diff --git a/.github/workflows/go.yml b/.github/workflows/go.yml index abf493c9..33a24351 100644 --- a/.github/workflows/go.yml +++ b/.github/workflows/go.yml @@ -27,7 +27,7 @@ env: # # https://github.com/golangci/golangci-lint/releases # - GOLANGCI_LINT_VERSION: "v2.10.1" + GOLANGCI_LINT_VERSION: "v2.11.4" jobs: checks-lint: @@ -76,15 +76,52 @@ jobs: with: go-version-file: go.mod - - name: Build - run: go build -v -mod=vendor . + - name: Build tables-to-go + run: | + go build -v -mod=vendor . - - name: Test + - name: Run unit tests shell: bash - run: go test -v -mod=vendor -race -coverprofile=coverage.txt ./... + run: | + go test -v -mod=vendor -race ./... + + # Run integration tests and coverage only on ubuntu-latest. + # + # Because there is no docker installed on MacOS, see here + # https://github.community/t5/GitHub-Actions/Why-is-Docker-not-installed-on-macOS/td-p/39364 + # + # And on Windows we get this error: + # + # vendor\github.com\ory\dockertest\docker\pkg\system\filesys_windows.go:113:24: + # cannot use uintptr(unsafe.Pointer(&sd[0])) (type uintptr) as type *"golang.org/x/sys/windows".SECURITY_DESCRIPTOR in assignment + # + integration-test: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v6 + + - uses: actions/setup-go@v6 + with: + go-version-file: go.mod + + - name: Run integration tests + run: | + go test -v -mod=vendor -race -tags=integration ./internal/integration_tests/... + + coverage: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v6 + + - uses: actions/setup-go@v6 + with: + go-version-file: go.mod + + - name: Run all tests with coverage + run: | + go test -v -mod=vendor -tags=integration -covermode=atomic -coverpkg=./... -coverprofile=coverage.txt ./... - name: Upload Coverage uses: codecov/codecov-action@v5 - if: matrix.os == 'ubuntu-latest' with: token: ${{ secrets.CODECOV_TOKEN }} diff --git a/.gitignore b/.gitignore index 42059cad..f909d54c 100644 --- a/.gitignore +++ b/.gitignore @@ -29,4 +29,11 @@ _testmain.go .DS_Store +.dev tables-to-go +coverage.txt + +internal/integration_tests/**/output + +AGENTS.md +plan.md diff --git a/Makefile b/Makefile index aebb60b4..38d9b5f3 100644 --- a/Makefile +++ b/Makefile @@ -1,4 +1,4 @@ -.PHONY: all build +.PHONY: all install test integration-test TAG=$(shell git describe --abbrev=0 --tags 2>&1) TS=$(shell date '+%b %d %Y %T') @@ -14,6 +14,12 @@ install: ## Installs tables-to-go. Requires `git` to be installed "-X 'main.buildTimestamp=$(TS)' -X 'main.versionTag=$(TAG)'" \ . +test: ## Runs unit tests with race flag enabled + go test -mod=vendor -race ./... + +integration-test: ## Runs integration tests + go test -mod=vendor -tags=integration ./internal/integration_tests/... + sqlite3: ## Installs tables-to-go with sqlite3 driver and the \ ## User Authentication feature enabled. \ ## For more information see the documentation of the driver at \ diff --git a/README.md b/README.md index 9f485d02..2633696f 100644 --- a/README.md +++ b/README.md @@ -57,7 +57,8 @@ containing the structs will get created (default: current working directory). * convert your tables to structs * table with name `a_foo_bar` will become file `AFooBar.go` with struct `AFooBar` * properly formatted files with imports -* automatically typed struct fields, either with `sql.Null*` or primitive pointer types +* automatically typed struct fields, either with `sql.Null*` or primitive `*builtinType` +pointer types * struct fields with `db`-tags for ready to use in database code * **partial support for [Masterminds/structable](https://github.com/Masterminds/structable)** * only primary key & auto increment columns supported @@ -66,7 +67,7 @@ containing the structs will get created (default: current working directory). * without `db`-tags * with or without `structable.Recorder` * **currently supported**: - * PostgreSQL (9.5 tested) + * PostgreSQL (10, 11, 12, 17, 18 tested) * MySQL (5.5+, 8 tested) * SQLite (3 tested) * currently, the following basic data types are supported: @@ -113,8 +114,8 @@ type SomeUserInfo struct { } ``` -The column `id` got automatically converted to upper-case to follow the idiomatic -go guidelines. +The column `id` got automatically converted to upper-case to follow the +idiomatic Go guidelines. See [here](https://github.com/golang/go/wiki/CodeReviewComments#initialisms) for more details. Words which gets converted can be found diff --git a/go.mod b/go.mod index 47376707..f93b61b8 100644 --- a/go.mod +++ b/go.mod @@ -1,21 +1,48 @@ module github.com/fraenky8/tables-to-go/v2 -go 1.26.0 +go 1.26 require ( + github.com/Masterminds/structable v0.0.0-20170407152004-a1a302ef78ec github.com/go-sql-driver/mysql v1.9.3 github.com/iancoleman/strcase v0.3.0 github.com/jmoiron/sqlx v1.4.0 - github.com/lib/pq v1.11.2 - github.com/mattn/go-sqlite3 v1.14.34 + github.com/lib/pq v1.12.3 + github.com/mattn/go-sqlite3 v1.14.42 + github.com/moby/moby/api v1.54.1 + github.com/moby/moby/client v0.4.0 + github.com/ory/dockertest/v4 v4.0.0-beta.4 github.com/stretchr/testify v1.11.1 - golang.org/x/text v0.34.0 + golang.org/x/text v0.36.0 ) require ( filippo.io/edwards25519 v1.2.0 // indirect + github.com/Masterminds/squirrel v1.5.4 // indirect + github.com/Microsoft/go-winio v0.6.2 // indirect + github.com/cenkalti/backoff/v5 v5.0.3 // indirect + github.com/cespare/xxhash/v2 v2.3.0 // indirect + github.com/containerd/errdefs v1.0.0 // indirect + github.com/containerd/errdefs/pkg v0.3.0 // indirect github.com/davecgh/go-spew v1.1.1 // indirect + github.com/distribution/reference v0.6.0 // indirect + github.com/docker/go-connections v0.6.0 // indirect + github.com/docker/go-units v0.5.0 // indirect + github.com/felixge/httpsnoop v1.0.4 // indirect + github.com/go-logr/logr v1.4.3 // indirect + github.com/go-logr/stdr v1.2.2 // indirect + github.com/lann/builder v0.0.0-20180802200727-47ae307949d0 // indirect + github.com/lann/ps v0.0.0-20150810152359-62de8c46ede0 // indirect + github.com/moby/docker-image-spec v1.3.1 // indirect + github.com/opencontainers/go-digest v1.0.0 // indirect + github.com/opencontainers/image-spec v1.1.1 // indirect github.com/pmezard/go-difflib v1.0.0 // indirect github.com/stretchr/objx v0.5.3 // indirect + go.opentelemetry.io/auto/sdk v1.2.1 // indirect + go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.68.0 // indirect + go.opentelemetry.io/otel v1.43.0 // indirect + go.opentelemetry.io/otel/metric v1.43.0 // indirect + go.opentelemetry.io/otel/trace v1.43.0 // indirect + golang.org/x/sys v0.43.0 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect ) diff --git a/go.sum b/go.sum index d76723fe..2cba4698 100644 --- a/go.sum +++ b/go.sum @@ -1,30 +1,105 @@ filippo.io/edwards25519 v1.1.0/go.mod h1:BxyFTGdWcka3PhytdK4V28tE5sGfRvvvRV7EaN4VDT4= filippo.io/edwards25519 v1.2.0 h1:crnVqOiS4jqYleHd9vaKZ+HKtHfllngJIiOpNpoJsjo= filippo.io/edwards25519 v1.2.0/go.mod h1:xzAOLCNug/yB62zG1bQ8uziwrIqIuxhctzJT18Q77mc= +github.com/Masterminds/squirrel v1.5.4 h1:uUcX/aBc8O7Fg9kaISIUsHXdKuqehiXAMQTYX8afzqM= +github.com/Masterminds/squirrel v1.5.4/go.mod h1:NNaOrjSoIDfDA40n7sr2tPNZRfjzjA400rg+riTZj10= +github.com/Masterminds/structable v0.0.0-20170407152004-a1a302ef78ec h1:zchF0NAt+UR7iOTb+htQIauAUh3tv7xuHBWqrj6VlBk= +github.com/Masterminds/structable v0.0.0-20170407152004-a1a302ef78ec/go.mod h1:CBK/3s101oxmHZ6XJtdD3yKaeG6aRNi7TVVzJiWpMIY= +github.com/Microsoft/go-winio v0.6.2 h1:F2VQgta7ecxGYO8k3ZZz3RS8fVIXVxONVUPlNERoyfY= +github.com/Microsoft/go-winio v0.6.2/go.mod h1:yd8OoFMLzJbo9gZq8j5qaps8bJ9aShtEA8Ipt1oGCvU= +github.com/cenkalti/backoff/v5 v5.0.3 h1:ZN+IMa753KfX5hd8vVaMixjnqRZ3y8CuJKRKj1xcsSM= +github.com/cenkalti/backoff/v5 v5.0.3/go.mod h1:rkhZdG3JZukswDf7f0cwqPNk4K0sa+F97BxZthm/crw= +github.com/cespare/xxhash/v2 v2.3.0 h1:UL815xU9SqsFlibzuggzjXhog7bL6oX9BbNZnL2UFvs= +github.com/cespare/xxhash/v2 v2.3.0/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XLFGgcrjCOs= +github.com/containerd/errdefs v1.0.0 h1:tg5yIfIlQIrxYtu9ajqY42W3lpS19XqdxRQeEwYG8PI= +github.com/containerd/errdefs v1.0.0/go.mod h1:+YBYIdtsnF4Iw6nWZhJcqGSg/dwvV7tyJ/kCkyJ2k+M= +github.com/containerd/errdefs/pkg v0.3.0 h1:9IKJ06FvyNlexW690DXuQNx2KA2cUJXx151Xdx3ZPPE= +github.com/containerd/errdefs/pkg v0.3.0/go.mod h1:NJw6s9HwNuRhnjJhM7pylWwMyAkmCQvQ4GpJHEqRLVk= 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/distribution/reference v0.6.0 h1:0IXCQ5g4/QMHHkarYzh5l+u8T3t73zM5QvfrDyIgxBk= +github.com/distribution/reference v0.6.0/go.mod h1:BbU0aIcezP1/5jX/8MP0YiH4SdvB5Y4f/wlDRiLyi3E= +github.com/docker/go-connections v0.6.0 h1:LlMG9azAe1TqfR7sO+NJttz1gy6KO7VJBh+pMmjSD94= +github.com/docker/go-connections v0.6.0/go.mod h1:AahvXYshr6JgfUJGdDCs2b5EZG/vmaMAntpSFH5BFKE= +github.com/docker/go-units v0.5.0 h1:69rxXcBk27SvSaaxTtLh/8llcHD8vYHT7WSdRZ/jvr4= +github.com/docker/go-units v0.5.0/go.mod h1:fgPhTUdO+D/Jk86RDLlptpiXQzgHJF7gydDDbaIK4Dk= +github.com/felixge/httpsnoop v1.0.4 h1:NFTV2Zj1bL4mc9sqWACXbQFVBBg2W3GPvqp8/ESS2Wg= +github.com/felixge/httpsnoop v1.0.4/go.mod h1:m8KPJKqk1gH5J9DgRY2ASl2lWCfGKXixSwevea8zH2U= +github.com/go-logr/logr v1.2.2/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A= +github.com/go-logr/logr v1.4.3 h1:CjnDlHq8ikf6E492q6eKboGOC0T8CDaOvkHCIg8idEI= +github.com/go-logr/logr v1.4.3/go.mod h1:9T104GzyrTigFIr8wt5mBrctHMim0Nb2HLGrmQ40KvY= +github.com/go-logr/stdr v1.2.2 h1:hSWxHoqTgW2S2qGc0LTAI563KZ5YKYRhT3MFKZMbjag= +github.com/go-logr/stdr v1.2.2/go.mod h1:mMo/vtBO5dYbehREoey6XUKy/eSumjCCveDpRre4VKE= github.com/go-sql-driver/mysql v1.8.1/go.mod h1:wEBSXgmK//2ZFJyE+qWnIsVGmvmEKlqwuVSjsCm7DZg= github.com/go-sql-driver/mysql v1.9.3 h1:U/N249h2WzJ3Ukj8SowVFjdtZKfu9vlLZxjPXV1aweo= github.com/go-sql-driver/mysql v1.9.3/go.mod h1:qn46aNg1333BRMNU69Lq93t8du/dwxI64Gl8i5p1WMU= +github.com/google/go-cmp v0.7.0 h1:wk8382ETsv4JYUZwIsn6YpYiWiBsYLSJiTsyBybVuN8= +github.com/google/go-cmp v0.7.0/go.mod h1:pXiqmnSA92OHEEa9HXL2W4E7lf9JzCmGVUdgjX3N/iU= +github.com/google/uuid v1.6.0 h1:NIvaJDMOsjHA8n1jAhLSgzrAzy1Hgr+hNrb57e+94F0= +github.com/google/uuid v1.6.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= github.com/iancoleman/strcase v0.3.0 h1:nTXanmYxhfFAMjZL34Ov6gkzEsSJZ5DbhxWjvSASxEI= github.com/iancoleman/strcase v0.3.0/go.mod h1:iwCmte+B7n89clKwxIoIXy/HfoL7AsD47ZCWhYzw7ho= github.com/jmoiron/sqlx v1.4.0 h1:1PLqN7S1UYp5t4SrVVnt4nUVNemrDAtxlulVe+Qgm3o= github.com/jmoiron/sqlx v1.4.0/go.mod h1:ZrZ7UsYB/weZdl2Bxg6jCRO9c3YHl8r3ahlKmRT4JLY= +github.com/kr/pretty v0.3.1 h1:flRD4NNwYAUpkphVc1HcthR4KEIFJ65n8Mw5qdRn3LE= +github.com/kr/pretty v0.3.1/go.mod h1:hoEshYVHaxMs3cyo3Yncou5ZscifuDolrwPKZanG3xk= +github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY= +github.com/kr/text v0.2.0/go.mod h1:eLer722TekiGuMkidMxC/pM04lWEeraHUUmBw8l2grE= +github.com/lann/builder v0.0.0-20180802200727-47ae307949d0 h1:SOEGU9fKiNWd/HOJuq6+3iTQz8KNCLtVX6idSoTLdUw= +github.com/lann/builder v0.0.0-20180802200727-47ae307949d0/go.mod h1:dXGbAdH5GtBTC4WfIxhKZfyBF/HBFgRZSWwZ9g/He9o= +github.com/lann/ps v0.0.0-20150810152359-62de8c46ede0 h1:P6pPBnrTSX3DEVR4fDembhRWSsG5rVo6hYhAB/ADZrk= +github.com/lann/ps v0.0.0-20150810152359-62de8c46ede0/go.mod h1:vmVJ0l/dxyfGW6FmdpVm2joNMFikkuWg0EoCKLGUMNw= github.com/lib/pq v1.10.9/go.mod h1:AlVN5x4E4T544tWzH6hKfbfQvm3HdbOxrmggDNAPY9o= -github.com/lib/pq v1.11.2 h1:x6gxUeu39V0BHZiugWe8LXZYZ+Utk7hSJGThs8sdzfs= -github.com/lib/pq v1.11.2/go.mod h1:/p+8NSbOcwzAEI7wiMXFlgydTwcgTr3OSKMsD2BitpA= +github.com/lib/pq v1.12.3 h1:tTWxr2YLKwIvK90ZXEw8GP7UFHtcbTtty8zsI+YjrfQ= +github.com/lib/pq v1.12.3/go.mod h1:/p+8NSbOcwzAEI7wiMXFlgydTwcgTr3OSKMsD2BitpA= github.com/mattn/go-sqlite3 v1.14.22/go.mod h1:Uh1q+B4BYcTPb+yiD3kU8Ct7aC0hY9fxUwlHK0RXw+Y= -github.com/mattn/go-sqlite3 v1.14.34 h1:3NtcvcUnFBPsuRcno8pUtupspG/GM+9nZ88zgJcp6Zk= -github.com/mattn/go-sqlite3 v1.14.34/go.mod h1:Uh1q+B4BYcTPb+yiD3kU8Ct7aC0hY9fxUwlHK0RXw+Y= +github.com/mattn/go-sqlite3 v1.14.42 h1:MigqEP4ZmHw3aIdIT7T+9TLa90Z6smwcthx+Azv4Cgo= +github.com/mattn/go-sqlite3 v1.14.42/go.mod h1:pjEuOr8IwzLJP2MfGeTb0A35jauH+C2kbHKBr7yXKVQ= +github.com/moby/docker-image-spec v1.3.1 h1:jMKff3w6PgbfSa69GfNg+zN/XLhfXJGnEx3Nl2EsFP0= +github.com/moby/docker-image-spec v1.3.1/go.mod h1:eKmb5VW8vQEh/BAr2yvVNvuiJuY6UIocYsFu/DxxRpo= +github.com/moby/moby/api v1.54.1 h1:TqVzuJkOLsgLDDwNLmYqACUuTehOHRGKiPhvH8V3Nn4= +github.com/moby/moby/api v1.54.1/go.mod h1:+RQ6wluLwtYaTd1WnPLykIDPekkuyD/ROWQClE83pzs= +github.com/moby/moby/client v0.4.0 h1:S+2XegzHQrrvTCvF6s5HFzcrywWQmuVnhOXe2kiWjIw= +github.com/moby/moby/client v0.4.0/go.mod h1:QWPbvWchQbxBNdaLSpoKpCdf5E+WxFAgNHogCWDoa7g= +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/image-spec v1.1.1 h1:y0fUlFfIZhPF1W537XOLg0/fcx6zcHCJwooC2xJA040= +github.com/opencontainers/image-spec v1.1.1/go.mod h1:qpqAh3Dmcf36wStyyWU+kCeDgrGnAve2nCC8+7h8Q0M= +github.com/ory/dockertest/v4 v4.0.0-beta.4 h1:QcrNrobOP+5IjSDmS4//EuBtwiFuznQhi5xTe8oFSoM= +github.com/ory/dockertest/v4 v4.0.0-beta.4/go.mod h1:p9kfE14tzK8+WU4F9YbIZlzhCzQ2pH7H1KIfBKrF3DM= 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/rogpeppe/go-internal v1.14.1 h1:UQB4HGPB6osV0SQTLymcB4TgvyWu6ZyliaW0tI/otEQ= +github.com/rogpeppe/go-internal v1.14.1/go.mod h1:MaRKkUm5W0goXpeCfT7UZI6fk/L7L7so1lCWt35ZSgc= github.com/stretchr/objx v0.5.3 h1:jmXUvGomnU1o3W/V5h2VEradbpJDwGrzugQQvL0POH4= github.com/stretchr/objx v0.5.3/go.mod h1:rDQraq+vQZU7Fde9LOZLr8Tax6zZvy4kuNKF+QYS+U0= +github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs= github.com/stretchr/testify v1.11.1 h1:7s2iGBzp5EwR7/aIZr8ao5+dra3wiQyKjjFuvgVKu7U= github.com/stretchr/testify v1.11.1/go.mod h1:wZwfW3scLgRK+23gO65QZefKpKQRnfz6sD981Nm4B6U= -golang.org/x/text v0.34.0 h1:oL/Qq0Kdaqxa1KbNeMKwQq0reLCCaFtqu2eNuSeNHbk= -golang.org/x/text v0.34.0/go.mod h1:homfLqTYRFyVYemLBFl5GgL/DWEiH5wcsQ5gSh1yziA= -gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405 h1:yhCVgyC4o1eVCa2tZl7eS0r+SDo693bJlVdllGtEeKM= +go.opentelemetry.io/auto/sdk v1.2.1 h1:jXsnJ4Lmnqd11kwkBV2LgLoFMZKizbCi5fNZ/ipaZ64= +go.opentelemetry.io/auto/sdk v1.2.1/go.mod h1:KRTj+aOaElaLi+wW1kO/DZRXwkF4C5xPbEe3ZiIhN7Y= +go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.68.0 h1:CqXxU8VOmDefoh0+ztfGaymYbhdB/tT3zs79QaZTNGY= +go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.68.0/go.mod h1:BuhAPThV8PBHBvg8ZzZ/Ok3idOdhWIodywz2xEcRbJo= +go.opentelemetry.io/otel v1.43.0 h1:mYIM03dnh5zfN7HautFE4ieIig9amkNANT+xcVxAj9I= +go.opentelemetry.io/otel v1.43.0/go.mod h1:JuG+u74mvjvcm8vj8pI5XiHy1zDeoCS2LB1spIq7Ay0= +go.opentelemetry.io/otel/metric v1.43.0 h1:d7638QeInOnuwOONPp4JAOGfbCEpYb+K6DVWvdxGzgM= +go.opentelemetry.io/otel/metric v1.43.0/go.mod h1:RDnPtIxvqlgO8GRW18W6Z/4P462ldprJtfxHxyKd2PY= +go.opentelemetry.io/otel/sdk v1.43.0 h1:pi5mE86i5rTeLXqoF/hhiBtUNcrAGHLKQdhg4h4V9Dg= +go.opentelemetry.io/otel/sdk v1.43.0/go.mod h1:P+IkVU3iWukmiit/Yf9AWvpyRDlUeBaRg6Y+C58QHzg= +go.opentelemetry.io/otel/sdk/metric v1.43.0 h1:S88dyqXjJkuBNLeMcVPRFXpRw2fuwdvfCGLEo89fDkw= +go.opentelemetry.io/otel/sdk/metric v1.43.0/go.mod h1:C/RJtwSEJ5hzTiUz5pXF1kILHStzb9zFlIEe85bhj6A= +go.opentelemetry.io/otel/trace v1.43.0 h1:BkNrHpup+4k4w+ZZ86CZoHHEkohws8AY+WTX09nk+3A= +go.opentelemetry.io/otel/trace v1.43.0/go.mod h1:/QJhyVBUUswCphDVxq+8mld+AvhXZLhe+8WVFxiFff0= +golang.org/x/sys v0.43.0 h1:Rlag2XtaFTxp19wS8MXlJwTvoh8ArU6ezoyFsMyCTNI= +golang.org/x/sys v0.43.0/go.mod h1:4GL1E5IUh+htKOUEOaiffhrAeqysfVGipDYzABqnCmw= +golang.org/x/text v0.36.0 h1:JfKh3XmcRPqZPKevfXVpI1wXPTqbkE5f7JA92a55Yxg= +golang.org/x/text v0.36.0/go.mod h1:NIdBknypM8iqVmPiuco0Dh6P5Jcdk8lJL0CUebqK164= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= +gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c h1:Hei/4ADfdWqJk1ZMxUNpqntNwaWcugrBjAiHlqqRiVk= +gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c/go.mod h1:JHkPIbrfpd72SG/EVd6muEfDQjcINNoR0C8j2r3qZ4Q= gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= +gotest.tools/v3 v3.5.2 h1:7koQfIKdy+I8UTetycgUqXWSDwpgv193Ka+qRsmBY8Q= +gotest.tools/v3 v3.5.2/go.mod h1:LtdLGcnqToBH83WByAAi/wiwSFCArdFIUV/xxN4pcjA= +pgregory.net/rapid v1.2.0 h1:keKAYRcjm+e1F0oAuU5F5+YPAWcyxNNRK2wud503Gnk= +pgregory.net/rapid v1.2.0/go.mod h1:PY5XlDGj0+V1FCq0o192FdRhpKHGTRIWBgqjDBTrq04= diff --git a/internal/cli/tables-to-go-cli.go b/internal/cli/tables-to-go-cli.go index 7addc621..a060fc66 100644 --- a/internal/cli/tables-to-go-cli.go +++ b/internal/cli/tables-to-go-cli.go @@ -102,8 +102,7 @@ func (c columnInfo) isNullableOrTemporal() bool { func createTableStructString(settings *settings.Settings, db database.Database, table *database.Table) (string, string, error) { - var structFields strings.Builder - tableName := caser.String(settings.Prefix + table.Name + settings.Suffix) + tableName := caser.String(settings.Prefix) + caser.String(table.Name) + caser.String(settings.Suffix) // Replace any whitespace with underscores tableName = strings.Map(replaceSpace, tableName) if settings.IsOutputFormatCamelCase() { @@ -115,9 +114,11 @@ func createTableStructString(settings *settings.Settings, db database.Database, return "", "", fmt.Errorf("table name %q contains invalid characters", table.Name) } - columnInfo := columnInfo{} - columns := map[string]struct{}{} - + var ( + structFields strings.Builder + columnInfo columnInfo + columns = make(map[string]struct{}, len(table.Columns)) + ) for _, column := range table.Columns { columnName, err := formatColumnName(settings, column.Name, table.Name) if err != nil { @@ -216,13 +217,13 @@ func mapDbColumnTypeToGoType(s *settings.Settings, db database.Database, column columnInfo.isNullable = true } } else if db.IsTemporal(column) { - if !db.IsNullable(column) { - goType = "time.Time" - columnInfo.isTemporal = true - } else { + if db.IsNullable(column) { goType = getNullType(s, "*time.Time", "sql.NullTime") - columnInfo.isTemporal = s.Null == settings.NullTypeNative + columnInfo.isTemporal = !s.IsNullTypeSQL() columnInfo.isNullable = true + } else { + goType = "time.Time" + columnInfo.isTemporal = true } } else { // TODO handle special data types @@ -264,7 +265,7 @@ func camelCaseString(s string) string { return cc.String() } -func getNullType(settings *settings.Settings, primitive string, sql string) string { +func getNullType(settings *settings.Settings, primitive, sql string) string { if settings.IsNullTypeSQL() { return sql } diff --git a/internal/integration_tests/integration_test.go b/internal/integration_tests/integration_test.go new file mode 100644 index 00000000..83aded0f --- /dev/null +++ b/internal/integration_tests/integration_test.go @@ -0,0 +1,1246 @@ +//go:build integration + +package integration_tests + +import ( + "bytes" + "context" + "fmt" + "log" + "os" + "os/signal" + "path/filepath" + "sort" + "strconv" + "syscall" + "testing" + "time" + + "github.com/go-sql-driver/mysql" + "github.com/jmoiron/sqlx" + "github.com/moby/moby/api/types/container" + "github.com/ory/dockertest/v4" + "github.com/stretchr/testify/assert" + + "github.com/fraenky8/tables-to-go/v2/internal/cli" + "github.com/fraenky8/tables-to-go/v2/pkg/database" + "github.com/fraenky8/tables-to-go/v2/pkg/output" + "github.com/fraenky8/tables-to-go/v2/pkg/settings" +) + +const ( + testdataDirectoryName = "testdata" + outputDirectoryName = "output" +) + +var ( + pool dockertest.ClosablePool +) + +// nopLogger is used to silence MySQL logs of "packets.go:36: unexpected EOF". +type nopLogger struct{} + +func (nopLogger) Print(...any) {} + +var ( + isCI bool +) + +func init() { + isCI, _ = strconv.ParseBool(os.Getenv("CI")) + + // Suppress logs of "packets.go:36: unexpected EOF" + _ = mysql.SetLogger(nopLogger{}) +} + +type testSettings struct { + *settings.Settings + + // root filepath where the test can store its testdata and any (expected) output + filepath string + // the actual directory for that particular test under the filepath root + testDirectory string + + dockerImage string + version string + tmpfs map[string]string + cmd []string + env []string +} + +func newMySQLSettings(version, path, testDirectory string) *testSettings { + s := settings.New() + s.DbType = settings.DBTypeMySQL + s.User = "root" + s.Pswd = "mysecretpassword" + s.DbName = "public" + s.Host = "localhost" + s.Port = "3306" + s.OutputFilePath = filepath.Join(path, testDirectory, outputDirectoryName) + + return &testSettings{ + Settings: s, + filepath: path, + testDirectory: testDirectory, + dockerImage: "mysql", + version: version, + tmpfs: map[string]string{"/var/lib/mysql": ""}, + cmd: []string{ + "--skip-log-bin", + "--innodb_flush_log_at_trx_commit=2", + "--sync_binlog=0", + }, + env: []string{ + "MYSQL_DATABASE=" + s.DbName, + "MYSQL_ROOT_PASSWORD=" + s.Pswd, + }, + } +} + +func newPostgresSettings(version, path, testDirectory string) *testSettings { + s := settings.New() + s.DbType = settings.DBTypePostgresql + s.User = "postgres" + s.Pswd = "mysecretpassword" + s.DbName = "postgres" + s.Schema = "public" + s.Host = "localhost" + s.Port = "5432" + s.SSLMode = "disable" + s.OutputFilePath = filepath.Join(path, testDirectory, outputDirectoryName) + + return &testSettings{ + Settings: s, + filepath: path, + testDirectory: testDirectory, + dockerImage: "postgres", + version: version, + tmpfs: map[string]string{"/var/lib/postgresql": ""}, + cmd: []string{ + "postgres", + "-c", "fsync=off", + "-c", "full_page_writes=off", + "-c", "synchronous_commit=off", + }, + env: []string{ + "POSTGRES_DB=" + s.DbName, + "POSTGRES_PASSWORD=" + s.Pswd, + }, + } +} + +func TestMain(m *testing.M) { + ctx := context.Background() + + logMsg := "running Tables-to-Go integration tests" + if isCI { + logMsg += " on CI" + } + log.Println(logMsg) + + log.Println("creating Docker pool...") + + var err error + pool, err = dockertest.NewPool(ctx, "") + if err != nil { + log.Fatalf("error connecting to Docker: %v", err) + } + + ctx = registerCleanupSignalHandler(ctx) + + code := m.Run() + + err = pool.Close(ctx) + if err != nil { + // No need to log.Fatal here, this is just informative. + log.Printf("warning: error closing Docker pool: %v", err) + } + + os.Exit(code) +} + +func registerCleanupSignalHandler(ctx context.Context) context.Context { + signals := []os.Signal{syscall.SIGTERM, syscall.SIGQUIT, syscall.SIGINT} + done, stop := signal.NotifyContext(ctx, signals...) + go func() { + defer stop() + select { + case <-done.Done(): + log.Println("got signal:", context.Cause(done)) + log.Println("removing container...") + _ = pool.Close(ctx) + // Ignoring error here because it might be called multiple times due + // to multiple signals arriving. The first of them will remove the + // container already leading subsequent calls error. But we are not + // interested in an error saying that the container does not exist (anymore). + } + }() + return done +} + +func TestIntegrationDefaultSettings(t *testing.T) { + const testDirectory = "defaultsettings" + + tests := []struct { + desc string + settings *testSettings + }{ + { + desc: "mysql 5", + settings: newMySQLSettings("5", "mysql5", testDirectory), + }, + { + desc: "mysql 8", + settings: newMySQLSettings("8", "mysql8", testDirectory), + }, + { + desc: "postgres 10", + settings: newPostgresSettings("10", "postgres", testDirectory), + }, + { + desc: "postgres 11", + settings: newPostgresSettings("11", "postgres", testDirectory), + }, + { + desc: "postgres 12", + settings: newPostgresSettings("12", "postgres", testDirectory), + }, + { + desc: "postgres 17", + settings: newPostgresSettings("17", "postgres", testDirectory), + }, + { + desc: "postgres 18", + settings: newPostgresSettings("18", "postgres", testDirectory), + }, + } + + for _, test := range tests { + t.Run(test.desc, func(t *testing.T) { + db := setupDatabase(t, test.settings) + defer func() { + if !t.Failed() { + _ = os.RemoveAll(test.settings.Settings.OutputFilePath) + } + }() + + loadTestData(t, db.SQLDriver(), test.settings) + + err := os.MkdirAll(test.settings.Settings.OutputFilePath, 0755) + if err != nil { + t.Fatalf("could not create output file path: %v", err) + } + + version, err := db.Version() + if err != nil { + t.Logf("could not get version: %v", err) + } else { + t.Logf("running tests against database %s\n", version) + } + + writer := output.NewFileWriter(test.settings.Settings.OutputFilePath) + + err = cli.Run(test.settings.Settings, db, writer) + assert.NoError(t, err) + + checkFiles(t, test.settings) + }) + } +} + +func TestIntegrationNullTypePrimitive(t *testing.T) { + const testDirectory = "nulltypeprimitive" + + tests := []struct { + desc string + settings *testSettings + }{ + { + desc: "mysql 5", + settings: func() *testSettings { + s := newMySQLSettings("5", "mysql5", testDirectory) + s.Null = settings.NullTypePrimitive + return s + }(), + }, + { + desc: "mysql 8", + settings: func() *testSettings { + s := newMySQLSettings("8", "mysql8", testDirectory) + s.Null = settings.NullTypePrimitive + return s + }(), + }, + { + desc: "postgres 10", + settings: func() *testSettings { + s := newPostgresSettings("10", "postgres", testDirectory) + s.Null = settings.NullTypePrimitive + return s + }(), + }, + { + desc: "postgres 11", + settings: func() *testSettings { + s := newPostgresSettings("11", "postgres", testDirectory) + s.Null = settings.NullTypePrimitive + return s + }(), + }, + { + desc: "postgres 12", + settings: func() *testSettings { + s := newPostgresSettings("12", "postgres", testDirectory) + s.Null = settings.NullTypePrimitive + return s + }(), + }, + { + desc: "postgres 17", + settings: func() *testSettings { + s := newPostgresSettings("17", "postgres", testDirectory) + s.Null = settings.NullTypePrimitive + return s + }(), + }, + { + desc: "postgres 18", + settings: func() *testSettings { + s := newPostgresSettings("18", "postgres", testDirectory) + s.Null = settings.NullTypePrimitive + return s + }(), + }, + } + + for _, test := range tests { + t.Run(test.desc, func(t *testing.T) { + db := setupDatabase(t, test.settings) + defer func() { + if !t.Failed() { + _ = os.RemoveAll(test.settings.Settings.OutputFilePath) + } + }() + + loadTestData(t, db.SQLDriver(), test.settings) + + err := os.MkdirAll(test.settings.Settings.OutputFilePath, 0755) + if err != nil { + t.Fatalf("could not create output file path: %v", err) + } + + version, err := db.Version() + if err != nil { + t.Logf("could not get version: %v", err) + } else { + t.Logf("running tests against database %s\n", version) + } + + writer := output.NewFileWriter(test.settings.Settings.OutputFilePath) + + err = cli.Run(test.settings.Settings, db, writer) + assert.NoError(t, err) + + checkFiles(t, test.settings) + }) + } +} + +func TestIntegrationTablesFlag(t *testing.T) { + const testDirectory = "tablesflag" + + tests := []struct { + desc string + settings *testSettings + }{ + { + desc: "mysql 5", + settings: func() *testSettings { + s := newMySQLSettings("5", "mysql5", testDirectory) + // Note: int_table non-existing + s.Tables = settings.StringsFlag{"datetime_table", "float_table", "int_table", "varchar_table"} + return s + }(), + }, + { + desc: "mysql 8", + settings: func() *testSettings { + s := newMySQLSettings("8", "mysql8", testDirectory) + // Note: int_table non-existing + s.Tables = settings.StringsFlag{"datetime_table", "float_table", "int_table", "varchar_table", "user"} + return s + }(), + }, + { + desc: "postgres 10", + settings: func() *testSettings { + s := newPostgresSettings("10", "postgres", testDirectory) + // Note: int_table non-existing + s.Tables = settings.StringsFlag{"date", "float", "int_table", "varchar"} + return s + }(), + }, + { + desc: "postgres 11", + settings: func() *testSettings { + s := newPostgresSettings("11", "postgres", testDirectory) + // Note: int_table non-existing + s.Tables = settings.StringsFlag{"date", "float", "int_table", "varchar"} + return s + }(), + }, + { + desc: "postgres 12", + settings: func() *testSettings { + s := newPostgresSettings("12", "postgres", testDirectory) + // Note: int_table non-existing + s.Tables = settings.StringsFlag{"date", "float", "int_table", "varchar"} + return s + }(), + }, + { + desc: "postgres 17", + settings: func() *testSettings { + s := newPostgresSettings("17", "postgres", testDirectory) + // Note: int_table non-existing + s.Tables = settings.StringsFlag{"date", "float", "int_table", "varchar"} + return s + }(), + }, + { + desc: "postgres 18", + settings: func() *testSettings { + s := newPostgresSettings("18", "postgres", testDirectory) + // Note: int_table non-existing + s.Tables = settings.StringsFlag{"date", "float", "int_table", "varchar"} + return s + }(), + }, + } + + for _, test := range tests { + t.Run(test.desc, func(t *testing.T) { + db := setupDatabase(t, test.settings) + defer func() { + if !t.Failed() { + _ = os.RemoveAll(test.settings.Settings.OutputFilePath) + } + }() + + loadTestData(t, db.SQLDriver(), test.settings) + + err := os.MkdirAll(test.settings.Settings.OutputFilePath, 0755) + if err != nil { + t.Fatalf("could not create output file path: %v", err) + } + + version, err := db.Version() + if err != nil { + t.Logf("could not get version: %v", err) + } else { + t.Logf("running tests against database %s\n", version) + } + + writer := output.NewFileWriter(test.settings.Settings.OutputFilePath) + + err = cli.Run(test.settings.Settings, db, writer) + assert.NoError(t, err) + + checkFiles(t, test.settings) + }) + } +} + +func TestIntegrationOutputFormatOriginal(t *testing.T) { + const testDirectory = "outputformatoriginal" + + tests := []struct { + desc string + settings *testSettings + }{ + { + desc: "mysql 8", + settings: func() *testSettings { + s := newMySQLSettings("8", "mysql8", testDirectory) + s.OutputFormat = settings.OutputFormatOriginal + + // Only set to reduce the amount of files + s.Tables = settings.StringsFlag{"datetime_table", "float_table", "integer_table", "varchar_table", "user"} + + return s + }(), + }, + // Skipping all other DB types since it's not related to the type itself, + // and testing for one type covers all others. + } + + for _, test := range tests { + t.Run(test.desc, func(t *testing.T) { + db := setupDatabase(t, test.settings) + defer func() { + if !t.Failed() { + _ = os.RemoveAll(test.settings.Settings.OutputFilePath) + } + }() + + loadTestData(t, db.SQLDriver(), test.settings) + + err := os.MkdirAll(test.settings.Settings.OutputFilePath, 0755) + if err != nil { + t.Fatalf("could not create output file path: %v", err) + } + + version, err := db.Version() + if err != nil { + t.Logf("could not get version: %v", err) + } else { + t.Logf("running tests against database %s\n", version) + } + + writer := output.NewFileWriter(test.settings.Settings.OutputFilePath) + + err = cli.Run(test.settings.Settings, db, writer) + assert.NoError(t, err) + + checkFiles(t, test.settings) + }) + } +} + +func TestIntegrationFileNameFormatSnakeCase(t *testing.T) { + const testDirectory = "filenameformatsnakecase" + + tests := []struct { + desc string + settings *testSettings + }{ + { + desc: "mysql 8", + settings: func() *testSettings { + s := newMySQLSettings("8", "mysql8", testDirectory) + s.FileNameFormat = settings.FileNameFormatSnakeCase + + // Only set to reduce the amount of files + s.Tables = settings.StringsFlag{"datetime_table", "float_table", "integer_table", "varchar_table", "user"} + + return s + }(), + }, + // Skipping all other DB types since it's not related to the type itself, + // and testing for one type covers all others. + } + + for _, test := range tests { + t.Run(test.desc, func(t *testing.T) { + db := setupDatabase(t, test.settings) + defer func() { + if !t.Failed() { + _ = os.RemoveAll(test.settings.Settings.OutputFilePath) + } + }() + + loadTestData(t, db.SQLDriver(), test.settings) + + err := os.MkdirAll(test.settings.Settings.OutputFilePath, 0755) + if err != nil { + t.Fatalf("could not create output file path: %v", err) + } + + version, err := db.Version() + if err != nil { + t.Logf("could not get version: %v", err) + } else { + t.Logf("running tests against database %s\n", version) + } + + writer := output.NewFileWriter(test.settings.Settings.OutputFilePath) + + err = cli.Run(test.settings.Settings, db, writer) + assert.NoError(t, err) + + checkFiles(t, test.settings) + }) + } +} + +func TestIntegrationPackageName(t *testing.T) { + const testDirectory = "packagename" + + tests := []struct { + desc string + settings *testSettings + }{ + { + desc: "mysql 8", + settings: func() *testSettings { + s := newMySQLSettings("8", "mysql8", testDirectory) + s.PackageName = "models" + + // Only set to reduce the amount of files + s.Tables = settings.StringsFlag{"datetime_table", "float_table", "integer_table", "varchar_table", "user"} + + return s + }(), + }, + // Skipping all other DB types since it's not related to the type itself, + // and testing for one type covers all others. + } + + for _, test := range tests { + t.Run(test.desc, func(t *testing.T) { + db := setupDatabase(t, test.settings) + defer func() { + if !t.Failed() { + _ = os.RemoveAll(test.settings.Settings.OutputFilePath) + } + }() + + loadTestData(t, db.SQLDriver(), test.settings) + + err := os.MkdirAll(test.settings.Settings.OutputFilePath, 0755) + if err != nil { + t.Fatalf("could not create output file path: %v", err) + } + + version, err := db.Version() + if err != nil { + t.Logf("could not get version: %v", err) + } else { + t.Logf("running tests against database %s\n", version) + } + + writer := output.NewFileWriter(test.settings.Settings.OutputFilePath) + + err = cli.Run(test.settings.Settings, db, writer) + assert.NoError(t, err) + + checkFiles(t, test.settings) + }) + } +} + +func TestIntegrationPrefix(t *testing.T) { + const testDirectory = "prefix" + + tests := []struct { + desc string + settings *testSettings + }{ + { + desc: "mysql 8", + settings: func() *testSettings { + s := newMySQLSettings("8", "mysql8", testDirectory) + s.Prefix = "Prefix_" + + // Only set to reduce the amount of files + s.Tables = settings.StringsFlag{"datetime_table", "float_table", "integer_table", "varchar_table", "user"} + + return s + }(), + }, + // Skipping all other DB types since it's not related to the type itself, + // and testing for one type covers all others. + } + + for _, test := range tests { + t.Run(test.desc, func(t *testing.T) { + db := setupDatabase(t, test.settings) + defer func() { + if !t.Failed() { + _ = os.RemoveAll(test.settings.Settings.OutputFilePath) + } + }() + + loadTestData(t, db.SQLDriver(), test.settings) + + err := os.MkdirAll(test.settings.Settings.OutputFilePath, 0755) + if err != nil { + t.Fatalf("could not create output file path: %v", err) + } + + version, err := db.Version() + if err != nil { + t.Logf("could not get version: %v", err) + } else { + t.Logf("running tests against database %s\n", version) + } + + writer := output.NewFileWriter(test.settings.Settings.OutputFilePath) + + err = cli.Run(test.settings.Settings, db, writer) + assert.NoError(t, err) + + checkFiles(t, test.settings) + }) + } +} + +func TestIntegrationSuffix(t *testing.T) { + const testDirectory = "suffix" + + tests := []struct { + desc string + settings *testSettings + }{ + { + desc: "mysql 8", + settings: func() *testSettings { + s := newMySQLSettings("8", "mysql8", testDirectory) + s.Suffix = "_Suffix" + + // Only set to reduce the amount of files + s.Tables = settings.StringsFlag{"datetime_table", "float_table", "integer_table", "varchar_table", "user"} + + return s + }(), + }, + // Skipping all other DB types since it's not related to the type itself, + // and testing for one type covers all others. + } + + for _, test := range tests { + t.Run(test.desc, func(t *testing.T) { + db := setupDatabase(t, test.settings) + defer func() { + if !t.Failed() { + _ = os.RemoveAll(test.settings.Settings.OutputFilePath) + } + }() + + loadTestData(t, db.SQLDriver(), test.settings) + + err := os.MkdirAll(test.settings.Settings.OutputFilePath, 0755) + if err != nil { + t.Fatalf("could not create output file path: %v", err) + } + + version, err := db.Version() + if err != nil { + t.Logf("could not get version: %v", err) + } else { + t.Logf("running tests against database %s\n", version) + } + + writer := output.NewFileWriter(test.settings.Settings.OutputFilePath) + + err = cli.Run(test.settings.Settings, db, writer) + assert.NoError(t, err) + + checkFiles(t, test.settings) + }) + } +} + +func TestIntegrationPrefixSuffix(t *testing.T) { + const testDirectory = "prefixsuffix" + + tests := []struct { + desc string + settings *testSettings + }{ + { + desc: "mysql 8", + settings: func() *testSettings { + s := newMySQLSettings("8", "mysql8", testDirectory) + s.Prefix = "Prefix_" + s.Suffix = "_Suffix" + + // Only set to reduce the amount of files + s.Tables = settings.StringsFlag{"datetime_table", "float_table", "integer_table", "varchar_table", "user"} + + return s + }(), + }, + // Skipping all other DB types since it's not related to the type itself, + // and testing for one type covers all others. + } + + for _, test := range tests { + t.Run(test.desc, func(t *testing.T) { + db := setupDatabase(t, test.settings) + defer func() { + if !t.Failed() { + _ = os.RemoveAll(test.settings.Settings.OutputFilePath) + } + }() + + loadTestData(t, db.SQLDriver(), test.settings) + + err := os.MkdirAll(test.settings.Settings.OutputFilePath, 0755) + if err != nil { + t.Fatalf("could not create output file path: %v", err) + } + + version, err := db.Version() + if err != nil { + t.Logf("could not get version: %v", err) + } else { + t.Logf("running tests against database %s\n", version) + } + + writer := output.NewFileWriter(test.settings.Settings.OutputFilePath) + + err = cli.Run(test.settings.Settings, db, writer) + assert.NoError(t, err) + + checkFiles(t, test.settings) + }) + } +} + +func TestIntegrationNoInitialism(t *testing.T) { + const testDirectory = "noinitialism" + + tests := []struct { + desc string + settings *testSettings + }{ + { + desc: "mysql 8", + settings: func() *testSettings { + s := newMySQLSettings("8", "mysql8", testDirectory) + s.NoInitialism = true + s.Tables = settings.StringsFlag{"user"} + return s + }(), + }, + // Skipping all other DB types since it's not related to the type itself, + // and testing for one type covers all others. + } + + for _, test := range tests { + t.Run(test.desc, func(t *testing.T) { + db := setupDatabase(t, test.settings) + defer func() { + if !t.Failed() { + _ = os.RemoveAll(test.settings.Settings.OutputFilePath) + } + }() + + loadTestData(t, db.SQLDriver(), test.settings) + + err := os.MkdirAll(test.settings.Settings.OutputFilePath, 0755) + if err != nil { + t.Fatalf("could not create output file path: %v", err) + } + + version, err := db.Version() + if err != nil { + t.Logf("could not get version: %v", err) + } else { + t.Logf("running tests against database %s\n", version) + } + + writer := output.NewFileWriter(test.settings.Settings.OutputFilePath) + + err = cli.Run(test.settings.Settings, db, writer) + assert.NoError(t, err) + + checkFiles(t, test.settings) + }) + } +} + +func TestIntegrationTagsNoDB(t *testing.T) { + const testDirectory = "tagsnodbflag" + + tests := []struct { + desc string + settings *testSettings + }{ + { + desc: "mysql 8", + settings: func() *testSettings { + s := newMySQLSettings("8", "mysql8", testDirectory) + s.TagsNoDb = true + + // Only set to reduce the amount of files + s.Tables = settings.StringsFlag{"datetime_table", "float_table", "integer_table", "varchar_table", "user"} + + return s + }(), + }, + // Skipping all other DB types since it's not related to the type itself, + // and testing for one type covers all others. + } + + for _, test := range tests { + t.Run(test.desc, func(t *testing.T) { + db := setupDatabase(t, test.settings) + defer func() { + if !t.Failed() { + _ = os.RemoveAll(test.settings.Settings.OutputFilePath) + } + }() + + loadTestData(t, db.SQLDriver(), test.settings) + + err := os.MkdirAll(test.settings.Settings.OutputFilePath, 0755) + if err != nil { + t.Fatalf("could not create output file path: %v", err) + } + + version, err := db.Version() + if err != nil { + t.Logf("could not get version: %v", err) + } else { + t.Logf("running tests against database %s\n", version) + } + + writer := output.NewFileWriter(test.settings.Settings.OutputFilePath) + + err = cli.Run(test.settings.Settings, db, writer) + assert.NoError(t, err) + + checkFiles(t, test.settings) + }) + } +} + +func TestIntegrationTagsMastermindStructable(t *testing.T) { + const testDirectory = "tagsmastermindstructable" + + tests := []struct { + desc string + settings *testSettings + }{ + { + desc: "mysql 8", + settings: func() *testSettings { + s := newMySQLSettings("8", "mysql8", testDirectory) + s.TagsMastermindStructable = true + + // Only set to reduce the amount of files + s.Tables = settings.StringsFlag{"datetime_table", "float_table", "integer_table", "varchar_table", "user"} + + return s + }(), + }, + // Skipping all other DB types since it's not related to the type itself, + // and testing for one type covers all others. + } + + for _, test := range tests { + t.Run(test.desc, func(t *testing.T) { + db := setupDatabase(t, test.settings) + defer func() { + if !t.Failed() { + _ = os.RemoveAll(test.settings.Settings.OutputFilePath) + } + }() + + loadTestData(t, db.SQLDriver(), test.settings) + + err := os.MkdirAll(test.settings.Settings.OutputFilePath, 0755) + if err != nil { + t.Fatalf("could not create output file path: %v", err) + } + + version, err := db.Version() + if err != nil { + t.Logf("could not get version: %v", err) + } else { + t.Logf("running tests against database %s\n", version) + } + + writer := output.NewFileWriter(test.settings.Settings.OutputFilePath) + + err = cli.Run(test.settings.Settings, db, writer) + assert.NoError(t, err) + + checkFiles(t, test.settings) + }) + } +} + +func TestIntegrationTagsMastermindStructableOnly(t *testing.T) { + const testDirectory = "tagsmastermindstructableonly" + + tests := []struct { + desc string + settings *testSettings + }{ + { + desc: "mysql 8", + settings: func() *testSettings { + s := newMySQLSettings("8", "mysql8", testDirectory) + s.TagsMastermindStructableOnly = true + + // Only set to reduce the amount of files + s.Tables = settings.StringsFlag{"datetime_table", "float_table", "integer_table", "varchar_table", "user"} + + return s + }(), + }, + // Skipping all other DB types since it's not related to the type itself, + // and testing for one type covers all others. + } + + for _, test := range tests { + t.Run(test.desc, func(t *testing.T) { + db := setupDatabase(t, test.settings) + defer func() { + if !t.Failed() { + _ = os.RemoveAll(test.settings.Settings.OutputFilePath) + } + }() + + loadTestData(t, db.SQLDriver(), test.settings) + + err := os.MkdirAll(test.settings.Settings.OutputFilePath, 0755) + if err != nil { + t.Fatalf("could not create output file path: %v", err) + } + + version, err := db.Version() + if err != nil { + t.Logf("could not get version: %v", err) + } else { + t.Logf("running tests against database %s\n", version) + } + + writer := output.NewFileWriter(test.settings.Settings.OutputFilePath) + + err = cli.Run(test.settings.Settings, db, writer) + assert.NoError(t, err) + + checkFiles(t, test.settings) + }) + } +} + +func TestIntegrationIsMastermindStructableRecorder(t *testing.T) { + const testDirectory = "ismastermindstructablerecorder" + + tests := []struct { + desc string + settings *testSettings + }{ + { + desc: "mysql 8", + settings: func() *testSettings { + s := newMySQLSettings("8", "mysql8", testDirectory) + s.TagsMastermindStructableOnly = true + s.IsMastermindStructableRecorder = true + + // Only set to reduce the amount of files + s.Tables = settings.StringsFlag{"datetime_table", "float_table", "integer_table", "varchar_table", "user"} + + return s + }(), + }, + // Skipping all other DB types since it's not related to the type itself, + // and testing for one type covers all others. + } + + for _, test := range tests { + t.Run(test.desc, func(t *testing.T) { + db := setupDatabase(t, test.settings) + defer func() { + if !t.Failed() { + _ = os.RemoveAll(test.settings.Settings.OutputFilePath) + } + }() + + loadTestData(t, db.SQLDriver(), test.settings) + + err := os.MkdirAll(test.settings.Settings.OutputFilePath, 0755) + if err != nil { + t.Fatalf("could not create output file path: %v", err) + } + + version, err := db.Version() + if err != nil { + t.Logf("could not get version: %v", err) + } else { + t.Logf("running tests against database %s\n", version) + } + + writer := output.NewFileWriter(test.settings.Settings.OutputFilePath) + + err = cli.Run(test.settings.Settings, db, writer) + assert.NoError(t, err) + + checkFiles(t, test.settings) + }) + } +} + +func checkFiles(t *testing.T, s *testSettings) { + expectedPattern := filepath.Join(s.filepath, s.testDirectory, "*.go") + expectedFiles, err := filepath.Glob(expectedPattern) + assert.NoError(t, err) + + outputPattern := filepath.Join(s.Settings.OutputFilePath, "*") + outputFiles, err := filepath.Glob(outputPattern) + assert.NoError(t, err) + + if len(expectedFiles) != len(outputFiles) { + t.Fatalf("number of expected and output files differ: %d vs. %d", + len(expectedFiles), len(outputFiles)) + } + + expectedByName := make(map[string]string, len(expectedFiles)) + for _, expectedFile := range expectedFiles { + fileName := filepath.Base(expectedFile) + if _, ok := expectedByName[fileName]; ok { + t.Fatalf("duplicate expected file %q", fileName) + } + expectedByName[fileName] = expectedFile + } + + for _, outputFile := range outputFiles { + fileName := filepath.Base(outputFile) + + expectedFile, ok := expectedByName[fileName] + if !ok { + t.Fatalf("unexpected output file %q", outputFile) + } + delete(expectedByName, fileName) + + expectedInfo, err := os.Stat(expectedFile) + assert.NoError(t, err) + outputInfo, err := os.Stat(outputFile) + assert.NoError(t, err) + + assert.Equal(t, expectedInfo.Size(), outputInfo.Size(), "file %q differs in size", fileName) + + expectedContent, err := os.ReadFile(expectedFile) + assert.NoError(t, err) + outputContent, err := os.ReadFile(outputFile) + assert.NoError(t, err) + + assert.Equal(t, string(expectedContent), string(outputContent), "file %q differs in content", fileName) + } + + if len(expectedByName) > 0 { + missingFiles := make([]string, 0, len(expectedByName)) + for fileName := range expectedByName { + missingFiles = append(missingFiles, fileName) + } + sort.Strings(missingFiles) + t.Fatalf("missing output files for expected files: %v", missingFiles) + } +} + +func setupDatabase(t *testing.T, s *testSettings) database.Database { + t.Logf("spinning up database %s:%s", s.dockerImage, s.version) + + containerName := fmt.Sprintf("tables_to_go_%s_%s_integration", s.dockerImage, s.version) + + // Using pool.Run instead of pool.RunT here to be able to reuse containers. + // Otherwise, t.Cleanup would have been run already and removed the container. + resource, err := pool.Run(t.Context(), s.dockerImage, + dockertest.WithCmd(s.cmd), + dockertest.WithTag(s.version), + dockertest.WithName(containerName), + dockertest.WithEnv(s.env), + dockertest.WithHostConfig(func(config *container.HostConfig) { + config.AutoRemove = true + config.RestartPolicy = container.RestartPolicy{ + Name: container.RestartPolicyDisabled, + } + config.Tmpfs = s.tmpfs + }), + ) + if err != nil { + t.Fatalf("could not start resource: %v", err) + } + + var db database.Database + + if err := pool.Retry(t.Context(), 0, func() error { + port := resource.GetPort(s.Port + "/tcp") + if port != "" { + s.Settings.Port = port + } + db = database.New(s.Settings) + err := db.Connect() + if err != nil { + if s.Settings.Verbose { + t.Log(err.Error()) + } + return err + } + return nil + }); err != nil { + t.Fatalf("could not connect to database: %v", err) + } + t.Cleanup(func() { + _ = db.Close() + }) + + resetDatabase(t, db, s) + + return db +} + +func loadTestData(t *testing.T, db *sqlx.DB, s *testSettings) { + testDataPattern := filepath.Join(s.filepath, testdataDirectoryName, "*.sql") + files, err := filepath.Glob(testDataPattern) + if err != nil { + t.Fatalf("could not find sql testdata: %v", err) + } + + for _, f := range files { + data, err := os.ReadFile(f) + if err != nil { + t.Fatalf("could not read %q: %v", f, err) + } + + queries := bytes.Split(data, []byte(";")) + + for _, query := range queries { + query = bytes.TrimSpace(query) + q := string(query) + if q == "" { + continue + } + + _, err = db.Exec(q) + if err != nil { + t.Fatalf("could not create testdata %q: %v", f, err) + } + } + } +} + +func resetDatabase(t *testing.T, db database.Database, s *testSettings) { + start := time.Now() + + dbx := db.SQLDriver() + + // For the sake of integration testing and not to expose a DROP method + // at the database.Database interface, we type switch here. + switch tdb := db.(type) { + case *database.MySQL: + query := `DROP DATABASE ` + s.DbName + if _, err := dbx.ExecContext(t.Context(), query); err != nil { + t.Fatalf("could not drop database %q: %v", s.DbName, err) + } + query = `CREATE DATABASE ` + s.DbName + if _, err := dbx.ExecContext(t.Context(), query); err != nil { + t.Fatalf("could not create database %q: %v", s.DbName, err) + } + query = `USE ` + s.DbName + if _, err := dbx.ExecContext(t.Context(), query); err != nil { + t.Fatalf("could not use database %q: %v", s.DbName, err) + } + case *database.Postgresql: + query := `DROP SCHEMA ` + s.Schema + ` CASCADE` + if _, err := dbx.ExecContext(t.Context(), query); err != nil { + t.Fatalf("could not drop schema %q: %v", s.Schema, err) + } + query = `CREATE SCHEMA ` + s.Schema + if _, err := dbx.ExecContext(t.Context(), query); err != nil { + t.Fatalf("could not create schema %q: %v", s.Schema, err) + } + case *database.SQLite: + t.Log("not implemented") + default: + // MUST never happen + t.Fatalf("unknown database %v", tdb) + } + + t.Logf("resetting database (%s)", time.Since(start)) +} diff --git a/internal/integration_tests/mysql5/defaultsettings/BigintCheckPk.go b/internal/integration_tests/mysql5/defaultsettings/BigintCheckPk.go new file mode 100644 index 00000000..2474c3d5 --- /dev/null +++ b/internal/integration_tests/mysql5/defaultsettings/BigintCheckPk.go @@ -0,0 +1,5 @@ +package dto + +type BigintCheckPk struct { + BigintCheckPk int `db:"bigint_check_pk"` +} diff --git a/internal/integration_tests/mysql5/defaultsettings/BigintDefConstUniqueCheckPk.go b/internal/integration_tests/mysql5/defaultsettings/BigintDefConstUniqueCheckPk.go new file mode 100644 index 00000000..808e31f2 --- /dev/null +++ b/internal/integration_tests/mysql5/defaultsettings/BigintDefConstUniqueCheckPk.go @@ -0,0 +1,5 @@ +package dto + +type BigintDefConstUniqueCheckPk struct { + BigintDefConstUniqueCheckPk int `db:"bigint_def_const_unique_check_pk"` +} diff --git a/internal/integration_tests/mysql5/defaultsettings/BigintDefConstUniqueCheckPkRef.go b/internal/integration_tests/mysql5/defaultsettings/BigintDefConstUniqueCheckPkRef.go new file mode 100644 index 00000000..64fcb8c8 --- /dev/null +++ b/internal/integration_tests/mysql5/defaultsettings/BigintDefConstUniqueCheckPkRef.go @@ -0,0 +1,5 @@ +package dto + +type BigintDefConstUniqueCheckPkRef struct { + BigintDefConstUniqueCheckPkRef int `db:"bigint_def_const_unique_check_pk_ref"` +} diff --git a/internal/integration_tests/mysql5/defaultsettings/BigintDefFuncUniqueCheckPk.go b/internal/integration_tests/mysql5/defaultsettings/BigintDefFuncUniqueCheckPk.go new file mode 100644 index 00000000..68117369 --- /dev/null +++ b/internal/integration_tests/mysql5/defaultsettings/BigintDefFuncUniqueCheckPk.go @@ -0,0 +1,5 @@ +package dto + +type BigintDefFuncUniqueCheckPk struct { + BigintDefFuncUniqueCheckPk int `db:"bigint_def_func_unique_check_pk"` +} diff --git a/internal/integration_tests/mysql5/defaultsettings/BigintDefFuncUniqueCheckPkRef.go b/internal/integration_tests/mysql5/defaultsettings/BigintDefFuncUniqueCheckPkRef.go new file mode 100644 index 00000000..dbd5da9d --- /dev/null +++ b/internal/integration_tests/mysql5/defaultsettings/BigintDefFuncUniqueCheckPkRef.go @@ -0,0 +1,5 @@ +package dto + +type BigintDefFuncUniqueCheckPkRef struct { + BigintDefFuncUniqueCheckPkRef int `db:"bigint_def_func_unique_check_pk_ref"` +} diff --git a/internal/integration_tests/mysql5/defaultsettings/BigintNnPk.go b/internal/integration_tests/mysql5/defaultsettings/BigintNnPk.go new file mode 100644 index 00000000..f4ddc4aa --- /dev/null +++ b/internal/integration_tests/mysql5/defaultsettings/BigintNnPk.go @@ -0,0 +1,5 @@ +package dto + +type BigintNnPk struct { + BigintNnPk int `db:"bigint_nn_pk"` +} diff --git a/internal/integration_tests/mysql5/defaultsettings/BigintNnUniqueCheckPk.go b/internal/integration_tests/mysql5/defaultsettings/BigintNnUniqueCheckPk.go new file mode 100644 index 00000000..ce5d15c5 --- /dev/null +++ b/internal/integration_tests/mysql5/defaultsettings/BigintNnUniqueCheckPk.go @@ -0,0 +1,5 @@ +package dto + +type BigintNnUniqueCheckPk struct { + BigintNnUniqueCheckPk int `db:"bigint_nn_unique_check_pk"` +} diff --git a/internal/integration_tests/mysql5/defaultsettings/BigintNnUniqueCheckPkRef.go b/internal/integration_tests/mysql5/defaultsettings/BigintNnUniqueCheckPkRef.go new file mode 100644 index 00000000..4c065777 --- /dev/null +++ b/internal/integration_tests/mysql5/defaultsettings/BigintNnUniqueCheckPkRef.go @@ -0,0 +1,5 @@ +package dto + +type BigintNnUniqueCheckPkRef struct { + BigintNnUniqueCheckPkRef int `db:"bigint_nn_unique_check_pk_ref"` +} diff --git a/internal/integration_tests/mysql5/defaultsettings/BigintPk.go b/internal/integration_tests/mysql5/defaultsettings/BigintPk.go new file mode 100644 index 00000000..0b34e55b --- /dev/null +++ b/internal/integration_tests/mysql5/defaultsettings/BigintPk.go @@ -0,0 +1,5 @@ +package dto + +type BigintPk struct { + BigintPk int `db:"bigint_pk"` +} diff --git a/internal/integration_tests/mysql5/defaultsettings/BigintPkDefConst.go b/internal/integration_tests/mysql5/defaultsettings/BigintPkDefConst.go new file mode 100644 index 00000000..08c26cbd --- /dev/null +++ b/internal/integration_tests/mysql5/defaultsettings/BigintPkDefConst.go @@ -0,0 +1,5 @@ +package dto + +type BigintPkDefConst struct { + BigintPkDefConst int `db:"bigint_pk_def_const"` +} diff --git a/internal/integration_tests/mysql5/defaultsettings/BigintPkDefFunc.go b/internal/integration_tests/mysql5/defaultsettings/BigintPkDefFunc.go new file mode 100644 index 00000000..656fadc9 --- /dev/null +++ b/internal/integration_tests/mysql5/defaultsettings/BigintPkDefFunc.go @@ -0,0 +1,5 @@ +package dto + +type BigintPkDefFunc struct { + BigintPkDefFunc int `db:"bigint_pk_def_func"` +} diff --git a/internal/integration_tests/mysql5/defaultsettings/BigintPkRef.go b/internal/integration_tests/mysql5/defaultsettings/BigintPkRef.go new file mode 100644 index 00000000..21608d8c --- /dev/null +++ b/internal/integration_tests/mysql5/defaultsettings/BigintPkRef.go @@ -0,0 +1,5 @@ +package dto + +type BigintPkRef struct { + BigintPkRef int `db:"bigint_pk_ref"` +} diff --git a/internal/integration_tests/mysql5/defaultsettings/BigintRef.go b/internal/integration_tests/mysql5/defaultsettings/BigintRef.go new file mode 100644 index 00000000..348ad421 --- /dev/null +++ b/internal/integration_tests/mysql5/defaultsettings/BigintRef.go @@ -0,0 +1,9 @@ +package dto + +import ( + "database/sql" +) + +type BigintRef struct { + BigintRef sql.NullInt64 `db:"bigint_ref"` +} diff --git a/internal/integration_tests/mysql5/defaultsettings/BigintTable.go b/internal/integration_tests/mysql5/defaultsettings/BigintTable.go new file mode 100644 index 00000000..fac6e51e --- /dev/null +++ b/internal/integration_tests/mysql5/defaultsettings/BigintTable.go @@ -0,0 +1,27 @@ +package dto + +import ( + "database/sql" +) + +type BigintTable struct { + I sql.NullInt64 `db:"i"` + BigintNn int `db:"bigint_nn"` + BigintNnUnique int `db:"bigint_nn_unique"` + BigintNnCheck int `db:"bigint_nn_check"` + BigintUnique sql.NullInt64 `db:"bigint_unique"` + BigintUniqueCheck sql.NullInt64 `db:"bigint_unique_check"` + BigintUniqueRef sql.NullInt64 `db:"bigint_unique_ref"` + BigintUniqueDefConst sql.NullInt64 `db:"bigint_unique_def_const"` + BigintUniqueDefFunc sql.NullInt64 `db:"bigint_unique_def_func"` + BigintCheck sql.NullInt64 `db:"bigint_check"` + BigintCheckRef sql.NullInt64 `db:"bigint_check_ref"` + BigintCheckDefConst sql.NullInt64 `db:"bigint_check_def_const"` + BigintCheckDefFunc sql.NullInt64 `db:"bigint_check_def_func"` + BigintRef sql.NullInt64 `db:"bigint_ref"` + BigintRefUniqueCheck sql.NullInt64 `db:"bigint_ref_unique_check"` + BigintDefConst sql.NullInt64 `db:"bigint_def_const"` + BigintDefConstUniqueCheck sql.NullInt64 `db:"bigint_def_const_unique_check"` + BigintDefFunc sql.NullInt64 `db:"bigint_def_func"` + BigintDefFuncUniqueCheck sql.NullInt64 `db:"bigint_def_func_unique_check"` +} diff --git a/internal/integration_tests/mysql5/defaultsettings/BigintUniqueCheckPk.go b/internal/integration_tests/mysql5/defaultsettings/BigintUniqueCheckPk.go new file mode 100644 index 00000000..d2cd0c7e --- /dev/null +++ b/internal/integration_tests/mysql5/defaultsettings/BigintUniqueCheckPk.go @@ -0,0 +1,5 @@ +package dto + +type BigintUniqueCheckPk struct { + BigintUniqueCheckPk int `db:"bigint_unique_check_pk"` +} diff --git a/internal/integration_tests/mysql5/defaultsettings/BigintUniqueCheckPkRef.go b/internal/integration_tests/mysql5/defaultsettings/BigintUniqueCheckPkRef.go new file mode 100644 index 00000000..f41b59bf --- /dev/null +++ b/internal/integration_tests/mysql5/defaultsettings/BigintUniqueCheckPkRef.go @@ -0,0 +1,5 @@ +package dto + +type BigintUniqueCheckPkRef struct { + BigintUniqueCheckPkRef int `db:"bigint_unique_check_pk_ref"` +} diff --git a/internal/integration_tests/mysql5/defaultsettings/BigintUniquePk.go b/internal/integration_tests/mysql5/defaultsettings/BigintUniquePk.go new file mode 100644 index 00000000..06e50c8e --- /dev/null +++ b/internal/integration_tests/mysql5/defaultsettings/BigintUniquePk.go @@ -0,0 +1,5 @@ +package dto + +type BigintUniquePk struct { + BigintUniquePk int `db:"bigint_unique_pk"` +} diff --git a/internal/integration_tests/mysql5/defaultsettings/BinaryCheckPk.go b/internal/integration_tests/mysql5/defaultsettings/BinaryCheckPk.go new file mode 100644 index 00000000..efa14dfd --- /dev/null +++ b/internal/integration_tests/mysql5/defaultsettings/BinaryCheckPk.go @@ -0,0 +1,5 @@ +package dto + +type BinaryCheckPk struct { + BinaryCheckPk string `db:"binary_check_pk"` +} diff --git a/internal/integration_tests/mysql5/defaultsettings/BinaryDefConstUniqueCheckPk.go b/internal/integration_tests/mysql5/defaultsettings/BinaryDefConstUniqueCheckPk.go new file mode 100644 index 00000000..065a8a21 --- /dev/null +++ b/internal/integration_tests/mysql5/defaultsettings/BinaryDefConstUniqueCheckPk.go @@ -0,0 +1,5 @@ +package dto + +type BinaryDefConstUniqueCheckPk struct { + BinaryDefConstUniqueCheckPk string `db:"binary_def_const_unique_check_pk"` +} diff --git a/internal/integration_tests/mysql5/defaultsettings/BinaryDefConstUniqueCheckPkRef.go b/internal/integration_tests/mysql5/defaultsettings/BinaryDefConstUniqueCheckPkRef.go new file mode 100644 index 00000000..5309fbd7 --- /dev/null +++ b/internal/integration_tests/mysql5/defaultsettings/BinaryDefConstUniqueCheckPkRef.go @@ -0,0 +1,5 @@ +package dto + +type BinaryDefConstUniqueCheckPkRef struct { + BinaryDefConstUniqueCheckPkRef string `db:"binary_def_const_unique_check_pk_ref"` +} diff --git a/internal/integration_tests/mysql5/defaultsettings/BinaryDefFuncUniqueCheckPk.go b/internal/integration_tests/mysql5/defaultsettings/BinaryDefFuncUniqueCheckPk.go new file mode 100644 index 00000000..17d016cf --- /dev/null +++ b/internal/integration_tests/mysql5/defaultsettings/BinaryDefFuncUniqueCheckPk.go @@ -0,0 +1,5 @@ +package dto + +type BinaryDefFuncUniqueCheckPk struct { + BinaryDefFuncUniqueCheckPk string `db:"binary_def_func_unique_check_pk"` +} diff --git a/internal/integration_tests/mysql5/defaultsettings/BinaryDefFuncUniqueCheckPkRef.go b/internal/integration_tests/mysql5/defaultsettings/BinaryDefFuncUniqueCheckPkRef.go new file mode 100644 index 00000000..8ad6c58e --- /dev/null +++ b/internal/integration_tests/mysql5/defaultsettings/BinaryDefFuncUniqueCheckPkRef.go @@ -0,0 +1,5 @@ +package dto + +type BinaryDefFuncUniqueCheckPkRef struct { + BinaryDefFuncUniqueCheckPkRef string `db:"binary_def_func_unique_check_pk_ref"` +} diff --git a/internal/integration_tests/mysql5/defaultsettings/BinaryNnPk.go b/internal/integration_tests/mysql5/defaultsettings/BinaryNnPk.go new file mode 100644 index 00000000..3ed599f3 --- /dev/null +++ b/internal/integration_tests/mysql5/defaultsettings/BinaryNnPk.go @@ -0,0 +1,5 @@ +package dto + +type BinaryNnPk struct { + BinaryNnPk string `db:"binary_nn_pk"` +} diff --git a/internal/integration_tests/mysql5/defaultsettings/BinaryNnUniqueCheckPk.go b/internal/integration_tests/mysql5/defaultsettings/BinaryNnUniqueCheckPk.go new file mode 100644 index 00000000..c2c3e783 --- /dev/null +++ b/internal/integration_tests/mysql5/defaultsettings/BinaryNnUniqueCheckPk.go @@ -0,0 +1,5 @@ +package dto + +type BinaryNnUniqueCheckPk struct { + BinaryNnUniqueCheckPk string `db:"binary_nn_unique_check_pk"` +} diff --git a/internal/integration_tests/mysql5/defaultsettings/BinaryNnUniqueCheckPkRef.go b/internal/integration_tests/mysql5/defaultsettings/BinaryNnUniqueCheckPkRef.go new file mode 100644 index 00000000..d0c44d10 --- /dev/null +++ b/internal/integration_tests/mysql5/defaultsettings/BinaryNnUniqueCheckPkRef.go @@ -0,0 +1,5 @@ +package dto + +type BinaryNnUniqueCheckPkRef struct { + BinaryNnUniqueCheckPkRef string `db:"binary_nn_unique_check_pk_ref"` +} diff --git a/internal/integration_tests/mysql5/defaultsettings/BinaryPk.go b/internal/integration_tests/mysql5/defaultsettings/BinaryPk.go new file mode 100644 index 00000000..6b5f9d3c --- /dev/null +++ b/internal/integration_tests/mysql5/defaultsettings/BinaryPk.go @@ -0,0 +1,5 @@ +package dto + +type BinaryPk struct { + BinaryPk string `db:"binary_pk"` +} diff --git a/internal/integration_tests/mysql5/defaultsettings/BinaryPkDefConst.go b/internal/integration_tests/mysql5/defaultsettings/BinaryPkDefConst.go new file mode 100644 index 00000000..a82868f0 --- /dev/null +++ b/internal/integration_tests/mysql5/defaultsettings/BinaryPkDefConst.go @@ -0,0 +1,5 @@ +package dto + +type BinaryPkDefConst struct { + BinaryPkDefConst string `db:"binary_pk_def_const"` +} diff --git a/internal/integration_tests/mysql5/defaultsettings/BinaryPkDefFunc.go b/internal/integration_tests/mysql5/defaultsettings/BinaryPkDefFunc.go new file mode 100644 index 00000000..6b3afc82 --- /dev/null +++ b/internal/integration_tests/mysql5/defaultsettings/BinaryPkDefFunc.go @@ -0,0 +1,5 @@ +package dto + +type BinaryPkDefFunc struct { + BinaryPkDefFunc string `db:"binary_pk_def_func"` +} diff --git a/internal/integration_tests/mysql5/defaultsettings/BinaryPkRef.go b/internal/integration_tests/mysql5/defaultsettings/BinaryPkRef.go new file mode 100644 index 00000000..499cda7d --- /dev/null +++ b/internal/integration_tests/mysql5/defaultsettings/BinaryPkRef.go @@ -0,0 +1,5 @@ +package dto + +type BinaryPkRef struct { + BinaryPkRef string `db:"binary_pk_ref"` +} diff --git a/internal/integration_tests/mysql5/defaultsettings/BinaryRef.go b/internal/integration_tests/mysql5/defaultsettings/BinaryRef.go new file mode 100644 index 00000000..644ed768 --- /dev/null +++ b/internal/integration_tests/mysql5/defaultsettings/BinaryRef.go @@ -0,0 +1,9 @@ +package dto + +import ( + "database/sql" +) + +type BinaryRef struct { + BinaryRef sql.NullString `db:"binary_ref"` +} diff --git a/internal/integration_tests/mysql5/defaultsettings/BinaryTable.go b/internal/integration_tests/mysql5/defaultsettings/BinaryTable.go new file mode 100644 index 00000000..bd213757 --- /dev/null +++ b/internal/integration_tests/mysql5/defaultsettings/BinaryTable.go @@ -0,0 +1,33 @@ +package dto + +import ( + "database/sql" +) + +type BinaryTable struct { + Col sql.NullString `db:"col"` + BinaryCap sql.NullString `db:"binary_cap"` + BinaryNn string `db:"binary_nn"` + BinaryNnUnique string `db:"binary_nn_unique"` + BinaryNnCheckCmp string `db:"binary_nn_check_cmp"` + BinaryNnCheckFn string `db:"binary_nn_check_fn"` + BinaryNnRef string `db:"binary_nn_ref"` + BinaryNnDefConst string `db:"binary_nn_def_const"` + BinaryNnDefFunc string `db:"binary_nn_def_func"` + BinaryNnUniqueCheck string `db:"binary_nn_unique_check"` + BinaryUnique sql.NullString `db:"binary_unique"` + BinaryUniqueCheck sql.NullString `db:"binary_unique_check"` + BinaryUniqueRef sql.NullString `db:"binary_unique_ref"` + BinaryUniqueDefConst sql.NullString `db:"binary_unique_def_const"` + BinaryUniqueDefFunc sql.NullString `db:"binary_unique_def_func"` + BinaryCheck sql.NullString `db:"binary_check"` + BinaryCheckRef sql.NullString `db:"binary_check_ref"` + BinaryCheckDefConst sql.NullString `db:"binary_check_def_const"` + BinaryCheckDefFunc sql.NullString `db:"binary_check_def_func"` + BinaryRef sql.NullString `db:"binary_ref"` + BinaryRefUniqueCheck sql.NullString `db:"binary_ref_unique_check"` + BinaryDefConst sql.NullString `db:"binary_def_const"` + BinaryDefConstUniqueCheck sql.NullString `db:"binary_def_const_unique_check"` + BinaryDefFunc sql.NullString `db:"binary_def_func"` + BinaryDefFuncUniqueCheck sql.NullString `db:"binary_def_func_unique_check"` +} diff --git a/internal/integration_tests/mysql5/defaultsettings/BinaryUniqueCheckPk.go b/internal/integration_tests/mysql5/defaultsettings/BinaryUniqueCheckPk.go new file mode 100644 index 00000000..b52b07de --- /dev/null +++ b/internal/integration_tests/mysql5/defaultsettings/BinaryUniqueCheckPk.go @@ -0,0 +1,5 @@ +package dto + +type BinaryUniqueCheckPk struct { + BinaryUniqueCheckPk string `db:"binary_unique_check_pk"` +} diff --git a/internal/integration_tests/mysql5/defaultsettings/BinaryUniqueCheckPkRef.go b/internal/integration_tests/mysql5/defaultsettings/BinaryUniqueCheckPkRef.go new file mode 100644 index 00000000..87df9f43 --- /dev/null +++ b/internal/integration_tests/mysql5/defaultsettings/BinaryUniqueCheckPkRef.go @@ -0,0 +1,5 @@ +package dto + +type BinaryUniqueCheckPkRef struct { + BinaryUniqueCheckPkRef string `db:"binary_unique_check_pk_ref"` +} diff --git a/internal/integration_tests/mysql5/defaultsettings/BinaryUniquePk.go b/internal/integration_tests/mysql5/defaultsettings/BinaryUniquePk.go new file mode 100644 index 00000000..f6700a1c --- /dev/null +++ b/internal/integration_tests/mysql5/defaultsettings/BinaryUniquePk.go @@ -0,0 +1,5 @@ +package dto + +type BinaryUniquePk struct { + BinaryUniquePk string `db:"binary_unique_pk"` +} diff --git a/internal/integration_tests/mysql5/defaultsettings/BlobRef.go b/internal/integration_tests/mysql5/defaultsettings/BlobRef.go new file mode 100644 index 00000000..31a8025d --- /dev/null +++ b/internal/integration_tests/mysql5/defaultsettings/BlobRef.go @@ -0,0 +1,5 @@ +package dto + +type BlobRef struct { + BlobRef string `db:"blob_ref"` +} diff --git a/internal/integration_tests/mysql5/defaultsettings/BlobTable.go b/internal/integration_tests/mysql5/defaultsettings/BlobTable.go new file mode 100644 index 00000000..d69f8c26 --- /dev/null +++ b/internal/integration_tests/mysql5/defaultsettings/BlobTable.go @@ -0,0 +1,22 @@ +package dto + +import ( + "database/sql" +) + +type BlobTable struct { + Col sql.NullString `db:"col"` + BlobDefConst sql.NullString `db:"blob_def_const"` + BlobDefFunc sql.NullString `db:"blob_def_func"` + BlobRef sql.NullString `db:"blob_ref"` + BlobNn string `db:"blob_nn"` + BlobNnCheckCmp string `db:"blob_nn_check_cmp"` + BlobNnCheckFn string `db:"blob_nn_check_fn"` + BlobNnRef string `db:"blob_nn_ref"` + BlobNnDefConst string `db:"blob_nn_def_const"` + BlobNnDefFunc string `db:"blob_nn_def_func"` + BlobCheck sql.NullString `db:"blob_check"` + BlobCheckRef sql.NullString `db:"blob_check_ref"` + BlobCheckDefConst sql.NullString `db:"blob_check_def_const"` + BlobCheckDefFunc sql.NullString `db:"blob_check_def_func"` +} diff --git a/internal/integration_tests/mysql5/defaultsettings/CharCheckPk.go b/internal/integration_tests/mysql5/defaultsettings/CharCheckPk.go new file mode 100644 index 00000000..3fced3dc --- /dev/null +++ b/internal/integration_tests/mysql5/defaultsettings/CharCheckPk.go @@ -0,0 +1,5 @@ +package dto + +type CharCheckPk struct { + CharCheckPk string `db:"char_check_pk"` +} diff --git a/internal/integration_tests/mysql5/defaultsettings/CharDefConstUniqueCheckPk.go b/internal/integration_tests/mysql5/defaultsettings/CharDefConstUniqueCheckPk.go new file mode 100644 index 00000000..3c69f6ff --- /dev/null +++ b/internal/integration_tests/mysql5/defaultsettings/CharDefConstUniqueCheckPk.go @@ -0,0 +1,5 @@ +package dto + +type CharDefConstUniqueCheckPk struct { + CharDefConstUniqueCheckPk string `db:"char_def_const_unique_check_pk"` +} diff --git a/internal/integration_tests/mysql5/defaultsettings/CharDefConstUniqueCheckPkRef.go b/internal/integration_tests/mysql5/defaultsettings/CharDefConstUniqueCheckPkRef.go new file mode 100644 index 00000000..6b29a7e6 --- /dev/null +++ b/internal/integration_tests/mysql5/defaultsettings/CharDefConstUniqueCheckPkRef.go @@ -0,0 +1,5 @@ +package dto + +type CharDefConstUniqueCheckPkRef struct { + CharDefConstUniqueCheckPkRef string `db:"char_def_const_unique_check_pk_ref"` +} diff --git a/internal/integration_tests/mysql5/defaultsettings/CharDefFuncUniqueCheckPk.go b/internal/integration_tests/mysql5/defaultsettings/CharDefFuncUniqueCheckPk.go new file mode 100644 index 00000000..45d10db8 --- /dev/null +++ b/internal/integration_tests/mysql5/defaultsettings/CharDefFuncUniqueCheckPk.go @@ -0,0 +1,5 @@ +package dto + +type CharDefFuncUniqueCheckPk struct { + CharDefFuncUniqueCheckPk string `db:"char_def_func_unique_check_pk"` +} diff --git a/internal/integration_tests/mysql5/defaultsettings/CharDefFuncUniqueCheckPkRef.go b/internal/integration_tests/mysql5/defaultsettings/CharDefFuncUniqueCheckPkRef.go new file mode 100644 index 00000000..43d48b6b --- /dev/null +++ b/internal/integration_tests/mysql5/defaultsettings/CharDefFuncUniqueCheckPkRef.go @@ -0,0 +1,5 @@ +package dto + +type CharDefFuncUniqueCheckPkRef struct { + CharDefFuncUniqueCheckPkRef string `db:"char_def_func_unique_check_pk_ref"` +} diff --git a/internal/integration_tests/mysql5/defaultsettings/CharNnPk.go b/internal/integration_tests/mysql5/defaultsettings/CharNnPk.go new file mode 100644 index 00000000..309e6e87 --- /dev/null +++ b/internal/integration_tests/mysql5/defaultsettings/CharNnPk.go @@ -0,0 +1,5 @@ +package dto + +type CharNnPk struct { + CharNnPk string `db:"char_nn_pk"` +} diff --git a/internal/integration_tests/mysql5/defaultsettings/CharNnUniqueCheckPk.go b/internal/integration_tests/mysql5/defaultsettings/CharNnUniqueCheckPk.go new file mode 100644 index 00000000..0ffe2059 --- /dev/null +++ b/internal/integration_tests/mysql5/defaultsettings/CharNnUniqueCheckPk.go @@ -0,0 +1,5 @@ +package dto + +type CharNnUniqueCheckPk struct { + CharNnUniqueCheckPk string `db:"char_nn_unique_check_pk"` +} diff --git a/internal/integration_tests/mysql5/defaultsettings/CharNnUniqueCheckPkRef.go b/internal/integration_tests/mysql5/defaultsettings/CharNnUniqueCheckPkRef.go new file mode 100644 index 00000000..62f9b39b --- /dev/null +++ b/internal/integration_tests/mysql5/defaultsettings/CharNnUniqueCheckPkRef.go @@ -0,0 +1,5 @@ +package dto + +type CharNnUniqueCheckPkRef struct { + CharNnUniqueCheckPkRef string `db:"char_nn_unique_check_pk_ref"` +} diff --git a/internal/integration_tests/mysql5/defaultsettings/CharPk.go b/internal/integration_tests/mysql5/defaultsettings/CharPk.go new file mode 100644 index 00000000..82d769ca --- /dev/null +++ b/internal/integration_tests/mysql5/defaultsettings/CharPk.go @@ -0,0 +1,5 @@ +package dto + +type CharPk struct { + CharPk string `db:"char_pk"` +} diff --git a/internal/integration_tests/mysql5/defaultsettings/CharPkDefConst.go b/internal/integration_tests/mysql5/defaultsettings/CharPkDefConst.go new file mode 100644 index 00000000..e386cc95 --- /dev/null +++ b/internal/integration_tests/mysql5/defaultsettings/CharPkDefConst.go @@ -0,0 +1,5 @@ +package dto + +type CharPkDefConst struct { + CharPkDefConst string `db:"char_pk_def_const"` +} diff --git a/internal/integration_tests/mysql5/defaultsettings/CharPkDefFunc.go b/internal/integration_tests/mysql5/defaultsettings/CharPkDefFunc.go new file mode 100644 index 00000000..24a1d17a --- /dev/null +++ b/internal/integration_tests/mysql5/defaultsettings/CharPkDefFunc.go @@ -0,0 +1,5 @@ +package dto + +type CharPkDefFunc struct { + CharPkDefFunc string `db:"char_pk_def_func"` +} diff --git a/internal/integration_tests/mysql5/defaultsettings/CharPkRef.go b/internal/integration_tests/mysql5/defaultsettings/CharPkRef.go new file mode 100644 index 00000000..aed73b7d --- /dev/null +++ b/internal/integration_tests/mysql5/defaultsettings/CharPkRef.go @@ -0,0 +1,5 @@ +package dto + +type CharPkRef struct { + CharPkRef string `db:"char_pk_ref"` +} diff --git a/internal/integration_tests/mysql5/defaultsettings/CharRef.go b/internal/integration_tests/mysql5/defaultsettings/CharRef.go new file mode 100644 index 00000000..5bbf267b --- /dev/null +++ b/internal/integration_tests/mysql5/defaultsettings/CharRef.go @@ -0,0 +1,9 @@ +package dto + +import ( + "database/sql" +) + +type CharRef struct { + CharRef sql.NullString `db:"char_ref"` +} diff --git a/internal/integration_tests/mysql5/defaultsettings/CharTable.go b/internal/integration_tests/mysql5/defaultsettings/CharTable.go new file mode 100644 index 00000000..e0d2400c --- /dev/null +++ b/internal/integration_tests/mysql5/defaultsettings/CharTable.go @@ -0,0 +1,33 @@ +package dto + +import ( + "database/sql" +) + +type CharTable struct { + Col sql.NullString `db:"col"` + CharCap sql.NullString `db:"char_cap"` + CharNn string `db:"char_nn"` + CharNnUnique string `db:"char_nn_unique"` + CharNnCheckCmp string `db:"char_nn_check_cmp"` + CharNnCheckFn string `db:"char_nn_check_fn"` + CharNnRef string `db:"char_nn_ref"` + CharNnDefConst string `db:"char_nn_def_const"` + CharNnDefFunc string `db:"char_nn_def_func"` + CharNnUniqueCheck string `db:"char_nn_unique_check"` + CharUnique sql.NullString `db:"char_unique"` + CharUniqueCheck sql.NullString `db:"char_unique_check"` + CharUniqueRef sql.NullString `db:"char_unique_ref"` + CharUniqueDefConst sql.NullString `db:"char_unique_def_const"` + CharUniqueDefFunc sql.NullString `db:"char_unique_def_func"` + CharCheck sql.NullString `db:"char_check"` + CharCheckRef sql.NullString `db:"char_check_ref"` + CharCheckDefConst sql.NullString `db:"char_check_def_const"` + CharCheckDefFunc sql.NullString `db:"char_check_def_func"` + CharRef sql.NullString `db:"char_ref"` + CharRefUniqueCheck sql.NullString `db:"char_ref_unique_check"` + CharDefConst sql.NullString `db:"char_def_const"` + CharDefConstUniqueCheck sql.NullString `db:"char_def_const_unique_check"` + CharDefFunc sql.NullString `db:"char_def_func"` + CharDefFuncUniqueCheck sql.NullString `db:"char_def_func_unique_check"` +} diff --git a/internal/integration_tests/mysql5/defaultsettings/CharUniqueCheckPk.go b/internal/integration_tests/mysql5/defaultsettings/CharUniqueCheckPk.go new file mode 100644 index 00000000..3a27898a --- /dev/null +++ b/internal/integration_tests/mysql5/defaultsettings/CharUniqueCheckPk.go @@ -0,0 +1,5 @@ +package dto + +type CharUniqueCheckPk struct { + CharUniqueCheckPk string `db:"char_unique_check_pk"` +} diff --git a/internal/integration_tests/mysql5/defaultsettings/CharUniqueCheckPkRef.go b/internal/integration_tests/mysql5/defaultsettings/CharUniqueCheckPkRef.go new file mode 100644 index 00000000..47939972 --- /dev/null +++ b/internal/integration_tests/mysql5/defaultsettings/CharUniqueCheckPkRef.go @@ -0,0 +1,5 @@ +package dto + +type CharUniqueCheckPkRef struct { + CharUniqueCheckPkRef string `db:"char_unique_check_pk_ref"` +} diff --git a/internal/integration_tests/mysql5/defaultsettings/CharUniquePk.go b/internal/integration_tests/mysql5/defaultsettings/CharUniquePk.go new file mode 100644 index 00000000..27407394 --- /dev/null +++ b/internal/integration_tests/mysql5/defaultsettings/CharUniquePk.go @@ -0,0 +1,5 @@ +package dto + +type CharUniquePk struct { + CharUniquePk string `db:"char_unique_pk"` +} diff --git a/internal/integration_tests/mysql5/defaultsettings/ConstraintComboNonPk.go b/internal/integration_tests/mysql5/defaultsettings/ConstraintComboNonPk.go new file mode 100644 index 00000000..575d9778 --- /dev/null +++ b/internal/integration_tests/mysql5/defaultsettings/ConstraintComboNonPk.go @@ -0,0 +1,16 @@ +package dto + +type ConstraintComboNonPk struct { + NotNullUniqueCheckDefConst float64 `db:"not_null_unique_check_def_const"` + NotNullUniqueCheckDefFunc float64 `db:"not_null_unique_check_def_func"` + NotNullUniqueRefDefConst float64 `db:"not_null_unique_ref_def_const"` + NotNullUniqueRefDefFunc float64 `db:"not_null_unique_ref_def_func"` + NotNullCheckRefDefConst float64 `db:"not_null_check_ref_def_const"` + NotNullCheckRefDefFunc float64 `db:"not_null_check_ref_def_func"` + NotNullUniqueDefConst float64 `db:"not_null_unique_def_const"` + NotNullUniqueDefFunc float64 `db:"not_null_unique_def_func"` + NotNullCheckDefConst float64 `db:"not_null_check_def_const"` + NotNullCheckDefFunc float64 `db:"not_null_check_def_func"` + NotNullRefDefConst float64 `db:"not_null_ref_def_const"` + NotNullRefDefFunc float64 `db:"not_null_ref_def_func"` +} diff --git a/internal/integration_tests/mysql5/defaultsettings/ConstraintComboNotNullCheckPkDefConst.go b/internal/integration_tests/mysql5/defaultsettings/ConstraintComboNotNullCheckPkDefConst.go new file mode 100644 index 00000000..4aa890ba --- /dev/null +++ b/internal/integration_tests/mysql5/defaultsettings/ConstraintComboNotNullCheckPkDefConst.go @@ -0,0 +1,5 @@ +package dto + +type ConstraintComboNotNullCheckPkDefConst struct { + ConstraintComboNotNullCheckPkDefConst float64 `db:"constraint_combo_not_null_check_pk_def_const"` +} diff --git a/internal/integration_tests/mysql5/defaultsettings/ConstraintComboNotNullCheckPkDefFunc.go b/internal/integration_tests/mysql5/defaultsettings/ConstraintComboNotNullCheckPkDefFunc.go new file mode 100644 index 00000000..dce0d8b3 --- /dev/null +++ b/internal/integration_tests/mysql5/defaultsettings/ConstraintComboNotNullCheckPkDefFunc.go @@ -0,0 +1,5 @@ +package dto + +type ConstraintComboNotNullCheckPkDefFunc struct { + ConstraintComboNotNullCheckPkDefFunc float64 `db:"constraint_combo_not_null_check_pk_def_func"` +} diff --git a/internal/integration_tests/mysql5/defaultsettings/ConstraintComboNotNullPkDefConst.go b/internal/integration_tests/mysql5/defaultsettings/ConstraintComboNotNullPkDefConst.go new file mode 100644 index 00000000..ca059e7a --- /dev/null +++ b/internal/integration_tests/mysql5/defaultsettings/ConstraintComboNotNullPkDefConst.go @@ -0,0 +1,5 @@ +package dto + +type ConstraintComboNotNullPkDefConst struct { + ConstraintComboNotNullPkDefConst float64 `db:"constraint_combo_not_null_pk_def_const"` +} diff --git a/internal/integration_tests/mysql5/defaultsettings/ConstraintComboNotNullPkDefFunc.go b/internal/integration_tests/mysql5/defaultsettings/ConstraintComboNotNullPkDefFunc.go new file mode 100644 index 00000000..5bb0b531 --- /dev/null +++ b/internal/integration_tests/mysql5/defaultsettings/ConstraintComboNotNullPkDefFunc.go @@ -0,0 +1,5 @@ +package dto + +type ConstraintComboNotNullPkDefFunc struct { + ConstraintComboNotNullPkDefFunc float64 `db:"constraint_combo_not_null_pk_def_func"` +} diff --git a/internal/integration_tests/mysql5/defaultsettings/ConstraintComboNotNullPkRefDefConst.go b/internal/integration_tests/mysql5/defaultsettings/ConstraintComboNotNullPkRefDefConst.go new file mode 100644 index 00000000..4bd7ce91 --- /dev/null +++ b/internal/integration_tests/mysql5/defaultsettings/ConstraintComboNotNullPkRefDefConst.go @@ -0,0 +1,5 @@ +package dto + +type ConstraintComboNotNullPkRefDefConst struct { + ConstraintComboNotNullPkRefDefConst float64 `db:"constraint_combo_not_null_pk_ref_def_const"` +} diff --git a/internal/integration_tests/mysql5/defaultsettings/ConstraintComboNotNullPkRefDefFunc.go b/internal/integration_tests/mysql5/defaultsettings/ConstraintComboNotNullPkRefDefFunc.go new file mode 100644 index 00000000..72c2299b --- /dev/null +++ b/internal/integration_tests/mysql5/defaultsettings/ConstraintComboNotNullPkRefDefFunc.go @@ -0,0 +1,5 @@ +package dto + +type ConstraintComboNotNullPkRefDefFunc struct { + ConstraintComboNotNullPkRefDefFunc float64 `db:"constraint_combo_not_null_pk_ref_def_func"` +} diff --git a/internal/integration_tests/mysql5/defaultsettings/ConstraintComboNotNullUniquePkDefConst.go b/internal/integration_tests/mysql5/defaultsettings/ConstraintComboNotNullUniquePkDefConst.go new file mode 100644 index 00000000..b195d769 --- /dev/null +++ b/internal/integration_tests/mysql5/defaultsettings/ConstraintComboNotNullUniquePkDefConst.go @@ -0,0 +1,5 @@ +package dto + +type ConstraintComboNotNullUniquePkDefConst struct { + ConstraintComboNotNullUniquePkDefConst float64 `db:"constraint_combo_not_null_unique_pk_def_const"` +} diff --git a/internal/integration_tests/mysql5/defaultsettings/ConstraintComboNotNullUniquePkDefFunc.go b/internal/integration_tests/mysql5/defaultsettings/ConstraintComboNotNullUniquePkDefFunc.go new file mode 100644 index 00000000..845d6231 --- /dev/null +++ b/internal/integration_tests/mysql5/defaultsettings/ConstraintComboNotNullUniquePkDefFunc.go @@ -0,0 +1,5 @@ +package dto + +type ConstraintComboNotNullUniquePkDefFunc struct { + ConstraintComboNotNullUniquePkDefFunc float64 `db:"constraint_combo_not_null_unique_pk_def_func"` +} diff --git a/internal/integration_tests/mysql5/defaultsettings/ConstraintComboRef.go b/internal/integration_tests/mysql5/defaultsettings/ConstraintComboRef.go new file mode 100644 index 00000000..ecc8379f --- /dev/null +++ b/internal/integration_tests/mysql5/defaultsettings/ConstraintComboRef.go @@ -0,0 +1,9 @@ +package dto + +import ( + "database/sql" +) + +type ConstraintComboRef struct { + ConstraintComboRef sql.NullFloat64 `db:"constraint_combo_ref"` +} diff --git a/internal/integration_tests/mysql5/defaultsettings/DateCheckPk.go b/internal/integration_tests/mysql5/defaultsettings/DateCheckPk.go new file mode 100644 index 00000000..6cb1844e --- /dev/null +++ b/internal/integration_tests/mysql5/defaultsettings/DateCheckPk.go @@ -0,0 +1,9 @@ +package dto + +import ( + "time" +) + +type DateCheckPk struct { + DateCheckPk time.Time `db:"date_check_pk"` +} diff --git a/internal/integration_tests/mysql5/defaultsettings/DateDefConstUniqueCheckPk.go b/internal/integration_tests/mysql5/defaultsettings/DateDefConstUniqueCheckPk.go new file mode 100644 index 00000000..e07a7ed5 --- /dev/null +++ b/internal/integration_tests/mysql5/defaultsettings/DateDefConstUniqueCheckPk.go @@ -0,0 +1,9 @@ +package dto + +import ( + "time" +) + +type DateDefConstUniqueCheckPk struct { + DateDefConstUniqueCheckPk time.Time `db:"date_def_const_unique_check_pk"` +} diff --git a/internal/integration_tests/mysql5/defaultsettings/DateDefConstUniqueCheckPkRef.go b/internal/integration_tests/mysql5/defaultsettings/DateDefConstUniqueCheckPkRef.go new file mode 100644 index 00000000..3b99928e --- /dev/null +++ b/internal/integration_tests/mysql5/defaultsettings/DateDefConstUniqueCheckPkRef.go @@ -0,0 +1,9 @@ +package dto + +import ( + "time" +) + +type DateDefConstUniqueCheckPkRef struct { + DateDefConstUniqueCheckPkRef time.Time `db:"date_def_const_unique_check_pk_ref"` +} diff --git a/internal/integration_tests/mysql5/defaultsettings/DateDefFuncUniqueCheckPk.go b/internal/integration_tests/mysql5/defaultsettings/DateDefFuncUniqueCheckPk.go new file mode 100644 index 00000000..12934d64 --- /dev/null +++ b/internal/integration_tests/mysql5/defaultsettings/DateDefFuncUniqueCheckPk.go @@ -0,0 +1,9 @@ +package dto + +import ( + "time" +) + +type DateDefFuncUniqueCheckPk struct { + DateDefFuncUniqueCheckPk time.Time `db:"date_def_func_unique_check_pk"` +} diff --git a/internal/integration_tests/mysql5/defaultsettings/DateDefFuncUniqueCheckPkRef.go b/internal/integration_tests/mysql5/defaultsettings/DateDefFuncUniqueCheckPkRef.go new file mode 100644 index 00000000..19ed2d94 --- /dev/null +++ b/internal/integration_tests/mysql5/defaultsettings/DateDefFuncUniqueCheckPkRef.go @@ -0,0 +1,9 @@ +package dto + +import ( + "time" +) + +type DateDefFuncUniqueCheckPkRef struct { + DateDefFuncUniqueCheckPkRef time.Time `db:"date_def_func_unique_check_pk_ref"` +} diff --git a/internal/integration_tests/mysql5/defaultsettings/DateNnPk.go b/internal/integration_tests/mysql5/defaultsettings/DateNnPk.go new file mode 100644 index 00000000..24f7dc12 --- /dev/null +++ b/internal/integration_tests/mysql5/defaultsettings/DateNnPk.go @@ -0,0 +1,9 @@ +package dto + +import ( + "time" +) + +type DateNnPk struct { + DateNnPk time.Time `db:"date_nn_pk"` +} diff --git a/internal/integration_tests/mysql5/defaultsettings/DateNnUniqueCheckPk.go b/internal/integration_tests/mysql5/defaultsettings/DateNnUniqueCheckPk.go new file mode 100644 index 00000000..162ceee5 --- /dev/null +++ b/internal/integration_tests/mysql5/defaultsettings/DateNnUniqueCheckPk.go @@ -0,0 +1,9 @@ +package dto + +import ( + "time" +) + +type DateNnUniqueCheckPk struct { + DateNnUniqueCheckPk time.Time `db:"date_nn_unique_check_pk"` +} diff --git a/internal/integration_tests/mysql5/defaultsettings/DateNnUniqueCheckPkRef.go b/internal/integration_tests/mysql5/defaultsettings/DateNnUniqueCheckPkRef.go new file mode 100644 index 00000000..57c61fce --- /dev/null +++ b/internal/integration_tests/mysql5/defaultsettings/DateNnUniqueCheckPkRef.go @@ -0,0 +1,9 @@ +package dto + +import ( + "time" +) + +type DateNnUniqueCheckPkRef struct { + DateNnUniqueCheckPkRef time.Time `db:"date_nn_unique_check_pk_ref"` +} diff --git a/internal/integration_tests/mysql5/defaultsettings/DatePk.go b/internal/integration_tests/mysql5/defaultsettings/DatePk.go new file mode 100644 index 00000000..d006be42 --- /dev/null +++ b/internal/integration_tests/mysql5/defaultsettings/DatePk.go @@ -0,0 +1,9 @@ +package dto + +import ( + "time" +) + +type DatePk struct { + DatePk time.Time `db:"date_pk"` +} diff --git a/internal/integration_tests/mysql5/defaultsettings/DatePkDefConst.go b/internal/integration_tests/mysql5/defaultsettings/DatePkDefConst.go new file mode 100644 index 00000000..b10866e0 --- /dev/null +++ b/internal/integration_tests/mysql5/defaultsettings/DatePkDefConst.go @@ -0,0 +1,9 @@ +package dto + +import ( + "time" +) + +type DatePkDefConst struct { + DatePkDefConst time.Time `db:"date_pk_def_const"` +} diff --git a/internal/integration_tests/mysql5/defaultsettings/DatePkDefFunc.go b/internal/integration_tests/mysql5/defaultsettings/DatePkDefFunc.go new file mode 100644 index 00000000..133d388a --- /dev/null +++ b/internal/integration_tests/mysql5/defaultsettings/DatePkDefFunc.go @@ -0,0 +1,9 @@ +package dto + +import ( + "time" +) + +type DatePkDefFunc struct { + DatePkDefFunc time.Time `db:"date_pk_def_func"` +} diff --git a/internal/integration_tests/mysql5/defaultsettings/DatePkRef.go b/internal/integration_tests/mysql5/defaultsettings/DatePkRef.go new file mode 100644 index 00000000..e4f6d521 --- /dev/null +++ b/internal/integration_tests/mysql5/defaultsettings/DatePkRef.go @@ -0,0 +1,9 @@ +package dto + +import ( + "time" +) + +type DatePkRef struct { + DatePkRef time.Time `db:"date_pk_ref"` +} diff --git a/internal/integration_tests/mysql5/defaultsettings/DateRef.go b/internal/integration_tests/mysql5/defaultsettings/DateRef.go new file mode 100644 index 00000000..aef0b9fa --- /dev/null +++ b/internal/integration_tests/mysql5/defaultsettings/DateRef.go @@ -0,0 +1,9 @@ +package dto + +import ( + "database/sql" +) + +type DateRef struct { + DateRef sql.NullTime `db:"date_ref"` +} diff --git a/internal/integration_tests/mysql5/defaultsettings/DateTable.go b/internal/integration_tests/mysql5/defaultsettings/DateTable.go new file mode 100644 index 00000000..c83707a4 --- /dev/null +++ b/internal/integration_tests/mysql5/defaultsettings/DateTable.go @@ -0,0 +1,32 @@ +package dto + +import ( + "database/sql" + "time" +) + +type DateTable struct { + Date sql.NullTime `db:"date"` + DateNn time.Time `db:"date_nn"` + DateNnUnique time.Time `db:"date_nn_unique"` + DateNnCheck time.Time `db:"date_nn_check"` + DateNnRef time.Time `db:"date_nn_ref"` + DateNnDefConst time.Time `db:"date_nn_def_const"` + DateNnDefFunc time.Time `db:"date_nn_def_func"` + DateNnUniqueCheck time.Time `db:"date_nn_unique_check"` + DateUnique sql.NullTime `db:"date_unique"` + DateUniqueCheck sql.NullTime `db:"date_unique_check"` + DateUniqueRef sql.NullTime `db:"date_unique_ref"` + DateUniqueDefConst sql.NullTime `db:"date_unique_def_const"` + DateUniqueDefFunc sql.NullTime `db:"date_unique_def_func"` + DateCheck sql.NullTime `db:"date_check"` + DateCheckRef sql.NullTime `db:"date_check_ref"` + DateCheckDefConst sql.NullTime `db:"date_check_def_const"` + DateCheckDefFunc sql.NullTime `db:"date_check_def_func"` + DateRef sql.NullTime `db:"date_ref"` + DateRefUniqueCheck sql.NullTime `db:"date_ref_unique_check"` + DateDefConst sql.NullTime `db:"date_def_const"` + DateDefConstUniqueCheck sql.NullTime `db:"date_def_const_unique_check"` + DateDefFunc sql.NullTime `db:"date_def_func"` + DateDefFuncUniqueCheck sql.NullTime `db:"date_def_func_unique_check"` +} diff --git a/internal/integration_tests/mysql5/defaultsettings/DateUniqueCheckPk.go b/internal/integration_tests/mysql5/defaultsettings/DateUniqueCheckPk.go new file mode 100644 index 00000000..de81a9ee --- /dev/null +++ b/internal/integration_tests/mysql5/defaultsettings/DateUniqueCheckPk.go @@ -0,0 +1,9 @@ +package dto + +import ( + "time" +) + +type DateUniqueCheckPk struct { + DateUniqueCheckPk time.Time `db:"date_unique_check_pk"` +} diff --git a/internal/integration_tests/mysql5/defaultsettings/DateUniqueCheckPkRef.go b/internal/integration_tests/mysql5/defaultsettings/DateUniqueCheckPkRef.go new file mode 100644 index 00000000..9c44f9cd --- /dev/null +++ b/internal/integration_tests/mysql5/defaultsettings/DateUniqueCheckPkRef.go @@ -0,0 +1,9 @@ +package dto + +import ( + "time" +) + +type DateUniqueCheckPkRef struct { + DateUniqueCheckPkRef time.Time `db:"date_unique_check_pk_ref"` +} diff --git a/internal/integration_tests/mysql5/defaultsettings/DateUniquePk.go b/internal/integration_tests/mysql5/defaultsettings/DateUniquePk.go new file mode 100644 index 00000000..8a2081d9 --- /dev/null +++ b/internal/integration_tests/mysql5/defaultsettings/DateUniquePk.go @@ -0,0 +1,9 @@ +package dto + +import ( + "time" +) + +type DateUniquePk struct { + DateUniquePk time.Time `db:"date_unique_pk"` +} diff --git a/internal/integration_tests/mysql5/defaultsettings/DatetimeCheckPk.go b/internal/integration_tests/mysql5/defaultsettings/DatetimeCheckPk.go new file mode 100644 index 00000000..94283788 --- /dev/null +++ b/internal/integration_tests/mysql5/defaultsettings/DatetimeCheckPk.go @@ -0,0 +1,9 @@ +package dto + +import ( + "time" +) + +type DatetimeCheckPk struct { + DatetimeCheckPk time.Time `db:"datetime_check_pk"` +} diff --git a/internal/integration_tests/mysql5/defaultsettings/DatetimeDefConstUniqueCheckPk.go b/internal/integration_tests/mysql5/defaultsettings/DatetimeDefConstUniqueCheckPk.go new file mode 100644 index 00000000..42c954d1 --- /dev/null +++ b/internal/integration_tests/mysql5/defaultsettings/DatetimeDefConstUniqueCheckPk.go @@ -0,0 +1,9 @@ +package dto + +import ( + "time" +) + +type DatetimeDefConstUniqueCheckPk struct { + DatetimeDefConstUniqueCheckPk time.Time `db:"datetime_def_const_unique_check_pk"` +} diff --git a/internal/integration_tests/mysql5/defaultsettings/DatetimeDefConstUniqueCheckPkRef.go b/internal/integration_tests/mysql5/defaultsettings/DatetimeDefConstUniqueCheckPkRef.go new file mode 100644 index 00000000..de2a504a --- /dev/null +++ b/internal/integration_tests/mysql5/defaultsettings/DatetimeDefConstUniqueCheckPkRef.go @@ -0,0 +1,9 @@ +package dto + +import ( + "time" +) + +type DatetimeDefConstUniqueCheckPkRef struct { + DatetimeDefConstUniqueCheckPkRef time.Time `db:"datetime_def_const_unique_check_pk_ref"` +} diff --git a/internal/integration_tests/mysql5/defaultsettings/DatetimeDefFuncUniqueCheckPk.go b/internal/integration_tests/mysql5/defaultsettings/DatetimeDefFuncUniqueCheckPk.go new file mode 100644 index 00000000..bdb6ac27 --- /dev/null +++ b/internal/integration_tests/mysql5/defaultsettings/DatetimeDefFuncUniqueCheckPk.go @@ -0,0 +1,9 @@ +package dto + +import ( + "time" +) + +type DatetimeDefFuncUniqueCheckPk struct { + DatetimeDefFuncUniqueCheckPk time.Time `db:"datetime_def_func_unique_check_pk"` +} diff --git a/internal/integration_tests/mysql5/defaultsettings/DatetimeDefFuncUniqueCheckPkRef.go b/internal/integration_tests/mysql5/defaultsettings/DatetimeDefFuncUniqueCheckPkRef.go new file mode 100644 index 00000000..5bc51f30 --- /dev/null +++ b/internal/integration_tests/mysql5/defaultsettings/DatetimeDefFuncUniqueCheckPkRef.go @@ -0,0 +1,9 @@ +package dto + +import ( + "time" +) + +type DatetimeDefFuncUniqueCheckPkRef struct { + DatetimeDefFuncUniqueCheckPkRef time.Time `db:"datetime_def_func_unique_check_pk_ref"` +} diff --git a/internal/integration_tests/mysql5/defaultsettings/DatetimeNnPk.go b/internal/integration_tests/mysql5/defaultsettings/DatetimeNnPk.go new file mode 100644 index 00000000..30998f47 --- /dev/null +++ b/internal/integration_tests/mysql5/defaultsettings/DatetimeNnPk.go @@ -0,0 +1,9 @@ +package dto + +import ( + "time" +) + +type DatetimeNnPk struct { + DatetimeNnPk time.Time `db:"datetime_nn_pk"` +} diff --git a/internal/integration_tests/mysql5/defaultsettings/DatetimeNnUniqueCheckPk.go b/internal/integration_tests/mysql5/defaultsettings/DatetimeNnUniqueCheckPk.go new file mode 100644 index 00000000..f6d77322 --- /dev/null +++ b/internal/integration_tests/mysql5/defaultsettings/DatetimeNnUniqueCheckPk.go @@ -0,0 +1,9 @@ +package dto + +import ( + "time" +) + +type DatetimeNnUniqueCheckPk struct { + DatetimeNnUniqueCheckPk time.Time `db:"datetime_nn_unique_check_pk"` +} diff --git a/internal/integration_tests/mysql5/defaultsettings/DatetimeNnUniqueCheckPkRef.go b/internal/integration_tests/mysql5/defaultsettings/DatetimeNnUniqueCheckPkRef.go new file mode 100644 index 00000000..82611c60 --- /dev/null +++ b/internal/integration_tests/mysql5/defaultsettings/DatetimeNnUniqueCheckPkRef.go @@ -0,0 +1,9 @@ +package dto + +import ( + "time" +) + +type DatetimeNnUniqueCheckPkRef struct { + DatetimeNnUniqueCheckPkRef time.Time `db:"datetime_nn_unique_check_pk_ref"` +} diff --git a/internal/integration_tests/mysql5/defaultsettings/DatetimePk.go b/internal/integration_tests/mysql5/defaultsettings/DatetimePk.go new file mode 100644 index 00000000..f514c724 --- /dev/null +++ b/internal/integration_tests/mysql5/defaultsettings/DatetimePk.go @@ -0,0 +1,9 @@ +package dto + +import ( + "time" +) + +type DatetimePk struct { + DatetimePk time.Time `db:"datetime_pk"` +} diff --git a/internal/integration_tests/mysql5/defaultsettings/DatetimePkDefConst.go b/internal/integration_tests/mysql5/defaultsettings/DatetimePkDefConst.go new file mode 100644 index 00000000..3fc935f7 --- /dev/null +++ b/internal/integration_tests/mysql5/defaultsettings/DatetimePkDefConst.go @@ -0,0 +1,9 @@ +package dto + +import ( + "time" +) + +type DatetimePkDefConst struct { + DatetimePkDefConst time.Time `db:"datetime_pk_def_const"` +} diff --git a/internal/integration_tests/mysql5/defaultsettings/DatetimePkDefFunc.go b/internal/integration_tests/mysql5/defaultsettings/DatetimePkDefFunc.go new file mode 100644 index 00000000..3562a7cd --- /dev/null +++ b/internal/integration_tests/mysql5/defaultsettings/DatetimePkDefFunc.go @@ -0,0 +1,9 @@ +package dto + +import ( + "time" +) + +type DatetimePkDefFunc struct { + DatetimePkDefFunc time.Time `db:"datetime_pk_def_func"` +} diff --git a/internal/integration_tests/mysql5/defaultsettings/DatetimePkRef.go b/internal/integration_tests/mysql5/defaultsettings/DatetimePkRef.go new file mode 100644 index 00000000..a4e05075 --- /dev/null +++ b/internal/integration_tests/mysql5/defaultsettings/DatetimePkRef.go @@ -0,0 +1,9 @@ +package dto + +import ( + "time" +) + +type DatetimePkRef struct { + DatetimePkRef time.Time `db:"datetime_pk_ref"` +} diff --git a/internal/integration_tests/mysql5/defaultsettings/DatetimeRef.go b/internal/integration_tests/mysql5/defaultsettings/DatetimeRef.go new file mode 100644 index 00000000..a7e1480c --- /dev/null +++ b/internal/integration_tests/mysql5/defaultsettings/DatetimeRef.go @@ -0,0 +1,9 @@ +package dto + +import ( + "database/sql" +) + +type DatetimeRef struct { + DatetimeRef sql.NullTime `db:"datetime_ref"` +} diff --git a/internal/integration_tests/mysql5/defaultsettings/DatetimeTable.go b/internal/integration_tests/mysql5/defaultsettings/DatetimeTable.go new file mode 100644 index 00000000..36b7bc40 --- /dev/null +++ b/internal/integration_tests/mysql5/defaultsettings/DatetimeTable.go @@ -0,0 +1,32 @@ +package dto + +import ( + "database/sql" + "time" +) + +type DatetimeTable struct { + Datetime sql.NullTime `db:"datetime"` + DatetimeNn time.Time `db:"datetime_nn"` + DatetimeNnUnique time.Time `db:"datetime_nn_unique"` + DatetimeNnCheck time.Time `db:"datetime_nn_check"` + DatetimeNnRef time.Time `db:"datetime_nn_ref"` + DatetimeNnDefConst time.Time `db:"datetime_nn_def_const"` + DatetimeNnDefFunc time.Time `db:"datetime_nn_def_func"` + DatetimeNnUniqueCheck time.Time `db:"datetime_nn_unique_check"` + DatetimeUnique sql.NullTime `db:"datetime_unique"` + DatetimeUniqueCheck sql.NullTime `db:"datetime_unique_check"` + DatetimeUniqueRef sql.NullTime `db:"datetime_unique_ref"` + DatetimeUniqueDefConst sql.NullTime `db:"datetime_unique_def_const"` + DatetimeUniqueDefFunc sql.NullTime `db:"datetime_unique_def_func"` + DatetimeCheck sql.NullTime `db:"datetime_check"` + DatetimeCheckRef sql.NullTime `db:"datetime_check_ref"` + DatetimeCheckDefConst sql.NullTime `db:"datetime_check_def_const"` + DatetimeCheckDefFunc sql.NullTime `db:"datetime_check_def_func"` + DatetimeRef sql.NullTime `db:"datetime_ref"` + DatetimeRefUniqueCheck sql.NullTime `db:"datetime_ref_unique_check"` + DatetimeDefConst sql.NullTime `db:"datetime_def_const"` + DatetimeDefConstUniqueCheck sql.NullTime `db:"datetime_def_const_unique_check"` + DatetimeDefFunc sql.NullTime `db:"datetime_def_func"` + DatetimeDefFuncUniqueCheck sql.NullTime `db:"datetime_def_func_unique_check"` +} diff --git a/internal/integration_tests/mysql5/defaultsettings/DatetimeUniqueCheckPk.go b/internal/integration_tests/mysql5/defaultsettings/DatetimeUniqueCheckPk.go new file mode 100644 index 00000000..f5afbf89 --- /dev/null +++ b/internal/integration_tests/mysql5/defaultsettings/DatetimeUniqueCheckPk.go @@ -0,0 +1,9 @@ +package dto + +import ( + "time" +) + +type DatetimeUniqueCheckPk struct { + DatetimeUniqueCheckPk time.Time `db:"datetime_unique_check_pk"` +} diff --git a/internal/integration_tests/mysql5/defaultsettings/DatetimeUniqueCheckPkRef.go b/internal/integration_tests/mysql5/defaultsettings/DatetimeUniqueCheckPkRef.go new file mode 100644 index 00000000..5b9834ba --- /dev/null +++ b/internal/integration_tests/mysql5/defaultsettings/DatetimeUniqueCheckPkRef.go @@ -0,0 +1,9 @@ +package dto + +import ( + "time" +) + +type DatetimeUniqueCheckPkRef struct { + DatetimeUniqueCheckPkRef time.Time `db:"datetime_unique_check_pk_ref"` +} diff --git a/internal/integration_tests/mysql5/defaultsettings/DatetimeUniquePk.go b/internal/integration_tests/mysql5/defaultsettings/DatetimeUniquePk.go new file mode 100644 index 00000000..efd8e62c --- /dev/null +++ b/internal/integration_tests/mysql5/defaultsettings/DatetimeUniquePk.go @@ -0,0 +1,9 @@ +package dto + +import ( + "time" +) + +type DatetimeUniquePk struct { + DatetimeUniquePk time.Time `db:"datetime_unique_pk"` +} diff --git a/internal/integration_tests/mysql5/defaultsettings/DecimalCheckPk.go b/internal/integration_tests/mysql5/defaultsettings/DecimalCheckPk.go new file mode 100644 index 00000000..e51ea81a --- /dev/null +++ b/internal/integration_tests/mysql5/defaultsettings/DecimalCheckPk.go @@ -0,0 +1,5 @@ +package dto + +type DecimalCheckPk struct { + DecimalCheckPk float64 `db:"decimal_check_pk"` +} diff --git a/internal/integration_tests/mysql5/defaultsettings/DecimalDefConstUniqueCheckPk.go b/internal/integration_tests/mysql5/defaultsettings/DecimalDefConstUniqueCheckPk.go new file mode 100644 index 00000000..725b1900 --- /dev/null +++ b/internal/integration_tests/mysql5/defaultsettings/DecimalDefConstUniqueCheckPk.go @@ -0,0 +1,5 @@ +package dto + +type DecimalDefConstUniqueCheckPk struct { + DecimalDefConstUniqueCheckPk float64 `db:"decimal_def_const_unique_check_pk"` +} diff --git a/internal/integration_tests/mysql5/defaultsettings/DecimalDefConstUniqueCheckPkRef.go b/internal/integration_tests/mysql5/defaultsettings/DecimalDefConstUniqueCheckPkRef.go new file mode 100644 index 00000000..47a13f96 --- /dev/null +++ b/internal/integration_tests/mysql5/defaultsettings/DecimalDefConstUniqueCheckPkRef.go @@ -0,0 +1,5 @@ +package dto + +type DecimalDefConstUniqueCheckPkRef struct { + DecimalDefConstUniqueCheckPkRef float64 `db:"decimal_def_const_unique_check_pk_ref"` +} diff --git a/internal/integration_tests/mysql5/defaultsettings/DecimalDefFuncUniqueCheckPk.go b/internal/integration_tests/mysql5/defaultsettings/DecimalDefFuncUniqueCheckPk.go new file mode 100644 index 00000000..689faf76 --- /dev/null +++ b/internal/integration_tests/mysql5/defaultsettings/DecimalDefFuncUniqueCheckPk.go @@ -0,0 +1,5 @@ +package dto + +type DecimalDefFuncUniqueCheckPk struct { + DecimalDefFuncUniqueCheckPk float64 `db:"decimal_def_func_unique_check_pk"` +} diff --git a/internal/integration_tests/mysql5/defaultsettings/DecimalDefFuncUniqueCheckPkRef.go b/internal/integration_tests/mysql5/defaultsettings/DecimalDefFuncUniqueCheckPkRef.go new file mode 100644 index 00000000..212509c5 --- /dev/null +++ b/internal/integration_tests/mysql5/defaultsettings/DecimalDefFuncUniqueCheckPkRef.go @@ -0,0 +1,5 @@ +package dto + +type DecimalDefFuncUniqueCheckPkRef struct { + DecimalDefFuncUniqueCheckPkRef float64 `db:"decimal_def_func_unique_check_pk_ref"` +} diff --git a/internal/integration_tests/mysql5/defaultsettings/DecimalNnPk.go b/internal/integration_tests/mysql5/defaultsettings/DecimalNnPk.go new file mode 100644 index 00000000..cd8f4912 --- /dev/null +++ b/internal/integration_tests/mysql5/defaultsettings/DecimalNnPk.go @@ -0,0 +1,5 @@ +package dto + +type DecimalNnPk struct { + DecimalNnPk float64 `db:"decimal_nn_pk"` +} diff --git a/internal/integration_tests/mysql5/defaultsettings/DecimalNnUniqueCheckPk.go b/internal/integration_tests/mysql5/defaultsettings/DecimalNnUniqueCheckPk.go new file mode 100644 index 00000000..fa82e68b --- /dev/null +++ b/internal/integration_tests/mysql5/defaultsettings/DecimalNnUniqueCheckPk.go @@ -0,0 +1,5 @@ +package dto + +type DecimalNnUniqueCheckPk struct { + DecimalNnUniqueCheckPk float64 `db:"decimal_nn_unique_check_pk"` +} diff --git a/internal/integration_tests/mysql5/defaultsettings/DecimalNnUniqueCheckPkRef.go b/internal/integration_tests/mysql5/defaultsettings/DecimalNnUniqueCheckPkRef.go new file mode 100644 index 00000000..f9003bf2 --- /dev/null +++ b/internal/integration_tests/mysql5/defaultsettings/DecimalNnUniqueCheckPkRef.go @@ -0,0 +1,5 @@ +package dto + +type DecimalNnUniqueCheckPkRef struct { + DecimalNnUniqueCheckPkRef float64 `db:"decimal_nn_unique_check_pk_ref"` +} diff --git a/internal/integration_tests/mysql5/defaultsettings/DecimalPk.go b/internal/integration_tests/mysql5/defaultsettings/DecimalPk.go new file mode 100644 index 00000000..42a811a1 --- /dev/null +++ b/internal/integration_tests/mysql5/defaultsettings/DecimalPk.go @@ -0,0 +1,5 @@ +package dto + +type DecimalPk struct { + DecimalPk float64 `db:"decimal_pk"` +} diff --git a/internal/integration_tests/mysql5/defaultsettings/DecimalPkDefConst.go b/internal/integration_tests/mysql5/defaultsettings/DecimalPkDefConst.go new file mode 100644 index 00000000..844cf9d1 --- /dev/null +++ b/internal/integration_tests/mysql5/defaultsettings/DecimalPkDefConst.go @@ -0,0 +1,5 @@ +package dto + +type DecimalPkDefConst struct { + DecimalPkDefConst float64 `db:"decimal_pk_def_const"` +} diff --git a/internal/integration_tests/mysql5/defaultsettings/DecimalPkDefFunc.go b/internal/integration_tests/mysql5/defaultsettings/DecimalPkDefFunc.go new file mode 100644 index 00000000..82ec62c8 --- /dev/null +++ b/internal/integration_tests/mysql5/defaultsettings/DecimalPkDefFunc.go @@ -0,0 +1,5 @@ +package dto + +type DecimalPkDefFunc struct { + DecimalPkDefFunc float64 `db:"decimal_pk_def_func"` +} diff --git a/internal/integration_tests/mysql5/defaultsettings/DecimalPkRef.go b/internal/integration_tests/mysql5/defaultsettings/DecimalPkRef.go new file mode 100644 index 00000000..bd5ef076 --- /dev/null +++ b/internal/integration_tests/mysql5/defaultsettings/DecimalPkRef.go @@ -0,0 +1,5 @@ +package dto + +type DecimalPkRef struct { + DecimalPkRef float64 `db:"decimal_pk_ref"` +} diff --git a/internal/integration_tests/mysql5/defaultsettings/DecimalRef.go b/internal/integration_tests/mysql5/defaultsettings/DecimalRef.go new file mode 100644 index 00000000..2b6e7a24 --- /dev/null +++ b/internal/integration_tests/mysql5/defaultsettings/DecimalRef.go @@ -0,0 +1,9 @@ +package dto + +import ( + "database/sql" +) + +type DecimalRef struct { + DecimalRef sql.NullFloat64 `db:"decimal_ref"` +} diff --git a/internal/integration_tests/mysql5/defaultsettings/DecimalTable.go b/internal/integration_tests/mysql5/defaultsettings/DecimalTable.go new file mode 100644 index 00000000..fc476d8b --- /dev/null +++ b/internal/integration_tests/mysql5/defaultsettings/DecimalTable.go @@ -0,0 +1,31 @@ +package dto + +import ( + "database/sql" +) + +type DecimalTable struct { + Col sql.NullFloat64 `db:"col"` + DecimalNn float64 `db:"decimal_nn"` + DecimalNnUnique float64 `db:"decimal_nn_unique"` + DecimalNnCheck float64 `db:"decimal_nn_check"` + DecimalNnRef float64 `db:"decimal_nn_ref"` + DecimalNnDefConst float64 `db:"decimal_nn_def_const"` + DecimalNnDefFunc float64 `db:"decimal_nn_def_func"` + DecimalNnUniqueCheck float64 `db:"decimal_nn_unique_check"` + DecimalUnique sql.NullFloat64 `db:"decimal_unique"` + DecimalUniqueCheck sql.NullFloat64 `db:"decimal_unique_check"` + DecimalUniqueRef sql.NullFloat64 `db:"decimal_unique_ref"` + DecimalUniqueDefConst sql.NullFloat64 `db:"decimal_unique_def_const"` + DecimalUniqueDefFunc sql.NullFloat64 `db:"decimal_unique_def_func"` + DecimalCheck sql.NullFloat64 `db:"decimal_check"` + DecimalCheckRef sql.NullFloat64 `db:"decimal_check_ref"` + DecimalCheckDefConst sql.NullFloat64 `db:"decimal_check_def_const"` + DecimalCheckDefFunc sql.NullFloat64 `db:"decimal_check_def_func"` + DecimalRef sql.NullFloat64 `db:"decimal_ref"` + DecimalRefUniqueCheck sql.NullFloat64 `db:"decimal_ref_unique_check"` + DecimalDefConst sql.NullFloat64 `db:"decimal_def_const"` + DecimalDefConstUniqueCheck sql.NullFloat64 `db:"decimal_def_const_unique_check"` + DecimalDefFunc sql.NullFloat64 `db:"decimal_def_func"` + DecimalDefFuncUniqueCheck sql.NullFloat64 `db:"decimal_def_func_unique_check"` +} diff --git a/internal/integration_tests/mysql5/defaultsettings/DecimalUniqueCheckPk.go b/internal/integration_tests/mysql5/defaultsettings/DecimalUniqueCheckPk.go new file mode 100644 index 00000000..f6df5c3e --- /dev/null +++ b/internal/integration_tests/mysql5/defaultsettings/DecimalUniqueCheckPk.go @@ -0,0 +1,5 @@ +package dto + +type DecimalUniqueCheckPk struct { + DecimalUniqueCheckPk float64 `db:"decimal_unique_check_pk"` +} diff --git a/internal/integration_tests/mysql5/defaultsettings/DecimalUniqueCheckPkRef.go b/internal/integration_tests/mysql5/defaultsettings/DecimalUniqueCheckPkRef.go new file mode 100644 index 00000000..c94f982e --- /dev/null +++ b/internal/integration_tests/mysql5/defaultsettings/DecimalUniqueCheckPkRef.go @@ -0,0 +1,5 @@ +package dto + +type DecimalUniqueCheckPkRef struct { + DecimalUniqueCheckPkRef float64 `db:"decimal_unique_check_pk_ref"` +} diff --git a/internal/integration_tests/mysql5/defaultsettings/DecimalUniquePk.go b/internal/integration_tests/mysql5/defaultsettings/DecimalUniquePk.go new file mode 100644 index 00000000..ca299e19 --- /dev/null +++ b/internal/integration_tests/mysql5/defaultsettings/DecimalUniquePk.go @@ -0,0 +1,5 @@ +package dto + +type DecimalUniquePk struct { + DecimalUniquePk float64 `db:"decimal_unique_pk"` +} diff --git a/internal/integration_tests/mysql5/defaultsettings/DoublePrecisionCheckPk.go b/internal/integration_tests/mysql5/defaultsettings/DoublePrecisionCheckPk.go new file mode 100644 index 00000000..b371f477 --- /dev/null +++ b/internal/integration_tests/mysql5/defaultsettings/DoublePrecisionCheckPk.go @@ -0,0 +1,5 @@ +package dto + +type DoublePrecisionCheckPk struct { + DoublePrecisionCheckPk float64 `db:"double_precision_check_pk"` +} diff --git a/internal/integration_tests/mysql5/defaultsettings/DoublePrecisionDefConstUniqueCheckPk.go b/internal/integration_tests/mysql5/defaultsettings/DoublePrecisionDefConstUniqueCheckPk.go new file mode 100644 index 00000000..aed14fe8 --- /dev/null +++ b/internal/integration_tests/mysql5/defaultsettings/DoublePrecisionDefConstUniqueCheckPk.go @@ -0,0 +1,5 @@ +package dto + +type DoublePrecisionDefConstUniqueCheckPk struct { + DoublePrecisionDefConstUniqueCheckPk float64 `db:"double_precision_def_const_unique_check_pk"` +} diff --git a/internal/integration_tests/mysql5/defaultsettings/DoublePrecisionDefConstUniqueCheckPkRef.go b/internal/integration_tests/mysql5/defaultsettings/DoublePrecisionDefConstUniqueCheckPkRef.go new file mode 100644 index 00000000..f3fd6f6f --- /dev/null +++ b/internal/integration_tests/mysql5/defaultsettings/DoublePrecisionDefConstUniqueCheckPkRef.go @@ -0,0 +1,5 @@ +package dto + +type DoublePrecisionDefConstUniqueCheckPkRef struct { + DoublePrecisionDefConstUniqueCheckPkRef float64 `db:"double_precision_def_const_unique_check_pk_ref"` +} diff --git a/internal/integration_tests/mysql5/defaultsettings/DoublePrecisionDefFuncUniqueCheckPk.go b/internal/integration_tests/mysql5/defaultsettings/DoublePrecisionDefFuncUniqueCheckPk.go new file mode 100644 index 00000000..d868ad99 --- /dev/null +++ b/internal/integration_tests/mysql5/defaultsettings/DoublePrecisionDefFuncUniqueCheckPk.go @@ -0,0 +1,5 @@ +package dto + +type DoublePrecisionDefFuncUniqueCheckPk struct { + DoublePrecisionDefFuncUniqueCheckPk float64 `db:"double_precision_def_func_unique_check_pk"` +} diff --git a/internal/integration_tests/mysql5/defaultsettings/DoublePrecisionDefFuncUniqueCheckPkRef.go b/internal/integration_tests/mysql5/defaultsettings/DoublePrecisionDefFuncUniqueCheckPkRef.go new file mode 100644 index 00000000..cfc1fd16 --- /dev/null +++ b/internal/integration_tests/mysql5/defaultsettings/DoublePrecisionDefFuncUniqueCheckPkRef.go @@ -0,0 +1,5 @@ +package dto + +type DoublePrecisionDefFuncUniqueCheckPkRef struct { + DoublePrecisionDefFuncUniqueCheckPkRef float64 `db:"double_precision_def_func_unique_check_pk_ref"` +} diff --git a/internal/integration_tests/mysql5/defaultsettings/DoublePrecisionNnPk.go b/internal/integration_tests/mysql5/defaultsettings/DoublePrecisionNnPk.go new file mode 100644 index 00000000..cdd85c7c --- /dev/null +++ b/internal/integration_tests/mysql5/defaultsettings/DoublePrecisionNnPk.go @@ -0,0 +1,5 @@ +package dto + +type DoublePrecisionNnPk struct { + DoublePrecisionNnPk float64 `db:"double_precision_nn_pk"` +} diff --git a/internal/integration_tests/mysql5/defaultsettings/DoublePrecisionNnUniqueCheckPk.go b/internal/integration_tests/mysql5/defaultsettings/DoublePrecisionNnUniqueCheckPk.go new file mode 100644 index 00000000..4c6f76fd --- /dev/null +++ b/internal/integration_tests/mysql5/defaultsettings/DoublePrecisionNnUniqueCheckPk.go @@ -0,0 +1,5 @@ +package dto + +type DoublePrecisionNnUniqueCheckPk struct { + DoublePrecisionNnUniqueCheckPk float64 `db:"double_precision_nn_unique_check_pk"` +} diff --git a/internal/integration_tests/mysql5/defaultsettings/DoublePrecisionNnUniqueCheckPkRef.go b/internal/integration_tests/mysql5/defaultsettings/DoublePrecisionNnUniqueCheckPkRef.go new file mode 100644 index 00000000..46f9308c --- /dev/null +++ b/internal/integration_tests/mysql5/defaultsettings/DoublePrecisionNnUniqueCheckPkRef.go @@ -0,0 +1,5 @@ +package dto + +type DoublePrecisionNnUniqueCheckPkRef struct { + DoublePrecisionNnUniqueCheckPkRef float64 `db:"double_precision_nn_unique_check_pk_ref"` +} diff --git a/internal/integration_tests/mysql5/defaultsettings/DoublePrecisionPk.go b/internal/integration_tests/mysql5/defaultsettings/DoublePrecisionPk.go new file mode 100644 index 00000000..dd4230cd --- /dev/null +++ b/internal/integration_tests/mysql5/defaultsettings/DoublePrecisionPk.go @@ -0,0 +1,5 @@ +package dto + +type DoublePrecisionPk struct { + DoublePrecisionPk float64 `db:"double_precision_pk"` +} diff --git a/internal/integration_tests/mysql5/defaultsettings/DoublePrecisionPkDefConst.go b/internal/integration_tests/mysql5/defaultsettings/DoublePrecisionPkDefConst.go new file mode 100644 index 00000000..88e67c92 --- /dev/null +++ b/internal/integration_tests/mysql5/defaultsettings/DoublePrecisionPkDefConst.go @@ -0,0 +1,5 @@ +package dto + +type DoublePrecisionPkDefConst struct { + DoublePrecisionPkDefConst float64 `db:"double_precision_pk_def_const"` +} diff --git a/internal/integration_tests/mysql5/defaultsettings/DoublePrecisionPkDefFunc.go b/internal/integration_tests/mysql5/defaultsettings/DoublePrecisionPkDefFunc.go new file mode 100644 index 00000000..a61e3112 --- /dev/null +++ b/internal/integration_tests/mysql5/defaultsettings/DoublePrecisionPkDefFunc.go @@ -0,0 +1,5 @@ +package dto + +type DoublePrecisionPkDefFunc struct { + DoublePrecisionPkDefFunc float64 `db:"double_precision_pk_def_func"` +} diff --git a/internal/integration_tests/mysql5/defaultsettings/DoublePrecisionPkRef.go b/internal/integration_tests/mysql5/defaultsettings/DoublePrecisionPkRef.go new file mode 100644 index 00000000..0ef20e93 --- /dev/null +++ b/internal/integration_tests/mysql5/defaultsettings/DoublePrecisionPkRef.go @@ -0,0 +1,5 @@ +package dto + +type DoublePrecisionPkRef struct { + DoublePrecisionPkRef float64 `db:"double_precision_pk_ref"` +} diff --git a/internal/integration_tests/mysql5/defaultsettings/DoublePrecisionRef.go b/internal/integration_tests/mysql5/defaultsettings/DoublePrecisionRef.go new file mode 100644 index 00000000..569451b6 --- /dev/null +++ b/internal/integration_tests/mysql5/defaultsettings/DoublePrecisionRef.go @@ -0,0 +1,9 @@ +package dto + +import ( + "database/sql" +) + +type DoublePrecisionRef struct { + DoublePrecisionRef sql.NullFloat64 `db:"double_precision_ref"` +} diff --git a/internal/integration_tests/mysql5/defaultsettings/DoublePrecisionTable.go b/internal/integration_tests/mysql5/defaultsettings/DoublePrecisionTable.go new file mode 100644 index 00000000..56db32f5 --- /dev/null +++ b/internal/integration_tests/mysql5/defaultsettings/DoublePrecisionTable.go @@ -0,0 +1,31 @@ +package dto + +import ( + "database/sql" +) + +type DoublePrecisionTable struct { + Col sql.NullFloat64 `db:"col"` + DoublePrecisionNn float64 `db:"double_precision_nn"` + DoublePrecisionNnUnique float64 `db:"double_precision_nn_unique"` + DoublePrecisionNnCheck float64 `db:"double_precision_nn_check"` + DoublePrecisionNnRef float64 `db:"double_precision_nn_ref"` + DoublePrecisionNnDefConst float64 `db:"double_precision_nn_def_const"` + DoublePrecisionNnDefFunc float64 `db:"double_precision_nn_def_func"` + DoublePrecisionNnUniqueCheck float64 `db:"double_precision_nn_unique_check"` + DoublePrecisionUnique sql.NullFloat64 `db:"double_precision_unique"` + DoublePrecisionUniqueCheck sql.NullFloat64 `db:"double_precision_unique_check"` + DoublePrecisionUniqueRef sql.NullFloat64 `db:"double_precision_unique_ref"` + DoublePrecisionUniqueDefConst sql.NullFloat64 `db:"double_precision_unique_def_const"` + DoublePrecisionUniqueDefFunc sql.NullFloat64 `db:"double_precision_unique_def_func"` + DoublePrecisionCheck sql.NullFloat64 `db:"double_precision_check"` + DoublePrecisionCheckRef sql.NullFloat64 `db:"double_precision_check_ref"` + DoublePrecisionCheckDefConst sql.NullFloat64 `db:"double_precision_check_def_const"` + DoublePrecisionCheckDefFunc sql.NullFloat64 `db:"double_precision_check_def_func"` + DoublePrecisionRef sql.NullFloat64 `db:"double_precision_ref"` + DoublePrecisionRefUniqueCheck sql.NullFloat64 `db:"double_precision_ref_unique_check"` + DoublePrecisionDefConst sql.NullFloat64 `db:"double_precision_def_const"` + DoublePrecisionDefConstUniqueCheck sql.NullFloat64 `db:"double_precision_def_const_unique_check"` + DoublePrecisionDefFunc sql.NullFloat64 `db:"double_precision_def_func"` + DoublePrecisionDefFuncUniqueCheck sql.NullFloat64 `db:"double_precision_def_func_unique_check"` +} diff --git a/internal/integration_tests/mysql5/defaultsettings/DoublePrecisionUniqueCheckPk.go b/internal/integration_tests/mysql5/defaultsettings/DoublePrecisionUniqueCheckPk.go new file mode 100644 index 00000000..3e3cf20b --- /dev/null +++ b/internal/integration_tests/mysql5/defaultsettings/DoublePrecisionUniqueCheckPk.go @@ -0,0 +1,5 @@ +package dto + +type DoublePrecisionUniqueCheckPk struct { + DoublePrecisionUniqueCheckPk float64 `db:"double_precision_unique_check_pk"` +} diff --git a/internal/integration_tests/mysql5/defaultsettings/DoublePrecisionUniqueCheckPkRef.go b/internal/integration_tests/mysql5/defaultsettings/DoublePrecisionUniqueCheckPkRef.go new file mode 100644 index 00000000..3655f585 --- /dev/null +++ b/internal/integration_tests/mysql5/defaultsettings/DoublePrecisionUniqueCheckPkRef.go @@ -0,0 +1,5 @@ +package dto + +type DoublePrecisionUniqueCheckPkRef struct { + DoublePrecisionUniqueCheckPkRef float64 `db:"double_precision_unique_check_pk_ref"` +} diff --git a/internal/integration_tests/mysql5/defaultsettings/DoublePrecisionUniquePk.go b/internal/integration_tests/mysql5/defaultsettings/DoublePrecisionUniquePk.go new file mode 100644 index 00000000..df2b18cc --- /dev/null +++ b/internal/integration_tests/mysql5/defaultsettings/DoublePrecisionUniquePk.go @@ -0,0 +1,5 @@ +package dto + +type DoublePrecisionUniquePk struct { + DoublePrecisionUniquePk float64 `db:"double_precision_unique_pk"` +} diff --git a/internal/integration_tests/mysql5/defaultsettings/FloatCheckPk.go b/internal/integration_tests/mysql5/defaultsettings/FloatCheckPk.go new file mode 100644 index 00000000..e40adfb8 --- /dev/null +++ b/internal/integration_tests/mysql5/defaultsettings/FloatCheckPk.go @@ -0,0 +1,5 @@ +package dto + +type FloatCheckPk struct { + FloatCheckPk float64 `db:"float_check_pk"` +} diff --git a/internal/integration_tests/mysql5/defaultsettings/FloatDefConstUniqueCheckPk.go b/internal/integration_tests/mysql5/defaultsettings/FloatDefConstUniqueCheckPk.go new file mode 100644 index 00000000..57baef77 --- /dev/null +++ b/internal/integration_tests/mysql5/defaultsettings/FloatDefConstUniqueCheckPk.go @@ -0,0 +1,5 @@ +package dto + +type FloatDefConstUniqueCheckPk struct { + FloatDefConstUniqueCheckPk float64 `db:"float_def_const_unique_check_pk"` +} diff --git a/internal/integration_tests/mysql5/defaultsettings/FloatDefConstUniqueCheckPkRef.go b/internal/integration_tests/mysql5/defaultsettings/FloatDefConstUniqueCheckPkRef.go new file mode 100644 index 00000000..6125761b --- /dev/null +++ b/internal/integration_tests/mysql5/defaultsettings/FloatDefConstUniqueCheckPkRef.go @@ -0,0 +1,5 @@ +package dto + +type FloatDefConstUniqueCheckPkRef struct { + FloatDefConstUniqueCheckPkRef float64 `db:"float_def_const_unique_check_pk_ref"` +} diff --git a/internal/integration_tests/mysql5/defaultsettings/FloatDefFuncUniqueCheckPk.go b/internal/integration_tests/mysql5/defaultsettings/FloatDefFuncUniqueCheckPk.go new file mode 100644 index 00000000..00622747 --- /dev/null +++ b/internal/integration_tests/mysql5/defaultsettings/FloatDefFuncUniqueCheckPk.go @@ -0,0 +1,5 @@ +package dto + +type FloatDefFuncUniqueCheckPk struct { + FloatDefFuncUniqueCheckPk float64 `db:"float_def_func_unique_check_pk"` +} diff --git a/internal/integration_tests/mysql5/defaultsettings/FloatDefFuncUniqueCheckPkRef.go b/internal/integration_tests/mysql5/defaultsettings/FloatDefFuncUniqueCheckPkRef.go new file mode 100644 index 00000000..8d025ad4 --- /dev/null +++ b/internal/integration_tests/mysql5/defaultsettings/FloatDefFuncUniqueCheckPkRef.go @@ -0,0 +1,5 @@ +package dto + +type FloatDefFuncUniqueCheckPkRef struct { + FloatDefFuncUniqueCheckPkRef float64 `db:"float_def_func_unique_check_pk_ref"` +} diff --git a/internal/integration_tests/mysql5/defaultsettings/FloatNnPk.go b/internal/integration_tests/mysql5/defaultsettings/FloatNnPk.go new file mode 100644 index 00000000..aa175645 --- /dev/null +++ b/internal/integration_tests/mysql5/defaultsettings/FloatNnPk.go @@ -0,0 +1,5 @@ +package dto + +type FloatNnPk struct { + FloatNnPk float64 `db:"float_nn_pk"` +} diff --git a/internal/integration_tests/mysql5/defaultsettings/FloatNnUniqueCheckPk.go b/internal/integration_tests/mysql5/defaultsettings/FloatNnUniqueCheckPk.go new file mode 100644 index 00000000..a65f5786 --- /dev/null +++ b/internal/integration_tests/mysql5/defaultsettings/FloatNnUniqueCheckPk.go @@ -0,0 +1,5 @@ +package dto + +type FloatNnUniqueCheckPk struct { + FloatNnUniqueCheckPk float64 `db:"float_nn_unique_check_pk"` +} diff --git a/internal/integration_tests/mysql5/defaultsettings/FloatNnUniqueCheckPkRef.go b/internal/integration_tests/mysql5/defaultsettings/FloatNnUniqueCheckPkRef.go new file mode 100644 index 00000000..a3253c3f --- /dev/null +++ b/internal/integration_tests/mysql5/defaultsettings/FloatNnUniqueCheckPkRef.go @@ -0,0 +1,5 @@ +package dto + +type FloatNnUniqueCheckPkRef struct { + FloatNnUniqueCheckPkRef float64 `db:"float_nn_unique_check_pk_ref"` +} diff --git a/internal/integration_tests/mysql5/defaultsettings/FloatPk.go b/internal/integration_tests/mysql5/defaultsettings/FloatPk.go new file mode 100644 index 00000000..60ca0fcb --- /dev/null +++ b/internal/integration_tests/mysql5/defaultsettings/FloatPk.go @@ -0,0 +1,5 @@ +package dto + +type FloatPk struct { + FloatPk float64 `db:"float_pk"` +} diff --git a/internal/integration_tests/mysql5/defaultsettings/FloatPkDefConst.go b/internal/integration_tests/mysql5/defaultsettings/FloatPkDefConst.go new file mode 100644 index 00000000..1660a67a --- /dev/null +++ b/internal/integration_tests/mysql5/defaultsettings/FloatPkDefConst.go @@ -0,0 +1,5 @@ +package dto + +type FloatPkDefConst struct { + FloatPkDefConst float64 `db:"float_pk_def_const"` +} diff --git a/internal/integration_tests/mysql5/defaultsettings/FloatPkDefFunc.go b/internal/integration_tests/mysql5/defaultsettings/FloatPkDefFunc.go new file mode 100644 index 00000000..e2de6364 --- /dev/null +++ b/internal/integration_tests/mysql5/defaultsettings/FloatPkDefFunc.go @@ -0,0 +1,5 @@ +package dto + +type FloatPkDefFunc struct { + FloatPkDefFunc float64 `db:"float_pk_def_func"` +} diff --git a/internal/integration_tests/mysql5/defaultsettings/FloatPkRef.go b/internal/integration_tests/mysql5/defaultsettings/FloatPkRef.go new file mode 100644 index 00000000..476d656e --- /dev/null +++ b/internal/integration_tests/mysql5/defaultsettings/FloatPkRef.go @@ -0,0 +1,5 @@ +package dto + +type FloatPkRef struct { + FloatPkRef float64 `db:"float_pk_ref"` +} diff --git a/internal/integration_tests/mysql5/defaultsettings/FloatRef.go b/internal/integration_tests/mysql5/defaultsettings/FloatRef.go new file mode 100644 index 00000000..9a43e1af --- /dev/null +++ b/internal/integration_tests/mysql5/defaultsettings/FloatRef.go @@ -0,0 +1,9 @@ +package dto + +import ( + "database/sql" +) + +type FloatRef struct { + FloatRef sql.NullFloat64 `db:"float_ref"` +} diff --git a/internal/integration_tests/mysql5/defaultsettings/FloatTable.go b/internal/integration_tests/mysql5/defaultsettings/FloatTable.go new file mode 100644 index 00000000..e0c1fd48 --- /dev/null +++ b/internal/integration_tests/mysql5/defaultsettings/FloatTable.go @@ -0,0 +1,31 @@ +package dto + +import ( + "database/sql" +) + +type FloatTable struct { + Col sql.NullFloat64 `db:"col"` + FloatNn float64 `db:"float_nn"` + FloatNnUnique float64 `db:"float_nn_unique"` + FloatNnCheck float64 `db:"float_nn_check"` + FloatNnRef float64 `db:"float_nn_ref"` + FloatNnDefConst float64 `db:"float_nn_def_const"` + FloatNnDefFunc float64 `db:"float_nn_def_func"` + FloatNnUniqueCheck float64 `db:"float_nn_unique_check"` + FloatUnique sql.NullFloat64 `db:"float_unique"` + FloatUniqueCheck sql.NullFloat64 `db:"float_unique_check"` + FloatUniqueRef sql.NullFloat64 `db:"float_unique_ref"` + FloatUniqueDefConst sql.NullFloat64 `db:"float_unique_def_const"` + FloatUniqueDefFunc sql.NullFloat64 `db:"float_unique_def_func"` + FloatCheck sql.NullFloat64 `db:"float_check"` + FloatCheckRef sql.NullFloat64 `db:"float_check_ref"` + FloatCheckDefConst sql.NullFloat64 `db:"float_check_def_const"` + FloatCheckDefFunc sql.NullFloat64 `db:"float_check_def_func"` + FloatRef sql.NullFloat64 `db:"float_ref"` + FloatRefUniqueCheck sql.NullFloat64 `db:"float_ref_unique_check"` + FloatDefConst sql.NullFloat64 `db:"float_def_const"` + FloatDefConstUniqueCheck sql.NullFloat64 `db:"float_def_const_unique_check"` + FloatDefFunc sql.NullFloat64 `db:"float_def_func"` + FloatDefFuncUniqueCheck sql.NullFloat64 `db:"float_def_func_unique_check"` +} diff --git a/internal/integration_tests/mysql5/defaultsettings/FloatUniqueCheckPk.go b/internal/integration_tests/mysql5/defaultsettings/FloatUniqueCheckPk.go new file mode 100644 index 00000000..81ddc37f --- /dev/null +++ b/internal/integration_tests/mysql5/defaultsettings/FloatUniqueCheckPk.go @@ -0,0 +1,5 @@ +package dto + +type FloatUniqueCheckPk struct { + FloatUniqueCheckPk float64 `db:"float_unique_check_pk"` +} diff --git a/internal/integration_tests/mysql5/defaultsettings/FloatUniqueCheckPkRef.go b/internal/integration_tests/mysql5/defaultsettings/FloatUniqueCheckPkRef.go new file mode 100644 index 00000000..530d26cc --- /dev/null +++ b/internal/integration_tests/mysql5/defaultsettings/FloatUniqueCheckPkRef.go @@ -0,0 +1,5 @@ +package dto + +type FloatUniqueCheckPkRef struct { + FloatUniqueCheckPkRef float64 `db:"float_unique_check_pk_ref"` +} diff --git a/internal/integration_tests/mysql5/defaultsettings/FloatUniquePk.go b/internal/integration_tests/mysql5/defaultsettings/FloatUniquePk.go new file mode 100644 index 00000000..6f0e1fbd --- /dev/null +++ b/internal/integration_tests/mysql5/defaultsettings/FloatUniquePk.go @@ -0,0 +1,5 @@ +package dto + +type FloatUniquePk struct { + FloatUniquePk float64 `db:"float_unique_pk"` +} diff --git a/internal/integration_tests/mysql5/defaultsettings/IntegerCheckPk.go b/internal/integration_tests/mysql5/defaultsettings/IntegerCheckPk.go new file mode 100644 index 00000000..ad7c9d02 --- /dev/null +++ b/internal/integration_tests/mysql5/defaultsettings/IntegerCheckPk.go @@ -0,0 +1,5 @@ +package dto + +type IntegerCheckPk struct { + IntegerCheckPk int `db:"integer_check_pk"` +} diff --git a/internal/integration_tests/mysql5/defaultsettings/IntegerDefConstUniqueCheckPk.go b/internal/integration_tests/mysql5/defaultsettings/IntegerDefConstUniqueCheckPk.go new file mode 100644 index 00000000..72165e92 --- /dev/null +++ b/internal/integration_tests/mysql5/defaultsettings/IntegerDefConstUniqueCheckPk.go @@ -0,0 +1,5 @@ +package dto + +type IntegerDefConstUniqueCheckPk struct { + IntegerDefConstUniqueCheckPk int `db:"integer_def_const_unique_check_pk"` +} diff --git a/internal/integration_tests/mysql5/defaultsettings/IntegerDefConstUniqueCheckPkRef.go b/internal/integration_tests/mysql5/defaultsettings/IntegerDefConstUniqueCheckPkRef.go new file mode 100644 index 00000000..3345b997 --- /dev/null +++ b/internal/integration_tests/mysql5/defaultsettings/IntegerDefConstUniqueCheckPkRef.go @@ -0,0 +1,5 @@ +package dto + +type IntegerDefConstUniqueCheckPkRef struct { + IntegerDefConstUniqueCheckPkRef int `db:"integer_def_const_unique_check_pk_ref"` +} diff --git a/internal/integration_tests/mysql5/defaultsettings/IntegerDefFuncUniqueCheckPk.go b/internal/integration_tests/mysql5/defaultsettings/IntegerDefFuncUniqueCheckPk.go new file mode 100644 index 00000000..842dc704 --- /dev/null +++ b/internal/integration_tests/mysql5/defaultsettings/IntegerDefFuncUniqueCheckPk.go @@ -0,0 +1,5 @@ +package dto + +type IntegerDefFuncUniqueCheckPk struct { + IntegerDefFuncUniqueCheckPk int `db:"integer_def_func_unique_check_pk"` +} diff --git a/internal/integration_tests/mysql5/defaultsettings/IntegerDefFuncUniqueCheckPkRef.go b/internal/integration_tests/mysql5/defaultsettings/IntegerDefFuncUniqueCheckPkRef.go new file mode 100644 index 00000000..8f406218 --- /dev/null +++ b/internal/integration_tests/mysql5/defaultsettings/IntegerDefFuncUniqueCheckPkRef.go @@ -0,0 +1,5 @@ +package dto + +type IntegerDefFuncUniqueCheckPkRef struct { + IntegerDefFuncUniqueCheckPkRef int `db:"integer_def_func_unique_check_pk_ref"` +} diff --git a/internal/integration_tests/mysql5/defaultsettings/IntegerNnPk.go b/internal/integration_tests/mysql5/defaultsettings/IntegerNnPk.go new file mode 100644 index 00000000..2ec86875 --- /dev/null +++ b/internal/integration_tests/mysql5/defaultsettings/IntegerNnPk.go @@ -0,0 +1,5 @@ +package dto + +type IntegerNnPk struct { + IntegerNnPk int `db:"integer_nn_pk"` +} diff --git a/internal/integration_tests/mysql5/defaultsettings/IntegerNnUniqueCheckPk.go b/internal/integration_tests/mysql5/defaultsettings/IntegerNnUniqueCheckPk.go new file mode 100644 index 00000000..f9311f0e --- /dev/null +++ b/internal/integration_tests/mysql5/defaultsettings/IntegerNnUniqueCheckPk.go @@ -0,0 +1,5 @@ +package dto + +type IntegerNnUniqueCheckPk struct { + IntegerNnUniqueCheckPk int `db:"integer_nn_unique_check_pk"` +} diff --git a/internal/integration_tests/mysql5/defaultsettings/IntegerNnUniqueCheckPkRef.go b/internal/integration_tests/mysql5/defaultsettings/IntegerNnUniqueCheckPkRef.go new file mode 100644 index 00000000..9dca594a --- /dev/null +++ b/internal/integration_tests/mysql5/defaultsettings/IntegerNnUniqueCheckPkRef.go @@ -0,0 +1,5 @@ +package dto + +type IntegerNnUniqueCheckPkRef struct { + IntegerNnUniqueCheckPkRef int `db:"integer_nn_unique_check_pk_ref"` +} diff --git a/internal/integration_tests/mysql5/defaultsettings/IntegerPk.go b/internal/integration_tests/mysql5/defaultsettings/IntegerPk.go new file mode 100644 index 00000000..4ad7290a --- /dev/null +++ b/internal/integration_tests/mysql5/defaultsettings/IntegerPk.go @@ -0,0 +1,5 @@ +package dto + +type IntegerPk struct { + IntegerPk int `db:"integer_pk"` +} diff --git a/internal/integration_tests/mysql5/defaultsettings/IntegerPkDefConst.go b/internal/integration_tests/mysql5/defaultsettings/IntegerPkDefConst.go new file mode 100644 index 00000000..16ca6af6 --- /dev/null +++ b/internal/integration_tests/mysql5/defaultsettings/IntegerPkDefConst.go @@ -0,0 +1,5 @@ +package dto + +type IntegerPkDefConst struct { + IntegerPkDefConst int `db:"integer_pk_def_const"` +} diff --git a/internal/integration_tests/mysql5/defaultsettings/IntegerPkDefFunc.go b/internal/integration_tests/mysql5/defaultsettings/IntegerPkDefFunc.go new file mode 100644 index 00000000..902032a0 --- /dev/null +++ b/internal/integration_tests/mysql5/defaultsettings/IntegerPkDefFunc.go @@ -0,0 +1,5 @@ +package dto + +type IntegerPkDefFunc struct { + IntegerPkDefFunc int `db:"integer_pk_def_func"` +} diff --git a/internal/integration_tests/mysql5/defaultsettings/IntegerPkRef.go b/internal/integration_tests/mysql5/defaultsettings/IntegerPkRef.go new file mode 100644 index 00000000..4b526720 --- /dev/null +++ b/internal/integration_tests/mysql5/defaultsettings/IntegerPkRef.go @@ -0,0 +1,5 @@ +package dto + +type IntegerPkRef struct { + IntegerPkRef int `db:"integer_pk_ref"` +} diff --git a/internal/integration_tests/mysql5/defaultsettings/IntegerRef.go b/internal/integration_tests/mysql5/defaultsettings/IntegerRef.go new file mode 100644 index 00000000..0c130331 --- /dev/null +++ b/internal/integration_tests/mysql5/defaultsettings/IntegerRef.go @@ -0,0 +1,9 @@ +package dto + +import ( + "database/sql" +) + +type IntegerRef struct { + IntegerRef sql.NullInt64 `db:"integer_ref"` +} diff --git a/internal/integration_tests/mysql5/defaultsettings/IntegerTable.go b/internal/integration_tests/mysql5/defaultsettings/IntegerTable.go new file mode 100644 index 00000000..4fc8d333 --- /dev/null +++ b/internal/integration_tests/mysql5/defaultsettings/IntegerTable.go @@ -0,0 +1,27 @@ +package dto + +import ( + "database/sql" +) + +type IntegerTable struct { + I sql.NullInt64 `db:"i"` + IntegerNn int `db:"integer_nn"` + IntegerNnUnique int `db:"integer_nn_unique"` + IntegerNnCheck int `db:"integer_nn_check"` + IntegerUnique sql.NullInt64 `db:"integer_unique"` + IntegerUniqueCheck sql.NullInt64 `db:"integer_unique_check"` + IntegerUniqueRef sql.NullInt64 `db:"integer_unique_ref"` + IntegerUniqueDefConst sql.NullInt64 `db:"integer_unique_def_const"` + IntegerUniqueDefFunc sql.NullInt64 `db:"integer_unique_def_func"` + IntegerCheck sql.NullInt64 `db:"integer_check"` + IntegerCheckRef sql.NullInt64 `db:"integer_check_ref"` + IntegerCheckDefConst sql.NullInt64 `db:"integer_check_def_const"` + IntegerCheckDefFunc sql.NullInt64 `db:"integer_check_def_func"` + IntegerRef sql.NullInt64 `db:"integer_ref"` + IntegerRefUniqueCheck sql.NullInt64 `db:"integer_ref_unique_check"` + IntegerDefConst sql.NullInt64 `db:"integer_def_const"` + IntegerDefConstUniqueCheck sql.NullInt64 `db:"integer_def_const_unique_check"` + IntegerDefFunc sql.NullInt64 `db:"integer_def_func"` + IntegerDefFuncUniqueCheck sql.NullInt64 `db:"integer_def_func_unique_check"` +} diff --git a/internal/integration_tests/mysql5/defaultsettings/IntegerUniqueCheckPk.go b/internal/integration_tests/mysql5/defaultsettings/IntegerUniqueCheckPk.go new file mode 100644 index 00000000..e9752b8b --- /dev/null +++ b/internal/integration_tests/mysql5/defaultsettings/IntegerUniqueCheckPk.go @@ -0,0 +1,5 @@ +package dto + +type IntegerUniqueCheckPk struct { + IntegerUniqueCheckPk int `db:"integer_unique_check_pk"` +} diff --git a/internal/integration_tests/mysql5/defaultsettings/IntegerUniqueCheckPkRef.go b/internal/integration_tests/mysql5/defaultsettings/IntegerUniqueCheckPkRef.go new file mode 100644 index 00000000..23ec56d9 --- /dev/null +++ b/internal/integration_tests/mysql5/defaultsettings/IntegerUniqueCheckPkRef.go @@ -0,0 +1,5 @@ +package dto + +type IntegerUniqueCheckPkRef struct { + IntegerUniqueCheckPkRef int `db:"integer_unique_check_pk_ref"` +} diff --git a/internal/integration_tests/mysql5/defaultsettings/IntegerUniquePk.go b/internal/integration_tests/mysql5/defaultsettings/IntegerUniquePk.go new file mode 100644 index 00000000..460e2616 --- /dev/null +++ b/internal/integration_tests/mysql5/defaultsettings/IntegerUniquePk.go @@ -0,0 +1,5 @@ +package dto + +type IntegerUniquePk struct { + IntegerUniquePk int `db:"integer_unique_pk"` +} diff --git a/internal/integration_tests/mysql5/defaultsettings/LongblobRef.go b/internal/integration_tests/mysql5/defaultsettings/LongblobRef.go new file mode 100644 index 00000000..27258135 --- /dev/null +++ b/internal/integration_tests/mysql5/defaultsettings/LongblobRef.go @@ -0,0 +1,5 @@ +package dto + +type LongblobRef struct { + LongblobRef string `db:"longblob_ref"` +} diff --git a/internal/integration_tests/mysql5/defaultsettings/LongblobTable.go b/internal/integration_tests/mysql5/defaultsettings/LongblobTable.go new file mode 100644 index 00000000..607f0740 --- /dev/null +++ b/internal/integration_tests/mysql5/defaultsettings/LongblobTable.go @@ -0,0 +1,22 @@ +package dto + +import ( + "database/sql" +) + +type LongblobTable struct { + Col sql.NullString `db:"col"` + LongblobDefConst sql.NullString `db:"longblob_def_const"` + LongblobDefFunc sql.NullString `db:"longblob_def_func"` + LongblobRef sql.NullString `db:"longblob_ref"` + LongblobNn string `db:"longblob_nn"` + LongblobNnCheckCmp string `db:"longblob_nn_check_cmp"` + LongblobNnCheckFn string `db:"longblob_nn_check_fn"` + LongblobNnRef string `db:"longblob_nn_ref"` + LongblobNnDefConst string `db:"longblob_nn_def_const"` + LongblobNnDefFunc string `db:"longblob_nn_def_func"` + LongblobCheck sql.NullString `db:"longblob_check"` + LongblobCheckRef sql.NullString `db:"longblob_check_ref"` + LongblobCheckDefConst sql.NullString `db:"longblob_check_def_const"` + LongblobCheckDefFunc sql.NullString `db:"longblob_check_def_func"` +} diff --git a/internal/integration_tests/mysql5/defaultsettings/LongtextRef.go b/internal/integration_tests/mysql5/defaultsettings/LongtextRef.go new file mode 100644 index 00000000..643799f5 --- /dev/null +++ b/internal/integration_tests/mysql5/defaultsettings/LongtextRef.go @@ -0,0 +1,5 @@ +package dto + +type LongtextRef struct { + LongtextRef string `db:"longtext_ref"` +} diff --git a/internal/integration_tests/mysql5/defaultsettings/LongtextTable.go b/internal/integration_tests/mysql5/defaultsettings/LongtextTable.go new file mode 100644 index 00000000..af6bd5bf --- /dev/null +++ b/internal/integration_tests/mysql5/defaultsettings/LongtextTable.go @@ -0,0 +1,22 @@ +package dto + +import ( + "database/sql" +) + +type LongtextTable struct { + Col sql.NullString `db:"col"` + LongtextDefConst sql.NullString `db:"longtext_def_const"` + LongtextDefFunc sql.NullString `db:"longtext_def_func"` + LongtextRef sql.NullString `db:"longtext_ref"` + LongtextNn string `db:"longtext_nn"` + LongtextNnCheckCmp string `db:"longtext_nn_check_cmp"` + LongtextNnCheckFn string `db:"longtext_nn_check_fn"` + LongtextNnRef string `db:"longtext_nn_ref"` + LongtextNnDefConst string `db:"longtext_nn_def_const"` + LongtextNnDefFunc string `db:"longtext_nn_def_func"` + LongtextCheck sql.NullString `db:"longtext_check"` + LongtextCheckRef sql.NullString `db:"longtext_check_ref"` + LongtextCheckDefConst sql.NullString `db:"longtext_check_def_const"` + LongtextCheckDefFunc sql.NullString `db:"longtext_check_def_func"` +} diff --git a/internal/integration_tests/mysql5/defaultsettings/MediumblobRef.go b/internal/integration_tests/mysql5/defaultsettings/MediumblobRef.go new file mode 100644 index 00000000..c07a7901 --- /dev/null +++ b/internal/integration_tests/mysql5/defaultsettings/MediumblobRef.go @@ -0,0 +1,5 @@ +package dto + +type MediumblobRef struct { + MediumblobRef string `db:"mediumblob_ref"` +} diff --git a/internal/integration_tests/mysql5/defaultsettings/MediumblobTable.go b/internal/integration_tests/mysql5/defaultsettings/MediumblobTable.go new file mode 100644 index 00000000..071a3c7b --- /dev/null +++ b/internal/integration_tests/mysql5/defaultsettings/MediumblobTable.go @@ -0,0 +1,22 @@ +package dto + +import ( + "database/sql" +) + +type MediumblobTable struct { + Col sql.NullString `db:"col"` + MediumblobDefConst sql.NullString `db:"mediumblob_def_const"` + MediumblobDefFunc sql.NullString `db:"mediumblob_def_func"` + MediumblobRef sql.NullString `db:"mediumblob_ref"` + MediumblobNn string `db:"mediumblob_nn"` + MediumblobNnCheckCmp string `db:"mediumblob_nn_check_cmp"` + MediumblobNnCheckFn string `db:"mediumblob_nn_check_fn"` + MediumblobNnRef string `db:"mediumblob_nn_ref"` + MediumblobNnDefConst string `db:"mediumblob_nn_def_const"` + MediumblobNnDefFunc string `db:"mediumblob_nn_def_func"` + MediumblobCheck sql.NullString `db:"mediumblob_check"` + MediumblobCheckRef sql.NullString `db:"mediumblob_check_ref"` + MediumblobCheckDefConst sql.NullString `db:"mediumblob_check_def_const"` + MediumblobCheckDefFunc sql.NullString `db:"mediumblob_check_def_func"` +} diff --git a/internal/integration_tests/mysql5/defaultsettings/MediumintCheckPk.go b/internal/integration_tests/mysql5/defaultsettings/MediumintCheckPk.go new file mode 100644 index 00000000..45cbb5c1 --- /dev/null +++ b/internal/integration_tests/mysql5/defaultsettings/MediumintCheckPk.go @@ -0,0 +1,5 @@ +package dto + +type MediumintCheckPk struct { + MediumintCheckPk int `db:"mediumint_check_pk"` +} diff --git a/internal/integration_tests/mysql5/defaultsettings/MediumintDefConstUniqueCheckPk.go b/internal/integration_tests/mysql5/defaultsettings/MediumintDefConstUniqueCheckPk.go new file mode 100644 index 00000000..b9ddc8db --- /dev/null +++ b/internal/integration_tests/mysql5/defaultsettings/MediumintDefConstUniqueCheckPk.go @@ -0,0 +1,5 @@ +package dto + +type MediumintDefConstUniqueCheckPk struct { + MediumintDefConstUniqueCheckPk int `db:"mediumint_def_const_unique_check_pk"` +} diff --git a/internal/integration_tests/mysql5/defaultsettings/MediumintDefConstUniqueCheckPkRef.go b/internal/integration_tests/mysql5/defaultsettings/MediumintDefConstUniqueCheckPkRef.go new file mode 100644 index 00000000..0d765358 --- /dev/null +++ b/internal/integration_tests/mysql5/defaultsettings/MediumintDefConstUniqueCheckPkRef.go @@ -0,0 +1,5 @@ +package dto + +type MediumintDefConstUniqueCheckPkRef struct { + MediumintDefConstUniqueCheckPkRef int `db:"mediumint_def_const_unique_check_pk_ref"` +} diff --git a/internal/integration_tests/mysql5/defaultsettings/MediumintDefFuncUniqueCheckPk.go b/internal/integration_tests/mysql5/defaultsettings/MediumintDefFuncUniqueCheckPk.go new file mode 100644 index 00000000..9fbe5e3e --- /dev/null +++ b/internal/integration_tests/mysql5/defaultsettings/MediumintDefFuncUniqueCheckPk.go @@ -0,0 +1,5 @@ +package dto + +type MediumintDefFuncUniqueCheckPk struct { + MediumintDefFuncUniqueCheckPk int `db:"mediumint_def_func_unique_check_pk"` +} diff --git a/internal/integration_tests/mysql5/defaultsettings/MediumintDefFuncUniqueCheckPkRef.go b/internal/integration_tests/mysql5/defaultsettings/MediumintDefFuncUniqueCheckPkRef.go new file mode 100644 index 00000000..5abfd547 --- /dev/null +++ b/internal/integration_tests/mysql5/defaultsettings/MediumintDefFuncUniqueCheckPkRef.go @@ -0,0 +1,5 @@ +package dto + +type MediumintDefFuncUniqueCheckPkRef struct { + MediumintDefFuncUniqueCheckPkRef int `db:"mediumint_def_func_unique_check_pk_ref"` +} diff --git a/internal/integration_tests/mysql5/defaultsettings/MediumintNnPk.go b/internal/integration_tests/mysql5/defaultsettings/MediumintNnPk.go new file mode 100644 index 00000000..232ab1a8 --- /dev/null +++ b/internal/integration_tests/mysql5/defaultsettings/MediumintNnPk.go @@ -0,0 +1,5 @@ +package dto + +type MediumintNnPk struct { + MediumintNnPk int `db:"mediumint_nn_pk"` +} diff --git a/internal/integration_tests/mysql5/defaultsettings/MediumintNnUniqueCheckPk.go b/internal/integration_tests/mysql5/defaultsettings/MediumintNnUniqueCheckPk.go new file mode 100644 index 00000000..b8155be5 --- /dev/null +++ b/internal/integration_tests/mysql5/defaultsettings/MediumintNnUniqueCheckPk.go @@ -0,0 +1,5 @@ +package dto + +type MediumintNnUniqueCheckPk struct { + MediumintNnUniqueCheckPk int `db:"mediumint_nn_unique_check_pk"` +} diff --git a/internal/integration_tests/mysql5/defaultsettings/MediumintNnUniqueCheckPkRef.go b/internal/integration_tests/mysql5/defaultsettings/MediumintNnUniqueCheckPkRef.go new file mode 100644 index 00000000..b116bf6d --- /dev/null +++ b/internal/integration_tests/mysql5/defaultsettings/MediumintNnUniqueCheckPkRef.go @@ -0,0 +1,5 @@ +package dto + +type MediumintNnUniqueCheckPkRef struct { + MediumintNnUniqueCheckPkRef int `db:"mediumint_nn_unique_check_pk_ref"` +} diff --git a/internal/integration_tests/mysql5/defaultsettings/MediumintPk.go b/internal/integration_tests/mysql5/defaultsettings/MediumintPk.go new file mode 100644 index 00000000..8699b985 --- /dev/null +++ b/internal/integration_tests/mysql5/defaultsettings/MediumintPk.go @@ -0,0 +1,5 @@ +package dto + +type MediumintPk struct { + MediumintPk int `db:"mediumint_pk"` +} diff --git a/internal/integration_tests/mysql5/defaultsettings/MediumintPkDefConst.go b/internal/integration_tests/mysql5/defaultsettings/MediumintPkDefConst.go new file mode 100644 index 00000000..93cfa99c --- /dev/null +++ b/internal/integration_tests/mysql5/defaultsettings/MediumintPkDefConst.go @@ -0,0 +1,5 @@ +package dto + +type MediumintPkDefConst struct { + MediumintPkDefConst int `db:"mediumint_pk_def_const"` +} diff --git a/internal/integration_tests/mysql5/defaultsettings/MediumintPkDefFunc.go b/internal/integration_tests/mysql5/defaultsettings/MediumintPkDefFunc.go new file mode 100644 index 00000000..bc09f7f8 --- /dev/null +++ b/internal/integration_tests/mysql5/defaultsettings/MediumintPkDefFunc.go @@ -0,0 +1,5 @@ +package dto + +type MediumintPkDefFunc struct { + MediumintPkDefFunc int `db:"mediumint_pk_def_func"` +} diff --git a/internal/integration_tests/mysql5/defaultsettings/MediumintPkRef.go b/internal/integration_tests/mysql5/defaultsettings/MediumintPkRef.go new file mode 100644 index 00000000..bf4a377f --- /dev/null +++ b/internal/integration_tests/mysql5/defaultsettings/MediumintPkRef.go @@ -0,0 +1,5 @@ +package dto + +type MediumintPkRef struct { + MediumintPkRef int `db:"mediumint_pk_ref"` +} diff --git a/internal/integration_tests/mysql5/defaultsettings/MediumintRef.go b/internal/integration_tests/mysql5/defaultsettings/MediumintRef.go new file mode 100644 index 00000000..d1792f5c --- /dev/null +++ b/internal/integration_tests/mysql5/defaultsettings/MediumintRef.go @@ -0,0 +1,9 @@ +package dto + +import ( + "database/sql" +) + +type MediumintRef struct { + MediumintRef sql.NullInt64 `db:"mediumint_ref"` +} diff --git a/internal/integration_tests/mysql5/defaultsettings/MediumintTable.go b/internal/integration_tests/mysql5/defaultsettings/MediumintTable.go new file mode 100644 index 00000000..899e02f6 --- /dev/null +++ b/internal/integration_tests/mysql5/defaultsettings/MediumintTable.go @@ -0,0 +1,27 @@ +package dto + +import ( + "database/sql" +) + +type MediumintTable struct { + I sql.NullInt64 `db:"i"` + MediumintNn int `db:"mediumint_nn"` + MediumintNnUnique int `db:"mediumint_nn_unique"` + MediumintNnCheck int `db:"mediumint_nn_check"` + MediumintUnique sql.NullInt64 `db:"mediumint_unique"` + MediumintUniqueCheck sql.NullInt64 `db:"mediumint_unique_check"` + MediumintUniqueRef sql.NullInt64 `db:"mediumint_unique_ref"` + MediumintUniqueDefConst sql.NullInt64 `db:"mediumint_unique_def_const"` + MediumintUniqueDefFunc sql.NullInt64 `db:"mediumint_unique_def_func"` + MediumintCheck sql.NullInt64 `db:"mediumint_check"` + MediumintCheckRef sql.NullInt64 `db:"mediumint_check_ref"` + MediumintCheckDefConst sql.NullInt64 `db:"mediumint_check_def_const"` + MediumintCheckDefFunc sql.NullInt64 `db:"mediumint_check_def_func"` + MediumintRef sql.NullInt64 `db:"mediumint_ref"` + MediumintRefUniqueCheck sql.NullInt64 `db:"mediumint_ref_unique_check"` + MediumintDefConst sql.NullInt64 `db:"mediumint_def_const"` + MediumintDefConstUniqueCheck sql.NullInt64 `db:"mediumint_def_const_unique_check"` + MediumintDefFunc sql.NullInt64 `db:"mediumint_def_func"` + MediumintDefFuncUniqueCheck sql.NullInt64 `db:"mediumint_def_func_unique_check"` +} diff --git a/internal/integration_tests/mysql5/defaultsettings/MediumintUniqueCheckPk.go b/internal/integration_tests/mysql5/defaultsettings/MediumintUniqueCheckPk.go new file mode 100644 index 00000000..560ec7bf --- /dev/null +++ b/internal/integration_tests/mysql5/defaultsettings/MediumintUniqueCheckPk.go @@ -0,0 +1,5 @@ +package dto + +type MediumintUniqueCheckPk struct { + MediumintUniqueCheckPk int `db:"mediumint_unique_check_pk"` +} diff --git a/internal/integration_tests/mysql5/defaultsettings/MediumintUniqueCheckPkRef.go b/internal/integration_tests/mysql5/defaultsettings/MediumintUniqueCheckPkRef.go new file mode 100644 index 00000000..5fc524dc --- /dev/null +++ b/internal/integration_tests/mysql5/defaultsettings/MediumintUniqueCheckPkRef.go @@ -0,0 +1,5 @@ +package dto + +type MediumintUniqueCheckPkRef struct { + MediumintUniqueCheckPkRef int `db:"mediumint_unique_check_pk_ref"` +} diff --git a/internal/integration_tests/mysql5/defaultsettings/MediumintUniquePk.go b/internal/integration_tests/mysql5/defaultsettings/MediumintUniquePk.go new file mode 100644 index 00000000..d8029efd --- /dev/null +++ b/internal/integration_tests/mysql5/defaultsettings/MediumintUniquePk.go @@ -0,0 +1,5 @@ +package dto + +type MediumintUniquePk struct { + MediumintUniquePk int `db:"mediumint_unique_pk"` +} diff --git a/internal/integration_tests/mysql5/defaultsettings/MediumtextRef.go b/internal/integration_tests/mysql5/defaultsettings/MediumtextRef.go new file mode 100644 index 00000000..8102e8aa --- /dev/null +++ b/internal/integration_tests/mysql5/defaultsettings/MediumtextRef.go @@ -0,0 +1,5 @@ +package dto + +type MediumtextRef struct { + MediumtextRef string `db:"mediumtext_ref"` +} diff --git a/internal/integration_tests/mysql5/defaultsettings/MediumtextTable.go b/internal/integration_tests/mysql5/defaultsettings/MediumtextTable.go new file mode 100644 index 00000000..05428119 --- /dev/null +++ b/internal/integration_tests/mysql5/defaultsettings/MediumtextTable.go @@ -0,0 +1,22 @@ +package dto + +import ( + "database/sql" +) + +type MediumtextTable struct { + Col sql.NullString `db:"col"` + MediumtextDefConst sql.NullString `db:"mediumtext_def_const"` + MediumtextDefFunc sql.NullString `db:"mediumtext_def_func"` + MediumtextRef sql.NullString `db:"mediumtext_ref"` + MediumtextNn string `db:"mediumtext_nn"` + MediumtextNnCheckCmp string `db:"mediumtext_nn_check_cmp"` + MediumtextNnCheckFn string `db:"mediumtext_nn_check_fn"` + MediumtextNnRef string `db:"mediumtext_nn_ref"` + MediumtextNnDefConst string `db:"mediumtext_nn_def_const"` + MediumtextNnDefFunc string `db:"mediumtext_nn_def_func"` + MediumtextCheck sql.NullString `db:"mediumtext_check"` + MediumtextCheckRef sql.NullString `db:"mediumtext_check_ref"` + MediumtextCheckDefConst sql.NullString `db:"mediumtext_check_def_const"` + MediumtextCheckDefFunc sql.NullString `db:"mediumtext_check_def_func"` +} diff --git a/internal/integration_tests/mysql5/defaultsettings/NumericCheckPk.go b/internal/integration_tests/mysql5/defaultsettings/NumericCheckPk.go new file mode 100644 index 00000000..58709a6e --- /dev/null +++ b/internal/integration_tests/mysql5/defaultsettings/NumericCheckPk.go @@ -0,0 +1,5 @@ +package dto + +type NumericCheckPk struct { + NumericCheckPk float64 `db:"numeric_check_pk"` +} diff --git a/internal/integration_tests/mysql5/defaultsettings/NumericDefConstUniqueCheckPk.go b/internal/integration_tests/mysql5/defaultsettings/NumericDefConstUniqueCheckPk.go new file mode 100644 index 00000000..e6fdd1a2 --- /dev/null +++ b/internal/integration_tests/mysql5/defaultsettings/NumericDefConstUniqueCheckPk.go @@ -0,0 +1,5 @@ +package dto + +type NumericDefConstUniqueCheckPk struct { + NumericDefConstUniqueCheckPk float64 `db:"numeric_def_const_unique_check_pk"` +} diff --git a/internal/integration_tests/mysql5/defaultsettings/NumericDefConstUniqueCheckPkRef.go b/internal/integration_tests/mysql5/defaultsettings/NumericDefConstUniqueCheckPkRef.go new file mode 100644 index 00000000..cdaee17e --- /dev/null +++ b/internal/integration_tests/mysql5/defaultsettings/NumericDefConstUniqueCheckPkRef.go @@ -0,0 +1,5 @@ +package dto + +type NumericDefConstUniqueCheckPkRef struct { + NumericDefConstUniqueCheckPkRef float64 `db:"numeric_def_const_unique_check_pk_ref"` +} diff --git a/internal/integration_tests/mysql5/defaultsettings/NumericDefFuncUniqueCheckPk.go b/internal/integration_tests/mysql5/defaultsettings/NumericDefFuncUniqueCheckPk.go new file mode 100644 index 00000000..7747f0a7 --- /dev/null +++ b/internal/integration_tests/mysql5/defaultsettings/NumericDefFuncUniqueCheckPk.go @@ -0,0 +1,5 @@ +package dto + +type NumericDefFuncUniqueCheckPk struct { + NumericDefFuncUniqueCheckPk float64 `db:"numeric_def_func_unique_check_pk"` +} diff --git a/internal/integration_tests/mysql5/defaultsettings/NumericDefFuncUniqueCheckPkRef.go b/internal/integration_tests/mysql5/defaultsettings/NumericDefFuncUniqueCheckPkRef.go new file mode 100644 index 00000000..ade94a23 --- /dev/null +++ b/internal/integration_tests/mysql5/defaultsettings/NumericDefFuncUniqueCheckPkRef.go @@ -0,0 +1,5 @@ +package dto + +type NumericDefFuncUniqueCheckPkRef struct { + NumericDefFuncUniqueCheckPkRef float64 `db:"numeric_def_func_unique_check_pk_ref"` +} diff --git a/internal/integration_tests/mysql5/defaultsettings/NumericNnPk.go b/internal/integration_tests/mysql5/defaultsettings/NumericNnPk.go new file mode 100644 index 00000000..d4f8dba5 --- /dev/null +++ b/internal/integration_tests/mysql5/defaultsettings/NumericNnPk.go @@ -0,0 +1,5 @@ +package dto + +type NumericNnPk struct { + NumericNnPk float64 `db:"numeric_nn_pk"` +} diff --git a/internal/integration_tests/mysql5/defaultsettings/NumericNnUniqueCheckPk.go b/internal/integration_tests/mysql5/defaultsettings/NumericNnUniqueCheckPk.go new file mode 100644 index 00000000..bad0e84f --- /dev/null +++ b/internal/integration_tests/mysql5/defaultsettings/NumericNnUniqueCheckPk.go @@ -0,0 +1,5 @@ +package dto + +type NumericNnUniqueCheckPk struct { + NumericNnUniqueCheckPk float64 `db:"numeric_nn_unique_check_pk"` +} diff --git a/internal/integration_tests/mysql5/defaultsettings/NumericNnUniqueCheckPkRef.go b/internal/integration_tests/mysql5/defaultsettings/NumericNnUniqueCheckPkRef.go new file mode 100644 index 00000000..c4d76752 --- /dev/null +++ b/internal/integration_tests/mysql5/defaultsettings/NumericNnUniqueCheckPkRef.go @@ -0,0 +1,5 @@ +package dto + +type NumericNnUniqueCheckPkRef struct { + NumericNnUniqueCheckPkRef float64 `db:"numeric_nn_unique_check_pk_ref"` +} diff --git a/internal/integration_tests/mysql5/defaultsettings/NumericPk.go b/internal/integration_tests/mysql5/defaultsettings/NumericPk.go new file mode 100644 index 00000000..c2d654cc --- /dev/null +++ b/internal/integration_tests/mysql5/defaultsettings/NumericPk.go @@ -0,0 +1,5 @@ +package dto + +type NumericPk struct { + NumericPk float64 `db:"numeric_pk"` +} diff --git a/internal/integration_tests/mysql5/defaultsettings/NumericPkDefConst.go b/internal/integration_tests/mysql5/defaultsettings/NumericPkDefConst.go new file mode 100644 index 00000000..b501ee37 --- /dev/null +++ b/internal/integration_tests/mysql5/defaultsettings/NumericPkDefConst.go @@ -0,0 +1,5 @@ +package dto + +type NumericPkDefConst struct { + NumericPkDefConst float64 `db:"numeric_pk_def_const"` +} diff --git a/internal/integration_tests/mysql5/defaultsettings/NumericPkDefFunc.go b/internal/integration_tests/mysql5/defaultsettings/NumericPkDefFunc.go new file mode 100644 index 00000000..13dd726d --- /dev/null +++ b/internal/integration_tests/mysql5/defaultsettings/NumericPkDefFunc.go @@ -0,0 +1,5 @@ +package dto + +type NumericPkDefFunc struct { + NumericPkDefFunc float64 `db:"numeric_pk_def_func"` +} diff --git a/internal/integration_tests/mysql5/defaultsettings/NumericPkRef.go b/internal/integration_tests/mysql5/defaultsettings/NumericPkRef.go new file mode 100644 index 00000000..af53186e --- /dev/null +++ b/internal/integration_tests/mysql5/defaultsettings/NumericPkRef.go @@ -0,0 +1,5 @@ +package dto + +type NumericPkRef struct { + NumericPkRef float64 `db:"numeric_pk_ref"` +} diff --git a/internal/integration_tests/mysql5/defaultsettings/NumericRef.go b/internal/integration_tests/mysql5/defaultsettings/NumericRef.go new file mode 100644 index 00000000..2adb8d6d --- /dev/null +++ b/internal/integration_tests/mysql5/defaultsettings/NumericRef.go @@ -0,0 +1,9 @@ +package dto + +import ( + "database/sql" +) + +type NumericRef struct { + NumericRef sql.NullFloat64 `db:"numeric_ref"` +} diff --git a/internal/integration_tests/mysql5/defaultsettings/NumericTable.go b/internal/integration_tests/mysql5/defaultsettings/NumericTable.go new file mode 100644 index 00000000..0277ce43 --- /dev/null +++ b/internal/integration_tests/mysql5/defaultsettings/NumericTable.go @@ -0,0 +1,31 @@ +package dto + +import ( + "database/sql" +) + +type NumericTable struct { + Col sql.NullFloat64 `db:"col"` + NumericNn float64 `db:"numeric_nn"` + NumericNnUnique float64 `db:"numeric_nn_unique"` + NumericNnCheck float64 `db:"numeric_nn_check"` + NumericNnRef float64 `db:"numeric_nn_ref"` + NumericNnDefConst float64 `db:"numeric_nn_def_const"` + NumericNnDefFunc float64 `db:"numeric_nn_def_func"` + NumericNnUniqueCheck float64 `db:"numeric_nn_unique_check"` + NumericUnique sql.NullFloat64 `db:"numeric_unique"` + NumericUniqueCheck sql.NullFloat64 `db:"numeric_unique_check"` + NumericUniqueRef sql.NullFloat64 `db:"numeric_unique_ref"` + NumericUniqueDefConst sql.NullFloat64 `db:"numeric_unique_def_const"` + NumericUniqueDefFunc sql.NullFloat64 `db:"numeric_unique_def_func"` + NumericCheck sql.NullFloat64 `db:"numeric_check"` + NumericCheckRef sql.NullFloat64 `db:"numeric_check_ref"` + NumericCheckDefConst sql.NullFloat64 `db:"numeric_check_def_const"` + NumericCheckDefFunc sql.NullFloat64 `db:"numeric_check_def_func"` + NumericRef sql.NullFloat64 `db:"numeric_ref"` + NumericRefUniqueCheck sql.NullFloat64 `db:"numeric_ref_unique_check"` + NumericDefConst sql.NullFloat64 `db:"numeric_def_const"` + NumericDefConstUniqueCheck sql.NullFloat64 `db:"numeric_def_const_unique_check"` + NumericDefFunc sql.NullFloat64 `db:"numeric_def_func"` + NumericDefFuncUniqueCheck sql.NullFloat64 `db:"numeric_def_func_unique_check"` +} diff --git a/internal/integration_tests/mysql5/defaultsettings/NumericUniqueCheckPk.go b/internal/integration_tests/mysql5/defaultsettings/NumericUniqueCheckPk.go new file mode 100644 index 00000000..e48c41ec --- /dev/null +++ b/internal/integration_tests/mysql5/defaultsettings/NumericUniqueCheckPk.go @@ -0,0 +1,5 @@ +package dto + +type NumericUniqueCheckPk struct { + NumericUniqueCheckPk float64 `db:"numeric_unique_check_pk"` +} diff --git a/internal/integration_tests/mysql5/defaultsettings/NumericUniqueCheckPkRef.go b/internal/integration_tests/mysql5/defaultsettings/NumericUniqueCheckPkRef.go new file mode 100644 index 00000000..d230e9c3 --- /dev/null +++ b/internal/integration_tests/mysql5/defaultsettings/NumericUniqueCheckPkRef.go @@ -0,0 +1,5 @@ +package dto + +type NumericUniqueCheckPkRef struct { + NumericUniqueCheckPkRef float64 `db:"numeric_unique_check_pk_ref"` +} diff --git a/internal/integration_tests/mysql5/defaultsettings/NumericUniquePk.go b/internal/integration_tests/mysql5/defaultsettings/NumericUniquePk.go new file mode 100644 index 00000000..308c1b60 --- /dev/null +++ b/internal/integration_tests/mysql5/defaultsettings/NumericUniquePk.go @@ -0,0 +1,5 @@ +package dto + +type NumericUniquePk struct { + NumericUniquePk float64 `db:"numeric_unique_pk"` +} diff --git a/internal/integration_tests/mysql5/defaultsettings/RealCheckPk.go b/internal/integration_tests/mysql5/defaultsettings/RealCheckPk.go new file mode 100644 index 00000000..41bbff57 --- /dev/null +++ b/internal/integration_tests/mysql5/defaultsettings/RealCheckPk.go @@ -0,0 +1,5 @@ +package dto + +type RealCheckPk struct { + RealCheckPk float64 `db:"real_check_pk"` +} diff --git a/internal/integration_tests/mysql5/defaultsettings/RealDefConstUniqueCheckPk.go b/internal/integration_tests/mysql5/defaultsettings/RealDefConstUniqueCheckPk.go new file mode 100644 index 00000000..9be61d5c --- /dev/null +++ b/internal/integration_tests/mysql5/defaultsettings/RealDefConstUniqueCheckPk.go @@ -0,0 +1,5 @@ +package dto + +type RealDefConstUniqueCheckPk struct { + RealDefConstUniqueCheckPk float64 `db:"real_def_const_unique_check_pk"` +} diff --git a/internal/integration_tests/mysql5/defaultsettings/RealDefConstUniqueCheckPkRef.go b/internal/integration_tests/mysql5/defaultsettings/RealDefConstUniqueCheckPkRef.go new file mode 100644 index 00000000..af58466f --- /dev/null +++ b/internal/integration_tests/mysql5/defaultsettings/RealDefConstUniqueCheckPkRef.go @@ -0,0 +1,5 @@ +package dto + +type RealDefConstUniqueCheckPkRef struct { + RealDefConstUniqueCheckPkRef float64 `db:"real_def_const_unique_check_pk_ref"` +} diff --git a/internal/integration_tests/mysql5/defaultsettings/RealDefFuncUniqueCheckPk.go b/internal/integration_tests/mysql5/defaultsettings/RealDefFuncUniqueCheckPk.go new file mode 100644 index 00000000..2619719a --- /dev/null +++ b/internal/integration_tests/mysql5/defaultsettings/RealDefFuncUniqueCheckPk.go @@ -0,0 +1,5 @@ +package dto + +type RealDefFuncUniqueCheckPk struct { + RealDefFuncUniqueCheckPk float64 `db:"real_def_func_unique_check_pk"` +} diff --git a/internal/integration_tests/mysql5/defaultsettings/RealDefFuncUniqueCheckPkRef.go b/internal/integration_tests/mysql5/defaultsettings/RealDefFuncUniqueCheckPkRef.go new file mode 100644 index 00000000..1c085edc --- /dev/null +++ b/internal/integration_tests/mysql5/defaultsettings/RealDefFuncUniqueCheckPkRef.go @@ -0,0 +1,5 @@ +package dto + +type RealDefFuncUniqueCheckPkRef struct { + RealDefFuncUniqueCheckPkRef float64 `db:"real_def_func_unique_check_pk_ref"` +} diff --git a/internal/integration_tests/mysql5/defaultsettings/RealNnPk.go b/internal/integration_tests/mysql5/defaultsettings/RealNnPk.go new file mode 100644 index 00000000..c9efd760 --- /dev/null +++ b/internal/integration_tests/mysql5/defaultsettings/RealNnPk.go @@ -0,0 +1,5 @@ +package dto + +type RealNnPk struct { + RealNnPk float64 `db:"real_nn_pk"` +} diff --git a/internal/integration_tests/mysql5/defaultsettings/RealNnUniqueCheckPk.go b/internal/integration_tests/mysql5/defaultsettings/RealNnUniqueCheckPk.go new file mode 100644 index 00000000..bcd80e13 --- /dev/null +++ b/internal/integration_tests/mysql5/defaultsettings/RealNnUniqueCheckPk.go @@ -0,0 +1,5 @@ +package dto + +type RealNnUniqueCheckPk struct { + RealNnUniqueCheckPk float64 `db:"real_nn_unique_check_pk"` +} diff --git a/internal/integration_tests/mysql5/defaultsettings/RealNnUniqueCheckPkRef.go b/internal/integration_tests/mysql5/defaultsettings/RealNnUniqueCheckPkRef.go new file mode 100644 index 00000000..1ab6f733 --- /dev/null +++ b/internal/integration_tests/mysql5/defaultsettings/RealNnUniqueCheckPkRef.go @@ -0,0 +1,5 @@ +package dto + +type RealNnUniqueCheckPkRef struct { + RealNnUniqueCheckPkRef float64 `db:"real_nn_unique_check_pk_ref"` +} diff --git a/internal/integration_tests/mysql5/defaultsettings/RealPk.go b/internal/integration_tests/mysql5/defaultsettings/RealPk.go new file mode 100644 index 00000000..aae62539 --- /dev/null +++ b/internal/integration_tests/mysql5/defaultsettings/RealPk.go @@ -0,0 +1,5 @@ +package dto + +type RealPk struct { + RealPk float64 `db:"real_pk"` +} diff --git a/internal/integration_tests/mysql5/defaultsettings/RealPkDefConst.go b/internal/integration_tests/mysql5/defaultsettings/RealPkDefConst.go new file mode 100644 index 00000000..dcb3b0fa --- /dev/null +++ b/internal/integration_tests/mysql5/defaultsettings/RealPkDefConst.go @@ -0,0 +1,5 @@ +package dto + +type RealPkDefConst struct { + RealPkDefConst float64 `db:"real_pk_def_const"` +} diff --git a/internal/integration_tests/mysql5/defaultsettings/RealPkDefFunc.go b/internal/integration_tests/mysql5/defaultsettings/RealPkDefFunc.go new file mode 100644 index 00000000..85041669 --- /dev/null +++ b/internal/integration_tests/mysql5/defaultsettings/RealPkDefFunc.go @@ -0,0 +1,5 @@ +package dto + +type RealPkDefFunc struct { + RealPkDefFunc float64 `db:"real_pk_def_func"` +} diff --git a/internal/integration_tests/mysql5/defaultsettings/RealPkRef.go b/internal/integration_tests/mysql5/defaultsettings/RealPkRef.go new file mode 100644 index 00000000..99800028 --- /dev/null +++ b/internal/integration_tests/mysql5/defaultsettings/RealPkRef.go @@ -0,0 +1,5 @@ +package dto + +type RealPkRef struct { + RealPkRef float64 `db:"real_pk_ref"` +} diff --git a/internal/integration_tests/mysql5/defaultsettings/RealRef.go b/internal/integration_tests/mysql5/defaultsettings/RealRef.go new file mode 100644 index 00000000..631f836c --- /dev/null +++ b/internal/integration_tests/mysql5/defaultsettings/RealRef.go @@ -0,0 +1,9 @@ +package dto + +import ( + "database/sql" +) + +type RealRef struct { + RealRef sql.NullFloat64 `db:"real_ref"` +} diff --git a/internal/integration_tests/mysql5/defaultsettings/RealTable.go b/internal/integration_tests/mysql5/defaultsettings/RealTable.go new file mode 100644 index 00000000..4fb87abc --- /dev/null +++ b/internal/integration_tests/mysql5/defaultsettings/RealTable.go @@ -0,0 +1,31 @@ +package dto + +import ( + "database/sql" +) + +type RealTable struct { + Col sql.NullFloat64 `db:"col"` + RealNn float64 `db:"real_nn"` + RealNnUnique float64 `db:"real_nn_unique"` + RealNnCheck float64 `db:"real_nn_check"` + RealNnRef float64 `db:"real_nn_ref"` + RealNnDefConst float64 `db:"real_nn_def_const"` + RealNnDefFunc float64 `db:"real_nn_def_func"` + RealNnUniqueCheck float64 `db:"real_nn_unique_check"` + RealUnique sql.NullFloat64 `db:"real_unique"` + RealUniqueCheck sql.NullFloat64 `db:"real_unique_check"` + RealUniqueRef sql.NullFloat64 `db:"real_unique_ref"` + RealUniqueDefConst sql.NullFloat64 `db:"real_unique_def_const"` + RealUniqueDefFunc sql.NullFloat64 `db:"real_unique_def_func"` + RealCheck sql.NullFloat64 `db:"real_check"` + RealCheckRef sql.NullFloat64 `db:"real_check_ref"` + RealCheckDefConst sql.NullFloat64 `db:"real_check_def_const"` + RealCheckDefFunc sql.NullFloat64 `db:"real_check_def_func"` + RealRef sql.NullFloat64 `db:"real_ref"` + RealRefUniqueCheck sql.NullFloat64 `db:"real_ref_unique_check"` + RealDefConst sql.NullFloat64 `db:"real_def_const"` + RealDefConstUniqueCheck sql.NullFloat64 `db:"real_def_const_unique_check"` + RealDefFunc sql.NullFloat64 `db:"real_def_func"` + RealDefFuncUniqueCheck sql.NullFloat64 `db:"real_def_func_unique_check"` +} diff --git a/internal/integration_tests/mysql5/defaultsettings/RealUniqueCheckPk.go b/internal/integration_tests/mysql5/defaultsettings/RealUniqueCheckPk.go new file mode 100644 index 00000000..68483d8a --- /dev/null +++ b/internal/integration_tests/mysql5/defaultsettings/RealUniqueCheckPk.go @@ -0,0 +1,5 @@ +package dto + +type RealUniqueCheckPk struct { + RealUniqueCheckPk float64 `db:"real_unique_check_pk"` +} diff --git a/internal/integration_tests/mysql5/defaultsettings/RealUniqueCheckPkRef.go b/internal/integration_tests/mysql5/defaultsettings/RealUniqueCheckPkRef.go new file mode 100644 index 00000000..bc4b0d90 --- /dev/null +++ b/internal/integration_tests/mysql5/defaultsettings/RealUniqueCheckPkRef.go @@ -0,0 +1,5 @@ +package dto + +type RealUniqueCheckPkRef struct { + RealUniqueCheckPkRef float64 `db:"real_unique_check_pk_ref"` +} diff --git a/internal/integration_tests/mysql5/defaultsettings/RealUniquePk.go b/internal/integration_tests/mysql5/defaultsettings/RealUniquePk.go new file mode 100644 index 00000000..8d22f752 --- /dev/null +++ b/internal/integration_tests/mysql5/defaultsettings/RealUniquePk.go @@ -0,0 +1,5 @@ +package dto + +type RealUniquePk struct { + RealUniquePk float64 `db:"real_unique_pk"` +} diff --git a/internal/integration_tests/mysql5/defaultsettings/SmallintCheckPk.go b/internal/integration_tests/mysql5/defaultsettings/SmallintCheckPk.go new file mode 100644 index 00000000..b751015a --- /dev/null +++ b/internal/integration_tests/mysql5/defaultsettings/SmallintCheckPk.go @@ -0,0 +1,5 @@ +package dto + +type SmallintCheckPk struct { + SmallintCheckPk int `db:"smallint_check_pk"` +} diff --git a/internal/integration_tests/mysql5/defaultsettings/SmallintDefConstUniqueCheckPk.go b/internal/integration_tests/mysql5/defaultsettings/SmallintDefConstUniqueCheckPk.go new file mode 100644 index 00000000..e2e17b6f --- /dev/null +++ b/internal/integration_tests/mysql5/defaultsettings/SmallintDefConstUniqueCheckPk.go @@ -0,0 +1,5 @@ +package dto + +type SmallintDefConstUniqueCheckPk struct { + SmallintDefConstUniqueCheckPk int `db:"smallint_def_const_unique_check_pk"` +} diff --git a/internal/integration_tests/mysql5/defaultsettings/SmallintDefConstUniqueCheckPkRef.go b/internal/integration_tests/mysql5/defaultsettings/SmallintDefConstUniqueCheckPkRef.go new file mode 100644 index 00000000..827d36f7 --- /dev/null +++ b/internal/integration_tests/mysql5/defaultsettings/SmallintDefConstUniqueCheckPkRef.go @@ -0,0 +1,5 @@ +package dto + +type SmallintDefConstUniqueCheckPkRef struct { + SmallintDefConstUniqueCheckPkRef int `db:"smallint_def_const_unique_check_pk_ref"` +} diff --git a/internal/integration_tests/mysql5/defaultsettings/SmallintDefFuncUniqueCheckPk.go b/internal/integration_tests/mysql5/defaultsettings/SmallintDefFuncUniqueCheckPk.go new file mode 100644 index 00000000..ab2612af --- /dev/null +++ b/internal/integration_tests/mysql5/defaultsettings/SmallintDefFuncUniqueCheckPk.go @@ -0,0 +1,5 @@ +package dto + +type SmallintDefFuncUniqueCheckPk struct { + SmallintDefFuncUniqueCheckPk int `db:"smallint_def_func_unique_check_pk"` +} diff --git a/internal/integration_tests/mysql5/defaultsettings/SmallintDefFuncUniqueCheckPkRef.go b/internal/integration_tests/mysql5/defaultsettings/SmallintDefFuncUniqueCheckPkRef.go new file mode 100644 index 00000000..3aef8dba --- /dev/null +++ b/internal/integration_tests/mysql5/defaultsettings/SmallintDefFuncUniqueCheckPkRef.go @@ -0,0 +1,5 @@ +package dto + +type SmallintDefFuncUniqueCheckPkRef struct { + SmallintDefFuncUniqueCheckPkRef int `db:"smallint_def_func_unique_check_pk_ref"` +} diff --git a/internal/integration_tests/mysql5/defaultsettings/SmallintNnPk.go b/internal/integration_tests/mysql5/defaultsettings/SmallintNnPk.go new file mode 100644 index 00000000..e860d504 --- /dev/null +++ b/internal/integration_tests/mysql5/defaultsettings/SmallintNnPk.go @@ -0,0 +1,5 @@ +package dto + +type SmallintNnPk struct { + SmallintNnPk int `db:"smallint_nn_pk"` +} diff --git a/internal/integration_tests/mysql5/defaultsettings/SmallintNnUniqueCheckPk.go b/internal/integration_tests/mysql5/defaultsettings/SmallintNnUniqueCheckPk.go new file mode 100644 index 00000000..09158e0c --- /dev/null +++ b/internal/integration_tests/mysql5/defaultsettings/SmallintNnUniqueCheckPk.go @@ -0,0 +1,5 @@ +package dto + +type SmallintNnUniqueCheckPk struct { + SmallintNnUniqueCheckPk int `db:"smallint_nn_unique_check_pk"` +} diff --git a/internal/integration_tests/mysql5/defaultsettings/SmallintNnUniqueCheckPkRef.go b/internal/integration_tests/mysql5/defaultsettings/SmallintNnUniqueCheckPkRef.go new file mode 100644 index 00000000..29099ecd --- /dev/null +++ b/internal/integration_tests/mysql5/defaultsettings/SmallintNnUniqueCheckPkRef.go @@ -0,0 +1,5 @@ +package dto + +type SmallintNnUniqueCheckPkRef struct { + SmallintNnUniqueCheckPkRef int `db:"smallint_nn_unique_check_pk_ref"` +} diff --git a/internal/integration_tests/mysql5/defaultsettings/SmallintPk.go b/internal/integration_tests/mysql5/defaultsettings/SmallintPk.go new file mode 100644 index 00000000..7e31ea21 --- /dev/null +++ b/internal/integration_tests/mysql5/defaultsettings/SmallintPk.go @@ -0,0 +1,5 @@ +package dto + +type SmallintPk struct { + SmallintPk int `db:"smallint_pk"` +} diff --git a/internal/integration_tests/mysql5/defaultsettings/SmallintPkDefConst.go b/internal/integration_tests/mysql5/defaultsettings/SmallintPkDefConst.go new file mode 100644 index 00000000..6674cb63 --- /dev/null +++ b/internal/integration_tests/mysql5/defaultsettings/SmallintPkDefConst.go @@ -0,0 +1,5 @@ +package dto + +type SmallintPkDefConst struct { + SmallintPkDefConst int `db:"smallint_pk_def_const"` +} diff --git a/internal/integration_tests/mysql5/defaultsettings/SmallintPkDefFunc.go b/internal/integration_tests/mysql5/defaultsettings/SmallintPkDefFunc.go new file mode 100644 index 00000000..3951e6bf --- /dev/null +++ b/internal/integration_tests/mysql5/defaultsettings/SmallintPkDefFunc.go @@ -0,0 +1,5 @@ +package dto + +type SmallintPkDefFunc struct { + SmallintPkDefFunc int `db:"smallint_pk_def_func"` +} diff --git a/internal/integration_tests/mysql5/defaultsettings/SmallintPkRef.go b/internal/integration_tests/mysql5/defaultsettings/SmallintPkRef.go new file mode 100644 index 00000000..fc0176ef --- /dev/null +++ b/internal/integration_tests/mysql5/defaultsettings/SmallintPkRef.go @@ -0,0 +1,5 @@ +package dto + +type SmallintPkRef struct { + SmallintPkRef int `db:"smallint_pk_ref"` +} diff --git a/internal/integration_tests/mysql5/defaultsettings/SmallintRef.go b/internal/integration_tests/mysql5/defaultsettings/SmallintRef.go new file mode 100644 index 00000000..c2924ae4 --- /dev/null +++ b/internal/integration_tests/mysql5/defaultsettings/SmallintRef.go @@ -0,0 +1,9 @@ +package dto + +import ( + "database/sql" +) + +type SmallintRef struct { + SmallintRef sql.NullInt64 `db:"smallint_ref"` +} diff --git a/internal/integration_tests/mysql5/defaultsettings/SmallintTable.go b/internal/integration_tests/mysql5/defaultsettings/SmallintTable.go new file mode 100644 index 00000000..13b78883 --- /dev/null +++ b/internal/integration_tests/mysql5/defaultsettings/SmallintTable.go @@ -0,0 +1,27 @@ +package dto + +import ( + "database/sql" +) + +type SmallintTable struct { + I sql.NullInt64 `db:"i"` + SmallintNn int `db:"smallint_nn"` + SmallintNnUnique int `db:"smallint_nn_unique"` + SmallintNnCheck int `db:"smallint_nn_check"` + SmallintUnique sql.NullInt64 `db:"smallint_unique"` + SmallintUniqueCheck sql.NullInt64 `db:"smallint_unique_check"` + SmallintUniqueRef sql.NullInt64 `db:"smallint_unique_ref"` + SmallintUniqueDefConst sql.NullInt64 `db:"smallint_unique_def_const"` + SmallintUniqueDefFunc sql.NullInt64 `db:"smallint_unique_def_func"` + SmallintCheck sql.NullInt64 `db:"smallint_check"` + SmallintCheckRef sql.NullInt64 `db:"smallint_check_ref"` + SmallintCheckDefConst sql.NullInt64 `db:"smallint_check_def_const"` + SmallintCheckDefFunc sql.NullInt64 `db:"smallint_check_def_func"` + SmallintRef sql.NullInt64 `db:"smallint_ref"` + SmallintRefUniqueCheck sql.NullInt64 `db:"smallint_ref_unique_check"` + SmallintDefConst sql.NullInt64 `db:"smallint_def_const"` + SmallintDefConstUniqueCheck sql.NullInt64 `db:"smallint_def_const_unique_check"` + SmallintDefFunc sql.NullInt64 `db:"smallint_def_func"` + SmallintDefFuncUniqueCheck sql.NullInt64 `db:"smallint_def_func_unique_check"` +} diff --git a/internal/integration_tests/mysql5/defaultsettings/SmallintUniqueCheckPk.go b/internal/integration_tests/mysql5/defaultsettings/SmallintUniqueCheckPk.go new file mode 100644 index 00000000..3cf7cccc --- /dev/null +++ b/internal/integration_tests/mysql5/defaultsettings/SmallintUniqueCheckPk.go @@ -0,0 +1,5 @@ +package dto + +type SmallintUniqueCheckPk struct { + SmallintUniqueCheckPk int `db:"smallint_unique_check_pk"` +} diff --git a/internal/integration_tests/mysql5/defaultsettings/SmallintUniqueCheckPkRef.go b/internal/integration_tests/mysql5/defaultsettings/SmallintUniqueCheckPkRef.go new file mode 100644 index 00000000..2dc8bfd8 --- /dev/null +++ b/internal/integration_tests/mysql5/defaultsettings/SmallintUniqueCheckPkRef.go @@ -0,0 +1,5 @@ +package dto + +type SmallintUniqueCheckPkRef struct { + SmallintUniqueCheckPkRef int `db:"smallint_unique_check_pk_ref"` +} diff --git a/internal/integration_tests/mysql5/defaultsettings/SmallintUniquePk.go b/internal/integration_tests/mysql5/defaultsettings/SmallintUniquePk.go new file mode 100644 index 00000000..1814500f --- /dev/null +++ b/internal/integration_tests/mysql5/defaultsettings/SmallintUniquePk.go @@ -0,0 +1,5 @@ +package dto + +type SmallintUniquePk struct { + SmallintUniquePk int `db:"smallint_unique_pk"` +} diff --git a/internal/integration_tests/mysql5/defaultsettings/TextRef.go b/internal/integration_tests/mysql5/defaultsettings/TextRef.go new file mode 100644 index 00000000..115deada --- /dev/null +++ b/internal/integration_tests/mysql5/defaultsettings/TextRef.go @@ -0,0 +1,5 @@ +package dto + +type TextRef struct { + TextRef string `db:"text_ref"` +} diff --git a/internal/integration_tests/mysql5/defaultsettings/TextTable.go b/internal/integration_tests/mysql5/defaultsettings/TextTable.go new file mode 100644 index 00000000..30abb518 --- /dev/null +++ b/internal/integration_tests/mysql5/defaultsettings/TextTable.go @@ -0,0 +1,22 @@ +package dto + +import ( + "database/sql" +) + +type TextTable struct { + Col sql.NullString `db:"col"` + TextDefConst sql.NullString `db:"text_def_const"` + TextDefFunc sql.NullString `db:"text_def_func"` + TextRef sql.NullString `db:"text_ref"` + TextNn string `db:"text_nn"` + TextNnCheckCmp string `db:"text_nn_check_cmp"` + TextNnCheckFn string `db:"text_nn_check_fn"` + TextNnRef string `db:"text_nn_ref"` + TextNnDefConst string `db:"text_nn_def_const"` + TextNnDefFunc string `db:"text_nn_def_func"` + TextCheck sql.NullString `db:"text_check"` + TextCheckRef sql.NullString `db:"text_check_ref"` + TextCheckDefConst sql.NullString `db:"text_check_def_const"` + TextCheckDefFunc sql.NullString `db:"text_check_def_func"` +} diff --git a/internal/integration_tests/mysql5/defaultsettings/TimeCheckPk.go b/internal/integration_tests/mysql5/defaultsettings/TimeCheckPk.go new file mode 100644 index 00000000..8ac4498b --- /dev/null +++ b/internal/integration_tests/mysql5/defaultsettings/TimeCheckPk.go @@ -0,0 +1,9 @@ +package dto + +import ( + "time" +) + +type TimeCheckPk struct { + TimeCheckPk time.Time `db:"time_check_pk"` +} diff --git a/internal/integration_tests/mysql5/defaultsettings/TimeDefConstUniqueCheckPk.go b/internal/integration_tests/mysql5/defaultsettings/TimeDefConstUniqueCheckPk.go new file mode 100644 index 00000000..f9d70c06 --- /dev/null +++ b/internal/integration_tests/mysql5/defaultsettings/TimeDefConstUniqueCheckPk.go @@ -0,0 +1,9 @@ +package dto + +import ( + "time" +) + +type TimeDefConstUniqueCheckPk struct { + TimeDefConstUniqueCheckPk time.Time `db:"time_def_const_unique_check_pk"` +} diff --git a/internal/integration_tests/mysql5/defaultsettings/TimeDefConstUniqueCheckPkRef.go b/internal/integration_tests/mysql5/defaultsettings/TimeDefConstUniqueCheckPkRef.go new file mode 100644 index 00000000..227c15c5 --- /dev/null +++ b/internal/integration_tests/mysql5/defaultsettings/TimeDefConstUniqueCheckPkRef.go @@ -0,0 +1,9 @@ +package dto + +import ( + "time" +) + +type TimeDefConstUniqueCheckPkRef struct { + TimeDefConstUniqueCheckPkRef time.Time `db:"time_def_const_unique_check_pk_ref"` +} diff --git a/internal/integration_tests/mysql5/defaultsettings/TimeDefFuncUniqueCheckPk.go b/internal/integration_tests/mysql5/defaultsettings/TimeDefFuncUniqueCheckPk.go new file mode 100644 index 00000000..5058c3c9 --- /dev/null +++ b/internal/integration_tests/mysql5/defaultsettings/TimeDefFuncUniqueCheckPk.go @@ -0,0 +1,9 @@ +package dto + +import ( + "time" +) + +type TimeDefFuncUniqueCheckPk struct { + TimeDefFuncUniqueCheckPk time.Time `db:"time_def_func_unique_check_pk"` +} diff --git a/internal/integration_tests/mysql5/defaultsettings/TimeDefFuncUniqueCheckPkRef.go b/internal/integration_tests/mysql5/defaultsettings/TimeDefFuncUniqueCheckPkRef.go new file mode 100644 index 00000000..c07b24c2 --- /dev/null +++ b/internal/integration_tests/mysql5/defaultsettings/TimeDefFuncUniqueCheckPkRef.go @@ -0,0 +1,9 @@ +package dto + +import ( + "time" +) + +type TimeDefFuncUniqueCheckPkRef struct { + TimeDefFuncUniqueCheckPkRef time.Time `db:"time_def_func_unique_check_pk_ref"` +} diff --git a/internal/integration_tests/mysql5/defaultsettings/TimeNnPk.go b/internal/integration_tests/mysql5/defaultsettings/TimeNnPk.go new file mode 100644 index 00000000..9b53ef52 --- /dev/null +++ b/internal/integration_tests/mysql5/defaultsettings/TimeNnPk.go @@ -0,0 +1,9 @@ +package dto + +import ( + "time" +) + +type TimeNnPk struct { + TimeNnPk time.Time `db:"time_nn_pk"` +} diff --git a/internal/integration_tests/mysql5/defaultsettings/TimeNnUniqueCheckPk.go b/internal/integration_tests/mysql5/defaultsettings/TimeNnUniqueCheckPk.go new file mode 100644 index 00000000..ab75df92 --- /dev/null +++ b/internal/integration_tests/mysql5/defaultsettings/TimeNnUniqueCheckPk.go @@ -0,0 +1,9 @@ +package dto + +import ( + "time" +) + +type TimeNnUniqueCheckPk struct { + TimeNnUniqueCheckPk time.Time `db:"time_nn_unique_check_pk"` +} diff --git a/internal/integration_tests/mysql5/defaultsettings/TimeNnUniqueCheckPkRef.go b/internal/integration_tests/mysql5/defaultsettings/TimeNnUniqueCheckPkRef.go new file mode 100644 index 00000000..37926bf8 --- /dev/null +++ b/internal/integration_tests/mysql5/defaultsettings/TimeNnUniqueCheckPkRef.go @@ -0,0 +1,9 @@ +package dto + +import ( + "time" +) + +type TimeNnUniqueCheckPkRef struct { + TimeNnUniqueCheckPkRef time.Time `db:"time_nn_unique_check_pk_ref"` +} diff --git a/internal/integration_tests/mysql5/defaultsettings/TimePk.go b/internal/integration_tests/mysql5/defaultsettings/TimePk.go new file mode 100644 index 00000000..4cb08dc4 --- /dev/null +++ b/internal/integration_tests/mysql5/defaultsettings/TimePk.go @@ -0,0 +1,9 @@ +package dto + +import ( + "time" +) + +type TimePk struct { + TimePk time.Time `db:"time_pk"` +} diff --git a/internal/integration_tests/mysql5/defaultsettings/TimePkDefConst.go b/internal/integration_tests/mysql5/defaultsettings/TimePkDefConst.go new file mode 100644 index 00000000..7f119e6f --- /dev/null +++ b/internal/integration_tests/mysql5/defaultsettings/TimePkDefConst.go @@ -0,0 +1,9 @@ +package dto + +import ( + "time" +) + +type TimePkDefConst struct { + TimePkDefConst time.Time `db:"time_pk_def_const"` +} diff --git a/internal/integration_tests/mysql5/defaultsettings/TimePkDefFunc.go b/internal/integration_tests/mysql5/defaultsettings/TimePkDefFunc.go new file mode 100644 index 00000000..6b5c04c3 --- /dev/null +++ b/internal/integration_tests/mysql5/defaultsettings/TimePkDefFunc.go @@ -0,0 +1,9 @@ +package dto + +import ( + "time" +) + +type TimePkDefFunc struct { + TimePkDefFunc time.Time `db:"time_pk_def_func"` +} diff --git a/internal/integration_tests/mysql5/defaultsettings/TimePkRef.go b/internal/integration_tests/mysql5/defaultsettings/TimePkRef.go new file mode 100644 index 00000000..f2f24a81 --- /dev/null +++ b/internal/integration_tests/mysql5/defaultsettings/TimePkRef.go @@ -0,0 +1,9 @@ +package dto + +import ( + "time" +) + +type TimePkRef struct { + TimePkRef time.Time `db:"time_pk_ref"` +} diff --git a/internal/integration_tests/mysql5/defaultsettings/TimeRef.go b/internal/integration_tests/mysql5/defaultsettings/TimeRef.go new file mode 100644 index 00000000..d31ee043 --- /dev/null +++ b/internal/integration_tests/mysql5/defaultsettings/TimeRef.go @@ -0,0 +1,9 @@ +package dto + +import ( + "database/sql" +) + +type TimeRef struct { + TimeRef sql.NullTime `db:"time_ref"` +} diff --git a/internal/integration_tests/mysql5/defaultsettings/TimeTable.go b/internal/integration_tests/mysql5/defaultsettings/TimeTable.go new file mode 100644 index 00000000..7dcbb08e --- /dev/null +++ b/internal/integration_tests/mysql5/defaultsettings/TimeTable.go @@ -0,0 +1,32 @@ +package dto + +import ( + "database/sql" + "time" +) + +type TimeTable struct { + Time sql.NullTime `db:"time"` + TimeNn time.Time `db:"time_nn"` + TimeNnUnique time.Time `db:"time_nn_unique"` + TimeNnCheck time.Time `db:"time_nn_check"` + TimeNnRef time.Time `db:"time_nn_ref"` + TimeNnDefConst time.Time `db:"time_nn_def_const"` + TimeNnDefFunc time.Time `db:"time_nn_def_func"` + TimeNnUniqueCheck time.Time `db:"time_nn_unique_check"` + TimeUnique sql.NullTime `db:"time_unique"` + TimeUniqueCheck sql.NullTime `db:"time_unique_check"` + TimeUniqueRef sql.NullTime `db:"time_unique_ref"` + TimeUniqueDefConst sql.NullTime `db:"time_unique_def_const"` + TimeUniqueDefFunc sql.NullTime `db:"time_unique_def_func"` + TimeCheck sql.NullTime `db:"time_check"` + TimeCheckRef sql.NullTime `db:"time_check_ref"` + TimeCheckDefConst sql.NullTime `db:"time_check_def_const"` + TimeCheckDefFunc sql.NullTime `db:"time_check_def_func"` + TimeRef sql.NullTime `db:"time_ref"` + TimeRefUniqueCheck sql.NullTime `db:"time_ref_unique_check"` + TimeDefConst sql.NullTime `db:"time_def_const"` + TimeDefConstUniqueCheck sql.NullTime `db:"time_def_const_unique_check"` + TimeDefFunc sql.NullTime `db:"time_def_func"` + TimeDefFuncUniqueCheck sql.NullTime `db:"time_def_func_unique_check"` +} diff --git a/internal/integration_tests/mysql5/defaultsettings/TimeUniqueCheckPk.go b/internal/integration_tests/mysql5/defaultsettings/TimeUniqueCheckPk.go new file mode 100644 index 00000000..24140cb6 --- /dev/null +++ b/internal/integration_tests/mysql5/defaultsettings/TimeUniqueCheckPk.go @@ -0,0 +1,9 @@ +package dto + +import ( + "time" +) + +type TimeUniqueCheckPk struct { + TimeUniqueCheckPk time.Time `db:"time_unique_check_pk"` +} diff --git a/internal/integration_tests/mysql5/defaultsettings/TimeUniqueCheckPkRef.go b/internal/integration_tests/mysql5/defaultsettings/TimeUniqueCheckPkRef.go new file mode 100644 index 00000000..4772a2c9 --- /dev/null +++ b/internal/integration_tests/mysql5/defaultsettings/TimeUniqueCheckPkRef.go @@ -0,0 +1,9 @@ +package dto + +import ( + "time" +) + +type TimeUniqueCheckPkRef struct { + TimeUniqueCheckPkRef time.Time `db:"time_unique_check_pk_ref"` +} diff --git a/internal/integration_tests/mysql5/defaultsettings/TimeUniquePk.go b/internal/integration_tests/mysql5/defaultsettings/TimeUniquePk.go new file mode 100644 index 00000000..4a5a293b --- /dev/null +++ b/internal/integration_tests/mysql5/defaultsettings/TimeUniquePk.go @@ -0,0 +1,9 @@ +package dto + +import ( + "time" +) + +type TimeUniquePk struct { + TimeUniquePk time.Time `db:"time_unique_pk"` +} diff --git a/internal/integration_tests/mysql5/defaultsettings/TimestampCheckPk.go b/internal/integration_tests/mysql5/defaultsettings/TimestampCheckPk.go new file mode 100644 index 00000000..11d9aac0 --- /dev/null +++ b/internal/integration_tests/mysql5/defaultsettings/TimestampCheckPk.go @@ -0,0 +1,9 @@ +package dto + +import ( + "time" +) + +type TimestampCheckPk struct { + TimestampCheckPk time.Time `db:"timestamp_check_pk"` +} diff --git a/internal/integration_tests/mysql5/defaultsettings/TimestampDefConstUniqueCheckPk.go b/internal/integration_tests/mysql5/defaultsettings/TimestampDefConstUniqueCheckPk.go new file mode 100644 index 00000000..76291a17 --- /dev/null +++ b/internal/integration_tests/mysql5/defaultsettings/TimestampDefConstUniqueCheckPk.go @@ -0,0 +1,9 @@ +package dto + +import ( + "time" +) + +type TimestampDefConstUniqueCheckPk struct { + TimestampDefConstUniqueCheckPk time.Time `db:"timestamp_def_const_unique_check_pk"` +} diff --git a/internal/integration_tests/mysql5/defaultsettings/TimestampDefConstUniqueCheckPkRef.go b/internal/integration_tests/mysql5/defaultsettings/TimestampDefConstUniqueCheckPkRef.go new file mode 100644 index 00000000..b5bd7f6d --- /dev/null +++ b/internal/integration_tests/mysql5/defaultsettings/TimestampDefConstUniqueCheckPkRef.go @@ -0,0 +1,9 @@ +package dto + +import ( + "time" +) + +type TimestampDefConstUniqueCheckPkRef struct { + TimestampDefConstUniqueCheckPkRef time.Time `db:"timestamp_def_const_unique_check_pk_ref"` +} diff --git a/internal/integration_tests/mysql5/defaultsettings/TimestampDefFuncUniqueCheckPk.go b/internal/integration_tests/mysql5/defaultsettings/TimestampDefFuncUniqueCheckPk.go new file mode 100644 index 00000000..07987edb --- /dev/null +++ b/internal/integration_tests/mysql5/defaultsettings/TimestampDefFuncUniqueCheckPk.go @@ -0,0 +1,9 @@ +package dto + +import ( + "time" +) + +type TimestampDefFuncUniqueCheckPk struct { + TimestampDefFuncUniqueCheckPk time.Time `db:"timestamp_def_func_unique_check_pk"` +} diff --git a/internal/integration_tests/mysql5/defaultsettings/TimestampDefFuncUniqueCheckPkRef.go b/internal/integration_tests/mysql5/defaultsettings/TimestampDefFuncUniqueCheckPkRef.go new file mode 100644 index 00000000..db425463 --- /dev/null +++ b/internal/integration_tests/mysql5/defaultsettings/TimestampDefFuncUniqueCheckPkRef.go @@ -0,0 +1,9 @@ +package dto + +import ( + "time" +) + +type TimestampDefFuncUniqueCheckPkRef struct { + TimestampDefFuncUniqueCheckPkRef time.Time `db:"timestamp_def_func_unique_check_pk_ref"` +} diff --git a/internal/integration_tests/mysql5/defaultsettings/TimestampNnPk.go b/internal/integration_tests/mysql5/defaultsettings/TimestampNnPk.go new file mode 100644 index 00000000..24d62061 --- /dev/null +++ b/internal/integration_tests/mysql5/defaultsettings/TimestampNnPk.go @@ -0,0 +1,9 @@ +package dto + +import ( + "time" +) + +type TimestampNnPk struct { + TimestampNnPk time.Time `db:"timestamp_nn_pk"` +} diff --git a/internal/integration_tests/mysql5/defaultsettings/TimestampNnUniqueCheckPk.go b/internal/integration_tests/mysql5/defaultsettings/TimestampNnUniqueCheckPk.go new file mode 100644 index 00000000..21ae8031 --- /dev/null +++ b/internal/integration_tests/mysql5/defaultsettings/TimestampNnUniqueCheckPk.go @@ -0,0 +1,9 @@ +package dto + +import ( + "time" +) + +type TimestampNnUniqueCheckPk struct { + TimestampNnUniqueCheckPk time.Time `db:"timestamp_nn_unique_check_pk"` +} diff --git a/internal/integration_tests/mysql5/defaultsettings/TimestampNnUniqueCheckPkRef.go b/internal/integration_tests/mysql5/defaultsettings/TimestampNnUniqueCheckPkRef.go new file mode 100644 index 00000000..1c20c377 --- /dev/null +++ b/internal/integration_tests/mysql5/defaultsettings/TimestampNnUniqueCheckPkRef.go @@ -0,0 +1,9 @@ +package dto + +import ( + "time" +) + +type TimestampNnUniqueCheckPkRef struct { + TimestampNnUniqueCheckPkRef time.Time `db:"timestamp_nn_unique_check_pk_ref"` +} diff --git a/internal/integration_tests/mysql5/defaultsettings/TimestampPk.go b/internal/integration_tests/mysql5/defaultsettings/TimestampPk.go new file mode 100644 index 00000000..5c10b8d9 --- /dev/null +++ b/internal/integration_tests/mysql5/defaultsettings/TimestampPk.go @@ -0,0 +1,9 @@ +package dto + +import ( + "time" +) + +type TimestampPk struct { + TimestampPk time.Time `db:"timestamp_pk"` +} diff --git a/internal/integration_tests/mysql5/defaultsettings/TimestampPkDefConst.go b/internal/integration_tests/mysql5/defaultsettings/TimestampPkDefConst.go new file mode 100644 index 00000000..1aae107b --- /dev/null +++ b/internal/integration_tests/mysql5/defaultsettings/TimestampPkDefConst.go @@ -0,0 +1,9 @@ +package dto + +import ( + "time" +) + +type TimestampPkDefConst struct { + TimestampPkDefConst time.Time `db:"timestamp_pk_def_const"` +} diff --git a/internal/integration_tests/mysql5/defaultsettings/TimestampPkDefFunc.go b/internal/integration_tests/mysql5/defaultsettings/TimestampPkDefFunc.go new file mode 100644 index 00000000..2e17c253 --- /dev/null +++ b/internal/integration_tests/mysql5/defaultsettings/TimestampPkDefFunc.go @@ -0,0 +1,9 @@ +package dto + +import ( + "time" +) + +type TimestampPkDefFunc struct { + TimestampPkDefFunc time.Time `db:"timestamp_pk_def_func"` +} diff --git a/internal/integration_tests/mysql5/defaultsettings/TimestampPkRef.go b/internal/integration_tests/mysql5/defaultsettings/TimestampPkRef.go new file mode 100644 index 00000000..c36c99c4 --- /dev/null +++ b/internal/integration_tests/mysql5/defaultsettings/TimestampPkRef.go @@ -0,0 +1,9 @@ +package dto + +import ( + "time" +) + +type TimestampPkRef struct { + TimestampPkRef time.Time `db:"timestamp_pk_ref"` +} diff --git a/internal/integration_tests/mysql5/defaultsettings/TimestampRef.go b/internal/integration_tests/mysql5/defaultsettings/TimestampRef.go new file mode 100644 index 00000000..c69f434a --- /dev/null +++ b/internal/integration_tests/mysql5/defaultsettings/TimestampRef.go @@ -0,0 +1,9 @@ +package dto + +import ( + "time" +) + +type TimestampRef struct { + TimestampRef time.Time `db:"timestamp_ref"` +} diff --git a/internal/integration_tests/mysql5/defaultsettings/TimestampTable.go b/internal/integration_tests/mysql5/defaultsettings/TimestampTable.go new file mode 100644 index 00000000..d2135479 --- /dev/null +++ b/internal/integration_tests/mysql5/defaultsettings/TimestampTable.go @@ -0,0 +1,31 @@ +package dto + +import ( + "time" +) + +type TimestampTable struct { + Timestamp time.Time `db:"timestamp"` + TimestampNn time.Time `db:"timestamp_nn"` + TimestampNnUnique time.Time `db:"timestamp_nn_unique"` + TimestampNnCheck time.Time `db:"timestamp_nn_check"` + TimestampNnRef time.Time `db:"timestamp_nn_ref"` + TimestampNnDefConst time.Time `db:"timestamp_nn_def_const"` + TimestampNnDefFunc time.Time `db:"timestamp_nn_def_func"` + TimestampNnUniqueCheck time.Time `db:"timestamp_nn_unique_check"` + TimestampUnique time.Time `db:"timestamp_unique"` + TimestampUniqueCheck time.Time `db:"timestamp_unique_check"` + TimestampUniqueRef time.Time `db:"timestamp_unique_ref"` + TimestampUniqueDefConst time.Time `db:"timestamp_unique_def_const"` + TimestampUniqueDefFunc time.Time `db:"timestamp_unique_def_func"` + TimestampCheck time.Time `db:"timestamp_check"` + TimestampCheckRef time.Time `db:"timestamp_check_ref"` + TimestampCheckDefConst time.Time `db:"timestamp_check_def_const"` + TimestampCheckDefFunc time.Time `db:"timestamp_check_def_func"` + TimestampRef time.Time `db:"timestamp_ref"` + TimestampRefUniqueCheck time.Time `db:"timestamp_ref_unique_check"` + TimestampDefConst time.Time `db:"timestamp_def_const"` + TimestampDefConstUniqueCheck time.Time `db:"timestamp_def_const_unique_check"` + TimestampDefFunc time.Time `db:"timestamp_def_func"` + TimestampDefFuncUniqueCheck time.Time `db:"timestamp_def_func_unique_check"` +} diff --git a/internal/integration_tests/mysql5/defaultsettings/TimestampUniqueCheckPk.go b/internal/integration_tests/mysql5/defaultsettings/TimestampUniqueCheckPk.go new file mode 100644 index 00000000..af5f08ff --- /dev/null +++ b/internal/integration_tests/mysql5/defaultsettings/TimestampUniqueCheckPk.go @@ -0,0 +1,9 @@ +package dto + +import ( + "time" +) + +type TimestampUniqueCheckPk struct { + TimestampUniqueCheckPk time.Time `db:"timestamp_unique_check_pk"` +} diff --git a/internal/integration_tests/mysql5/defaultsettings/TimestampUniqueCheckPkRef.go b/internal/integration_tests/mysql5/defaultsettings/TimestampUniqueCheckPkRef.go new file mode 100644 index 00000000..a3880c53 --- /dev/null +++ b/internal/integration_tests/mysql5/defaultsettings/TimestampUniqueCheckPkRef.go @@ -0,0 +1,9 @@ +package dto + +import ( + "time" +) + +type TimestampUniqueCheckPkRef struct { + TimestampUniqueCheckPkRef time.Time `db:"timestamp_unique_check_pk_ref"` +} diff --git a/internal/integration_tests/mysql5/defaultsettings/TimestampUniquePk.go b/internal/integration_tests/mysql5/defaultsettings/TimestampUniquePk.go new file mode 100644 index 00000000..6ef3e9ee --- /dev/null +++ b/internal/integration_tests/mysql5/defaultsettings/TimestampUniquePk.go @@ -0,0 +1,9 @@ +package dto + +import ( + "time" +) + +type TimestampUniquePk struct { + TimestampUniquePk time.Time `db:"timestamp_unique_pk"` +} diff --git a/internal/integration_tests/mysql5/defaultsettings/TinyblobRef.go b/internal/integration_tests/mysql5/defaultsettings/TinyblobRef.go new file mode 100644 index 00000000..4bf6bb24 --- /dev/null +++ b/internal/integration_tests/mysql5/defaultsettings/TinyblobRef.go @@ -0,0 +1,5 @@ +package dto + +type TinyblobRef struct { + TinyblobRef string `db:"tinyblob_ref"` +} diff --git a/internal/integration_tests/mysql5/defaultsettings/TinyblobTable.go b/internal/integration_tests/mysql5/defaultsettings/TinyblobTable.go new file mode 100644 index 00000000..5a5bcba9 --- /dev/null +++ b/internal/integration_tests/mysql5/defaultsettings/TinyblobTable.go @@ -0,0 +1,22 @@ +package dto + +import ( + "database/sql" +) + +type TinyblobTable struct { + Col sql.NullString `db:"col"` + TinyblobDefConst sql.NullString `db:"tinyblob_def_const"` + TinyblobDefFunc sql.NullString `db:"tinyblob_def_func"` + TinyblobRef sql.NullString `db:"tinyblob_ref"` + TinyblobNn string `db:"tinyblob_nn"` + TinyblobNnCheckCmp string `db:"tinyblob_nn_check_cmp"` + TinyblobNnCheckFn string `db:"tinyblob_nn_check_fn"` + TinyblobNnRef string `db:"tinyblob_nn_ref"` + TinyblobNnDefConst string `db:"tinyblob_nn_def_const"` + TinyblobNnDefFunc string `db:"tinyblob_nn_def_func"` + TinyblobCheck sql.NullString `db:"tinyblob_check"` + TinyblobCheckRef sql.NullString `db:"tinyblob_check_ref"` + TinyblobCheckDefConst sql.NullString `db:"tinyblob_check_def_const"` + TinyblobCheckDefFunc sql.NullString `db:"tinyblob_check_def_func"` +} diff --git a/internal/integration_tests/mysql5/defaultsettings/TinyintCheckPk.go b/internal/integration_tests/mysql5/defaultsettings/TinyintCheckPk.go new file mode 100644 index 00000000..c99bf0f9 --- /dev/null +++ b/internal/integration_tests/mysql5/defaultsettings/TinyintCheckPk.go @@ -0,0 +1,5 @@ +package dto + +type TinyintCheckPk struct { + TinyintCheckPk int `db:"tinyint_check_pk"` +} diff --git a/internal/integration_tests/mysql5/defaultsettings/TinyintDefConstUniqueCheckPk.go b/internal/integration_tests/mysql5/defaultsettings/TinyintDefConstUniqueCheckPk.go new file mode 100644 index 00000000..7ffc4928 --- /dev/null +++ b/internal/integration_tests/mysql5/defaultsettings/TinyintDefConstUniqueCheckPk.go @@ -0,0 +1,5 @@ +package dto + +type TinyintDefConstUniqueCheckPk struct { + TinyintDefConstUniqueCheckPk int `db:"tinyint_def_const_unique_check_pk"` +} diff --git a/internal/integration_tests/mysql5/defaultsettings/TinyintDefConstUniqueCheckPkRef.go b/internal/integration_tests/mysql5/defaultsettings/TinyintDefConstUniqueCheckPkRef.go new file mode 100644 index 00000000..0d5bf10c --- /dev/null +++ b/internal/integration_tests/mysql5/defaultsettings/TinyintDefConstUniqueCheckPkRef.go @@ -0,0 +1,5 @@ +package dto + +type TinyintDefConstUniqueCheckPkRef struct { + TinyintDefConstUniqueCheckPkRef int `db:"tinyint_def_const_unique_check_pk_ref"` +} diff --git a/internal/integration_tests/mysql5/defaultsettings/TinyintDefFuncUniqueCheckPk.go b/internal/integration_tests/mysql5/defaultsettings/TinyintDefFuncUniqueCheckPk.go new file mode 100644 index 00000000..f2a64472 --- /dev/null +++ b/internal/integration_tests/mysql5/defaultsettings/TinyintDefFuncUniqueCheckPk.go @@ -0,0 +1,5 @@ +package dto + +type TinyintDefFuncUniqueCheckPk struct { + TinyintDefFuncUniqueCheckPk int `db:"tinyint_def_func_unique_check_pk"` +} diff --git a/internal/integration_tests/mysql5/defaultsettings/TinyintDefFuncUniqueCheckPkRef.go b/internal/integration_tests/mysql5/defaultsettings/TinyintDefFuncUniqueCheckPkRef.go new file mode 100644 index 00000000..c11b6834 --- /dev/null +++ b/internal/integration_tests/mysql5/defaultsettings/TinyintDefFuncUniqueCheckPkRef.go @@ -0,0 +1,5 @@ +package dto + +type TinyintDefFuncUniqueCheckPkRef struct { + TinyintDefFuncUniqueCheckPkRef int `db:"tinyint_def_func_unique_check_pk_ref"` +} diff --git a/internal/integration_tests/mysql5/defaultsettings/TinyintNnPk.go b/internal/integration_tests/mysql5/defaultsettings/TinyintNnPk.go new file mode 100644 index 00000000..8b38fdcf --- /dev/null +++ b/internal/integration_tests/mysql5/defaultsettings/TinyintNnPk.go @@ -0,0 +1,5 @@ +package dto + +type TinyintNnPk struct { + TinyintNnPk int `db:"tinyint_nn_pk"` +} diff --git a/internal/integration_tests/mysql5/defaultsettings/TinyintNnUniqueCheckPk.go b/internal/integration_tests/mysql5/defaultsettings/TinyintNnUniqueCheckPk.go new file mode 100644 index 00000000..7551c68b --- /dev/null +++ b/internal/integration_tests/mysql5/defaultsettings/TinyintNnUniqueCheckPk.go @@ -0,0 +1,5 @@ +package dto + +type TinyintNnUniqueCheckPk struct { + TinyintNnUniqueCheckPk int `db:"tinyint_nn_unique_check_pk"` +} diff --git a/internal/integration_tests/mysql5/defaultsettings/TinyintNnUniqueCheckPkRef.go b/internal/integration_tests/mysql5/defaultsettings/TinyintNnUniqueCheckPkRef.go new file mode 100644 index 00000000..63c61bce --- /dev/null +++ b/internal/integration_tests/mysql5/defaultsettings/TinyintNnUniqueCheckPkRef.go @@ -0,0 +1,5 @@ +package dto + +type TinyintNnUniqueCheckPkRef struct { + TinyintNnUniqueCheckPkRef int `db:"tinyint_nn_unique_check_pk_ref"` +} diff --git a/internal/integration_tests/mysql5/defaultsettings/TinyintPk.go b/internal/integration_tests/mysql5/defaultsettings/TinyintPk.go new file mode 100644 index 00000000..02b30a86 --- /dev/null +++ b/internal/integration_tests/mysql5/defaultsettings/TinyintPk.go @@ -0,0 +1,5 @@ +package dto + +type TinyintPk struct { + TinyintPk int `db:"tinyint_pk"` +} diff --git a/internal/integration_tests/mysql5/defaultsettings/TinyintPkDefConst.go b/internal/integration_tests/mysql5/defaultsettings/TinyintPkDefConst.go new file mode 100644 index 00000000..b9f15c15 --- /dev/null +++ b/internal/integration_tests/mysql5/defaultsettings/TinyintPkDefConst.go @@ -0,0 +1,5 @@ +package dto + +type TinyintPkDefConst struct { + TinyintPkDefConst int `db:"tinyint_pk_def_const"` +} diff --git a/internal/integration_tests/mysql5/defaultsettings/TinyintPkDefFunc.go b/internal/integration_tests/mysql5/defaultsettings/TinyintPkDefFunc.go new file mode 100644 index 00000000..ee8d490a --- /dev/null +++ b/internal/integration_tests/mysql5/defaultsettings/TinyintPkDefFunc.go @@ -0,0 +1,5 @@ +package dto + +type TinyintPkDefFunc struct { + TinyintPkDefFunc int `db:"tinyint_pk_def_func"` +} diff --git a/internal/integration_tests/mysql5/defaultsettings/TinyintPkRef.go b/internal/integration_tests/mysql5/defaultsettings/TinyintPkRef.go new file mode 100644 index 00000000..3f95dead --- /dev/null +++ b/internal/integration_tests/mysql5/defaultsettings/TinyintPkRef.go @@ -0,0 +1,5 @@ +package dto + +type TinyintPkRef struct { + TinyintPkRef int `db:"tinyint_pk_ref"` +} diff --git a/internal/integration_tests/mysql5/defaultsettings/TinyintRef.go b/internal/integration_tests/mysql5/defaultsettings/TinyintRef.go new file mode 100644 index 00000000..9c2f7bc0 --- /dev/null +++ b/internal/integration_tests/mysql5/defaultsettings/TinyintRef.go @@ -0,0 +1,9 @@ +package dto + +import ( + "database/sql" +) + +type TinyintRef struct { + TinyintRef sql.NullInt64 `db:"tinyint_ref"` +} diff --git a/internal/integration_tests/mysql5/defaultsettings/TinyintTable.go b/internal/integration_tests/mysql5/defaultsettings/TinyintTable.go new file mode 100644 index 00000000..159115a3 --- /dev/null +++ b/internal/integration_tests/mysql5/defaultsettings/TinyintTable.go @@ -0,0 +1,27 @@ +package dto + +import ( + "database/sql" +) + +type TinyintTable struct { + I sql.NullInt64 `db:"i"` + TinyintNn int `db:"tinyint_nn"` + TinyintNnUnique int `db:"tinyint_nn_unique"` + TinyintNnCheck int `db:"tinyint_nn_check"` + TinyintUnique sql.NullInt64 `db:"tinyint_unique"` + TinyintUniqueCheck sql.NullInt64 `db:"tinyint_unique_check"` + TinyintUniqueRef sql.NullInt64 `db:"tinyint_unique_ref"` + TinyintUniqueDefConst sql.NullInt64 `db:"tinyint_unique_def_const"` + TinyintUniqueDefFunc sql.NullInt64 `db:"tinyint_unique_def_func"` + TinyintCheck sql.NullInt64 `db:"tinyint_check"` + TinyintCheckRef sql.NullInt64 `db:"tinyint_check_ref"` + TinyintCheckDefConst sql.NullInt64 `db:"tinyint_check_def_const"` + TinyintCheckDefFunc sql.NullInt64 `db:"tinyint_check_def_func"` + TinyintRef sql.NullInt64 `db:"tinyint_ref"` + TinyintRefUniqueCheck sql.NullInt64 `db:"tinyint_ref_unique_check"` + TinyintDefConst sql.NullInt64 `db:"tinyint_def_const"` + TinyintDefConstUniqueCheck sql.NullInt64 `db:"tinyint_def_const_unique_check"` + TinyintDefFunc sql.NullInt64 `db:"tinyint_def_func"` + TinyintDefFuncUniqueCheck sql.NullInt64 `db:"tinyint_def_func_unique_check"` +} diff --git a/internal/integration_tests/mysql5/defaultsettings/TinyintUniqueCheckPk.go b/internal/integration_tests/mysql5/defaultsettings/TinyintUniqueCheckPk.go new file mode 100644 index 00000000..8f43510d --- /dev/null +++ b/internal/integration_tests/mysql5/defaultsettings/TinyintUniqueCheckPk.go @@ -0,0 +1,5 @@ +package dto + +type TinyintUniqueCheckPk struct { + TinyintUniqueCheckPk int `db:"tinyint_unique_check_pk"` +} diff --git a/internal/integration_tests/mysql5/defaultsettings/TinyintUniqueCheckPkRef.go b/internal/integration_tests/mysql5/defaultsettings/TinyintUniqueCheckPkRef.go new file mode 100644 index 00000000..65effa9b --- /dev/null +++ b/internal/integration_tests/mysql5/defaultsettings/TinyintUniqueCheckPkRef.go @@ -0,0 +1,5 @@ +package dto + +type TinyintUniqueCheckPkRef struct { + TinyintUniqueCheckPkRef int `db:"tinyint_unique_check_pk_ref"` +} diff --git a/internal/integration_tests/mysql5/defaultsettings/TinyintUniquePk.go b/internal/integration_tests/mysql5/defaultsettings/TinyintUniquePk.go new file mode 100644 index 00000000..d134425d --- /dev/null +++ b/internal/integration_tests/mysql5/defaultsettings/TinyintUniquePk.go @@ -0,0 +1,5 @@ +package dto + +type TinyintUniquePk struct { + TinyintUniquePk int `db:"tinyint_unique_pk"` +} diff --git a/internal/integration_tests/mysql5/defaultsettings/TinytextRef.go b/internal/integration_tests/mysql5/defaultsettings/TinytextRef.go new file mode 100644 index 00000000..4a76f7dd --- /dev/null +++ b/internal/integration_tests/mysql5/defaultsettings/TinytextRef.go @@ -0,0 +1,5 @@ +package dto + +type TinytextRef struct { + TinytextRef string `db:"tinytext_ref"` +} diff --git a/internal/integration_tests/mysql5/defaultsettings/TinytextTable.go b/internal/integration_tests/mysql5/defaultsettings/TinytextTable.go new file mode 100644 index 00000000..6ed6e818 --- /dev/null +++ b/internal/integration_tests/mysql5/defaultsettings/TinytextTable.go @@ -0,0 +1,22 @@ +package dto + +import ( + "database/sql" +) + +type TinytextTable struct { + Col sql.NullString `db:"col"` + TinytextDefConst sql.NullString `db:"tinytext_def_const"` + TinytextDefFunc sql.NullString `db:"tinytext_def_func"` + TinytextRef sql.NullString `db:"tinytext_ref"` + TinytextNn string `db:"tinytext_nn"` + TinytextNnCheckCmp string `db:"tinytext_nn_check_cmp"` + TinytextNnCheckFn string `db:"tinytext_nn_check_fn"` + TinytextNnRef string `db:"tinytext_nn_ref"` + TinytextNnDefConst string `db:"tinytext_nn_def_const"` + TinytextNnDefFunc string `db:"tinytext_nn_def_func"` + TinytextCheck sql.NullString `db:"tinytext_check"` + TinytextCheckRef sql.NullString `db:"tinytext_check_ref"` + TinytextCheckDefConst sql.NullString `db:"tinytext_check_def_const"` + TinytextCheckDefFunc sql.NullString `db:"tinytext_check_def_func"` +} diff --git a/internal/integration_tests/mysql5/defaultsettings/VarbinaryCheckPk.go b/internal/integration_tests/mysql5/defaultsettings/VarbinaryCheckPk.go new file mode 100644 index 00000000..ec1add83 --- /dev/null +++ b/internal/integration_tests/mysql5/defaultsettings/VarbinaryCheckPk.go @@ -0,0 +1,5 @@ +package dto + +type VarbinaryCheckPk struct { + VarbinaryCheckPk string `db:"varbinary_check_pk"` +} diff --git a/internal/integration_tests/mysql5/defaultsettings/VarbinaryDefConstUniqueCheckPk.go b/internal/integration_tests/mysql5/defaultsettings/VarbinaryDefConstUniqueCheckPk.go new file mode 100644 index 00000000..405c5f62 --- /dev/null +++ b/internal/integration_tests/mysql5/defaultsettings/VarbinaryDefConstUniqueCheckPk.go @@ -0,0 +1,5 @@ +package dto + +type VarbinaryDefConstUniqueCheckPk struct { + VarbinaryDefConstUniqueCheckPk string `db:"varbinary_def_const_unique_check_pk"` +} diff --git a/internal/integration_tests/mysql5/defaultsettings/VarbinaryDefConstUniqueCheckPkRef.go b/internal/integration_tests/mysql5/defaultsettings/VarbinaryDefConstUniqueCheckPkRef.go new file mode 100644 index 00000000..43fdd969 --- /dev/null +++ b/internal/integration_tests/mysql5/defaultsettings/VarbinaryDefConstUniqueCheckPkRef.go @@ -0,0 +1,5 @@ +package dto + +type VarbinaryDefConstUniqueCheckPkRef struct { + VarbinaryDefConstUniqueCheckPkRef string `db:"varbinary_def_const_unique_check_pk_ref"` +} diff --git a/internal/integration_tests/mysql5/defaultsettings/VarbinaryDefFuncUniqueCheckPk.go b/internal/integration_tests/mysql5/defaultsettings/VarbinaryDefFuncUniqueCheckPk.go new file mode 100644 index 00000000..481a8606 --- /dev/null +++ b/internal/integration_tests/mysql5/defaultsettings/VarbinaryDefFuncUniqueCheckPk.go @@ -0,0 +1,5 @@ +package dto + +type VarbinaryDefFuncUniqueCheckPk struct { + VarbinaryDefFuncUniqueCheckPk string `db:"varbinary_def_func_unique_check_pk"` +} diff --git a/internal/integration_tests/mysql5/defaultsettings/VarbinaryDefFuncUniqueCheckPkRef.go b/internal/integration_tests/mysql5/defaultsettings/VarbinaryDefFuncUniqueCheckPkRef.go new file mode 100644 index 00000000..78e363c7 --- /dev/null +++ b/internal/integration_tests/mysql5/defaultsettings/VarbinaryDefFuncUniqueCheckPkRef.go @@ -0,0 +1,5 @@ +package dto + +type VarbinaryDefFuncUniqueCheckPkRef struct { + VarbinaryDefFuncUniqueCheckPkRef string `db:"varbinary_def_func_unique_check_pk_ref"` +} diff --git a/internal/integration_tests/mysql5/defaultsettings/VarbinaryNnPk.go b/internal/integration_tests/mysql5/defaultsettings/VarbinaryNnPk.go new file mode 100644 index 00000000..6e2231f1 --- /dev/null +++ b/internal/integration_tests/mysql5/defaultsettings/VarbinaryNnPk.go @@ -0,0 +1,5 @@ +package dto + +type VarbinaryNnPk struct { + VarbinaryNnPk string `db:"varbinary_nn_pk"` +} diff --git a/internal/integration_tests/mysql5/defaultsettings/VarbinaryNnUniqueCheckPk.go b/internal/integration_tests/mysql5/defaultsettings/VarbinaryNnUniqueCheckPk.go new file mode 100644 index 00000000..54f19d70 --- /dev/null +++ b/internal/integration_tests/mysql5/defaultsettings/VarbinaryNnUniqueCheckPk.go @@ -0,0 +1,5 @@ +package dto + +type VarbinaryNnUniqueCheckPk struct { + VarbinaryNnUniqueCheckPk string `db:"varbinary_nn_unique_check_pk"` +} diff --git a/internal/integration_tests/mysql5/defaultsettings/VarbinaryNnUniqueCheckPkRef.go b/internal/integration_tests/mysql5/defaultsettings/VarbinaryNnUniqueCheckPkRef.go new file mode 100644 index 00000000..f8170e58 --- /dev/null +++ b/internal/integration_tests/mysql5/defaultsettings/VarbinaryNnUniqueCheckPkRef.go @@ -0,0 +1,5 @@ +package dto + +type VarbinaryNnUniqueCheckPkRef struct { + VarbinaryNnUniqueCheckPkRef string `db:"varbinary_nn_unique_check_pk_ref"` +} diff --git a/internal/integration_tests/mysql5/defaultsettings/VarbinaryPk.go b/internal/integration_tests/mysql5/defaultsettings/VarbinaryPk.go new file mode 100644 index 00000000..8250904d --- /dev/null +++ b/internal/integration_tests/mysql5/defaultsettings/VarbinaryPk.go @@ -0,0 +1,5 @@ +package dto + +type VarbinaryPk struct { + VarbinaryPk string `db:"varbinary_pk"` +} diff --git a/internal/integration_tests/mysql5/defaultsettings/VarbinaryPkDefConst.go b/internal/integration_tests/mysql5/defaultsettings/VarbinaryPkDefConst.go new file mode 100644 index 00000000..579a26ed --- /dev/null +++ b/internal/integration_tests/mysql5/defaultsettings/VarbinaryPkDefConst.go @@ -0,0 +1,5 @@ +package dto + +type VarbinaryPkDefConst struct { + VarbinaryPkDefConst string `db:"varbinary_pk_def_const"` +} diff --git a/internal/integration_tests/mysql5/defaultsettings/VarbinaryPkDefFunc.go b/internal/integration_tests/mysql5/defaultsettings/VarbinaryPkDefFunc.go new file mode 100644 index 00000000..2bf3817f --- /dev/null +++ b/internal/integration_tests/mysql5/defaultsettings/VarbinaryPkDefFunc.go @@ -0,0 +1,5 @@ +package dto + +type VarbinaryPkDefFunc struct { + VarbinaryPkDefFunc string `db:"varbinary_pk_def_func"` +} diff --git a/internal/integration_tests/mysql5/defaultsettings/VarbinaryPkRef.go b/internal/integration_tests/mysql5/defaultsettings/VarbinaryPkRef.go new file mode 100644 index 00000000..d395a72d --- /dev/null +++ b/internal/integration_tests/mysql5/defaultsettings/VarbinaryPkRef.go @@ -0,0 +1,5 @@ +package dto + +type VarbinaryPkRef struct { + VarbinaryPkRef string `db:"varbinary_pk_ref"` +} diff --git a/internal/integration_tests/mysql5/defaultsettings/VarbinaryRef.go b/internal/integration_tests/mysql5/defaultsettings/VarbinaryRef.go new file mode 100644 index 00000000..a8afd55e --- /dev/null +++ b/internal/integration_tests/mysql5/defaultsettings/VarbinaryRef.go @@ -0,0 +1,9 @@ +package dto + +import ( + "database/sql" +) + +type VarbinaryRef struct { + VarbinaryRef sql.NullString `db:"varbinary_ref"` +} diff --git a/internal/integration_tests/mysql5/defaultsettings/VarbinaryTable.go b/internal/integration_tests/mysql5/defaultsettings/VarbinaryTable.go new file mode 100644 index 00000000..96012522 --- /dev/null +++ b/internal/integration_tests/mysql5/defaultsettings/VarbinaryTable.go @@ -0,0 +1,33 @@ +package dto + +import ( + "database/sql" +) + +type VarbinaryTable struct { + Col sql.NullString `db:"col"` + VarbinaryCap sql.NullString `db:"varbinary_cap"` + VarbinaryNn string `db:"varbinary_nn"` + VarbinaryNnUnique string `db:"varbinary_nn_unique"` + VarbinaryNnCheckCmp string `db:"varbinary_nn_check_cmp"` + VarbinaryNnCheckFn string `db:"varbinary_nn_check_fn"` + VarbinaryNnRef string `db:"varbinary_nn_ref"` + VarbinaryNnDefConst string `db:"varbinary_nn_def_const"` + VarbinaryNnDefFunc string `db:"varbinary_nn_def_func"` + VarbinaryNnUniqueCheck string `db:"varbinary_nn_unique_check"` + VarbinaryUnique sql.NullString `db:"varbinary_unique"` + VarbinaryUniqueCheck sql.NullString `db:"varbinary_unique_check"` + VarbinaryUniqueRef sql.NullString `db:"varbinary_unique_ref"` + VarbinaryUniqueDefConst sql.NullString `db:"varbinary_unique_def_const"` + VarbinaryUniqueDefFunc sql.NullString `db:"varbinary_unique_def_func"` + VarbinaryCheck sql.NullString `db:"varbinary_check"` + VarbinaryCheckRef sql.NullString `db:"varbinary_check_ref"` + VarbinaryCheckDefConst sql.NullString `db:"varbinary_check_def_const"` + VarbinaryCheckDefFunc sql.NullString `db:"varbinary_check_def_func"` + VarbinaryRef sql.NullString `db:"varbinary_ref"` + VarbinaryRefUniqueCheck sql.NullString `db:"varbinary_ref_unique_check"` + VarbinaryDefConst sql.NullString `db:"varbinary_def_const"` + VarbinaryDefConstUniqueCheck sql.NullString `db:"varbinary_def_const_unique_check"` + VarbinaryDefFunc sql.NullString `db:"varbinary_def_func"` + VarbinaryDefFuncUniqueCheck sql.NullString `db:"varbinary_def_func_unique_check"` +} diff --git a/internal/integration_tests/mysql5/defaultsettings/VarbinaryUniqueCheckPk.go b/internal/integration_tests/mysql5/defaultsettings/VarbinaryUniqueCheckPk.go new file mode 100644 index 00000000..cd74bfc8 --- /dev/null +++ b/internal/integration_tests/mysql5/defaultsettings/VarbinaryUniqueCheckPk.go @@ -0,0 +1,5 @@ +package dto + +type VarbinaryUniqueCheckPk struct { + VarbinaryUniqueCheckPk string `db:"varbinary_unique_check_pk"` +} diff --git a/internal/integration_tests/mysql5/defaultsettings/VarbinaryUniqueCheckPkRef.go b/internal/integration_tests/mysql5/defaultsettings/VarbinaryUniqueCheckPkRef.go new file mode 100644 index 00000000..883c332d --- /dev/null +++ b/internal/integration_tests/mysql5/defaultsettings/VarbinaryUniqueCheckPkRef.go @@ -0,0 +1,5 @@ +package dto + +type VarbinaryUniqueCheckPkRef struct { + VarbinaryUniqueCheckPkRef string `db:"varbinary_unique_check_pk_ref"` +} diff --git a/internal/integration_tests/mysql5/defaultsettings/VarbinaryUniquePk.go b/internal/integration_tests/mysql5/defaultsettings/VarbinaryUniquePk.go new file mode 100644 index 00000000..92816a2c --- /dev/null +++ b/internal/integration_tests/mysql5/defaultsettings/VarbinaryUniquePk.go @@ -0,0 +1,5 @@ +package dto + +type VarbinaryUniquePk struct { + VarbinaryUniquePk string `db:"varbinary_unique_pk"` +} diff --git a/internal/integration_tests/mysql5/defaultsettings/VarcharCheckPk.go b/internal/integration_tests/mysql5/defaultsettings/VarcharCheckPk.go new file mode 100644 index 00000000..3f42d91f --- /dev/null +++ b/internal/integration_tests/mysql5/defaultsettings/VarcharCheckPk.go @@ -0,0 +1,5 @@ +package dto + +type VarcharCheckPk struct { + VarcharCheckPk string `db:"varchar_check_pk"` +} diff --git a/internal/integration_tests/mysql5/defaultsettings/VarcharDefConstUniqueCheckPk.go b/internal/integration_tests/mysql5/defaultsettings/VarcharDefConstUniqueCheckPk.go new file mode 100644 index 00000000..b0c8f76b --- /dev/null +++ b/internal/integration_tests/mysql5/defaultsettings/VarcharDefConstUniqueCheckPk.go @@ -0,0 +1,5 @@ +package dto + +type VarcharDefConstUniqueCheckPk struct { + VarcharDefConstUniqueCheckPk string `db:"varchar_def_const_unique_check_pk"` +} diff --git a/internal/integration_tests/mysql5/defaultsettings/VarcharDefConstUniqueCheckPkRef.go b/internal/integration_tests/mysql5/defaultsettings/VarcharDefConstUniqueCheckPkRef.go new file mode 100644 index 00000000..55840733 --- /dev/null +++ b/internal/integration_tests/mysql5/defaultsettings/VarcharDefConstUniqueCheckPkRef.go @@ -0,0 +1,5 @@ +package dto + +type VarcharDefConstUniqueCheckPkRef struct { + VarcharDefConstUniqueCheckPkRef string `db:"varchar_def_const_unique_check_pk_ref"` +} diff --git a/internal/integration_tests/mysql5/defaultsettings/VarcharDefFuncUniqueCheckPk.go b/internal/integration_tests/mysql5/defaultsettings/VarcharDefFuncUniqueCheckPk.go new file mode 100644 index 00000000..eb63e5d1 --- /dev/null +++ b/internal/integration_tests/mysql5/defaultsettings/VarcharDefFuncUniqueCheckPk.go @@ -0,0 +1,5 @@ +package dto + +type VarcharDefFuncUniqueCheckPk struct { + VarcharDefFuncUniqueCheckPk string `db:"varchar_def_func_unique_check_pk"` +} diff --git a/internal/integration_tests/mysql5/defaultsettings/VarcharDefFuncUniqueCheckPkRef.go b/internal/integration_tests/mysql5/defaultsettings/VarcharDefFuncUniqueCheckPkRef.go new file mode 100644 index 00000000..8b002629 --- /dev/null +++ b/internal/integration_tests/mysql5/defaultsettings/VarcharDefFuncUniqueCheckPkRef.go @@ -0,0 +1,5 @@ +package dto + +type VarcharDefFuncUniqueCheckPkRef struct { + VarcharDefFuncUniqueCheckPkRef string `db:"varchar_def_func_unique_check_pk_ref"` +} diff --git a/internal/integration_tests/mysql5/defaultsettings/VarcharNnPk.go b/internal/integration_tests/mysql5/defaultsettings/VarcharNnPk.go new file mode 100644 index 00000000..b8364e86 --- /dev/null +++ b/internal/integration_tests/mysql5/defaultsettings/VarcharNnPk.go @@ -0,0 +1,5 @@ +package dto + +type VarcharNnPk struct { + VarcharNnPk string `db:"varchar_nn_pk"` +} diff --git a/internal/integration_tests/mysql5/defaultsettings/VarcharNnUniqueCheckPk.go b/internal/integration_tests/mysql5/defaultsettings/VarcharNnUniqueCheckPk.go new file mode 100644 index 00000000..0a24372c --- /dev/null +++ b/internal/integration_tests/mysql5/defaultsettings/VarcharNnUniqueCheckPk.go @@ -0,0 +1,5 @@ +package dto + +type VarcharNnUniqueCheckPk struct { + VarcharNnUniqueCheckPk string `db:"varchar_nn_unique_check_pk"` +} diff --git a/internal/integration_tests/mysql5/defaultsettings/VarcharNnUniqueCheckPkRef.go b/internal/integration_tests/mysql5/defaultsettings/VarcharNnUniqueCheckPkRef.go new file mode 100644 index 00000000..419161c0 --- /dev/null +++ b/internal/integration_tests/mysql5/defaultsettings/VarcharNnUniqueCheckPkRef.go @@ -0,0 +1,5 @@ +package dto + +type VarcharNnUniqueCheckPkRef struct { + VarcharNnUniqueCheckPkRef string `db:"varchar_nn_unique_check_pk_ref"` +} diff --git a/internal/integration_tests/mysql5/defaultsettings/VarcharPk.go b/internal/integration_tests/mysql5/defaultsettings/VarcharPk.go new file mode 100644 index 00000000..d04cc77d --- /dev/null +++ b/internal/integration_tests/mysql5/defaultsettings/VarcharPk.go @@ -0,0 +1,5 @@ +package dto + +type VarcharPk struct { + VarcharPk string `db:"varchar_pk"` +} diff --git a/internal/integration_tests/mysql5/defaultsettings/VarcharPkDefConst.go b/internal/integration_tests/mysql5/defaultsettings/VarcharPkDefConst.go new file mode 100644 index 00000000..2b5b3bce --- /dev/null +++ b/internal/integration_tests/mysql5/defaultsettings/VarcharPkDefConst.go @@ -0,0 +1,5 @@ +package dto + +type VarcharPkDefConst struct { + VarcharPkDefConst string `db:"varchar_pk_def_const"` +} diff --git a/internal/integration_tests/mysql5/defaultsettings/VarcharPkDefFunc.go b/internal/integration_tests/mysql5/defaultsettings/VarcharPkDefFunc.go new file mode 100644 index 00000000..8e0d43b6 --- /dev/null +++ b/internal/integration_tests/mysql5/defaultsettings/VarcharPkDefFunc.go @@ -0,0 +1,5 @@ +package dto + +type VarcharPkDefFunc struct { + VarcharPkDefFunc string `db:"varchar_pk_def_func"` +} diff --git a/internal/integration_tests/mysql5/defaultsettings/VarcharPkRef.go b/internal/integration_tests/mysql5/defaultsettings/VarcharPkRef.go new file mode 100644 index 00000000..1237c5d4 --- /dev/null +++ b/internal/integration_tests/mysql5/defaultsettings/VarcharPkRef.go @@ -0,0 +1,5 @@ +package dto + +type VarcharPkRef struct { + VarcharPkRef string `db:"varchar_pk_ref"` +} diff --git a/internal/integration_tests/mysql5/defaultsettings/VarcharRef.go b/internal/integration_tests/mysql5/defaultsettings/VarcharRef.go new file mode 100644 index 00000000..4add70ab --- /dev/null +++ b/internal/integration_tests/mysql5/defaultsettings/VarcharRef.go @@ -0,0 +1,9 @@ +package dto + +import ( + "database/sql" +) + +type VarcharRef struct { + VarcharRef sql.NullString `db:"varchar_ref"` +} diff --git a/internal/integration_tests/mysql5/defaultsettings/VarcharTable.go b/internal/integration_tests/mysql5/defaultsettings/VarcharTable.go new file mode 100644 index 00000000..2a0f0084 --- /dev/null +++ b/internal/integration_tests/mysql5/defaultsettings/VarcharTable.go @@ -0,0 +1,33 @@ +package dto + +import ( + "database/sql" +) + +type VarcharTable struct { + Col sql.NullString `db:"col"` + VarcharCap sql.NullString `db:"varchar_cap"` + VarcharNn string `db:"varchar_nn"` + VarcharNnUnique string `db:"varchar_nn_unique"` + VarcharNnCheckCmp string `db:"varchar_nn_check_cmp"` + VarcharNnCheckFn string `db:"varchar_nn_check_fn"` + VarcharNnRef string `db:"varchar_nn_ref"` + VarcharNnDefConst string `db:"varchar_nn_def_const"` + VarcharNnDefFunc string `db:"varchar_nn_def_func"` + VarcharNnUniqueCheck string `db:"varchar_nn_unique_check"` + VarcharUnique sql.NullString `db:"varchar_unique"` + VarcharUniqueCheck sql.NullString `db:"varchar_unique_check"` + VarcharUniqueRef sql.NullString `db:"varchar_unique_ref"` + VarcharUniqueDefConst sql.NullString `db:"varchar_unique_def_const"` + VarcharUniqueDefFunc sql.NullString `db:"varchar_unique_def_func"` + VarcharCheck sql.NullString `db:"varchar_check"` + VarcharCheckRef sql.NullString `db:"varchar_check_ref"` + VarcharCheckDefConst sql.NullString `db:"varchar_check_def_const"` + VarcharCheckDefFunc sql.NullString `db:"varchar_check_def_func"` + VarcharRef sql.NullString `db:"varchar_ref"` + VarcharRefUniqueCheck sql.NullString `db:"varchar_ref_unique_check"` + VarcharDefConst sql.NullString `db:"varchar_def_const"` + VarcharDefConstUniqueCheck sql.NullString `db:"varchar_def_const_unique_check"` + VarcharDefFunc sql.NullString `db:"varchar_def_func"` + VarcharDefFuncUniqueCheck sql.NullString `db:"varchar_def_func_unique_check"` +} diff --git a/internal/integration_tests/mysql5/defaultsettings/VarcharUniqueCheckPk.go b/internal/integration_tests/mysql5/defaultsettings/VarcharUniqueCheckPk.go new file mode 100644 index 00000000..98513a8f --- /dev/null +++ b/internal/integration_tests/mysql5/defaultsettings/VarcharUniqueCheckPk.go @@ -0,0 +1,5 @@ +package dto + +type VarcharUniqueCheckPk struct { + VarcharUniqueCheckPk string `db:"varchar_unique_check_pk"` +} diff --git a/internal/integration_tests/mysql5/defaultsettings/VarcharUniqueCheckPkRef.go b/internal/integration_tests/mysql5/defaultsettings/VarcharUniqueCheckPkRef.go new file mode 100644 index 00000000..9e078bac --- /dev/null +++ b/internal/integration_tests/mysql5/defaultsettings/VarcharUniqueCheckPkRef.go @@ -0,0 +1,5 @@ +package dto + +type VarcharUniqueCheckPkRef struct { + VarcharUniqueCheckPkRef string `db:"varchar_unique_check_pk_ref"` +} diff --git a/internal/integration_tests/mysql5/defaultsettings/VarcharUniquePk.go b/internal/integration_tests/mysql5/defaultsettings/VarcharUniquePk.go new file mode 100644 index 00000000..66a68448 --- /dev/null +++ b/internal/integration_tests/mysql5/defaultsettings/VarcharUniquePk.go @@ -0,0 +1,5 @@ +package dto + +type VarcharUniquePk struct { + VarcharUniquePk string `db:"varchar_unique_pk"` +} diff --git a/internal/integration_tests/mysql5/defaultsettings/YearCheckPk.go b/internal/integration_tests/mysql5/defaultsettings/YearCheckPk.go new file mode 100644 index 00000000..098cc2b7 --- /dev/null +++ b/internal/integration_tests/mysql5/defaultsettings/YearCheckPk.go @@ -0,0 +1,9 @@ +package dto + +import ( + "time" +) + +type YearCheckPk struct { + YearCheckPk time.Time `db:"year_check_pk"` +} diff --git a/internal/integration_tests/mysql5/defaultsettings/YearDefConstUniqueCheckPk.go b/internal/integration_tests/mysql5/defaultsettings/YearDefConstUniqueCheckPk.go new file mode 100644 index 00000000..15ba8ad8 --- /dev/null +++ b/internal/integration_tests/mysql5/defaultsettings/YearDefConstUniqueCheckPk.go @@ -0,0 +1,9 @@ +package dto + +import ( + "time" +) + +type YearDefConstUniqueCheckPk struct { + YearDefConstUniqueCheckPk time.Time `db:"year_def_const_unique_check_pk"` +} diff --git a/internal/integration_tests/mysql5/defaultsettings/YearDefConstUniqueCheckPkRef.go b/internal/integration_tests/mysql5/defaultsettings/YearDefConstUniqueCheckPkRef.go new file mode 100644 index 00000000..85043112 --- /dev/null +++ b/internal/integration_tests/mysql5/defaultsettings/YearDefConstUniqueCheckPkRef.go @@ -0,0 +1,9 @@ +package dto + +import ( + "time" +) + +type YearDefConstUniqueCheckPkRef struct { + YearDefConstUniqueCheckPkRef time.Time `db:"year_def_const_unique_check_pk_ref"` +} diff --git a/internal/integration_tests/mysql5/defaultsettings/YearDefFuncUniqueCheckPk.go b/internal/integration_tests/mysql5/defaultsettings/YearDefFuncUniqueCheckPk.go new file mode 100644 index 00000000..4b6c7ad7 --- /dev/null +++ b/internal/integration_tests/mysql5/defaultsettings/YearDefFuncUniqueCheckPk.go @@ -0,0 +1,9 @@ +package dto + +import ( + "time" +) + +type YearDefFuncUniqueCheckPk struct { + YearDefFuncUniqueCheckPk time.Time `db:"year_def_func_unique_check_pk"` +} diff --git a/internal/integration_tests/mysql5/defaultsettings/YearDefFuncUniqueCheckPkRef.go b/internal/integration_tests/mysql5/defaultsettings/YearDefFuncUniqueCheckPkRef.go new file mode 100644 index 00000000..ec31e106 --- /dev/null +++ b/internal/integration_tests/mysql5/defaultsettings/YearDefFuncUniqueCheckPkRef.go @@ -0,0 +1,9 @@ +package dto + +import ( + "time" +) + +type YearDefFuncUniqueCheckPkRef struct { + YearDefFuncUniqueCheckPkRef time.Time `db:"year_def_func_unique_check_pk_ref"` +} diff --git a/internal/integration_tests/mysql5/defaultsettings/YearNnPk.go b/internal/integration_tests/mysql5/defaultsettings/YearNnPk.go new file mode 100644 index 00000000..806ee601 --- /dev/null +++ b/internal/integration_tests/mysql5/defaultsettings/YearNnPk.go @@ -0,0 +1,9 @@ +package dto + +import ( + "time" +) + +type YearNnPk struct { + YearNnPk time.Time `db:"year_nn_pk"` +} diff --git a/internal/integration_tests/mysql5/defaultsettings/YearNnUniqueCheckPk.go b/internal/integration_tests/mysql5/defaultsettings/YearNnUniqueCheckPk.go new file mode 100644 index 00000000..390293e5 --- /dev/null +++ b/internal/integration_tests/mysql5/defaultsettings/YearNnUniqueCheckPk.go @@ -0,0 +1,9 @@ +package dto + +import ( + "time" +) + +type YearNnUniqueCheckPk struct { + YearNnUniqueCheckPk time.Time `db:"year_nn_unique_check_pk"` +} diff --git a/internal/integration_tests/mysql5/defaultsettings/YearNnUniqueCheckPkRef.go b/internal/integration_tests/mysql5/defaultsettings/YearNnUniqueCheckPkRef.go new file mode 100644 index 00000000..29c667cd --- /dev/null +++ b/internal/integration_tests/mysql5/defaultsettings/YearNnUniqueCheckPkRef.go @@ -0,0 +1,9 @@ +package dto + +import ( + "time" +) + +type YearNnUniqueCheckPkRef struct { + YearNnUniqueCheckPkRef time.Time `db:"year_nn_unique_check_pk_ref"` +} diff --git a/internal/integration_tests/mysql5/defaultsettings/YearPk.go b/internal/integration_tests/mysql5/defaultsettings/YearPk.go new file mode 100644 index 00000000..2dc02194 --- /dev/null +++ b/internal/integration_tests/mysql5/defaultsettings/YearPk.go @@ -0,0 +1,9 @@ +package dto + +import ( + "time" +) + +type YearPk struct { + YearPk time.Time `db:"year_pk"` +} diff --git a/internal/integration_tests/mysql5/defaultsettings/YearPkDefConst.go b/internal/integration_tests/mysql5/defaultsettings/YearPkDefConst.go new file mode 100644 index 00000000..de1191fc --- /dev/null +++ b/internal/integration_tests/mysql5/defaultsettings/YearPkDefConst.go @@ -0,0 +1,9 @@ +package dto + +import ( + "time" +) + +type YearPkDefConst struct { + YearPkDefConst time.Time `db:"year_pk_def_const"` +} diff --git a/internal/integration_tests/mysql5/defaultsettings/YearPkDefFunc.go b/internal/integration_tests/mysql5/defaultsettings/YearPkDefFunc.go new file mode 100644 index 00000000..fd1faf72 --- /dev/null +++ b/internal/integration_tests/mysql5/defaultsettings/YearPkDefFunc.go @@ -0,0 +1,9 @@ +package dto + +import ( + "time" +) + +type YearPkDefFunc struct { + YearPkDefFunc time.Time `db:"year_pk_def_func"` +} diff --git a/internal/integration_tests/mysql5/defaultsettings/YearPkRef.go b/internal/integration_tests/mysql5/defaultsettings/YearPkRef.go new file mode 100644 index 00000000..a031e633 --- /dev/null +++ b/internal/integration_tests/mysql5/defaultsettings/YearPkRef.go @@ -0,0 +1,9 @@ +package dto + +import ( + "time" +) + +type YearPkRef struct { + YearPkRef time.Time `db:"year_pk_ref"` +} diff --git a/internal/integration_tests/mysql5/defaultsettings/YearRef.go b/internal/integration_tests/mysql5/defaultsettings/YearRef.go new file mode 100644 index 00000000..432186d2 --- /dev/null +++ b/internal/integration_tests/mysql5/defaultsettings/YearRef.go @@ -0,0 +1,9 @@ +package dto + +import ( + "database/sql" +) + +type YearRef struct { + YearRef sql.NullTime `db:"year_ref"` +} diff --git a/internal/integration_tests/mysql5/defaultsettings/YearTable.go b/internal/integration_tests/mysql5/defaultsettings/YearTable.go new file mode 100644 index 00000000..8b21f6d6 --- /dev/null +++ b/internal/integration_tests/mysql5/defaultsettings/YearTable.go @@ -0,0 +1,32 @@ +package dto + +import ( + "database/sql" + "time" +) + +type YearTable struct { + Year sql.NullTime `db:"year"` + YearNn time.Time `db:"year_nn"` + YearNnUnique time.Time `db:"year_nn_unique"` + YearNnCheck time.Time `db:"year_nn_check"` + YearNnRef time.Time `db:"year_nn_ref"` + YearNnDefConst time.Time `db:"year_nn_def_const"` + YearNnDefFunc time.Time `db:"year_nn_def_func"` + YearNnUniqueCheck time.Time `db:"year_nn_unique_check"` + YearUnique sql.NullTime `db:"year_unique"` + YearUniqueCheck sql.NullTime `db:"year_unique_check"` + YearUniqueRef sql.NullTime `db:"year_unique_ref"` + YearUniqueDefConst sql.NullTime `db:"year_unique_def_const"` + YearUniqueDefFunc sql.NullTime `db:"year_unique_def_func"` + YearCheck sql.NullTime `db:"year_check"` + YearCheckRef sql.NullTime `db:"year_check_ref"` + YearCheckDefConst sql.NullTime `db:"year_check_def_const"` + YearCheckDefFunc sql.NullTime `db:"year_check_def_func"` + YearRef sql.NullTime `db:"year_ref"` + YearRefUniqueCheck sql.NullTime `db:"year_ref_unique_check"` + YearDefConst sql.NullTime `db:"year_def_const"` + YearDefConstUniqueCheck sql.NullTime `db:"year_def_const_unique_check"` + YearDefFunc sql.NullTime `db:"year_def_func"` + YearDefFuncUniqueCheck sql.NullTime `db:"year_def_func_unique_check"` +} diff --git a/internal/integration_tests/mysql5/defaultsettings/YearUniqueCheckPk.go b/internal/integration_tests/mysql5/defaultsettings/YearUniqueCheckPk.go new file mode 100644 index 00000000..b677a138 --- /dev/null +++ b/internal/integration_tests/mysql5/defaultsettings/YearUniqueCheckPk.go @@ -0,0 +1,9 @@ +package dto + +import ( + "time" +) + +type YearUniqueCheckPk struct { + YearUniqueCheckPk time.Time `db:"year_unique_check_pk"` +} diff --git a/internal/integration_tests/mysql5/defaultsettings/YearUniqueCheckPkRef.go b/internal/integration_tests/mysql5/defaultsettings/YearUniqueCheckPkRef.go new file mode 100644 index 00000000..798abf45 --- /dev/null +++ b/internal/integration_tests/mysql5/defaultsettings/YearUniqueCheckPkRef.go @@ -0,0 +1,9 @@ +package dto + +import ( + "time" +) + +type YearUniqueCheckPkRef struct { + YearUniqueCheckPkRef time.Time `db:"year_unique_check_pk_ref"` +} diff --git a/internal/integration_tests/mysql5/defaultsettings/YearUniquePk.go b/internal/integration_tests/mysql5/defaultsettings/YearUniquePk.go new file mode 100644 index 00000000..beca6fda --- /dev/null +++ b/internal/integration_tests/mysql5/defaultsettings/YearUniquePk.go @@ -0,0 +1,9 @@ +package dto + +import ( + "time" +) + +type YearUniquePk struct { + YearUniquePk time.Time `db:"year_unique_pk"` +} diff --git a/internal/integration_tests/mysql5/nulltypeprimitive/BigintCheckPk.go b/internal/integration_tests/mysql5/nulltypeprimitive/BigintCheckPk.go new file mode 100644 index 00000000..2474c3d5 --- /dev/null +++ b/internal/integration_tests/mysql5/nulltypeprimitive/BigintCheckPk.go @@ -0,0 +1,5 @@ +package dto + +type BigintCheckPk struct { + BigintCheckPk int `db:"bigint_check_pk"` +} diff --git a/internal/integration_tests/mysql5/nulltypeprimitive/BigintDefConstUniqueCheckPk.go b/internal/integration_tests/mysql5/nulltypeprimitive/BigintDefConstUniqueCheckPk.go new file mode 100644 index 00000000..808e31f2 --- /dev/null +++ b/internal/integration_tests/mysql5/nulltypeprimitive/BigintDefConstUniqueCheckPk.go @@ -0,0 +1,5 @@ +package dto + +type BigintDefConstUniqueCheckPk struct { + BigintDefConstUniqueCheckPk int `db:"bigint_def_const_unique_check_pk"` +} diff --git a/internal/integration_tests/mysql5/nulltypeprimitive/BigintDefConstUniqueCheckPkRef.go b/internal/integration_tests/mysql5/nulltypeprimitive/BigintDefConstUniqueCheckPkRef.go new file mode 100644 index 00000000..64fcb8c8 --- /dev/null +++ b/internal/integration_tests/mysql5/nulltypeprimitive/BigintDefConstUniqueCheckPkRef.go @@ -0,0 +1,5 @@ +package dto + +type BigintDefConstUniqueCheckPkRef struct { + BigintDefConstUniqueCheckPkRef int `db:"bigint_def_const_unique_check_pk_ref"` +} diff --git a/internal/integration_tests/mysql5/nulltypeprimitive/BigintDefFuncUniqueCheckPk.go b/internal/integration_tests/mysql5/nulltypeprimitive/BigintDefFuncUniqueCheckPk.go new file mode 100644 index 00000000..68117369 --- /dev/null +++ b/internal/integration_tests/mysql5/nulltypeprimitive/BigintDefFuncUniqueCheckPk.go @@ -0,0 +1,5 @@ +package dto + +type BigintDefFuncUniqueCheckPk struct { + BigintDefFuncUniqueCheckPk int `db:"bigint_def_func_unique_check_pk"` +} diff --git a/internal/integration_tests/mysql5/nulltypeprimitive/BigintDefFuncUniqueCheckPkRef.go b/internal/integration_tests/mysql5/nulltypeprimitive/BigintDefFuncUniqueCheckPkRef.go new file mode 100644 index 00000000..dbd5da9d --- /dev/null +++ b/internal/integration_tests/mysql5/nulltypeprimitive/BigintDefFuncUniqueCheckPkRef.go @@ -0,0 +1,5 @@ +package dto + +type BigintDefFuncUniqueCheckPkRef struct { + BigintDefFuncUniqueCheckPkRef int `db:"bigint_def_func_unique_check_pk_ref"` +} diff --git a/internal/integration_tests/mysql5/nulltypeprimitive/BigintNnPk.go b/internal/integration_tests/mysql5/nulltypeprimitive/BigintNnPk.go new file mode 100644 index 00000000..f4ddc4aa --- /dev/null +++ b/internal/integration_tests/mysql5/nulltypeprimitive/BigintNnPk.go @@ -0,0 +1,5 @@ +package dto + +type BigintNnPk struct { + BigintNnPk int `db:"bigint_nn_pk"` +} diff --git a/internal/integration_tests/mysql5/nulltypeprimitive/BigintNnUniqueCheckPk.go b/internal/integration_tests/mysql5/nulltypeprimitive/BigintNnUniqueCheckPk.go new file mode 100644 index 00000000..ce5d15c5 --- /dev/null +++ b/internal/integration_tests/mysql5/nulltypeprimitive/BigintNnUniqueCheckPk.go @@ -0,0 +1,5 @@ +package dto + +type BigintNnUniqueCheckPk struct { + BigintNnUniqueCheckPk int `db:"bigint_nn_unique_check_pk"` +} diff --git a/internal/integration_tests/mysql5/nulltypeprimitive/BigintNnUniqueCheckPkRef.go b/internal/integration_tests/mysql5/nulltypeprimitive/BigintNnUniqueCheckPkRef.go new file mode 100644 index 00000000..4c065777 --- /dev/null +++ b/internal/integration_tests/mysql5/nulltypeprimitive/BigintNnUniqueCheckPkRef.go @@ -0,0 +1,5 @@ +package dto + +type BigintNnUniqueCheckPkRef struct { + BigintNnUniqueCheckPkRef int `db:"bigint_nn_unique_check_pk_ref"` +} diff --git a/internal/integration_tests/mysql5/nulltypeprimitive/BigintPk.go b/internal/integration_tests/mysql5/nulltypeprimitive/BigintPk.go new file mode 100644 index 00000000..0b34e55b --- /dev/null +++ b/internal/integration_tests/mysql5/nulltypeprimitive/BigintPk.go @@ -0,0 +1,5 @@ +package dto + +type BigintPk struct { + BigintPk int `db:"bigint_pk"` +} diff --git a/internal/integration_tests/mysql5/nulltypeprimitive/BigintPkDefConst.go b/internal/integration_tests/mysql5/nulltypeprimitive/BigintPkDefConst.go new file mode 100644 index 00000000..08c26cbd --- /dev/null +++ b/internal/integration_tests/mysql5/nulltypeprimitive/BigintPkDefConst.go @@ -0,0 +1,5 @@ +package dto + +type BigintPkDefConst struct { + BigintPkDefConst int `db:"bigint_pk_def_const"` +} diff --git a/internal/integration_tests/mysql5/nulltypeprimitive/BigintPkDefFunc.go b/internal/integration_tests/mysql5/nulltypeprimitive/BigintPkDefFunc.go new file mode 100644 index 00000000..656fadc9 --- /dev/null +++ b/internal/integration_tests/mysql5/nulltypeprimitive/BigintPkDefFunc.go @@ -0,0 +1,5 @@ +package dto + +type BigintPkDefFunc struct { + BigintPkDefFunc int `db:"bigint_pk_def_func"` +} diff --git a/internal/integration_tests/mysql5/nulltypeprimitive/BigintPkRef.go b/internal/integration_tests/mysql5/nulltypeprimitive/BigintPkRef.go new file mode 100644 index 00000000..21608d8c --- /dev/null +++ b/internal/integration_tests/mysql5/nulltypeprimitive/BigintPkRef.go @@ -0,0 +1,5 @@ +package dto + +type BigintPkRef struct { + BigintPkRef int `db:"bigint_pk_ref"` +} diff --git a/internal/integration_tests/mysql5/nulltypeprimitive/BigintRef.go b/internal/integration_tests/mysql5/nulltypeprimitive/BigintRef.go new file mode 100644 index 00000000..377b5cd8 --- /dev/null +++ b/internal/integration_tests/mysql5/nulltypeprimitive/BigintRef.go @@ -0,0 +1,5 @@ +package dto + +type BigintRef struct { + BigintRef *int `db:"bigint_ref"` +} diff --git a/internal/integration_tests/mysql5/nulltypeprimitive/BigintTable.go b/internal/integration_tests/mysql5/nulltypeprimitive/BigintTable.go new file mode 100644 index 00000000..3b6df1fb --- /dev/null +++ b/internal/integration_tests/mysql5/nulltypeprimitive/BigintTable.go @@ -0,0 +1,23 @@ +package dto + +type BigintTable struct { + I *int `db:"i"` + BigintNn int `db:"bigint_nn"` + BigintNnUnique int `db:"bigint_nn_unique"` + BigintNnCheck int `db:"bigint_nn_check"` + BigintUnique *int `db:"bigint_unique"` + BigintUniqueCheck *int `db:"bigint_unique_check"` + BigintUniqueRef *int `db:"bigint_unique_ref"` + BigintUniqueDefConst *int `db:"bigint_unique_def_const"` + BigintUniqueDefFunc *int `db:"bigint_unique_def_func"` + BigintCheck *int `db:"bigint_check"` + BigintCheckRef *int `db:"bigint_check_ref"` + BigintCheckDefConst *int `db:"bigint_check_def_const"` + BigintCheckDefFunc *int `db:"bigint_check_def_func"` + BigintRef *int `db:"bigint_ref"` + BigintRefUniqueCheck *int `db:"bigint_ref_unique_check"` + BigintDefConst *int `db:"bigint_def_const"` + BigintDefConstUniqueCheck *int `db:"bigint_def_const_unique_check"` + BigintDefFunc *int `db:"bigint_def_func"` + BigintDefFuncUniqueCheck *int `db:"bigint_def_func_unique_check"` +} diff --git a/internal/integration_tests/mysql5/nulltypeprimitive/BigintUniqueCheckPk.go b/internal/integration_tests/mysql5/nulltypeprimitive/BigintUniqueCheckPk.go new file mode 100644 index 00000000..d2cd0c7e --- /dev/null +++ b/internal/integration_tests/mysql5/nulltypeprimitive/BigintUniqueCheckPk.go @@ -0,0 +1,5 @@ +package dto + +type BigintUniqueCheckPk struct { + BigintUniqueCheckPk int `db:"bigint_unique_check_pk"` +} diff --git a/internal/integration_tests/mysql5/nulltypeprimitive/BigintUniqueCheckPkRef.go b/internal/integration_tests/mysql5/nulltypeprimitive/BigintUniqueCheckPkRef.go new file mode 100644 index 00000000..f41b59bf --- /dev/null +++ b/internal/integration_tests/mysql5/nulltypeprimitive/BigintUniqueCheckPkRef.go @@ -0,0 +1,5 @@ +package dto + +type BigintUniqueCheckPkRef struct { + BigintUniqueCheckPkRef int `db:"bigint_unique_check_pk_ref"` +} diff --git a/internal/integration_tests/mysql5/nulltypeprimitive/BigintUniquePk.go b/internal/integration_tests/mysql5/nulltypeprimitive/BigintUniquePk.go new file mode 100644 index 00000000..06e50c8e --- /dev/null +++ b/internal/integration_tests/mysql5/nulltypeprimitive/BigintUniquePk.go @@ -0,0 +1,5 @@ +package dto + +type BigintUniquePk struct { + BigintUniquePk int `db:"bigint_unique_pk"` +} diff --git a/internal/integration_tests/mysql5/nulltypeprimitive/BinaryCheckPk.go b/internal/integration_tests/mysql5/nulltypeprimitive/BinaryCheckPk.go new file mode 100644 index 00000000..efa14dfd --- /dev/null +++ b/internal/integration_tests/mysql5/nulltypeprimitive/BinaryCheckPk.go @@ -0,0 +1,5 @@ +package dto + +type BinaryCheckPk struct { + BinaryCheckPk string `db:"binary_check_pk"` +} diff --git a/internal/integration_tests/mysql5/nulltypeprimitive/BinaryDefConstUniqueCheckPk.go b/internal/integration_tests/mysql5/nulltypeprimitive/BinaryDefConstUniqueCheckPk.go new file mode 100644 index 00000000..065a8a21 --- /dev/null +++ b/internal/integration_tests/mysql5/nulltypeprimitive/BinaryDefConstUniqueCheckPk.go @@ -0,0 +1,5 @@ +package dto + +type BinaryDefConstUniqueCheckPk struct { + BinaryDefConstUniqueCheckPk string `db:"binary_def_const_unique_check_pk"` +} diff --git a/internal/integration_tests/mysql5/nulltypeprimitive/BinaryDefConstUniqueCheckPkRef.go b/internal/integration_tests/mysql5/nulltypeprimitive/BinaryDefConstUniqueCheckPkRef.go new file mode 100644 index 00000000..5309fbd7 --- /dev/null +++ b/internal/integration_tests/mysql5/nulltypeprimitive/BinaryDefConstUniqueCheckPkRef.go @@ -0,0 +1,5 @@ +package dto + +type BinaryDefConstUniqueCheckPkRef struct { + BinaryDefConstUniqueCheckPkRef string `db:"binary_def_const_unique_check_pk_ref"` +} diff --git a/internal/integration_tests/mysql5/nulltypeprimitive/BinaryDefFuncUniqueCheckPk.go b/internal/integration_tests/mysql5/nulltypeprimitive/BinaryDefFuncUniqueCheckPk.go new file mode 100644 index 00000000..17d016cf --- /dev/null +++ b/internal/integration_tests/mysql5/nulltypeprimitive/BinaryDefFuncUniqueCheckPk.go @@ -0,0 +1,5 @@ +package dto + +type BinaryDefFuncUniqueCheckPk struct { + BinaryDefFuncUniqueCheckPk string `db:"binary_def_func_unique_check_pk"` +} diff --git a/internal/integration_tests/mysql5/nulltypeprimitive/BinaryDefFuncUniqueCheckPkRef.go b/internal/integration_tests/mysql5/nulltypeprimitive/BinaryDefFuncUniqueCheckPkRef.go new file mode 100644 index 00000000..8ad6c58e --- /dev/null +++ b/internal/integration_tests/mysql5/nulltypeprimitive/BinaryDefFuncUniqueCheckPkRef.go @@ -0,0 +1,5 @@ +package dto + +type BinaryDefFuncUniqueCheckPkRef struct { + BinaryDefFuncUniqueCheckPkRef string `db:"binary_def_func_unique_check_pk_ref"` +} diff --git a/internal/integration_tests/mysql5/nulltypeprimitive/BinaryNnPk.go b/internal/integration_tests/mysql5/nulltypeprimitive/BinaryNnPk.go new file mode 100644 index 00000000..3ed599f3 --- /dev/null +++ b/internal/integration_tests/mysql5/nulltypeprimitive/BinaryNnPk.go @@ -0,0 +1,5 @@ +package dto + +type BinaryNnPk struct { + BinaryNnPk string `db:"binary_nn_pk"` +} diff --git a/internal/integration_tests/mysql5/nulltypeprimitive/BinaryNnUniqueCheckPk.go b/internal/integration_tests/mysql5/nulltypeprimitive/BinaryNnUniqueCheckPk.go new file mode 100644 index 00000000..c2c3e783 --- /dev/null +++ b/internal/integration_tests/mysql5/nulltypeprimitive/BinaryNnUniqueCheckPk.go @@ -0,0 +1,5 @@ +package dto + +type BinaryNnUniqueCheckPk struct { + BinaryNnUniqueCheckPk string `db:"binary_nn_unique_check_pk"` +} diff --git a/internal/integration_tests/mysql5/nulltypeprimitive/BinaryNnUniqueCheckPkRef.go b/internal/integration_tests/mysql5/nulltypeprimitive/BinaryNnUniqueCheckPkRef.go new file mode 100644 index 00000000..d0c44d10 --- /dev/null +++ b/internal/integration_tests/mysql5/nulltypeprimitive/BinaryNnUniqueCheckPkRef.go @@ -0,0 +1,5 @@ +package dto + +type BinaryNnUniqueCheckPkRef struct { + BinaryNnUniqueCheckPkRef string `db:"binary_nn_unique_check_pk_ref"` +} diff --git a/internal/integration_tests/mysql5/nulltypeprimitive/BinaryPk.go b/internal/integration_tests/mysql5/nulltypeprimitive/BinaryPk.go new file mode 100644 index 00000000..6b5f9d3c --- /dev/null +++ b/internal/integration_tests/mysql5/nulltypeprimitive/BinaryPk.go @@ -0,0 +1,5 @@ +package dto + +type BinaryPk struct { + BinaryPk string `db:"binary_pk"` +} diff --git a/internal/integration_tests/mysql5/nulltypeprimitive/BinaryPkDefConst.go b/internal/integration_tests/mysql5/nulltypeprimitive/BinaryPkDefConst.go new file mode 100644 index 00000000..a82868f0 --- /dev/null +++ b/internal/integration_tests/mysql5/nulltypeprimitive/BinaryPkDefConst.go @@ -0,0 +1,5 @@ +package dto + +type BinaryPkDefConst struct { + BinaryPkDefConst string `db:"binary_pk_def_const"` +} diff --git a/internal/integration_tests/mysql5/nulltypeprimitive/BinaryPkDefFunc.go b/internal/integration_tests/mysql5/nulltypeprimitive/BinaryPkDefFunc.go new file mode 100644 index 00000000..6b3afc82 --- /dev/null +++ b/internal/integration_tests/mysql5/nulltypeprimitive/BinaryPkDefFunc.go @@ -0,0 +1,5 @@ +package dto + +type BinaryPkDefFunc struct { + BinaryPkDefFunc string `db:"binary_pk_def_func"` +} diff --git a/internal/integration_tests/mysql5/nulltypeprimitive/BinaryPkRef.go b/internal/integration_tests/mysql5/nulltypeprimitive/BinaryPkRef.go new file mode 100644 index 00000000..499cda7d --- /dev/null +++ b/internal/integration_tests/mysql5/nulltypeprimitive/BinaryPkRef.go @@ -0,0 +1,5 @@ +package dto + +type BinaryPkRef struct { + BinaryPkRef string `db:"binary_pk_ref"` +} diff --git a/internal/integration_tests/mysql5/nulltypeprimitive/BinaryRef.go b/internal/integration_tests/mysql5/nulltypeprimitive/BinaryRef.go new file mode 100644 index 00000000..17601d67 --- /dev/null +++ b/internal/integration_tests/mysql5/nulltypeprimitive/BinaryRef.go @@ -0,0 +1,5 @@ +package dto + +type BinaryRef struct { + BinaryRef *string `db:"binary_ref"` +} diff --git a/internal/integration_tests/mysql5/nulltypeprimitive/BinaryTable.go b/internal/integration_tests/mysql5/nulltypeprimitive/BinaryTable.go new file mode 100644 index 00000000..9e90a6d7 --- /dev/null +++ b/internal/integration_tests/mysql5/nulltypeprimitive/BinaryTable.go @@ -0,0 +1,29 @@ +package dto + +type BinaryTable struct { + Col *string `db:"col"` + BinaryCap *string `db:"binary_cap"` + BinaryNn string `db:"binary_nn"` + BinaryNnUnique string `db:"binary_nn_unique"` + BinaryNnCheckCmp string `db:"binary_nn_check_cmp"` + BinaryNnCheckFn string `db:"binary_nn_check_fn"` + BinaryNnRef string `db:"binary_nn_ref"` + BinaryNnDefConst string `db:"binary_nn_def_const"` + BinaryNnDefFunc string `db:"binary_nn_def_func"` + BinaryNnUniqueCheck string `db:"binary_nn_unique_check"` + BinaryUnique *string `db:"binary_unique"` + BinaryUniqueCheck *string `db:"binary_unique_check"` + BinaryUniqueRef *string `db:"binary_unique_ref"` + BinaryUniqueDefConst *string `db:"binary_unique_def_const"` + BinaryUniqueDefFunc *string `db:"binary_unique_def_func"` + BinaryCheck *string `db:"binary_check"` + BinaryCheckRef *string `db:"binary_check_ref"` + BinaryCheckDefConst *string `db:"binary_check_def_const"` + BinaryCheckDefFunc *string `db:"binary_check_def_func"` + BinaryRef *string `db:"binary_ref"` + BinaryRefUniqueCheck *string `db:"binary_ref_unique_check"` + BinaryDefConst *string `db:"binary_def_const"` + BinaryDefConstUniqueCheck *string `db:"binary_def_const_unique_check"` + BinaryDefFunc *string `db:"binary_def_func"` + BinaryDefFuncUniqueCheck *string `db:"binary_def_func_unique_check"` +} diff --git a/internal/integration_tests/mysql5/nulltypeprimitive/BinaryUniqueCheckPk.go b/internal/integration_tests/mysql5/nulltypeprimitive/BinaryUniqueCheckPk.go new file mode 100644 index 00000000..b52b07de --- /dev/null +++ b/internal/integration_tests/mysql5/nulltypeprimitive/BinaryUniqueCheckPk.go @@ -0,0 +1,5 @@ +package dto + +type BinaryUniqueCheckPk struct { + BinaryUniqueCheckPk string `db:"binary_unique_check_pk"` +} diff --git a/internal/integration_tests/mysql5/nulltypeprimitive/BinaryUniqueCheckPkRef.go b/internal/integration_tests/mysql5/nulltypeprimitive/BinaryUniqueCheckPkRef.go new file mode 100644 index 00000000..87df9f43 --- /dev/null +++ b/internal/integration_tests/mysql5/nulltypeprimitive/BinaryUniqueCheckPkRef.go @@ -0,0 +1,5 @@ +package dto + +type BinaryUniqueCheckPkRef struct { + BinaryUniqueCheckPkRef string `db:"binary_unique_check_pk_ref"` +} diff --git a/internal/integration_tests/mysql5/nulltypeprimitive/BinaryUniquePk.go b/internal/integration_tests/mysql5/nulltypeprimitive/BinaryUniquePk.go new file mode 100644 index 00000000..f6700a1c --- /dev/null +++ b/internal/integration_tests/mysql5/nulltypeprimitive/BinaryUniquePk.go @@ -0,0 +1,5 @@ +package dto + +type BinaryUniquePk struct { + BinaryUniquePk string `db:"binary_unique_pk"` +} diff --git a/internal/integration_tests/mysql5/nulltypeprimitive/BlobRef.go b/internal/integration_tests/mysql5/nulltypeprimitive/BlobRef.go new file mode 100644 index 00000000..31a8025d --- /dev/null +++ b/internal/integration_tests/mysql5/nulltypeprimitive/BlobRef.go @@ -0,0 +1,5 @@ +package dto + +type BlobRef struct { + BlobRef string `db:"blob_ref"` +} diff --git a/internal/integration_tests/mysql5/nulltypeprimitive/BlobTable.go b/internal/integration_tests/mysql5/nulltypeprimitive/BlobTable.go new file mode 100644 index 00000000..b17d85a1 --- /dev/null +++ b/internal/integration_tests/mysql5/nulltypeprimitive/BlobTable.go @@ -0,0 +1,18 @@ +package dto + +type BlobTable struct { + Col *string `db:"col"` + BlobDefConst *string `db:"blob_def_const"` + BlobDefFunc *string `db:"blob_def_func"` + BlobRef *string `db:"blob_ref"` + BlobNn string `db:"blob_nn"` + BlobNnCheckCmp string `db:"blob_nn_check_cmp"` + BlobNnCheckFn string `db:"blob_nn_check_fn"` + BlobNnRef string `db:"blob_nn_ref"` + BlobNnDefConst string `db:"blob_nn_def_const"` + BlobNnDefFunc string `db:"blob_nn_def_func"` + BlobCheck *string `db:"blob_check"` + BlobCheckRef *string `db:"blob_check_ref"` + BlobCheckDefConst *string `db:"blob_check_def_const"` + BlobCheckDefFunc *string `db:"blob_check_def_func"` +} diff --git a/internal/integration_tests/mysql5/nulltypeprimitive/CharCheckPk.go b/internal/integration_tests/mysql5/nulltypeprimitive/CharCheckPk.go new file mode 100644 index 00000000..3fced3dc --- /dev/null +++ b/internal/integration_tests/mysql5/nulltypeprimitive/CharCheckPk.go @@ -0,0 +1,5 @@ +package dto + +type CharCheckPk struct { + CharCheckPk string `db:"char_check_pk"` +} diff --git a/internal/integration_tests/mysql5/nulltypeprimitive/CharDefConstUniqueCheckPk.go b/internal/integration_tests/mysql5/nulltypeprimitive/CharDefConstUniqueCheckPk.go new file mode 100644 index 00000000..3c69f6ff --- /dev/null +++ b/internal/integration_tests/mysql5/nulltypeprimitive/CharDefConstUniqueCheckPk.go @@ -0,0 +1,5 @@ +package dto + +type CharDefConstUniqueCheckPk struct { + CharDefConstUniqueCheckPk string `db:"char_def_const_unique_check_pk"` +} diff --git a/internal/integration_tests/mysql5/nulltypeprimitive/CharDefConstUniqueCheckPkRef.go b/internal/integration_tests/mysql5/nulltypeprimitive/CharDefConstUniqueCheckPkRef.go new file mode 100644 index 00000000..6b29a7e6 --- /dev/null +++ b/internal/integration_tests/mysql5/nulltypeprimitive/CharDefConstUniqueCheckPkRef.go @@ -0,0 +1,5 @@ +package dto + +type CharDefConstUniqueCheckPkRef struct { + CharDefConstUniqueCheckPkRef string `db:"char_def_const_unique_check_pk_ref"` +} diff --git a/internal/integration_tests/mysql5/nulltypeprimitive/CharDefFuncUniqueCheckPk.go b/internal/integration_tests/mysql5/nulltypeprimitive/CharDefFuncUniqueCheckPk.go new file mode 100644 index 00000000..45d10db8 --- /dev/null +++ b/internal/integration_tests/mysql5/nulltypeprimitive/CharDefFuncUniqueCheckPk.go @@ -0,0 +1,5 @@ +package dto + +type CharDefFuncUniqueCheckPk struct { + CharDefFuncUniqueCheckPk string `db:"char_def_func_unique_check_pk"` +} diff --git a/internal/integration_tests/mysql5/nulltypeprimitive/CharDefFuncUniqueCheckPkRef.go b/internal/integration_tests/mysql5/nulltypeprimitive/CharDefFuncUniqueCheckPkRef.go new file mode 100644 index 00000000..43d48b6b --- /dev/null +++ b/internal/integration_tests/mysql5/nulltypeprimitive/CharDefFuncUniqueCheckPkRef.go @@ -0,0 +1,5 @@ +package dto + +type CharDefFuncUniqueCheckPkRef struct { + CharDefFuncUniqueCheckPkRef string `db:"char_def_func_unique_check_pk_ref"` +} diff --git a/internal/integration_tests/mysql5/nulltypeprimitive/CharNnPk.go b/internal/integration_tests/mysql5/nulltypeprimitive/CharNnPk.go new file mode 100644 index 00000000..309e6e87 --- /dev/null +++ b/internal/integration_tests/mysql5/nulltypeprimitive/CharNnPk.go @@ -0,0 +1,5 @@ +package dto + +type CharNnPk struct { + CharNnPk string `db:"char_nn_pk"` +} diff --git a/internal/integration_tests/mysql5/nulltypeprimitive/CharNnUniqueCheckPk.go b/internal/integration_tests/mysql5/nulltypeprimitive/CharNnUniqueCheckPk.go new file mode 100644 index 00000000..0ffe2059 --- /dev/null +++ b/internal/integration_tests/mysql5/nulltypeprimitive/CharNnUniqueCheckPk.go @@ -0,0 +1,5 @@ +package dto + +type CharNnUniqueCheckPk struct { + CharNnUniqueCheckPk string `db:"char_nn_unique_check_pk"` +} diff --git a/internal/integration_tests/mysql5/nulltypeprimitive/CharNnUniqueCheckPkRef.go b/internal/integration_tests/mysql5/nulltypeprimitive/CharNnUniqueCheckPkRef.go new file mode 100644 index 00000000..62f9b39b --- /dev/null +++ b/internal/integration_tests/mysql5/nulltypeprimitive/CharNnUniqueCheckPkRef.go @@ -0,0 +1,5 @@ +package dto + +type CharNnUniqueCheckPkRef struct { + CharNnUniqueCheckPkRef string `db:"char_nn_unique_check_pk_ref"` +} diff --git a/internal/integration_tests/mysql5/nulltypeprimitive/CharPk.go b/internal/integration_tests/mysql5/nulltypeprimitive/CharPk.go new file mode 100644 index 00000000..82d769ca --- /dev/null +++ b/internal/integration_tests/mysql5/nulltypeprimitive/CharPk.go @@ -0,0 +1,5 @@ +package dto + +type CharPk struct { + CharPk string `db:"char_pk"` +} diff --git a/internal/integration_tests/mysql5/nulltypeprimitive/CharPkDefConst.go b/internal/integration_tests/mysql5/nulltypeprimitive/CharPkDefConst.go new file mode 100644 index 00000000..e386cc95 --- /dev/null +++ b/internal/integration_tests/mysql5/nulltypeprimitive/CharPkDefConst.go @@ -0,0 +1,5 @@ +package dto + +type CharPkDefConst struct { + CharPkDefConst string `db:"char_pk_def_const"` +} diff --git a/internal/integration_tests/mysql5/nulltypeprimitive/CharPkDefFunc.go b/internal/integration_tests/mysql5/nulltypeprimitive/CharPkDefFunc.go new file mode 100644 index 00000000..24a1d17a --- /dev/null +++ b/internal/integration_tests/mysql5/nulltypeprimitive/CharPkDefFunc.go @@ -0,0 +1,5 @@ +package dto + +type CharPkDefFunc struct { + CharPkDefFunc string `db:"char_pk_def_func"` +} diff --git a/internal/integration_tests/mysql5/nulltypeprimitive/CharPkRef.go b/internal/integration_tests/mysql5/nulltypeprimitive/CharPkRef.go new file mode 100644 index 00000000..aed73b7d --- /dev/null +++ b/internal/integration_tests/mysql5/nulltypeprimitive/CharPkRef.go @@ -0,0 +1,5 @@ +package dto + +type CharPkRef struct { + CharPkRef string `db:"char_pk_ref"` +} diff --git a/internal/integration_tests/mysql5/nulltypeprimitive/CharRef.go b/internal/integration_tests/mysql5/nulltypeprimitive/CharRef.go new file mode 100644 index 00000000..369a1e00 --- /dev/null +++ b/internal/integration_tests/mysql5/nulltypeprimitive/CharRef.go @@ -0,0 +1,5 @@ +package dto + +type CharRef struct { + CharRef *string `db:"char_ref"` +} diff --git a/internal/integration_tests/mysql5/nulltypeprimitive/CharTable.go b/internal/integration_tests/mysql5/nulltypeprimitive/CharTable.go new file mode 100644 index 00000000..60bf019b --- /dev/null +++ b/internal/integration_tests/mysql5/nulltypeprimitive/CharTable.go @@ -0,0 +1,29 @@ +package dto + +type CharTable struct { + Col *string `db:"col"` + CharCap *string `db:"char_cap"` + CharNn string `db:"char_nn"` + CharNnUnique string `db:"char_nn_unique"` + CharNnCheckCmp string `db:"char_nn_check_cmp"` + CharNnCheckFn string `db:"char_nn_check_fn"` + CharNnRef string `db:"char_nn_ref"` + CharNnDefConst string `db:"char_nn_def_const"` + CharNnDefFunc string `db:"char_nn_def_func"` + CharNnUniqueCheck string `db:"char_nn_unique_check"` + CharUnique *string `db:"char_unique"` + CharUniqueCheck *string `db:"char_unique_check"` + CharUniqueRef *string `db:"char_unique_ref"` + CharUniqueDefConst *string `db:"char_unique_def_const"` + CharUniqueDefFunc *string `db:"char_unique_def_func"` + CharCheck *string `db:"char_check"` + CharCheckRef *string `db:"char_check_ref"` + CharCheckDefConst *string `db:"char_check_def_const"` + CharCheckDefFunc *string `db:"char_check_def_func"` + CharRef *string `db:"char_ref"` + CharRefUniqueCheck *string `db:"char_ref_unique_check"` + CharDefConst *string `db:"char_def_const"` + CharDefConstUniqueCheck *string `db:"char_def_const_unique_check"` + CharDefFunc *string `db:"char_def_func"` + CharDefFuncUniqueCheck *string `db:"char_def_func_unique_check"` +} diff --git a/internal/integration_tests/mysql5/nulltypeprimitive/CharUniqueCheckPk.go b/internal/integration_tests/mysql5/nulltypeprimitive/CharUniqueCheckPk.go new file mode 100644 index 00000000..3a27898a --- /dev/null +++ b/internal/integration_tests/mysql5/nulltypeprimitive/CharUniqueCheckPk.go @@ -0,0 +1,5 @@ +package dto + +type CharUniqueCheckPk struct { + CharUniqueCheckPk string `db:"char_unique_check_pk"` +} diff --git a/internal/integration_tests/mysql5/nulltypeprimitive/CharUniqueCheckPkRef.go b/internal/integration_tests/mysql5/nulltypeprimitive/CharUniqueCheckPkRef.go new file mode 100644 index 00000000..47939972 --- /dev/null +++ b/internal/integration_tests/mysql5/nulltypeprimitive/CharUniqueCheckPkRef.go @@ -0,0 +1,5 @@ +package dto + +type CharUniqueCheckPkRef struct { + CharUniqueCheckPkRef string `db:"char_unique_check_pk_ref"` +} diff --git a/internal/integration_tests/mysql5/nulltypeprimitive/CharUniquePk.go b/internal/integration_tests/mysql5/nulltypeprimitive/CharUniquePk.go new file mode 100644 index 00000000..27407394 --- /dev/null +++ b/internal/integration_tests/mysql5/nulltypeprimitive/CharUniquePk.go @@ -0,0 +1,5 @@ +package dto + +type CharUniquePk struct { + CharUniquePk string `db:"char_unique_pk"` +} diff --git a/internal/integration_tests/mysql5/nulltypeprimitive/ConstraintComboNonPk.go b/internal/integration_tests/mysql5/nulltypeprimitive/ConstraintComboNonPk.go new file mode 100644 index 00000000..575d9778 --- /dev/null +++ b/internal/integration_tests/mysql5/nulltypeprimitive/ConstraintComboNonPk.go @@ -0,0 +1,16 @@ +package dto + +type ConstraintComboNonPk struct { + NotNullUniqueCheckDefConst float64 `db:"not_null_unique_check_def_const"` + NotNullUniqueCheckDefFunc float64 `db:"not_null_unique_check_def_func"` + NotNullUniqueRefDefConst float64 `db:"not_null_unique_ref_def_const"` + NotNullUniqueRefDefFunc float64 `db:"not_null_unique_ref_def_func"` + NotNullCheckRefDefConst float64 `db:"not_null_check_ref_def_const"` + NotNullCheckRefDefFunc float64 `db:"not_null_check_ref_def_func"` + NotNullUniqueDefConst float64 `db:"not_null_unique_def_const"` + NotNullUniqueDefFunc float64 `db:"not_null_unique_def_func"` + NotNullCheckDefConst float64 `db:"not_null_check_def_const"` + NotNullCheckDefFunc float64 `db:"not_null_check_def_func"` + NotNullRefDefConst float64 `db:"not_null_ref_def_const"` + NotNullRefDefFunc float64 `db:"not_null_ref_def_func"` +} diff --git a/internal/integration_tests/mysql5/nulltypeprimitive/ConstraintComboNotNullCheckPkDefConst.go b/internal/integration_tests/mysql5/nulltypeprimitive/ConstraintComboNotNullCheckPkDefConst.go new file mode 100644 index 00000000..4aa890ba --- /dev/null +++ b/internal/integration_tests/mysql5/nulltypeprimitive/ConstraintComboNotNullCheckPkDefConst.go @@ -0,0 +1,5 @@ +package dto + +type ConstraintComboNotNullCheckPkDefConst struct { + ConstraintComboNotNullCheckPkDefConst float64 `db:"constraint_combo_not_null_check_pk_def_const"` +} diff --git a/internal/integration_tests/mysql5/nulltypeprimitive/ConstraintComboNotNullCheckPkDefFunc.go b/internal/integration_tests/mysql5/nulltypeprimitive/ConstraintComboNotNullCheckPkDefFunc.go new file mode 100644 index 00000000..dce0d8b3 --- /dev/null +++ b/internal/integration_tests/mysql5/nulltypeprimitive/ConstraintComboNotNullCheckPkDefFunc.go @@ -0,0 +1,5 @@ +package dto + +type ConstraintComboNotNullCheckPkDefFunc struct { + ConstraintComboNotNullCheckPkDefFunc float64 `db:"constraint_combo_not_null_check_pk_def_func"` +} diff --git a/internal/integration_tests/mysql5/nulltypeprimitive/ConstraintComboNotNullPkDefConst.go b/internal/integration_tests/mysql5/nulltypeprimitive/ConstraintComboNotNullPkDefConst.go new file mode 100644 index 00000000..ca059e7a --- /dev/null +++ b/internal/integration_tests/mysql5/nulltypeprimitive/ConstraintComboNotNullPkDefConst.go @@ -0,0 +1,5 @@ +package dto + +type ConstraintComboNotNullPkDefConst struct { + ConstraintComboNotNullPkDefConst float64 `db:"constraint_combo_not_null_pk_def_const"` +} diff --git a/internal/integration_tests/mysql5/nulltypeprimitive/ConstraintComboNotNullPkDefFunc.go b/internal/integration_tests/mysql5/nulltypeprimitive/ConstraintComboNotNullPkDefFunc.go new file mode 100644 index 00000000..5bb0b531 --- /dev/null +++ b/internal/integration_tests/mysql5/nulltypeprimitive/ConstraintComboNotNullPkDefFunc.go @@ -0,0 +1,5 @@ +package dto + +type ConstraintComboNotNullPkDefFunc struct { + ConstraintComboNotNullPkDefFunc float64 `db:"constraint_combo_not_null_pk_def_func"` +} diff --git a/internal/integration_tests/mysql5/nulltypeprimitive/ConstraintComboNotNullPkRefDefConst.go b/internal/integration_tests/mysql5/nulltypeprimitive/ConstraintComboNotNullPkRefDefConst.go new file mode 100644 index 00000000..4bd7ce91 --- /dev/null +++ b/internal/integration_tests/mysql5/nulltypeprimitive/ConstraintComboNotNullPkRefDefConst.go @@ -0,0 +1,5 @@ +package dto + +type ConstraintComboNotNullPkRefDefConst struct { + ConstraintComboNotNullPkRefDefConst float64 `db:"constraint_combo_not_null_pk_ref_def_const"` +} diff --git a/internal/integration_tests/mysql5/nulltypeprimitive/ConstraintComboNotNullPkRefDefFunc.go b/internal/integration_tests/mysql5/nulltypeprimitive/ConstraintComboNotNullPkRefDefFunc.go new file mode 100644 index 00000000..72c2299b --- /dev/null +++ b/internal/integration_tests/mysql5/nulltypeprimitive/ConstraintComboNotNullPkRefDefFunc.go @@ -0,0 +1,5 @@ +package dto + +type ConstraintComboNotNullPkRefDefFunc struct { + ConstraintComboNotNullPkRefDefFunc float64 `db:"constraint_combo_not_null_pk_ref_def_func"` +} diff --git a/internal/integration_tests/mysql5/nulltypeprimitive/ConstraintComboNotNullUniquePkDefConst.go b/internal/integration_tests/mysql5/nulltypeprimitive/ConstraintComboNotNullUniquePkDefConst.go new file mode 100644 index 00000000..b195d769 --- /dev/null +++ b/internal/integration_tests/mysql5/nulltypeprimitive/ConstraintComboNotNullUniquePkDefConst.go @@ -0,0 +1,5 @@ +package dto + +type ConstraintComboNotNullUniquePkDefConst struct { + ConstraintComboNotNullUniquePkDefConst float64 `db:"constraint_combo_not_null_unique_pk_def_const"` +} diff --git a/internal/integration_tests/mysql5/nulltypeprimitive/ConstraintComboNotNullUniquePkDefFunc.go b/internal/integration_tests/mysql5/nulltypeprimitive/ConstraintComboNotNullUniquePkDefFunc.go new file mode 100644 index 00000000..845d6231 --- /dev/null +++ b/internal/integration_tests/mysql5/nulltypeprimitive/ConstraintComboNotNullUniquePkDefFunc.go @@ -0,0 +1,5 @@ +package dto + +type ConstraintComboNotNullUniquePkDefFunc struct { + ConstraintComboNotNullUniquePkDefFunc float64 `db:"constraint_combo_not_null_unique_pk_def_func"` +} diff --git a/internal/integration_tests/mysql5/nulltypeprimitive/ConstraintComboRef.go b/internal/integration_tests/mysql5/nulltypeprimitive/ConstraintComboRef.go new file mode 100644 index 00000000..85387cf7 --- /dev/null +++ b/internal/integration_tests/mysql5/nulltypeprimitive/ConstraintComboRef.go @@ -0,0 +1,5 @@ +package dto + +type ConstraintComboRef struct { + ConstraintComboRef *float64 `db:"constraint_combo_ref"` +} diff --git a/internal/integration_tests/mysql5/nulltypeprimitive/DateCheckPk.go b/internal/integration_tests/mysql5/nulltypeprimitive/DateCheckPk.go new file mode 100644 index 00000000..6cb1844e --- /dev/null +++ b/internal/integration_tests/mysql5/nulltypeprimitive/DateCheckPk.go @@ -0,0 +1,9 @@ +package dto + +import ( + "time" +) + +type DateCheckPk struct { + DateCheckPk time.Time `db:"date_check_pk"` +} diff --git a/internal/integration_tests/mysql5/nulltypeprimitive/DateDefConstUniqueCheckPk.go b/internal/integration_tests/mysql5/nulltypeprimitive/DateDefConstUniqueCheckPk.go new file mode 100644 index 00000000..e07a7ed5 --- /dev/null +++ b/internal/integration_tests/mysql5/nulltypeprimitive/DateDefConstUniqueCheckPk.go @@ -0,0 +1,9 @@ +package dto + +import ( + "time" +) + +type DateDefConstUniqueCheckPk struct { + DateDefConstUniqueCheckPk time.Time `db:"date_def_const_unique_check_pk"` +} diff --git a/internal/integration_tests/mysql5/nulltypeprimitive/DateDefConstUniqueCheckPkRef.go b/internal/integration_tests/mysql5/nulltypeprimitive/DateDefConstUniqueCheckPkRef.go new file mode 100644 index 00000000..3b99928e --- /dev/null +++ b/internal/integration_tests/mysql5/nulltypeprimitive/DateDefConstUniqueCheckPkRef.go @@ -0,0 +1,9 @@ +package dto + +import ( + "time" +) + +type DateDefConstUniqueCheckPkRef struct { + DateDefConstUniqueCheckPkRef time.Time `db:"date_def_const_unique_check_pk_ref"` +} diff --git a/internal/integration_tests/mysql5/nulltypeprimitive/DateDefFuncUniqueCheckPk.go b/internal/integration_tests/mysql5/nulltypeprimitive/DateDefFuncUniqueCheckPk.go new file mode 100644 index 00000000..12934d64 --- /dev/null +++ b/internal/integration_tests/mysql5/nulltypeprimitive/DateDefFuncUniqueCheckPk.go @@ -0,0 +1,9 @@ +package dto + +import ( + "time" +) + +type DateDefFuncUniqueCheckPk struct { + DateDefFuncUniqueCheckPk time.Time `db:"date_def_func_unique_check_pk"` +} diff --git a/internal/integration_tests/mysql5/nulltypeprimitive/DateDefFuncUniqueCheckPkRef.go b/internal/integration_tests/mysql5/nulltypeprimitive/DateDefFuncUniqueCheckPkRef.go new file mode 100644 index 00000000..19ed2d94 --- /dev/null +++ b/internal/integration_tests/mysql5/nulltypeprimitive/DateDefFuncUniqueCheckPkRef.go @@ -0,0 +1,9 @@ +package dto + +import ( + "time" +) + +type DateDefFuncUniqueCheckPkRef struct { + DateDefFuncUniqueCheckPkRef time.Time `db:"date_def_func_unique_check_pk_ref"` +} diff --git a/internal/integration_tests/mysql5/nulltypeprimitive/DateNnPk.go b/internal/integration_tests/mysql5/nulltypeprimitive/DateNnPk.go new file mode 100644 index 00000000..24f7dc12 --- /dev/null +++ b/internal/integration_tests/mysql5/nulltypeprimitive/DateNnPk.go @@ -0,0 +1,9 @@ +package dto + +import ( + "time" +) + +type DateNnPk struct { + DateNnPk time.Time `db:"date_nn_pk"` +} diff --git a/internal/integration_tests/mysql5/nulltypeprimitive/DateNnUniqueCheckPk.go b/internal/integration_tests/mysql5/nulltypeprimitive/DateNnUniqueCheckPk.go new file mode 100644 index 00000000..162ceee5 --- /dev/null +++ b/internal/integration_tests/mysql5/nulltypeprimitive/DateNnUniqueCheckPk.go @@ -0,0 +1,9 @@ +package dto + +import ( + "time" +) + +type DateNnUniqueCheckPk struct { + DateNnUniqueCheckPk time.Time `db:"date_nn_unique_check_pk"` +} diff --git a/internal/integration_tests/mysql5/nulltypeprimitive/DateNnUniqueCheckPkRef.go b/internal/integration_tests/mysql5/nulltypeprimitive/DateNnUniqueCheckPkRef.go new file mode 100644 index 00000000..57c61fce --- /dev/null +++ b/internal/integration_tests/mysql5/nulltypeprimitive/DateNnUniqueCheckPkRef.go @@ -0,0 +1,9 @@ +package dto + +import ( + "time" +) + +type DateNnUniqueCheckPkRef struct { + DateNnUniqueCheckPkRef time.Time `db:"date_nn_unique_check_pk_ref"` +} diff --git a/internal/integration_tests/mysql5/nulltypeprimitive/DatePk.go b/internal/integration_tests/mysql5/nulltypeprimitive/DatePk.go new file mode 100644 index 00000000..d006be42 --- /dev/null +++ b/internal/integration_tests/mysql5/nulltypeprimitive/DatePk.go @@ -0,0 +1,9 @@ +package dto + +import ( + "time" +) + +type DatePk struct { + DatePk time.Time `db:"date_pk"` +} diff --git a/internal/integration_tests/mysql5/nulltypeprimitive/DatePkDefConst.go b/internal/integration_tests/mysql5/nulltypeprimitive/DatePkDefConst.go new file mode 100644 index 00000000..b10866e0 --- /dev/null +++ b/internal/integration_tests/mysql5/nulltypeprimitive/DatePkDefConst.go @@ -0,0 +1,9 @@ +package dto + +import ( + "time" +) + +type DatePkDefConst struct { + DatePkDefConst time.Time `db:"date_pk_def_const"` +} diff --git a/internal/integration_tests/mysql5/nulltypeprimitive/DatePkDefFunc.go b/internal/integration_tests/mysql5/nulltypeprimitive/DatePkDefFunc.go new file mode 100644 index 00000000..133d388a --- /dev/null +++ b/internal/integration_tests/mysql5/nulltypeprimitive/DatePkDefFunc.go @@ -0,0 +1,9 @@ +package dto + +import ( + "time" +) + +type DatePkDefFunc struct { + DatePkDefFunc time.Time `db:"date_pk_def_func"` +} diff --git a/internal/integration_tests/mysql5/nulltypeprimitive/DatePkRef.go b/internal/integration_tests/mysql5/nulltypeprimitive/DatePkRef.go new file mode 100644 index 00000000..e4f6d521 --- /dev/null +++ b/internal/integration_tests/mysql5/nulltypeprimitive/DatePkRef.go @@ -0,0 +1,9 @@ +package dto + +import ( + "time" +) + +type DatePkRef struct { + DatePkRef time.Time `db:"date_pk_ref"` +} diff --git a/internal/integration_tests/mysql5/nulltypeprimitive/DateRef.go b/internal/integration_tests/mysql5/nulltypeprimitive/DateRef.go new file mode 100644 index 00000000..31d25216 --- /dev/null +++ b/internal/integration_tests/mysql5/nulltypeprimitive/DateRef.go @@ -0,0 +1,9 @@ +package dto + +import ( + "time" +) + +type DateRef struct { + DateRef *time.Time `db:"date_ref"` +} diff --git a/internal/integration_tests/mysql5/nulltypeprimitive/DateTable.go b/internal/integration_tests/mysql5/nulltypeprimitive/DateTable.go new file mode 100644 index 00000000..8b1acfb8 --- /dev/null +++ b/internal/integration_tests/mysql5/nulltypeprimitive/DateTable.go @@ -0,0 +1,31 @@ +package dto + +import ( + "time" +) + +type DateTable struct { + Date *time.Time `db:"date"` + DateNn time.Time `db:"date_nn"` + DateNnUnique time.Time `db:"date_nn_unique"` + DateNnCheck time.Time `db:"date_nn_check"` + DateNnRef time.Time `db:"date_nn_ref"` + DateNnDefConst time.Time `db:"date_nn_def_const"` + DateNnDefFunc time.Time `db:"date_nn_def_func"` + DateNnUniqueCheck time.Time `db:"date_nn_unique_check"` + DateUnique *time.Time `db:"date_unique"` + DateUniqueCheck *time.Time `db:"date_unique_check"` + DateUniqueRef *time.Time `db:"date_unique_ref"` + DateUniqueDefConst *time.Time `db:"date_unique_def_const"` + DateUniqueDefFunc *time.Time `db:"date_unique_def_func"` + DateCheck *time.Time `db:"date_check"` + DateCheckRef *time.Time `db:"date_check_ref"` + DateCheckDefConst *time.Time `db:"date_check_def_const"` + DateCheckDefFunc *time.Time `db:"date_check_def_func"` + DateRef *time.Time `db:"date_ref"` + DateRefUniqueCheck *time.Time `db:"date_ref_unique_check"` + DateDefConst *time.Time `db:"date_def_const"` + DateDefConstUniqueCheck *time.Time `db:"date_def_const_unique_check"` + DateDefFunc *time.Time `db:"date_def_func"` + DateDefFuncUniqueCheck *time.Time `db:"date_def_func_unique_check"` +} diff --git a/internal/integration_tests/mysql5/nulltypeprimitive/DateUniqueCheckPk.go b/internal/integration_tests/mysql5/nulltypeprimitive/DateUniqueCheckPk.go new file mode 100644 index 00000000..de81a9ee --- /dev/null +++ b/internal/integration_tests/mysql5/nulltypeprimitive/DateUniqueCheckPk.go @@ -0,0 +1,9 @@ +package dto + +import ( + "time" +) + +type DateUniqueCheckPk struct { + DateUniqueCheckPk time.Time `db:"date_unique_check_pk"` +} diff --git a/internal/integration_tests/mysql5/nulltypeprimitive/DateUniqueCheckPkRef.go b/internal/integration_tests/mysql5/nulltypeprimitive/DateUniqueCheckPkRef.go new file mode 100644 index 00000000..9c44f9cd --- /dev/null +++ b/internal/integration_tests/mysql5/nulltypeprimitive/DateUniqueCheckPkRef.go @@ -0,0 +1,9 @@ +package dto + +import ( + "time" +) + +type DateUniqueCheckPkRef struct { + DateUniqueCheckPkRef time.Time `db:"date_unique_check_pk_ref"` +} diff --git a/internal/integration_tests/mysql5/nulltypeprimitive/DateUniquePk.go b/internal/integration_tests/mysql5/nulltypeprimitive/DateUniquePk.go new file mode 100644 index 00000000..8a2081d9 --- /dev/null +++ b/internal/integration_tests/mysql5/nulltypeprimitive/DateUniquePk.go @@ -0,0 +1,9 @@ +package dto + +import ( + "time" +) + +type DateUniquePk struct { + DateUniquePk time.Time `db:"date_unique_pk"` +} diff --git a/internal/integration_tests/mysql5/nulltypeprimitive/DatetimeCheckPk.go b/internal/integration_tests/mysql5/nulltypeprimitive/DatetimeCheckPk.go new file mode 100644 index 00000000..94283788 --- /dev/null +++ b/internal/integration_tests/mysql5/nulltypeprimitive/DatetimeCheckPk.go @@ -0,0 +1,9 @@ +package dto + +import ( + "time" +) + +type DatetimeCheckPk struct { + DatetimeCheckPk time.Time `db:"datetime_check_pk"` +} diff --git a/internal/integration_tests/mysql5/nulltypeprimitive/DatetimeDefConstUniqueCheckPk.go b/internal/integration_tests/mysql5/nulltypeprimitive/DatetimeDefConstUniqueCheckPk.go new file mode 100644 index 00000000..42c954d1 --- /dev/null +++ b/internal/integration_tests/mysql5/nulltypeprimitive/DatetimeDefConstUniqueCheckPk.go @@ -0,0 +1,9 @@ +package dto + +import ( + "time" +) + +type DatetimeDefConstUniqueCheckPk struct { + DatetimeDefConstUniqueCheckPk time.Time `db:"datetime_def_const_unique_check_pk"` +} diff --git a/internal/integration_tests/mysql5/nulltypeprimitive/DatetimeDefConstUniqueCheckPkRef.go b/internal/integration_tests/mysql5/nulltypeprimitive/DatetimeDefConstUniqueCheckPkRef.go new file mode 100644 index 00000000..de2a504a --- /dev/null +++ b/internal/integration_tests/mysql5/nulltypeprimitive/DatetimeDefConstUniqueCheckPkRef.go @@ -0,0 +1,9 @@ +package dto + +import ( + "time" +) + +type DatetimeDefConstUniqueCheckPkRef struct { + DatetimeDefConstUniqueCheckPkRef time.Time `db:"datetime_def_const_unique_check_pk_ref"` +} diff --git a/internal/integration_tests/mysql5/nulltypeprimitive/DatetimeDefFuncUniqueCheckPk.go b/internal/integration_tests/mysql5/nulltypeprimitive/DatetimeDefFuncUniqueCheckPk.go new file mode 100644 index 00000000..bdb6ac27 --- /dev/null +++ b/internal/integration_tests/mysql5/nulltypeprimitive/DatetimeDefFuncUniqueCheckPk.go @@ -0,0 +1,9 @@ +package dto + +import ( + "time" +) + +type DatetimeDefFuncUniqueCheckPk struct { + DatetimeDefFuncUniqueCheckPk time.Time `db:"datetime_def_func_unique_check_pk"` +} diff --git a/internal/integration_tests/mysql5/nulltypeprimitive/DatetimeDefFuncUniqueCheckPkRef.go b/internal/integration_tests/mysql5/nulltypeprimitive/DatetimeDefFuncUniqueCheckPkRef.go new file mode 100644 index 00000000..5bc51f30 --- /dev/null +++ b/internal/integration_tests/mysql5/nulltypeprimitive/DatetimeDefFuncUniqueCheckPkRef.go @@ -0,0 +1,9 @@ +package dto + +import ( + "time" +) + +type DatetimeDefFuncUniqueCheckPkRef struct { + DatetimeDefFuncUniqueCheckPkRef time.Time `db:"datetime_def_func_unique_check_pk_ref"` +} diff --git a/internal/integration_tests/mysql5/nulltypeprimitive/DatetimeNnPk.go b/internal/integration_tests/mysql5/nulltypeprimitive/DatetimeNnPk.go new file mode 100644 index 00000000..30998f47 --- /dev/null +++ b/internal/integration_tests/mysql5/nulltypeprimitive/DatetimeNnPk.go @@ -0,0 +1,9 @@ +package dto + +import ( + "time" +) + +type DatetimeNnPk struct { + DatetimeNnPk time.Time `db:"datetime_nn_pk"` +} diff --git a/internal/integration_tests/mysql5/nulltypeprimitive/DatetimeNnUniqueCheckPk.go b/internal/integration_tests/mysql5/nulltypeprimitive/DatetimeNnUniqueCheckPk.go new file mode 100644 index 00000000..f6d77322 --- /dev/null +++ b/internal/integration_tests/mysql5/nulltypeprimitive/DatetimeNnUniqueCheckPk.go @@ -0,0 +1,9 @@ +package dto + +import ( + "time" +) + +type DatetimeNnUniqueCheckPk struct { + DatetimeNnUniqueCheckPk time.Time `db:"datetime_nn_unique_check_pk"` +} diff --git a/internal/integration_tests/mysql5/nulltypeprimitive/DatetimeNnUniqueCheckPkRef.go b/internal/integration_tests/mysql5/nulltypeprimitive/DatetimeNnUniqueCheckPkRef.go new file mode 100644 index 00000000..82611c60 --- /dev/null +++ b/internal/integration_tests/mysql5/nulltypeprimitive/DatetimeNnUniqueCheckPkRef.go @@ -0,0 +1,9 @@ +package dto + +import ( + "time" +) + +type DatetimeNnUniqueCheckPkRef struct { + DatetimeNnUniqueCheckPkRef time.Time `db:"datetime_nn_unique_check_pk_ref"` +} diff --git a/internal/integration_tests/mysql5/nulltypeprimitive/DatetimePk.go b/internal/integration_tests/mysql5/nulltypeprimitive/DatetimePk.go new file mode 100644 index 00000000..f514c724 --- /dev/null +++ b/internal/integration_tests/mysql5/nulltypeprimitive/DatetimePk.go @@ -0,0 +1,9 @@ +package dto + +import ( + "time" +) + +type DatetimePk struct { + DatetimePk time.Time `db:"datetime_pk"` +} diff --git a/internal/integration_tests/mysql5/nulltypeprimitive/DatetimePkDefConst.go b/internal/integration_tests/mysql5/nulltypeprimitive/DatetimePkDefConst.go new file mode 100644 index 00000000..3fc935f7 --- /dev/null +++ b/internal/integration_tests/mysql5/nulltypeprimitive/DatetimePkDefConst.go @@ -0,0 +1,9 @@ +package dto + +import ( + "time" +) + +type DatetimePkDefConst struct { + DatetimePkDefConst time.Time `db:"datetime_pk_def_const"` +} diff --git a/internal/integration_tests/mysql5/nulltypeprimitive/DatetimePkDefFunc.go b/internal/integration_tests/mysql5/nulltypeprimitive/DatetimePkDefFunc.go new file mode 100644 index 00000000..3562a7cd --- /dev/null +++ b/internal/integration_tests/mysql5/nulltypeprimitive/DatetimePkDefFunc.go @@ -0,0 +1,9 @@ +package dto + +import ( + "time" +) + +type DatetimePkDefFunc struct { + DatetimePkDefFunc time.Time `db:"datetime_pk_def_func"` +} diff --git a/internal/integration_tests/mysql5/nulltypeprimitive/DatetimePkRef.go b/internal/integration_tests/mysql5/nulltypeprimitive/DatetimePkRef.go new file mode 100644 index 00000000..a4e05075 --- /dev/null +++ b/internal/integration_tests/mysql5/nulltypeprimitive/DatetimePkRef.go @@ -0,0 +1,9 @@ +package dto + +import ( + "time" +) + +type DatetimePkRef struct { + DatetimePkRef time.Time `db:"datetime_pk_ref"` +} diff --git a/internal/integration_tests/mysql5/nulltypeprimitive/DatetimeRef.go b/internal/integration_tests/mysql5/nulltypeprimitive/DatetimeRef.go new file mode 100644 index 00000000..17728daf --- /dev/null +++ b/internal/integration_tests/mysql5/nulltypeprimitive/DatetimeRef.go @@ -0,0 +1,9 @@ +package dto + +import ( + "time" +) + +type DatetimeRef struct { + DatetimeRef *time.Time `db:"datetime_ref"` +} diff --git a/internal/integration_tests/mysql5/nulltypeprimitive/DatetimeTable.go b/internal/integration_tests/mysql5/nulltypeprimitive/DatetimeTable.go new file mode 100644 index 00000000..456224b5 --- /dev/null +++ b/internal/integration_tests/mysql5/nulltypeprimitive/DatetimeTable.go @@ -0,0 +1,31 @@ +package dto + +import ( + "time" +) + +type DatetimeTable struct { + Datetime *time.Time `db:"datetime"` + DatetimeNn time.Time `db:"datetime_nn"` + DatetimeNnUnique time.Time `db:"datetime_nn_unique"` + DatetimeNnCheck time.Time `db:"datetime_nn_check"` + DatetimeNnRef time.Time `db:"datetime_nn_ref"` + DatetimeNnDefConst time.Time `db:"datetime_nn_def_const"` + DatetimeNnDefFunc time.Time `db:"datetime_nn_def_func"` + DatetimeNnUniqueCheck time.Time `db:"datetime_nn_unique_check"` + DatetimeUnique *time.Time `db:"datetime_unique"` + DatetimeUniqueCheck *time.Time `db:"datetime_unique_check"` + DatetimeUniqueRef *time.Time `db:"datetime_unique_ref"` + DatetimeUniqueDefConst *time.Time `db:"datetime_unique_def_const"` + DatetimeUniqueDefFunc *time.Time `db:"datetime_unique_def_func"` + DatetimeCheck *time.Time `db:"datetime_check"` + DatetimeCheckRef *time.Time `db:"datetime_check_ref"` + DatetimeCheckDefConst *time.Time `db:"datetime_check_def_const"` + DatetimeCheckDefFunc *time.Time `db:"datetime_check_def_func"` + DatetimeRef *time.Time `db:"datetime_ref"` + DatetimeRefUniqueCheck *time.Time `db:"datetime_ref_unique_check"` + DatetimeDefConst *time.Time `db:"datetime_def_const"` + DatetimeDefConstUniqueCheck *time.Time `db:"datetime_def_const_unique_check"` + DatetimeDefFunc *time.Time `db:"datetime_def_func"` + DatetimeDefFuncUniqueCheck *time.Time `db:"datetime_def_func_unique_check"` +} diff --git a/internal/integration_tests/mysql5/nulltypeprimitive/DatetimeUniqueCheckPk.go b/internal/integration_tests/mysql5/nulltypeprimitive/DatetimeUniqueCheckPk.go new file mode 100644 index 00000000..f5afbf89 --- /dev/null +++ b/internal/integration_tests/mysql5/nulltypeprimitive/DatetimeUniqueCheckPk.go @@ -0,0 +1,9 @@ +package dto + +import ( + "time" +) + +type DatetimeUniqueCheckPk struct { + DatetimeUniqueCheckPk time.Time `db:"datetime_unique_check_pk"` +} diff --git a/internal/integration_tests/mysql5/nulltypeprimitive/DatetimeUniqueCheckPkRef.go b/internal/integration_tests/mysql5/nulltypeprimitive/DatetimeUniqueCheckPkRef.go new file mode 100644 index 00000000..5b9834ba --- /dev/null +++ b/internal/integration_tests/mysql5/nulltypeprimitive/DatetimeUniqueCheckPkRef.go @@ -0,0 +1,9 @@ +package dto + +import ( + "time" +) + +type DatetimeUniqueCheckPkRef struct { + DatetimeUniqueCheckPkRef time.Time `db:"datetime_unique_check_pk_ref"` +} diff --git a/internal/integration_tests/mysql5/nulltypeprimitive/DatetimeUniquePk.go b/internal/integration_tests/mysql5/nulltypeprimitive/DatetimeUniquePk.go new file mode 100644 index 00000000..efd8e62c --- /dev/null +++ b/internal/integration_tests/mysql5/nulltypeprimitive/DatetimeUniquePk.go @@ -0,0 +1,9 @@ +package dto + +import ( + "time" +) + +type DatetimeUniquePk struct { + DatetimeUniquePk time.Time `db:"datetime_unique_pk"` +} diff --git a/internal/integration_tests/mysql5/nulltypeprimitive/DecimalCheckPk.go b/internal/integration_tests/mysql5/nulltypeprimitive/DecimalCheckPk.go new file mode 100644 index 00000000..e51ea81a --- /dev/null +++ b/internal/integration_tests/mysql5/nulltypeprimitive/DecimalCheckPk.go @@ -0,0 +1,5 @@ +package dto + +type DecimalCheckPk struct { + DecimalCheckPk float64 `db:"decimal_check_pk"` +} diff --git a/internal/integration_tests/mysql5/nulltypeprimitive/DecimalDefConstUniqueCheckPk.go b/internal/integration_tests/mysql5/nulltypeprimitive/DecimalDefConstUniqueCheckPk.go new file mode 100644 index 00000000..725b1900 --- /dev/null +++ b/internal/integration_tests/mysql5/nulltypeprimitive/DecimalDefConstUniqueCheckPk.go @@ -0,0 +1,5 @@ +package dto + +type DecimalDefConstUniqueCheckPk struct { + DecimalDefConstUniqueCheckPk float64 `db:"decimal_def_const_unique_check_pk"` +} diff --git a/internal/integration_tests/mysql5/nulltypeprimitive/DecimalDefConstUniqueCheckPkRef.go b/internal/integration_tests/mysql5/nulltypeprimitive/DecimalDefConstUniqueCheckPkRef.go new file mode 100644 index 00000000..47a13f96 --- /dev/null +++ b/internal/integration_tests/mysql5/nulltypeprimitive/DecimalDefConstUniqueCheckPkRef.go @@ -0,0 +1,5 @@ +package dto + +type DecimalDefConstUniqueCheckPkRef struct { + DecimalDefConstUniqueCheckPkRef float64 `db:"decimal_def_const_unique_check_pk_ref"` +} diff --git a/internal/integration_tests/mysql5/nulltypeprimitive/DecimalDefFuncUniqueCheckPk.go b/internal/integration_tests/mysql5/nulltypeprimitive/DecimalDefFuncUniqueCheckPk.go new file mode 100644 index 00000000..689faf76 --- /dev/null +++ b/internal/integration_tests/mysql5/nulltypeprimitive/DecimalDefFuncUniqueCheckPk.go @@ -0,0 +1,5 @@ +package dto + +type DecimalDefFuncUniqueCheckPk struct { + DecimalDefFuncUniqueCheckPk float64 `db:"decimal_def_func_unique_check_pk"` +} diff --git a/internal/integration_tests/mysql5/nulltypeprimitive/DecimalDefFuncUniqueCheckPkRef.go b/internal/integration_tests/mysql5/nulltypeprimitive/DecimalDefFuncUniqueCheckPkRef.go new file mode 100644 index 00000000..212509c5 --- /dev/null +++ b/internal/integration_tests/mysql5/nulltypeprimitive/DecimalDefFuncUniqueCheckPkRef.go @@ -0,0 +1,5 @@ +package dto + +type DecimalDefFuncUniqueCheckPkRef struct { + DecimalDefFuncUniqueCheckPkRef float64 `db:"decimal_def_func_unique_check_pk_ref"` +} diff --git a/internal/integration_tests/mysql5/nulltypeprimitive/DecimalNnPk.go b/internal/integration_tests/mysql5/nulltypeprimitive/DecimalNnPk.go new file mode 100644 index 00000000..cd8f4912 --- /dev/null +++ b/internal/integration_tests/mysql5/nulltypeprimitive/DecimalNnPk.go @@ -0,0 +1,5 @@ +package dto + +type DecimalNnPk struct { + DecimalNnPk float64 `db:"decimal_nn_pk"` +} diff --git a/internal/integration_tests/mysql5/nulltypeprimitive/DecimalNnUniqueCheckPk.go b/internal/integration_tests/mysql5/nulltypeprimitive/DecimalNnUniqueCheckPk.go new file mode 100644 index 00000000..fa82e68b --- /dev/null +++ b/internal/integration_tests/mysql5/nulltypeprimitive/DecimalNnUniqueCheckPk.go @@ -0,0 +1,5 @@ +package dto + +type DecimalNnUniqueCheckPk struct { + DecimalNnUniqueCheckPk float64 `db:"decimal_nn_unique_check_pk"` +} diff --git a/internal/integration_tests/mysql5/nulltypeprimitive/DecimalNnUniqueCheckPkRef.go b/internal/integration_tests/mysql5/nulltypeprimitive/DecimalNnUniqueCheckPkRef.go new file mode 100644 index 00000000..f9003bf2 --- /dev/null +++ b/internal/integration_tests/mysql5/nulltypeprimitive/DecimalNnUniqueCheckPkRef.go @@ -0,0 +1,5 @@ +package dto + +type DecimalNnUniqueCheckPkRef struct { + DecimalNnUniqueCheckPkRef float64 `db:"decimal_nn_unique_check_pk_ref"` +} diff --git a/internal/integration_tests/mysql5/nulltypeprimitive/DecimalPk.go b/internal/integration_tests/mysql5/nulltypeprimitive/DecimalPk.go new file mode 100644 index 00000000..42a811a1 --- /dev/null +++ b/internal/integration_tests/mysql5/nulltypeprimitive/DecimalPk.go @@ -0,0 +1,5 @@ +package dto + +type DecimalPk struct { + DecimalPk float64 `db:"decimal_pk"` +} diff --git a/internal/integration_tests/mysql5/nulltypeprimitive/DecimalPkDefConst.go b/internal/integration_tests/mysql5/nulltypeprimitive/DecimalPkDefConst.go new file mode 100644 index 00000000..844cf9d1 --- /dev/null +++ b/internal/integration_tests/mysql5/nulltypeprimitive/DecimalPkDefConst.go @@ -0,0 +1,5 @@ +package dto + +type DecimalPkDefConst struct { + DecimalPkDefConst float64 `db:"decimal_pk_def_const"` +} diff --git a/internal/integration_tests/mysql5/nulltypeprimitive/DecimalPkDefFunc.go b/internal/integration_tests/mysql5/nulltypeprimitive/DecimalPkDefFunc.go new file mode 100644 index 00000000..82ec62c8 --- /dev/null +++ b/internal/integration_tests/mysql5/nulltypeprimitive/DecimalPkDefFunc.go @@ -0,0 +1,5 @@ +package dto + +type DecimalPkDefFunc struct { + DecimalPkDefFunc float64 `db:"decimal_pk_def_func"` +} diff --git a/internal/integration_tests/mysql5/nulltypeprimitive/DecimalPkRef.go b/internal/integration_tests/mysql5/nulltypeprimitive/DecimalPkRef.go new file mode 100644 index 00000000..bd5ef076 --- /dev/null +++ b/internal/integration_tests/mysql5/nulltypeprimitive/DecimalPkRef.go @@ -0,0 +1,5 @@ +package dto + +type DecimalPkRef struct { + DecimalPkRef float64 `db:"decimal_pk_ref"` +} diff --git a/internal/integration_tests/mysql5/nulltypeprimitive/DecimalRef.go b/internal/integration_tests/mysql5/nulltypeprimitive/DecimalRef.go new file mode 100644 index 00000000..46576647 --- /dev/null +++ b/internal/integration_tests/mysql5/nulltypeprimitive/DecimalRef.go @@ -0,0 +1,5 @@ +package dto + +type DecimalRef struct { + DecimalRef *float64 `db:"decimal_ref"` +} diff --git a/internal/integration_tests/mysql5/nulltypeprimitive/DecimalTable.go b/internal/integration_tests/mysql5/nulltypeprimitive/DecimalTable.go new file mode 100644 index 00000000..b2026ee6 --- /dev/null +++ b/internal/integration_tests/mysql5/nulltypeprimitive/DecimalTable.go @@ -0,0 +1,27 @@ +package dto + +type DecimalTable struct { + Col *float64 `db:"col"` + DecimalNn float64 `db:"decimal_nn"` + DecimalNnUnique float64 `db:"decimal_nn_unique"` + DecimalNnCheck float64 `db:"decimal_nn_check"` + DecimalNnRef float64 `db:"decimal_nn_ref"` + DecimalNnDefConst float64 `db:"decimal_nn_def_const"` + DecimalNnDefFunc float64 `db:"decimal_nn_def_func"` + DecimalNnUniqueCheck float64 `db:"decimal_nn_unique_check"` + DecimalUnique *float64 `db:"decimal_unique"` + DecimalUniqueCheck *float64 `db:"decimal_unique_check"` + DecimalUniqueRef *float64 `db:"decimal_unique_ref"` + DecimalUniqueDefConst *float64 `db:"decimal_unique_def_const"` + DecimalUniqueDefFunc *float64 `db:"decimal_unique_def_func"` + DecimalCheck *float64 `db:"decimal_check"` + DecimalCheckRef *float64 `db:"decimal_check_ref"` + DecimalCheckDefConst *float64 `db:"decimal_check_def_const"` + DecimalCheckDefFunc *float64 `db:"decimal_check_def_func"` + DecimalRef *float64 `db:"decimal_ref"` + DecimalRefUniqueCheck *float64 `db:"decimal_ref_unique_check"` + DecimalDefConst *float64 `db:"decimal_def_const"` + DecimalDefConstUniqueCheck *float64 `db:"decimal_def_const_unique_check"` + DecimalDefFunc *float64 `db:"decimal_def_func"` + DecimalDefFuncUniqueCheck *float64 `db:"decimal_def_func_unique_check"` +} diff --git a/internal/integration_tests/mysql5/nulltypeprimitive/DecimalUniqueCheckPk.go b/internal/integration_tests/mysql5/nulltypeprimitive/DecimalUniqueCheckPk.go new file mode 100644 index 00000000..f6df5c3e --- /dev/null +++ b/internal/integration_tests/mysql5/nulltypeprimitive/DecimalUniqueCheckPk.go @@ -0,0 +1,5 @@ +package dto + +type DecimalUniqueCheckPk struct { + DecimalUniqueCheckPk float64 `db:"decimal_unique_check_pk"` +} diff --git a/internal/integration_tests/mysql5/nulltypeprimitive/DecimalUniqueCheckPkRef.go b/internal/integration_tests/mysql5/nulltypeprimitive/DecimalUniqueCheckPkRef.go new file mode 100644 index 00000000..c94f982e --- /dev/null +++ b/internal/integration_tests/mysql5/nulltypeprimitive/DecimalUniqueCheckPkRef.go @@ -0,0 +1,5 @@ +package dto + +type DecimalUniqueCheckPkRef struct { + DecimalUniqueCheckPkRef float64 `db:"decimal_unique_check_pk_ref"` +} diff --git a/internal/integration_tests/mysql5/nulltypeprimitive/DecimalUniquePk.go b/internal/integration_tests/mysql5/nulltypeprimitive/DecimalUniquePk.go new file mode 100644 index 00000000..ca299e19 --- /dev/null +++ b/internal/integration_tests/mysql5/nulltypeprimitive/DecimalUniquePk.go @@ -0,0 +1,5 @@ +package dto + +type DecimalUniquePk struct { + DecimalUniquePk float64 `db:"decimal_unique_pk"` +} diff --git a/internal/integration_tests/mysql5/nulltypeprimitive/DoublePrecisionCheckPk.go b/internal/integration_tests/mysql5/nulltypeprimitive/DoublePrecisionCheckPk.go new file mode 100644 index 00000000..b371f477 --- /dev/null +++ b/internal/integration_tests/mysql5/nulltypeprimitive/DoublePrecisionCheckPk.go @@ -0,0 +1,5 @@ +package dto + +type DoublePrecisionCheckPk struct { + DoublePrecisionCheckPk float64 `db:"double_precision_check_pk"` +} diff --git a/internal/integration_tests/mysql5/nulltypeprimitive/DoublePrecisionDefConstUniqueCheckPk.go b/internal/integration_tests/mysql5/nulltypeprimitive/DoublePrecisionDefConstUniqueCheckPk.go new file mode 100644 index 00000000..aed14fe8 --- /dev/null +++ b/internal/integration_tests/mysql5/nulltypeprimitive/DoublePrecisionDefConstUniqueCheckPk.go @@ -0,0 +1,5 @@ +package dto + +type DoublePrecisionDefConstUniqueCheckPk struct { + DoublePrecisionDefConstUniqueCheckPk float64 `db:"double_precision_def_const_unique_check_pk"` +} diff --git a/internal/integration_tests/mysql5/nulltypeprimitive/DoublePrecisionDefConstUniqueCheckPkRef.go b/internal/integration_tests/mysql5/nulltypeprimitive/DoublePrecisionDefConstUniqueCheckPkRef.go new file mode 100644 index 00000000..f3fd6f6f --- /dev/null +++ b/internal/integration_tests/mysql5/nulltypeprimitive/DoublePrecisionDefConstUniqueCheckPkRef.go @@ -0,0 +1,5 @@ +package dto + +type DoublePrecisionDefConstUniqueCheckPkRef struct { + DoublePrecisionDefConstUniqueCheckPkRef float64 `db:"double_precision_def_const_unique_check_pk_ref"` +} diff --git a/internal/integration_tests/mysql5/nulltypeprimitive/DoublePrecisionDefFuncUniqueCheckPk.go b/internal/integration_tests/mysql5/nulltypeprimitive/DoublePrecisionDefFuncUniqueCheckPk.go new file mode 100644 index 00000000..d868ad99 --- /dev/null +++ b/internal/integration_tests/mysql5/nulltypeprimitive/DoublePrecisionDefFuncUniqueCheckPk.go @@ -0,0 +1,5 @@ +package dto + +type DoublePrecisionDefFuncUniqueCheckPk struct { + DoublePrecisionDefFuncUniqueCheckPk float64 `db:"double_precision_def_func_unique_check_pk"` +} diff --git a/internal/integration_tests/mysql5/nulltypeprimitive/DoublePrecisionDefFuncUniqueCheckPkRef.go b/internal/integration_tests/mysql5/nulltypeprimitive/DoublePrecisionDefFuncUniqueCheckPkRef.go new file mode 100644 index 00000000..cfc1fd16 --- /dev/null +++ b/internal/integration_tests/mysql5/nulltypeprimitive/DoublePrecisionDefFuncUniqueCheckPkRef.go @@ -0,0 +1,5 @@ +package dto + +type DoublePrecisionDefFuncUniqueCheckPkRef struct { + DoublePrecisionDefFuncUniqueCheckPkRef float64 `db:"double_precision_def_func_unique_check_pk_ref"` +} diff --git a/internal/integration_tests/mysql5/nulltypeprimitive/DoublePrecisionNnPk.go b/internal/integration_tests/mysql5/nulltypeprimitive/DoublePrecisionNnPk.go new file mode 100644 index 00000000..cdd85c7c --- /dev/null +++ b/internal/integration_tests/mysql5/nulltypeprimitive/DoublePrecisionNnPk.go @@ -0,0 +1,5 @@ +package dto + +type DoublePrecisionNnPk struct { + DoublePrecisionNnPk float64 `db:"double_precision_nn_pk"` +} diff --git a/internal/integration_tests/mysql5/nulltypeprimitive/DoublePrecisionNnUniqueCheckPk.go b/internal/integration_tests/mysql5/nulltypeprimitive/DoublePrecisionNnUniqueCheckPk.go new file mode 100644 index 00000000..4c6f76fd --- /dev/null +++ b/internal/integration_tests/mysql5/nulltypeprimitive/DoublePrecisionNnUniqueCheckPk.go @@ -0,0 +1,5 @@ +package dto + +type DoublePrecisionNnUniqueCheckPk struct { + DoublePrecisionNnUniqueCheckPk float64 `db:"double_precision_nn_unique_check_pk"` +} diff --git a/internal/integration_tests/mysql5/nulltypeprimitive/DoublePrecisionNnUniqueCheckPkRef.go b/internal/integration_tests/mysql5/nulltypeprimitive/DoublePrecisionNnUniqueCheckPkRef.go new file mode 100644 index 00000000..46f9308c --- /dev/null +++ b/internal/integration_tests/mysql5/nulltypeprimitive/DoublePrecisionNnUniqueCheckPkRef.go @@ -0,0 +1,5 @@ +package dto + +type DoublePrecisionNnUniqueCheckPkRef struct { + DoublePrecisionNnUniqueCheckPkRef float64 `db:"double_precision_nn_unique_check_pk_ref"` +} diff --git a/internal/integration_tests/mysql5/nulltypeprimitive/DoublePrecisionPk.go b/internal/integration_tests/mysql5/nulltypeprimitive/DoublePrecisionPk.go new file mode 100644 index 00000000..dd4230cd --- /dev/null +++ b/internal/integration_tests/mysql5/nulltypeprimitive/DoublePrecisionPk.go @@ -0,0 +1,5 @@ +package dto + +type DoublePrecisionPk struct { + DoublePrecisionPk float64 `db:"double_precision_pk"` +} diff --git a/internal/integration_tests/mysql5/nulltypeprimitive/DoublePrecisionPkDefConst.go b/internal/integration_tests/mysql5/nulltypeprimitive/DoublePrecisionPkDefConst.go new file mode 100644 index 00000000..88e67c92 --- /dev/null +++ b/internal/integration_tests/mysql5/nulltypeprimitive/DoublePrecisionPkDefConst.go @@ -0,0 +1,5 @@ +package dto + +type DoublePrecisionPkDefConst struct { + DoublePrecisionPkDefConst float64 `db:"double_precision_pk_def_const"` +} diff --git a/internal/integration_tests/mysql5/nulltypeprimitive/DoublePrecisionPkDefFunc.go b/internal/integration_tests/mysql5/nulltypeprimitive/DoublePrecisionPkDefFunc.go new file mode 100644 index 00000000..a61e3112 --- /dev/null +++ b/internal/integration_tests/mysql5/nulltypeprimitive/DoublePrecisionPkDefFunc.go @@ -0,0 +1,5 @@ +package dto + +type DoublePrecisionPkDefFunc struct { + DoublePrecisionPkDefFunc float64 `db:"double_precision_pk_def_func"` +} diff --git a/internal/integration_tests/mysql5/nulltypeprimitive/DoublePrecisionPkRef.go b/internal/integration_tests/mysql5/nulltypeprimitive/DoublePrecisionPkRef.go new file mode 100644 index 00000000..0ef20e93 --- /dev/null +++ b/internal/integration_tests/mysql5/nulltypeprimitive/DoublePrecisionPkRef.go @@ -0,0 +1,5 @@ +package dto + +type DoublePrecisionPkRef struct { + DoublePrecisionPkRef float64 `db:"double_precision_pk_ref"` +} diff --git a/internal/integration_tests/mysql5/nulltypeprimitive/DoublePrecisionRef.go b/internal/integration_tests/mysql5/nulltypeprimitive/DoublePrecisionRef.go new file mode 100644 index 00000000..7b7ec34e --- /dev/null +++ b/internal/integration_tests/mysql5/nulltypeprimitive/DoublePrecisionRef.go @@ -0,0 +1,5 @@ +package dto + +type DoublePrecisionRef struct { + DoublePrecisionRef *float64 `db:"double_precision_ref"` +} diff --git a/internal/integration_tests/mysql5/nulltypeprimitive/DoublePrecisionTable.go b/internal/integration_tests/mysql5/nulltypeprimitive/DoublePrecisionTable.go new file mode 100644 index 00000000..09c6f80d --- /dev/null +++ b/internal/integration_tests/mysql5/nulltypeprimitive/DoublePrecisionTable.go @@ -0,0 +1,27 @@ +package dto + +type DoublePrecisionTable struct { + Col *float64 `db:"col"` + DoublePrecisionNn float64 `db:"double_precision_nn"` + DoublePrecisionNnUnique float64 `db:"double_precision_nn_unique"` + DoublePrecisionNnCheck float64 `db:"double_precision_nn_check"` + DoublePrecisionNnRef float64 `db:"double_precision_nn_ref"` + DoublePrecisionNnDefConst float64 `db:"double_precision_nn_def_const"` + DoublePrecisionNnDefFunc float64 `db:"double_precision_nn_def_func"` + DoublePrecisionNnUniqueCheck float64 `db:"double_precision_nn_unique_check"` + DoublePrecisionUnique *float64 `db:"double_precision_unique"` + DoublePrecisionUniqueCheck *float64 `db:"double_precision_unique_check"` + DoublePrecisionUniqueRef *float64 `db:"double_precision_unique_ref"` + DoublePrecisionUniqueDefConst *float64 `db:"double_precision_unique_def_const"` + DoublePrecisionUniqueDefFunc *float64 `db:"double_precision_unique_def_func"` + DoublePrecisionCheck *float64 `db:"double_precision_check"` + DoublePrecisionCheckRef *float64 `db:"double_precision_check_ref"` + DoublePrecisionCheckDefConst *float64 `db:"double_precision_check_def_const"` + DoublePrecisionCheckDefFunc *float64 `db:"double_precision_check_def_func"` + DoublePrecisionRef *float64 `db:"double_precision_ref"` + DoublePrecisionRefUniqueCheck *float64 `db:"double_precision_ref_unique_check"` + DoublePrecisionDefConst *float64 `db:"double_precision_def_const"` + DoublePrecisionDefConstUniqueCheck *float64 `db:"double_precision_def_const_unique_check"` + DoublePrecisionDefFunc *float64 `db:"double_precision_def_func"` + DoublePrecisionDefFuncUniqueCheck *float64 `db:"double_precision_def_func_unique_check"` +} diff --git a/internal/integration_tests/mysql5/nulltypeprimitive/DoublePrecisionUniqueCheckPk.go b/internal/integration_tests/mysql5/nulltypeprimitive/DoublePrecisionUniqueCheckPk.go new file mode 100644 index 00000000..3e3cf20b --- /dev/null +++ b/internal/integration_tests/mysql5/nulltypeprimitive/DoublePrecisionUniqueCheckPk.go @@ -0,0 +1,5 @@ +package dto + +type DoublePrecisionUniqueCheckPk struct { + DoublePrecisionUniqueCheckPk float64 `db:"double_precision_unique_check_pk"` +} diff --git a/internal/integration_tests/mysql5/nulltypeprimitive/DoublePrecisionUniqueCheckPkRef.go b/internal/integration_tests/mysql5/nulltypeprimitive/DoublePrecisionUniqueCheckPkRef.go new file mode 100644 index 00000000..3655f585 --- /dev/null +++ b/internal/integration_tests/mysql5/nulltypeprimitive/DoublePrecisionUniqueCheckPkRef.go @@ -0,0 +1,5 @@ +package dto + +type DoublePrecisionUniqueCheckPkRef struct { + DoublePrecisionUniqueCheckPkRef float64 `db:"double_precision_unique_check_pk_ref"` +} diff --git a/internal/integration_tests/mysql5/nulltypeprimitive/DoublePrecisionUniquePk.go b/internal/integration_tests/mysql5/nulltypeprimitive/DoublePrecisionUniquePk.go new file mode 100644 index 00000000..df2b18cc --- /dev/null +++ b/internal/integration_tests/mysql5/nulltypeprimitive/DoublePrecisionUniquePk.go @@ -0,0 +1,5 @@ +package dto + +type DoublePrecisionUniquePk struct { + DoublePrecisionUniquePk float64 `db:"double_precision_unique_pk"` +} diff --git a/internal/integration_tests/mysql5/nulltypeprimitive/FloatCheckPk.go b/internal/integration_tests/mysql5/nulltypeprimitive/FloatCheckPk.go new file mode 100644 index 00000000..e40adfb8 --- /dev/null +++ b/internal/integration_tests/mysql5/nulltypeprimitive/FloatCheckPk.go @@ -0,0 +1,5 @@ +package dto + +type FloatCheckPk struct { + FloatCheckPk float64 `db:"float_check_pk"` +} diff --git a/internal/integration_tests/mysql5/nulltypeprimitive/FloatDefConstUniqueCheckPk.go b/internal/integration_tests/mysql5/nulltypeprimitive/FloatDefConstUniqueCheckPk.go new file mode 100644 index 00000000..57baef77 --- /dev/null +++ b/internal/integration_tests/mysql5/nulltypeprimitive/FloatDefConstUniqueCheckPk.go @@ -0,0 +1,5 @@ +package dto + +type FloatDefConstUniqueCheckPk struct { + FloatDefConstUniqueCheckPk float64 `db:"float_def_const_unique_check_pk"` +} diff --git a/internal/integration_tests/mysql5/nulltypeprimitive/FloatDefConstUniqueCheckPkRef.go b/internal/integration_tests/mysql5/nulltypeprimitive/FloatDefConstUniqueCheckPkRef.go new file mode 100644 index 00000000..6125761b --- /dev/null +++ b/internal/integration_tests/mysql5/nulltypeprimitive/FloatDefConstUniqueCheckPkRef.go @@ -0,0 +1,5 @@ +package dto + +type FloatDefConstUniqueCheckPkRef struct { + FloatDefConstUniqueCheckPkRef float64 `db:"float_def_const_unique_check_pk_ref"` +} diff --git a/internal/integration_tests/mysql5/nulltypeprimitive/FloatDefFuncUniqueCheckPk.go b/internal/integration_tests/mysql5/nulltypeprimitive/FloatDefFuncUniqueCheckPk.go new file mode 100644 index 00000000..00622747 --- /dev/null +++ b/internal/integration_tests/mysql5/nulltypeprimitive/FloatDefFuncUniqueCheckPk.go @@ -0,0 +1,5 @@ +package dto + +type FloatDefFuncUniqueCheckPk struct { + FloatDefFuncUniqueCheckPk float64 `db:"float_def_func_unique_check_pk"` +} diff --git a/internal/integration_tests/mysql5/nulltypeprimitive/FloatDefFuncUniqueCheckPkRef.go b/internal/integration_tests/mysql5/nulltypeprimitive/FloatDefFuncUniqueCheckPkRef.go new file mode 100644 index 00000000..8d025ad4 --- /dev/null +++ b/internal/integration_tests/mysql5/nulltypeprimitive/FloatDefFuncUniqueCheckPkRef.go @@ -0,0 +1,5 @@ +package dto + +type FloatDefFuncUniqueCheckPkRef struct { + FloatDefFuncUniqueCheckPkRef float64 `db:"float_def_func_unique_check_pk_ref"` +} diff --git a/internal/integration_tests/mysql5/nulltypeprimitive/FloatNnPk.go b/internal/integration_tests/mysql5/nulltypeprimitive/FloatNnPk.go new file mode 100644 index 00000000..aa175645 --- /dev/null +++ b/internal/integration_tests/mysql5/nulltypeprimitive/FloatNnPk.go @@ -0,0 +1,5 @@ +package dto + +type FloatNnPk struct { + FloatNnPk float64 `db:"float_nn_pk"` +} diff --git a/internal/integration_tests/mysql5/nulltypeprimitive/FloatNnUniqueCheckPk.go b/internal/integration_tests/mysql5/nulltypeprimitive/FloatNnUniqueCheckPk.go new file mode 100644 index 00000000..a65f5786 --- /dev/null +++ b/internal/integration_tests/mysql5/nulltypeprimitive/FloatNnUniqueCheckPk.go @@ -0,0 +1,5 @@ +package dto + +type FloatNnUniqueCheckPk struct { + FloatNnUniqueCheckPk float64 `db:"float_nn_unique_check_pk"` +} diff --git a/internal/integration_tests/mysql5/nulltypeprimitive/FloatNnUniqueCheckPkRef.go b/internal/integration_tests/mysql5/nulltypeprimitive/FloatNnUniqueCheckPkRef.go new file mode 100644 index 00000000..a3253c3f --- /dev/null +++ b/internal/integration_tests/mysql5/nulltypeprimitive/FloatNnUniqueCheckPkRef.go @@ -0,0 +1,5 @@ +package dto + +type FloatNnUniqueCheckPkRef struct { + FloatNnUniqueCheckPkRef float64 `db:"float_nn_unique_check_pk_ref"` +} diff --git a/internal/integration_tests/mysql5/nulltypeprimitive/FloatPk.go b/internal/integration_tests/mysql5/nulltypeprimitive/FloatPk.go new file mode 100644 index 00000000..60ca0fcb --- /dev/null +++ b/internal/integration_tests/mysql5/nulltypeprimitive/FloatPk.go @@ -0,0 +1,5 @@ +package dto + +type FloatPk struct { + FloatPk float64 `db:"float_pk"` +} diff --git a/internal/integration_tests/mysql5/nulltypeprimitive/FloatPkDefConst.go b/internal/integration_tests/mysql5/nulltypeprimitive/FloatPkDefConst.go new file mode 100644 index 00000000..1660a67a --- /dev/null +++ b/internal/integration_tests/mysql5/nulltypeprimitive/FloatPkDefConst.go @@ -0,0 +1,5 @@ +package dto + +type FloatPkDefConst struct { + FloatPkDefConst float64 `db:"float_pk_def_const"` +} diff --git a/internal/integration_tests/mysql5/nulltypeprimitive/FloatPkDefFunc.go b/internal/integration_tests/mysql5/nulltypeprimitive/FloatPkDefFunc.go new file mode 100644 index 00000000..e2de6364 --- /dev/null +++ b/internal/integration_tests/mysql5/nulltypeprimitive/FloatPkDefFunc.go @@ -0,0 +1,5 @@ +package dto + +type FloatPkDefFunc struct { + FloatPkDefFunc float64 `db:"float_pk_def_func"` +} diff --git a/internal/integration_tests/mysql5/nulltypeprimitive/FloatPkRef.go b/internal/integration_tests/mysql5/nulltypeprimitive/FloatPkRef.go new file mode 100644 index 00000000..476d656e --- /dev/null +++ b/internal/integration_tests/mysql5/nulltypeprimitive/FloatPkRef.go @@ -0,0 +1,5 @@ +package dto + +type FloatPkRef struct { + FloatPkRef float64 `db:"float_pk_ref"` +} diff --git a/internal/integration_tests/mysql5/nulltypeprimitive/FloatRef.go b/internal/integration_tests/mysql5/nulltypeprimitive/FloatRef.go new file mode 100644 index 00000000..43b5c303 --- /dev/null +++ b/internal/integration_tests/mysql5/nulltypeprimitive/FloatRef.go @@ -0,0 +1,5 @@ +package dto + +type FloatRef struct { + FloatRef *float64 `db:"float_ref"` +} diff --git a/internal/integration_tests/mysql5/nulltypeprimitive/FloatTable.go b/internal/integration_tests/mysql5/nulltypeprimitive/FloatTable.go new file mode 100644 index 00000000..23acdc06 --- /dev/null +++ b/internal/integration_tests/mysql5/nulltypeprimitive/FloatTable.go @@ -0,0 +1,27 @@ +package dto + +type FloatTable struct { + Col *float64 `db:"col"` + FloatNn float64 `db:"float_nn"` + FloatNnUnique float64 `db:"float_nn_unique"` + FloatNnCheck float64 `db:"float_nn_check"` + FloatNnRef float64 `db:"float_nn_ref"` + FloatNnDefConst float64 `db:"float_nn_def_const"` + FloatNnDefFunc float64 `db:"float_nn_def_func"` + FloatNnUniqueCheck float64 `db:"float_nn_unique_check"` + FloatUnique *float64 `db:"float_unique"` + FloatUniqueCheck *float64 `db:"float_unique_check"` + FloatUniqueRef *float64 `db:"float_unique_ref"` + FloatUniqueDefConst *float64 `db:"float_unique_def_const"` + FloatUniqueDefFunc *float64 `db:"float_unique_def_func"` + FloatCheck *float64 `db:"float_check"` + FloatCheckRef *float64 `db:"float_check_ref"` + FloatCheckDefConst *float64 `db:"float_check_def_const"` + FloatCheckDefFunc *float64 `db:"float_check_def_func"` + FloatRef *float64 `db:"float_ref"` + FloatRefUniqueCheck *float64 `db:"float_ref_unique_check"` + FloatDefConst *float64 `db:"float_def_const"` + FloatDefConstUniqueCheck *float64 `db:"float_def_const_unique_check"` + FloatDefFunc *float64 `db:"float_def_func"` + FloatDefFuncUniqueCheck *float64 `db:"float_def_func_unique_check"` +} diff --git a/internal/integration_tests/mysql5/nulltypeprimitive/FloatUniqueCheckPk.go b/internal/integration_tests/mysql5/nulltypeprimitive/FloatUniqueCheckPk.go new file mode 100644 index 00000000..81ddc37f --- /dev/null +++ b/internal/integration_tests/mysql5/nulltypeprimitive/FloatUniqueCheckPk.go @@ -0,0 +1,5 @@ +package dto + +type FloatUniqueCheckPk struct { + FloatUniqueCheckPk float64 `db:"float_unique_check_pk"` +} diff --git a/internal/integration_tests/mysql5/nulltypeprimitive/FloatUniqueCheckPkRef.go b/internal/integration_tests/mysql5/nulltypeprimitive/FloatUniqueCheckPkRef.go new file mode 100644 index 00000000..530d26cc --- /dev/null +++ b/internal/integration_tests/mysql5/nulltypeprimitive/FloatUniqueCheckPkRef.go @@ -0,0 +1,5 @@ +package dto + +type FloatUniqueCheckPkRef struct { + FloatUniqueCheckPkRef float64 `db:"float_unique_check_pk_ref"` +} diff --git a/internal/integration_tests/mysql5/nulltypeprimitive/FloatUniquePk.go b/internal/integration_tests/mysql5/nulltypeprimitive/FloatUniquePk.go new file mode 100644 index 00000000..6f0e1fbd --- /dev/null +++ b/internal/integration_tests/mysql5/nulltypeprimitive/FloatUniquePk.go @@ -0,0 +1,5 @@ +package dto + +type FloatUniquePk struct { + FloatUniquePk float64 `db:"float_unique_pk"` +} diff --git a/internal/integration_tests/mysql5/nulltypeprimitive/IntegerCheckPk.go b/internal/integration_tests/mysql5/nulltypeprimitive/IntegerCheckPk.go new file mode 100644 index 00000000..ad7c9d02 --- /dev/null +++ b/internal/integration_tests/mysql5/nulltypeprimitive/IntegerCheckPk.go @@ -0,0 +1,5 @@ +package dto + +type IntegerCheckPk struct { + IntegerCheckPk int `db:"integer_check_pk"` +} diff --git a/internal/integration_tests/mysql5/nulltypeprimitive/IntegerDefConstUniqueCheckPk.go b/internal/integration_tests/mysql5/nulltypeprimitive/IntegerDefConstUniqueCheckPk.go new file mode 100644 index 00000000..72165e92 --- /dev/null +++ b/internal/integration_tests/mysql5/nulltypeprimitive/IntegerDefConstUniqueCheckPk.go @@ -0,0 +1,5 @@ +package dto + +type IntegerDefConstUniqueCheckPk struct { + IntegerDefConstUniqueCheckPk int `db:"integer_def_const_unique_check_pk"` +} diff --git a/internal/integration_tests/mysql5/nulltypeprimitive/IntegerDefConstUniqueCheckPkRef.go b/internal/integration_tests/mysql5/nulltypeprimitive/IntegerDefConstUniqueCheckPkRef.go new file mode 100644 index 00000000..3345b997 --- /dev/null +++ b/internal/integration_tests/mysql5/nulltypeprimitive/IntegerDefConstUniqueCheckPkRef.go @@ -0,0 +1,5 @@ +package dto + +type IntegerDefConstUniqueCheckPkRef struct { + IntegerDefConstUniqueCheckPkRef int `db:"integer_def_const_unique_check_pk_ref"` +} diff --git a/internal/integration_tests/mysql5/nulltypeprimitive/IntegerDefFuncUniqueCheckPk.go b/internal/integration_tests/mysql5/nulltypeprimitive/IntegerDefFuncUniqueCheckPk.go new file mode 100644 index 00000000..842dc704 --- /dev/null +++ b/internal/integration_tests/mysql5/nulltypeprimitive/IntegerDefFuncUniqueCheckPk.go @@ -0,0 +1,5 @@ +package dto + +type IntegerDefFuncUniqueCheckPk struct { + IntegerDefFuncUniqueCheckPk int `db:"integer_def_func_unique_check_pk"` +} diff --git a/internal/integration_tests/mysql5/nulltypeprimitive/IntegerDefFuncUniqueCheckPkRef.go b/internal/integration_tests/mysql5/nulltypeprimitive/IntegerDefFuncUniqueCheckPkRef.go new file mode 100644 index 00000000..8f406218 --- /dev/null +++ b/internal/integration_tests/mysql5/nulltypeprimitive/IntegerDefFuncUniqueCheckPkRef.go @@ -0,0 +1,5 @@ +package dto + +type IntegerDefFuncUniqueCheckPkRef struct { + IntegerDefFuncUniqueCheckPkRef int `db:"integer_def_func_unique_check_pk_ref"` +} diff --git a/internal/integration_tests/mysql5/nulltypeprimitive/IntegerNnPk.go b/internal/integration_tests/mysql5/nulltypeprimitive/IntegerNnPk.go new file mode 100644 index 00000000..2ec86875 --- /dev/null +++ b/internal/integration_tests/mysql5/nulltypeprimitive/IntegerNnPk.go @@ -0,0 +1,5 @@ +package dto + +type IntegerNnPk struct { + IntegerNnPk int `db:"integer_nn_pk"` +} diff --git a/internal/integration_tests/mysql5/nulltypeprimitive/IntegerNnUniqueCheckPk.go b/internal/integration_tests/mysql5/nulltypeprimitive/IntegerNnUniqueCheckPk.go new file mode 100644 index 00000000..f9311f0e --- /dev/null +++ b/internal/integration_tests/mysql5/nulltypeprimitive/IntegerNnUniqueCheckPk.go @@ -0,0 +1,5 @@ +package dto + +type IntegerNnUniqueCheckPk struct { + IntegerNnUniqueCheckPk int `db:"integer_nn_unique_check_pk"` +} diff --git a/internal/integration_tests/mysql5/nulltypeprimitive/IntegerNnUniqueCheckPkRef.go b/internal/integration_tests/mysql5/nulltypeprimitive/IntegerNnUniqueCheckPkRef.go new file mode 100644 index 00000000..9dca594a --- /dev/null +++ b/internal/integration_tests/mysql5/nulltypeprimitive/IntegerNnUniqueCheckPkRef.go @@ -0,0 +1,5 @@ +package dto + +type IntegerNnUniqueCheckPkRef struct { + IntegerNnUniqueCheckPkRef int `db:"integer_nn_unique_check_pk_ref"` +} diff --git a/internal/integration_tests/mysql5/nulltypeprimitive/IntegerPk.go b/internal/integration_tests/mysql5/nulltypeprimitive/IntegerPk.go new file mode 100644 index 00000000..4ad7290a --- /dev/null +++ b/internal/integration_tests/mysql5/nulltypeprimitive/IntegerPk.go @@ -0,0 +1,5 @@ +package dto + +type IntegerPk struct { + IntegerPk int `db:"integer_pk"` +} diff --git a/internal/integration_tests/mysql5/nulltypeprimitive/IntegerPkDefConst.go b/internal/integration_tests/mysql5/nulltypeprimitive/IntegerPkDefConst.go new file mode 100644 index 00000000..16ca6af6 --- /dev/null +++ b/internal/integration_tests/mysql5/nulltypeprimitive/IntegerPkDefConst.go @@ -0,0 +1,5 @@ +package dto + +type IntegerPkDefConst struct { + IntegerPkDefConst int `db:"integer_pk_def_const"` +} diff --git a/internal/integration_tests/mysql5/nulltypeprimitive/IntegerPkDefFunc.go b/internal/integration_tests/mysql5/nulltypeprimitive/IntegerPkDefFunc.go new file mode 100644 index 00000000..902032a0 --- /dev/null +++ b/internal/integration_tests/mysql5/nulltypeprimitive/IntegerPkDefFunc.go @@ -0,0 +1,5 @@ +package dto + +type IntegerPkDefFunc struct { + IntegerPkDefFunc int `db:"integer_pk_def_func"` +} diff --git a/internal/integration_tests/mysql5/nulltypeprimitive/IntegerPkRef.go b/internal/integration_tests/mysql5/nulltypeprimitive/IntegerPkRef.go new file mode 100644 index 00000000..4b526720 --- /dev/null +++ b/internal/integration_tests/mysql5/nulltypeprimitive/IntegerPkRef.go @@ -0,0 +1,5 @@ +package dto + +type IntegerPkRef struct { + IntegerPkRef int `db:"integer_pk_ref"` +} diff --git a/internal/integration_tests/mysql5/nulltypeprimitive/IntegerRef.go b/internal/integration_tests/mysql5/nulltypeprimitive/IntegerRef.go new file mode 100644 index 00000000..4b9105ba --- /dev/null +++ b/internal/integration_tests/mysql5/nulltypeprimitive/IntegerRef.go @@ -0,0 +1,5 @@ +package dto + +type IntegerRef struct { + IntegerRef *int `db:"integer_ref"` +} diff --git a/internal/integration_tests/mysql5/nulltypeprimitive/IntegerTable.go b/internal/integration_tests/mysql5/nulltypeprimitive/IntegerTable.go new file mode 100644 index 00000000..d619a795 --- /dev/null +++ b/internal/integration_tests/mysql5/nulltypeprimitive/IntegerTable.go @@ -0,0 +1,23 @@ +package dto + +type IntegerTable struct { + I *int `db:"i"` + IntegerNn int `db:"integer_nn"` + IntegerNnUnique int `db:"integer_nn_unique"` + IntegerNnCheck int `db:"integer_nn_check"` + IntegerUnique *int `db:"integer_unique"` + IntegerUniqueCheck *int `db:"integer_unique_check"` + IntegerUniqueRef *int `db:"integer_unique_ref"` + IntegerUniqueDefConst *int `db:"integer_unique_def_const"` + IntegerUniqueDefFunc *int `db:"integer_unique_def_func"` + IntegerCheck *int `db:"integer_check"` + IntegerCheckRef *int `db:"integer_check_ref"` + IntegerCheckDefConst *int `db:"integer_check_def_const"` + IntegerCheckDefFunc *int `db:"integer_check_def_func"` + IntegerRef *int `db:"integer_ref"` + IntegerRefUniqueCheck *int `db:"integer_ref_unique_check"` + IntegerDefConst *int `db:"integer_def_const"` + IntegerDefConstUniqueCheck *int `db:"integer_def_const_unique_check"` + IntegerDefFunc *int `db:"integer_def_func"` + IntegerDefFuncUniqueCheck *int `db:"integer_def_func_unique_check"` +} diff --git a/internal/integration_tests/mysql5/nulltypeprimitive/IntegerUniqueCheckPk.go b/internal/integration_tests/mysql5/nulltypeprimitive/IntegerUniqueCheckPk.go new file mode 100644 index 00000000..e9752b8b --- /dev/null +++ b/internal/integration_tests/mysql5/nulltypeprimitive/IntegerUniqueCheckPk.go @@ -0,0 +1,5 @@ +package dto + +type IntegerUniqueCheckPk struct { + IntegerUniqueCheckPk int `db:"integer_unique_check_pk"` +} diff --git a/internal/integration_tests/mysql5/nulltypeprimitive/IntegerUniqueCheckPkRef.go b/internal/integration_tests/mysql5/nulltypeprimitive/IntegerUniqueCheckPkRef.go new file mode 100644 index 00000000..23ec56d9 --- /dev/null +++ b/internal/integration_tests/mysql5/nulltypeprimitive/IntegerUniqueCheckPkRef.go @@ -0,0 +1,5 @@ +package dto + +type IntegerUniqueCheckPkRef struct { + IntegerUniqueCheckPkRef int `db:"integer_unique_check_pk_ref"` +} diff --git a/internal/integration_tests/mysql5/nulltypeprimitive/IntegerUniquePk.go b/internal/integration_tests/mysql5/nulltypeprimitive/IntegerUniquePk.go new file mode 100644 index 00000000..460e2616 --- /dev/null +++ b/internal/integration_tests/mysql5/nulltypeprimitive/IntegerUniquePk.go @@ -0,0 +1,5 @@ +package dto + +type IntegerUniquePk struct { + IntegerUniquePk int `db:"integer_unique_pk"` +} diff --git a/internal/integration_tests/mysql5/nulltypeprimitive/LongblobRef.go b/internal/integration_tests/mysql5/nulltypeprimitive/LongblobRef.go new file mode 100644 index 00000000..27258135 --- /dev/null +++ b/internal/integration_tests/mysql5/nulltypeprimitive/LongblobRef.go @@ -0,0 +1,5 @@ +package dto + +type LongblobRef struct { + LongblobRef string `db:"longblob_ref"` +} diff --git a/internal/integration_tests/mysql5/nulltypeprimitive/LongblobTable.go b/internal/integration_tests/mysql5/nulltypeprimitive/LongblobTable.go new file mode 100644 index 00000000..96a0e82f --- /dev/null +++ b/internal/integration_tests/mysql5/nulltypeprimitive/LongblobTable.go @@ -0,0 +1,18 @@ +package dto + +type LongblobTable struct { + Col *string `db:"col"` + LongblobDefConst *string `db:"longblob_def_const"` + LongblobDefFunc *string `db:"longblob_def_func"` + LongblobRef *string `db:"longblob_ref"` + LongblobNn string `db:"longblob_nn"` + LongblobNnCheckCmp string `db:"longblob_nn_check_cmp"` + LongblobNnCheckFn string `db:"longblob_nn_check_fn"` + LongblobNnRef string `db:"longblob_nn_ref"` + LongblobNnDefConst string `db:"longblob_nn_def_const"` + LongblobNnDefFunc string `db:"longblob_nn_def_func"` + LongblobCheck *string `db:"longblob_check"` + LongblobCheckRef *string `db:"longblob_check_ref"` + LongblobCheckDefConst *string `db:"longblob_check_def_const"` + LongblobCheckDefFunc *string `db:"longblob_check_def_func"` +} diff --git a/internal/integration_tests/mysql5/nulltypeprimitive/LongtextRef.go b/internal/integration_tests/mysql5/nulltypeprimitive/LongtextRef.go new file mode 100644 index 00000000..643799f5 --- /dev/null +++ b/internal/integration_tests/mysql5/nulltypeprimitive/LongtextRef.go @@ -0,0 +1,5 @@ +package dto + +type LongtextRef struct { + LongtextRef string `db:"longtext_ref"` +} diff --git a/internal/integration_tests/mysql5/nulltypeprimitive/LongtextTable.go b/internal/integration_tests/mysql5/nulltypeprimitive/LongtextTable.go new file mode 100644 index 00000000..a62155f5 --- /dev/null +++ b/internal/integration_tests/mysql5/nulltypeprimitive/LongtextTable.go @@ -0,0 +1,18 @@ +package dto + +type LongtextTable struct { + Col *string `db:"col"` + LongtextDefConst *string `db:"longtext_def_const"` + LongtextDefFunc *string `db:"longtext_def_func"` + LongtextRef *string `db:"longtext_ref"` + LongtextNn string `db:"longtext_nn"` + LongtextNnCheckCmp string `db:"longtext_nn_check_cmp"` + LongtextNnCheckFn string `db:"longtext_nn_check_fn"` + LongtextNnRef string `db:"longtext_nn_ref"` + LongtextNnDefConst string `db:"longtext_nn_def_const"` + LongtextNnDefFunc string `db:"longtext_nn_def_func"` + LongtextCheck *string `db:"longtext_check"` + LongtextCheckRef *string `db:"longtext_check_ref"` + LongtextCheckDefConst *string `db:"longtext_check_def_const"` + LongtextCheckDefFunc *string `db:"longtext_check_def_func"` +} diff --git a/internal/integration_tests/mysql5/nulltypeprimitive/MediumblobRef.go b/internal/integration_tests/mysql5/nulltypeprimitive/MediumblobRef.go new file mode 100644 index 00000000..c07a7901 --- /dev/null +++ b/internal/integration_tests/mysql5/nulltypeprimitive/MediumblobRef.go @@ -0,0 +1,5 @@ +package dto + +type MediumblobRef struct { + MediumblobRef string `db:"mediumblob_ref"` +} diff --git a/internal/integration_tests/mysql5/nulltypeprimitive/MediumblobTable.go b/internal/integration_tests/mysql5/nulltypeprimitive/MediumblobTable.go new file mode 100644 index 00000000..e3024311 --- /dev/null +++ b/internal/integration_tests/mysql5/nulltypeprimitive/MediumblobTable.go @@ -0,0 +1,18 @@ +package dto + +type MediumblobTable struct { + Col *string `db:"col"` + MediumblobDefConst *string `db:"mediumblob_def_const"` + MediumblobDefFunc *string `db:"mediumblob_def_func"` + MediumblobRef *string `db:"mediumblob_ref"` + MediumblobNn string `db:"mediumblob_nn"` + MediumblobNnCheckCmp string `db:"mediumblob_nn_check_cmp"` + MediumblobNnCheckFn string `db:"mediumblob_nn_check_fn"` + MediumblobNnRef string `db:"mediumblob_nn_ref"` + MediumblobNnDefConst string `db:"mediumblob_nn_def_const"` + MediumblobNnDefFunc string `db:"mediumblob_nn_def_func"` + MediumblobCheck *string `db:"mediumblob_check"` + MediumblobCheckRef *string `db:"mediumblob_check_ref"` + MediumblobCheckDefConst *string `db:"mediumblob_check_def_const"` + MediumblobCheckDefFunc *string `db:"mediumblob_check_def_func"` +} diff --git a/internal/integration_tests/mysql5/nulltypeprimitive/MediumintCheckPk.go b/internal/integration_tests/mysql5/nulltypeprimitive/MediumintCheckPk.go new file mode 100644 index 00000000..45cbb5c1 --- /dev/null +++ b/internal/integration_tests/mysql5/nulltypeprimitive/MediumintCheckPk.go @@ -0,0 +1,5 @@ +package dto + +type MediumintCheckPk struct { + MediumintCheckPk int `db:"mediumint_check_pk"` +} diff --git a/internal/integration_tests/mysql5/nulltypeprimitive/MediumintDefConstUniqueCheckPk.go b/internal/integration_tests/mysql5/nulltypeprimitive/MediumintDefConstUniqueCheckPk.go new file mode 100644 index 00000000..b9ddc8db --- /dev/null +++ b/internal/integration_tests/mysql5/nulltypeprimitive/MediumintDefConstUniqueCheckPk.go @@ -0,0 +1,5 @@ +package dto + +type MediumintDefConstUniqueCheckPk struct { + MediumintDefConstUniqueCheckPk int `db:"mediumint_def_const_unique_check_pk"` +} diff --git a/internal/integration_tests/mysql5/nulltypeprimitive/MediumintDefConstUniqueCheckPkRef.go b/internal/integration_tests/mysql5/nulltypeprimitive/MediumintDefConstUniqueCheckPkRef.go new file mode 100644 index 00000000..0d765358 --- /dev/null +++ b/internal/integration_tests/mysql5/nulltypeprimitive/MediumintDefConstUniqueCheckPkRef.go @@ -0,0 +1,5 @@ +package dto + +type MediumintDefConstUniqueCheckPkRef struct { + MediumintDefConstUniqueCheckPkRef int `db:"mediumint_def_const_unique_check_pk_ref"` +} diff --git a/internal/integration_tests/mysql5/nulltypeprimitive/MediumintDefFuncUniqueCheckPk.go b/internal/integration_tests/mysql5/nulltypeprimitive/MediumintDefFuncUniqueCheckPk.go new file mode 100644 index 00000000..9fbe5e3e --- /dev/null +++ b/internal/integration_tests/mysql5/nulltypeprimitive/MediumintDefFuncUniqueCheckPk.go @@ -0,0 +1,5 @@ +package dto + +type MediumintDefFuncUniqueCheckPk struct { + MediumintDefFuncUniqueCheckPk int `db:"mediumint_def_func_unique_check_pk"` +} diff --git a/internal/integration_tests/mysql5/nulltypeprimitive/MediumintDefFuncUniqueCheckPkRef.go b/internal/integration_tests/mysql5/nulltypeprimitive/MediumintDefFuncUniqueCheckPkRef.go new file mode 100644 index 00000000..5abfd547 --- /dev/null +++ b/internal/integration_tests/mysql5/nulltypeprimitive/MediumintDefFuncUniqueCheckPkRef.go @@ -0,0 +1,5 @@ +package dto + +type MediumintDefFuncUniqueCheckPkRef struct { + MediumintDefFuncUniqueCheckPkRef int `db:"mediumint_def_func_unique_check_pk_ref"` +} diff --git a/internal/integration_tests/mysql5/nulltypeprimitive/MediumintNnPk.go b/internal/integration_tests/mysql5/nulltypeprimitive/MediumintNnPk.go new file mode 100644 index 00000000..232ab1a8 --- /dev/null +++ b/internal/integration_tests/mysql5/nulltypeprimitive/MediumintNnPk.go @@ -0,0 +1,5 @@ +package dto + +type MediumintNnPk struct { + MediumintNnPk int `db:"mediumint_nn_pk"` +} diff --git a/internal/integration_tests/mysql5/nulltypeprimitive/MediumintNnUniqueCheckPk.go b/internal/integration_tests/mysql5/nulltypeprimitive/MediumintNnUniqueCheckPk.go new file mode 100644 index 00000000..b8155be5 --- /dev/null +++ b/internal/integration_tests/mysql5/nulltypeprimitive/MediumintNnUniqueCheckPk.go @@ -0,0 +1,5 @@ +package dto + +type MediumintNnUniqueCheckPk struct { + MediumintNnUniqueCheckPk int `db:"mediumint_nn_unique_check_pk"` +} diff --git a/internal/integration_tests/mysql5/nulltypeprimitive/MediumintNnUniqueCheckPkRef.go b/internal/integration_tests/mysql5/nulltypeprimitive/MediumintNnUniqueCheckPkRef.go new file mode 100644 index 00000000..b116bf6d --- /dev/null +++ b/internal/integration_tests/mysql5/nulltypeprimitive/MediumintNnUniqueCheckPkRef.go @@ -0,0 +1,5 @@ +package dto + +type MediumintNnUniqueCheckPkRef struct { + MediumintNnUniqueCheckPkRef int `db:"mediumint_nn_unique_check_pk_ref"` +} diff --git a/internal/integration_tests/mysql5/nulltypeprimitive/MediumintPk.go b/internal/integration_tests/mysql5/nulltypeprimitive/MediumintPk.go new file mode 100644 index 00000000..8699b985 --- /dev/null +++ b/internal/integration_tests/mysql5/nulltypeprimitive/MediumintPk.go @@ -0,0 +1,5 @@ +package dto + +type MediumintPk struct { + MediumintPk int `db:"mediumint_pk"` +} diff --git a/internal/integration_tests/mysql5/nulltypeprimitive/MediumintPkDefConst.go b/internal/integration_tests/mysql5/nulltypeprimitive/MediumintPkDefConst.go new file mode 100644 index 00000000..93cfa99c --- /dev/null +++ b/internal/integration_tests/mysql5/nulltypeprimitive/MediumintPkDefConst.go @@ -0,0 +1,5 @@ +package dto + +type MediumintPkDefConst struct { + MediumintPkDefConst int `db:"mediumint_pk_def_const"` +} diff --git a/internal/integration_tests/mysql5/nulltypeprimitive/MediumintPkDefFunc.go b/internal/integration_tests/mysql5/nulltypeprimitive/MediumintPkDefFunc.go new file mode 100644 index 00000000..bc09f7f8 --- /dev/null +++ b/internal/integration_tests/mysql5/nulltypeprimitive/MediumintPkDefFunc.go @@ -0,0 +1,5 @@ +package dto + +type MediumintPkDefFunc struct { + MediumintPkDefFunc int `db:"mediumint_pk_def_func"` +} diff --git a/internal/integration_tests/mysql5/nulltypeprimitive/MediumintPkRef.go b/internal/integration_tests/mysql5/nulltypeprimitive/MediumintPkRef.go new file mode 100644 index 00000000..bf4a377f --- /dev/null +++ b/internal/integration_tests/mysql5/nulltypeprimitive/MediumintPkRef.go @@ -0,0 +1,5 @@ +package dto + +type MediumintPkRef struct { + MediumintPkRef int `db:"mediumint_pk_ref"` +} diff --git a/internal/integration_tests/mysql5/nulltypeprimitive/MediumintRef.go b/internal/integration_tests/mysql5/nulltypeprimitive/MediumintRef.go new file mode 100644 index 00000000..8e4944c3 --- /dev/null +++ b/internal/integration_tests/mysql5/nulltypeprimitive/MediumintRef.go @@ -0,0 +1,5 @@ +package dto + +type MediumintRef struct { + MediumintRef *int `db:"mediumint_ref"` +} diff --git a/internal/integration_tests/mysql5/nulltypeprimitive/MediumintTable.go b/internal/integration_tests/mysql5/nulltypeprimitive/MediumintTable.go new file mode 100644 index 00000000..1c4c4d82 --- /dev/null +++ b/internal/integration_tests/mysql5/nulltypeprimitive/MediumintTable.go @@ -0,0 +1,23 @@ +package dto + +type MediumintTable struct { + I *int `db:"i"` + MediumintNn int `db:"mediumint_nn"` + MediumintNnUnique int `db:"mediumint_nn_unique"` + MediumintNnCheck int `db:"mediumint_nn_check"` + MediumintUnique *int `db:"mediumint_unique"` + MediumintUniqueCheck *int `db:"mediumint_unique_check"` + MediumintUniqueRef *int `db:"mediumint_unique_ref"` + MediumintUniqueDefConst *int `db:"mediumint_unique_def_const"` + MediumintUniqueDefFunc *int `db:"mediumint_unique_def_func"` + MediumintCheck *int `db:"mediumint_check"` + MediumintCheckRef *int `db:"mediumint_check_ref"` + MediumintCheckDefConst *int `db:"mediumint_check_def_const"` + MediumintCheckDefFunc *int `db:"mediumint_check_def_func"` + MediumintRef *int `db:"mediumint_ref"` + MediumintRefUniqueCheck *int `db:"mediumint_ref_unique_check"` + MediumintDefConst *int `db:"mediumint_def_const"` + MediumintDefConstUniqueCheck *int `db:"mediumint_def_const_unique_check"` + MediumintDefFunc *int `db:"mediumint_def_func"` + MediumintDefFuncUniqueCheck *int `db:"mediumint_def_func_unique_check"` +} diff --git a/internal/integration_tests/mysql5/nulltypeprimitive/MediumintUniqueCheckPk.go b/internal/integration_tests/mysql5/nulltypeprimitive/MediumintUniqueCheckPk.go new file mode 100644 index 00000000..560ec7bf --- /dev/null +++ b/internal/integration_tests/mysql5/nulltypeprimitive/MediumintUniqueCheckPk.go @@ -0,0 +1,5 @@ +package dto + +type MediumintUniqueCheckPk struct { + MediumintUniqueCheckPk int `db:"mediumint_unique_check_pk"` +} diff --git a/internal/integration_tests/mysql5/nulltypeprimitive/MediumintUniqueCheckPkRef.go b/internal/integration_tests/mysql5/nulltypeprimitive/MediumintUniqueCheckPkRef.go new file mode 100644 index 00000000..5fc524dc --- /dev/null +++ b/internal/integration_tests/mysql5/nulltypeprimitive/MediumintUniqueCheckPkRef.go @@ -0,0 +1,5 @@ +package dto + +type MediumintUniqueCheckPkRef struct { + MediumintUniqueCheckPkRef int `db:"mediumint_unique_check_pk_ref"` +} diff --git a/internal/integration_tests/mysql5/nulltypeprimitive/MediumintUniquePk.go b/internal/integration_tests/mysql5/nulltypeprimitive/MediumintUniquePk.go new file mode 100644 index 00000000..d8029efd --- /dev/null +++ b/internal/integration_tests/mysql5/nulltypeprimitive/MediumintUniquePk.go @@ -0,0 +1,5 @@ +package dto + +type MediumintUniquePk struct { + MediumintUniquePk int `db:"mediumint_unique_pk"` +} diff --git a/internal/integration_tests/mysql5/nulltypeprimitive/MediumtextRef.go b/internal/integration_tests/mysql5/nulltypeprimitive/MediumtextRef.go new file mode 100644 index 00000000..8102e8aa --- /dev/null +++ b/internal/integration_tests/mysql5/nulltypeprimitive/MediumtextRef.go @@ -0,0 +1,5 @@ +package dto + +type MediumtextRef struct { + MediumtextRef string `db:"mediumtext_ref"` +} diff --git a/internal/integration_tests/mysql5/nulltypeprimitive/MediumtextTable.go b/internal/integration_tests/mysql5/nulltypeprimitive/MediumtextTable.go new file mode 100644 index 00000000..8c3e4cc2 --- /dev/null +++ b/internal/integration_tests/mysql5/nulltypeprimitive/MediumtextTable.go @@ -0,0 +1,18 @@ +package dto + +type MediumtextTable struct { + Col *string `db:"col"` + MediumtextDefConst *string `db:"mediumtext_def_const"` + MediumtextDefFunc *string `db:"mediumtext_def_func"` + MediumtextRef *string `db:"mediumtext_ref"` + MediumtextNn string `db:"mediumtext_nn"` + MediumtextNnCheckCmp string `db:"mediumtext_nn_check_cmp"` + MediumtextNnCheckFn string `db:"mediumtext_nn_check_fn"` + MediumtextNnRef string `db:"mediumtext_nn_ref"` + MediumtextNnDefConst string `db:"mediumtext_nn_def_const"` + MediumtextNnDefFunc string `db:"mediumtext_nn_def_func"` + MediumtextCheck *string `db:"mediumtext_check"` + MediumtextCheckRef *string `db:"mediumtext_check_ref"` + MediumtextCheckDefConst *string `db:"mediumtext_check_def_const"` + MediumtextCheckDefFunc *string `db:"mediumtext_check_def_func"` +} diff --git a/internal/integration_tests/mysql5/nulltypeprimitive/NumericCheckPk.go b/internal/integration_tests/mysql5/nulltypeprimitive/NumericCheckPk.go new file mode 100644 index 00000000..58709a6e --- /dev/null +++ b/internal/integration_tests/mysql5/nulltypeprimitive/NumericCheckPk.go @@ -0,0 +1,5 @@ +package dto + +type NumericCheckPk struct { + NumericCheckPk float64 `db:"numeric_check_pk"` +} diff --git a/internal/integration_tests/mysql5/nulltypeprimitive/NumericDefConstUniqueCheckPk.go b/internal/integration_tests/mysql5/nulltypeprimitive/NumericDefConstUniqueCheckPk.go new file mode 100644 index 00000000..e6fdd1a2 --- /dev/null +++ b/internal/integration_tests/mysql5/nulltypeprimitive/NumericDefConstUniqueCheckPk.go @@ -0,0 +1,5 @@ +package dto + +type NumericDefConstUniqueCheckPk struct { + NumericDefConstUniqueCheckPk float64 `db:"numeric_def_const_unique_check_pk"` +} diff --git a/internal/integration_tests/mysql5/nulltypeprimitive/NumericDefConstUniqueCheckPkRef.go b/internal/integration_tests/mysql5/nulltypeprimitive/NumericDefConstUniqueCheckPkRef.go new file mode 100644 index 00000000..cdaee17e --- /dev/null +++ b/internal/integration_tests/mysql5/nulltypeprimitive/NumericDefConstUniqueCheckPkRef.go @@ -0,0 +1,5 @@ +package dto + +type NumericDefConstUniqueCheckPkRef struct { + NumericDefConstUniqueCheckPkRef float64 `db:"numeric_def_const_unique_check_pk_ref"` +} diff --git a/internal/integration_tests/mysql5/nulltypeprimitive/NumericDefFuncUniqueCheckPk.go b/internal/integration_tests/mysql5/nulltypeprimitive/NumericDefFuncUniqueCheckPk.go new file mode 100644 index 00000000..7747f0a7 --- /dev/null +++ b/internal/integration_tests/mysql5/nulltypeprimitive/NumericDefFuncUniqueCheckPk.go @@ -0,0 +1,5 @@ +package dto + +type NumericDefFuncUniqueCheckPk struct { + NumericDefFuncUniqueCheckPk float64 `db:"numeric_def_func_unique_check_pk"` +} diff --git a/internal/integration_tests/mysql5/nulltypeprimitive/NumericDefFuncUniqueCheckPkRef.go b/internal/integration_tests/mysql5/nulltypeprimitive/NumericDefFuncUniqueCheckPkRef.go new file mode 100644 index 00000000..ade94a23 --- /dev/null +++ b/internal/integration_tests/mysql5/nulltypeprimitive/NumericDefFuncUniqueCheckPkRef.go @@ -0,0 +1,5 @@ +package dto + +type NumericDefFuncUniqueCheckPkRef struct { + NumericDefFuncUniqueCheckPkRef float64 `db:"numeric_def_func_unique_check_pk_ref"` +} diff --git a/internal/integration_tests/mysql5/nulltypeprimitive/NumericNnPk.go b/internal/integration_tests/mysql5/nulltypeprimitive/NumericNnPk.go new file mode 100644 index 00000000..d4f8dba5 --- /dev/null +++ b/internal/integration_tests/mysql5/nulltypeprimitive/NumericNnPk.go @@ -0,0 +1,5 @@ +package dto + +type NumericNnPk struct { + NumericNnPk float64 `db:"numeric_nn_pk"` +} diff --git a/internal/integration_tests/mysql5/nulltypeprimitive/NumericNnUniqueCheckPk.go b/internal/integration_tests/mysql5/nulltypeprimitive/NumericNnUniqueCheckPk.go new file mode 100644 index 00000000..bad0e84f --- /dev/null +++ b/internal/integration_tests/mysql5/nulltypeprimitive/NumericNnUniqueCheckPk.go @@ -0,0 +1,5 @@ +package dto + +type NumericNnUniqueCheckPk struct { + NumericNnUniqueCheckPk float64 `db:"numeric_nn_unique_check_pk"` +} diff --git a/internal/integration_tests/mysql5/nulltypeprimitive/NumericNnUniqueCheckPkRef.go b/internal/integration_tests/mysql5/nulltypeprimitive/NumericNnUniqueCheckPkRef.go new file mode 100644 index 00000000..c4d76752 --- /dev/null +++ b/internal/integration_tests/mysql5/nulltypeprimitive/NumericNnUniqueCheckPkRef.go @@ -0,0 +1,5 @@ +package dto + +type NumericNnUniqueCheckPkRef struct { + NumericNnUniqueCheckPkRef float64 `db:"numeric_nn_unique_check_pk_ref"` +} diff --git a/internal/integration_tests/mysql5/nulltypeprimitive/NumericPk.go b/internal/integration_tests/mysql5/nulltypeprimitive/NumericPk.go new file mode 100644 index 00000000..c2d654cc --- /dev/null +++ b/internal/integration_tests/mysql5/nulltypeprimitive/NumericPk.go @@ -0,0 +1,5 @@ +package dto + +type NumericPk struct { + NumericPk float64 `db:"numeric_pk"` +} diff --git a/internal/integration_tests/mysql5/nulltypeprimitive/NumericPkDefConst.go b/internal/integration_tests/mysql5/nulltypeprimitive/NumericPkDefConst.go new file mode 100644 index 00000000..b501ee37 --- /dev/null +++ b/internal/integration_tests/mysql5/nulltypeprimitive/NumericPkDefConst.go @@ -0,0 +1,5 @@ +package dto + +type NumericPkDefConst struct { + NumericPkDefConst float64 `db:"numeric_pk_def_const"` +} diff --git a/internal/integration_tests/mysql5/nulltypeprimitive/NumericPkDefFunc.go b/internal/integration_tests/mysql5/nulltypeprimitive/NumericPkDefFunc.go new file mode 100644 index 00000000..13dd726d --- /dev/null +++ b/internal/integration_tests/mysql5/nulltypeprimitive/NumericPkDefFunc.go @@ -0,0 +1,5 @@ +package dto + +type NumericPkDefFunc struct { + NumericPkDefFunc float64 `db:"numeric_pk_def_func"` +} diff --git a/internal/integration_tests/mysql5/nulltypeprimitive/NumericPkRef.go b/internal/integration_tests/mysql5/nulltypeprimitive/NumericPkRef.go new file mode 100644 index 00000000..af53186e --- /dev/null +++ b/internal/integration_tests/mysql5/nulltypeprimitive/NumericPkRef.go @@ -0,0 +1,5 @@ +package dto + +type NumericPkRef struct { + NumericPkRef float64 `db:"numeric_pk_ref"` +} diff --git a/internal/integration_tests/mysql5/nulltypeprimitive/NumericRef.go b/internal/integration_tests/mysql5/nulltypeprimitive/NumericRef.go new file mode 100644 index 00000000..a3cac8a7 --- /dev/null +++ b/internal/integration_tests/mysql5/nulltypeprimitive/NumericRef.go @@ -0,0 +1,5 @@ +package dto + +type NumericRef struct { + NumericRef *float64 `db:"numeric_ref"` +} diff --git a/internal/integration_tests/mysql5/nulltypeprimitive/NumericTable.go b/internal/integration_tests/mysql5/nulltypeprimitive/NumericTable.go new file mode 100644 index 00000000..c45a220c --- /dev/null +++ b/internal/integration_tests/mysql5/nulltypeprimitive/NumericTable.go @@ -0,0 +1,27 @@ +package dto + +type NumericTable struct { + Col *float64 `db:"col"` + NumericNn float64 `db:"numeric_nn"` + NumericNnUnique float64 `db:"numeric_nn_unique"` + NumericNnCheck float64 `db:"numeric_nn_check"` + NumericNnRef float64 `db:"numeric_nn_ref"` + NumericNnDefConst float64 `db:"numeric_nn_def_const"` + NumericNnDefFunc float64 `db:"numeric_nn_def_func"` + NumericNnUniqueCheck float64 `db:"numeric_nn_unique_check"` + NumericUnique *float64 `db:"numeric_unique"` + NumericUniqueCheck *float64 `db:"numeric_unique_check"` + NumericUniqueRef *float64 `db:"numeric_unique_ref"` + NumericUniqueDefConst *float64 `db:"numeric_unique_def_const"` + NumericUniqueDefFunc *float64 `db:"numeric_unique_def_func"` + NumericCheck *float64 `db:"numeric_check"` + NumericCheckRef *float64 `db:"numeric_check_ref"` + NumericCheckDefConst *float64 `db:"numeric_check_def_const"` + NumericCheckDefFunc *float64 `db:"numeric_check_def_func"` + NumericRef *float64 `db:"numeric_ref"` + NumericRefUniqueCheck *float64 `db:"numeric_ref_unique_check"` + NumericDefConst *float64 `db:"numeric_def_const"` + NumericDefConstUniqueCheck *float64 `db:"numeric_def_const_unique_check"` + NumericDefFunc *float64 `db:"numeric_def_func"` + NumericDefFuncUniqueCheck *float64 `db:"numeric_def_func_unique_check"` +} diff --git a/internal/integration_tests/mysql5/nulltypeprimitive/NumericUniqueCheckPk.go b/internal/integration_tests/mysql5/nulltypeprimitive/NumericUniqueCheckPk.go new file mode 100644 index 00000000..e48c41ec --- /dev/null +++ b/internal/integration_tests/mysql5/nulltypeprimitive/NumericUniqueCheckPk.go @@ -0,0 +1,5 @@ +package dto + +type NumericUniqueCheckPk struct { + NumericUniqueCheckPk float64 `db:"numeric_unique_check_pk"` +} diff --git a/internal/integration_tests/mysql5/nulltypeprimitive/NumericUniqueCheckPkRef.go b/internal/integration_tests/mysql5/nulltypeprimitive/NumericUniqueCheckPkRef.go new file mode 100644 index 00000000..d230e9c3 --- /dev/null +++ b/internal/integration_tests/mysql5/nulltypeprimitive/NumericUniqueCheckPkRef.go @@ -0,0 +1,5 @@ +package dto + +type NumericUniqueCheckPkRef struct { + NumericUniqueCheckPkRef float64 `db:"numeric_unique_check_pk_ref"` +} diff --git a/internal/integration_tests/mysql5/nulltypeprimitive/NumericUniquePk.go b/internal/integration_tests/mysql5/nulltypeprimitive/NumericUniquePk.go new file mode 100644 index 00000000..308c1b60 --- /dev/null +++ b/internal/integration_tests/mysql5/nulltypeprimitive/NumericUniquePk.go @@ -0,0 +1,5 @@ +package dto + +type NumericUniquePk struct { + NumericUniquePk float64 `db:"numeric_unique_pk"` +} diff --git a/internal/integration_tests/mysql5/nulltypeprimitive/RealCheckPk.go b/internal/integration_tests/mysql5/nulltypeprimitive/RealCheckPk.go new file mode 100644 index 00000000..41bbff57 --- /dev/null +++ b/internal/integration_tests/mysql5/nulltypeprimitive/RealCheckPk.go @@ -0,0 +1,5 @@ +package dto + +type RealCheckPk struct { + RealCheckPk float64 `db:"real_check_pk"` +} diff --git a/internal/integration_tests/mysql5/nulltypeprimitive/RealDefConstUniqueCheckPk.go b/internal/integration_tests/mysql5/nulltypeprimitive/RealDefConstUniqueCheckPk.go new file mode 100644 index 00000000..9be61d5c --- /dev/null +++ b/internal/integration_tests/mysql5/nulltypeprimitive/RealDefConstUniqueCheckPk.go @@ -0,0 +1,5 @@ +package dto + +type RealDefConstUniqueCheckPk struct { + RealDefConstUniqueCheckPk float64 `db:"real_def_const_unique_check_pk"` +} diff --git a/internal/integration_tests/mysql5/nulltypeprimitive/RealDefConstUniqueCheckPkRef.go b/internal/integration_tests/mysql5/nulltypeprimitive/RealDefConstUniqueCheckPkRef.go new file mode 100644 index 00000000..af58466f --- /dev/null +++ b/internal/integration_tests/mysql5/nulltypeprimitive/RealDefConstUniqueCheckPkRef.go @@ -0,0 +1,5 @@ +package dto + +type RealDefConstUniqueCheckPkRef struct { + RealDefConstUniqueCheckPkRef float64 `db:"real_def_const_unique_check_pk_ref"` +} diff --git a/internal/integration_tests/mysql5/nulltypeprimitive/RealDefFuncUniqueCheckPk.go b/internal/integration_tests/mysql5/nulltypeprimitive/RealDefFuncUniqueCheckPk.go new file mode 100644 index 00000000..2619719a --- /dev/null +++ b/internal/integration_tests/mysql5/nulltypeprimitive/RealDefFuncUniqueCheckPk.go @@ -0,0 +1,5 @@ +package dto + +type RealDefFuncUniqueCheckPk struct { + RealDefFuncUniqueCheckPk float64 `db:"real_def_func_unique_check_pk"` +} diff --git a/internal/integration_tests/mysql5/nulltypeprimitive/RealDefFuncUniqueCheckPkRef.go b/internal/integration_tests/mysql5/nulltypeprimitive/RealDefFuncUniqueCheckPkRef.go new file mode 100644 index 00000000..1c085edc --- /dev/null +++ b/internal/integration_tests/mysql5/nulltypeprimitive/RealDefFuncUniqueCheckPkRef.go @@ -0,0 +1,5 @@ +package dto + +type RealDefFuncUniqueCheckPkRef struct { + RealDefFuncUniqueCheckPkRef float64 `db:"real_def_func_unique_check_pk_ref"` +} diff --git a/internal/integration_tests/mysql5/nulltypeprimitive/RealNnPk.go b/internal/integration_tests/mysql5/nulltypeprimitive/RealNnPk.go new file mode 100644 index 00000000..c9efd760 --- /dev/null +++ b/internal/integration_tests/mysql5/nulltypeprimitive/RealNnPk.go @@ -0,0 +1,5 @@ +package dto + +type RealNnPk struct { + RealNnPk float64 `db:"real_nn_pk"` +} diff --git a/internal/integration_tests/mysql5/nulltypeprimitive/RealNnUniqueCheckPk.go b/internal/integration_tests/mysql5/nulltypeprimitive/RealNnUniqueCheckPk.go new file mode 100644 index 00000000..bcd80e13 --- /dev/null +++ b/internal/integration_tests/mysql5/nulltypeprimitive/RealNnUniqueCheckPk.go @@ -0,0 +1,5 @@ +package dto + +type RealNnUniqueCheckPk struct { + RealNnUniqueCheckPk float64 `db:"real_nn_unique_check_pk"` +} diff --git a/internal/integration_tests/mysql5/nulltypeprimitive/RealNnUniqueCheckPkRef.go b/internal/integration_tests/mysql5/nulltypeprimitive/RealNnUniqueCheckPkRef.go new file mode 100644 index 00000000..1ab6f733 --- /dev/null +++ b/internal/integration_tests/mysql5/nulltypeprimitive/RealNnUniqueCheckPkRef.go @@ -0,0 +1,5 @@ +package dto + +type RealNnUniqueCheckPkRef struct { + RealNnUniqueCheckPkRef float64 `db:"real_nn_unique_check_pk_ref"` +} diff --git a/internal/integration_tests/mysql5/nulltypeprimitive/RealPk.go b/internal/integration_tests/mysql5/nulltypeprimitive/RealPk.go new file mode 100644 index 00000000..aae62539 --- /dev/null +++ b/internal/integration_tests/mysql5/nulltypeprimitive/RealPk.go @@ -0,0 +1,5 @@ +package dto + +type RealPk struct { + RealPk float64 `db:"real_pk"` +} diff --git a/internal/integration_tests/mysql5/nulltypeprimitive/RealPkDefConst.go b/internal/integration_tests/mysql5/nulltypeprimitive/RealPkDefConst.go new file mode 100644 index 00000000..dcb3b0fa --- /dev/null +++ b/internal/integration_tests/mysql5/nulltypeprimitive/RealPkDefConst.go @@ -0,0 +1,5 @@ +package dto + +type RealPkDefConst struct { + RealPkDefConst float64 `db:"real_pk_def_const"` +} diff --git a/internal/integration_tests/mysql5/nulltypeprimitive/RealPkDefFunc.go b/internal/integration_tests/mysql5/nulltypeprimitive/RealPkDefFunc.go new file mode 100644 index 00000000..85041669 --- /dev/null +++ b/internal/integration_tests/mysql5/nulltypeprimitive/RealPkDefFunc.go @@ -0,0 +1,5 @@ +package dto + +type RealPkDefFunc struct { + RealPkDefFunc float64 `db:"real_pk_def_func"` +} diff --git a/internal/integration_tests/mysql5/nulltypeprimitive/RealPkRef.go b/internal/integration_tests/mysql5/nulltypeprimitive/RealPkRef.go new file mode 100644 index 00000000..99800028 --- /dev/null +++ b/internal/integration_tests/mysql5/nulltypeprimitive/RealPkRef.go @@ -0,0 +1,5 @@ +package dto + +type RealPkRef struct { + RealPkRef float64 `db:"real_pk_ref"` +} diff --git a/internal/integration_tests/mysql5/nulltypeprimitive/RealRef.go b/internal/integration_tests/mysql5/nulltypeprimitive/RealRef.go new file mode 100644 index 00000000..ab340dbe --- /dev/null +++ b/internal/integration_tests/mysql5/nulltypeprimitive/RealRef.go @@ -0,0 +1,5 @@ +package dto + +type RealRef struct { + RealRef *float64 `db:"real_ref"` +} diff --git a/internal/integration_tests/mysql5/nulltypeprimitive/RealTable.go b/internal/integration_tests/mysql5/nulltypeprimitive/RealTable.go new file mode 100644 index 00000000..b97edf42 --- /dev/null +++ b/internal/integration_tests/mysql5/nulltypeprimitive/RealTable.go @@ -0,0 +1,27 @@ +package dto + +type RealTable struct { + Col *float64 `db:"col"` + RealNn float64 `db:"real_nn"` + RealNnUnique float64 `db:"real_nn_unique"` + RealNnCheck float64 `db:"real_nn_check"` + RealNnRef float64 `db:"real_nn_ref"` + RealNnDefConst float64 `db:"real_nn_def_const"` + RealNnDefFunc float64 `db:"real_nn_def_func"` + RealNnUniqueCheck float64 `db:"real_nn_unique_check"` + RealUnique *float64 `db:"real_unique"` + RealUniqueCheck *float64 `db:"real_unique_check"` + RealUniqueRef *float64 `db:"real_unique_ref"` + RealUniqueDefConst *float64 `db:"real_unique_def_const"` + RealUniqueDefFunc *float64 `db:"real_unique_def_func"` + RealCheck *float64 `db:"real_check"` + RealCheckRef *float64 `db:"real_check_ref"` + RealCheckDefConst *float64 `db:"real_check_def_const"` + RealCheckDefFunc *float64 `db:"real_check_def_func"` + RealRef *float64 `db:"real_ref"` + RealRefUniqueCheck *float64 `db:"real_ref_unique_check"` + RealDefConst *float64 `db:"real_def_const"` + RealDefConstUniqueCheck *float64 `db:"real_def_const_unique_check"` + RealDefFunc *float64 `db:"real_def_func"` + RealDefFuncUniqueCheck *float64 `db:"real_def_func_unique_check"` +} diff --git a/internal/integration_tests/mysql5/nulltypeprimitive/RealUniqueCheckPk.go b/internal/integration_tests/mysql5/nulltypeprimitive/RealUniqueCheckPk.go new file mode 100644 index 00000000..68483d8a --- /dev/null +++ b/internal/integration_tests/mysql5/nulltypeprimitive/RealUniqueCheckPk.go @@ -0,0 +1,5 @@ +package dto + +type RealUniqueCheckPk struct { + RealUniqueCheckPk float64 `db:"real_unique_check_pk"` +} diff --git a/internal/integration_tests/mysql5/nulltypeprimitive/RealUniqueCheckPkRef.go b/internal/integration_tests/mysql5/nulltypeprimitive/RealUniqueCheckPkRef.go new file mode 100644 index 00000000..bc4b0d90 --- /dev/null +++ b/internal/integration_tests/mysql5/nulltypeprimitive/RealUniqueCheckPkRef.go @@ -0,0 +1,5 @@ +package dto + +type RealUniqueCheckPkRef struct { + RealUniqueCheckPkRef float64 `db:"real_unique_check_pk_ref"` +} diff --git a/internal/integration_tests/mysql5/nulltypeprimitive/RealUniquePk.go b/internal/integration_tests/mysql5/nulltypeprimitive/RealUniquePk.go new file mode 100644 index 00000000..8d22f752 --- /dev/null +++ b/internal/integration_tests/mysql5/nulltypeprimitive/RealUniquePk.go @@ -0,0 +1,5 @@ +package dto + +type RealUniquePk struct { + RealUniquePk float64 `db:"real_unique_pk"` +} diff --git a/internal/integration_tests/mysql5/nulltypeprimitive/SmallintCheckPk.go b/internal/integration_tests/mysql5/nulltypeprimitive/SmallintCheckPk.go new file mode 100644 index 00000000..b751015a --- /dev/null +++ b/internal/integration_tests/mysql5/nulltypeprimitive/SmallintCheckPk.go @@ -0,0 +1,5 @@ +package dto + +type SmallintCheckPk struct { + SmallintCheckPk int `db:"smallint_check_pk"` +} diff --git a/internal/integration_tests/mysql5/nulltypeprimitive/SmallintDefConstUniqueCheckPk.go b/internal/integration_tests/mysql5/nulltypeprimitive/SmallintDefConstUniqueCheckPk.go new file mode 100644 index 00000000..e2e17b6f --- /dev/null +++ b/internal/integration_tests/mysql5/nulltypeprimitive/SmallintDefConstUniqueCheckPk.go @@ -0,0 +1,5 @@ +package dto + +type SmallintDefConstUniqueCheckPk struct { + SmallintDefConstUniqueCheckPk int `db:"smallint_def_const_unique_check_pk"` +} diff --git a/internal/integration_tests/mysql5/nulltypeprimitive/SmallintDefConstUniqueCheckPkRef.go b/internal/integration_tests/mysql5/nulltypeprimitive/SmallintDefConstUniqueCheckPkRef.go new file mode 100644 index 00000000..827d36f7 --- /dev/null +++ b/internal/integration_tests/mysql5/nulltypeprimitive/SmallintDefConstUniqueCheckPkRef.go @@ -0,0 +1,5 @@ +package dto + +type SmallintDefConstUniqueCheckPkRef struct { + SmallintDefConstUniqueCheckPkRef int `db:"smallint_def_const_unique_check_pk_ref"` +} diff --git a/internal/integration_tests/mysql5/nulltypeprimitive/SmallintDefFuncUniqueCheckPk.go b/internal/integration_tests/mysql5/nulltypeprimitive/SmallintDefFuncUniqueCheckPk.go new file mode 100644 index 00000000..ab2612af --- /dev/null +++ b/internal/integration_tests/mysql5/nulltypeprimitive/SmallintDefFuncUniqueCheckPk.go @@ -0,0 +1,5 @@ +package dto + +type SmallintDefFuncUniqueCheckPk struct { + SmallintDefFuncUniqueCheckPk int `db:"smallint_def_func_unique_check_pk"` +} diff --git a/internal/integration_tests/mysql5/nulltypeprimitive/SmallintDefFuncUniqueCheckPkRef.go b/internal/integration_tests/mysql5/nulltypeprimitive/SmallintDefFuncUniqueCheckPkRef.go new file mode 100644 index 00000000..3aef8dba --- /dev/null +++ b/internal/integration_tests/mysql5/nulltypeprimitive/SmallintDefFuncUniqueCheckPkRef.go @@ -0,0 +1,5 @@ +package dto + +type SmallintDefFuncUniqueCheckPkRef struct { + SmallintDefFuncUniqueCheckPkRef int `db:"smallint_def_func_unique_check_pk_ref"` +} diff --git a/internal/integration_tests/mysql5/nulltypeprimitive/SmallintNnPk.go b/internal/integration_tests/mysql5/nulltypeprimitive/SmallintNnPk.go new file mode 100644 index 00000000..e860d504 --- /dev/null +++ b/internal/integration_tests/mysql5/nulltypeprimitive/SmallintNnPk.go @@ -0,0 +1,5 @@ +package dto + +type SmallintNnPk struct { + SmallintNnPk int `db:"smallint_nn_pk"` +} diff --git a/internal/integration_tests/mysql5/nulltypeprimitive/SmallintNnUniqueCheckPk.go b/internal/integration_tests/mysql5/nulltypeprimitive/SmallintNnUniqueCheckPk.go new file mode 100644 index 00000000..09158e0c --- /dev/null +++ b/internal/integration_tests/mysql5/nulltypeprimitive/SmallintNnUniqueCheckPk.go @@ -0,0 +1,5 @@ +package dto + +type SmallintNnUniqueCheckPk struct { + SmallintNnUniqueCheckPk int `db:"smallint_nn_unique_check_pk"` +} diff --git a/internal/integration_tests/mysql5/nulltypeprimitive/SmallintNnUniqueCheckPkRef.go b/internal/integration_tests/mysql5/nulltypeprimitive/SmallintNnUniqueCheckPkRef.go new file mode 100644 index 00000000..29099ecd --- /dev/null +++ b/internal/integration_tests/mysql5/nulltypeprimitive/SmallintNnUniqueCheckPkRef.go @@ -0,0 +1,5 @@ +package dto + +type SmallintNnUniqueCheckPkRef struct { + SmallintNnUniqueCheckPkRef int `db:"smallint_nn_unique_check_pk_ref"` +} diff --git a/internal/integration_tests/mysql5/nulltypeprimitive/SmallintPk.go b/internal/integration_tests/mysql5/nulltypeprimitive/SmallintPk.go new file mode 100644 index 00000000..7e31ea21 --- /dev/null +++ b/internal/integration_tests/mysql5/nulltypeprimitive/SmallintPk.go @@ -0,0 +1,5 @@ +package dto + +type SmallintPk struct { + SmallintPk int `db:"smallint_pk"` +} diff --git a/internal/integration_tests/mysql5/nulltypeprimitive/SmallintPkDefConst.go b/internal/integration_tests/mysql5/nulltypeprimitive/SmallintPkDefConst.go new file mode 100644 index 00000000..6674cb63 --- /dev/null +++ b/internal/integration_tests/mysql5/nulltypeprimitive/SmallintPkDefConst.go @@ -0,0 +1,5 @@ +package dto + +type SmallintPkDefConst struct { + SmallintPkDefConst int `db:"smallint_pk_def_const"` +} diff --git a/internal/integration_tests/mysql5/nulltypeprimitive/SmallintPkDefFunc.go b/internal/integration_tests/mysql5/nulltypeprimitive/SmallintPkDefFunc.go new file mode 100644 index 00000000..3951e6bf --- /dev/null +++ b/internal/integration_tests/mysql5/nulltypeprimitive/SmallintPkDefFunc.go @@ -0,0 +1,5 @@ +package dto + +type SmallintPkDefFunc struct { + SmallintPkDefFunc int `db:"smallint_pk_def_func"` +} diff --git a/internal/integration_tests/mysql5/nulltypeprimitive/SmallintPkRef.go b/internal/integration_tests/mysql5/nulltypeprimitive/SmallintPkRef.go new file mode 100644 index 00000000..fc0176ef --- /dev/null +++ b/internal/integration_tests/mysql5/nulltypeprimitive/SmallintPkRef.go @@ -0,0 +1,5 @@ +package dto + +type SmallintPkRef struct { + SmallintPkRef int `db:"smallint_pk_ref"` +} diff --git a/internal/integration_tests/mysql5/nulltypeprimitive/SmallintRef.go b/internal/integration_tests/mysql5/nulltypeprimitive/SmallintRef.go new file mode 100644 index 00000000..f5e3acb8 --- /dev/null +++ b/internal/integration_tests/mysql5/nulltypeprimitive/SmallintRef.go @@ -0,0 +1,5 @@ +package dto + +type SmallintRef struct { + SmallintRef *int `db:"smallint_ref"` +} diff --git a/internal/integration_tests/mysql5/nulltypeprimitive/SmallintTable.go b/internal/integration_tests/mysql5/nulltypeprimitive/SmallintTable.go new file mode 100644 index 00000000..009a7647 --- /dev/null +++ b/internal/integration_tests/mysql5/nulltypeprimitive/SmallintTable.go @@ -0,0 +1,23 @@ +package dto + +type SmallintTable struct { + I *int `db:"i"` + SmallintNn int `db:"smallint_nn"` + SmallintNnUnique int `db:"smallint_nn_unique"` + SmallintNnCheck int `db:"smallint_nn_check"` + SmallintUnique *int `db:"smallint_unique"` + SmallintUniqueCheck *int `db:"smallint_unique_check"` + SmallintUniqueRef *int `db:"smallint_unique_ref"` + SmallintUniqueDefConst *int `db:"smallint_unique_def_const"` + SmallintUniqueDefFunc *int `db:"smallint_unique_def_func"` + SmallintCheck *int `db:"smallint_check"` + SmallintCheckRef *int `db:"smallint_check_ref"` + SmallintCheckDefConst *int `db:"smallint_check_def_const"` + SmallintCheckDefFunc *int `db:"smallint_check_def_func"` + SmallintRef *int `db:"smallint_ref"` + SmallintRefUniqueCheck *int `db:"smallint_ref_unique_check"` + SmallintDefConst *int `db:"smallint_def_const"` + SmallintDefConstUniqueCheck *int `db:"smallint_def_const_unique_check"` + SmallintDefFunc *int `db:"smallint_def_func"` + SmallintDefFuncUniqueCheck *int `db:"smallint_def_func_unique_check"` +} diff --git a/internal/integration_tests/mysql5/nulltypeprimitive/SmallintUniqueCheckPk.go b/internal/integration_tests/mysql5/nulltypeprimitive/SmallintUniqueCheckPk.go new file mode 100644 index 00000000..3cf7cccc --- /dev/null +++ b/internal/integration_tests/mysql5/nulltypeprimitive/SmallintUniqueCheckPk.go @@ -0,0 +1,5 @@ +package dto + +type SmallintUniqueCheckPk struct { + SmallintUniqueCheckPk int `db:"smallint_unique_check_pk"` +} diff --git a/internal/integration_tests/mysql5/nulltypeprimitive/SmallintUniqueCheckPkRef.go b/internal/integration_tests/mysql5/nulltypeprimitive/SmallintUniqueCheckPkRef.go new file mode 100644 index 00000000..2dc8bfd8 --- /dev/null +++ b/internal/integration_tests/mysql5/nulltypeprimitive/SmallintUniqueCheckPkRef.go @@ -0,0 +1,5 @@ +package dto + +type SmallintUniqueCheckPkRef struct { + SmallintUniqueCheckPkRef int `db:"smallint_unique_check_pk_ref"` +} diff --git a/internal/integration_tests/mysql5/nulltypeprimitive/SmallintUniquePk.go b/internal/integration_tests/mysql5/nulltypeprimitive/SmallintUniquePk.go new file mode 100644 index 00000000..1814500f --- /dev/null +++ b/internal/integration_tests/mysql5/nulltypeprimitive/SmallintUniquePk.go @@ -0,0 +1,5 @@ +package dto + +type SmallintUniquePk struct { + SmallintUniquePk int `db:"smallint_unique_pk"` +} diff --git a/internal/integration_tests/mysql5/nulltypeprimitive/TextRef.go b/internal/integration_tests/mysql5/nulltypeprimitive/TextRef.go new file mode 100644 index 00000000..115deada --- /dev/null +++ b/internal/integration_tests/mysql5/nulltypeprimitive/TextRef.go @@ -0,0 +1,5 @@ +package dto + +type TextRef struct { + TextRef string `db:"text_ref"` +} diff --git a/internal/integration_tests/mysql5/nulltypeprimitive/TextTable.go b/internal/integration_tests/mysql5/nulltypeprimitive/TextTable.go new file mode 100644 index 00000000..58c988c6 --- /dev/null +++ b/internal/integration_tests/mysql5/nulltypeprimitive/TextTable.go @@ -0,0 +1,18 @@ +package dto + +type TextTable struct { + Col *string `db:"col"` + TextDefConst *string `db:"text_def_const"` + TextDefFunc *string `db:"text_def_func"` + TextRef *string `db:"text_ref"` + TextNn string `db:"text_nn"` + TextNnCheckCmp string `db:"text_nn_check_cmp"` + TextNnCheckFn string `db:"text_nn_check_fn"` + TextNnRef string `db:"text_nn_ref"` + TextNnDefConst string `db:"text_nn_def_const"` + TextNnDefFunc string `db:"text_nn_def_func"` + TextCheck *string `db:"text_check"` + TextCheckRef *string `db:"text_check_ref"` + TextCheckDefConst *string `db:"text_check_def_const"` + TextCheckDefFunc *string `db:"text_check_def_func"` +} diff --git a/internal/integration_tests/mysql5/nulltypeprimitive/TimeCheckPk.go b/internal/integration_tests/mysql5/nulltypeprimitive/TimeCheckPk.go new file mode 100644 index 00000000..8ac4498b --- /dev/null +++ b/internal/integration_tests/mysql5/nulltypeprimitive/TimeCheckPk.go @@ -0,0 +1,9 @@ +package dto + +import ( + "time" +) + +type TimeCheckPk struct { + TimeCheckPk time.Time `db:"time_check_pk"` +} diff --git a/internal/integration_tests/mysql5/nulltypeprimitive/TimeDefConstUniqueCheckPk.go b/internal/integration_tests/mysql5/nulltypeprimitive/TimeDefConstUniqueCheckPk.go new file mode 100644 index 00000000..f9d70c06 --- /dev/null +++ b/internal/integration_tests/mysql5/nulltypeprimitive/TimeDefConstUniqueCheckPk.go @@ -0,0 +1,9 @@ +package dto + +import ( + "time" +) + +type TimeDefConstUniqueCheckPk struct { + TimeDefConstUniqueCheckPk time.Time `db:"time_def_const_unique_check_pk"` +} diff --git a/internal/integration_tests/mysql5/nulltypeprimitive/TimeDefConstUniqueCheckPkRef.go b/internal/integration_tests/mysql5/nulltypeprimitive/TimeDefConstUniqueCheckPkRef.go new file mode 100644 index 00000000..227c15c5 --- /dev/null +++ b/internal/integration_tests/mysql5/nulltypeprimitive/TimeDefConstUniqueCheckPkRef.go @@ -0,0 +1,9 @@ +package dto + +import ( + "time" +) + +type TimeDefConstUniqueCheckPkRef struct { + TimeDefConstUniqueCheckPkRef time.Time `db:"time_def_const_unique_check_pk_ref"` +} diff --git a/internal/integration_tests/mysql5/nulltypeprimitive/TimeDefFuncUniqueCheckPk.go b/internal/integration_tests/mysql5/nulltypeprimitive/TimeDefFuncUniqueCheckPk.go new file mode 100644 index 00000000..5058c3c9 --- /dev/null +++ b/internal/integration_tests/mysql5/nulltypeprimitive/TimeDefFuncUniqueCheckPk.go @@ -0,0 +1,9 @@ +package dto + +import ( + "time" +) + +type TimeDefFuncUniqueCheckPk struct { + TimeDefFuncUniqueCheckPk time.Time `db:"time_def_func_unique_check_pk"` +} diff --git a/internal/integration_tests/mysql5/nulltypeprimitive/TimeDefFuncUniqueCheckPkRef.go b/internal/integration_tests/mysql5/nulltypeprimitive/TimeDefFuncUniqueCheckPkRef.go new file mode 100644 index 00000000..c07b24c2 --- /dev/null +++ b/internal/integration_tests/mysql5/nulltypeprimitive/TimeDefFuncUniqueCheckPkRef.go @@ -0,0 +1,9 @@ +package dto + +import ( + "time" +) + +type TimeDefFuncUniqueCheckPkRef struct { + TimeDefFuncUniqueCheckPkRef time.Time `db:"time_def_func_unique_check_pk_ref"` +} diff --git a/internal/integration_tests/mysql5/nulltypeprimitive/TimeNnPk.go b/internal/integration_tests/mysql5/nulltypeprimitive/TimeNnPk.go new file mode 100644 index 00000000..9b53ef52 --- /dev/null +++ b/internal/integration_tests/mysql5/nulltypeprimitive/TimeNnPk.go @@ -0,0 +1,9 @@ +package dto + +import ( + "time" +) + +type TimeNnPk struct { + TimeNnPk time.Time `db:"time_nn_pk"` +} diff --git a/internal/integration_tests/mysql5/nulltypeprimitive/TimeNnUniqueCheckPk.go b/internal/integration_tests/mysql5/nulltypeprimitive/TimeNnUniqueCheckPk.go new file mode 100644 index 00000000..ab75df92 --- /dev/null +++ b/internal/integration_tests/mysql5/nulltypeprimitive/TimeNnUniqueCheckPk.go @@ -0,0 +1,9 @@ +package dto + +import ( + "time" +) + +type TimeNnUniqueCheckPk struct { + TimeNnUniqueCheckPk time.Time `db:"time_nn_unique_check_pk"` +} diff --git a/internal/integration_tests/mysql5/nulltypeprimitive/TimeNnUniqueCheckPkRef.go b/internal/integration_tests/mysql5/nulltypeprimitive/TimeNnUniqueCheckPkRef.go new file mode 100644 index 00000000..37926bf8 --- /dev/null +++ b/internal/integration_tests/mysql5/nulltypeprimitive/TimeNnUniqueCheckPkRef.go @@ -0,0 +1,9 @@ +package dto + +import ( + "time" +) + +type TimeNnUniqueCheckPkRef struct { + TimeNnUniqueCheckPkRef time.Time `db:"time_nn_unique_check_pk_ref"` +} diff --git a/internal/integration_tests/mysql5/nulltypeprimitive/TimePk.go b/internal/integration_tests/mysql5/nulltypeprimitive/TimePk.go new file mode 100644 index 00000000..4cb08dc4 --- /dev/null +++ b/internal/integration_tests/mysql5/nulltypeprimitive/TimePk.go @@ -0,0 +1,9 @@ +package dto + +import ( + "time" +) + +type TimePk struct { + TimePk time.Time `db:"time_pk"` +} diff --git a/internal/integration_tests/mysql5/nulltypeprimitive/TimePkDefConst.go b/internal/integration_tests/mysql5/nulltypeprimitive/TimePkDefConst.go new file mode 100644 index 00000000..7f119e6f --- /dev/null +++ b/internal/integration_tests/mysql5/nulltypeprimitive/TimePkDefConst.go @@ -0,0 +1,9 @@ +package dto + +import ( + "time" +) + +type TimePkDefConst struct { + TimePkDefConst time.Time `db:"time_pk_def_const"` +} diff --git a/internal/integration_tests/mysql5/nulltypeprimitive/TimePkDefFunc.go b/internal/integration_tests/mysql5/nulltypeprimitive/TimePkDefFunc.go new file mode 100644 index 00000000..6b5c04c3 --- /dev/null +++ b/internal/integration_tests/mysql5/nulltypeprimitive/TimePkDefFunc.go @@ -0,0 +1,9 @@ +package dto + +import ( + "time" +) + +type TimePkDefFunc struct { + TimePkDefFunc time.Time `db:"time_pk_def_func"` +} diff --git a/internal/integration_tests/mysql5/nulltypeprimitive/TimePkRef.go b/internal/integration_tests/mysql5/nulltypeprimitive/TimePkRef.go new file mode 100644 index 00000000..f2f24a81 --- /dev/null +++ b/internal/integration_tests/mysql5/nulltypeprimitive/TimePkRef.go @@ -0,0 +1,9 @@ +package dto + +import ( + "time" +) + +type TimePkRef struct { + TimePkRef time.Time `db:"time_pk_ref"` +} diff --git a/internal/integration_tests/mysql5/nulltypeprimitive/TimeRef.go b/internal/integration_tests/mysql5/nulltypeprimitive/TimeRef.go new file mode 100644 index 00000000..5b80230f --- /dev/null +++ b/internal/integration_tests/mysql5/nulltypeprimitive/TimeRef.go @@ -0,0 +1,9 @@ +package dto + +import ( + "time" +) + +type TimeRef struct { + TimeRef *time.Time `db:"time_ref"` +} diff --git a/internal/integration_tests/mysql5/nulltypeprimitive/TimeTable.go b/internal/integration_tests/mysql5/nulltypeprimitive/TimeTable.go new file mode 100644 index 00000000..a0c2101d --- /dev/null +++ b/internal/integration_tests/mysql5/nulltypeprimitive/TimeTable.go @@ -0,0 +1,31 @@ +package dto + +import ( + "time" +) + +type TimeTable struct { + Time *time.Time `db:"time"` + TimeNn time.Time `db:"time_nn"` + TimeNnUnique time.Time `db:"time_nn_unique"` + TimeNnCheck time.Time `db:"time_nn_check"` + TimeNnRef time.Time `db:"time_nn_ref"` + TimeNnDefConst time.Time `db:"time_nn_def_const"` + TimeNnDefFunc time.Time `db:"time_nn_def_func"` + TimeNnUniqueCheck time.Time `db:"time_nn_unique_check"` + TimeUnique *time.Time `db:"time_unique"` + TimeUniqueCheck *time.Time `db:"time_unique_check"` + TimeUniqueRef *time.Time `db:"time_unique_ref"` + TimeUniqueDefConst *time.Time `db:"time_unique_def_const"` + TimeUniqueDefFunc *time.Time `db:"time_unique_def_func"` + TimeCheck *time.Time `db:"time_check"` + TimeCheckRef *time.Time `db:"time_check_ref"` + TimeCheckDefConst *time.Time `db:"time_check_def_const"` + TimeCheckDefFunc *time.Time `db:"time_check_def_func"` + TimeRef *time.Time `db:"time_ref"` + TimeRefUniqueCheck *time.Time `db:"time_ref_unique_check"` + TimeDefConst *time.Time `db:"time_def_const"` + TimeDefConstUniqueCheck *time.Time `db:"time_def_const_unique_check"` + TimeDefFunc *time.Time `db:"time_def_func"` + TimeDefFuncUniqueCheck *time.Time `db:"time_def_func_unique_check"` +} diff --git a/internal/integration_tests/mysql5/nulltypeprimitive/TimeUniqueCheckPk.go b/internal/integration_tests/mysql5/nulltypeprimitive/TimeUniqueCheckPk.go new file mode 100644 index 00000000..24140cb6 --- /dev/null +++ b/internal/integration_tests/mysql5/nulltypeprimitive/TimeUniqueCheckPk.go @@ -0,0 +1,9 @@ +package dto + +import ( + "time" +) + +type TimeUniqueCheckPk struct { + TimeUniqueCheckPk time.Time `db:"time_unique_check_pk"` +} diff --git a/internal/integration_tests/mysql5/nulltypeprimitive/TimeUniqueCheckPkRef.go b/internal/integration_tests/mysql5/nulltypeprimitive/TimeUniqueCheckPkRef.go new file mode 100644 index 00000000..4772a2c9 --- /dev/null +++ b/internal/integration_tests/mysql5/nulltypeprimitive/TimeUniqueCheckPkRef.go @@ -0,0 +1,9 @@ +package dto + +import ( + "time" +) + +type TimeUniqueCheckPkRef struct { + TimeUniqueCheckPkRef time.Time `db:"time_unique_check_pk_ref"` +} diff --git a/internal/integration_tests/mysql5/nulltypeprimitive/TimeUniquePk.go b/internal/integration_tests/mysql5/nulltypeprimitive/TimeUniquePk.go new file mode 100644 index 00000000..4a5a293b --- /dev/null +++ b/internal/integration_tests/mysql5/nulltypeprimitive/TimeUniquePk.go @@ -0,0 +1,9 @@ +package dto + +import ( + "time" +) + +type TimeUniquePk struct { + TimeUniquePk time.Time `db:"time_unique_pk"` +} diff --git a/internal/integration_tests/mysql5/nulltypeprimitive/TimestampCheckPk.go b/internal/integration_tests/mysql5/nulltypeprimitive/TimestampCheckPk.go new file mode 100644 index 00000000..11d9aac0 --- /dev/null +++ b/internal/integration_tests/mysql5/nulltypeprimitive/TimestampCheckPk.go @@ -0,0 +1,9 @@ +package dto + +import ( + "time" +) + +type TimestampCheckPk struct { + TimestampCheckPk time.Time `db:"timestamp_check_pk"` +} diff --git a/internal/integration_tests/mysql5/nulltypeprimitive/TimestampDefConstUniqueCheckPk.go b/internal/integration_tests/mysql5/nulltypeprimitive/TimestampDefConstUniqueCheckPk.go new file mode 100644 index 00000000..76291a17 --- /dev/null +++ b/internal/integration_tests/mysql5/nulltypeprimitive/TimestampDefConstUniqueCheckPk.go @@ -0,0 +1,9 @@ +package dto + +import ( + "time" +) + +type TimestampDefConstUniqueCheckPk struct { + TimestampDefConstUniqueCheckPk time.Time `db:"timestamp_def_const_unique_check_pk"` +} diff --git a/internal/integration_tests/mysql5/nulltypeprimitive/TimestampDefConstUniqueCheckPkRef.go b/internal/integration_tests/mysql5/nulltypeprimitive/TimestampDefConstUniqueCheckPkRef.go new file mode 100644 index 00000000..b5bd7f6d --- /dev/null +++ b/internal/integration_tests/mysql5/nulltypeprimitive/TimestampDefConstUniqueCheckPkRef.go @@ -0,0 +1,9 @@ +package dto + +import ( + "time" +) + +type TimestampDefConstUniqueCheckPkRef struct { + TimestampDefConstUniqueCheckPkRef time.Time `db:"timestamp_def_const_unique_check_pk_ref"` +} diff --git a/internal/integration_tests/mysql5/nulltypeprimitive/TimestampDefFuncUniqueCheckPk.go b/internal/integration_tests/mysql5/nulltypeprimitive/TimestampDefFuncUniqueCheckPk.go new file mode 100644 index 00000000..07987edb --- /dev/null +++ b/internal/integration_tests/mysql5/nulltypeprimitive/TimestampDefFuncUniqueCheckPk.go @@ -0,0 +1,9 @@ +package dto + +import ( + "time" +) + +type TimestampDefFuncUniqueCheckPk struct { + TimestampDefFuncUniqueCheckPk time.Time `db:"timestamp_def_func_unique_check_pk"` +} diff --git a/internal/integration_tests/mysql5/nulltypeprimitive/TimestampDefFuncUniqueCheckPkRef.go b/internal/integration_tests/mysql5/nulltypeprimitive/TimestampDefFuncUniqueCheckPkRef.go new file mode 100644 index 00000000..db425463 --- /dev/null +++ b/internal/integration_tests/mysql5/nulltypeprimitive/TimestampDefFuncUniqueCheckPkRef.go @@ -0,0 +1,9 @@ +package dto + +import ( + "time" +) + +type TimestampDefFuncUniqueCheckPkRef struct { + TimestampDefFuncUniqueCheckPkRef time.Time `db:"timestamp_def_func_unique_check_pk_ref"` +} diff --git a/internal/integration_tests/mysql5/nulltypeprimitive/TimestampNnPk.go b/internal/integration_tests/mysql5/nulltypeprimitive/TimestampNnPk.go new file mode 100644 index 00000000..24d62061 --- /dev/null +++ b/internal/integration_tests/mysql5/nulltypeprimitive/TimestampNnPk.go @@ -0,0 +1,9 @@ +package dto + +import ( + "time" +) + +type TimestampNnPk struct { + TimestampNnPk time.Time `db:"timestamp_nn_pk"` +} diff --git a/internal/integration_tests/mysql5/nulltypeprimitive/TimestampNnUniqueCheckPk.go b/internal/integration_tests/mysql5/nulltypeprimitive/TimestampNnUniqueCheckPk.go new file mode 100644 index 00000000..21ae8031 --- /dev/null +++ b/internal/integration_tests/mysql5/nulltypeprimitive/TimestampNnUniqueCheckPk.go @@ -0,0 +1,9 @@ +package dto + +import ( + "time" +) + +type TimestampNnUniqueCheckPk struct { + TimestampNnUniqueCheckPk time.Time `db:"timestamp_nn_unique_check_pk"` +} diff --git a/internal/integration_tests/mysql5/nulltypeprimitive/TimestampNnUniqueCheckPkRef.go b/internal/integration_tests/mysql5/nulltypeprimitive/TimestampNnUniqueCheckPkRef.go new file mode 100644 index 00000000..1c20c377 --- /dev/null +++ b/internal/integration_tests/mysql5/nulltypeprimitive/TimestampNnUniqueCheckPkRef.go @@ -0,0 +1,9 @@ +package dto + +import ( + "time" +) + +type TimestampNnUniqueCheckPkRef struct { + TimestampNnUniqueCheckPkRef time.Time `db:"timestamp_nn_unique_check_pk_ref"` +} diff --git a/internal/integration_tests/mysql5/nulltypeprimitive/TimestampPk.go b/internal/integration_tests/mysql5/nulltypeprimitive/TimestampPk.go new file mode 100644 index 00000000..5c10b8d9 --- /dev/null +++ b/internal/integration_tests/mysql5/nulltypeprimitive/TimestampPk.go @@ -0,0 +1,9 @@ +package dto + +import ( + "time" +) + +type TimestampPk struct { + TimestampPk time.Time `db:"timestamp_pk"` +} diff --git a/internal/integration_tests/mysql5/nulltypeprimitive/TimestampPkDefConst.go b/internal/integration_tests/mysql5/nulltypeprimitive/TimestampPkDefConst.go new file mode 100644 index 00000000..1aae107b --- /dev/null +++ b/internal/integration_tests/mysql5/nulltypeprimitive/TimestampPkDefConst.go @@ -0,0 +1,9 @@ +package dto + +import ( + "time" +) + +type TimestampPkDefConst struct { + TimestampPkDefConst time.Time `db:"timestamp_pk_def_const"` +} diff --git a/internal/integration_tests/mysql5/nulltypeprimitive/TimestampPkDefFunc.go b/internal/integration_tests/mysql5/nulltypeprimitive/TimestampPkDefFunc.go new file mode 100644 index 00000000..2e17c253 --- /dev/null +++ b/internal/integration_tests/mysql5/nulltypeprimitive/TimestampPkDefFunc.go @@ -0,0 +1,9 @@ +package dto + +import ( + "time" +) + +type TimestampPkDefFunc struct { + TimestampPkDefFunc time.Time `db:"timestamp_pk_def_func"` +} diff --git a/internal/integration_tests/mysql5/nulltypeprimitive/TimestampPkRef.go b/internal/integration_tests/mysql5/nulltypeprimitive/TimestampPkRef.go new file mode 100644 index 00000000..c36c99c4 --- /dev/null +++ b/internal/integration_tests/mysql5/nulltypeprimitive/TimestampPkRef.go @@ -0,0 +1,9 @@ +package dto + +import ( + "time" +) + +type TimestampPkRef struct { + TimestampPkRef time.Time `db:"timestamp_pk_ref"` +} diff --git a/internal/integration_tests/mysql5/nulltypeprimitive/TimestampRef.go b/internal/integration_tests/mysql5/nulltypeprimitive/TimestampRef.go new file mode 100644 index 00000000..c69f434a --- /dev/null +++ b/internal/integration_tests/mysql5/nulltypeprimitive/TimestampRef.go @@ -0,0 +1,9 @@ +package dto + +import ( + "time" +) + +type TimestampRef struct { + TimestampRef time.Time `db:"timestamp_ref"` +} diff --git a/internal/integration_tests/mysql5/nulltypeprimitive/TimestampTable.go b/internal/integration_tests/mysql5/nulltypeprimitive/TimestampTable.go new file mode 100644 index 00000000..d2135479 --- /dev/null +++ b/internal/integration_tests/mysql5/nulltypeprimitive/TimestampTable.go @@ -0,0 +1,31 @@ +package dto + +import ( + "time" +) + +type TimestampTable struct { + Timestamp time.Time `db:"timestamp"` + TimestampNn time.Time `db:"timestamp_nn"` + TimestampNnUnique time.Time `db:"timestamp_nn_unique"` + TimestampNnCheck time.Time `db:"timestamp_nn_check"` + TimestampNnRef time.Time `db:"timestamp_nn_ref"` + TimestampNnDefConst time.Time `db:"timestamp_nn_def_const"` + TimestampNnDefFunc time.Time `db:"timestamp_nn_def_func"` + TimestampNnUniqueCheck time.Time `db:"timestamp_nn_unique_check"` + TimestampUnique time.Time `db:"timestamp_unique"` + TimestampUniqueCheck time.Time `db:"timestamp_unique_check"` + TimestampUniqueRef time.Time `db:"timestamp_unique_ref"` + TimestampUniqueDefConst time.Time `db:"timestamp_unique_def_const"` + TimestampUniqueDefFunc time.Time `db:"timestamp_unique_def_func"` + TimestampCheck time.Time `db:"timestamp_check"` + TimestampCheckRef time.Time `db:"timestamp_check_ref"` + TimestampCheckDefConst time.Time `db:"timestamp_check_def_const"` + TimestampCheckDefFunc time.Time `db:"timestamp_check_def_func"` + TimestampRef time.Time `db:"timestamp_ref"` + TimestampRefUniqueCheck time.Time `db:"timestamp_ref_unique_check"` + TimestampDefConst time.Time `db:"timestamp_def_const"` + TimestampDefConstUniqueCheck time.Time `db:"timestamp_def_const_unique_check"` + TimestampDefFunc time.Time `db:"timestamp_def_func"` + TimestampDefFuncUniqueCheck time.Time `db:"timestamp_def_func_unique_check"` +} diff --git a/internal/integration_tests/mysql5/nulltypeprimitive/TimestampUniqueCheckPk.go b/internal/integration_tests/mysql5/nulltypeprimitive/TimestampUniqueCheckPk.go new file mode 100644 index 00000000..af5f08ff --- /dev/null +++ b/internal/integration_tests/mysql5/nulltypeprimitive/TimestampUniqueCheckPk.go @@ -0,0 +1,9 @@ +package dto + +import ( + "time" +) + +type TimestampUniqueCheckPk struct { + TimestampUniqueCheckPk time.Time `db:"timestamp_unique_check_pk"` +} diff --git a/internal/integration_tests/mysql5/nulltypeprimitive/TimestampUniqueCheckPkRef.go b/internal/integration_tests/mysql5/nulltypeprimitive/TimestampUniqueCheckPkRef.go new file mode 100644 index 00000000..a3880c53 --- /dev/null +++ b/internal/integration_tests/mysql5/nulltypeprimitive/TimestampUniqueCheckPkRef.go @@ -0,0 +1,9 @@ +package dto + +import ( + "time" +) + +type TimestampUniqueCheckPkRef struct { + TimestampUniqueCheckPkRef time.Time `db:"timestamp_unique_check_pk_ref"` +} diff --git a/internal/integration_tests/mysql5/nulltypeprimitive/TimestampUniquePk.go b/internal/integration_tests/mysql5/nulltypeprimitive/TimestampUniquePk.go new file mode 100644 index 00000000..6ef3e9ee --- /dev/null +++ b/internal/integration_tests/mysql5/nulltypeprimitive/TimestampUniquePk.go @@ -0,0 +1,9 @@ +package dto + +import ( + "time" +) + +type TimestampUniquePk struct { + TimestampUniquePk time.Time `db:"timestamp_unique_pk"` +} diff --git a/internal/integration_tests/mysql5/nulltypeprimitive/TinyblobRef.go b/internal/integration_tests/mysql5/nulltypeprimitive/TinyblobRef.go new file mode 100644 index 00000000..4bf6bb24 --- /dev/null +++ b/internal/integration_tests/mysql5/nulltypeprimitive/TinyblobRef.go @@ -0,0 +1,5 @@ +package dto + +type TinyblobRef struct { + TinyblobRef string `db:"tinyblob_ref"` +} diff --git a/internal/integration_tests/mysql5/nulltypeprimitive/TinyblobTable.go b/internal/integration_tests/mysql5/nulltypeprimitive/TinyblobTable.go new file mode 100644 index 00000000..9c25b2e4 --- /dev/null +++ b/internal/integration_tests/mysql5/nulltypeprimitive/TinyblobTable.go @@ -0,0 +1,18 @@ +package dto + +type TinyblobTable struct { + Col *string `db:"col"` + TinyblobDefConst *string `db:"tinyblob_def_const"` + TinyblobDefFunc *string `db:"tinyblob_def_func"` + TinyblobRef *string `db:"tinyblob_ref"` + TinyblobNn string `db:"tinyblob_nn"` + TinyblobNnCheckCmp string `db:"tinyblob_nn_check_cmp"` + TinyblobNnCheckFn string `db:"tinyblob_nn_check_fn"` + TinyblobNnRef string `db:"tinyblob_nn_ref"` + TinyblobNnDefConst string `db:"tinyblob_nn_def_const"` + TinyblobNnDefFunc string `db:"tinyblob_nn_def_func"` + TinyblobCheck *string `db:"tinyblob_check"` + TinyblobCheckRef *string `db:"tinyblob_check_ref"` + TinyblobCheckDefConst *string `db:"tinyblob_check_def_const"` + TinyblobCheckDefFunc *string `db:"tinyblob_check_def_func"` +} diff --git a/internal/integration_tests/mysql5/nulltypeprimitive/TinyintCheckPk.go b/internal/integration_tests/mysql5/nulltypeprimitive/TinyintCheckPk.go new file mode 100644 index 00000000..c99bf0f9 --- /dev/null +++ b/internal/integration_tests/mysql5/nulltypeprimitive/TinyintCheckPk.go @@ -0,0 +1,5 @@ +package dto + +type TinyintCheckPk struct { + TinyintCheckPk int `db:"tinyint_check_pk"` +} diff --git a/internal/integration_tests/mysql5/nulltypeprimitive/TinyintDefConstUniqueCheckPk.go b/internal/integration_tests/mysql5/nulltypeprimitive/TinyintDefConstUniqueCheckPk.go new file mode 100644 index 00000000..7ffc4928 --- /dev/null +++ b/internal/integration_tests/mysql5/nulltypeprimitive/TinyintDefConstUniqueCheckPk.go @@ -0,0 +1,5 @@ +package dto + +type TinyintDefConstUniqueCheckPk struct { + TinyintDefConstUniqueCheckPk int `db:"tinyint_def_const_unique_check_pk"` +} diff --git a/internal/integration_tests/mysql5/nulltypeprimitive/TinyintDefConstUniqueCheckPkRef.go b/internal/integration_tests/mysql5/nulltypeprimitive/TinyintDefConstUniqueCheckPkRef.go new file mode 100644 index 00000000..0d5bf10c --- /dev/null +++ b/internal/integration_tests/mysql5/nulltypeprimitive/TinyintDefConstUniqueCheckPkRef.go @@ -0,0 +1,5 @@ +package dto + +type TinyintDefConstUniqueCheckPkRef struct { + TinyintDefConstUniqueCheckPkRef int `db:"tinyint_def_const_unique_check_pk_ref"` +} diff --git a/internal/integration_tests/mysql5/nulltypeprimitive/TinyintDefFuncUniqueCheckPk.go b/internal/integration_tests/mysql5/nulltypeprimitive/TinyintDefFuncUniqueCheckPk.go new file mode 100644 index 00000000..f2a64472 --- /dev/null +++ b/internal/integration_tests/mysql5/nulltypeprimitive/TinyintDefFuncUniqueCheckPk.go @@ -0,0 +1,5 @@ +package dto + +type TinyintDefFuncUniqueCheckPk struct { + TinyintDefFuncUniqueCheckPk int `db:"tinyint_def_func_unique_check_pk"` +} diff --git a/internal/integration_tests/mysql5/nulltypeprimitive/TinyintDefFuncUniqueCheckPkRef.go b/internal/integration_tests/mysql5/nulltypeprimitive/TinyintDefFuncUniqueCheckPkRef.go new file mode 100644 index 00000000..c11b6834 --- /dev/null +++ b/internal/integration_tests/mysql5/nulltypeprimitive/TinyintDefFuncUniqueCheckPkRef.go @@ -0,0 +1,5 @@ +package dto + +type TinyintDefFuncUniqueCheckPkRef struct { + TinyintDefFuncUniqueCheckPkRef int `db:"tinyint_def_func_unique_check_pk_ref"` +} diff --git a/internal/integration_tests/mysql5/nulltypeprimitive/TinyintNnPk.go b/internal/integration_tests/mysql5/nulltypeprimitive/TinyintNnPk.go new file mode 100644 index 00000000..8b38fdcf --- /dev/null +++ b/internal/integration_tests/mysql5/nulltypeprimitive/TinyintNnPk.go @@ -0,0 +1,5 @@ +package dto + +type TinyintNnPk struct { + TinyintNnPk int `db:"tinyint_nn_pk"` +} diff --git a/internal/integration_tests/mysql5/nulltypeprimitive/TinyintNnUniqueCheckPk.go b/internal/integration_tests/mysql5/nulltypeprimitive/TinyintNnUniqueCheckPk.go new file mode 100644 index 00000000..7551c68b --- /dev/null +++ b/internal/integration_tests/mysql5/nulltypeprimitive/TinyintNnUniqueCheckPk.go @@ -0,0 +1,5 @@ +package dto + +type TinyintNnUniqueCheckPk struct { + TinyintNnUniqueCheckPk int `db:"tinyint_nn_unique_check_pk"` +} diff --git a/internal/integration_tests/mysql5/nulltypeprimitive/TinyintNnUniqueCheckPkRef.go b/internal/integration_tests/mysql5/nulltypeprimitive/TinyintNnUniqueCheckPkRef.go new file mode 100644 index 00000000..63c61bce --- /dev/null +++ b/internal/integration_tests/mysql5/nulltypeprimitive/TinyintNnUniqueCheckPkRef.go @@ -0,0 +1,5 @@ +package dto + +type TinyintNnUniqueCheckPkRef struct { + TinyintNnUniqueCheckPkRef int `db:"tinyint_nn_unique_check_pk_ref"` +} diff --git a/internal/integration_tests/mysql5/nulltypeprimitive/TinyintPk.go b/internal/integration_tests/mysql5/nulltypeprimitive/TinyintPk.go new file mode 100644 index 00000000..02b30a86 --- /dev/null +++ b/internal/integration_tests/mysql5/nulltypeprimitive/TinyintPk.go @@ -0,0 +1,5 @@ +package dto + +type TinyintPk struct { + TinyintPk int `db:"tinyint_pk"` +} diff --git a/internal/integration_tests/mysql5/nulltypeprimitive/TinyintPkDefConst.go b/internal/integration_tests/mysql5/nulltypeprimitive/TinyintPkDefConst.go new file mode 100644 index 00000000..b9f15c15 --- /dev/null +++ b/internal/integration_tests/mysql5/nulltypeprimitive/TinyintPkDefConst.go @@ -0,0 +1,5 @@ +package dto + +type TinyintPkDefConst struct { + TinyintPkDefConst int `db:"tinyint_pk_def_const"` +} diff --git a/internal/integration_tests/mysql5/nulltypeprimitive/TinyintPkDefFunc.go b/internal/integration_tests/mysql5/nulltypeprimitive/TinyintPkDefFunc.go new file mode 100644 index 00000000..ee8d490a --- /dev/null +++ b/internal/integration_tests/mysql5/nulltypeprimitive/TinyintPkDefFunc.go @@ -0,0 +1,5 @@ +package dto + +type TinyintPkDefFunc struct { + TinyintPkDefFunc int `db:"tinyint_pk_def_func"` +} diff --git a/internal/integration_tests/mysql5/nulltypeprimitive/TinyintPkRef.go b/internal/integration_tests/mysql5/nulltypeprimitive/TinyintPkRef.go new file mode 100644 index 00000000..3f95dead --- /dev/null +++ b/internal/integration_tests/mysql5/nulltypeprimitive/TinyintPkRef.go @@ -0,0 +1,5 @@ +package dto + +type TinyintPkRef struct { + TinyintPkRef int `db:"tinyint_pk_ref"` +} diff --git a/internal/integration_tests/mysql5/nulltypeprimitive/TinyintRef.go b/internal/integration_tests/mysql5/nulltypeprimitive/TinyintRef.go new file mode 100644 index 00000000..423bac0c --- /dev/null +++ b/internal/integration_tests/mysql5/nulltypeprimitive/TinyintRef.go @@ -0,0 +1,5 @@ +package dto + +type TinyintRef struct { + TinyintRef *int `db:"tinyint_ref"` +} diff --git a/internal/integration_tests/mysql5/nulltypeprimitive/TinyintTable.go b/internal/integration_tests/mysql5/nulltypeprimitive/TinyintTable.go new file mode 100644 index 00000000..f6166ffe --- /dev/null +++ b/internal/integration_tests/mysql5/nulltypeprimitive/TinyintTable.go @@ -0,0 +1,23 @@ +package dto + +type TinyintTable struct { + I *int `db:"i"` + TinyintNn int `db:"tinyint_nn"` + TinyintNnUnique int `db:"tinyint_nn_unique"` + TinyintNnCheck int `db:"tinyint_nn_check"` + TinyintUnique *int `db:"tinyint_unique"` + TinyintUniqueCheck *int `db:"tinyint_unique_check"` + TinyintUniqueRef *int `db:"tinyint_unique_ref"` + TinyintUniqueDefConst *int `db:"tinyint_unique_def_const"` + TinyintUniqueDefFunc *int `db:"tinyint_unique_def_func"` + TinyintCheck *int `db:"tinyint_check"` + TinyintCheckRef *int `db:"tinyint_check_ref"` + TinyintCheckDefConst *int `db:"tinyint_check_def_const"` + TinyintCheckDefFunc *int `db:"tinyint_check_def_func"` + TinyintRef *int `db:"tinyint_ref"` + TinyintRefUniqueCheck *int `db:"tinyint_ref_unique_check"` + TinyintDefConst *int `db:"tinyint_def_const"` + TinyintDefConstUniqueCheck *int `db:"tinyint_def_const_unique_check"` + TinyintDefFunc *int `db:"tinyint_def_func"` + TinyintDefFuncUniqueCheck *int `db:"tinyint_def_func_unique_check"` +} diff --git a/internal/integration_tests/mysql5/nulltypeprimitive/TinyintUniqueCheckPk.go b/internal/integration_tests/mysql5/nulltypeprimitive/TinyintUniqueCheckPk.go new file mode 100644 index 00000000..8f43510d --- /dev/null +++ b/internal/integration_tests/mysql5/nulltypeprimitive/TinyintUniqueCheckPk.go @@ -0,0 +1,5 @@ +package dto + +type TinyintUniqueCheckPk struct { + TinyintUniqueCheckPk int `db:"tinyint_unique_check_pk"` +} diff --git a/internal/integration_tests/mysql5/nulltypeprimitive/TinyintUniqueCheckPkRef.go b/internal/integration_tests/mysql5/nulltypeprimitive/TinyintUniqueCheckPkRef.go new file mode 100644 index 00000000..65effa9b --- /dev/null +++ b/internal/integration_tests/mysql5/nulltypeprimitive/TinyintUniqueCheckPkRef.go @@ -0,0 +1,5 @@ +package dto + +type TinyintUniqueCheckPkRef struct { + TinyintUniqueCheckPkRef int `db:"tinyint_unique_check_pk_ref"` +} diff --git a/internal/integration_tests/mysql5/nulltypeprimitive/TinyintUniquePk.go b/internal/integration_tests/mysql5/nulltypeprimitive/TinyintUniquePk.go new file mode 100644 index 00000000..d134425d --- /dev/null +++ b/internal/integration_tests/mysql5/nulltypeprimitive/TinyintUniquePk.go @@ -0,0 +1,5 @@ +package dto + +type TinyintUniquePk struct { + TinyintUniquePk int `db:"tinyint_unique_pk"` +} diff --git a/internal/integration_tests/mysql5/nulltypeprimitive/TinytextRef.go b/internal/integration_tests/mysql5/nulltypeprimitive/TinytextRef.go new file mode 100644 index 00000000..4a76f7dd --- /dev/null +++ b/internal/integration_tests/mysql5/nulltypeprimitive/TinytextRef.go @@ -0,0 +1,5 @@ +package dto + +type TinytextRef struct { + TinytextRef string `db:"tinytext_ref"` +} diff --git a/internal/integration_tests/mysql5/nulltypeprimitive/TinytextTable.go b/internal/integration_tests/mysql5/nulltypeprimitive/TinytextTable.go new file mode 100644 index 00000000..aae7487f --- /dev/null +++ b/internal/integration_tests/mysql5/nulltypeprimitive/TinytextTable.go @@ -0,0 +1,18 @@ +package dto + +type TinytextTable struct { + Col *string `db:"col"` + TinytextDefConst *string `db:"tinytext_def_const"` + TinytextDefFunc *string `db:"tinytext_def_func"` + TinytextRef *string `db:"tinytext_ref"` + TinytextNn string `db:"tinytext_nn"` + TinytextNnCheckCmp string `db:"tinytext_nn_check_cmp"` + TinytextNnCheckFn string `db:"tinytext_nn_check_fn"` + TinytextNnRef string `db:"tinytext_nn_ref"` + TinytextNnDefConst string `db:"tinytext_nn_def_const"` + TinytextNnDefFunc string `db:"tinytext_nn_def_func"` + TinytextCheck *string `db:"tinytext_check"` + TinytextCheckRef *string `db:"tinytext_check_ref"` + TinytextCheckDefConst *string `db:"tinytext_check_def_const"` + TinytextCheckDefFunc *string `db:"tinytext_check_def_func"` +} diff --git a/internal/integration_tests/mysql5/nulltypeprimitive/VarbinaryCheckPk.go b/internal/integration_tests/mysql5/nulltypeprimitive/VarbinaryCheckPk.go new file mode 100644 index 00000000..ec1add83 --- /dev/null +++ b/internal/integration_tests/mysql5/nulltypeprimitive/VarbinaryCheckPk.go @@ -0,0 +1,5 @@ +package dto + +type VarbinaryCheckPk struct { + VarbinaryCheckPk string `db:"varbinary_check_pk"` +} diff --git a/internal/integration_tests/mysql5/nulltypeprimitive/VarbinaryDefConstUniqueCheckPk.go b/internal/integration_tests/mysql5/nulltypeprimitive/VarbinaryDefConstUniqueCheckPk.go new file mode 100644 index 00000000..405c5f62 --- /dev/null +++ b/internal/integration_tests/mysql5/nulltypeprimitive/VarbinaryDefConstUniqueCheckPk.go @@ -0,0 +1,5 @@ +package dto + +type VarbinaryDefConstUniqueCheckPk struct { + VarbinaryDefConstUniqueCheckPk string `db:"varbinary_def_const_unique_check_pk"` +} diff --git a/internal/integration_tests/mysql5/nulltypeprimitive/VarbinaryDefConstUniqueCheckPkRef.go b/internal/integration_tests/mysql5/nulltypeprimitive/VarbinaryDefConstUniqueCheckPkRef.go new file mode 100644 index 00000000..43fdd969 --- /dev/null +++ b/internal/integration_tests/mysql5/nulltypeprimitive/VarbinaryDefConstUniqueCheckPkRef.go @@ -0,0 +1,5 @@ +package dto + +type VarbinaryDefConstUniqueCheckPkRef struct { + VarbinaryDefConstUniqueCheckPkRef string `db:"varbinary_def_const_unique_check_pk_ref"` +} diff --git a/internal/integration_tests/mysql5/nulltypeprimitive/VarbinaryDefFuncUniqueCheckPk.go b/internal/integration_tests/mysql5/nulltypeprimitive/VarbinaryDefFuncUniqueCheckPk.go new file mode 100644 index 00000000..481a8606 --- /dev/null +++ b/internal/integration_tests/mysql5/nulltypeprimitive/VarbinaryDefFuncUniqueCheckPk.go @@ -0,0 +1,5 @@ +package dto + +type VarbinaryDefFuncUniqueCheckPk struct { + VarbinaryDefFuncUniqueCheckPk string `db:"varbinary_def_func_unique_check_pk"` +} diff --git a/internal/integration_tests/mysql5/nulltypeprimitive/VarbinaryDefFuncUniqueCheckPkRef.go b/internal/integration_tests/mysql5/nulltypeprimitive/VarbinaryDefFuncUniqueCheckPkRef.go new file mode 100644 index 00000000..78e363c7 --- /dev/null +++ b/internal/integration_tests/mysql5/nulltypeprimitive/VarbinaryDefFuncUniqueCheckPkRef.go @@ -0,0 +1,5 @@ +package dto + +type VarbinaryDefFuncUniqueCheckPkRef struct { + VarbinaryDefFuncUniqueCheckPkRef string `db:"varbinary_def_func_unique_check_pk_ref"` +} diff --git a/internal/integration_tests/mysql5/nulltypeprimitive/VarbinaryNnPk.go b/internal/integration_tests/mysql5/nulltypeprimitive/VarbinaryNnPk.go new file mode 100644 index 00000000..6e2231f1 --- /dev/null +++ b/internal/integration_tests/mysql5/nulltypeprimitive/VarbinaryNnPk.go @@ -0,0 +1,5 @@ +package dto + +type VarbinaryNnPk struct { + VarbinaryNnPk string `db:"varbinary_nn_pk"` +} diff --git a/internal/integration_tests/mysql5/nulltypeprimitive/VarbinaryNnUniqueCheckPk.go b/internal/integration_tests/mysql5/nulltypeprimitive/VarbinaryNnUniqueCheckPk.go new file mode 100644 index 00000000..54f19d70 --- /dev/null +++ b/internal/integration_tests/mysql5/nulltypeprimitive/VarbinaryNnUniqueCheckPk.go @@ -0,0 +1,5 @@ +package dto + +type VarbinaryNnUniqueCheckPk struct { + VarbinaryNnUniqueCheckPk string `db:"varbinary_nn_unique_check_pk"` +} diff --git a/internal/integration_tests/mysql5/nulltypeprimitive/VarbinaryNnUniqueCheckPkRef.go b/internal/integration_tests/mysql5/nulltypeprimitive/VarbinaryNnUniqueCheckPkRef.go new file mode 100644 index 00000000..f8170e58 --- /dev/null +++ b/internal/integration_tests/mysql5/nulltypeprimitive/VarbinaryNnUniqueCheckPkRef.go @@ -0,0 +1,5 @@ +package dto + +type VarbinaryNnUniqueCheckPkRef struct { + VarbinaryNnUniqueCheckPkRef string `db:"varbinary_nn_unique_check_pk_ref"` +} diff --git a/internal/integration_tests/mysql5/nulltypeprimitive/VarbinaryPk.go b/internal/integration_tests/mysql5/nulltypeprimitive/VarbinaryPk.go new file mode 100644 index 00000000..8250904d --- /dev/null +++ b/internal/integration_tests/mysql5/nulltypeprimitive/VarbinaryPk.go @@ -0,0 +1,5 @@ +package dto + +type VarbinaryPk struct { + VarbinaryPk string `db:"varbinary_pk"` +} diff --git a/internal/integration_tests/mysql5/nulltypeprimitive/VarbinaryPkDefConst.go b/internal/integration_tests/mysql5/nulltypeprimitive/VarbinaryPkDefConst.go new file mode 100644 index 00000000..579a26ed --- /dev/null +++ b/internal/integration_tests/mysql5/nulltypeprimitive/VarbinaryPkDefConst.go @@ -0,0 +1,5 @@ +package dto + +type VarbinaryPkDefConst struct { + VarbinaryPkDefConst string `db:"varbinary_pk_def_const"` +} diff --git a/internal/integration_tests/mysql5/nulltypeprimitive/VarbinaryPkDefFunc.go b/internal/integration_tests/mysql5/nulltypeprimitive/VarbinaryPkDefFunc.go new file mode 100644 index 00000000..2bf3817f --- /dev/null +++ b/internal/integration_tests/mysql5/nulltypeprimitive/VarbinaryPkDefFunc.go @@ -0,0 +1,5 @@ +package dto + +type VarbinaryPkDefFunc struct { + VarbinaryPkDefFunc string `db:"varbinary_pk_def_func"` +} diff --git a/internal/integration_tests/mysql5/nulltypeprimitive/VarbinaryPkRef.go b/internal/integration_tests/mysql5/nulltypeprimitive/VarbinaryPkRef.go new file mode 100644 index 00000000..d395a72d --- /dev/null +++ b/internal/integration_tests/mysql5/nulltypeprimitive/VarbinaryPkRef.go @@ -0,0 +1,5 @@ +package dto + +type VarbinaryPkRef struct { + VarbinaryPkRef string `db:"varbinary_pk_ref"` +} diff --git a/internal/integration_tests/mysql5/nulltypeprimitive/VarbinaryRef.go b/internal/integration_tests/mysql5/nulltypeprimitive/VarbinaryRef.go new file mode 100644 index 00000000..60528578 --- /dev/null +++ b/internal/integration_tests/mysql5/nulltypeprimitive/VarbinaryRef.go @@ -0,0 +1,5 @@ +package dto + +type VarbinaryRef struct { + VarbinaryRef *string `db:"varbinary_ref"` +} diff --git a/internal/integration_tests/mysql5/nulltypeprimitive/VarbinaryTable.go b/internal/integration_tests/mysql5/nulltypeprimitive/VarbinaryTable.go new file mode 100644 index 00000000..e3751435 --- /dev/null +++ b/internal/integration_tests/mysql5/nulltypeprimitive/VarbinaryTable.go @@ -0,0 +1,29 @@ +package dto + +type VarbinaryTable struct { + Col *string `db:"col"` + VarbinaryCap *string `db:"varbinary_cap"` + VarbinaryNn string `db:"varbinary_nn"` + VarbinaryNnUnique string `db:"varbinary_nn_unique"` + VarbinaryNnCheckCmp string `db:"varbinary_nn_check_cmp"` + VarbinaryNnCheckFn string `db:"varbinary_nn_check_fn"` + VarbinaryNnRef string `db:"varbinary_nn_ref"` + VarbinaryNnDefConst string `db:"varbinary_nn_def_const"` + VarbinaryNnDefFunc string `db:"varbinary_nn_def_func"` + VarbinaryNnUniqueCheck string `db:"varbinary_nn_unique_check"` + VarbinaryUnique *string `db:"varbinary_unique"` + VarbinaryUniqueCheck *string `db:"varbinary_unique_check"` + VarbinaryUniqueRef *string `db:"varbinary_unique_ref"` + VarbinaryUniqueDefConst *string `db:"varbinary_unique_def_const"` + VarbinaryUniqueDefFunc *string `db:"varbinary_unique_def_func"` + VarbinaryCheck *string `db:"varbinary_check"` + VarbinaryCheckRef *string `db:"varbinary_check_ref"` + VarbinaryCheckDefConst *string `db:"varbinary_check_def_const"` + VarbinaryCheckDefFunc *string `db:"varbinary_check_def_func"` + VarbinaryRef *string `db:"varbinary_ref"` + VarbinaryRefUniqueCheck *string `db:"varbinary_ref_unique_check"` + VarbinaryDefConst *string `db:"varbinary_def_const"` + VarbinaryDefConstUniqueCheck *string `db:"varbinary_def_const_unique_check"` + VarbinaryDefFunc *string `db:"varbinary_def_func"` + VarbinaryDefFuncUniqueCheck *string `db:"varbinary_def_func_unique_check"` +} diff --git a/internal/integration_tests/mysql5/nulltypeprimitive/VarbinaryUniqueCheckPk.go b/internal/integration_tests/mysql5/nulltypeprimitive/VarbinaryUniqueCheckPk.go new file mode 100644 index 00000000..cd74bfc8 --- /dev/null +++ b/internal/integration_tests/mysql5/nulltypeprimitive/VarbinaryUniqueCheckPk.go @@ -0,0 +1,5 @@ +package dto + +type VarbinaryUniqueCheckPk struct { + VarbinaryUniqueCheckPk string `db:"varbinary_unique_check_pk"` +} diff --git a/internal/integration_tests/mysql5/nulltypeprimitive/VarbinaryUniqueCheckPkRef.go b/internal/integration_tests/mysql5/nulltypeprimitive/VarbinaryUniqueCheckPkRef.go new file mode 100644 index 00000000..883c332d --- /dev/null +++ b/internal/integration_tests/mysql5/nulltypeprimitive/VarbinaryUniqueCheckPkRef.go @@ -0,0 +1,5 @@ +package dto + +type VarbinaryUniqueCheckPkRef struct { + VarbinaryUniqueCheckPkRef string `db:"varbinary_unique_check_pk_ref"` +} diff --git a/internal/integration_tests/mysql5/nulltypeprimitive/VarbinaryUniquePk.go b/internal/integration_tests/mysql5/nulltypeprimitive/VarbinaryUniquePk.go new file mode 100644 index 00000000..92816a2c --- /dev/null +++ b/internal/integration_tests/mysql5/nulltypeprimitive/VarbinaryUniquePk.go @@ -0,0 +1,5 @@ +package dto + +type VarbinaryUniquePk struct { + VarbinaryUniquePk string `db:"varbinary_unique_pk"` +} diff --git a/internal/integration_tests/mysql5/nulltypeprimitive/VarcharCheckPk.go b/internal/integration_tests/mysql5/nulltypeprimitive/VarcharCheckPk.go new file mode 100644 index 00000000..3f42d91f --- /dev/null +++ b/internal/integration_tests/mysql5/nulltypeprimitive/VarcharCheckPk.go @@ -0,0 +1,5 @@ +package dto + +type VarcharCheckPk struct { + VarcharCheckPk string `db:"varchar_check_pk"` +} diff --git a/internal/integration_tests/mysql5/nulltypeprimitive/VarcharDefConstUniqueCheckPk.go b/internal/integration_tests/mysql5/nulltypeprimitive/VarcharDefConstUniqueCheckPk.go new file mode 100644 index 00000000..b0c8f76b --- /dev/null +++ b/internal/integration_tests/mysql5/nulltypeprimitive/VarcharDefConstUniqueCheckPk.go @@ -0,0 +1,5 @@ +package dto + +type VarcharDefConstUniqueCheckPk struct { + VarcharDefConstUniqueCheckPk string `db:"varchar_def_const_unique_check_pk"` +} diff --git a/internal/integration_tests/mysql5/nulltypeprimitive/VarcharDefConstUniqueCheckPkRef.go b/internal/integration_tests/mysql5/nulltypeprimitive/VarcharDefConstUniqueCheckPkRef.go new file mode 100644 index 00000000..55840733 --- /dev/null +++ b/internal/integration_tests/mysql5/nulltypeprimitive/VarcharDefConstUniqueCheckPkRef.go @@ -0,0 +1,5 @@ +package dto + +type VarcharDefConstUniqueCheckPkRef struct { + VarcharDefConstUniqueCheckPkRef string `db:"varchar_def_const_unique_check_pk_ref"` +} diff --git a/internal/integration_tests/mysql5/nulltypeprimitive/VarcharDefFuncUniqueCheckPk.go b/internal/integration_tests/mysql5/nulltypeprimitive/VarcharDefFuncUniqueCheckPk.go new file mode 100644 index 00000000..eb63e5d1 --- /dev/null +++ b/internal/integration_tests/mysql5/nulltypeprimitive/VarcharDefFuncUniqueCheckPk.go @@ -0,0 +1,5 @@ +package dto + +type VarcharDefFuncUniqueCheckPk struct { + VarcharDefFuncUniqueCheckPk string `db:"varchar_def_func_unique_check_pk"` +} diff --git a/internal/integration_tests/mysql5/nulltypeprimitive/VarcharDefFuncUniqueCheckPkRef.go b/internal/integration_tests/mysql5/nulltypeprimitive/VarcharDefFuncUniqueCheckPkRef.go new file mode 100644 index 00000000..8b002629 --- /dev/null +++ b/internal/integration_tests/mysql5/nulltypeprimitive/VarcharDefFuncUniqueCheckPkRef.go @@ -0,0 +1,5 @@ +package dto + +type VarcharDefFuncUniqueCheckPkRef struct { + VarcharDefFuncUniqueCheckPkRef string `db:"varchar_def_func_unique_check_pk_ref"` +} diff --git a/internal/integration_tests/mysql5/nulltypeprimitive/VarcharNnPk.go b/internal/integration_tests/mysql5/nulltypeprimitive/VarcharNnPk.go new file mode 100644 index 00000000..b8364e86 --- /dev/null +++ b/internal/integration_tests/mysql5/nulltypeprimitive/VarcharNnPk.go @@ -0,0 +1,5 @@ +package dto + +type VarcharNnPk struct { + VarcharNnPk string `db:"varchar_nn_pk"` +} diff --git a/internal/integration_tests/mysql5/nulltypeprimitive/VarcharNnUniqueCheckPk.go b/internal/integration_tests/mysql5/nulltypeprimitive/VarcharNnUniqueCheckPk.go new file mode 100644 index 00000000..0a24372c --- /dev/null +++ b/internal/integration_tests/mysql5/nulltypeprimitive/VarcharNnUniqueCheckPk.go @@ -0,0 +1,5 @@ +package dto + +type VarcharNnUniqueCheckPk struct { + VarcharNnUniqueCheckPk string `db:"varchar_nn_unique_check_pk"` +} diff --git a/internal/integration_tests/mysql5/nulltypeprimitive/VarcharNnUniqueCheckPkRef.go b/internal/integration_tests/mysql5/nulltypeprimitive/VarcharNnUniqueCheckPkRef.go new file mode 100644 index 00000000..419161c0 --- /dev/null +++ b/internal/integration_tests/mysql5/nulltypeprimitive/VarcharNnUniqueCheckPkRef.go @@ -0,0 +1,5 @@ +package dto + +type VarcharNnUniqueCheckPkRef struct { + VarcharNnUniqueCheckPkRef string `db:"varchar_nn_unique_check_pk_ref"` +} diff --git a/internal/integration_tests/mysql5/nulltypeprimitive/VarcharPk.go b/internal/integration_tests/mysql5/nulltypeprimitive/VarcharPk.go new file mode 100644 index 00000000..d04cc77d --- /dev/null +++ b/internal/integration_tests/mysql5/nulltypeprimitive/VarcharPk.go @@ -0,0 +1,5 @@ +package dto + +type VarcharPk struct { + VarcharPk string `db:"varchar_pk"` +} diff --git a/internal/integration_tests/mysql5/nulltypeprimitive/VarcharPkDefConst.go b/internal/integration_tests/mysql5/nulltypeprimitive/VarcharPkDefConst.go new file mode 100644 index 00000000..2b5b3bce --- /dev/null +++ b/internal/integration_tests/mysql5/nulltypeprimitive/VarcharPkDefConst.go @@ -0,0 +1,5 @@ +package dto + +type VarcharPkDefConst struct { + VarcharPkDefConst string `db:"varchar_pk_def_const"` +} diff --git a/internal/integration_tests/mysql5/nulltypeprimitive/VarcharPkDefFunc.go b/internal/integration_tests/mysql5/nulltypeprimitive/VarcharPkDefFunc.go new file mode 100644 index 00000000..8e0d43b6 --- /dev/null +++ b/internal/integration_tests/mysql5/nulltypeprimitive/VarcharPkDefFunc.go @@ -0,0 +1,5 @@ +package dto + +type VarcharPkDefFunc struct { + VarcharPkDefFunc string `db:"varchar_pk_def_func"` +} diff --git a/internal/integration_tests/mysql5/nulltypeprimitive/VarcharPkRef.go b/internal/integration_tests/mysql5/nulltypeprimitive/VarcharPkRef.go new file mode 100644 index 00000000..1237c5d4 --- /dev/null +++ b/internal/integration_tests/mysql5/nulltypeprimitive/VarcharPkRef.go @@ -0,0 +1,5 @@ +package dto + +type VarcharPkRef struct { + VarcharPkRef string `db:"varchar_pk_ref"` +} diff --git a/internal/integration_tests/mysql5/nulltypeprimitive/VarcharRef.go b/internal/integration_tests/mysql5/nulltypeprimitive/VarcharRef.go new file mode 100644 index 00000000..2f7810a0 --- /dev/null +++ b/internal/integration_tests/mysql5/nulltypeprimitive/VarcharRef.go @@ -0,0 +1,5 @@ +package dto + +type VarcharRef struct { + VarcharRef *string `db:"varchar_ref"` +} diff --git a/internal/integration_tests/mysql5/nulltypeprimitive/VarcharTable.go b/internal/integration_tests/mysql5/nulltypeprimitive/VarcharTable.go new file mode 100644 index 00000000..42246b36 --- /dev/null +++ b/internal/integration_tests/mysql5/nulltypeprimitive/VarcharTable.go @@ -0,0 +1,29 @@ +package dto + +type VarcharTable struct { + Col *string `db:"col"` + VarcharCap *string `db:"varchar_cap"` + VarcharNn string `db:"varchar_nn"` + VarcharNnUnique string `db:"varchar_nn_unique"` + VarcharNnCheckCmp string `db:"varchar_nn_check_cmp"` + VarcharNnCheckFn string `db:"varchar_nn_check_fn"` + VarcharNnRef string `db:"varchar_nn_ref"` + VarcharNnDefConst string `db:"varchar_nn_def_const"` + VarcharNnDefFunc string `db:"varchar_nn_def_func"` + VarcharNnUniqueCheck string `db:"varchar_nn_unique_check"` + VarcharUnique *string `db:"varchar_unique"` + VarcharUniqueCheck *string `db:"varchar_unique_check"` + VarcharUniqueRef *string `db:"varchar_unique_ref"` + VarcharUniqueDefConst *string `db:"varchar_unique_def_const"` + VarcharUniqueDefFunc *string `db:"varchar_unique_def_func"` + VarcharCheck *string `db:"varchar_check"` + VarcharCheckRef *string `db:"varchar_check_ref"` + VarcharCheckDefConst *string `db:"varchar_check_def_const"` + VarcharCheckDefFunc *string `db:"varchar_check_def_func"` + VarcharRef *string `db:"varchar_ref"` + VarcharRefUniqueCheck *string `db:"varchar_ref_unique_check"` + VarcharDefConst *string `db:"varchar_def_const"` + VarcharDefConstUniqueCheck *string `db:"varchar_def_const_unique_check"` + VarcharDefFunc *string `db:"varchar_def_func"` + VarcharDefFuncUniqueCheck *string `db:"varchar_def_func_unique_check"` +} diff --git a/internal/integration_tests/mysql5/nulltypeprimitive/VarcharUniqueCheckPk.go b/internal/integration_tests/mysql5/nulltypeprimitive/VarcharUniqueCheckPk.go new file mode 100644 index 00000000..98513a8f --- /dev/null +++ b/internal/integration_tests/mysql5/nulltypeprimitive/VarcharUniqueCheckPk.go @@ -0,0 +1,5 @@ +package dto + +type VarcharUniqueCheckPk struct { + VarcharUniqueCheckPk string `db:"varchar_unique_check_pk"` +} diff --git a/internal/integration_tests/mysql5/nulltypeprimitive/VarcharUniqueCheckPkRef.go b/internal/integration_tests/mysql5/nulltypeprimitive/VarcharUniqueCheckPkRef.go new file mode 100644 index 00000000..9e078bac --- /dev/null +++ b/internal/integration_tests/mysql5/nulltypeprimitive/VarcharUniqueCheckPkRef.go @@ -0,0 +1,5 @@ +package dto + +type VarcharUniqueCheckPkRef struct { + VarcharUniqueCheckPkRef string `db:"varchar_unique_check_pk_ref"` +} diff --git a/internal/integration_tests/mysql5/nulltypeprimitive/VarcharUniquePk.go b/internal/integration_tests/mysql5/nulltypeprimitive/VarcharUniquePk.go new file mode 100644 index 00000000..66a68448 --- /dev/null +++ b/internal/integration_tests/mysql5/nulltypeprimitive/VarcharUniquePk.go @@ -0,0 +1,5 @@ +package dto + +type VarcharUniquePk struct { + VarcharUniquePk string `db:"varchar_unique_pk"` +} diff --git a/internal/integration_tests/mysql5/nulltypeprimitive/YearCheckPk.go b/internal/integration_tests/mysql5/nulltypeprimitive/YearCheckPk.go new file mode 100644 index 00000000..098cc2b7 --- /dev/null +++ b/internal/integration_tests/mysql5/nulltypeprimitive/YearCheckPk.go @@ -0,0 +1,9 @@ +package dto + +import ( + "time" +) + +type YearCheckPk struct { + YearCheckPk time.Time `db:"year_check_pk"` +} diff --git a/internal/integration_tests/mysql5/nulltypeprimitive/YearDefConstUniqueCheckPk.go b/internal/integration_tests/mysql5/nulltypeprimitive/YearDefConstUniqueCheckPk.go new file mode 100644 index 00000000..15ba8ad8 --- /dev/null +++ b/internal/integration_tests/mysql5/nulltypeprimitive/YearDefConstUniqueCheckPk.go @@ -0,0 +1,9 @@ +package dto + +import ( + "time" +) + +type YearDefConstUniqueCheckPk struct { + YearDefConstUniqueCheckPk time.Time `db:"year_def_const_unique_check_pk"` +} diff --git a/internal/integration_tests/mysql5/nulltypeprimitive/YearDefConstUniqueCheckPkRef.go b/internal/integration_tests/mysql5/nulltypeprimitive/YearDefConstUniqueCheckPkRef.go new file mode 100644 index 00000000..85043112 --- /dev/null +++ b/internal/integration_tests/mysql5/nulltypeprimitive/YearDefConstUniqueCheckPkRef.go @@ -0,0 +1,9 @@ +package dto + +import ( + "time" +) + +type YearDefConstUniqueCheckPkRef struct { + YearDefConstUniqueCheckPkRef time.Time `db:"year_def_const_unique_check_pk_ref"` +} diff --git a/internal/integration_tests/mysql5/nulltypeprimitive/YearDefFuncUniqueCheckPk.go b/internal/integration_tests/mysql5/nulltypeprimitive/YearDefFuncUniqueCheckPk.go new file mode 100644 index 00000000..4b6c7ad7 --- /dev/null +++ b/internal/integration_tests/mysql5/nulltypeprimitive/YearDefFuncUniqueCheckPk.go @@ -0,0 +1,9 @@ +package dto + +import ( + "time" +) + +type YearDefFuncUniqueCheckPk struct { + YearDefFuncUniqueCheckPk time.Time `db:"year_def_func_unique_check_pk"` +} diff --git a/internal/integration_tests/mysql5/nulltypeprimitive/YearDefFuncUniqueCheckPkRef.go b/internal/integration_tests/mysql5/nulltypeprimitive/YearDefFuncUniqueCheckPkRef.go new file mode 100644 index 00000000..ec31e106 --- /dev/null +++ b/internal/integration_tests/mysql5/nulltypeprimitive/YearDefFuncUniqueCheckPkRef.go @@ -0,0 +1,9 @@ +package dto + +import ( + "time" +) + +type YearDefFuncUniqueCheckPkRef struct { + YearDefFuncUniqueCheckPkRef time.Time `db:"year_def_func_unique_check_pk_ref"` +} diff --git a/internal/integration_tests/mysql5/nulltypeprimitive/YearNnPk.go b/internal/integration_tests/mysql5/nulltypeprimitive/YearNnPk.go new file mode 100644 index 00000000..806ee601 --- /dev/null +++ b/internal/integration_tests/mysql5/nulltypeprimitive/YearNnPk.go @@ -0,0 +1,9 @@ +package dto + +import ( + "time" +) + +type YearNnPk struct { + YearNnPk time.Time `db:"year_nn_pk"` +} diff --git a/internal/integration_tests/mysql5/nulltypeprimitive/YearNnUniqueCheckPk.go b/internal/integration_tests/mysql5/nulltypeprimitive/YearNnUniqueCheckPk.go new file mode 100644 index 00000000..390293e5 --- /dev/null +++ b/internal/integration_tests/mysql5/nulltypeprimitive/YearNnUniqueCheckPk.go @@ -0,0 +1,9 @@ +package dto + +import ( + "time" +) + +type YearNnUniqueCheckPk struct { + YearNnUniqueCheckPk time.Time `db:"year_nn_unique_check_pk"` +} diff --git a/internal/integration_tests/mysql5/nulltypeprimitive/YearNnUniqueCheckPkRef.go b/internal/integration_tests/mysql5/nulltypeprimitive/YearNnUniqueCheckPkRef.go new file mode 100644 index 00000000..29c667cd --- /dev/null +++ b/internal/integration_tests/mysql5/nulltypeprimitive/YearNnUniqueCheckPkRef.go @@ -0,0 +1,9 @@ +package dto + +import ( + "time" +) + +type YearNnUniqueCheckPkRef struct { + YearNnUniqueCheckPkRef time.Time `db:"year_nn_unique_check_pk_ref"` +} diff --git a/internal/integration_tests/mysql5/nulltypeprimitive/YearPk.go b/internal/integration_tests/mysql5/nulltypeprimitive/YearPk.go new file mode 100644 index 00000000..2dc02194 --- /dev/null +++ b/internal/integration_tests/mysql5/nulltypeprimitive/YearPk.go @@ -0,0 +1,9 @@ +package dto + +import ( + "time" +) + +type YearPk struct { + YearPk time.Time `db:"year_pk"` +} diff --git a/internal/integration_tests/mysql5/nulltypeprimitive/YearPkDefConst.go b/internal/integration_tests/mysql5/nulltypeprimitive/YearPkDefConst.go new file mode 100644 index 00000000..de1191fc --- /dev/null +++ b/internal/integration_tests/mysql5/nulltypeprimitive/YearPkDefConst.go @@ -0,0 +1,9 @@ +package dto + +import ( + "time" +) + +type YearPkDefConst struct { + YearPkDefConst time.Time `db:"year_pk_def_const"` +} diff --git a/internal/integration_tests/mysql5/nulltypeprimitive/YearPkDefFunc.go b/internal/integration_tests/mysql5/nulltypeprimitive/YearPkDefFunc.go new file mode 100644 index 00000000..fd1faf72 --- /dev/null +++ b/internal/integration_tests/mysql5/nulltypeprimitive/YearPkDefFunc.go @@ -0,0 +1,9 @@ +package dto + +import ( + "time" +) + +type YearPkDefFunc struct { + YearPkDefFunc time.Time `db:"year_pk_def_func"` +} diff --git a/internal/integration_tests/mysql5/nulltypeprimitive/YearPkRef.go b/internal/integration_tests/mysql5/nulltypeprimitive/YearPkRef.go new file mode 100644 index 00000000..a031e633 --- /dev/null +++ b/internal/integration_tests/mysql5/nulltypeprimitive/YearPkRef.go @@ -0,0 +1,9 @@ +package dto + +import ( + "time" +) + +type YearPkRef struct { + YearPkRef time.Time `db:"year_pk_ref"` +} diff --git a/internal/integration_tests/mysql5/nulltypeprimitive/YearRef.go b/internal/integration_tests/mysql5/nulltypeprimitive/YearRef.go new file mode 100644 index 00000000..7a41313b --- /dev/null +++ b/internal/integration_tests/mysql5/nulltypeprimitive/YearRef.go @@ -0,0 +1,9 @@ +package dto + +import ( + "time" +) + +type YearRef struct { + YearRef *time.Time `db:"year_ref"` +} diff --git a/internal/integration_tests/mysql5/nulltypeprimitive/YearTable.go b/internal/integration_tests/mysql5/nulltypeprimitive/YearTable.go new file mode 100644 index 00000000..146470b4 --- /dev/null +++ b/internal/integration_tests/mysql5/nulltypeprimitive/YearTable.go @@ -0,0 +1,31 @@ +package dto + +import ( + "time" +) + +type YearTable struct { + Year *time.Time `db:"year"` + YearNn time.Time `db:"year_nn"` + YearNnUnique time.Time `db:"year_nn_unique"` + YearNnCheck time.Time `db:"year_nn_check"` + YearNnRef time.Time `db:"year_nn_ref"` + YearNnDefConst time.Time `db:"year_nn_def_const"` + YearNnDefFunc time.Time `db:"year_nn_def_func"` + YearNnUniqueCheck time.Time `db:"year_nn_unique_check"` + YearUnique *time.Time `db:"year_unique"` + YearUniqueCheck *time.Time `db:"year_unique_check"` + YearUniqueRef *time.Time `db:"year_unique_ref"` + YearUniqueDefConst *time.Time `db:"year_unique_def_const"` + YearUniqueDefFunc *time.Time `db:"year_unique_def_func"` + YearCheck *time.Time `db:"year_check"` + YearCheckRef *time.Time `db:"year_check_ref"` + YearCheckDefConst *time.Time `db:"year_check_def_const"` + YearCheckDefFunc *time.Time `db:"year_check_def_func"` + YearRef *time.Time `db:"year_ref"` + YearRefUniqueCheck *time.Time `db:"year_ref_unique_check"` + YearDefConst *time.Time `db:"year_def_const"` + YearDefConstUniqueCheck *time.Time `db:"year_def_const_unique_check"` + YearDefFunc *time.Time `db:"year_def_func"` + YearDefFuncUniqueCheck *time.Time `db:"year_def_func_unique_check"` +} diff --git a/internal/integration_tests/mysql5/nulltypeprimitive/YearUniqueCheckPk.go b/internal/integration_tests/mysql5/nulltypeprimitive/YearUniqueCheckPk.go new file mode 100644 index 00000000..b677a138 --- /dev/null +++ b/internal/integration_tests/mysql5/nulltypeprimitive/YearUniqueCheckPk.go @@ -0,0 +1,9 @@ +package dto + +import ( + "time" +) + +type YearUniqueCheckPk struct { + YearUniqueCheckPk time.Time `db:"year_unique_check_pk"` +} diff --git a/internal/integration_tests/mysql5/nulltypeprimitive/YearUniqueCheckPkRef.go b/internal/integration_tests/mysql5/nulltypeprimitive/YearUniqueCheckPkRef.go new file mode 100644 index 00000000..798abf45 --- /dev/null +++ b/internal/integration_tests/mysql5/nulltypeprimitive/YearUniqueCheckPkRef.go @@ -0,0 +1,9 @@ +package dto + +import ( + "time" +) + +type YearUniqueCheckPkRef struct { + YearUniqueCheckPkRef time.Time `db:"year_unique_check_pk_ref"` +} diff --git a/internal/integration_tests/mysql5/nulltypeprimitive/YearUniquePk.go b/internal/integration_tests/mysql5/nulltypeprimitive/YearUniquePk.go new file mode 100644 index 00000000..beca6fda --- /dev/null +++ b/internal/integration_tests/mysql5/nulltypeprimitive/YearUniquePk.go @@ -0,0 +1,9 @@ +package dto + +import ( + "time" +) + +type YearUniquePk struct { + YearUniquePk time.Time `db:"year_unique_pk"` +} diff --git a/internal/integration_tests/mysql5/tablesflag/DatetimeTable.go b/internal/integration_tests/mysql5/tablesflag/DatetimeTable.go new file mode 100644 index 00000000..36b7bc40 --- /dev/null +++ b/internal/integration_tests/mysql5/tablesflag/DatetimeTable.go @@ -0,0 +1,32 @@ +package dto + +import ( + "database/sql" + "time" +) + +type DatetimeTable struct { + Datetime sql.NullTime `db:"datetime"` + DatetimeNn time.Time `db:"datetime_nn"` + DatetimeNnUnique time.Time `db:"datetime_nn_unique"` + DatetimeNnCheck time.Time `db:"datetime_nn_check"` + DatetimeNnRef time.Time `db:"datetime_nn_ref"` + DatetimeNnDefConst time.Time `db:"datetime_nn_def_const"` + DatetimeNnDefFunc time.Time `db:"datetime_nn_def_func"` + DatetimeNnUniqueCheck time.Time `db:"datetime_nn_unique_check"` + DatetimeUnique sql.NullTime `db:"datetime_unique"` + DatetimeUniqueCheck sql.NullTime `db:"datetime_unique_check"` + DatetimeUniqueRef sql.NullTime `db:"datetime_unique_ref"` + DatetimeUniqueDefConst sql.NullTime `db:"datetime_unique_def_const"` + DatetimeUniqueDefFunc sql.NullTime `db:"datetime_unique_def_func"` + DatetimeCheck sql.NullTime `db:"datetime_check"` + DatetimeCheckRef sql.NullTime `db:"datetime_check_ref"` + DatetimeCheckDefConst sql.NullTime `db:"datetime_check_def_const"` + DatetimeCheckDefFunc sql.NullTime `db:"datetime_check_def_func"` + DatetimeRef sql.NullTime `db:"datetime_ref"` + DatetimeRefUniqueCheck sql.NullTime `db:"datetime_ref_unique_check"` + DatetimeDefConst sql.NullTime `db:"datetime_def_const"` + DatetimeDefConstUniqueCheck sql.NullTime `db:"datetime_def_const_unique_check"` + DatetimeDefFunc sql.NullTime `db:"datetime_def_func"` + DatetimeDefFuncUniqueCheck sql.NullTime `db:"datetime_def_func_unique_check"` +} diff --git a/internal/integration_tests/mysql5/tablesflag/FloatTable.go b/internal/integration_tests/mysql5/tablesflag/FloatTable.go new file mode 100644 index 00000000..e0c1fd48 --- /dev/null +++ b/internal/integration_tests/mysql5/tablesflag/FloatTable.go @@ -0,0 +1,31 @@ +package dto + +import ( + "database/sql" +) + +type FloatTable struct { + Col sql.NullFloat64 `db:"col"` + FloatNn float64 `db:"float_nn"` + FloatNnUnique float64 `db:"float_nn_unique"` + FloatNnCheck float64 `db:"float_nn_check"` + FloatNnRef float64 `db:"float_nn_ref"` + FloatNnDefConst float64 `db:"float_nn_def_const"` + FloatNnDefFunc float64 `db:"float_nn_def_func"` + FloatNnUniqueCheck float64 `db:"float_nn_unique_check"` + FloatUnique sql.NullFloat64 `db:"float_unique"` + FloatUniqueCheck sql.NullFloat64 `db:"float_unique_check"` + FloatUniqueRef sql.NullFloat64 `db:"float_unique_ref"` + FloatUniqueDefConst sql.NullFloat64 `db:"float_unique_def_const"` + FloatUniqueDefFunc sql.NullFloat64 `db:"float_unique_def_func"` + FloatCheck sql.NullFloat64 `db:"float_check"` + FloatCheckRef sql.NullFloat64 `db:"float_check_ref"` + FloatCheckDefConst sql.NullFloat64 `db:"float_check_def_const"` + FloatCheckDefFunc sql.NullFloat64 `db:"float_check_def_func"` + FloatRef sql.NullFloat64 `db:"float_ref"` + FloatRefUniqueCheck sql.NullFloat64 `db:"float_ref_unique_check"` + FloatDefConst sql.NullFloat64 `db:"float_def_const"` + FloatDefConstUniqueCheck sql.NullFloat64 `db:"float_def_const_unique_check"` + FloatDefFunc sql.NullFloat64 `db:"float_def_func"` + FloatDefFuncUniqueCheck sql.NullFloat64 `db:"float_def_func_unique_check"` +} diff --git a/internal/integration_tests/mysql5/tablesflag/VarcharTable.go b/internal/integration_tests/mysql5/tablesflag/VarcharTable.go new file mode 100644 index 00000000..2a0f0084 --- /dev/null +++ b/internal/integration_tests/mysql5/tablesflag/VarcharTable.go @@ -0,0 +1,33 @@ +package dto + +import ( + "database/sql" +) + +type VarcharTable struct { + Col sql.NullString `db:"col"` + VarcharCap sql.NullString `db:"varchar_cap"` + VarcharNn string `db:"varchar_nn"` + VarcharNnUnique string `db:"varchar_nn_unique"` + VarcharNnCheckCmp string `db:"varchar_nn_check_cmp"` + VarcharNnCheckFn string `db:"varchar_nn_check_fn"` + VarcharNnRef string `db:"varchar_nn_ref"` + VarcharNnDefConst string `db:"varchar_nn_def_const"` + VarcharNnDefFunc string `db:"varchar_nn_def_func"` + VarcharNnUniqueCheck string `db:"varchar_nn_unique_check"` + VarcharUnique sql.NullString `db:"varchar_unique"` + VarcharUniqueCheck sql.NullString `db:"varchar_unique_check"` + VarcharUniqueRef sql.NullString `db:"varchar_unique_ref"` + VarcharUniqueDefConst sql.NullString `db:"varchar_unique_def_const"` + VarcharUniqueDefFunc sql.NullString `db:"varchar_unique_def_func"` + VarcharCheck sql.NullString `db:"varchar_check"` + VarcharCheckRef sql.NullString `db:"varchar_check_ref"` + VarcharCheckDefConst sql.NullString `db:"varchar_check_def_const"` + VarcharCheckDefFunc sql.NullString `db:"varchar_check_def_func"` + VarcharRef sql.NullString `db:"varchar_ref"` + VarcharRefUniqueCheck sql.NullString `db:"varchar_ref_unique_check"` + VarcharDefConst sql.NullString `db:"varchar_def_const"` + VarcharDefConstUniqueCheck sql.NullString `db:"varchar_def_const_unique_check"` + VarcharDefFunc sql.NullString `db:"varchar_def_func"` + VarcharDefFuncUniqueCheck sql.NullString `db:"varchar_def_func_unique_check"` +} diff --git a/internal/integration_tests/mysql5/testdata/bigint.sql b/internal/integration_tests/mysql5/testdata/bigint.sql new file mode 100644 index 00000000..d5f66c02 --- /dev/null +++ b/internal/integration_tests/mysql5/testdata/bigint.sql @@ -0,0 +1,124 @@ +DROP TABLE IF EXISTS bigint_ref CASCADE; +CREATE TABLE bigint_ref +( + bigint_ref bigint UNIQUE +); + +DROP TABLE IF EXISTS bigint_table; +CREATE TABLE bigint_table +( + i bigint, + bigint_nn bigint NOT NULL, + bigint_nn_unique bigint NOT NULL UNIQUE, + bigint_nn_check bigint NOT NULL, + + bigint_unique bigint UNIQUE, + bigint_unique_check bigint UNIQUE, + bigint_unique_ref bigint UNIQUE REFERENCES bigint_ref (bigint_ref), + bigint_unique_def_const bigint UNIQUE DEFAULT 42, + bigint_unique_def_func bigint UNIQUE DEFAULT 42, + + bigint_check bigint, + bigint_check_ref bigint REFERENCES bigint_ref (bigint_ref), + bigint_check_def_const bigint DEFAULT 42, + bigint_check_def_func bigint DEFAULT 42, + + bigint_ref bigint REFERENCES bigint_ref (bigint_ref), + bigint_ref_unique_check bigint UNIQUE REFERENCES bigint_ref (bigint_ref), + + bigint_def_const bigint DEFAULT 42, + bigint_def_const_unique_check bigint UNIQUE DEFAULT 42, + + bigint_def_func bigint DEFAULT 42, + bigint_def_func_unique_check bigint UNIQUE DEFAULT 42 +); + +DROP TABLE IF EXISTS bigint_pk; +CREATE TABLE bigint_pk +( + bigint_pk bigint PRIMARY KEY +); + +DROP TABLE IF EXISTS bigint_pk_ref; +CREATE TABLE bigint_pk_ref +( + bigint_pk_ref bigint PRIMARY KEY REFERENCES bigint_ref (bigint_ref) +); + +DROP TABLE IF EXISTS bigint_pk_def_const; +CREATE TABLE bigint_pk_def_const +( + bigint_pk_def_const bigint PRIMARY KEY DEFAULT 42 +); + +DROP TABLE IF EXISTS bigint_pk_def_func; +CREATE TABLE bigint_pk_def_func +( + bigint_pk_def_func bigint PRIMARY KEY DEFAULT 42 +); + +DROP TABLE IF EXISTS bigint_nn_pk; +CREATE TABLE bigint_nn_pk +( + bigint_nn_pk bigint NOT NULL PRIMARY KEY +); + +DROP TABLE IF EXISTS bigint_nn_unique_check_pk; +CREATE TABLE bigint_nn_unique_check_pk +( + bigint_nn_unique_check_pk bigint PRIMARY KEY NOT NULL UNIQUE +); + +DROP TABLE IF EXISTS bigint_nn_unique_check_pk_ref; +CREATE TABLE bigint_nn_unique_check_pk_ref +( + bigint_nn_unique_check_pk_ref bigint PRIMARY KEY NOT NULL UNIQUE REFERENCES bigint_ref (bigint_ref) +); + +DROP TABLE IF EXISTS bigint_unique_pk; +CREATE TABLE bigint_unique_pk +( + bigint_unique_pk bigint PRIMARY KEY UNIQUE +); + +DROP TABLE IF EXISTS bigint_unique_check_pk; +CREATE TABLE bigint_unique_check_pk +( + bigint_unique_check_pk bigint PRIMARY KEY UNIQUE +); + +DROP TABLE IF EXISTS bigint_unique_check_pk_ref; +CREATE TABLE bigint_unique_check_pk_ref +( + bigint_unique_check_pk_ref bigint PRIMARY KEY UNIQUE REFERENCES bigint_ref (bigint_ref) +); + +DROP TABLE IF EXISTS bigint_check_pk; +CREATE TABLE bigint_check_pk +( + bigint_check_pk bigint PRIMARY KEY +); + +DROP TABLE IF EXISTS bigint_def_const_unique_check_pk; +CREATE TABLE bigint_def_const_unique_check_pk +( + bigint_def_const_unique_check_pk bigint PRIMARY KEY UNIQUE DEFAULT 42 +); + +DROP TABLE IF EXISTS bigint_def_const_unique_check_pk_ref; +CREATE TABLE bigint_def_const_unique_check_pk_ref +( + bigint_def_const_unique_check_pk_ref bigint PRIMARY KEY UNIQUE DEFAULT 42 REFERENCES bigint_ref (bigint_ref) +); + +DROP TABLE IF EXISTS bigint_def_func_unique_check_pk; +CREATE TABLE bigint_def_func_unique_check_pk +( + bigint_def_func_unique_check_pk bigint PRIMARY KEY UNIQUE DEFAULT 42 +); + +DROP TABLE IF EXISTS bigint_def_func_unique_check_pk_ref; +CREATE TABLE bigint_def_func_unique_check_pk_ref +( + bigint_def_func_unique_check_pk_ref bigint PRIMARY KEY UNIQUE DEFAULT 42 REFERENCES bigint_ref (bigint_ref) +); diff --git a/internal/integration_tests/mysql5/testdata/binary.sql b/internal/integration_tests/mysql5/testdata/binary.sql new file mode 100644 index 00000000..43881c32 --- /dev/null +++ b/internal/integration_tests/mysql5/testdata/binary.sql @@ -0,0 +1,131 @@ +DROP TABLE IF EXISTS binary_ref CASCADE; +CREATE TABLE binary_ref +( + binary_ref binary UNIQUE +); + +DROP TABLE IF EXISTS binary_table; +CREATE TABLE binary_table +( + col binary, + + binary_cap binary(255), + binary_nn binary NOT NULL, + binary_nn_unique binary NOT NULL UNIQUE, + binary_nn_check_cmp binary NOT NULL, + binary_nn_check_fn binary NOT NULL, + binary_nn_ref binary NOT NULL REFERENCES binary_ref (binary_ref), + binary_nn_def_const binary NOT NULL DEFAULT '4', + binary_nn_def_func binary NOT NULL DEFAULT '5', + binary_nn_unique_check binary NOT NULL UNIQUE, + + binary_unique binary UNIQUE, + binary_unique_check binary UNIQUE, + binary_unique_ref binary UNIQUE REFERENCES binary_ref (binary_ref), + binary_unique_def_const binary UNIQUE DEFAULT '4', + binary_unique_def_func binary UNIQUE DEFAULT '5', + + binary_check binary, + binary_check_ref binary REFERENCES binary_ref (binary_ref), + binary_check_def_const binary DEFAULT '4', + binary_check_def_func binary DEFAULT '5', + + binary_ref binary REFERENCES binary_ref (binary_ref), + binary_ref_unique_check binary UNIQUE REFERENCES binary_ref (binary_ref), + + binary_def_const binary DEFAULT '4', + binary_def_const_unique_check binary UNIQUE DEFAULT '4', + + binary_def_func binary DEFAULT '5', + binary_def_func_unique_check binary UNIQUE DEFAULT '5' +); + +DROP TABLE IF EXISTS binary_pk; +CREATE TABLE binary_pk +( + binary_pk binary PRIMARY KEY +); + +DROP TABLE IF EXISTS binary_pk_ref; +CREATE TABLE binary_pk_ref +( + binary_pk_ref binary PRIMARY KEY REFERENCES binary_ref (binary_ref) +); + +DROP TABLE IF EXISTS binary_pk_def_const; +CREATE TABLE binary_pk_def_const +( + binary_pk_def_const binary PRIMARY KEY DEFAULT '4' +); + +DROP TABLE IF EXISTS binary_pk_def_func; +CREATE TABLE binary_pk_def_func +( + binary_pk_def_func binary PRIMARY KEY DEFAULT '5' +); + +DROP TABLE IF EXISTS binary_nn_pk; +CREATE TABLE binary_nn_pk +( + binary_nn_pk binary NOT NULL PRIMARY KEY +); + +DROP TABLE IF EXISTS binary_nn_unique_check_pk; +CREATE TABLE binary_nn_unique_check_pk +( + binary_nn_unique_check_pk binary PRIMARY KEY NOT NULL UNIQUE +); + +DROP TABLE IF EXISTS binary_nn_unique_check_pk_ref; +CREATE TABLE binary_nn_unique_check_pk_ref +( + binary_nn_unique_check_pk_ref binary PRIMARY KEY NOT NULL UNIQUE REFERENCES binary_ref (binary_ref) +); + +DROP TABLE IF EXISTS binary_unique_pk; +CREATE TABLE binary_unique_pk +( + binary_unique_pk binary PRIMARY KEY UNIQUE +); + +DROP TABLE IF EXISTS binary_unique_check_pk; +CREATE TABLE binary_unique_check_pk +( + binary_unique_check_pk binary PRIMARY KEY UNIQUE +); + +DROP TABLE IF EXISTS binary_unique_check_pk_ref; +CREATE TABLE binary_unique_check_pk_ref +( + binary_unique_check_pk_ref binary PRIMARY KEY UNIQUE REFERENCES binary_ref (binary_ref) +); + +DROP TABLE IF EXISTS binary_check_pk; +CREATE TABLE binary_check_pk +( + binary_check_pk binary PRIMARY KEY +); + +DROP TABLE IF EXISTS binary_def_const_unique_check_pk; +CREATE TABLE binary_def_const_unique_check_pk +( + binary_def_const_unique_check_pk binary PRIMARY KEY UNIQUE DEFAULT '4' +); + +DROP TABLE IF EXISTS binary_def_const_unique_check_pk_ref; +CREATE TABLE binary_def_const_unique_check_pk_ref +( + binary_def_const_unique_check_pk_ref binary PRIMARY KEY UNIQUE DEFAULT '4' REFERENCES binary_ref (binary_ref) +); + +DROP TABLE IF EXISTS binary_def_func_unique_check_pk; +CREATE TABLE binary_def_func_unique_check_pk +( + binary_def_func_unique_check_pk binary PRIMARY KEY UNIQUE DEFAULT '5' +); + +DROP TABLE IF EXISTS binary_def_func_unique_check_pk_ref; +CREATE TABLE binary_def_func_unique_check_pk_ref +( + binary_def_func_unique_check_pk_ref binary PRIMARY KEY UNIQUE DEFAULT '5' REFERENCES binary_ref (binary_ref) +); diff --git a/internal/integration_tests/mysql5/testdata/blob.sql b/internal/integration_tests/mysql5/testdata/blob.sql new file mode 100644 index 00000000..f2c4f95c --- /dev/null +++ b/internal/integration_tests/mysql5/testdata/blob.sql @@ -0,0 +1,29 @@ +DROP TABLE IF EXISTS blob_ref CASCADE; +CREATE TABLE blob_ref +( + blob_ref blob NOT NULL, + KEY blob_ref_len_key (blob_ref(10)) +); + +DROP TABLE IF EXISTS blob_table; +CREATE TABLE blob_table +( + col blob, + + blob_def_const blob, + blob_def_func blob, + + blob_ref blob REFERENCES blob_ref (blob_ref), + + blob_nn blob NOT NULL, + blob_nn_check_cmp blob NOT NULL, + blob_nn_check_fn blob NOT NULL, + blob_nn_ref blob NOT NULL REFERENCES blob_ref (blob_ref), + blob_nn_def_const blob NOT NULL, + blob_nn_def_func blob NOT NULL, + + blob_check blob, + blob_check_ref blob REFERENCES blob_ref (blob_ref), + blob_check_def_const blob, + blob_check_def_func blob +); diff --git a/internal/integration_tests/mysql5/testdata/char.sql b/internal/integration_tests/mysql5/testdata/char.sql new file mode 100644 index 00000000..fd2fbc4f --- /dev/null +++ b/internal/integration_tests/mysql5/testdata/char.sql @@ -0,0 +1,131 @@ +DROP TABLE IF EXISTS char_ref CASCADE; +CREATE TABLE char_ref +( + char_ref char UNIQUE +); + +DROP TABLE IF EXISTS char_table; +CREATE TABLE char_table +( + col char, + + char_cap char(255), + char_nn char NOT NULL, + char_nn_unique char NOT NULL UNIQUE, + char_nn_check_cmp char NOT NULL, + char_nn_check_fn char NOT NULL, + char_nn_ref char NOT NULL REFERENCES char_ref (char_ref), + char_nn_def_const char NOT NULL DEFAULT '4', + char_nn_def_func char NOT NULL DEFAULT '5', + char_nn_unique_check char NOT NULL UNIQUE, + + char_unique char UNIQUE, + char_unique_check char UNIQUE, + char_unique_ref char UNIQUE REFERENCES char_ref (char_ref), + char_unique_def_const char UNIQUE DEFAULT '4', + char_unique_def_func char UNIQUE DEFAULT '5', + + char_check char, + char_check_ref char REFERENCES char_ref (char_ref), + char_check_def_const char DEFAULT '4', + char_check_def_func char DEFAULT '5', + + char_ref char REFERENCES char_ref (char_ref), + char_ref_unique_check char UNIQUE REFERENCES char_ref (char_ref), + + char_def_const char DEFAULT '4', + char_def_const_unique_check char UNIQUE DEFAULT '4', + + char_def_func char DEFAULT '5', + char_def_func_unique_check char UNIQUE DEFAULT '5' +); + +DROP TABLE IF EXISTS char_pk; +CREATE TABLE char_pk +( + char_pk char PRIMARY KEY +); + +DROP TABLE IF EXISTS char_pk_ref; +CREATE TABLE char_pk_ref +( + char_pk_ref char PRIMARY KEY REFERENCES char_ref (char_ref) +); + +DROP TABLE IF EXISTS char_pk_def_const; +CREATE TABLE char_pk_def_const +( + char_pk_def_const char PRIMARY KEY DEFAULT '4' +); + +DROP TABLE IF EXISTS char_pk_def_func; +CREATE TABLE char_pk_def_func +( + char_pk_def_func char PRIMARY KEY DEFAULT '5' +); + +DROP TABLE IF EXISTS char_nn_pk; +CREATE TABLE char_nn_pk +( + char_nn_pk char NOT NULL PRIMARY KEY +); + +DROP TABLE IF EXISTS char_nn_unique_check_pk; +CREATE TABLE char_nn_unique_check_pk +( + char_nn_unique_check_pk char PRIMARY KEY NOT NULL UNIQUE +); + +DROP TABLE IF EXISTS char_nn_unique_check_pk_ref; +CREATE TABLE char_nn_unique_check_pk_ref +( + char_nn_unique_check_pk_ref char PRIMARY KEY NOT NULL UNIQUE REFERENCES char_ref (char_ref) +); + +DROP TABLE IF EXISTS char_unique_pk; +CREATE TABLE char_unique_pk +( + char_unique_pk char PRIMARY KEY UNIQUE +); + +DROP TABLE IF EXISTS char_unique_check_pk; +CREATE TABLE char_unique_check_pk +( + char_unique_check_pk char PRIMARY KEY UNIQUE +); + +DROP TABLE IF EXISTS char_unique_check_pk_ref; +CREATE TABLE char_unique_check_pk_ref +( + char_unique_check_pk_ref char PRIMARY KEY UNIQUE REFERENCES char_ref (char_ref) +); + +DROP TABLE IF EXISTS char_check_pk; +CREATE TABLE char_check_pk +( + char_check_pk char PRIMARY KEY +); + +DROP TABLE IF EXISTS char_def_const_unique_check_pk; +CREATE TABLE char_def_const_unique_check_pk +( + char_def_const_unique_check_pk char PRIMARY KEY UNIQUE DEFAULT '4' +); + +DROP TABLE IF EXISTS char_def_const_unique_check_pk_ref; +CREATE TABLE char_def_const_unique_check_pk_ref +( + char_def_const_unique_check_pk_ref char PRIMARY KEY UNIQUE DEFAULT '4' REFERENCES char_ref (char_ref) +); + +DROP TABLE IF EXISTS char_def_func_unique_check_pk; +CREATE TABLE char_def_func_unique_check_pk +( + char_def_func_unique_check_pk char PRIMARY KEY UNIQUE DEFAULT '5' +); + +DROP TABLE IF EXISTS char_def_func_unique_check_pk_ref; +CREATE TABLE char_def_func_unique_check_pk_ref +( + char_def_func_unique_check_pk_ref char PRIMARY KEY UNIQUE DEFAULT '5' REFERENCES char_ref (char_ref) +); diff --git a/internal/integration_tests/mysql5/testdata/constraint_combinations.sql b/internal/integration_tests/mysql5/testdata/constraint_combinations.sql new file mode 100644 index 00000000..b8f7da5a --- /dev/null +++ b/internal/integration_tests/mysql5/testdata/constraint_combinations.sql @@ -0,0 +1,70 @@ +DROP TABLE IF EXISTS constraint_combo_ref; +CREATE TABLE constraint_combo_ref +( + constraint_combo_ref double UNIQUE +); + +DROP TABLE IF EXISTS constraint_combo_non_pk; +CREATE TABLE constraint_combo_non_pk +( + not_null_unique_check_def_const double NOT NULL UNIQUE DEFAULT 42, + not_null_unique_check_def_func double NOT NULL UNIQUE DEFAULT 42, + not_null_unique_ref_def_const double NOT NULL UNIQUE DEFAULT 42 REFERENCES constraint_combo_ref(constraint_combo_ref), + not_null_unique_ref_def_func double NOT NULL UNIQUE DEFAULT 42 REFERENCES constraint_combo_ref(constraint_combo_ref), + not_null_check_ref_def_const double NOT NULL DEFAULT 42 REFERENCES constraint_combo_ref(constraint_combo_ref), + not_null_check_ref_def_func double NOT NULL DEFAULT 42 REFERENCES constraint_combo_ref(constraint_combo_ref), + not_null_unique_def_const double NOT NULL UNIQUE DEFAULT 42, + not_null_unique_def_func double NOT NULL UNIQUE DEFAULT 42, + not_null_check_def_const double NOT NULL DEFAULT 42, + not_null_check_def_func double NOT NULL DEFAULT 42, + not_null_ref_def_const double NOT NULL DEFAULT 42 REFERENCES constraint_combo_ref(constraint_combo_ref), + not_null_ref_def_func double NOT NULL DEFAULT 42 REFERENCES constraint_combo_ref(constraint_combo_ref) +); + +DROP TABLE IF EXISTS constraint_combo_not_null_unique_pk_def_const; +CREATE TABLE constraint_combo_not_null_unique_pk_def_const +( + constraint_combo_not_null_unique_pk_def_const double PRIMARY KEY NOT NULL UNIQUE DEFAULT 42 +); + +DROP TABLE IF EXISTS constraint_combo_not_null_unique_pk_def_func; +CREATE TABLE constraint_combo_not_null_unique_pk_def_func +( + constraint_combo_not_null_unique_pk_def_func double PRIMARY KEY NOT NULL UNIQUE DEFAULT 42 +); + +DROP TABLE IF EXISTS constraint_combo_not_null_check_pk_def_const; +CREATE TABLE constraint_combo_not_null_check_pk_def_const +( + constraint_combo_not_null_check_pk_def_const double PRIMARY KEY NOT NULL DEFAULT 42 +); + +DROP TABLE IF EXISTS constraint_combo_not_null_check_pk_def_func; +CREATE TABLE constraint_combo_not_null_check_pk_def_func +( + constraint_combo_not_null_check_pk_def_func double PRIMARY KEY NOT NULL DEFAULT 42 +); + +DROP TABLE IF EXISTS constraint_combo_not_null_pk_ref_def_const; +CREATE TABLE constraint_combo_not_null_pk_ref_def_const +( + constraint_combo_not_null_pk_ref_def_const double PRIMARY KEY NOT NULL DEFAULT 42 REFERENCES constraint_combo_ref(constraint_combo_ref) +); + +DROP TABLE IF EXISTS constraint_combo_not_null_pk_ref_def_func; +CREATE TABLE constraint_combo_not_null_pk_ref_def_func +( + constraint_combo_not_null_pk_ref_def_func double PRIMARY KEY NOT NULL DEFAULT 42 REFERENCES constraint_combo_ref(constraint_combo_ref) +); + +DROP TABLE IF EXISTS constraint_combo_not_null_pk_def_const; +CREATE TABLE constraint_combo_not_null_pk_def_const +( + constraint_combo_not_null_pk_def_const double NOT NULL PRIMARY KEY DEFAULT 42 +); + +DROP TABLE IF EXISTS constraint_combo_not_null_pk_def_func; +CREATE TABLE constraint_combo_not_null_pk_def_func +( + constraint_combo_not_null_pk_def_func double NOT NULL PRIMARY KEY DEFAULT 42 +); diff --git a/internal/integration_tests/mysql5/testdata/date.sql b/internal/integration_tests/mysql5/testdata/date.sql new file mode 100644 index 00000000..8bbe4640 --- /dev/null +++ b/internal/integration_tests/mysql5/testdata/date.sql @@ -0,0 +1,128 @@ +DROP TABLE IF EXISTS date_ref CASCADE; +CREATE TABLE date_ref +( + date_ref date UNIQUE +); + +DROP TABLE IF EXISTS date_table; +CREATE TABLE date_table +( + date date, + date_nn date NOT NULL, + date_nn_unique date NOT NULL UNIQUE, + date_nn_check date NOT NULL, + date_nn_ref date NOT NULL REFERENCES date_ref (date_ref), + date_nn_def_const date NOT NULL DEFAULT '2020-03-01', + date_nn_def_func date NOT NULL DEFAULT '2020-03-01', + date_nn_unique_check date NOT NULL UNIQUE, + + date_unique date UNIQUE, + date_unique_check date UNIQUE, + date_unique_ref date UNIQUE REFERENCES date_ref (date_ref), + date_unique_def_const date UNIQUE DEFAULT '2020-03-01', + date_unique_def_func date UNIQUE DEFAULT '2020-03-01', + + date_check date, + date_check_ref date REFERENCES date_ref (date_ref), + date_check_def_const date DEFAULT '2020-03-01', + date_check_def_func date DEFAULT '2020-03-01', + + date_ref date REFERENCES date_ref (date_ref), + date_ref_unique_check date UNIQUE REFERENCES date_ref (date_ref), + + date_def_const date DEFAULT '2020-03-01', + date_def_const_unique_check date UNIQUE DEFAULT '2020-03-01', + + date_def_func date DEFAULT '2020-03-01', + date_def_func_unique_check date UNIQUE DEFAULT '2020-03-01' +); + +DROP TABLE IF EXISTS date_pk; +CREATE TABLE date_pk +( + date_pk date PRIMARY KEY +); + +DROP TABLE IF EXISTS date_pk_ref; +CREATE TABLE date_pk_ref +( + date_pk_ref date PRIMARY KEY REFERENCES date_ref (date_ref) +); + +DROP TABLE IF EXISTS date_pk_def_const; +CREATE TABLE date_pk_def_const +( + date_pk_def_const date PRIMARY KEY DEFAULT '2020-03-01' +); + +DROP TABLE IF EXISTS date_pk_def_func; +CREATE TABLE date_pk_def_func +( + date_pk_def_func date PRIMARY KEY DEFAULT '2020-03-01' +); + +DROP TABLE IF EXISTS date_nn_pk; +CREATE TABLE date_nn_pk +( + date_nn_pk date NOT NULL PRIMARY KEY +); + +DROP TABLE IF EXISTS date_nn_unique_check_pk; +CREATE TABLE date_nn_unique_check_pk +( + date_nn_unique_check_pk date PRIMARY KEY NOT NULL UNIQUE +); + +DROP TABLE IF EXISTS date_nn_unique_check_pk_ref; +CREATE TABLE date_nn_unique_check_pk_ref +( + date_nn_unique_check_pk_ref date PRIMARY KEY NOT NULL UNIQUE REFERENCES date_ref (date_ref) +); + +DROP TABLE IF EXISTS date_unique_pk; +CREATE TABLE date_unique_pk +( + date_unique_pk date PRIMARY KEY UNIQUE +); + +DROP TABLE IF EXISTS date_unique_check_pk; +CREATE TABLE date_unique_check_pk +( + date_unique_check_pk date PRIMARY KEY UNIQUE +); + +DROP TABLE IF EXISTS date_unique_check_pk_ref; +CREATE TABLE date_unique_check_pk_ref +( + date_unique_check_pk_ref date PRIMARY KEY UNIQUE REFERENCES date_ref (date_ref) +); + +DROP TABLE IF EXISTS date_check_pk; +CREATE TABLE date_check_pk +( + date_check_pk date PRIMARY KEY +); + +DROP TABLE IF EXISTS date_def_const_unique_check_pk; +CREATE TABLE date_def_const_unique_check_pk +( + date_def_const_unique_check_pk date PRIMARY KEY UNIQUE DEFAULT '2020-03-01' +); + +DROP TABLE IF EXISTS date_def_const_unique_check_pk_ref; +CREATE TABLE date_def_const_unique_check_pk_ref +( + date_def_const_unique_check_pk_ref date PRIMARY KEY UNIQUE DEFAULT '2020-03-01' REFERENCES date_ref (date_ref) +); + +DROP TABLE IF EXISTS date_def_func_unique_check_pk; +CREATE TABLE date_def_func_unique_check_pk +( + date_def_func_unique_check_pk date PRIMARY KEY UNIQUE DEFAULT '2020-03-01' +); + +DROP TABLE IF EXISTS date_def_func_unique_check_pk_ref; +CREATE TABLE date_def_func_unique_check_pk_ref +( + date_def_func_unique_check_pk_ref date PRIMARY KEY UNIQUE DEFAULT '2020-03-01' REFERENCES date_ref (date_ref) +); diff --git a/internal/integration_tests/mysql5/testdata/datetime.sql b/internal/integration_tests/mysql5/testdata/datetime.sql new file mode 100644 index 00000000..09ffdca0 --- /dev/null +++ b/internal/integration_tests/mysql5/testdata/datetime.sql @@ -0,0 +1,128 @@ +DROP TABLE IF EXISTS datetime_ref CASCADE; +CREATE TABLE datetime_ref +( + datetime_ref datetime UNIQUE +); + +DROP TABLE IF EXISTS datetime_table; +CREATE TABLE datetime_table +( + datetime datetime, + datetime_nn datetime NOT NULL, + datetime_nn_unique datetime NOT NULL UNIQUE, + datetime_nn_check datetime NOT NULL, + datetime_nn_ref datetime NOT NULL REFERENCES datetime_ref (datetime_ref), + datetime_nn_def_const datetime NOT NULL DEFAULT '2020-03-01 12:34:56', + datetime_nn_def_func datetime NOT NULL DEFAULT '2020-03-01 12:34:56', + datetime_nn_unique_check datetime NOT NULL UNIQUE, + + datetime_unique datetime UNIQUE, + datetime_unique_check datetime UNIQUE, + datetime_unique_ref datetime UNIQUE REFERENCES datetime_ref (datetime_ref), + datetime_unique_def_const datetime UNIQUE DEFAULT '2020-03-01 12:34:56', + datetime_unique_def_func datetime UNIQUE DEFAULT '2020-03-01 12:34:56', + + datetime_check datetime, + datetime_check_ref datetime REFERENCES datetime_ref (datetime_ref), + datetime_check_def_const datetime DEFAULT '2020-03-01 12:34:56', + datetime_check_def_func datetime DEFAULT '2020-03-01 12:34:56', + + datetime_ref datetime REFERENCES datetime_ref (datetime_ref), + datetime_ref_unique_check datetime UNIQUE REFERENCES datetime_ref (datetime_ref), + + datetime_def_const datetime DEFAULT '2020-03-01 12:34:56', + datetime_def_const_unique_check datetime UNIQUE DEFAULT '2020-03-01 12:34:56', + + datetime_def_func datetime DEFAULT '2020-03-01 12:34:56', + datetime_def_func_unique_check datetime UNIQUE DEFAULT '2020-03-01 12:34:56' +); + +DROP TABLE IF EXISTS datetime_pk; +CREATE TABLE datetime_pk +( + datetime_pk datetime PRIMARY KEY +); + +DROP TABLE IF EXISTS datetime_pk_ref; +CREATE TABLE datetime_pk_ref +( + datetime_pk_ref datetime PRIMARY KEY REFERENCES datetime_ref (datetime_ref) +); + +DROP TABLE IF EXISTS datetime_pk_def_const; +CREATE TABLE datetime_pk_def_const +( + datetime_pk_def_const datetime PRIMARY KEY DEFAULT '2020-03-01 12:34:56' +); + +DROP TABLE IF EXISTS datetime_pk_def_func; +CREATE TABLE datetime_pk_def_func +( + datetime_pk_def_func datetime PRIMARY KEY DEFAULT '2020-03-01 12:34:56' +); + +DROP TABLE IF EXISTS datetime_nn_pk; +CREATE TABLE datetime_nn_pk +( + datetime_nn_pk datetime NOT NULL PRIMARY KEY +); + +DROP TABLE IF EXISTS datetime_nn_unique_check_pk; +CREATE TABLE datetime_nn_unique_check_pk +( + datetime_nn_unique_check_pk datetime PRIMARY KEY NOT NULL UNIQUE +); + +DROP TABLE IF EXISTS datetime_nn_unique_check_pk_ref; +CREATE TABLE datetime_nn_unique_check_pk_ref +( + datetime_nn_unique_check_pk_ref datetime PRIMARY KEY NOT NULL UNIQUE REFERENCES datetime_ref (datetime_ref) +); + +DROP TABLE IF EXISTS datetime_unique_pk; +CREATE TABLE datetime_unique_pk +( + datetime_unique_pk datetime PRIMARY KEY UNIQUE +); + +DROP TABLE IF EXISTS datetime_unique_check_pk; +CREATE TABLE datetime_unique_check_pk +( + datetime_unique_check_pk datetime PRIMARY KEY UNIQUE +); + +DROP TABLE IF EXISTS datetime_unique_check_pk_ref; +CREATE TABLE datetime_unique_check_pk_ref +( + datetime_unique_check_pk_ref datetime PRIMARY KEY UNIQUE REFERENCES datetime_ref (datetime_ref) +); + +DROP TABLE IF EXISTS datetime_check_pk; +CREATE TABLE datetime_check_pk +( + datetime_check_pk datetime PRIMARY KEY +); + +DROP TABLE IF EXISTS datetime_def_const_unique_check_pk; +CREATE TABLE datetime_def_const_unique_check_pk +( + datetime_def_const_unique_check_pk datetime PRIMARY KEY UNIQUE DEFAULT '2020-03-01 12:34:56' +); + +DROP TABLE IF EXISTS datetime_def_const_unique_check_pk_ref; +CREATE TABLE datetime_def_const_unique_check_pk_ref +( + datetime_def_const_unique_check_pk_ref datetime PRIMARY KEY UNIQUE DEFAULT '2020-03-01 12:34:56' REFERENCES datetime_ref (datetime_ref) +); + +DROP TABLE IF EXISTS datetime_def_func_unique_check_pk; +CREATE TABLE datetime_def_func_unique_check_pk +( + datetime_def_func_unique_check_pk datetime PRIMARY KEY UNIQUE DEFAULT '2020-03-01 12:34:56' +); + +DROP TABLE IF EXISTS datetime_def_func_unique_check_pk_ref; +CREATE TABLE datetime_def_func_unique_check_pk_ref +( + datetime_def_func_unique_check_pk_ref datetime PRIMARY KEY UNIQUE DEFAULT '2020-03-01 12:34:56' REFERENCES datetime_ref (datetime_ref) +); diff --git a/internal/integration_tests/mysql5/testdata/decimal.sql b/internal/integration_tests/mysql5/testdata/decimal.sql new file mode 100644 index 00000000..ff056d2c --- /dev/null +++ b/internal/integration_tests/mysql5/testdata/decimal.sql @@ -0,0 +1,129 @@ +DROP TABLE IF EXISTS decimal_ref CASCADE; +CREATE TABLE decimal_ref +( + decimal_ref decimal UNIQUE +); + +DROP TABLE IF EXISTS decimal_table; +CREATE TABLE decimal_table +( + col decimal, + + decimal_nn decimal NOT NULL, + decimal_nn_unique decimal NOT NULL UNIQUE, + decimal_nn_check decimal NOT NULL, + decimal_nn_ref decimal NOT NULL REFERENCES decimal_ref (decimal_ref), + decimal_nn_def_const decimal NOT NULL DEFAULT 42, + decimal_nn_def_func decimal NOT NULL DEFAULT 42, + decimal_nn_unique_check decimal NOT NULL UNIQUE, + + decimal_unique decimal UNIQUE, + decimal_unique_check decimal UNIQUE, + decimal_unique_ref decimal UNIQUE REFERENCES decimal_ref (decimal_ref), + decimal_unique_def_const decimal UNIQUE DEFAULT 42, + decimal_unique_def_func decimal UNIQUE DEFAULT 42, + + decimal_check decimal, + decimal_check_ref decimal REFERENCES decimal_ref (decimal_ref), + decimal_check_def_const decimal DEFAULT 42, + decimal_check_def_func decimal DEFAULT 42, + + decimal_ref decimal REFERENCES decimal_ref (decimal_ref), + decimal_ref_unique_check decimal UNIQUE REFERENCES decimal_ref (decimal_ref), + + decimal_def_const decimal DEFAULT 42, + decimal_def_const_unique_check decimal UNIQUE DEFAULT 42, + + decimal_def_func decimal DEFAULT 42, + decimal_def_func_unique_check decimal UNIQUE DEFAULT 42 +); + +DROP TABLE IF EXISTS decimal_pk; +CREATE TABLE decimal_pk +( + decimal_pk decimal PRIMARY KEY +); + +DROP TABLE IF EXISTS decimal_pk_ref; +CREATE TABLE decimal_pk_ref +( + decimal_pk_ref decimal PRIMARY KEY REFERENCES decimal_ref (decimal_ref) +); + +DROP TABLE IF EXISTS decimal_pk_def_const; +CREATE TABLE decimal_pk_def_const +( + decimal_pk_def_const decimal PRIMARY KEY DEFAULT 42 +); + +DROP TABLE IF EXISTS decimal_pk_def_func; +CREATE TABLE decimal_pk_def_func +( + decimal_pk_def_func decimal PRIMARY KEY DEFAULT 42 +); + +DROP TABLE IF EXISTS decimal_nn_pk; +CREATE TABLE decimal_nn_pk +( + decimal_nn_pk decimal NOT NULL PRIMARY KEY +); + +DROP TABLE IF EXISTS decimal_nn_unique_check_pk; +CREATE TABLE decimal_nn_unique_check_pk +( + decimal_nn_unique_check_pk decimal PRIMARY KEY NOT NULL UNIQUE +); + +DROP TABLE IF EXISTS decimal_nn_unique_check_pk_ref; +CREATE TABLE decimal_nn_unique_check_pk_ref +( + decimal_nn_unique_check_pk_ref decimal PRIMARY KEY NOT NULL UNIQUE REFERENCES decimal_ref (decimal_ref) +); + +DROP TABLE IF EXISTS decimal_unique_pk; +CREATE TABLE decimal_unique_pk +( + decimal_unique_pk decimal PRIMARY KEY UNIQUE +); + +DROP TABLE IF EXISTS decimal_unique_check_pk; +CREATE TABLE decimal_unique_check_pk +( + decimal_unique_check_pk decimal PRIMARY KEY UNIQUE +); + +DROP TABLE IF EXISTS decimal_unique_check_pk_ref; +CREATE TABLE decimal_unique_check_pk_ref +( + decimal_unique_check_pk_ref decimal PRIMARY KEY UNIQUE REFERENCES decimal_ref (decimal_ref) +); + +DROP TABLE IF EXISTS decimal_check_pk; +CREATE TABLE decimal_check_pk +( + decimal_check_pk decimal PRIMARY KEY +); + +DROP TABLE IF EXISTS decimal_def_const_unique_check_pk; +CREATE TABLE decimal_def_const_unique_check_pk +( + decimal_def_const_unique_check_pk decimal PRIMARY KEY UNIQUE DEFAULT 42 +); + +DROP TABLE IF EXISTS decimal_def_const_unique_check_pk_ref; +CREATE TABLE decimal_def_const_unique_check_pk_ref +( + decimal_def_const_unique_check_pk_ref decimal PRIMARY KEY UNIQUE DEFAULT 42 REFERENCES decimal_ref (decimal_ref) +); + +DROP TABLE IF EXISTS decimal_def_func_unique_check_pk; +CREATE TABLE decimal_def_func_unique_check_pk +( + decimal_def_func_unique_check_pk decimal PRIMARY KEY UNIQUE DEFAULT 42 +); + +DROP TABLE IF EXISTS decimal_def_func_unique_check_pk_ref; +CREATE TABLE decimal_def_func_unique_check_pk_ref +( + decimal_def_func_unique_check_pk_ref decimal PRIMARY KEY UNIQUE DEFAULT 42 REFERENCES decimal_ref (decimal_ref) +); diff --git a/internal/integration_tests/mysql5/testdata/doubleprecision.sql b/internal/integration_tests/mysql5/testdata/doubleprecision.sql new file mode 100644 index 00000000..bbf645c3 --- /dev/null +++ b/internal/integration_tests/mysql5/testdata/doubleprecision.sql @@ -0,0 +1,129 @@ +DROP TABLE IF EXISTS double_precision_ref CASCADE; +CREATE TABLE double_precision_ref +( + double_precision_ref double precision UNIQUE +); + +DROP TABLE IF EXISTS double_precision_table; +CREATE TABLE double_precision_table +( + col double precision, + + double_precision_nn double precision NOT NULL, + double_precision_nn_unique double precision NOT NULL UNIQUE, + double_precision_nn_check double precision NOT NULL, + double_precision_nn_ref double precision NOT NULL REFERENCES double_precision_ref (double_precision_ref), + double_precision_nn_def_const double precision NOT NULL DEFAULT 42, + double_precision_nn_def_func double precision NOT NULL DEFAULT 42, + double_precision_nn_unique_check double precision NOT NULL UNIQUE, + + double_precision_unique double precision UNIQUE, + double_precision_unique_check double precision UNIQUE, + double_precision_unique_ref double precision UNIQUE REFERENCES double_precision_ref (double_precision_ref), + double_precision_unique_def_const double precision UNIQUE DEFAULT 42, + double_precision_unique_def_func double precision UNIQUE DEFAULT 42, + + double_precision_check double precision, + double_precision_check_ref double precision REFERENCES double_precision_ref (double_precision_ref), + double_precision_check_def_const double precision DEFAULT 42, + double_precision_check_def_func double precision DEFAULT 42, + + double_precision_ref double precision REFERENCES double_precision_ref (double_precision_ref), + double_precision_ref_unique_check double precision UNIQUE REFERENCES double_precision_ref (double_precision_ref), + + double_precision_def_const double precision DEFAULT 42, + double_precision_def_const_unique_check double precision UNIQUE DEFAULT 42, + + double_precision_def_func double precision DEFAULT 42, + double_precision_def_func_unique_check double precision UNIQUE DEFAULT 42 +); + +DROP TABLE IF EXISTS double_precision_pk; +CREATE TABLE double_precision_pk +( + double_precision_pk double precision PRIMARY KEY +); + +DROP TABLE IF EXISTS double_precision_pk_ref; +CREATE TABLE double_precision_pk_ref +( + double_precision_pk_ref double precision PRIMARY KEY REFERENCES double_precision_ref (double_precision_ref) +); + +DROP TABLE IF EXISTS double_precision_pk_def_const; +CREATE TABLE double_precision_pk_def_const +( + double_precision_pk_def_const double precision PRIMARY KEY DEFAULT 42 +); + +DROP TABLE IF EXISTS double_precision_pk_def_func; +CREATE TABLE double_precision_pk_def_func +( + double_precision_pk_def_func double precision PRIMARY KEY DEFAULT 42 +); + +DROP TABLE IF EXISTS double_precision_nn_pk; +CREATE TABLE double_precision_nn_pk +( + double_precision_nn_pk double precision NOT NULL PRIMARY KEY +); + +DROP TABLE IF EXISTS double_precision_nn_unique_check_pk; +CREATE TABLE double_precision_nn_unique_check_pk +( + double_precision_nn_unique_check_pk double precision PRIMARY KEY NOT NULL UNIQUE +); + +DROP TABLE IF EXISTS double_precision_nn_unique_check_pk_ref; +CREATE TABLE double_precision_nn_unique_check_pk_ref +( + double_precision_nn_unique_check_pk_ref double precision PRIMARY KEY NOT NULL UNIQUE REFERENCES double_precision_ref (double_precision_ref) +); + +DROP TABLE IF EXISTS double_precision_unique_pk; +CREATE TABLE double_precision_unique_pk +( + double_precision_unique_pk double precision PRIMARY KEY UNIQUE +); + +DROP TABLE IF EXISTS double_precision_unique_check_pk; +CREATE TABLE double_precision_unique_check_pk +( + double_precision_unique_check_pk double precision PRIMARY KEY UNIQUE +); + +DROP TABLE IF EXISTS double_precision_unique_check_pk_ref; +CREATE TABLE double_precision_unique_check_pk_ref +( + double_precision_unique_check_pk_ref double precision PRIMARY KEY UNIQUE REFERENCES double_precision_ref (double_precision_ref) +); + +DROP TABLE IF EXISTS double_precision_check_pk; +CREATE TABLE double_precision_check_pk +( + double_precision_check_pk double precision PRIMARY KEY +); + +DROP TABLE IF EXISTS double_precision_def_const_unique_check_pk; +CREATE TABLE double_precision_def_const_unique_check_pk +( + double_precision_def_const_unique_check_pk double precision PRIMARY KEY UNIQUE DEFAULT 42 +); + +DROP TABLE IF EXISTS double_precision_def_const_unique_check_pk_ref; +CREATE TABLE double_precision_def_const_unique_check_pk_ref +( + double_precision_def_const_unique_check_pk_ref double precision PRIMARY KEY UNIQUE DEFAULT 42 REFERENCES double_precision_ref (double_precision_ref) +); + +DROP TABLE IF EXISTS double_precision_def_func_unique_check_pk; +CREATE TABLE double_precision_def_func_unique_check_pk +( + double_precision_def_func_unique_check_pk double precision PRIMARY KEY UNIQUE DEFAULT 42 +); + +DROP TABLE IF EXISTS double_precision_def_func_unique_check_pk_ref; +CREATE TABLE double_precision_def_func_unique_check_pk_ref +( + double_precision_def_func_unique_check_pk_ref double precision PRIMARY KEY UNIQUE DEFAULT 42 REFERENCES double_precision_ref (double_precision_ref) +); diff --git a/internal/integration_tests/mysql5/testdata/float.sql b/internal/integration_tests/mysql5/testdata/float.sql new file mode 100644 index 00000000..d6332575 --- /dev/null +++ b/internal/integration_tests/mysql5/testdata/float.sql @@ -0,0 +1,129 @@ +DROP TABLE IF EXISTS float_ref CASCADE; +CREATE TABLE float_ref +( + float_ref float UNIQUE +); + +DROP TABLE IF EXISTS float_table; +CREATE TABLE float_table +( + col float, + + float_nn float NOT NULL, + float_nn_unique float NOT NULL UNIQUE, + float_nn_check float NOT NULL, + float_nn_ref float NOT NULL REFERENCES float_ref (float_ref), + float_nn_def_const float NOT NULL DEFAULT 42, + float_nn_def_func float NOT NULL DEFAULT 42, + float_nn_unique_check float NOT NULL UNIQUE, + + float_unique float UNIQUE, + float_unique_check float UNIQUE, + float_unique_ref float UNIQUE REFERENCES float_ref (float_ref), + float_unique_def_const float UNIQUE DEFAULT 42, + float_unique_def_func float UNIQUE DEFAULT 42, + + float_check float, + float_check_ref float REFERENCES float_ref (float_ref), + float_check_def_const float DEFAULT 42, + float_check_def_func float DEFAULT 42, + + float_ref float REFERENCES float_ref (float_ref), + float_ref_unique_check float UNIQUE REFERENCES float_ref (float_ref), + + float_def_const float DEFAULT 42, + float_def_const_unique_check float UNIQUE DEFAULT 42, + + float_def_func float DEFAULT 42, + float_def_func_unique_check float UNIQUE DEFAULT 42 +); + +DROP TABLE IF EXISTS float_pk; +CREATE TABLE float_pk +( + float_pk float PRIMARY KEY +); + +DROP TABLE IF EXISTS float_pk_ref; +CREATE TABLE float_pk_ref +( + float_pk_ref float PRIMARY KEY REFERENCES float_ref (float_ref) +); + +DROP TABLE IF EXISTS float_pk_def_const; +CREATE TABLE float_pk_def_const +( + float_pk_def_const float PRIMARY KEY DEFAULT 42 +); + +DROP TABLE IF EXISTS float_pk_def_func; +CREATE TABLE float_pk_def_func +( + float_pk_def_func float PRIMARY KEY DEFAULT 42 +); + +DROP TABLE IF EXISTS float_nn_pk; +CREATE TABLE float_nn_pk +( + float_nn_pk float NOT NULL PRIMARY KEY +); + +DROP TABLE IF EXISTS float_nn_unique_check_pk; +CREATE TABLE float_nn_unique_check_pk +( + float_nn_unique_check_pk float PRIMARY KEY NOT NULL UNIQUE +); + +DROP TABLE IF EXISTS float_nn_unique_check_pk_ref; +CREATE TABLE float_nn_unique_check_pk_ref +( + float_nn_unique_check_pk_ref float PRIMARY KEY NOT NULL UNIQUE REFERENCES float_ref (float_ref) +); + +DROP TABLE IF EXISTS float_unique_pk; +CREATE TABLE float_unique_pk +( + float_unique_pk float PRIMARY KEY UNIQUE +); + +DROP TABLE IF EXISTS float_unique_check_pk; +CREATE TABLE float_unique_check_pk +( + float_unique_check_pk float PRIMARY KEY UNIQUE +); + +DROP TABLE IF EXISTS float_unique_check_pk_ref; +CREATE TABLE float_unique_check_pk_ref +( + float_unique_check_pk_ref float PRIMARY KEY UNIQUE REFERENCES float_ref (float_ref) +); + +DROP TABLE IF EXISTS float_check_pk; +CREATE TABLE float_check_pk +( + float_check_pk float PRIMARY KEY +); + +DROP TABLE IF EXISTS float_def_const_unique_check_pk; +CREATE TABLE float_def_const_unique_check_pk +( + float_def_const_unique_check_pk float PRIMARY KEY UNIQUE DEFAULT 42 +); + +DROP TABLE IF EXISTS float_def_const_unique_check_pk_ref; +CREATE TABLE float_def_const_unique_check_pk_ref +( + float_def_const_unique_check_pk_ref float PRIMARY KEY UNIQUE DEFAULT 42 REFERENCES float_ref (float_ref) +); + +DROP TABLE IF EXISTS float_def_func_unique_check_pk; +CREATE TABLE float_def_func_unique_check_pk +( + float_def_func_unique_check_pk float PRIMARY KEY UNIQUE DEFAULT 42 +); + +DROP TABLE IF EXISTS float_def_func_unique_check_pk_ref; +CREATE TABLE float_def_func_unique_check_pk_ref +( + float_def_func_unique_check_pk_ref float PRIMARY KEY UNIQUE DEFAULT 42 REFERENCES float_ref (float_ref) +); diff --git a/internal/integration_tests/mysql5/testdata/int.sql b/internal/integration_tests/mysql5/testdata/int.sql new file mode 100644 index 00000000..c9cfb262 --- /dev/null +++ b/internal/integration_tests/mysql5/testdata/int.sql @@ -0,0 +1,124 @@ +DROP TABLE IF EXISTS integer_ref CASCADE; +CREATE TABLE integer_ref +( + integer_ref integer UNIQUE +); + +DROP TABLE IF EXISTS integer_table; +CREATE TABLE integer_table +( + i integer, + integer_nn integer NOT NULL, + integer_nn_unique integer NOT NULL UNIQUE, + integer_nn_check integer NOT NULL, + + integer_unique integer UNIQUE, + integer_unique_check integer UNIQUE, + integer_unique_ref integer UNIQUE REFERENCES integer_ref (integer_ref), + integer_unique_def_const integer UNIQUE DEFAULT 42, + integer_unique_def_func integer UNIQUE DEFAULT 42, + + integer_check integer, + integer_check_ref integer REFERENCES integer_ref (integer_ref), + integer_check_def_const integer DEFAULT 42, + integer_check_def_func integer DEFAULT 42, + + integer_ref integer REFERENCES integer_ref (integer_ref), + integer_ref_unique_check integer UNIQUE REFERENCES integer_ref (integer_ref), + + integer_def_const integer DEFAULT 42, + integer_def_const_unique_check integer UNIQUE DEFAULT 42, + + integer_def_func integer DEFAULT 42, + integer_def_func_unique_check integer UNIQUE DEFAULT 42 +); + +DROP TABLE IF EXISTS integer_pk; +CREATE TABLE integer_pk +( + integer_pk integer PRIMARY KEY +); + +DROP TABLE IF EXISTS integer_pk_ref; +CREATE TABLE integer_pk_ref +( + integer_pk_ref integer PRIMARY KEY REFERENCES integer_ref (integer_ref) +); + +DROP TABLE IF EXISTS integer_pk_def_const; +CREATE TABLE integer_pk_def_const +( + integer_pk_def_const integer PRIMARY KEY DEFAULT 42 +); + +DROP TABLE IF EXISTS integer_pk_def_func; +CREATE TABLE integer_pk_def_func +( + integer_pk_def_func integer PRIMARY KEY DEFAULT 42 +); + +DROP TABLE IF EXISTS integer_nn_pk; +CREATE TABLE integer_nn_pk +( + integer_nn_pk integer NOT NULL PRIMARY KEY +); + +DROP TABLE IF EXISTS integer_nn_unique_check_pk; +CREATE TABLE integer_nn_unique_check_pk +( + integer_nn_unique_check_pk integer PRIMARY KEY NOT NULL UNIQUE +); + +DROP TABLE IF EXISTS integer_nn_unique_check_pk_ref; +CREATE TABLE integer_nn_unique_check_pk_ref +( + integer_nn_unique_check_pk_ref integer PRIMARY KEY NOT NULL UNIQUE REFERENCES integer_ref (integer_ref) +); + +DROP TABLE IF EXISTS integer_unique_pk; +CREATE TABLE integer_unique_pk +( + integer_unique_pk integer PRIMARY KEY UNIQUE +); + +DROP TABLE IF EXISTS integer_unique_check_pk; +CREATE TABLE integer_unique_check_pk +( + integer_unique_check_pk integer PRIMARY KEY UNIQUE +); + +DROP TABLE IF EXISTS integer_unique_check_pk_ref; +CREATE TABLE integer_unique_check_pk_ref +( + integer_unique_check_pk_ref integer PRIMARY KEY UNIQUE REFERENCES integer_ref (integer_ref) +); + +DROP TABLE IF EXISTS integer_check_pk; +CREATE TABLE integer_check_pk +( + integer_check_pk integer PRIMARY KEY +); + +DROP TABLE IF EXISTS integer_def_const_unique_check_pk; +CREATE TABLE integer_def_const_unique_check_pk +( + integer_def_const_unique_check_pk integer PRIMARY KEY UNIQUE DEFAULT 42 +); + +DROP TABLE IF EXISTS integer_def_const_unique_check_pk_ref; +CREATE TABLE integer_def_const_unique_check_pk_ref +( + integer_def_const_unique_check_pk_ref integer PRIMARY KEY UNIQUE DEFAULT 42 REFERENCES integer_ref (integer_ref) +); + +DROP TABLE IF EXISTS integer_def_func_unique_check_pk; +CREATE TABLE integer_def_func_unique_check_pk +( + integer_def_func_unique_check_pk integer PRIMARY KEY UNIQUE DEFAULT 42 +); + +DROP TABLE IF EXISTS integer_def_func_unique_check_pk_ref; +CREATE TABLE integer_def_func_unique_check_pk_ref +( + integer_def_func_unique_check_pk_ref integer PRIMARY KEY UNIQUE DEFAULT 42 REFERENCES integer_ref (integer_ref) +); diff --git a/internal/integration_tests/mysql5/testdata/longblob.sql b/internal/integration_tests/mysql5/testdata/longblob.sql new file mode 100644 index 00000000..8f877490 --- /dev/null +++ b/internal/integration_tests/mysql5/testdata/longblob.sql @@ -0,0 +1,29 @@ +DROP TABLE IF EXISTS longblob_ref CASCADE; +CREATE TABLE longblob_ref +( + longblob_ref longblob NOT NULL, + KEY longblob_ref_len_key (longblob_ref(10)) +); + +DROP TABLE IF EXISTS longblob_table; +CREATE TABLE longblob_table +( + col longblob, + + longblob_def_const longblob, + longblob_def_func longblob, + + longblob_ref longblob REFERENCES longblob_ref (longblob_ref), + + longblob_nn longblob NOT NULL, + longblob_nn_check_cmp longblob NOT NULL, + longblob_nn_check_fn longblob NOT NULL, + longblob_nn_ref longblob NOT NULL REFERENCES longblob_ref (longblob_ref), + longblob_nn_def_const longblob NOT NULL, + longblob_nn_def_func longblob NOT NULL, + + longblob_check longblob, + longblob_check_ref longblob REFERENCES longblob_ref (longblob_ref), + longblob_check_def_const longblob, + longblob_check_def_func longblob +); diff --git a/internal/integration_tests/mysql5/testdata/longtext.sql b/internal/integration_tests/mysql5/testdata/longtext.sql new file mode 100644 index 00000000..2e46fe3c --- /dev/null +++ b/internal/integration_tests/mysql5/testdata/longtext.sql @@ -0,0 +1,29 @@ +DROP TABLE IF EXISTS longtext_ref CASCADE; +CREATE TABLE longtext_ref +( + longtext_ref longtext NOT NULL, + KEY longtext_ref_len_key (longtext_ref(10)) +); + +DROP TABLE IF EXISTS longtext_table; +CREATE TABLE longtext_table +( + col longtext, + + longtext_def_const longtext, + longtext_def_func longtext, + + longtext_ref longtext REFERENCES longtext_ref (longtext_ref), + + longtext_nn longtext NOT NULL, + longtext_nn_check_cmp longtext NOT NULL, + longtext_nn_check_fn longtext NOT NULL, + longtext_nn_ref longtext NOT NULL REFERENCES longtext_ref (longtext_ref), + longtext_nn_def_const longtext NOT NULL, + longtext_nn_def_func longtext NOT NULL, + + longtext_check longtext, + longtext_check_ref longtext REFERENCES longtext_ref (longtext_ref), + longtext_check_def_const longtext, + longtext_check_def_func longtext +); diff --git a/internal/integration_tests/mysql5/testdata/mediumblob.sql b/internal/integration_tests/mysql5/testdata/mediumblob.sql new file mode 100644 index 00000000..b7c1842a --- /dev/null +++ b/internal/integration_tests/mysql5/testdata/mediumblob.sql @@ -0,0 +1,29 @@ +DROP TABLE IF EXISTS mediumblob_ref CASCADE; +CREATE TABLE mediumblob_ref +( + mediumblob_ref mediumblob NOT NULL, + KEY mediumblob_ref_len_key (mediumblob_ref(10)) +); + +DROP TABLE IF EXISTS mediumblob_table; +CREATE TABLE mediumblob_table +( + col mediumblob, + + mediumblob_def_const mediumblob, + mediumblob_def_func mediumblob, + + mediumblob_ref mediumblob REFERENCES mediumblob_ref (mediumblob_ref), + + mediumblob_nn mediumblob NOT NULL, + mediumblob_nn_check_cmp mediumblob NOT NULL, + mediumblob_nn_check_fn mediumblob NOT NULL, + mediumblob_nn_ref mediumblob NOT NULL REFERENCES mediumblob_ref (mediumblob_ref), + mediumblob_nn_def_const mediumblob NOT NULL, + mediumblob_nn_def_func mediumblob NOT NULL, + + mediumblob_check mediumblob, + mediumblob_check_ref mediumblob REFERENCES mediumblob_ref (mediumblob_ref), + mediumblob_check_def_const mediumblob, + mediumblob_check_def_func mediumblob +); diff --git a/internal/integration_tests/mysql5/testdata/mediumint.sql b/internal/integration_tests/mysql5/testdata/mediumint.sql new file mode 100644 index 00000000..ae91c03a --- /dev/null +++ b/internal/integration_tests/mysql5/testdata/mediumint.sql @@ -0,0 +1,124 @@ +DROP TABLE IF EXISTS mediumint_ref CASCADE; +CREATE TABLE mediumint_ref +( + mediumint_ref mediumint UNIQUE +); + +DROP TABLE IF EXISTS mediumint_table; +CREATE TABLE mediumint_table +( + i mediumint, + mediumint_nn mediumint NOT NULL, + mediumint_nn_unique mediumint NOT NULL UNIQUE, + mediumint_nn_check mediumint NOT NULL, + + mediumint_unique mediumint UNIQUE, + mediumint_unique_check mediumint UNIQUE, + mediumint_unique_ref mediumint UNIQUE REFERENCES mediumint_ref (mediumint_ref), + mediumint_unique_def_const mediumint UNIQUE DEFAULT 42, + mediumint_unique_def_func mediumint UNIQUE DEFAULT 42, + + mediumint_check mediumint, + mediumint_check_ref mediumint REFERENCES mediumint_ref (mediumint_ref), + mediumint_check_def_const mediumint DEFAULT 42, + mediumint_check_def_func mediumint DEFAULT 42, + + mediumint_ref mediumint REFERENCES mediumint_ref (mediumint_ref), + mediumint_ref_unique_check mediumint UNIQUE REFERENCES mediumint_ref (mediumint_ref), + + mediumint_def_const mediumint DEFAULT 42, + mediumint_def_const_unique_check mediumint UNIQUE DEFAULT 42, + + mediumint_def_func mediumint DEFAULT 42, + mediumint_def_func_unique_check mediumint UNIQUE DEFAULT 42 +); + +DROP TABLE IF EXISTS mediumint_pk; +CREATE TABLE mediumint_pk +( + mediumint_pk mediumint PRIMARY KEY +); + +DROP TABLE IF EXISTS mediumint_pk_ref; +CREATE TABLE mediumint_pk_ref +( + mediumint_pk_ref mediumint PRIMARY KEY REFERENCES mediumint_ref (mediumint_ref) +); + +DROP TABLE IF EXISTS mediumint_pk_def_const; +CREATE TABLE mediumint_pk_def_const +( + mediumint_pk_def_const mediumint PRIMARY KEY DEFAULT 42 +); + +DROP TABLE IF EXISTS mediumint_pk_def_func; +CREATE TABLE mediumint_pk_def_func +( + mediumint_pk_def_func mediumint PRIMARY KEY DEFAULT 42 +); + +DROP TABLE IF EXISTS mediumint_nn_pk; +CREATE TABLE mediumint_nn_pk +( + mediumint_nn_pk mediumint NOT NULL PRIMARY KEY +); + +DROP TABLE IF EXISTS mediumint_nn_unique_check_pk; +CREATE TABLE mediumint_nn_unique_check_pk +( + mediumint_nn_unique_check_pk mediumint PRIMARY KEY NOT NULL UNIQUE +); + +DROP TABLE IF EXISTS mediumint_nn_unique_check_pk_ref; +CREATE TABLE mediumint_nn_unique_check_pk_ref +( + mediumint_nn_unique_check_pk_ref mediumint PRIMARY KEY NOT NULL UNIQUE REFERENCES mediumint_ref (mediumint_ref) +); + +DROP TABLE IF EXISTS mediumint_unique_pk; +CREATE TABLE mediumint_unique_pk +( + mediumint_unique_pk mediumint PRIMARY KEY UNIQUE +); + +DROP TABLE IF EXISTS mediumint_unique_check_pk; +CREATE TABLE mediumint_unique_check_pk +( + mediumint_unique_check_pk mediumint PRIMARY KEY UNIQUE +); + +DROP TABLE IF EXISTS mediumint_unique_check_pk_ref; +CREATE TABLE mediumint_unique_check_pk_ref +( + mediumint_unique_check_pk_ref mediumint PRIMARY KEY UNIQUE REFERENCES mediumint_ref (mediumint_ref) +); + +DROP TABLE IF EXISTS mediumint_check_pk; +CREATE TABLE mediumint_check_pk +( + mediumint_check_pk mediumint PRIMARY KEY +); + +DROP TABLE IF EXISTS mediumint_def_const_unique_check_pk; +CREATE TABLE mediumint_def_const_unique_check_pk +( + mediumint_def_const_unique_check_pk mediumint PRIMARY KEY UNIQUE DEFAULT 42 +); + +DROP TABLE IF EXISTS mediumint_def_const_unique_check_pk_ref; +CREATE TABLE mediumint_def_const_unique_check_pk_ref +( + mediumint_def_const_unique_check_pk_ref mediumint PRIMARY KEY UNIQUE DEFAULT 42 REFERENCES mediumint_ref (mediumint_ref) +); + +DROP TABLE IF EXISTS mediumint_def_func_unique_check_pk; +CREATE TABLE mediumint_def_func_unique_check_pk +( + mediumint_def_func_unique_check_pk mediumint PRIMARY KEY UNIQUE DEFAULT 42 +); + +DROP TABLE IF EXISTS mediumint_def_func_unique_check_pk_ref; +CREATE TABLE mediumint_def_func_unique_check_pk_ref +( + mediumint_def_func_unique_check_pk_ref mediumint PRIMARY KEY UNIQUE DEFAULT 42 REFERENCES mediumint_ref (mediumint_ref) +); diff --git a/internal/integration_tests/mysql5/testdata/mediumtext.sql b/internal/integration_tests/mysql5/testdata/mediumtext.sql new file mode 100644 index 00000000..a4e2f5c0 --- /dev/null +++ b/internal/integration_tests/mysql5/testdata/mediumtext.sql @@ -0,0 +1,29 @@ +DROP TABLE IF EXISTS mediumtext_ref CASCADE; +CREATE TABLE mediumtext_ref +( + mediumtext_ref mediumtext NOT NULL, + KEY mediumtext_ref_len_key (mediumtext_ref(10)) +); + +DROP TABLE IF EXISTS mediumtext_table; +CREATE TABLE mediumtext_table +( + col mediumtext, + + mediumtext_def_const mediumtext, + mediumtext_def_func mediumtext, + + mediumtext_ref mediumtext REFERENCES mediumtext_ref (mediumtext_ref), + + mediumtext_nn mediumtext NOT NULL, + mediumtext_nn_check_cmp mediumtext NOT NULL, + mediumtext_nn_check_fn mediumtext NOT NULL, + mediumtext_nn_ref mediumtext NOT NULL REFERENCES mediumtext_ref (mediumtext_ref), + mediumtext_nn_def_const mediumtext NOT NULL, + mediumtext_nn_def_func mediumtext NOT NULL, + + mediumtext_check mediumtext, + mediumtext_check_ref mediumtext REFERENCES mediumtext_ref (mediumtext_ref), + mediumtext_check_def_const mediumtext, + mediumtext_check_def_func mediumtext +); diff --git a/internal/integration_tests/mysql5/testdata/numeric.sql b/internal/integration_tests/mysql5/testdata/numeric.sql new file mode 100644 index 00000000..1543a7fa --- /dev/null +++ b/internal/integration_tests/mysql5/testdata/numeric.sql @@ -0,0 +1,129 @@ +DROP TABLE IF EXISTS numeric_ref CASCADE; +CREATE TABLE numeric_ref +( + numeric_ref numeric UNIQUE +); + +DROP TABLE IF EXISTS numeric_table; +CREATE TABLE numeric_table +( + col numeric, + + numeric_nn numeric NOT NULL, + numeric_nn_unique numeric NOT NULL UNIQUE, + numeric_nn_check numeric NOT NULL, + numeric_nn_ref numeric NOT NULL REFERENCES numeric_ref (numeric_ref), + numeric_nn_def_const numeric NOT NULL DEFAULT 42, + numeric_nn_def_func numeric NOT NULL DEFAULT 42, + numeric_nn_unique_check numeric NOT NULL UNIQUE, + + numeric_unique numeric UNIQUE, + numeric_unique_check numeric UNIQUE, + numeric_unique_ref numeric UNIQUE REFERENCES numeric_ref (numeric_ref), + numeric_unique_def_const numeric UNIQUE DEFAULT 42, + numeric_unique_def_func numeric UNIQUE DEFAULT 42, + + numeric_check numeric, + numeric_check_ref numeric REFERENCES numeric_ref (numeric_ref), + numeric_check_def_const numeric DEFAULT 42, + numeric_check_def_func numeric DEFAULT 42, + + numeric_ref numeric REFERENCES numeric_ref (numeric_ref), + numeric_ref_unique_check numeric UNIQUE REFERENCES numeric_ref (numeric_ref), + + numeric_def_const numeric DEFAULT 42, + numeric_def_const_unique_check numeric UNIQUE DEFAULT 42, + + numeric_def_func numeric DEFAULT 42, + numeric_def_func_unique_check numeric UNIQUE DEFAULT 42 +); + +DROP TABLE IF EXISTS numeric_pk; +CREATE TABLE numeric_pk +( + numeric_pk numeric PRIMARY KEY +); + +DROP TABLE IF EXISTS numeric_pk_ref; +CREATE TABLE numeric_pk_ref +( + numeric_pk_ref numeric PRIMARY KEY REFERENCES numeric_ref (numeric_ref) +); + +DROP TABLE IF EXISTS numeric_pk_def_const; +CREATE TABLE numeric_pk_def_const +( + numeric_pk_def_const numeric PRIMARY KEY DEFAULT 42 +); + +DROP TABLE IF EXISTS numeric_pk_def_func; +CREATE TABLE numeric_pk_def_func +( + numeric_pk_def_func numeric PRIMARY KEY DEFAULT 42 +); + +DROP TABLE IF EXISTS numeric_nn_pk; +CREATE TABLE numeric_nn_pk +( + numeric_nn_pk numeric NOT NULL PRIMARY KEY +); + +DROP TABLE IF EXISTS numeric_nn_unique_check_pk; +CREATE TABLE numeric_nn_unique_check_pk +( + numeric_nn_unique_check_pk numeric PRIMARY KEY NOT NULL UNIQUE +); + +DROP TABLE IF EXISTS numeric_nn_unique_check_pk_ref; +CREATE TABLE numeric_nn_unique_check_pk_ref +( + numeric_nn_unique_check_pk_ref numeric PRIMARY KEY NOT NULL UNIQUE REFERENCES numeric_ref (numeric_ref) +); + +DROP TABLE IF EXISTS numeric_unique_pk; +CREATE TABLE numeric_unique_pk +( + numeric_unique_pk numeric PRIMARY KEY UNIQUE +); + +DROP TABLE IF EXISTS numeric_unique_check_pk; +CREATE TABLE numeric_unique_check_pk +( + numeric_unique_check_pk numeric PRIMARY KEY UNIQUE +); + +DROP TABLE IF EXISTS numeric_unique_check_pk_ref; +CREATE TABLE numeric_unique_check_pk_ref +( + numeric_unique_check_pk_ref numeric PRIMARY KEY UNIQUE REFERENCES numeric_ref (numeric_ref) +); + +DROP TABLE IF EXISTS numeric_check_pk; +CREATE TABLE numeric_check_pk +( + numeric_check_pk numeric PRIMARY KEY +); + +DROP TABLE IF EXISTS numeric_def_const_unique_check_pk; +CREATE TABLE numeric_def_const_unique_check_pk +( + numeric_def_const_unique_check_pk numeric PRIMARY KEY UNIQUE DEFAULT 42 +); + +DROP TABLE IF EXISTS numeric_def_const_unique_check_pk_ref; +CREATE TABLE numeric_def_const_unique_check_pk_ref +( + numeric_def_const_unique_check_pk_ref numeric PRIMARY KEY UNIQUE DEFAULT 42 REFERENCES numeric_ref (numeric_ref) +); + +DROP TABLE IF EXISTS numeric_def_func_unique_check_pk; +CREATE TABLE numeric_def_func_unique_check_pk +( + numeric_def_func_unique_check_pk numeric PRIMARY KEY UNIQUE DEFAULT 42 +); + +DROP TABLE IF EXISTS numeric_def_func_unique_check_pk_ref; +CREATE TABLE numeric_def_func_unique_check_pk_ref +( + numeric_def_func_unique_check_pk_ref numeric PRIMARY KEY UNIQUE DEFAULT 42 REFERENCES numeric_ref (numeric_ref) +); diff --git a/internal/integration_tests/mysql5/testdata/real.sql b/internal/integration_tests/mysql5/testdata/real.sql new file mode 100644 index 00000000..3e58e6f8 --- /dev/null +++ b/internal/integration_tests/mysql5/testdata/real.sql @@ -0,0 +1,129 @@ +DROP TABLE IF EXISTS real_ref CASCADE; +CREATE TABLE real_ref +( + real_ref real UNIQUE +); + +DROP TABLE IF EXISTS real_table; +CREATE TABLE real_table +( + col real, + + real_nn real NOT NULL, + real_nn_unique real NOT NULL UNIQUE, + real_nn_check real NOT NULL, + real_nn_ref real NOT NULL REFERENCES real_ref (real_ref), + real_nn_def_const real NOT NULL DEFAULT 42, + real_nn_def_func real NOT NULL DEFAULT 42, + real_nn_unique_check real NOT NULL UNIQUE, + + real_unique real UNIQUE, + real_unique_check real UNIQUE, + real_unique_ref real UNIQUE REFERENCES real_ref (real_ref), + real_unique_def_const real UNIQUE DEFAULT 42, + real_unique_def_func real UNIQUE DEFAULT 42, + + real_check real, + real_check_ref real REFERENCES real_ref (real_ref), + real_check_def_const real DEFAULT 42, + real_check_def_func real DEFAULT 42, + + real_ref real REFERENCES real_ref (real_ref), + real_ref_unique_check real UNIQUE REFERENCES real_ref (real_ref), + + real_def_const real DEFAULT 42, + real_def_const_unique_check real UNIQUE DEFAULT 42, + + real_def_func real DEFAULT 42, + real_def_func_unique_check real UNIQUE DEFAULT 42 +); + +DROP TABLE IF EXISTS real_pk; +CREATE TABLE real_pk +( + real_pk real PRIMARY KEY +); + +DROP TABLE IF EXISTS real_pk_ref; +CREATE TABLE real_pk_ref +( + real_pk_ref real PRIMARY KEY REFERENCES real_ref (real_ref) +); + +DROP TABLE IF EXISTS real_pk_def_const; +CREATE TABLE real_pk_def_const +( + real_pk_def_const real PRIMARY KEY DEFAULT 42 +); + +DROP TABLE IF EXISTS real_pk_def_func; +CREATE TABLE real_pk_def_func +( + real_pk_def_func real PRIMARY KEY DEFAULT 42 +); + +DROP TABLE IF EXISTS real_nn_pk; +CREATE TABLE real_nn_pk +( + real_nn_pk real NOT NULL PRIMARY KEY +); + +DROP TABLE IF EXISTS real_nn_unique_check_pk; +CREATE TABLE real_nn_unique_check_pk +( + real_nn_unique_check_pk real PRIMARY KEY NOT NULL UNIQUE +); + +DROP TABLE IF EXISTS real_nn_unique_check_pk_ref; +CREATE TABLE real_nn_unique_check_pk_ref +( + real_nn_unique_check_pk_ref real PRIMARY KEY NOT NULL UNIQUE REFERENCES real_ref (real_ref) +); + +DROP TABLE IF EXISTS real_unique_pk; +CREATE TABLE real_unique_pk +( + real_unique_pk real PRIMARY KEY UNIQUE +); + +DROP TABLE IF EXISTS real_unique_check_pk; +CREATE TABLE real_unique_check_pk +( + real_unique_check_pk real PRIMARY KEY UNIQUE +); + +DROP TABLE IF EXISTS real_unique_check_pk_ref; +CREATE TABLE real_unique_check_pk_ref +( + real_unique_check_pk_ref real PRIMARY KEY UNIQUE REFERENCES real_ref (real_ref) +); + +DROP TABLE IF EXISTS real_check_pk; +CREATE TABLE real_check_pk +( + real_check_pk real PRIMARY KEY +); + +DROP TABLE IF EXISTS real_def_const_unique_check_pk; +CREATE TABLE real_def_const_unique_check_pk +( + real_def_const_unique_check_pk real PRIMARY KEY UNIQUE DEFAULT 42 +); + +DROP TABLE IF EXISTS real_def_const_unique_check_pk_ref; +CREATE TABLE real_def_const_unique_check_pk_ref +( + real_def_const_unique_check_pk_ref real PRIMARY KEY UNIQUE DEFAULT 42 REFERENCES real_ref (real_ref) +); + +DROP TABLE IF EXISTS real_def_func_unique_check_pk; +CREATE TABLE real_def_func_unique_check_pk +( + real_def_func_unique_check_pk real PRIMARY KEY UNIQUE DEFAULT 42 +); + +DROP TABLE IF EXISTS real_def_func_unique_check_pk_ref; +CREATE TABLE real_def_func_unique_check_pk_ref +( + real_def_func_unique_check_pk_ref real PRIMARY KEY UNIQUE DEFAULT 42 REFERENCES real_ref (real_ref) +); diff --git a/internal/integration_tests/mysql5/testdata/smallint.sql b/internal/integration_tests/mysql5/testdata/smallint.sql new file mode 100644 index 00000000..8a410ee7 --- /dev/null +++ b/internal/integration_tests/mysql5/testdata/smallint.sql @@ -0,0 +1,124 @@ +DROP TABLE IF EXISTS smallint_ref CASCADE; +CREATE TABLE smallint_ref +( + smallint_ref smallint UNIQUE +); + +DROP TABLE IF EXISTS smallint_table; +CREATE TABLE smallint_table +( + i smallint, + smallint_nn smallint NOT NULL, + smallint_nn_unique smallint NOT NULL UNIQUE, + smallint_nn_check smallint NOT NULL, + + smallint_unique smallint UNIQUE, + smallint_unique_check smallint UNIQUE, + smallint_unique_ref smallint UNIQUE REFERENCES smallint_ref (smallint_ref), + smallint_unique_def_const smallint UNIQUE DEFAULT 42, + smallint_unique_def_func smallint UNIQUE DEFAULT 42, + + smallint_check smallint, + smallint_check_ref smallint REFERENCES smallint_ref (smallint_ref), + smallint_check_def_const smallint DEFAULT 42, + smallint_check_def_func smallint DEFAULT 42, + + smallint_ref smallint REFERENCES smallint_ref (smallint_ref), + smallint_ref_unique_check smallint UNIQUE REFERENCES smallint_ref (smallint_ref), + + smallint_def_const smallint DEFAULT 42, + smallint_def_const_unique_check smallint UNIQUE DEFAULT 42, + + smallint_def_func smallint DEFAULT 42, + smallint_def_func_unique_check smallint UNIQUE DEFAULT 42 +); + +DROP TABLE IF EXISTS smallint_pk; +CREATE TABLE smallint_pk +( + smallint_pk smallint PRIMARY KEY +); + +DROP TABLE IF EXISTS smallint_pk_ref; +CREATE TABLE smallint_pk_ref +( + smallint_pk_ref smallint PRIMARY KEY REFERENCES smallint_ref (smallint_ref) +); + +DROP TABLE IF EXISTS smallint_pk_def_const; +CREATE TABLE smallint_pk_def_const +( + smallint_pk_def_const smallint PRIMARY KEY DEFAULT 42 +); + +DROP TABLE IF EXISTS smallint_pk_def_func; +CREATE TABLE smallint_pk_def_func +( + smallint_pk_def_func smallint PRIMARY KEY DEFAULT 42 +); + +DROP TABLE IF EXISTS smallint_nn_pk; +CREATE TABLE smallint_nn_pk +( + smallint_nn_pk smallint NOT NULL PRIMARY KEY +); + +DROP TABLE IF EXISTS smallint_nn_unique_check_pk; +CREATE TABLE smallint_nn_unique_check_pk +( + smallint_nn_unique_check_pk smallint PRIMARY KEY NOT NULL UNIQUE +); + +DROP TABLE IF EXISTS smallint_nn_unique_check_pk_ref; +CREATE TABLE smallint_nn_unique_check_pk_ref +( + smallint_nn_unique_check_pk_ref smallint PRIMARY KEY NOT NULL UNIQUE REFERENCES smallint_ref (smallint_ref) +); + +DROP TABLE IF EXISTS smallint_unique_pk; +CREATE TABLE smallint_unique_pk +( + smallint_unique_pk smallint PRIMARY KEY UNIQUE +); + +DROP TABLE IF EXISTS smallint_unique_check_pk; +CREATE TABLE smallint_unique_check_pk +( + smallint_unique_check_pk smallint PRIMARY KEY UNIQUE +); + +DROP TABLE IF EXISTS smallint_unique_check_pk_ref; +CREATE TABLE smallint_unique_check_pk_ref +( + smallint_unique_check_pk_ref smallint PRIMARY KEY UNIQUE REFERENCES smallint_ref (smallint_ref) +); + +DROP TABLE IF EXISTS smallint_check_pk; +CREATE TABLE smallint_check_pk +( + smallint_check_pk smallint PRIMARY KEY +); + +DROP TABLE IF EXISTS smallint_def_const_unique_check_pk; +CREATE TABLE smallint_def_const_unique_check_pk +( + smallint_def_const_unique_check_pk smallint PRIMARY KEY UNIQUE DEFAULT 42 +); + +DROP TABLE IF EXISTS smallint_def_const_unique_check_pk_ref; +CREATE TABLE smallint_def_const_unique_check_pk_ref +( + smallint_def_const_unique_check_pk_ref smallint PRIMARY KEY UNIQUE DEFAULT 42 REFERENCES smallint_ref (smallint_ref) +); + +DROP TABLE IF EXISTS smallint_def_func_unique_check_pk; +CREATE TABLE smallint_def_func_unique_check_pk +( + smallint_def_func_unique_check_pk smallint PRIMARY KEY UNIQUE DEFAULT 42 +); + +DROP TABLE IF EXISTS smallint_def_func_unique_check_pk_ref; +CREATE TABLE smallint_def_func_unique_check_pk_ref +( + smallint_def_func_unique_check_pk_ref smallint PRIMARY KEY UNIQUE DEFAULT 42 REFERENCES smallint_ref (smallint_ref) +); diff --git a/internal/integration_tests/mysql5/testdata/text.sql b/internal/integration_tests/mysql5/testdata/text.sql new file mode 100644 index 00000000..59649235 --- /dev/null +++ b/internal/integration_tests/mysql5/testdata/text.sql @@ -0,0 +1,29 @@ +DROP TABLE IF EXISTS text_ref CASCADE; +CREATE TABLE text_ref +( + text_ref text NOT NULL, + KEY text_ref_len_key (text_ref(10)) +); + +DROP TABLE IF EXISTS text_table; +CREATE TABLE text_table +( + col text, + + text_def_const text, + text_def_func text, + + text_ref text REFERENCES text_ref (text_ref), + + text_nn text NOT NULL, + text_nn_check_cmp text NOT NULL, + text_nn_check_fn text NOT NULL, + text_nn_ref text NOT NULL REFERENCES text_ref (text_ref), + text_nn_def_const text NOT NULL, + text_nn_def_func text NOT NULL, + + text_check text, + text_check_ref text REFERENCES text_ref (text_ref), + text_check_def_const text, + text_check_def_func text +); diff --git a/internal/integration_tests/mysql5/testdata/time.sql b/internal/integration_tests/mysql5/testdata/time.sql new file mode 100644 index 00000000..b8ee8f8e --- /dev/null +++ b/internal/integration_tests/mysql5/testdata/time.sql @@ -0,0 +1,128 @@ +DROP TABLE IF EXISTS time_ref CASCADE; +CREATE TABLE time_ref +( + time_ref time UNIQUE +); + +DROP TABLE IF EXISTS time_table; +CREATE TABLE time_table +( + time time, + time_nn time NOT NULL, + time_nn_unique time NOT NULL UNIQUE, + time_nn_check time NOT NULL, + time_nn_ref time NOT NULL REFERENCES time_ref (time_ref), + time_nn_def_const time NOT NULL DEFAULT '12:34:56', + time_nn_def_func time NOT NULL DEFAULT '12:34:56', + time_nn_unique_check time NOT NULL UNIQUE, + + time_unique time UNIQUE, + time_unique_check time UNIQUE, + time_unique_ref time UNIQUE REFERENCES time_ref (time_ref), + time_unique_def_const time UNIQUE DEFAULT '12:34:56', + time_unique_def_func time UNIQUE DEFAULT '12:34:56', + + time_check time, + time_check_ref time REFERENCES time_ref (time_ref), + time_check_def_const time DEFAULT '12:34:56', + time_check_def_func time DEFAULT '12:34:56', + + time_ref time REFERENCES time_ref (time_ref), + time_ref_unique_check time UNIQUE REFERENCES time_ref (time_ref), + + time_def_const time DEFAULT '12:34:56', + time_def_const_unique_check time UNIQUE DEFAULT '12:34:56', + + time_def_func time DEFAULT '12:34:56', + time_def_func_unique_check time UNIQUE DEFAULT '12:34:56' +); + +DROP TABLE IF EXISTS time_pk; +CREATE TABLE time_pk +( + time_pk time PRIMARY KEY +); + +DROP TABLE IF EXISTS time_pk_ref; +CREATE TABLE time_pk_ref +( + time_pk_ref time PRIMARY KEY REFERENCES time_ref (time_ref) +); + +DROP TABLE IF EXISTS time_pk_def_const; +CREATE TABLE time_pk_def_const +( + time_pk_def_const time PRIMARY KEY DEFAULT '12:34:56' +); + +DROP TABLE IF EXISTS time_pk_def_func; +CREATE TABLE time_pk_def_func +( + time_pk_def_func time PRIMARY KEY DEFAULT '12:34:56' +); + +DROP TABLE IF EXISTS time_nn_pk; +CREATE TABLE time_nn_pk +( + time_nn_pk time NOT NULL PRIMARY KEY +); + +DROP TABLE IF EXISTS time_nn_unique_check_pk; +CREATE TABLE time_nn_unique_check_pk +( + time_nn_unique_check_pk time PRIMARY KEY NOT NULL UNIQUE +); + +DROP TABLE IF EXISTS time_nn_unique_check_pk_ref; +CREATE TABLE time_nn_unique_check_pk_ref +( + time_nn_unique_check_pk_ref time PRIMARY KEY NOT NULL UNIQUE REFERENCES time_ref (time_ref) +); + +DROP TABLE IF EXISTS time_unique_pk; +CREATE TABLE time_unique_pk +( + time_unique_pk time PRIMARY KEY UNIQUE +); + +DROP TABLE IF EXISTS time_unique_check_pk; +CREATE TABLE time_unique_check_pk +( + time_unique_check_pk time PRIMARY KEY UNIQUE +); + +DROP TABLE IF EXISTS time_unique_check_pk_ref; +CREATE TABLE time_unique_check_pk_ref +( + time_unique_check_pk_ref time PRIMARY KEY UNIQUE REFERENCES time_ref (time_ref) +); + +DROP TABLE IF EXISTS time_check_pk; +CREATE TABLE time_check_pk +( + time_check_pk time PRIMARY KEY +); + +DROP TABLE IF EXISTS time_def_const_unique_check_pk; +CREATE TABLE time_def_const_unique_check_pk +( + time_def_const_unique_check_pk time PRIMARY KEY UNIQUE DEFAULT '12:34:56' +); + +DROP TABLE IF EXISTS time_def_const_unique_check_pk_ref; +CREATE TABLE time_def_const_unique_check_pk_ref +( + time_def_const_unique_check_pk_ref time PRIMARY KEY UNIQUE DEFAULT '12:34:56' REFERENCES time_ref (time_ref) +); + +DROP TABLE IF EXISTS time_def_func_unique_check_pk; +CREATE TABLE time_def_func_unique_check_pk +( + time_def_func_unique_check_pk time PRIMARY KEY UNIQUE DEFAULT '12:34:56' +); + +DROP TABLE IF EXISTS time_def_func_unique_check_pk_ref; +CREATE TABLE time_def_func_unique_check_pk_ref +( + time_def_func_unique_check_pk_ref time PRIMARY KEY UNIQUE DEFAULT '12:34:56' REFERENCES time_ref (time_ref) +); diff --git a/internal/integration_tests/mysql5/testdata/timestamp.sql b/internal/integration_tests/mysql5/testdata/timestamp.sql new file mode 100644 index 00000000..7f2353bd --- /dev/null +++ b/internal/integration_tests/mysql5/testdata/timestamp.sql @@ -0,0 +1,128 @@ +DROP TABLE IF EXISTS timestamp_ref CASCADE; +CREATE TABLE timestamp_ref +( + timestamp_ref timestamp UNIQUE DEFAULT CURRENT_TIMESTAMP +); + +DROP TABLE IF EXISTS timestamp_table; +CREATE TABLE timestamp_table +( + timestamp timestamp DEFAULT CURRENT_TIMESTAMP, + timestamp_nn timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP, + timestamp_nn_unique timestamp NOT NULL UNIQUE DEFAULT CURRENT_TIMESTAMP, + timestamp_nn_check timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP, + timestamp_nn_ref timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP REFERENCES timestamp_ref (timestamp_ref), + timestamp_nn_def_const timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP, + timestamp_nn_def_func timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP, + timestamp_nn_unique_check timestamp NOT NULL UNIQUE DEFAULT CURRENT_TIMESTAMP, + + timestamp_unique timestamp UNIQUE DEFAULT CURRENT_TIMESTAMP, + timestamp_unique_check timestamp UNIQUE DEFAULT CURRENT_TIMESTAMP, + timestamp_unique_ref timestamp UNIQUE DEFAULT CURRENT_TIMESTAMP REFERENCES timestamp_ref (timestamp_ref), + timestamp_unique_def_const timestamp UNIQUE DEFAULT CURRENT_TIMESTAMP, + timestamp_unique_def_func timestamp UNIQUE DEFAULT CURRENT_TIMESTAMP, + + timestamp_check timestamp DEFAULT CURRENT_TIMESTAMP, + timestamp_check_ref timestamp DEFAULT CURRENT_TIMESTAMP REFERENCES timestamp_ref (timestamp_ref), + timestamp_check_def_const timestamp DEFAULT CURRENT_TIMESTAMP, + timestamp_check_def_func timestamp DEFAULT CURRENT_TIMESTAMP, + + timestamp_ref timestamp DEFAULT CURRENT_TIMESTAMP REFERENCES timestamp_ref (timestamp_ref), + timestamp_ref_unique_check timestamp UNIQUE DEFAULT CURRENT_TIMESTAMP REFERENCES timestamp_ref (timestamp_ref), + + timestamp_def_const timestamp DEFAULT CURRENT_TIMESTAMP, + timestamp_def_const_unique_check timestamp UNIQUE DEFAULT CURRENT_TIMESTAMP, + + timestamp_def_func timestamp DEFAULT CURRENT_TIMESTAMP, + timestamp_def_func_unique_check timestamp UNIQUE DEFAULT CURRENT_TIMESTAMP +); + +DROP TABLE IF EXISTS timestamp_pk; +CREATE TABLE timestamp_pk +( + timestamp_pk timestamp PRIMARY KEY DEFAULT CURRENT_TIMESTAMP +); + +DROP TABLE IF EXISTS timestamp_pk_ref; +CREATE TABLE timestamp_pk_ref +( + timestamp_pk_ref timestamp PRIMARY KEY DEFAULT CURRENT_TIMESTAMP REFERENCES timestamp_ref (timestamp_ref) +); + +DROP TABLE IF EXISTS timestamp_pk_def_const; +CREATE TABLE timestamp_pk_def_const +( + timestamp_pk_def_const timestamp PRIMARY KEY DEFAULT CURRENT_TIMESTAMP +); + +DROP TABLE IF EXISTS timestamp_pk_def_func; +CREATE TABLE timestamp_pk_def_func +( + timestamp_pk_def_func timestamp PRIMARY KEY DEFAULT CURRENT_TIMESTAMP +); + +DROP TABLE IF EXISTS timestamp_nn_pk; +CREATE TABLE timestamp_nn_pk +( + timestamp_nn_pk timestamp NOT NULL PRIMARY KEY DEFAULT CURRENT_TIMESTAMP +); + +DROP TABLE IF EXISTS timestamp_nn_unique_check_pk; +CREATE TABLE timestamp_nn_unique_check_pk +( + timestamp_nn_unique_check_pk timestamp PRIMARY KEY NOT NULL UNIQUE DEFAULT CURRENT_TIMESTAMP +); + +DROP TABLE IF EXISTS timestamp_nn_unique_check_pk_ref; +CREATE TABLE timestamp_nn_unique_check_pk_ref +( + timestamp_nn_unique_check_pk_ref timestamp PRIMARY KEY NOT NULL UNIQUE DEFAULT CURRENT_TIMESTAMP REFERENCES timestamp_ref (timestamp_ref) +); + +DROP TABLE IF EXISTS timestamp_unique_pk; +CREATE TABLE timestamp_unique_pk +( + timestamp_unique_pk timestamp PRIMARY KEY UNIQUE DEFAULT CURRENT_TIMESTAMP +); + +DROP TABLE IF EXISTS timestamp_unique_check_pk; +CREATE TABLE timestamp_unique_check_pk +( + timestamp_unique_check_pk timestamp PRIMARY KEY UNIQUE DEFAULT CURRENT_TIMESTAMP +); + +DROP TABLE IF EXISTS timestamp_unique_check_pk_ref; +CREATE TABLE timestamp_unique_check_pk_ref +( + timestamp_unique_check_pk_ref timestamp PRIMARY KEY UNIQUE DEFAULT CURRENT_TIMESTAMP REFERENCES timestamp_ref (timestamp_ref) +); + +DROP TABLE IF EXISTS timestamp_check_pk; +CREATE TABLE timestamp_check_pk +( + timestamp_check_pk timestamp PRIMARY KEY DEFAULT CURRENT_TIMESTAMP +); + +DROP TABLE IF EXISTS timestamp_def_const_unique_check_pk; +CREATE TABLE timestamp_def_const_unique_check_pk +( + timestamp_def_const_unique_check_pk timestamp PRIMARY KEY UNIQUE DEFAULT CURRENT_TIMESTAMP +); + +DROP TABLE IF EXISTS timestamp_def_const_unique_check_pk_ref; +CREATE TABLE timestamp_def_const_unique_check_pk_ref +( + timestamp_def_const_unique_check_pk_ref timestamp PRIMARY KEY UNIQUE DEFAULT CURRENT_TIMESTAMP REFERENCES timestamp_ref (timestamp_ref) +); + +DROP TABLE IF EXISTS timestamp_def_func_unique_check_pk; +CREATE TABLE timestamp_def_func_unique_check_pk +( + timestamp_def_func_unique_check_pk timestamp PRIMARY KEY UNIQUE DEFAULT CURRENT_TIMESTAMP +); + +DROP TABLE IF EXISTS timestamp_def_func_unique_check_pk_ref; +CREATE TABLE timestamp_def_func_unique_check_pk_ref +( + timestamp_def_func_unique_check_pk_ref timestamp PRIMARY KEY UNIQUE DEFAULT CURRENT_TIMESTAMP REFERENCES timestamp_ref (timestamp_ref) +); diff --git a/internal/integration_tests/mysql5/testdata/tinyblob.sql b/internal/integration_tests/mysql5/testdata/tinyblob.sql new file mode 100644 index 00000000..46d85791 --- /dev/null +++ b/internal/integration_tests/mysql5/testdata/tinyblob.sql @@ -0,0 +1,29 @@ +DROP TABLE IF EXISTS tinyblob_ref CASCADE; +CREATE TABLE tinyblob_ref +( + tinyblob_ref tinyblob NOT NULL, + KEY tinyblob_ref_len_key (tinyblob_ref(10)) +); + +DROP TABLE IF EXISTS tinyblob_table; +CREATE TABLE tinyblob_table +( + col tinyblob, + + tinyblob_def_const tinyblob, + tinyblob_def_func tinyblob, + + tinyblob_ref tinyblob REFERENCES tinyblob_ref (tinyblob_ref), + + tinyblob_nn tinyblob NOT NULL, + tinyblob_nn_check_cmp tinyblob NOT NULL, + tinyblob_nn_check_fn tinyblob NOT NULL, + tinyblob_nn_ref tinyblob NOT NULL REFERENCES tinyblob_ref (tinyblob_ref), + tinyblob_nn_def_const tinyblob NOT NULL, + tinyblob_nn_def_func tinyblob NOT NULL, + + tinyblob_check tinyblob, + tinyblob_check_ref tinyblob REFERENCES tinyblob_ref (tinyblob_ref), + tinyblob_check_def_const tinyblob, + tinyblob_check_def_func tinyblob +); diff --git a/internal/integration_tests/mysql5/testdata/tinyint.sql b/internal/integration_tests/mysql5/testdata/tinyint.sql new file mode 100644 index 00000000..8815cafd --- /dev/null +++ b/internal/integration_tests/mysql5/testdata/tinyint.sql @@ -0,0 +1,124 @@ +DROP TABLE IF EXISTS tinyint_ref CASCADE; +CREATE TABLE tinyint_ref +( + tinyint_ref tinyint UNIQUE +); + +DROP TABLE IF EXISTS tinyint_table; +CREATE TABLE tinyint_table +( + i tinyint, + tinyint_nn tinyint NOT NULL, + tinyint_nn_unique tinyint NOT NULL UNIQUE, + tinyint_nn_check tinyint NOT NULL, + + tinyint_unique tinyint UNIQUE, + tinyint_unique_check tinyint UNIQUE, + tinyint_unique_ref tinyint UNIQUE REFERENCES tinyint_ref (tinyint_ref), + tinyint_unique_def_const tinyint UNIQUE DEFAULT 42, + tinyint_unique_def_func tinyint UNIQUE DEFAULT 42, + + tinyint_check tinyint, + tinyint_check_ref tinyint REFERENCES tinyint_ref (tinyint_ref), + tinyint_check_def_const tinyint DEFAULT 42, + tinyint_check_def_func tinyint DEFAULT 42, + + tinyint_ref tinyint REFERENCES tinyint_ref (tinyint_ref), + tinyint_ref_unique_check tinyint UNIQUE REFERENCES tinyint_ref (tinyint_ref), + + tinyint_def_const tinyint DEFAULT 42, + tinyint_def_const_unique_check tinyint UNIQUE DEFAULT 42, + + tinyint_def_func tinyint DEFAULT 42, + tinyint_def_func_unique_check tinyint UNIQUE DEFAULT 42 +); + +DROP TABLE IF EXISTS tinyint_pk; +CREATE TABLE tinyint_pk +( + tinyint_pk tinyint PRIMARY KEY +); + +DROP TABLE IF EXISTS tinyint_pk_ref; +CREATE TABLE tinyint_pk_ref +( + tinyint_pk_ref tinyint PRIMARY KEY REFERENCES tinyint_ref (tinyint_ref) +); + +DROP TABLE IF EXISTS tinyint_pk_def_const; +CREATE TABLE tinyint_pk_def_const +( + tinyint_pk_def_const tinyint PRIMARY KEY DEFAULT 42 +); + +DROP TABLE IF EXISTS tinyint_pk_def_func; +CREATE TABLE tinyint_pk_def_func +( + tinyint_pk_def_func tinyint PRIMARY KEY DEFAULT 42 +); + +DROP TABLE IF EXISTS tinyint_nn_pk; +CREATE TABLE tinyint_nn_pk +( + tinyint_nn_pk tinyint NOT NULL PRIMARY KEY +); + +DROP TABLE IF EXISTS tinyint_nn_unique_check_pk; +CREATE TABLE tinyint_nn_unique_check_pk +( + tinyint_nn_unique_check_pk tinyint PRIMARY KEY NOT NULL UNIQUE +); + +DROP TABLE IF EXISTS tinyint_nn_unique_check_pk_ref; +CREATE TABLE tinyint_nn_unique_check_pk_ref +( + tinyint_nn_unique_check_pk_ref tinyint PRIMARY KEY NOT NULL UNIQUE REFERENCES tinyint_ref (tinyint_ref) +); + +DROP TABLE IF EXISTS tinyint_unique_pk; +CREATE TABLE tinyint_unique_pk +( + tinyint_unique_pk tinyint PRIMARY KEY UNIQUE +); + +DROP TABLE IF EXISTS tinyint_unique_check_pk; +CREATE TABLE tinyint_unique_check_pk +( + tinyint_unique_check_pk tinyint PRIMARY KEY UNIQUE +); + +DROP TABLE IF EXISTS tinyint_unique_check_pk_ref; +CREATE TABLE tinyint_unique_check_pk_ref +( + tinyint_unique_check_pk_ref tinyint PRIMARY KEY UNIQUE REFERENCES tinyint_ref (tinyint_ref) +); + +DROP TABLE IF EXISTS tinyint_check_pk; +CREATE TABLE tinyint_check_pk +( + tinyint_check_pk tinyint PRIMARY KEY +); + +DROP TABLE IF EXISTS tinyint_def_const_unique_check_pk; +CREATE TABLE tinyint_def_const_unique_check_pk +( + tinyint_def_const_unique_check_pk tinyint PRIMARY KEY UNIQUE DEFAULT 42 +); + +DROP TABLE IF EXISTS tinyint_def_const_unique_check_pk_ref; +CREATE TABLE tinyint_def_const_unique_check_pk_ref +( + tinyint_def_const_unique_check_pk_ref tinyint PRIMARY KEY UNIQUE DEFAULT 42 REFERENCES tinyint_ref (tinyint_ref) +); + +DROP TABLE IF EXISTS tinyint_def_func_unique_check_pk; +CREATE TABLE tinyint_def_func_unique_check_pk +( + tinyint_def_func_unique_check_pk tinyint PRIMARY KEY UNIQUE DEFAULT 42 +); + +DROP TABLE IF EXISTS tinyint_def_func_unique_check_pk_ref; +CREATE TABLE tinyint_def_func_unique_check_pk_ref +( + tinyint_def_func_unique_check_pk_ref tinyint PRIMARY KEY UNIQUE DEFAULT 42 REFERENCES tinyint_ref (tinyint_ref) +); diff --git a/internal/integration_tests/mysql5/testdata/tinytext.sql b/internal/integration_tests/mysql5/testdata/tinytext.sql new file mode 100644 index 00000000..8b1c4579 --- /dev/null +++ b/internal/integration_tests/mysql5/testdata/tinytext.sql @@ -0,0 +1,29 @@ +DROP TABLE IF EXISTS tinytext_ref CASCADE; +CREATE TABLE tinytext_ref +( + tinytext_ref tinytext NOT NULL, + KEY tinytext_ref_len_key (tinytext_ref(10)) +); + +DROP TABLE IF EXISTS tinytext_table; +CREATE TABLE tinytext_table +( + col tinytext, + + tinytext_def_const tinytext, + tinytext_def_func tinytext, + + tinytext_ref tinytext REFERENCES tinytext_ref (tinytext_ref), + + tinytext_nn tinytext NOT NULL, + tinytext_nn_check_cmp tinytext NOT NULL, + tinytext_nn_check_fn tinytext NOT NULL, + tinytext_nn_ref tinytext NOT NULL REFERENCES tinytext_ref (tinytext_ref), + tinytext_nn_def_const tinytext NOT NULL, + tinytext_nn_def_func tinytext NOT NULL, + + tinytext_check tinytext, + tinytext_check_ref tinytext REFERENCES tinytext_ref (tinytext_ref), + tinytext_check_def_const tinytext, + tinytext_check_def_func tinytext +); diff --git a/internal/integration_tests/mysql5/testdata/varbinary.sql b/internal/integration_tests/mysql5/testdata/varbinary.sql new file mode 100644 index 00000000..5dbf6698 --- /dev/null +++ b/internal/integration_tests/mysql5/testdata/varbinary.sql @@ -0,0 +1,131 @@ +DROP TABLE IF EXISTS varbinary_ref CASCADE; +CREATE TABLE varbinary_ref +( + varbinary_ref varbinary(10) UNIQUE +); + +DROP TABLE IF EXISTS varbinary_table; +CREATE TABLE varbinary_table +( + col varbinary(10), + + varbinary_cap varbinary(10), + varbinary_nn varbinary(10) NOT NULL, + varbinary_nn_unique varbinary(10) NOT NULL UNIQUE, + varbinary_nn_check_cmp varbinary(10) NOT NULL, + varbinary_nn_check_fn varbinary(10) NOT NULL, + varbinary_nn_ref varbinary(10) NOT NULL REFERENCES varbinary_ref(varbinary_ref), + varbinary_nn_def_const varbinary(10) NOT NULL DEFAULT '42', + varbinary_nn_def_func varbinary(10) NOT NULL DEFAULT 42, + varbinary_nn_unique_check varbinary(10) NOT NULL UNIQUE, + + varbinary_unique varbinary(10) UNIQUE, + varbinary_unique_check varbinary(10) UNIQUE, + varbinary_unique_ref varbinary(10) UNIQUE REFERENCES varbinary_ref(varbinary_ref), + varbinary_unique_def_const varbinary(10) UNIQUE DEFAULT '42', + varbinary_unique_def_func varbinary(10) UNIQUE DEFAULT 42, + + varbinary_check varbinary(10), + varbinary_check_ref varbinary(10) REFERENCES varbinary_ref(varbinary_ref), + varbinary_check_def_const varbinary(10) DEFAULT '42', + varbinary_check_def_func varbinary(10) DEFAULT 42, + + varbinary_ref varbinary(10) REFERENCES varbinary_ref(varbinary_ref), + varbinary_ref_unique_check varbinary(10) UNIQUE REFERENCES varbinary_ref(varbinary_ref), + + varbinary_def_const varbinary(10) DEFAULT '42', + varbinary_def_const_unique_check varbinary(10) UNIQUE DEFAULT '42', + + varbinary_def_func varbinary(10) DEFAULT 42, + varbinary_def_func_unique_check varbinary(10) UNIQUE DEFAULT 42 +); + +DROP TABLE IF EXISTS varbinary_pk; +CREATE TABLE varbinary_pk +( + varbinary_pk varbinary(10) PRIMARY KEY +); + +DROP TABLE IF EXISTS varbinary_pk_ref; +CREATE TABLE varbinary_pk_ref +( + varbinary_pk_ref varbinary(10) PRIMARY KEY REFERENCES varbinary_ref(varbinary_ref) +); + +DROP TABLE IF EXISTS varbinary_pk_def_const; +CREATE TABLE varbinary_pk_def_const +( + varbinary_pk_def_const varbinary(10) PRIMARY KEY DEFAULT '42' +); + +DROP TABLE IF EXISTS varbinary_pk_def_func; +CREATE TABLE varbinary_pk_def_func +( + varbinary_pk_def_func varbinary(10) PRIMARY KEY DEFAULT 42 +); + +DROP TABLE IF EXISTS varbinary_nn_pk; +CREATE TABLE varbinary_nn_pk +( + varbinary_nn_pk varbinary(10) NOT NULL PRIMARY KEY +); + +DROP TABLE IF EXISTS varbinary_nn_unique_check_pk; +CREATE TABLE varbinary_nn_unique_check_pk +( + varbinary_nn_unique_check_pk varbinary(10) PRIMARY KEY NOT NULL UNIQUE +); + +DROP TABLE IF EXISTS varbinary_nn_unique_check_pk_ref; +CREATE TABLE varbinary_nn_unique_check_pk_ref +( + varbinary_nn_unique_check_pk_ref varbinary(10) PRIMARY KEY NOT NULL UNIQUE REFERENCES varbinary_ref(varbinary_ref) +); + +DROP TABLE IF EXISTS varbinary_unique_pk; +CREATE TABLE varbinary_unique_pk +( + varbinary_unique_pk varbinary(10) PRIMARY KEY UNIQUE +); + +DROP TABLE IF EXISTS varbinary_unique_check_pk; +CREATE TABLE varbinary_unique_check_pk +( + varbinary_unique_check_pk varbinary(10) PRIMARY KEY UNIQUE +); + +DROP TABLE IF EXISTS varbinary_unique_check_pk_ref; +CREATE TABLE varbinary_unique_check_pk_ref +( + varbinary_unique_check_pk_ref varbinary(10) PRIMARY KEY UNIQUE REFERENCES varbinary_ref(varbinary_ref) +); + +DROP TABLE IF EXISTS varbinary_check_pk; +CREATE TABLE varbinary_check_pk +( + varbinary_check_pk varbinary(10) PRIMARY KEY +); + +DROP TABLE IF EXISTS varbinary_def_const_unique_check_pk; +CREATE TABLE varbinary_def_const_unique_check_pk +( + varbinary_def_const_unique_check_pk varbinary(10) PRIMARY KEY UNIQUE DEFAULT '42' +); + +DROP TABLE IF EXISTS varbinary_def_const_unique_check_pk_ref; +CREATE TABLE varbinary_def_const_unique_check_pk_ref +( + varbinary_def_const_unique_check_pk_ref varbinary(10) PRIMARY KEY UNIQUE DEFAULT '42' REFERENCES varbinary_ref(varbinary_ref) +); + +DROP TABLE IF EXISTS varbinary_def_func_unique_check_pk; +CREATE TABLE varbinary_def_func_unique_check_pk +( + varbinary_def_func_unique_check_pk varbinary(10) PRIMARY KEY UNIQUE DEFAULT 42 +); + +DROP TABLE IF EXISTS varbinary_def_func_unique_check_pk_ref; +CREATE TABLE varbinary_def_func_unique_check_pk_ref +( + varbinary_def_func_unique_check_pk_ref varbinary(10) PRIMARY KEY UNIQUE DEFAULT 42 REFERENCES varbinary_ref(varbinary_ref) +); diff --git a/internal/integration_tests/mysql5/testdata/varchar.sql b/internal/integration_tests/mysql5/testdata/varchar.sql new file mode 100644 index 00000000..bd9137e6 --- /dev/null +++ b/internal/integration_tests/mysql5/testdata/varchar.sql @@ -0,0 +1,131 @@ +DROP TABLE IF EXISTS varchar_ref CASCADE; +CREATE TABLE varchar_ref +( + varchar_ref varchar(10) UNIQUE +); + +DROP TABLE IF EXISTS varchar_table; +CREATE TABLE varchar_table +( + col varchar(10), + + varchar_cap varchar(10), + varchar_nn varchar(10) NOT NULL, + varchar_nn_unique varchar(10) NOT NULL UNIQUE, + varchar_nn_check_cmp varchar(10) NOT NULL, + varchar_nn_check_fn varchar(10) NOT NULL, + varchar_nn_ref varchar(10) NOT NULL REFERENCES varchar_ref (varchar_ref), + varchar_nn_def_const varchar(10) NOT NULL DEFAULT '42', + varchar_nn_def_func varchar(10) NOT NULL DEFAULT 42, + varchar_nn_unique_check varchar(10) NOT NULL UNIQUE, + + varchar_unique varchar(10) UNIQUE, + varchar_unique_check varchar(10) UNIQUE, + varchar_unique_ref varchar(10) UNIQUE REFERENCES varchar_ref (varchar_ref), + varchar_unique_def_const varchar(10) UNIQUE DEFAULT '42', + varchar_unique_def_func varchar(10) UNIQUE DEFAULT 42, + + varchar_check varchar(10), + varchar_check_ref varchar(10) REFERENCES varchar_ref (varchar_ref), + varchar_check_def_const varchar(10) DEFAULT '42', + varchar_check_def_func varchar(10) DEFAULT 42, + + varchar_ref varchar(10) REFERENCES varchar_ref (varchar_ref), + varchar_ref_unique_check varchar(10) UNIQUE REFERENCES varchar_ref (varchar_ref), + + varchar_def_const varchar(10) DEFAULT '42', + varchar_def_const_unique_check varchar(10) UNIQUE DEFAULT '42', + + varchar_def_func varchar(10) DEFAULT 42, + varchar_def_func_unique_check varchar(10) UNIQUE DEFAULT 42 +); + +DROP TABLE IF EXISTS varchar_pk; +CREATE TABLE varchar_pk +( + varchar_pk varchar(10) PRIMARY KEY +); + +DROP TABLE IF EXISTS varchar_pk_ref; +CREATE TABLE varchar_pk_ref +( + varchar_pk_ref varchar(10) PRIMARY KEY REFERENCES varchar_ref (varchar_ref) +); + +DROP TABLE IF EXISTS varchar_pk_def_const; +CREATE TABLE varchar_pk_def_const +( + varchar_pk_def_const varchar(10) PRIMARY KEY DEFAULT '42' +); + +DROP TABLE IF EXISTS varchar_pk_def_func; +CREATE TABLE varchar_pk_def_func +( + varchar_pk_def_func varchar(10) PRIMARY KEY DEFAULT 42 +); + +DROP TABLE IF EXISTS varchar_nn_pk; +CREATE TABLE varchar_nn_pk +( + varchar_nn_pk varchar(10) NOT NULL PRIMARY KEY +); + +DROP TABLE IF EXISTS varchar_nn_unique_check_pk; +CREATE TABLE varchar_nn_unique_check_pk +( + varchar_nn_unique_check_pk varchar(10) PRIMARY KEY NOT NULL UNIQUE +); + +DROP TABLE IF EXISTS varchar_nn_unique_check_pk_ref; +CREATE TABLE varchar_nn_unique_check_pk_ref +( + varchar_nn_unique_check_pk_ref varchar(10) PRIMARY KEY NOT NULL UNIQUE REFERENCES varchar_ref (varchar_ref) +); + +DROP TABLE IF EXISTS varchar_unique_pk; +CREATE TABLE varchar_unique_pk +( + varchar_unique_pk varchar(10) PRIMARY KEY UNIQUE +); + +DROP TABLE IF EXISTS varchar_unique_check_pk; +CREATE TABLE varchar_unique_check_pk +( + varchar_unique_check_pk varchar(10) PRIMARY KEY UNIQUE +); + +DROP TABLE IF EXISTS varchar_unique_check_pk_ref; +CREATE TABLE varchar_unique_check_pk_ref +( + varchar_unique_check_pk_ref varchar(10) PRIMARY KEY UNIQUE REFERENCES varchar_ref (varchar_ref) +); + +DROP TABLE IF EXISTS varchar_check_pk; +CREATE TABLE varchar_check_pk +( + varchar_check_pk varchar(10) PRIMARY KEY +); + +DROP TABLE IF EXISTS varchar_def_const_unique_check_pk; +CREATE TABLE varchar_def_const_unique_check_pk +( + varchar_def_const_unique_check_pk varchar(10) PRIMARY KEY UNIQUE DEFAULT '42' +); + +DROP TABLE IF EXISTS varchar_def_const_unique_check_pk_ref; +CREATE TABLE varchar_def_const_unique_check_pk_ref +( + varchar_def_const_unique_check_pk_ref varchar(10) PRIMARY KEY UNIQUE DEFAULT '42' REFERENCES varchar_ref (varchar_ref) +); + +DROP TABLE IF EXISTS varchar_def_func_unique_check_pk; +CREATE TABLE varchar_def_func_unique_check_pk +( + varchar_def_func_unique_check_pk varchar(10) PRIMARY KEY UNIQUE DEFAULT 42 +); + +DROP TABLE IF EXISTS varchar_def_func_unique_check_pk_ref; +CREATE TABLE varchar_def_func_unique_check_pk_ref +( + varchar_def_func_unique_check_pk_ref varchar(10) PRIMARY KEY UNIQUE DEFAULT 42 REFERENCES varchar_ref (varchar_ref) +); diff --git a/internal/integration_tests/mysql5/testdata/year.sql b/internal/integration_tests/mysql5/testdata/year.sql new file mode 100644 index 00000000..1d5da134 --- /dev/null +++ b/internal/integration_tests/mysql5/testdata/year.sql @@ -0,0 +1,128 @@ +DROP TABLE IF EXISTS year_ref CASCADE; +CREATE TABLE year_ref +( + year_ref year UNIQUE +); + +DROP TABLE IF EXISTS year_table; +CREATE TABLE year_table +( + year year, + year_nn year NOT NULL, + year_nn_unique year NOT NULL UNIQUE, + year_nn_check year NOT NULL, + year_nn_ref year NOT NULL REFERENCES year_ref(year_ref), + year_nn_def_const year NOT NULL DEFAULT '2020', + year_nn_def_func year NOT NULL DEFAULT '2020', + year_nn_unique_check year NOT NULL UNIQUE, + + year_unique year UNIQUE, + year_unique_check year UNIQUE, + year_unique_ref year UNIQUE REFERENCES year_ref(year_ref), + year_unique_def_const year UNIQUE DEFAULT '2020', + year_unique_def_func year UNIQUE DEFAULT '2020', + + year_check year, + year_check_ref year REFERENCES year_ref(year_ref), + year_check_def_const year DEFAULT '2020', + year_check_def_func year DEFAULT '2020', + + year_ref year REFERENCES year_ref(year_ref), + year_ref_unique_check year UNIQUE REFERENCES year_ref(year_ref), + + year_def_const year DEFAULT '2020', + year_def_const_unique_check year UNIQUE DEFAULT '2020', + + year_def_func year DEFAULT '2020', + year_def_func_unique_check year UNIQUE DEFAULT '2020' +); + +DROP TABLE IF EXISTS year_pk; +CREATE TABLE year_pk +( + year_pk year PRIMARY KEY +); + +DROP TABLE IF EXISTS year_pk_ref; +CREATE TABLE year_pk_ref +( + year_pk_ref year PRIMARY KEY REFERENCES year_ref(year_ref) +); + +DROP TABLE IF EXISTS year_pk_def_const; +CREATE TABLE year_pk_def_const +( + year_pk_def_const year PRIMARY KEY DEFAULT '2020' +); + +DROP TABLE IF EXISTS year_pk_def_func; +CREATE TABLE year_pk_def_func +( + year_pk_def_func year PRIMARY KEY DEFAULT '2020' +); + +DROP TABLE IF EXISTS year_nn_pk; +CREATE TABLE year_nn_pk +( + year_nn_pk year NOT NULL PRIMARY KEY +); + +DROP TABLE IF EXISTS year_nn_unique_check_pk; +CREATE TABLE year_nn_unique_check_pk +( + year_nn_unique_check_pk year PRIMARY KEY NOT NULL UNIQUE +); + +DROP TABLE IF EXISTS year_nn_unique_check_pk_ref; +CREATE TABLE year_nn_unique_check_pk_ref +( + year_nn_unique_check_pk_ref year PRIMARY KEY NOT NULL UNIQUE REFERENCES year_ref(year_ref) +); + +DROP TABLE IF EXISTS year_unique_pk; +CREATE TABLE year_unique_pk +( + year_unique_pk year PRIMARY KEY UNIQUE +); + +DROP TABLE IF EXISTS year_unique_check_pk; +CREATE TABLE year_unique_check_pk +( + year_unique_check_pk year PRIMARY KEY UNIQUE +); + +DROP TABLE IF EXISTS year_unique_check_pk_ref; +CREATE TABLE year_unique_check_pk_ref +( + year_unique_check_pk_ref year PRIMARY KEY UNIQUE REFERENCES year_ref(year_ref) +); + +DROP TABLE IF EXISTS year_check_pk; +CREATE TABLE year_check_pk +( + year_check_pk year PRIMARY KEY +); + +DROP TABLE IF EXISTS year_def_const_unique_check_pk; +CREATE TABLE year_def_const_unique_check_pk +( + year_def_const_unique_check_pk year PRIMARY KEY UNIQUE DEFAULT '2020' +); + +DROP TABLE IF EXISTS year_def_const_unique_check_pk_ref; +CREATE TABLE year_def_const_unique_check_pk_ref +( + year_def_const_unique_check_pk_ref year PRIMARY KEY UNIQUE DEFAULT '2020' REFERENCES year_ref(year_ref) +); + +DROP TABLE IF EXISTS year_def_func_unique_check_pk; +CREATE TABLE year_def_func_unique_check_pk +( + year_def_func_unique_check_pk year PRIMARY KEY UNIQUE DEFAULT '2020' +); + +DROP TABLE IF EXISTS year_def_func_unique_check_pk_ref; +CREATE TABLE year_def_func_unique_check_pk_ref +( + year_def_func_unique_check_pk_ref year PRIMARY KEY UNIQUE DEFAULT '2020' REFERENCES year_ref(year_ref) +); diff --git a/internal/integration_tests/mysql8/defaultsettings/BigintCheckPk.go b/internal/integration_tests/mysql8/defaultsettings/BigintCheckPk.go new file mode 100644 index 00000000..2474c3d5 --- /dev/null +++ b/internal/integration_tests/mysql8/defaultsettings/BigintCheckPk.go @@ -0,0 +1,5 @@ +package dto + +type BigintCheckPk struct { + BigintCheckPk int `db:"bigint_check_pk"` +} diff --git a/internal/integration_tests/mysql8/defaultsettings/BigintDefConstUniqueCheckPk.go b/internal/integration_tests/mysql8/defaultsettings/BigintDefConstUniqueCheckPk.go new file mode 100644 index 00000000..808e31f2 --- /dev/null +++ b/internal/integration_tests/mysql8/defaultsettings/BigintDefConstUniqueCheckPk.go @@ -0,0 +1,5 @@ +package dto + +type BigintDefConstUniqueCheckPk struct { + BigintDefConstUniqueCheckPk int `db:"bigint_def_const_unique_check_pk"` +} diff --git a/internal/integration_tests/mysql8/defaultsettings/BigintDefConstUniqueCheckPkRef.go b/internal/integration_tests/mysql8/defaultsettings/BigintDefConstUniqueCheckPkRef.go new file mode 100644 index 00000000..64fcb8c8 --- /dev/null +++ b/internal/integration_tests/mysql8/defaultsettings/BigintDefConstUniqueCheckPkRef.go @@ -0,0 +1,5 @@ +package dto + +type BigintDefConstUniqueCheckPkRef struct { + BigintDefConstUniqueCheckPkRef int `db:"bigint_def_const_unique_check_pk_ref"` +} diff --git a/internal/integration_tests/mysql8/defaultsettings/BigintDefFuncUniqueCheckPk.go b/internal/integration_tests/mysql8/defaultsettings/BigintDefFuncUniqueCheckPk.go new file mode 100644 index 00000000..68117369 --- /dev/null +++ b/internal/integration_tests/mysql8/defaultsettings/BigintDefFuncUniqueCheckPk.go @@ -0,0 +1,5 @@ +package dto + +type BigintDefFuncUniqueCheckPk struct { + BigintDefFuncUniqueCheckPk int `db:"bigint_def_func_unique_check_pk"` +} diff --git a/internal/integration_tests/mysql8/defaultsettings/BigintDefFuncUniqueCheckPkRef.go b/internal/integration_tests/mysql8/defaultsettings/BigintDefFuncUniqueCheckPkRef.go new file mode 100644 index 00000000..dbd5da9d --- /dev/null +++ b/internal/integration_tests/mysql8/defaultsettings/BigintDefFuncUniqueCheckPkRef.go @@ -0,0 +1,5 @@ +package dto + +type BigintDefFuncUniqueCheckPkRef struct { + BigintDefFuncUniqueCheckPkRef int `db:"bigint_def_func_unique_check_pk_ref"` +} diff --git a/internal/integration_tests/mysql8/defaultsettings/BigintNnPk.go b/internal/integration_tests/mysql8/defaultsettings/BigintNnPk.go new file mode 100644 index 00000000..f4ddc4aa --- /dev/null +++ b/internal/integration_tests/mysql8/defaultsettings/BigintNnPk.go @@ -0,0 +1,5 @@ +package dto + +type BigintNnPk struct { + BigintNnPk int `db:"bigint_nn_pk"` +} diff --git a/internal/integration_tests/mysql8/defaultsettings/BigintNnUniqueCheckPk.go b/internal/integration_tests/mysql8/defaultsettings/BigintNnUniqueCheckPk.go new file mode 100644 index 00000000..ce5d15c5 --- /dev/null +++ b/internal/integration_tests/mysql8/defaultsettings/BigintNnUniqueCheckPk.go @@ -0,0 +1,5 @@ +package dto + +type BigintNnUniqueCheckPk struct { + BigintNnUniqueCheckPk int `db:"bigint_nn_unique_check_pk"` +} diff --git a/internal/integration_tests/mysql8/defaultsettings/BigintNnUniqueCheckPkRef.go b/internal/integration_tests/mysql8/defaultsettings/BigintNnUniqueCheckPkRef.go new file mode 100644 index 00000000..4c065777 --- /dev/null +++ b/internal/integration_tests/mysql8/defaultsettings/BigintNnUniqueCheckPkRef.go @@ -0,0 +1,5 @@ +package dto + +type BigintNnUniqueCheckPkRef struct { + BigintNnUniqueCheckPkRef int `db:"bigint_nn_unique_check_pk_ref"` +} diff --git a/internal/integration_tests/mysql8/defaultsettings/BigintPk.go b/internal/integration_tests/mysql8/defaultsettings/BigintPk.go new file mode 100644 index 00000000..0b34e55b --- /dev/null +++ b/internal/integration_tests/mysql8/defaultsettings/BigintPk.go @@ -0,0 +1,5 @@ +package dto + +type BigintPk struct { + BigintPk int `db:"bigint_pk"` +} diff --git a/internal/integration_tests/mysql8/defaultsettings/BigintPkDefConst.go b/internal/integration_tests/mysql8/defaultsettings/BigintPkDefConst.go new file mode 100644 index 00000000..08c26cbd --- /dev/null +++ b/internal/integration_tests/mysql8/defaultsettings/BigintPkDefConst.go @@ -0,0 +1,5 @@ +package dto + +type BigintPkDefConst struct { + BigintPkDefConst int `db:"bigint_pk_def_const"` +} diff --git a/internal/integration_tests/mysql8/defaultsettings/BigintPkDefFunc.go b/internal/integration_tests/mysql8/defaultsettings/BigintPkDefFunc.go new file mode 100644 index 00000000..656fadc9 --- /dev/null +++ b/internal/integration_tests/mysql8/defaultsettings/BigintPkDefFunc.go @@ -0,0 +1,5 @@ +package dto + +type BigintPkDefFunc struct { + BigintPkDefFunc int `db:"bigint_pk_def_func"` +} diff --git a/internal/integration_tests/mysql8/defaultsettings/BigintPkRef.go b/internal/integration_tests/mysql8/defaultsettings/BigintPkRef.go new file mode 100644 index 00000000..21608d8c --- /dev/null +++ b/internal/integration_tests/mysql8/defaultsettings/BigintPkRef.go @@ -0,0 +1,5 @@ +package dto + +type BigintPkRef struct { + BigintPkRef int `db:"bigint_pk_ref"` +} diff --git a/internal/integration_tests/mysql8/defaultsettings/BigintRef.go b/internal/integration_tests/mysql8/defaultsettings/BigintRef.go new file mode 100644 index 00000000..348ad421 --- /dev/null +++ b/internal/integration_tests/mysql8/defaultsettings/BigintRef.go @@ -0,0 +1,9 @@ +package dto + +import ( + "database/sql" +) + +type BigintRef struct { + BigintRef sql.NullInt64 `db:"bigint_ref"` +} diff --git a/internal/integration_tests/mysql8/defaultsettings/BigintTable.go b/internal/integration_tests/mysql8/defaultsettings/BigintTable.go new file mode 100644 index 00000000..fac6e51e --- /dev/null +++ b/internal/integration_tests/mysql8/defaultsettings/BigintTable.go @@ -0,0 +1,27 @@ +package dto + +import ( + "database/sql" +) + +type BigintTable struct { + I sql.NullInt64 `db:"i"` + BigintNn int `db:"bigint_nn"` + BigintNnUnique int `db:"bigint_nn_unique"` + BigintNnCheck int `db:"bigint_nn_check"` + BigintUnique sql.NullInt64 `db:"bigint_unique"` + BigintUniqueCheck sql.NullInt64 `db:"bigint_unique_check"` + BigintUniqueRef sql.NullInt64 `db:"bigint_unique_ref"` + BigintUniqueDefConst sql.NullInt64 `db:"bigint_unique_def_const"` + BigintUniqueDefFunc sql.NullInt64 `db:"bigint_unique_def_func"` + BigintCheck sql.NullInt64 `db:"bigint_check"` + BigintCheckRef sql.NullInt64 `db:"bigint_check_ref"` + BigintCheckDefConst sql.NullInt64 `db:"bigint_check_def_const"` + BigintCheckDefFunc sql.NullInt64 `db:"bigint_check_def_func"` + BigintRef sql.NullInt64 `db:"bigint_ref"` + BigintRefUniqueCheck sql.NullInt64 `db:"bigint_ref_unique_check"` + BigintDefConst sql.NullInt64 `db:"bigint_def_const"` + BigintDefConstUniqueCheck sql.NullInt64 `db:"bigint_def_const_unique_check"` + BigintDefFunc sql.NullInt64 `db:"bigint_def_func"` + BigintDefFuncUniqueCheck sql.NullInt64 `db:"bigint_def_func_unique_check"` +} diff --git a/internal/integration_tests/mysql8/defaultsettings/BigintUniqueCheckPk.go b/internal/integration_tests/mysql8/defaultsettings/BigintUniqueCheckPk.go new file mode 100644 index 00000000..d2cd0c7e --- /dev/null +++ b/internal/integration_tests/mysql8/defaultsettings/BigintUniqueCheckPk.go @@ -0,0 +1,5 @@ +package dto + +type BigintUniqueCheckPk struct { + BigintUniqueCheckPk int `db:"bigint_unique_check_pk"` +} diff --git a/internal/integration_tests/mysql8/defaultsettings/BigintUniqueCheckPkRef.go b/internal/integration_tests/mysql8/defaultsettings/BigintUniqueCheckPkRef.go new file mode 100644 index 00000000..f41b59bf --- /dev/null +++ b/internal/integration_tests/mysql8/defaultsettings/BigintUniqueCheckPkRef.go @@ -0,0 +1,5 @@ +package dto + +type BigintUniqueCheckPkRef struct { + BigintUniqueCheckPkRef int `db:"bigint_unique_check_pk_ref"` +} diff --git a/internal/integration_tests/mysql8/defaultsettings/BigintUniquePk.go b/internal/integration_tests/mysql8/defaultsettings/BigintUniquePk.go new file mode 100644 index 00000000..06e50c8e --- /dev/null +++ b/internal/integration_tests/mysql8/defaultsettings/BigintUniquePk.go @@ -0,0 +1,5 @@ +package dto + +type BigintUniquePk struct { + BigintUniquePk int `db:"bigint_unique_pk"` +} diff --git a/internal/integration_tests/mysql8/defaultsettings/BinaryCheckPk.go b/internal/integration_tests/mysql8/defaultsettings/BinaryCheckPk.go new file mode 100644 index 00000000..efa14dfd --- /dev/null +++ b/internal/integration_tests/mysql8/defaultsettings/BinaryCheckPk.go @@ -0,0 +1,5 @@ +package dto + +type BinaryCheckPk struct { + BinaryCheckPk string `db:"binary_check_pk"` +} diff --git a/internal/integration_tests/mysql8/defaultsettings/BinaryDefConstUniqueCheckPk.go b/internal/integration_tests/mysql8/defaultsettings/BinaryDefConstUniqueCheckPk.go new file mode 100644 index 00000000..065a8a21 --- /dev/null +++ b/internal/integration_tests/mysql8/defaultsettings/BinaryDefConstUniqueCheckPk.go @@ -0,0 +1,5 @@ +package dto + +type BinaryDefConstUniqueCheckPk struct { + BinaryDefConstUniqueCheckPk string `db:"binary_def_const_unique_check_pk"` +} diff --git a/internal/integration_tests/mysql8/defaultsettings/BinaryDefConstUniqueCheckPkRef.go b/internal/integration_tests/mysql8/defaultsettings/BinaryDefConstUniqueCheckPkRef.go new file mode 100644 index 00000000..5309fbd7 --- /dev/null +++ b/internal/integration_tests/mysql8/defaultsettings/BinaryDefConstUniqueCheckPkRef.go @@ -0,0 +1,5 @@ +package dto + +type BinaryDefConstUniqueCheckPkRef struct { + BinaryDefConstUniqueCheckPkRef string `db:"binary_def_const_unique_check_pk_ref"` +} diff --git a/internal/integration_tests/mysql8/defaultsettings/BinaryDefFuncUniqueCheckPk.go b/internal/integration_tests/mysql8/defaultsettings/BinaryDefFuncUniqueCheckPk.go new file mode 100644 index 00000000..17d016cf --- /dev/null +++ b/internal/integration_tests/mysql8/defaultsettings/BinaryDefFuncUniqueCheckPk.go @@ -0,0 +1,5 @@ +package dto + +type BinaryDefFuncUniqueCheckPk struct { + BinaryDefFuncUniqueCheckPk string `db:"binary_def_func_unique_check_pk"` +} diff --git a/internal/integration_tests/mysql8/defaultsettings/BinaryDefFuncUniqueCheckPkRef.go b/internal/integration_tests/mysql8/defaultsettings/BinaryDefFuncUniqueCheckPkRef.go new file mode 100644 index 00000000..8ad6c58e --- /dev/null +++ b/internal/integration_tests/mysql8/defaultsettings/BinaryDefFuncUniqueCheckPkRef.go @@ -0,0 +1,5 @@ +package dto + +type BinaryDefFuncUniqueCheckPkRef struct { + BinaryDefFuncUniqueCheckPkRef string `db:"binary_def_func_unique_check_pk_ref"` +} diff --git a/internal/integration_tests/mysql8/defaultsettings/BinaryNnPk.go b/internal/integration_tests/mysql8/defaultsettings/BinaryNnPk.go new file mode 100644 index 00000000..3ed599f3 --- /dev/null +++ b/internal/integration_tests/mysql8/defaultsettings/BinaryNnPk.go @@ -0,0 +1,5 @@ +package dto + +type BinaryNnPk struct { + BinaryNnPk string `db:"binary_nn_pk"` +} diff --git a/internal/integration_tests/mysql8/defaultsettings/BinaryNnUniqueCheckPk.go b/internal/integration_tests/mysql8/defaultsettings/BinaryNnUniqueCheckPk.go new file mode 100644 index 00000000..c2c3e783 --- /dev/null +++ b/internal/integration_tests/mysql8/defaultsettings/BinaryNnUniqueCheckPk.go @@ -0,0 +1,5 @@ +package dto + +type BinaryNnUniqueCheckPk struct { + BinaryNnUniqueCheckPk string `db:"binary_nn_unique_check_pk"` +} diff --git a/internal/integration_tests/mysql8/defaultsettings/BinaryNnUniqueCheckPkRef.go b/internal/integration_tests/mysql8/defaultsettings/BinaryNnUniqueCheckPkRef.go new file mode 100644 index 00000000..d0c44d10 --- /dev/null +++ b/internal/integration_tests/mysql8/defaultsettings/BinaryNnUniqueCheckPkRef.go @@ -0,0 +1,5 @@ +package dto + +type BinaryNnUniqueCheckPkRef struct { + BinaryNnUniqueCheckPkRef string `db:"binary_nn_unique_check_pk_ref"` +} diff --git a/internal/integration_tests/mysql8/defaultsettings/BinaryPk.go b/internal/integration_tests/mysql8/defaultsettings/BinaryPk.go new file mode 100644 index 00000000..6b5f9d3c --- /dev/null +++ b/internal/integration_tests/mysql8/defaultsettings/BinaryPk.go @@ -0,0 +1,5 @@ +package dto + +type BinaryPk struct { + BinaryPk string `db:"binary_pk"` +} diff --git a/internal/integration_tests/mysql8/defaultsettings/BinaryPkDefConst.go b/internal/integration_tests/mysql8/defaultsettings/BinaryPkDefConst.go new file mode 100644 index 00000000..a82868f0 --- /dev/null +++ b/internal/integration_tests/mysql8/defaultsettings/BinaryPkDefConst.go @@ -0,0 +1,5 @@ +package dto + +type BinaryPkDefConst struct { + BinaryPkDefConst string `db:"binary_pk_def_const"` +} diff --git a/internal/integration_tests/mysql8/defaultsettings/BinaryPkDefFunc.go b/internal/integration_tests/mysql8/defaultsettings/BinaryPkDefFunc.go new file mode 100644 index 00000000..6b3afc82 --- /dev/null +++ b/internal/integration_tests/mysql8/defaultsettings/BinaryPkDefFunc.go @@ -0,0 +1,5 @@ +package dto + +type BinaryPkDefFunc struct { + BinaryPkDefFunc string `db:"binary_pk_def_func"` +} diff --git a/internal/integration_tests/mysql8/defaultsettings/BinaryPkRef.go b/internal/integration_tests/mysql8/defaultsettings/BinaryPkRef.go new file mode 100644 index 00000000..499cda7d --- /dev/null +++ b/internal/integration_tests/mysql8/defaultsettings/BinaryPkRef.go @@ -0,0 +1,5 @@ +package dto + +type BinaryPkRef struct { + BinaryPkRef string `db:"binary_pk_ref"` +} diff --git a/internal/integration_tests/mysql8/defaultsettings/BinaryRef.go b/internal/integration_tests/mysql8/defaultsettings/BinaryRef.go new file mode 100644 index 00000000..644ed768 --- /dev/null +++ b/internal/integration_tests/mysql8/defaultsettings/BinaryRef.go @@ -0,0 +1,9 @@ +package dto + +import ( + "database/sql" +) + +type BinaryRef struct { + BinaryRef sql.NullString `db:"binary_ref"` +} diff --git a/internal/integration_tests/mysql8/defaultsettings/BinaryTable.go b/internal/integration_tests/mysql8/defaultsettings/BinaryTable.go new file mode 100644 index 00000000..bd213757 --- /dev/null +++ b/internal/integration_tests/mysql8/defaultsettings/BinaryTable.go @@ -0,0 +1,33 @@ +package dto + +import ( + "database/sql" +) + +type BinaryTable struct { + Col sql.NullString `db:"col"` + BinaryCap sql.NullString `db:"binary_cap"` + BinaryNn string `db:"binary_nn"` + BinaryNnUnique string `db:"binary_nn_unique"` + BinaryNnCheckCmp string `db:"binary_nn_check_cmp"` + BinaryNnCheckFn string `db:"binary_nn_check_fn"` + BinaryNnRef string `db:"binary_nn_ref"` + BinaryNnDefConst string `db:"binary_nn_def_const"` + BinaryNnDefFunc string `db:"binary_nn_def_func"` + BinaryNnUniqueCheck string `db:"binary_nn_unique_check"` + BinaryUnique sql.NullString `db:"binary_unique"` + BinaryUniqueCheck sql.NullString `db:"binary_unique_check"` + BinaryUniqueRef sql.NullString `db:"binary_unique_ref"` + BinaryUniqueDefConst sql.NullString `db:"binary_unique_def_const"` + BinaryUniqueDefFunc sql.NullString `db:"binary_unique_def_func"` + BinaryCheck sql.NullString `db:"binary_check"` + BinaryCheckRef sql.NullString `db:"binary_check_ref"` + BinaryCheckDefConst sql.NullString `db:"binary_check_def_const"` + BinaryCheckDefFunc sql.NullString `db:"binary_check_def_func"` + BinaryRef sql.NullString `db:"binary_ref"` + BinaryRefUniqueCheck sql.NullString `db:"binary_ref_unique_check"` + BinaryDefConst sql.NullString `db:"binary_def_const"` + BinaryDefConstUniqueCheck sql.NullString `db:"binary_def_const_unique_check"` + BinaryDefFunc sql.NullString `db:"binary_def_func"` + BinaryDefFuncUniqueCheck sql.NullString `db:"binary_def_func_unique_check"` +} diff --git a/internal/integration_tests/mysql8/defaultsettings/BinaryUniqueCheckPk.go b/internal/integration_tests/mysql8/defaultsettings/BinaryUniqueCheckPk.go new file mode 100644 index 00000000..b52b07de --- /dev/null +++ b/internal/integration_tests/mysql8/defaultsettings/BinaryUniqueCheckPk.go @@ -0,0 +1,5 @@ +package dto + +type BinaryUniqueCheckPk struct { + BinaryUniqueCheckPk string `db:"binary_unique_check_pk"` +} diff --git a/internal/integration_tests/mysql8/defaultsettings/BinaryUniqueCheckPkRef.go b/internal/integration_tests/mysql8/defaultsettings/BinaryUniqueCheckPkRef.go new file mode 100644 index 00000000..87df9f43 --- /dev/null +++ b/internal/integration_tests/mysql8/defaultsettings/BinaryUniqueCheckPkRef.go @@ -0,0 +1,5 @@ +package dto + +type BinaryUniqueCheckPkRef struct { + BinaryUniqueCheckPkRef string `db:"binary_unique_check_pk_ref"` +} diff --git a/internal/integration_tests/mysql8/defaultsettings/BinaryUniquePk.go b/internal/integration_tests/mysql8/defaultsettings/BinaryUniquePk.go new file mode 100644 index 00000000..f6700a1c --- /dev/null +++ b/internal/integration_tests/mysql8/defaultsettings/BinaryUniquePk.go @@ -0,0 +1,5 @@ +package dto + +type BinaryUniquePk struct { + BinaryUniquePk string `db:"binary_unique_pk"` +} diff --git a/internal/integration_tests/mysql8/defaultsettings/BlobRef.go b/internal/integration_tests/mysql8/defaultsettings/BlobRef.go new file mode 100644 index 00000000..31a8025d --- /dev/null +++ b/internal/integration_tests/mysql8/defaultsettings/BlobRef.go @@ -0,0 +1,5 @@ +package dto + +type BlobRef struct { + BlobRef string `db:"blob_ref"` +} diff --git a/internal/integration_tests/mysql8/defaultsettings/BlobTable.go b/internal/integration_tests/mysql8/defaultsettings/BlobTable.go new file mode 100644 index 00000000..d69f8c26 --- /dev/null +++ b/internal/integration_tests/mysql8/defaultsettings/BlobTable.go @@ -0,0 +1,22 @@ +package dto + +import ( + "database/sql" +) + +type BlobTable struct { + Col sql.NullString `db:"col"` + BlobDefConst sql.NullString `db:"blob_def_const"` + BlobDefFunc sql.NullString `db:"blob_def_func"` + BlobRef sql.NullString `db:"blob_ref"` + BlobNn string `db:"blob_nn"` + BlobNnCheckCmp string `db:"blob_nn_check_cmp"` + BlobNnCheckFn string `db:"blob_nn_check_fn"` + BlobNnRef string `db:"blob_nn_ref"` + BlobNnDefConst string `db:"blob_nn_def_const"` + BlobNnDefFunc string `db:"blob_nn_def_func"` + BlobCheck sql.NullString `db:"blob_check"` + BlobCheckRef sql.NullString `db:"blob_check_ref"` + BlobCheckDefConst sql.NullString `db:"blob_check_def_const"` + BlobCheckDefFunc sql.NullString `db:"blob_check_def_func"` +} diff --git a/internal/integration_tests/mysql8/defaultsettings/CharCheckPk.go b/internal/integration_tests/mysql8/defaultsettings/CharCheckPk.go new file mode 100644 index 00000000..3fced3dc --- /dev/null +++ b/internal/integration_tests/mysql8/defaultsettings/CharCheckPk.go @@ -0,0 +1,5 @@ +package dto + +type CharCheckPk struct { + CharCheckPk string `db:"char_check_pk"` +} diff --git a/internal/integration_tests/mysql8/defaultsettings/CharDefConstUniqueCheckPk.go b/internal/integration_tests/mysql8/defaultsettings/CharDefConstUniqueCheckPk.go new file mode 100644 index 00000000..3c69f6ff --- /dev/null +++ b/internal/integration_tests/mysql8/defaultsettings/CharDefConstUniqueCheckPk.go @@ -0,0 +1,5 @@ +package dto + +type CharDefConstUniqueCheckPk struct { + CharDefConstUniqueCheckPk string `db:"char_def_const_unique_check_pk"` +} diff --git a/internal/integration_tests/mysql8/defaultsettings/CharDefConstUniqueCheckPkRef.go b/internal/integration_tests/mysql8/defaultsettings/CharDefConstUniqueCheckPkRef.go new file mode 100644 index 00000000..6b29a7e6 --- /dev/null +++ b/internal/integration_tests/mysql8/defaultsettings/CharDefConstUniqueCheckPkRef.go @@ -0,0 +1,5 @@ +package dto + +type CharDefConstUniqueCheckPkRef struct { + CharDefConstUniqueCheckPkRef string `db:"char_def_const_unique_check_pk_ref"` +} diff --git a/internal/integration_tests/mysql8/defaultsettings/CharDefFuncUniqueCheckPk.go b/internal/integration_tests/mysql8/defaultsettings/CharDefFuncUniqueCheckPk.go new file mode 100644 index 00000000..45d10db8 --- /dev/null +++ b/internal/integration_tests/mysql8/defaultsettings/CharDefFuncUniqueCheckPk.go @@ -0,0 +1,5 @@ +package dto + +type CharDefFuncUniqueCheckPk struct { + CharDefFuncUniqueCheckPk string `db:"char_def_func_unique_check_pk"` +} diff --git a/internal/integration_tests/mysql8/defaultsettings/CharDefFuncUniqueCheckPkRef.go b/internal/integration_tests/mysql8/defaultsettings/CharDefFuncUniqueCheckPkRef.go new file mode 100644 index 00000000..43d48b6b --- /dev/null +++ b/internal/integration_tests/mysql8/defaultsettings/CharDefFuncUniqueCheckPkRef.go @@ -0,0 +1,5 @@ +package dto + +type CharDefFuncUniqueCheckPkRef struct { + CharDefFuncUniqueCheckPkRef string `db:"char_def_func_unique_check_pk_ref"` +} diff --git a/internal/integration_tests/mysql8/defaultsettings/CharNnPk.go b/internal/integration_tests/mysql8/defaultsettings/CharNnPk.go new file mode 100644 index 00000000..309e6e87 --- /dev/null +++ b/internal/integration_tests/mysql8/defaultsettings/CharNnPk.go @@ -0,0 +1,5 @@ +package dto + +type CharNnPk struct { + CharNnPk string `db:"char_nn_pk"` +} diff --git a/internal/integration_tests/mysql8/defaultsettings/CharNnUniqueCheckPk.go b/internal/integration_tests/mysql8/defaultsettings/CharNnUniqueCheckPk.go new file mode 100644 index 00000000..0ffe2059 --- /dev/null +++ b/internal/integration_tests/mysql8/defaultsettings/CharNnUniqueCheckPk.go @@ -0,0 +1,5 @@ +package dto + +type CharNnUniqueCheckPk struct { + CharNnUniqueCheckPk string `db:"char_nn_unique_check_pk"` +} diff --git a/internal/integration_tests/mysql8/defaultsettings/CharNnUniqueCheckPkRef.go b/internal/integration_tests/mysql8/defaultsettings/CharNnUniqueCheckPkRef.go new file mode 100644 index 00000000..62f9b39b --- /dev/null +++ b/internal/integration_tests/mysql8/defaultsettings/CharNnUniqueCheckPkRef.go @@ -0,0 +1,5 @@ +package dto + +type CharNnUniqueCheckPkRef struct { + CharNnUniqueCheckPkRef string `db:"char_nn_unique_check_pk_ref"` +} diff --git a/internal/integration_tests/mysql8/defaultsettings/CharPk.go b/internal/integration_tests/mysql8/defaultsettings/CharPk.go new file mode 100644 index 00000000..82d769ca --- /dev/null +++ b/internal/integration_tests/mysql8/defaultsettings/CharPk.go @@ -0,0 +1,5 @@ +package dto + +type CharPk struct { + CharPk string `db:"char_pk"` +} diff --git a/internal/integration_tests/mysql8/defaultsettings/CharPkDefConst.go b/internal/integration_tests/mysql8/defaultsettings/CharPkDefConst.go new file mode 100644 index 00000000..e386cc95 --- /dev/null +++ b/internal/integration_tests/mysql8/defaultsettings/CharPkDefConst.go @@ -0,0 +1,5 @@ +package dto + +type CharPkDefConst struct { + CharPkDefConst string `db:"char_pk_def_const"` +} diff --git a/internal/integration_tests/mysql8/defaultsettings/CharPkDefFunc.go b/internal/integration_tests/mysql8/defaultsettings/CharPkDefFunc.go new file mode 100644 index 00000000..24a1d17a --- /dev/null +++ b/internal/integration_tests/mysql8/defaultsettings/CharPkDefFunc.go @@ -0,0 +1,5 @@ +package dto + +type CharPkDefFunc struct { + CharPkDefFunc string `db:"char_pk_def_func"` +} diff --git a/internal/integration_tests/mysql8/defaultsettings/CharPkRef.go b/internal/integration_tests/mysql8/defaultsettings/CharPkRef.go new file mode 100644 index 00000000..aed73b7d --- /dev/null +++ b/internal/integration_tests/mysql8/defaultsettings/CharPkRef.go @@ -0,0 +1,5 @@ +package dto + +type CharPkRef struct { + CharPkRef string `db:"char_pk_ref"` +} diff --git a/internal/integration_tests/mysql8/defaultsettings/CharRef.go b/internal/integration_tests/mysql8/defaultsettings/CharRef.go new file mode 100644 index 00000000..5bbf267b --- /dev/null +++ b/internal/integration_tests/mysql8/defaultsettings/CharRef.go @@ -0,0 +1,9 @@ +package dto + +import ( + "database/sql" +) + +type CharRef struct { + CharRef sql.NullString `db:"char_ref"` +} diff --git a/internal/integration_tests/mysql8/defaultsettings/CharTable.go b/internal/integration_tests/mysql8/defaultsettings/CharTable.go new file mode 100644 index 00000000..e0d2400c --- /dev/null +++ b/internal/integration_tests/mysql8/defaultsettings/CharTable.go @@ -0,0 +1,33 @@ +package dto + +import ( + "database/sql" +) + +type CharTable struct { + Col sql.NullString `db:"col"` + CharCap sql.NullString `db:"char_cap"` + CharNn string `db:"char_nn"` + CharNnUnique string `db:"char_nn_unique"` + CharNnCheckCmp string `db:"char_nn_check_cmp"` + CharNnCheckFn string `db:"char_nn_check_fn"` + CharNnRef string `db:"char_nn_ref"` + CharNnDefConst string `db:"char_nn_def_const"` + CharNnDefFunc string `db:"char_nn_def_func"` + CharNnUniqueCheck string `db:"char_nn_unique_check"` + CharUnique sql.NullString `db:"char_unique"` + CharUniqueCheck sql.NullString `db:"char_unique_check"` + CharUniqueRef sql.NullString `db:"char_unique_ref"` + CharUniqueDefConst sql.NullString `db:"char_unique_def_const"` + CharUniqueDefFunc sql.NullString `db:"char_unique_def_func"` + CharCheck sql.NullString `db:"char_check"` + CharCheckRef sql.NullString `db:"char_check_ref"` + CharCheckDefConst sql.NullString `db:"char_check_def_const"` + CharCheckDefFunc sql.NullString `db:"char_check_def_func"` + CharRef sql.NullString `db:"char_ref"` + CharRefUniqueCheck sql.NullString `db:"char_ref_unique_check"` + CharDefConst sql.NullString `db:"char_def_const"` + CharDefConstUniqueCheck sql.NullString `db:"char_def_const_unique_check"` + CharDefFunc sql.NullString `db:"char_def_func"` + CharDefFuncUniqueCheck sql.NullString `db:"char_def_func_unique_check"` +} diff --git a/internal/integration_tests/mysql8/defaultsettings/CharUniqueCheckPk.go b/internal/integration_tests/mysql8/defaultsettings/CharUniqueCheckPk.go new file mode 100644 index 00000000..3a27898a --- /dev/null +++ b/internal/integration_tests/mysql8/defaultsettings/CharUniqueCheckPk.go @@ -0,0 +1,5 @@ +package dto + +type CharUniqueCheckPk struct { + CharUniqueCheckPk string `db:"char_unique_check_pk"` +} diff --git a/internal/integration_tests/mysql8/defaultsettings/CharUniqueCheckPkRef.go b/internal/integration_tests/mysql8/defaultsettings/CharUniqueCheckPkRef.go new file mode 100644 index 00000000..47939972 --- /dev/null +++ b/internal/integration_tests/mysql8/defaultsettings/CharUniqueCheckPkRef.go @@ -0,0 +1,5 @@ +package dto + +type CharUniqueCheckPkRef struct { + CharUniqueCheckPkRef string `db:"char_unique_check_pk_ref"` +} diff --git a/internal/integration_tests/mysql8/defaultsettings/CharUniquePk.go b/internal/integration_tests/mysql8/defaultsettings/CharUniquePk.go new file mode 100644 index 00000000..27407394 --- /dev/null +++ b/internal/integration_tests/mysql8/defaultsettings/CharUniquePk.go @@ -0,0 +1,5 @@ +package dto + +type CharUniquePk struct { + CharUniquePk string `db:"char_unique_pk"` +} diff --git a/internal/integration_tests/mysql8/defaultsettings/ConstraintComboNonPk.go b/internal/integration_tests/mysql8/defaultsettings/ConstraintComboNonPk.go new file mode 100644 index 00000000..575d9778 --- /dev/null +++ b/internal/integration_tests/mysql8/defaultsettings/ConstraintComboNonPk.go @@ -0,0 +1,16 @@ +package dto + +type ConstraintComboNonPk struct { + NotNullUniqueCheckDefConst float64 `db:"not_null_unique_check_def_const"` + NotNullUniqueCheckDefFunc float64 `db:"not_null_unique_check_def_func"` + NotNullUniqueRefDefConst float64 `db:"not_null_unique_ref_def_const"` + NotNullUniqueRefDefFunc float64 `db:"not_null_unique_ref_def_func"` + NotNullCheckRefDefConst float64 `db:"not_null_check_ref_def_const"` + NotNullCheckRefDefFunc float64 `db:"not_null_check_ref_def_func"` + NotNullUniqueDefConst float64 `db:"not_null_unique_def_const"` + NotNullUniqueDefFunc float64 `db:"not_null_unique_def_func"` + NotNullCheckDefConst float64 `db:"not_null_check_def_const"` + NotNullCheckDefFunc float64 `db:"not_null_check_def_func"` + NotNullRefDefConst float64 `db:"not_null_ref_def_const"` + NotNullRefDefFunc float64 `db:"not_null_ref_def_func"` +} diff --git a/internal/integration_tests/mysql8/defaultsettings/ConstraintComboNotNullCheckPkDefConst.go b/internal/integration_tests/mysql8/defaultsettings/ConstraintComboNotNullCheckPkDefConst.go new file mode 100644 index 00000000..4aa890ba --- /dev/null +++ b/internal/integration_tests/mysql8/defaultsettings/ConstraintComboNotNullCheckPkDefConst.go @@ -0,0 +1,5 @@ +package dto + +type ConstraintComboNotNullCheckPkDefConst struct { + ConstraintComboNotNullCheckPkDefConst float64 `db:"constraint_combo_not_null_check_pk_def_const"` +} diff --git a/internal/integration_tests/mysql8/defaultsettings/ConstraintComboNotNullCheckPkDefFunc.go b/internal/integration_tests/mysql8/defaultsettings/ConstraintComboNotNullCheckPkDefFunc.go new file mode 100644 index 00000000..dce0d8b3 --- /dev/null +++ b/internal/integration_tests/mysql8/defaultsettings/ConstraintComboNotNullCheckPkDefFunc.go @@ -0,0 +1,5 @@ +package dto + +type ConstraintComboNotNullCheckPkDefFunc struct { + ConstraintComboNotNullCheckPkDefFunc float64 `db:"constraint_combo_not_null_check_pk_def_func"` +} diff --git a/internal/integration_tests/mysql8/defaultsettings/ConstraintComboNotNullPkDefConst.go b/internal/integration_tests/mysql8/defaultsettings/ConstraintComboNotNullPkDefConst.go new file mode 100644 index 00000000..ca059e7a --- /dev/null +++ b/internal/integration_tests/mysql8/defaultsettings/ConstraintComboNotNullPkDefConst.go @@ -0,0 +1,5 @@ +package dto + +type ConstraintComboNotNullPkDefConst struct { + ConstraintComboNotNullPkDefConst float64 `db:"constraint_combo_not_null_pk_def_const"` +} diff --git a/internal/integration_tests/mysql8/defaultsettings/ConstraintComboNotNullPkDefFunc.go b/internal/integration_tests/mysql8/defaultsettings/ConstraintComboNotNullPkDefFunc.go new file mode 100644 index 00000000..5bb0b531 --- /dev/null +++ b/internal/integration_tests/mysql8/defaultsettings/ConstraintComboNotNullPkDefFunc.go @@ -0,0 +1,5 @@ +package dto + +type ConstraintComboNotNullPkDefFunc struct { + ConstraintComboNotNullPkDefFunc float64 `db:"constraint_combo_not_null_pk_def_func"` +} diff --git a/internal/integration_tests/mysql8/defaultsettings/ConstraintComboNotNullPkRefDefConst.go b/internal/integration_tests/mysql8/defaultsettings/ConstraintComboNotNullPkRefDefConst.go new file mode 100644 index 00000000..4bd7ce91 --- /dev/null +++ b/internal/integration_tests/mysql8/defaultsettings/ConstraintComboNotNullPkRefDefConst.go @@ -0,0 +1,5 @@ +package dto + +type ConstraintComboNotNullPkRefDefConst struct { + ConstraintComboNotNullPkRefDefConst float64 `db:"constraint_combo_not_null_pk_ref_def_const"` +} diff --git a/internal/integration_tests/mysql8/defaultsettings/ConstraintComboNotNullPkRefDefFunc.go b/internal/integration_tests/mysql8/defaultsettings/ConstraintComboNotNullPkRefDefFunc.go new file mode 100644 index 00000000..72c2299b --- /dev/null +++ b/internal/integration_tests/mysql8/defaultsettings/ConstraintComboNotNullPkRefDefFunc.go @@ -0,0 +1,5 @@ +package dto + +type ConstraintComboNotNullPkRefDefFunc struct { + ConstraintComboNotNullPkRefDefFunc float64 `db:"constraint_combo_not_null_pk_ref_def_func"` +} diff --git a/internal/integration_tests/mysql8/defaultsettings/ConstraintComboNotNullUniquePkDefConst.go b/internal/integration_tests/mysql8/defaultsettings/ConstraintComboNotNullUniquePkDefConst.go new file mode 100644 index 00000000..b195d769 --- /dev/null +++ b/internal/integration_tests/mysql8/defaultsettings/ConstraintComboNotNullUniquePkDefConst.go @@ -0,0 +1,5 @@ +package dto + +type ConstraintComboNotNullUniquePkDefConst struct { + ConstraintComboNotNullUniquePkDefConst float64 `db:"constraint_combo_not_null_unique_pk_def_const"` +} diff --git a/internal/integration_tests/mysql8/defaultsettings/ConstraintComboNotNullUniquePkDefFunc.go b/internal/integration_tests/mysql8/defaultsettings/ConstraintComboNotNullUniquePkDefFunc.go new file mode 100644 index 00000000..845d6231 --- /dev/null +++ b/internal/integration_tests/mysql8/defaultsettings/ConstraintComboNotNullUniquePkDefFunc.go @@ -0,0 +1,5 @@ +package dto + +type ConstraintComboNotNullUniquePkDefFunc struct { + ConstraintComboNotNullUniquePkDefFunc float64 `db:"constraint_combo_not_null_unique_pk_def_func"` +} diff --git a/internal/integration_tests/mysql8/defaultsettings/ConstraintComboRef.go b/internal/integration_tests/mysql8/defaultsettings/ConstraintComboRef.go new file mode 100644 index 00000000..ecc8379f --- /dev/null +++ b/internal/integration_tests/mysql8/defaultsettings/ConstraintComboRef.go @@ -0,0 +1,9 @@ +package dto + +import ( + "database/sql" +) + +type ConstraintComboRef struct { + ConstraintComboRef sql.NullFloat64 `db:"constraint_combo_ref"` +} diff --git a/internal/integration_tests/mysql8/defaultsettings/DateCheckPk.go b/internal/integration_tests/mysql8/defaultsettings/DateCheckPk.go new file mode 100644 index 00000000..6cb1844e --- /dev/null +++ b/internal/integration_tests/mysql8/defaultsettings/DateCheckPk.go @@ -0,0 +1,9 @@ +package dto + +import ( + "time" +) + +type DateCheckPk struct { + DateCheckPk time.Time `db:"date_check_pk"` +} diff --git a/internal/integration_tests/mysql8/defaultsettings/DateDefConstUniqueCheckPk.go b/internal/integration_tests/mysql8/defaultsettings/DateDefConstUniqueCheckPk.go new file mode 100644 index 00000000..e07a7ed5 --- /dev/null +++ b/internal/integration_tests/mysql8/defaultsettings/DateDefConstUniqueCheckPk.go @@ -0,0 +1,9 @@ +package dto + +import ( + "time" +) + +type DateDefConstUniqueCheckPk struct { + DateDefConstUniqueCheckPk time.Time `db:"date_def_const_unique_check_pk"` +} diff --git a/internal/integration_tests/mysql8/defaultsettings/DateDefConstUniqueCheckPkRef.go b/internal/integration_tests/mysql8/defaultsettings/DateDefConstUniqueCheckPkRef.go new file mode 100644 index 00000000..3b99928e --- /dev/null +++ b/internal/integration_tests/mysql8/defaultsettings/DateDefConstUniqueCheckPkRef.go @@ -0,0 +1,9 @@ +package dto + +import ( + "time" +) + +type DateDefConstUniqueCheckPkRef struct { + DateDefConstUniqueCheckPkRef time.Time `db:"date_def_const_unique_check_pk_ref"` +} diff --git a/internal/integration_tests/mysql8/defaultsettings/DateDefFuncUniqueCheckPk.go b/internal/integration_tests/mysql8/defaultsettings/DateDefFuncUniqueCheckPk.go new file mode 100644 index 00000000..12934d64 --- /dev/null +++ b/internal/integration_tests/mysql8/defaultsettings/DateDefFuncUniqueCheckPk.go @@ -0,0 +1,9 @@ +package dto + +import ( + "time" +) + +type DateDefFuncUniqueCheckPk struct { + DateDefFuncUniqueCheckPk time.Time `db:"date_def_func_unique_check_pk"` +} diff --git a/internal/integration_tests/mysql8/defaultsettings/DateDefFuncUniqueCheckPkRef.go b/internal/integration_tests/mysql8/defaultsettings/DateDefFuncUniqueCheckPkRef.go new file mode 100644 index 00000000..19ed2d94 --- /dev/null +++ b/internal/integration_tests/mysql8/defaultsettings/DateDefFuncUniqueCheckPkRef.go @@ -0,0 +1,9 @@ +package dto + +import ( + "time" +) + +type DateDefFuncUniqueCheckPkRef struct { + DateDefFuncUniqueCheckPkRef time.Time `db:"date_def_func_unique_check_pk_ref"` +} diff --git a/internal/integration_tests/mysql8/defaultsettings/DateNnPk.go b/internal/integration_tests/mysql8/defaultsettings/DateNnPk.go new file mode 100644 index 00000000..24f7dc12 --- /dev/null +++ b/internal/integration_tests/mysql8/defaultsettings/DateNnPk.go @@ -0,0 +1,9 @@ +package dto + +import ( + "time" +) + +type DateNnPk struct { + DateNnPk time.Time `db:"date_nn_pk"` +} diff --git a/internal/integration_tests/mysql8/defaultsettings/DateNnUniqueCheckPk.go b/internal/integration_tests/mysql8/defaultsettings/DateNnUniqueCheckPk.go new file mode 100644 index 00000000..162ceee5 --- /dev/null +++ b/internal/integration_tests/mysql8/defaultsettings/DateNnUniqueCheckPk.go @@ -0,0 +1,9 @@ +package dto + +import ( + "time" +) + +type DateNnUniqueCheckPk struct { + DateNnUniqueCheckPk time.Time `db:"date_nn_unique_check_pk"` +} diff --git a/internal/integration_tests/mysql8/defaultsettings/DateNnUniqueCheckPkRef.go b/internal/integration_tests/mysql8/defaultsettings/DateNnUniqueCheckPkRef.go new file mode 100644 index 00000000..57c61fce --- /dev/null +++ b/internal/integration_tests/mysql8/defaultsettings/DateNnUniqueCheckPkRef.go @@ -0,0 +1,9 @@ +package dto + +import ( + "time" +) + +type DateNnUniqueCheckPkRef struct { + DateNnUniqueCheckPkRef time.Time `db:"date_nn_unique_check_pk_ref"` +} diff --git a/internal/integration_tests/mysql8/defaultsettings/DatePk.go b/internal/integration_tests/mysql8/defaultsettings/DatePk.go new file mode 100644 index 00000000..d006be42 --- /dev/null +++ b/internal/integration_tests/mysql8/defaultsettings/DatePk.go @@ -0,0 +1,9 @@ +package dto + +import ( + "time" +) + +type DatePk struct { + DatePk time.Time `db:"date_pk"` +} diff --git a/internal/integration_tests/mysql8/defaultsettings/DatePkDefConst.go b/internal/integration_tests/mysql8/defaultsettings/DatePkDefConst.go new file mode 100644 index 00000000..b10866e0 --- /dev/null +++ b/internal/integration_tests/mysql8/defaultsettings/DatePkDefConst.go @@ -0,0 +1,9 @@ +package dto + +import ( + "time" +) + +type DatePkDefConst struct { + DatePkDefConst time.Time `db:"date_pk_def_const"` +} diff --git a/internal/integration_tests/mysql8/defaultsettings/DatePkDefFunc.go b/internal/integration_tests/mysql8/defaultsettings/DatePkDefFunc.go new file mode 100644 index 00000000..133d388a --- /dev/null +++ b/internal/integration_tests/mysql8/defaultsettings/DatePkDefFunc.go @@ -0,0 +1,9 @@ +package dto + +import ( + "time" +) + +type DatePkDefFunc struct { + DatePkDefFunc time.Time `db:"date_pk_def_func"` +} diff --git a/internal/integration_tests/mysql8/defaultsettings/DatePkRef.go b/internal/integration_tests/mysql8/defaultsettings/DatePkRef.go new file mode 100644 index 00000000..e4f6d521 --- /dev/null +++ b/internal/integration_tests/mysql8/defaultsettings/DatePkRef.go @@ -0,0 +1,9 @@ +package dto + +import ( + "time" +) + +type DatePkRef struct { + DatePkRef time.Time `db:"date_pk_ref"` +} diff --git a/internal/integration_tests/mysql8/defaultsettings/DateRef.go b/internal/integration_tests/mysql8/defaultsettings/DateRef.go new file mode 100644 index 00000000..aef0b9fa --- /dev/null +++ b/internal/integration_tests/mysql8/defaultsettings/DateRef.go @@ -0,0 +1,9 @@ +package dto + +import ( + "database/sql" +) + +type DateRef struct { + DateRef sql.NullTime `db:"date_ref"` +} diff --git a/internal/integration_tests/mysql8/defaultsettings/DateTable.go b/internal/integration_tests/mysql8/defaultsettings/DateTable.go new file mode 100644 index 00000000..c83707a4 --- /dev/null +++ b/internal/integration_tests/mysql8/defaultsettings/DateTable.go @@ -0,0 +1,32 @@ +package dto + +import ( + "database/sql" + "time" +) + +type DateTable struct { + Date sql.NullTime `db:"date"` + DateNn time.Time `db:"date_nn"` + DateNnUnique time.Time `db:"date_nn_unique"` + DateNnCheck time.Time `db:"date_nn_check"` + DateNnRef time.Time `db:"date_nn_ref"` + DateNnDefConst time.Time `db:"date_nn_def_const"` + DateNnDefFunc time.Time `db:"date_nn_def_func"` + DateNnUniqueCheck time.Time `db:"date_nn_unique_check"` + DateUnique sql.NullTime `db:"date_unique"` + DateUniqueCheck sql.NullTime `db:"date_unique_check"` + DateUniqueRef sql.NullTime `db:"date_unique_ref"` + DateUniqueDefConst sql.NullTime `db:"date_unique_def_const"` + DateUniqueDefFunc sql.NullTime `db:"date_unique_def_func"` + DateCheck sql.NullTime `db:"date_check"` + DateCheckRef sql.NullTime `db:"date_check_ref"` + DateCheckDefConst sql.NullTime `db:"date_check_def_const"` + DateCheckDefFunc sql.NullTime `db:"date_check_def_func"` + DateRef sql.NullTime `db:"date_ref"` + DateRefUniqueCheck sql.NullTime `db:"date_ref_unique_check"` + DateDefConst sql.NullTime `db:"date_def_const"` + DateDefConstUniqueCheck sql.NullTime `db:"date_def_const_unique_check"` + DateDefFunc sql.NullTime `db:"date_def_func"` + DateDefFuncUniqueCheck sql.NullTime `db:"date_def_func_unique_check"` +} diff --git a/internal/integration_tests/mysql8/defaultsettings/DateUniqueCheckPk.go b/internal/integration_tests/mysql8/defaultsettings/DateUniqueCheckPk.go new file mode 100644 index 00000000..de81a9ee --- /dev/null +++ b/internal/integration_tests/mysql8/defaultsettings/DateUniqueCheckPk.go @@ -0,0 +1,9 @@ +package dto + +import ( + "time" +) + +type DateUniqueCheckPk struct { + DateUniqueCheckPk time.Time `db:"date_unique_check_pk"` +} diff --git a/internal/integration_tests/mysql8/defaultsettings/DateUniqueCheckPkRef.go b/internal/integration_tests/mysql8/defaultsettings/DateUniqueCheckPkRef.go new file mode 100644 index 00000000..9c44f9cd --- /dev/null +++ b/internal/integration_tests/mysql8/defaultsettings/DateUniqueCheckPkRef.go @@ -0,0 +1,9 @@ +package dto + +import ( + "time" +) + +type DateUniqueCheckPkRef struct { + DateUniqueCheckPkRef time.Time `db:"date_unique_check_pk_ref"` +} diff --git a/internal/integration_tests/mysql8/defaultsettings/DateUniquePk.go b/internal/integration_tests/mysql8/defaultsettings/DateUniquePk.go new file mode 100644 index 00000000..8a2081d9 --- /dev/null +++ b/internal/integration_tests/mysql8/defaultsettings/DateUniquePk.go @@ -0,0 +1,9 @@ +package dto + +import ( + "time" +) + +type DateUniquePk struct { + DateUniquePk time.Time `db:"date_unique_pk"` +} diff --git a/internal/integration_tests/mysql8/defaultsettings/DatetimeCheckPk.go b/internal/integration_tests/mysql8/defaultsettings/DatetimeCheckPk.go new file mode 100644 index 00000000..94283788 --- /dev/null +++ b/internal/integration_tests/mysql8/defaultsettings/DatetimeCheckPk.go @@ -0,0 +1,9 @@ +package dto + +import ( + "time" +) + +type DatetimeCheckPk struct { + DatetimeCheckPk time.Time `db:"datetime_check_pk"` +} diff --git a/internal/integration_tests/mysql8/defaultsettings/DatetimeDefConstUniqueCheckPk.go b/internal/integration_tests/mysql8/defaultsettings/DatetimeDefConstUniqueCheckPk.go new file mode 100644 index 00000000..42c954d1 --- /dev/null +++ b/internal/integration_tests/mysql8/defaultsettings/DatetimeDefConstUniqueCheckPk.go @@ -0,0 +1,9 @@ +package dto + +import ( + "time" +) + +type DatetimeDefConstUniqueCheckPk struct { + DatetimeDefConstUniqueCheckPk time.Time `db:"datetime_def_const_unique_check_pk"` +} diff --git a/internal/integration_tests/mysql8/defaultsettings/DatetimeDefConstUniqueCheckPkRef.go b/internal/integration_tests/mysql8/defaultsettings/DatetimeDefConstUniqueCheckPkRef.go new file mode 100644 index 00000000..de2a504a --- /dev/null +++ b/internal/integration_tests/mysql8/defaultsettings/DatetimeDefConstUniqueCheckPkRef.go @@ -0,0 +1,9 @@ +package dto + +import ( + "time" +) + +type DatetimeDefConstUniqueCheckPkRef struct { + DatetimeDefConstUniqueCheckPkRef time.Time `db:"datetime_def_const_unique_check_pk_ref"` +} diff --git a/internal/integration_tests/mysql8/defaultsettings/DatetimeDefFuncUniqueCheckPk.go b/internal/integration_tests/mysql8/defaultsettings/DatetimeDefFuncUniqueCheckPk.go new file mode 100644 index 00000000..bdb6ac27 --- /dev/null +++ b/internal/integration_tests/mysql8/defaultsettings/DatetimeDefFuncUniqueCheckPk.go @@ -0,0 +1,9 @@ +package dto + +import ( + "time" +) + +type DatetimeDefFuncUniqueCheckPk struct { + DatetimeDefFuncUniqueCheckPk time.Time `db:"datetime_def_func_unique_check_pk"` +} diff --git a/internal/integration_tests/mysql8/defaultsettings/DatetimeDefFuncUniqueCheckPkRef.go b/internal/integration_tests/mysql8/defaultsettings/DatetimeDefFuncUniqueCheckPkRef.go new file mode 100644 index 00000000..5bc51f30 --- /dev/null +++ b/internal/integration_tests/mysql8/defaultsettings/DatetimeDefFuncUniqueCheckPkRef.go @@ -0,0 +1,9 @@ +package dto + +import ( + "time" +) + +type DatetimeDefFuncUniqueCheckPkRef struct { + DatetimeDefFuncUniqueCheckPkRef time.Time `db:"datetime_def_func_unique_check_pk_ref"` +} diff --git a/internal/integration_tests/mysql8/defaultsettings/DatetimeNnPk.go b/internal/integration_tests/mysql8/defaultsettings/DatetimeNnPk.go new file mode 100644 index 00000000..30998f47 --- /dev/null +++ b/internal/integration_tests/mysql8/defaultsettings/DatetimeNnPk.go @@ -0,0 +1,9 @@ +package dto + +import ( + "time" +) + +type DatetimeNnPk struct { + DatetimeNnPk time.Time `db:"datetime_nn_pk"` +} diff --git a/internal/integration_tests/mysql8/defaultsettings/DatetimeNnUniqueCheckPk.go b/internal/integration_tests/mysql8/defaultsettings/DatetimeNnUniqueCheckPk.go new file mode 100644 index 00000000..f6d77322 --- /dev/null +++ b/internal/integration_tests/mysql8/defaultsettings/DatetimeNnUniqueCheckPk.go @@ -0,0 +1,9 @@ +package dto + +import ( + "time" +) + +type DatetimeNnUniqueCheckPk struct { + DatetimeNnUniqueCheckPk time.Time `db:"datetime_nn_unique_check_pk"` +} diff --git a/internal/integration_tests/mysql8/defaultsettings/DatetimeNnUniqueCheckPkRef.go b/internal/integration_tests/mysql8/defaultsettings/DatetimeNnUniqueCheckPkRef.go new file mode 100644 index 00000000..82611c60 --- /dev/null +++ b/internal/integration_tests/mysql8/defaultsettings/DatetimeNnUniqueCheckPkRef.go @@ -0,0 +1,9 @@ +package dto + +import ( + "time" +) + +type DatetimeNnUniqueCheckPkRef struct { + DatetimeNnUniqueCheckPkRef time.Time `db:"datetime_nn_unique_check_pk_ref"` +} diff --git a/internal/integration_tests/mysql8/defaultsettings/DatetimePk.go b/internal/integration_tests/mysql8/defaultsettings/DatetimePk.go new file mode 100644 index 00000000..f514c724 --- /dev/null +++ b/internal/integration_tests/mysql8/defaultsettings/DatetimePk.go @@ -0,0 +1,9 @@ +package dto + +import ( + "time" +) + +type DatetimePk struct { + DatetimePk time.Time `db:"datetime_pk"` +} diff --git a/internal/integration_tests/mysql8/defaultsettings/DatetimePkDefConst.go b/internal/integration_tests/mysql8/defaultsettings/DatetimePkDefConst.go new file mode 100644 index 00000000..3fc935f7 --- /dev/null +++ b/internal/integration_tests/mysql8/defaultsettings/DatetimePkDefConst.go @@ -0,0 +1,9 @@ +package dto + +import ( + "time" +) + +type DatetimePkDefConst struct { + DatetimePkDefConst time.Time `db:"datetime_pk_def_const"` +} diff --git a/internal/integration_tests/mysql8/defaultsettings/DatetimePkDefFunc.go b/internal/integration_tests/mysql8/defaultsettings/DatetimePkDefFunc.go new file mode 100644 index 00000000..3562a7cd --- /dev/null +++ b/internal/integration_tests/mysql8/defaultsettings/DatetimePkDefFunc.go @@ -0,0 +1,9 @@ +package dto + +import ( + "time" +) + +type DatetimePkDefFunc struct { + DatetimePkDefFunc time.Time `db:"datetime_pk_def_func"` +} diff --git a/internal/integration_tests/mysql8/defaultsettings/DatetimePkRef.go b/internal/integration_tests/mysql8/defaultsettings/DatetimePkRef.go new file mode 100644 index 00000000..a4e05075 --- /dev/null +++ b/internal/integration_tests/mysql8/defaultsettings/DatetimePkRef.go @@ -0,0 +1,9 @@ +package dto + +import ( + "time" +) + +type DatetimePkRef struct { + DatetimePkRef time.Time `db:"datetime_pk_ref"` +} diff --git a/internal/integration_tests/mysql8/defaultsettings/DatetimeRef.go b/internal/integration_tests/mysql8/defaultsettings/DatetimeRef.go new file mode 100644 index 00000000..a7e1480c --- /dev/null +++ b/internal/integration_tests/mysql8/defaultsettings/DatetimeRef.go @@ -0,0 +1,9 @@ +package dto + +import ( + "database/sql" +) + +type DatetimeRef struct { + DatetimeRef sql.NullTime `db:"datetime_ref"` +} diff --git a/internal/integration_tests/mysql8/defaultsettings/DatetimeTable.go b/internal/integration_tests/mysql8/defaultsettings/DatetimeTable.go new file mode 100644 index 00000000..36b7bc40 --- /dev/null +++ b/internal/integration_tests/mysql8/defaultsettings/DatetimeTable.go @@ -0,0 +1,32 @@ +package dto + +import ( + "database/sql" + "time" +) + +type DatetimeTable struct { + Datetime sql.NullTime `db:"datetime"` + DatetimeNn time.Time `db:"datetime_nn"` + DatetimeNnUnique time.Time `db:"datetime_nn_unique"` + DatetimeNnCheck time.Time `db:"datetime_nn_check"` + DatetimeNnRef time.Time `db:"datetime_nn_ref"` + DatetimeNnDefConst time.Time `db:"datetime_nn_def_const"` + DatetimeNnDefFunc time.Time `db:"datetime_nn_def_func"` + DatetimeNnUniqueCheck time.Time `db:"datetime_nn_unique_check"` + DatetimeUnique sql.NullTime `db:"datetime_unique"` + DatetimeUniqueCheck sql.NullTime `db:"datetime_unique_check"` + DatetimeUniqueRef sql.NullTime `db:"datetime_unique_ref"` + DatetimeUniqueDefConst sql.NullTime `db:"datetime_unique_def_const"` + DatetimeUniqueDefFunc sql.NullTime `db:"datetime_unique_def_func"` + DatetimeCheck sql.NullTime `db:"datetime_check"` + DatetimeCheckRef sql.NullTime `db:"datetime_check_ref"` + DatetimeCheckDefConst sql.NullTime `db:"datetime_check_def_const"` + DatetimeCheckDefFunc sql.NullTime `db:"datetime_check_def_func"` + DatetimeRef sql.NullTime `db:"datetime_ref"` + DatetimeRefUniqueCheck sql.NullTime `db:"datetime_ref_unique_check"` + DatetimeDefConst sql.NullTime `db:"datetime_def_const"` + DatetimeDefConstUniqueCheck sql.NullTime `db:"datetime_def_const_unique_check"` + DatetimeDefFunc sql.NullTime `db:"datetime_def_func"` + DatetimeDefFuncUniqueCheck sql.NullTime `db:"datetime_def_func_unique_check"` +} diff --git a/internal/integration_tests/mysql8/defaultsettings/DatetimeUniqueCheckPk.go b/internal/integration_tests/mysql8/defaultsettings/DatetimeUniqueCheckPk.go new file mode 100644 index 00000000..f5afbf89 --- /dev/null +++ b/internal/integration_tests/mysql8/defaultsettings/DatetimeUniqueCheckPk.go @@ -0,0 +1,9 @@ +package dto + +import ( + "time" +) + +type DatetimeUniqueCheckPk struct { + DatetimeUniqueCheckPk time.Time `db:"datetime_unique_check_pk"` +} diff --git a/internal/integration_tests/mysql8/defaultsettings/DatetimeUniqueCheckPkRef.go b/internal/integration_tests/mysql8/defaultsettings/DatetimeUniqueCheckPkRef.go new file mode 100644 index 00000000..5b9834ba --- /dev/null +++ b/internal/integration_tests/mysql8/defaultsettings/DatetimeUniqueCheckPkRef.go @@ -0,0 +1,9 @@ +package dto + +import ( + "time" +) + +type DatetimeUniqueCheckPkRef struct { + DatetimeUniqueCheckPkRef time.Time `db:"datetime_unique_check_pk_ref"` +} diff --git a/internal/integration_tests/mysql8/defaultsettings/DatetimeUniquePk.go b/internal/integration_tests/mysql8/defaultsettings/DatetimeUniquePk.go new file mode 100644 index 00000000..efd8e62c --- /dev/null +++ b/internal/integration_tests/mysql8/defaultsettings/DatetimeUniquePk.go @@ -0,0 +1,9 @@ +package dto + +import ( + "time" +) + +type DatetimeUniquePk struct { + DatetimeUniquePk time.Time `db:"datetime_unique_pk"` +} diff --git a/internal/integration_tests/mysql8/defaultsettings/DecimalCheckPk.go b/internal/integration_tests/mysql8/defaultsettings/DecimalCheckPk.go new file mode 100644 index 00000000..e51ea81a --- /dev/null +++ b/internal/integration_tests/mysql8/defaultsettings/DecimalCheckPk.go @@ -0,0 +1,5 @@ +package dto + +type DecimalCheckPk struct { + DecimalCheckPk float64 `db:"decimal_check_pk"` +} diff --git a/internal/integration_tests/mysql8/defaultsettings/DecimalDefConstUniqueCheckPk.go b/internal/integration_tests/mysql8/defaultsettings/DecimalDefConstUniqueCheckPk.go new file mode 100644 index 00000000..725b1900 --- /dev/null +++ b/internal/integration_tests/mysql8/defaultsettings/DecimalDefConstUniqueCheckPk.go @@ -0,0 +1,5 @@ +package dto + +type DecimalDefConstUniqueCheckPk struct { + DecimalDefConstUniqueCheckPk float64 `db:"decimal_def_const_unique_check_pk"` +} diff --git a/internal/integration_tests/mysql8/defaultsettings/DecimalDefConstUniqueCheckPkRef.go b/internal/integration_tests/mysql8/defaultsettings/DecimalDefConstUniqueCheckPkRef.go new file mode 100644 index 00000000..47a13f96 --- /dev/null +++ b/internal/integration_tests/mysql8/defaultsettings/DecimalDefConstUniqueCheckPkRef.go @@ -0,0 +1,5 @@ +package dto + +type DecimalDefConstUniqueCheckPkRef struct { + DecimalDefConstUniqueCheckPkRef float64 `db:"decimal_def_const_unique_check_pk_ref"` +} diff --git a/internal/integration_tests/mysql8/defaultsettings/DecimalDefFuncUniqueCheckPk.go b/internal/integration_tests/mysql8/defaultsettings/DecimalDefFuncUniqueCheckPk.go new file mode 100644 index 00000000..689faf76 --- /dev/null +++ b/internal/integration_tests/mysql8/defaultsettings/DecimalDefFuncUniqueCheckPk.go @@ -0,0 +1,5 @@ +package dto + +type DecimalDefFuncUniqueCheckPk struct { + DecimalDefFuncUniqueCheckPk float64 `db:"decimal_def_func_unique_check_pk"` +} diff --git a/internal/integration_tests/mysql8/defaultsettings/DecimalDefFuncUniqueCheckPkRef.go b/internal/integration_tests/mysql8/defaultsettings/DecimalDefFuncUniqueCheckPkRef.go new file mode 100644 index 00000000..212509c5 --- /dev/null +++ b/internal/integration_tests/mysql8/defaultsettings/DecimalDefFuncUniqueCheckPkRef.go @@ -0,0 +1,5 @@ +package dto + +type DecimalDefFuncUniqueCheckPkRef struct { + DecimalDefFuncUniqueCheckPkRef float64 `db:"decimal_def_func_unique_check_pk_ref"` +} diff --git a/internal/integration_tests/mysql8/defaultsettings/DecimalNnPk.go b/internal/integration_tests/mysql8/defaultsettings/DecimalNnPk.go new file mode 100644 index 00000000..cd8f4912 --- /dev/null +++ b/internal/integration_tests/mysql8/defaultsettings/DecimalNnPk.go @@ -0,0 +1,5 @@ +package dto + +type DecimalNnPk struct { + DecimalNnPk float64 `db:"decimal_nn_pk"` +} diff --git a/internal/integration_tests/mysql8/defaultsettings/DecimalNnUniqueCheckPk.go b/internal/integration_tests/mysql8/defaultsettings/DecimalNnUniqueCheckPk.go new file mode 100644 index 00000000..fa82e68b --- /dev/null +++ b/internal/integration_tests/mysql8/defaultsettings/DecimalNnUniqueCheckPk.go @@ -0,0 +1,5 @@ +package dto + +type DecimalNnUniqueCheckPk struct { + DecimalNnUniqueCheckPk float64 `db:"decimal_nn_unique_check_pk"` +} diff --git a/internal/integration_tests/mysql8/defaultsettings/DecimalNnUniqueCheckPkRef.go b/internal/integration_tests/mysql8/defaultsettings/DecimalNnUniqueCheckPkRef.go new file mode 100644 index 00000000..f9003bf2 --- /dev/null +++ b/internal/integration_tests/mysql8/defaultsettings/DecimalNnUniqueCheckPkRef.go @@ -0,0 +1,5 @@ +package dto + +type DecimalNnUniqueCheckPkRef struct { + DecimalNnUniqueCheckPkRef float64 `db:"decimal_nn_unique_check_pk_ref"` +} diff --git a/internal/integration_tests/mysql8/defaultsettings/DecimalPk.go b/internal/integration_tests/mysql8/defaultsettings/DecimalPk.go new file mode 100644 index 00000000..42a811a1 --- /dev/null +++ b/internal/integration_tests/mysql8/defaultsettings/DecimalPk.go @@ -0,0 +1,5 @@ +package dto + +type DecimalPk struct { + DecimalPk float64 `db:"decimal_pk"` +} diff --git a/internal/integration_tests/mysql8/defaultsettings/DecimalPkDefConst.go b/internal/integration_tests/mysql8/defaultsettings/DecimalPkDefConst.go new file mode 100644 index 00000000..844cf9d1 --- /dev/null +++ b/internal/integration_tests/mysql8/defaultsettings/DecimalPkDefConst.go @@ -0,0 +1,5 @@ +package dto + +type DecimalPkDefConst struct { + DecimalPkDefConst float64 `db:"decimal_pk_def_const"` +} diff --git a/internal/integration_tests/mysql8/defaultsettings/DecimalPkDefFunc.go b/internal/integration_tests/mysql8/defaultsettings/DecimalPkDefFunc.go new file mode 100644 index 00000000..82ec62c8 --- /dev/null +++ b/internal/integration_tests/mysql8/defaultsettings/DecimalPkDefFunc.go @@ -0,0 +1,5 @@ +package dto + +type DecimalPkDefFunc struct { + DecimalPkDefFunc float64 `db:"decimal_pk_def_func"` +} diff --git a/internal/integration_tests/mysql8/defaultsettings/DecimalPkRef.go b/internal/integration_tests/mysql8/defaultsettings/DecimalPkRef.go new file mode 100644 index 00000000..bd5ef076 --- /dev/null +++ b/internal/integration_tests/mysql8/defaultsettings/DecimalPkRef.go @@ -0,0 +1,5 @@ +package dto + +type DecimalPkRef struct { + DecimalPkRef float64 `db:"decimal_pk_ref"` +} diff --git a/internal/integration_tests/mysql8/defaultsettings/DecimalRef.go b/internal/integration_tests/mysql8/defaultsettings/DecimalRef.go new file mode 100644 index 00000000..2b6e7a24 --- /dev/null +++ b/internal/integration_tests/mysql8/defaultsettings/DecimalRef.go @@ -0,0 +1,9 @@ +package dto + +import ( + "database/sql" +) + +type DecimalRef struct { + DecimalRef sql.NullFloat64 `db:"decimal_ref"` +} diff --git a/internal/integration_tests/mysql8/defaultsettings/DecimalTable.go b/internal/integration_tests/mysql8/defaultsettings/DecimalTable.go new file mode 100644 index 00000000..fc476d8b --- /dev/null +++ b/internal/integration_tests/mysql8/defaultsettings/DecimalTable.go @@ -0,0 +1,31 @@ +package dto + +import ( + "database/sql" +) + +type DecimalTable struct { + Col sql.NullFloat64 `db:"col"` + DecimalNn float64 `db:"decimal_nn"` + DecimalNnUnique float64 `db:"decimal_nn_unique"` + DecimalNnCheck float64 `db:"decimal_nn_check"` + DecimalNnRef float64 `db:"decimal_nn_ref"` + DecimalNnDefConst float64 `db:"decimal_nn_def_const"` + DecimalNnDefFunc float64 `db:"decimal_nn_def_func"` + DecimalNnUniqueCheck float64 `db:"decimal_nn_unique_check"` + DecimalUnique sql.NullFloat64 `db:"decimal_unique"` + DecimalUniqueCheck sql.NullFloat64 `db:"decimal_unique_check"` + DecimalUniqueRef sql.NullFloat64 `db:"decimal_unique_ref"` + DecimalUniqueDefConst sql.NullFloat64 `db:"decimal_unique_def_const"` + DecimalUniqueDefFunc sql.NullFloat64 `db:"decimal_unique_def_func"` + DecimalCheck sql.NullFloat64 `db:"decimal_check"` + DecimalCheckRef sql.NullFloat64 `db:"decimal_check_ref"` + DecimalCheckDefConst sql.NullFloat64 `db:"decimal_check_def_const"` + DecimalCheckDefFunc sql.NullFloat64 `db:"decimal_check_def_func"` + DecimalRef sql.NullFloat64 `db:"decimal_ref"` + DecimalRefUniqueCheck sql.NullFloat64 `db:"decimal_ref_unique_check"` + DecimalDefConst sql.NullFloat64 `db:"decimal_def_const"` + DecimalDefConstUniqueCheck sql.NullFloat64 `db:"decimal_def_const_unique_check"` + DecimalDefFunc sql.NullFloat64 `db:"decimal_def_func"` + DecimalDefFuncUniqueCheck sql.NullFloat64 `db:"decimal_def_func_unique_check"` +} diff --git a/internal/integration_tests/mysql8/defaultsettings/DecimalUniqueCheckPk.go b/internal/integration_tests/mysql8/defaultsettings/DecimalUniqueCheckPk.go new file mode 100644 index 00000000..f6df5c3e --- /dev/null +++ b/internal/integration_tests/mysql8/defaultsettings/DecimalUniqueCheckPk.go @@ -0,0 +1,5 @@ +package dto + +type DecimalUniqueCheckPk struct { + DecimalUniqueCheckPk float64 `db:"decimal_unique_check_pk"` +} diff --git a/internal/integration_tests/mysql8/defaultsettings/DecimalUniqueCheckPkRef.go b/internal/integration_tests/mysql8/defaultsettings/DecimalUniqueCheckPkRef.go new file mode 100644 index 00000000..c94f982e --- /dev/null +++ b/internal/integration_tests/mysql8/defaultsettings/DecimalUniqueCheckPkRef.go @@ -0,0 +1,5 @@ +package dto + +type DecimalUniqueCheckPkRef struct { + DecimalUniqueCheckPkRef float64 `db:"decimal_unique_check_pk_ref"` +} diff --git a/internal/integration_tests/mysql8/defaultsettings/DecimalUniquePk.go b/internal/integration_tests/mysql8/defaultsettings/DecimalUniquePk.go new file mode 100644 index 00000000..ca299e19 --- /dev/null +++ b/internal/integration_tests/mysql8/defaultsettings/DecimalUniquePk.go @@ -0,0 +1,5 @@ +package dto + +type DecimalUniquePk struct { + DecimalUniquePk float64 `db:"decimal_unique_pk"` +} diff --git a/internal/integration_tests/mysql8/defaultsettings/DoublePrecisionCheckPk.go b/internal/integration_tests/mysql8/defaultsettings/DoublePrecisionCheckPk.go new file mode 100644 index 00000000..b371f477 --- /dev/null +++ b/internal/integration_tests/mysql8/defaultsettings/DoublePrecisionCheckPk.go @@ -0,0 +1,5 @@ +package dto + +type DoublePrecisionCheckPk struct { + DoublePrecisionCheckPk float64 `db:"double_precision_check_pk"` +} diff --git a/internal/integration_tests/mysql8/defaultsettings/DoublePrecisionDefConstUniqueCheckPk.go b/internal/integration_tests/mysql8/defaultsettings/DoublePrecisionDefConstUniqueCheckPk.go new file mode 100644 index 00000000..aed14fe8 --- /dev/null +++ b/internal/integration_tests/mysql8/defaultsettings/DoublePrecisionDefConstUniqueCheckPk.go @@ -0,0 +1,5 @@ +package dto + +type DoublePrecisionDefConstUniqueCheckPk struct { + DoublePrecisionDefConstUniqueCheckPk float64 `db:"double_precision_def_const_unique_check_pk"` +} diff --git a/internal/integration_tests/mysql8/defaultsettings/DoublePrecisionDefConstUniqueCheckPkRef.go b/internal/integration_tests/mysql8/defaultsettings/DoublePrecisionDefConstUniqueCheckPkRef.go new file mode 100644 index 00000000..f3fd6f6f --- /dev/null +++ b/internal/integration_tests/mysql8/defaultsettings/DoublePrecisionDefConstUniqueCheckPkRef.go @@ -0,0 +1,5 @@ +package dto + +type DoublePrecisionDefConstUniqueCheckPkRef struct { + DoublePrecisionDefConstUniqueCheckPkRef float64 `db:"double_precision_def_const_unique_check_pk_ref"` +} diff --git a/internal/integration_tests/mysql8/defaultsettings/DoublePrecisionDefFuncUniqueCheckPk.go b/internal/integration_tests/mysql8/defaultsettings/DoublePrecisionDefFuncUniqueCheckPk.go new file mode 100644 index 00000000..d868ad99 --- /dev/null +++ b/internal/integration_tests/mysql8/defaultsettings/DoublePrecisionDefFuncUniqueCheckPk.go @@ -0,0 +1,5 @@ +package dto + +type DoublePrecisionDefFuncUniqueCheckPk struct { + DoublePrecisionDefFuncUniqueCheckPk float64 `db:"double_precision_def_func_unique_check_pk"` +} diff --git a/internal/integration_tests/mysql8/defaultsettings/DoublePrecisionDefFuncUniqueCheckPkRef.go b/internal/integration_tests/mysql8/defaultsettings/DoublePrecisionDefFuncUniqueCheckPkRef.go new file mode 100644 index 00000000..cfc1fd16 --- /dev/null +++ b/internal/integration_tests/mysql8/defaultsettings/DoublePrecisionDefFuncUniqueCheckPkRef.go @@ -0,0 +1,5 @@ +package dto + +type DoublePrecisionDefFuncUniqueCheckPkRef struct { + DoublePrecisionDefFuncUniqueCheckPkRef float64 `db:"double_precision_def_func_unique_check_pk_ref"` +} diff --git a/internal/integration_tests/mysql8/defaultsettings/DoublePrecisionNnPk.go b/internal/integration_tests/mysql8/defaultsettings/DoublePrecisionNnPk.go new file mode 100644 index 00000000..cdd85c7c --- /dev/null +++ b/internal/integration_tests/mysql8/defaultsettings/DoublePrecisionNnPk.go @@ -0,0 +1,5 @@ +package dto + +type DoublePrecisionNnPk struct { + DoublePrecisionNnPk float64 `db:"double_precision_nn_pk"` +} diff --git a/internal/integration_tests/mysql8/defaultsettings/DoublePrecisionNnUniqueCheckPk.go b/internal/integration_tests/mysql8/defaultsettings/DoublePrecisionNnUniqueCheckPk.go new file mode 100644 index 00000000..4c6f76fd --- /dev/null +++ b/internal/integration_tests/mysql8/defaultsettings/DoublePrecisionNnUniqueCheckPk.go @@ -0,0 +1,5 @@ +package dto + +type DoublePrecisionNnUniqueCheckPk struct { + DoublePrecisionNnUniqueCheckPk float64 `db:"double_precision_nn_unique_check_pk"` +} diff --git a/internal/integration_tests/mysql8/defaultsettings/DoublePrecisionNnUniqueCheckPkRef.go b/internal/integration_tests/mysql8/defaultsettings/DoublePrecisionNnUniqueCheckPkRef.go new file mode 100644 index 00000000..46f9308c --- /dev/null +++ b/internal/integration_tests/mysql8/defaultsettings/DoublePrecisionNnUniqueCheckPkRef.go @@ -0,0 +1,5 @@ +package dto + +type DoublePrecisionNnUniqueCheckPkRef struct { + DoublePrecisionNnUniqueCheckPkRef float64 `db:"double_precision_nn_unique_check_pk_ref"` +} diff --git a/internal/integration_tests/mysql8/defaultsettings/DoublePrecisionPk.go b/internal/integration_tests/mysql8/defaultsettings/DoublePrecisionPk.go new file mode 100644 index 00000000..dd4230cd --- /dev/null +++ b/internal/integration_tests/mysql8/defaultsettings/DoublePrecisionPk.go @@ -0,0 +1,5 @@ +package dto + +type DoublePrecisionPk struct { + DoublePrecisionPk float64 `db:"double_precision_pk"` +} diff --git a/internal/integration_tests/mysql8/defaultsettings/DoublePrecisionPkDefConst.go b/internal/integration_tests/mysql8/defaultsettings/DoublePrecisionPkDefConst.go new file mode 100644 index 00000000..88e67c92 --- /dev/null +++ b/internal/integration_tests/mysql8/defaultsettings/DoublePrecisionPkDefConst.go @@ -0,0 +1,5 @@ +package dto + +type DoublePrecisionPkDefConst struct { + DoublePrecisionPkDefConst float64 `db:"double_precision_pk_def_const"` +} diff --git a/internal/integration_tests/mysql8/defaultsettings/DoublePrecisionPkDefFunc.go b/internal/integration_tests/mysql8/defaultsettings/DoublePrecisionPkDefFunc.go new file mode 100644 index 00000000..a61e3112 --- /dev/null +++ b/internal/integration_tests/mysql8/defaultsettings/DoublePrecisionPkDefFunc.go @@ -0,0 +1,5 @@ +package dto + +type DoublePrecisionPkDefFunc struct { + DoublePrecisionPkDefFunc float64 `db:"double_precision_pk_def_func"` +} diff --git a/internal/integration_tests/mysql8/defaultsettings/DoublePrecisionPkRef.go b/internal/integration_tests/mysql8/defaultsettings/DoublePrecisionPkRef.go new file mode 100644 index 00000000..0ef20e93 --- /dev/null +++ b/internal/integration_tests/mysql8/defaultsettings/DoublePrecisionPkRef.go @@ -0,0 +1,5 @@ +package dto + +type DoublePrecisionPkRef struct { + DoublePrecisionPkRef float64 `db:"double_precision_pk_ref"` +} diff --git a/internal/integration_tests/mysql8/defaultsettings/DoublePrecisionRef.go b/internal/integration_tests/mysql8/defaultsettings/DoublePrecisionRef.go new file mode 100644 index 00000000..569451b6 --- /dev/null +++ b/internal/integration_tests/mysql8/defaultsettings/DoublePrecisionRef.go @@ -0,0 +1,9 @@ +package dto + +import ( + "database/sql" +) + +type DoublePrecisionRef struct { + DoublePrecisionRef sql.NullFloat64 `db:"double_precision_ref"` +} diff --git a/internal/integration_tests/mysql8/defaultsettings/DoublePrecisionTable.go b/internal/integration_tests/mysql8/defaultsettings/DoublePrecisionTable.go new file mode 100644 index 00000000..56db32f5 --- /dev/null +++ b/internal/integration_tests/mysql8/defaultsettings/DoublePrecisionTable.go @@ -0,0 +1,31 @@ +package dto + +import ( + "database/sql" +) + +type DoublePrecisionTable struct { + Col sql.NullFloat64 `db:"col"` + DoublePrecisionNn float64 `db:"double_precision_nn"` + DoublePrecisionNnUnique float64 `db:"double_precision_nn_unique"` + DoublePrecisionNnCheck float64 `db:"double_precision_nn_check"` + DoublePrecisionNnRef float64 `db:"double_precision_nn_ref"` + DoublePrecisionNnDefConst float64 `db:"double_precision_nn_def_const"` + DoublePrecisionNnDefFunc float64 `db:"double_precision_nn_def_func"` + DoublePrecisionNnUniqueCheck float64 `db:"double_precision_nn_unique_check"` + DoublePrecisionUnique sql.NullFloat64 `db:"double_precision_unique"` + DoublePrecisionUniqueCheck sql.NullFloat64 `db:"double_precision_unique_check"` + DoublePrecisionUniqueRef sql.NullFloat64 `db:"double_precision_unique_ref"` + DoublePrecisionUniqueDefConst sql.NullFloat64 `db:"double_precision_unique_def_const"` + DoublePrecisionUniqueDefFunc sql.NullFloat64 `db:"double_precision_unique_def_func"` + DoublePrecisionCheck sql.NullFloat64 `db:"double_precision_check"` + DoublePrecisionCheckRef sql.NullFloat64 `db:"double_precision_check_ref"` + DoublePrecisionCheckDefConst sql.NullFloat64 `db:"double_precision_check_def_const"` + DoublePrecisionCheckDefFunc sql.NullFloat64 `db:"double_precision_check_def_func"` + DoublePrecisionRef sql.NullFloat64 `db:"double_precision_ref"` + DoublePrecisionRefUniqueCheck sql.NullFloat64 `db:"double_precision_ref_unique_check"` + DoublePrecisionDefConst sql.NullFloat64 `db:"double_precision_def_const"` + DoublePrecisionDefConstUniqueCheck sql.NullFloat64 `db:"double_precision_def_const_unique_check"` + DoublePrecisionDefFunc sql.NullFloat64 `db:"double_precision_def_func"` + DoublePrecisionDefFuncUniqueCheck sql.NullFloat64 `db:"double_precision_def_func_unique_check"` +} diff --git a/internal/integration_tests/mysql8/defaultsettings/DoublePrecisionUniqueCheckPk.go b/internal/integration_tests/mysql8/defaultsettings/DoublePrecisionUniqueCheckPk.go new file mode 100644 index 00000000..3e3cf20b --- /dev/null +++ b/internal/integration_tests/mysql8/defaultsettings/DoublePrecisionUniqueCheckPk.go @@ -0,0 +1,5 @@ +package dto + +type DoublePrecisionUniqueCheckPk struct { + DoublePrecisionUniqueCheckPk float64 `db:"double_precision_unique_check_pk"` +} diff --git a/internal/integration_tests/mysql8/defaultsettings/DoublePrecisionUniqueCheckPkRef.go b/internal/integration_tests/mysql8/defaultsettings/DoublePrecisionUniqueCheckPkRef.go new file mode 100644 index 00000000..3655f585 --- /dev/null +++ b/internal/integration_tests/mysql8/defaultsettings/DoublePrecisionUniqueCheckPkRef.go @@ -0,0 +1,5 @@ +package dto + +type DoublePrecisionUniqueCheckPkRef struct { + DoublePrecisionUniqueCheckPkRef float64 `db:"double_precision_unique_check_pk_ref"` +} diff --git a/internal/integration_tests/mysql8/defaultsettings/DoublePrecisionUniquePk.go b/internal/integration_tests/mysql8/defaultsettings/DoublePrecisionUniquePk.go new file mode 100644 index 00000000..df2b18cc --- /dev/null +++ b/internal/integration_tests/mysql8/defaultsettings/DoublePrecisionUniquePk.go @@ -0,0 +1,5 @@ +package dto + +type DoublePrecisionUniquePk struct { + DoublePrecisionUniquePk float64 `db:"double_precision_unique_pk"` +} diff --git a/internal/integration_tests/mysql8/defaultsettings/FloatCheckPk.go b/internal/integration_tests/mysql8/defaultsettings/FloatCheckPk.go new file mode 100644 index 00000000..e40adfb8 --- /dev/null +++ b/internal/integration_tests/mysql8/defaultsettings/FloatCheckPk.go @@ -0,0 +1,5 @@ +package dto + +type FloatCheckPk struct { + FloatCheckPk float64 `db:"float_check_pk"` +} diff --git a/internal/integration_tests/mysql8/defaultsettings/FloatDefConstUniqueCheckPk.go b/internal/integration_tests/mysql8/defaultsettings/FloatDefConstUniqueCheckPk.go new file mode 100644 index 00000000..57baef77 --- /dev/null +++ b/internal/integration_tests/mysql8/defaultsettings/FloatDefConstUniqueCheckPk.go @@ -0,0 +1,5 @@ +package dto + +type FloatDefConstUniqueCheckPk struct { + FloatDefConstUniqueCheckPk float64 `db:"float_def_const_unique_check_pk"` +} diff --git a/internal/integration_tests/mysql8/defaultsettings/FloatDefConstUniqueCheckPkRef.go b/internal/integration_tests/mysql8/defaultsettings/FloatDefConstUniqueCheckPkRef.go new file mode 100644 index 00000000..6125761b --- /dev/null +++ b/internal/integration_tests/mysql8/defaultsettings/FloatDefConstUniqueCheckPkRef.go @@ -0,0 +1,5 @@ +package dto + +type FloatDefConstUniqueCheckPkRef struct { + FloatDefConstUniqueCheckPkRef float64 `db:"float_def_const_unique_check_pk_ref"` +} diff --git a/internal/integration_tests/mysql8/defaultsettings/FloatDefFuncUniqueCheckPk.go b/internal/integration_tests/mysql8/defaultsettings/FloatDefFuncUniqueCheckPk.go new file mode 100644 index 00000000..00622747 --- /dev/null +++ b/internal/integration_tests/mysql8/defaultsettings/FloatDefFuncUniqueCheckPk.go @@ -0,0 +1,5 @@ +package dto + +type FloatDefFuncUniqueCheckPk struct { + FloatDefFuncUniqueCheckPk float64 `db:"float_def_func_unique_check_pk"` +} diff --git a/internal/integration_tests/mysql8/defaultsettings/FloatDefFuncUniqueCheckPkRef.go b/internal/integration_tests/mysql8/defaultsettings/FloatDefFuncUniqueCheckPkRef.go new file mode 100644 index 00000000..8d025ad4 --- /dev/null +++ b/internal/integration_tests/mysql8/defaultsettings/FloatDefFuncUniqueCheckPkRef.go @@ -0,0 +1,5 @@ +package dto + +type FloatDefFuncUniqueCheckPkRef struct { + FloatDefFuncUniqueCheckPkRef float64 `db:"float_def_func_unique_check_pk_ref"` +} diff --git a/internal/integration_tests/mysql8/defaultsettings/FloatNnPk.go b/internal/integration_tests/mysql8/defaultsettings/FloatNnPk.go new file mode 100644 index 00000000..aa175645 --- /dev/null +++ b/internal/integration_tests/mysql8/defaultsettings/FloatNnPk.go @@ -0,0 +1,5 @@ +package dto + +type FloatNnPk struct { + FloatNnPk float64 `db:"float_nn_pk"` +} diff --git a/internal/integration_tests/mysql8/defaultsettings/FloatNnUniqueCheckPk.go b/internal/integration_tests/mysql8/defaultsettings/FloatNnUniqueCheckPk.go new file mode 100644 index 00000000..a65f5786 --- /dev/null +++ b/internal/integration_tests/mysql8/defaultsettings/FloatNnUniqueCheckPk.go @@ -0,0 +1,5 @@ +package dto + +type FloatNnUniqueCheckPk struct { + FloatNnUniqueCheckPk float64 `db:"float_nn_unique_check_pk"` +} diff --git a/internal/integration_tests/mysql8/defaultsettings/FloatNnUniqueCheckPkRef.go b/internal/integration_tests/mysql8/defaultsettings/FloatNnUniqueCheckPkRef.go new file mode 100644 index 00000000..a3253c3f --- /dev/null +++ b/internal/integration_tests/mysql8/defaultsettings/FloatNnUniqueCheckPkRef.go @@ -0,0 +1,5 @@ +package dto + +type FloatNnUniqueCheckPkRef struct { + FloatNnUniqueCheckPkRef float64 `db:"float_nn_unique_check_pk_ref"` +} diff --git a/internal/integration_tests/mysql8/defaultsettings/FloatPk.go b/internal/integration_tests/mysql8/defaultsettings/FloatPk.go new file mode 100644 index 00000000..60ca0fcb --- /dev/null +++ b/internal/integration_tests/mysql8/defaultsettings/FloatPk.go @@ -0,0 +1,5 @@ +package dto + +type FloatPk struct { + FloatPk float64 `db:"float_pk"` +} diff --git a/internal/integration_tests/mysql8/defaultsettings/FloatPkDefConst.go b/internal/integration_tests/mysql8/defaultsettings/FloatPkDefConst.go new file mode 100644 index 00000000..1660a67a --- /dev/null +++ b/internal/integration_tests/mysql8/defaultsettings/FloatPkDefConst.go @@ -0,0 +1,5 @@ +package dto + +type FloatPkDefConst struct { + FloatPkDefConst float64 `db:"float_pk_def_const"` +} diff --git a/internal/integration_tests/mysql8/defaultsettings/FloatPkDefFunc.go b/internal/integration_tests/mysql8/defaultsettings/FloatPkDefFunc.go new file mode 100644 index 00000000..e2de6364 --- /dev/null +++ b/internal/integration_tests/mysql8/defaultsettings/FloatPkDefFunc.go @@ -0,0 +1,5 @@ +package dto + +type FloatPkDefFunc struct { + FloatPkDefFunc float64 `db:"float_pk_def_func"` +} diff --git a/internal/integration_tests/mysql8/defaultsettings/FloatPkRef.go b/internal/integration_tests/mysql8/defaultsettings/FloatPkRef.go new file mode 100644 index 00000000..476d656e --- /dev/null +++ b/internal/integration_tests/mysql8/defaultsettings/FloatPkRef.go @@ -0,0 +1,5 @@ +package dto + +type FloatPkRef struct { + FloatPkRef float64 `db:"float_pk_ref"` +} diff --git a/internal/integration_tests/mysql8/defaultsettings/FloatRef.go b/internal/integration_tests/mysql8/defaultsettings/FloatRef.go new file mode 100644 index 00000000..9a43e1af --- /dev/null +++ b/internal/integration_tests/mysql8/defaultsettings/FloatRef.go @@ -0,0 +1,9 @@ +package dto + +import ( + "database/sql" +) + +type FloatRef struct { + FloatRef sql.NullFloat64 `db:"float_ref"` +} diff --git a/internal/integration_tests/mysql8/defaultsettings/FloatTable.go b/internal/integration_tests/mysql8/defaultsettings/FloatTable.go new file mode 100644 index 00000000..e0c1fd48 --- /dev/null +++ b/internal/integration_tests/mysql8/defaultsettings/FloatTable.go @@ -0,0 +1,31 @@ +package dto + +import ( + "database/sql" +) + +type FloatTable struct { + Col sql.NullFloat64 `db:"col"` + FloatNn float64 `db:"float_nn"` + FloatNnUnique float64 `db:"float_nn_unique"` + FloatNnCheck float64 `db:"float_nn_check"` + FloatNnRef float64 `db:"float_nn_ref"` + FloatNnDefConst float64 `db:"float_nn_def_const"` + FloatNnDefFunc float64 `db:"float_nn_def_func"` + FloatNnUniqueCheck float64 `db:"float_nn_unique_check"` + FloatUnique sql.NullFloat64 `db:"float_unique"` + FloatUniqueCheck sql.NullFloat64 `db:"float_unique_check"` + FloatUniqueRef sql.NullFloat64 `db:"float_unique_ref"` + FloatUniqueDefConst sql.NullFloat64 `db:"float_unique_def_const"` + FloatUniqueDefFunc sql.NullFloat64 `db:"float_unique_def_func"` + FloatCheck sql.NullFloat64 `db:"float_check"` + FloatCheckRef sql.NullFloat64 `db:"float_check_ref"` + FloatCheckDefConst sql.NullFloat64 `db:"float_check_def_const"` + FloatCheckDefFunc sql.NullFloat64 `db:"float_check_def_func"` + FloatRef sql.NullFloat64 `db:"float_ref"` + FloatRefUniqueCheck sql.NullFloat64 `db:"float_ref_unique_check"` + FloatDefConst sql.NullFloat64 `db:"float_def_const"` + FloatDefConstUniqueCheck sql.NullFloat64 `db:"float_def_const_unique_check"` + FloatDefFunc sql.NullFloat64 `db:"float_def_func"` + FloatDefFuncUniqueCheck sql.NullFloat64 `db:"float_def_func_unique_check"` +} diff --git a/internal/integration_tests/mysql8/defaultsettings/FloatUniqueCheckPk.go b/internal/integration_tests/mysql8/defaultsettings/FloatUniqueCheckPk.go new file mode 100644 index 00000000..81ddc37f --- /dev/null +++ b/internal/integration_tests/mysql8/defaultsettings/FloatUniqueCheckPk.go @@ -0,0 +1,5 @@ +package dto + +type FloatUniqueCheckPk struct { + FloatUniqueCheckPk float64 `db:"float_unique_check_pk"` +} diff --git a/internal/integration_tests/mysql8/defaultsettings/FloatUniqueCheckPkRef.go b/internal/integration_tests/mysql8/defaultsettings/FloatUniqueCheckPkRef.go new file mode 100644 index 00000000..530d26cc --- /dev/null +++ b/internal/integration_tests/mysql8/defaultsettings/FloatUniqueCheckPkRef.go @@ -0,0 +1,5 @@ +package dto + +type FloatUniqueCheckPkRef struct { + FloatUniqueCheckPkRef float64 `db:"float_unique_check_pk_ref"` +} diff --git a/internal/integration_tests/mysql8/defaultsettings/FloatUniquePk.go b/internal/integration_tests/mysql8/defaultsettings/FloatUniquePk.go new file mode 100644 index 00000000..6f0e1fbd --- /dev/null +++ b/internal/integration_tests/mysql8/defaultsettings/FloatUniquePk.go @@ -0,0 +1,5 @@ +package dto + +type FloatUniquePk struct { + FloatUniquePk float64 `db:"float_unique_pk"` +} diff --git a/internal/integration_tests/mysql8/defaultsettings/IntegerCheckPk.go b/internal/integration_tests/mysql8/defaultsettings/IntegerCheckPk.go new file mode 100644 index 00000000..ad7c9d02 --- /dev/null +++ b/internal/integration_tests/mysql8/defaultsettings/IntegerCheckPk.go @@ -0,0 +1,5 @@ +package dto + +type IntegerCheckPk struct { + IntegerCheckPk int `db:"integer_check_pk"` +} diff --git a/internal/integration_tests/mysql8/defaultsettings/IntegerDefConstUniqueCheckPk.go b/internal/integration_tests/mysql8/defaultsettings/IntegerDefConstUniqueCheckPk.go new file mode 100644 index 00000000..72165e92 --- /dev/null +++ b/internal/integration_tests/mysql8/defaultsettings/IntegerDefConstUniqueCheckPk.go @@ -0,0 +1,5 @@ +package dto + +type IntegerDefConstUniqueCheckPk struct { + IntegerDefConstUniqueCheckPk int `db:"integer_def_const_unique_check_pk"` +} diff --git a/internal/integration_tests/mysql8/defaultsettings/IntegerDefConstUniqueCheckPkRef.go b/internal/integration_tests/mysql8/defaultsettings/IntegerDefConstUniqueCheckPkRef.go new file mode 100644 index 00000000..3345b997 --- /dev/null +++ b/internal/integration_tests/mysql8/defaultsettings/IntegerDefConstUniqueCheckPkRef.go @@ -0,0 +1,5 @@ +package dto + +type IntegerDefConstUniqueCheckPkRef struct { + IntegerDefConstUniqueCheckPkRef int `db:"integer_def_const_unique_check_pk_ref"` +} diff --git a/internal/integration_tests/mysql8/defaultsettings/IntegerDefFuncUniqueCheckPk.go b/internal/integration_tests/mysql8/defaultsettings/IntegerDefFuncUniqueCheckPk.go new file mode 100644 index 00000000..842dc704 --- /dev/null +++ b/internal/integration_tests/mysql8/defaultsettings/IntegerDefFuncUniqueCheckPk.go @@ -0,0 +1,5 @@ +package dto + +type IntegerDefFuncUniqueCheckPk struct { + IntegerDefFuncUniqueCheckPk int `db:"integer_def_func_unique_check_pk"` +} diff --git a/internal/integration_tests/mysql8/defaultsettings/IntegerDefFuncUniqueCheckPkRef.go b/internal/integration_tests/mysql8/defaultsettings/IntegerDefFuncUniqueCheckPkRef.go new file mode 100644 index 00000000..8f406218 --- /dev/null +++ b/internal/integration_tests/mysql8/defaultsettings/IntegerDefFuncUniqueCheckPkRef.go @@ -0,0 +1,5 @@ +package dto + +type IntegerDefFuncUniqueCheckPkRef struct { + IntegerDefFuncUniqueCheckPkRef int `db:"integer_def_func_unique_check_pk_ref"` +} diff --git a/internal/integration_tests/mysql8/defaultsettings/IntegerNnPk.go b/internal/integration_tests/mysql8/defaultsettings/IntegerNnPk.go new file mode 100644 index 00000000..2ec86875 --- /dev/null +++ b/internal/integration_tests/mysql8/defaultsettings/IntegerNnPk.go @@ -0,0 +1,5 @@ +package dto + +type IntegerNnPk struct { + IntegerNnPk int `db:"integer_nn_pk"` +} diff --git a/internal/integration_tests/mysql8/defaultsettings/IntegerNnUniqueCheckPk.go b/internal/integration_tests/mysql8/defaultsettings/IntegerNnUniqueCheckPk.go new file mode 100644 index 00000000..f9311f0e --- /dev/null +++ b/internal/integration_tests/mysql8/defaultsettings/IntegerNnUniqueCheckPk.go @@ -0,0 +1,5 @@ +package dto + +type IntegerNnUniqueCheckPk struct { + IntegerNnUniqueCheckPk int `db:"integer_nn_unique_check_pk"` +} diff --git a/internal/integration_tests/mysql8/defaultsettings/IntegerNnUniqueCheckPkRef.go b/internal/integration_tests/mysql8/defaultsettings/IntegerNnUniqueCheckPkRef.go new file mode 100644 index 00000000..9dca594a --- /dev/null +++ b/internal/integration_tests/mysql8/defaultsettings/IntegerNnUniqueCheckPkRef.go @@ -0,0 +1,5 @@ +package dto + +type IntegerNnUniqueCheckPkRef struct { + IntegerNnUniqueCheckPkRef int `db:"integer_nn_unique_check_pk_ref"` +} diff --git a/internal/integration_tests/mysql8/defaultsettings/IntegerPk.go b/internal/integration_tests/mysql8/defaultsettings/IntegerPk.go new file mode 100644 index 00000000..4ad7290a --- /dev/null +++ b/internal/integration_tests/mysql8/defaultsettings/IntegerPk.go @@ -0,0 +1,5 @@ +package dto + +type IntegerPk struct { + IntegerPk int `db:"integer_pk"` +} diff --git a/internal/integration_tests/mysql8/defaultsettings/IntegerPkDefConst.go b/internal/integration_tests/mysql8/defaultsettings/IntegerPkDefConst.go new file mode 100644 index 00000000..16ca6af6 --- /dev/null +++ b/internal/integration_tests/mysql8/defaultsettings/IntegerPkDefConst.go @@ -0,0 +1,5 @@ +package dto + +type IntegerPkDefConst struct { + IntegerPkDefConst int `db:"integer_pk_def_const"` +} diff --git a/internal/integration_tests/mysql8/defaultsettings/IntegerPkDefFunc.go b/internal/integration_tests/mysql8/defaultsettings/IntegerPkDefFunc.go new file mode 100644 index 00000000..902032a0 --- /dev/null +++ b/internal/integration_tests/mysql8/defaultsettings/IntegerPkDefFunc.go @@ -0,0 +1,5 @@ +package dto + +type IntegerPkDefFunc struct { + IntegerPkDefFunc int `db:"integer_pk_def_func"` +} diff --git a/internal/integration_tests/mysql8/defaultsettings/IntegerPkRef.go b/internal/integration_tests/mysql8/defaultsettings/IntegerPkRef.go new file mode 100644 index 00000000..4b526720 --- /dev/null +++ b/internal/integration_tests/mysql8/defaultsettings/IntegerPkRef.go @@ -0,0 +1,5 @@ +package dto + +type IntegerPkRef struct { + IntegerPkRef int `db:"integer_pk_ref"` +} diff --git a/internal/integration_tests/mysql8/defaultsettings/IntegerRef.go b/internal/integration_tests/mysql8/defaultsettings/IntegerRef.go new file mode 100644 index 00000000..0c130331 --- /dev/null +++ b/internal/integration_tests/mysql8/defaultsettings/IntegerRef.go @@ -0,0 +1,9 @@ +package dto + +import ( + "database/sql" +) + +type IntegerRef struct { + IntegerRef sql.NullInt64 `db:"integer_ref"` +} diff --git a/internal/integration_tests/mysql8/defaultsettings/IntegerTable.go b/internal/integration_tests/mysql8/defaultsettings/IntegerTable.go new file mode 100644 index 00000000..4fc8d333 --- /dev/null +++ b/internal/integration_tests/mysql8/defaultsettings/IntegerTable.go @@ -0,0 +1,27 @@ +package dto + +import ( + "database/sql" +) + +type IntegerTable struct { + I sql.NullInt64 `db:"i"` + IntegerNn int `db:"integer_nn"` + IntegerNnUnique int `db:"integer_nn_unique"` + IntegerNnCheck int `db:"integer_nn_check"` + IntegerUnique sql.NullInt64 `db:"integer_unique"` + IntegerUniqueCheck sql.NullInt64 `db:"integer_unique_check"` + IntegerUniqueRef sql.NullInt64 `db:"integer_unique_ref"` + IntegerUniqueDefConst sql.NullInt64 `db:"integer_unique_def_const"` + IntegerUniqueDefFunc sql.NullInt64 `db:"integer_unique_def_func"` + IntegerCheck sql.NullInt64 `db:"integer_check"` + IntegerCheckRef sql.NullInt64 `db:"integer_check_ref"` + IntegerCheckDefConst sql.NullInt64 `db:"integer_check_def_const"` + IntegerCheckDefFunc sql.NullInt64 `db:"integer_check_def_func"` + IntegerRef sql.NullInt64 `db:"integer_ref"` + IntegerRefUniqueCheck sql.NullInt64 `db:"integer_ref_unique_check"` + IntegerDefConst sql.NullInt64 `db:"integer_def_const"` + IntegerDefConstUniqueCheck sql.NullInt64 `db:"integer_def_const_unique_check"` + IntegerDefFunc sql.NullInt64 `db:"integer_def_func"` + IntegerDefFuncUniqueCheck sql.NullInt64 `db:"integer_def_func_unique_check"` +} diff --git a/internal/integration_tests/mysql8/defaultsettings/IntegerUniqueCheckPk.go b/internal/integration_tests/mysql8/defaultsettings/IntegerUniqueCheckPk.go new file mode 100644 index 00000000..e9752b8b --- /dev/null +++ b/internal/integration_tests/mysql8/defaultsettings/IntegerUniqueCheckPk.go @@ -0,0 +1,5 @@ +package dto + +type IntegerUniqueCheckPk struct { + IntegerUniqueCheckPk int `db:"integer_unique_check_pk"` +} diff --git a/internal/integration_tests/mysql8/defaultsettings/IntegerUniqueCheckPkRef.go b/internal/integration_tests/mysql8/defaultsettings/IntegerUniqueCheckPkRef.go new file mode 100644 index 00000000..23ec56d9 --- /dev/null +++ b/internal/integration_tests/mysql8/defaultsettings/IntegerUniqueCheckPkRef.go @@ -0,0 +1,5 @@ +package dto + +type IntegerUniqueCheckPkRef struct { + IntegerUniqueCheckPkRef int `db:"integer_unique_check_pk_ref"` +} diff --git a/internal/integration_tests/mysql8/defaultsettings/IntegerUniquePk.go b/internal/integration_tests/mysql8/defaultsettings/IntegerUniquePk.go new file mode 100644 index 00000000..460e2616 --- /dev/null +++ b/internal/integration_tests/mysql8/defaultsettings/IntegerUniquePk.go @@ -0,0 +1,5 @@ +package dto + +type IntegerUniquePk struct { + IntegerUniquePk int `db:"integer_unique_pk"` +} diff --git a/internal/integration_tests/mysql8/defaultsettings/LongblobRef.go b/internal/integration_tests/mysql8/defaultsettings/LongblobRef.go new file mode 100644 index 00000000..27258135 --- /dev/null +++ b/internal/integration_tests/mysql8/defaultsettings/LongblobRef.go @@ -0,0 +1,5 @@ +package dto + +type LongblobRef struct { + LongblobRef string `db:"longblob_ref"` +} diff --git a/internal/integration_tests/mysql8/defaultsettings/LongblobTable.go b/internal/integration_tests/mysql8/defaultsettings/LongblobTable.go new file mode 100644 index 00000000..607f0740 --- /dev/null +++ b/internal/integration_tests/mysql8/defaultsettings/LongblobTable.go @@ -0,0 +1,22 @@ +package dto + +import ( + "database/sql" +) + +type LongblobTable struct { + Col sql.NullString `db:"col"` + LongblobDefConst sql.NullString `db:"longblob_def_const"` + LongblobDefFunc sql.NullString `db:"longblob_def_func"` + LongblobRef sql.NullString `db:"longblob_ref"` + LongblobNn string `db:"longblob_nn"` + LongblobNnCheckCmp string `db:"longblob_nn_check_cmp"` + LongblobNnCheckFn string `db:"longblob_nn_check_fn"` + LongblobNnRef string `db:"longblob_nn_ref"` + LongblobNnDefConst string `db:"longblob_nn_def_const"` + LongblobNnDefFunc string `db:"longblob_nn_def_func"` + LongblobCheck sql.NullString `db:"longblob_check"` + LongblobCheckRef sql.NullString `db:"longblob_check_ref"` + LongblobCheckDefConst sql.NullString `db:"longblob_check_def_const"` + LongblobCheckDefFunc sql.NullString `db:"longblob_check_def_func"` +} diff --git a/internal/integration_tests/mysql8/defaultsettings/LongtextRef.go b/internal/integration_tests/mysql8/defaultsettings/LongtextRef.go new file mode 100644 index 00000000..643799f5 --- /dev/null +++ b/internal/integration_tests/mysql8/defaultsettings/LongtextRef.go @@ -0,0 +1,5 @@ +package dto + +type LongtextRef struct { + LongtextRef string `db:"longtext_ref"` +} diff --git a/internal/integration_tests/mysql8/defaultsettings/LongtextTable.go b/internal/integration_tests/mysql8/defaultsettings/LongtextTable.go new file mode 100644 index 00000000..af6bd5bf --- /dev/null +++ b/internal/integration_tests/mysql8/defaultsettings/LongtextTable.go @@ -0,0 +1,22 @@ +package dto + +import ( + "database/sql" +) + +type LongtextTable struct { + Col sql.NullString `db:"col"` + LongtextDefConst sql.NullString `db:"longtext_def_const"` + LongtextDefFunc sql.NullString `db:"longtext_def_func"` + LongtextRef sql.NullString `db:"longtext_ref"` + LongtextNn string `db:"longtext_nn"` + LongtextNnCheckCmp string `db:"longtext_nn_check_cmp"` + LongtextNnCheckFn string `db:"longtext_nn_check_fn"` + LongtextNnRef string `db:"longtext_nn_ref"` + LongtextNnDefConst string `db:"longtext_nn_def_const"` + LongtextNnDefFunc string `db:"longtext_nn_def_func"` + LongtextCheck sql.NullString `db:"longtext_check"` + LongtextCheckRef sql.NullString `db:"longtext_check_ref"` + LongtextCheckDefConst sql.NullString `db:"longtext_check_def_const"` + LongtextCheckDefFunc sql.NullString `db:"longtext_check_def_func"` +} diff --git a/internal/integration_tests/mysql8/defaultsettings/MediumblobRef.go b/internal/integration_tests/mysql8/defaultsettings/MediumblobRef.go new file mode 100644 index 00000000..c07a7901 --- /dev/null +++ b/internal/integration_tests/mysql8/defaultsettings/MediumblobRef.go @@ -0,0 +1,5 @@ +package dto + +type MediumblobRef struct { + MediumblobRef string `db:"mediumblob_ref"` +} diff --git a/internal/integration_tests/mysql8/defaultsettings/MediumblobTable.go b/internal/integration_tests/mysql8/defaultsettings/MediumblobTable.go new file mode 100644 index 00000000..071a3c7b --- /dev/null +++ b/internal/integration_tests/mysql8/defaultsettings/MediumblobTable.go @@ -0,0 +1,22 @@ +package dto + +import ( + "database/sql" +) + +type MediumblobTable struct { + Col sql.NullString `db:"col"` + MediumblobDefConst sql.NullString `db:"mediumblob_def_const"` + MediumblobDefFunc sql.NullString `db:"mediumblob_def_func"` + MediumblobRef sql.NullString `db:"mediumblob_ref"` + MediumblobNn string `db:"mediumblob_nn"` + MediumblobNnCheckCmp string `db:"mediumblob_nn_check_cmp"` + MediumblobNnCheckFn string `db:"mediumblob_nn_check_fn"` + MediumblobNnRef string `db:"mediumblob_nn_ref"` + MediumblobNnDefConst string `db:"mediumblob_nn_def_const"` + MediumblobNnDefFunc string `db:"mediumblob_nn_def_func"` + MediumblobCheck sql.NullString `db:"mediumblob_check"` + MediumblobCheckRef sql.NullString `db:"mediumblob_check_ref"` + MediumblobCheckDefConst sql.NullString `db:"mediumblob_check_def_const"` + MediumblobCheckDefFunc sql.NullString `db:"mediumblob_check_def_func"` +} diff --git a/internal/integration_tests/mysql8/defaultsettings/MediumintCheckPk.go b/internal/integration_tests/mysql8/defaultsettings/MediumintCheckPk.go new file mode 100644 index 00000000..45cbb5c1 --- /dev/null +++ b/internal/integration_tests/mysql8/defaultsettings/MediumintCheckPk.go @@ -0,0 +1,5 @@ +package dto + +type MediumintCheckPk struct { + MediumintCheckPk int `db:"mediumint_check_pk"` +} diff --git a/internal/integration_tests/mysql8/defaultsettings/MediumintDefConstUniqueCheckPk.go b/internal/integration_tests/mysql8/defaultsettings/MediumintDefConstUniqueCheckPk.go new file mode 100644 index 00000000..b9ddc8db --- /dev/null +++ b/internal/integration_tests/mysql8/defaultsettings/MediumintDefConstUniqueCheckPk.go @@ -0,0 +1,5 @@ +package dto + +type MediumintDefConstUniqueCheckPk struct { + MediumintDefConstUniqueCheckPk int `db:"mediumint_def_const_unique_check_pk"` +} diff --git a/internal/integration_tests/mysql8/defaultsettings/MediumintDefConstUniqueCheckPkRef.go b/internal/integration_tests/mysql8/defaultsettings/MediumintDefConstUniqueCheckPkRef.go new file mode 100644 index 00000000..0d765358 --- /dev/null +++ b/internal/integration_tests/mysql8/defaultsettings/MediumintDefConstUniqueCheckPkRef.go @@ -0,0 +1,5 @@ +package dto + +type MediumintDefConstUniqueCheckPkRef struct { + MediumintDefConstUniqueCheckPkRef int `db:"mediumint_def_const_unique_check_pk_ref"` +} diff --git a/internal/integration_tests/mysql8/defaultsettings/MediumintDefFuncUniqueCheckPk.go b/internal/integration_tests/mysql8/defaultsettings/MediumintDefFuncUniqueCheckPk.go new file mode 100644 index 00000000..9fbe5e3e --- /dev/null +++ b/internal/integration_tests/mysql8/defaultsettings/MediumintDefFuncUniqueCheckPk.go @@ -0,0 +1,5 @@ +package dto + +type MediumintDefFuncUniqueCheckPk struct { + MediumintDefFuncUniqueCheckPk int `db:"mediumint_def_func_unique_check_pk"` +} diff --git a/internal/integration_tests/mysql8/defaultsettings/MediumintDefFuncUniqueCheckPkRef.go b/internal/integration_tests/mysql8/defaultsettings/MediumintDefFuncUniqueCheckPkRef.go new file mode 100644 index 00000000..5abfd547 --- /dev/null +++ b/internal/integration_tests/mysql8/defaultsettings/MediumintDefFuncUniqueCheckPkRef.go @@ -0,0 +1,5 @@ +package dto + +type MediumintDefFuncUniqueCheckPkRef struct { + MediumintDefFuncUniqueCheckPkRef int `db:"mediumint_def_func_unique_check_pk_ref"` +} diff --git a/internal/integration_tests/mysql8/defaultsettings/MediumintNnPk.go b/internal/integration_tests/mysql8/defaultsettings/MediumintNnPk.go new file mode 100644 index 00000000..232ab1a8 --- /dev/null +++ b/internal/integration_tests/mysql8/defaultsettings/MediumintNnPk.go @@ -0,0 +1,5 @@ +package dto + +type MediumintNnPk struct { + MediumintNnPk int `db:"mediumint_nn_pk"` +} diff --git a/internal/integration_tests/mysql8/defaultsettings/MediumintNnUniqueCheckPk.go b/internal/integration_tests/mysql8/defaultsettings/MediumintNnUniqueCheckPk.go new file mode 100644 index 00000000..b8155be5 --- /dev/null +++ b/internal/integration_tests/mysql8/defaultsettings/MediumintNnUniqueCheckPk.go @@ -0,0 +1,5 @@ +package dto + +type MediumintNnUniqueCheckPk struct { + MediumintNnUniqueCheckPk int `db:"mediumint_nn_unique_check_pk"` +} diff --git a/internal/integration_tests/mysql8/defaultsettings/MediumintNnUniqueCheckPkRef.go b/internal/integration_tests/mysql8/defaultsettings/MediumintNnUniqueCheckPkRef.go new file mode 100644 index 00000000..b116bf6d --- /dev/null +++ b/internal/integration_tests/mysql8/defaultsettings/MediumintNnUniqueCheckPkRef.go @@ -0,0 +1,5 @@ +package dto + +type MediumintNnUniqueCheckPkRef struct { + MediumintNnUniqueCheckPkRef int `db:"mediumint_nn_unique_check_pk_ref"` +} diff --git a/internal/integration_tests/mysql8/defaultsettings/MediumintPk.go b/internal/integration_tests/mysql8/defaultsettings/MediumintPk.go new file mode 100644 index 00000000..8699b985 --- /dev/null +++ b/internal/integration_tests/mysql8/defaultsettings/MediumintPk.go @@ -0,0 +1,5 @@ +package dto + +type MediumintPk struct { + MediumintPk int `db:"mediumint_pk"` +} diff --git a/internal/integration_tests/mysql8/defaultsettings/MediumintPkDefConst.go b/internal/integration_tests/mysql8/defaultsettings/MediumintPkDefConst.go new file mode 100644 index 00000000..93cfa99c --- /dev/null +++ b/internal/integration_tests/mysql8/defaultsettings/MediumintPkDefConst.go @@ -0,0 +1,5 @@ +package dto + +type MediumintPkDefConst struct { + MediumintPkDefConst int `db:"mediumint_pk_def_const"` +} diff --git a/internal/integration_tests/mysql8/defaultsettings/MediumintPkDefFunc.go b/internal/integration_tests/mysql8/defaultsettings/MediumintPkDefFunc.go new file mode 100644 index 00000000..bc09f7f8 --- /dev/null +++ b/internal/integration_tests/mysql8/defaultsettings/MediumintPkDefFunc.go @@ -0,0 +1,5 @@ +package dto + +type MediumintPkDefFunc struct { + MediumintPkDefFunc int `db:"mediumint_pk_def_func"` +} diff --git a/internal/integration_tests/mysql8/defaultsettings/MediumintPkRef.go b/internal/integration_tests/mysql8/defaultsettings/MediumintPkRef.go new file mode 100644 index 00000000..bf4a377f --- /dev/null +++ b/internal/integration_tests/mysql8/defaultsettings/MediumintPkRef.go @@ -0,0 +1,5 @@ +package dto + +type MediumintPkRef struct { + MediumintPkRef int `db:"mediumint_pk_ref"` +} diff --git a/internal/integration_tests/mysql8/defaultsettings/MediumintRef.go b/internal/integration_tests/mysql8/defaultsettings/MediumintRef.go new file mode 100644 index 00000000..d1792f5c --- /dev/null +++ b/internal/integration_tests/mysql8/defaultsettings/MediumintRef.go @@ -0,0 +1,9 @@ +package dto + +import ( + "database/sql" +) + +type MediumintRef struct { + MediumintRef sql.NullInt64 `db:"mediumint_ref"` +} diff --git a/internal/integration_tests/mysql8/defaultsettings/MediumintTable.go b/internal/integration_tests/mysql8/defaultsettings/MediumintTable.go new file mode 100644 index 00000000..899e02f6 --- /dev/null +++ b/internal/integration_tests/mysql8/defaultsettings/MediumintTable.go @@ -0,0 +1,27 @@ +package dto + +import ( + "database/sql" +) + +type MediumintTable struct { + I sql.NullInt64 `db:"i"` + MediumintNn int `db:"mediumint_nn"` + MediumintNnUnique int `db:"mediumint_nn_unique"` + MediumintNnCheck int `db:"mediumint_nn_check"` + MediumintUnique sql.NullInt64 `db:"mediumint_unique"` + MediumintUniqueCheck sql.NullInt64 `db:"mediumint_unique_check"` + MediumintUniqueRef sql.NullInt64 `db:"mediumint_unique_ref"` + MediumintUniqueDefConst sql.NullInt64 `db:"mediumint_unique_def_const"` + MediumintUniqueDefFunc sql.NullInt64 `db:"mediumint_unique_def_func"` + MediumintCheck sql.NullInt64 `db:"mediumint_check"` + MediumintCheckRef sql.NullInt64 `db:"mediumint_check_ref"` + MediumintCheckDefConst sql.NullInt64 `db:"mediumint_check_def_const"` + MediumintCheckDefFunc sql.NullInt64 `db:"mediumint_check_def_func"` + MediumintRef sql.NullInt64 `db:"mediumint_ref"` + MediumintRefUniqueCheck sql.NullInt64 `db:"mediumint_ref_unique_check"` + MediumintDefConst sql.NullInt64 `db:"mediumint_def_const"` + MediumintDefConstUniqueCheck sql.NullInt64 `db:"mediumint_def_const_unique_check"` + MediumintDefFunc sql.NullInt64 `db:"mediumint_def_func"` + MediumintDefFuncUniqueCheck sql.NullInt64 `db:"mediumint_def_func_unique_check"` +} diff --git a/internal/integration_tests/mysql8/defaultsettings/MediumintUniqueCheckPk.go b/internal/integration_tests/mysql8/defaultsettings/MediumintUniqueCheckPk.go new file mode 100644 index 00000000..560ec7bf --- /dev/null +++ b/internal/integration_tests/mysql8/defaultsettings/MediumintUniqueCheckPk.go @@ -0,0 +1,5 @@ +package dto + +type MediumintUniqueCheckPk struct { + MediumintUniqueCheckPk int `db:"mediumint_unique_check_pk"` +} diff --git a/internal/integration_tests/mysql8/defaultsettings/MediumintUniqueCheckPkRef.go b/internal/integration_tests/mysql8/defaultsettings/MediumintUniqueCheckPkRef.go new file mode 100644 index 00000000..5fc524dc --- /dev/null +++ b/internal/integration_tests/mysql8/defaultsettings/MediumintUniqueCheckPkRef.go @@ -0,0 +1,5 @@ +package dto + +type MediumintUniqueCheckPkRef struct { + MediumintUniqueCheckPkRef int `db:"mediumint_unique_check_pk_ref"` +} diff --git a/internal/integration_tests/mysql8/defaultsettings/MediumintUniquePk.go b/internal/integration_tests/mysql8/defaultsettings/MediumintUniquePk.go new file mode 100644 index 00000000..d8029efd --- /dev/null +++ b/internal/integration_tests/mysql8/defaultsettings/MediumintUniquePk.go @@ -0,0 +1,5 @@ +package dto + +type MediumintUniquePk struct { + MediumintUniquePk int `db:"mediumint_unique_pk"` +} diff --git a/internal/integration_tests/mysql8/defaultsettings/MediumtextRef.go b/internal/integration_tests/mysql8/defaultsettings/MediumtextRef.go new file mode 100644 index 00000000..8102e8aa --- /dev/null +++ b/internal/integration_tests/mysql8/defaultsettings/MediumtextRef.go @@ -0,0 +1,5 @@ +package dto + +type MediumtextRef struct { + MediumtextRef string `db:"mediumtext_ref"` +} diff --git a/internal/integration_tests/mysql8/defaultsettings/MediumtextTable.go b/internal/integration_tests/mysql8/defaultsettings/MediumtextTable.go new file mode 100644 index 00000000..05428119 --- /dev/null +++ b/internal/integration_tests/mysql8/defaultsettings/MediumtextTable.go @@ -0,0 +1,22 @@ +package dto + +import ( + "database/sql" +) + +type MediumtextTable struct { + Col sql.NullString `db:"col"` + MediumtextDefConst sql.NullString `db:"mediumtext_def_const"` + MediumtextDefFunc sql.NullString `db:"mediumtext_def_func"` + MediumtextRef sql.NullString `db:"mediumtext_ref"` + MediumtextNn string `db:"mediumtext_nn"` + MediumtextNnCheckCmp string `db:"mediumtext_nn_check_cmp"` + MediumtextNnCheckFn string `db:"mediumtext_nn_check_fn"` + MediumtextNnRef string `db:"mediumtext_nn_ref"` + MediumtextNnDefConst string `db:"mediumtext_nn_def_const"` + MediumtextNnDefFunc string `db:"mediumtext_nn_def_func"` + MediumtextCheck sql.NullString `db:"mediumtext_check"` + MediumtextCheckRef sql.NullString `db:"mediumtext_check_ref"` + MediumtextCheckDefConst sql.NullString `db:"mediumtext_check_def_const"` + MediumtextCheckDefFunc sql.NullString `db:"mediumtext_check_def_func"` +} diff --git a/internal/integration_tests/mysql8/defaultsettings/NumericCheckPk.go b/internal/integration_tests/mysql8/defaultsettings/NumericCheckPk.go new file mode 100644 index 00000000..58709a6e --- /dev/null +++ b/internal/integration_tests/mysql8/defaultsettings/NumericCheckPk.go @@ -0,0 +1,5 @@ +package dto + +type NumericCheckPk struct { + NumericCheckPk float64 `db:"numeric_check_pk"` +} diff --git a/internal/integration_tests/mysql8/defaultsettings/NumericDefConstUniqueCheckPk.go b/internal/integration_tests/mysql8/defaultsettings/NumericDefConstUniqueCheckPk.go new file mode 100644 index 00000000..e6fdd1a2 --- /dev/null +++ b/internal/integration_tests/mysql8/defaultsettings/NumericDefConstUniqueCheckPk.go @@ -0,0 +1,5 @@ +package dto + +type NumericDefConstUniqueCheckPk struct { + NumericDefConstUniqueCheckPk float64 `db:"numeric_def_const_unique_check_pk"` +} diff --git a/internal/integration_tests/mysql8/defaultsettings/NumericDefConstUniqueCheckPkRef.go b/internal/integration_tests/mysql8/defaultsettings/NumericDefConstUniqueCheckPkRef.go new file mode 100644 index 00000000..cdaee17e --- /dev/null +++ b/internal/integration_tests/mysql8/defaultsettings/NumericDefConstUniqueCheckPkRef.go @@ -0,0 +1,5 @@ +package dto + +type NumericDefConstUniqueCheckPkRef struct { + NumericDefConstUniqueCheckPkRef float64 `db:"numeric_def_const_unique_check_pk_ref"` +} diff --git a/internal/integration_tests/mysql8/defaultsettings/NumericDefFuncUniqueCheckPk.go b/internal/integration_tests/mysql8/defaultsettings/NumericDefFuncUniqueCheckPk.go new file mode 100644 index 00000000..7747f0a7 --- /dev/null +++ b/internal/integration_tests/mysql8/defaultsettings/NumericDefFuncUniqueCheckPk.go @@ -0,0 +1,5 @@ +package dto + +type NumericDefFuncUniqueCheckPk struct { + NumericDefFuncUniqueCheckPk float64 `db:"numeric_def_func_unique_check_pk"` +} diff --git a/internal/integration_tests/mysql8/defaultsettings/NumericDefFuncUniqueCheckPkRef.go b/internal/integration_tests/mysql8/defaultsettings/NumericDefFuncUniqueCheckPkRef.go new file mode 100644 index 00000000..ade94a23 --- /dev/null +++ b/internal/integration_tests/mysql8/defaultsettings/NumericDefFuncUniqueCheckPkRef.go @@ -0,0 +1,5 @@ +package dto + +type NumericDefFuncUniqueCheckPkRef struct { + NumericDefFuncUniqueCheckPkRef float64 `db:"numeric_def_func_unique_check_pk_ref"` +} diff --git a/internal/integration_tests/mysql8/defaultsettings/NumericNnPk.go b/internal/integration_tests/mysql8/defaultsettings/NumericNnPk.go new file mode 100644 index 00000000..d4f8dba5 --- /dev/null +++ b/internal/integration_tests/mysql8/defaultsettings/NumericNnPk.go @@ -0,0 +1,5 @@ +package dto + +type NumericNnPk struct { + NumericNnPk float64 `db:"numeric_nn_pk"` +} diff --git a/internal/integration_tests/mysql8/defaultsettings/NumericNnUniqueCheckPk.go b/internal/integration_tests/mysql8/defaultsettings/NumericNnUniqueCheckPk.go new file mode 100644 index 00000000..bad0e84f --- /dev/null +++ b/internal/integration_tests/mysql8/defaultsettings/NumericNnUniqueCheckPk.go @@ -0,0 +1,5 @@ +package dto + +type NumericNnUniqueCheckPk struct { + NumericNnUniqueCheckPk float64 `db:"numeric_nn_unique_check_pk"` +} diff --git a/internal/integration_tests/mysql8/defaultsettings/NumericNnUniqueCheckPkRef.go b/internal/integration_tests/mysql8/defaultsettings/NumericNnUniqueCheckPkRef.go new file mode 100644 index 00000000..c4d76752 --- /dev/null +++ b/internal/integration_tests/mysql8/defaultsettings/NumericNnUniqueCheckPkRef.go @@ -0,0 +1,5 @@ +package dto + +type NumericNnUniqueCheckPkRef struct { + NumericNnUniqueCheckPkRef float64 `db:"numeric_nn_unique_check_pk_ref"` +} diff --git a/internal/integration_tests/mysql8/defaultsettings/NumericPk.go b/internal/integration_tests/mysql8/defaultsettings/NumericPk.go new file mode 100644 index 00000000..c2d654cc --- /dev/null +++ b/internal/integration_tests/mysql8/defaultsettings/NumericPk.go @@ -0,0 +1,5 @@ +package dto + +type NumericPk struct { + NumericPk float64 `db:"numeric_pk"` +} diff --git a/internal/integration_tests/mysql8/defaultsettings/NumericPkDefConst.go b/internal/integration_tests/mysql8/defaultsettings/NumericPkDefConst.go new file mode 100644 index 00000000..b501ee37 --- /dev/null +++ b/internal/integration_tests/mysql8/defaultsettings/NumericPkDefConst.go @@ -0,0 +1,5 @@ +package dto + +type NumericPkDefConst struct { + NumericPkDefConst float64 `db:"numeric_pk_def_const"` +} diff --git a/internal/integration_tests/mysql8/defaultsettings/NumericPkDefFunc.go b/internal/integration_tests/mysql8/defaultsettings/NumericPkDefFunc.go new file mode 100644 index 00000000..13dd726d --- /dev/null +++ b/internal/integration_tests/mysql8/defaultsettings/NumericPkDefFunc.go @@ -0,0 +1,5 @@ +package dto + +type NumericPkDefFunc struct { + NumericPkDefFunc float64 `db:"numeric_pk_def_func"` +} diff --git a/internal/integration_tests/mysql8/defaultsettings/NumericPkRef.go b/internal/integration_tests/mysql8/defaultsettings/NumericPkRef.go new file mode 100644 index 00000000..af53186e --- /dev/null +++ b/internal/integration_tests/mysql8/defaultsettings/NumericPkRef.go @@ -0,0 +1,5 @@ +package dto + +type NumericPkRef struct { + NumericPkRef float64 `db:"numeric_pk_ref"` +} diff --git a/internal/integration_tests/mysql8/defaultsettings/NumericRef.go b/internal/integration_tests/mysql8/defaultsettings/NumericRef.go new file mode 100644 index 00000000..2adb8d6d --- /dev/null +++ b/internal/integration_tests/mysql8/defaultsettings/NumericRef.go @@ -0,0 +1,9 @@ +package dto + +import ( + "database/sql" +) + +type NumericRef struct { + NumericRef sql.NullFloat64 `db:"numeric_ref"` +} diff --git a/internal/integration_tests/mysql8/defaultsettings/NumericTable.go b/internal/integration_tests/mysql8/defaultsettings/NumericTable.go new file mode 100644 index 00000000..0277ce43 --- /dev/null +++ b/internal/integration_tests/mysql8/defaultsettings/NumericTable.go @@ -0,0 +1,31 @@ +package dto + +import ( + "database/sql" +) + +type NumericTable struct { + Col sql.NullFloat64 `db:"col"` + NumericNn float64 `db:"numeric_nn"` + NumericNnUnique float64 `db:"numeric_nn_unique"` + NumericNnCheck float64 `db:"numeric_nn_check"` + NumericNnRef float64 `db:"numeric_nn_ref"` + NumericNnDefConst float64 `db:"numeric_nn_def_const"` + NumericNnDefFunc float64 `db:"numeric_nn_def_func"` + NumericNnUniqueCheck float64 `db:"numeric_nn_unique_check"` + NumericUnique sql.NullFloat64 `db:"numeric_unique"` + NumericUniqueCheck sql.NullFloat64 `db:"numeric_unique_check"` + NumericUniqueRef sql.NullFloat64 `db:"numeric_unique_ref"` + NumericUniqueDefConst sql.NullFloat64 `db:"numeric_unique_def_const"` + NumericUniqueDefFunc sql.NullFloat64 `db:"numeric_unique_def_func"` + NumericCheck sql.NullFloat64 `db:"numeric_check"` + NumericCheckRef sql.NullFloat64 `db:"numeric_check_ref"` + NumericCheckDefConst sql.NullFloat64 `db:"numeric_check_def_const"` + NumericCheckDefFunc sql.NullFloat64 `db:"numeric_check_def_func"` + NumericRef sql.NullFloat64 `db:"numeric_ref"` + NumericRefUniqueCheck sql.NullFloat64 `db:"numeric_ref_unique_check"` + NumericDefConst sql.NullFloat64 `db:"numeric_def_const"` + NumericDefConstUniqueCheck sql.NullFloat64 `db:"numeric_def_const_unique_check"` + NumericDefFunc sql.NullFloat64 `db:"numeric_def_func"` + NumericDefFuncUniqueCheck sql.NullFloat64 `db:"numeric_def_func_unique_check"` +} diff --git a/internal/integration_tests/mysql8/defaultsettings/NumericUniqueCheckPk.go b/internal/integration_tests/mysql8/defaultsettings/NumericUniqueCheckPk.go new file mode 100644 index 00000000..e48c41ec --- /dev/null +++ b/internal/integration_tests/mysql8/defaultsettings/NumericUniqueCheckPk.go @@ -0,0 +1,5 @@ +package dto + +type NumericUniqueCheckPk struct { + NumericUniqueCheckPk float64 `db:"numeric_unique_check_pk"` +} diff --git a/internal/integration_tests/mysql8/defaultsettings/NumericUniqueCheckPkRef.go b/internal/integration_tests/mysql8/defaultsettings/NumericUniqueCheckPkRef.go new file mode 100644 index 00000000..d230e9c3 --- /dev/null +++ b/internal/integration_tests/mysql8/defaultsettings/NumericUniqueCheckPkRef.go @@ -0,0 +1,5 @@ +package dto + +type NumericUniqueCheckPkRef struct { + NumericUniqueCheckPkRef float64 `db:"numeric_unique_check_pk_ref"` +} diff --git a/internal/integration_tests/mysql8/defaultsettings/NumericUniquePk.go b/internal/integration_tests/mysql8/defaultsettings/NumericUniquePk.go new file mode 100644 index 00000000..308c1b60 --- /dev/null +++ b/internal/integration_tests/mysql8/defaultsettings/NumericUniquePk.go @@ -0,0 +1,5 @@ +package dto + +type NumericUniquePk struct { + NumericUniquePk float64 `db:"numeric_unique_pk"` +} diff --git a/internal/integration_tests/mysql8/defaultsettings/RealCheckPk.go b/internal/integration_tests/mysql8/defaultsettings/RealCheckPk.go new file mode 100644 index 00000000..41bbff57 --- /dev/null +++ b/internal/integration_tests/mysql8/defaultsettings/RealCheckPk.go @@ -0,0 +1,5 @@ +package dto + +type RealCheckPk struct { + RealCheckPk float64 `db:"real_check_pk"` +} diff --git a/internal/integration_tests/mysql8/defaultsettings/RealDefConstUniqueCheckPk.go b/internal/integration_tests/mysql8/defaultsettings/RealDefConstUniqueCheckPk.go new file mode 100644 index 00000000..9be61d5c --- /dev/null +++ b/internal/integration_tests/mysql8/defaultsettings/RealDefConstUniqueCheckPk.go @@ -0,0 +1,5 @@ +package dto + +type RealDefConstUniqueCheckPk struct { + RealDefConstUniqueCheckPk float64 `db:"real_def_const_unique_check_pk"` +} diff --git a/internal/integration_tests/mysql8/defaultsettings/RealDefConstUniqueCheckPkRef.go b/internal/integration_tests/mysql8/defaultsettings/RealDefConstUniqueCheckPkRef.go new file mode 100644 index 00000000..af58466f --- /dev/null +++ b/internal/integration_tests/mysql8/defaultsettings/RealDefConstUniqueCheckPkRef.go @@ -0,0 +1,5 @@ +package dto + +type RealDefConstUniqueCheckPkRef struct { + RealDefConstUniqueCheckPkRef float64 `db:"real_def_const_unique_check_pk_ref"` +} diff --git a/internal/integration_tests/mysql8/defaultsettings/RealDefFuncUniqueCheckPk.go b/internal/integration_tests/mysql8/defaultsettings/RealDefFuncUniqueCheckPk.go new file mode 100644 index 00000000..2619719a --- /dev/null +++ b/internal/integration_tests/mysql8/defaultsettings/RealDefFuncUniqueCheckPk.go @@ -0,0 +1,5 @@ +package dto + +type RealDefFuncUniqueCheckPk struct { + RealDefFuncUniqueCheckPk float64 `db:"real_def_func_unique_check_pk"` +} diff --git a/internal/integration_tests/mysql8/defaultsettings/RealDefFuncUniqueCheckPkRef.go b/internal/integration_tests/mysql8/defaultsettings/RealDefFuncUniqueCheckPkRef.go new file mode 100644 index 00000000..1c085edc --- /dev/null +++ b/internal/integration_tests/mysql8/defaultsettings/RealDefFuncUniqueCheckPkRef.go @@ -0,0 +1,5 @@ +package dto + +type RealDefFuncUniqueCheckPkRef struct { + RealDefFuncUniqueCheckPkRef float64 `db:"real_def_func_unique_check_pk_ref"` +} diff --git a/internal/integration_tests/mysql8/defaultsettings/RealNnPk.go b/internal/integration_tests/mysql8/defaultsettings/RealNnPk.go new file mode 100644 index 00000000..c9efd760 --- /dev/null +++ b/internal/integration_tests/mysql8/defaultsettings/RealNnPk.go @@ -0,0 +1,5 @@ +package dto + +type RealNnPk struct { + RealNnPk float64 `db:"real_nn_pk"` +} diff --git a/internal/integration_tests/mysql8/defaultsettings/RealNnUniqueCheckPk.go b/internal/integration_tests/mysql8/defaultsettings/RealNnUniqueCheckPk.go new file mode 100644 index 00000000..bcd80e13 --- /dev/null +++ b/internal/integration_tests/mysql8/defaultsettings/RealNnUniqueCheckPk.go @@ -0,0 +1,5 @@ +package dto + +type RealNnUniqueCheckPk struct { + RealNnUniqueCheckPk float64 `db:"real_nn_unique_check_pk"` +} diff --git a/internal/integration_tests/mysql8/defaultsettings/RealNnUniqueCheckPkRef.go b/internal/integration_tests/mysql8/defaultsettings/RealNnUniqueCheckPkRef.go new file mode 100644 index 00000000..1ab6f733 --- /dev/null +++ b/internal/integration_tests/mysql8/defaultsettings/RealNnUniqueCheckPkRef.go @@ -0,0 +1,5 @@ +package dto + +type RealNnUniqueCheckPkRef struct { + RealNnUniqueCheckPkRef float64 `db:"real_nn_unique_check_pk_ref"` +} diff --git a/internal/integration_tests/mysql8/defaultsettings/RealPk.go b/internal/integration_tests/mysql8/defaultsettings/RealPk.go new file mode 100644 index 00000000..aae62539 --- /dev/null +++ b/internal/integration_tests/mysql8/defaultsettings/RealPk.go @@ -0,0 +1,5 @@ +package dto + +type RealPk struct { + RealPk float64 `db:"real_pk"` +} diff --git a/internal/integration_tests/mysql8/defaultsettings/RealPkDefConst.go b/internal/integration_tests/mysql8/defaultsettings/RealPkDefConst.go new file mode 100644 index 00000000..dcb3b0fa --- /dev/null +++ b/internal/integration_tests/mysql8/defaultsettings/RealPkDefConst.go @@ -0,0 +1,5 @@ +package dto + +type RealPkDefConst struct { + RealPkDefConst float64 `db:"real_pk_def_const"` +} diff --git a/internal/integration_tests/mysql8/defaultsettings/RealPkDefFunc.go b/internal/integration_tests/mysql8/defaultsettings/RealPkDefFunc.go new file mode 100644 index 00000000..85041669 --- /dev/null +++ b/internal/integration_tests/mysql8/defaultsettings/RealPkDefFunc.go @@ -0,0 +1,5 @@ +package dto + +type RealPkDefFunc struct { + RealPkDefFunc float64 `db:"real_pk_def_func"` +} diff --git a/internal/integration_tests/mysql8/defaultsettings/RealPkRef.go b/internal/integration_tests/mysql8/defaultsettings/RealPkRef.go new file mode 100644 index 00000000..99800028 --- /dev/null +++ b/internal/integration_tests/mysql8/defaultsettings/RealPkRef.go @@ -0,0 +1,5 @@ +package dto + +type RealPkRef struct { + RealPkRef float64 `db:"real_pk_ref"` +} diff --git a/internal/integration_tests/mysql8/defaultsettings/RealRef.go b/internal/integration_tests/mysql8/defaultsettings/RealRef.go new file mode 100644 index 00000000..631f836c --- /dev/null +++ b/internal/integration_tests/mysql8/defaultsettings/RealRef.go @@ -0,0 +1,9 @@ +package dto + +import ( + "database/sql" +) + +type RealRef struct { + RealRef sql.NullFloat64 `db:"real_ref"` +} diff --git a/internal/integration_tests/mysql8/defaultsettings/RealTable.go b/internal/integration_tests/mysql8/defaultsettings/RealTable.go new file mode 100644 index 00000000..4fb87abc --- /dev/null +++ b/internal/integration_tests/mysql8/defaultsettings/RealTable.go @@ -0,0 +1,31 @@ +package dto + +import ( + "database/sql" +) + +type RealTable struct { + Col sql.NullFloat64 `db:"col"` + RealNn float64 `db:"real_nn"` + RealNnUnique float64 `db:"real_nn_unique"` + RealNnCheck float64 `db:"real_nn_check"` + RealNnRef float64 `db:"real_nn_ref"` + RealNnDefConst float64 `db:"real_nn_def_const"` + RealNnDefFunc float64 `db:"real_nn_def_func"` + RealNnUniqueCheck float64 `db:"real_nn_unique_check"` + RealUnique sql.NullFloat64 `db:"real_unique"` + RealUniqueCheck sql.NullFloat64 `db:"real_unique_check"` + RealUniqueRef sql.NullFloat64 `db:"real_unique_ref"` + RealUniqueDefConst sql.NullFloat64 `db:"real_unique_def_const"` + RealUniqueDefFunc sql.NullFloat64 `db:"real_unique_def_func"` + RealCheck sql.NullFloat64 `db:"real_check"` + RealCheckRef sql.NullFloat64 `db:"real_check_ref"` + RealCheckDefConst sql.NullFloat64 `db:"real_check_def_const"` + RealCheckDefFunc sql.NullFloat64 `db:"real_check_def_func"` + RealRef sql.NullFloat64 `db:"real_ref"` + RealRefUniqueCheck sql.NullFloat64 `db:"real_ref_unique_check"` + RealDefConst sql.NullFloat64 `db:"real_def_const"` + RealDefConstUniqueCheck sql.NullFloat64 `db:"real_def_const_unique_check"` + RealDefFunc sql.NullFloat64 `db:"real_def_func"` + RealDefFuncUniqueCheck sql.NullFloat64 `db:"real_def_func_unique_check"` +} diff --git a/internal/integration_tests/mysql8/defaultsettings/RealUniqueCheckPk.go b/internal/integration_tests/mysql8/defaultsettings/RealUniqueCheckPk.go new file mode 100644 index 00000000..68483d8a --- /dev/null +++ b/internal/integration_tests/mysql8/defaultsettings/RealUniqueCheckPk.go @@ -0,0 +1,5 @@ +package dto + +type RealUniqueCheckPk struct { + RealUniqueCheckPk float64 `db:"real_unique_check_pk"` +} diff --git a/internal/integration_tests/mysql8/defaultsettings/RealUniqueCheckPkRef.go b/internal/integration_tests/mysql8/defaultsettings/RealUniqueCheckPkRef.go new file mode 100644 index 00000000..bc4b0d90 --- /dev/null +++ b/internal/integration_tests/mysql8/defaultsettings/RealUniqueCheckPkRef.go @@ -0,0 +1,5 @@ +package dto + +type RealUniqueCheckPkRef struct { + RealUniqueCheckPkRef float64 `db:"real_unique_check_pk_ref"` +} diff --git a/internal/integration_tests/mysql8/defaultsettings/RealUniquePk.go b/internal/integration_tests/mysql8/defaultsettings/RealUniquePk.go new file mode 100644 index 00000000..8d22f752 --- /dev/null +++ b/internal/integration_tests/mysql8/defaultsettings/RealUniquePk.go @@ -0,0 +1,5 @@ +package dto + +type RealUniquePk struct { + RealUniquePk float64 `db:"real_unique_pk"` +} diff --git a/internal/integration_tests/mysql8/defaultsettings/SmallintCheckPk.go b/internal/integration_tests/mysql8/defaultsettings/SmallintCheckPk.go new file mode 100644 index 00000000..b751015a --- /dev/null +++ b/internal/integration_tests/mysql8/defaultsettings/SmallintCheckPk.go @@ -0,0 +1,5 @@ +package dto + +type SmallintCheckPk struct { + SmallintCheckPk int `db:"smallint_check_pk"` +} diff --git a/internal/integration_tests/mysql8/defaultsettings/SmallintDefConstUniqueCheckPk.go b/internal/integration_tests/mysql8/defaultsettings/SmallintDefConstUniqueCheckPk.go new file mode 100644 index 00000000..e2e17b6f --- /dev/null +++ b/internal/integration_tests/mysql8/defaultsettings/SmallintDefConstUniqueCheckPk.go @@ -0,0 +1,5 @@ +package dto + +type SmallintDefConstUniqueCheckPk struct { + SmallintDefConstUniqueCheckPk int `db:"smallint_def_const_unique_check_pk"` +} diff --git a/internal/integration_tests/mysql8/defaultsettings/SmallintDefConstUniqueCheckPkRef.go b/internal/integration_tests/mysql8/defaultsettings/SmallintDefConstUniqueCheckPkRef.go new file mode 100644 index 00000000..827d36f7 --- /dev/null +++ b/internal/integration_tests/mysql8/defaultsettings/SmallintDefConstUniqueCheckPkRef.go @@ -0,0 +1,5 @@ +package dto + +type SmallintDefConstUniqueCheckPkRef struct { + SmallintDefConstUniqueCheckPkRef int `db:"smallint_def_const_unique_check_pk_ref"` +} diff --git a/internal/integration_tests/mysql8/defaultsettings/SmallintDefFuncUniqueCheckPk.go b/internal/integration_tests/mysql8/defaultsettings/SmallintDefFuncUniqueCheckPk.go new file mode 100644 index 00000000..ab2612af --- /dev/null +++ b/internal/integration_tests/mysql8/defaultsettings/SmallintDefFuncUniqueCheckPk.go @@ -0,0 +1,5 @@ +package dto + +type SmallintDefFuncUniqueCheckPk struct { + SmallintDefFuncUniqueCheckPk int `db:"smallint_def_func_unique_check_pk"` +} diff --git a/internal/integration_tests/mysql8/defaultsettings/SmallintDefFuncUniqueCheckPkRef.go b/internal/integration_tests/mysql8/defaultsettings/SmallintDefFuncUniqueCheckPkRef.go new file mode 100644 index 00000000..3aef8dba --- /dev/null +++ b/internal/integration_tests/mysql8/defaultsettings/SmallintDefFuncUniqueCheckPkRef.go @@ -0,0 +1,5 @@ +package dto + +type SmallintDefFuncUniqueCheckPkRef struct { + SmallintDefFuncUniqueCheckPkRef int `db:"smallint_def_func_unique_check_pk_ref"` +} diff --git a/internal/integration_tests/mysql8/defaultsettings/SmallintNnPk.go b/internal/integration_tests/mysql8/defaultsettings/SmallintNnPk.go new file mode 100644 index 00000000..e860d504 --- /dev/null +++ b/internal/integration_tests/mysql8/defaultsettings/SmallintNnPk.go @@ -0,0 +1,5 @@ +package dto + +type SmallintNnPk struct { + SmallintNnPk int `db:"smallint_nn_pk"` +} diff --git a/internal/integration_tests/mysql8/defaultsettings/SmallintNnUniqueCheckPk.go b/internal/integration_tests/mysql8/defaultsettings/SmallintNnUniqueCheckPk.go new file mode 100644 index 00000000..09158e0c --- /dev/null +++ b/internal/integration_tests/mysql8/defaultsettings/SmallintNnUniqueCheckPk.go @@ -0,0 +1,5 @@ +package dto + +type SmallintNnUniqueCheckPk struct { + SmallintNnUniqueCheckPk int `db:"smallint_nn_unique_check_pk"` +} diff --git a/internal/integration_tests/mysql8/defaultsettings/SmallintNnUniqueCheckPkRef.go b/internal/integration_tests/mysql8/defaultsettings/SmallintNnUniqueCheckPkRef.go new file mode 100644 index 00000000..29099ecd --- /dev/null +++ b/internal/integration_tests/mysql8/defaultsettings/SmallintNnUniqueCheckPkRef.go @@ -0,0 +1,5 @@ +package dto + +type SmallintNnUniqueCheckPkRef struct { + SmallintNnUniqueCheckPkRef int `db:"smallint_nn_unique_check_pk_ref"` +} diff --git a/internal/integration_tests/mysql8/defaultsettings/SmallintPk.go b/internal/integration_tests/mysql8/defaultsettings/SmallintPk.go new file mode 100644 index 00000000..7e31ea21 --- /dev/null +++ b/internal/integration_tests/mysql8/defaultsettings/SmallintPk.go @@ -0,0 +1,5 @@ +package dto + +type SmallintPk struct { + SmallintPk int `db:"smallint_pk"` +} diff --git a/internal/integration_tests/mysql8/defaultsettings/SmallintPkDefConst.go b/internal/integration_tests/mysql8/defaultsettings/SmallintPkDefConst.go new file mode 100644 index 00000000..6674cb63 --- /dev/null +++ b/internal/integration_tests/mysql8/defaultsettings/SmallintPkDefConst.go @@ -0,0 +1,5 @@ +package dto + +type SmallintPkDefConst struct { + SmallintPkDefConst int `db:"smallint_pk_def_const"` +} diff --git a/internal/integration_tests/mysql8/defaultsettings/SmallintPkDefFunc.go b/internal/integration_tests/mysql8/defaultsettings/SmallintPkDefFunc.go new file mode 100644 index 00000000..3951e6bf --- /dev/null +++ b/internal/integration_tests/mysql8/defaultsettings/SmallintPkDefFunc.go @@ -0,0 +1,5 @@ +package dto + +type SmallintPkDefFunc struct { + SmallintPkDefFunc int `db:"smallint_pk_def_func"` +} diff --git a/internal/integration_tests/mysql8/defaultsettings/SmallintPkRef.go b/internal/integration_tests/mysql8/defaultsettings/SmallintPkRef.go new file mode 100644 index 00000000..fc0176ef --- /dev/null +++ b/internal/integration_tests/mysql8/defaultsettings/SmallintPkRef.go @@ -0,0 +1,5 @@ +package dto + +type SmallintPkRef struct { + SmallintPkRef int `db:"smallint_pk_ref"` +} diff --git a/internal/integration_tests/mysql8/defaultsettings/SmallintRef.go b/internal/integration_tests/mysql8/defaultsettings/SmallintRef.go new file mode 100644 index 00000000..c2924ae4 --- /dev/null +++ b/internal/integration_tests/mysql8/defaultsettings/SmallintRef.go @@ -0,0 +1,9 @@ +package dto + +import ( + "database/sql" +) + +type SmallintRef struct { + SmallintRef sql.NullInt64 `db:"smallint_ref"` +} diff --git a/internal/integration_tests/mysql8/defaultsettings/SmallintTable.go b/internal/integration_tests/mysql8/defaultsettings/SmallintTable.go new file mode 100644 index 00000000..13b78883 --- /dev/null +++ b/internal/integration_tests/mysql8/defaultsettings/SmallintTable.go @@ -0,0 +1,27 @@ +package dto + +import ( + "database/sql" +) + +type SmallintTable struct { + I sql.NullInt64 `db:"i"` + SmallintNn int `db:"smallint_nn"` + SmallintNnUnique int `db:"smallint_nn_unique"` + SmallintNnCheck int `db:"smallint_nn_check"` + SmallintUnique sql.NullInt64 `db:"smallint_unique"` + SmallintUniqueCheck sql.NullInt64 `db:"smallint_unique_check"` + SmallintUniqueRef sql.NullInt64 `db:"smallint_unique_ref"` + SmallintUniqueDefConst sql.NullInt64 `db:"smallint_unique_def_const"` + SmallintUniqueDefFunc sql.NullInt64 `db:"smallint_unique_def_func"` + SmallintCheck sql.NullInt64 `db:"smallint_check"` + SmallintCheckRef sql.NullInt64 `db:"smallint_check_ref"` + SmallintCheckDefConst sql.NullInt64 `db:"smallint_check_def_const"` + SmallintCheckDefFunc sql.NullInt64 `db:"smallint_check_def_func"` + SmallintRef sql.NullInt64 `db:"smallint_ref"` + SmallintRefUniqueCheck sql.NullInt64 `db:"smallint_ref_unique_check"` + SmallintDefConst sql.NullInt64 `db:"smallint_def_const"` + SmallintDefConstUniqueCheck sql.NullInt64 `db:"smallint_def_const_unique_check"` + SmallintDefFunc sql.NullInt64 `db:"smallint_def_func"` + SmallintDefFuncUniqueCheck sql.NullInt64 `db:"smallint_def_func_unique_check"` +} diff --git a/internal/integration_tests/mysql8/defaultsettings/SmallintUniqueCheckPk.go b/internal/integration_tests/mysql8/defaultsettings/SmallintUniqueCheckPk.go new file mode 100644 index 00000000..3cf7cccc --- /dev/null +++ b/internal/integration_tests/mysql8/defaultsettings/SmallintUniqueCheckPk.go @@ -0,0 +1,5 @@ +package dto + +type SmallintUniqueCheckPk struct { + SmallintUniqueCheckPk int `db:"smallint_unique_check_pk"` +} diff --git a/internal/integration_tests/mysql8/defaultsettings/SmallintUniqueCheckPkRef.go b/internal/integration_tests/mysql8/defaultsettings/SmallintUniqueCheckPkRef.go new file mode 100644 index 00000000..2dc8bfd8 --- /dev/null +++ b/internal/integration_tests/mysql8/defaultsettings/SmallintUniqueCheckPkRef.go @@ -0,0 +1,5 @@ +package dto + +type SmallintUniqueCheckPkRef struct { + SmallintUniqueCheckPkRef int `db:"smallint_unique_check_pk_ref"` +} diff --git a/internal/integration_tests/mysql8/defaultsettings/SmallintUniquePk.go b/internal/integration_tests/mysql8/defaultsettings/SmallintUniquePk.go new file mode 100644 index 00000000..1814500f --- /dev/null +++ b/internal/integration_tests/mysql8/defaultsettings/SmallintUniquePk.go @@ -0,0 +1,5 @@ +package dto + +type SmallintUniquePk struct { + SmallintUniquePk int `db:"smallint_unique_pk"` +} diff --git a/internal/integration_tests/mysql8/defaultsettings/TextRef.go b/internal/integration_tests/mysql8/defaultsettings/TextRef.go new file mode 100644 index 00000000..115deada --- /dev/null +++ b/internal/integration_tests/mysql8/defaultsettings/TextRef.go @@ -0,0 +1,5 @@ +package dto + +type TextRef struct { + TextRef string `db:"text_ref"` +} diff --git a/internal/integration_tests/mysql8/defaultsettings/TextTable.go b/internal/integration_tests/mysql8/defaultsettings/TextTable.go new file mode 100644 index 00000000..30abb518 --- /dev/null +++ b/internal/integration_tests/mysql8/defaultsettings/TextTable.go @@ -0,0 +1,22 @@ +package dto + +import ( + "database/sql" +) + +type TextTable struct { + Col sql.NullString `db:"col"` + TextDefConst sql.NullString `db:"text_def_const"` + TextDefFunc sql.NullString `db:"text_def_func"` + TextRef sql.NullString `db:"text_ref"` + TextNn string `db:"text_nn"` + TextNnCheckCmp string `db:"text_nn_check_cmp"` + TextNnCheckFn string `db:"text_nn_check_fn"` + TextNnRef string `db:"text_nn_ref"` + TextNnDefConst string `db:"text_nn_def_const"` + TextNnDefFunc string `db:"text_nn_def_func"` + TextCheck sql.NullString `db:"text_check"` + TextCheckRef sql.NullString `db:"text_check_ref"` + TextCheckDefConst sql.NullString `db:"text_check_def_const"` + TextCheckDefFunc sql.NullString `db:"text_check_def_func"` +} diff --git a/internal/integration_tests/mysql8/defaultsettings/TimeCheckPk.go b/internal/integration_tests/mysql8/defaultsettings/TimeCheckPk.go new file mode 100644 index 00000000..8ac4498b --- /dev/null +++ b/internal/integration_tests/mysql8/defaultsettings/TimeCheckPk.go @@ -0,0 +1,9 @@ +package dto + +import ( + "time" +) + +type TimeCheckPk struct { + TimeCheckPk time.Time `db:"time_check_pk"` +} diff --git a/internal/integration_tests/mysql8/defaultsettings/TimeDefConstUniqueCheckPk.go b/internal/integration_tests/mysql8/defaultsettings/TimeDefConstUniqueCheckPk.go new file mode 100644 index 00000000..f9d70c06 --- /dev/null +++ b/internal/integration_tests/mysql8/defaultsettings/TimeDefConstUniqueCheckPk.go @@ -0,0 +1,9 @@ +package dto + +import ( + "time" +) + +type TimeDefConstUniqueCheckPk struct { + TimeDefConstUniqueCheckPk time.Time `db:"time_def_const_unique_check_pk"` +} diff --git a/internal/integration_tests/mysql8/defaultsettings/TimeDefConstUniqueCheckPkRef.go b/internal/integration_tests/mysql8/defaultsettings/TimeDefConstUniqueCheckPkRef.go new file mode 100644 index 00000000..227c15c5 --- /dev/null +++ b/internal/integration_tests/mysql8/defaultsettings/TimeDefConstUniqueCheckPkRef.go @@ -0,0 +1,9 @@ +package dto + +import ( + "time" +) + +type TimeDefConstUniqueCheckPkRef struct { + TimeDefConstUniqueCheckPkRef time.Time `db:"time_def_const_unique_check_pk_ref"` +} diff --git a/internal/integration_tests/mysql8/defaultsettings/TimeDefFuncUniqueCheckPk.go b/internal/integration_tests/mysql8/defaultsettings/TimeDefFuncUniqueCheckPk.go new file mode 100644 index 00000000..5058c3c9 --- /dev/null +++ b/internal/integration_tests/mysql8/defaultsettings/TimeDefFuncUniqueCheckPk.go @@ -0,0 +1,9 @@ +package dto + +import ( + "time" +) + +type TimeDefFuncUniqueCheckPk struct { + TimeDefFuncUniqueCheckPk time.Time `db:"time_def_func_unique_check_pk"` +} diff --git a/internal/integration_tests/mysql8/defaultsettings/TimeDefFuncUniqueCheckPkRef.go b/internal/integration_tests/mysql8/defaultsettings/TimeDefFuncUniqueCheckPkRef.go new file mode 100644 index 00000000..c07b24c2 --- /dev/null +++ b/internal/integration_tests/mysql8/defaultsettings/TimeDefFuncUniqueCheckPkRef.go @@ -0,0 +1,9 @@ +package dto + +import ( + "time" +) + +type TimeDefFuncUniqueCheckPkRef struct { + TimeDefFuncUniqueCheckPkRef time.Time `db:"time_def_func_unique_check_pk_ref"` +} diff --git a/internal/integration_tests/mysql8/defaultsettings/TimeNnPk.go b/internal/integration_tests/mysql8/defaultsettings/TimeNnPk.go new file mode 100644 index 00000000..9b53ef52 --- /dev/null +++ b/internal/integration_tests/mysql8/defaultsettings/TimeNnPk.go @@ -0,0 +1,9 @@ +package dto + +import ( + "time" +) + +type TimeNnPk struct { + TimeNnPk time.Time `db:"time_nn_pk"` +} diff --git a/internal/integration_tests/mysql8/defaultsettings/TimeNnUniqueCheckPk.go b/internal/integration_tests/mysql8/defaultsettings/TimeNnUniqueCheckPk.go new file mode 100644 index 00000000..ab75df92 --- /dev/null +++ b/internal/integration_tests/mysql8/defaultsettings/TimeNnUniqueCheckPk.go @@ -0,0 +1,9 @@ +package dto + +import ( + "time" +) + +type TimeNnUniqueCheckPk struct { + TimeNnUniqueCheckPk time.Time `db:"time_nn_unique_check_pk"` +} diff --git a/internal/integration_tests/mysql8/defaultsettings/TimeNnUniqueCheckPkRef.go b/internal/integration_tests/mysql8/defaultsettings/TimeNnUniqueCheckPkRef.go new file mode 100644 index 00000000..37926bf8 --- /dev/null +++ b/internal/integration_tests/mysql8/defaultsettings/TimeNnUniqueCheckPkRef.go @@ -0,0 +1,9 @@ +package dto + +import ( + "time" +) + +type TimeNnUniqueCheckPkRef struct { + TimeNnUniqueCheckPkRef time.Time `db:"time_nn_unique_check_pk_ref"` +} diff --git a/internal/integration_tests/mysql8/defaultsettings/TimePk.go b/internal/integration_tests/mysql8/defaultsettings/TimePk.go new file mode 100644 index 00000000..4cb08dc4 --- /dev/null +++ b/internal/integration_tests/mysql8/defaultsettings/TimePk.go @@ -0,0 +1,9 @@ +package dto + +import ( + "time" +) + +type TimePk struct { + TimePk time.Time `db:"time_pk"` +} diff --git a/internal/integration_tests/mysql8/defaultsettings/TimePkDefConst.go b/internal/integration_tests/mysql8/defaultsettings/TimePkDefConst.go new file mode 100644 index 00000000..7f119e6f --- /dev/null +++ b/internal/integration_tests/mysql8/defaultsettings/TimePkDefConst.go @@ -0,0 +1,9 @@ +package dto + +import ( + "time" +) + +type TimePkDefConst struct { + TimePkDefConst time.Time `db:"time_pk_def_const"` +} diff --git a/internal/integration_tests/mysql8/defaultsettings/TimePkDefFunc.go b/internal/integration_tests/mysql8/defaultsettings/TimePkDefFunc.go new file mode 100644 index 00000000..6b5c04c3 --- /dev/null +++ b/internal/integration_tests/mysql8/defaultsettings/TimePkDefFunc.go @@ -0,0 +1,9 @@ +package dto + +import ( + "time" +) + +type TimePkDefFunc struct { + TimePkDefFunc time.Time `db:"time_pk_def_func"` +} diff --git a/internal/integration_tests/mysql8/defaultsettings/TimePkRef.go b/internal/integration_tests/mysql8/defaultsettings/TimePkRef.go new file mode 100644 index 00000000..f2f24a81 --- /dev/null +++ b/internal/integration_tests/mysql8/defaultsettings/TimePkRef.go @@ -0,0 +1,9 @@ +package dto + +import ( + "time" +) + +type TimePkRef struct { + TimePkRef time.Time `db:"time_pk_ref"` +} diff --git a/internal/integration_tests/mysql8/defaultsettings/TimeRef.go b/internal/integration_tests/mysql8/defaultsettings/TimeRef.go new file mode 100644 index 00000000..d31ee043 --- /dev/null +++ b/internal/integration_tests/mysql8/defaultsettings/TimeRef.go @@ -0,0 +1,9 @@ +package dto + +import ( + "database/sql" +) + +type TimeRef struct { + TimeRef sql.NullTime `db:"time_ref"` +} diff --git a/internal/integration_tests/mysql8/defaultsettings/TimeTable.go b/internal/integration_tests/mysql8/defaultsettings/TimeTable.go new file mode 100644 index 00000000..7dcbb08e --- /dev/null +++ b/internal/integration_tests/mysql8/defaultsettings/TimeTable.go @@ -0,0 +1,32 @@ +package dto + +import ( + "database/sql" + "time" +) + +type TimeTable struct { + Time sql.NullTime `db:"time"` + TimeNn time.Time `db:"time_nn"` + TimeNnUnique time.Time `db:"time_nn_unique"` + TimeNnCheck time.Time `db:"time_nn_check"` + TimeNnRef time.Time `db:"time_nn_ref"` + TimeNnDefConst time.Time `db:"time_nn_def_const"` + TimeNnDefFunc time.Time `db:"time_nn_def_func"` + TimeNnUniqueCheck time.Time `db:"time_nn_unique_check"` + TimeUnique sql.NullTime `db:"time_unique"` + TimeUniqueCheck sql.NullTime `db:"time_unique_check"` + TimeUniqueRef sql.NullTime `db:"time_unique_ref"` + TimeUniqueDefConst sql.NullTime `db:"time_unique_def_const"` + TimeUniqueDefFunc sql.NullTime `db:"time_unique_def_func"` + TimeCheck sql.NullTime `db:"time_check"` + TimeCheckRef sql.NullTime `db:"time_check_ref"` + TimeCheckDefConst sql.NullTime `db:"time_check_def_const"` + TimeCheckDefFunc sql.NullTime `db:"time_check_def_func"` + TimeRef sql.NullTime `db:"time_ref"` + TimeRefUniqueCheck sql.NullTime `db:"time_ref_unique_check"` + TimeDefConst sql.NullTime `db:"time_def_const"` + TimeDefConstUniqueCheck sql.NullTime `db:"time_def_const_unique_check"` + TimeDefFunc sql.NullTime `db:"time_def_func"` + TimeDefFuncUniqueCheck sql.NullTime `db:"time_def_func_unique_check"` +} diff --git a/internal/integration_tests/mysql8/defaultsettings/TimeUniqueCheckPk.go b/internal/integration_tests/mysql8/defaultsettings/TimeUniqueCheckPk.go new file mode 100644 index 00000000..24140cb6 --- /dev/null +++ b/internal/integration_tests/mysql8/defaultsettings/TimeUniqueCheckPk.go @@ -0,0 +1,9 @@ +package dto + +import ( + "time" +) + +type TimeUniqueCheckPk struct { + TimeUniqueCheckPk time.Time `db:"time_unique_check_pk"` +} diff --git a/internal/integration_tests/mysql8/defaultsettings/TimeUniqueCheckPkRef.go b/internal/integration_tests/mysql8/defaultsettings/TimeUniqueCheckPkRef.go new file mode 100644 index 00000000..4772a2c9 --- /dev/null +++ b/internal/integration_tests/mysql8/defaultsettings/TimeUniqueCheckPkRef.go @@ -0,0 +1,9 @@ +package dto + +import ( + "time" +) + +type TimeUniqueCheckPkRef struct { + TimeUniqueCheckPkRef time.Time `db:"time_unique_check_pk_ref"` +} diff --git a/internal/integration_tests/mysql8/defaultsettings/TimeUniquePk.go b/internal/integration_tests/mysql8/defaultsettings/TimeUniquePk.go new file mode 100644 index 00000000..4a5a293b --- /dev/null +++ b/internal/integration_tests/mysql8/defaultsettings/TimeUniquePk.go @@ -0,0 +1,9 @@ +package dto + +import ( + "time" +) + +type TimeUniquePk struct { + TimeUniquePk time.Time `db:"time_unique_pk"` +} diff --git a/internal/integration_tests/mysql8/defaultsettings/TimestampCheckPk.go b/internal/integration_tests/mysql8/defaultsettings/TimestampCheckPk.go new file mode 100644 index 00000000..11d9aac0 --- /dev/null +++ b/internal/integration_tests/mysql8/defaultsettings/TimestampCheckPk.go @@ -0,0 +1,9 @@ +package dto + +import ( + "time" +) + +type TimestampCheckPk struct { + TimestampCheckPk time.Time `db:"timestamp_check_pk"` +} diff --git a/internal/integration_tests/mysql8/defaultsettings/TimestampDefConstUniqueCheckPk.go b/internal/integration_tests/mysql8/defaultsettings/TimestampDefConstUniqueCheckPk.go new file mode 100644 index 00000000..76291a17 --- /dev/null +++ b/internal/integration_tests/mysql8/defaultsettings/TimestampDefConstUniqueCheckPk.go @@ -0,0 +1,9 @@ +package dto + +import ( + "time" +) + +type TimestampDefConstUniqueCheckPk struct { + TimestampDefConstUniqueCheckPk time.Time `db:"timestamp_def_const_unique_check_pk"` +} diff --git a/internal/integration_tests/mysql8/defaultsettings/TimestampDefConstUniqueCheckPkRef.go b/internal/integration_tests/mysql8/defaultsettings/TimestampDefConstUniqueCheckPkRef.go new file mode 100644 index 00000000..b5bd7f6d --- /dev/null +++ b/internal/integration_tests/mysql8/defaultsettings/TimestampDefConstUniqueCheckPkRef.go @@ -0,0 +1,9 @@ +package dto + +import ( + "time" +) + +type TimestampDefConstUniqueCheckPkRef struct { + TimestampDefConstUniqueCheckPkRef time.Time `db:"timestamp_def_const_unique_check_pk_ref"` +} diff --git a/internal/integration_tests/mysql8/defaultsettings/TimestampDefFuncUniqueCheckPk.go b/internal/integration_tests/mysql8/defaultsettings/TimestampDefFuncUniqueCheckPk.go new file mode 100644 index 00000000..07987edb --- /dev/null +++ b/internal/integration_tests/mysql8/defaultsettings/TimestampDefFuncUniqueCheckPk.go @@ -0,0 +1,9 @@ +package dto + +import ( + "time" +) + +type TimestampDefFuncUniqueCheckPk struct { + TimestampDefFuncUniqueCheckPk time.Time `db:"timestamp_def_func_unique_check_pk"` +} diff --git a/internal/integration_tests/mysql8/defaultsettings/TimestampDefFuncUniqueCheckPkRef.go b/internal/integration_tests/mysql8/defaultsettings/TimestampDefFuncUniqueCheckPkRef.go new file mode 100644 index 00000000..db425463 --- /dev/null +++ b/internal/integration_tests/mysql8/defaultsettings/TimestampDefFuncUniqueCheckPkRef.go @@ -0,0 +1,9 @@ +package dto + +import ( + "time" +) + +type TimestampDefFuncUniqueCheckPkRef struct { + TimestampDefFuncUniqueCheckPkRef time.Time `db:"timestamp_def_func_unique_check_pk_ref"` +} diff --git a/internal/integration_tests/mysql8/defaultsettings/TimestampNnPk.go b/internal/integration_tests/mysql8/defaultsettings/TimestampNnPk.go new file mode 100644 index 00000000..24d62061 --- /dev/null +++ b/internal/integration_tests/mysql8/defaultsettings/TimestampNnPk.go @@ -0,0 +1,9 @@ +package dto + +import ( + "time" +) + +type TimestampNnPk struct { + TimestampNnPk time.Time `db:"timestamp_nn_pk"` +} diff --git a/internal/integration_tests/mysql8/defaultsettings/TimestampNnUniqueCheckPk.go b/internal/integration_tests/mysql8/defaultsettings/TimestampNnUniqueCheckPk.go new file mode 100644 index 00000000..21ae8031 --- /dev/null +++ b/internal/integration_tests/mysql8/defaultsettings/TimestampNnUniqueCheckPk.go @@ -0,0 +1,9 @@ +package dto + +import ( + "time" +) + +type TimestampNnUniqueCheckPk struct { + TimestampNnUniqueCheckPk time.Time `db:"timestamp_nn_unique_check_pk"` +} diff --git a/internal/integration_tests/mysql8/defaultsettings/TimestampNnUniqueCheckPkRef.go b/internal/integration_tests/mysql8/defaultsettings/TimestampNnUniqueCheckPkRef.go new file mode 100644 index 00000000..1c20c377 --- /dev/null +++ b/internal/integration_tests/mysql8/defaultsettings/TimestampNnUniqueCheckPkRef.go @@ -0,0 +1,9 @@ +package dto + +import ( + "time" +) + +type TimestampNnUniqueCheckPkRef struct { + TimestampNnUniqueCheckPkRef time.Time `db:"timestamp_nn_unique_check_pk_ref"` +} diff --git a/internal/integration_tests/mysql8/defaultsettings/TimestampPk.go b/internal/integration_tests/mysql8/defaultsettings/TimestampPk.go new file mode 100644 index 00000000..5c10b8d9 --- /dev/null +++ b/internal/integration_tests/mysql8/defaultsettings/TimestampPk.go @@ -0,0 +1,9 @@ +package dto + +import ( + "time" +) + +type TimestampPk struct { + TimestampPk time.Time `db:"timestamp_pk"` +} diff --git a/internal/integration_tests/mysql8/defaultsettings/TimestampPkDefConst.go b/internal/integration_tests/mysql8/defaultsettings/TimestampPkDefConst.go new file mode 100644 index 00000000..1aae107b --- /dev/null +++ b/internal/integration_tests/mysql8/defaultsettings/TimestampPkDefConst.go @@ -0,0 +1,9 @@ +package dto + +import ( + "time" +) + +type TimestampPkDefConst struct { + TimestampPkDefConst time.Time `db:"timestamp_pk_def_const"` +} diff --git a/internal/integration_tests/mysql8/defaultsettings/TimestampPkDefFunc.go b/internal/integration_tests/mysql8/defaultsettings/TimestampPkDefFunc.go new file mode 100644 index 00000000..2e17c253 --- /dev/null +++ b/internal/integration_tests/mysql8/defaultsettings/TimestampPkDefFunc.go @@ -0,0 +1,9 @@ +package dto + +import ( + "time" +) + +type TimestampPkDefFunc struct { + TimestampPkDefFunc time.Time `db:"timestamp_pk_def_func"` +} diff --git a/internal/integration_tests/mysql8/defaultsettings/TimestampPkRef.go b/internal/integration_tests/mysql8/defaultsettings/TimestampPkRef.go new file mode 100644 index 00000000..c36c99c4 --- /dev/null +++ b/internal/integration_tests/mysql8/defaultsettings/TimestampPkRef.go @@ -0,0 +1,9 @@ +package dto + +import ( + "time" +) + +type TimestampPkRef struct { + TimestampPkRef time.Time `db:"timestamp_pk_ref"` +} diff --git a/internal/integration_tests/mysql8/defaultsettings/TimestampRef.go b/internal/integration_tests/mysql8/defaultsettings/TimestampRef.go new file mode 100644 index 00000000..b423232b --- /dev/null +++ b/internal/integration_tests/mysql8/defaultsettings/TimestampRef.go @@ -0,0 +1,9 @@ +package dto + +import ( + "database/sql" +) + +type TimestampRef struct { + TimestampRef sql.NullTime `db:"timestamp_ref"` +} diff --git a/internal/integration_tests/mysql8/defaultsettings/TimestampTable.go b/internal/integration_tests/mysql8/defaultsettings/TimestampTable.go new file mode 100644 index 00000000..0ee72399 --- /dev/null +++ b/internal/integration_tests/mysql8/defaultsettings/TimestampTable.go @@ -0,0 +1,32 @@ +package dto + +import ( + "database/sql" + "time" +) + +type TimestampTable struct { + Timestamp sql.NullTime `db:"timestamp"` + TimestampNn time.Time `db:"timestamp_nn"` + TimestampNnUnique time.Time `db:"timestamp_nn_unique"` + TimestampNnCheck time.Time `db:"timestamp_nn_check"` + TimestampNnRef time.Time `db:"timestamp_nn_ref"` + TimestampNnDefConst time.Time `db:"timestamp_nn_def_const"` + TimestampNnDefFunc time.Time `db:"timestamp_nn_def_func"` + TimestampNnUniqueCheck time.Time `db:"timestamp_nn_unique_check"` + TimestampUnique sql.NullTime `db:"timestamp_unique"` + TimestampUniqueCheck sql.NullTime `db:"timestamp_unique_check"` + TimestampUniqueRef sql.NullTime `db:"timestamp_unique_ref"` + TimestampUniqueDefConst sql.NullTime `db:"timestamp_unique_def_const"` + TimestampUniqueDefFunc sql.NullTime `db:"timestamp_unique_def_func"` + TimestampCheck sql.NullTime `db:"timestamp_check"` + TimestampCheckRef sql.NullTime `db:"timestamp_check_ref"` + TimestampCheckDefConst sql.NullTime `db:"timestamp_check_def_const"` + TimestampCheckDefFunc sql.NullTime `db:"timestamp_check_def_func"` + TimestampRef sql.NullTime `db:"timestamp_ref"` + TimestampRefUniqueCheck sql.NullTime `db:"timestamp_ref_unique_check"` + TimestampDefConst sql.NullTime `db:"timestamp_def_const"` + TimestampDefConstUniqueCheck sql.NullTime `db:"timestamp_def_const_unique_check"` + TimestampDefFunc sql.NullTime `db:"timestamp_def_func"` + TimestampDefFuncUniqueCheck sql.NullTime `db:"timestamp_def_func_unique_check"` +} diff --git a/internal/integration_tests/mysql8/defaultsettings/TimestampUniqueCheckPk.go b/internal/integration_tests/mysql8/defaultsettings/TimestampUniqueCheckPk.go new file mode 100644 index 00000000..af5f08ff --- /dev/null +++ b/internal/integration_tests/mysql8/defaultsettings/TimestampUniqueCheckPk.go @@ -0,0 +1,9 @@ +package dto + +import ( + "time" +) + +type TimestampUniqueCheckPk struct { + TimestampUniqueCheckPk time.Time `db:"timestamp_unique_check_pk"` +} diff --git a/internal/integration_tests/mysql8/defaultsettings/TimestampUniqueCheckPkRef.go b/internal/integration_tests/mysql8/defaultsettings/TimestampUniqueCheckPkRef.go new file mode 100644 index 00000000..a3880c53 --- /dev/null +++ b/internal/integration_tests/mysql8/defaultsettings/TimestampUniqueCheckPkRef.go @@ -0,0 +1,9 @@ +package dto + +import ( + "time" +) + +type TimestampUniqueCheckPkRef struct { + TimestampUniqueCheckPkRef time.Time `db:"timestamp_unique_check_pk_ref"` +} diff --git a/internal/integration_tests/mysql8/defaultsettings/TimestampUniquePk.go b/internal/integration_tests/mysql8/defaultsettings/TimestampUniquePk.go new file mode 100644 index 00000000..6ef3e9ee --- /dev/null +++ b/internal/integration_tests/mysql8/defaultsettings/TimestampUniquePk.go @@ -0,0 +1,9 @@ +package dto + +import ( + "time" +) + +type TimestampUniquePk struct { + TimestampUniquePk time.Time `db:"timestamp_unique_pk"` +} diff --git a/internal/integration_tests/mysql8/defaultsettings/TinyblobRef.go b/internal/integration_tests/mysql8/defaultsettings/TinyblobRef.go new file mode 100644 index 00000000..4bf6bb24 --- /dev/null +++ b/internal/integration_tests/mysql8/defaultsettings/TinyblobRef.go @@ -0,0 +1,5 @@ +package dto + +type TinyblobRef struct { + TinyblobRef string `db:"tinyblob_ref"` +} diff --git a/internal/integration_tests/mysql8/defaultsettings/TinyblobTable.go b/internal/integration_tests/mysql8/defaultsettings/TinyblobTable.go new file mode 100644 index 00000000..5a5bcba9 --- /dev/null +++ b/internal/integration_tests/mysql8/defaultsettings/TinyblobTable.go @@ -0,0 +1,22 @@ +package dto + +import ( + "database/sql" +) + +type TinyblobTable struct { + Col sql.NullString `db:"col"` + TinyblobDefConst sql.NullString `db:"tinyblob_def_const"` + TinyblobDefFunc sql.NullString `db:"tinyblob_def_func"` + TinyblobRef sql.NullString `db:"tinyblob_ref"` + TinyblobNn string `db:"tinyblob_nn"` + TinyblobNnCheckCmp string `db:"tinyblob_nn_check_cmp"` + TinyblobNnCheckFn string `db:"tinyblob_nn_check_fn"` + TinyblobNnRef string `db:"tinyblob_nn_ref"` + TinyblobNnDefConst string `db:"tinyblob_nn_def_const"` + TinyblobNnDefFunc string `db:"tinyblob_nn_def_func"` + TinyblobCheck sql.NullString `db:"tinyblob_check"` + TinyblobCheckRef sql.NullString `db:"tinyblob_check_ref"` + TinyblobCheckDefConst sql.NullString `db:"tinyblob_check_def_const"` + TinyblobCheckDefFunc sql.NullString `db:"tinyblob_check_def_func"` +} diff --git a/internal/integration_tests/mysql8/defaultsettings/TinyintCheckPk.go b/internal/integration_tests/mysql8/defaultsettings/TinyintCheckPk.go new file mode 100644 index 00000000..c99bf0f9 --- /dev/null +++ b/internal/integration_tests/mysql8/defaultsettings/TinyintCheckPk.go @@ -0,0 +1,5 @@ +package dto + +type TinyintCheckPk struct { + TinyintCheckPk int `db:"tinyint_check_pk"` +} diff --git a/internal/integration_tests/mysql8/defaultsettings/TinyintDefConstUniqueCheckPk.go b/internal/integration_tests/mysql8/defaultsettings/TinyintDefConstUniqueCheckPk.go new file mode 100644 index 00000000..7ffc4928 --- /dev/null +++ b/internal/integration_tests/mysql8/defaultsettings/TinyintDefConstUniqueCheckPk.go @@ -0,0 +1,5 @@ +package dto + +type TinyintDefConstUniqueCheckPk struct { + TinyintDefConstUniqueCheckPk int `db:"tinyint_def_const_unique_check_pk"` +} diff --git a/internal/integration_tests/mysql8/defaultsettings/TinyintDefConstUniqueCheckPkRef.go b/internal/integration_tests/mysql8/defaultsettings/TinyintDefConstUniqueCheckPkRef.go new file mode 100644 index 00000000..0d5bf10c --- /dev/null +++ b/internal/integration_tests/mysql8/defaultsettings/TinyintDefConstUniqueCheckPkRef.go @@ -0,0 +1,5 @@ +package dto + +type TinyintDefConstUniqueCheckPkRef struct { + TinyintDefConstUniqueCheckPkRef int `db:"tinyint_def_const_unique_check_pk_ref"` +} diff --git a/internal/integration_tests/mysql8/defaultsettings/TinyintDefFuncUniqueCheckPk.go b/internal/integration_tests/mysql8/defaultsettings/TinyintDefFuncUniqueCheckPk.go new file mode 100644 index 00000000..f2a64472 --- /dev/null +++ b/internal/integration_tests/mysql8/defaultsettings/TinyintDefFuncUniqueCheckPk.go @@ -0,0 +1,5 @@ +package dto + +type TinyintDefFuncUniqueCheckPk struct { + TinyintDefFuncUniqueCheckPk int `db:"tinyint_def_func_unique_check_pk"` +} diff --git a/internal/integration_tests/mysql8/defaultsettings/TinyintDefFuncUniqueCheckPkRef.go b/internal/integration_tests/mysql8/defaultsettings/TinyintDefFuncUniqueCheckPkRef.go new file mode 100644 index 00000000..c11b6834 --- /dev/null +++ b/internal/integration_tests/mysql8/defaultsettings/TinyintDefFuncUniqueCheckPkRef.go @@ -0,0 +1,5 @@ +package dto + +type TinyintDefFuncUniqueCheckPkRef struct { + TinyintDefFuncUniqueCheckPkRef int `db:"tinyint_def_func_unique_check_pk_ref"` +} diff --git a/internal/integration_tests/mysql8/defaultsettings/TinyintNnPk.go b/internal/integration_tests/mysql8/defaultsettings/TinyintNnPk.go new file mode 100644 index 00000000..8b38fdcf --- /dev/null +++ b/internal/integration_tests/mysql8/defaultsettings/TinyintNnPk.go @@ -0,0 +1,5 @@ +package dto + +type TinyintNnPk struct { + TinyintNnPk int `db:"tinyint_nn_pk"` +} diff --git a/internal/integration_tests/mysql8/defaultsettings/TinyintNnUniqueCheckPk.go b/internal/integration_tests/mysql8/defaultsettings/TinyintNnUniqueCheckPk.go new file mode 100644 index 00000000..7551c68b --- /dev/null +++ b/internal/integration_tests/mysql8/defaultsettings/TinyintNnUniqueCheckPk.go @@ -0,0 +1,5 @@ +package dto + +type TinyintNnUniqueCheckPk struct { + TinyintNnUniqueCheckPk int `db:"tinyint_nn_unique_check_pk"` +} diff --git a/internal/integration_tests/mysql8/defaultsettings/TinyintNnUniqueCheckPkRef.go b/internal/integration_tests/mysql8/defaultsettings/TinyintNnUniqueCheckPkRef.go new file mode 100644 index 00000000..63c61bce --- /dev/null +++ b/internal/integration_tests/mysql8/defaultsettings/TinyintNnUniqueCheckPkRef.go @@ -0,0 +1,5 @@ +package dto + +type TinyintNnUniqueCheckPkRef struct { + TinyintNnUniqueCheckPkRef int `db:"tinyint_nn_unique_check_pk_ref"` +} diff --git a/internal/integration_tests/mysql8/defaultsettings/TinyintPk.go b/internal/integration_tests/mysql8/defaultsettings/TinyintPk.go new file mode 100644 index 00000000..02b30a86 --- /dev/null +++ b/internal/integration_tests/mysql8/defaultsettings/TinyintPk.go @@ -0,0 +1,5 @@ +package dto + +type TinyintPk struct { + TinyintPk int `db:"tinyint_pk"` +} diff --git a/internal/integration_tests/mysql8/defaultsettings/TinyintPkDefConst.go b/internal/integration_tests/mysql8/defaultsettings/TinyintPkDefConst.go new file mode 100644 index 00000000..b9f15c15 --- /dev/null +++ b/internal/integration_tests/mysql8/defaultsettings/TinyintPkDefConst.go @@ -0,0 +1,5 @@ +package dto + +type TinyintPkDefConst struct { + TinyintPkDefConst int `db:"tinyint_pk_def_const"` +} diff --git a/internal/integration_tests/mysql8/defaultsettings/TinyintPkDefFunc.go b/internal/integration_tests/mysql8/defaultsettings/TinyintPkDefFunc.go new file mode 100644 index 00000000..ee8d490a --- /dev/null +++ b/internal/integration_tests/mysql8/defaultsettings/TinyintPkDefFunc.go @@ -0,0 +1,5 @@ +package dto + +type TinyintPkDefFunc struct { + TinyintPkDefFunc int `db:"tinyint_pk_def_func"` +} diff --git a/internal/integration_tests/mysql8/defaultsettings/TinyintPkRef.go b/internal/integration_tests/mysql8/defaultsettings/TinyintPkRef.go new file mode 100644 index 00000000..3f95dead --- /dev/null +++ b/internal/integration_tests/mysql8/defaultsettings/TinyintPkRef.go @@ -0,0 +1,5 @@ +package dto + +type TinyintPkRef struct { + TinyintPkRef int `db:"tinyint_pk_ref"` +} diff --git a/internal/integration_tests/mysql8/defaultsettings/TinyintRef.go b/internal/integration_tests/mysql8/defaultsettings/TinyintRef.go new file mode 100644 index 00000000..9c2f7bc0 --- /dev/null +++ b/internal/integration_tests/mysql8/defaultsettings/TinyintRef.go @@ -0,0 +1,9 @@ +package dto + +import ( + "database/sql" +) + +type TinyintRef struct { + TinyintRef sql.NullInt64 `db:"tinyint_ref"` +} diff --git a/internal/integration_tests/mysql8/defaultsettings/TinyintTable.go b/internal/integration_tests/mysql8/defaultsettings/TinyintTable.go new file mode 100644 index 00000000..159115a3 --- /dev/null +++ b/internal/integration_tests/mysql8/defaultsettings/TinyintTable.go @@ -0,0 +1,27 @@ +package dto + +import ( + "database/sql" +) + +type TinyintTable struct { + I sql.NullInt64 `db:"i"` + TinyintNn int `db:"tinyint_nn"` + TinyintNnUnique int `db:"tinyint_nn_unique"` + TinyintNnCheck int `db:"tinyint_nn_check"` + TinyintUnique sql.NullInt64 `db:"tinyint_unique"` + TinyintUniqueCheck sql.NullInt64 `db:"tinyint_unique_check"` + TinyintUniqueRef sql.NullInt64 `db:"tinyint_unique_ref"` + TinyintUniqueDefConst sql.NullInt64 `db:"tinyint_unique_def_const"` + TinyintUniqueDefFunc sql.NullInt64 `db:"tinyint_unique_def_func"` + TinyintCheck sql.NullInt64 `db:"tinyint_check"` + TinyintCheckRef sql.NullInt64 `db:"tinyint_check_ref"` + TinyintCheckDefConst sql.NullInt64 `db:"tinyint_check_def_const"` + TinyintCheckDefFunc sql.NullInt64 `db:"tinyint_check_def_func"` + TinyintRef sql.NullInt64 `db:"tinyint_ref"` + TinyintRefUniqueCheck sql.NullInt64 `db:"tinyint_ref_unique_check"` + TinyintDefConst sql.NullInt64 `db:"tinyint_def_const"` + TinyintDefConstUniqueCheck sql.NullInt64 `db:"tinyint_def_const_unique_check"` + TinyintDefFunc sql.NullInt64 `db:"tinyint_def_func"` + TinyintDefFuncUniqueCheck sql.NullInt64 `db:"tinyint_def_func_unique_check"` +} diff --git a/internal/integration_tests/mysql8/defaultsettings/TinyintUniqueCheckPk.go b/internal/integration_tests/mysql8/defaultsettings/TinyintUniqueCheckPk.go new file mode 100644 index 00000000..8f43510d --- /dev/null +++ b/internal/integration_tests/mysql8/defaultsettings/TinyintUniqueCheckPk.go @@ -0,0 +1,5 @@ +package dto + +type TinyintUniqueCheckPk struct { + TinyintUniqueCheckPk int `db:"tinyint_unique_check_pk"` +} diff --git a/internal/integration_tests/mysql8/defaultsettings/TinyintUniqueCheckPkRef.go b/internal/integration_tests/mysql8/defaultsettings/TinyintUniqueCheckPkRef.go new file mode 100644 index 00000000..65effa9b --- /dev/null +++ b/internal/integration_tests/mysql8/defaultsettings/TinyintUniqueCheckPkRef.go @@ -0,0 +1,5 @@ +package dto + +type TinyintUniqueCheckPkRef struct { + TinyintUniqueCheckPkRef int `db:"tinyint_unique_check_pk_ref"` +} diff --git a/internal/integration_tests/mysql8/defaultsettings/TinyintUniquePk.go b/internal/integration_tests/mysql8/defaultsettings/TinyintUniquePk.go new file mode 100644 index 00000000..d134425d --- /dev/null +++ b/internal/integration_tests/mysql8/defaultsettings/TinyintUniquePk.go @@ -0,0 +1,5 @@ +package dto + +type TinyintUniquePk struct { + TinyintUniquePk int `db:"tinyint_unique_pk"` +} diff --git a/internal/integration_tests/mysql8/defaultsettings/TinytextRef.go b/internal/integration_tests/mysql8/defaultsettings/TinytextRef.go new file mode 100644 index 00000000..4a76f7dd --- /dev/null +++ b/internal/integration_tests/mysql8/defaultsettings/TinytextRef.go @@ -0,0 +1,5 @@ +package dto + +type TinytextRef struct { + TinytextRef string `db:"tinytext_ref"` +} diff --git a/internal/integration_tests/mysql8/defaultsettings/TinytextTable.go b/internal/integration_tests/mysql8/defaultsettings/TinytextTable.go new file mode 100644 index 00000000..6ed6e818 --- /dev/null +++ b/internal/integration_tests/mysql8/defaultsettings/TinytextTable.go @@ -0,0 +1,22 @@ +package dto + +import ( + "database/sql" +) + +type TinytextTable struct { + Col sql.NullString `db:"col"` + TinytextDefConst sql.NullString `db:"tinytext_def_const"` + TinytextDefFunc sql.NullString `db:"tinytext_def_func"` + TinytextRef sql.NullString `db:"tinytext_ref"` + TinytextNn string `db:"tinytext_nn"` + TinytextNnCheckCmp string `db:"tinytext_nn_check_cmp"` + TinytextNnCheckFn string `db:"tinytext_nn_check_fn"` + TinytextNnRef string `db:"tinytext_nn_ref"` + TinytextNnDefConst string `db:"tinytext_nn_def_const"` + TinytextNnDefFunc string `db:"tinytext_nn_def_func"` + TinytextCheck sql.NullString `db:"tinytext_check"` + TinytextCheckRef sql.NullString `db:"tinytext_check_ref"` + TinytextCheckDefConst sql.NullString `db:"tinytext_check_def_const"` + TinytextCheckDefFunc sql.NullString `db:"tinytext_check_def_func"` +} diff --git a/internal/integration_tests/mysql8/defaultsettings/User.go b/internal/integration_tests/mysql8/defaultsettings/User.go new file mode 100644 index 00000000..ba4ce59b --- /dev/null +++ b/internal/integration_tests/mysql8/defaultsettings/User.go @@ -0,0 +1,11 @@ +package dto + +import ( + "database/sql" +) + +type User struct { + ID int `db:"id"` + UserID int `db:"user_id"` + WebsiteURL sql.NullString `db:"website_url"` +} diff --git a/internal/integration_tests/mysql8/defaultsettings/VarbinaryCheckPk.go b/internal/integration_tests/mysql8/defaultsettings/VarbinaryCheckPk.go new file mode 100644 index 00000000..ec1add83 --- /dev/null +++ b/internal/integration_tests/mysql8/defaultsettings/VarbinaryCheckPk.go @@ -0,0 +1,5 @@ +package dto + +type VarbinaryCheckPk struct { + VarbinaryCheckPk string `db:"varbinary_check_pk"` +} diff --git a/internal/integration_tests/mysql8/defaultsettings/VarbinaryDefConstUniqueCheckPk.go b/internal/integration_tests/mysql8/defaultsettings/VarbinaryDefConstUniqueCheckPk.go new file mode 100644 index 00000000..405c5f62 --- /dev/null +++ b/internal/integration_tests/mysql8/defaultsettings/VarbinaryDefConstUniqueCheckPk.go @@ -0,0 +1,5 @@ +package dto + +type VarbinaryDefConstUniqueCheckPk struct { + VarbinaryDefConstUniqueCheckPk string `db:"varbinary_def_const_unique_check_pk"` +} diff --git a/internal/integration_tests/mysql8/defaultsettings/VarbinaryDefConstUniqueCheckPkRef.go b/internal/integration_tests/mysql8/defaultsettings/VarbinaryDefConstUniqueCheckPkRef.go new file mode 100644 index 00000000..43fdd969 --- /dev/null +++ b/internal/integration_tests/mysql8/defaultsettings/VarbinaryDefConstUniqueCheckPkRef.go @@ -0,0 +1,5 @@ +package dto + +type VarbinaryDefConstUniqueCheckPkRef struct { + VarbinaryDefConstUniqueCheckPkRef string `db:"varbinary_def_const_unique_check_pk_ref"` +} diff --git a/internal/integration_tests/mysql8/defaultsettings/VarbinaryDefFuncUniqueCheckPk.go b/internal/integration_tests/mysql8/defaultsettings/VarbinaryDefFuncUniqueCheckPk.go new file mode 100644 index 00000000..481a8606 --- /dev/null +++ b/internal/integration_tests/mysql8/defaultsettings/VarbinaryDefFuncUniqueCheckPk.go @@ -0,0 +1,5 @@ +package dto + +type VarbinaryDefFuncUniqueCheckPk struct { + VarbinaryDefFuncUniqueCheckPk string `db:"varbinary_def_func_unique_check_pk"` +} diff --git a/internal/integration_tests/mysql8/defaultsettings/VarbinaryDefFuncUniqueCheckPkRef.go b/internal/integration_tests/mysql8/defaultsettings/VarbinaryDefFuncUniqueCheckPkRef.go new file mode 100644 index 00000000..78e363c7 --- /dev/null +++ b/internal/integration_tests/mysql8/defaultsettings/VarbinaryDefFuncUniqueCheckPkRef.go @@ -0,0 +1,5 @@ +package dto + +type VarbinaryDefFuncUniqueCheckPkRef struct { + VarbinaryDefFuncUniqueCheckPkRef string `db:"varbinary_def_func_unique_check_pk_ref"` +} diff --git a/internal/integration_tests/mysql8/defaultsettings/VarbinaryNnPk.go b/internal/integration_tests/mysql8/defaultsettings/VarbinaryNnPk.go new file mode 100644 index 00000000..6e2231f1 --- /dev/null +++ b/internal/integration_tests/mysql8/defaultsettings/VarbinaryNnPk.go @@ -0,0 +1,5 @@ +package dto + +type VarbinaryNnPk struct { + VarbinaryNnPk string `db:"varbinary_nn_pk"` +} diff --git a/internal/integration_tests/mysql8/defaultsettings/VarbinaryNnUniqueCheckPk.go b/internal/integration_tests/mysql8/defaultsettings/VarbinaryNnUniqueCheckPk.go new file mode 100644 index 00000000..54f19d70 --- /dev/null +++ b/internal/integration_tests/mysql8/defaultsettings/VarbinaryNnUniqueCheckPk.go @@ -0,0 +1,5 @@ +package dto + +type VarbinaryNnUniqueCheckPk struct { + VarbinaryNnUniqueCheckPk string `db:"varbinary_nn_unique_check_pk"` +} diff --git a/internal/integration_tests/mysql8/defaultsettings/VarbinaryNnUniqueCheckPkRef.go b/internal/integration_tests/mysql8/defaultsettings/VarbinaryNnUniqueCheckPkRef.go new file mode 100644 index 00000000..f8170e58 --- /dev/null +++ b/internal/integration_tests/mysql8/defaultsettings/VarbinaryNnUniqueCheckPkRef.go @@ -0,0 +1,5 @@ +package dto + +type VarbinaryNnUniqueCheckPkRef struct { + VarbinaryNnUniqueCheckPkRef string `db:"varbinary_nn_unique_check_pk_ref"` +} diff --git a/internal/integration_tests/mysql8/defaultsettings/VarbinaryPk.go b/internal/integration_tests/mysql8/defaultsettings/VarbinaryPk.go new file mode 100644 index 00000000..8250904d --- /dev/null +++ b/internal/integration_tests/mysql8/defaultsettings/VarbinaryPk.go @@ -0,0 +1,5 @@ +package dto + +type VarbinaryPk struct { + VarbinaryPk string `db:"varbinary_pk"` +} diff --git a/internal/integration_tests/mysql8/defaultsettings/VarbinaryPkDefConst.go b/internal/integration_tests/mysql8/defaultsettings/VarbinaryPkDefConst.go new file mode 100644 index 00000000..579a26ed --- /dev/null +++ b/internal/integration_tests/mysql8/defaultsettings/VarbinaryPkDefConst.go @@ -0,0 +1,5 @@ +package dto + +type VarbinaryPkDefConst struct { + VarbinaryPkDefConst string `db:"varbinary_pk_def_const"` +} diff --git a/internal/integration_tests/mysql8/defaultsettings/VarbinaryPkDefFunc.go b/internal/integration_tests/mysql8/defaultsettings/VarbinaryPkDefFunc.go new file mode 100644 index 00000000..2bf3817f --- /dev/null +++ b/internal/integration_tests/mysql8/defaultsettings/VarbinaryPkDefFunc.go @@ -0,0 +1,5 @@ +package dto + +type VarbinaryPkDefFunc struct { + VarbinaryPkDefFunc string `db:"varbinary_pk_def_func"` +} diff --git a/internal/integration_tests/mysql8/defaultsettings/VarbinaryPkRef.go b/internal/integration_tests/mysql8/defaultsettings/VarbinaryPkRef.go new file mode 100644 index 00000000..d395a72d --- /dev/null +++ b/internal/integration_tests/mysql8/defaultsettings/VarbinaryPkRef.go @@ -0,0 +1,5 @@ +package dto + +type VarbinaryPkRef struct { + VarbinaryPkRef string `db:"varbinary_pk_ref"` +} diff --git a/internal/integration_tests/mysql8/defaultsettings/VarbinaryRef.go b/internal/integration_tests/mysql8/defaultsettings/VarbinaryRef.go new file mode 100644 index 00000000..a8afd55e --- /dev/null +++ b/internal/integration_tests/mysql8/defaultsettings/VarbinaryRef.go @@ -0,0 +1,9 @@ +package dto + +import ( + "database/sql" +) + +type VarbinaryRef struct { + VarbinaryRef sql.NullString `db:"varbinary_ref"` +} diff --git a/internal/integration_tests/mysql8/defaultsettings/VarbinaryTable.go b/internal/integration_tests/mysql8/defaultsettings/VarbinaryTable.go new file mode 100644 index 00000000..96012522 --- /dev/null +++ b/internal/integration_tests/mysql8/defaultsettings/VarbinaryTable.go @@ -0,0 +1,33 @@ +package dto + +import ( + "database/sql" +) + +type VarbinaryTable struct { + Col sql.NullString `db:"col"` + VarbinaryCap sql.NullString `db:"varbinary_cap"` + VarbinaryNn string `db:"varbinary_nn"` + VarbinaryNnUnique string `db:"varbinary_nn_unique"` + VarbinaryNnCheckCmp string `db:"varbinary_nn_check_cmp"` + VarbinaryNnCheckFn string `db:"varbinary_nn_check_fn"` + VarbinaryNnRef string `db:"varbinary_nn_ref"` + VarbinaryNnDefConst string `db:"varbinary_nn_def_const"` + VarbinaryNnDefFunc string `db:"varbinary_nn_def_func"` + VarbinaryNnUniqueCheck string `db:"varbinary_nn_unique_check"` + VarbinaryUnique sql.NullString `db:"varbinary_unique"` + VarbinaryUniqueCheck sql.NullString `db:"varbinary_unique_check"` + VarbinaryUniqueRef sql.NullString `db:"varbinary_unique_ref"` + VarbinaryUniqueDefConst sql.NullString `db:"varbinary_unique_def_const"` + VarbinaryUniqueDefFunc sql.NullString `db:"varbinary_unique_def_func"` + VarbinaryCheck sql.NullString `db:"varbinary_check"` + VarbinaryCheckRef sql.NullString `db:"varbinary_check_ref"` + VarbinaryCheckDefConst sql.NullString `db:"varbinary_check_def_const"` + VarbinaryCheckDefFunc sql.NullString `db:"varbinary_check_def_func"` + VarbinaryRef sql.NullString `db:"varbinary_ref"` + VarbinaryRefUniqueCheck sql.NullString `db:"varbinary_ref_unique_check"` + VarbinaryDefConst sql.NullString `db:"varbinary_def_const"` + VarbinaryDefConstUniqueCheck sql.NullString `db:"varbinary_def_const_unique_check"` + VarbinaryDefFunc sql.NullString `db:"varbinary_def_func"` + VarbinaryDefFuncUniqueCheck sql.NullString `db:"varbinary_def_func_unique_check"` +} diff --git a/internal/integration_tests/mysql8/defaultsettings/VarbinaryUniqueCheckPk.go b/internal/integration_tests/mysql8/defaultsettings/VarbinaryUniqueCheckPk.go new file mode 100644 index 00000000..cd74bfc8 --- /dev/null +++ b/internal/integration_tests/mysql8/defaultsettings/VarbinaryUniqueCheckPk.go @@ -0,0 +1,5 @@ +package dto + +type VarbinaryUniqueCheckPk struct { + VarbinaryUniqueCheckPk string `db:"varbinary_unique_check_pk"` +} diff --git a/internal/integration_tests/mysql8/defaultsettings/VarbinaryUniqueCheckPkRef.go b/internal/integration_tests/mysql8/defaultsettings/VarbinaryUniqueCheckPkRef.go new file mode 100644 index 00000000..883c332d --- /dev/null +++ b/internal/integration_tests/mysql8/defaultsettings/VarbinaryUniqueCheckPkRef.go @@ -0,0 +1,5 @@ +package dto + +type VarbinaryUniqueCheckPkRef struct { + VarbinaryUniqueCheckPkRef string `db:"varbinary_unique_check_pk_ref"` +} diff --git a/internal/integration_tests/mysql8/defaultsettings/VarbinaryUniquePk.go b/internal/integration_tests/mysql8/defaultsettings/VarbinaryUniquePk.go new file mode 100644 index 00000000..92816a2c --- /dev/null +++ b/internal/integration_tests/mysql8/defaultsettings/VarbinaryUniquePk.go @@ -0,0 +1,5 @@ +package dto + +type VarbinaryUniquePk struct { + VarbinaryUniquePk string `db:"varbinary_unique_pk"` +} diff --git a/internal/integration_tests/mysql8/defaultsettings/VarcharCheckPk.go b/internal/integration_tests/mysql8/defaultsettings/VarcharCheckPk.go new file mode 100644 index 00000000..3f42d91f --- /dev/null +++ b/internal/integration_tests/mysql8/defaultsettings/VarcharCheckPk.go @@ -0,0 +1,5 @@ +package dto + +type VarcharCheckPk struct { + VarcharCheckPk string `db:"varchar_check_pk"` +} diff --git a/internal/integration_tests/mysql8/defaultsettings/VarcharDefConstUniqueCheckPk.go b/internal/integration_tests/mysql8/defaultsettings/VarcharDefConstUniqueCheckPk.go new file mode 100644 index 00000000..b0c8f76b --- /dev/null +++ b/internal/integration_tests/mysql8/defaultsettings/VarcharDefConstUniqueCheckPk.go @@ -0,0 +1,5 @@ +package dto + +type VarcharDefConstUniqueCheckPk struct { + VarcharDefConstUniqueCheckPk string `db:"varchar_def_const_unique_check_pk"` +} diff --git a/internal/integration_tests/mysql8/defaultsettings/VarcharDefConstUniqueCheckPkRef.go b/internal/integration_tests/mysql8/defaultsettings/VarcharDefConstUniqueCheckPkRef.go new file mode 100644 index 00000000..55840733 --- /dev/null +++ b/internal/integration_tests/mysql8/defaultsettings/VarcharDefConstUniqueCheckPkRef.go @@ -0,0 +1,5 @@ +package dto + +type VarcharDefConstUniqueCheckPkRef struct { + VarcharDefConstUniqueCheckPkRef string `db:"varchar_def_const_unique_check_pk_ref"` +} diff --git a/internal/integration_tests/mysql8/defaultsettings/VarcharDefFuncUniqueCheckPk.go b/internal/integration_tests/mysql8/defaultsettings/VarcharDefFuncUniqueCheckPk.go new file mode 100644 index 00000000..eb63e5d1 --- /dev/null +++ b/internal/integration_tests/mysql8/defaultsettings/VarcharDefFuncUniqueCheckPk.go @@ -0,0 +1,5 @@ +package dto + +type VarcharDefFuncUniqueCheckPk struct { + VarcharDefFuncUniqueCheckPk string `db:"varchar_def_func_unique_check_pk"` +} diff --git a/internal/integration_tests/mysql8/defaultsettings/VarcharDefFuncUniqueCheckPkRef.go b/internal/integration_tests/mysql8/defaultsettings/VarcharDefFuncUniqueCheckPkRef.go new file mode 100644 index 00000000..8b002629 --- /dev/null +++ b/internal/integration_tests/mysql8/defaultsettings/VarcharDefFuncUniqueCheckPkRef.go @@ -0,0 +1,5 @@ +package dto + +type VarcharDefFuncUniqueCheckPkRef struct { + VarcharDefFuncUniqueCheckPkRef string `db:"varchar_def_func_unique_check_pk_ref"` +} diff --git a/internal/integration_tests/mysql8/defaultsettings/VarcharNnPk.go b/internal/integration_tests/mysql8/defaultsettings/VarcharNnPk.go new file mode 100644 index 00000000..b8364e86 --- /dev/null +++ b/internal/integration_tests/mysql8/defaultsettings/VarcharNnPk.go @@ -0,0 +1,5 @@ +package dto + +type VarcharNnPk struct { + VarcharNnPk string `db:"varchar_nn_pk"` +} diff --git a/internal/integration_tests/mysql8/defaultsettings/VarcharNnUniqueCheckPk.go b/internal/integration_tests/mysql8/defaultsettings/VarcharNnUniqueCheckPk.go new file mode 100644 index 00000000..0a24372c --- /dev/null +++ b/internal/integration_tests/mysql8/defaultsettings/VarcharNnUniqueCheckPk.go @@ -0,0 +1,5 @@ +package dto + +type VarcharNnUniqueCheckPk struct { + VarcharNnUniqueCheckPk string `db:"varchar_nn_unique_check_pk"` +} diff --git a/internal/integration_tests/mysql8/defaultsettings/VarcharNnUniqueCheckPkRef.go b/internal/integration_tests/mysql8/defaultsettings/VarcharNnUniqueCheckPkRef.go new file mode 100644 index 00000000..419161c0 --- /dev/null +++ b/internal/integration_tests/mysql8/defaultsettings/VarcharNnUniqueCheckPkRef.go @@ -0,0 +1,5 @@ +package dto + +type VarcharNnUniqueCheckPkRef struct { + VarcharNnUniqueCheckPkRef string `db:"varchar_nn_unique_check_pk_ref"` +} diff --git a/internal/integration_tests/mysql8/defaultsettings/VarcharPk.go b/internal/integration_tests/mysql8/defaultsettings/VarcharPk.go new file mode 100644 index 00000000..d04cc77d --- /dev/null +++ b/internal/integration_tests/mysql8/defaultsettings/VarcharPk.go @@ -0,0 +1,5 @@ +package dto + +type VarcharPk struct { + VarcharPk string `db:"varchar_pk"` +} diff --git a/internal/integration_tests/mysql8/defaultsettings/VarcharPkDefConst.go b/internal/integration_tests/mysql8/defaultsettings/VarcharPkDefConst.go new file mode 100644 index 00000000..2b5b3bce --- /dev/null +++ b/internal/integration_tests/mysql8/defaultsettings/VarcharPkDefConst.go @@ -0,0 +1,5 @@ +package dto + +type VarcharPkDefConst struct { + VarcharPkDefConst string `db:"varchar_pk_def_const"` +} diff --git a/internal/integration_tests/mysql8/defaultsettings/VarcharPkDefFunc.go b/internal/integration_tests/mysql8/defaultsettings/VarcharPkDefFunc.go new file mode 100644 index 00000000..8e0d43b6 --- /dev/null +++ b/internal/integration_tests/mysql8/defaultsettings/VarcharPkDefFunc.go @@ -0,0 +1,5 @@ +package dto + +type VarcharPkDefFunc struct { + VarcharPkDefFunc string `db:"varchar_pk_def_func"` +} diff --git a/internal/integration_tests/mysql8/defaultsettings/VarcharPkRef.go b/internal/integration_tests/mysql8/defaultsettings/VarcharPkRef.go new file mode 100644 index 00000000..1237c5d4 --- /dev/null +++ b/internal/integration_tests/mysql8/defaultsettings/VarcharPkRef.go @@ -0,0 +1,5 @@ +package dto + +type VarcharPkRef struct { + VarcharPkRef string `db:"varchar_pk_ref"` +} diff --git a/internal/integration_tests/mysql8/defaultsettings/VarcharRef.go b/internal/integration_tests/mysql8/defaultsettings/VarcharRef.go new file mode 100644 index 00000000..4add70ab --- /dev/null +++ b/internal/integration_tests/mysql8/defaultsettings/VarcharRef.go @@ -0,0 +1,9 @@ +package dto + +import ( + "database/sql" +) + +type VarcharRef struct { + VarcharRef sql.NullString `db:"varchar_ref"` +} diff --git a/internal/integration_tests/mysql8/defaultsettings/VarcharTable.go b/internal/integration_tests/mysql8/defaultsettings/VarcharTable.go new file mode 100644 index 00000000..2a0f0084 --- /dev/null +++ b/internal/integration_tests/mysql8/defaultsettings/VarcharTable.go @@ -0,0 +1,33 @@ +package dto + +import ( + "database/sql" +) + +type VarcharTable struct { + Col sql.NullString `db:"col"` + VarcharCap sql.NullString `db:"varchar_cap"` + VarcharNn string `db:"varchar_nn"` + VarcharNnUnique string `db:"varchar_nn_unique"` + VarcharNnCheckCmp string `db:"varchar_nn_check_cmp"` + VarcharNnCheckFn string `db:"varchar_nn_check_fn"` + VarcharNnRef string `db:"varchar_nn_ref"` + VarcharNnDefConst string `db:"varchar_nn_def_const"` + VarcharNnDefFunc string `db:"varchar_nn_def_func"` + VarcharNnUniqueCheck string `db:"varchar_nn_unique_check"` + VarcharUnique sql.NullString `db:"varchar_unique"` + VarcharUniqueCheck sql.NullString `db:"varchar_unique_check"` + VarcharUniqueRef sql.NullString `db:"varchar_unique_ref"` + VarcharUniqueDefConst sql.NullString `db:"varchar_unique_def_const"` + VarcharUniqueDefFunc sql.NullString `db:"varchar_unique_def_func"` + VarcharCheck sql.NullString `db:"varchar_check"` + VarcharCheckRef sql.NullString `db:"varchar_check_ref"` + VarcharCheckDefConst sql.NullString `db:"varchar_check_def_const"` + VarcharCheckDefFunc sql.NullString `db:"varchar_check_def_func"` + VarcharRef sql.NullString `db:"varchar_ref"` + VarcharRefUniqueCheck sql.NullString `db:"varchar_ref_unique_check"` + VarcharDefConst sql.NullString `db:"varchar_def_const"` + VarcharDefConstUniqueCheck sql.NullString `db:"varchar_def_const_unique_check"` + VarcharDefFunc sql.NullString `db:"varchar_def_func"` + VarcharDefFuncUniqueCheck sql.NullString `db:"varchar_def_func_unique_check"` +} diff --git a/internal/integration_tests/mysql8/defaultsettings/VarcharUniqueCheckPk.go b/internal/integration_tests/mysql8/defaultsettings/VarcharUniqueCheckPk.go new file mode 100644 index 00000000..98513a8f --- /dev/null +++ b/internal/integration_tests/mysql8/defaultsettings/VarcharUniqueCheckPk.go @@ -0,0 +1,5 @@ +package dto + +type VarcharUniqueCheckPk struct { + VarcharUniqueCheckPk string `db:"varchar_unique_check_pk"` +} diff --git a/internal/integration_tests/mysql8/defaultsettings/VarcharUniqueCheckPkRef.go b/internal/integration_tests/mysql8/defaultsettings/VarcharUniqueCheckPkRef.go new file mode 100644 index 00000000..9e078bac --- /dev/null +++ b/internal/integration_tests/mysql8/defaultsettings/VarcharUniqueCheckPkRef.go @@ -0,0 +1,5 @@ +package dto + +type VarcharUniqueCheckPkRef struct { + VarcharUniqueCheckPkRef string `db:"varchar_unique_check_pk_ref"` +} diff --git a/internal/integration_tests/mysql8/defaultsettings/VarcharUniquePk.go b/internal/integration_tests/mysql8/defaultsettings/VarcharUniquePk.go new file mode 100644 index 00000000..66a68448 --- /dev/null +++ b/internal/integration_tests/mysql8/defaultsettings/VarcharUniquePk.go @@ -0,0 +1,5 @@ +package dto + +type VarcharUniquePk struct { + VarcharUniquePk string `db:"varchar_unique_pk"` +} diff --git a/internal/integration_tests/mysql8/defaultsettings/YearCheckPk.go b/internal/integration_tests/mysql8/defaultsettings/YearCheckPk.go new file mode 100644 index 00000000..098cc2b7 --- /dev/null +++ b/internal/integration_tests/mysql8/defaultsettings/YearCheckPk.go @@ -0,0 +1,9 @@ +package dto + +import ( + "time" +) + +type YearCheckPk struct { + YearCheckPk time.Time `db:"year_check_pk"` +} diff --git a/internal/integration_tests/mysql8/defaultsettings/YearDefConstUniqueCheckPk.go b/internal/integration_tests/mysql8/defaultsettings/YearDefConstUniqueCheckPk.go new file mode 100644 index 00000000..15ba8ad8 --- /dev/null +++ b/internal/integration_tests/mysql8/defaultsettings/YearDefConstUniqueCheckPk.go @@ -0,0 +1,9 @@ +package dto + +import ( + "time" +) + +type YearDefConstUniqueCheckPk struct { + YearDefConstUniqueCheckPk time.Time `db:"year_def_const_unique_check_pk"` +} diff --git a/internal/integration_tests/mysql8/defaultsettings/YearDefConstUniqueCheckPkRef.go b/internal/integration_tests/mysql8/defaultsettings/YearDefConstUniqueCheckPkRef.go new file mode 100644 index 00000000..85043112 --- /dev/null +++ b/internal/integration_tests/mysql8/defaultsettings/YearDefConstUniqueCheckPkRef.go @@ -0,0 +1,9 @@ +package dto + +import ( + "time" +) + +type YearDefConstUniqueCheckPkRef struct { + YearDefConstUniqueCheckPkRef time.Time `db:"year_def_const_unique_check_pk_ref"` +} diff --git a/internal/integration_tests/mysql8/defaultsettings/YearDefFuncUniqueCheckPk.go b/internal/integration_tests/mysql8/defaultsettings/YearDefFuncUniqueCheckPk.go new file mode 100644 index 00000000..4b6c7ad7 --- /dev/null +++ b/internal/integration_tests/mysql8/defaultsettings/YearDefFuncUniqueCheckPk.go @@ -0,0 +1,9 @@ +package dto + +import ( + "time" +) + +type YearDefFuncUniqueCheckPk struct { + YearDefFuncUniqueCheckPk time.Time `db:"year_def_func_unique_check_pk"` +} diff --git a/internal/integration_tests/mysql8/defaultsettings/YearDefFuncUniqueCheckPkRef.go b/internal/integration_tests/mysql8/defaultsettings/YearDefFuncUniqueCheckPkRef.go new file mode 100644 index 00000000..ec31e106 --- /dev/null +++ b/internal/integration_tests/mysql8/defaultsettings/YearDefFuncUniqueCheckPkRef.go @@ -0,0 +1,9 @@ +package dto + +import ( + "time" +) + +type YearDefFuncUniqueCheckPkRef struct { + YearDefFuncUniqueCheckPkRef time.Time `db:"year_def_func_unique_check_pk_ref"` +} diff --git a/internal/integration_tests/mysql8/defaultsettings/YearNnPk.go b/internal/integration_tests/mysql8/defaultsettings/YearNnPk.go new file mode 100644 index 00000000..806ee601 --- /dev/null +++ b/internal/integration_tests/mysql8/defaultsettings/YearNnPk.go @@ -0,0 +1,9 @@ +package dto + +import ( + "time" +) + +type YearNnPk struct { + YearNnPk time.Time `db:"year_nn_pk"` +} diff --git a/internal/integration_tests/mysql8/defaultsettings/YearNnUniqueCheckPk.go b/internal/integration_tests/mysql8/defaultsettings/YearNnUniqueCheckPk.go new file mode 100644 index 00000000..390293e5 --- /dev/null +++ b/internal/integration_tests/mysql8/defaultsettings/YearNnUniqueCheckPk.go @@ -0,0 +1,9 @@ +package dto + +import ( + "time" +) + +type YearNnUniqueCheckPk struct { + YearNnUniqueCheckPk time.Time `db:"year_nn_unique_check_pk"` +} diff --git a/internal/integration_tests/mysql8/defaultsettings/YearNnUniqueCheckPkRef.go b/internal/integration_tests/mysql8/defaultsettings/YearNnUniqueCheckPkRef.go new file mode 100644 index 00000000..29c667cd --- /dev/null +++ b/internal/integration_tests/mysql8/defaultsettings/YearNnUniqueCheckPkRef.go @@ -0,0 +1,9 @@ +package dto + +import ( + "time" +) + +type YearNnUniqueCheckPkRef struct { + YearNnUniqueCheckPkRef time.Time `db:"year_nn_unique_check_pk_ref"` +} diff --git a/internal/integration_tests/mysql8/defaultsettings/YearPk.go b/internal/integration_tests/mysql8/defaultsettings/YearPk.go new file mode 100644 index 00000000..2dc02194 --- /dev/null +++ b/internal/integration_tests/mysql8/defaultsettings/YearPk.go @@ -0,0 +1,9 @@ +package dto + +import ( + "time" +) + +type YearPk struct { + YearPk time.Time `db:"year_pk"` +} diff --git a/internal/integration_tests/mysql8/defaultsettings/YearPkDefConst.go b/internal/integration_tests/mysql8/defaultsettings/YearPkDefConst.go new file mode 100644 index 00000000..de1191fc --- /dev/null +++ b/internal/integration_tests/mysql8/defaultsettings/YearPkDefConst.go @@ -0,0 +1,9 @@ +package dto + +import ( + "time" +) + +type YearPkDefConst struct { + YearPkDefConst time.Time `db:"year_pk_def_const"` +} diff --git a/internal/integration_tests/mysql8/defaultsettings/YearPkDefFunc.go b/internal/integration_tests/mysql8/defaultsettings/YearPkDefFunc.go new file mode 100644 index 00000000..fd1faf72 --- /dev/null +++ b/internal/integration_tests/mysql8/defaultsettings/YearPkDefFunc.go @@ -0,0 +1,9 @@ +package dto + +import ( + "time" +) + +type YearPkDefFunc struct { + YearPkDefFunc time.Time `db:"year_pk_def_func"` +} diff --git a/internal/integration_tests/mysql8/defaultsettings/YearPkRef.go b/internal/integration_tests/mysql8/defaultsettings/YearPkRef.go new file mode 100644 index 00000000..a031e633 --- /dev/null +++ b/internal/integration_tests/mysql8/defaultsettings/YearPkRef.go @@ -0,0 +1,9 @@ +package dto + +import ( + "time" +) + +type YearPkRef struct { + YearPkRef time.Time `db:"year_pk_ref"` +} diff --git a/internal/integration_tests/mysql8/defaultsettings/YearRef.go b/internal/integration_tests/mysql8/defaultsettings/YearRef.go new file mode 100644 index 00000000..432186d2 --- /dev/null +++ b/internal/integration_tests/mysql8/defaultsettings/YearRef.go @@ -0,0 +1,9 @@ +package dto + +import ( + "database/sql" +) + +type YearRef struct { + YearRef sql.NullTime `db:"year_ref"` +} diff --git a/internal/integration_tests/mysql8/defaultsettings/YearTable.go b/internal/integration_tests/mysql8/defaultsettings/YearTable.go new file mode 100644 index 00000000..8b21f6d6 --- /dev/null +++ b/internal/integration_tests/mysql8/defaultsettings/YearTable.go @@ -0,0 +1,32 @@ +package dto + +import ( + "database/sql" + "time" +) + +type YearTable struct { + Year sql.NullTime `db:"year"` + YearNn time.Time `db:"year_nn"` + YearNnUnique time.Time `db:"year_nn_unique"` + YearNnCheck time.Time `db:"year_nn_check"` + YearNnRef time.Time `db:"year_nn_ref"` + YearNnDefConst time.Time `db:"year_nn_def_const"` + YearNnDefFunc time.Time `db:"year_nn_def_func"` + YearNnUniqueCheck time.Time `db:"year_nn_unique_check"` + YearUnique sql.NullTime `db:"year_unique"` + YearUniqueCheck sql.NullTime `db:"year_unique_check"` + YearUniqueRef sql.NullTime `db:"year_unique_ref"` + YearUniqueDefConst sql.NullTime `db:"year_unique_def_const"` + YearUniqueDefFunc sql.NullTime `db:"year_unique_def_func"` + YearCheck sql.NullTime `db:"year_check"` + YearCheckRef sql.NullTime `db:"year_check_ref"` + YearCheckDefConst sql.NullTime `db:"year_check_def_const"` + YearCheckDefFunc sql.NullTime `db:"year_check_def_func"` + YearRef sql.NullTime `db:"year_ref"` + YearRefUniqueCheck sql.NullTime `db:"year_ref_unique_check"` + YearDefConst sql.NullTime `db:"year_def_const"` + YearDefConstUniqueCheck sql.NullTime `db:"year_def_const_unique_check"` + YearDefFunc sql.NullTime `db:"year_def_func"` + YearDefFuncUniqueCheck sql.NullTime `db:"year_def_func_unique_check"` +} diff --git a/internal/integration_tests/mysql8/defaultsettings/YearUniqueCheckPk.go b/internal/integration_tests/mysql8/defaultsettings/YearUniqueCheckPk.go new file mode 100644 index 00000000..b677a138 --- /dev/null +++ b/internal/integration_tests/mysql8/defaultsettings/YearUniqueCheckPk.go @@ -0,0 +1,9 @@ +package dto + +import ( + "time" +) + +type YearUniqueCheckPk struct { + YearUniqueCheckPk time.Time `db:"year_unique_check_pk"` +} diff --git a/internal/integration_tests/mysql8/defaultsettings/YearUniqueCheckPkRef.go b/internal/integration_tests/mysql8/defaultsettings/YearUniqueCheckPkRef.go new file mode 100644 index 00000000..798abf45 --- /dev/null +++ b/internal/integration_tests/mysql8/defaultsettings/YearUniqueCheckPkRef.go @@ -0,0 +1,9 @@ +package dto + +import ( + "time" +) + +type YearUniqueCheckPkRef struct { + YearUniqueCheckPkRef time.Time `db:"year_unique_check_pk_ref"` +} diff --git a/internal/integration_tests/mysql8/defaultsettings/YearUniquePk.go b/internal/integration_tests/mysql8/defaultsettings/YearUniquePk.go new file mode 100644 index 00000000..beca6fda --- /dev/null +++ b/internal/integration_tests/mysql8/defaultsettings/YearUniquePk.go @@ -0,0 +1,9 @@ +package dto + +import ( + "time" +) + +type YearUniquePk struct { + YearUniquePk time.Time `db:"year_unique_pk"` +} diff --git a/internal/integration_tests/mysql8/filenameformatsnakecase/datetime_table.go b/internal/integration_tests/mysql8/filenameformatsnakecase/datetime_table.go new file mode 100644 index 00000000..36b7bc40 --- /dev/null +++ b/internal/integration_tests/mysql8/filenameformatsnakecase/datetime_table.go @@ -0,0 +1,32 @@ +package dto + +import ( + "database/sql" + "time" +) + +type DatetimeTable struct { + Datetime sql.NullTime `db:"datetime"` + DatetimeNn time.Time `db:"datetime_nn"` + DatetimeNnUnique time.Time `db:"datetime_nn_unique"` + DatetimeNnCheck time.Time `db:"datetime_nn_check"` + DatetimeNnRef time.Time `db:"datetime_nn_ref"` + DatetimeNnDefConst time.Time `db:"datetime_nn_def_const"` + DatetimeNnDefFunc time.Time `db:"datetime_nn_def_func"` + DatetimeNnUniqueCheck time.Time `db:"datetime_nn_unique_check"` + DatetimeUnique sql.NullTime `db:"datetime_unique"` + DatetimeUniqueCheck sql.NullTime `db:"datetime_unique_check"` + DatetimeUniqueRef sql.NullTime `db:"datetime_unique_ref"` + DatetimeUniqueDefConst sql.NullTime `db:"datetime_unique_def_const"` + DatetimeUniqueDefFunc sql.NullTime `db:"datetime_unique_def_func"` + DatetimeCheck sql.NullTime `db:"datetime_check"` + DatetimeCheckRef sql.NullTime `db:"datetime_check_ref"` + DatetimeCheckDefConst sql.NullTime `db:"datetime_check_def_const"` + DatetimeCheckDefFunc sql.NullTime `db:"datetime_check_def_func"` + DatetimeRef sql.NullTime `db:"datetime_ref"` + DatetimeRefUniqueCheck sql.NullTime `db:"datetime_ref_unique_check"` + DatetimeDefConst sql.NullTime `db:"datetime_def_const"` + DatetimeDefConstUniqueCheck sql.NullTime `db:"datetime_def_const_unique_check"` + DatetimeDefFunc sql.NullTime `db:"datetime_def_func"` + DatetimeDefFuncUniqueCheck sql.NullTime `db:"datetime_def_func_unique_check"` +} diff --git a/internal/integration_tests/mysql8/filenameformatsnakecase/float_table.go b/internal/integration_tests/mysql8/filenameformatsnakecase/float_table.go new file mode 100644 index 00000000..e0c1fd48 --- /dev/null +++ b/internal/integration_tests/mysql8/filenameformatsnakecase/float_table.go @@ -0,0 +1,31 @@ +package dto + +import ( + "database/sql" +) + +type FloatTable struct { + Col sql.NullFloat64 `db:"col"` + FloatNn float64 `db:"float_nn"` + FloatNnUnique float64 `db:"float_nn_unique"` + FloatNnCheck float64 `db:"float_nn_check"` + FloatNnRef float64 `db:"float_nn_ref"` + FloatNnDefConst float64 `db:"float_nn_def_const"` + FloatNnDefFunc float64 `db:"float_nn_def_func"` + FloatNnUniqueCheck float64 `db:"float_nn_unique_check"` + FloatUnique sql.NullFloat64 `db:"float_unique"` + FloatUniqueCheck sql.NullFloat64 `db:"float_unique_check"` + FloatUniqueRef sql.NullFloat64 `db:"float_unique_ref"` + FloatUniqueDefConst sql.NullFloat64 `db:"float_unique_def_const"` + FloatUniqueDefFunc sql.NullFloat64 `db:"float_unique_def_func"` + FloatCheck sql.NullFloat64 `db:"float_check"` + FloatCheckRef sql.NullFloat64 `db:"float_check_ref"` + FloatCheckDefConst sql.NullFloat64 `db:"float_check_def_const"` + FloatCheckDefFunc sql.NullFloat64 `db:"float_check_def_func"` + FloatRef sql.NullFloat64 `db:"float_ref"` + FloatRefUniqueCheck sql.NullFloat64 `db:"float_ref_unique_check"` + FloatDefConst sql.NullFloat64 `db:"float_def_const"` + FloatDefConstUniqueCheck sql.NullFloat64 `db:"float_def_const_unique_check"` + FloatDefFunc sql.NullFloat64 `db:"float_def_func"` + FloatDefFuncUniqueCheck sql.NullFloat64 `db:"float_def_func_unique_check"` +} diff --git a/internal/integration_tests/mysql8/filenameformatsnakecase/integer_table.go b/internal/integration_tests/mysql8/filenameformatsnakecase/integer_table.go new file mode 100644 index 00000000..4fc8d333 --- /dev/null +++ b/internal/integration_tests/mysql8/filenameformatsnakecase/integer_table.go @@ -0,0 +1,27 @@ +package dto + +import ( + "database/sql" +) + +type IntegerTable struct { + I sql.NullInt64 `db:"i"` + IntegerNn int `db:"integer_nn"` + IntegerNnUnique int `db:"integer_nn_unique"` + IntegerNnCheck int `db:"integer_nn_check"` + IntegerUnique sql.NullInt64 `db:"integer_unique"` + IntegerUniqueCheck sql.NullInt64 `db:"integer_unique_check"` + IntegerUniqueRef sql.NullInt64 `db:"integer_unique_ref"` + IntegerUniqueDefConst sql.NullInt64 `db:"integer_unique_def_const"` + IntegerUniqueDefFunc sql.NullInt64 `db:"integer_unique_def_func"` + IntegerCheck sql.NullInt64 `db:"integer_check"` + IntegerCheckRef sql.NullInt64 `db:"integer_check_ref"` + IntegerCheckDefConst sql.NullInt64 `db:"integer_check_def_const"` + IntegerCheckDefFunc sql.NullInt64 `db:"integer_check_def_func"` + IntegerRef sql.NullInt64 `db:"integer_ref"` + IntegerRefUniqueCheck sql.NullInt64 `db:"integer_ref_unique_check"` + IntegerDefConst sql.NullInt64 `db:"integer_def_const"` + IntegerDefConstUniqueCheck sql.NullInt64 `db:"integer_def_const_unique_check"` + IntegerDefFunc sql.NullInt64 `db:"integer_def_func"` + IntegerDefFuncUniqueCheck sql.NullInt64 `db:"integer_def_func_unique_check"` +} diff --git a/internal/integration_tests/mysql8/filenameformatsnakecase/user.go b/internal/integration_tests/mysql8/filenameformatsnakecase/user.go new file mode 100644 index 00000000..ba4ce59b --- /dev/null +++ b/internal/integration_tests/mysql8/filenameformatsnakecase/user.go @@ -0,0 +1,11 @@ +package dto + +import ( + "database/sql" +) + +type User struct { + ID int `db:"id"` + UserID int `db:"user_id"` + WebsiteURL sql.NullString `db:"website_url"` +} diff --git a/internal/integration_tests/mysql8/filenameformatsnakecase/varchar_table.go b/internal/integration_tests/mysql8/filenameformatsnakecase/varchar_table.go new file mode 100644 index 00000000..2a0f0084 --- /dev/null +++ b/internal/integration_tests/mysql8/filenameformatsnakecase/varchar_table.go @@ -0,0 +1,33 @@ +package dto + +import ( + "database/sql" +) + +type VarcharTable struct { + Col sql.NullString `db:"col"` + VarcharCap sql.NullString `db:"varchar_cap"` + VarcharNn string `db:"varchar_nn"` + VarcharNnUnique string `db:"varchar_nn_unique"` + VarcharNnCheckCmp string `db:"varchar_nn_check_cmp"` + VarcharNnCheckFn string `db:"varchar_nn_check_fn"` + VarcharNnRef string `db:"varchar_nn_ref"` + VarcharNnDefConst string `db:"varchar_nn_def_const"` + VarcharNnDefFunc string `db:"varchar_nn_def_func"` + VarcharNnUniqueCheck string `db:"varchar_nn_unique_check"` + VarcharUnique sql.NullString `db:"varchar_unique"` + VarcharUniqueCheck sql.NullString `db:"varchar_unique_check"` + VarcharUniqueRef sql.NullString `db:"varchar_unique_ref"` + VarcharUniqueDefConst sql.NullString `db:"varchar_unique_def_const"` + VarcharUniqueDefFunc sql.NullString `db:"varchar_unique_def_func"` + VarcharCheck sql.NullString `db:"varchar_check"` + VarcharCheckRef sql.NullString `db:"varchar_check_ref"` + VarcharCheckDefConst sql.NullString `db:"varchar_check_def_const"` + VarcharCheckDefFunc sql.NullString `db:"varchar_check_def_func"` + VarcharRef sql.NullString `db:"varchar_ref"` + VarcharRefUniqueCheck sql.NullString `db:"varchar_ref_unique_check"` + VarcharDefConst sql.NullString `db:"varchar_def_const"` + VarcharDefConstUniqueCheck sql.NullString `db:"varchar_def_const_unique_check"` + VarcharDefFunc sql.NullString `db:"varchar_def_func"` + VarcharDefFuncUniqueCheck sql.NullString `db:"varchar_def_func_unique_check"` +} diff --git a/internal/integration_tests/mysql8/ismastermindstructablerecorder/DatetimeTable.go b/internal/integration_tests/mysql8/ismastermindstructablerecorder/DatetimeTable.go new file mode 100644 index 00000000..0a5d4278 --- /dev/null +++ b/internal/integration_tests/mysql8/ismastermindstructablerecorder/DatetimeTable.go @@ -0,0 +1,36 @@ +package dto + +import ( + "database/sql" + "time" + + "github.com/Masterminds/structable" +) + +type DatetimeTable struct { + Datetime sql.NullTime `stbl:"datetime"` + DatetimeNn time.Time `stbl:"datetime_nn"` + DatetimeNnUnique time.Time `stbl:"datetime_nn_unique,PRIMARY_KEY"` + DatetimeNnCheck time.Time `stbl:"datetime_nn_check"` + DatetimeNnRef time.Time `stbl:"datetime_nn_ref"` + DatetimeNnDefConst time.Time `stbl:"datetime_nn_def_const"` + DatetimeNnDefFunc time.Time `stbl:"datetime_nn_def_func"` + DatetimeNnUniqueCheck time.Time `stbl:"datetime_nn_unique_check"` + DatetimeUnique sql.NullTime `stbl:"datetime_unique"` + DatetimeUniqueCheck sql.NullTime `stbl:"datetime_unique_check"` + DatetimeUniqueRef sql.NullTime `stbl:"datetime_unique_ref"` + DatetimeUniqueDefConst sql.NullTime `stbl:"datetime_unique_def_const"` + DatetimeUniqueDefFunc sql.NullTime `stbl:"datetime_unique_def_func"` + DatetimeCheck sql.NullTime `stbl:"datetime_check"` + DatetimeCheckRef sql.NullTime `stbl:"datetime_check_ref"` + DatetimeCheckDefConst sql.NullTime `stbl:"datetime_check_def_const"` + DatetimeCheckDefFunc sql.NullTime `stbl:"datetime_check_def_func"` + DatetimeRef sql.NullTime `stbl:"datetime_ref"` + DatetimeRefUniqueCheck sql.NullTime `stbl:"datetime_ref_unique_check"` + DatetimeDefConst sql.NullTime `stbl:"datetime_def_const"` + DatetimeDefConstUniqueCheck sql.NullTime `stbl:"datetime_def_const_unique_check"` + DatetimeDefFunc sql.NullTime `stbl:"datetime_def_func"` + DatetimeDefFuncUniqueCheck sql.NullTime `stbl:"datetime_def_func_unique_check"` + + structable.Recorder +} diff --git a/internal/integration_tests/mysql8/ismastermindstructablerecorder/FloatTable.go b/internal/integration_tests/mysql8/ismastermindstructablerecorder/FloatTable.go new file mode 100644 index 00000000..fb54afc5 --- /dev/null +++ b/internal/integration_tests/mysql8/ismastermindstructablerecorder/FloatTable.go @@ -0,0 +1,35 @@ +package dto + +import ( + "database/sql" + + "github.com/Masterminds/structable" +) + +type FloatTable struct { + Col sql.NullFloat64 `stbl:"col"` + FloatNn float64 `stbl:"float_nn"` + FloatNnUnique float64 `stbl:"float_nn_unique,PRIMARY_KEY"` + FloatNnCheck float64 `stbl:"float_nn_check"` + FloatNnRef float64 `stbl:"float_nn_ref"` + FloatNnDefConst float64 `stbl:"float_nn_def_const"` + FloatNnDefFunc float64 `stbl:"float_nn_def_func"` + FloatNnUniqueCheck float64 `stbl:"float_nn_unique_check"` + FloatUnique sql.NullFloat64 `stbl:"float_unique"` + FloatUniqueCheck sql.NullFloat64 `stbl:"float_unique_check"` + FloatUniqueRef sql.NullFloat64 `stbl:"float_unique_ref"` + FloatUniqueDefConst sql.NullFloat64 `stbl:"float_unique_def_const"` + FloatUniqueDefFunc sql.NullFloat64 `stbl:"float_unique_def_func"` + FloatCheck sql.NullFloat64 `stbl:"float_check"` + FloatCheckRef sql.NullFloat64 `stbl:"float_check_ref"` + FloatCheckDefConst sql.NullFloat64 `stbl:"float_check_def_const"` + FloatCheckDefFunc sql.NullFloat64 `stbl:"float_check_def_func"` + FloatRef sql.NullFloat64 `stbl:"float_ref"` + FloatRefUniqueCheck sql.NullFloat64 `stbl:"float_ref_unique_check"` + FloatDefConst sql.NullFloat64 `stbl:"float_def_const"` + FloatDefConstUniqueCheck sql.NullFloat64 `stbl:"float_def_const_unique_check"` + FloatDefFunc sql.NullFloat64 `stbl:"float_def_func"` + FloatDefFuncUniqueCheck sql.NullFloat64 `stbl:"float_def_func_unique_check"` + + structable.Recorder +} diff --git a/internal/integration_tests/mysql8/ismastermindstructablerecorder/IntegerTable.go b/internal/integration_tests/mysql8/ismastermindstructablerecorder/IntegerTable.go new file mode 100644 index 00000000..7c8458ea --- /dev/null +++ b/internal/integration_tests/mysql8/ismastermindstructablerecorder/IntegerTable.go @@ -0,0 +1,31 @@ +package dto + +import ( + "database/sql" + + "github.com/Masterminds/structable" +) + +type IntegerTable struct { + I sql.NullInt64 `stbl:"i"` + IntegerNn int `stbl:"integer_nn"` + IntegerNnUnique int `stbl:"integer_nn_unique,PRIMARY_KEY"` + IntegerNnCheck int `stbl:"integer_nn_check"` + IntegerUnique sql.NullInt64 `stbl:"integer_unique"` + IntegerUniqueCheck sql.NullInt64 `stbl:"integer_unique_check"` + IntegerUniqueRef sql.NullInt64 `stbl:"integer_unique_ref"` + IntegerUniqueDefConst sql.NullInt64 `stbl:"integer_unique_def_const"` + IntegerUniqueDefFunc sql.NullInt64 `stbl:"integer_unique_def_func"` + IntegerCheck sql.NullInt64 `stbl:"integer_check"` + IntegerCheckRef sql.NullInt64 `stbl:"integer_check_ref"` + IntegerCheckDefConst sql.NullInt64 `stbl:"integer_check_def_const"` + IntegerCheckDefFunc sql.NullInt64 `stbl:"integer_check_def_func"` + IntegerRef sql.NullInt64 `stbl:"integer_ref"` + IntegerRefUniqueCheck sql.NullInt64 `stbl:"integer_ref_unique_check"` + IntegerDefConst sql.NullInt64 `stbl:"integer_def_const"` + IntegerDefConstUniqueCheck sql.NullInt64 `stbl:"integer_def_const_unique_check"` + IntegerDefFunc sql.NullInt64 `stbl:"integer_def_func"` + IntegerDefFuncUniqueCheck sql.NullInt64 `stbl:"integer_def_func_unique_check"` + + structable.Recorder +} diff --git a/internal/integration_tests/mysql8/ismastermindstructablerecorder/User.go b/internal/integration_tests/mysql8/ismastermindstructablerecorder/User.go new file mode 100644 index 00000000..5fb648bd --- /dev/null +++ b/internal/integration_tests/mysql8/ismastermindstructablerecorder/User.go @@ -0,0 +1,15 @@ +package dto + +import ( + "database/sql" + + "github.com/Masterminds/structable" +) + +type User struct { + ID int `stbl:"id,PRIMARY_KEY,SERIAL,AUTO_INCREMENT"` + UserID int `stbl:"user_id"` + WebsiteURL sql.NullString `stbl:"website_url"` + + structable.Recorder +} diff --git a/internal/integration_tests/mysql8/ismastermindstructablerecorder/VarcharTable.go b/internal/integration_tests/mysql8/ismastermindstructablerecorder/VarcharTable.go new file mode 100644 index 00000000..6c57eb46 --- /dev/null +++ b/internal/integration_tests/mysql8/ismastermindstructablerecorder/VarcharTable.go @@ -0,0 +1,37 @@ +package dto + +import ( + "database/sql" + + "github.com/Masterminds/structable" +) + +type VarcharTable struct { + Col sql.NullString `stbl:"col"` + VarcharCap sql.NullString `stbl:"varchar_cap"` + VarcharNn string `stbl:"varchar_nn"` + VarcharNnUnique string `stbl:"varchar_nn_unique,PRIMARY_KEY"` + VarcharNnCheckCmp string `stbl:"varchar_nn_check_cmp"` + VarcharNnCheckFn string `stbl:"varchar_nn_check_fn"` + VarcharNnRef string `stbl:"varchar_nn_ref"` + VarcharNnDefConst string `stbl:"varchar_nn_def_const"` + VarcharNnDefFunc string `stbl:"varchar_nn_def_func"` + VarcharNnUniqueCheck string `stbl:"varchar_nn_unique_check"` + VarcharUnique sql.NullString `stbl:"varchar_unique"` + VarcharUniqueCheck sql.NullString `stbl:"varchar_unique_check"` + VarcharUniqueRef sql.NullString `stbl:"varchar_unique_ref"` + VarcharUniqueDefConst sql.NullString `stbl:"varchar_unique_def_const"` + VarcharUniqueDefFunc sql.NullString `stbl:"varchar_unique_def_func"` + VarcharCheck sql.NullString `stbl:"varchar_check"` + VarcharCheckRef sql.NullString `stbl:"varchar_check_ref"` + VarcharCheckDefConst sql.NullString `stbl:"varchar_check_def_const"` + VarcharCheckDefFunc sql.NullString `stbl:"varchar_check_def_func"` + VarcharRef sql.NullString `stbl:"varchar_ref"` + VarcharRefUniqueCheck sql.NullString `stbl:"varchar_ref_unique_check"` + VarcharDefConst sql.NullString `stbl:"varchar_def_const"` + VarcharDefConstUniqueCheck sql.NullString `stbl:"varchar_def_const_unique_check"` + VarcharDefFunc sql.NullString `stbl:"varchar_def_func"` + VarcharDefFuncUniqueCheck sql.NullString `stbl:"varchar_def_func_unique_check"` + + structable.Recorder +} diff --git a/internal/integration_tests/mysql8/noinitialism/User.go b/internal/integration_tests/mysql8/noinitialism/User.go new file mode 100644 index 00000000..ec9cddd2 --- /dev/null +++ b/internal/integration_tests/mysql8/noinitialism/User.go @@ -0,0 +1,11 @@ +package dto + +import ( + "database/sql" +) + +type User struct { + Id int `db:"id"` + UserId int `db:"user_id"` + WebsiteUrl sql.NullString `db:"website_url"` +} diff --git a/internal/integration_tests/mysql8/nulltypeprimitive/BigintCheckPk.go b/internal/integration_tests/mysql8/nulltypeprimitive/BigintCheckPk.go new file mode 100644 index 00000000..2474c3d5 --- /dev/null +++ b/internal/integration_tests/mysql8/nulltypeprimitive/BigintCheckPk.go @@ -0,0 +1,5 @@ +package dto + +type BigintCheckPk struct { + BigintCheckPk int `db:"bigint_check_pk"` +} diff --git a/internal/integration_tests/mysql8/nulltypeprimitive/BigintDefConstUniqueCheckPk.go b/internal/integration_tests/mysql8/nulltypeprimitive/BigintDefConstUniqueCheckPk.go new file mode 100644 index 00000000..808e31f2 --- /dev/null +++ b/internal/integration_tests/mysql8/nulltypeprimitive/BigintDefConstUniqueCheckPk.go @@ -0,0 +1,5 @@ +package dto + +type BigintDefConstUniqueCheckPk struct { + BigintDefConstUniqueCheckPk int `db:"bigint_def_const_unique_check_pk"` +} diff --git a/internal/integration_tests/mysql8/nulltypeprimitive/BigintDefConstUniqueCheckPkRef.go b/internal/integration_tests/mysql8/nulltypeprimitive/BigintDefConstUniqueCheckPkRef.go new file mode 100644 index 00000000..64fcb8c8 --- /dev/null +++ b/internal/integration_tests/mysql8/nulltypeprimitive/BigintDefConstUniqueCheckPkRef.go @@ -0,0 +1,5 @@ +package dto + +type BigintDefConstUniqueCheckPkRef struct { + BigintDefConstUniqueCheckPkRef int `db:"bigint_def_const_unique_check_pk_ref"` +} diff --git a/internal/integration_tests/mysql8/nulltypeprimitive/BigintDefFuncUniqueCheckPk.go b/internal/integration_tests/mysql8/nulltypeprimitive/BigintDefFuncUniqueCheckPk.go new file mode 100644 index 00000000..68117369 --- /dev/null +++ b/internal/integration_tests/mysql8/nulltypeprimitive/BigintDefFuncUniqueCheckPk.go @@ -0,0 +1,5 @@ +package dto + +type BigintDefFuncUniqueCheckPk struct { + BigintDefFuncUniqueCheckPk int `db:"bigint_def_func_unique_check_pk"` +} diff --git a/internal/integration_tests/mysql8/nulltypeprimitive/BigintDefFuncUniqueCheckPkRef.go b/internal/integration_tests/mysql8/nulltypeprimitive/BigintDefFuncUniqueCheckPkRef.go new file mode 100644 index 00000000..dbd5da9d --- /dev/null +++ b/internal/integration_tests/mysql8/nulltypeprimitive/BigintDefFuncUniqueCheckPkRef.go @@ -0,0 +1,5 @@ +package dto + +type BigintDefFuncUniqueCheckPkRef struct { + BigintDefFuncUniqueCheckPkRef int `db:"bigint_def_func_unique_check_pk_ref"` +} diff --git a/internal/integration_tests/mysql8/nulltypeprimitive/BigintNnPk.go b/internal/integration_tests/mysql8/nulltypeprimitive/BigintNnPk.go new file mode 100644 index 00000000..f4ddc4aa --- /dev/null +++ b/internal/integration_tests/mysql8/nulltypeprimitive/BigintNnPk.go @@ -0,0 +1,5 @@ +package dto + +type BigintNnPk struct { + BigintNnPk int `db:"bigint_nn_pk"` +} diff --git a/internal/integration_tests/mysql8/nulltypeprimitive/BigintNnUniqueCheckPk.go b/internal/integration_tests/mysql8/nulltypeprimitive/BigintNnUniqueCheckPk.go new file mode 100644 index 00000000..ce5d15c5 --- /dev/null +++ b/internal/integration_tests/mysql8/nulltypeprimitive/BigintNnUniqueCheckPk.go @@ -0,0 +1,5 @@ +package dto + +type BigintNnUniqueCheckPk struct { + BigintNnUniqueCheckPk int `db:"bigint_nn_unique_check_pk"` +} diff --git a/internal/integration_tests/mysql8/nulltypeprimitive/BigintNnUniqueCheckPkRef.go b/internal/integration_tests/mysql8/nulltypeprimitive/BigintNnUniqueCheckPkRef.go new file mode 100644 index 00000000..4c065777 --- /dev/null +++ b/internal/integration_tests/mysql8/nulltypeprimitive/BigintNnUniqueCheckPkRef.go @@ -0,0 +1,5 @@ +package dto + +type BigintNnUniqueCheckPkRef struct { + BigintNnUniqueCheckPkRef int `db:"bigint_nn_unique_check_pk_ref"` +} diff --git a/internal/integration_tests/mysql8/nulltypeprimitive/BigintPk.go b/internal/integration_tests/mysql8/nulltypeprimitive/BigintPk.go new file mode 100644 index 00000000..0b34e55b --- /dev/null +++ b/internal/integration_tests/mysql8/nulltypeprimitive/BigintPk.go @@ -0,0 +1,5 @@ +package dto + +type BigintPk struct { + BigintPk int `db:"bigint_pk"` +} diff --git a/internal/integration_tests/mysql8/nulltypeprimitive/BigintPkDefConst.go b/internal/integration_tests/mysql8/nulltypeprimitive/BigintPkDefConst.go new file mode 100644 index 00000000..08c26cbd --- /dev/null +++ b/internal/integration_tests/mysql8/nulltypeprimitive/BigintPkDefConst.go @@ -0,0 +1,5 @@ +package dto + +type BigintPkDefConst struct { + BigintPkDefConst int `db:"bigint_pk_def_const"` +} diff --git a/internal/integration_tests/mysql8/nulltypeprimitive/BigintPkDefFunc.go b/internal/integration_tests/mysql8/nulltypeprimitive/BigintPkDefFunc.go new file mode 100644 index 00000000..656fadc9 --- /dev/null +++ b/internal/integration_tests/mysql8/nulltypeprimitive/BigintPkDefFunc.go @@ -0,0 +1,5 @@ +package dto + +type BigintPkDefFunc struct { + BigintPkDefFunc int `db:"bigint_pk_def_func"` +} diff --git a/internal/integration_tests/mysql8/nulltypeprimitive/BigintPkRef.go b/internal/integration_tests/mysql8/nulltypeprimitive/BigintPkRef.go new file mode 100644 index 00000000..21608d8c --- /dev/null +++ b/internal/integration_tests/mysql8/nulltypeprimitive/BigintPkRef.go @@ -0,0 +1,5 @@ +package dto + +type BigintPkRef struct { + BigintPkRef int `db:"bigint_pk_ref"` +} diff --git a/internal/integration_tests/mysql8/nulltypeprimitive/BigintRef.go b/internal/integration_tests/mysql8/nulltypeprimitive/BigintRef.go new file mode 100644 index 00000000..377b5cd8 --- /dev/null +++ b/internal/integration_tests/mysql8/nulltypeprimitive/BigintRef.go @@ -0,0 +1,5 @@ +package dto + +type BigintRef struct { + BigintRef *int `db:"bigint_ref"` +} diff --git a/internal/integration_tests/mysql8/nulltypeprimitive/BigintTable.go b/internal/integration_tests/mysql8/nulltypeprimitive/BigintTable.go new file mode 100644 index 00000000..3b6df1fb --- /dev/null +++ b/internal/integration_tests/mysql8/nulltypeprimitive/BigintTable.go @@ -0,0 +1,23 @@ +package dto + +type BigintTable struct { + I *int `db:"i"` + BigintNn int `db:"bigint_nn"` + BigintNnUnique int `db:"bigint_nn_unique"` + BigintNnCheck int `db:"bigint_nn_check"` + BigintUnique *int `db:"bigint_unique"` + BigintUniqueCheck *int `db:"bigint_unique_check"` + BigintUniqueRef *int `db:"bigint_unique_ref"` + BigintUniqueDefConst *int `db:"bigint_unique_def_const"` + BigintUniqueDefFunc *int `db:"bigint_unique_def_func"` + BigintCheck *int `db:"bigint_check"` + BigintCheckRef *int `db:"bigint_check_ref"` + BigintCheckDefConst *int `db:"bigint_check_def_const"` + BigintCheckDefFunc *int `db:"bigint_check_def_func"` + BigintRef *int `db:"bigint_ref"` + BigintRefUniqueCheck *int `db:"bigint_ref_unique_check"` + BigintDefConst *int `db:"bigint_def_const"` + BigintDefConstUniqueCheck *int `db:"bigint_def_const_unique_check"` + BigintDefFunc *int `db:"bigint_def_func"` + BigintDefFuncUniqueCheck *int `db:"bigint_def_func_unique_check"` +} diff --git a/internal/integration_tests/mysql8/nulltypeprimitive/BigintUniqueCheckPk.go b/internal/integration_tests/mysql8/nulltypeprimitive/BigintUniqueCheckPk.go new file mode 100644 index 00000000..d2cd0c7e --- /dev/null +++ b/internal/integration_tests/mysql8/nulltypeprimitive/BigintUniqueCheckPk.go @@ -0,0 +1,5 @@ +package dto + +type BigintUniqueCheckPk struct { + BigintUniqueCheckPk int `db:"bigint_unique_check_pk"` +} diff --git a/internal/integration_tests/mysql8/nulltypeprimitive/BigintUniqueCheckPkRef.go b/internal/integration_tests/mysql8/nulltypeprimitive/BigintUniqueCheckPkRef.go new file mode 100644 index 00000000..f41b59bf --- /dev/null +++ b/internal/integration_tests/mysql8/nulltypeprimitive/BigintUniqueCheckPkRef.go @@ -0,0 +1,5 @@ +package dto + +type BigintUniqueCheckPkRef struct { + BigintUniqueCheckPkRef int `db:"bigint_unique_check_pk_ref"` +} diff --git a/internal/integration_tests/mysql8/nulltypeprimitive/BigintUniquePk.go b/internal/integration_tests/mysql8/nulltypeprimitive/BigintUniquePk.go new file mode 100644 index 00000000..06e50c8e --- /dev/null +++ b/internal/integration_tests/mysql8/nulltypeprimitive/BigintUniquePk.go @@ -0,0 +1,5 @@ +package dto + +type BigintUniquePk struct { + BigintUniquePk int `db:"bigint_unique_pk"` +} diff --git a/internal/integration_tests/mysql8/nulltypeprimitive/BinaryCheckPk.go b/internal/integration_tests/mysql8/nulltypeprimitive/BinaryCheckPk.go new file mode 100644 index 00000000..efa14dfd --- /dev/null +++ b/internal/integration_tests/mysql8/nulltypeprimitive/BinaryCheckPk.go @@ -0,0 +1,5 @@ +package dto + +type BinaryCheckPk struct { + BinaryCheckPk string `db:"binary_check_pk"` +} diff --git a/internal/integration_tests/mysql8/nulltypeprimitive/BinaryDefConstUniqueCheckPk.go b/internal/integration_tests/mysql8/nulltypeprimitive/BinaryDefConstUniqueCheckPk.go new file mode 100644 index 00000000..065a8a21 --- /dev/null +++ b/internal/integration_tests/mysql8/nulltypeprimitive/BinaryDefConstUniqueCheckPk.go @@ -0,0 +1,5 @@ +package dto + +type BinaryDefConstUniqueCheckPk struct { + BinaryDefConstUniqueCheckPk string `db:"binary_def_const_unique_check_pk"` +} diff --git a/internal/integration_tests/mysql8/nulltypeprimitive/BinaryDefConstUniqueCheckPkRef.go b/internal/integration_tests/mysql8/nulltypeprimitive/BinaryDefConstUniqueCheckPkRef.go new file mode 100644 index 00000000..5309fbd7 --- /dev/null +++ b/internal/integration_tests/mysql8/nulltypeprimitive/BinaryDefConstUniqueCheckPkRef.go @@ -0,0 +1,5 @@ +package dto + +type BinaryDefConstUniqueCheckPkRef struct { + BinaryDefConstUniqueCheckPkRef string `db:"binary_def_const_unique_check_pk_ref"` +} diff --git a/internal/integration_tests/mysql8/nulltypeprimitive/BinaryDefFuncUniqueCheckPk.go b/internal/integration_tests/mysql8/nulltypeprimitive/BinaryDefFuncUniqueCheckPk.go new file mode 100644 index 00000000..17d016cf --- /dev/null +++ b/internal/integration_tests/mysql8/nulltypeprimitive/BinaryDefFuncUniqueCheckPk.go @@ -0,0 +1,5 @@ +package dto + +type BinaryDefFuncUniqueCheckPk struct { + BinaryDefFuncUniqueCheckPk string `db:"binary_def_func_unique_check_pk"` +} diff --git a/internal/integration_tests/mysql8/nulltypeprimitive/BinaryDefFuncUniqueCheckPkRef.go b/internal/integration_tests/mysql8/nulltypeprimitive/BinaryDefFuncUniqueCheckPkRef.go new file mode 100644 index 00000000..8ad6c58e --- /dev/null +++ b/internal/integration_tests/mysql8/nulltypeprimitive/BinaryDefFuncUniqueCheckPkRef.go @@ -0,0 +1,5 @@ +package dto + +type BinaryDefFuncUniqueCheckPkRef struct { + BinaryDefFuncUniqueCheckPkRef string `db:"binary_def_func_unique_check_pk_ref"` +} diff --git a/internal/integration_tests/mysql8/nulltypeprimitive/BinaryNnPk.go b/internal/integration_tests/mysql8/nulltypeprimitive/BinaryNnPk.go new file mode 100644 index 00000000..3ed599f3 --- /dev/null +++ b/internal/integration_tests/mysql8/nulltypeprimitive/BinaryNnPk.go @@ -0,0 +1,5 @@ +package dto + +type BinaryNnPk struct { + BinaryNnPk string `db:"binary_nn_pk"` +} diff --git a/internal/integration_tests/mysql8/nulltypeprimitive/BinaryNnUniqueCheckPk.go b/internal/integration_tests/mysql8/nulltypeprimitive/BinaryNnUniqueCheckPk.go new file mode 100644 index 00000000..c2c3e783 --- /dev/null +++ b/internal/integration_tests/mysql8/nulltypeprimitive/BinaryNnUniqueCheckPk.go @@ -0,0 +1,5 @@ +package dto + +type BinaryNnUniqueCheckPk struct { + BinaryNnUniqueCheckPk string `db:"binary_nn_unique_check_pk"` +} diff --git a/internal/integration_tests/mysql8/nulltypeprimitive/BinaryNnUniqueCheckPkRef.go b/internal/integration_tests/mysql8/nulltypeprimitive/BinaryNnUniqueCheckPkRef.go new file mode 100644 index 00000000..d0c44d10 --- /dev/null +++ b/internal/integration_tests/mysql8/nulltypeprimitive/BinaryNnUniqueCheckPkRef.go @@ -0,0 +1,5 @@ +package dto + +type BinaryNnUniqueCheckPkRef struct { + BinaryNnUniqueCheckPkRef string `db:"binary_nn_unique_check_pk_ref"` +} diff --git a/internal/integration_tests/mysql8/nulltypeprimitive/BinaryPk.go b/internal/integration_tests/mysql8/nulltypeprimitive/BinaryPk.go new file mode 100644 index 00000000..6b5f9d3c --- /dev/null +++ b/internal/integration_tests/mysql8/nulltypeprimitive/BinaryPk.go @@ -0,0 +1,5 @@ +package dto + +type BinaryPk struct { + BinaryPk string `db:"binary_pk"` +} diff --git a/internal/integration_tests/mysql8/nulltypeprimitive/BinaryPkDefConst.go b/internal/integration_tests/mysql8/nulltypeprimitive/BinaryPkDefConst.go new file mode 100644 index 00000000..a82868f0 --- /dev/null +++ b/internal/integration_tests/mysql8/nulltypeprimitive/BinaryPkDefConst.go @@ -0,0 +1,5 @@ +package dto + +type BinaryPkDefConst struct { + BinaryPkDefConst string `db:"binary_pk_def_const"` +} diff --git a/internal/integration_tests/mysql8/nulltypeprimitive/BinaryPkDefFunc.go b/internal/integration_tests/mysql8/nulltypeprimitive/BinaryPkDefFunc.go new file mode 100644 index 00000000..6b3afc82 --- /dev/null +++ b/internal/integration_tests/mysql8/nulltypeprimitive/BinaryPkDefFunc.go @@ -0,0 +1,5 @@ +package dto + +type BinaryPkDefFunc struct { + BinaryPkDefFunc string `db:"binary_pk_def_func"` +} diff --git a/internal/integration_tests/mysql8/nulltypeprimitive/BinaryPkRef.go b/internal/integration_tests/mysql8/nulltypeprimitive/BinaryPkRef.go new file mode 100644 index 00000000..499cda7d --- /dev/null +++ b/internal/integration_tests/mysql8/nulltypeprimitive/BinaryPkRef.go @@ -0,0 +1,5 @@ +package dto + +type BinaryPkRef struct { + BinaryPkRef string `db:"binary_pk_ref"` +} diff --git a/internal/integration_tests/mysql8/nulltypeprimitive/BinaryRef.go b/internal/integration_tests/mysql8/nulltypeprimitive/BinaryRef.go new file mode 100644 index 00000000..17601d67 --- /dev/null +++ b/internal/integration_tests/mysql8/nulltypeprimitive/BinaryRef.go @@ -0,0 +1,5 @@ +package dto + +type BinaryRef struct { + BinaryRef *string `db:"binary_ref"` +} diff --git a/internal/integration_tests/mysql8/nulltypeprimitive/BinaryTable.go b/internal/integration_tests/mysql8/nulltypeprimitive/BinaryTable.go new file mode 100644 index 00000000..9e90a6d7 --- /dev/null +++ b/internal/integration_tests/mysql8/nulltypeprimitive/BinaryTable.go @@ -0,0 +1,29 @@ +package dto + +type BinaryTable struct { + Col *string `db:"col"` + BinaryCap *string `db:"binary_cap"` + BinaryNn string `db:"binary_nn"` + BinaryNnUnique string `db:"binary_nn_unique"` + BinaryNnCheckCmp string `db:"binary_nn_check_cmp"` + BinaryNnCheckFn string `db:"binary_nn_check_fn"` + BinaryNnRef string `db:"binary_nn_ref"` + BinaryNnDefConst string `db:"binary_nn_def_const"` + BinaryNnDefFunc string `db:"binary_nn_def_func"` + BinaryNnUniqueCheck string `db:"binary_nn_unique_check"` + BinaryUnique *string `db:"binary_unique"` + BinaryUniqueCheck *string `db:"binary_unique_check"` + BinaryUniqueRef *string `db:"binary_unique_ref"` + BinaryUniqueDefConst *string `db:"binary_unique_def_const"` + BinaryUniqueDefFunc *string `db:"binary_unique_def_func"` + BinaryCheck *string `db:"binary_check"` + BinaryCheckRef *string `db:"binary_check_ref"` + BinaryCheckDefConst *string `db:"binary_check_def_const"` + BinaryCheckDefFunc *string `db:"binary_check_def_func"` + BinaryRef *string `db:"binary_ref"` + BinaryRefUniqueCheck *string `db:"binary_ref_unique_check"` + BinaryDefConst *string `db:"binary_def_const"` + BinaryDefConstUniqueCheck *string `db:"binary_def_const_unique_check"` + BinaryDefFunc *string `db:"binary_def_func"` + BinaryDefFuncUniqueCheck *string `db:"binary_def_func_unique_check"` +} diff --git a/internal/integration_tests/mysql8/nulltypeprimitive/BinaryUniqueCheckPk.go b/internal/integration_tests/mysql8/nulltypeprimitive/BinaryUniqueCheckPk.go new file mode 100644 index 00000000..b52b07de --- /dev/null +++ b/internal/integration_tests/mysql8/nulltypeprimitive/BinaryUniqueCheckPk.go @@ -0,0 +1,5 @@ +package dto + +type BinaryUniqueCheckPk struct { + BinaryUniqueCheckPk string `db:"binary_unique_check_pk"` +} diff --git a/internal/integration_tests/mysql8/nulltypeprimitive/BinaryUniqueCheckPkRef.go b/internal/integration_tests/mysql8/nulltypeprimitive/BinaryUniqueCheckPkRef.go new file mode 100644 index 00000000..87df9f43 --- /dev/null +++ b/internal/integration_tests/mysql8/nulltypeprimitive/BinaryUniqueCheckPkRef.go @@ -0,0 +1,5 @@ +package dto + +type BinaryUniqueCheckPkRef struct { + BinaryUniqueCheckPkRef string `db:"binary_unique_check_pk_ref"` +} diff --git a/internal/integration_tests/mysql8/nulltypeprimitive/BinaryUniquePk.go b/internal/integration_tests/mysql8/nulltypeprimitive/BinaryUniquePk.go new file mode 100644 index 00000000..f6700a1c --- /dev/null +++ b/internal/integration_tests/mysql8/nulltypeprimitive/BinaryUniquePk.go @@ -0,0 +1,5 @@ +package dto + +type BinaryUniquePk struct { + BinaryUniquePk string `db:"binary_unique_pk"` +} diff --git a/internal/integration_tests/mysql8/nulltypeprimitive/BlobRef.go b/internal/integration_tests/mysql8/nulltypeprimitive/BlobRef.go new file mode 100644 index 00000000..31a8025d --- /dev/null +++ b/internal/integration_tests/mysql8/nulltypeprimitive/BlobRef.go @@ -0,0 +1,5 @@ +package dto + +type BlobRef struct { + BlobRef string `db:"blob_ref"` +} diff --git a/internal/integration_tests/mysql8/nulltypeprimitive/BlobTable.go b/internal/integration_tests/mysql8/nulltypeprimitive/BlobTable.go new file mode 100644 index 00000000..b17d85a1 --- /dev/null +++ b/internal/integration_tests/mysql8/nulltypeprimitive/BlobTable.go @@ -0,0 +1,18 @@ +package dto + +type BlobTable struct { + Col *string `db:"col"` + BlobDefConst *string `db:"blob_def_const"` + BlobDefFunc *string `db:"blob_def_func"` + BlobRef *string `db:"blob_ref"` + BlobNn string `db:"blob_nn"` + BlobNnCheckCmp string `db:"blob_nn_check_cmp"` + BlobNnCheckFn string `db:"blob_nn_check_fn"` + BlobNnRef string `db:"blob_nn_ref"` + BlobNnDefConst string `db:"blob_nn_def_const"` + BlobNnDefFunc string `db:"blob_nn_def_func"` + BlobCheck *string `db:"blob_check"` + BlobCheckRef *string `db:"blob_check_ref"` + BlobCheckDefConst *string `db:"blob_check_def_const"` + BlobCheckDefFunc *string `db:"blob_check_def_func"` +} diff --git a/internal/integration_tests/mysql8/nulltypeprimitive/CharCheckPk.go b/internal/integration_tests/mysql8/nulltypeprimitive/CharCheckPk.go new file mode 100644 index 00000000..3fced3dc --- /dev/null +++ b/internal/integration_tests/mysql8/nulltypeprimitive/CharCheckPk.go @@ -0,0 +1,5 @@ +package dto + +type CharCheckPk struct { + CharCheckPk string `db:"char_check_pk"` +} diff --git a/internal/integration_tests/mysql8/nulltypeprimitive/CharDefConstUniqueCheckPk.go b/internal/integration_tests/mysql8/nulltypeprimitive/CharDefConstUniqueCheckPk.go new file mode 100644 index 00000000..3c69f6ff --- /dev/null +++ b/internal/integration_tests/mysql8/nulltypeprimitive/CharDefConstUniqueCheckPk.go @@ -0,0 +1,5 @@ +package dto + +type CharDefConstUniqueCheckPk struct { + CharDefConstUniqueCheckPk string `db:"char_def_const_unique_check_pk"` +} diff --git a/internal/integration_tests/mysql8/nulltypeprimitive/CharDefConstUniqueCheckPkRef.go b/internal/integration_tests/mysql8/nulltypeprimitive/CharDefConstUniqueCheckPkRef.go new file mode 100644 index 00000000..6b29a7e6 --- /dev/null +++ b/internal/integration_tests/mysql8/nulltypeprimitive/CharDefConstUniqueCheckPkRef.go @@ -0,0 +1,5 @@ +package dto + +type CharDefConstUniqueCheckPkRef struct { + CharDefConstUniqueCheckPkRef string `db:"char_def_const_unique_check_pk_ref"` +} diff --git a/internal/integration_tests/mysql8/nulltypeprimitive/CharDefFuncUniqueCheckPk.go b/internal/integration_tests/mysql8/nulltypeprimitive/CharDefFuncUniqueCheckPk.go new file mode 100644 index 00000000..45d10db8 --- /dev/null +++ b/internal/integration_tests/mysql8/nulltypeprimitive/CharDefFuncUniqueCheckPk.go @@ -0,0 +1,5 @@ +package dto + +type CharDefFuncUniqueCheckPk struct { + CharDefFuncUniqueCheckPk string `db:"char_def_func_unique_check_pk"` +} diff --git a/internal/integration_tests/mysql8/nulltypeprimitive/CharDefFuncUniqueCheckPkRef.go b/internal/integration_tests/mysql8/nulltypeprimitive/CharDefFuncUniqueCheckPkRef.go new file mode 100644 index 00000000..43d48b6b --- /dev/null +++ b/internal/integration_tests/mysql8/nulltypeprimitive/CharDefFuncUniqueCheckPkRef.go @@ -0,0 +1,5 @@ +package dto + +type CharDefFuncUniqueCheckPkRef struct { + CharDefFuncUniqueCheckPkRef string `db:"char_def_func_unique_check_pk_ref"` +} diff --git a/internal/integration_tests/mysql8/nulltypeprimitive/CharNnPk.go b/internal/integration_tests/mysql8/nulltypeprimitive/CharNnPk.go new file mode 100644 index 00000000..309e6e87 --- /dev/null +++ b/internal/integration_tests/mysql8/nulltypeprimitive/CharNnPk.go @@ -0,0 +1,5 @@ +package dto + +type CharNnPk struct { + CharNnPk string `db:"char_nn_pk"` +} diff --git a/internal/integration_tests/mysql8/nulltypeprimitive/CharNnUniqueCheckPk.go b/internal/integration_tests/mysql8/nulltypeprimitive/CharNnUniqueCheckPk.go new file mode 100644 index 00000000..0ffe2059 --- /dev/null +++ b/internal/integration_tests/mysql8/nulltypeprimitive/CharNnUniqueCheckPk.go @@ -0,0 +1,5 @@ +package dto + +type CharNnUniqueCheckPk struct { + CharNnUniqueCheckPk string `db:"char_nn_unique_check_pk"` +} diff --git a/internal/integration_tests/mysql8/nulltypeprimitive/CharNnUniqueCheckPkRef.go b/internal/integration_tests/mysql8/nulltypeprimitive/CharNnUniqueCheckPkRef.go new file mode 100644 index 00000000..62f9b39b --- /dev/null +++ b/internal/integration_tests/mysql8/nulltypeprimitive/CharNnUniqueCheckPkRef.go @@ -0,0 +1,5 @@ +package dto + +type CharNnUniqueCheckPkRef struct { + CharNnUniqueCheckPkRef string `db:"char_nn_unique_check_pk_ref"` +} diff --git a/internal/integration_tests/mysql8/nulltypeprimitive/CharPk.go b/internal/integration_tests/mysql8/nulltypeprimitive/CharPk.go new file mode 100644 index 00000000..82d769ca --- /dev/null +++ b/internal/integration_tests/mysql8/nulltypeprimitive/CharPk.go @@ -0,0 +1,5 @@ +package dto + +type CharPk struct { + CharPk string `db:"char_pk"` +} diff --git a/internal/integration_tests/mysql8/nulltypeprimitive/CharPkDefConst.go b/internal/integration_tests/mysql8/nulltypeprimitive/CharPkDefConst.go new file mode 100644 index 00000000..e386cc95 --- /dev/null +++ b/internal/integration_tests/mysql8/nulltypeprimitive/CharPkDefConst.go @@ -0,0 +1,5 @@ +package dto + +type CharPkDefConst struct { + CharPkDefConst string `db:"char_pk_def_const"` +} diff --git a/internal/integration_tests/mysql8/nulltypeprimitive/CharPkDefFunc.go b/internal/integration_tests/mysql8/nulltypeprimitive/CharPkDefFunc.go new file mode 100644 index 00000000..24a1d17a --- /dev/null +++ b/internal/integration_tests/mysql8/nulltypeprimitive/CharPkDefFunc.go @@ -0,0 +1,5 @@ +package dto + +type CharPkDefFunc struct { + CharPkDefFunc string `db:"char_pk_def_func"` +} diff --git a/internal/integration_tests/mysql8/nulltypeprimitive/CharPkRef.go b/internal/integration_tests/mysql8/nulltypeprimitive/CharPkRef.go new file mode 100644 index 00000000..aed73b7d --- /dev/null +++ b/internal/integration_tests/mysql8/nulltypeprimitive/CharPkRef.go @@ -0,0 +1,5 @@ +package dto + +type CharPkRef struct { + CharPkRef string `db:"char_pk_ref"` +} diff --git a/internal/integration_tests/mysql8/nulltypeprimitive/CharRef.go b/internal/integration_tests/mysql8/nulltypeprimitive/CharRef.go new file mode 100644 index 00000000..369a1e00 --- /dev/null +++ b/internal/integration_tests/mysql8/nulltypeprimitive/CharRef.go @@ -0,0 +1,5 @@ +package dto + +type CharRef struct { + CharRef *string `db:"char_ref"` +} diff --git a/internal/integration_tests/mysql8/nulltypeprimitive/CharTable.go b/internal/integration_tests/mysql8/nulltypeprimitive/CharTable.go new file mode 100644 index 00000000..60bf019b --- /dev/null +++ b/internal/integration_tests/mysql8/nulltypeprimitive/CharTable.go @@ -0,0 +1,29 @@ +package dto + +type CharTable struct { + Col *string `db:"col"` + CharCap *string `db:"char_cap"` + CharNn string `db:"char_nn"` + CharNnUnique string `db:"char_nn_unique"` + CharNnCheckCmp string `db:"char_nn_check_cmp"` + CharNnCheckFn string `db:"char_nn_check_fn"` + CharNnRef string `db:"char_nn_ref"` + CharNnDefConst string `db:"char_nn_def_const"` + CharNnDefFunc string `db:"char_nn_def_func"` + CharNnUniqueCheck string `db:"char_nn_unique_check"` + CharUnique *string `db:"char_unique"` + CharUniqueCheck *string `db:"char_unique_check"` + CharUniqueRef *string `db:"char_unique_ref"` + CharUniqueDefConst *string `db:"char_unique_def_const"` + CharUniqueDefFunc *string `db:"char_unique_def_func"` + CharCheck *string `db:"char_check"` + CharCheckRef *string `db:"char_check_ref"` + CharCheckDefConst *string `db:"char_check_def_const"` + CharCheckDefFunc *string `db:"char_check_def_func"` + CharRef *string `db:"char_ref"` + CharRefUniqueCheck *string `db:"char_ref_unique_check"` + CharDefConst *string `db:"char_def_const"` + CharDefConstUniqueCheck *string `db:"char_def_const_unique_check"` + CharDefFunc *string `db:"char_def_func"` + CharDefFuncUniqueCheck *string `db:"char_def_func_unique_check"` +} diff --git a/internal/integration_tests/mysql8/nulltypeprimitive/CharUniqueCheckPk.go b/internal/integration_tests/mysql8/nulltypeprimitive/CharUniqueCheckPk.go new file mode 100644 index 00000000..3a27898a --- /dev/null +++ b/internal/integration_tests/mysql8/nulltypeprimitive/CharUniqueCheckPk.go @@ -0,0 +1,5 @@ +package dto + +type CharUniqueCheckPk struct { + CharUniqueCheckPk string `db:"char_unique_check_pk"` +} diff --git a/internal/integration_tests/mysql8/nulltypeprimitive/CharUniqueCheckPkRef.go b/internal/integration_tests/mysql8/nulltypeprimitive/CharUniqueCheckPkRef.go new file mode 100644 index 00000000..47939972 --- /dev/null +++ b/internal/integration_tests/mysql8/nulltypeprimitive/CharUniqueCheckPkRef.go @@ -0,0 +1,5 @@ +package dto + +type CharUniqueCheckPkRef struct { + CharUniqueCheckPkRef string `db:"char_unique_check_pk_ref"` +} diff --git a/internal/integration_tests/mysql8/nulltypeprimitive/CharUniquePk.go b/internal/integration_tests/mysql8/nulltypeprimitive/CharUniquePk.go new file mode 100644 index 00000000..27407394 --- /dev/null +++ b/internal/integration_tests/mysql8/nulltypeprimitive/CharUniquePk.go @@ -0,0 +1,5 @@ +package dto + +type CharUniquePk struct { + CharUniquePk string `db:"char_unique_pk"` +} diff --git a/internal/integration_tests/mysql8/nulltypeprimitive/ConstraintComboNonPk.go b/internal/integration_tests/mysql8/nulltypeprimitive/ConstraintComboNonPk.go new file mode 100644 index 00000000..575d9778 --- /dev/null +++ b/internal/integration_tests/mysql8/nulltypeprimitive/ConstraintComboNonPk.go @@ -0,0 +1,16 @@ +package dto + +type ConstraintComboNonPk struct { + NotNullUniqueCheckDefConst float64 `db:"not_null_unique_check_def_const"` + NotNullUniqueCheckDefFunc float64 `db:"not_null_unique_check_def_func"` + NotNullUniqueRefDefConst float64 `db:"not_null_unique_ref_def_const"` + NotNullUniqueRefDefFunc float64 `db:"not_null_unique_ref_def_func"` + NotNullCheckRefDefConst float64 `db:"not_null_check_ref_def_const"` + NotNullCheckRefDefFunc float64 `db:"not_null_check_ref_def_func"` + NotNullUniqueDefConst float64 `db:"not_null_unique_def_const"` + NotNullUniqueDefFunc float64 `db:"not_null_unique_def_func"` + NotNullCheckDefConst float64 `db:"not_null_check_def_const"` + NotNullCheckDefFunc float64 `db:"not_null_check_def_func"` + NotNullRefDefConst float64 `db:"not_null_ref_def_const"` + NotNullRefDefFunc float64 `db:"not_null_ref_def_func"` +} diff --git a/internal/integration_tests/mysql8/nulltypeprimitive/ConstraintComboNotNullCheckPkDefConst.go b/internal/integration_tests/mysql8/nulltypeprimitive/ConstraintComboNotNullCheckPkDefConst.go new file mode 100644 index 00000000..4aa890ba --- /dev/null +++ b/internal/integration_tests/mysql8/nulltypeprimitive/ConstraintComboNotNullCheckPkDefConst.go @@ -0,0 +1,5 @@ +package dto + +type ConstraintComboNotNullCheckPkDefConst struct { + ConstraintComboNotNullCheckPkDefConst float64 `db:"constraint_combo_not_null_check_pk_def_const"` +} diff --git a/internal/integration_tests/mysql8/nulltypeprimitive/ConstraintComboNotNullCheckPkDefFunc.go b/internal/integration_tests/mysql8/nulltypeprimitive/ConstraintComboNotNullCheckPkDefFunc.go new file mode 100644 index 00000000..dce0d8b3 --- /dev/null +++ b/internal/integration_tests/mysql8/nulltypeprimitive/ConstraintComboNotNullCheckPkDefFunc.go @@ -0,0 +1,5 @@ +package dto + +type ConstraintComboNotNullCheckPkDefFunc struct { + ConstraintComboNotNullCheckPkDefFunc float64 `db:"constraint_combo_not_null_check_pk_def_func"` +} diff --git a/internal/integration_tests/mysql8/nulltypeprimitive/ConstraintComboNotNullPkDefConst.go b/internal/integration_tests/mysql8/nulltypeprimitive/ConstraintComboNotNullPkDefConst.go new file mode 100644 index 00000000..ca059e7a --- /dev/null +++ b/internal/integration_tests/mysql8/nulltypeprimitive/ConstraintComboNotNullPkDefConst.go @@ -0,0 +1,5 @@ +package dto + +type ConstraintComboNotNullPkDefConst struct { + ConstraintComboNotNullPkDefConst float64 `db:"constraint_combo_not_null_pk_def_const"` +} diff --git a/internal/integration_tests/mysql8/nulltypeprimitive/ConstraintComboNotNullPkDefFunc.go b/internal/integration_tests/mysql8/nulltypeprimitive/ConstraintComboNotNullPkDefFunc.go new file mode 100644 index 00000000..5bb0b531 --- /dev/null +++ b/internal/integration_tests/mysql8/nulltypeprimitive/ConstraintComboNotNullPkDefFunc.go @@ -0,0 +1,5 @@ +package dto + +type ConstraintComboNotNullPkDefFunc struct { + ConstraintComboNotNullPkDefFunc float64 `db:"constraint_combo_not_null_pk_def_func"` +} diff --git a/internal/integration_tests/mysql8/nulltypeprimitive/ConstraintComboNotNullPkRefDefConst.go b/internal/integration_tests/mysql8/nulltypeprimitive/ConstraintComboNotNullPkRefDefConst.go new file mode 100644 index 00000000..4bd7ce91 --- /dev/null +++ b/internal/integration_tests/mysql8/nulltypeprimitive/ConstraintComboNotNullPkRefDefConst.go @@ -0,0 +1,5 @@ +package dto + +type ConstraintComboNotNullPkRefDefConst struct { + ConstraintComboNotNullPkRefDefConst float64 `db:"constraint_combo_not_null_pk_ref_def_const"` +} diff --git a/internal/integration_tests/mysql8/nulltypeprimitive/ConstraintComboNotNullPkRefDefFunc.go b/internal/integration_tests/mysql8/nulltypeprimitive/ConstraintComboNotNullPkRefDefFunc.go new file mode 100644 index 00000000..72c2299b --- /dev/null +++ b/internal/integration_tests/mysql8/nulltypeprimitive/ConstraintComboNotNullPkRefDefFunc.go @@ -0,0 +1,5 @@ +package dto + +type ConstraintComboNotNullPkRefDefFunc struct { + ConstraintComboNotNullPkRefDefFunc float64 `db:"constraint_combo_not_null_pk_ref_def_func"` +} diff --git a/internal/integration_tests/mysql8/nulltypeprimitive/ConstraintComboNotNullUniquePkDefConst.go b/internal/integration_tests/mysql8/nulltypeprimitive/ConstraintComboNotNullUniquePkDefConst.go new file mode 100644 index 00000000..b195d769 --- /dev/null +++ b/internal/integration_tests/mysql8/nulltypeprimitive/ConstraintComboNotNullUniquePkDefConst.go @@ -0,0 +1,5 @@ +package dto + +type ConstraintComboNotNullUniquePkDefConst struct { + ConstraintComboNotNullUniquePkDefConst float64 `db:"constraint_combo_not_null_unique_pk_def_const"` +} diff --git a/internal/integration_tests/mysql8/nulltypeprimitive/ConstraintComboNotNullUniquePkDefFunc.go b/internal/integration_tests/mysql8/nulltypeprimitive/ConstraintComboNotNullUniquePkDefFunc.go new file mode 100644 index 00000000..845d6231 --- /dev/null +++ b/internal/integration_tests/mysql8/nulltypeprimitive/ConstraintComboNotNullUniquePkDefFunc.go @@ -0,0 +1,5 @@ +package dto + +type ConstraintComboNotNullUniquePkDefFunc struct { + ConstraintComboNotNullUniquePkDefFunc float64 `db:"constraint_combo_not_null_unique_pk_def_func"` +} diff --git a/internal/integration_tests/mysql8/nulltypeprimitive/ConstraintComboRef.go b/internal/integration_tests/mysql8/nulltypeprimitive/ConstraintComboRef.go new file mode 100644 index 00000000..85387cf7 --- /dev/null +++ b/internal/integration_tests/mysql8/nulltypeprimitive/ConstraintComboRef.go @@ -0,0 +1,5 @@ +package dto + +type ConstraintComboRef struct { + ConstraintComboRef *float64 `db:"constraint_combo_ref"` +} diff --git a/internal/integration_tests/mysql8/nulltypeprimitive/DateCheckPk.go b/internal/integration_tests/mysql8/nulltypeprimitive/DateCheckPk.go new file mode 100644 index 00000000..6cb1844e --- /dev/null +++ b/internal/integration_tests/mysql8/nulltypeprimitive/DateCheckPk.go @@ -0,0 +1,9 @@ +package dto + +import ( + "time" +) + +type DateCheckPk struct { + DateCheckPk time.Time `db:"date_check_pk"` +} diff --git a/internal/integration_tests/mysql8/nulltypeprimitive/DateDefConstUniqueCheckPk.go b/internal/integration_tests/mysql8/nulltypeprimitive/DateDefConstUniqueCheckPk.go new file mode 100644 index 00000000..e07a7ed5 --- /dev/null +++ b/internal/integration_tests/mysql8/nulltypeprimitive/DateDefConstUniqueCheckPk.go @@ -0,0 +1,9 @@ +package dto + +import ( + "time" +) + +type DateDefConstUniqueCheckPk struct { + DateDefConstUniqueCheckPk time.Time `db:"date_def_const_unique_check_pk"` +} diff --git a/internal/integration_tests/mysql8/nulltypeprimitive/DateDefConstUniqueCheckPkRef.go b/internal/integration_tests/mysql8/nulltypeprimitive/DateDefConstUniqueCheckPkRef.go new file mode 100644 index 00000000..3b99928e --- /dev/null +++ b/internal/integration_tests/mysql8/nulltypeprimitive/DateDefConstUniqueCheckPkRef.go @@ -0,0 +1,9 @@ +package dto + +import ( + "time" +) + +type DateDefConstUniqueCheckPkRef struct { + DateDefConstUniqueCheckPkRef time.Time `db:"date_def_const_unique_check_pk_ref"` +} diff --git a/internal/integration_tests/mysql8/nulltypeprimitive/DateDefFuncUniqueCheckPk.go b/internal/integration_tests/mysql8/nulltypeprimitive/DateDefFuncUniqueCheckPk.go new file mode 100644 index 00000000..12934d64 --- /dev/null +++ b/internal/integration_tests/mysql8/nulltypeprimitive/DateDefFuncUniqueCheckPk.go @@ -0,0 +1,9 @@ +package dto + +import ( + "time" +) + +type DateDefFuncUniqueCheckPk struct { + DateDefFuncUniqueCheckPk time.Time `db:"date_def_func_unique_check_pk"` +} diff --git a/internal/integration_tests/mysql8/nulltypeprimitive/DateDefFuncUniqueCheckPkRef.go b/internal/integration_tests/mysql8/nulltypeprimitive/DateDefFuncUniqueCheckPkRef.go new file mode 100644 index 00000000..19ed2d94 --- /dev/null +++ b/internal/integration_tests/mysql8/nulltypeprimitive/DateDefFuncUniqueCheckPkRef.go @@ -0,0 +1,9 @@ +package dto + +import ( + "time" +) + +type DateDefFuncUniqueCheckPkRef struct { + DateDefFuncUniqueCheckPkRef time.Time `db:"date_def_func_unique_check_pk_ref"` +} diff --git a/internal/integration_tests/mysql8/nulltypeprimitive/DateNnPk.go b/internal/integration_tests/mysql8/nulltypeprimitive/DateNnPk.go new file mode 100644 index 00000000..24f7dc12 --- /dev/null +++ b/internal/integration_tests/mysql8/nulltypeprimitive/DateNnPk.go @@ -0,0 +1,9 @@ +package dto + +import ( + "time" +) + +type DateNnPk struct { + DateNnPk time.Time `db:"date_nn_pk"` +} diff --git a/internal/integration_tests/mysql8/nulltypeprimitive/DateNnUniqueCheckPk.go b/internal/integration_tests/mysql8/nulltypeprimitive/DateNnUniqueCheckPk.go new file mode 100644 index 00000000..162ceee5 --- /dev/null +++ b/internal/integration_tests/mysql8/nulltypeprimitive/DateNnUniqueCheckPk.go @@ -0,0 +1,9 @@ +package dto + +import ( + "time" +) + +type DateNnUniqueCheckPk struct { + DateNnUniqueCheckPk time.Time `db:"date_nn_unique_check_pk"` +} diff --git a/internal/integration_tests/mysql8/nulltypeprimitive/DateNnUniqueCheckPkRef.go b/internal/integration_tests/mysql8/nulltypeprimitive/DateNnUniqueCheckPkRef.go new file mode 100644 index 00000000..57c61fce --- /dev/null +++ b/internal/integration_tests/mysql8/nulltypeprimitive/DateNnUniqueCheckPkRef.go @@ -0,0 +1,9 @@ +package dto + +import ( + "time" +) + +type DateNnUniqueCheckPkRef struct { + DateNnUniqueCheckPkRef time.Time `db:"date_nn_unique_check_pk_ref"` +} diff --git a/internal/integration_tests/mysql8/nulltypeprimitive/DatePk.go b/internal/integration_tests/mysql8/nulltypeprimitive/DatePk.go new file mode 100644 index 00000000..d006be42 --- /dev/null +++ b/internal/integration_tests/mysql8/nulltypeprimitive/DatePk.go @@ -0,0 +1,9 @@ +package dto + +import ( + "time" +) + +type DatePk struct { + DatePk time.Time `db:"date_pk"` +} diff --git a/internal/integration_tests/mysql8/nulltypeprimitive/DatePkDefConst.go b/internal/integration_tests/mysql8/nulltypeprimitive/DatePkDefConst.go new file mode 100644 index 00000000..b10866e0 --- /dev/null +++ b/internal/integration_tests/mysql8/nulltypeprimitive/DatePkDefConst.go @@ -0,0 +1,9 @@ +package dto + +import ( + "time" +) + +type DatePkDefConst struct { + DatePkDefConst time.Time `db:"date_pk_def_const"` +} diff --git a/internal/integration_tests/mysql8/nulltypeprimitive/DatePkDefFunc.go b/internal/integration_tests/mysql8/nulltypeprimitive/DatePkDefFunc.go new file mode 100644 index 00000000..133d388a --- /dev/null +++ b/internal/integration_tests/mysql8/nulltypeprimitive/DatePkDefFunc.go @@ -0,0 +1,9 @@ +package dto + +import ( + "time" +) + +type DatePkDefFunc struct { + DatePkDefFunc time.Time `db:"date_pk_def_func"` +} diff --git a/internal/integration_tests/mysql8/nulltypeprimitive/DatePkRef.go b/internal/integration_tests/mysql8/nulltypeprimitive/DatePkRef.go new file mode 100644 index 00000000..e4f6d521 --- /dev/null +++ b/internal/integration_tests/mysql8/nulltypeprimitive/DatePkRef.go @@ -0,0 +1,9 @@ +package dto + +import ( + "time" +) + +type DatePkRef struct { + DatePkRef time.Time `db:"date_pk_ref"` +} diff --git a/internal/integration_tests/mysql8/nulltypeprimitive/DateRef.go b/internal/integration_tests/mysql8/nulltypeprimitive/DateRef.go new file mode 100644 index 00000000..31d25216 --- /dev/null +++ b/internal/integration_tests/mysql8/nulltypeprimitive/DateRef.go @@ -0,0 +1,9 @@ +package dto + +import ( + "time" +) + +type DateRef struct { + DateRef *time.Time `db:"date_ref"` +} diff --git a/internal/integration_tests/mysql8/nulltypeprimitive/DateTable.go b/internal/integration_tests/mysql8/nulltypeprimitive/DateTable.go new file mode 100644 index 00000000..8b1acfb8 --- /dev/null +++ b/internal/integration_tests/mysql8/nulltypeprimitive/DateTable.go @@ -0,0 +1,31 @@ +package dto + +import ( + "time" +) + +type DateTable struct { + Date *time.Time `db:"date"` + DateNn time.Time `db:"date_nn"` + DateNnUnique time.Time `db:"date_nn_unique"` + DateNnCheck time.Time `db:"date_nn_check"` + DateNnRef time.Time `db:"date_nn_ref"` + DateNnDefConst time.Time `db:"date_nn_def_const"` + DateNnDefFunc time.Time `db:"date_nn_def_func"` + DateNnUniqueCheck time.Time `db:"date_nn_unique_check"` + DateUnique *time.Time `db:"date_unique"` + DateUniqueCheck *time.Time `db:"date_unique_check"` + DateUniqueRef *time.Time `db:"date_unique_ref"` + DateUniqueDefConst *time.Time `db:"date_unique_def_const"` + DateUniqueDefFunc *time.Time `db:"date_unique_def_func"` + DateCheck *time.Time `db:"date_check"` + DateCheckRef *time.Time `db:"date_check_ref"` + DateCheckDefConst *time.Time `db:"date_check_def_const"` + DateCheckDefFunc *time.Time `db:"date_check_def_func"` + DateRef *time.Time `db:"date_ref"` + DateRefUniqueCheck *time.Time `db:"date_ref_unique_check"` + DateDefConst *time.Time `db:"date_def_const"` + DateDefConstUniqueCheck *time.Time `db:"date_def_const_unique_check"` + DateDefFunc *time.Time `db:"date_def_func"` + DateDefFuncUniqueCheck *time.Time `db:"date_def_func_unique_check"` +} diff --git a/internal/integration_tests/mysql8/nulltypeprimitive/DateUniqueCheckPk.go b/internal/integration_tests/mysql8/nulltypeprimitive/DateUniqueCheckPk.go new file mode 100644 index 00000000..de81a9ee --- /dev/null +++ b/internal/integration_tests/mysql8/nulltypeprimitive/DateUniqueCheckPk.go @@ -0,0 +1,9 @@ +package dto + +import ( + "time" +) + +type DateUniqueCheckPk struct { + DateUniqueCheckPk time.Time `db:"date_unique_check_pk"` +} diff --git a/internal/integration_tests/mysql8/nulltypeprimitive/DateUniqueCheckPkRef.go b/internal/integration_tests/mysql8/nulltypeprimitive/DateUniqueCheckPkRef.go new file mode 100644 index 00000000..9c44f9cd --- /dev/null +++ b/internal/integration_tests/mysql8/nulltypeprimitive/DateUniqueCheckPkRef.go @@ -0,0 +1,9 @@ +package dto + +import ( + "time" +) + +type DateUniqueCheckPkRef struct { + DateUniqueCheckPkRef time.Time `db:"date_unique_check_pk_ref"` +} diff --git a/internal/integration_tests/mysql8/nulltypeprimitive/DateUniquePk.go b/internal/integration_tests/mysql8/nulltypeprimitive/DateUniquePk.go new file mode 100644 index 00000000..8a2081d9 --- /dev/null +++ b/internal/integration_tests/mysql8/nulltypeprimitive/DateUniquePk.go @@ -0,0 +1,9 @@ +package dto + +import ( + "time" +) + +type DateUniquePk struct { + DateUniquePk time.Time `db:"date_unique_pk"` +} diff --git a/internal/integration_tests/mysql8/nulltypeprimitive/DatetimeCheckPk.go b/internal/integration_tests/mysql8/nulltypeprimitive/DatetimeCheckPk.go new file mode 100644 index 00000000..94283788 --- /dev/null +++ b/internal/integration_tests/mysql8/nulltypeprimitive/DatetimeCheckPk.go @@ -0,0 +1,9 @@ +package dto + +import ( + "time" +) + +type DatetimeCheckPk struct { + DatetimeCheckPk time.Time `db:"datetime_check_pk"` +} diff --git a/internal/integration_tests/mysql8/nulltypeprimitive/DatetimeDefConstUniqueCheckPk.go b/internal/integration_tests/mysql8/nulltypeprimitive/DatetimeDefConstUniqueCheckPk.go new file mode 100644 index 00000000..42c954d1 --- /dev/null +++ b/internal/integration_tests/mysql8/nulltypeprimitive/DatetimeDefConstUniqueCheckPk.go @@ -0,0 +1,9 @@ +package dto + +import ( + "time" +) + +type DatetimeDefConstUniqueCheckPk struct { + DatetimeDefConstUniqueCheckPk time.Time `db:"datetime_def_const_unique_check_pk"` +} diff --git a/internal/integration_tests/mysql8/nulltypeprimitive/DatetimeDefConstUniqueCheckPkRef.go b/internal/integration_tests/mysql8/nulltypeprimitive/DatetimeDefConstUniqueCheckPkRef.go new file mode 100644 index 00000000..de2a504a --- /dev/null +++ b/internal/integration_tests/mysql8/nulltypeprimitive/DatetimeDefConstUniqueCheckPkRef.go @@ -0,0 +1,9 @@ +package dto + +import ( + "time" +) + +type DatetimeDefConstUniqueCheckPkRef struct { + DatetimeDefConstUniqueCheckPkRef time.Time `db:"datetime_def_const_unique_check_pk_ref"` +} diff --git a/internal/integration_tests/mysql8/nulltypeprimitive/DatetimeDefFuncUniqueCheckPk.go b/internal/integration_tests/mysql8/nulltypeprimitive/DatetimeDefFuncUniqueCheckPk.go new file mode 100644 index 00000000..bdb6ac27 --- /dev/null +++ b/internal/integration_tests/mysql8/nulltypeprimitive/DatetimeDefFuncUniqueCheckPk.go @@ -0,0 +1,9 @@ +package dto + +import ( + "time" +) + +type DatetimeDefFuncUniqueCheckPk struct { + DatetimeDefFuncUniqueCheckPk time.Time `db:"datetime_def_func_unique_check_pk"` +} diff --git a/internal/integration_tests/mysql8/nulltypeprimitive/DatetimeDefFuncUniqueCheckPkRef.go b/internal/integration_tests/mysql8/nulltypeprimitive/DatetimeDefFuncUniqueCheckPkRef.go new file mode 100644 index 00000000..5bc51f30 --- /dev/null +++ b/internal/integration_tests/mysql8/nulltypeprimitive/DatetimeDefFuncUniqueCheckPkRef.go @@ -0,0 +1,9 @@ +package dto + +import ( + "time" +) + +type DatetimeDefFuncUniqueCheckPkRef struct { + DatetimeDefFuncUniqueCheckPkRef time.Time `db:"datetime_def_func_unique_check_pk_ref"` +} diff --git a/internal/integration_tests/mysql8/nulltypeprimitive/DatetimeNnPk.go b/internal/integration_tests/mysql8/nulltypeprimitive/DatetimeNnPk.go new file mode 100644 index 00000000..30998f47 --- /dev/null +++ b/internal/integration_tests/mysql8/nulltypeprimitive/DatetimeNnPk.go @@ -0,0 +1,9 @@ +package dto + +import ( + "time" +) + +type DatetimeNnPk struct { + DatetimeNnPk time.Time `db:"datetime_nn_pk"` +} diff --git a/internal/integration_tests/mysql8/nulltypeprimitive/DatetimeNnUniqueCheckPk.go b/internal/integration_tests/mysql8/nulltypeprimitive/DatetimeNnUniqueCheckPk.go new file mode 100644 index 00000000..f6d77322 --- /dev/null +++ b/internal/integration_tests/mysql8/nulltypeprimitive/DatetimeNnUniqueCheckPk.go @@ -0,0 +1,9 @@ +package dto + +import ( + "time" +) + +type DatetimeNnUniqueCheckPk struct { + DatetimeNnUniqueCheckPk time.Time `db:"datetime_nn_unique_check_pk"` +} diff --git a/internal/integration_tests/mysql8/nulltypeprimitive/DatetimeNnUniqueCheckPkRef.go b/internal/integration_tests/mysql8/nulltypeprimitive/DatetimeNnUniqueCheckPkRef.go new file mode 100644 index 00000000..82611c60 --- /dev/null +++ b/internal/integration_tests/mysql8/nulltypeprimitive/DatetimeNnUniqueCheckPkRef.go @@ -0,0 +1,9 @@ +package dto + +import ( + "time" +) + +type DatetimeNnUniqueCheckPkRef struct { + DatetimeNnUniqueCheckPkRef time.Time `db:"datetime_nn_unique_check_pk_ref"` +} diff --git a/internal/integration_tests/mysql8/nulltypeprimitive/DatetimePk.go b/internal/integration_tests/mysql8/nulltypeprimitive/DatetimePk.go new file mode 100644 index 00000000..f514c724 --- /dev/null +++ b/internal/integration_tests/mysql8/nulltypeprimitive/DatetimePk.go @@ -0,0 +1,9 @@ +package dto + +import ( + "time" +) + +type DatetimePk struct { + DatetimePk time.Time `db:"datetime_pk"` +} diff --git a/internal/integration_tests/mysql8/nulltypeprimitive/DatetimePkDefConst.go b/internal/integration_tests/mysql8/nulltypeprimitive/DatetimePkDefConst.go new file mode 100644 index 00000000..3fc935f7 --- /dev/null +++ b/internal/integration_tests/mysql8/nulltypeprimitive/DatetimePkDefConst.go @@ -0,0 +1,9 @@ +package dto + +import ( + "time" +) + +type DatetimePkDefConst struct { + DatetimePkDefConst time.Time `db:"datetime_pk_def_const"` +} diff --git a/internal/integration_tests/mysql8/nulltypeprimitive/DatetimePkDefFunc.go b/internal/integration_tests/mysql8/nulltypeprimitive/DatetimePkDefFunc.go new file mode 100644 index 00000000..3562a7cd --- /dev/null +++ b/internal/integration_tests/mysql8/nulltypeprimitive/DatetimePkDefFunc.go @@ -0,0 +1,9 @@ +package dto + +import ( + "time" +) + +type DatetimePkDefFunc struct { + DatetimePkDefFunc time.Time `db:"datetime_pk_def_func"` +} diff --git a/internal/integration_tests/mysql8/nulltypeprimitive/DatetimePkRef.go b/internal/integration_tests/mysql8/nulltypeprimitive/DatetimePkRef.go new file mode 100644 index 00000000..a4e05075 --- /dev/null +++ b/internal/integration_tests/mysql8/nulltypeprimitive/DatetimePkRef.go @@ -0,0 +1,9 @@ +package dto + +import ( + "time" +) + +type DatetimePkRef struct { + DatetimePkRef time.Time `db:"datetime_pk_ref"` +} diff --git a/internal/integration_tests/mysql8/nulltypeprimitive/DatetimeRef.go b/internal/integration_tests/mysql8/nulltypeprimitive/DatetimeRef.go new file mode 100644 index 00000000..17728daf --- /dev/null +++ b/internal/integration_tests/mysql8/nulltypeprimitive/DatetimeRef.go @@ -0,0 +1,9 @@ +package dto + +import ( + "time" +) + +type DatetimeRef struct { + DatetimeRef *time.Time `db:"datetime_ref"` +} diff --git a/internal/integration_tests/mysql8/nulltypeprimitive/DatetimeTable.go b/internal/integration_tests/mysql8/nulltypeprimitive/DatetimeTable.go new file mode 100644 index 00000000..456224b5 --- /dev/null +++ b/internal/integration_tests/mysql8/nulltypeprimitive/DatetimeTable.go @@ -0,0 +1,31 @@ +package dto + +import ( + "time" +) + +type DatetimeTable struct { + Datetime *time.Time `db:"datetime"` + DatetimeNn time.Time `db:"datetime_nn"` + DatetimeNnUnique time.Time `db:"datetime_nn_unique"` + DatetimeNnCheck time.Time `db:"datetime_nn_check"` + DatetimeNnRef time.Time `db:"datetime_nn_ref"` + DatetimeNnDefConst time.Time `db:"datetime_nn_def_const"` + DatetimeNnDefFunc time.Time `db:"datetime_nn_def_func"` + DatetimeNnUniqueCheck time.Time `db:"datetime_nn_unique_check"` + DatetimeUnique *time.Time `db:"datetime_unique"` + DatetimeUniqueCheck *time.Time `db:"datetime_unique_check"` + DatetimeUniqueRef *time.Time `db:"datetime_unique_ref"` + DatetimeUniqueDefConst *time.Time `db:"datetime_unique_def_const"` + DatetimeUniqueDefFunc *time.Time `db:"datetime_unique_def_func"` + DatetimeCheck *time.Time `db:"datetime_check"` + DatetimeCheckRef *time.Time `db:"datetime_check_ref"` + DatetimeCheckDefConst *time.Time `db:"datetime_check_def_const"` + DatetimeCheckDefFunc *time.Time `db:"datetime_check_def_func"` + DatetimeRef *time.Time `db:"datetime_ref"` + DatetimeRefUniqueCheck *time.Time `db:"datetime_ref_unique_check"` + DatetimeDefConst *time.Time `db:"datetime_def_const"` + DatetimeDefConstUniqueCheck *time.Time `db:"datetime_def_const_unique_check"` + DatetimeDefFunc *time.Time `db:"datetime_def_func"` + DatetimeDefFuncUniqueCheck *time.Time `db:"datetime_def_func_unique_check"` +} diff --git a/internal/integration_tests/mysql8/nulltypeprimitive/DatetimeUniqueCheckPk.go b/internal/integration_tests/mysql8/nulltypeprimitive/DatetimeUniqueCheckPk.go new file mode 100644 index 00000000..f5afbf89 --- /dev/null +++ b/internal/integration_tests/mysql8/nulltypeprimitive/DatetimeUniqueCheckPk.go @@ -0,0 +1,9 @@ +package dto + +import ( + "time" +) + +type DatetimeUniqueCheckPk struct { + DatetimeUniqueCheckPk time.Time `db:"datetime_unique_check_pk"` +} diff --git a/internal/integration_tests/mysql8/nulltypeprimitive/DatetimeUniqueCheckPkRef.go b/internal/integration_tests/mysql8/nulltypeprimitive/DatetimeUniqueCheckPkRef.go new file mode 100644 index 00000000..5b9834ba --- /dev/null +++ b/internal/integration_tests/mysql8/nulltypeprimitive/DatetimeUniqueCheckPkRef.go @@ -0,0 +1,9 @@ +package dto + +import ( + "time" +) + +type DatetimeUniqueCheckPkRef struct { + DatetimeUniqueCheckPkRef time.Time `db:"datetime_unique_check_pk_ref"` +} diff --git a/internal/integration_tests/mysql8/nulltypeprimitive/DatetimeUniquePk.go b/internal/integration_tests/mysql8/nulltypeprimitive/DatetimeUniquePk.go new file mode 100644 index 00000000..efd8e62c --- /dev/null +++ b/internal/integration_tests/mysql8/nulltypeprimitive/DatetimeUniquePk.go @@ -0,0 +1,9 @@ +package dto + +import ( + "time" +) + +type DatetimeUniquePk struct { + DatetimeUniquePk time.Time `db:"datetime_unique_pk"` +} diff --git a/internal/integration_tests/mysql8/nulltypeprimitive/DecimalCheckPk.go b/internal/integration_tests/mysql8/nulltypeprimitive/DecimalCheckPk.go new file mode 100644 index 00000000..e51ea81a --- /dev/null +++ b/internal/integration_tests/mysql8/nulltypeprimitive/DecimalCheckPk.go @@ -0,0 +1,5 @@ +package dto + +type DecimalCheckPk struct { + DecimalCheckPk float64 `db:"decimal_check_pk"` +} diff --git a/internal/integration_tests/mysql8/nulltypeprimitive/DecimalDefConstUniqueCheckPk.go b/internal/integration_tests/mysql8/nulltypeprimitive/DecimalDefConstUniqueCheckPk.go new file mode 100644 index 00000000..725b1900 --- /dev/null +++ b/internal/integration_tests/mysql8/nulltypeprimitive/DecimalDefConstUniqueCheckPk.go @@ -0,0 +1,5 @@ +package dto + +type DecimalDefConstUniqueCheckPk struct { + DecimalDefConstUniqueCheckPk float64 `db:"decimal_def_const_unique_check_pk"` +} diff --git a/internal/integration_tests/mysql8/nulltypeprimitive/DecimalDefConstUniqueCheckPkRef.go b/internal/integration_tests/mysql8/nulltypeprimitive/DecimalDefConstUniqueCheckPkRef.go new file mode 100644 index 00000000..47a13f96 --- /dev/null +++ b/internal/integration_tests/mysql8/nulltypeprimitive/DecimalDefConstUniqueCheckPkRef.go @@ -0,0 +1,5 @@ +package dto + +type DecimalDefConstUniqueCheckPkRef struct { + DecimalDefConstUniqueCheckPkRef float64 `db:"decimal_def_const_unique_check_pk_ref"` +} diff --git a/internal/integration_tests/mysql8/nulltypeprimitive/DecimalDefFuncUniqueCheckPk.go b/internal/integration_tests/mysql8/nulltypeprimitive/DecimalDefFuncUniqueCheckPk.go new file mode 100644 index 00000000..689faf76 --- /dev/null +++ b/internal/integration_tests/mysql8/nulltypeprimitive/DecimalDefFuncUniqueCheckPk.go @@ -0,0 +1,5 @@ +package dto + +type DecimalDefFuncUniqueCheckPk struct { + DecimalDefFuncUniqueCheckPk float64 `db:"decimal_def_func_unique_check_pk"` +} diff --git a/internal/integration_tests/mysql8/nulltypeprimitive/DecimalDefFuncUniqueCheckPkRef.go b/internal/integration_tests/mysql8/nulltypeprimitive/DecimalDefFuncUniqueCheckPkRef.go new file mode 100644 index 00000000..212509c5 --- /dev/null +++ b/internal/integration_tests/mysql8/nulltypeprimitive/DecimalDefFuncUniqueCheckPkRef.go @@ -0,0 +1,5 @@ +package dto + +type DecimalDefFuncUniqueCheckPkRef struct { + DecimalDefFuncUniqueCheckPkRef float64 `db:"decimal_def_func_unique_check_pk_ref"` +} diff --git a/internal/integration_tests/mysql8/nulltypeprimitive/DecimalNnPk.go b/internal/integration_tests/mysql8/nulltypeprimitive/DecimalNnPk.go new file mode 100644 index 00000000..cd8f4912 --- /dev/null +++ b/internal/integration_tests/mysql8/nulltypeprimitive/DecimalNnPk.go @@ -0,0 +1,5 @@ +package dto + +type DecimalNnPk struct { + DecimalNnPk float64 `db:"decimal_nn_pk"` +} diff --git a/internal/integration_tests/mysql8/nulltypeprimitive/DecimalNnUniqueCheckPk.go b/internal/integration_tests/mysql8/nulltypeprimitive/DecimalNnUniqueCheckPk.go new file mode 100644 index 00000000..fa82e68b --- /dev/null +++ b/internal/integration_tests/mysql8/nulltypeprimitive/DecimalNnUniqueCheckPk.go @@ -0,0 +1,5 @@ +package dto + +type DecimalNnUniqueCheckPk struct { + DecimalNnUniqueCheckPk float64 `db:"decimal_nn_unique_check_pk"` +} diff --git a/internal/integration_tests/mysql8/nulltypeprimitive/DecimalNnUniqueCheckPkRef.go b/internal/integration_tests/mysql8/nulltypeprimitive/DecimalNnUniqueCheckPkRef.go new file mode 100644 index 00000000..f9003bf2 --- /dev/null +++ b/internal/integration_tests/mysql8/nulltypeprimitive/DecimalNnUniqueCheckPkRef.go @@ -0,0 +1,5 @@ +package dto + +type DecimalNnUniqueCheckPkRef struct { + DecimalNnUniqueCheckPkRef float64 `db:"decimal_nn_unique_check_pk_ref"` +} diff --git a/internal/integration_tests/mysql8/nulltypeprimitive/DecimalPk.go b/internal/integration_tests/mysql8/nulltypeprimitive/DecimalPk.go new file mode 100644 index 00000000..42a811a1 --- /dev/null +++ b/internal/integration_tests/mysql8/nulltypeprimitive/DecimalPk.go @@ -0,0 +1,5 @@ +package dto + +type DecimalPk struct { + DecimalPk float64 `db:"decimal_pk"` +} diff --git a/internal/integration_tests/mysql8/nulltypeprimitive/DecimalPkDefConst.go b/internal/integration_tests/mysql8/nulltypeprimitive/DecimalPkDefConst.go new file mode 100644 index 00000000..844cf9d1 --- /dev/null +++ b/internal/integration_tests/mysql8/nulltypeprimitive/DecimalPkDefConst.go @@ -0,0 +1,5 @@ +package dto + +type DecimalPkDefConst struct { + DecimalPkDefConst float64 `db:"decimal_pk_def_const"` +} diff --git a/internal/integration_tests/mysql8/nulltypeprimitive/DecimalPkDefFunc.go b/internal/integration_tests/mysql8/nulltypeprimitive/DecimalPkDefFunc.go new file mode 100644 index 00000000..82ec62c8 --- /dev/null +++ b/internal/integration_tests/mysql8/nulltypeprimitive/DecimalPkDefFunc.go @@ -0,0 +1,5 @@ +package dto + +type DecimalPkDefFunc struct { + DecimalPkDefFunc float64 `db:"decimal_pk_def_func"` +} diff --git a/internal/integration_tests/mysql8/nulltypeprimitive/DecimalPkRef.go b/internal/integration_tests/mysql8/nulltypeprimitive/DecimalPkRef.go new file mode 100644 index 00000000..bd5ef076 --- /dev/null +++ b/internal/integration_tests/mysql8/nulltypeprimitive/DecimalPkRef.go @@ -0,0 +1,5 @@ +package dto + +type DecimalPkRef struct { + DecimalPkRef float64 `db:"decimal_pk_ref"` +} diff --git a/internal/integration_tests/mysql8/nulltypeprimitive/DecimalRef.go b/internal/integration_tests/mysql8/nulltypeprimitive/DecimalRef.go new file mode 100644 index 00000000..46576647 --- /dev/null +++ b/internal/integration_tests/mysql8/nulltypeprimitive/DecimalRef.go @@ -0,0 +1,5 @@ +package dto + +type DecimalRef struct { + DecimalRef *float64 `db:"decimal_ref"` +} diff --git a/internal/integration_tests/mysql8/nulltypeprimitive/DecimalTable.go b/internal/integration_tests/mysql8/nulltypeprimitive/DecimalTable.go new file mode 100644 index 00000000..b2026ee6 --- /dev/null +++ b/internal/integration_tests/mysql8/nulltypeprimitive/DecimalTable.go @@ -0,0 +1,27 @@ +package dto + +type DecimalTable struct { + Col *float64 `db:"col"` + DecimalNn float64 `db:"decimal_nn"` + DecimalNnUnique float64 `db:"decimal_nn_unique"` + DecimalNnCheck float64 `db:"decimal_nn_check"` + DecimalNnRef float64 `db:"decimal_nn_ref"` + DecimalNnDefConst float64 `db:"decimal_nn_def_const"` + DecimalNnDefFunc float64 `db:"decimal_nn_def_func"` + DecimalNnUniqueCheck float64 `db:"decimal_nn_unique_check"` + DecimalUnique *float64 `db:"decimal_unique"` + DecimalUniqueCheck *float64 `db:"decimal_unique_check"` + DecimalUniqueRef *float64 `db:"decimal_unique_ref"` + DecimalUniqueDefConst *float64 `db:"decimal_unique_def_const"` + DecimalUniqueDefFunc *float64 `db:"decimal_unique_def_func"` + DecimalCheck *float64 `db:"decimal_check"` + DecimalCheckRef *float64 `db:"decimal_check_ref"` + DecimalCheckDefConst *float64 `db:"decimal_check_def_const"` + DecimalCheckDefFunc *float64 `db:"decimal_check_def_func"` + DecimalRef *float64 `db:"decimal_ref"` + DecimalRefUniqueCheck *float64 `db:"decimal_ref_unique_check"` + DecimalDefConst *float64 `db:"decimal_def_const"` + DecimalDefConstUniqueCheck *float64 `db:"decimal_def_const_unique_check"` + DecimalDefFunc *float64 `db:"decimal_def_func"` + DecimalDefFuncUniqueCheck *float64 `db:"decimal_def_func_unique_check"` +} diff --git a/internal/integration_tests/mysql8/nulltypeprimitive/DecimalUniqueCheckPk.go b/internal/integration_tests/mysql8/nulltypeprimitive/DecimalUniqueCheckPk.go new file mode 100644 index 00000000..f6df5c3e --- /dev/null +++ b/internal/integration_tests/mysql8/nulltypeprimitive/DecimalUniqueCheckPk.go @@ -0,0 +1,5 @@ +package dto + +type DecimalUniqueCheckPk struct { + DecimalUniqueCheckPk float64 `db:"decimal_unique_check_pk"` +} diff --git a/internal/integration_tests/mysql8/nulltypeprimitive/DecimalUniqueCheckPkRef.go b/internal/integration_tests/mysql8/nulltypeprimitive/DecimalUniqueCheckPkRef.go new file mode 100644 index 00000000..c94f982e --- /dev/null +++ b/internal/integration_tests/mysql8/nulltypeprimitive/DecimalUniqueCheckPkRef.go @@ -0,0 +1,5 @@ +package dto + +type DecimalUniqueCheckPkRef struct { + DecimalUniqueCheckPkRef float64 `db:"decimal_unique_check_pk_ref"` +} diff --git a/internal/integration_tests/mysql8/nulltypeprimitive/DecimalUniquePk.go b/internal/integration_tests/mysql8/nulltypeprimitive/DecimalUniquePk.go new file mode 100644 index 00000000..ca299e19 --- /dev/null +++ b/internal/integration_tests/mysql8/nulltypeprimitive/DecimalUniquePk.go @@ -0,0 +1,5 @@ +package dto + +type DecimalUniquePk struct { + DecimalUniquePk float64 `db:"decimal_unique_pk"` +} diff --git a/internal/integration_tests/mysql8/nulltypeprimitive/DoublePrecisionCheckPk.go b/internal/integration_tests/mysql8/nulltypeprimitive/DoublePrecisionCheckPk.go new file mode 100644 index 00000000..b371f477 --- /dev/null +++ b/internal/integration_tests/mysql8/nulltypeprimitive/DoublePrecisionCheckPk.go @@ -0,0 +1,5 @@ +package dto + +type DoublePrecisionCheckPk struct { + DoublePrecisionCheckPk float64 `db:"double_precision_check_pk"` +} diff --git a/internal/integration_tests/mysql8/nulltypeprimitive/DoublePrecisionDefConstUniqueCheckPk.go b/internal/integration_tests/mysql8/nulltypeprimitive/DoublePrecisionDefConstUniqueCheckPk.go new file mode 100644 index 00000000..aed14fe8 --- /dev/null +++ b/internal/integration_tests/mysql8/nulltypeprimitive/DoublePrecisionDefConstUniqueCheckPk.go @@ -0,0 +1,5 @@ +package dto + +type DoublePrecisionDefConstUniqueCheckPk struct { + DoublePrecisionDefConstUniqueCheckPk float64 `db:"double_precision_def_const_unique_check_pk"` +} diff --git a/internal/integration_tests/mysql8/nulltypeprimitive/DoublePrecisionDefConstUniqueCheckPkRef.go b/internal/integration_tests/mysql8/nulltypeprimitive/DoublePrecisionDefConstUniqueCheckPkRef.go new file mode 100644 index 00000000..f3fd6f6f --- /dev/null +++ b/internal/integration_tests/mysql8/nulltypeprimitive/DoublePrecisionDefConstUniqueCheckPkRef.go @@ -0,0 +1,5 @@ +package dto + +type DoublePrecisionDefConstUniqueCheckPkRef struct { + DoublePrecisionDefConstUniqueCheckPkRef float64 `db:"double_precision_def_const_unique_check_pk_ref"` +} diff --git a/internal/integration_tests/mysql8/nulltypeprimitive/DoublePrecisionDefFuncUniqueCheckPk.go b/internal/integration_tests/mysql8/nulltypeprimitive/DoublePrecisionDefFuncUniqueCheckPk.go new file mode 100644 index 00000000..d868ad99 --- /dev/null +++ b/internal/integration_tests/mysql8/nulltypeprimitive/DoublePrecisionDefFuncUniqueCheckPk.go @@ -0,0 +1,5 @@ +package dto + +type DoublePrecisionDefFuncUniqueCheckPk struct { + DoublePrecisionDefFuncUniqueCheckPk float64 `db:"double_precision_def_func_unique_check_pk"` +} diff --git a/internal/integration_tests/mysql8/nulltypeprimitive/DoublePrecisionDefFuncUniqueCheckPkRef.go b/internal/integration_tests/mysql8/nulltypeprimitive/DoublePrecisionDefFuncUniqueCheckPkRef.go new file mode 100644 index 00000000..cfc1fd16 --- /dev/null +++ b/internal/integration_tests/mysql8/nulltypeprimitive/DoublePrecisionDefFuncUniqueCheckPkRef.go @@ -0,0 +1,5 @@ +package dto + +type DoublePrecisionDefFuncUniqueCheckPkRef struct { + DoublePrecisionDefFuncUniqueCheckPkRef float64 `db:"double_precision_def_func_unique_check_pk_ref"` +} diff --git a/internal/integration_tests/mysql8/nulltypeprimitive/DoublePrecisionNnPk.go b/internal/integration_tests/mysql8/nulltypeprimitive/DoublePrecisionNnPk.go new file mode 100644 index 00000000..cdd85c7c --- /dev/null +++ b/internal/integration_tests/mysql8/nulltypeprimitive/DoublePrecisionNnPk.go @@ -0,0 +1,5 @@ +package dto + +type DoublePrecisionNnPk struct { + DoublePrecisionNnPk float64 `db:"double_precision_nn_pk"` +} diff --git a/internal/integration_tests/mysql8/nulltypeprimitive/DoublePrecisionNnUniqueCheckPk.go b/internal/integration_tests/mysql8/nulltypeprimitive/DoublePrecisionNnUniqueCheckPk.go new file mode 100644 index 00000000..4c6f76fd --- /dev/null +++ b/internal/integration_tests/mysql8/nulltypeprimitive/DoublePrecisionNnUniqueCheckPk.go @@ -0,0 +1,5 @@ +package dto + +type DoublePrecisionNnUniqueCheckPk struct { + DoublePrecisionNnUniqueCheckPk float64 `db:"double_precision_nn_unique_check_pk"` +} diff --git a/internal/integration_tests/mysql8/nulltypeprimitive/DoublePrecisionNnUniqueCheckPkRef.go b/internal/integration_tests/mysql8/nulltypeprimitive/DoublePrecisionNnUniqueCheckPkRef.go new file mode 100644 index 00000000..46f9308c --- /dev/null +++ b/internal/integration_tests/mysql8/nulltypeprimitive/DoublePrecisionNnUniqueCheckPkRef.go @@ -0,0 +1,5 @@ +package dto + +type DoublePrecisionNnUniqueCheckPkRef struct { + DoublePrecisionNnUniqueCheckPkRef float64 `db:"double_precision_nn_unique_check_pk_ref"` +} diff --git a/internal/integration_tests/mysql8/nulltypeprimitive/DoublePrecisionPk.go b/internal/integration_tests/mysql8/nulltypeprimitive/DoublePrecisionPk.go new file mode 100644 index 00000000..dd4230cd --- /dev/null +++ b/internal/integration_tests/mysql8/nulltypeprimitive/DoublePrecisionPk.go @@ -0,0 +1,5 @@ +package dto + +type DoublePrecisionPk struct { + DoublePrecisionPk float64 `db:"double_precision_pk"` +} diff --git a/internal/integration_tests/mysql8/nulltypeprimitive/DoublePrecisionPkDefConst.go b/internal/integration_tests/mysql8/nulltypeprimitive/DoublePrecisionPkDefConst.go new file mode 100644 index 00000000..88e67c92 --- /dev/null +++ b/internal/integration_tests/mysql8/nulltypeprimitive/DoublePrecisionPkDefConst.go @@ -0,0 +1,5 @@ +package dto + +type DoublePrecisionPkDefConst struct { + DoublePrecisionPkDefConst float64 `db:"double_precision_pk_def_const"` +} diff --git a/internal/integration_tests/mysql8/nulltypeprimitive/DoublePrecisionPkDefFunc.go b/internal/integration_tests/mysql8/nulltypeprimitive/DoublePrecisionPkDefFunc.go new file mode 100644 index 00000000..a61e3112 --- /dev/null +++ b/internal/integration_tests/mysql8/nulltypeprimitive/DoublePrecisionPkDefFunc.go @@ -0,0 +1,5 @@ +package dto + +type DoublePrecisionPkDefFunc struct { + DoublePrecisionPkDefFunc float64 `db:"double_precision_pk_def_func"` +} diff --git a/internal/integration_tests/mysql8/nulltypeprimitive/DoublePrecisionPkRef.go b/internal/integration_tests/mysql8/nulltypeprimitive/DoublePrecisionPkRef.go new file mode 100644 index 00000000..0ef20e93 --- /dev/null +++ b/internal/integration_tests/mysql8/nulltypeprimitive/DoublePrecisionPkRef.go @@ -0,0 +1,5 @@ +package dto + +type DoublePrecisionPkRef struct { + DoublePrecisionPkRef float64 `db:"double_precision_pk_ref"` +} diff --git a/internal/integration_tests/mysql8/nulltypeprimitive/DoublePrecisionRef.go b/internal/integration_tests/mysql8/nulltypeprimitive/DoublePrecisionRef.go new file mode 100644 index 00000000..7b7ec34e --- /dev/null +++ b/internal/integration_tests/mysql8/nulltypeprimitive/DoublePrecisionRef.go @@ -0,0 +1,5 @@ +package dto + +type DoublePrecisionRef struct { + DoublePrecisionRef *float64 `db:"double_precision_ref"` +} diff --git a/internal/integration_tests/mysql8/nulltypeprimitive/DoublePrecisionTable.go b/internal/integration_tests/mysql8/nulltypeprimitive/DoublePrecisionTable.go new file mode 100644 index 00000000..09c6f80d --- /dev/null +++ b/internal/integration_tests/mysql8/nulltypeprimitive/DoublePrecisionTable.go @@ -0,0 +1,27 @@ +package dto + +type DoublePrecisionTable struct { + Col *float64 `db:"col"` + DoublePrecisionNn float64 `db:"double_precision_nn"` + DoublePrecisionNnUnique float64 `db:"double_precision_nn_unique"` + DoublePrecisionNnCheck float64 `db:"double_precision_nn_check"` + DoublePrecisionNnRef float64 `db:"double_precision_nn_ref"` + DoublePrecisionNnDefConst float64 `db:"double_precision_nn_def_const"` + DoublePrecisionNnDefFunc float64 `db:"double_precision_nn_def_func"` + DoublePrecisionNnUniqueCheck float64 `db:"double_precision_nn_unique_check"` + DoublePrecisionUnique *float64 `db:"double_precision_unique"` + DoublePrecisionUniqueCheck *float64 `db:"double_precision_unique_check"` + DoublePrecisionUniqueRef *float64 `db:"double_precision_unique_ref"` + DoublePrecisionUniqueDefConst *float64 `db:"double_precision_unique_def_const"` + DoublePrecisionUniqueDefFunc *float64 `db:"double_precision_unique_def_func"` + DoublePrecisionCheck *float64 `db:"double_precision_check"` + DoublePrecisionCheckRef *float64 `db:"double_precision_check_ref"` + DoublePrecisionCheckDefConst *float64 `db:"double_precision_check_def_const"` + DoublePrecisionCheckDefFunc *float64 `db:"double_precision_check_def_func"` + DoublePrecisionRef *float64 `db:"double_precision_ref"` + DoublePrecisionRefUniqueCheck *float64 `db:"double_precision_ref_unique_check"` + DoublePrecisionDefConst *float64 `db:"double_precision_def_const"` + DoublePrecisionDefConstUniqueCheck *float64 `db:"double_precision_def_const_unique_check"` + DoublePrecisionDefFunc *float64 `db:"double_precision_def_func"` + DoublePrecisionDefFuncUniqueCheck *float64 `db:"double_precision_def_func_unique_check"` +} diff --git a/internal/integration_tests/mysql8/nulltypeprimitive/DoublePrecisionUniqueCheckPk.go b/internal/integration_tests/mysql8/nulltypeprimitive/DoublePrecisionUniqueCheckPk.go new file mode 100644 index 00000000..3e3cf20b --- /dev/null +++ b/internal/integration_tests/mysql8/nulltypeprimitive/DoublePrecisionUniqueCheckPk.go @@ -0,0 +1,5 @@ +package dto + +type DoublePrecisionUniqueCheckPk struct { + DoublePrecisionUniqueCheckPk float64 `db:"double_precision_unique_check_pk"` +} diff --git a/internal/integration_tests/mysql8/nulltypeprimitive/DoublePrecisionUniqueCheckPkRef.go b/internal/integration_tests/mysql8/nulltypeprimitive/DoublePrecisionUniqueCheckPkRef.go new file mode 100644 index 00000000..3655f585 --- /dev/null +++ b/internal/integration_tests/mysql8/nulltypeprimitive/DoublePrecisionUniqueCheckPkRef.go @@ -0,0 +1,5 @@ +package dto + +type DoublePrecisionUniqueCheckPkRef struct { + DoublePrecisionUniqueCheckPkRef float64 `db:"double_precision_unique_check_pk_ref"` +} diff --git a/internal/integration_tests/mysql8/nulltypeprimitive/DoublePrecisionUniquePk.go b/internal/integration_tests/mysql8/nulltypeprimitive/DoublePrecisionUniquePk.go new file mode 100644 index 00000000..df2b18cc --- /dev/null +++ b/internal/integration_tests/mysql8/nulltypeprimitive/DoublePrecisionUniquePk.go @@ -0,0 +1,5 @@ +package dto + +type DoublePrecisionUniquePk struct { + DoublePrecisionUniquePk float64 `db:"double_precision_unique_pk"` +} diff --git a/internal/integration_tests/mysql8/nulltypeprimitive/FloatCheckPk.go b/internal/integration_tests/mysql8/nulltypeprimitive/FloatCheckPk.go new file mode 100644 index 00000000..e40adfb8 --- /dev/null +++ b/internal/integration_tests/mysql8/nulltypeprimitive/FloatCheckPk.go @@ -0,0 +1,5 @@ +package dto + +type FloatCheckPk struct { + FloatCheckPk float64 `db:"float_check_pk"` +} diff --git a/internal/integration_tests/mysql8/nulltypeprimitive/FloatDefConstUniqueCheckPk.go b/internal/integration_tests/mysql8/nulltypeprimitive/FloatDefConstUniqueCheckPk.go new file mode 100644 index 00000000..57baef77 --- /dev/null +++ b/internal/integration_tests/mysql8/nulltypeprimitive/FloatDefConstUniqueCheckPk.go @@ -0,0 +1,5 @@ +package dto + +type FloatDefConstUniqueCheckPk struct { + FloatDefConstUniqueCheckPk float64 `db:"float_def_const_unique_check_pk"` +} diff --git a/internal/integration_tests/mysql8/nulltypeprimitive/FloatDefConstUniqueCheckPkRef.go b/internal/integration_tests/mysql8/nulltypeprimitive/FloatDefConstUniqueCheckPkRef.go new file mode 100644 index 00000000..6125761b --- /dev/null +++ b/internal/integration_tests/mysql8/nulltypeprimitive/FloatDefConstUniqueCheckPkRef.go @@ -0,0 +1,5 @@ +package dto + +type FloatDefConstUniqueCheckPkRef struct { + FloatDefConstUniqueCheckPkRef float64 `db:"float_def_const_unique_check_pk_ref"` +} diff --git a/internal/integration_tests/mysql8/nulltypeprimitive/FloatDefFuncUniqueCheckPk.go b/internal/integration_tests/mysql8/nulltypeprimitive/FloatDefFuncUniqueCheckPk.go new file mode 100644 index 00000000..00622747 --- /dev/null +++ b/internal/integration_tests/mysql8/nulltypeprimitive/FloatDefFuncUniqueCheckPk.go @@ -0,0 +1,5 @@ +package dto + +type FloatDefFuncUniqueCheckPk struct { + FloatDefFuncUniqueCheckPk float64 `db:"float_def_func_unique_check_pk"` +} diff --git a/internal/integration_tests/mysql8/nulltypeprimitive/FloatDefFuncUniqueCheckPkRef.go b/internal/integration_tests/mysql8/nulltypeprimitive/FloatDefFuncUniqueCheckPkRef.go new file mode 100644 index 00000000..8d025ad4 --- /dev/null +++ b/internal/integration_tests/mysql8/nulltypeprimitive/FloatDefFuncUniqueCheckPkRef.go @@ -0,0 +1,5 @@ +package dto + +type FloatDefFuncUniqueCheckPkRef struct { + FloatDefFuncUniqueCheckPkRef float64 `db:"float_def_func_unique_check_pk_ref"` +} diff --git a/internal/integration_tests/mysql8/nulltypeprimitive/FloatNnPk.go b/internal/integration_tests/mysql8/nulltypeprimitive/FloatNnPk.go new file mode 100644 index 00000000..aa175645 --- /dev/null +++ b/internal/integration_tests/mysql8/nulltypeprimitive/FloatNnPk.go @@ -0,0 +1,5 @@ +package dto + +type FloatNnPk struct { + FloatNnPk float64 `db:"float_nn_pk"` +} diff --git a/internal/integration_tests/mysql8/nulltypeprimitive/FloatNnUniqueCheckPk.go b/internal/integration_tests/mysql8/nulltypeprimitive/FloatNnUniqueCheckPk.go new file mode 100644 index 00000000..a65f5786 --- /dev/null +++ b/internal/integration_tests/mysql8/nulltypeprimitive/FloatNnUniqueCheckPk.go @@ -0,0 +1,5 @@ +package dto + +type FloatNnUniqueCheckPk struct { + FloatNnUniqueCheckPk float64 `db:"float_nn_unique_check_pk"` +} diff --git a/internal/integration_tests/mysql8/nulltypeprimitive/FloatNnUniqueCheckPkRef.go b/internal/integration_tests/mysql8/nulltypeprimitive/FloatNnUniqueCheckPkRef.go new file mode 100644 index 00000000..a3253c3f --- /dev/null +++ b/internal/integration_tests/mysql8/nulltypeprimitive/FloatNnUniqueCheckPkRef.go @@ -0,0 +1,5 @@ +package dto + +type FloatNnUniqueCheckPkRef struct { + FloatNnUniqueCheckPkRef float64 `db:"float_nn_unique_check_pk_ref"` +} diff --git a/internal/integration_tests/mysql8/nulltypeprimitive/FloatPk.go b/internal/integration_tests/mysql8/nulltypeprimitive/FloatPk.go new file mode 100644 index 00000000..60ca0fcb --- /dev/null +++ b/internal/integration_tests/mysql8/nulltypeprimitive/FloatPk.go @@ -0,0 +1,5 @@ +package dto + +type FloatPk struct { + FloatPk float64 `db:"float_pk"` +} diff --git a/internal/integration_tests/mysql8/nulltypeprimitive/FloatPkDefConst.go b/internal/integration_tests/mysql8/nulltypeprimitive/FloatPkDefConst.go new file mode 100644 index 00000000..1660a67a --- /dev/null +++ b/internal/integration_tests/mysql8/nulltypeprimitive/FloatPkDefConst.go @@ -0,0 +1,5 @@ +package dto + +type FloatPkDefConst struct { + FloatPkDefConst float64 `db:"float_pk_def_const"` +} diff --git a/internal/integration_tests/mysql8/nulltypeprimitive/FloatPkDefFunc.go b/internal/integration_tests/mysql8/nulltypeprimitive/FloatPkDefFunc.go new file mode 100644 index 00000000..e2de6364 --- /dev/null +++ b/internal/integration_tests/mysql8/nulltypeprimitive/FloatPkDefFunc.go @@ -0,0 +1,5 @@ +package dto + +type FloatPkDefFunc struct { + FloatPkDefFunc float64 `db:"float_pk_def_func"` +} diff --git a/internal/integration_tests/mysql8/nulltypeprimitive/FloatPkRef.go b/internal/integration_tests/mysql8/nulltypeprimitive/FloatPkRef.go new file mode 100644 index 00000000..476d656e --- /dev/null +++ b/internal/integration_tests/mysql8/nulltypeprimitive/FloatPkRef.go @@ -0,0 +1,5 @@ +package dto + +type FloatPkRef struct { + FloatPkRef float64 `db:"float_pk_ref"` +} diff --git a/internal/integration_tests/mysql8/nulltypeprimitive/FloatRef.go b/internal/integration_tests/mysql8/nulltypeprimitive/FloatRef.go new file mode 100644 index 00000000..43b5c303 --- /dev/null +++ b/internal/integration_tests/mysql8/nulltypeprimitive/FloatRef.go @@ -0,0 +1,5 @@ +package dto + +type FloatRef struct { + FloatRef *float64 `db:"float_ref"` +} diff --git a/internal/integration_tests/mysql8/nulltypeprimitive/FloatTable.go b/internal/integration_tests/mysql8/nulltypeprimitive/FloatTable.go new file mode 100644 index 00000000..23acdc06 --- /dev/null +++ b/internal/integration_tests/mysql8/nulltypeprimitive/FloatTable.go @@ -0,0 +1,27 @@ +package dto + +type FloatTable struct { + Col *float64 `db:"col"` + FloatNn float64 `db:"float_nn"` + FloatNnUnique float64 `db:"float_nn_unique"` + FloatNnCheck float64 `db:"float_nn_check"` + FloatNnRef float64 `db:"float_nn_ref"` + FloatNnDefConst float64 `db:"float_nn_def_const"` + FloatNnDefFunc float64 `db:"float_nn_def_func"` + FloatNnUniqueCheck float64 `db:"float_nn_unique_check"` + FloatUnique *float64 `db:"float_unique"` + FloatUniqueCheck *float64 `db:"float_unique_check"` + FloatUniqueRef *float64 `db:"float_unique_ref"` + FloatUniqueDefConst *float64 `db:"float_unique_def_const"` + FloatUniqueDefFunc *float64 `db:"float_unique_def_func"` + FloatCheck *float64 `db:"float_check"` + FloatCheckRef *float64 `db:"float_check_ref"` + FloatCheckDefConst *float64 `db:"float_check_def_const"` + FloatCheckDefFunc *float64 `db:"float_check_def_func"` + FloatRef *float64 `db:"float_ref"` + FloatRefUniqueCheck *float64 `db:"float_ref_unique_check"` + FloatDefConst *float64 `db:"float_def_const"` + FloatDefConstUniqueCheck *float64 `db:"float_def_const_unique_check"` + FloatDefFunc *float64 `db:"float_def_func"` + FloatDefFuncUniqueCheck *float64 `db:"float_def_func_unique_check"` +} diff --git a/internal/integration_tests/mysql8/nulltypeprimitive/FloatUniqueCheckPk.go b/internal/integration_tests/mysql8/nulltypeprimitive/FloatUniqueCheckPk.go new file mode 100644 index 00000000..81ddc37f --- /dev/null +++ b/internal/integration_tests/mysql8/nulltypeprimitive/FloatUniqueCheckPk.go @@ -0,0 +1,5 @@ +package dto + +type FloatUniqueCheckPk struct { + FloatUniqueCheckPk float64 `db:"float_unique_check_pk"` +} diff --git a/internal/integration_tests/mysql8/nulltypeprimitive/FloatUniqueCheckPkRef.go b/internal/integration_tests/mysql8/nulltypeprimitive/FloatUniqueCheckPkRef.go new file mode 100644 index 00000000..530d26cc --- /dev/null +++ b/internal/integration_tests/mysql8/nulltypeprimitive/FloatUniqueCheckPkRef.go @@ -0,0 +1,5 @@ +package dto + +type FloatUniqueCheckPkRef struct { + FloatUniqueCheckPkRef float64 `db:"float_unique_check_pk_ref"` +} diff --git a/internal/integration_tests/mysql8/nulltypeprimitive/FloatUniquePk.go b/internal/integration_tests/mysql8/nulltypeprimitive/FloatUniquePk.go new file mode 100644 index 00000000..6f0e1fbd --- /dev/null +++ b/internal/integration_tests/mysql8/nulltypeprimitive/FloatUniquePk.go @@ -0,0 +1,5 @@ +package dto + +type FloatUniquePk struct { + FloatUniquePk float64 `db:"float_unique_pk"` +} diff --git a/internal/integration_tests/mysql8/nulltypeprimitive/IntegerCheckPk.go b/internal/integration_tests/mysql8/nulltypeprimitive/IntegerCheckPk.go new file mode 100644 index 00000000..ad7c9d02 --- /dev/null +++ b/internal/integration_tests/mysql8/nulltypeprimitive/IntegerCheckPk.go @@ -0,0 +1,5 @@ +package dto + +type IntegerCheckPk struct { + IntegerCheckPk int `db:"integer_check_pk"` +} diff --git a/internal/integration_tests/mysql8/nulltypeprimitive/IntegerDefConstUniqueCheckPk.go b/internal/integration_tests/mysql8/nulltypeprimitive/IntegerDefConstUniqueCheckPk.go new file mode 100644 index 00000000..72165e92 --- /dev/null +++ b/internal/integration_tests/mysql8/nulltypeprimitive/IntegerDefConstUniqueCheckPk.go @@ -0,0 +1,5 @@ +package dto + +type IntegerDefConstUniqueCheckPk struct { + IntegerDefConstUniqueCheckPk int `db:"integer_def_const_unique_check_pk"` +} diff --git a/internal/integration_tests/mysql8/nulltypeprimitive/IntegerDefConstUniqueCheckPkRef.go b/internal/integration_tests/mysql8/nulltypeprimitive/IntegerDefConstUniqueCheckPkRef.go new file mode 100644 index 00000000..3345b997 --- /dev/null +++ b/internal/integration_tests/mysql8/nulltypeprimitive/IntegerDefConstUniqueCheckPkRef.go @@ -0,0 +1,5 @@ +package dto + +type IntegerDefConstUniqueCheckPkRef struct { + IntegerDefConstUniqueCheckPkRef int `db:"integer_def_const_unique_check_pk_ref"` +} diff --git a/internal/integration_tests/mysql8/nulltypeprimitive/IntegerDefFuncUniqueCheckPk.go b/internal/integration_tests/mysql8/nulltypeprimitive/IntegerDefFuncUniqueCheckPk.go new file mode 100644 index 00000000..842dc704 --- /dev/null +++ b/internal/integration_tests/mysql8/nulltypeprimitive/IntegerDefFuncUniqueCheckPk.go @@ -0,0 +1,5 @@ +package dto + +type IntegerDefFuncUniqueCheckPk struct { + IntegerDefFuncUniqueCheckPk int `db:"integer_def_func_unique_check_pk"` +} diff --git a/internal/integration_tests/mysql8/nulltypeprimitive/IntegerDefFuncUniqueCheckPkRef.go b/internal/integration_tests/mysql8/nulltypeprimitive/IntegerDefFuncUniqueCheckPkRef.go new file mode 100644 index 00000000..8f406218 --- /dev/null +++ b/internal/integration_tests/mysql8/nulltypeprimitive/IntegerDefFuncUniqueCheckPkRef.go @@ -0,0 +1,5 @@ +package dto + +type IntegerDefFuncUniqueCheckPkRef struct { + IntegerDefFuncUniqueCheckPkRef int `db:"integer_def_func_unique_check_pk_ref"` +} diff --git a/internal/integration_tests/mysql8/nulltypeprimitive/IntegerNnPk.go b/internal/integration_tests/mysql8/nulltypeprimitive/IntegerNnPk.go new file mode 100644 index 00000000..2ec86875 --- /dev/null +++ b/internal/integration_tests/mysql8/nulltypeprimitive/IntegerNnPk.go @@ -0,0 +1,5 @@ +package dto + +type IntegerNnPk struct { + IntegerNnPk int `db:"integer_nn_pk"` +} diff --git a/internal/integration_tests/mysql8/nulltypeprimitive/IntegerNnUniqueCheckPk.go b/internal/integration_tests/mysql8/nulltypeprimitive/IntegerNnUniqueCheckPk.go new file mode 100644 index 00000000..f9311f0e --- /dev/null +++ b/internal/integration_tests/mysql8/nulltypeprimitive/IntegerNnUniqueCheckPk.go @@ -0,0 +1,5 @@ +package dto + +type IntegerNnUniqueCheckPk struct { + IntegerNnUniqueCheckPk int `db:"integer_nn_unique_check_pk"` +} diff --git a/internal/integration_tests/mysql8/nulltypeprimitive/IntegerNnUniqueCheckPkRef.go b/internal/integration_tests/mysql8/nulltypeprimitive/IntegerNnUniqueCheckPkRef.go new file mode 100644 index 00000000..9dca594a --- /dev/null +++ b/internal/integration_tests/mysql8/nulltypeprimitive/IntegerNnUniqueCheckPkRef.go @@ -0,0 +1,5 @@ +package dto + +type IntegerNnUniqueCheckPkRef struct { + IntegerNnUniqueCheckPkRef int `db:"integer_nn_unique_check_pk_ref"` +} diff --git a/internal/integration_tests/mysql8/nulltypeprimitive/IntegerPk.go b/internal/integration_tests/mysql8/nulltypeprimitive/IntegerPk.go new file mode 100644 index 00000000..4ad7290a --- /dev/null +++ b/internal/integration_tests/mysql8/nulltypeprimitive/IntegerPk.go @@ -0,0 +1,5 @@ +package dto + +type IntegerPk struct { + IntegerPk int `db:"integer_pk"` +} diff --git a/internal/integration_tests/mysql8/nulltypeprimitive/IntegerPkDefConst.go b/internal/integration_tests/mysql8/nulltypeprimitive/IntegerPkDefConst.go new file mode 100644 index 00000000..16ca6af6 --- /dev/null +++ b/internal/integration_tests/mysql8/nulltypeprimitive/IntegerPkDefConst.go @@ -0,0 +1,5 @@ +package dto + +type IntegerPkDefConst struct { + IntegerPkDefConst int `db:"integer_pk_def_const"` +} diff --git a/internal/integration_tests/mysql8/nulltypeprimitive/IntegerPkDefFunc.go b/internal/integration_tests/mysql8/nulltypeprimitive/IntegerPkDefFunc.go new file mode 100644 index 00000000..902032a0 --- /dev/null +++ b/internal/integration_tests/mysql8/nulltypeprimitive/IntegerPkDefFunc.go @@ -0,0 +1,5 @@ +package dto + +type IntegerPkDefFunc struct { + IntegerPkDefFunc int `db:"integer_pk_def_func"` +} diff --git a/internal/integration_tests/mysql8/nulltypeprimitive/IntegerPkRef.go b/internal/integration_tests/mysql8/nulltypeprimitive/IntegerPkRef.go new file mode 100644 index 00000000..4b526720 --- /dev/null +++ b/internal/integration_tests/mysql8/nulltypeprimitive/IntegerPkRef.go @@ -0,0 +1,5 @@ +package dto + +type IntegerPkRef struct { + IntegerPkRef int `db:"integer_pk_ref"` +} diff --git a/internal/integration_tests/mysql8/nulltypeprimitive/IntegerRef.go b/internal/integration_tests/mysql8/nulltypeprimitive/IntegerRef.go new file mode 100644 index 00000000..4b9105ba --- /dev/null +++ b/internal/integration_tests/mysql8/nulltypeprimitive/IntegerRef.go @@ -0,0 +1,5 @@ +package dto + +type IntegerRef struct { + IntegerRef *int `db:"integer_ref"` +} diff --git a/internal/integration_tests/mysql8/nulltypeprimitive/IntegerTable.go b/internal/integration_tests/mysql8/nulltypeprimitive/IntegerTable.go new file mode 100644 index 00000000..d619a795 --- /dev/null +++ b/internal/integration_tests/mysql8/nulltypeprimitive/IntegerTable.go @@ -0,0 +1,23 @@ +package dto + +type IntegerTable struct { + I *int `db:"i"` + IntegerNn int `db:"integer_nn"` + IntegerNnUnique int `db:"integer_nn_unique"` + IntegerNnCheck int `db:"integer_nn_check"` + IntegerUnique *int `db:"integer_unique"` + IntegerUniqueCheck *int `db:"integer_unique_check"` + IntegerUniqueRef *int `db:"integer_unique_ref"` + IntegerUniqueDefConst *int `db:"integer_unique_def_const"` + IntegerUniqueDefFunc *int `db:"integer_unique_def_func"` + IntegerCheck *int `db:"integer_check"` + IntegerCheckRef *int `db:"integer_check_ref"` + IntegerCheckDefConst *int `db:"integer_check_def_const"` + IntegerCheckDefFunc *int `db:"integer_check_def_func"` + IntegerRef *int `db:"integer_ref"` + IntegerRefUniqueCheck *int `db:"integer_ref_unique_check"` + IntegerDefConst *int `db:"integer_def_const"` + IntegerDefConstUniqueCheck *int `db:"integer_def_const_unique_check"` + IntegerDefFunc *int `db:"integer_def_func"` + IntegerDefFuncUniqueCheck *int `db:"integer_def_func_unique_check"` +} diff --git a/internal/integration_tests/mysql8/nulltypeprimitive/IntegerUniqueCheckPk.go b/internal/integration_tests/mysql8/nulltypeprimitive/IntegerUniqueCheckPk.go new file mode 100644 index 00000000..e9752b8b --- /dev/null +++ b/internal/integration_tests/mysql8/nulltypeprimitive/IntegerUniqueCheckPk.go @@ -0,0 +1,5 @@ +package dto + +type IntegerUniqueCheckPk struct { + IntegerUniqueCheckPk int `db:"integer_unique_check_pk"` +} diff --git a/internal/integration_tests/mysql8/nulltypeprimitive/IntegerUniqueCheckPkRef.go b/internal/integration_tests/mysql8/nulltypeprimitive/IntegerUniqueCheckPkRef.go new file mode 100644 index 00000000..23ec56d9 --- /dev/null +++ b/internal/integration_tests/mysql8/nulltypeprimitive/IntegerUniqueCheckPkRef.go @@ -0,0 +1,5 @@ +package dto + +type IntegerUniqueCheckPkRef struct { + IntegerUniqueCheckPkRef int `db:"integer_unique_check_pk_ref"` +} diff --git a/internal/integration_tests/mysql8/nulltypeprimitive/IntegerUniquePk.go b/internal/integration_tests/mysql8/nulltypeprimitive/IntegerUniquePk.go new file mode 100644 index 00000000..460e2616 --- /dev/null +++ b/internal/integration_tests/mysql8/nulltypeprimitive/IntegerUniquePk.go @@ -0,0 +1,5 @@ +package dto + +type IntegerUniquePk struct { + IntegerUniquePk int `db:"integer_unique_pk"` +} diff --git a/internal/integration_tests/mysql8/nulltypeprimitive/LongblobRef.go b/internal/integration_tests/mysql8/nulltypeprimitive/LongblobRef.go new file mode 100644 index 00000000..27258135 --- /dev/null +++ b/internal/integration_tests/mysql8/nulltypeprimitive/LongblobRef.go @@ -0,0 +1,5 @@ +package dto + +type LongblobRef struct { + LongblobRef string `db:"longblob_ref"` +} diff --git a/internal/integration_tests/mysql8/nulltypeprimitive/LongblobTable.go b/internal/integration_tests/mysql8/nulltypeprimitive/LongblobTable.go new file mode 100644 index 00000000..96a0e82f --- /dev/null +++ b/internal/integration_tests/mysql8/nulltypeprimitive/LongblobTable.go @@ -0,0 +1,18 @@ +package dto + +type LongblobTable struct { + Col *string `db:"col"` + LongblobDefConst *string `db:"longblob_def_const"` + LongblobDefFunc *string `db:"longblob_def_func"` + LongblobRef *string `db:"longblob_ref"` + LongblobNn string `db:"longblob_nn"` + LongblobNnCheckCmp string `db:"longblob_nn_check_cmp"` + LongblobNnCheckFn string `db:"longblob_nn_check_fn"` + LongblobNnRef string `db:"longblob_nn_ref"` + LongblobNnDefConst string `db:"longblob_nn_def_const"` + LongblobNnDefFunc string `db:"longblob_nn_def_func"` + LongblobCheck *string `db:"longblob_check"` + LongblobCheckRef *string `db:"longblob_check_ref"` + LongblobCheckDefConst *string `db:"longblob_check_def_const"` + LongblobCheckDefFunc *string `db:"longblob_check_def_func"` +} diff --git a/internal/integration_tests/mysql8/nulltypeprimitive/LongtextRef.go b/internal/integration_tests/mysql8/nulltypeprimitive/LongtextRef.go new file mode 100644 index 00000000..643799f5 --- /dev/null +++ b/internal/integration_tests/mysql8/nulltypeprimitive/LongtextRef.go @@ -0,0 +1,5 @@ +package dto + +type LongtextRef struct { + LongtextRef string `db:"longtext_ref"` +} diff --git a/internal/integration_tests/mysql8/nulltypeprimitive/LongtextTable.go b/internal/integration_tests/mysql8/nulltypeprimitive/LongtextTable.go new file mode 100644 index 00000000..a62155f5 --- /dev/null +++ b/internal/integration_tests/mysql8/nulltypeprimitive/LongtextTable.go @@ -0,0 +1,18 @@ +package dto + +type LongtextTable struct { + Col *string `db:"col"` + LongtextDefConst *string `db:"longtext_def_const"` + LongtextDefFunc *string `db:"longtext_def_func"` + LongtextRef *string `db:"longtext_ref"` + LongtextNn string `db:"longtext_nn"` + LongtextNnCheckCmp string `db:"longtext_nn_check_cmp"` + LongtextNnCheckFn string `db:"longtext_nn_check_fn"` + LongtextNnRef string `db:"longtext_nn_ref"` + LongtextNnDefConst string `db:"longtext_nn_def_const"` + LongtextNnDefFunc string `db:"longtext_nn_def_func"` + LongtextCheck *string `db:"longtext_check"` + LongtextCheckRef *string `db:"longtext_check_ref"` + LongtextCheckDefConst *string `db:"longtext_check_def_const"` + LongtextCheckDefFunc *string `db:"longtext_check_def_func"` +} diff --git a/internal/integration_tests/mysql8/nulltypeprimitive/MediumblobRef.go b/internal/integration_tests/mysql8/nulltypeprimitive/MediumblobRef.go new file mode 100644 index 00000000..c07a7901 --- /dev/null +++ b/internal/integration_tests/mysql8/nulltypeprimitive/MediumblobRef.go @@ -0,0 +1,5 @@ +package dto + +type MediumblobRef struct { + MediumblobRef string `db:"mediumblob_ref"` +} diff --git a/internal/integration_tests/mysql8/nulltypeprimitive/MediumblobTable.go b/internal/integration_tests/mysql8/nulltypeprimitive/MediumblobTable.go new file mode 100644 index 00000000..e3024311 --- /dev/null +++ b/internal/integration_tests/mysql8/nulltypeprimitive/MediumblobTable.go @@ -0,0 +1,18 @@ +package dto + +type MediumblobTable struct { + Col *string `db:"col"` + MediumblobDefConst *string `db:"mediumblob_def_const"` + MediumblobDefFunc *string `db:"mediumblob_def_func"` + MediumblobRef *string `db:"mediumblob_ref"` + MediumblobNn string `db:"mediumblob_nn"` + MediumblobNnCheckCmp string `db:"mediumblob_nn_check_cmp"` + MediumblobNnCheckFn string `db:"mediumblob_nn_check_fn"` + MediumblobNnRef string `db:"mediumblob_nn_ref"` + MediumblobNnDefConst string `db:"mediumblob_nn_def_const"` + MediumblobNnDefFunc string `db:"mediumblob_nn_def_func"` + MediumblobCheck *string `db:"mediumblob_check"` + MediumblobCheckRef *string `db:"mediumblob_check_ref"` + MediumblobCheckDefConst *string `db:"mediumblob_check_def_const"` + MediumblobCheckDefFunc *string `db:"mediumblob_check_def_func"` +} diff --git a/internal/integration_tests/mysql8/nulltypeprimitive/MediumintCheckPk.go b/internal/integration_tests/mysql8/nulltypeprimitive/MediumintCheckPk.go new file mode 100644 index 00000000..45cbb5c1 --- /dev/null +++ b/internal/integration_tests/mysql8/nulltypeprimitive/MediumintCheckPk.go @@ -0,0 +1,5 @@ +package dto + +type MediumintCheckPk struct { + MediumintCheckPk int `db:"mediumint_check_pk"` +} diff --git a/internal/integration_tests/mysql8/nulltypeprimitive/MediumintDefConstUniqueCheckPk.go b/internal/integration_tests/mysql8/nulltypeprimitive/MediumintDefConstUniqueCheckPk.go new file mode 100644 index 00000000..b9ddc8db --- /dev/null +++ b/internal/integration_tests/mysql8/nulltypeprimitive/MediumintDefConstUniqueCheckPk.go @@ -0,0 +1,5 @@ +package dto + +type MediumintDefConstUniqueCheckPk struct { + MediumintDefConstUniqueCheckPk int `db:"mediumint_def_const_unique_check_pk"` +} diff --git a/internal/integration_tests/mysql8/nulltypeprimitive/MediumintDefConstUniqueCheckPkRef.go b/internal/integration_tests/mysql8/nulltypeprimitive/MediumintDefConstUniqueCheckPkRef.go new file mode 100644 index 00000000..0d765358 --- /dev/null +++ b/internal/integration_tests/mysql8/nulltypeprimitive/MediumintDefConstUniqueCheckPkRef.go @@ -0,0 +1,5 @@ +package dto + +type MediumintDefConstUniqueCheckPkRef struct { + MediumintDefConstUniqueCheckPkRef int `db:"mediumint_def_const_unique_check_pk_ref"` +} diff --git a/internal/integration_tests/mysql8/nulltypeprimitive/MediumintDefFuncUniqueCheckPk.go b/internal/integration_tests/mysql8/nulltypeprimitive/MediumintDefFuncUniqueCheckPk.go new file mode 100644 index 00000000..9fbe5e3e --- /dev/null +++ b/internal/integration_tests/mysql8/nulltypeprimitive/MediumintDefFuncUniqueCheckPk.go @@ -0,0 +1,5 @@ +package dto + +type MediumintDefFuncUniqueCheckPk struct { + MediumintDefFuncUniqueCheckPk int `db:"mediumint_def_func_unique_check_pk"` +} diff --git a/internal/integration_tests/mysql8/nulltypeprimitive/MediumintDefFuncUniqueCheckPkRef.go b/internal/integration_tests/mysql8/nulltypeprimitive/MediumintDefFuncUniqueCheckPkRef.go new file mode 100644 index 00000000..5abfd547 --- /dev/null +++ b/internal/integration_tests/mysql8/nulltypeprimitive/MediumintDefFuncUniqueCheckPkRef.go @@ -0,0 +1,5 @@ +package dto + +type MediumintDefFuncUniqueCheckPkRef struct { + MediumintDefFuncUniqueCheckPkRef int `db:"mediumint_def_func_unique_check_pk_ref"` +} diff --git a/internal/integration_tests/mysql8/nulltypeprimitive/MediumintNnPk.go b/internal/integration_tests/mysql8/nulltypeprimitive/MediumintNnPk.go new file mode 100644 index 00000000..232ab1a8 --- /dev/null +++ b/internal/integration_tests/mysql8/nulltypeprimitive/MediumintNnPk.go @@ -0,0 +1,5 @@ +package dto + +type MediumintNnPk struct { + MediumintNnPk int `db:"mediumint_nn_pk"` +} diff --git a/internal/integration_tests/mysql8/nulltypeprimitive/MediumintNnUniqueCheckPk.go b/internal/integration_tests/mysql8/nulltypeprimitive/MediumintNnUniqueCheckPk.go new file mode 100644 index 00000000..b8155be5 --- /dev/null +++ b/internal/integration_tests/mysql8/nulltypeprimitive/MediumintNnUniqueCheckPk.go @@ -0,0 +1,5 @@ +package dto + +type MediumintNnUniqueCheckPk struct { + MediumintNnUniqueCheckPk int `db:"mediumint_nn_unique_check_pk"` +} diff --git a/internal/integration_tests/mysql8/nulltypeprimitive/MediumintNnUniqueCheckPkRef.go b/internal/integration_tests/mysql8/nulltypeprimitive/MediumintNnUniqueCheckPkRef.go new file mode 100644 index 00000000..b116bf6d --- /dev/null +++ b/internal/integration_tests/mysql8/nulltypeprimitive/MediumintNnUniqueCheckPkRef.go @@ -0,0 +1,5 @@ +package dto + +type MediumintNnUniqueCheckPkRef struct { + MediumintNnUniqueCheckPkRef int `db:"mediumint_nn_unique_check_pk_ref"` +} diff --git a/internal/integration_tests/mysql8/nulltypeprimitive/MediumintPk.go b/internal/integration_tests/mysql8/nulltypeprimitive/MediumintPk.go new file mode 100644 index 00000000..8699b985 --- /dev/null +++ b/internal/integration_tests/mysql8/nulltypeprimitive/MediumintPk.go @@ -0,0 +1,5 @@ +package dto + +type MediumintPk struct { + MediumintPk int `db:"mediumint_pk"` +} diff --git a/internal/integration_tests/mysql8/nulltypeprimitive/MediumintPkDefConst.go b/internal/integration_tests/mysql8/nulltypeprimitive/MediumintPkDefConst.go new file mode 100644 index 00000000..93cfa99c --- /dev/null +++ b/internal/integration_tests/mysql8/nulltypeprimitive/MediumintPkDefConst.go @@ -0,0 +1,5 @@ +package dto + +type MediumintPkDefConst struct { + MediumintPkDefConst int `db:"mediumint_pk_def_const"` +} diff --git a/internal/integration_tests/mysql8/nulltypeprimitive/MediumintPkDefFunc.go b/internal/integration_tests/mysql8/nulltypeprimitive/MediumintPkDefFunc.go new file mode 100644 index 00000000..bc09f7f8 --- /dev/null +++ b/internal/integration_tests/mysql8/nulltypeprimitive/MediumintPkDefFunc.go @@ -0,0 +1,5 @@ +package dto + +type MediumintPkDefFunc struct { + MediumintPkDefFunc int `db:"mediumint_pk_def_func"` +} diff --git a/internal/integration_tests/mysql8/nulltypeprimitive/MediumintPkRef.go b/internal/integration_tests/mysql8/nulltypeprimitive/MediumintPkRef.go new file mode 100644 index 00000000..bf4a377f --- /dev/null +++ b/internal/integration_tests/mysql8/nulltypeprimitive/MediumintPkRef.go @@ -0,0 +1,5 @@ +package dto + +type MediumintPkRef struct { + MediumintPkRef int `db:"mediumint_pk_ref"` +} diff --git a/internal/integration_tests/mysql8/nulltypeprimitive/MediumintRef.go b/internal/integration_tests/mysql8/nulltypeprimitive/MediumintRef.go new file mode 100644 index 00000000..8e4944c3 --- /dev/null +++ b/internal/integration_tests/mysql8/nulltypeprimitive/MediumintRef.go @@ -0,0 +1,5 @@ +package dto + +type MediumintRef struct { + MediumintRef *int `db:"mediumint_ref"` +} diff --git a/internal/integration_tests/mysql8/nulltypeprimitive/MediumintTable.go b/internal/integration_tests/mysql8/nulltypeprimitive/MediumintTable.go new file mode 100644 index 00000000..1c4c4d82 --- /dev/null +++ b/internal/integration_tests/mysql8/nulltypeprimitive/MediumintTable.go @@ -0,0 +1,23 @@ +package dto + +type MediumintTable struct { + I *int `db:"i"` + MediumintNn int `db:"mediumint_nn"` + MediumintNnUnique int `db:"mediumint_nn_unique"` + MediumintNnCheck int `db:"mediumint_nn_check"` + MediumintUnique *int `db:"mediumint_unique"` + MediumintUniqueCheck *int `db:"mediumint_unique_check"` + MediumintUniqueRef *int `db:"mediumint_unique_ref"` + MediumintUniqueDefConst *int `db:"mediumint_unique_def_const"` + MediumintUniqueDefFunc *int `db:"mediumint_unique_def_func"` + MediumintCheck *int `db:"mediumint_check"` + MediumintCheckRef *int `db:"mediumint_check_ref"` + MediumintCheckDefConst *int `db:"mediumint_check_def_const"` + MediumintCheckDefFunc *int `db:"mediumint_check_def_func"` + MediumintRef *int `db:"mediumint_ref"` + MediumintRefUniqueCheck *int `db:"mediumint_ref_unique_check"` + MediumintDefConst *int `db:"mediumint_def_const"` + MediumintDefConstUniqueCheck *int `db:"mediumint_def_const_unique_check"` + MediumintDefFunc *int `db:"mediumint_def_func"` + MediumintDefFuncUniqueCheck *int `db:"mediumint_def_func_unique_check"` +} diff --git a/internal/integration_tests/mysql8/nulltypeprimitive/MediumintUniqueCheckPk.go b/internal/integration_tests/mysql8/nulltypeprimitive/MediumintUniqueCheckPk.go new file mode 100644 index 00000000..560ec7bf --- /dev/null +++ b/internal/integration_tests/mysql8/nulltypeprimitive/MediumintUniqueCheckPk.go @@ -0,0 +1,5 @@ +package dto + +type MediumintUniqueCheckPk struct { + MediumintUniqueCheckPk int `db:"mediumint_unique_check_pk"` +} diff --git a/internal/integration_tests/mysql8/nulltypeprimitive/MediumintUniqueCheckPkRef.go b/internal/integration_tests/mysql8/nulltypeprimitive/MediumintUniqueCheckPkRef.go new file mode 100644 index 00000000..5fc524dc --- /dev/null +++ b/internal/integration_tests/mysql8/nulltypeprimitive/MediumintUniqueCheckPkRef.go @@ -0,0 +1,5 @@ +package dto + +type MediumintUniqueCheckPkRef struct { + MediumintUniqueCheckPkRef int `db:"mediumint_unique_check_pk_ref"` +} diff --git a/internal/integration_tests/mysql8/nulltypeprimitive/MediumintUniquePk.go b/internal/integration_tests/mysql8/nulltypeprimitive/MediumintUniquePk.go new file mode 100644 index 00000000..d8029efd --- /dev/null +++ b/internal/integration_tests/mysql8/nulltypeprimitive/MediumintUniquePk.go @@ -0,0 +1,5 @@ +package dto + +type MediumintUniquePk struct { + MediumintUniquePk int `db:"mediumint_unique_pk"` +} diff --git a/internal/integration_tests/mysql8/nulltypeprimitive/MediumtextRef.go b/internal/integration_tests/mysql8/nulltypeprimitive/MediumtextRef.go new file mode 100644 index 00000000..8102e8aa --- /dev/null +++ b/internal/integration_tests/mysql8/nulltypeprimitive/MediumtextRef.go @@ -0,0 +1,5 @@ +package dto + +type MediumtextRef struct { + MediumtextRef string `db:"mediumtext_ref"` +} diff --git a/internal/integration_tests/mysql8/nulltypeprimitive/MediumtextTable.go b/internal/integration_tests/mysql8/nulltypeprimitive/MediumtextTable.go new file mode 100644 index 00000000..8c3e4cc2 --- /dev/null +++ b/internal/integration_tests/mysql8/nulltypeprimitive/MediumtextTable.go @@ -0,0 +1,18 @@ +package dto + +type MediumtextTable struct { + Col *string `db:"col"` + MediumtextDefConst *string `db:"mediumtext_def_const"` + MediumtextDefFunc *string `db:"mediumtext_def_func"` + MediumtextRef *string `db:"mediumtext_ref"` + MediumtextNn string `db:"mediumtext_nn"` + MediumtextNnCheckCmp string `db:"mediumtext_nn_check_cmp"` + MediumtextNnCheckFn string `db:"mediumtext_nn_check_fn"` + MediumtextNnRef string `db:"mediumtext_nn_ref"` + MediumtextNnDefConst string `db:"mediumtext_nn_def_const"` + MediumtextNnDefFunc string `db:"mediumtext_nn_def_func"` + MediumtextCheck *string `db:"mediumtext_check"` + MediumtextCheckRef *string `db:"mediumtext_check_ref"` + MediumtextCheckDefConst *string `db:"mediumtext_check_def_const"` + MediumtextCheckDefFunc *string `db:"mediumtext_check_def_func"` +} diff --git a/internal/integration_tests/mysql8/nulltypeprimitive/NumericCheckPk.go b/internal/integration_tests/mysql8/nulltypeprimitive/NumericCheckPk.go new file mode 100644 index 00000000..58709a6e --- /dev/null +++ b/internal/integration_tests/mysql8/nulltypeprimitive/NumericCheckPk.go @@ -0,0 +1,5 @@ +package dto + +type NumericCheckPk struct { + NumericCheckPk float64 `db:"numeric_check_pk"` +} diff --git a/internal/integration_tests/mysql8/nulltypeprimitive/NumericDefConstUniqueCheckPk.go b/internal/integration_tests/mysql8/nulltypeprimitive/NumericDefConstUniqueCheckPk.go new file mode 100644 index 00000000..e6fdd1a2 --- /dev/null +++ b/internal/integration_tests/mysql8/nulltypeprimitive/NumericDefConstUniqueCheckPk.go @@ -0,0 +1,5 @@ +package dto + +type NumericDefConstUniqueCheckPk struct { + NumericDefConstUniqueCheckPk float64 `db:"numeric_def_const_unique_check_pk"` +} diff --git a/internal/integration_tests/mysql8/nulltypeprimitive/NumericDefConstUniqueCheckPkRef.go b/internal/integration_tests/mysql8/nulltypeprimitive/NumericDefConstUniqueCheckPkRef.go new file mode 100644 index 00000000..cdaee17e --- /dev/null +++ b/internal/integration_tests/mysql8/nulltypeprimitive/NumericDefConstUniqueCheckPkRef.go @@ -0,0 +1,5 @@ +package dto + +type NumericDefConstUniqueCheckPkRef struct { + NumericDefConstUniqueCheckPkRef float64 `db:"numeric_def_const_unique_check_pk_ref"` +} diff --git a/internal/integration_tests/mysql8/nulltypeprimitive/NumericDefFuncUniqueCheckPk.go b/internal/integration_tests/mysql8/nulltypeprimitive/NumericDefFuncUniqueCheckPk.go new file mode 100644 index 00000000..7747f0a7 --- /dev/null +++ b/internal/integration_tests/mysql8/nulltypeprimitive/NumericDefFuncUniqueCheckPk.go @@ -0,0 +1,5 @@ +package dto + +type NumericDefFuncUniqueCheckPk struct { + NumericDefFuncUniqueCheckPk float64 `db:"numeric_def_func_unique_check_pk"` +} diff --git a/internal/integration_tests/mysql8/nulltypeprimitive/NumericDefFuncUniqueCheckPkRef.go b/internal/integration_tests/mysql8/nulltypeprimitive/NumericDefFuncUniqueCheckPkRef.go new file mode 100644 index 00000000..ade94a23 --- /dev/null +++ b/internal/integration_tests/mysql8/nulltypeprimitive/NumericDefFuncUniqueCheckPkRef.go @@ -0,0 +1,5 @@ +package dto + +type NumericDefFuncUniqueCheckPkRef struct { + NumericDefFuncUniqueCheckPkRef float64 `db:"numeric_def_func_unique_check_pk_ref"` +} diff --git a/internal/integration_tests/mysql8/nulltypeprimitive/NumericNnPk.go b/internal/integration_tests/mysql8/nulltypeprimitive/NumericNnPk.go new file mode 100644 index 00000000..d4f8dba5 --- /dev/null +++ b/internal/integration_tests/mysql8/nulltypeprimitive/NumericNnPk.go @@ -0,0 +1,5 @@ +package dto + +type NumericNnPk struct { + NumericNnPk float64 `db:"numeric_nn_pk"` +} diff --git a/internal/integration_tests/mysql8/nulltypeprimitive/NumericNnUniqueCheckPk.go b/internal/integration_tests/mysql8/nulltypeprimitive/NumericNnUniqueCheckPk.go new file mode 100644 index 00000000..bad0e84f --- /dev/null +++ b/internal/integration_tests/mysql8/nulltypeprimitive/NumericNnUniqueCheckPk.go @@ -0,0 +1,5 @@ +package dto + +type NumericNnUniqueCheckPk struct { + NumericNnUniqueCheckPk float64 `db:"numeric_nn_unique_check_pk"` +} diff --git a/internal/integration_tests/mysql8/nulltypeprimitive/NumericNnUniqueCheckPkRef.go b/internal/integration_tests/mysql8/nulltypeprimitive/NumericNnUniqueCheckPkRef.go new file mode 100644 index 00000000..c4d76752 --- /dev/null +++ b/internal/integration_tests/mysql8/nulltypeprimitive/NumericNnUniqueCheckPkRef.go @@ -0,0 +1,5 @@ +package dto + +type NumericNnUniqueCheckPkRef struct { + NumericNnUniqueCheckPkRef float64 `db:"numeric_nn_unique_check_pk_ref"` +} diff --git a/internal/integration_tests/mysql8/nulltypeprimitive/NumericPk.go b/internal/integration_tests/mysql8/nulltypeprimitive/NumericPk.go new file mode 100644 index 00000000..c2d654cc --- /dev/null +++ b/internal/integration_tests/mysql8/nulltypeprimitive/NumericPk.go @@ -0,0 +1,5 @@ +package dto + +type NumericPk struct { + NumericPk float64 `db:"numeric_pk"` +} diff --git a/internal/integration_tests/mysql8/nulltypeprimitive/NumericPkDefConst.go b/internal/integration_tests/mysql8/nulltypeprimitive/NumericPkDefConst.go new file mode 100644 index 00000000..b501ee37 --- /dev/null +++ b/internal/integration_tests/mysql8/nulltypeprimitive/NumericPkDefConst.go @@ -0,0 +1,5 @@ +package dto + +type NumericPkDefConst struct { + NumericPkDefConst float64 `db:"numeric_pk_def_const"` +} diff --git a/internal/integration_tests/mysql8/nulltypeprimitive/NumericPkDefFunc.go b/internal/integration_tests/mysql8/nulltypeprimitive/NumericPkDefFunc.go new file mode 100644 index 00000000..13dd726d --- /dev/null +++ b/internal/integration_tests/mysql8/nulltypeprimitive/NumericPkDefFunc.go @@ -0,0 +1,5 @@ +package dto + +type NumericPkDefFunc struct { + NumericPkDefFunc float64 `db:"numeric_pk_def_func"` +} diff --git a/internal/integration_tests/mysql8/nulltypeprimitive/NumericPkRef.go b/internal/integration_tests/mysql8/nulltypeprimitive/NumericPkRef.go new file mode 100644 index 00000000..af53186e --- /dev/null +++ b/internal/integration_tests/mysql8/nulltypeprimitive/NumericPkRef.go @@ -0,0 +1,5 @@ +package dto + +type NumericPkRef struct { + NumericPkRef float64 `db:"numeric_pk_ref"` +} diff --git a/internal/integration_tests/mysql8/nulltypeprimitive/NumericRef.go b/internal/integration_tests/mysql8/nulltypeprimitive/NumericRef.go new file mode 100644 index 00000000..a3cac8a7 --- /dev/null +++ b/internal/integration_tests/mysql8/nulltypeprimitive/NumericRef.go @@ -0,0 +1,5 @@ +package dto + +type NumericRef struct { + NumericRef *float64 `db:"numeric_ref"` +} diff --git a/internal/integration_tests/mysql8/nulltypeprimitive/NumericTable.go b/internal/integration_tests/mysql8/nulltypeprimitive/NumericTable.go new file mode 100644 index 00000000..c45a220c --- /dev/null +++ b/internal/integration_tests/mysql8/nulltypeprimitive/NumericTable.go @@ -0,0 +1,27 @@ +package dto + +type NumericTable struct { + Col *float64 `db:"col"` + NumericNn float64 `db:"numeric_nn"` + NumericNnUnique float64 `db:"numeric_nn_unique"` + NumericNnCheck float64 `db:"numeric_nn_check"` + NumericNnRef float64 `db:"numeric_nn_ref"` + NumericNnDefConst float64 `db:"numeric_nn_def_const"` + NumericNnDefFunc float64 `db:"numeric_nn_def_func"` + NumericNnUniqueCheck float64 `db:"numeric_nn_unique_check"` + NumericUnique *float64 `db:"numeric_unique"` + NumericUniqueCheck *float64 `db:"numeric_unique_check"` + NumericUniqueRef *float64 `db:"numeric_unique_ref"` + NumericUniqueDefConst *float64 `db:"numeric_unique_def_const"` + NumericUniqueDefFunc *float64 `db:"numeric_unique_def_func"` + NumericCheck *float64 `db:"numeric_check"` + NumericCheckRef *float64 `db:"numeric_check_ref"` + NumericCheckDefConst *float64 `db:"numeric_check_def_const"` + NumericCheckDefFunc *float64 `db:"numeric_check_def_func"` + NumericRef *float64 `db:"numeric_ref"` + NumericRefUniqueCheck *float64 `db:"numeric_ref_unique_check"` + NumericDefConst *float64 `db:"numeric_def_const"` + NumericDefConstUniqueCheck *float64 `db:"numeric_def_const_unique_check"` + NumericDefFunc *float64 `db:"numeric_def_func"` + NumericDefFuncUniqueCheck *float64 `db:"numeric_def_func_unique_check"` +} diff --git a/internal/integration_tests/mysql8/nulltypeprimitive/NumericUniqueCheckPk.go b/internal/integration_tests/mysql8/nulltypeprimitive/NumericUniqueCheckPk.go new file mode 100644 index 00000000..e48c41ec --- /dev/null +++ b/internal/integration_tests/mysql8/nulltypeprimitive/NumericUniqueCheckPk.go @@ -0,0 +1,5 @@ +package dto + +type NumericUniqueCheckPk struct { + NumericUniqueCheckPk float64 `db:"numeric_unique_check_pk"` +} diff --git a/internal/integration_tests/mysql8/nulltypeprimitive/NumericUniqueCheckPkRef.go b/internal/integration_tests/mysql8/nulltypeprimitive/NumericUniqueCheckPkRef.go new file mode 100644 index 00000000..d230e9c3 --- /dev/null +++ b/internal/integration_tests/mysql8/nulltypeprimitive/NumericUniqueCheckPkRef.go @@ -0,0 +1,5 @@ +package dto + +type NumericUniqueCheckPkRef struct { + NumericUniqueCheckPkRef float64 `db:"numeric_unique_check_pk_ref"` +} diff --git a/internal/integration_tests/mysql8/nulltypeprimitive/NumericUniquePk.go b/internal/integration_tests/mysql8/nulltypeprimitive/NumericUniquePk.go new file mode 100644 index 00000000..308c1b60 --- /dev/null +++ b/internal/integration_tests/mysql8/nulltypeprimitive/NumericUniquePk.go @@ -0,0 +1,5 @@ +package dto + +type NumericUniquePk struct { + NumericUniquePk float64 `db:"numeric_unique_pk"` +} diff --git a/internal/integration_tests/mysql8/nulltypeprimitive/RealCheckPk.go b/internal/integration_tests/mysql8/nulltypeprimitive/RealCheckPk.go new file mode 100644 index 00000000..41bbff57 --- /dev/null +++ b/internal/integration_tests/mysql8/nulltypeprimitive/RealCheckPk.go @@ -0,0 +1,5 @@ +package dto + +type RealCheckPk struct { + RealCheckPk float64 `db:"real_check_pk"` +} diff --git a/internal/integration_tests/mysql8/nulltypeprimitive/RealDefConstUniqueCheckPk.go b/internal/integration_tests/mysql8/nulltypeprimitive/RealDefConstUniqueCheckPk.go new file mode 100644 index 00000000..9be61d5c --- /dev/null +++ b/internal/integration_tests/mysql8/nulltypeprimitive/RealDefConstUniqueCheckPk.go @@ -0,0 +1,5 @@ +package dto + +type RealDefConstUniqueCheckPk struct { + RealDefConstUniqueCheckPk float64 `db:"real_def_const_unique_check_pk"` +} diff --git a/internal/integration_tests/mysql8/nulltypeprimitive/RealDefConstUniqueCheckPkRef.go b/internal/integration_tests/mysql8/nulltypeprimitive/RealDefConstUniqueCheckPkRef.go new file mode 100644 index 00000000..af58466f --- /dev/null +++ b/internal/integration_tests/mysql8/nulltypeprimitive/RealDefConstUniqueCheckPkRef.go @@ -0,0 +1,5 @@ +package dto + +type RealDefConstUniqueCheckPkRef struct { + RealDefConstUniqueCheckPkRef float64 `db:"real_def_const_unique_check_pk_ref"` +} diff --git a/internal/integration_tests/mysql8/nulltypeprimitive/RealDefFuncUniqueCheckPk.go b/internal/integration_tests/mysql8/nulltypeprimitive/RealDefFuncUniqueCheckPk.go new file mode 100644 index 00000000..2619719a --- /dev/null +++ b/internal/integration_tests/mysql8/nulltypeprimitive/RealDefFuncUniqueCheckPk.go @@ -0,0 +1,5 @@ +package dto + +type RealDefFuncUniqueCheckPk struct { + RealDefFuncUniqueCheckPk float64 `db:"real_def_func_unique_check_pk"` +} diff --git a/internal/integration_tests/mysql8/nulltypeprimitive/RealDefFuncUniqueCheckPkRef.go b/internal/integration_tests/mysql8/nulltypeprimitive/RealDefFuncUniqueCheckPkRef.go new file mode 100644 index 00000000..1c085edc --- /dev/null +++ b/internal/integration_tests/mysql8/nulltypeprimitive/RealDefFuncUniqueCheckPkRef.go @@ -0,0 +1,5 @@ +package dto + +type RealDefFuncUniqueCheckPkRef struct { + RealDefFuncUniqueCheckPkRef float64 `db:"real_def_func_unique_check_pk_ref"` +} diff --git a/internal/integration_tests/mysql8/nulltypeprimitive/RealNnPk.go b/internal/integration_tests/mysql8/nulltypeprimitive/RealNnPk.go new file mode 100644 index 00000000..c9efd760 --- /dev/null +++ b/internal/integration_tests/mysql8/nulltypeprimitive/RealNnPk.go @@ -0,0 +1,5 @@ +package dto + +type RealNnPk struct { + RealNnPk float64 `db:"real_nn_pk"` +} diff --git a/internal/integration_tests/mysql8/nulltypeprimitive/RealNnUniqueCheckPk.go b/internal/integration_tests/mysql8/nulltypeprimitive/RealNnUniqueCheckPk.go new file mode 100644 index 00000000..bcd80e13 --- /dev/null +++ b/internal/integration_tests/mysql8/nulltypeprimitive/RealNnUniqueCheckPk.go @@ -0,0 +1,5 @@ +package dto + +type RealNnUniqueCheckPk struct { + RealNnUniqueCheckPk float64 `db:"real_nn_unique_check_pk"` +} diff --git a/internal/integration_tests/mysql8/nulltypeprimitive/RealNnUniqueCheckPkRef.go b/internal/integration_tests/mysql8/nulltypeprimitive/RealNnUniqueCheckPkRef.go new file mode 100644 index 00000000..1ab6f733 --- /dev/null +++ b/internal/integration_tests/mysql8/nulltypeprimitive/RealNnUniqueCheckPkRef.go @@ -0,0 +1,5 @@ +package dto + +type RealNnUniqueCheckPkRef struct { + RealNnUniqueCheckPkRef float64 `db:"real_nn_unique_check_pk_ref"` +} diff --git a/internal/integration_tests/mysql8/nulltypeprimitive/RealPk.go b/internal/integration_tests/mysql8/nulltypeprimitive/RealPk.go new file mode 100644 index 00000000..aae62539 --- /dev/null +++ b/internal/integration_tests/mysql8/nulltypeprimitive/RealPk.go @@ -0,0 +1,5 @@ +package dto + +type RealPk struct { + RealPk float64 `db:"real_pk"` +} diff --git a/internal/integration_tests/mysql8/nulltypeprimitive/RealPkDefConst.go b/internal/integration_tests/mysql8/nulltypeprimitive/RealPkDefConst.go new file mode 100644 index 00000000..dcb3b0fa --- /dev/null +++ b/internal/integration_tests/mysql8/nulltypeprimitive/RealPkDefConst.go @@ -0,0 +1,5 @@ +package dto + +type RealPkDefConst struct { + RealPkDefConst float64 `db:"real_pk_def_const"` +} diff --git a/internal/integration_tests/mysql8/nulltypeprimitive/RealPkDefFunc.go b/internal/integration_tests/mysql8/nulltypeprimitive/RealPkDefFunc.go new file mode 100644 index 00000000..85041669 --- /dev/null +++ b/internal/integration_tests/mysql8/nulltypeprimitive/RealPkDefFunc.go @@ -0,0 +1,5 @@ +package dto + +type RealPkDefFunc struct { + RealPkDefFunc float64 `db:"real_pk_def_func"` +} diff --git a/internal/integration_tests/mysql8/nulltypeprimitive/RealPkRef.go b/internal/integration_tests/mysql8/nulltypeprimitive/RealPkRef.go new file mode 100644 index 00000000..99800028 --- /dev/null +++ b/internal/integration_tests/mysql8/nulltypeprimitive/RealPkRef.go @@ -0,0 +1,5 @@ +package dto + +type RealPkRef struct { + RealPkRef float64 `db:"real_pk_ref"` +} diff --git a/internal/integration_tests/mysql8/nulltypeprimitive/RealRef.go b/internal/integration_tests/mysql8/nulltypeprimitive/RealRef.go new file mode 100644 index 00000000..ab340dbe --- /dev/null +++ b/internal/integration_tests/mysql8/nulltypeprimitive/RealRef.go @@ -0,0 +1,5 @@ +package dto + +type RealRef struct { + RealRef *float64 `db:"real_ref"` +} diff --git a/internal/integration_tests/mysql8/nulltypeprimitive/RealTable.go b/internal/integration_tests/mysql8/nulltypeprimitive/RealTable.go new file mode 100644 index 00000000..b97edf42 --- /dev/null +++ b/internal/integration_tests/mysql8/nulltypeprimitive/RealTable.go @@ -0,0 +1,27 @@ +package dto + +type RealTable struct { + Col *float64 `db:"col"` + RealNn float64 `db:"real_nn"` + RealNnUnique float64 `db:"real_nn_unique"` + RealNnCheck float64 `db:"real_nn_check"` + RealNnRef float64 `db:"real_nn_ref"` + RealNnDefConst float64 `db:"real_nn_def_const"` + RealNnDefFunc float64 `db:"real_nn_def_func"` + RealNnUniqueCheck float64 `db:"real_nn_unique_check"` + RealUnique *float64 `db:"real_unique"` + RealUniqueCheck *float64 `db:"real_unique_check"` + RealUniqueRef *float64 `db:"real_unique_ref"` + RealUniqueDefConst *float64 `db:"real_unique_def_const"` + RealUniqueDefFunc *float64 `db:"real_unique_def_func"` + RealCheck *float64 `db:"real_check"` + RealCheckRef *float64 `db:"real_check_ref"` + RealCheckDefConst *float64 `db:"real_check_def_const"` + RealCheckDefFunc *float64 `db:"real_check_def_func"` + RealRef *float64 `db:"real_ref"` + RealRefUniqueCheck *float64 `db:"real_ref_unique_check"` + RealDefConst *float64 `db:"real_def_const"` + RealDefConstUniqueCheck *float64 `db:"real_def_const_unique_check"` + RealDefFunc *float64 `db:"real_def_func"` + RealDefFuncUniqueCheck *float64 `db:"real_def_func_unique_check"` +} diff --git a/internal/integration_tests/mysql8/nulltypeprimitive/RealUniqueCheckPk.go b/internal/integration_tests/mysql8/nulltypeprimitive/RealUniqueCheckPk.go new file mode 100644 index 00000000..68483d8a --- /dev/null +++ b/internal/integration_tests/mysql8/nulltypeprimitive/RealUniqueCheckPk.go @@ -0,0 +1,5 @@ +package dto + +type RealUniqueCheckPk struct { + RealUniqueCheckPk float64 `db:"real_unique_check_pk"` +} diff --git a/internal/integration_tests/mysql8/nulltypeprimitive/RealUniqueCheckPkRef.go b/internal/integration_tests/mysql8/nulltypeprimitive/RealUniqueCheckPkRef.go new file mode 100644 index 00000000..bc4b0d90 --- /dev/null +++ b/internal/integration_tests/mysql8/nulltypeprimitive/RealUniqueCheckPkRef.go @@ -0,0 +1,5 @@ +package dto + +type RealUniqueCheckPkRef struct { + RealUniqueCheckPkRef float64 `db:"real_unique_check_pk_ref"` +} diff --git a/internal/integration_tests/mysql8/nulltypeprimitive/RealUniquePk.go b/internal/integration_tests/mysql8/nulltypeprimitive/RealUniquePk.go new file mode 100644 index 00000000..8d22f752 --- /dev/null +++ b/internal/integration_tests/mysql8/nulltypeprimitive/RealUniquePk.go @@ -0,0 +1,5 @@ +package dto + +type RealUniquePk struct { + RealUniquePk float64 `db:"real_unique_pk"` +} diff --git a/internal/integration_tests/mysql8/nulltypeprimitive/SmallintCheckPk.go b/internal/integration_tests/mysql8/nulltypeprimitive/SmallintCheckPk.go new file mode 100644 index 00000000..b751015a --- /dev/null +++ b/internal/integration_tests/mysql8/nulltypeprimitive/SmallintCheckPk.go @@ -0,0 +1,5 @@ +package dto + +type SmallintCheckPk struct { + SmallintCheckPk int `db:"smallint_check_pk"` +} diff --git a/internal/integration_tests/mysql8/nulltypeprimitive/SmallintDefConstUniqueCheckPk.go b/internal/integration_tests/mysql8/nulltypeprimitive/SmallintDefConstUniqueCheckPk.go new file mode 100644 index 00000000..e2e17b6f --- /dev/null +++ b/internal/integration_tests/mysql8/nulltypeprimitive/SmallintDefConstUniqueCheckPk.go @@ -0,0 +1,5 @@ +package dto + +type SmallintDefConstUniqueCheckPk struct { + SmallintDefConstUniqueCheckPk int `db:"smallint_def_const_unique_check_pk"` +} diff --git a/internal/integration_tests/mysql8/nulltypeprimitive/SmallintDefConstUniqueCheckPkRef.go b/internal/integration_tests/mysql8/nulltypeprimitive/SmallintDefConstUniqueCheckPkRef.go new file mode 100644 index 00000000..827d36f7 --- /dev/null +++ b/internal/integration_tests/mysql8/nulltypeprimitive/SmallintDefConstUniqueCheckPkRef.go @@ -0,0 +1,5 @@ +package dto + +type SmallintDefConstUniqueCheckPkRef struct { + SmallintDefConstUniqueCheckPkRef int `db:"smallint_def_const_unique_check_pk_ref"` +} diff --git a/internal/integration_tests/mysql8/nulltypeprimitive/SmallintDefFuncUniqueCheckPk.go b/internal/integration_tests/mysql8/nulltypeprimitive/SmallintDefFuncUniqueCheckPk.go new file mode 100644 index 00000000..ab2612af --- /dev/null +++ b/internal/integration_tests/mysql8/nulltypeprimitive/SmallintDefFuncUniqueCheckPk.go @@ -0,0 +1,5 @@ +package dto + +type SmallintDefFuncUniqueCheckPk struct { + SmallintDefFuncUniqueCheckPk int `db:"smallint_def_func_unique_check_pk"` +} diff --git a/internal/integration_tests/mysql8/nulltypeprimitive/SmallintDefFuncUniqueCheckPkRef.go b/internal/integration_tests/mysql8/nulltypeprimitive/SmallintDefFuncUniqueCheckPkRef.go new file mode 100644 index 00000000..3aef8dba --- /dev/null +++ b/internal/integration_tests/mysql8/nulltypeprimitive/SmallintDefFuncUniqueCheckPkRef.go @@ -0,0 +1,5 @@ +package dto + +type SmallintDefFuncUniqueCheckPkRef struct { + SmallintDefFuncUniqueCheckPkRef int `db:"smallint_def_func_unique_check_pk_ref"` +} diff --git a/internal/integration_tests/mysql8/nulltypeprimitive/SmallintNnPk.go b/internal/integration_tests/mysql8/nulltypeprimitive/SmallintNnPk.go new file mode 100644 index 00000000..e860d504 --- /dev/null +++ b/internal/integration_tests/mysql8/nulltypeprimitive/SmallintNnPk.go @@ -0,0 +1,5 @@ +package dto + +type SmallintNnPk struct { + SmallintNnPk int `db:"smallint_nn_pk"` +} diff --git a/internal/integration_tests/mysql8/nulltypeprimitive/SmallintNnUniqueCheckPk.go b/internal/integration_tests/mysql8/nulltypeprimitive/SmallintNnUniqueCheckPk.go new file mode 100644 index 00000000..09158e0c --- /dev/null +++ b/internal/integration_tests/mysql8/nulltypeprimitive/SmallintNnUniqueCheckPk.go @@ -0,0 +1,5 @@ +package dto + +type SmallintNnUniqueCheckPk struct { + SmallintNnUniqueCheckPk int `db:"smallint_nn_unique_check_pk"` +} diff --git a/internal/integration_tests/mysql8/nulltypeprimitive/SmallintNnUniqueCheckPkRef.go b/internal/integration_tests/mysql8/nulltypeprimitive/SmallintNnUniqueCheckPkRef.go new file mode 100644 index 00000000..29099ecd --- /dev/null +++ b/internal/integration_tests/mysql8/nulltypeprimitive/SmallintNnUniqueCheckPkRef.go @@ -0,0 +1,5 @@ +package dto + +type SmallintNnUniqueCheckPkRef struct { + SmallintNnUniqueCheckPkRef int `db:"smallint_nn_unique_check_pk_ref"` +} diff --git a/internal/integration_tests/mysql8/nulltypeprimitive/SmallintPk.go b/internal/integration_tests/mysql8/nulltypeprimitive/SmallintPk.go new file mode 100644 index 00000000..7e31ea21 --- /dev/null +++ b/internal/integration_tests/mysql8/nulltypeprimitive/SmallintPk.go @@ -0,0 +1,5 @@ +package dto + +type SmallintPk struct { + SmallintPk int `db:"smallint_pk"` +} diff --git a/internal/integration_tests/mysql8/nulltypeprimitive/SmallintPkDefConst.go b/internal/integration_tests/mysql8/nulltypeprimitive/SmallintPkDefConst.go new file mode 100644 index 00000000..6674cb63 --- /dev/null +++ b/internal/integration_tests/mysql8/nulltypeprimitive/SmallintPkDefConst.go @@ -0,0 +1,5 @@ +package dto + +type SmallintPkDefConst struct { + SmallintPkDefConst int `db:"smallint_pk_def_const"` +} diff --git a/internal/integration_tests/mysql8/nulltypeprimitive/SmallintPkDefFunc.go b/internal/integration_tests/mysql8/nulltypeprimitive/SmallintPkDefFunc.go new file mode 100644 index 00000000..3951e6bf --- /dev/null +++ b/internal/integration_tests/mysql8/nulltypeprimitive/SmallintPkDefFunc.go @@ -0,0 +1,5 @@ +package dto + +type SmallintPkDefFunc struct { + SmallintPkDefFunc int `db:"smallint_pk_def_func"` +} diff --git a/internal/integration_tests/mysql8/nulltypeprimitive/SmallintPkRef.go b/internal/integration_tests/mysql8/nulltypeprimitive/SmallintPkRef.go new file mode 100644 index 00000000..fc0176ef --- /dev/null +++ b/internal/integration_tests/mysql8/nulltypeprimitive/SmallintPkRef.go @@ -0,0 +1,5 @@ +package dto + +type SmallintPkRef struct { + SmallintPkRef int `db:"smallint_pk_ref"` +} diff --git a/internal/integration_tests/mysql8/nulltypeprimitive/SmallintRef.go b/internal/integration_tests/mysql8/nulltypeprimitive/SmallintRef.go new file mode 100644 index 00000000..f5e3acb8 --- /dev/null +++ b/internal/integration_tests/mysql8/nulltypeprimitive/SmallintRef.go @@ -0,0 +1,5 @@ +package dto + +type SmallintRef struct { + SmallintRef *int `db:"smallint_ref"` +} diff --git a/internal/integration_tests/mysql8/nulltypeprimitive/SmallintTable.go b/internal/integration_tests/mysql8/nulltypeprimitive/SmallintTable.go new file mode 100644 index 00000000..009a7647 --- /dev/null +++ b/internal/integration_tests/mysql8/nulltypeprimitive/SmallintTable.go @@ -0,0 +1,23 @@ +package dto + +type SmallintTable struct { + I *int `db:"i"` + SmallintNn int `db:"smallint_nn"` + SmallintNnUnique int `db:"smallint_nn_unique"` + SmallintNnCheck int `db:"smallint_nn_check"` + SmallintUnique *int `db:"smallint_unique"` + SmallintUniqueCheck *int `db:"smallint_unique_check"` + SmallintUniqueRef *int `db:"smallint_unique_ref"` + SmallintUniqueDefConst *int `db:"smallint_unique_def_const"` + SmallintUniqueDefFunc *int `db:"smallint_unique_def_func"` + SmallintCheck *int `db:"smallint_check"` + SmallintCheckRef *int `db:"smallint_check_ref"` + SmallintCheckDefConst *int `db:"smallint_check_def_const"` + SmallintCheckDefFunc *int `db:"smallint_check_def_func"` + SmallintRef *int `db:"smallint_ref"` + SmallintRefUniqueCheck *int `db:"smallint_ref_unique_check"` + SmallintDefConst *int `db:"smallint_def_const"` + SmallintDefConstUniqueCheck *int `db:"smallint_def_const_unique_check"` + SmallintDefFunc *int `db:"smallint_def_func"` + SmallintDefFuncUniqueCheck *int `db:"smallint_def_func_unique_check"` +} diff --git a/internal/integration_tests/mysql8/nulltypeprimitive/SmallintUniqueCheckPk.go b/internal/integration_tests/mysql8/nulltypeprimitive/SmallintUniqueCheckPk.go new file mode 100644 index 00000000..3cf7cccc --- /dev/null +++ b/internal/integration_tests/mysql8/nulltypeprimitive/SmallintUniqueCheckPk.go @@ -0,0 +1,5 @@ +package dto + +type SmallintUniqueCheckPk struct { + SmallintUniqueCheckPk int `db:"smallint_unique_check_pk"` +} diff --git a/internal/integration_tests/mysql8/nulltypeprimitive/SmallintUniqueCheckPkRef.go b/internal/integration_tests/mysql8/nulltypeprimitive/SmallintUniqueCheckPkRef.go new file mode 100644 index 00000000..2dc8bfd8 --- /dev/null +++ b/internal/integration_tests/mysql8/nulltypeprimitive/SmallintUniqueCheckPkRef.go @@ -0,0 +1,5 @@ +package dto + +type SmallintUniqueCheckPkRef struct { + SmallintUniqueCheckPkRef int `db:"smallint_unique_check_pk_ref"` +} diff --git a/internal/integration_tests/mysql8/nulltypeprimitive/SmallintUniquePk.go b/internal/integration_tests/mysql8/nulltypeprimitive/SmallintUniquePk.go new file mode 100644 index 00000000..1814500f --- /dev/null +++ b/internal/integration_tests/mysql8/nulltypeprimitive/SmallintUniquePk.go @@ -0,0 +1,5 @@ +package dto + +type SmallintUniquePk struct { + SmallintUniquePk int `db:"smallint_unique_pk"` +} diff --git a/internal/integration_tests/mysql8/nulltypeprimitive/TextRef.go b/internal/integration_tests/mysql8/nulltypeprimitive/TextRef.go new file mode 100644 index 00000000..115deada --- /dev/null +++ b/internal/integration_tests/mysql8/nulltypeprimitive/TextRef.go @@ -0,0 +1,5 @@ +package dto + +type TextRef struct { + TextRef string `db:"text_ref"` +} diff --git a/internal/integration_tests/mysql8/nulltypeprimitive/TextTable.go b/internal/integration_tests/mysql8/nulltypeprimitive/TextTable.go new file mode 100644 index 00000000..58c988c6 --- /dev/null +++ b/internal/integration_tests/mysql8/nulltypeprimitive/TextTable.go @@ -0,0 +1,18 @@ +package dto + +type TextTable struct { + Col *string `db:"col"` + TextDefConst *string `db:"text_def_const"` + TextDefFunc *string `db:"text_def_func"` + TextRef *string `db:"text_ref"` + TextNn string `db:"text_nn"` + TextNnCheckCmp string `db:"text_nn_check_cmp"` + TextNnCheckFn string `db:"text_nn_check_fn"` + TextNnRef string `db:"text_nn_ref"` + TextNnDefConst string `db:"text_nn_def_const"` + TextNnDefFunc string `db:"text_nn_def_func"` + TextCheck *string `db:"text_check"` + TextCheckRef *string `db:"text_check_ref"` + TextCheckDefConst *string `db:"text_check_def_const"` + TextCheckDefFunc *string `db:"text_check_def_func"` +} diff --git a/internal/integration_tests/mysql8/nulltypeprimitive/TimeCheckPk.go b/internal/integration_tests/mysql8/nulltypeprimitive/TimeCheckPk.go new file mode 100644 index 00000000..8ac4498b --- /dev/null +++ b/internal/integration_tests/mysql8/nulltypeprimitive/TimeCheckPk.go @@ -0,0 +1,9 @@ +package dto + +import ( + "time" +) + +type TimeCheckPk struct { + TimeCheckPk time.Time `db:"time_check_pk"` +} diff --git a/internal/integration_tests/mysql8/nulltypeprimitive/TimeDefConstUniqueCheckPk.go b/internal/integration_tests/mysql8/nulltypeprimitive/TimeDefConstUniqueCheckPk.go new file mode 100644 index 00000000..f9d70c06 --- /dev/null +++ b/internal/integration_tests/mysql8/nulltypeprimitive/TimeDefConstUniqueCheckPk.go @@ -0,0 +1,9 @@ +package dto + +import ( + "time" +) + +type TimeDefConstUniqueCheckPk struct { + TimeDefConstUniqueCheckPk time.Time `db:"time_def_const_unique_check_pk"` +} diff --git a/internal/integration_tests/mysql8/nulltypeprimitive/TimeDefConstUniqueCheckPkRef.go b/internal/integration_tests/mysql8/nulltypeprimitive/TimeDefConstUniqueCheckPkRef.go new file mode 100644 index 00000000..227c15c5 --- /dev/null +++ b/internal/integration_tests/mysql8/nulltypeprimitive/TimeDefConstUniqueCheckPkRef.go @@ -0,0 +1,9 @@ +package dto + +import ( + "time" +) + +type TimeDefConstUniqueCheckPkRef struct { + TimeDefConstUniqueCheckPkRef time.Time `db:"time_def_const_unique_check_pk_ref"` +} diff --git a/internal/integration_tests/mysql8/nulltypeprimitive/TimeDefFuncUniqueCheckPk.go b/internal/integration_tests/mysql8/nulltypeprimitive/TimeDefFuncUniqueCheckPk.go new file mode 100644 index 00000000..5058c3c9 --- /dev/null +++ b/internal/integration_tests/mysql8/nulltypeprimitive/TimeDefFuncUniqueCheckPk.go @@ -0,0 +1,9 @@ +package dto + +import ( + "time" +) + +type TimeDefFuncUniqueCheckPk struct { + TimeDefFuncUniqueCheckPk time.Time `db:"time_def_func_unique_check_pk"` +} diff --git a/internal/integration_tests/mysql8/nulltypeprimitive/TimeDefFuncUniqueCheckPkRef.go b/internal/integration_tests/mysql8/nulltypeprimitive/TimeDefFuncUniqueCheckPkRef.go new file mode 100644 index 00000000..c07b24c2 --- /dev/null +++ b/internal/integration_tests/mysql8/nulltypeprimitive/TimeDefFuncUniqueCheckPkRef.go @@ -0,0 +1,9 @@ +package dto + +import ( + "time" +) + +type TimeDefFuncUniqueCheckPkRef struct { + TimeDefFuncUniqueCheckPkRef time.Time `db:"time_def_func_unique_check_pk_ref"` +} diff --git a/internal/integration_tests/mysql8/nulltypeprimitive/TimeNnPk.go b/internal/integration_tests/mysql8/nulltypeprimitive/TimeNnPk.go new file mode 100644 index 00000000..9b53ef52 --- /dev/null +++ b/internal/integration_tests/mysql8/nulltypeprimitive/TimeNnPk.go @@ -0,0 +1,9 @@ +package dto + +import ( + "time" +) + +type TimeNnPk struct { + TimeNnPk time.Time `db:"time_nn_pk"` +} diff --git a/internal/integration_tests/mysql8/nulltypeprimitive/TimeNnUniqueCheckPk.go b/internal/integration_tests/mysql8/nulltypeprimitive/TimeNnUniqueCheckPk.go new file mode 100644 index 00000000..ab75df92 --- /dev/null +++ b/internal/integration_tests/mysql8/nulltypeprimitive/TimeNnUniqueCheckPk.go @@ -0,0 +1,9 @@ +package dto + +import ( + "time" +) + +type TimeNnUniqueCheckPk struct { + TimeNnUniqueCheckPk time.Time `db:"time_nn_unique_check_pk"` +} diff --git a/internal/integration_tests/mysql8/nulltypeprimitive/TimeNnUniqueCheckPkRef.go b/internal/integration_tests/mysql8/nulltypeprimitive/TimeNnUniqueCheckPkRef.go new file mode 100644 index 00000000..37926bf8 --- /dev/null +++ b/internal/integration_tests/mysql8/nulltypeprimitive/TimeNnUniqueCheckPkRef.go @@ -0,0 +1,9 @@ +package dto + +import ( + "time" +) + +type TimeNnUniqueCheckPkRef struct { + TimeNnUniqueCheckPkRef time.Time `db:"time_nn_unique_check_pk_ref"` +} diff --git a/internal/integration_tests/mysql8/nulltypeprimitive/TimePk.go b/internal/integration_tests/mysql8/nulltypeprimitive/TimePk.go new file mode 100644 index 00000000..4cb08dc4 --- /dev/null +++ b/internal/integration_tests/mysql8/nulltypeprimitive/TimePk.go @@ -0,0 +1,9 @@ +package dto + +import ( + "time" +) + +type TimePk struct { + TimePk time.Time `db:"time_pk"` +} diff --git a/internal/integration_tests/mysql8/nulltypeprimitive/TimePkDefConst.go b/internal/integration_tests/mysql8/nulltypeprimitive/TimePkDefConst.go new file mode 100644 index 00000000..7f119e6f --- /dev/null +++ b/internal/integration_tests/mysql8/nulltypeprimitive/TimePkDefConst.go @@ -0,0 +1,9 @@ +package dto + +import ( + "time" +) + +type TimePkDefConst struct { + TimePkDefConst time.Time `db:"time_pk_def_const"` +} diff --git a/internal/integration_tests/mysql8/nulltypeprimitive/TimePkDefFunc.go b/internal/integration_tests/mysql8/nulltypeprimitive/TimePkDefFunc.go new file mode 100644 index 00000000..6b5c04c3 --- /dev/null +++ b/internal/integration_tests/mysql8/nulltypeprimitive/TimePkDefFunc.go @@ -0,0 +1,9 @@ +package dto + +import ( + "time" +) + +type TimePkDefFunc struct { + TimePkDefFunc time.Time `db:"time_pk_def_func"` +} diff --git a/internal/integration_tests/mysql8/nulltypeprimitive/TimePkRef.go b/internal/integration_tests/mysql8/nulltypeprimitive/TimePkRef.go new file mode 100644 index 00000000..f2f24a81 --- /dev/null +++ b/internal/integration_tests/mysql8/nulltypeprimitive/TimePkRef.go @@ -0,0 +1,9 @@ +package dto + +import ( + "time" +) + +type TimePkRef struct { + TimePkRef time.Time `db:"time_pk_ref"` +} diff --git a/internal/integration_tests/mysql8/nulltypeprimitive/TimeRef.go b/internal/integration_tests/mysql8/nulltypeprimitive/TimeRef.go new file mode 100644 index 00000000..5b80230f --- /dev/null +++ b/internal/integration_tests/mysql8/nulltypeprimitive/TimeRef.go @@ -0,0 +1,9 @@ +package dto + +import ( + "time" +) + +type TimeRef struct { + TimeRef *time.Time `db:"time_ref"` +} diff --git a/internal/integration_tests/mysql8/nulltypeprimitive/TimeTable.go b/internal/integration_tests/mysql8/nulltypeprimitive/TimeTable.go new file mode 100644 index 00000000..a0c2101d --- /dev/null +++ b/internal/integration_tests/mysql8/nulltypeprimitive/TimeTable.go @@ -0,0 +1,31 @@ +package dto + +import ( + "time" +) + +type TimeTable struct { + Time *time.Time `db:"time"` + TimeNn time.Time `db:"time_nn"` + TimeNnUnique time.Time `db:"time_nn_unique"` + TimeNnCheck time.Time `db:"time_nn_check"` + TimeNnRef time.Time `db:"time_nn_ref"` + TimeNnDefConst time.Time `db:"time_nn_def_const"` + TimeNnDefFunc time.Time `db:"time_nn_def_func"` + TimeNnUniqueCheck time.Time `db:"time_nn_unique_check"` + TimeUnique *time.Time `db:"time_unique"` + TimeUniqueCheck *time.Time `db:"time_unique_check"` + TimeUniqueRef *time.Time `db:"time_unique_ref"` + TimeUniqueDefConst *time.Time `db:"time_unique_def_const"` + TimeUniqueDefFunc *time.Time `db:"time_unique_def_func"` + TimeCheck *time.Time `db:"time_check"` + TimeCheckRef *time.Time `db:"time_check_ref"` + TimeCheckDefConst *time.Time `db:"time_check_def_const"` + TimeCheckDefFunc *time.Time `db:"time_check_def_func"` + TimeRef *time.Time `db:"time_ref"` + TimeRefUniqueCheck *time.Time `db:"time_ref_unique_check"` + TimeDefConst *time.Time `db:"time_def_const"` + TimeDefConstUniqueCheck *time.Time `db:"time_def_const_unique_check"` + TimeDefFunc *time.Time `db:"time_def_func"` + TimeDefFuncUniqueCheck *time.Time `db:"time_def_func_unique_check"` +} diff --git a/internal/integration_tests/mysql8/nulltypeprimitive/TimeUniqueCheckPk.go b/internal/integration_tests/mysql8/nulltypeprimitive/TimeUniqueCheckPk.go new file mode 100644 index 00000000..24140cb6 --- /dev/null +++ b/internal/integration_tests/mysql8/nulltypeprimitive/TimeUniqueCheckPk.go @@ -0,0 +1,9 @@ +package dto + +import ( + "time" +) + +type TimeUniqueCheckPk struct { + TimeUniqueCheckPk time.Time `db:"time_unique_check_pk"` +} diff --git a/internal/integration_tests/mysql8/nulltypeprimitive/TimeUniqueCheckPkRef.go b/internal/integration_tests/mysql8/nulltypeprimitive/TimeUniqueCheckPkRef.go new file mode 100644 index 00000000..4772a2c9 --- /dev/null +++ b/internal/integration_tests/mysql8/nulltypeprimitive/TimeUniqueCheckPkRef.go @@ -0,0 +1,9 @@ +package dto + +import ( + "time" +) + +type TimeUniqueCheckPkRef struct { + TimeUniqueCheckPkRef time.Time `db:"time_unique_check_pk_ref"` +} diff --git a/internal/integration_tests/mysql8/nulltypeprimitive/TimeUniquePk.go b/internal/integration_tests/mysql8/nulltypeprimitive/TimeUniquePk.go new file mode 100644 index 00000000..4a5a293b --- /dev/null +++ b/internal/integration_tests/mysql8/nulltypeprimitive/TimeUniquePk.go @@ -0,0 +1,9 @@ +package dto + +import ( + "time" +) + +type TimeUniquePk struct { + TimeUniquePk time.Time `db:"time_unique_pk"` +} diff --git a/internal/integration_tests/mysql8/nulltypeprimitive/TimestampCheckPk.go b/internal/integration_tests/mysql8/nulltypeprimitive/TimestampCheckPk.go new file mode 100644 index 00000000..11d9aac0 --- /dev/null +++ b/internal/integration_tests/mysql8/nulltypeprimitive/TimestampCheckPk.go @@ -0,0 +1,9 @@ +package dto + +import ( + "time" +) + +type TimestampCheckPk struct { + TimestampCheckPk time.Time `db:"timestamp_check_pk"` +} diff --git a/internal/integration_tests/mysql8/nulltypeprimitive/TimestampDefConstUniqueCheckPk.go b/internal/integration_tests/mysql8/nulltypeprimitive/TimestampDefConstUniqueCheckPk.go new file mode 100644 index 00000000..76291a17 --- /dev/null +++ b/internal/integration_tests/mysql8/nulltypeprimitive/TimestampDefConstUniqueCheckPk.go @@ -0,0 +1,9 @@ +package dto + +import ( + "time" +) + +type TimestampDefConstUniqueCheckPk struct { + TimestampDefConstUniqueCheckPk time.Time `db:"timestamp_def_const_unique_check_pk"` +} diff --git a/internal/integration_tests/mysql8/nulltypeprimitive/TimestampDefConstUniqueCheckPkRef.go b/internal/integration_tests/mysql8/nulltypeprimitive/TimestampDefConstUniqueCheckPkRef.go new file mode 100644 index 00000000..b5bd7f6d --- /dev/null +++ b/internal/integration_tests/mysql8/nulltypeprimitive/TimestampDefConstUniqueCheckPkRef.go @@ -0,0 +1,9 @@ +package dto + +import ( + "time" +) + +type TimestampDefConstUniqueCheckPkRef struct { + TimestampDefConstUniqueCheckPkRef time.Time `db:"timestamp_def_const_unique_check_pk_ref"` +} diff --git a/internal/integration_tests/mysql8/nulltypeprimitive/TimestampDefFuncUniqueCheckPk.go b/internal/integration_tests/mysql8/nulltypeprimitive/TimestampDefFuncUniqueCheckPk.go new file mode 100644 index 00000000..07987edb --- /dev/null +++ b/internal/integration_tests/mysql8/nulltypeprimitive/TimestampDefFuncUniqueCheckPk.go @@ -0,0 +1,9 @@ +package dto + +import ( + "time" +) + +type TimestampDefFuncUniqueCheckPk struct { + TimestampDefFuncUniqueCheckPk time.Time `db:"timestamp_def_func_unique_check_pk"` +} diff --git a/internal/integration_tests/mysql8/nulltypeprimitive/TimestampDefFuncUniqueCheckPkRef.go b/internal/integration_tests/mysql8/nulltypeprimitive/TimestampDefFuncUniqueCheckPkRef.go new file mode 100644 index 00000000..db425463 --- /dev/null +++ b/internal/integration_tests/mysql8/nulltypeprimitive/TimestampDefFuncUniqueCheckPkRef.go @@ -0,0 +1,9 @@ +package dto + +import ( + "time" +) + +type TimestampDefFuncUniqueCheckPkRef struct { + TimestampDefFuncUniqueCheckPkRef time.Time `db:"timestamp_def_func_unique_check_pk_ref"` +} diff --git a/internal/integration_tests/mysql8/nulltypeprimitive/TimestampNnPk.go b/internal/integration_tests/mysql8/nulltypeprimitive/TimestampNnPk.go new file mode 100644 index 00000000..24d62061 --- /dev/null +++ b/internal/integration_tests/mysql8/nulltypeprimitive/TimestampNnPk.go @@ -0,0 +1,9 @@ +package dto + +import ( + "time" +) + +type TimestampNnPk struct { + TimestampNnPk time.Time `db:"timestamp_nn_pk"` +} diff --git a/internal/integration_tests/mysql8/nulltypeprimitive/TimestampNnUniqueCheckPk.go b/internal/integration_tests/mysql8/nulltypeprimitive/TimestampNnUniqueCheckPk.go new file mode 100644 index 00000000..21ae8031 --- /dev/null +++ b/internal/integration_tests/mysql8/nulltypeprimitive/TimestampNnUniqueCheckPk.go @@ -0,0 +1,9 @@ +package dto + +import ( + "time" +) + +type TimestampNnUniqueCheckPk struct { + TimestampNnUniqueCheckPk time.Time `db:"timestamp_nn_unique_check_pk"` +} diff --git a/internal/integration_tests/mysql8/nulltypeprimitive/TimestampNnUniqueCheckPkRef.go b/internal/integration_tests/mysql8/nulltypeprimitive/TimestampNnUniqueCheckPkRef.go new file mode 100644 index 00000000..1c20c377 --- /dev/null +++ b/internal/integration_tests/mysql8/nulltypeprimitive/TimestampNnUniqueCheckPkRef.go @@ -0,0 +1,9 @@ +package dto + +import ( + "time" +) + +type TimestampNnUniqueCheckPkRef struct { + TimestampNnUniqueCheckPkRef time.Time `db:"timestamp_nn_unique_check_pk_ref"` +} diff --git a/internal/integration_tests/mysql8/nulltypeprimitive/TimestampPk.go b/internal/integration_tests/mysql8/nulltypeprimitive/TimestampPk.go new file mode 100644 index 00000000..5c10b8d9 --- /dev/null +++ b/internal/integration_tests/mysql8/nulltypeprimitive/TimestampPk.go @@ -0,0 +1,9 @@ +package dto + +import ( + "time" +) + +type TimestampPk struct { + TimestampPk time.Time `db:"timestamp_pk"` +} diff --git a/internal/integration_tests/mysql8/nulltypeprimitive/TimestampPkDefConst.go b/internal/integration_tests/mysql8/nulltypeprimitive/TimestampPkDefConst.go new file mode 100644 index 00000000..1aae107b --- /dev/null +++ b/internal/integration_tests/mysql8/nulltypeprimitive/TimestampPkDefConst.go @@ -0,0 +1,9 @@ +package dto + +import ( + "time" +) + +type TimestampPkDefConst struct { + TimestampPkDefConst time.Time `db:"timestamp_pk_def_const"` +} diff --git a/internal/integration_tests/mysql8/nulltypeprimitive/TimestampPkDefFunc.go b/internal/integration_tests/mysql8/nulltypeprimitive/TimestampPkDefFunc.go new file mode 100644 index 00000000..2e17c253 --- /dev/null +++ b/internal/integration_tests/mysql8/nulltypeprimitive/TimestampPkDefFunc.go @@ -0,0 +1,9 @@ +package dto + +import ( + "time" +) + +type TimestampPkDefFunc struct { + TimestampPkDefFunc time.Time `db:"timestamp_pk_def_func"` +} diff --git a/internal/integration_tests/mysql8/nulltypeprimitive/TimestampPkRef.go b/internal/integration_tests/mysql8/nulltypeprimitive/TimestampPkRef.go new file mode 100644 index 00000000..c36c99c4 --- /dev/null +++ b/internal/integration_tests/mysql8/nulltypeprimitive/TimestampPkRef.go @@ -0,0 +1,9 @@ +package dto + +import ( + "time" +) + +type TimestampPkRef struct { + TimestampPkRef time.Time `db:"timestamp_pk_ref"` +} diff --git a/internal/integration_tests/mysql8/nulltypeprimitive/TimestampRef.go b/internal/integration_tests/mysql8/nulltypeprimitive/TimestampRef.go new file mode 100644 index 00000000..44fbd7f5 --- /dev/null +++ b/internal/integration_tests/mysql8/nulltypeprimitive/TimestampRef.go @@ -0,0 +1,9 @@ +package dto + +import ( + "time" +) + +type TimestampRef struct { + TimestampRef *time.Time `db:"timestamp_ref"` +} diff --git a/internal/integration_tests/mysql8/nulltypeprimitive/TimestampTable.go b/internal/integration_tests/mysql8/nulltypeprimitive/TimestampTable.go new file mode 100644 index 00000000..c734185d --- /dev/null +++ b/internal/integration_tests/mysql8/nulltypeprimitive/TimestampTable.go @@ -0,0 +1,31 @@ +package dto + +import ( + "time" +) + +type TimestampTable struct { + Timestamp *time.Time `db:"timestamp"` + TimestampNn time.Time `db:"timestamp_nn"` + TimestampNnUnique time.Time `db:"timestamp_nn_unique"` + TimestampNnCheck time.Time `db:"timestamp_nn_check"` + TimestampNnRef time.Time `db:"timestamp_nn_ref"` + TimestampNnDefConst time.Time `db:"timestamp_nn_def_const"` + TimestampNnDefFunc time.Time `db:"timestamp_nn_def_func"` + TimestampNnUniqueCheck time.Time `db:"timestamp_nn_unique_check"` + TimestampUnique *time.Time `db:"timestamp_unique"` + TimestampUniqueCheck *time.Time `db:"timestamp_unique_check"` + TimestampUniqueRef *time.Time `db:"timestamp_unique_ref"` + TimestampUniqueDefConst *time.Time `db:"timestamp_unique_def_const"` + TimestampUniqueDefFunc *time.Time `db:"timestamp_unique_def_func"` + TimestampCheck *time.Time `db:"timestamp_check"` + TimestampCheckRef *time.Time `db:"timestamp_check_ref"` + TimestampCheckDefConst *time.Time `db:"timestamp_check_def_const"` + TimestampCheckDefFunc *time.Time `db:"timestamp_check_def_func"` + TimestampRef *time.Time `db:"timestamp_ref"` + TimestampRefUniqueCheck *time.Time `db:"timestamp_ref_unique_check"` + TimestampDefConst *time.Time `db:"timestamp_def_const"` + TimestampDefConstUniqueCheck *time.Time `db:"timestamp_def_const_unique_check"` + TimestampDefFunc *time.Time `db:"timestamp_def_func"` + TimestampDefFuncUniqueCheck *time.Time `db:"timestamp_def_func_unique_check"` +} diff --git a/internal/integration_tests/mysql8/nulltypeprimitive/TimestampUniqueCheckPk.go b/internal/integration_tests/mysql8/nulltypeprimitive/TimestampUniqueCheckPk.go new file mode 100644 index 00000000..af5f08ff --- /dev/null +++ b/internal/integration_tests/mysql8/nulltypeprimitive/TimestampUniqueCheckPk.go @@ -0,0 +1,9 @@ +package dto + +import ( + "time" +) + +type TimestampUniqueCheckPk struct { + TimestampUniqueCheckPk time.Time `db:"timestamp_unique_check_pk"` +} diff --git a/internal/integration_tests/mysql8/nulltypeprimitive/TimestampUniqueCheckPkRef.go b/internal/integration_tests/mysql8/nulltypeprimitive/TimestampUniqueCheckPkRef.go new file mode 100644 index 00000000..a3880c53 --- /dev/null +++ b/internal/integration_tests/mysql8/nulltypeprimitive/TimestampUniqueCheckPkRef.go @@ -0,0 +1,9 @@ +package dto + +import ( + "time" +) + +type TimestampUniqueCheckPkRef struct { + TimestampUniqueCheckPkRef time.Time `db:"timestamp_unique_check_pk_ref"` +} diff --git a/internal/integration_tests/mysql8/nulltypeprimitive/TimestampUniquePk.go b/internal/integration_tests/mysql8/nulltypeprimitive/TimestampUniquePk.go new file mode 100644 index 00000000..6ef3e9ee --- /dev/null +++ b/internal/integration_tests/mysql8/nulltypeprimitive/TimestampUniquePk.go @@ -0,0 +1,9 @@ +package dto + +import ( + "time" +) + +type TimestampUniquePk struct { + TimestampUniquePk time.Time `db:"timestamp_unique_pk"` +} diff --git a/internal/integration_tests/mysql8/nulltypeprimitive/TinyblobRef.go b/internal/integration_tests/mysql8/nulltypeprimitive/TinyblobRef.go new file mode 100644 index 00000000..4bf6bb24 --- /dev/null +++ b/internal/integration_tests/mysql8/nulltypeprimitive/TinyblobRef.go @@ -0,0 +1,5 @@ +package dto + +type TinyblobRef struct { + TinyblobRef string `db:"tinyblob_ref"` +} diff --git a/internal/integration_tests/mysql8/nulltypeprimitive/TinyblobTable.go b/internal/integration_tests/mysql8/nulltypeprimitive/TinyblobTable.go new file mode 100644 index 00000000..9c25b2e4 --- /dev/null +++ b/internal/integration_tests/mysql8/nulltypeprimitive/TinyblobTable.go @@ -0,0 +1,18 @@ +package dto + +type TinyblobTable struct { + Col *string `db:"col"` + TinyblobDefConst *string `db:"tinyblob_def_const"` + TinyblobDefFunc *string `db:"tinyblob_def_func"` + TinyblobRef *string `db:"tinyblob_ref"` + TinyblobNn string `db:"tinyblob_nn"` + TinyblobNnCheckCmp string `db:"tinyblob_nn_check_cmp"` + TinyblobNnCheckFn string `db:"tinyblob_nn_check_fn"` + TinyblobNnRef string `db:"tinyblob_nn_ref"` + TinyblobNnDefConst string `db:"tinyblob_nn_def_const"` + TinyblobNnDefFunc string `db:"tinyblob_nn_def_func"` + TinyblobCheck *string `db:"tinyblob_check"` + TinyblobCheckRef *string `db:"tinyblob_check_ref"` + TinyblobCheckDefConst *string `db:"tinyblob_check_def_const"` + TinyblobCheckDefFunc *string `db:"tinyblob_check_def_func"` +} diff --git a/internal/integration_tests/mysql8/nulltypeprimitive/TinyintCheckPk.go b/internal/integration_tests/mysql8/nulltypeprimitive/TinyintCheckPk.go new file mode 100644 index 00000000..c99bf0f9 --- /dev/null +++ b/internal/integration_tests/mysql8/nulltypeprimitive/TinyintCheckPk.go @@ -0,0 +1,5 @@ +package dto + +type TinyintCheckPk struct { + TinyintCheckPk int `db:"tinyint_check_pk"` +} diff --git a/internal/integration_tests/mysql8/nulltypeprimitive/TinyintDefConstUniqueCheckPk.go b/internal/integration_tests/mysql8/nulltypeprimitive/TinyintDefConstUniqueCheckPk.go new file mode 100644 index 00000000..7ffc4928 --- /dev/null +++ b/internal/integration_tests/mysql8/nulltypeprimitive/TinyintDefConstUniqueCheckPk.go @@ -0,0 +1,5 @@ +package dto + +type TinyintDefConstUniqueCheckPk struct { + TinyintDefConstUniqueCheckPk int `db:"tinyint_def_const_unique_check_pk"` +} diff --git a/internal/integration_tests/mysql8/nulltypeprimitive/TinyintDefConstUniqueCheckPkRef.go b/internal/integration_tests/mysql8/nulltypeprimitive/TinyintDefConstUniqueCheckPkRef.go new file mode 100644 index 00000000..0d5bf10c --- /dev/null +++ b/internal/integration_tests/mysql8/nulltypeprimitive/TinyintDefConstUniqueCheckPkRef.go @@ -0,0 +1,5 @@ +package dto + +type TinyintDefConstUniqueCheckPkRef struct { + TinyintDefConstUniqueCheckPkRef int `db:"tinyint_def_const_unique_check_pk_ref"` +} diff --git a/internal/integration_tests/mysql8/nulltypeprimitive/TinyintDefFuncUniqueCheckPk.go b/internal/integration_tests/mysql8/nulltypeprimitive/TinyintDefFuncUniqueCheckPk.go new file mode 100644 index 00000000..f2a64472 --- /dev/null +++ b/internal/integration_tests/mysql8/nulltypeprimitive/TinyintDefFuncUniqueCheckPk.go @@ -0,0 +1,5 @@ +package dto + +type TinyintDefFuncUniqueCheckPk struct { + TinyintDefFuncUniqueCheckPk int `db:"tinyint_def_func_unique_check_pk"` +} diff --git a/internal/integration_tests/mysql8/nulltypeprimitive/TinyintDefFuncUniqueCheckPkRef.go b/internal/integration_tests/mysql8/nulltypeprimitive/TinyintDefFuncUniqueCheckPkRef.go new file mode 100644 index 00000000..c11b6834 --- /dev/null +++ b/internal/integration_tests/mysql8/nulltypeprimitive/TinyintDefFuncUniqueCheckPkRef.go @@ -0,0 +1,5 @@ +package dto + +type TinyintDefFuncUniqueCheckPkRef struct { + TinyintDefFuncUniqueCheckPkRef int `db:"tinyint_def_func_unique_check_pk_ref"` +} diff --git a/internal/integration_tests/mysql8/nulltypeprimitive/TinyintNnPk.go b/internal/integration_tests/mysql8/nulltypeprimitive/TinyintNnPk.go new file mode 100644 index 00000000..8b38fdcf --- /dev/null +++ b/internal/integration_tests/mysql8/nulltypeprimitive/TinyintNnPk.go @@ -0,0 +1,5 @@ +package dto + +type TinyintNnPk struct { + TinyintNnPk int `db:"tinyint_nn_pk"` +} diff --git a/internal/integration_tests/mysql8/nulltypeprimitive/TinyintNnUniqueCheckPk.go b/internal/integration_tests/mysql8/nulltypeprimitive/TinyintNnUniqueCheckPk.go new file mode 100644 index 00000000..7551c68b --- /dev/null +++ b/internal/integration_tests/mysql8/nulltypeprimitive/TinyintNnUniqueCheckPk.go @@ -0,0 +1,5 @@ +package dto + +type TinyintNnUniqueCheckPk struct { + TinyintNnUniqueCheckPk int `db:"tinyint_nn_unique_check_pk"` +} diff --git a/internal/integration_tests/mysql8/nulltypeprimitive/TinyintNnUniqueCheckPkRef.go b/internal/integration_tests/mysql8/nulltypeprimitive/TinyintNnUniqueCheckPkRef.go new file mode 100644 index 00000000..63c61bce --- /dev/null +++ b/internal/integration_tests/mysql8/nulltypeprimitive/TinyintNnUniqueCheckPkRef.go @@ -0,0 +1,5 @@ +package dto + +type TinyintNnUniqueCheckPkRef struct { + TinyintNnUniqueCheckPkRef int `db:"tinyint_nn_unique_check_pk_ref"` +} diff --git a/internal/integration_tests/mysql8/nulltypeprimitive/TinyintPk.go b/internal/integration_tests/mysql8/nulltypeprimitive/TinyintPk.go new file mode 100644 index 00000000..02b30a86 --- /dev/null +++ b/internal/integration_tests/mysql8/nulltypeprimitive/TinyintPk.go @@ -0,0 +1,5 @@ +package dto + +type TinyintPk struct { + TinyintPk int `db:"tinyint_pk"` +} diff --git a/internal/integration_tests/mysql8/nulltypeprimitive/TinyintPkDefConst.go b/internal/integration_tests/mysql8/nulltypeprimitive/TinyintPkDefConst.go new file mode 100644 index 00000000..b9f15c15 --- /dev/null +++ b/internal/integration_tests/mysql8/nulltypeprimitive/TinyintPkDefConst.go @@ -0,0 +1,5 @@ +package dto + +type TinyintPkDefConst struct { + TinyintPkDefConst int `db:"tinyint_pk_def_const"` +} diff --git a/internal/integration_tests/mysql8/nulltypeprimitive/TinyintPkDefFunc.go b/internal/integration_tests/mysql8/nulltypeprimitive/TinyintPkDefFunc.go new file mode 100644 index 00000000..ee8d490a --- /dev/null +++ b/internal/integration_tests/mysql8/nulltypeprimitive/TinyintPkDefFunc.go @@ -0,0 +1,5 @@ +package dto + +type TinyintPkDefFunc struct { + TinyintPkDefFunc int `db:"tinyint_pk_def_func"` +} diff --git a/internal/integration_tests/mysql8/nulltypeprimitive/TinyintPkRef.go b/internal/integration_tests/mysql8/nulltypeprimitive/TinyintPkRef.go new file mode 100644 index 00000000..3f95dead --- /dev/null +++ b/internal/integration_tests/mysql8/nulltypeprimitive/TinyintPkRef.go @@ -0,0 +1,5 @@ +package dto + +type TinyintPkRef struct { + TinyintPkRef int `db:"tinyint_pk_ref"` +} diff --git a/internal/integration_tests/mysql8/nulltypeprimitive/TinyintRef.go b/internal/integration_tests/mysql8/nulltypeprimitive/TinyintRef.go new file mode 100644 index 00000000..423bac0c --- /dev/null +++ b/internal/integration_tests/mysql8/nulltypeprimitive/TinyintRef.go @@ -0,0 +1,5 @@ +package dto + +type TinyintRef struct { + TinyintRef *int `db:"tinyint_ref"` +} diff --git a/internal/integration_tests/mysql8/nulltypeprimitive/TinyintTable.go b/internal/integration_tests/mysql8/nulltypeprimitive/TinyintTable.go new file mode 100644 index 00000000..f6166ffe --- /dev/null +++ b/internal/integration_tests/mysql8/nulltypeprimitive/TinyintTable.go @@ -0,0 +1,23 @@ +package dto + +type TinyintTable struct { + I *int `db:"i"` + TinyintNn int `db:"tinyint_nn"` + TinyintNnUnique int `db:"tinyint_nn_unique"` + TinyintNnCheck int `db:"tinyint_nn_check"` + TinyintUnique *int `db:"tinyint_unique"` + TinyintUniqueCheck *int `db:"tinyint_unique_check"` + TinyintUniqueRef *int `db:"tinyint_unique_ref"` + TinyintUniqueDefConst *int `db:"tinyint_unique_def_const"` + TinyintUniqueDefFunc *int `db:"tinyint_unique_def_func"` + TinyintCheck *int `db:"tinyint_check"` + TinyintCheckRef *int `db:"tinyint_check_ref"` + TinyintCheckDefConst *int `db:"tinyint_check_def_const"` + TinyintCheckDefFunc *int `db:"tinyint_check_def_func"` + TinyintRef *int `db:"tinyint_ref"` + TinyintRefUniqueCheck *int `db:"tinyint_ref_unique_check"` + TinyintDefConst *int `db:"tinyint_def_const"` + TinyintDefConstUniqueCheck *int `db:"tinyint_def_const_unique_check"` + TinyintDefFunc *int `db:"tinyint_def_func"` + TinyintDefFuncUniqueCheck *int `db:"tinyint_def_func_unique_check"` +} diff --git a/internal/integration_tests/mysql8/nulltypeprimitive/TinyintUniqueCheckPk.go b/internal/integration_tests/mysql8/nulltypeprimitive/TinyintUniqueCheckPk.go new file mode 100644 index 00000000..8f43510d --- /dev/null +++ b/internal/integration_tests/mysql8/nulltypeprimitive/TinyintUniqueCheckPk.go @@ -0,0 +1,5 @@ +package dto + +type TinyintUniqueCheckPk struct { + TinyintUniqueCheckPk int `db:"tinyint_unique_check_pk"` +} diff --git a/internal/integration_tests/mysql8/nulltypeprimitive/TinyintUniqueCheckPkRef.go b/internal/integration_tests/mysql8/nulltypeprimitive/TinyintUniqueCheckPkRef.go new file mode 100644 index 00000000..65effa9b --- /dev/null +++ b/internal/integration_tests/mysql8/nulltypeprimitive/TinyintUniqueCheckPkRef.go @@ -0,0 +1,5 @@ +package dto + +type TinyintUniqueCheckPkRef struct { + TinyintUniqueCheckPkRef int `db:"tinyint_unique_check_pk_ref"` +} diff --git a/internal/integration_tests/mysql8/nulltypeprimitive/TinyintUniquePk.go b/internal/integration_tests/mysql8/nulltypeprimitive/TinyintUniquePk.go new file mode 100644 index 00000000..d134425d --- /dev/null +++ b/internal/integration_tests/mysql8/nulltypeprimitive/TinyintUniquePk.go @@ -0,0 +1,5 @@ +package dto + +type TinyintUniquePk struct { + TinyintUniquePk int `db:"tinyint_unique_pk"` +} diff --git a/internal/integration_tests/mysql8/nulltypeprimitive/TinytextRef.go b/internal/integration_tests/mysql8/nulltypeprimitive/TinytextRef.go new file mode 100644 index 00000000..4a76f7dd --- /dev/null +++ b/internal/integration_tests/mysql8/nulltypeprimitive/TinytextRef.go @@ -0,0 +1,5 @@ +package dto + +type TinytextRef struct { + TinytextRef string `db:"tinytext_ref"` +} diff --git a/internal/integration_tests/mysql8/nulltypeprimitive/TinytextTable.go b/internal/integration_tests/mysql8/nulltypeprimitive/TinytextTable.go new file mode 100644 index 00000000..aae7487f --- /dev/null +++ b/internal/integration_tests/mysql8/nulltypeprimitive/TinytextTable.go @@ -0,0 +1,18 @@ +package dto + +type TinytextTable struct { + Col *string `db:"col"` + TinytextDefConst *string `db:"tinytext_def_const"` + TinytextDefFunc *string `db:"tinytext_def_func"` + TinytextRef *string `db:"tinytext_ref"` + TinytextNn string `db:"tinytext_nn"` + TinytextNnCheckCmp string `db:"tinytext_nn_check_cmp"` + TinytextNnCheckFn string `db:"tinytext_nn_check_fn"` + TinytextNnRef string `db:"tinytext_nn_ref"` + TinytextNnDefConst string `db:"tinytext_nn_def_const"` + TinytextNnDefFunc string `db:"tinytext_nn_def_func"` + TinytextCheck *string `db:"tinytext_check"` + TinytextCheckRef *string `db:"tinytext_check_ref"` + TinytextCheckDefConst *string `db:"tinytext_check_def_const"` + TinytextCheckDefFunc *string `db:"tinytext_check_def_func"` +} diff --git a/internal/integration_tests/mysql8/nulltypeprimitive/User.go b/internal/integration_tests/mysql8/nulltypeprimitive/User.go new file mode 100644 index 00000000..cd701067 --- /dev/null +++ b/internal/integration_tests/mysql8/nulltypeprimitive/User.go @@ -0,0 +1,7 @@ +package dto + +type User struct { + ID int `db:"id"` + UserID int `db:"user_id"` + WebsiteURL *string `db:"website_url"` +} diff --git a/internal/integration_tests/mysql8/nulltypeprimitive/VarbinaryCheckPk.go b/internal/integration_tests/mysql8/nulltypeprimitive/VarbinaryCheckPk.go new file mode 100644 index 00000000..ec1add83 --- /dev/null +++ b/internal/integration_tests/mysql8/nulltypeprimitive/VarbinaryCheckPk.go @@ -0,0 +1,5 @@ +package dto + +type VarbinaryCheckPk struct { + VarbinaryCheckPk string `db:"varbinary_check_pk"` +} diff --git a/internal/integration_tests/mysql8/nulltypeprimitive/VarbinaryDefConstUniqueCheckPk.go b/internal/integration_tests/mysql8/nulltypeprimitive/VarbinaryDefConstUniqueCheckPk.go new file mode 100644 index 00000000..405c5f62 --- /dev/null +++ b/internal/integration_tests/mysql8/nulltypeprimitive/VarbinaryDefConstUniqueCheckPk.go @@ -0,0 +1,5 @@ +package dto + +type VarbinaryDefConstUniqueCheckPk struct { + VarbinaryDefConstUniqueCheckPk string `db:"varbinary_def_const_unique_check_pk"` +} diff --git a/internal/integration_tests/mysql8/nulltypeprimitive/VarbinaryDefConstUniqueCheckPkRef.go b/internal/integration_tests/mysql8/nulltypeprimitive/VarbinaryDefConstUniqueCheckPkRef.go new file mode 100644 index 00000000..43fdd969 --- /dev/null +++ b/internal/integration_tests/mysql8/nulltypeprimitive/VarbinaryDefConstUniqueCheckPkRef.go @@ -0,0 +1,5 @@ +package dto + +type VarbinaryDefConstUniqueCheckPkRef struct { + VarbinaryDefConstUniqueCheckPkRef string `db:"varbinary_def_const_unique_check_pk_ref"` +} diff --git a/internal/integration_tests/mysql8/nulltypeprimitive/VarbinaryDefFuncUniqueCheckPk.go b/internal/integration_tests/mysql8/nulltypeprimitive/VarbinaryDefFuncUniqueCheckPk.go new file mode 100644 index 00000000..481a8606 --- /dev/null +++ b/internal/integration_tests/mysql8/nulltypeprimitive/VarbinaryDefFuncUniqueCheckPk.go @@ -0,0 +1,5 @@ +package dto + +type VarbinaryDefFuncUniqueCheckPk struct { + VarbinaryDefFuncUniqueCheckPk string `db:"varbinary_def_func_unique_check_pk"` +} diff --git a/internal/integration_tests/mysql8/nulltypeprimitive/VarbinaryDefFuncUniqueCheckPkRef.go b/internal/integration_tests/mysql8/nulltypeprimitive/VarbinaryDefFuncUniqueCheckPkRef.go new file mode 100644 index 00000000..78e363c7 --- /dev/null +++ b/internal/integration_tests/mysql8/nulltypeprimitive/VarbinaryDefFuncUniqueCheckPkRef.go @@ -0,0 +1,5 @@ +package dto + +type VarbinaryDefFuncUniqueCheckPkRef struct { + VarbinaryDefFuncUniqueCheckPkRef string `db:"varbinary_def_func_unique_check_pk_ref"` +} diff --git a/internal/integration_tests/mysql8/nulltypeprimitive/VarbinaryNnPk.go b/internal/integration_tests/mysql8/nulltypeprimitive/VarbinaryNnPk.go new file mode 100644 index 00000000..6e2231f1 --- /dev/null +++ b/internal/integration_tests/mysql8/nulltypeprimitive/VarbinaryNnPk.go @@ -0,0 +1,5 @@ +package dto + +type VarbinaryNnPk struct { + VarbinaryNnPk string `db:"varbinary_nn_pk"` +} diff --git a/internal/integration_tests/mysql8/nulltypeprimitive/VarbinaryNnUniqueCheckPk.go b/internal/integration_tests/mysql8/nulltypeprimitive/VarbinaryNnUniqueCheckPk.go new file mode 100644 index 00000000..54f19d70 --- /dev/null +++ b/internal/integration_tests/mysql8/nulltypeprimitive/VarbinaryNnUniqueCheckPk.go @@ -0,0 +1,5 @@ +package dto + +type VarbinaryNnUniqueCheckPk struct { + VarbinaryNnUniqueCheckPk string `db:"varbinary_nn_unique_check_pk"` +} diff --git a/internal/integration_tests/mysql8/nulltypeprimitive/VarbinaryNnUniqueCheckPkRef.go b/internal/integration_tests/mysql8/nulltypeprimitive/VarbinaryNnUniqueCheckPkRef.go new file mode 100644 index 00000000..f8170e58 --- /dev/null +++ b/internal/integration_tests/mysql8/nulltypeprimitive/VarbinaryNnUniqueCheckPkRef.go @@ -0,0 +1,5 @@ +package dto + +type VarbinaryNnUniqueCheckPkRef struct { + VarbinaryNnUniqueCheckPkRef string `db:"varbinary_nn_unique_check_pk_ref"` +} diff --git a/internal/integration_tests/mysql8/nulltypeprimitive/VarbinaryPk.go b/internal/integration_tests/mysql8/nulltypeprimitive/VarbinaryPk.go new file mode 100644 index 00000000..8250904d --- /dev/null +++ b/internal/integration_tests/mysql8/nulltypeprimitive/VarbinaryPk.go @@ -0,0 +1,5 @@ +package dto + +type VarbinaryPk struct { + VarbinaryPk string `db:"varbinary_pk"` +} diff --git a/internal/integration_tests/mysql8/nulltypeprimitive/VarbinaryPkDefConst.go b/internal/integration_tests/mysql8/nulltypeprimitive/VarbinaryPkDefConst.go new file mode 100644 index 00000000..579a26ed --- /dev/null +++ b/internal/integration_tests/mysql8/nulltypeprimitive/VarbinaryPkDefConst.go @@ -0,0 +1,5 @@ +package dto + +type VarbinaryPkDefConst struct { + VarbinaryPkDefConst string `db:"varbinary_pk_def_const"` +} diff --git a/internal/integration_tests/mysql8/nulltypeprimitive/VarbinaryPkDefFunc.go b/internal/integration_tests/mysql8/nulltypeprimitive/VarbinaryPkDefFunc.go new file mode 100644 index 00000000..2bf3817f --- /dev/null +++ b/internal/integration_tests/mysql8/nulltypeprimitive/VarbinaryPkDefFunc.go @@ -0,0 +1,5 @@ +package dto + +type VarbinaryPkDefFunc struct { + VarbinaryPkDefFunc string `db:"varbinary_pk_def_func"` +} diff --git a/internal/integration_tests/mysql8/nulltypeprimitive/VarbinaryPkRef.go b/internal/integration_tests/mysql8/nulltypeprimitive/VarbinaryPkRef.go new file mode 100644 index 00000000..d395a72d --- /dev/null +++ b/internal/integration_tests/mysql8/nulltypeprimitive/VarbinaryPkRef.go @@ -0,0 +1,5 @@ +package dto + +type VarbinaryPkRef struct { + VarbinaryPkRef string `db:"varbinary_pk_ref"` +} diff --git a/internal/integration_tests/mysql8/nulltypeprimitive/VarbinaryRef.go b/internal/integration_tests/mysql8/nulltypeprimitive/VarbinaryRef.go new file mode 100644 index 00000000..60528578 --- /dev/null +++ b/internal/integration_tests/mysql8/nulltypeprimitive/VarbinaryRef.go @@ -0,0 +1,5 @@ +package dto + +type VarbinaryRef struct { + VarbinaryRef *string `db:"varbinary_ref"` +} diff --git a/internal/integration_tests/mysql8/nulltypeprimitive/VarbinaryTable.go b/internal/integration_tests/mysql8/nulltypeprimitive/VarbinaryTable.go new file mode 100644 index 00000000..e3751435 --- /dev/null +++ b/internal/integration_tests/mysql8/nulltypeprimitive/VarbinaryTable.go @@ -0,0 +1,29 @@ +package dto + +type VarbinaryTable struct { + Col *string `db:"col"` + VarbinaryCap *string `db:"varbinary_cap"` + VarbinaryNn string `db:"varbinary_nn"` + VarbinaryNnUnique string `db:"varbinary_nn_unique"` + VarbinaryNnCheckCmp string `db:"varbinary_nn_check_cmp"` + VarbinaryNnCheckFn string `db:"varbinary_nn_check_fn"` + VarbinaryNnRef string `db:"varbinary_nn_ref"` + VarbinaryNnDefConst string `db:"varbinary_nn_def_const"` + VarbinaryNnDefFunc string `db:"varbinary_nn_def_func"` + VarbinaryNnUniqueCheck string `db:"varbinary_nn_unique_check"` + VarbinaryUnique *string `db:"varbinary_unique"` + VarbinaryUniqueCheck *string `db:"varbinary_unique_check"` + VarbinaryUniqueRef *string `db:"varbinary_unique_ref"` + VarbinaryUniqueDefConst *string `db:"varbinary_unique_def_const"` + VarbinaryUniqueDefFunc *string `db:"varbinary_unique_def_func"` + VarbinaryCheck *string `db:"varbinary_check"` + VarbinaryCheckRef *string `db:"varbinary_check_ref"` + VarbinaryCheckDefConst *string `db:"varbinary_check_def_const"` + VarbinaryCheckDefFunc *string `db:"varbinary_check_def_func"` + VarbinaryRef *string `db:"varbinary_ref"` + VarbinaryRefUniqueCheck *string `db:"varbinary_ref_unique_check"` + VarbinaryDefConst *string `db:"varbinary_def_const"` + VarbinaryDefConstUniqueCheck *string `db:"varbinary_def_const_unique_check"` + VarbinaryDefFunc *string `db:"varbinary_def_func"` + VarbinaryDefFuncUniqueCheck *string `db:"varbinary_def_func_unique_check"` +} diff --git a/internal/integration_tests/mysql8/nulltypeprimitive/VarbinaryUniqueCheckPk.go b/internal/integration_tests/mysql8/nulltypeprimitive/VarbinaryUniqueCheckPk.go new file mode 100644 index 00000000..cd74bfc8 --- /dev/null +++ b/internal/integration_tests/mysql8/nulltypeprimitive/VarbinaryUniqueCheckPk.go @@ -0,0 +1,5 @@ +package dto + +type VarbinaryUniqueCheckPk struct { + VarbinaryUniqueCheckPk string `db:"varbinary_unique_check_pk"` +} diff --git a/internal/integration_tests/mysql8/nulltypeprimitive/VarbinaryUniqueCheckPkRef.go b/internal/integration_tests/mysql8/nulltypeprimitive/VarbinaryUniqueCheckPkRef.go new file mode 100644 index 00000000..883c332d --- /dev/null +++ b/internal/integration_tests/mysql8/nulltypeprimitive/VarbinaryUniqueCheckPkRef.go @@ -0,0 +1,5 @@ +package dto + +type VarbinaryUniqueCheckPkRef struct { + VarbinaryUniqueCheckPkRef string `db:"varbinary_unique_check_pk_ref"` +} diff --git a/internal/integration_tests/mysql8/nulltypeprimitive/VarbinaryUniquePk.go b/internal/integration_tests/mysql8/nulltypeprimitive/VarbinaryUniquePk.go new file mode 100644 index 00000000..92816a2c --- /dev/null +++ b/internal/integration_tests/mysql8/nulltypeprimitive/VarbinaryUniquePk.go @@ -0,0 +1,5 @@ +package dto + +type VarbinaryUniquePk struct { + VarbinaryUniquePk string `db:"varbinary_unique_pk"` +} diff --git a/internal/integration_tests/mysql8/nulltypeprimitive/VarcharCheckPk.go b/internal/integration_tests/mysql8/nulltypeprimitive/VarcharCheckPk.go new file mode 100644 index 00000000..3f42d91f --- /dev/null +++ b/internal/integration_tests/mysql8/nulltypeprimitive/VarcharCheckPk.go @@ -0,0 +1,5 @@ +package dto + +type VarcharCheckPk struct { + VarcharCheckPk string `db:"varchar_check_pk"` +} diff --git a/internal/integration_tests/mysql8/nulltypeprimitive/VarcharDefConstUniqueCheckPk.go b/internal/integration_tests/mysql8/nulltypeprimitive/VarcharDefConstUniqueCheckPk.go new file mode 100644 index 00000000..b0c8f76b --- /dev/null +++ b/internal/integration_tests/mysql8/nulltypeprimitive/VarcharDefConstUniqueCheckPk.go @@ -0,0 +1,5 @@ +package dto + +type VarcharDefConstUniqueCheckPk struct { + VarcharDefConstUniqueCheckPk string `db:"varchar_def_const_unique_check_pk"` +} diff --git a/internal/integration_tests/mysql8/nulltypeprimitive/VarcharDefConstUniqueCheckPkRef.go b/internal/integration_tests/mysql8/nulltypeprimitive/VarcharDefConstUniqueCheckPkRef.go new file mode 100644 index 00000000..55840733 --- /dev/null +++ b/internal/integration_tests/mysql8/nulltypeprimitive/VarcharDefConstUniqueCheckPkRef.go @@ -0,0 +1,5 @@ +package dto + +type VarcharDefConstUniqueCheckPkRef struct { + VarcharDefConstUniqueCheckPkRef string `db:"varchar_def_const_unique_check_pk_ref"` +} diff --git a/internal/integration_tests/mysql8/nulltypeprimitive/VarcharDefFuncUniqueCheckPk.go b/internal/integration_tests/mysql8/nulltypeprimitive/VarcharDefFuncUniqueCheckPk.go new file mode 100644 index 00000000..eb63e5d1 --- /dev/null +++ b/internal/integration_tests/mysql8/nulltypeprimitive/VarcharDefFuncUniqueCheckPk.go @@ -0,0 +1,5 @@ +package dto + +type VarcharDefFuncUniqueCheckPk struct { + VarcharDefFuncUniqueCheckPk string `db:"varchar_def_func_unique_check_pk"` +} diff --git a/internal/integration_tests/mysql8/nulltypeprimitive/VarcharDefFuncUniqueCheckPkRef.go b/internal/integration_tests/mysql8/nulltypeprimitive/VarcharDefFuncUniqueCheckPkRef.go new file mode 100644 index 00000000..8b002629 --- /dev/null +++ b/internal/integration_tests/mysql8/nulltypeprimitive/VarcharDefFuncUniqueCheckPkRef.go @@ -0,0 +1,5 @@ +package dto + +type VarcharDefFuncUniqueCheckPkRef struct { + VarcharDefFuncUniqueCheckPkRef string `db:"varchar_def_func_unique_check_pk_ref"` +} diff --git a/internal/integration_tests/mysql8/nulltypeprimitive/VarcharNnPk.go b/internal/integration_tests/mysql8/nulltypeprimitive/VarcharNnPk.go new file mode 100644 index 00000000..b8364e86 --- /dev/null +++ b/internal/integration_tests/mysql8/nulltypeprimitive/VarcharNnPk.go @@ -0,0 +1,5 @@ +package dto + +type VarcharNnPk struct { + VarcharNnPk string `db:"varchar_nn_pk"` +} diff --git a/internal/integration_tests/mysql8/nulltypeprimitive/VarcharNnUniqueCheckPk.go b/internal/integration_tests/mysql8/nulltypeprimitive/VarcharNnUniqueCheckPk.go new file mode 100644 index 00000000..0a24372c --- /dev/null +++ b/internal/integration_tests/mysql8/nulltypeprimitive/VarcharNnUniqueCheckPk.go @@ -0,0 +1,5 @@ +package dto + +type VarcharNnUniqueCheckPk struct { + VarcharNnUniqueCheckPk string `db:"varchar_nn_unique_check_pk"` +} diff --git a/internal/integration_tests/mysql8/nulltypeprimitive/VarcharNnUniqueCheckPkRef.go b/internal/integration_tests/mysql8/nulltypeprimitive/VarcharNnUniqueCheckPkRef.go new file mode 100644 index 00000000..419161c0 --- /dev/null +++ b/internal/integration_tests/mysql8/nulltypeprimitive/VarcharNnUniqueCheckPkRef.go @@ -0,0 +1,5 @@ +package dto + +type VarcharNnUniqueCheckPkRef struct { + VarcharNnUniqueCheckPkRef string `db:"varchar_nn_unique_check_pk_ref"` +} diff --git a/internal/integration_tests/mysql8/nulltypeprimitive/VarcharPk.go b/internal/integration_tests/mysql8/nulltypeprimitive/VarcharPk.go new file mode 100644 index 00000000..d04cc77d --- /dev/null +++ b/internal/integration_tests/mysql8/nulltypeprimitive/VarcharPk.go @@ -0,0 +1,5 @@ +package dto + +type VarcharPk struct { + VarcharPk string `db:"varchar_pk"` +} diff --git a/internal/integration_tests/mysql8/nulltypeprimitive/VarcharPkDefConst.go b/internal/integration_tests/mysql8/nulltypeprimitive/VarcharPkDefConst.go new file mode 100644 index 00000000..2b5b3bce --- /dev/null +++ b/internal/integration_tests/mysql8/nulltypeprimitive/VarcharPkDefConst.go @@ -0,0 +1,5 @@ +package dto + +type VarcharPkDefConst struct { + VarcharPkDefConst string `db:"varchar_pk_def_const"` +} diff --git a/internal/integration_tests/mysql8/nulltypeprimitive/VarcharPkDefFunc.go b/internal/integration_tests/mysql8/nulltypeprimitive/VarcharPkDefFunc.go new file mode 100644 index 00000000..8e0d43b6 --- /dev/null +++ b/internal/integration_tests/mysql8/nulltypeprimitive/VarcharPkDefFunc.go @@ -0,0 +1,5 @@ +package dto + +type VarcharPkDefFunc struct { + VarcharPkDefFunc string `db:"varchar_pk_def_func"` +} diff --git a/internal/integration_tests/mysql8/nulltypeprimitive/VarcharPkRef.go b/internal/integration_tests/mysql8/nulltypeprimitive/VarcharPkRef.go new file mode 100644 index 00000000..1237c5d4 --- /dev/null +++ b/internal/integration_tests/mysql8/nulltypeprimitive/VarcharPkRef.go @@ -0,0 +1,5 @@ +package dto + +type VarcharPkRef struct { + VarcharPkRef string `db:"varchar_pk_ref"` +} diff --git a/internal/integration_tests/mysql8/nulltypeprimitive/VarcharRef.go b/internal/integration_tests/mysql8/nulltypeprimitive/VarcharRef.go new file mode 100644 index 00000000..2f7810a0 --- /dev/null +++ b/internal/integration_tests/mysql8/nulltypeprimitive/VarcharRef.go @@ -0,0 +1,5 @@ +package dto + +type VarcharRef struct { + VarcharRef *string `db:"varchar_ref"` +} diff --git a/internal/integration_tests/mysql8/nulltypeprimitive/VarcharTable.go b/internal/integration_tests/mysql8/nulltypeprimitive/VarcharTable.go new file mode 100644 index 00000000..42246b36 --- /dev/null +++ b/internal/integration_tests/mysql8/nulltypeprimitive/VarcharTable.go @@ -0,0 +1,29 @@ +package dto + +type VarcharTable struct { + Col *string `db:"col"` + VarcharCap *string `db:"varchar_cap"` + VarcharNn string `db:"varchar_nn"` + VarcharNnUnique string `db:"varchar_nn_unique"` + VarcharNnCheckCmp string `db:"varchar_nn_check_cmp"` + VarcharNnCheckFn string `db:"varchar_nn_check_fn"` + VarcharNnRef string `db:"varchar_nn_ref"` + VarcharNnDefConst string `db:"varchar_nn_def_const"` + VarcharNnDefFunc string `db:"varchar_nn_def_func"` + VarcharNnUniqueCheck string `db:"varchar_nn_unique_check"` + VarcharUnique *string `db:"varchar_unique"` + VarcharUniqueCheck *string `db:"varchar_unique_check"` + VarcharUniqueRef *string `db:"varchar_unique_ref"` + VarcharUniqueDefConst *string `db:"varchar_unique_def_const"` + VarcharUniqueDefFunc *string `db:"varchar_unique_def_func"` + VarcharCheck *string `db:"varchar_check"` + VarcharCheckRef *string `db:"varchar_check_ref"` + VarcharCheckDefConst *string `db:"varchar_check_def_const"` + VarcharCheckDefFunc *string `db:"varchar_check_def_func"` + VarcharRef *string `db:"varchar_ref"` + VarcharRefUniqueCheck *string `db:"varchar_ref_unique_check"` + VarcharDefConst *string `db:"varchar_def_const"` + VarcharDefConstUniqueCheck *string `db:"varchar_def_const_unique_check"` + VarcharDefFunc *string `db:"varchar_def_func"` + VarcharDefFuncUniqueCheck *string `db:"varchar_def_func_unique_check"` +} diff --git a/internal/integration_tests/mysql8/nulltypeprimitive/VarcharUniqueCheckPk.go b/internal/integration_tests/mysql8/nulltypeprimitive/VarcharUniqueCheckPk.go new file mode 100644 index 00000000..98513a8f --- /dev/null +++ b/internal/integration_tests/mysql8/nulltypeprimitive/VarcharUniqueCheckPk.go @@ -0,0 +1,5 @@ +package dto + +type VarcharUniqueCheckPk struct { + VarcharUniqueCheckPk string `db:"varchar_unique_check_pk"` +} diff --git a/internal/integration_tests/mysql8/nulltypeprimitive/VarcharUniqueCheckPkRef.go b/internal/integration_tests/mysql8/nulltypeprimitive/VarcharUniqueCheckPkRef.go new file mode 100644 index 00000000..9e078bac --- /dev/null +++ b/internal/integration_tests/mysql8/nulltypeprimitive/VarcharUniqueCheckPkRef.go @@ -0,0 +1,5 @@ +package dto + +type VarcharUniqueCheckPkRef struct { + VarcharUniqueCheckPkRef string `db:"varchar_unique_check_pk_ref"` +} diff --git a/internal/integration_tests/mysql8/nulltypeprimitive/VarcharUniquePk.go b/internal/integration_tests/mysql8/nulltypeprimitive/VarcharUniquePk.go new file mode 100644 index 00000000..66a68448 --- /dev/null +++ b/internal/integration_tests/mysql8/nulltypeprimitive/VarcharUniquePk.go @@ -0,0 +1,5 @@ +package dto + +type VarcharUniquePk struct { + VarcharUniquePk string `db:"varchar_unique_pk"` +} diff --git a/internal/integration_tests/mysql8/nulltypeprimitive/YearCheckPk.go b/internal/integration_tests/mysql8/nulltypeprimitive/YearCheckPk.go new file mode 100644 index 00000000..098cc2b7 --- /dev/null +++ b/internal/integration_tests/mysql8/nulltypeprimitive/YearCheckPk.go @@ -0,0 +1,9 @@ +package dto + +import ( + "time" +) + +type YearCheckPk struct { + YearCheckPk time.Time `db:"year_check_pk"` +} diff --git a/internal/integration_tests/mysql8/nulltypeprimitive/YearDefConstUniqueCheckPk.go b/internal/integration_tests/mysql8/nulltypeprimitive/YearDefConstUniqueCheckPk.go new file mode 100644 index 00000000..15ba8ad8 --- /dev/null +++ b/internal/integration_tests/mysql8/nulltypeprimitive/YearDefConstUniqueCheckPk.go @@ -0,0 +1,9 @@ +package dto + +import ( + "time" +) + +type YearDefConstUniqueCheckPk struct { + YearDefConstUniqueCheckPk time.Time `db:"year_def_const_unique_check_pk"` +} diff --git a/internal/integration_tests/mysql8/nulltypeprimitive/YearDefConstUniqueCheckPkRef.go b/internal/integration_tests/mysql8/nulltypeprimitive/YearDefConstUniqueCheckPkRef.go new file mode 100644 index 00000000..85043112 --- /dev/null +++ b/internal/integration_tests/mysql8/nulltypeprimitive/YearDefConstUniqueCheckPkRef.go @@ -0,0 +1,9 @@ +package dto + +import ( + "time" +) + +type YearDefConstUniqueCheckPkRef struct { + YearDefConstUniqueCheckPkRef time.Time `db:"year_def_const_unique_check_pk_ref"` +} diff --git a/internal/integration_tests/mysql8/nulltypeprimitive/YearDefFuncUniqueCheckPk.go b/internal/integration_tests/mysql8/nulltypeprimitive/YearDefFuncUniqueCheckPk.go new file mode 100644 index 00000000..4b6c7ad7 --- /dev/null +++ b/internal/integration_tests/mysql8/nulltypeprimitive/YearDefFuncUniqueCheckPk.go @@ -0,0 +1,9 @@ +package dto + +import ( + "time" +) + +type YearDefFuncUniqueCheckPk struct { + YearDefFuncUniqueCheckPk time.Time `db:"year_def_func_unique_check_pk"` +} diff --git a/internal/integration_tests/mysql8/nulltypeprimitive/YearDefFuncUniqueCheckPkRef.go b/internal/integration_tests/mysql8/nulltypeprimitive/YearDefFuncUniqueCheckPkRef.go new file mode 100644 index 00000000..ec31e106 --- /dev/null +++ b/internal/integration_tests/mysql8/nulltypeprimitive/YearDefFuncUniqueCheckPkRef.go @@ -0,0 +1,9 @@ +package dto + +import ( + "time" +) + +type YearDefFuncUniqueCheckPkRef struct { + YearDefFuncUniqueCheckPkRef time.Time `db:"year_def_func_unique_check_pk_ref"` +} diff --git a/internal/integration_tests/mysql8/nulltypeprimitive/YearNnPk.go b/internal/integration_tests/mysql8/nulltypeprimitive/YearNnPk.go new file mode 100644 index 00000000..806ee601 --- /dev/null +++ b/internal/integration_tests/mysql8/nulltypeprimitive/YearNnPk.go @@ -0,0 +1,9 @@ +package dto + +import ( + "time" +) + +type YearNnPk struct { + YearNnPk time.Time `db:"year_nn_pk"` +} diff --git a/internal/integration_tests/mysql8/nulltypeprimitive/YearNnUniqueCheckPk.go b/internal/integration_tests/mysql8/nulltypeprimitive/YearNnUniqueCheckPk.go new file mode 100644 index 00000000..390293e5 --- /dev/null +++ b/internal/integration_tests/mysql8/nulltypeprimitive/YearNnUniqueCheckPk.go @@ -0,0 +1,9 @@ +package dto + +import ( + "time" +) + +type YearNnUniqueCheckPk struct { + YearNnUniqueCheckPk time.Time `db:"year_nn_unique_check_pk"` +} diff --git a/internal/integration_tests/mysql8/nulltypeprimitive/YearNnUniqueCheckPkRef.go b/internal/integration_tests/mysql8/nulltypeprimitive/YearNnUniqueCheckPkRef.go new file mode 100644 index 00000000..29c667cd --- /dev/null +++ b/internal/integration_tests/mysql8/nulltypeprimitive/YearNnUniqueCheckPkRef.go @@ -0,0 +1,9 @@ +package dto + +import ( + "time" +) + +type YearNnUniqueCheckPkRef struct { + YearNnUniqueCheckPkRef time.Time `db:"year_nn_unique_check_pk_ref"` +} diff --git a/internal/integration_tests/mysql8/nulltypeprimitive/YearPk.go b/internal/integration_tests/mysql8/nulltypeprimitive/YearPk.go new file mode 100644 index 00000000..2dc02194 --- /dev/null +++ b/internal/integration_tests/mysql8/nulltypeprimitive/YearPk.go @@ -0,0 +1,9 @@ +package dto + +import ( + "time" +) + +type YearPk struct { + YearPk time.Time `db:"year_pk"` +} diff --git a/internal/integration_tests/mysql8/nulltypeprimitive/YearPkDefConst.go b/internal/integration_tests/mysql8/nulltypeprimitive/YearPkDefConst.go new file mode 100644 index 00000000..de1191fc --- /dev/null +++ b/internal/integration_tests/mysql8/nulltypeprimitive/YearPkDefConst.go @@ -0,0 +1,9 @@ +package dto + +import ( + "time" +) + +type YearPkDefConst struct { + YearPkDefConst time.Time `db:"year_pk_def_const"` +} diff --git a/internal/integration_tests/mysql8/nulltypeprimitive/YearPkDefFunc.go b/internal/integration_tests/mysql8/nulltypeprimitive/YearPkDefFunc.go new file mode 100644 index 00000000..fd1faf72 --- /dev/null +++ b/internal/integration_tests/mysql8/nulltypeprimitive/YearPkDefFunc.go @@ -0,0 +1,9 @@ +package dto + +import ( + "time" +) + +type YearPkDefFunc struct { + YearPkDefFunc time.Time `db:"year_pk_def_func"` +} diff --git a/internal/integration_tests/mysql8/nulltypeprimitive/YearPkRef.go b/internal/integration_tests/mysql8/nulltypeprimitive/YearPkRef.go new file mode 100644 index 00000000..a031e633 --- /dev/null +++ b/internal/integration_tests/mysql8/nulltypeprimitive/YearPkRef.go @@ -0,0 +1,9 @@ +package dto + +import ( + "time" +) + +type YearPkRef struct { + YearPkRef time.Time `db:"year_pk_ref"` +} diff --git a/internal/integration_tests/mysql8/nulltypeprimitive/YearRef.go b/internal/integration_tests/mysql8/nulltypeprimitive/YearRef.go new file mode 100644 index 00000000..7a41313b --- /dev/null +++ b/internal/integration_tests/mysql8/nulltypeprimitive/YearRef.go @@ -0,0 +1,9 @@ +package dto + +import ( + "time" +) + +type YearRef struct { + YearRef *time.Time `db:"year_ref"` +} diff --git a/internal/integration_tests/mysql8/nulltypeprimitive/YearTable.go b/internal/integration_tests/mysql8/nulltypeprimitive/YearTable.go new file mode 100644 index 00000000..146470b4 --- /dev/null +++ b/internal/integration_tests/mysql8/nulltypeprimitive/YearTable.go @@ -0,0 +1,31 @@ +package dto + +import ( + "time" +) + +type YearTable struct { + Year *time.Time `db:"year"` + YearNn time.Time `db:"year_nn"` + YearNnUnique time.Time `db:"year_nn_unique"` + YearNnCheck time.Time `db:"year_nn_check"` + YearNnRef time.Time `db:"year_nn_ref"` + YearNnDefConst time.Time `db:"year_nn_def_const"` + YearNnDefFunc time.Time `db:"year_nn_def_func"` + YearNnUniqueCheck time.Time `db:"year_nn_unique_check"` + YearUnique *time.Time `db:"year_unique"` + YearUniqueCheck *time.Time `db:"year_unique_check"` + YearUniqueRef *time.Time `db:"year_unique_ref"` + YearUniqueDefConst *time.Time `db:"year_unique_def_const"` + YearUniqueDefFunc *time.Time `db:"year_unique_def_func"` + YearCheck *time.Time `db:"year_check"` + YearCheckRef *time.Time `db:"year_check_ref"` + YearCheckDefConst *time.Time `db:"year_check_def_const"` + YearCheckDefFunc *time.Time `db:"year_check_def_func"` + YearRef *time.Time `db:"year_ref"` + YearRefUniqueCheck *time.Time `db:"year_ref_unique_check"` + YearDefConst *time.Time `db:"year_def_const"` + YearDefConstUniqueCheck *time.Time `db:"year_def_const_unique_check"` + YearDefFunc *time.Time `db:"year_def_func"` + YearDefFuncUniqueCheck *time.Time `db:"year_def_func_unique_check"` +} diff --git a/internal/integration_tests/mysql8/nulltypeprimitive/YearUniqueCheckPk.go b/internal/integration_tests/mysql8/nulltypeprimitive/YearUniqueCheckPk.go new file mode 100644 index 00000000..b677a138 --- /dev/null +++ b/internal/integration_tests/mysql8/nulltypeprimitive/YearUniqueCheckPk.go @@ -0,0 +1,9 @@ +package dto + +import ( + "time" +) + +type YearUniqueCheckPk struct { + YearUniqueCheckPk time.Time `db:"year_unique_check_pk"` +} diff --git a/internal/integration_tests/mysql8/nulltypeprimitive/YearUniqueCheckPkRef.go b/internal/integration_tests/mysql8/nulltypeprimitive/YearUniqueCheckPkRef.go new file mode 100644 index 00000000..798abf45 --- /dev/null +++ b/internal/integration_tests/mysql8/nulltypeprimitive/YearUniqueCheckPkRef.go @@ -0,0 +1,9 @@ +package dto + +import ( + "time" +) + +type YearUniqueCheckPkRef struct { + YearUniqueCheckPkRef time.Time `db:"year_unique_check_pk_ref"` +} diff --git a/internal/integration_tests/mysql8/nulltypeprimitive/YearUniquePk.go b/internal/integration_tests/mysql8/nulltypeprimitive/YearUniquePk.go new file mode 100644 index 00000000..beca6fda --- /dev/null +++ b/internal/integration_tests/mysql8/nulltypeprimitive/YearUniquePk.go @@ -0,0 +1,9 @@ +package dto + +import ( + "time" +) + +type YearUniquePk struct { + YearUniquePk time.Time `db:"year_unique_pk"` +} diff --git a/internal/integration_tests/mysql8/outputformatoriginal/DatetimeTable.go b/internal/integration_tests/mysql8/outputformatoriginal/DatetimeTable.go new file mode 100644 index 00000000..5725f617 --- /dev/null +++ b/internal/integration_tests/mysql8/outputformatoriginal/DatetimeTable.go @@ -0,0 +1,32 @@ +package dto + +import ( + "database/sql" + "time" +) + +type Datetime_table struct { + Datetime sql.NullTime `db:"datetime"` + Datetime_nn time.Time `db:"datetime_nn"` + Datetime_nn_unique time.Time `db:"datetime_nn_unique"` + Datetime_nn_check time.Time `db:"datetime_nn_check"` + Datetime_nn_ref time.Time `db:"datetime_nn_ref"` + Datetime_nn_def_const time.Time `db:"datetime_nn_def_const"` + Datetime_nn_def_func time.Time `db:"datetime_nn_def_func"` + Datetime_nn_unique_check time.Time `db:"datetime_nn_unique_check"` + Datetime_unique sql.NullTime `db:"datetime_unique"` + Datetime_unique_check sql.NullTime `db:"datetime_unique_check"` + Datetime_unique_ref sql.NullTime `db:"datetime_unique_ref"` + Datetime_unique_def_const sql.NullTime `db:"datetime_unique_def_const"` + Datetime_unique_def_func sql.NullTime `db:"datetime_unique_def_func"` + Datetime_check sql.NullTime `db:"datetime_check"` + Datetime_check_ref sql.NullTime `db:"datetime_check_ref"` + Datetime_check_def_const sql.NullTime `db:"datetime_check_def_const"` + Datetime_check_def_func sql.NullTime `db:"datetime_check_def_func"` + Datetime_ref sql.NullTime `db:"datetime_ref"` + Datetime_ref_unique_check sql.NullTime `db:"datetime_ref_unique_check"` + Datetime_def_const sql.NullTime `db:"datetime_def_const"` + Datetime_def_const_unique_check sql.NullTime `db:"datetime_def_const_unique_check"` + Datetime_def_func sql.NullTime `db:"datetime_def_func"` + Datetime_def_func_unique_check sql.NullTime `db:"datetime_def_func_unique_check"` +} diff --git a/internal/integration_tests/mysql8/outputformatoriginal/FloatTable.go b/internal/integration_tests/mysql8/outputformatoriginal/FloatTable.go new file mode 100644 index 00000000..1c79814a --- /dev/null +++ b/internal/integration_tests/mysql8/outputformatoriginal/FloatTable.go @@ -0,0 +1,31 @@ +package dto + +import ( + "database/sql" +) + +type Float_table struct { + Col sql.NullFloat64 `db:"col"` + Float_nn float64 `db:"float_nn"` + Float_nn_unique float64 `db:"float_nn_unique"` + Float_nn_check float64 `db:"float_nn_check"` + Float_nn_ref float64 `db:"float_nn_ref"` + Float_nn_def_const float64 `db:"float_nn_def_const"` + Float_nn_def_func float64 `db:"float_nn_def_func"` + Float_nn_unique_check float64 `db:"float_nn_unique_check"` + Float_unique sql.NullFloat64 `db:"float_unique"` + Float_unique_check sql.NullFloat64 `db:"float_unique_check"` + Float_unique_ref sql.NullFloat64 `db:"float_unique_ref"` + Float_unique_def_const sql.NullFloat64 `db:"float_unique_def_const"` + Float_unique_def_func sql.NullFloat64 `db:"float_unique_def_func"` + Float_check sql.NullFloat64 `db:"float_check"` + Float_check_ref sql.NullFloat64 `db:"float_check_ref"` + Float_check_def_const sql.NullFloat64 `db:"float_check_def_const"` + Float_check_def_func sql.NullFloat64 `db:"float_check_def_func"` + Float_ref sql.NullFloat64 `db:"float_ref"` + Float_ref_unique_check sql.NullFloat64 `db:"float_ref_unique_check"` + Float_def_const sql.NullFloat64 `db:"float_def_const"` + Float_def_const_unique_check sql.NullFloat64 `db:"float_def_const_unique_check"` + Float_def_func sql.NullFloat64 `db:"float_def_func"` + Float_def_func_unique_check sql.NullFloat64 `db:"float_def_func_unique_check"` +} diff --git a/internal/integration_tests/mysql8/outputformatoriginal/IntegerTable.go b/internal/integration_tests/mysql8/outputformatoriginal/IntegerTable.go new file mode 100644 index 00000000..6db257ad --- /dev/null +++ b/internal/integration_tests/mysql8/outputformatoriginal/IntegerTable.go @@ -0,0 +1,27 @@ +package dto + +import ( + "database/sql" +) + +type Integer_table struct { + I sql.NullInt64 `db:"i"` + Integer_nn int `db:"integer_nn"` + Integer_nn_unique int `db:"integer_nn_unique"` + Integer_nn_check int `db:"integer_nn_check"` + Integer_unique sql.NullInt64 `db:"integer_unique"` + Integer_unique_check sql.NullInt64 `db:"integer_unique_check"` + Integer_unique_ref sql.NullInt64 `db:"integer_unique_ref"` + Integer_unique_def_const sql.NullInt64 `db:"integer_unique_def_const"` + Integer_unique_def_func sql.NullInt64 `db:"integer_unique_def_func"` + Integer_check sql.NullInt64 `db:"integer_check"` + Integer_check_ref sql.NullInt64 `db:"integer_check_ref"` + Integer_check_def_const sql.NullInt64 `db:"integer_check_def_const"` + Integer_check_def_func sql.NullInt64 `db:"integer_check_def_func"` + Integer_ref sql.NullInt64 `db:"integer_ref"` + Integer_ref_unique_check sql.NullInt64 `db:"integer_ref_unique_check"` + Integer_def_const sql.NullInt64 `db:"integer_def_const"` + Integer_def_const_unique_check sql.NullInt64 `db:"integer_def_const_unique_check"` + Integer_def_func sql.NullInt64 `db:"integer_def_func"` + Integer_def_func_unique_check sql.NullInt64 `db:"integer_def_func_unique_check"` +} diff --git a/internal/integration_tests/mysql8/outputformatoriginal/User.go b/internal/integration_tests/mysql8/outputformatoriginal/User.go new file mode 100644 index 00000000..02528370 --- /dev/null +++ b/internal/integration_tests/mysql8/outputformatoriginal/User.go @@ -0,0 +1,11 @@ +package dto + +import ( + "database/sql" +) + +type User struct { + ID int `db:"id"` + User_ID int `db:"user_id"` + Website_URL sql.NullString `db:"website_url"` +} diff --git a/internal/integration_tests/mysql8/outputformatoriginal/VarcharTable.go b/internal/integration_tests/mysql8/outputformatoriginal/VarcharTable.go new file mode 100644 index 00000000..2de4ed7b --- /dev/null +++ b/internal/integration_tests/mysql8/outputformatoriginal/VarcharTable.go @@ -0,0 +1,33 @@ +package dto + +import ( + "database/sql" +) + +type Varchar_table struct { + Col sql.NullString `db:"col"` + Varchar_cap sql.NullString `db:"varchar_cap"` + Varchar_nn string `db:"varchar_nn"` + Varchar_nn_unique string `db:"varchar_nn_unique"` + Varchar_nn_check_cmp string `db:"varchar_nn_check_cmp"` + Varchar_nn_check_fn string `db:"varchar_nn_check_fn"` + Varchar_nn_ref string `db:"varchar_nn_ref"` + Varchar_nn_def_const string `db:"varchar_nn_def_const"` + Varchar_nn_def_func string `db:"varchar_nn_def_func"` + Varchar_nn_unique_check string `db:"varchar_nn_unique_check"` + Varchar_unique sql.NullString `db:"varchar_unique"` + Varchar_unique_check sql.NullString `db:"varchar_unique_check"` + Varchar_unique_ref sql.NullString `db:"varchar_unique_ref"` + Varchar_unique_def_const sql.NullString `db:"varchar_unique_def_const"` + Varchar_unique_def_func sql.NullString `db:"varchar_unique_def_func"` + Varchar_check sql.NullString `db:"varchar_check"` + Varchar_check_ref sql.NullString `db:"varchar_check_ref"` + Varchar_check_def_const sql.NullString `db:"varchar_check_def_const"` + Varchar_check_def_func sql.NullString `db:"varchar_check_def_func"` + Varchar_ref sql.NullString `db:"varchar_ref"` + Varchar_ref_unique_check sql.NullString `db:"varchar_ref_unique_check"` + Varchar_def_const sql.NullString `db:"varchar_def_const"` + Varchar_def_const_unique_check sql.NullString `db:"varchar_def_const_unique_check"` + Varchar_def_func sql.NullString `db:"varchar_def_func"` + Varchar_def_func_unique_check sql.NullString `db:"varchar_def_func_unique_check"` +} diff --git a/internal/integration_tests/mysql8/packagename/DatetimeTable.go b/internal/integration_tests/mysql8/packagename/DatetimeTable.go new file mode 100644 index 00000000..1a1001c1 --- /dev/null +++ b/internal/integration_tests/mysql8/packagename/DatetimeTable.go @@ -0,0 +1,32 @@ +package models + +import ( + "database/sql" + "time" +) + +type DatetimeTable struct { + Datetime sql.NullTime `db:"datetime"` + DatetimeNn time.Time `db:"datetime_nn"` + DatetimeNnUnique time.Time `db:"datetime_nn_unique"` + DatetimeNnCheck time.Time `db:"datetime_nn_check"` + DatetimeNnRef time.Time `db:"datetime_nn_ref"` + DatetimeNnDefConst time.Time `db:"datetime_nn_def_const"` + DatetimeNnDefFunc time.Time `db:"datetime_nn_def_func"` + DatetimeNnUniqueCheck time.Time `db:"datetime_nn_unique_check"` + DatetimeUnique sql.NullTime `db:"datetime_unique"` + DatetimeUniqueCheck sql.NullTime `db:"datetime_unique_check"` + DatetimeUniqueRef sql.NullTime `db:"datetime_unique_ref"` + DatetimeUniqueDefConst sql.NullTime `db:"datetime_unique_def_const"` + DatetimeUniqueDefFunc sql.NullTime `db:"datetime_unique_def_func"` + DatetimeCheck sql.NullTime `db:"datetime_check"` + DatetimeCheckRef sql.NullTime `db:"datetime_check_ref"` + DatetimeCheckDefConst sql.NullTime `db:"datetime_check_def_const"` + DatetimeCheckDefFunc sql.NullTime `db:"datetime_check_def_func"` + DatetimeRef sql.NullTime `db:"datetime_ref"` + DatetimeRefUniqueCheck sql.NullTime `db:"datetime_ref_unique_check"` + DatetimeDefConst sql.NullTime `db:"datetime_def_const"` + DatetimeDefConstUniqueCheck sql.NullTime `db:"datetime_def_const_unique_check"` + DatetimeDefFunc sql.NullTime `db:"datetime_def_func"` + DatetimeDefFuncUniqueCheck sql.NullTime `db:"datetime_def_func_unique_check"` +} diff --git a/internal/integration_tests/mysql8/packagename/FloatTable.go b/internal/integration_tests/mysql8/packagename/FloatTable.go new file mode 100644 index 00000000..706abb81 --- /dev/null +++ b/internal/integration_tests/mysql8/packagename/FloatTable.go @@ -0,0 +1,31 @@ +package models + +import ( + "database/sql" +) + +type FloatTable struct { + Col sql.NullFloat64 `db:"col"` + FloatNn float64 `db:"float_nn"` + FloatNnUnique float64 `db:"float_nn_unique"` + FloatNnCheck float64 `db:"float_nn_check"` + FloatNnRef float64 `db:"float_nn_ref"` + FloatNnDefConst float64 `db:"float_nn_def_const"` + FloatNnDefFunc float64 `db:"float_nn_def_func"` + FloatNnUniqueCheck float64 `db:"float_nn_unique_check"` + FloatUnique sql.NullFloat64 `db:"float_unique"` + FloatUniqueCheck sql.NullFloat64 `db:"float_unique_check"` + FloatUniqueRef sql.NullFloat64 `db:"float_unique_ref"` + FloatUniqueDefConst sql.NullFloat64 `db:"float_unique_def_const"` + FloatUniqueDefFunc sql.NullFloat64 `db:"float_unique_def_func"` + FloatCheck sql.NullFloat64 `db:"float_check"` + FloatCheckRef sql.NullFloat64 `db:"float_check_ref"` + FloatCheckDefConst sql.NullFloat64 `db:"float_check_def_const"` + FloatCheckDefFunc sql.NullFloat64 `db:"float_check_def_func"` + FloatRef sql.NullFloat64 `db:"float_ref"` + FloatRefUniqueCheck sql.NullFloat64 `db:"float_ref_unique_check"` + FloatDefConst sql.NullFloat64 `db:"float_def_const"` + FloatDefConstUniqueCheck sql.NullFloat64 `db:"float_def_const_unique_check"` + FloatDefFunc sql.NullFloat64 `db:"float_def_func"` + FloatDefFuncUniqueCheck sql.NullFloat64 `db:"float_def_func_unique_check"` +} diff --git a/internal/integration_tests/mysql8/packagename/IntegerTable.go b/internal/integration_tests/mysql8/packagename/IntegerTable.go new file mode 100644 index 00000000..2006bbcd --- /dev/null +++ b/internal/integration_tests/mysql8/packagename/IntegerTable.go @@ -0,0 +1,27 @@ +package models + +import ( + "database/sql" +) + +type IntegerTable struct { + I sql.NullInt64 `db:"i"` + IntegerNn int `db:"integer_nn"` + IntegerNnUnique int `db:"integer_nn_unique"` + IntegerNnCheck int `db:"integer_nn_check"` + IntegerUnique sql.NullInt64 `db:"integer_unique"` + IntegerUniqueCheck sql.NullInt64 `db:"integer_unique_check"` + IntegerUniqueRef sql.NullInt64 `db:"integer_unique_ref"` + IntegerUniqueDefConst sql.NullInt64 `db:"integer_unique_def_const"` + IntegerUniqueDefFunc sql.NullInt64 `db:"integer_unique_def_func"` + IntegerCheck sql.NullInt64 `db:"integer_check"` + IntegerCheckRef sql.NullInt64 `db:"integer_check_ref"` + IntegerCheckDefConst sql.NullInt64 `db:"integer_check_def_const"` + IntegerCheckDefFunc sql.NullInt64 `db:"integer_check_def_func"` + IntegerRef sql.NullInt64 `db:"integer_ref"` + IntegerRefUniqueCheck sql.NullInt64 `db:"integer_ref_unique_check"` + IntegerDefConst sql.NullInt64 `db:"integer_def_const"` + IntegerDefConstUniqueCheck sql.NullInt64 `db:"integer_def_const_unique_check"` + IntegerDefFunc sql.NullInt64 `db:"integer_def_func"` + IntegerDefFuncUniqueCheck sql.NullInt64 `db:"integer_def_func_unique_check"` +} diff --git a/internal/integration_tests/mysql8/packagename/User.go b/internal/integration_tests/mysql8/packagename/User.go new file mode 100644 index 00000000..b05cd83c --- /dev/null +++ b/internal/integration_tests/mysql8/packagename/User.go @@ -0,0 +1,11 @@ +package models + +import ( + "database/sql" +) + +type User struct { + ID int `db:"id"` + UserID int `db:"user_id"` + WebsiteURL sql.NullString `db:"website_url"` +} diff --git a/internal/integration_tests/mysql8/packagename/VarcharTable.go b/internal/integration_tests/mysql8/packagename/VarcharTable.go new file mode 100644 index 00000000..7ab89d9d --- /dev/null +++ b/internal/integration_tests/mysql8/packagename/VarcharTable.go @@ -0,0 +1,33 @@ +package models + +import ( + "database/sql" +) + +type VarcharTable struct { + Col sql.NullString `db:"col"` + VarcharCap sql.NullString `db:"varchar_cap"` + VarcharNn string `db:"varchar_nn"` + VarcharNnUnique string `db:"varchar_nn_unique"` + VarcharNnCheckCmp string `db:"varchar_nn_check_cmp"` + VarcharNnCheckFn string `db:"varchar_nn_check_fn"` + VarcharNnRef string `db:"varchar_nn_ref"` + VarcharNnDefConst string `db:"varchar_nn_def_const"` + VarcharNnDefFunc string `db:"varchar_nn_def_func"` + VarcharNnUniqueCheck string `db:"varchar_nn_unique_check"` + VarcharUnique sql.NullString `db:"varchar_unique"` + VarcharUniqueCheck sql.NullString `db:"varchar_unique_check"` + VarcharUniqueRef sql.NullString `db:"varchar_unique_ref"` + VarcharUniqueDefConst sql.NullString `db:"varchar_unique_def_const"` + VarcharUniqueDefFunc sql.NullString `db:"varchar_unique_def_func"` + VarcharCheck sql.NullString `db:"varchar_check"` + VarcharCheckRef sql.NullString `db:"varchar_check_ref"` + VarcharCheckDefConst sql.NullString `db:"varchar_check_def_const"` + VarcharCheckDefFunc sql.NullString `db:"varchar_check_def_func"` + VarcharRef sql.NullString `db:"varchar_ref"` + VarcharRefUniqueCheck sql.NullString `db:"varchar_ref_unique_check"` + VarcharDefConst sql.NullString `db:"varchar_def_const"` + VarcharDefConstUniqueCheck sql.NullString `db:"varchar_def_const_unique_check"` + VarcharDefFunc sql.NullString `db:"varchar_def_func"` + VarcharDefFuncUniqueCheck sql.NullString `db:"varchar_def_func_unique_check"` +} diff --git a/internal/integration_tests/mysql8/prefix/PrefixDatetimeTable.go b/internal/integration_tests/mysql8/prefix/PrefixDatetimeTable.go new file mode 100644 index 00000000..172aec4c --- /dev/null +++ b/internal/integration_tests/mysql8/prefix/PrefixDatetimeTable.go @@ -0,0 +1,32 @@ +package dto + +import ( + "database/sql" + "time" +) + +type PrefixDatetimeTable struct { + Datetime sql.NullTime `db:"datetime"` + DatetimeNn time.Time `db:"datetime_nn"` + DatetimeNnUnique time.Time `db:"datetime_nn_unique"` + DatetimeNnCheck time.Time `db:"datetime_nn_check"` + DatetimeNnRef time.Time `db:"datetime_nn_ref"` + DatetimeNnDefConst time.Time `db:"datetime_nn_def_const"` + DatetimeNnDefFunc time.Time `db:"datetime_nn_def_func"` + DatetimeNnUniqueCheck time.Time `db:"datetime_nn_unique_check"` + DatetimeUnique sql.NullTime `db:"datetime_unique"` + DatetimeUniqueCheck sql.NullTime `db:"datetime_unique_check"` + DatetimeUniqueRef sql.NullTime `db:"datetime_unique_ref"` + DatetimeUniqueDefConst sql.NullTime `db:"datetime_unique_def_const"` + DatetimeUniqueDefFunc sql.NullTime `db:"datetime_unique_def_func"` + DatetimeCheck sql.NullTime `db:"datetime_check"` + DatetimeCheckRef sql.NullTime `db:"datetime_check_ref"` + DatetimeCheckDefConst sql.NullTime `db:"datetime_check_def_const"` + DatetimeCheckDefFunc sql.NullTime `db:"datetime_check_def_func"` + DatetimeRef sql.NullTime `db:"datetime_ref"` + DatetimeRefUniqueCheck sql.NullTime `db:"datetime_ref_unique_check"` + DatetimeDefConst sql.NullTime `db:"datetime_def_const"` + DatetimeDefConstUniqueCheck sql.NullTime `db:"datetime_def_const_unique_check"` + DatetimeDefFunc sql.NullTime `db:"datetime_def_func"` + DatetimeDefFuncUniqueCheck sql.NullTime `db:"datetime_def_func_unique_check"` +} diff --git a/internal/integration_tests/mysql8/prefix/PrefixFloatTable.go b/internal/integration_tests/mysql8/prefix/PrefixFloatTable.go new file mode 100644 index 00000000..151044af --- /dev/null +++ b/internal/integration_tests/mysql8/prefix/PrefixFloatTable.go @@ -0,0 +1,31 @@ +package dto + +import ( + "database/sql" +) + +type PrefixFloatTable struct { + Col sql.NullFloat64 `db:"col"` + FloatNn float64 `db:"float_nn"` + FloatNnUnique float64 `db:"float_nn_unique"` + FloatNnCheck float64 `db:"float_nn_check"` + FloatNnRef float64 `db:"float_nn_ref"` + FloatNnDefConst float64 `db:"float_nn_def_const"` + FloatNnDefFunc float64 `db:"float_nn_def_func"` + FloatNnUniqueCheck float64 `db:"float_nn_unique_check"` + FloatUnique sql.NullFloat64 `db:"float_unique"` + FloatUniqueCheck sql.NullFloat64 `db:"float_unique_check"` + FloatUniqueRef sql.NullFloat64 `db:"float_unique_ref"` + FloatUniqueDefConst sql.NullFloat64 `db:"float_unique_def_const"` + FloatUniqueDefFunc sql.NullFloat64 `db:"float_unique_def_func"` + FloatCheck sql.NullFloat64 `db:"float_check"` + FloatCheckRef sql.NullFloat64 `db:"float_check_ref"` + FloatCheckDefConst sql.NullFloat64 `db:"float_check_def_const"` + FloatCheckDefFunc sql.NullFloat64 `db:"float_check_def_func"` + FloatRef sql.NullFloat64 `db:"float_ref"` + FloatRefUniqueCheck sql.NullFloat64 `db:"float_ref_unique_check"` + FloatDefConst sql.NullFloat64 `db:"float_def_const"` + FloatDefConstUniqueCheck sql.NullFloat64 `db:"float_def_const_unique_check"` + FloatDefFunc sql.NullFloat64 `db:"float_def_func"` + FloatDefFuncUniqueCheck sql.NullFloat64 `db:"float_def_func_unique_check"` +} diff --git a/internal/integration_tests/mysql8/prefix/PrefixIntegerTable.go b/internal/integration_tests/mysql8/prefix/PrefixIntegerTable.go new file mode 100644 index 00000000..0f589d13 --- /dev/null +++ b/internal/integration_tests/mysql8/prefix/PrefixIntegerTable.go @@ -0,0 +1,27 @@ +package dto + +import ( + "database/sql" +) + +type PrefixIntegerTable struct { + I sql.NullInt64 `db:"i"` + IntegerNn int `db:"integer_nn"` + IntegerNnUnique int `db:"integer_nn_unique"` + IntegerNnCheck int `db:"integer_nn_check"` + IntegerUnique sql.NullInt64 `db:"integer_unique"` + IntegerUniqueCheck sql.NullInt64 `db:"integer_unique_check"` + IntegerUniqueRef sql.NullInt64 `db:"integer_unique_ref"` + IntegerUniqueDefConst sql.NullInt64 `db:"integer_unique_def_const"` + IntegerUniqueDefFunc sql.NullInt64 `db:"integer_unique_def_func"` + IntegerCheck sql.NullInt64 `db:"integer_check"` + IntegerCheckRef sql.NullInt64 `db:"integer_check_ref"` + IntegerCheckDefConst sql.NullInt64 `db:"integer_check_def_const"` + IntegerCheckDefFunc sql.NullInt64 `db:"integer_check_def_func"` + IntegerRef sql.NullInt64 `db:"integer_ref"` + IntegerRefUniqueCheck sql.NullInt64 `db:"integer_ref_unique_check"` + IntegerDefConst sql.NullInt64 `db:"integer_def_const"` + IntegerDefConstUniqueCheck sql.NullInt64 `db:"integer_def_const_unique_check"` + IntegerDefFunc sql.NullInt64 `db:"integer_def_func"` + IntegerDefFuncUniqueCheck sql.NullInt64 `db:"integer_def_func_unique_check"` +} diff --git a/internal/integration_tests/mysql8/prefix/PrefixUser.go b/internal/integration_tests/mysql8/prefix/PrefixUser.go new file mode 100644 index 00000000..ea9fbf4c --- /dev/null +++ b/internal/integration_tests/mysql8/prefix/PrefixUser.go @@ -0,0 +1,11 @@ +package dto + +import ( + "database/sql" +) + +type PrefixUser struct { + ID int `db:"id"` + UserID int `db:"user_id"` + WebsiteURL sql.NullString `db:"website_url"` +} diff --git a/internal/integration_tests/mysql8/prefix/PrefixVarcharTable.go b/internal/integration_tests/mysql8/prefix/PrefixVarcharTable.go new file mode 100644 index 00000000..4b44d77d --- /dev/null +++ b/internal/integration_tests/mysql8/prefix/PrefixVarcharTable.go @@ -0,0 +1,33 @@ +package dto + +import ( + "database/sql" +) + +type PrefixVarcharTable struct { + Col sql.NullString `db:"col"` + VarcharCap sql.NullString `db:"varchar_cap"` + VarcharNn string `db:"varchar_nn"` + VarcharNnUnique string `db:"varchar_nn_unique"` + VarcharNnCheckCmp string `db:"varchar_nn_check_cmp"` + VarcharNnCheckFn string `db:"varchar_nn_check_fn"` + VarcharNnRef string `db:"varchar_nn_ref"` + VarcharNnDefConst string `db:"varchar_nn_def_const"` + VarcharNnDefFunc string `db:"varchar_nn_def_func"` + VarcharNnUniqueCheck string `db:"varchar_nn_unique_check"` + VarcharUnique sql.NullString `db:"varchar_unique"` + VarcharUniqueCheck sql.NullString `db:"varchar_unique_check"` + VarcharUniqueRef sql.NullString `db:"varchar_unique_ref"` + VarcharUniqueDefConst sql.NullString `db:"varchar_unique_def_const"` + VarcharUniqueDefFunc sql.NullString `db:"varchar_unique_def_func"` + VarcharCheck sql.NullString `db:"varchar_check"` + VarcharCheckRef sql.NullString `db:"varchar_check_ref"` + VarcharCheckDefConst sql.NullString `db:"varchar_check_def_const"` + VarcharCheckDefFunc sql.NullString `db:"varchar_check_def_func"` + VarcharRef sql.NullString `db:"varchar_ref"` + VarcharRefUniqueCheck sql.NullString `db:"varchar_ref_unique_check"` + VarcharDefConst sql.NullString `db:"varchar_def_const"` + VarcharDefConstUniqueCheck sql.NullString `db:"varchar_def_const_unique_check"` + VarcharDefFunc sql.NullString `db:"varchar_def_func"` + VarcharDefFuncUniqueCheck sql.NullString `db:"varchar_def_func_unique_check"` +} diff --git a/internal/integration_tests/mysql8/prefixsuffix/PrefixDatetimeTableSuffix.go b/internal/integration_tests/mysql8/prefixsuffix/PrefixDatetimeTableSuffix.go new file mode 100644 index 00000000..395a4afd --- /dev/null +++ b/internal/integration_tests/mysql8/prefixsuffix/PrefixDatetimeTableSuffix.go @@ -0,0 +1,32 @@ +package dto + +import ( + "database/sql" + "time" +) + +type PrefixDatetimeTableSuffix struct { + Datetime sql.NullTime `db:"datetime"` + DatetimeNn time.Time `db:"datetime_nn"` + DatetimeNnUnique time.Time `db:"datetime_nn_unique"` + DatetimeNnCheck time.Time `db:"datetime_nn_check"` + DatetimeNnRef time.Time `db:"datetime_nn_ref"` + DatetimeNnDefConst time.Time `db:"datetime_nn_def_const"` + DatetimeNnDefFunc time.Time `db:"datetime_nn_def_func"` + DatetimeNnUniqueCheck time.Time `db:"datetime_nn_unique_check"` + DatetimeUnique sql.NullTime `db:"datetime_unique"` + DatetimeUniqueCheck sql.NullTime `db:"datetime_unique_check"` + DatetimeUniqueRef sql.NullTime `db:"datetime_unique_ref"` + DatetimeUniqueDefConst sql.NullTime `db:"datetime_unique_def_const"` + DatetimeUniqueDefFunc sql.NullTime `db:"datetime_unique_def_func"` + DatetimeCheck sql.NullTime `db:"datetime_check"` + DatetimeCheckRef sql.NullTime `db:"datetime_check_ref"` + DatetimeCheckDefConst sql.NullTime `db:"datetime_check_def_const"` + DatetimeCheckDefFunc sql.NullTime `db:"datetime_check_def_func"` + DatetimeRef sql.NullTime `db:"datetime_ref"` + DatetimeRefUniqueCheck sql.NullTime `db:"datetime_ref_unique_check"` + DatetimeDefConst sql.NullTime `db:"datetime_def_const"` + DatetimeDefConstUniqueCheck sql.NullTime `db:"datetime_def_const_unique_check"` + DatetimeDefFunc sql.NullTime `db:"datetime_def_func"` + DatetimeDefFuncUniqueCheck sql.NullTime `db:"datetime_def_func_unique_check"` +} diff --git a/internal/integration_tests/mysql8/prefixsuffix/PrefixFloatTableSuffix.go b/internal/integration_tests/mysql8/prefixsuffix/PrefixFloatTableSuffix.go new file mode 100644 index 00000000..a35cf9a2 --- /dev/null +++ b/internal/integration_tests/mysql8/prefixsuffix/PrefixFloatTableSuffix.go @@ -0,0 +1,31 @@ +package dto + +import ( + "database/sql" +) + +type PrefixFloatTableSuffix struct { + Col sql.NullFloat64 `db:"col"` + FloatNn float64 `db:"float_nn"` + FloatNnUnique float64 `db:"float_nn_unique"` + FloatNnCheck float64 `db:"float_nn_check"` + FloatNnRef float64 `db:"float_nn_ref"` + FloatNnDefConst float64 `db:"float_nn_def_const"` + FloatNnDefFunc float64 `db:"float_nn_def_func"` + FloatNnUniqueCheck float64 `db:"float_nn_unique_check"` + FloatUnique sql.NullFloat64 `db:"float_unique"` + FloatUniqueCheck sql.NullFloat64 `db:"float_unique_check"` + FloatUniqueRef sql.NullFloat64 `db:"float_unique_ref"` + FloatUniqueDefConst sql.NullFloat64 `db:"float_unique_def_const"` + FloatUniqueDefFunc sql.NullFloat64 `db:"float_unique_def_func"` + FloatCheck sql.NullFloat64 `db:"float_check"` + FloatCheckRef sql.NullFloat64 `db:"float_check_ref"` + FloatCheckDefConst sql.NullFloat64 `db:"float_check_def_const"` + FloatCheckDefFunc sql.NullFloat64 `db:"float_check_def_func"` + FloatRef sql.NullFloat64 `db:"float_ref"` + FloatRefUniqueCheck sql.NullFloat64 `db:"float_ref_unique_check"` + FloatDefConst sql.NullFloat64 `db:"float_def_const"` + FloatDefConstUniqueCheck sql.NullFloat64 `db:"float_def_const_unique_check"` + FloatDefFunc sql.NullFloat64 `db:"float_def_func"` + FloatDefFuncUniqueCheck sql.NullFloat64 `db:"float_def_func_unique_check"` +} diff --git a/internal/integration_tests/mysql8/prefixsuffix/PrefixIntegerTableSuffix.go b/internal/integration_tests/mysql8/prefixsuffix/PrefixIntegerTableSuffix.go new file mode 100644 index 00000000..b74622ce --- /dev/null +++ b/internal/integration_tests/mysql8/prefixsuffix/PrefixIntegerTableSuffix.go @@ -0,0 +1,27 @@ +package dto + +import ( + "database/sql" +) + +type PrefixIntegerTableSuffix struct { + I sql.NullInt64 `db:"i"` + IntegerNn int `db:"integer_nn"` + IntegerNnUnique int `db:"integer_nn_unique"` + IntegerNnCheck int `db:"integer_nn_check"` + IntegerUnique sql.NullInt64 `db:"integer_unique"` + IntegerUniqueCheck sql.NullInt64 `db:"integer_unique_check"` + IntegerUniqueRef sql.NullInt64 `db:"integer_unique_ref"` + IntegerUniqueDefConst sql.NullInt64 `db:"integer_unique_def_const"` + IntegerUniqueDefFunc sql.NullInt64 `db:"integer_unique_def_func"` + IntegerCheck sql.NullInt64 `db:"integer_check"` + IntegerCheckRef sql.NullInt64 `db:"integer_check_ref"` + IntegerCheckDefConst sql.NullInt64 `db:"integer_check_def_const"` + IntegerCheckDefFunc sql.NullInt64 `db:"integer_check_def_func"` + IntegerRef sql.NullInt64 `db:"integer_ref"` + IntegerRefUniqueCheck sql.NullInt64 `db:"integer_ref_unique_check"` + IntegerDefConst sql.NullInt64 `db:"integer_def_const"` + IntegerDefConstUniqueCheck sql.NullInt64 `db:"integer_def_const_unique_check"` + IntegerDefFunc sql.NullInt64 `db:"integer_def_func"` + IntegerDefFuncUniqueCheck sql.NullInt64 `db:"integer_def_func_unique_check"` +} diff --git a/internal/integration_tests/mysql8/prefixsuffix/PrefixUserSuffix.go b/internal/integration_tests/mysql8/prefixsuffix/PrefixUserSuffix.go new file mode 100644 index 00000000..6ce682fb --- /dev/null +++ b/internal/integration_tests/mysql8/prefixsuffix/PrefixUserSuffix.go @@ -0,0 +1,11 @@ +package dto + +import ( + "database/sql" +) + +type PrefixUserSuffix struct { + ID int `db:"id"` + UserID int `db:"user_id"` + WebsiteURL sql.NullString `db:"website_url"` +} diff --git a/internal/integration_tests/mysql8/prefixsuffix/PrefixVarcharTableSuffix.go b/internal/integration_tests/mysql8/prefixsuffix/PrefixVarcharTableSuffix.go new file mode 100644 index 00000000..06922184 --- /dev/null +++ b/internal/integration_tests/mysql8/prefixsuffix/PrefixVarcharTableSuffix.go @@ -0,0 +1,33 @@ +package dto + +import ( + "database/sql" +) + +type PrefixVarcharTableSuffix struct { + Col sql.NullString `db:"col"` + VarcharCap sql.NullString `db:"varchar_cap"` + VarcharNn string `db:"varchar_nn"` + VarcharNnUnique string `db:"varchar_nn_unique"` + VarcharNnCheckCmp string `db:"varchar_nn_check_cmp"` + VarcharNnCheckFn string `db:"varchar_nn_check_fn"` + VarcharNnRef string `db:"varchar_nn_ref"` + VarcharNnDefConst string `db:"varchar_nn_def_const"` + VarcharNnDefFunc string `db:"varchar_nn_def_func"` + VarcharNnUniqueCheck string `db:"varchar_nn_unique_check"` + VarcharUnique sql.NullString `db:"varchar_unique"` + VarcharUniqueCheck sql.NullString `db:"varchar_unique_check"` + VarcharUniqueRef sql.NullString `db:"varchar_unique_ref"` + VarcharUniqueDefConst sql.NullString `db:"varchar_unique_def_const"` + VarcharUniqueDefFunc sql.NullString `db:"varchar_unique_def_func"` + VarcharCheck sql.NullString `db:"varchar_check"` + VarcharCheckRef sql.NullString `db:"varchar_check_ref"` + VarcharCheckDefConst sql.NullString `db:"varchar_check_def_const"` + VarcharCheckDefFunc sql.NullString `db:"varchar_check_def_func"` + VarcharRef sql.NullString `db:"varchar_ref"` + VarcharRefUniqueCheck sql.NullString `db:"varchar_ref_unique_check"` + VarcharDefConst sql.NullString `db:"varchar_def_const"` + VarcharDefConstUniqueCheck sql.NullString `db:"varchar_def_const_unique_check"` + VarcharDefFunc sql.NullString `db:"varchar_def_func"` + VarcharDefFuncUniqueCheck sql.NullString `db:"varchar_def_func_unique_check"` +} diff --git a/internal/integration_tests/mysql8/suffix/DatetimeTableSuffix.go b/internal/integration_tests/mysql8/suffix/DatetimeTableSuffix.go new file mode 100644 index 00000000..a51019d6 --- /dev/null +++ b/internal/integration_tests/mysql8/suffix/DatetimeTableSuffix.go @@ -0,0 +1,32 @@ +package dto + +import ( + "database/sql" + "time" +) + +type DatetimeTableSuffix struct { + Datetime sql.NullTime `db:"datetime"` + DatetimeNn time.Time `db:"datetime_nn"` + DatetimeNnUnique time.Time `db:"datetime_nn_unique"` + DatetimeNnCheck time.Time `db:"datetime_nn_check"` + DatetimeNnRef time.Time `db:"datetime_nn_ref"` + DatetimeNnDefConst time.Time `db:"datetime_nn_def_const"` + DatetimeNnDefFunc time.Time `db:"datetime_nn_def_func"` + DatetimeNnUniqueCheck time.Time `db:"datetime_nn_unique_check"` + DatetimeUnique sql.NullTime `db:"datetime_unique"` + DatetimeUniqueCheck sql.NullTime `db:"datetime_unique_check"` + DatetimeUniqueRef sql.NullTime `db:"datetime_unique_ref"` + DatetimeUniqueDefConst sql.NullTime `db:"datetime_unique_def_const"` + DatetimeUniqueDefFunc sql.NullTime `db:"datetime_unique_def_func"` + DatetimeCheck sql.NullTime `db:"datetime_check"` + DatetimeCheckRef sql.NullTime `db:"datetime_check_ref"` + DatetimeCheckDefConst sql.NullTime `db:"datetime_check_def_const"` + DatetimeCheckDefFunc sql.NullTime `db:"datetime_check_def_func"` + DatetimeRef sql.NullTime `db:"datetime_ref"` + DatetimeRefUniqueCheck sql.NullTime `db:"datetime_ref_unique_check"` + DatetimeDefConst sql.NullTime `db:"datetime_def_const"` + DatetimeDefConstUniqueCheck sql.NullTime `db:"datetime_def_const_unique_check"` + DatetimeDefFunc sql.NullTime `db:"datetime_def_func"` + DatetimeDefFuncUniqueCheck sql.NullTime `db:"datetime_def_func_unique_check"` +} diff --git a/internal/integration_tests/mysql8/suffix/FloatTableSuffix.go b/internal/integration_tests/mysql8/suffix/FloatTableSuffix.go new file mode 100644 index 00000000..5faa3ca3 --- /dev/null +++ b/internal/integration_tests/mysql8/suffix/FloatTableSuffix.go @@ -0,0 +1,31 @@ +package dto + +import ( + "database/sql" +) + +type FloatTableSuffix struct { + Col sql.NullFloat64 `db:"col"` + FloatNn float64 `db:"float_nn"` + FloatNnUnique float64 `db:"float_nn_unique"` + FloatNnCheck float64 `db:"float_nn_check"` + FloatNnRef float64 `db:"float_nn_ref"` + FloatNnDefConst float64 `db:"float_nn_def_const"` + FloatNnDefFunc float64 `db:"float_nn_def_func"` + FloatNnUniqueCheck float64 `db:"float_nn_unique_check"` + FloatUnique sql.NullFloat64 `db:"float_unique"` + FloatUniqueCheck sql.NullFloat64 `db:"float_unique_check"` + FloatUniqueRef sql.NullFloat64 `db:"float_unique_ref"` + FloatUniqueDefConst sql.NullFloat64 `db:"float_unique_def_const"` + FloatUniqueDefFunc sql.NullFloat64 `db:"float_unique_def_func"` + FloatCheck sql.NullFloat64 `db:"float_check"` + FloatCheckRef sql.NullFloat64 `db:"float_check_ref"` + FloatCheckDefConst sql.NullFloat64 `db:"float_check_def_const"` + FloatCheckDefFunc sql.NullFloat64 `db:"float_check_def_func"` + FloatRef sql.NullFloat64 `db:"float_ref"` + FloatRefUniqueCheck sql.NullFloat64 `db:"float_ref_unique_check"` + FloatDefConst sql.NullFloat64 `db:"float_def_const"` + FloatDefConstUniqueCheck sql.NullFloat64 `db:"float_def_const_unique_check"` + FloatDefFunc sql.NullFloat64 `db:"float_def_func"` + FloatDefFuncUniqueCheck sql.NullFloat64 `db:"float_def_func_unique_check"` +} diff --git a/internal/integration_tests/mysql8/suffix/IntegerTableSuffix.go b/internal/integration_tests/mysql8/suffix/IntegerTableSuffix.go new file mode 100644 index 00000000..96bb5c3c --- /dev/null +++ b/internal/integration_tests/mysql8/suffix/IntegerTableSuffix.go @@ -0,0 +1,27 @@ +package dto + +import ( + "database/sql" +) + +type IntegerTableSuffix struct { + I sql.NullInt64 `db:"i"` + IntegerNn int `db:"integer_nn"` + IntegerNnUnique int `db:"integer_nn_unique"` + IntegerNnCheck int `db:"integer_nn_check"` + IntegerUnique sql.NullInt64 `db:"integer_unique"` + IntegerUniqueCheck sql.NullInt64 `db:"integer_unique_check"` + IntegerUniqueRef sql.NullInt64 `db:"integer_unique_ref"` + IntegerUniqueDefConst sql.NullInt64 `db:"integer_unique_def_const"` + IntegerUniqueDefFunc sql.NullInt64 `db:"integer_unique_def_func"` + IntegerCheck sql.NullInt64 `db:"integer_check"` + IntegerCheckRef sql.NullInt64 `db:"integer_check_ref"` + IntegerCheckDefConst sql.NullInt64 `db:"integer_check_def_const"` + IntegerCheckDefFunc sql.NullInt64 `db:"integer_check_def_func"` + IntegerRef sql.NullInt64 `db:"integer_ref"` + IntegerRefUniqueCheck sql.NullInt64 `db:"integer_ref_unique_check"` + IntegerDefConst sql.NullInt64 `db:"integer_def_const"` + IntegerDefConstUniqueCheck sql.NullInt64 `db:"integer_def_const_unique_check"` + IntegerDefFunc sql.NullInt64 `db:"integer_def_func"` + IntegerDefFuncUniqueCheck sql.NullInt64 `db:"integer_def_func_unique_check"` +} diff --git a/internal/integration_tests/mysql8/suffix/UserSuffix.go b/internal/integration_tests/mysql8/suffix/UserSuffix.go new file mode 100644 index 00000000..15466792 --- /dev/null +++ b/internal/integration_tests/mysql8/suffix/UserSuffix.go @@ -0,0 +1,11 @@ +package dto + +import ( + "database/sql" +) + +type UserSuffix struct { + ID int `db:"id"` + UserID int `db:"user_id"` + WebsiteURL sql.NullString `db:"website_url"` +} diff --git a/internal/integration_tests/mysql8/suffix/VarcharTableSuffix.go b/internal/integration_tests/mysql8/suffix/VarcharTableSuffix.go new file mode 100644 index 00000000..6a4983b3 --- /dev/null +++ b/internal/integration_tests/mysql8/suffix/VarcharTableSuffix.go @@ -0,0 +1,33 @@ +package dto + +import ( + "database/sql" +) + +type VarcharTableSuffix struct { + Col sql.NullString `db:"col"` + VarcharCap sql.NullString `db:"varchar_cap"` + VarcharNn string `db:"varchar_nn"` + VarcharNnUnique string `db:"varchar_nn_unique"` + VarcharNnCheckCmp string `db:"varchar_nn_check_cmp"` + VarcharNnCheckFn string `db:"varchar_nn_check_fn"` + VarcharNnRef string `db:"varchar_nn_ref"` + VarcharNnDefConst string `db:"varchar_nn_def_const"` + VarcharNnDefFunc string `db:"varchar_nn_def_func"` + VarcharNnUniqueCheck string `db:"varchar_nn_unique_check"` + VarcharUnique sql.NullString `db:"varchar_unique"` + VarcharUniqueCheck sql.NullString `db:"varchar_unique_check"` + VarcharUniqueRef sql.NullString `db:"varchar_unique_ref"` + VarcharUniqueDefConst sql.NullString `db:"varchar_unique_def_const"` + VarcharUniqueDefFunc sql.NullString `db:"varchar_unique_def_func"` + VarcharCheck sql.NullString `db:"varchar_check"` + VarcharCheckRef sql.NullString `db:"varchar_check_ref"` + VarcharCheckDefConst sql.NullString `db:"varchar_check_def_const"` + VarcharCheckDefFunc sql.NullString `db:"varchar_check_def_func"` + VarcharRef sql.NullString `db:"varchar_ref"` + VarcharRefUniqueCheck sql.NullString `db:"varchar_ref_unique_check"` + VarcharDefConst sql.NullString `db:"varchar_def_const"` + VarcharDefConstUniqueCheck sql.NullString `db:"varchar_def_const_unique_check"` + VarcharDefFunc sql.NullString `db:"varchar_def_func"` + VarcharDefFuncUniqueCheck sql.NullString `db:"varchar_def_func_unique_check"` +} diff --git a/internal/integration_tests/mysql8/tablesflag/DatetimeTable.go b/internal/integration_tests/mysql8/tablesflag/DatetimeTable.go new file mode 100644 index 00000000..36b7bc40 --- /dev/null +++ b/internal/integration_tests/mysql8/tablesflag/DatetimeTable.go @@ -0,0 +1,32 @@ +package dto + +import ( + "database/sql" + "time" +) + +type DatetimeTable struct { + Datetime sql.NullTime `db:"datetime"` + DatetimeNn time.Time `db:"datetime_nn"` + DatetimeNnUnique time.Time `db:"datetime_nn_unique"` + DatetimeNnCheck time.Time `db:"datetime_nn_check"` + DatetimeNnRef time.Time `db:"datetime_nn_ref"` + DatetimeNnDefConst time.Time `db:"datetime_nn_def_const"` + DatetimeNnDefFunc time.Time `db:"datetime_nn_def_func"` + DatetimeNnUniqueCheck time.Time `db:"datetime_nn_unique_check"` + DatetimeUnique sql.NullTime `db:"datetime_unique"` + DatetimeUniqueCheck sql.NullTime `db:"datetime_unique_check"` + DatetimeUniqueRef sql.NullTime `db:"datetime_unique_ref"` + DatetimeUniqueDefConst sql.NullTime `db:"datetime_unique_def_const"` + DatetimeUniqueDefFunc sql.NullTime `db:"datetime_unique_def_func"` + DatetimeCheck sql.NullTime `db:"datetime_check"` + DatetimeCheckRef sql.NullTime `db:"datetime_check_ref"` + DatetimeCheckDefConst sql.NullTime `db:"datetime_check_def_const"` + DatetimeCheckDefFunc sql.NullTime `db:"datetime_check_def_func"` + DatetimeRef sql.NullTime `db:"datetime_ref"` + DatetimeRefUniqueCheck sql.NullTime `db:"datetime_ref_unique_check"` + DatetimeDefConst sql.NullTime `db:"datetime_def_const"` + DatetimeDefConstUniqueCheck sql.NullTime `db:"datetime_def_const_unique_check"` + DatetimeDefFunc sql.NullTime `db:"datetime_def_func"` + DatetimeDefFuncUniqueCheck sql.NullTime `db:"datetime_def_func_unique_check"` +} diff --git a/internal/integration_tests/mysql8/tablesflag/FloatTable.go b/internal/integration_tests/mysql8/tablesflag/FloatTable.go new file mode 100644 index 00000000..e0c1fd48 --- /dev/null +++ b/internal/integration_tests/mysql8/tablesflag/FloatTable.go @@ -0,0 +1,31 @@ +package dto + +import ( + "database/sql" +) + +type FloatTable struct { + Col sql.NullFloat64 `db:"col"` + FloatNn float64 `db:"float_nn"` + FloatNnUnique float64 `db:"float_nn_unique"` + FloatNnCheck float64 `db:"float_nn_check"` + FloatNnRef float64 `db:"float_nn_ref"` + FloatNnDefConst float64 `db:"float_nn_def_const"` + FloatNnDefFunc float64 `db:"float_nn_def_func"` + FloatNnUniqueCheck float64 `db:"float_nn_unique_check"` + FloatUnique sql.NullFloat64 `db:"float_unique"` + FloatUniqueCheck sql.NullFloat64 `db:"float_unique_check"` + FloatUniqueRef sql.NullFloat64 `db:"float_unique_ref"` + FloatUniqueDefConst sql.NullFloat64 `db:"float_unique_def_const"` + FloatUniqueDefFunc sql.NullFloat64 `db:"float_unique_def_func"` + FloatCheck sql.NullFloat64 `db:"float_check"` + FloatCheckRef sql.NullFloat64 `db:"float_check_ref"` + FloatCheckDefConst sql.NullFloat64 `db:"float_check_def_const"` + FloatCheckDefFunc sql.NullFloat64 `db:"float_check_def_func"` + FloatRef sql.NullFloat64 `db:"float_ref"` + FloatRefUniqueCheck sql.NullFloat64 `db:"float_ref_unique_check"` + FloatDefConst sql.NullFloat64 `db:"float_def_const"` + FloatDefConstUniqueCheck sql.NullFloat64 `db:"float_def_const_unique_check"` + FloatDefFunc sql.NullFloat64 `db:"float_def_func"` + FloatDefFuncUniqueCheck sql.NullFloat64 `db:"float_def_func_unique_check"` +} diff --git a/internal/integration_tests/mysql8/tablesflag/User.go b/internal/integration_tests/mysql8/tablesflag/User.go new file mode 100644 index 00000000..ba4ce59b --- /dev/null +++ b/internal/integration_tests/mysql8/tablesflag/User.go @@ -0,0 +1,11 @@ +package dto + +import ( + "database/sql" +) + +type User struct { + ID int `db:"id"` + UserID int `db:"user_id"` + WebsiteURL sql.NullString `db:"website_url"` +} diff --git a/internal/integration_tests/mysql8/tablesflag/VarcharTable.go b/internal/integration_tests/mysql8/tablesflag/VarcharTable.go new file mode 100644 index 00000000..2a0f0084 --- /dev/null +++ b/internal/integration_tests/mysql8/tablesflag/VarcharTable.go @@ -0,0 +1,33 @@ +package dto + +import ( + "database/sql" +) + +type VarcharTable struct { + Col sql.NullString `db:"col"` + VarcharCap sql.NullString `db:"varchar_cap"` + VarcharNn string `db:"varchar_nn"` + VarcharNnUnique string `db:"varchar_nn_unique"` + VarcharNnCheckCmp string `db:"varchar_nn_check_cmp"` + VarcharNnCheckFn string `db:"varchar_nn_check_fn"` + VarcharNnRef string `db:"varchar_nn_ref"` + VarcharNnDefConst string `db:"varchar_nn_def_const"` + VarcharNnDefFunc string `db:"varchar_nn_def_func"` + VarcharNnUniqueCheck string `db:"varchar_nn_unique_check"` + VarcharUnique sql.NullString `db:"varchar_unique"` + VarcharUniqueCheck sql.NullString `db:"varchar_unique_check"` + VarcharUniqueRef sql.NullString `db:"varchar_unique_ref"` + VarcharUniqueDefConst sql.NullString `db:"varchar_unique_def_const"` + VarcharUniqueDefFunc sql.NullString `db:"varchar_unique_def_func"` + VarcharCheck sql.NullString `db:"varchar_check"` + VarcharCheckRef sql.NullString `db:"varchar_check_ref"` + VarcharCheckDefConst sql.NullString `db:"varchar_check_def_const"` + VarcharCheckDefFunc sql.NullString `db:"varchar_check_def_func"` + VarcharRef sql.NullString `db:"varchar_ref"` + VarcharRefUniqueCheck sql.NullString `db:"varchar_ref_unique_check"` + VarcharDefConst sql.NullString `db:"varchar_def_const"` + VarcharDefConstUniqueCheck sql.NullString `db:"varchar_def_const_unique_check"` + VarcharDefFunc sql.NullString `db:"varchar_def_func"` + VarcharDefFuncUniqueCheck sql.NullString `db:"varchar_def_func_unique_check"` +} diff --git a/internal/integration_tests/mysql8/tagsmastermindstructable/DatetimeTable.go b/internal/integration_tests/mysql8/tagsmastermindstructable/DatetimeTable.go new file mode 100644 index 00000000..c9f9e004 --- /dev/null +++ b/internal/integration_tests/mysql8/tagsmastermindstructable/DatetimeTable.go @@ -0,0 +1,32 @@ +package dto + +import ( + "database/sql" + "time" +) + +type DatetimeTable struct { + Datetime sql.NullTime `db:"datetime" stbl:"datetime"` + DatetimeNn time.Time `db:"datetime_nn" stbl:"datetime_nn"` + DatetimeNnUnique time.Time `db:"datetime_nn_unique" stbl:"datetime_nn_unique,PRIMARY_KEY"` + DatetimeNnCheck time.Time `db:"datetime_nn_check" stbl:"datetime_nn_check"` + DatetimeNnRef time.Time `db:"datetime_nn_ref" stbl:"datetime_nn_ref"` + DatetimeNnDefConst time.Time `db:"datetime_nn_def_const" stbl:"datetime_nn_def_const"` + DatetimeNnDefFunc time.Time `db:"datetime_nn_def_func" stbl:"datetime_nn_def_func"` + DatetimeNnUniqueCheck time.Time `db:"datetime_nn_unique_check" stbl:"datetime_nn_unique_check"` + DatetimeUnique sql.NullTime `db:"datetime_unique" stbl:"datetime_unique"` + DatetimeUniqueCheck sql.NullTime `db:"datetime_unique_check" stbl:"datetime_unique_check"` + DatetimeUniqueRef sql.NullTime `db:"datetime_unique_ref" stbl:"datetime_unique_ref"` + DatetimeUniqueDefConst sql.NullTime `db:"datetime_unique_def_const" stbl:"datetime_unique_def_const"` + DatetimeUniqueDefFunc sql.NullTime `db:"datetime_unique_def_func" stbl:"datetime_unique_def_func"` + DatetimeCheck sql.NullTime `db:"datetime_check" stbl:"datetime_check"` + DatetimeCheckRef sql.NullTime `db:"datetime_check_ref" stbl:"datetime_check_ref"` + DatetimeCheckDefConst sql.NullTime `db:"datetime_check_def_const" stbl:"datetime_check_def_const"` + DatetimeCheckDefFunc sql.NullTime `db:"datetime_check_def_func" stbl:"datetime_check_def_func"` + DatetimeRef sql.NullTime `db:"datetime_ref" stbl:"datetime_ref"` + DatetimeRefUniqueCheck sql.NullTime `db:"datetime_ref_unique_check" stbl:"datetime_ref_unique_check"` + DatetimeDefConst sql.NullTime `db:"datetime_def_const" stbl:"datetime_def_const"` + DatetimeDefConstUniqueCheck sql.NullTime `db:"datetime_def_const_unique_check" stbl:"datetime_def_const_unique_check"` + DatetimeDefFunc sql.NullTime `db:"datetime_def_func" stbl:"datetime_def_func"` + DatetimeDefFuncUniqueCheck sql.NullTime `db:"datetime_def_func_unique_check" stbl:"datetime_def_func_unique_check"` +} diff --git a/internal/integration_tests/mysql8/tagsmastermindstructable/FloatTable.go b/internal/integration_tests/mysql8/tagsmastermindstructable/FloatTable.go new file mode 100644 index 00000000..7f283ab0 --- /dev/null +++ b/internal/integration_tests/mysql8/tagsmastermindstructable/FloatTable.go @@ -0,0 +1,31 @@ +package dto + +import ( + "database/sql" +) + +type FloatTable struct { + Col sql.NullFloat64 `db:"col" stbl:"col"` + FloatNn float64 `db:"float_nn" stbl:"float_nn"` + FloatNnUnique float64 `db:"float_nn_unique" stbl:"float_nn_unique,PRIMARY_KEY"` + FloatNnCheck float64 `db:"float_nn_check" stbl:"float_nn_check"` + FloatNnRef float64 `db:"float_nn_ref" stbl:"float_nn_ref"` + FloatNnDefConst float64 `db:"float_nn_def_const" stbl:"float_nn_def_const"` + FloatNnDefFunc float64 `db:"float_nn_def_func" stbl:"float_nn_def_func"` + FloatNnUniqueCheck float64 `db:"float_nn_unique_check" stbl:"float_nn_unique_check"` + FloatUnique sql.NullFloat64 `db:"float_unique" stbl:"float_unique"` + FloatUniqueCheck sql.NullFloat64 `db:"float_unique_check" stbl:"float_unique_check"` + FloatUniqueRef sql.NullFloat64 `db:"float_unique_ref" stbl:"float_unique_ref"` + FloatUniqueDefConst sql.NullFloat64 `db:"float_unique_def_const" stbl:"float_unique_def_const"` + FloatUniqueDefFunc sql.NullFloat64 `db:"float_unique_def_func" stbl:"float_unique_def_func"` + FloatCheck sql.NullFloat64 `db:"float_check" stbl:"float_check"` + FloatCheckRef sql.NullFloat64 `db:"float_check_ref" stbl:"float_check_ref"` + FloatCheckDefConst sql.NullFloat64 `db:"float_check_def_const" stbl:"float_check_def_const"` + FloatCheckDefFunc sql.NullFloat64 `db:"float_check_def_func" stbl:"float_check_def_func"` + FloatRef sql.NullFloat64 `db:"float_ref" stbl:"float_ref"` + FloatRefUniqueCheck sql.NullFloat64 `db:"float_ref_unique_check" stbl:"float_ref_unique_check"` + FloatDefConst sql.NullFloat64 `db:"float_def_const" stbl:"float_def_const"` + FloatDefConstUniqueCheck sql.NullFloat64 `db:"float_def_const_unique_check" stbl:"float_def_const_unique_check"` + FloatDefFunc sql.NullFloat64 `db:"float_def_func" stbl:"float_def_func"` + FloatDefFuncUniqueCheck sql.NullFloat64 `db:"float_def_func_unique_check" stbl:"float_def_func_unique_check"` +} diff --git a/internal/integration_tests/mysql8/tagsmastermindstructable/IntegerTable.go b/internal/integration_tests/mysql8/tagsmastermindstructable/IntegerTable.go new file mode 100644 index 00000000..562f3dc4 --- /dev/null +++ b/internal/integration_tests/mysql8/tagsmastermindstructable/IntegerTable.go @@ -0,0 +1,27 @@ +package dto + +import ( + "database/sql" +) + +type IntegerTable struct { + I sql.NullInt64 `db:"i" stbl:"i"` + IntegerNn int `db:"integer_nn" stbl:"integer_nn"` + IntegerNnUnique int `db:"integer_nn_unique" stbl:"integer_nn_unique,PRIMARY_KEY"` + IntegerNnCheck int `db:"integer_nn_check" stbl:"integer_nn_check"` + IntegerUnique sql.NullInt64 `db:"integer_unique" stbl:"integer_unique"` + IntegerUniqueCheck sql.NullInt64 `db:"integer_unique_check" stbl:"integer_unique_check"` + IntegerUniqueRef sql.NullInt64 `db:"integer_unique_ref" stbl:"integer_unique_ref"` + IntegerUniqueDefConst sql.NullInt64 `db:"integer_unique_def_const" stbl:"integer_unique_def_const"` + IntegerUniqueDefFunc sql.NullInt64 `db:"integer_unique_def_func" stbl:"integer_unique_def_func"` + IntegerCheck sql.NullInt64 `db:"integer_check" stbl:"integer_check"` + IntegerCheckRef sql.NullInt64 `db:"integer_check_ref" stbl:"integer_check_ref"` + IntegerCheckDefConst sql.NullInt64 `db:"integer_check_def_const" stbl:"integer_check_def_const"` + IntegerCheckDefFunc sql.NullInt64 `db:"integer_check_def_func" stbl:"integer_check_def_func"` + IntegerRef sql.NullInt64 `db:"integer_ref" stbl:"integer_ref"` + IntegerRefUniqueCheck sql.NullInt64 `db:"integer_ref_unique_check" stbl:"integer_ref_unique_check"` + IntegerDefConst sql.NullInt64 `db:"integer_def_const" stbl:"integer_def_const"` + IntegerDefConstUniqueCheck sql.NullInt64 `db:"integer_def_const_unique_check" stbl:"integer_def_const_unique_check"` + IntegerDefFunc sql.NullInt64 `db:"integer_def_func" stbl:"integer_def_func"` + IntegerDefFuncUniqueCheck sql.NullInt64 `db:"integer_def_func_unique_check" stbl:"integer_def_func_unique_check"` +} diff --git a/internal/integration_tests/mysql8/tagsmastermindstructable/User.go b/internal/integration_tests/mysql8/tagsmastermindstructable/User.go new file mode 100644 index 00000000..3d589d4b --- /dev/null +++ b/internal/integration_tests/mysql8/tagsmastermindstructable/User.go @@ -0,0 +1,11 @@ +package dto + +import ( + "database/sql" +) + +type User struct { + ID int `db:"id" stbl:"id,PRIMARY_KEY,SERIAL,AUTO_INCREMENT"` + UserID int `db:"user_id" stbl:"user_id"` + WebsiteURL sql.NullString `db:"website_url" stbl:"website_url"` +} diff --git a/internal/integration_tests/mysql8/tagsmastermindstructable/VarcharTable.go b/internal/integration_tests/mysql8/tagsmastermindstructable/VarcharTable.go new file mode 100644 index 00000000..4edfd757 --- /dev/null +++ b/internal/integration_tests/mysql8/tagsmastermindstructable/VarcharTable.go @@ -0,0 +1,33 @@ +package dto + +import ( + "database/sql" +) + +type VarcharTable struct { + Col sql.NullString `db:"col" stbl:"col"` + VarcharCap sql.NullString `db:"varchar_cap" stbl:"varchar_cap"` + VarcharNn string `db:"varchar_nn" stbl:"varchar_nn"` + VarcharNnUnique string `db:"varchar_nn_unique" stbl:"varchar_nn_unique,PRIMARY_KEY"` + VarcharNnCheckCmp string `db:"varchar_nn_check_cmp" stbl:"varchar_nn_check_cmp"` + VarcharNnCheckFn string `db:"varchar_nn_check_fn" stbl:"varchar_nn_check_fn"` + VarcharNnRef string `db:"varchar_nn_ref" stbl:"varchar_nn_ref"` + VarcharNnDefConst string `db:"varchar_nn_def_const" stbl:"varchar_nn_def_const"` + VarcharNnDefFunc string `db:"varchar_nn_def_func" stbl:"varchar_nn_def_func"` + VarcharNnUniqueCheck string `db:"varchar_nn_unique_check" stbl:"varchar_nn_unique_check"` + VarcharUnique sql.NullString `db:"varchar_unique" stbl:"varchar_unique"` + VarcharUniqueCheck sql.NullString `db:"varchar_unique_check" stbl:"varchar_unique_check"` + VarcharUniqueRef sql.NullString `db:"varchar_unique_ref" stbl:"varchar_unique_ref"` + VarcharUniqueDefConst sql.NullString `db:"varchar_unique_def_const" stbl:"varchar_unique_def_const"` + VarcharUniqueDefFunc sql.NullString `db:"varchar_unique_def_func" stbl:"varchar_unique_def_func"` + VarcharCheck sql.NullString `db:"varchar_check" stbl:"varchar_check"` + VarcharCheckRef sql.NullString `db:"varchar_check_ref" stbl:"varchar_check_ref"` + VarcharCheckDefConst sql.NullString `db:"varchar_check_def_const" stbl:"varchar_check_def_const"` + VarcharCheckDefFunc sql.NullString `db:"varchar_check_def_func" stbl:"varchar_check_def_func"` + VarcharRef sql.NullString `db:"varchar_ref" stbl:"varchar_ref"` + VarcharRefUniqueCheck sql.NullString `db:"varchar_ref_unique_check" stbl:"varchar_ref_unique_check"` + VarcharDefConst sql.NullString `db:"varchar_def_const" stbl:"varchar_def_const"` + VarcharDefConstUniqueCheck sql.NullString `db:"varchar_def_const_unique_check" stbl:"varchar_def_const_unique_check"` + VarcharDefFunc sql.NullString `db:"varchar_def_func" stbl:"varchar_def_func"` + VarcharDefFuncUniqueCheck sql.NullString `db:"varchar_def_func_unique_check" stbl:"varchar_def_func_unique_check"` +} diff --git a/internal/integration_tests/mysql8/tagsmastermindstructableonly/DatetimeTable.go b/internal/integration_tests/mysql8/tagsmastermindstructableonly/DatetimeTable.go new file mode 100644 index 00000000..85a1c475 --- /dev/null +++ b/internal/integration_tests/mysql8/tagsmastermindstructableonly/DatetimeTable.go @@ -0,0 +1,32 @@ +package dto + +import ( + "database/sql" + "time" +) + +type DatetimeTable struct { + Datetime sql.NullTime `stbl:"datetime"` + DatetimeNn time.Time `stbl:"datetime_nn"` + DatetimeNnUnique time.Time `stbl:"datetime_nn_unique,PRIMARY_KEY"` + DatetimeNnCheck time.Time `stbl:"datetime_nn_check"` + DatetimeNnRef time.Time `stbl:"datetime_nn_ref"` + DatetimeNnDefConst time.Time `stbl:"datetime_nn_def_const"` + DatetimeNnDefFunc time.Time `stbl:"datetime_nn_def_func"` + DatetimeNnUniqueCheck time.Time `stbl:"datetime_nn_unique_check"` + DatetimeUnique sql.NullTime `stbl:"datetime_unique"` + DatetimeUniqueCheck sql.NullTime `stbl:"datetime_unique_check"` + DatetimeUniqueRef sql.NullTime `stbl:"datetime_unique_ref"` + DatetimeUniqueDefConst sql.NullTime `stbl:"datetime_unique_def_const"` + DatetimeUniqueDefFunc sql.NullTime `stbl:"datetime_unique_def_func"` + DatetimeCheck sql.NullTime `stbl:"datetime_check"` + DatetimeCheckRef sql.NullTime `stbl:"datetime_check_ref"` + DatetimeCheckDefConst sql.NullTime `stbl:"datetime_check_def_const"` + DatetimeCheckDefFunc sql.NullTime `stbl:"datetime_check_def_func"` + DatetimeRef sql.NullTime `stbl:"datetime_ref"` + DatetimeRefUniqueCheck sql.NullTime `stbl:"datetime_ref_unique_check"` + DatetimeDefConst sql.NullTime `stbl:"datetime_def_const"` + DatetimeDefConstUniqueCheck sql.NullTime `stbl:"datetime_def_const_unique_check"` + DatetimeDefFunc sql.NullTime `stbl:"datetime_def_func"` + DatetimeDefFuncUniqueCheck sql.NullTime `stbl:"datetime_def_func_unique_check"` +} diff --git a/internal/integration_tests/mysql8/tagsmastermindstructableonly/FloatTable.go b/internal/integration_tests/mysql8/tagsmastermindstructableonly/FloatTable.go new file mode 100644 index 00000000..964963bb --- /dev/null +++ b/internal/integration_tests/mysql8/tagsmastermindstructableonly/FloatTable.go @@ -0,0 +1,31 @@ +package dto + +import ( + "database/sql" +) + +type FloatTable struct { + Col sql.NullFloat64 `stbl:"col"` + FloatNn float64 `stbl:"float_nn"` + FloatNnUnique float64 `stbl:"float_nn_unique,PRIMARY_KEY"` + FloatNnCheck float64 `stbl:"float_nn_check"` + FloatNnRef float64 `stbl:"float_nn_ref"` + FloatNnDefConst float64 `stbl:"float_nn_def_const"` + FloatNnDefFunc float64 `stbl:"float_nn_def_func"` + FloatNnUniqueCheck float64 `stbl:"float_nn_unique_check"` + FloatUnique sql.NullFloat64 `stbl:"float_unique"` + FloatUniqueCheck sql.NullFloat64 `stbl:"float_unique_check"` + FloatUniqueRef sql.NullFloat64 `stbl:"float_unique_ref"` + FloatUniqueDefConst sql.NullFloat64 `stbl:"float_unique_def_const"` + FloatUniqueDefFunc sql.NullFloat64 `stbl:"float_unique_def_func"` + FloatCheck sql.NullFloat64 `stbl:"float_check"` + FloatCheckRef sql.NullFloat64 `stbl:"float_check_ref"` + FloatCheckDefConst sql.NullFloat64 `stbl:"float_check_def_const"` + FloatCheckDefFunc sql.NullFloat64 `stbl:"float_check_def_func"` + FloatRef sql.NullFloat64 `stbl:"float_ref"` + FloatRefUniqueCheck sql.NullFloat64 `stbl:"float_ref_unique_check"` + FloatDefConst sql.NullFloat64 `stbl:"float_def_const"` + FloatDefConstUniqueCheck sql.NullFloat64 `stbl:"float_def_const_unique_check"` + FloatDefFunc sql.NullFloat64 `stbl:"float_def_func"` + FloatDefFuncUniqueCheck sql.NullFloat64 `stbl:"float_def_func_unique_check"` +} diff --git a/internal/integration_tests/mysql8/tagsmastermindstructableonly/IntegerTable.go b/internal/integration_tests/mysql8/tagsmastermindstructableonly/IntegerTable.go new file mode 100644 index 00000000..b64658b7 --- /dev/null +++ b/internal/integration_tests/mysql8/tagsmastermindstructableonly/IntegerTable.go @@ -0,0 +1,27 @@ +package dto + +import ( + "database/sql" +) + +type IntegerTable struct { + I sql.NullInt64 `stbl:"i"` + IntegerNn int `stbl:"integer_nn"` + IntegerNnUnique int `stbl:"integer_nn_unique,PRIMARY_KEY"` + IntegerNnCheck int `stbl:"integer_nn_check"` + IntegerUnique sql.NullInt64 `stbl:"integer_unique"` + IntegerUniqueCheck sql.NullInt64 `stbl:"integer_unique_check"` + IntegerUniqueRef sql.NullInt64 `stbl:"integer_unique_ref"` + IntegerUniqueDefConst sql.NullInt64 `stbl:"integer_unique_def_const"` + IntegerUniqueDefFunc sql.NullInt64 `stbl:"integer_unique_def_func"` + IntegerCheck sql.NullInt64 `stbl:"integer_check"` + IntegerCheckRef sql.NullInt64 `stbl:"integer_check_ref"` + IntegerCheckDefConst sql.NullInt64 `stbl:"integer_check_def_const"` + IntegerCheckDefFunc sql.NullInt64 `stbl:"integer_check_def_func"` + IntegerRef sql.NullInt64 `stbl:"integer_ref"` + IntegerRefUniqueCheck sql.NullInt64 `stbl:"integer_ref_unique_check"` + IntegerDefConst sql.NullInt64 `stbl:"integer_def_const"` + IntegerDefConstUniqueCheck sql.NullInt64 `stbl:"integer_def_const_unique_check"` + IntegerDefFunc sql.NullInt64 `stbl:"integer_def_func"` + IntegerDefFuncUniqueCheck sql.NullInt64 `stbl:"integer_def_func_unique_check"` +} diff --git a/internal/integration_tests/mysql8/tagsmastermindstructableonly/User.go b/internal/integration_tests/mysql8/tagsmastermindstructableonly/User.go new file mode 100644 index 00000000..03ea4a55 --- /dev/null +++ b/internal/integration_tests/mysql8/tagsmastermindstructableonly/User.go @@ -0,0 +1,11 @@ +package dto + +import ( + "database/sql" +) + +type User struct { + ID int `stbl:"id,PRIMARY_KEY,SERIAL,AUTO_INCREMENT"` + UserID int `stbl:"user_id"` + WebsiteURL sql.NullString `stbl:"website_url"` +} diff --git a/internal/integration_tests/mysql8/tagsmastermindstructableonly/VarcharTable.go b/internal/integration_tests/mysql8/tagsmastermindstructableonly/VarcharTable.go new file mode 100644 index 00000000..3dddecb9 --- /dev/null +++ b/internal/integration_tests/mysql8/tagsmastermindstructableonly/VarcharTable.go @@ -0,0 +1,33 @@ +package dto + +import ( + "database/sql" +) + +type VarcharTable struct { + Col sql.NullString `stbl:"col"` + VarcharCap sql.NullString `stbl:"varchar_cap"` + VarcharNn string `stbl:"varchar_nn"` + VarcharNnUnique string `stbl:"varchar_nn_unique,PRIMARY_KEY"` + VarcharNnCheckCmp string `stbl:"varchar_nn_check_cmp"` + VarcharNnCheckFn string `stbl:"varchar_nn_check_fn"` + VarcharNnRef string `stbl:"varchar_nn_ref"` + VarcharNnDefConst string `stbl:"varchar_nn_def_const"` + VarcharNnDefFunc string `stbl:"varchar_nn_def_func"` + VarcharNnUniqueCheck string `stbl:"varchar_nn_unique_check"` + VarcharUnique sql.NullString `stbl:"varchar_unique"` + VarcharUniqueCheck sql.NullString `stbl:"varchar_unique_check"` + VarcharUniqueRef sql.NullString `stbl:"varchar_unique_ref"` + VarcharUniqueDefConst sql.NullString `stbl:"varchar_unique_def_const"` + VarcharUniqueDefFunc sql.NullString `stbl:"varchar_unique_def_func"` + VarcharCheck sql.NullString `stbl:"varchar_check"` + VarcharCheckRef sql.NullString `stbl:"varchar_check_ref"` + VarcharCheckDefConst sql.NullString `stbl:"varchar_check_def_const"` + VarcharCheckDefFunc sql.NullString `stbl:"varchar_check_def_func"` + VarcharRef sql.NullString `stbl:"varchar_ref"` + VarcharRefUniqueCheck sql.NullString `stbl:"varchar_ref_unique_check"` + VarcharDefConst sql.NullString `stbl:"varchar_def_const"` + VarcharDefConstUniqueCheck sql.NullString `stbl:"varchar_def_const_unique_check"` + VarcharDefFunc sql.NullString `stbl:"varchar_def_func"` + VarcharDefFuncUniqueCheck sql.NullString `stbl:"varchar_def_func_unique_check"` +} diff --git a/internal/integration_tests/mysql8/tagsnodbflag/DatetimeTable.go b/internal/integration_tests/mysql8/tagsnodbflag/DatetimeTable.go new file mode 100644 index 00000000..7523b528 --- /dev/null +++ b/internal/integration_tests/mysql8/tagsnodbflag/DatetimeTable.go @@ -0,0 +1,32 @@ +package dto + +import ( + "database/sql" + "time" +) + +type DatetimeTable struct { + Datetime sql.NullTime + DatetimeNn time.Time + DatetimeNnUnique time.Time + DatetimeNnCheck time.Time + DatetimeNnRef time.Time + DatetimeNnDefConst time.Time + DatetimeNnDefFunc time.Time + DatetimeNnUniqueCheck time.Time + DatetimeUnique sql.NullTime + DatetimeUniqueCheck sql.NullTime + DatetimeUniqueRef sql.NullTime + DatetimeUniqueDefConst sql.NullTime + DatetimeUniqueDefFunc sql.NullTime + DatetimeCheck sql.NullTime + DatetimeCheckRef sql.NullTime + DatetimeCheckDefConst sql.NullTime + DatetimeCheckDefFunc sql.NullTime + DatetimeRef sql.NullTime + DatetimeRefUniqueCheck sql.NullTime + DatetimeDefConst sql.NullTime + DatetimeDefConstUniqueCheck sql.NullTime + DatetimeDefFunc sql.NullTime + DatetimeDefFuncUniqueCheck sql.NullTime +} diff --git a/internal/integration_tests/mysql8/tagsnodbflag/FloatTable.go b/internal/integration_tests/mysql8/tagsnodbflag/FloatTable.go new file mode 100644 index 00000000..bbad7d97 --- /dev/null +++ b/internal/integration_tests/mysql8/tagsnodbflag/FloatTable.go @@ -0,0 +1,31 @@ +package dto + +import ( + "database/sql" +) + +type FloatTable struct { + Col sql.NullFloat64 + FloatNn float64 + FloatNnUnique float64 + FloatNnCheck float64 + FloatNnRef float64 + FloatNnDefConst float64 + FloatNnDefFunc float64 + FloatNnUniqueCheck float64 + FloatUnique sql.NullFloat64 + FloatUniqueCheck sql.NullFloat64 + FloatUniqueRef sql.NullFloat64 + FloatUniqueDefConst sql.NullFloat64 + FloatUniqueDefFunc sql.NullFloat64 + FloatCheck sql.NullFloat64 + FloatCheckRef sql.NullFloat64 + FloatCheckDefConst sql.NullFloat64 + FloatCheckDefFunc sql.NullFloat64 + FloatRef sql.NullFloat64 + FloatRefUniqueCheck sql.NullFloat64 + FloatDefConst sql.NullFloat64 + FloatDefConstUniqueCheck sql.NullFloat64 + FloatDefFunc sql.NullFloat64 + FloatDefFuncUniqueCheck sql.NullFloat64 +} diff --git a/internal/integration_tests/mysql8/tagsnodbflag/IntegerTable.go b/internal/integration_tests/mysql8/tagsnodbflag/IntegerTable.go new file mode 100644 index 00000000..8bc6a081 --- /dev/null +++ b/internal/integration_tests/mysql8/tagsnodbflag/IntegerTable.go @@ -0,0 +1,27 @@ +package dto + +import ( + "database/sql" +) + +type IntegerTable struct { + I sql.NullInt64 + IntegerNn int + IntegerNnUnique int + IntegerNnCheck int + IntegerUnique sql.NullInt64 + IntegerUniqueCheck sql.NullInt64 + IntegerUniqueRef sql.NullInt64 + IntegerUniqueDefConst sql.NullInt64 + IntegerUniqueDefFunc sql.NullInt64 + IntegerCheck sql.NullInt64 + IntegerCheckRef sql.NullInt64 + IntegerCheckDefConst sql.NullInt64 + IntegerCheckDefFunc sql.NullInt64 + IntegerRef sql.NullInt64 + IntegerRefUniqueCheck sql.NullInt64 + IntegerDefConst sql.NullInt64 + IntegerDefConstUniqueCheck sql.NullInt64 + IntegerDefFunc sql.NullInt64 + IntegerDefFuncUniqueCheck sql.NullInt64 +} diff --git a/internal/integration_tests/mysql8/tagsnodbflag/User.go b/internal/integration_tests/mysql8/tagsnodbflag/User.go new file mode 100644 index 00000000..752e721a --- /dev/null +++ b/internal/integration_tests/mysql8/tagsnodbflag/User.go @@ -0,0 +1,11 @@ +package dto + +import ( + "database/sql" +) + +type User struct { + ID int + UserID int + WebsiteURL sql.NullString +} diff --git a/internal/integration_tests/mysql8/tagsnodbflag/VarcharTable.go b/internal/integration_tests/mysql8/tagsnodbflag/VarcharTable.go new file mode 100644 index 00000000..79378937 --- /dev/null +++ b/internal/integration_tests/mysql8/tagsnodbflag/VarcharTable.go @@ -0,0 +1,33 @@ +package dto + +import ( + "database/sql" +) + +type VarcharTable struct { + Col sql.NullString + VarcharCap sql.NullString + VarcharNn string + VarcharNnUnique string + VarcharNnCheckCmp string + VarcharNnCheckFn string + VarcharNnRef string + VarcharNnDefConst string + VarcharNnDefFunc string + VarcharNnUniqueCheck string + VarcharUnique sql.NullString + VarcharUniqueCheck sql.NullString + VarcharUniqueRef sql.NullString + VarcharUniqueDefConst sql.NullString + VarcharUniqueDefFunc sql.NullString + VarcharCheck sql.NullString + VarcharCheckRef sql.NullString + VarcharCheckDefConst sql.NullString + VarcharCheckDefFunc sql.NullString + VarcharRef sql.NullString + VarcharRefUniqueCheck sql.NullString + VarcharDefConst sql.NullString + VarcharDefConstUniqueCheck sql.NullString + VarcharDefFunc sql.NullString + VarcharDefFuncUniqueCheck sql.NullString +} diff --git a/internal/integration_tests/mysql8/testdata/bigint.sql b/internal/integration_tests/mysql8/testdata/bigint.sql new file mode 100644 index 00000000..f523cf92 --- /dev/null +++ b/internal/integration_tests/mysql8/testdata/bigint.sql @@ -0,0 +1,124 @@ +DROP TABLE IF EXISTS bigint_ref CASCADE; +CREATE TABLE bigint_ref +( + bigint_ref bigint UNIQUE +); + +DROP TABLE IF EXISTS bigint_table; +CREATE TABLE bigint_table +( + i bigint, + bigint_nn bigint NOT NULL, + bigint_nn_unique bigint NOT NULL UNIQUE, + bigint_nn_check bigint NOT NULL CHECK ( bigint_nn_check > 0 ), + + bigint_unique bigint UNIQUE, + bigint_unique_check bigint UNIQUE CHECK ( bigint_unique_check > 0 ), + bigint_unique_ref bigint UNIQUE REFERENCES bigint_ref (bigint_ref), + bigint_unique_def_const bigint UNIQUE DEFAULT 42, + bigint_unique_def_func bigint UNIQUE DEFAULT (pi()), + + bigint_check bigint CHECK ( bigint_check > 0 ), + bigint_check_ref bigint CHECK ( bigint_check_ref > 0 ) REFERENCES bigint_ref (bigint_ref), + bigint_check_def_const bigint CHECK ( bigint_check_def_const > 0 ) DEFAULT 42, + bigint_check_def_func bigint CHECK ( bigint_check_def_func > 0 ) DEFAULT (pi()), + + bigint_ref bigint REFERENCES bigint_ref (bigint_ref), + bigint_ref_unique_check bigint UNIQUE CHECK ( bigint_ref_unique_check > 0 ) REFERENCES bigint_ref (bigint_ref), + + bigint_def_const bigint DEFAULT 42, + bigint_def_const_unique_check bigint UNIQUE CHECK ( bigint_def_const_unique_check > 0 ) DEFAULT 42, + + bigint_def_func bigint DEFAULT (pi()), + bigint_def_func_unique_check bigint UNIQUE CHECK ( bigint_def_func_unique_check > 0 ) DEFAULT (pi()) +); + +DROP TABLE IF EXISTS bigint_pk; +CREATE TABLE bigint_pk +( + bigint_pk bigint PRIMARY KEY +); + +DROP TABLE IF EXISTS bigint_pk_ref; +CREATE TABLE bigint_pk_ref +( + bigint_pk_ref bigint PRIMARY KEY REFERENCES bigint_ref (bigint_ref) +); + +DROP TABLE IF EXISTS bigint_pk_def_const; +CREATE TABLE bigint_pk_def_const +( + bigint_pk_def_const bigint PRIMARY KEY DEFAULT 42 +); + +DROP TABLE IF EXISTS bigint_pk_def_func; +CREATE TABLE bigint_pk_def_func +( + bigint_pk_def_func bigint PRIMARY KEY DEFAULT (pi()) +); + +DROP TABLE IF EXISTS bigint_nn_pk; +CREATE TABLE bigint_nn_pk +( + bigint_nn_pk bigint NOT NULL PRIMARY KEY +); + +DROP TABLE IF EXISTS bigint_nn_unique_check_pk; +CREATE TABLE bigint_nn_unique_check_pk +( + bigint_nn_unique_check_pk bigint PRIMARY KEY NOT NULL UNIQUE CHECK ( bigint_nn_unique_check_pk > 0) +); + +DROP TABLE IF EXISTS bigint_nn_unique_check_pk_ref; +CREATE TABLE bigint_nn_unique_check_pk_ref +( + bigint_nn_unique_check_pk_ref bigint PRIMARY KEY NOT NULL UNIQUE CHECK ( bigint_nn_unique_check_pk_ref > 0) REFERENCES bigint_ref (bigint_ref) +); + +DROP TABLE IF EXISTS bigint_unique_pk; +CREATE TABLE bigint_unique_pk +( + bigint_unique_pk bigint PRIMARY KEY UNIQUE +); + +DROP TABLE IF EXISTS bigint_unique_check_pk; +CREATE TABLE bigint_unique_check_pk +( + bigint_unique_check_pk bigint PRIMARY KEY UNIQUE CHECK ( bigint_unique_check_pk > 0 ) +); + +DROP TABLE IF EXISTS bigint_unique_check_pk_ref; +CREATE TABLE bigint_unique_check_pk_ref +( + bigint_unique_check_pk_ref bigint PRIMARY KEY UNIQUE CHECK ( bigint_unique_check_pk_ref > 0) REFERENCES bigint_ref (bigint_ref) +); + +DROP TABLE IF EXISTS bigint_check_pk; +CREATE TABLE bigint_check_pk +( + bigint_check_pk bigint PRIMARY KEY CHECK ( bigint_check_pk > 0 ) +); + +DROP TABLE IF EXISTS bigint_def_const_unique_check_pk; +CREATE TABLE bigint_def_const_unique_check_pk +( + bigint_def_const_unique_check_pk bigint PRIMARY KEY UNIQUE CHECK ( bigint_def_const_unique_check_pk > 0 ) DEFAULT 42 +); + +DROP TABLE IF EXISTS bigint_def_const_unique_check_pk_ref; +CREATE TABLE bigint_def_const_unique_check_pk_ref +( + bigint_def_const_unique_check_pk_ref bigint PRIMARY KEY UNIQUE CHECK ( bigint_def_const_unique_check_pk_ref > 0 ) DEFAULT 42 REFERENCES bigint_ref (bigint_ref) +); + +DROP TABLE IF EXISTS bigint_def_func_unique_check_pk; +CREATE TABLE bigint_def_func_unique_check_pk +( + bigint_def_func_unique_check_pk bigint PRIMARY KEY UNIQUE CHECK ( bigint_def_func_unique_check_pk > 0 ) DEFAULT (pi()) +); + +DROP TABLE IF EXISTS bigint_def_func_unique_check_pk_ref; +CREATE TABLE bigint_def_func_unique_check_pk_ref +( + bigint_def_func_unique_check_pk_ref bigint PRIMARY KEY UNIQUE CHECK ( bigint_def_func_unique_check_pk_ref > 0 ) DEFAULT (pi()) REFERENCES bigint_ref (bigint_ref) +); diff --git a/internal/integration_tests/mysql8/testdata/binary.sql b/internal/integration_tests/mysql8/testdata/binary.sql new file mode 100644 index 00000000..7547514b --- /dev/null +++ b/internal/integration_tests/mysql8/testdata/binary.sql @@ -0,0 +1,131 @@ +DROP TABLE IF EXISTS binary_ref CASCADE; +CREATE TABLE binary_ref +( + binary_ref binary UNIQUE +); + +DROP TABLE IF EXISTS binary_table; +CREATE TABLE binary_table +( + col binary, + + binary_cap binary(255), + binary_nn binary NOT NULL, + binary_nn_unique binary NOT NULL UNIQUE, + binary_nn_check_cmp binary NOT NULL CHECK ( binary_nn_check_cmp = '42' ), + binary_nn_check_fn binary NOT NULL CHECK ( length(binary_nn_check_fn) > 0 ), + binary_nn_ref binary NOT NULL REFERENCES binary_ref (binary_ref), + binary_nn_def_const binary NOT NULL DEFAULT ('42'), + binary_nn_def_func binary NOT NULL DEFAULT (pi()), + binary_nn_unique_check binary NOT NULL UNIQUE CHECK ( length(binary_nn_unique_check) > 0 ), + + binary_unique binary UNIQUE, + binary_unique_check binary UNIQUE CHECK ( length(binary_unique_check) > 0 ), + binary_unique_ref binary UNIQUE REFERENCES binary_ref (binary_ref), + binary_unique_def_const binary UNIQUE DEFAULT ('42'), + binary_unique_def_func binary UNIQUE DEFAULT (pi()), + + binary_check binary CHECK ( length(binary_check) > 0 ), + binary_check_ref binary CHECK ( length(binary_check_ref) > 0 ) REFERENCES binary_ref (binary_ref), + binary_check_def_const binary CHECK ( length(binary_check_def_const) > 0 ) DEFAULT ('42'), + binary_check_def_func binary CHECK ( length(binary_check_def_func) > 0 ) DEFAULT (pi()), + + binary_ref binary REFERENCES binary_ref (binary_ref), + binary_ref_unique_check binary UNIQUE CHECK ( length(binary_ref_unique_check) > 0 ) REFERENCES binary_ref (binary_ref), + + binary_def_const binary DEFAULT ('42'), + binary_def_const_unique_check binary UNIQUE CHECK ( length(binary_def_const_unique_check) > 0 ) DEFAULT ('42'), + + binary_def_func binary DEFAULT (pi()), + binary_def_func_unique_check binary UNIQUE CHECK ( length(binary_def_func_unique_check) > 0 ) DEFAULT (pi()) +); + +DROP TABLE IF EXISTS binary_pk; +CREATE TABLE binary_pk +( + binary_pk binary PRIMARY KEY +); + +DROP TABLE IF EXISTS binary_pk_ref; +CREATE TABLE binary_pk_ref +( + binary_pk_ref binary PRIMARY KEY REFERENCES binary_ref (binary_ref) +); + +DROP TABLE IF EXISTS binary_pk_def_const; +CREATE TABLE binary_pk_def_const +( + binary_pk_def_const binary PRIMARY KEY DEFAULT ('42') +); + +DROP TABLE IF EXISTS binary_pk_def_func; +CREATE TABLE binary_pk_def_func +( + binary_pk_def_func binary PRIMARY KEY DEFAULT (pi()) +); + +DROP TABLE IF EXISTS binary_nn_pk; +CREATE TABLE binary_nn_pk +( + binary_nn_pk binary NOT NULL PRIMARY KEY +); + +DROP TABLE IF EXISTS binary_nn_unique_check_pk; +CREATE TABLE binary_nn_unique_check_pk +( + binary_nn_unique_check_pk binary PRIMARY KEY NOT NULL UNIQUE CHECK ( length(binary_nn_unique_check_pk) > 0) +); + +DROP TABLE IF EXISTS binary_nn_unique_check_pk_ref; +CREATE TABLE binary_nn_unique_check_pk_ref +( + binary_nn_unique_check_pk_ref binary PRIMARY KEY NOT NULL UNIQUE CHECK ( length(binary_nn_unique_check_pk_ref) > 0) REFERENCES binary_ref (binary_ref) +); + +DROP TABLE IF EXISTS binary_unique_pk; +CREATE TABLE binary_unique_pk +( + binary_unique_pk binary PRIMARY KEY UNIQUE +); + +DROP TABLE IF EXISTS binary_unique_check_pk; +CREATE TABLE binary_unique_check_pk +( + binary_unique_check_pk binary PRIMARY KEY UNIQUE CHECK ( length(binary_unique_check_pk) > 0 ) +); + +DROP TABLE IF EXISTS binary_unique_check_pk_ref; +CREATE TABLE binary_unique_check_pk_ref +( + binary_unique_check_pk_ref binary PRIMARY KEY UNIQUE CHECK ( length(binary_unique_check_pk_ref) > 0) REFERENCES binary_ref (binary_ref) +); + +DROP TABLE IF EXISTS binary_check_pk; +CREATE TABLE binary_check_pk +( + binary_check_pk binary PRIMARY KEY CHECK ( length(binary_check_pk) > 0 ) +); + +DROP TABLE IF EXISTS binary_def_const_unique_check_pk; +CREATE TABLE binary_def_const_unique_check_pk +( + binary_def_const_unique_check_pk binary PRIMARY KEY UNIQUE CHECK ( length(binary_def_const_unique_check_pk) > 0 ) DEFAULT ('42') +); + +DROP TABLE IF EXISTS binary_def_const_unique_check_pk_ref; +CREATE TABLE binary_def_const_unique_check_pk_ref +( + binary_def_const_unique_check_pk_ref binary PRIMARY KEY UNIQUE CHECK ( length(binary_def_const_unique_check_pk_ref) > 0 ) DEFAULT ('42') REFERENCES binary_ref (binary_ref) +); + +DROP TABLE IF EXISTS binary_def_func_unique_check_pk; +CREATE TABLE binary_def_func_unique_check_pk +( + binary_def_func_unique_check_pk binary PRIMARY KEY UNIQUE CHECK ( length(binary_def_func_unique_check_pk) > 0 ) DEFAULT (pi()) +); + +DROP TABLE IF EXISTS binary_def_func_unique_check_pk_ref; +CREATE TABLE binary_def_func_unique_check_pk_ref +( + binary_def_func_unique_check_pk_ref binary PRIMARY KEY UNIQUE CHECK ( length(binary_def_func_unique_check_pk_ref) > 0 ) DEFAULT (pi()) REFERENCES binary_ref (binary_ref) +); diff --git a/internal/integration_tests/mysql8/testdata/blob.sql b/internal/integration_tests/mysql8/testdata/blob.sql new file mode 100644 index 00000000..03059abd --- /dev/null +++ b/internal/integration_tests/mysql8/testdata/blob.sql @@ -0,0 +1,29 @@ +DROP TABLE IF EXISTS blob_ref CASCADE; +CREATE TABLE blob_ref +( + blob_ref blob NOT NULL, + KEY blob_ref_len_key (blob_ref(10)) +); + +DROP TABLE IF EXISTS blob_table; +CREATE TABLE blob_table +( + col blob, + + blob_def_const blob DEFAULT ('42'), + blob_def_func blob DEFAULT (pi()), + + blob_ref blob REFERENCES blob_ref (blob_ref), + + blob_nn blob NOT NULL, + blob_nn_check_cmp blob NOT NULL CHECK ( blob_nn_check_cmp = '42' ), + blob_nn_check_fn blob NOT NULL CHECK ( length(blob_nn_check_fn) > 0 ), + blob_nn_ref blob NOT NULL REFERENCES blob_ref (blob_ref), + blob_nn_def_const blob NOT NULL DEFAULT ('42'), + blob_nn_def_func blob NOT NULL DEFAULT (pi()), + + blob_check blob CHECK ( length(blob_check) > 0 ), + blob_check_ref blob CHECK ( length(blob_check_ref) > 0 ) REFERENCES blob_ref (blob_ref), + blob_check_def_const blob CHECK ( length(blob_check_def_const) > 0 ) DEFAULT ('42'), + blob_check_def_func blob CHECK ( length(blob_check_def_func) > 0 ) DEFAULT (pi()) +); diff --git a/internal/integration_tests/mysql8/testdata/char.sql b/internal/integration_tests/mysql8/testdata/char.sql new file mode 100644 index 00000000..033f7110 --- /dev/null +++ b/internal/integration_tests/mysql8/testdata/char.sql @@ -0,0 +1,131 @@ +DROP TABLE IF EXISTS char_ref CASCADE; +CREATE TABLE char_ref +( + char_ref char UNIQUE +); + +DROP TABLE IF EXISTS char_table; +CREATE TABLE char_table +( + col char, + + char_cap char(255), + char_nn char NOT NULL, + char_nn_unique char NOT NULL UNIQUE, + char_nn_check_cmp char NOT NULL CHECK ( char_nn_check_cmp = '42' ), + char_nn_check_fn char NOT NULL CHECK ( length(char_nn_check_fn) > 0 ), + char_nn_ref char NOT NULL REFERENCES char_ref (char_ref), + char_nn_def_const char NOT NULL DEFAULT ('42'), + char_nn_def_func char NOT NULL DEFAULT (pi()), + char_nn_unique_check char NOT NULL UNIQUE CHECK ( length(char_nn_unique_check) > 0 ), + + char_unique char UNIQUE, + char_unique_check char UNIQUE CHECK ( length(char_unique_check) > 0 ), + char_unique_ref char UNIQUE REFERENCES char_ref (char_ref), + char_unique_def_const char UNIQUE DEFAULT ('42'), + char_unique_def_func char UNIQUE DEFAULT (pi()), + + char_check char CHECK ( length(char_check) > 0 ), + char_check_ref char CHECK ( length(char_check_ref) > 0 ) REFERENCES char_ref (char_ref), + char_check_def_const char CHECK ( length(char_check_def_const) > 0 ) DEFAULT ('42'), + char_check_def_func char CHECK ( length(char_check_def_func) > 0 ) DEFAULT (pi()), + + char_ref char REFERENCES char_ref (char_ref), + char_ref_unique_check char UNIQUE CHECK ( length(char_ref_unique_check) > 0 ) REFERENCES char_ref (char_ref), + + char_def_const char DEFAULT ('42'), + char_def_const_unique_check char UNIQUE CHECK ( length(char_def_const_unique_check) > 0 ) DEFAULT ('42'), + + char_def_func char DEFAULT (pi()), + char_def_func_unique_check char UNIQUE CHECK ( length(char_def_func_unique_check) > 0 ) DEFAULT (pi()) +); + +DROP TABLE IF EXISTS char_pk; +CREATE TABLE char_pk +( + char_pk char PRIMARY KEY +); + +DROP TABLE IF EXISTS char_pk_ref; +CREATE TABLE char_pk_ref +( + char_pk_ref char PRIMARY KEY REFERENCES char_ref (char_ref) +); + +DROP TABLE IF EXISTS char_pk_def_const; +CREATE TABLE char_pk_def_const +( + char_pk_def_const char PRIMARY KEY DEFAULT ('42') +); + +DROP TABLE IF EXISTS char_pk_def_func; +CREATE TABLE char_pk_def_func +( + char_pk_def_func char PRIMARY KEY DEFAULT (pi()) +); + +DROP TABLE IF EXISTS char_nn_pk; +CREATE TABLE char_nn_pk +( + char_nn_pk char NOT NULL PRIMARY KEY +); + +DROP TABLE IF EXISTS char_nn_unique_check_pk; +CREATE TABLE char_nn_unique_check_pk +( + char_nn_unique_check_pk char PRIMARY KEY NOT NULL UNIQUE CHECK ( length(char_nn_unique_check_pk) > 0) +); + +DROP TABLE IF EXISTS char_nn_unique_check_pk_ref; +CREATE TABLE char_nn_unique_check_pk_ref +( + char_nn_unique_check_pk_ref char PRIMARY KEY NOT NULL UNIQUE CHECK ( length(char_nn_unique_check_pk_ref) > 0) REFERENCES char_ref (char_ref) +); + +DROP TABLE IF EXISTS char_unique_pk; +CREATE TABLE char_unique_pk +( + char_unique_pk char PRIMARY KEY UNIQUE +); + +DROP TABLE IF EXISTS char_unique_check_pk; +CREATE TABLE char_unique_check_pk +( + char_unique_check_pk char PRIMARY KEY UNIQUE CHECK ( length(char_unique_check_pk) > 0 ) +); + +DROP TABLE IF EXISTS char_unique_check_pk_ref; +CREATE TABLE char_unique_check_pk_ref +( + char_unique_check_pk_ref char PRIMARY KEY UNIQUE CHECK ( length(char_unique_check_pk_ref) > 0) REFERENCES char_ref (char_ref) +); + +DROP TABLE IF EXISTS char_check_pk; +CREATE TABLE char_check_pk +( + char_check_pk char PRIMARY KEY CHECK ( length(char_check_pk) > 0 ) +); + +DROP TABLE IF EXISTS char_def_const_unique_check_pk; +CREATE TABLE char_def_const_unique_check_pk +( + char_def_const_unique_check_pk char PRIMARY KEY UNIQUE CHECK ( length(char_def_const_unique_check_pk) > 0 ) DEFAULT ('42') +); + +DROP TABLE IF EXISTS char_def_const_unique_check_pk_ref; +CREATE TABLE char_def_const_unique_check_pk_ref +( + char_def_const_unique_check_pk_ref char PRIMARY KEY UNIQUE CHECK ( length(char_def_const_unique_check_pk_ref) > 0 ) DEFAULT ('42') REFERENCES char_ref (char_ref) +); + +DROP TABLE IF EXISTS char_def_func_unique_check_pk; +CREATE TABLE char_def_func_unique_check_pk +( + char_def_func_unique_check_pk char PRIMARY KEY UNIQUE CHECK ( length(char_def_func_unique_check_pk) > 0 ) DEFAULT (pi()) +); + +DROP TABLE IF EXISTS char_def_func_unique_check_pk_ref; +CREATE TABLE char_def_func_unique_check_pk_ref +( + char_def_func_unique_check_pk_ref char PRIMARY KEY UNIQUE CHECK ( length(char_def_func_unique_check_pk_ref) > 0 ) DEFAULT (pi()) REFERENCES char_ref (char_ref) +); diff --git a/internal/integration_tests/mysql8/testdata/constraint_combinations.sql b/internal/integration_tests/mysql8/testdata/constraint_combinations.sql new file mode 100644 index 00000000..01ea00b1 --- /dev/null +++ b/internal/integration_tests/mysql8/testdata/constraint_combinations.sql @@ -0,0 +1,70 @@ +DROP TABLE IF EXISTS constraint_combo_ref; +CREATE TABLE constraint_combo_ref +( + constraint_combo_ref double UNIQUE +); + +DROP TABLE IF EXISTS constraint_combo_non_pk; +CREATE TABLE constraint_combo_non_pk +( + not_null_unique_check_def_const double NOT NULL UNIQUE CHECK (not_null_unique_check_def_const > 0) DEFAULT 42, + not_null_unique_check_def_func double NOT NULL UNIQUE CHECK (not_null_unique_check_def_func > 0) DEFAULT (pi()), + not_null_unique_ref_def_const double NOT NULL UNIQUE DEFAULT 42 REFERENCES constraint_combo_ref(constraint_combo_ref), + not_null_unique_ref_def_func double NOT NULL UNIQUE DEFAULT (pi()) REFERENCES constraint_combo_ref(constraint_combo_ref), + not_null_check_ref_def_const double NOT NULL CHECK (not_null_check_ref_def_const > 0) DEFAULT 42 REFERENCES constraint_combo_ref(constraint_combo_ref), + not_null_check_ref_def_func double NOT NULL CHECK (not_null_check_ref_def_func > 0) DEFAULT (pi()) REFERENCES constraint_combo_ref(constraint_combo_ref), + not_null_unique_def_const double NOT NULL UNIQUE DEFAULT 42, + not_null_unique_def_func double NOT NULL UNIQUE DEFAULT (pi()), + not_null_check_def_const double NOT NULL CHECK (not_null_check_def_const > 0) DEFAULT 42, + not_null_check_def_func double NOT NULL CHECK (not_null_check_def_func > 0) DEFAULT (pi()), + not_null_ref_def_const double NOT NULL DEFAULT 42 REFERENCES constraint_combo_ref(constraint_combo_ref), + not_null_ref_def_func double NOT NULL DEFAULT (pi()) REFERENCES constraint_combo_ref(constraint_combo_ref) +); + +DROP TABLE IF EXISTS constraint_combo_not_null_unique_pk_def_const; +CREATE TABLE constraint_combo_not_null_unique_pk_def_const +( + constraint_combo_not_null_unique_pk_def_const double PRIMARY KEY NOT NULL UNIQUE DEFAULT 42 +); + +DROP TABLE IF EXISTS constraint_combo_not_null_unique_pk_def_func; +CREATE TABLE constraint_combo_not_null_unique_pk_def_func +( + constraint_combo_not_null_unique_pk_def_func double PRIMARY KEY NOT NULL UNIQUE DEFAULT (pi()) +); + +DROP TABLE IF EXISTS constraint_combo_not_null_check_pk_def_const; +CREATE TABLE constraint_combo_not_null_check_pk_def_const +( + constraint_combo_not_null_check_pk_def_const double PRIMARY KEY NOT NULL CHECK (constraint_combo_not_null_check_pk_def_const > 0) DEFAULT 42 +); + +DROP TABLE IF EXISTS constraint_combo_not_null_check_pk_def_func; +CREATE TABLE constraint_combo_not_null_check_pk_def_func +( + constraint_combo_not_null_check_pk_def_func double PRIMARY KEY NOT NULL CHECK (constraint_combo_not_null_check_pk_def_func > 0) DEFAULT (pi()) +); + +DROP TABLE IF EXISTS constraint_combo_not_null_pk_ref_def_const; +CREATE TABLE constraint_combo_not_null_pk_ref_def_const +( + constraint_combo_not_null_pk_ref_def_const double PRIMARY KEY NOT NULL DEFAULT 42 REFERENCES constraint_combo_ref(constraint_combo_ref) +); + +DROP TABLE IF EXISTS constraint_combo_not_null_pk_ref_def_func; +CREATE TABLE constraint_combo_not_null_pk_ref_def_func +( + constraint_combo_not_null_pk_ref_def_func double PRIMARY KEY NOT NULL DEFAULT (pi()) REFERENCES constraint_combo_ref(constraint_combo_ref) +); + +DROP TABLE IF EXISTS constraint_combo_not_null_pk_def_const; +CREATE TABLE constraint_combo_not_null_pk_def_const +( + constraint_combo_not_null_pk_def_const double NOT NULL PRIMARY KEY DEFAULT 42 +); + +DROP TABLE IF EXISTS constraint_combo_not_null_pk_def_func; +CREATE TABLE constraint_combo_not_null_pk_def_func +( + constraint_combo_not_null_pk_def_func double NOT NULL PRIMARY KEY DEFAULT (pi()) +); diff --git a/internal/integration_tests/mysql8/testdata/date.sql b/internal/integration_tests/mysql8/testdata/date.sql new file mode 100644 index 00000000..c94ff90b --- /dev/null +++ b/internal/integration_tests/mysql8/testdata/date.sql @@ -0,0 +1,128 @@ +DROP TABLE IF EXISTS date_ref CASCADE; +CREATE TABLE date_ref +( + date_ref date UNIQUE +); + +DROP TABLE IF EXISTS date_table; +CREATE TABLE date_table +( + date date, + date_nn date NOT NULL, + date_nn_unique date NOT NULL UNIQUE, + date_nn_check date NOT NULL CHECK ( date_nn_check > '2020-03-01' ), + date_nn_ref date NOT NULL REFERENCES date_ref (date_ref), + date_nn_def_const date NOT NULL DEFAULT ('2020-03-01'), + date_nn_def_func date NOT NULL DEFAULT (now()), + date_nn_unique_check date NOT NULL UNIQUE CHECK ( date_nn_unique_check > '2020-03-01' ), + + date_unique date UNIQUE, + date_unique_check date UNIQUE CHECK ( date_unique_check > '2020-03-01' ), + date_unique_ref date UNIQUE REFERENCES date_ref (date_ref), + date_unique_def_const date UNIQUE DEFAULT ('2020-03-01'), + date_unique_def_func date UNIQUE DEFAULT (now()), + + date_check date CHECK ( date_check > '2020-03-01' ), + date_check_ref date CHECK ( date_check_ref > '2020-03-01' ) REFERENCES date_ref (date_ref), + date_check_def_const date CHECK ( date_check_def_const > '2020-03-01' ) DEFAULT ('2020-03-01'), + date_check_def_func date CHECK ( date_check_def_func > '2020-03-01' ) DEFAULT (now()), + + date_ref date REFERENCES date_ref (date_ref), + date_ref_unique_check date UNIQUE CHECK ( date_ref_unique_check > '2020-03-01' ) REFERENCES date_ref (date_ref), + + date_def_const date DEFAULT ('2020-03-01'), + date_def_const_unique_check date UNIQUE CHECK ( date_def_const_unique_check > '2020-03-01' ) DEFAULT ('2020-03-01'), + + date_def_func date DEFAULT (now()), + date_def_func_unique_check date UNIQUE CHECK ( date_def_func_unique_check > '2020-03-01' ) DEFAULT (now()) +); + +DROP TABLE IF EXISTS date_pk; +CREATE TABLE date_pk +( + date_pk date PRIMARY KEY +); + +DROP TABLE IF EXISTS date_pk_ref; +CREATE TABLE date_pk_ref +( + date_pk_ref date PRIMARY KEY REFERENCES date_ref (date_ref) +); + +DROP TABLE IF EXISTS date_pk_def_const; +CREATE TABLE date_pk_def_const +( + date_pk_def_const date PRIMARY KEY DEFAULT ('2020-03-01') +); + +DROP TABLE IF EXISTS date_pk_def_func; +CREATE TABLE date_pk_def_func +( + date_pk_def_func date PRIMARY KEY DEFAULT (now()) +); + +DROP TABLE IF EXISTS date_nn_pk; +CREATE TABLE date_nn_pk +( + date_nn_pk date NOT NULL PRIMARY KEY +); + +DROP TABLE IF EXISTS date_nn_unique_check_pk; +CREATE TABLE date_nn_unique_check_pk +( + date_nn_unique_check_pk date PRIMARY KEY NOT NULL UNIQUE CHECK ( date_nn_unique_check_pk > '2020-03-01' ) +); + +DROP TABLE IF EXISTS date_nn_unique_check_pk_ref; +CREATE TABLE date_nn_unique_check_pk_ref +( + date_nn_unique_check_pk_ref date PRIMARY KEY NOT NULL UNIQUE CHECK ( date_nn_unique_check_pk_ref > '2020-03-01' ) REFERENCES date_ref (date_ref) +); + +DROP TABLE IF EXISTS date_unique_pk; +CREATE TABLE date_unique_pk +( + date_unique_pk date PRIMARY KEY UNIQUE +); + +DROP TABLE IF EXISTS date_unique_check_pk; +CREATE TABLE date_unique_check_pk +( + date_unique_check_pk date PRIMARY KEY UNIQUE CHECK ( date_unique_check_pk > '2020-03-01' ) +); + +DROP TABLE IF EXISTS date_unique_check_pk_ref; +CREATE TABLE date_unique_check_pk_ref +( + date_unique_check_pk_ref date PRIMARY KEY UNIQUE CHECK ( date_unique_check_pk_ref > '2020-03-01' ) REFERENCES date_ref (date_ref) +); + +DROP TABLE IF EXISTS date_check_pk; +CREATE TABLE date_check_pk +( + date_check_pk date PRIMARY KEY CHECK ( date_check_pk > '2020-03-01' ) +); + +DROP TABLE IF EXISTS date_def_const_unique_check_pk; +CREATE TABLE date_def_const_unique_check_pk +( + date_def_const_unique_check_pk date PRIMARY KEY UNIQUE CHECK ( date_def_const_unique_check_pk > '2020-03-01' ) DEFAULT ('2020-03-01') +); + +DROP TABLE IF EXISTS date_def_const_unique_check_pk_ref; +CREATE TABLE date_def_const_unique_check_pk_ref +( + date_def_const_unique_check_pk_ref date PRIMARY KEY UNIQUE CHECK ( date_def_const_unique_check_pk_ref > '2020-03-01' ) DEFAULT ('2020-03-01') REFERENCES date_ref (date_ref) +); + +DROP TABLE IF EXISTS date_def_func_unique_check_pk; +CREATE TABLE date_def_func_unique_check_pk +( + date_def_func_unique_check_pk date PRIMARY KEY UNIQUE CHECK ( date_def_func_unique_check_pk > '2020-03-01' ) DEFAULT (now()) +); + +DROP TABLE IF EXISTS date_def_func_unique_check_pk_ref; +CREATE TABLE date_def_func_unique_check_pk_ref +( + date_def_func_unique_check_pk_ref date PRIMARY KEY UNIQUE CHECK ( date_def_func_unique_check_pk_ref > '2020-03-01' ) DEFAULT (now()) REFERENCES date_ref (date_ref) +); diff --git a/internal/integration_tests/mysql8/testdata/datetime.sql b/internal/integration_tests/mysql8/testdata/datetime.sql new file mode 100644 index 00000000..61c510ec --- /dev/null +++ b/internal/integration_tests/mysql8/testdata/datetime.sql @@ -0,0 +1,128 @@ +DROP TABLE IF EXISTS datetime_ref CASCADE; +CREATE TABLE datetime_ref +( + datetime_ref datetime UNIQUE +); + +DROP TABLE IF EXISTS datetime_table; +CREATE TABLE datetime_table +( + datetime datetime, + datetime_nn datetime NOT NULL, + datetime_nn_unique datetime NOT NULL UNIQUE, + datetime_nn_check datetime NOT NULL CHECK ( datetime_nn_check > '2020-03-01 12:34:56' ), + datetime_nn_ref datetime NOT NULL REFERENCES datetime_ref (datetime_ref), + datetime_nn_def_const datetime NOT NULL DEFAULT ('2020-03-01 12:34:56'), + datetime_nn_def_func datetime NOT NULL DEFAULT (now()), + datetime_nn_unique_check datetime NOT NULL UNIQUE CHECK ( datetime_nn_unique_check > '2020-03-01 12:34:56' ), + + datetime_unique datetime UNIQUE, + datetime_unique_check datetime UNIQUE CHECK ( datetime_unique_check > '2020-03-01 12:34:56' ), + datetime_unique_ref datetime UNIQUE REFERENCES datetime_ref (datetime_ref), + datetime_unique_def_const datetime UNIQUE DEFAULT ('2020-03-01 12:34:56'), + datetime_unique_def_func datetime UNIQUE DEFAULT (now()), + + datetime_check datetime CHECK ( datetime_check > '2020-03-01 12:34:56' ), + datetime_check_ref datetime CHECK ( datetime_check_ref > '2020-03-01 12:34:56' ) REFERENCES datetime_ref (datetime_ref), + datetime_check_def_const datetime CHECK ( datetime_check_def_const > '2020-03-01 12:34:56' ) DEFAULT ('2020-03-01 12:34:56'), + datetime_check_def_func datetime CHECK ( datetime_check_def_func > '2020-03-01 12:34:56' ) DEFAULT (now()), + + datetime_ref datetime REFERENCES datetime_ref (datetime_ref), + datetime_ref_unique_check datetime UNIQUE CHECK ( datetime_ref_unique_check > '2020-03-01 12:34:56' ) REFERENCES datetime_ref (datetime_ref), + + datetime_def_const datetime DEFAULT ('2020-03-01 12:34:56'), + datetime_def_const_unique_check datetime UNIQUE CHECK ( datetime_def_const_unique_check > '2020-03-01 12:34:56' ) DEFAULT ('2020-03-01 12:34:56'), + + datetime_def_func datetime DEFAULT (now()), + datetime_def_func_unique_check datetime UNIQUE CHECK ( datetime_def_func_unique_check > '2020-03-01 12:34:56' ) DEFAULT (now()) +); + +DROP TABLE IF EXISTS datetime_pk; +CREATE TABLE datetime_pk +( + datetime_pk datetime PRIMARY KEY +); + +DROP TABLE IF EXISTS datetime_pk_ref; +CREATE TABLE datetime_pk_ref +( + datetime_pk_ref datetime PRIMARY KEY REFERENCES datetime_ref (datetime_ref) +); + +DROP TABLE IF EXISTS datetime_pk_def_const; +CREATE TABLE datetime_pk_def_const +( + datetime_pk_def_const datetime PRIMARY KEY DEFAULT ('2020-03-01 12:34:56') +); + +DROP TABLE IF EXISTS datetime_pk_def_func; +CREATE TABLE datetime_pk_def_func +( + datetime_pk_def_func datetime PRIMARY KEY DEFAULT (now()) +); + +DROP TABLE IF EXISTS datetime_nn_pk; +CREATE TABLE datetime_nn_pk +( + datetime_nn_pk datetime NOT NULL PRIMARY KEY +); + +DROP TABLE IF EXISTS datetime_nn_unique_check_pk; +CREATE TABLE datetime_nn_unique_check_pk +( + datetime_nn_unique_check_pk datetime PRIMARY KEY NOT NULL UNIQUE CHECK ( datetime_nn_unique_check_pk > '2020-03-01 12:34:56' ) +); + +DROP TABLE IF EXISTS datetime_nn_unique_check_pk_ref; +CREATE TABLE datetime_nn_unique_check_pk_ref +( + datetime_nn_unique_check_pk_ref datetime PRIMARY KEY NOT NULL UNIQUE CHECK ( datetime_nn_unique_check_pk_ref > '2020-03-01 12:34:56' ) REFERENCES datetime_ref (datetime_ref) +); + +DROP TABLE IF EXISTS datetime_unique_pk; +CREATE TABLE datetime_unique_pk +( + datetime_unique_pk datetime PRIMARY KEY UNIQUE +); + +DROP TABLE IF EXISTS datetime_unique_check_pk; +CREATE TABLE datetime_unique_check_pk +( + datetime_unique_check_pk datetime PRIMARY KEY UNIQUE CHECK ( datetime_unique_check_pk > '2020-03-01 12:34:56' ) +); + +DROP TABLE IF EXISTS datetime_unique_check_pk_ref; +CREATE TABLE datetime_unique_check_pk_ref +( + datetime_unique_check_pk_ref datetime PRIMARY KEY UNIQUE CHECK ( datetime_unique_check_pk_ref > '2020-03-01 12:34:56' ) REFERENCES datetime_ref (datetime_ref) +); + +DROP TABLE IF EXISTS datetime_check_pk; +CREATE TABLE datetime_check_pk +( + datetime_check_pk datetime PRIMARY KEY CHECK ( datetime_check_pk > '2020-03-01 12:34:56' ) +); + +DROP TABLE IF EXISTS datetime_def_const_unique_check_pk; +CREATE TABLE datetime_def_const_unique_check_pk +( + datetime_def_const_unique_check_pk datetime PRIMARY KEY UNIQUE CHECK ( datetime_def_const_unique_check_pk > '2020-03-01 12:34:56' ) DEFAULT ('2020-03-01 12:34:56') +); + +DROP TABLE IF EXISTS datetime_def_const_unique_check_pk_ref; +CREATE TABLE datetime_def_const_unique_check_pk_ref +( + datetime_def_const_unique_check_pk_ref datetime PRIMARY KEY UNIQUE CHECK ( datetime_def_const_unique_check_pk_ref > '2020-03-01 12:34:56' ) DEFAULT ('2020-03-01 12:34:56') REFERENCES datetime_ref (datetime_ref) +); + +DROP TABLE IF EXISTS datetime_def_func_unique_check_pk; +CREATE TABLE datetime_def_func_unique_check_pk +( + datetime_def_func_unique_check_pk datetime PRIMARY KEY UNIQUE CHECK ( datetime_def_func_unique_check_pk > '2020-03-01 12:34:56' ) DEFAULT (now()) +); + +DROP TABLE IF EXISTS datetime_def_func_unique_check_pk_ref; +CREATE TABLE datetime_def_func_unique_check_pk_ref +( + datetime_def_func_unique_check_pk_ref datetime PRIMARY KEY UNIQUE CHECK ( datetime_def_func_unique_check_pk_ref > '2020-03-01 12:34:56' ) DEFAULT (now()) REFERENCES datetime_ref (datetime_ref) +); diff --git a/internal/integration_tests/mysql8/testdata/decimal.sql b/internal/integration_tests/mysql8/testdata/decimal.sql new file mode 100644 index 00000000..cfba3d1b --- /dev/null +++ b/internal/integration_tests/mysql8/testdata/decimal.sql @@ -0,0 +1,129 @@ +DROP TABLE IF EXISTS decimal_ref CASCADE; +CREATE TABLE decimal_ref +( + decimal_ref decimal UNIQUE +); + +DROP TABLE IF EXISTS decimal_table; +CREATE TABLE decimal_table +( + col decimal, + + decimal_nn decimal NOT NULL, + decimal_nn_unique decimal NOT NULL UNIQUE, + decimal_nn_check decimal NOT NULL CHECK ( decimal_nn_check > 0 ), + decimal_nn_ref decimal NOT NULL REFERENCES decimal_ref (decimal_ref), + decimal_nn_def_const decimal NOT NULL DEFAULT 42, + decimal_nn_def_func decimal NOT NULL DEFAULT (pi()), + decimal_nn_unique_check decimal NOT NULL UNIQUE CHECK ( decimal_nn_unique_check > 0 ), + + decimal_unique decimal UNIQUE, + decimal_unique_check decimal UNIQUE CHECK ( decimal_unique_check > 0 ), + decimal_unique_ref decimal UNIQUE REFERENCES decimal_ref (decimal_ref), + decimal_unique_def_const decimal UNIQUE DEFAULT 42, + decimal_unique_def_func decimal UNIQUE DEFAULT (pi()), + + decimal_check decimal CHECK ( decimal_check > 0 ), + decimal_check_ref decimal CHECK ( decimal_check_ref > 0 ) REFERENCES decimal_ref (decimal_ref), + decimal_check_def_const decimal CHECK ( decimal_check_def_const > 0 ) DEFAULT 42, + decimal_check_def_func decimal CHECK ( decimal_check_def_func > 0 ) DEFAULT (pi()), + + decimal_ref decimal REFERENCES decimal_ref (decimal_ref), + decimal_ref_unique_check decimal UNIQUE CHECK ( decimal_ref_unique_check > 0 ) REFERENCES decimal_ref (decimal_ref), + + decimal_def_const decimal DEFAULT 42, + decimal_def_const_unique_check decimal UNIQUE CHECK ( decimal_def_const_unique_check > 0 ) DEFAULT 42, + + decimal_def_func decimal DEFAULT (pi()), + decimal_def_func_unique_check decimal UNIQUE CHECK ( decimal_def_func_unique_check > 0 ) DEFAULT (pi()) +); + +DROP TABLE IF EXISTS decimal_pk; +CREATE TABLE decimal_pk +( + decimal_pk decimal PRIMARY KEY +); + +DROP TABLE IF EXISTS decimal_pk_ref; +CREATE TABLE decimal_pk_ref +( + decimal_pk_ref decimal PRIMARY KEY REFERENCES decimal_ref (decimal_ref) +); + +DROP TABLE IF EXISTS decimal_pk_def_const; +CREATE TABLE decimal_pk_def_const +( + decimal_pk_def_const decimal PRIMARY KEY DEFAULT 42 +); + +DROP TABLE IF EXISTS decimal_pk_def_func; +CREATE TABLE decimal_pk_def_func +( + decimal_pk_def_func decimal PRIMARY KEY DEFAULT (pi()) +); + +DROP TABLE IF EXISTS decimal_nn_pk; +CREATE TABLE decimal_nn_pk +( + decimal_nn_pk decimal NOT NULL PRIMARY KEY +); + +DROP TABLE IF EXISTS decimal_nn_unique_check_pk; +CREATE TABLE decimal_nn_unique_check_pk +( + decimal_nn_unique_check_pk decimal PRIMARY KEY NOT NULL UNIQUE CHECK ( decimal_nn_unique_check_pk > 0) +); + +DROP TABLE IF EXISTS decimal_nn_unique_check_pk_ref; +CREATE TABLE decimal_nn_unique_check_pk_ref +( + decimal_nn_unique_check_pk_ref decimal PRIMARY KEY NOT NULL UNIQUE CHECK ( decimal_nn_unique_check_pk_ref > 0) REFERENCES decimal_ref (decimal_ref) +); + +DROP TABLE IF EXISTS decimal_unique_pk; +CREATE TABLE decimal_unique_pk +( + decimal_unique_pk decimal PRIMARY KEY UNIQUE +); + +DROP TABLE IF EXISTS decimal_unique_check_pk; +CREATE TABLE decimal_unique_check_pk +( + decimal_unique_check_pk decimal PRIMARY KEY UNIQUE CHECK ( decimal_unique_check_pk > 0 ) +); + +DROP TABLE IF EXISTS decimal_unique_check_pk_ref; +CREATE TABLE decimal_unique_check_pk_ref +( + decimal_unique_check_pk_ref decimal PRIMARY KEY UNIQUE CHECK ( decimal_unique_check_pk_ref > 0) REFERENCES decimal_ref (decimal_ref) +); + +DROP TABLE IF EXISTS decimal_check_pk; +CREATE TABLE decimal_check_pk +( + decimal_check_pk decimal PRIMARY KEY CHECK ( decimal_check_pk > 0 ) +); + +DROP TABLE IF EXISTS decimal_def_const_unique_check_pk; +CREATE TABLE decimal_def_const_unique_check_pk +( + decimal_def_const_unique_check_pk decimal PRIMARY KEY UNIQUE CHECK ( decimal_def_const_unique_check_pk > 0 ) DEFAULT 42 +); + +DROP TABLE IF EXISTS decimal_def_const_unique_check_pk_ref; +CREATE TABLE decimal_def_const_unique_check_pk_ref +( + decimal_def_const_unique_check_pk_ref decimal PRIMARY KEY UNIQUE CHECK ( decimal_def_const_unique_check_pk_ref > 0 ) DEFAULT 42 REFERENCES decimal_ref (decimal_ref) +); + +DROP TABLE IF EXISTS decimal_def_func_unique_check_pk; +CREATE TABLE decimal_def_func_unique_check_pk +( + decimal_def_func_unique_check_pk decimal PRIMARY KEY UNIQUE CHECK ( decimal_def_func_unique_check_pk > 0 ) DEFAULT (pi()) +); + +DROP TABLE IF EXISTS decimal_def_func_unique_check_pk_ref; +CREATE TABLE decimal_def_func_unique_check_pk_ref +( + decimal_def_func_unique_check_pk_ref decimal PRIMARY KEY UNIQUE CHECK ( decimal_def_func_unique_check_pk_ref > 0 ) DEFAULT (pi()) REFERENCES decimal_ref (decimal_ref) +); diff --git a/internal/integration_tests/mysql8/testdata/doubleprecision.sql b/internal/integration_tests/mysql8/testdata/doubleprecision.sql new file mode 100644 index 00000000..522958b2 --- /dev/null +++ b/internal/integration_tests/mysql8/testdata/doubleprecision.sql @@ -0,0 +1,129 @@ +DROP TABLE IF EXISTS double_precision_ref CASCADE; +CREATE TABLE double_precision_ref +( + double_precision_ref double precision UNIQUE +); + +DROP TABLE IF EXISTS double_precision_table; +CREATE TABLE double_precision_table +( + col double precision, + + double_precision_nn double precision NOT NULL, + double_precision_nn_unique double precision NOT NULL UNIQUE, + double_precision_nn_check double precision NOT NULL CHECK ( double_precision_nn_check > 0 ), + double_precision_nn_ref double precision NOT NULL REFERENCES double_precision_ref (double_precision_ref), + double_precision_nn_def_const double precision NOT NULL DEFAULT 42, + double_precision_nn_def_func double precision NOT NULL DEFAULT (pi()), + double_precision_nn_unique_check double precision NOT NULL UNIQUE CHECK ( double_precision_nn_unique_check > 0 ), + + double_precision_unique double precision UNIQUE, + double_precision_unique_check double precision UNIQUE CHECK ( double_precision_unique_check > 0 ), + double_precision_unique_ref double precision UNIQUE REFERENCES double_precision_ref (double_precision_ref), + double_precision_unique_def_const double precision UNIQUE DEFAULT 42, + double_precision_unique_def_func double precision UNIQUE DEFAULT (pi()), + + double_precision_check double precision CHECK ( double_precision_check > 0 ), + double_precision_check_ref double precision CHECK ( double_precision_check_ref > 0 ) REFERENCES double_precision_ref (double_precision_ref), + double_precision_check_def_const double precision CHECK ( double_precision_check_def_const > 0 ) DEFAULT 42, + double_precision_check_def_func double precision CHECK ( double_precision_check_def_func > 0 ) DEFAULT (pi()), + + double_precision_ref double precision REFERENCES double_precision_ref (double_precision_ref), + double_precision_ref_unique_check double precision UNIQUE CHECK ( double_precision_ref_unique_check > 0 ) REFERENCES double_precision_ref (double_precision_ref), + + double_precision_def_const double precision DEFAULT 42, + double_precision_def_const_unique_check double precision UNIQUE CHECK ( double_precision_def_const_unique_check > 0 ) DEFAULT 42, + + double_precision_def_func double precision DEFAULT (pi()), + double_precision_def_func_unique_check double precision UNIQUE CHECK ( double_precision_def_func_unique_check > 0 ) DEFAULT (pi()) +); + +DROP TABLE IF EXISTS double_precision_pk; +CREATE TABLE double_precision_pk +( + double_precision_pk double precision PRIMARY KEY +); + +DROP TABLE IF EXISTS double_precision_pk_ref; +CREATE TABLE double_precision_pk_ref +( + double_precision_pk_ref double precision PRIMARY KEY REFERENCES double_precision_ref (double_precision_ref) +); + +DROP TABLE IF EXISTS double_precision_pk_def_const; +CREATE TABLE double_precision_pk_def_const +( + double_precision_pk_def_const double precision PRIMARY KEY DEFAULT 42 +); + +DROP TABLE IF EXISTS double_precision_pk_def_func; +CREATE TABLE double_precision_pk_def_func +( + double_precision_pk_def_func double precision PRIMARY KEY DEFAULT (pi()) +); + +DROP TABLE IF EXISTS double_precision_nn_pk; +CREATE TABLE double_precision_nn_pk +( + double_precision_nn_pk double precision NOT NULL PRIMARY KEY +); + +DROP TABLE IF EXISTS double_precision_nn_unique_check_pk; +CREATE TABLE double_precision_nn_unique_check_pk +( + double_precision_nn_unique_check_pk double precision PRIMARY KEY NOT NULL UNIQUE CHECK ( double_precision_nn_unique_check_pk > 0) +); + +DROP TABLE IF EXISTS double_precision_nn_unique_check_pk_ref; +CREATE TABLE double_precision_nn_unique_check_pk_ref +( + double_precision_nn_unique_check_pk_ref double precision PRIMARY KEY NOT NULL UNIQUE CHECK ( double_precision_nn_unique_check_pk_ref > 0) REFERENCES double_precision_ref (double_precision_ref) +); + +DROP TABLE IF EXISTS double_precision_unique_pk; +CREATE TABLE double_precision_unique_pk +( + double_precision_unique_pk double precision PRIMARY KEY UNIQUE +); + +DROP TABLE IF EXISTS double_precision_unique_check_pk; +CREATE TABLE double_precision_unique_check_pk +( + double_precision_unique_check_pk double precision PRIMARY KEY UNIQUE CHECK ( double_precision_unique_check_pk > 0 ) +); + +DROP TABLE IF EXISTS double_precision_unique_check_pk_ref; +CREATE TABLE double_precision_unique_check_pk_ref +( + double_precision_unique_check_pk_ref double precision PRIMARY KEY UNIQUE CHECK ( double_precision_unique_check_pk_ref > 0) REFERENCES double_precision_ref (double_precision_ref) +); + +DROP TABLE IF EXISTS double_precision_check_pk; +CREATE TABLE double_precision_check_pk +( + double_precision_check_pk double precision PRIMARY KEY CHECK ( double_precision_check_pk > 0 ) +); + +DROP TABLE IF EXISTS double_precision_def_const_unique_check_pk; +CREATE TABLE double_precision_def_const_unique_check_pk +( + double_precision_def_const_unique_check_pk double precision PRIMARY KEY UNIQUE CHECK ( double_precision_def_const_unique_check_pk > 0 ) DEFAULT 42 +); + +DROP TABLE IF EXISTS double_precision_def_const_unique_check_pk_ref; +CREATE TABLE double_precision_def_const_unique_check_pk_ref +( + double_precision_def_const_unique_check_pk_ref double precision PRIMARY KEY UNIQUE CHECK ( double_precision_def_const_unique_check_pk_ref > 0 ) DEFAULT 42 REFERENCES double_precision_ref (double_precision_ref) +); + +DROP TABLE IF EXISTS double_precision_def_func_unique_check_pk; +CREATE TABLE double_precision_def_func_unique_check_pk +( + double_precision_def_func_unique_check_pk double precision PRIMARY KEY UNIQUE CHECK ( double_precision_def_func_unique_check_pk > 0 ) DEFAULT (pi()) +); + +DROP TABLE IF EXISTS double_precision_def_func_unique_check_pk_ref; +CREATE TABLE double_precision_def_func_unique_check_pk_ref +( + double_precision_def_func_unique_check_pk_ref double precision PRIMARY KEY UNIQUE CHECK ( double_precision_def_func_unique_check_pk_ref > 0 ) DEFAULT (pi()) REFERENCES double_precision_ref (double_precision_ref) +); diff --git a/internal/integration_tests/mysql8/testdata/float.sql b/internal/integration_tests/mysql8/testdata/float.sql new file mode 100644 index 00000000..93d2606f --- /dev/null +++ b/internal/integration_tests/mysql8/testdata/float.sql @@ -0,0 +1,129 @@ +DROP TABLE IF EXISTS float_ref CASCADE; +CREATE TABLE float_ref +( + float_ref float UNIQUE +); + +DROP TABLE IF EXISTS float_table; +CREATE TABLE float_table +( + col float, + + float_nn float NOT NULL, + float_nn_unique float NOT NULL UNIQUE, + float_nn_check float NOT NULL CHECK ( float_nn_check > 0 ), + float_nn_ref float NOT NULL REFERENCES float_ref (float_ref), + float_nn_def_const float NOT NULL DEFAULT 42, + float_nn_def_func float NOT NULL DEFAULT (pi()), + float_nn_unique_check float NOT NULL UNIQUE CHECK ( float_nn_unique_check > 0 ), + + float_unique float UNIQUE, + float_unique_check float UNIQUE CHECK ( float_unique_check > 0 ), + float_unique_ref float UNIQUE REFERENCES float_ref (float_ref), + float_unique_def_const float UNIQUE DEFAULT 42, + float_unique_def_func float UNIQUE DEFAULT (pi()), + + float_check float CHECK ( float_check > 0 ), + float_check_ref float CHECK ( float_check_ref > 0 ) REFERENCES float_ref (float_ref), + float_check_def_const float CHECK ( float_check_def_const > 0 ) DEFAULT 42, + float_check_def_func float CHECK ( float_check_def_func > 0 ) DEFAULT (pi()), + + float_ref float REFERENCES float_ref (float_ref), + float_ref_unique_check float UNIQUE CHECK ( float_ref_unique_check > 0 ) REFERENCES float_ref (float_ref), + + float_def_const float DEFAULT 42, + float_def_const_unique_check float UNIQUE CHECK ( float_def_const_unique_check > 0 ) DEFAULT 42, + + float_def_func float DEFAULT (pi()), + float_def_func_unique_check float UNIQUE CHECK ( float_def_func_unique_check > 0 ) DEFAULT (pi()) +); + +DROP TABLE IF EXISTS float_pk; +CREATE TABLE float_pk +( + float_pk float PRIMARY KEY +); + +DROP TABLE IF EXISTS float_pk_ref; +CREATE TABLE float_pk_ref +( + float_pk_ref float PRIMARY KEY REFERENCES float_ref (float_ref) +); + +DROP TABLE IF EXISTS float_pk_def_const; +CREATE TABLE float_pk_def_const +( + float_pk_def_const float PRIMARY KEY DEFAULT 42 +); + +DROP TABLE IF EXISTS float_pk_def_func; +CREATE TABLE float_pk_def_func +( + float_pk_def_func float PRIMARY KEY DEFAULT (pi()) +); + +DROP TABLE IF EXISTS float_nn_pk; +CREATE TABLE float_nn_pk +( + float_nn_pk float NOT NULL PRIMARY KEY +); + +DROP TABLE IF EXISTS float_nn_unique_check_pk; +CREATE TABLE float_nn_unique_check_pk +( + float_nn_unique_check_pk float PRIMARY KEY NOT NULL UNIQUE CHECK ( float_nn_unique_check_pk > 0) +); + +DROP TABLE IF EXISTS float_nn_unique_check_pk_ref; +CREATE TABLE float_nn_unique_check_pk_ref +( + float_nn_unique_check_pk_ref float PRIMARY KEY NOT NULL UNIQUE CHECK ( float_nn_unique_check_pk_ref > 0) REFERENCES float_ref (float_ref) +); + +DROP TABLE IF EXISTS float_unique_pk; +CREATE TABLE float_unique_pk +( + float_unique_pk float PRIMARY KEY UNIQUE +); + +DROP TABLE IF EXISTS float_unique_check_pk; +CREATE TABLE float_unique_check_pk +( + float_unique_check_pk float PRIMARY KEY UNIQUE CHECK ( float_unique_check_pk > 0 ) +); + +DROP TABLE IF EXISTS float_unique_check_pk_ref; +CREATE TABLE float_unique_check_pk_ref +( + float_unique_check_pk_ref float PRIMARY KEY UNIQUE CHECK ( float_unique_check_pk_ref > 0) REFERENCES float_ref (float_ref) +); + +DROP TABLE IF EXISTS float_check_pk; +CREATE TABLE float_check_pk +( + float_check_pk float PRIMARY KEY CHECK ( float_check_pk > 0 ) +); + +DROP TABLE IF EXISTS float_def_const_unique_check_pk; +CREATE TABLE float_def_const_unique_check_pk +( + float_def_const_unique_check_pk float PRIMARY KEY UNIQUE CHECK ( float_def_const_unique_check_pk > 0 ) DEFAULT 42 +); + +DROP TABLE IF EXISTS float_def_const_unique_check_pk_ref; +CREATE TABLE float_def_const_unique_check_pk_ref +( + float_def_const_unique_check_pk_ref float PRIMARY KEY UNIQUE CHECK ( float_def_const_unique_check_pk_ref > 0 ) DEFAULT 42 REFERENCES float_ref (float_ref) +); + +DROP TABLE IF EXISTS float_def_func_unique_check_pk; +CREATE TABLE float_def_func_unique_check_pk +( + float_def_func_unique_check_pk float PRIMARY KEY UNIQUE CHECK ( float_def_func_unique_check_pk > 0 ) DEFAULT (pi()) +); + +DROP TABLE IF EXISTS float_def_func_unique_check_pk_ref; +CREATE TABLE float_def_func_unique_check_pk_ref +( + float_def_func_unique_check_pk_ref float PRIMARY KEY UNIQUE CHECK ( float_def_func_unique_check_pk_ref > 0 ) DEFAULT (pi()) REFERENCES float_ref (float_ref) +); diff --git a/internal/integration_tests/mysql8/testdata/int.sql b/internal/integration_tests/mysql8/testdata/int.sql new file mode 100644 index 00000000..bab6f15f --- /dev/null +++ b/internal/integration_tests/mysql8/testdata/int.sql @@ -0,0 +1,124 @@ +DROP TABLE IF EXISTS integer_ref CASCADE; +CREATE TABLE integer_ref +( + integer_ref integer UNIQUE +); + +DROP TABLE IF EXISTS integer_table; +CREATE TABLE integer_table +( + i integer, + integer_nn integer NOT NULL, + integer_nn_unique integer NOT NULL UNIQUE, + integer_nn_check integer NOT NULL CHECK ( integer_nn_check > 0 ), + + integer_unique integer UNIQUE, + integer_unique_check integer UNIQUE CHECK ( integer_unique_check > 0 ), + integer_unique_ref integer UNIQUE REFERENCES integer_ref (integer_ref), + integer_unique_def_const integer UNIQUE DEFAULT 42, + integer_unique_def_func integer UNIQUE DEFAULT (pi()), + + integer_check integer CHECK ( integer_check > 0 ), + integer_check_ref integer CHECK ( integer_check_ref > 0 ) REFERENCES integer_ref (integer_ref), + integer_check_def_const integer CHECK ( integer_check_def_const > 0 ) DEFAULT 42, + integer_check_def_func integer CHECK ( integer_check_def_func > 0 ) DEFAULT (pi()), + + integer_ref integer REFERENCES integer_ref (integer_ref), + integer_ref_unique_check integer UNIQUE CHECK ( integer_ref_unique_check > 0 ) REFERENCES integer_ref (integer_ref), + + integer_def_const integer DEFAULT 42, + integer_def_const_unique_check integer UNIQUE CHECK ( integer_def_const_unique_check > 0 ) DEFAULT 42, + + integer_def_func integer DEFAULT (pi()), + integer_def_func_unique_check integer UNIQUE CHECK ( integer_def_func_unique_check > 0 ) DEFAULT (pi()) +); + +DROP TABLE IF EXISTS integer_pk; +CREATE TABLE integer_pk +( + integer_pk integer PRIMARY KEY +); + +DROP TABLE IF EXISTS integer_pk_ref; +CREATE TABLE integer_pk_ref +( + integer_pk_ref integer PRIMARY KEY REFERENCES integer_ref (integer_ref) +); + +DROP TABLE IF EXISTS integer_pk_def_const; +CREATE TABLE integer_pk_def_const +( + integer_pk_def_const integer PRIMARY KEY DEFAULT 42 +); + +DROP TABLE IF EXISTS integer_pk_def_func; +CREATE TABLE integer_pk_def_func +( + integer_pk_def_func integer PRIMARY KEY DEFAULT (pi()) +); + +DROP TABLE IF EXISTS integer_nn_pk; +CREATE TABLE integer_nn_pk +( + integer_nn_pk integer NOT NULL PRIMARY KEY +); + +DROP TABLE IF EXISTS integer_nn_unique_check_pk; +CREATE TABLE integer_nn_unique_check_pk +( + integer_nn_unique_check_pk integer PRIMARY KEY NOT NULL UNIQUE CHECK ( integer_nn_unique_check_pk > 0) +); + +DROP TABLE IF EXISTS integer_nn_unique_check_pk_ref; +CREATE TABLE integer_nn_unique_check_pk_ref +( + integer_nn_unique_check_pk_ref integer PRIMARY KEY NOT NULL UNIQUE CHECK ( integer_nn_unique_check_pk_ref > 0) REFERENCES integer_ref (integer_ref) +); + +DROP TABLE IF EXISTS integer_unique_pk; +CREATE TABLE integer_unique_pk +( + integer_unique_pk integer PRIMARY KEY UNIQUE +); + +DROP TABLE IF EXISTS integer_unique_check_pk; +CREATE TABLE integer_unique_check_pk +( + integer_unique_check_pk integer PRIMARY KEY UNIQUE CHECK ( integer_unique_check_pk > 0 ) +); + +DROP TABLE IF EXISTS integer_unique_check_pk_ref; +CREATE TABLE integer_unique_check_pk_ref +( + integer_unique_check_pk_ref integer PRIMARY KEY UNIQUE CHECK ( integer_unique_check_pk_ref > 0) REFERENCES integer_ref (integer_ref) +); + +DROP TABLE IF EXISTS integer_check_pk; +CREATE TABLE integer_check_pk +( + integer_check_pk integer PRIMARY KEY CHECK ( integer_check_pk > 0 ) +); + +DROP TABLE IF EXISTS integer_def_const_unique_check_pk; +CREATE TABLE integer_def_const_unique_check_pk +( + integer_def_const_unique_check_pk integer PRIMARY KEY UNIQUE CHECK ( integer_def_const_unique_check_pk > 0 ) DEFAULT 42 +); + +DROP TABLE IF EXISTS integer_def_const_unique_check_pk_ref; +CREATE TABLE integer_def_const_unique_check_pk_ref +( + integer_def_const_unique_check_pk_ref integer PRIMARY KEY UNIQUE CHECK ( integer_def_const_unique_check_pk_ref > 0 ) DEFAULT 42 REFERENCES integer_ref (integer_ref) +); + +DROP TABLE IF EXISTS integer_def_func_unique_check_pk; +CREATE TABLE integer_def_func_unique_check_pk +( + integer_def_func_unique_check_pk integer PRIMARY KEY UNIQUE CHECK ( integer_def_func_unique_check_pk > 0 ) DEFAULT (pi()) +); + +DROP TABLE IF EXISTS integer_def_func_unique_check_pk_ref; +CREATE TABLE integer_def_func_unique_check_pk_ref +( + integer_def_func_unique_check_pk_ref integer PRIMARY KEY UNIQUE CHECK ( integer_def_func_unique_check_pk_ref > 0 ) DEFAULT (pi()) REFERENCES integer_ref (integer_ref) +); diff --git a/internal/integration_tests/mysql8/testdata/longblob.sql b/internal/integration_tests/mysql8/testdata/longblob.sql new file mode 100644 index 00000000..25f35315 --- /dev/null +++ b/internal/integration_tests/mysql8/testdata/longblob.sql @@ -0,0 +1,29 @@ +DROP TABLE IF EXISTS longblob_ref CASCADE; +CREATE TABLE longblob_ref +( + longblob_ref longblob NOT NULL, + KEY longblob_ref_len_key (longblob_ref(10)) +); + +DROP TABLE IF EXISTS longblob_table; +CREATE TABLE longblob_table +( + col longblob, + + longblob_def_const longblob DEFAULT ('42'), + longblob_def_func longblob DEFAULT (pi()), + + longblob_ref longblob REFERENCES longblob_ref (longblob_ref), + + longblob_nn longblob NOT NULL, + longblob_nn_check_cmp longblob NOT NULL CHECK ( longblob_nn_check_cmp = '42' ), + longblob_nn_check_fn longblob NOT NULL CHECK ( length(longblob_nn_check_fn) > 0 ), + longblob_nn_ref longblob NOT NULL REFERENCES longblob_ref (longblob_ref), + longblob_nn_def_const longblob NOT NULL DEFAULT ('42'), + longblob_nn_def_func longblob NOT NULL DEFAULT (pi()), + + longblob_check longblob CHECK ( length(longblob_check) > 0 ), + longblob_check_ref longblob CHECK ( length(longblob_check_ref) > 0 ) REFERENCES longblob_ref (longblob_ref), + longblob_check_def_const longblob CHECK ( length(longblob_check_def_const) > 0 ) DEFAULT ('42'), + longblob_check_def_func longblob CHECK ( length(longblob_check_def_func) > 0 ) DEFAULT (pi()) +); diff --git a/internal/integration_tests/mysql8/testdata/longtext.sql b/internal/integration_tests/mysql8/testdata/longtext.sql new file mode 100644 index 00000000..c92774b7 --- /dev/null +++ b/internal/integration_tests/mysql8/testdata/longtext.sql @@ -0,0 +1,29 @@ +DROP TABLE IF EXISTS longtext_ref CASCADE; +CREATE TABLE longtext_ref +( + longtext_ref longtext NOT NULL, + KEY longtext_ref_len_key (longtext_ref(10)) +); + +DROP TABLE IF EXISTS longtext_table; +CREATE TABLE longtext_table +( + col longtext, + + longtext_def_const longtext DEFAULT ('42'), + longtext_def_func longtext DEFAULT (pi()), + + longtext_ref longtext REFERENCES longtext_ref (longtext_ref), + + longtext_nn longtext NOT NULL, + longtext_nn_check_cmp longtext NOT NULL CHECK ( longtext_nn_check_cmp = '42' ), + longtext_nn_check_fn longtext NOT NULL CHECK ( length(longtext_nn_check_fn) > 0 ), + longtext_nn_ref longtext NOT NULL REFERENCES longtext_ref (longtext_ref), + longtext_nn_def_const longtext NOT NULL DEFAULT ('42'), + longtext_nn_def_func longtext NOT NULL DEFAULT (pi()), + + longtext_check longtext CHECK ( length(longtext_check) > 0 ), + longtext_check_ref longtext CHECK ( length(longtext_check_ref) > 0 ) REFERENCES longtext_ref (longtext_ref), + longtext_check_def_const longtext CHECK ( length(longtext_check_def_const) > 0 ) DEFAULT ('42'), + longtext_check_def_func longtext CHECK ( length(longtext_check_def_func) > 0 ) DEFAULT (pi()) +); diff --git a/internal/integration_tests/mysql8/testdata/mediumblob.sql b/internal/integration_tests/mysql8/testdata/mediumblob.sql new file mode 100644 index 00000000..dd88a795 --- /dev/null +++ b/internal/integration_tests/mysql8/testdata/mediumblob.sql @@ -0,0 +1,29 @@ +DROP TABLE IF EXISTS mediumblob_ref CASCADE; +CREATE TABLE mediumblob_ref +( + mediumblob_ref mediumblob NOT NULL, + KEY mediumblob_ref_len_key (mediumblob_ref(10)) +); + +DROP TABLE IF EXISTS mediumblob_table; +CREATE TABLE mediumblob_table +( + col mediumblob, + + mediumblob_def_const mediumblob DEFAULT ('42'), + mediumblob_def_func mediumblob DEFAULT (pi()), + + mediumblob_ref mediumblob REFERENCES mediumblob_ref (mediumblob_ref), + + mediumblob_nn mediumblob NOT NULL, + mediumblob_nn_check_cmp mediumblob NOT NULL CHECK ( mediumblob_nn_check_cmp = '42' ), + mediumblob_nn_check_fn mediumblob NOT NULL CHECK ( length(mediumblob_nn_check_fn) > 0 ), + mediumblob_nn_ref mediumblob NOT NULL REFERENCES mediumblob_ref (mediumblob_ref), + mediumblob_nn_def_const mediumblob NOT NULL DEFAULT ('42'), + mediumblob_nn_def_func mediumblob NOT NULL DEFAULT (pi()), + + mediumblob_check mediumblob CHECK ( length(mediumblob_check) > 0 ), + mediumblob_check_ref mediumblob CHECK ( length(mediumblob_check_ref) > 0 ) REFERENCES mediumblob_ref (mediumblob_ref), + mediumblob_check_def_const mediumblob CHECK ( length(mediumblob_check_def_const) > 0 ) DEFAULT ('42'), + mediumblob_check_def_func mediumblob CHECK ( length(mediumblob_check_def_func) > 0 ) DEFAULT (pi()) +); diff --git a/internal/integration_tests/mysql8/testdata/mediumint.sql b/internal/integration_tests/mysql8/testdata/mediumint.sql new file mode 100644 index 00000000..413e5f39 --- /dev/null +++ b/internal/integration_tests/mysql8/testdata/mediumint.sql @@ -0,0 +1,124 @@ +DROP TABLE IF EXISTS mediumint_ref CASCADE; +CREATE TABLE mediumint_ref +( + mediumint_ref mediumint UNIQUE +); + +DROP TABLE IF EXISTS mediumint_table; +CREATE TABLE mediumint_table +( + i mediumint, + mediumint_nn mediumint NOT NULL, + mediumint_nn_unique mediumint NOT NULL UNIQUE, + mediumint_nn_check mediumint NOT NULL CHECK ( mediumint_nn_check > 0 ), + + mediumint_unique mediumint UNIQUE, + mediumint_unique_check mediumint UNIQUE CHECK ( mediumint_unique_check > 0 ), + mediumint_unique_ref mediumint UNIQUE REFERENCES mediumint_ref (mediumint_ref), + mediumint_unique_def_const mediumint UNIQUE DEFAULT 42, + mediumint_unique_def_func mediumint UNIQUE DEFAULT (pi()), + + mediumint_check mediumint CHECK ( mediumint_check > 0 ), + mediumint_check_ref mediumint CHECK ( mediumint_check_ref > 0 ) REFERENCES mediumint_ref (mediumint_ref), + mediumint_check_def_const mediumint CHECK ( mediumint_check_def_const > 0 ) DEFAULT 42, + mediumint_check_def_func mediumint CHECK ( mediumint_check_def_func > 0 ) DEFAULT (pi()), + + mediumint_ref mediumint REFERENCES mediumint_ref (mediumint_ref), + mediumint_ref_unique_check mediumint UNIQUE CHECK ( mediumint_ref_unique_check > 0 ) REFERENCES mediumint_ref (mediumint_ref), + + mediumint_def_const mediumint DEFAULT 42, + mediumint_def_const_unique_check mediumint UNIQUE CHECK ( mediumint_def_const_unique_check > 0 ) DEFAULT 42, + + mediumint_def_func mediumint DEFAULT (pi()), + mediumint_def_func_unique_check mediumint UNIQUE CHECK ( mediumint_def_func_unique_check > 0 ) DEFAULT (pi()) +); + +DROP TABLE IF EXISTS mediumint_pk; +CREATE TABLE mediumint_pk +( + mediumint_pk mediumint PRIMARY KEY +); + +DROP TABLE IF EXISTS mediumint_pk_ref; +CREATE TABLE mediumint_pk_ref +( + mediumint_pk_ref mediumint PRIMARY KEY REFERENCES mediumint_ref (mediumint_ref) +); + +DROP TABLE IF EXISTS mediumint_pk_def_const; +CREATE TABLE mediumint_pk_def_const +( + mediumint_pk_def_const mediumint PRIMARY KEY DEFAULT 42 +); + +DROP TABLE IF EXISTS mediumint_pk_def_func; +CREATE TABLE mediumint_pk_def_func +( + mediumint_pk_def_func mediumint PRIMARY KEY DEFAULT (pi()) +); + +DROP TABLE IF EXISTS mediumint_nn_pk; +CREATE TABLE mediumint_nn_pk +( + mediumint_nn_pk mediumint NOT NULL PRIMARY KEY +); + +DROP TABLE IF EXISTS mediumint_nn_unique_check_pk; +CREATE TABLE mediumint_nn_unique_check_pk +( + mediumint_nn_unique_check_pk mediumint PRIMARY KEY NOT NULL UNIQUE CHECK ( mediumint_nn_unique_check_pk > 0) +); + +DROP TABLE IF EXISTS mediumint_nn_unique_check_pk_ref; +CREATE TABLE mediumint_nn_unique_check_pk_ref +( + mediumint_nn_unique_check_pk_ref mediumint PRIMARY KEY NOT NULL UNIQUE CHECK ( mediumint_nn_unique_check_pk_ref > 0) REFERENCES mediumint_ref (mediumint_ref) +); + +DROP TABLE IF EXISTS mediumint_unique_pk; +CREATE TABLE mediumint_unique_pk +( + mediumint_unique_pk mediumint PRIMARY KEY UNIQUE +); + +DROP TABLE IF EXISTS mediumint_unique_check_pk; +CREATE TABLE mediumint_unique_check_pk +( + mediumint_unique_check_pk mediumint PRIMARY KEY UNIQUE CHECK ( mediumint_unique_check_pk > 0 ) +); + +DROP TABLE IF EXISTS mediumint_unique_check_pk_ref; +CREATE TABLE mediumint_unique_check_pk_ref +( + mediumint_unique_check_pk_ref mediumint PRIMARY KEY UNIQUE CHECK ( mediumint_unique_check_pk_ref > 0) REFERENCES mediumint_ref (mediumint_ref) +); + +DROP TABLE IF EXISTS mediumint_check_pk; +CREATE TABLE mediumint_check_pk +( + mediumint_check_pk mediumint PRIMARY KEY CHECK ( mediumint_check_pk > 0 ) +); + +DROP TABLE IF EXISTS mediumint_def_const_unique_check_pk; +CREATE TABLE mediumint_def_const_unique_check_pk +( + mediumint_def_const_unique_check_pk mediumint PRIMARY KEY UNIQUE CHECK ( mediumint_def_const_unique_check_pk > 0 ) DEFAULT 42 +); + +DROP TABLE IF EXISTS mediumint_def_const_unique_check_pk_ref; +CREATE TABLE mediumint_def_const_unique_check_pk_ref +( + mediumint_def_const_unique_check_pk_ref mediumint PRIMARY KEY UNIQUE CHECK ( mediumint_def_const_unique_check_pk_ref > 0 ) DEFAULT 42 REFERENCES mediumint_ref (mediumint_ref) +); + +DROP TABLE IF EXISTS mediumint_def_func_unique_check_pk; +CREATE TABLE mediumint_def_func_unique_check_pk +( + mediumint_def_func_unique_check_pk mediumint PRIMARY KEY UNIQUE CHECK ( mediumint_def_func_unique_check_pk > 0 ) DEFAULT (pi()) +); + +DROP TABLE IF EXISTS mediumint_def_func_unique_check_pk_ref; +CREATE TABLE mediumint_def_func_unique_check_pk_ref +( + mediumint_def_func_unique_check_pk_ref mediumint PRIMARY KEY UNIQUE CHECK ( mediumint_def_func_unique_check_pk_ref > 0 ) DEFAULT (pi()) REFERENCES mediumint_ref (mediumint_ref) +); diff --git a/internal/integration_tests/mysql8/testdata/mediumtext.sql b/internal/integration_tests/mysql8/testdata/mediumtext.sql new file mode 100644 index 00000000..c660a8bf --- /dev/null +++ b/internal/integration_tests/mysql8/testdata/mediumtext.sql @@ -0,0 +1,29 @@ +DROP TABLE IF EXISTS mediumtext_ref CASCADE; +CREATE TABLE mediumtext_ref +( + mediumtext_ref mediumtext NOT NULL, + KEY mediumtext_ref_len_key (mediumtext_ref(10)) +); + +DROP TABLE IF EXISTS mediumtext_table; +CREATE TABLE mediumtext_table +( + col mediumtext, + + mediumtext_def_const mediumtext DEFAULT ('42'), + mediumtext_def_func mediumtext DEFAULT (pi()), + + mediumtext_ref mediumtext REFERENCES mediumtext_ref (mediumtext_ref), + + mediumtext_nn mediumtext NOT NULL, + mediumtext_nn_check_cmp mediumtext NOT NULL CHECK ( mediumtext_nn_check_cmp = '42' ), + mediumtext_nn_check_fn mediumtext NOT NULL CHECK ( length(mediumtext_nn_check_fn) > 0 ), + mediumtext_nn_ref mediumtext NOT NULL REFERENCES mediumtext_ref (mediumtext_ref), + mediumtext_nn_def_const mediumtext NOT NULL DEFAULT ('42'), + mediumtext_nn_def_func mediumtext NOT NULL DEFAULT (pi()), + + mediumtext_check mediumtext CHECK ( length(mediumtext_check) > 0 ), + mediumtext_check_ref mediumtext CHECK ( length(mediumtext_check_ref) > 0 ) REFERENCES mediumtext_ref (mediumtext_ref), + mediumtext_check_def_const mediumtext CHECK ( length(mediumtext_check_def_const) > 0 ) DEFAULT ('42'), + mediumtext_check_def_func mediumtext CHECK ( length(mediumtext_check_def_func) > 0 ) DEFAULT (pi()) +); diff --git a/internal/integration_tests/mysql8/testdata/numeric.sql b/internal/integration_tests/mysql8/testdata/numeric.sql new file mode 100644 index 00000000..9fb04744 --- /dev/null +++ b/internal/integration_tests/mysql8/testdata/numeric.sql @@ -0,0 +1,129 @@ +DROP TABLE IF EXISTS numeric_ref CASCADE; +CREATE TABLE numeric_ref +( + numeric_ref numeric UNIQUE +); + +DROP TABLE IF EXISTS numeric_table; +CREATE TABLE numeric_table +( + col numeric, + + numeric_nn numeric NOT NULL, + numeric_nn_unique numeric NOT NULL UNIQUE, + numeric_nn_check numeric NOT NULL CHECK ( numeric_nn_check > 0 ), + numeric_nn_ref numeric NOT NULL REFERENCES numeric_ref (numeric_ref), + numeric_nn_def_const numeric NOT NULL DEFAULT 42, + numeric_nn_def_func numeric NOT NULL DEFAULT (pi()), + numeric_nn_unique_check numeric NOT NULL UNIQUE CHECK ( numeric_nn_unique_check > 0 ), + + numeric_unique numeric UNIQUE, + numeric_unique_check numeric UNIQUE CHECK ( numeric_unique_check > 0 ), + numeric_unique_ref numeric UNIQUE REFERENCES numeric_ref (numeric_ref), + numeric_unique_def_const numeric UNIQUE DEFAULT 42, + numeric_unique_def_func numeric UNIQUE DEFAULT (pi()), + + numeric_check numeric CHECK ( numeric_check > 0 ), + numeric_check_ref numeric CHECK ( numeric_check_ref > 0 ) REFERENCES numeric_ref (numeric_ref), + numeric_check_def_const numeric CHECK ( numeric_check_def_const > 0 ) DEFAULT 42, + numeric_check_def_func numeric CHECK ( numeric_check_def_func > 0 ) DEFAULT (pi()), + + numeric_ref numeric REFERENCES numeric_ref (numeric_ref), + numeric_ref_unique_check numeric UNIQUE CHECK ( numeric_ref_unique_check > 0 ) REFERENCES numeric_ref (numeric_ref), + + numeric_def_const numeric DEFAULT 42, + numeric_def_const_unique_check numeric UNIQUE CHECK ( numeric_def_const_unique_check > 0 ) DEFAULT 42, + + numeric_def_func numeric DEFAULT (pi()), + numeric_def_func_unique_check numeric UNIQUE CHECK ( numeric_def_func_unique_check > 0 ) DEFAULT (pi()) +); + +DROP TABLE IF EXISTS numeric_pk; +CREATE TABLE numeric_pk +( + numeric_pk numeric PRIMARY KEY +); + +DROP TABLE IF EXISTS numeric_pk_ref; +CREATE TABLE numeric_pk_ref +( + numeric_pk_ref numeric PRIMARY KEY REFERENCES numeric_ref (numeric_ref) +); + +DROP TABLE IF EXISTS numeric_pk_def_const; +CREATE TABLE numeric_pk_def_const +( + numeric_pk_def_const numeric PRIMARY KEY DEFAULT 42 +); + +DROP TABLE IF EXISTS numeric_pk_def_func; +CREATE TABLE numeric_pk_def_func +( + numeric_pk_def_func numeric PRIMARY KEY DEFAULT (pi()) +); + +DROP TABLE IF EXISTS numeric_nn_pk; +CREATE TABLE numeric_nn_pk +( + numeric_nn_pk numeric NOT NULL PRIMARY KEY +); + +DROP TABLE IF EXISTS numeric_nn_unique_check_pk; +CREATE TABLE numeric_nn_unique_check_pk +( + numeric_nn_unique_check_pk numeric PRIMARY KEY NOT NULL UNIQUE CHECK ( numeric_nn_unique_check_pk > 0) +); + +DROP TABLE IF EXISTS numeric_nn_unique_check_pk_ref; +CREATE TABLE numeric_nn_unique_check_pk_ref +( + numeric_nn_unique_check_pk_ref numeric PRIMARY KEY NOT NULL UNIQUE CHECK ( numeric_nn_unique_check_pk_ref > 0) REFERENCES numeric_ref (numeric_ref) +); + +DROP TABLE IF EXISTS numeric_unique_pk; +CREATE TABLE numeric_unique_pk +( + numeric_unique_pk numeric PRIMARY KEY UNIQUE +); + +DROP TABLE IF EXISTS numeric_unique_check_pk; +CREATE TABLE numeric_unique_check_pk +( + numeric_unique_check_pk numeric PRIMARY KEY UNIQUE CHECK ( numeric_unique_check_pk > 0 ) +); + +DROP TABLE IF EXISTS numeric_unique_check_pk_ref; +CREATE TABLE numeric_unique_check_pk_ref +( + numeric_unique_check_pk_ref numeric PRIMARY KEY UNIQUE CHECK ( numeric_unique_check_pk_ref > 0) REFERENCES numeric_ref (numeric_ref) +); + +DROP TABLE IF EXISTS numeric_check_pk; +CREATE TABLE numeric_check_pk +( + numeric_check_pk numeric PRIMARY KEY CHECK ( numeric_check_pk > 0 ) +); + +DROP TABLE IF EXISTS numeric_def_const_unique_check_pk; +CREATE TABLE numeric_def_const_unique_check_pk +( + numeric_def_const_unique_check_pk numeric PRIMARY KEY UNIQUE CHECK ( numeric_def_const_unique_check_pk > 0 ) DEFAULT 42 +); + +DROP TABLE IF EXISTS numeric_def_const_unique_check_pk_ref; +CREATE TABLE numeric_def_const_unique_check_pk_ref +( + numeric_def_const_unique_check_pk_ref numeric PRIMARY KEY UNIQUE CHECK ( numeric_def_const_unique_check_pk_ref > 0 ) DEFAULT 42 REFERENCES numeric_ref (numeric_ref) +); + +DROP TABLE IF EXISTS numeric_def_func_unique_check_pk; +CREATE TABLE numeric_def_func_unique_check_pk +( + numeric_def_func_unique_check_pk numeric PRIMARY KEY UNIQUE CHECK ( numeric_def_func_unique_check_pk > 0 ) DEFAULT (pi()) +); + +DROP TABLE IF EXISTS numeric_def_func_unique_check_pk_ref; +CREATE TABLE numeric_def_func_unique_check_pk_ref +( + numeric_def_func_unique_check_pk_ref numeric PRIMARY KEY UNIQUE CHECK ( numeric_def_func_unique_check_pk_ref > 0 ) DEFAULT (pi()) REFERENCES numeric_ref (numeric_ref) +); diff --git a/internal/integration_tests/mysql8/testdata/real.sql b/internal/integration_tests/mysql8/testdata/real.sql new file mode 100644 index 00000000..693def2f --- /dev/null +++ b/internal/integration_tests/mysql8/testdata/real.sql @@ -0,0 +1,129 @@ +DROP TABLE IF EXISTS real_ref CASCADE; +CREATE TABLE real_ref +( + real_ref real UNIQUE +); + +DROP TABLE IF EXISTS real_table; +CREATE TABLE real_table +( + col real, + + real_nn real NOT NULL, + real_nn_unique real NOT NULL UNIQUE, + real_nn_check real NOT NULL CHECK ( real_nn_check > 0 ), + real_nn_ref real NOT NULL REFERENCES real_ref (real_ref), + real_nn_def_const real NOT NULL DEFAULT 42, + real_nn_def_func real NOT NULL DEFAULT (pi()), + real_nn_unique_check real NOT NULL UNIQUE CHECK ( real_nn_unique_check > 0 ), + + real_unique real UNIQUE, + real_unique_check real UNIQUE CHECK ( real_unique_check > 0 ), + real_unique_ref real UNIQUE REFERENCES real_ref (real_ref), + real_unique_def_const real UNIQUE DEFAULT 42, + real_unique_def_func real UNIQUE DEFAULT (pi()), + + real_check real CHECK ( real_check > 0 ), + real_check_ref real CHECK ( real_check_ref > 0 ) REFERENCES real_ref (real_ref), + real_check_def_const real CHECK ( real_check_def_const > 0 ) DEFAULT 42, + real_check_def_func real CHECK ( real_check_def_func > 0 ) DEFAULT (pi()), + + real_ref real REFERENCES real_ref (real_ref), + real_ref_unique_check real UNIQUE CHECK ( real_ref_unique_check > 0 ) REFERENCES real_ref (real_ref), + + real_def_const real DEFAULT 42, + real_def_const_unique_check real UNIQUE CHECK ( real_def_const_unique_check > 0 ) DEFAULT 42, + + real_def_func real DEFAULT (pi()), + real_def_func_unique_check real UNIQUE CHECK ( real_def_func_unique_check > 0 ) DEFAULT (pi()) +); + +DROP TABLE IF EXISTS real_pk; +CREATE TABLE real_pk +( + real_pk real PRIMARY KEY +); + +DROP TABLE IF EXISTS real_pk_ref; +CREATE TABLE real_pk_ref +( + real_pk_ref real PRIMARY KEY REFERENCES real_ref (real_ref) +); + +DROP TABLE IF EXISTS real_pk_def_const; +CREATE TABLE real_pk_def_const +( + real_pk_def_const real PRIMARY KEY DEFAULT 42 +); + +DROP TABLE IF EXISTS real_pk_def_func; +CREATE TABLE real_pk_def_func +( + real_pk_def_func real PRIMARY KEY DEFAULT (pi()) +); + +DROP TABLE IF EXISTS real_nn_pk; +CREATE TABLE real_nn_pk +( + real_nn_pk real NOT NULL PRIMARY KEY +); + +DROP TABLE IF EXISTS real_nn_unique_check_pk; +CREATE TABLE real_nn_unique_check_pk +( + real_nn_unique_check_pk real PRIMARY KEY NOT NULL UNIQUE CHECK ( real_nn_unique_check_pk > 0) +); + +DROP TABLE IF EXISTS real_nn_unique_check_pk_ref; +CREATE TABLE real_nn_unique_check_pk_ref +( + real_nn_unique_check_pk_ref real PRIMARY KEY NOT NULL UNIQUE CHECK ( real_nn_unique_check_pk_ref > 0) REFERENCES real_ref (real_ref) +); + +DROP TABLE IF EXISTS real_unique_pk; +CREATE TABLE real_unique_pk +( + real_unique_pk real PRIMARY KEY UNIQUE +); + +DROP TABLE IF EXISTS real_unique_check_pk; +CREATE TABLE real_unique_check_pk +( + real_unique_check_pk real PRIMARY KEY UNIQUE CHECK ( real_unique_check_pk > 0 ) +); + +DROP TABLE IF EXISTS real_unique_check_pk_ref; +CREATE TABLE real_unique_check_pk_ref +( + real_unique_check_pk_ref real PRIMARY KEY UNIQUE CHECK ( real_unique_check_pk_ref > 0) REFERENCES real_ref (real_ref) +); + +DROP TABLE IF EXISTS real_check_pk; +CREATE TABLE real_check_pk +( + real_check_pk real PRIMARY KEY CHECK ( real_check_pk > 0 ) +); + +DROP TABLE IF EXISTS real_def_const_unique_check_pk; +CREATE TABLE real_def_const_unique_check_pk +( + real_def_const_unique_check_pk real PRIMARY KEY UNIQUE CHECK ( real_def_const_unique_check_pk > 0 ) DEFAULT 42 +); + +DROP TABLE IF EXISTS real_def_const_unique_check_pk_ref; +CREATE TABLE real_def_const_unique_check_pk_ref +( + real_def_const_unique_check_pk_ref real PRIMARY KEY UNIQUE CHECK ( real_def_const_unique_check_pk_ref > 0 ) DEFAULT 42 REFERENCES real_ref (real_ref) +); + +DROP TABLE IF EXISTS real_def_func_unique_check_pk; +CREATE TABLE real_def_func_unique_check_pk +( + real_def_func_unique_check_pk real PRIMARY KEY UNIQUE CHECK ( real_def_func_unique_check_pk > 0 ) DEFAULT (pi()) +); + +DROP TABLE IF EXISTS real_def_func_unique_check_pk_ref; +CREATE TABLE real_def_func_unique_check_pk_ref +( + real_def_func_unique_check_pk_ref real PRIMARY KEY UNIQUE CHECK ( real_def_func_unique_check_pk_ref > 0 ) DEFAULT (pi()) REFERENCES real_ref (real_ref) +); diff --git a/internal/integration_tests/mysql8/testdata/smallint.sql b/internal/integration_tests/mysql8/testdata/smallint.sql new file mode 100644 index 00000000..a1345239 --- /dev/null +++ b/internal/integration_tests/mysql8/testdata/smallint.sql @@ -0,0 +1,124 @@ +DROP TABLE IF EXISTS smallint_ref CASCADE; +CREATE TABLE smallint_ref +( + smallint_ref smallint UNIQUE +); + +DROP TABLE IF EXISTS smallint_table; +CREATE TABLE smallint_table +( + i smallint, + smallint_nn smallint NOT NULL, + smallint_nn_unique smallint NOT NULL UNIQUE, + smallint_nn_check smallint NOT NULL CHECK ( smallint_nn_check > 0 ), + + smallint_unique smallint UNIQUE, + smallint_unique_check smallint UNIQUE CHECK ( smallint_unique_check > 0 ), + smallint_unique_ref smallint UNIQUE REFERENCES smallint_ref (smallint_ref), + smallint_unique_def_const smallint UNIQUE DEFAULT 42, + smallint_unique_def_func smallint UNIQUE DEFAULT (pi()), + + smallint_check smallint CHECK ( smallint_check > 0 ), + smallint_check_ref smallint CHECK ( smallint_check_ref > 0 ) REFERENCES smallint_ref (smallint_ref), + smallint_check_def_const smallint CHECK ( smallint_check_def_const > 0 ) DEFAULT 42, + smallint_check_def_func smallint CHECK ( smallint_check_def_func > 0 ) DEFAULT (pi()), + + smallint_ref smallint REFERENCES smallint_ref (smallint_ref), + smallint_ref_unique_check smallint UNIQUE CHECK ( smallint_ref_unique_check > 0 ) REFERENCES smallint_ref (smallint_ref), + + smallint_def_const smallint DEFAULT 42, + smallint_def_const_unique_check smallint UNIQUE CHECK ( smallint_def_const_unique_check > 0 ) DEFAULT 42, + + smallint_def_func smallint DEFAULT (pi()), + smallint_def_func_unique_check smallint UNIQUE CHECK ( smallint_def_func_unique_check > 0 ) DEFAULT (pi()) +); + +DROP TABLE IF EXISTS smallint_pk; +CREATE TABLE smallint_pk +( + smallint_pk smallint PRIMARY KEY +); + +DROP TABLE IF EXISTS smallint_pk_ref; +CREATE TABLE smallint_pk_ref +( + smallint_pk_ref smallint PRIMARY KEY REFERENCES smallint_ref (smallint_ref) +); + +DROP TABLE IF EXISTS smallint_pk_def_const; +CREATE TABLE smallint_pk_def_const +( + smallint_pk_def_const smallint PRIMARY KEY DEFAULT 42 +); + +DROP TABLE IF EXISTS smallint_pk_def_func; +CREATE TABLE smallint_pk_def_func +( + smallint_pk_def_func smallint PRIMARY KEY DEFAULT (pi()) +); + +DROP TABLE IF EXISTS smallint_nn_pk; +CREATE TABLE smallint_nn_pk +( + smallint_nn_pk smallint NOT NULL PRIMARY KEY +); + +DROP TABLE IF EXISTS smallint_nn_unique_check_pk; +CREATE TABLE smallint_nn_unique_check_pk +( + smallint_nn_unique_check_pk smallint PRIMARY KEY NOT NULL UNIQUE CHECK ( smallint_nn_unique_check_pk > 0) +); + +DROP TABLE IF EXISTS smallint_nn_unique_check_pk_ref; +CREATE TABLE smallint_nn_unique_check_pk_ref +( + smallint_nn_unique_check_pk_ref smallint PRIMARY KEY NOT NULL UNIQUE CHECK ( smallint_nn_unique_check_pk_ref > 0) REFERENCES smallint_ref (smallint_ref) +); + +DROP TABLE IF EXISTS smallint_unique_pk; +CREATE TABLE smallint_unique_pk +( + smallint_unique_pk smallint PRIMARY KEY UNIQUE +); + +DROP TABLE IF EXISTS smallint_unique_check_pk; +CREATE TABLE smallint_unique_check_pk +( + smallint_unique_check_pk smallint PRIMARY KEY UNIQUE CHECK ( smallint_unique_check_pk > 0 ) +); + +DROP TABLE IF EXISTS smallint_unique_check_pk_ref; +CREATE TABLE smallint_unique_check_pk_ref +( + smallint_unique_check_pk_ref smallint PRIMARY KEY UNIQUE CHECK ( smallint_unique_check_pk_ref > 0) REFERENCES smallint_ref (smallint_ref) +); + +DROP TABLE IF EXISTS smallint_check_pk; +CREATE TABLE smallint_check_pk +( + smallint_check_pk smallint PRIMARY KEY CHECK ( smallint_check_pk > 0 ) +); + +DROP TABLE IF EXISTS smallint_def_const_unique_check_pk; +CREATE TABLE smallint_def_const_unique_check_pk +( + smallint_def_const_unique_check_pk smallint PRIMARY KEY UNIQUE CHECK ( smallint_def_const_unique_check_pk > 0 ) DEFAULT 42 +); + +DROP TABLE IF EXISTS smallint_def_const_unique_check_pk_ref; +CREATE TABLE smallint_def_const_unique_check_pk_ref +( + smallint_def_const_unique_check_pk_ref smallint PRIMARY KEY UNIQUE CHECK ( smallint_def_const_unique_check_pk_ref > 0 ) DEFAULT 42 REFERENCES smallint_ref (smallint_ref) +); + +DROP TABLE IF EXISTS smallint_def_func_unique_check_pk; +CREATE TABLE smallint_def_func_unique_check_pk +( + smallint_def_func_unique_check_pk smallint PRIMARY KEY UNIQUE CHECK ( smallint_def_func_unique_check_pk > 0 ) DEFAULT (pi()) +); + +DROP TABLE IF EXISTS smallint_def_func_unique_check_pk_ref; +CREATE TABLE smallint_def_func_unique_check_pk_ref +( + smallint_def_func_unique_check_pk_ref smallint PRIMARY KEY UNIQUE CHECK ( smallint_def_func_unique_check_pk_ref > 0 ) DEFAULT (pi()) REFERENCES smallint_ref (smallint_ref) +); diff --git a/internal/integration_tests/mysql8/testdata/text.sql b/internal/integration_tests/mysql8/testdata/text.sql new file mode 100644 index 00000000..5ddbd61a --- /dev/null +++ b/internal/integration_tests/mysql8/testdata/text.sql @@ -0,0 +1,29 @@ +DROP TABLE IF EXISTS text_ref CASCADE; +CREATE TABLE text_ref +( + text_ref text NOT NULL, + KEY text_ref_len_key (text_ref(10)) +); + +DROP TABLE IF EXISTS text_table; +CREATE TABLE text_table +( + col text, + + text_def_const text DEFAULT ('42'), + text_def_func text DEFAULT (pi()), + + text_ref text REFERENCES text_ref (text_ref), + + text_nn text NOT NULL, + text_nn_check_cmp text NOT NULL CHECK ( text_nn_check_cmp = '42' ), + text_nn_check_fn text NOT NULL CHECK ( length(text_nn_check_fn) > 0 ), + text_nn_ref text NOT NULL REFERENCES text_ref (text_ref), + text_nn_def_const text NOT NULL DEFAULT ('42'), + text_nn_def_func text NOT NULL DEFAULT (pi()), + + text_check text CHECK ( length(text_check) > 0 ), + text_check_ref text CHECK ( length(text_check_ref) > 0 ) REFERENCES text_ref (text_ref), + text_check_def_const text CHECK ( length(text_check_def_const) > 0 ) DEFAULT ('42'), + text_check_def_func text CHECK ( length(text_check_def_func) > 0 ) DEFAULT (pi()) +); diff --git a/internal/integration_tests/mysql8/testdata/time.sql b/internal/integration_tests/mysql8/testdata/time.sql new file mode 100644 index 00000000..2261f737 --- /dev/null +++ b/internal/integration_tests/mysql8/testdata/time.sql @@ -0,0 +1,128 @@ +DROP TABLE IF EXISTS time_ref CASCADE; +CREATE TABLE time_ref +( + time_ref time UNIQUE +); + +DROP TABLE IF EXISTS time_table; +CREATE TABLE time_table +( + time time, + time_nn time NOT NULL, + time_nn_unique time NOT NULL UNIQUE, + time_nn_check time NOT NULL CHECK ( time_nn_check > '12:34:56' ), + time_nn_ref time NOT NULL REFERENCES time_ref (time_ref), + time_nn_def_const time NOT NULL DEFAULT ('12:34:56'), + time_nn_def_func time NOT NULL DEFAULT (now()), + time_nn_unique_check time NOT NULL UNIQUE CHECK ( time_nn_unique_check > '12:34:56' ), + + time_unique time UNIQUE, + time_unique_check time UNIQUE CHECK ( time_unique_check > '12:34:56' ), + time_unique_ref time UNIQUE REFERENCES time_ref (time_ref), + time_unique_def_const time UNIQUE DEFAULT ('12:34:56'), + time_unique_def_func time UNIQUE DEFAULT (now()), + + time_check time CHECK ( time_check > '12:34:56' ), + time_check_ref time CHECK ( time_check_ref > '12:34:56' ) REFERENCES time_ref (time_ref), + time_check_def_const time CHECK ( time_check_def_const > '12:34:56' ) DEFAULT ('12:34:56'), + time_check_def_func time CHECK ( time_check_def_func > '12:34:56' ) DEFAULT (now()), + + time_ref time REFERENCES time_ref (time_ref), + time_ref_unique_check time UNIQUE CHECK ( time_ref_unique_check > '12:34:56' ) REFERENCES time_ref (time_ref), + + time_def_const time DEFAULT ('12:34:56'), + time_def_const_unique_check time UNIQUE CHECK ( time_def_const_unique_check > '12:34:56' ) DEFAULT ('12:34:56'), + + time_def_func time DEFAULT (now()), + time_def_func_unique_check time UNIQUE CHECK ( time_def_func_unique_check > '12:34:56' ) DEFAULT (now()) +); + +DROP TABLE IF EXISTS time_pk; +CREATE TABLE time_pk +( + time_pk time PRIMARY KEY +); + +DROP TABLE IF EXISTS time_pk_ref; +CREATE TABLE time_pk_ref +( + time_pk_ref time PRIMARY KEY REFERENCES time_ref (time_ref) +); + +DROP TABLE IF EXISTS time_pk_def_const; +CREATE TABLE time_pk_def_const +( + time_pk_def_const time PRIMARY KEY DEFAULT ('12:34:56') +); + +DROP TABLE IF EXISTS time_pk_def_func; +CREATE TABLE time_pk_def_func +( + time_pk_def_func time PRIMARY KEY DEFAULT (now()) +); + +DROP TABLE IF EXISTS time_nn_pk; +CREATE TABLE time_nn_pk +( + time_nn_pk time NOT NULL PRIMARY KEY +); + +DROP TABLE IF EXISTS time_nn_unique_check_pk; +CREATE TABLE time_nn_unique_check_pk +( + time_nn_unique_check_pk time PRIMARY KEY NOT NULL UNIQUE CHECK ( time_nn_unique_check_pk > '12:34:56' ) +); + +DROP TABLE IF EXISTS time_nn_unique_check_pk_ref; +CREATE TABLE time_nn_unique_check_pk_ref +( + time_nn_unique_check_pk_ref time PRIMARY KEY NOT NULL UNIQUE CHECK ( time_nn_unique_check_pk_ref > '12:34:56' ) REFERENCES time_ref (time_ref) +); + +DROP TABLE IF EXISTS time_unique_pk; +CREATE TABLE time_unique_pk +( + time_unique_pk time PRIMARY KEY UNIQUE +); + +DROP TABLE IF EXISTS time_unique_check_pk; +CREATE TABLE time_unique_check_pk +( + time_unique_check_pk time PRIMARY KEY UNIQUE CHECK ( time_unique_check_pk > '12:34:56' ) +); + +DROP TABLE IF EXISTS time_unique_check_pk_ref; +CREATE TABLE time_unique_check_pk_ref +( + time_unique_check_pk_ref time PRIMARY KEY UNIQUE CHECK ( time_unique_check_pk_ref > '12:34:56' ) REFERENCES time_ref (time_ref) +); + +DROP TABLE IF EXISTS time_check_pk; +CREATE TABLE time_check_pk +( + time_check_pk time PRIMARY KEY CHECK ( time_check_pk > '12:34:56' ) +); + +DROP TABLE IF EXISTS time_def_const_unique_check_pk; +CREATE TABLE time_def_const_unique_check_pk +( + time_def_const_unique_check_pk time PRIMARY KEY UNIQUE CHECK ( time_def_const_unique_check_pk > '12:34:56' ) DEFAULT ('12:34:56') +); + +DROP TABLE IF EXISTS time_def_const_unique_check_pk_ref; +CREATE TABLE time_def_const_unique_check_pk_ref +( + time_def_const_unique_check_pk_ref time PRIMARY KEY UNIQUE CHECK ( time_def_const_unique_check_pk_ref > '12:34:56' ) DEFAULT ('12:34:56') REFERENCES time_ref (time_ref) +); + +DROP TABLE IF EXISTS time_def_func_unique_check_pk; +CREATE TABLE time_def_func_unique_check_pk +( + time_def_func_unique_check_pk time PRIMARY KEY UNIQUE CHECK ( time_def_func_unique_check_pk > '12:34:56' ) DEFAULT (now()) +); + +DROP TABLE IF EXISTS time_def_func_unique_check_pk_ref; +CREATE TABLE time_def_func_unique_check_pk_ref +( + time_def_func_unique_check_pk_ref time PRIMARY KEY UNIQUE CHECK ( time_def_func_unique_check_pk_ref > '12:34:56' ) DEFAULT (now()) REFERENCES time_ref (time_ref) +); diff --git a/internal/integration_tests/mysql8/testdata/timestamp.sql b/internal/integration_tests/mysql8/testdata/timestamp.sql new file mode 100644 index 00000000..648c3a7d --- /dev/null +++ b/internal/integration_tests/mysql8/testdata/timestamp.sql @@ -0,0 +1,128 @@ +DROP TABLE IF EXISTS timestamp_ref CASCADE; +CREATE TABLE timestamp_ref +( + timestamp_ref timestamp UNIQUE +); + +DROP TABLE IF EXISTS timestamp_table; +CREATE TABLE timestamp_table +( + timestamp timestamp, + timestamp_nn timestamp NOT NULL, + timestamp_nn_unique timestamp NOT NULL UNIQUE, + timestamp_nn_check timestamp NOT NULL CHECK ( timestamp_nn_check > '2020-03-01 12:34:56' ), + timestamp_nn_ref timestamp NOT NULL REFERENCES timestamp_ref (timestamp_ref), + timestamp_nn_def_const timestamp NOT NULL DEFAULT ('2020-03-01 12:34:56'), + timestamp_nn_def_func timestamp NOT NULL DEFAULT (now()), + timestamp_nn_unique_check timestamp NOT NULL UNIQUE CHECK ( timestamp_nn_unique_check > '2020-03-01 12:34:56' ), + + timestamp_unique timestamp UNIQUE, + timestamp_unique_check timestamp UNIQUE CHECK ( timestamp_unique_check > '2020-03-01 12:34:56' ), + timestamp_unique_ref timestamp UNIQUE REFERENCES timestamp_ref (timestamp_ref), + timestamp_unique_def_const timestamp UNIQUE DEFAULT ('2020-03-01 12:34:56'), + timestamp_unique_def_func timestamp UNIQUE DEFAULT (now()), + + timestamp_check timestamp CHECK ( timestamp_check > '2020-03-01 12:34:56' ), + timestamp_check_ref timestamp CHECK ( timestamp_check_ref > '2020-03-01 12:34:56' ) REFERENCES timestamp_ref (timestamp_ref), + timestamp_check_def_const timestamp CHECK ( timestamp_check_def_const > '2020-03-01 12:34:56' ) DEFAULT ('2020-03-01 12:34:56'), + timestamp_check_def_func timestamp CHECK ( timestamp_check_def_func > '2020-03-01 12:34:56' ) DEFAULT (now()), + + timestamp_ref timestamp REFERENCES timestamp_ref (timestamp_ref), + timestamp_ref_unique_check timestamp UNIQUE CHECK ( timestamp_ref_unique_check > '2020-03-01 12:34:56' ) REFERENCES timestamp_ref (timestamp_ref), + + timestamp_def_const timestamp DEFAULT ('2020-03-01 12:34:56'), + timestamp_def_const_unique_check timestamp UNIQUE CHECK ( timestamp_def_const_unique_check > '2020-03-01 12:34:56' ) DEFAULT ('2020-03-01 12:34:56'), + + timestamp_def_func timestamp DEFAULT (now()), + timestamp_def_func_unique_check timestamp UNIQUE CHECK ( timestamp_def_func_unique_check > '2020-03-01 12:34:56' ) DEFAULT (now()) +); + +DROP TABLE IF EXISTS timestamp_pk; +CREATE TABLE timestamp_pk +( + timestamp_pk timestamp PRIMARY KEY +); + +DROP TABLE IF EXISTS timestamp_pk_ref; +CREATE TABLE timestamp_pk_ref +( + timestamp_pk_ref timestamp PRIMARY KEY REFERENCES timestamp_ref (timestamp_ref) +); + +DROP TABLE IF EXISTS timestamp_pk_def_const; +CREATE TABLE timestamp_pk_def_const +( + timestamp_pk_def_const timestamp PRIMARY KEY DEFAULT ('2020-03-01 12:34:56') +); + +DROP TABLE IF EXISTS timestamp_pk_def_func; +CREATE TABLE timestamp_pk_def_func +( + timestamp_pk_def_func timestamp PRIMARY KEY DEFAULT (now()) +); + +DROP TABLE IF EXISTS timestamp_nn_pk; +CREATE TABLE timestamp_nn_pk +( + timestamp_nn_pk timestamp NOT NULL PRIMARY KEY +); + +DROP TABLE IF EXISTS timestamp_nn_unique_check_pk; +CREATE TABLE timestamp_nn_unique_check_pk +( + timestamp_nn_unique_check_pk timestamp PRIMARY KEY NOT NULL UNIQUE CHECK ( timestamp_nn_unique_check_pk > '2020-03-01 12:34:56' ) +); + +DROP TABLE IF EXISTS timestamp_nn_unique_check_pk_ref; +CREATE TABLE timestamp_nn_unique_check_pk_ref +( + timestamp_nn_unique_check_pk_ref timestamp PRIMARY KEY NOT NULL UNIQUE CHECK ( timestamp_nn_unique_check_pk_ref > '2020-03-01 12:34:56' ) REFERENCES timestamp_ref (timestamp_ref) +); + +DROP TABLE IF EXISTS timestamp_unique_pk; +CREATE TABLE timestamp_unique_pk +( + timestamp_unique_pk timestamp PRIMARY KEY UNIQUE +); + +DROP TABLE IF EXISTS timestamp_unique_check_pk; +CREATE TABLE timestamp_unique_check_pk +( + timestamp_unique_check_pk timestamp PRIMARY KEY UNIQUE CHECK ( timestamp_unique_check_pk > '2020-03-01 12:34:56' ) +); + +DROP TABLE IF EXISTS timestamp_unique_check_pk_ref; +CREATE TABLE timestamp_unique_check_pk_ref +( + timestamp_unique_check_pk_ref timestamp PRIMARY KEY UNIQUE CHECK ( timestamp_unique_check_pk_ref > '2020-03-01 12:34:56' ) REFERENCES timestamp_ref (timestamp_ref) +); + +DROP TABLE IF EXISTS timestamp_check_pk; +CREATE TABLE timestamp_check_pk +( + timestamp_check_pk timestamp PRIMARY KEY CHECK ( timestamp_check_pk > '2020-03-01 12:34:56' ) +); + +DROP TABLE IF EXISTS timestamp_def_const_unique_check_pk; +CREATE TABLE timestamp_def_const_unique_check_pk +( + timestamp_def_const_unique_check_pk timestamp PRIMARY KEY UNIQUE CHECK ( timestamp_def_const_unique_check_pk > '2020-03-01 12:34:56' ) DEFAULT ('2020-03-01 12:34:56') +); + +DROP TABLE IF EXISTS timestamp_def_const_unique_check_pk_ref; +CREATE TABLE timestamp_def_const_unique_check_pk_ref +( + timestamp_def_const_unique_check_pk_ref timestamp PRIMARY KEY UNIQUE CHECK ( timestamp_def_const_unique_check_pk_ref > '2020-03-01 12:34:56' ) DEFAULT ('2020-03-01 12:34:56') REFERENCES timestamp_ref (timestamp_ref) +); + +DROP TABLE IF EXISTS timestamp_def_func_unique_check_pk; +CREATE TABLE timestamp_def_func_unique_check_pk +( + timestamp_def_func_unique_check_pk timestamp PRIMARY KEY UNIQUE CHECK ( timestamp_def_func_unique_check_pk > '2020-03-01 12:34:56' ) DEFAULT (now()) +); + +DROP TABLE IF EXISTS timestamp_def_func_unique_check_pk_ref; +CREATE TABLE timestamp_def_func_unique_check_pk_ref +( + timestamp_def_func_unique_check_pk_ref timestamp PRIMARY KEY UNIQUE CHECK ( timestamp_def_func_unique_check_pk_ref > '2020-03-01 12:34:56' ) DEFAULT (now()) REFERENCES timestamp_ref (timestamp_ref) +); diff --git a/internal/integration_tests/mysql8/testdata/tinyblob.sql b/internal/integration_tests/mysql8/testdata/tinyblob.sql new file mode 100644 index 00000000..96e4f7ba --- /dev/null +++ b/internal/integration_tests/mysql8/testdata/tinyblob.sql @@ -0,0 +1,29 @@ +DROP TABLE IF EXISTS tinyblob_ref CASCADE; +CREATE TABLE tinyblob_ref +( + tinyblob_ref tinyblob NOT NULL, + KEY tinyblob_ref_len_key (tinyblob_ref(10)) +); + +DROP TABLE IF EXISTS tinyblob_table; +CREATE TABLE tinyblob_table +( + col tinyblob, + + tinyblob_def_const tinyblob DEFAULT ('42'), + tinyblob_def_func tinyblob DEFAULT (pi()), + + tinyblob_ref tinyblob REFERENCES tinyblob_ref (tinyblob_ref), + + tinyblob_nn tinyblob NOT NULL, + tinyblob_nn_check_cmp tinyblob NOT NULL CHECK ( tinyblob_nn_check_cmp = '42' ), + tinyblob_nn_check_fn tinyblob NOT NULL CHECK ( length(tinyblob_nn_check_fn) > 0 ), + tinyblob_nn_ref tinyblob NOT NULL REFERENCES tinyblob_ref (tinyblob_ref), + tinyblob_nn_def_const tinyblob NOT NULL DEFAULT ('42'), + tinyblob_nn_def_func tinyblob NOT NULL DEFAULT (pi()), + + tinyblob_check tinyblob CHECK ( length(tinyblob_check) > 0 ), + tinyblob_check_ref tinyblob CHECK ( length(tinyblob_check_ref) > 0 ) REFERENCES tinyblob_ref (tinyblob_ref), + tinyblob_check_def_const tinyblob CHECK ( length(tinyblob_check_def_const) > 0 ) DEFAULT ('42'), + tinyblob_check_def_func tinyblob CHECK ( length(tinyblob_check_def_func) > 0 ) DEFAULT (pi()) +); diff --git a/internal/integration_tests/mysql8/testdata/tinyint.sql b/internal/integration_tests/mysql8/testdata/tinyint.sql new file mode 100644 index 00000000..40c19f74 --- /dev/null +++ b/internal/integration_tests/mysql8/testdata/tinyint.sql @@ -0,0 +1,124 @@ +DROP TABLE IF EXISTS tinyint_ref CASCADE; +CREATE TABLE tinyint_ref +( + tinyint_ref tinyint UNIQUE +); + +DROP TABLE IF EXISTS tinyint_table; +CREATE TABLE tinyint_table +( + i tinyint, + tinyint_nn tinyint NOT NULL, + tinyint_nn_unique tinyint NOT NULL UNIQUE, + tinyint_nn_check tinyint NOT NULL CHECK ( tinyint_nn_check > 0 ), + + tinyint_unique tinyint UNIQUE, + tinyint_unique_check tinyint UNIQUE CHECK ( tinyint_unique_check > 0 ), + tinyint_unique_ref tinyint UNIQUE REFERENCES tinyint_ref (tinyint_ref), + tinyint_unique_def_const tinyint UNIQUE DEFAULT 42, + tinyint_unique_def_func tinyint UNIQUE DEFAULT (pi()), + + tinyint_check tinyint CHECK ( tinyint_check > 0 ), + tinyint_check_ref tinyint CHECK ( tinyint_check_ref > 0 ) REFERENCES tinyint_ref (tinyint_ref), + tinyint_check_def_const tinyint CHECK ( tinyint_check_def_const > 0 ) DEFAULT 42, + tinyint_check_def_func tinyint CHECK ( tinyint_check_def_func > 0 ) DEFAULT (pi()), + + tinyint_ref tinyint REFERENCES tinyint_ref (tinyint_ref), + tinyint_ref_unique_check tinyint UNIQUE CHECK ( tinyint_ref_unique_check > 0 ) REFERENCES tinyint_ref (tinyint_ref), + + tinyint_def_const tinyint DEFAULT 42, + tinyint_def_const_unique_check tinyint UNIQUE CHECK ( tinyint_def_const_unique_check > 0 ) DEFAULT 42, + + tinyint_def_func tinyint DEFAULT (pi()), + tinyint_def_func_unique_check tinyint UNIQUE CHECK ( tinyint_def_func_unique_check > 0 ) DEFAULT (pi()) +); + +DROP TABLE IF EXISTS tinyint_pk; +CREATE TABLE tinyint_pk +( + tinyint_pk tinyint PRIMARY KEY +); + +DROP TABLE IF EXISTS tinyint_pk_ref; +CREATE TABLE tinyint_pk_ref +( + tinyint_pk_ref tinyint PRIMARY KEY REFERENCES tinyint_ref (tinyint_ref) +); + +DROP TABLE IF EXISTS tinyint_pk_def_const; +CREATE TABLE tinyint_pk_def_const +( + tinyint_pk_def_const tinyint PRIMARY KEY DEFAULT 42 +); + +DROP TABLE IF EXISTS tinyint_pk_def_func; +CREATE TABLE tinyint_pk_def_func +( + tinyint_pk_def_func tinyint PRIMARY KEY DEFAULT (pi()) +); + +DROP TABLE IF EXISTS tinyint_nn_pk; +CREATE TABLE tinyint_nn_pk +( + tinyint_nn_pk tinyint NOT NULL PRIMARY KEY +); + +DROP TABLE IF EXISTS tinyint_nn_unique_check_pk; +CREATE TABLE tinyint_nn_unique_check_pk +( + tinyint_nn_unique_check_pk tinyint PRIMARY KEY NOT NULL UNIQUE CHECK ( tinyint_nn_unique_check_pk > 0) +); + +DROP TABLE IF EXISTS tinyint_nn_unique_check_pk_ref; +CREATE TABLE tinyint_nn_unique_check_pk_ref +( + tinyint_nn_unique_check_pk_ref tinyint PRIMARY KEY NOT NULL UNIQUE CHECK ( tinyint_nn_unique_check_pk_ref > 0) REFERENCES tinyint_ref (tinyint_ref) +); + +DROP TABLE IF EXISTS tinyint_unique_pk; +CREATE TABLE tinyint_unique_pk +( + tinyint_unique_pk tinyint PRIMARY KEY UNIQUE +); + +DROP TABLE IF EXISTS tinyint_unique_check_pk; +CREATE TABLE tinyint_unique_check_pk +( + tinyint_unique_check_pk tinyint PRIMARY KEY UNIQUE CHECK ( tinyint_unique_check_pk > 0 ) +); + +DROP TABLE IF EXISTS tinyint_unique_check_pk_ref; +CREATE TABLE tinyint_unique_check_pk_ref +( + tinyint_unique_check_pk_ref tinyint PRIMARY KEY UNIQUE CHECK ( tinyint_unique_check_pk_ref > 0) REFERENCES tinyint_ref (tinyint_ref) +); + +DROP TABLE IF EXISTS tinyint_check_pk; +CREATE TABLE tinyint_check_pk +( + tinyint_check_pk tinyint PRIMARY KEY CHECK ( tinyint_check_pk > 0 ) +); + +DROP TABLE IF EXISTS tinyint_def_const_unique_check_pk; +CREATE TABLE tinyint_def_const_unique_check_pk +( + tinyint_def_const_unique_check_pk tinyint PRIMARY KEY UNIQUE CHECK ( tinyint_def_const_unique_check_pk > 0 ) DEFAULT 42 +); + +DROP TABLE IF EXISTS tinyint_def_const_unique_check_pk_ref; +CREATE TABLE tinyint_def_const_unique_check_pk_ref +( + tinyint_def_const_unique_check_pk_ref tinyint PRIMARY KEY UNIQUE CHECK ( tinyint_def_const_unique_check_pk_ref > 0 ) DEFAULT 42 REFERENCES tinyint_ref (tinyint_ref) +); + +DROP TABLE IF EXISTS tinyint_def_func_unique_check_pk; +CREATE TABLE tinyint_def_func_unique_check_pk +( + tinyint_def_func_unique_check_pk tinyint PRIMARY KEY UNIQUE CHECK ( tinyint_def_func_unique_check_pk > 0 ) DEFAULT (pi()) +); + +DROP TABLE IF EXISTS tinyint_def_func_unique_check_pk_ref; +CREATE TABLE tinyint_def_func_unique_check_pk_ref +( + tinyint_def_func_unique_check_pk_ref tinyint PRIMARY KEY UNIQUE CHECK ( tinyint_def_func_unique_check_pk_ref > 0 ) DEFAULT (pi()) REFERENCES tinyint_ref (tinyint_ref) +); diff --git a/internal/integration_tests/mysql8/testdata/tinytext.sql b/internal/integration_tests/mysql8/testdata/tinytext.sql new file mode 100644 index 00000000..22e83593 --- /dev/null +++ b/internal/integration_tests/mysql8/testdata/tinytext.sql @@ -0,0 +1,29 @@ +DROP TABLE IF EXISTS tinytext_ref CASCADE; +CREATE TABLE tinytext_ref +( + tinytext_ref tinytext NOT NULL, + KEY tinytext_ref_len_key (tinytext_ref(10)) +); + +DROP TABLE IF EXISTS tinytext_table; +CREATE TABLE tinytext_table +( + col tinytext, + + tinytext_def_const tinytext DEFAULT ('42'), + tinytext_def_func tinytext DEFAULT (pi()), + + tinytext_ref tinytext REFERENCES tinytext_ref (tinytext_ref), + + tinytext_nn tinytext NOT NULL, + tinytext_nn_check_cmp tinytext NOT NULL CHECK ( tinytext_nn_check_cmp = '42' ), + tinytext_nn_check_fn tinytext NOT NULL CHECK ( length(tinytext_nn_check_fn) > 0 ), + tinytext_nn_ref tinytext NOT NULL REFERENCES tinytext_ref (tinytext_ref), + tinytext_nn_def_const tinytext NOT NULL DEFAULT ('42'), + tinytext_nn_def_func tinytext NOT NULL DEFAULT (pi()), + + tinytext_check tinytext CHECK ( length(tinytext_check) > 0 ), + tinytext_check_ref tinytext CHECK ( length(tinytext_check_ref) > 0 ) REFERENCES tinytext_ref (tinytext_ref), + tinytext_check_def_const tinytext CHECK ( length(tinytext_check_def_const) > 0 ) DEFAULT ('42'), + tinytext_check_def_func tinytext CHECK ( length(tinytext_check_def_func) > 0 ) DEFAULT (pi()) +); diff --git a/internal/integration_tests/mysql8/testdata/user.sql b/internal/integration_tests/mysql8/testdata/user.sql new file mode 100644 index 00000000..a8927fa6 --- /dev/null +++ b/internal/integration_tests/mysql8/testdata/user.sql @@ -0,0 +1,10 @@ +DROP TABLE IF EXISTS `user` CASCADE; +CREATE TABLE `user` +( + id INT UNSIGNED NOT NULL AUTO_INCREMENT, + user_id INT UNSIGNED NOT NULL, + + website_url VARCHAR(300), + + PRIMARY KEY (id) +); \ No newline at end of file diff --git a/internal/integration_tests/mysql8/testdata/varbinary.sql b/internal/integration_tests/mysql8/testdata/varbinary.sql new file mode 100644 index 00000000..83658247 --- /dev/null +++ b/internal/integration_tests/mysql8/testdata/varbinary.sql @@ -0,0 +1,131 @@ +DROP TABLE IF EXISTS varbinary_ref CASCADE; +CREATE TABLE varbinary_ref +( + varbinary_ref varbinary(10) UNIQUE +); + +DROP TABLE IF EXISTS varbinary_table; +CREATE TABLE varbinary_table +( + col varbinary(10), + + varbinary_cap varbinary(10), + varbinary_nn varbinary(10) NOT NULL, + varbinary_nn_unique varbinary(10) NOT NULL UNIQUE, + varbinary_nn_check_cmp varbinary(10) NOT NULL CHECK ( varbinary_nn_check_cmp = '42' ), + varbinary_nn_check_fn varbinary(10) NOT NULL CHECK ( length(varbinary_nn_check_fn) > 0 ), + varbinary_nn_ref varbinary(10) NOT NULL REFERENCES varbinary_ref(varbinary_ref), + varbinary_nn_def_const varbinary(10) NOT NULL DEFAULT ('42'), + varbinary_nn_def_func varbinary(10) NOT NULL DEFAULT (pi()), + varbinary_nn_unique_check varbinary(10) NOT NULL UNIQUE CHECK ( length(varbinary_nn_unique_check) > 0 ), + + varbinary_unique varbinary(10) UNIQUE, + varbinary_unique_check varbinary(10) UNIQUE CHECK ( length(varbinary_unique_check) > 0 ), + varbinary_unique_ref varbinary(10) UNIQUE REFERENCES varbinary_ref(varbinary_ref), + varbinary_unique_def_const varbinary(10) UNIQUE DEFAULT ('42'), + varbinary_unique_def_func varbinary(10) UNIQUE DEFAULT (pi()), + + varbinary_check varbinary(10) CHECK ( length(varbinary_check) > 0 ), + varbinary_check_ref varbinary(10) CHECK ( length(varbinary_check_ref) > 0 ) REFERENCES varbinary_ref(varbinary_ref), + varbinary_check_def_const varbinary(10) CHECK ( length(varbinary_check_def_const) > 0 ) DEFAULT ('42'), + varbinary_check_def_func varbinary(10) CHECK ( length(varbinary_check_def_func) > 0 ) DEFAULT (pi()), + + varbinary_ref varbinary(10) REFERENCES varbinary_ref(varbinary_ref), + varbinary_ref_unique_check varbinary(10) UNIQUE CHECK ( length(varbinary_ref_unique_check) > 0 ) REFERENCES varbinary_ref(varbinary_ref), + + varbinary_def_const varbinary(10) DEFAULT ('42'), + varbinary_def_const_unique_check varbinary(10) UNIQUE CHECK ( length(varbinary_def_const_unique_check) > 0 ) DEFAULT ('42'), + + varbinary_def_func varbinary(10) DEFAULT (pi()), + varbinary_def_func_unique_check varbinary(10) UNIQUE CHECK ( length(varbinary_def_func_unique_check) > 0 ) DEFAULT (pi()) +); + +DROP TABLE IF EXISTS varbinary_pk; +CREATE TABLE varbinary_pk +( + varbinary_pk varbinary(10) PRIMARY KEY +); + +DROP TABLE IF EXISTS varbinary_pk_ref; +CREATE TABLE varbinary_pk_ref +( + varbinary_pk_ref varbinary(10) PRIMARY KEY REFERENCES varbinary_ref(varbinary_ref) +); + +DROP TABLE IF EXISTS varbinary_pk_def_const; +CREATE TABLE varbinary_pk_def_const +( + varbinary_pk_def_const varbinary(10) PRIMARY KEY DEFAULT ('42') +); + +DROP TABLE IF EXISTS varbinary_pk_def_func; +CREATE TABLE varbinary_pk_def_func +( + varbinary_pk_def_func varbinary(10) PRIMARY KEY DEFAULT (pi()) +); + +DROP TABLE IF EXISTS varbinary_nn_pk; +CREATE TABLE varbinary_nn_pk +( + varbinary_nn_pk varbinary(10) NOT NULL PRIMARY KEY +); + +DROP TABLE IF EXISTS varbinary_nn_unique_check_pk; +CREATE TABLE varbinary_nn_unique_check_pk +( + varbinary_nn_unique_check_pk varbinary(10) PRIMARY KEY NOT NULL UNIQUE CHECK ( length(varbinary_nn_unique_check_pk) > 0) +); + +DROP TABLE IF EXISTS varbinary_nn_unique_check_pk_ref; +CREATE TABLE varbinary_nn_unique_check_pk_ref +( + varbinary_nn_unique_check_pk_ref varbinary(10) PRIMARY KEY NOT NULL UNIQUE CHECK ( length(varbinary_nn_unique_check_pk_ref) > 0) REFERENCES varbinary_ref(varbinary_ref) +); + +DROP TABLE IF EXISTS varbinary_unique_pk; +CREATE TABLE varbinary_unique_pk +( + varbinary_unique_pk varbinary(10) PRIMARY KEY UNIQUE +); + +DROP TABLE IF EXISTS varbinary_unique_check_pk; +CREATE TABLE varbinary_unique_check_pk +( + varbinary_unique_check_pk varbinary(10) PRIMARY KEY UNIQUE CHECK ( length(varbinary_unique_check_pk) > 0 ) +); + +DROP TABLE IF EXISTS varbinary_unique_check_pk_ref; +CREATE TABLE varbinary_unique_check_pk_ref +( + varbinary_unique_check_pk_ref varbinary(10) PRIMARY KEY UNIQUE CHECK ( length(varbinary_unique_check_pk_ref) > 0) REFERENCES varbinary_ref(varbinary_ref) +); + +DROP TABLE IF EXISTS varbinary_check_pk; +CREATE TABLE varbinary_check_pk +( + varbinary_check_pk varbinary(10) PRIMARY KEY CHECK ( length(varbinary_check_pk) > 0 ) +); + +DROP TABLE IF EXISTS varbinary_def_const_unique_check_pk; +CREATE TABLE varbinary_def_const_unique_check_pk +( + varbinary_def_const_unique_check_pk varbinary(10) PRIMARY KEY UNIQUE CHECK ( length(varbinary_def_const_unique_check_pk) > 0 ) DEFAULT ('42') +); + +DROP TABLE IF EXISTS varbinary_def_const_unique_check_pk_ref; +CREATE TABLE varbinary_def_const_unique_check_pk_ref +( + varbinary_def_const_unique_check_pk_ref varbinary(10) PRIMARY KEY UNIQUE CHECK ( length(varbinary_def_const_unique_check_pk_ref) > 0 ) DEFAULT ('42') REFERENCES varbinary_ref(varbinary_ref) +); + +DROP TABLE IF EXISTS varbinary_def_func_unique_check_pk; +CREATE TABLE varbinary_def_func_unique_check_pk +( + varbinary_def_func_unique_check_pk varbinary(10) PRIMARY KEY UNIQUE CHECK ( length(varbinary_def_func_unique_check_pk) > 0 ) DEFAULT (pi()) +); + +DROP TABLE IF EXISTS varbinary_def_func_unique_check_pk_ref; +CREATE TABLE varbinary_def_func_unique_check_pk_ref +( + varbinary_def_func_unique_check_pk_ref varbinary(10) PRIMARY KEY UNIQUE CHECK ( length(varbinary_def_func_unique_check_pk_ref) > 0 ) DEFAULT (pi()) REFERENCES varbinary_ref(varbinary_ref) +); diff --git a/internal/integration_tests/mysql8/testdata/varchar.sql b/internal/integration_tests/mysql8/testdata/varchar.sql new file mode 100644 index 00000000..abd21053 --- /dev/null +++ b/internal/integration_tests/mysql8/testdata/varchar.sql @@ -0,0 +1,131 @@ +DROP TABLE IF EXISTS varchar_ref CASCADE; +CREATE TABLE varchar_ref +( + varchar_ref varchar(10) UNIQUE +); + +DROP TABLE IF EXISTS varchar_table; +CREATE TABLE varchar_table +( + col varchar(10), + + varchar_cap varchar(10), + varchar_nn varchar(10) NOT NULL, + varchar_nn_unique varchar(10) NOT NULL UNIQUE, + varchar_nn_check_cmp varchar(10) NOT NULL CHECK ( varchar_nn_check_cmp = '42' ), + varchar_nn_check_fn varchar(10) NOT NULL CHECK ( length(varchar_nn_check_fn) > 0 ), + varchar_nn_ref varchar(10) NOT NULL REFERENCES varchar_ref (varchar_ref), + varchar_nn_def_const varchar(10) NOT NULL DEFAULT ('42'), + varchar_nn_def_func varchar(10) NOT NULL DEFAULT (pi()), + varchar_nn_unique_check varchar(10) NOT NULL UNIQUE CHECK ( length(varchar_nn_unique_check) > 0 ), + + varchar_unique varchar(10) UNIQUE, + varchar_unique_check varchar(10) UNIQUE CHECK ( length(varchar_unique_check) > 0 ), + varchar_unique_ref varchar(10) UNIQUE REFERENCES varchar_ref (varchar_ref), + varchar_unique_def_const varchar(10) UNIQUE DEFAULT ('42'), + varchar_unique_def_func varchar(10) UNIQUE DEFAULT (pi()), + + varchar_check varchar(10) CHECK ( length(varchar_check) > 0 ), + varchar_check_ref varchar(10) CHECK ( length(varchar_check_ref) > 0 ) REFERENCES varchar_ref (varchar_ref), + varchar_check_def_const varchar(10) CHECK ( length(varchar_check_def_const) > 0 ) DEFAULT ('42'), + varchar_check_def_func varchar(10) CHECK ( length(varchar_check_def_func) > 0 ) DEFAULT (pi()), + + varchar_ref varchar(10) REFERENCES varchar_ref (varchar_ref), + varchar_ref_unique_check varchar(10) UNIQUE CHECK ( length(varchar_ref_unique_check) > 0 ) REFERENCES varchar_ref (varchar_ref), + + varchar_def_const varchar(10) DEFAULT ('42'), + varchar_def_const_unique_check varchar(10) UNIQUE CHECK ( length(varchar_def_const_unique_check) > 0 ) DEFAULT ('42'), + + varchar_def_func varchar(10) DEFAULT (pi()), + varchar_def_func_unique_check varchar(10) UNIQUE CHECK ( length(varchar_def_func_unique_check) > 0 ) DEFAULT (pi()) +); + +DROP TABLE IF EXISTS varchar_pk; +CREATE TABLE varchar_pk +( + varchar_pk varchar(10) PRIMARY KEY +); + +DROP TABLE IF EXISTS varchar_pk_ref; +CREATE TABLE varchar_pk_ref +( + varchar_pk_ref varchar(10) PRIMARY KEY REFERENCES varchar_ref (varchar_ref) +); + +DROP TABLE IF EXISTS varchar_pk_def_const; +CREATE TABLE varchar_pk_def_const +( + varchar_pk_def_const varchar(10) PRIMARY KEY DEFAULT ('42') +); + +DROP TABLE IF EXISTS varchar_pk_def_func; +CREATE TABLE varchar_pk_def_func +( + varchar_pk_def_func varchar(10) PRIMARY KEY DEFAULT (pi()) +); + +DROP TABLE IF EXISTS varchar_nn_pk; +CREATE TABLE varchar_nn_pk +( + varchar_nn_pk varchar(10) NOT NULL PRIMARY KEY +); + +DROP TABLE IF EXISTS varchar_nn_unique_check_pk; +CREATE TABLE varchar_nn_unique_check_pk +( + varchar_nn_unique_check_pk varchar(10) PRIMARY KEY NOT NULL UNIQUE CHECK ( length(varchar_nn_unique_check_pk) > 0) +); + +DROP TABLE IF EXISTS varchar_nn_unique_check_pk_ref; +CREATE TABLE varchar_nn_unique_check_pk_ref +( + varchar_nn_unique_check_pk_ref varchar(10) PRIMARY KEY NOT NULL UNIQUE CHECK ( length(varchar_nn_unique_check_pk_ref) > 0) REFERENCES varchar_ref (varchar_ref) +); + +DROP TABLE IF EXISTS varchar_unique_pk; +CREATE TABLE varchar_unique_pk +( + varchar_unique_pk varchar(10) PRIMARY KEY UNIQUE +); + +DROP TABLE IF EXISTS varchar_unique_check_pk; +CREATE TABLE varchar_unique_check_pk +( + varchar_unique_check_pk varchar(10) PRIMARY KEY UNIQUE CHECK ( length(varchar_unique_check_pk) > 0 ) +); + +DROP TABLE IF EXISTS varchar_unique_check_pk_ref; +CREATE TABLE varchar_unique_check_pk_ref +( + varchar_unique_check_pk_ref varchar(10) PRIMARY KEY UNIQUE CHECK ( length(varchar_unique_check_pk_ref) > 0) REFERENCES varchar_ref (varchar_ref) +); + +DROP TABLE IF EXISTS varchar_check_pk; +CREATE TABLE varchar_check_pk +( + varchar_check_pk varchar(10) PRIMARY KEY CHECK ( length(varchar_check_pk) > 0 ) +); + +DROP TABLE IF EXISTS varchar_def_const_unique_check_pk; +CREATE TABLE varchar_def_const_unique_check_pk +( + varchar_def_const_unique_check_pk varchar(10) PRIMARY KEY UNIQUE CHECK ( length(varchar_def_const_unique_check_pk) > 0 ) DEFAULT ('42') +); + +DROP TABLE IF EXISTS varchar_def_const_unique_check_pk_ref; +CREATE TABLE varchar_def_const_unique_check_pk_ref +( + varchar_def_const_unique_check_pk_ref varchar(10) PRIMARY KEY UNIQUE CHECK ( length(varchar_def_const_unique_check_pk_ref) > 0 ) DEFAULT ('42') REFERENCES varchar_ref (varchar_ref) +); + +DROP TABLE IF EXISTS varchar_def_func_unique_check_pk; +CREATE TABLE varchar_def_func_unique_check_pk +( + varchar_def_func_unique_check_pk varchar(10) PRIMARY KEY UNIQUE CHECK ( length(varchar_def_func_unique_check_pk) > 0 ) DEFAULT (pi()) +); + +DROP TABLE IF EXISTS varchar_def_func_unique_check_pk_ref; +CREATE TABLE varchar_def_func_unique_check_pk_ref +( + varchar_def_func_unique_check_pk_ref varchar(10) PRIMARY KEY UNIQUE CHECK ( length(varchar_def_func_unique_check_pk_ref) > 0 ) DEFAULT (pi()) REFERENCES varchar_ref (varchar_ref) +); diff --git a/internal/integration_tests/mysql8/testdata/year.sql b/internal/integration_tests/mysql8/testdata/year.sql new file mode 100644 index 00000000..441da58f --- /dev/null +++ b/internal/integration_tests/mysql8/testdata/year.sql @@ -0,0 +1,128 @@ +DROP TABLE IF EXISTS year_ref CASCADE; +CREATE TABLE year_ref +( + year_ref year UNIQUE +); + +DROP TABLE IF EXISTS year_table; +CREATE TABLE year_table +( + year year, + year_nn year NOT NULL, + year_nn_unique year NOT NULL UNIQUE, + year_nn_check year NOT NULL CHECK ( year_nn_check > '2020' ), + year_nn_ref year NOT NULL REFERENCES year_ref(year_ref), + year_nn_def_const year NOT NULL DEFAULT ('2020'), + year_nn_def_func year NOT NULL DEFAULT (now()), + year_nn_unique_check year NOT NULL UNIQUE CHECK ( year_nn_unique_check > '2020' ), + + year_unique year UNIQUE, + year_unique_check year UNIQUE CHECK ( year_unique_check > '2020' ), + year_unique_ref year UNIQUE REFERENCES year_ref(year_ref), + year_unique_def_const year UNIQUE DEFAULT ('2020'), + year_unique_def_func year UNIQUE DEFAULT (now()), + + year_check year CHECK ( year_check > '2020' ), + year_check_ref year CHECK ( year_check_ref > '2020' ) REFERENCES year_ref(year_ref), + year_check_def_const year CHECK ( year_check_def_const > '2020' ) DEFAULT ('2020'), + year_check_def_func year CHECK ( year_check_def_func > '2020' ) DEFAULT (now()), + + year_ref year REFERENCES year_ref(year_ref), + year_ref_unique_check year UNIQUE CHECK ( year_ref_unique_check > '2020' ) REFERENCES year_ref(year_ref), + + year_def_const year DEFAULT ('2020'), + year_def_const_unique_check year UNIQUE CHECK ( year_def_const_unique_check > '2020' ) DEFAULT ('2020'), + + year_def_func year DEFAULT (now()), + year_def_func_unique_check year UNIQUE CHECK ( year_def_func_unique_check > '2020' ) DEFAULT (now()) +); + +DROP TABLE IF EXISTS year_pk; +CREATE TABLE year_pk +( + year_pk year PRIMARY KEY +); + +DROP TABLE IF EXISTS year_pk_ref; +CREATE TABLE year_pk_ref +( + year_pk_ref year PRIMARY KEY REFERENCES year_ref(year_ref) +); + +DROP TABLE IF EXISTS year_pk_def_const; +CREATE TABLE year_pk_def_const +( + year_pk_def_const year PRIMARY KEY DEFAULT ('2020') +); + +DROP TABLE IF EXISTS year_pk_def_func; +CREATE TABLE year_pk_def_func +( + year_pk_def_func year PRIMARY KEY DEFAULT (now()) +); + +DROP TABLE IF EXISTS year_nn_pk; +CREATE TABLE year_nn_pk +( + year_nn_pk year NOT NULL PRIMARY KEY +); + +DROP TABLE IF EXISTS year_nn_unique_check_pk; +CREATE TABLE year_nn_unique_check_pk +( + year_nn_unique_check_pk year PRIMARY KEY NOT NULL UNIQUE CHECK ( year_nn_unique_check_pk > '2020' ) +); + +DROP TABLE IF EXISTS year_nn_unique_check_pk_ref; +CREATE TABLE year_nn_unique_check_pk_ref +( + year_nn_unique_check_pk_ref year PRIMARY KEY NOT NULL UNIQUE CHECK ( year_nn_unique_check_pk_ref > '2020' ) REFERENCES year_ref(year_ref) +); + +DROP TABLE IF EXISTS year_unique_pk; +CREATE TABLE year_unique_pk +( + year_unique_pk year PRIMARY KEY UNIQUE +); + +DROP TABLE IF EXISTS year_unique_check_pk; +CREATE TABLE year_unique_check_pk +( + year_unique_check_pk year PRIMARY KEY UNIQUE CHECK ( year_unique_check_pk > '2020' ) +); + +DROP TABLE IF EXISTS year_unique_check_pk_ref; +CREATE TABLE year_unique_check_pk_ref +( + year_unique_check_pk_ref year PRIMARY KEY UNIQUE CHECK ( year_unique_check_pk_ref > '2020' ) REFERENCES year_ref(year_ref) +); + +DROP TABLE IF EXISTS year_check_pk; +CREATE TABLE year_check_pk +( + year_check_pk year PRIMARY KEY CHECK ( year_check_pk > '2020' ) +); + +DROP TABLE IF EXISTS year_def_const_unique_check_pk; +CREATE TABLE year_def_const_unique_check_pk +( + year_def_const_unique_check_pk year PRIMARY KEY UNIQUE CHECK ( year_def_const_unique_check_pk > '2020' ) DEFAULT ('2020') +); + +DROP TABLE IF EXISTS year_def_const_unique_check_pk_ref; +CREATE TABLE year_def_const_unique_check_pk_ref +( + year_def_const_unique_check_pk_ref year PRIMARY KEY UNIQUE CHECK ( year_def_const_unique_check_pk_ref > '2020' ) DEFAULT ('2020') REFERENCES year_ref(year_ref) +); + +DROP TABLE IF EXISTS year_def_func_unique_check_pk; +CREATE TABLE year_def_func_unique_check_pk +( + year_def_func_unique_check_pk year PRIMARY KEY UNIQUE CHECK ( year_def_func_unique_check_pk > '2020' ) DEFAULT (now()) +); + +DROP TABLE IF EXISTS year_def_func_unique_check_pk_ref; +CREATE TABLE year_def_func_unique_check_pk_ref +( + year_def_func_unique_check_pk_ref year PRIMARY KEY UNIQUE CHECK ( year_def_func_unique_check_pk_ref > '2020' ) DEFAULT (now()) REFERENCES year_ref(year_ref) +); diff --git a/internal/integration_tests/postgres/defaultsettings/Bigint.go b/internal/integration_tests/postgres/defaultsettings/Bigint.go new file mode 100644 index 00000000..c3901f50 --- /dev/null +++ b/internal/integration_tests/postgres/defaultsettings/Bigint.go @@ -0,0 +1,33 @@ +package dto + +import ( + "database/sql" +) + +type Bigint struct { + Bigint sql.NullInt64 `db:"bigint"` + BigintNn int `db:"bigint_nn"` + BigintNnUnique int `db:"bigint_nn_unique"` + BigintNnCheck int `db:"bigint_nn_check"` + BigintNnRef int `db:"bigint_nn_ref"` + BigintNnDefConst int `db:"bigint_nn_def_const"` + BigintNnDefFunc int `db:"bigint_nn_def_func"` + BigintNnUniqueCheck int `db:"bigint_nn_unique_check"` + BigintUnique sql.NullInt64 `db:"bigint_unique"` + BigintUniqueCheck sql.NullInt64 `db:"bigint_unique_check"` + BigintUniqueRef sql.NullInt64 `db:"bigint_unique_ref"` + BigintUniqueDefConst sql.NullInt64 `db:"bigint_unique_def_const"` + BigintUniqueDefFunc sql.NullInt64 `db:"bigint_unique_def_func"` + BigintCheck sql.NullInt64 `db:"bigint_check"` + BigintCheckRef sql.NullInt64 `db:"bigint_check_ref"` + BigintCheckDefConst sql.NullInt64 `db:"bigint_check_def_const"` + BigintCheckDefFunc sql.NullInt64 `db:"bigint_check_def_func"` + BigintRef sql.NullInt64 `db:"bigint_ref"` + BigintRefDefConst sql.NullInt64 `db:"bigint_ref_def_const"` + BigintRefDefFunc sql.NullInt64 `db:"bigint_ref_def_func"` + BigintRefUniqueCheck sql.NullInt64 `db:"bigint_ref_unique_check"` + BigintDefConst sql.NullInt64 `db:"bigint_def_const"` + BigintDefConstUniqueCheck sql.NullInt64 `db:"bigint_def_const_unique_check"` + BigintDefFunc sql.NullInt64 `db:"bigint_def_func"` + BigintDefFuncUniqueCheck sql.NullInt64 `db:"bigint_def_func_unique_check"` +} diff --git a/internal/integration_tests/postgres/defaultsettings/BigintCheckPk.go b/internal/integration_tests/postgres/defaultsettings/BigintCheckPk.go new file mode 100644 index 00000000..2474c3d5 --- /dev/null +++ b/internal/integration_tests/postgres/defaultsettings/BigintCheckPk.go @@ -0,0 +1,5 @@ +package dto + +type BigintCheckPk struct { + BigintCheckPk int `db:"bigint_check_pk"` +} diff --git a/internal/integration_tests/postgres/defaultsettings/BigintDefConstUniqueCheckPk.go b/internal/integration_tests/postgres/defaultsettings/BigintDefConstUniqueCheckPk.go new file mode 100644 index 00000000..808e31f2 --- /dev/null +++ b/internal/integration_tests/postgres/defaultsettings/BigintDefConstUniqueCheckPk.go @@ -0,0 +1,5 @@ +package dto + +type BigintDefConstUniqueCheckPk struct { + BigintDefConstUniqueCheckPk int `db:"bigint_def_const_unique_check_pk"` +} diff --git a/internal/integration_tests/postgres/defaultsettings/BigintDefConstUniqueCheckPkRef.go b/internal/integration_tests/postgres/defaultsettings/BigintDefConstUniqueCheckPkRef.go new file mode 100644 index 00000000..64fcb8c8 --- /dev/null +++ b/internal/integration_tests/postgres/defaultsettings/BigintDefConstUniqueCheckPkRef.go @@ -0,0 +1,5 @@ +package dto + +type BigintDefConstUniqueCheckPkRef struct { + BigintDefConstUniqueCheckPkRef int `db:"bigint_def_const_unique_check_pk_ref"` +} diff --git a/internal/integration_tests/postgres/defaultsettings/BigintDefFuncUniqueCheckPk.go b/internal/integration_tests/postgres/defaultsettings/BigintDefFuncUniqueCheckPk.go new file mode 100644 index 00000000..68117369 --- /dev/null +++ b/internal/integration_tests/postgres/defaultsettings/BigintDefFuncUniqueCheckPk.go @@ -0,0 +1,5 @@ +package dto + +type BigintDefFuncUniqueCheckPk struct { + BigintDefFuncUniqueCheckPk int `db:"bigint_def_func_unique_check_pk"` +} diff --git a/internal/integration_tests/postgres/defaultsettings/BigintDefFuncUniqueCheckPkRef.go b/internal/integration_tests/postgres/defaultsettings/BigintDefFuncUniqueCheckPkRef.go new file mode 100644 index 00000000..dbd5da9d --- /dev/null +++ b/internal/integration_tests/postgres/defaultsettings/BigintDefFuncUniqueCheckPkRef.go @@ -0,0 +1,5 @@ +package dto + +type BigintDefFuncUniqueCheckPkRef struct { + BigintDefFuncUniqueCheckPkRef int `db:"bigint_def_func_unique_check_pk_ref"` +} diff --git a/internal/integration_tests/postgres/defaultsettings/BigintNnPk.go b/internal/integration_tests/postgres/defaultsettings/BigintNnPk.go new file mode 100644 index 00000000..f4ddc4aa --- /dev/null +++ b/internal/integration_tests/postgres/defaultsettings/BigintNnPk.go @@ -0,0 +1,5 @@ +package dto + +type BigintNnPk struct { + BigintNnPk int `db:"bigint_nn_pk"` +} diff --git a/internal/integration_tests/postgres/defaultsettings/BigintNnUniqueCheckPk.go b/internal/integration_tests/postgres/defaultsettings/BigintNnUniqueCheckPk.go new file mode 100644 index 00000000..ce5d15c5 --- /dev/null +++ b/internal/integration_tests/postgres/defaultsettings/BigintNnUniqueCheckPk.go @@ -0,0 +1,5 @@ +package dto + +type BigintNnUniqueCheckPk struct { + BigintNnUniqueCheckPk int `db:"bigint_nn_unique_check_pk"` +} diff --git a/internal/integration_tests/postgres/defaultsettings/BigintNnUniqueCheckPkRef.go b/internal/integration_tests/postgres/defaultsettings/BigintNnUniqueCheckPkRef.go new file mode 100644 index 00000000..4c065777 --- /dev/null +++ b/internal/integration_tests/postgres/defaultsettings/BigintNnUniqueCheckPkRef.go @@ -0,0 +1,5 @@ +package dto + +type BigintNnUniqueCheckPkRef struct { + BigintNnUniqueCheckPkRef int `db:"bigint_nn_unique_check_pk_ref"` +} diff --git a/internal/integration_tests/postgres/defaultsettings/BigintPk.go b/internal/integration_tests/postgres/defaultsettings/BigintPk.go new file mode 100644 index 00000000..0b34e55b --- /dev/null +++ b/internal/integration_tests/postgres/defaultsettings/BigintPk.go @@ -0,0 +1,5 @@ +package dto + +type BigintPk struct { + BigintPk int `db:"bigint_pk"` +} diff --git a/internal/integration_tests/postgres/defaultsettings/BigintPkDefConst.go b/internal/integration_tests/postgres/defaultsettings/BigintPkDefConst.go new file mode 100644 index 00000000..08c26cbd --- /dev/null +++ b/internal/integration_tests/postgres/defaultsettings/BigintPkDefConst.go @@ -0,0 +1,5 @@ +package dto + +type BigintPkDefConst struct { + BigintPkDefConst int `db:"bigint_pk_def_const"` +} diff --git a/internal/integration_tests/postgres/defaultsettings/BigintPkDefFunc.go b/internal/integration_tests/postgres/defaultsettings/BigintPkDefFunc.go new file mode 100644 index 00000000..656fadc9 --- /dev/null +++ b/internal/integration_tests/postgres/defaultsettings/BigintPkDefFunc.go @@ -0,0 +1,5 @@ +package dto + +type BigintPkDefFunc struct { + BigintPkDefFunc int `db:"bigint_pk_def_func"` +} diff --git a/internal/integration_tests/postgres/defaultsettings/BigintPkRef.go b/internal/integration_tests/postgres/defaultsettings/BigintPkRef.go new file mode 100644 index 00000000..21608d8c --- /dev/null +++ b/internal/integration_tests/postgres/defaultsettings/BigintPkRef.go @@ -0,0 +1,5 @@ +package dto + +type BigintPkRef struct { + BigintPkRef int `db:"bigint_pk_ref"` +} diff --git a/internal/integration_tests/postgres/defaultsettings/BigintRef.go b/internal/integration_tests/postgres/defaultsettings/BigintRef.go new file mode 100644 index 00000000..348ad421 --- /dev/null +++ b/internal/integration_tests/postgres/defaultsettings/BigintRef.go @@ -0,0 +1,9 @@ +package dto + +import ( + "database/sql" +) + +type BigintRef struct { + BigintRef sql.NullInt64 `db:"bigint_ref"` +} diff --git a/internal/integration_tests/postgres/defaultsettings/BigintUniqueCheckPk.go b/internal/integration_tests/postgres/defaultsettings/BigintUniqueCheckPk.go new file mode 100644 index 00000000..d2cd0c7e --- /dev/null +++ b/internal/integration_tests/postgres/defaultsettings/BigintUniqueCheckPk.go @@ -0,0 +1,5 @@ +package dto + +type BigintUniqueCheckPk struct { + BigintUniqueCheckPk int `db:"bigint_unique_check_pk"` +} diff --git a/internal/integration_tests/postgres/defaultsettings/BigintUniqueCheckPkRef.go b/internal/integration_tests/postgres/defaultsettings/BigintUniqueCheckPkRef.go new file mode 100644 index 00000000..f41b59bf --- /dev/null +++ b/internal/integration_tests/postgres/defaultsettings/BigintUniqueCheckPkRef.go @@ -0,0 +1,5 @@ +package dto + +type BigintUniqueCheckPkRef struct { + BigintUniqueCheckPkRef int `db:"bigint_unique_check_pk_ref"` +} diff --git a/internal/integration_tests/postgres/defaultsettings/BigintUniquePk.go b/internal/integration_tests/postgres/defaultsettings/BigintUniquePk.go new file mode 100644 index 00000000..06e50c8e --- /dev/null +++ b/internal/integration_tests/postgres/defaultsettings/BigintUniquePk.go @@ -0,0 +1,5 @@ +package dto + +type BigintUniquePk struct { + BigintUniquePk int `db:"bigint_unique_pk"` +} diff --git a/internal/integration_tests/postgres/defaultsettings/Bigserial.go b/internal/integration_tests/postgres/defaultsettings/Bigserial.go new file mode 100644 index 00000000..b7ac1840 --- /dev/null +++ b/internal/integration_tests/postgres/defaultsettings/Bigserial.go @@ -0,0 +1,5 @@ +package dto + +type Bigserial struct { + Bigserial int `db:"bigserial"` +} diff --git a/internal/integration_tests/postgres/defaultsettings/BigserialCheck.go b/internal/integration_tests/postgres/defaultsettings/BigserialCheck.go new file mode 100644 index 00000000..770c067b --- /dev/null +++ b/internal/integration_tests/postgres/defaultsettings/BigserialCheck.go @@ -0,0 +1,5 @@ +package dto + +type BigserialCheck struct { + Bigserial int `db:"bigserial"` +} diff --git a/internal/integration_tests/postgres/defaultsettings/BigserialNotnull.go b/internal/integration_tests/postgres/defaultsettings/BigserialNotnull.go new file mode 100644 index 00000000..defb7802 --- /dev/null +++ b/internal/integration_tests/postgres/defaultsettings/BigserialNotnull.go @@ -0,0 +1,5 @@ +package dto + +type BigserialNotnull struct { + Bigserial int `db:"bigserial"` +} diff --git a/internal/integration_tests/postgres/defaultsettings/BigserialPk.go b/internal/integration_tests/postgres/defaultsettings/BigserialPk.go new file mode 100644 index 00000000..d494fe60 --- /dev/null +++ b/internal/integration_tests/postgres/defaultsettings/BigserialPk.go @@ -0,0 +1,5 @@ +package dto + +type BigserialPk struct { + Bigserial int `db:"bigserial"` +} diff --git a/internal/integration_tests/postgres/defaultsettings/BigserialRef.go b/internal/integration_tests/postgres/defaultsettings/BigserialRef.go new file mode 100644 index 00000000..0cb6df8c --- /dev/null +++ b/internal/integration_tests/postgres/defaultsettings/BigserialRef.go @@ -0,0 +1,5 @@ +package dto + +type BigserialRef struct { + BigserialRef int `db:"bigserial_ref"` +} diff --git a/internal/integration_tests/postgres/defaultsettings/BigserialReferences.go b/internal/integration_tests/postgres/defaultsettings/BigserialReferences.go new file mode 100644 index 00000000..5a8b5d51 --- /dev/null +++ b/internal/integration_tests/postgres/defaultsettings/BigserialReferences.go @@ -0,0 +1,5 @@ +package dto + +type BigserialReferences struct { + Bigserial int `db:"bigserial"` +} diff --git a/internal/integration_tests/postgres/defaultsettings/BigserialUnique.go b/internal/integration_tests/postgres/defaultsettings/BigserialUnique.go new file mode 100644 index 00000000..7884f697 --- /dev/null +++ b/internal/integration_tests/postgres/defaultsettings/BigserialUnique.go @@ -0,0 +1,5 @@ +package dto + +type BigserialUnique struct { + Bigserial int `db:"bigserial"` +} diff --git a/internal/integration_tests/postgres/defaultsettings/BigserialUniqueCheck.go b/internal/integration_tests/postgres/defaultsettings/BigserialUniqueCheck.go new file mode 100644 index 00000000..aa58bc27 --- /dev/null +++ b/internal/integration_tests/postgres/defaultsettings/BigserialUniqueCheck.go @@ -0,0 +1,5 @@ +package dto + +type BigserialUniqueCheck struct { + Bigserial int `db:"bigserial"` +} diff --git a/internal/integration_tests/postgres/defaultsettings/BigserialUniqueCheckPk.go b/internal/integration_tests/postgres/defaultsettings/BigserialUniqueCheckPk.go new file mode 100644 index 00000000..5715fff7 --- /dev/null +++ b/internal/integration_tests/postgres/defaultsettings/BigserialUniqueCheckPk.go @@ -0,0 +1,5 @@ +package dto + +type BigserialUniqueCheckPk struct { + Bigserial int `db:"bigserial"` +} diff --git a/internal/integration_tests/postgres/defaultsettings/BigserialUniqueCheckPkRef.go b/internal/integration_tests/postgres/defaultsettings/BigserialUniqueCheckPkRef.go new file mode 100644 index 00000000..c9b0b21f --- /dev/null +++ b/internal/integration_tests/postgres/defaultsettings/BigserialUniqueCheckPkRef.go @@ -0,0 +1,5 @@ +package dto + +type BigserialUniqueCheckPkRef struct { + Bigserial int `db:"bigserial"` +} diff --git a/internal/integration_tests/postgres/defaultsettings/BigserialUniqueCheckRef.go b/internal/integration_tests/postgres/defaultsettings/BigserialUniqueCheckRef.go new file mode 100644 index 00000000..f12fbe3b --- /dev/null +++ b/internal/integration_tests/postgres/defaultsettings/BigserialUniqueCheckRef.go @@ -0,0 +1,5 @@ +package dto + +type BigserialUniqueCheckRef struct { + Bigserial int `db:"bigserial"` +} diff --git a/internal/integration_tests/postgres/defaultsettings/Char.go b/internal/integration_tests/postgres/defaultsettings/Char.go new file mode 100644 index 00000000..1d3ec7a8 --- /dev/null +++ b/internal/integration_tests/postgres/defaultsettings/Char.go @@ -0,0 +1,35 @@ +package dto + +import ( + "database/sql" +) + +type Char struct { + Char sql.NullString `db:"char"` + CharCap sql.NullString `db:"char_cap"` + CharNn string `db:"char_nn"` + CharNnUnique string `db:"char_nn_unique"` + CharNnCheckCmp string `db:"char_nn_check_cmp"` + CharNnCheckFn string `db:"char_nn_check_fn"` + CharNnRef string `db:"char_nn_ref"` + CharNnDefConst string `db:"char_nn_def_const"` + CharNnDefFunc string `db:"char_nn_def_func"` + CharNnUniqueCheck string `db:"char_nn_unique_check"` + CharUnique sql.NullString `db:"char_unique"` + CharUniqueCheck sql.NullString `db:"char_unique_check"` + CharUniqueRef sql.NullString `db:"char_unique_ref"` + CharUniqueDefConst sql.NullString `db:"char_unique_def_const"` + CharUniqueDefFunc sql.NullString `db:"char_unique_def_func"` + CharCheck sql.NullString `db:"char_check"` + CharCheckRef sql.NullString `db:"char_check_ref"` + CharCheckDefConst sql.NullString `db:"char_check_def_const"` + CharCheckDefFunc sql.NullString `db:"char_check_def_func"` + CharRef sql.NullString `db:"char_ref"` + CharRefDefConst sql.NullString `db:"char_ref_def_const"` + CharRefDefFunc sql.NullString `db:"char_ref_def_func"` + CharRefUniqueCheck sql.NullString `db:"char_ref_unique_check"` + CharDefConst sql.NullString `db:"char_def_const"` + CharDefConstUniqueCheck sql.NullString `db:"char_def_const_unique_check"` + CharDefFunc sql.NullString `db:"char_def_func"` + CharDefFuncUniqueCheck sql.NullString `db:"char_def_func_unique_check"` +} diff --git a/internal/integration_tests/postgres/defaultsettings/CharCheckPk.go b/internal/integration_tests/postgres/defaultsettings/CharCheckPk.go new file mode 100644 index 00000000..3fced3dc --- /dev/null +++ b/internal/integration_tests/postgres/defaultsettings/CharCheckPk.go @@ -0,0 +1,5 @@ +package dto + +type CharCheckPk struct { + CharCheckPk string `db:"char_check_pk"` +} diff --git a/internal/integration_tests/postgres/defaultsettings/CharDefConstUniqueCheckPk.go b/internal/integration_tests/postgres/defaultsettings/CharDefConstUniqueCheckPk.go new file mode 100644 index 00000000..3c69f6ff --- /dev/null +++ b/internal/integration_tests/postgres/defaultsettings/CharDefConstUniqueCheckPk.go @@ -0,0 +1,5 @@ +package dto + +type CharDefConstUniqueCheckPk struct { + CharDefConstUniqueCheckPk string `db:"char_def_const_unique_check_pk"` +} diff --git a/internal/integration_tests/postgres/defaultsettings/CharDefConstUniqueCheckPkRef.go b/internal/integration_tests/postgres/defaultsettings/CharDefConstUniqueCheckPkRef.go new file mode 100644 index 00000000..6b29a7e6 --- /dev/null +++ b/internal/integration_tests/postgres/defaultsettings/CharDefConstUniqueCheckPkRef.go @@ -0,0 +1,5 @@ +package dto + +type CharDefConstUniqueCheckPkRef struct { + CharDefConstUniqueCheckPkRef string `db:"char_def_const_unique_check_pk_ref"` +} diff --git a/internal/integration_tests/postgres/defaultsettings/CharDefFuncUniqueCheckPk.go b/internal/integration_tests/postgres/defaultsettings/CharDefFuncUniqueCheckPk.go new file mode 100644 index 00000000..45d10db8 --- /dev/null +++ b/internal/integration_tests/postgres/defaultsettings/CharDefFuncUniqueCheckPk.go @@ -0,0 +1,5 @@ +package dto + +type CharDefFuncUniqueCheckPk struct { + CharDefFuncUniqueCheckPk string `db:"char_def_func_unique_check_pk"` +} diff --git a/internal/integration_tests/postgres/defaultsettings/CharDefFuncUniqueCheckPkRef.go b/internal/integration_tests/postgres/defaultsettings/CharDefFuncUniqueCheckPkRef.go new file mode 100644 index 00000000..43d48b6b --- /dev/null +++ b/internal/integration_tests/postgres/defaultsettings/CharDefFuncUniqueCheckPkRef.go @@ -0,0 +1,5 @@ +package dto + +type CharDefFuncUniqueCheckPkRef struct { + CharDefFuncUniqueCheckPkRef string `db:"char_def_func_unique_check_pk_ref"` +} diff --git a/internal/integration_tests/postgres/defaultsettings/CharNnPk.go b/internal/integration_tests/postgres/defaultsettings/CharNnPk.go new file mode 100644 index 00000000..309e6e87 --- /dev/null +++ b/internal/integration_tests/postgres/defaultsettings/CharNnPk.go @@ -0,0 +1,5 @@ +package dto + +type CharNnPk struct { + CharNnPk string `db:"char_nn_pk"` +} diff --git a/internal/integration_tests/postgres/defaultsettings/CharNnUniqueCheckPk.go b/internal/integration_tests/postgres/defaultsettings/CharNnUniqueCheckPk.go new file mode 100644 index 00000000..0ffe2059 --- /dev/null +++ b/internal/integration_tests/postgres/defaultsettings/CharNnUniqueCheckPk.go @@ -0,0 +1,5 @@ +package dto + +type CharNnUniqueCheckPk struct { + CharNnUniqueCheckPk string `db:"char_nn_unique_check_pk"` +} diff --git a/internal/integration_tests/postgres/defaultsettings/CharNnUniqueCheckPkRef.go b/internal/integration_tests/postgres/defaultsettings/CharNnUniqueCheckPkRef.go new file mode 100644 index 00000000..62f9b39b --- /dev/null +++ b/internal/integration_tests/postgres/defaultsettings/CharNnUniqueCheckPkRef.go @@ -0,0 +1,5 @@ +package dto + +type CharNnUniqueCheckPkRef struct { + CharNnUniqueCheckPkRef string `db:"char_nn_unique_check_pk_ref"` +} diff --git a/internal/integration_tests/postgres/defaultsettings/CharPk.go b/internal/integration_tests/postgres/defaultsettings/CharPk.go new file mode 100644 index 00000000..82d769ca --- /dev/null +++ b/internal/integration_tests/postgres/defaultsettings/CharPk.go @@ -0,0 +1,5 @@ +package dto + +type CharPk struct { + CharPk string `db:"char_pk"` +} diff --git a/internal/integration_tests/postgres/defaultsettings/CharPkDefConst.go b/internal/integration_tests/postgres/defaultsettings/CharPkDefConst.go new file mode 100644 index 00000000..e386cc95 --- /dev/null +++ b/internal/integration_tests/postgres/defaultsettings/CharPkDefConst.go @@ -0,0 +1,5 @@ +package dto + +type CharPkDefConst struct { + CharPkDefConst string `db:"char_pk_def_const"` +} diff --git a/internal/integration_tests/postgres/defaultsettings/CharPkDefFunc.go b/internal/integration_tests/postgres/defaultsettings/CharPkDefFunc.go new file mode 100644 index 00000000..24a1d17a --- /dev/null +++ b/internal/integration_tests/postgres/defaultsettings/CharPkDefFunc.go @@ -0,0 +1,5 @@ +package dto + +type CharPkDefFunc struct { + CharPkDefFunc string `db:"char_pk_def_func"` +} diff --git a/internal/integration_tests/postgres/defaultsettings/CharPkRef.go b/internal/integration_tests/postgres/defaultsettings/CharPkRef.go new file mode 100644 index 00000000..aed73b7d --- /dev/null +++ b/internal/integration_tests/postgres/defaultsettings/CharPkRef.go @@ -0,0 +1,5 @@ +package dto + +type CharPkRef struct { + CharPkRef string `db:"char_pk_ref"` +} diff --git a/internal/integration_tests/postgres/defaultsettings/CharRef.go b/internal/integration_tests/postgres/defaultsettings/CharRef.go new file mode 100644 index 00000000..5bbf267b --- /dev/null +++ b/internal/integration_tests/postgres/defaultsettings/CharRef.go @@ -0,0 +1,9 @@ +package dto + +import ( + "database/sql" +) + +type CharRef struct { + CharRef sql.NullString `db:"char_ref"` +} diff --git a/internal/integration_tests/postgres/defaultsettings/CharUniqueCheckPk.go b/internal/integration_tests/postgres/defaultsettings/CharUniqueCheckPk.go new file mode 100644 index 00000000..3a27898a --- /dev/null +++ b/internal/integration_tests/postgres/defaultsettings/CharUniqueCheckPk.go @@ -0,0 +1,5 @@ +package dto + +type CharUniqueCheckPk struct { + CharUniqueCheckPk string `db:"char_unique_check_pk"` +} diff --git a/internal/integration_tests/postgres/defaultsettings/CharUniqueCheckPkRef.go b/internal/integration_tests/postgres/defaultsettings/CharUniqueCheckPkRef.go new file mode 100644 index 00000000..47939972 --- /dev/null +++ b/internal/integration_tests/postgres/defaultsettings/CharUniqueCheckPkRef.go @@ -0,0 +1,5 @@ +package dto + +type CharUniqueCheckPkRef struct { + CharUniqueCheckPkRef string `db:"char_unique_check_pk_ref"` +} diff --git a/internal/integration_tests/postgres/defaultsettings/CharUniquePk.go b/internal/integration_tests/postgres/defaultsettings/CharUniquePk.go new file mode 100644 index 00000000..27407394 --- /dev/null +++ b/internal/integration_tests/postgres/defaultsettings/CharUniquePk.go @@ -0,0 +1,5 @@ +package dto + +type CharUniquePk struct { + CharUniquePk string `db:"char_unique_pk"` +} diff --git a/internal/integration_tests/postgres/defaultsettings/Character.go b/internal/integration_tests/postgres/defaultsettings/Character.go new file mode 100644 index 00000000..fad212e4 --- /dev/null +++ b/internal/integration_tests/postgres/defaultsettings/Character.go @@ -0,0 +1,35 @@ +package dto + +import ( + "database/sql" +) + +type Character struct { + Character sql.NullString `db:"character"` + CharacterCap sql.NullString `db:"character_cap"` + CharacterNn string `db:"character_nn"` + CharacterNnUnique string `db:"character_nn_unique"` + CharacterNnCheckCmp string `db:"character_nn_check_cmp"` + CharacterNnCheckFn string `db:"character_nn_check_fn"` + CharacterNnRef string `db:"character_nn_ref"` + CharacterNnDefConst string `db:"character_nn_def_const"` + CharacterNnDefFunc string `db:"character_nn_def_func"` + CharacterNnUniqueCheck string `db:"character_nn_unique_check"` + CharacterUnique sql.NullString `db:"character_unique"` + CharacterUniqueCheck sql.NullString `db:"character_unique_check"` + CharacterUniqueRef sql.NullString `db:"character_unique_ref"` + CharacterUniqueDefConst sql.NullString `db:"character_unique_def_const"` + CharacterUniqueDefFunc sql.NullString `db:"character_unique_def_func"` + CharacterCheck sql.NullString `db:"character_check"` + CharacterCheckRef sql.NullString `db:"character_check_ref"` + CharacterCheckDefConst sql.NullString `db:"character_check_def_const"` + CharacterCheckDefFunc sql.NullString `db:"character_check_def_func"` + CharacterRef sql.NullString `db:"character_ref"` + CharacterRefDefConst sql.NullString `db:"character_ref_def_const"` + CharacterRefDefFunc sql.NullString `db:"character_ref_def_func"` + CharacterRefUniqueCheck sql.NullString `db:"character_ref_unique_check"` + CharacterDefConst sql.NullString `db:"character_def_const"` + CharacterDefConstUniqueCheck sql.NullString `db:"character_def_const_unique_check"` + CharacterDefFunc sql.NullString `db:"character_def_func"` + CharacterDefFuncUniqueCheck sql.NullString `db:"character_def_func_unique_check"` +} diff --git a/internal/integration_tests/postgres/defaultsettings/CharacterCheckPk.go b/internal/integration_tests/postgres/defaultsettings/CharacterCheckPk.go new file mode 100644 index 00000000..43a57d0c --- /dev/null +++ b/internal/integration_tests/postgres/defaultsettings/CharacterCheckPk.go @@ -0,0 +1,5 @@ +package dto + +type CharacterCheckPk struct { + CharacterCheckPk string `db:"character_check_pk"` +} diff --git a/internal/integration_tests/postgres/defaultsettings/CharacterDefConstUniqueCheckPk.go b/internal/integration_tests/postgres/defaultsettings/CharacterDefConstUniqueCheckPk.go new file mode 100644 index 00000000..fe2c62e0 --- /dev/null +++ b/internal/integration_tests/postgres/defaultsettings/CharacterDefConstUniqueCheckPk.go @@ -0,0 +1,5 @@ +package dto + +type CharacterDefConstUniqueCheckPk struct { + CharacterDefConstUniqueCheckPk string `db:"character_def_const_unique_check_pk"` +} diff --git a/internal/integration_tests/postgres/defaultsettings/CharacterDefConstUniqueCheckPkRef.go b/internal/integration_tests/postgres/defaultsettings/CharacterDefConstUniqueCheckPkRef.go new file mode 100644 index 00000000..a26c3bf6 --- /dev/null +++ b/internal/integration_tests/postgres/defaultsettings/CharacterDefConstUniqueCheckPkRef.go @@ -0,0 +1,5 @@ +package dto + +type CharacterDefConstUniqueCheckPkRef struct { + CharacterDefConstUniqueCheckPkRef string `db:"character_def_const_unique_check_pk_ref"` +} diff --git a/internal/integration_tests/postgres/defaultsettings/CharacterDefFuncUniqueCheckPk.go b/internal/integration_tests/postgres/defaultsettings/CharacterDefFuncUniqueCheckPk.go new file mode 100644 index 00000000..66f3450b --- /dev/null +++ b/internal/integration_tests/postgres/defaultsettings/CharacterDefFuncUniqueCheckPk.go @@ -0,0 +1,5 @@ +package dto + +type CharacterDefFuncUniqueCheckPk struct { + CharacterDefFuncUniqueCheckPk string `db:"character_def_func_unique_check_pk"` +} diff --git a/internal/integration_tests/postgres/defaultsettings/CharacterDefFuncUniqueCheckPkRef.go b/internal/integration_tests/postgres/defaultsettings/CharacterDefFuncUniqueCheckPkRef.go new file mode 100644 index 00000000..fb65a7e2 --- /dev/null +++ b/internal/integration_tests/postgres/defaultsettings/CharacterDefFuncUniqueCheckPkRef.go @@ -0,0 +1,5 @@ +package dto + +type CharacterDefFuncUniqueCheckPkRef struct { + CharacterDefFuncUniqueCheckPkRef string `db:"character_def_func_unique_check_pk_ref"` +} diff --git a/internal/integration_tests/postgres/defaultsettings/CharacterNnPk.go b/internal/integration_tests/postgres/defaultsettings/CharacterNnPk.go new file mode 100644 index 00000000..43a53a5a --- /dev/null +++ b/internal/integration_tests/postgres/defaultsettings/CharacterNnPk.go @@ -0,0 +1,5 @@ +package dto + +type CharacterNnPk struct { + CharacterNnPk string `db:"character_nn_pk"` +} diff --git a/internal/integration_tests/postgres/defaultsettings/CharacterNnUniqueCheckPk.go b/internal/integration_tests/postgres/defaultsettings/CharacterNnUniqueCheckPk.go new file mode 100644 index 00000000..af7529b3 --- /dev/null +++ b/internal/integration_tests/postgres/defaultsettings/CharacterNnUniqueCheckPk.go @@ -0,0 +1,5 @@ +package dto + +type CharacterNnUniqueCheckPk struct { + CharacterNnUniqueCheckPk string `db:"character_nn_unique_check_pk"` +} diff --git a/internal/integration_tests/postgres/defaultsettings/CharacterNnUniqueCheckPkRef.go b/internal/integration_tests/postgres/defaultsettings/CharacterNnUniqueCheckPkRef.go new file mode 100644 index 00000000..c7d4497c --- /dev/null +++ b/internal/integration_tests/postgres/defaultsettings/CharacterNnUniqueCheckPkRef.go @@ -0,0 +1,5 @@ +package dto + +type CharacterNnUniqueCheckPkRef struct { + CharacterNnUniqueCheckPkRef string `db:"character_nn_unique_check_pk_ref"` +} diff --git a/internal/integration_tests/postgres/defaultsettings/CharacterPk.go b/internal/integration_tests/postgres/defaultsettings/CharacterPk.go new file mode 100644 index 00000000..0e01d927 --- /dev/null +++ b/internal/integration_tests/postgres/defaultsettings/CharacterPk.go @@ -0,0 +1,5 @@ +package dto + +type CharacterPk struct { + CharacterPk string `db:"character_pk"` +} diff --git a/internal/integration_tests/postgres/defaultsettings/CharacterPkDefConst.go b/internal/integration_tests/postgres/defaultsettings/CharacterPkDefConst.go new file mode 100644 index 00000000..39881d67 --- /dev/null +++ b/internal/integration_tests/postgres/defaultsettings/CharacterPkDefConst.go @@ -0,0 +1,5 @@ +package dto + +type CharacterPkDefConst struct { + CharacterPkDefConst string `db:"character_pk_def_const"` +} diff --git a/internal/integration_tests/postgres/defaultsettings/CharacterPkDefFunc.go b/internal/integration_tests/postgres/defaultsettings/CharacterPkDefFunc.go new file mode 100644 index 00000000..f0fdb03d --- /dev/null +++ b/internal/integration_tests/postgres/defaultsettings/CharacterPkDefFunc.go @@ -0,0 +1,5 @@ +package dto + +type CharacterPkDefFunc struct { + CharacterPkDefFunc string `db:"character_pk_def_func"` +} diff --git a/internal/integration_tests/postgres/defaultsettings/CharacterPkRef.go b/internal/integration_tests/postgres/defaultsettings/CharacterPkRef.go new file mode 100644 index 00000000..09953a06 --- /dev/null +++ b/internal/integration_tests/postgres/defaultsettings/CharacterPkRef.go @@ -0,0 +1,5 @@ +package dto + +type CharacterPkRef struct { + CharacterPkRef string `db:"character_pk_ref"` +} diff --git a/internal/integration_tests/postgres/defaultsettings/CharacterRef.go b/internal/integration_tests/postgres/defaultsettings/CharacterRef.go new file mode 100644 index 00000000..db44cc39 --- /dev/null +++ b/internal/integration_tests/postgres/defaultsettings/CharacterRef.go @@ -0,0 +1,9 @@ +package dto + +import ( + "database/sql" +) + +type CharacterRef struct { + CharacterRef sql.NullString `db:"character_ref"` +} diff --git a/internal/integration_tests/postgres/defaultsettings/CharacterUniqueCheckPk.go b/internal/integration_tests/postgres/defaultsettings/CharacterUniqueCheckPk.go new file mode 100644 index 00000000..fa003ea8 --- /dev/null +++ b/internal/integration_tests/postgres/defaultsettings/CharacterUniqueCheckPk.go @@ -0,0 +1,5 @@ +package dto + +type CharacterUniqueCheckPk struct { + CharacterUniqueCheckPk string `db:"character_unique_check_pk"` +} diff --git a/internal/integration_tests/postgres/defaultsettings/CharacterUniqueCheckPkRef.go b/internal/integration_tests/postgres/defaultsettings/CharacterUniqueCheckPkRef.go new file mode 100644 index 00000000..e87ec75f --- /dev/null +++ b/internal/integration_tests/postgres/defaultsettings/CharacterUniqueCheckPkRef.go @@ -0,0 +1,5 @@ +package dto + +type CharacterUniqueCheckPkRef struct { + CharacterUniqueCheckPkRef string `db:"character_unique_check_pk_ref"` +} diff --git a/internal/integration_tests/postgres/defaultsettings/CharacterUniquePk.go b/internal/integration_tests/postgres/defaultsettings/CharacterUniquePk.go new file mode 100644 index 00000000..af580474 --- /dev/null +++ b/internal/integration_tests/postgres/defaultsettings/CharacterUniquePk.go @@ -0,0 +1,5 @@ +package dto + +type CharacterUniquePk struct { + CharacterUniquePk string `db:"character_unique_pk"` +} diff --git a/internal/integration_tests/postgres/defaultsettings/CharacterVarying.go b/internal/integration_tests/postgres/defaultsettings/CharacterVarying.go new file mode 100644 index 00000000..4ea97471 --- /dev/null +++ b/internal/integration_tests/postgres/defaultsettings/CharacterVarying.go @@ -0,0 +1,35 @@ +package dto + +import ( + "database/sql" +) + +type CharacterVarying struct { + CharacterVarying sql.NullString `db:"character_varying"` + CharacterVaryingCap sql.NullString `db:"character_varying_cap"` + CharacterVaryingNn string `db:"character_varying_nn"` + CharacterVaryingNnUnique string `db:"character_varying_nn_unique"` + CharacterVaryingNnCheckCmp string `db:"character_varying_nn_check_cmp"` + CharacterVaryingNnCheckFn string `db:"character_varying_nn_check_fn"` + CharacterVaryingNnRef string `db:"character_varying_nn_ref"` + CharacterVaryingNnDefConst string `db:"character_varying_nn_def_const"` + CharacterVaryingNnDefFunc string `db:"character_varying_nn_def_func"` + CharacterVaryingNnUniqueCheck string `db:"character_varying_nn_unique_check"` + CharacterVaryingUnique sql.NullString `db:"character_varying_unique"` + CharacterVaryingUniqueCheck sql.NullString `db:"character_varying_unique_check"` + CharacterVaryingUniqueRef sql.NullString `db:"character_varying_unique_ref"` + CharacterVaryingUniqueDefConst sql.NullString `db:"character_varying_unique_def_const"` + CharacterVaryingUniqueDefFunc sql.NullString `db:"character_varying_unique_def_func"` + CharacterVaryingCheck sql.NullString `db:"character_varying_check"` + CharacterVaryingCheckRef sql.NullString `db:"character_varying_check_ref"` + CharacterVaryingCheckDefConst sql.NullString `db:"character_varying_check_def_const"` + CharacterVaryingCheckDefFunc sql.NullString `db:"character_varying_check_def_func"` + CharacterVaryingRef sql.NullString `db:"character_varying_ref"` + CharacterVaryingRefDefConst sql.NullString `db:"character_varying_ref_def_const"` + CharacterVaryingRefDefFunc sql.NullString `db:"character_varying_ref_def_func"` + CharacterVaryingRefUniqueCheck sql.NullString `db:"character_varying_ref_unique_check"` + CharacterVaryingDefConst sql.NullString `db:"character_varying_def_const"` + CharacterVaryingDefConstUniqueCheck sql.NullString `db:"character_varying_def_const_unique_check"` + CharacterVaryingDefFunc sql.NullString `db:"character_varying_def_func"` + CharacterVaryingDefFuncUniqueCheck sql.NullString `db:"character_varying_def_func_unique_check"` +} diff --git a/internal/integration_tests/postgres/defaultsettings/CharacterVaryingCheckPk.go b/internal/integration_tests/postgres/defaultsettings/CharacterVaryingCheckPk.go new file mode 100644 index 00000000..a02d2b97 --- /dev/null +++ b/internal/integration_tests/postgres/defaultsettings/CharacterVaryingCheckPk.go @@ -0,0 +1,5 @@ +package dto + +type CharacterVaryingCheckPk struct { + CharacterVaryingCheckPk string `db:"character_varying_check_pk"` +} diff --git a/internal/integration_tests/postgres/defaultsettings/CharacterVaryingDefConstUniqueCheckPk.go b/internal/integration_tests/postgres/defaultsettings/CharacterVaryingDefConstUniqueCheckPk.go new file mode 100644 index 00000000..0e65c023 --- /dev/null +++ b/internal/integration_tests/postgres/defaultsettings/CharacterVaryingDefConstUniqueCheckPk.go @@ -0,0 +1,5 @@ +package dto + +type CharacterVaryingDefConstUniqueCheckPk struct { + CharacterVaryingDefConstUniqueCheckPk string `db:"character_varying_def_const_unique_check_pk"` +} diff --git a/internal/integration_tests/postgres/defaultsettings/CharacterVaryingDefConstUniqueCheckPkRef.go b/internal/integration_tests/postgres/defaultsettings/CharacterVaryingDefConstUniqueCheckPkRef.go new file mode 100644 index 00000000..9bbee877 --- /dev/null +++ b/internal/integration_tests/postgres/defaultsettings/CharacterVaryingDefConstUniqueCheckPkRef.go @@ -0,0 +1,5 @@ +package dto + +type CharacterVaryingDefConstUniqueCheckPkRef struct { + CharacterVaryingDefConstUniqueCheckPkRef string `db:"character_varying_def_const_unique_check_pk_ref"` +} diff --git a/internal/integration_tests/postgres/defaultsettings/CharacterVaryingDefFuncUniqueCheckPk.go b/internal/integration_tests/postgres/defaultsettings/CharacterVaryingDefFuncUniqueCheckPk.go new file mode 100644 index 00000000..c5f22fa4 --- /dev/null +++ b/internal/integration_tests/postgres/defaultsettings/CharacterVaryingDefFuncUniqueCheckPk.go @@ -0,0 +1,5 @@ +package dto + +type CharacterVaryingDefFuncUniqueCheckPk struct { + CharacterVaryingDefFuncUniqueCheckPk string `db:"character_varying_def_func_unique_check_pk"` +} diff --git a/internal/integration_tests/postgres/defaultsettings/CharacterVaryingDefFuncUniqueCheckPkRef.go b/internal/integration_tests/postgres/defaultsettings/CharacterVaryingDefFuncUniqueCheckPkRef.go new file mode 100644 index 00000000..4b728029 --- /dev/null +++ b/internal/integration_tests/postgres/defaultsettings/CharacterVaryingDefFuncUniqueCheckPkRef.go @@ -0,0 +1,5 @@ +package dto + +type CharacterVaryingDefFuncUniqueCheckPkRef struct { + CharacterVaryingDefFuncUniqueCheckPkRef string `db:"character_varying_def_func_unique_check_pk_ref"` +} diff --git a/internal/integration_tests/postgres/defaultsettings/CharacterVaryingNnPk.go b/internal/integration_tests/postgres/defaultsettings/CharacterVaryingNnPk.go new file mode 100644 index 00000000..13cc0e4b --- /dev/null +++ b/internal/integration_tests/postgres/defaultsettings/CharacterVaryingNnPk.go @@ -0,0 +1,5 @@ +package dto + +type CharacterVaryingNnPk struct { + CharacterVaryingNnPk string `db:"character_varying_nn_pk"` +} diff --git a/internal/integration_tests/postgres/defaultsettings/CharacterVaryingNnUniqueCheckPk.go b/internal/integration_tests/postgres/defaultsettings/CharacterVaryingNnUniqueCheckPk.go new file mode 100644 index 00000000..01255678 --- /dev/null +++ b/internal/integration_tests/postgres/defaultsettings/CharacterVaryingNnUniqueCheckPk.go @@ -0,0 +1,5 @@ +package dto + +type CharacterVaryingNnUniqueCheckPk struct { + CharacterVaryingNnUniqueCheckPk string `db:"character_varying_nn_unique_check_pk"` +} diff --git a/internal/integration_tests/postgres/defaultsettings/CharacterVaryingNnUniqueCheckPkRef.go b/internal/integration_tests/postgres/defaultsettings/CharacterVaryingNnUniqueCheckPkRef.go new file mode 100644 index 00000000..58498089 --- /dev/null +++ b/internal/integration_tests/postgres/defaultsettings/CharacterVaryingNnUniqueCheckPkRef.go @@ -0,0 +1,5 @@ +package dto + +type CharacterVaryingNnUniqueCheckPkRef struct { + CharacterVaryingNnUniqueCheckPkRef string `db:"character_varying_nn_unique_check_pk_ref"` +} diff --git a/internal/integration_tests/postgres/defaultsettings/CharacterVaryingPk.go b/internal/integration_tests/postgres/defaultsettings/CharacterVaryingPk.go new file mode 100644 index 00000000..51554509 --- /dev/null +++ b/internal/integration_tests/postgres/defaultsettings/CharacterVaryingPk.go @@ -0,0 +1,5 @@ +package dto + +type CharacterVaryingPk struct { + CharacterVaryingPk string `db:"character_varying_pk"` +} diff --git a/internal/integration_tests/postgres/defaultsettings/CharacterVaryingPkDefConst.go b/internal/integration_tests/postgres/defaultsettings/CharacterVaryingPkDefConst.go new file mode 100644 index 00000000..0dd7e8fd --- /dev/null +++ b/internal/integration_tests/postgres/defaultsettings/CharacterVaryingPkDefConst.go @@ -0,0 +1,5 @@ +package dto + +type CharacterVaryingPkDefConst struct { + CharacterVaryingPkDefConst string `db:"character_varying_pk_def_const"` +} diff --git a/internal/integration_tests/postgres/defaultsettings/CharacterVaryingPkDefFunc.go b/internal/integration_tests/postgres/defaultsettings/CharacterVaryingPkDefFunc.go new file mode 100644 index 00000000..0663e375 --- /dev/null +++ b/internal/integration_tests/postgres/defaultsettings/CharacterVaryingPkDefFunc.go @@ -0,0 +1,5 @@ +package dto + +type CharacterVaryingPkDefFunc struct { + CharacterVaryingPkDefFunc string `db:"character_varying_pk_def_func"` +} diff --git a/internal/integration_tests/postgres/defaultsettings/CharacterVaryingPkRef.go b/internal/integration_tests/postgres/defaultsettings/CharacterVaryingPkRef.go new file mode 100644 index 00000000..57831d46 --- /dev/null +++ b/internal/integration_tests/postgres/defaultsettings/CharacterVaryingPkRef.go @@ -0,0 +1,5 @@ +package dto + +type CharacterVaryingPkRef struct { + CharacterVaryingPkRef string `db:"character_varying_pk_ref"` +} diff --git a/internal/integration_tests/postgres/defaultsettings/CharacterVaryingRef.go b/internal/integration_tests/postgres/defaultsettings/CharacterVaryingRef.go new file mode 100644 index 00000000..c8673a65 --- /dev/null +++ b/internal/integration_tests/postgres/defaultsettings/CharacterVaryingRef.go @@ -0,0 +1,9 @@ +package dto + +import ( + "database/sql" +) + +type CharacterVaryingRef struct { + CharacterVaryingRef sql.NullString `db:"character_varying_ref"` +} diff --git a/internal/integration_tests/postgres/defaultsettings/CharacterVaryingUniqueCheckPk.go b/internal/integration_tests/postgres/defaultsettings/CharacterVaryingUniqueCheckPk.go new file mode 100644 index 00000000..5e362dfc --- /dev/null +++ b/internal/integration_tests/postgres/defaultsettings/CharacterVaryingUniqueCheckPk.go @@ -0,0 +1,5 @@ +package dto + +type CharacterVaryingUniqueCheckPk struct { + CharacterVaryingUniqueCheckPk string `db:"character_varying_unique_check_pk"` +} diff --git a/internal/integration_tests/postgres/defaultsettings/CharacterVaryingUniqueCheckPkRef.go b/internal/integration_tests/postgres/defaultsettings/CharacterVaryingUniqueCheckPkRef.go new file mode 100644 index 00000000..2553e497 --- /dev/null +++ b/internal/integration_tests/postgres/defaultsettings/CharacterVaryingUniqueCheckPkRef.go @@ -0,0 +1,5 @@ +package dto + +type CharacterVaryingUniqueCheckPkRef struct { + CharacterVaryingUniqueCheckPkRef string `db:"character_varying_unique_check_pk_ref"` +} diff --git a/internal/integration_tests/postgres/defaultsettings/CharacterVaryingUniquePk.go b/internal/integration_tests/postgres/defaultsettings/CharacterVaryingUniquePk.go new file mode 100644 index 00000000..1dd51986 --- /dev/null +++ b/internal/integration_tests/postgres/defaultsettings/CharacterVaryingUniquePk.go @@ -0,0 +1,5 @@ +package dto + +type CharacterVaryingUniquePk struct { + CharacterVaryingUniquePk string `db:"character_varying_unique_pk"` +} diff --git a/internal/integration_tests/postgres/defaultsettings/ConstraintComboNonPk.go b/internal/integration_tests/postgres/defaultsettings/ConstraintComboNonPk.go new file mode 100644 index 00000000..575d9778 --- /dev/null +++ b/internal/integration_tests/postgres/defaultsettings/ConstraintComboNonPk.go @@ -0,0 +1,16 @@ +package dto + +type ConstraintComboNonPk struct { + NotNullUniqueCheckDefConst float64 `db:"not_null_unique_check_def_const"` + NotNullUniqueCheckDefFunc float64 `db:"not_null_unique_check_def_func"` + NotNullUniqueRefDefConst float64 `db:"not_null_unique_ref_def_const"` + NotNullUniqueRefDefFunc float64 `db:"not_null_unique_ref_def_func"` + NotNullCheckRefDefConst float64 `db:"not_null_check_ref_def_const"` + NotNullCheckRefDefFunc float64 `db:"not_null_check_ref_def_func"` + NotNullUniqueDefConst float64 `db:"not_null_unique_def_const"` + NotNullUniqueDefFunc float64 `db:"not_null_unique_def_func"` + NotNullCheckDefConst float64 `db:"not_null_check_def_const"` + NotNullCheckDefFunc float64 `db:"not_null_check_def_func"` + NotNullRefDefConst float64 `db:"not_null_ref_def_const"` + NotNullRefDefFunc float64 `db:"not_null_ref_def_func"` +} diff --git a/internal/integration_tests/postgres/defaultsettings/ConstraintComboNotNullCheckPkDefConst.go b/internal/integration_tests/postgres/defaultsettings/ConstraintComboNotNullCheckPkDefConst.go new file mode 100644 index 00000000..4aa890ba --- /dev/null +++ b/internal/integration_tests/postgres/defaultsettings/ConstraintComboNotNullCheckPkDefConst.go @@ -0,0 +1,5 @@ +package dto + +type ConstraintComboNotNullCheckPkDefConst struct { + ConstraintComboNotNullCheckPkDefConst float64 `db:"constraint_combo_not_null_check_pk_def_const"` +} diff --git a/internal/integration_tests/postgres/defaultsettings/ConstraintComboNotNullCheckPkDefFunc.go b/internal/integration_tests/postgres/defaultsettings/ConstraintComboNotNullCheckPkDefFunc.go new file mode 100644 index 00000000..dce0d8b3 --- /dev/null +++ b/internal/integration_tests/postgres/defaultsettings/ConstraintComboNotNullCheckPkDefFunc.go @@ -0,0 +1,5 @@ +package dto + +type ConstraintComboNotNullCheckPkDefFunc struct { + ConstraintComboNotNullCheckPkDefFunc float64 `db:"constraint_combo_not_null_check_pk_def_func"` +} diff --git a/internal/integration_tests/postgres/defaultsettings/ConstraintComboNotNullPkDefConst.go b/internal/integration_tests/postgres/defaultsettings/ConstraintComboNotNullPkDefConst.go new file mode 100644 index 00000000..ca059e7a --- /dev/null +++ b/internal/integration_tests/postgres/defaultsettings/ConstraintComboNotNullPkDefConst.go @@ -0,0 +1,5 @@ +package dto + +type ConstraintComboNotNullPkDefConst struct { + ConstraintComboNotNullPkDefConst float64 `db:"constraint_combo_not_null_pk_def_const"` +} diff --git a/internal/integration_tests/postgres/defaultsettings/ConstraintComboNotNullPkDefFunc.go b/internal/integration_tests/postgres/defaultsettings/ConstraintComboNotNullPkDefFunc.go new file mode 100644 index 00000000..5bb0b531 --- /dev/null +++ b/internal/integration_tests/postgres/defaultsettings/ConstraintComboNotNullPkDefFunc.go @@ -0,0 +1,5 @@ +package dto + +type ConstraintComboNotNullPkDefFunc struct { + ConstraintComboNotNullPkDefFunc float64 `db:"constraint_combo_not_null_pk_def_func"` +} diff --git a/internal/integration_tests/postgres/defaultsettings/ConstraintComboNotNullPkRefDefConst.go b/internal/integration_tests/postgres/defaultsettings/ConstraintComboNotNullPkRefDefConst.go new file mode 100644 index 00000000..4bd7ce91 --- /dev/null +++ b/internal/integration_tests/postgres/defaultsettings/ConstraintComboNotNullPkRefDefConst.go @@ -0,0 +1,5 @@ +package dto + +type ConstraintComboNotNullPkRefDefConst struct { + ConstraintComboNotNullPkRefDefConst float64 `db:"constraint_combo_not_null_pk_ref_def_const"` +} diff --git a/internal/integration_tests/postgres/defaultsettings/ConstraintComboNotNullPkRefDefFunc.go b/internal/integration_tests/postgres/defaultsettings/ConstraintComboNotNullPkRefDefFunc.go new file mode 100644 index 00000000..72c2299b --- /dev/null +++ b/internal/integration_tests/postgres/defaultsettings/ConstraintComboNotNullPkRefDefFunc.go @@ -0,0 +1,5 @@ +package dto + +type ConstraintComboNotNullPkRefDefFunc struct { + ConstraintComboNotNullPkRefDefFunc float64 `db:"constraint_combo_not_null_pk_ref_def_func"` +} diff --git a/internal/integration_tests/postgres/defaultsettings/ConstraintComboNotNullUniquePkDefConst.go b/internal/integration_tests/postgres/defaultsettings/ConstraintComboNotNullUniquePkDefConst.go new file mode 100644 index 00000000..b195d769 --- /dev/null +++ b/internal/integration_tests/postgres/defaultsettings/ConstraintComboNotNullUniquePkDefConst.go @@ -0,0 +1,5 @@ +package dto + +type ConstraintComboNotNullUniquePkDefConst struct { + ConstraintComboNotNullUniquePkDefConst float64 `db:"constraint_combo_not_null_unique_pk_def_const"` +} diff --git a/internal/integration_tests/postgres/defaultsettings/ConstraintComboNotNullUniquePkDefFunc.go b/internal/integration_tests/postgres/defaultsettings/ConstraintComboNotNullUniquePkDefFunc.go new file mode 100644 index 00000000..845d6231 --- /dev/null +++ b/internal/integration_tests/postgres/defaultsettings/ConstraintComboNotNullUniquePkDefFunc.go @@ -0,0 +1,5 @@ +package dto + +type ConstraintComboNotNullUniquePkDefFunc struct { + ConstraintComboNotNullUniquePkDefFunc float64 `db:"constraint_combo_not_null_unique_pk_def_func"` +} diff --git a/internal/integration_tests/postgres/defaultsettings/ConstraintComboRef.go b/internal/integration_tests/postgres/defaultsettings/ConstraintComboRef.go new file mode 100644 index 00000000..ecc8379f --- /dev/null +++ b/internal/integration_tests/postgres/defaultsettings/ConstraintComboRef.go @@ -0,0 +1,9 @@ +package dto + +import ( + "database/sql" +) + +type ConstraintComboRef struct { + ConstraintComboRef sql.NullFloat64 `db:"constraint_combo_ref"` +} diff --git a/internal/integration_tests/postgres/defaultsettings/Date.go b/internal/integration_tests/postgres/defaultsettings/Date.go new file mode 100644 index 00000000..f5a4e6f5 --- /dev/null +++ b/internal/integration_tests/postgres/defaultsettings/Date.go @@ -0,0 +1,34 @@ +package dto + +import ( + "database/sql" + "time" +) + +type Date struct { + Date sql.NullTime `db:"date"` + DateNn time.Time `db:"date_nn"` + DateNnUnique time.Time `db:"date_nn_unique"` + DateNnCheck time.Time `db:"date_nn_check"` + DateNnRef time.Time `db:"date_nn_ref"` + DateNnDefConst time.Time `db:"date_nn_def_const"` + DateNnDefFunc time.Time `db:"date_nn_def_func"` + DateNnUniqueCheck time.Time `db:"date_nn_unique_check"` + DateUnique sql.NullTime `db:"date_unique"` + DateUniqueCheck sql.NullTime `db:"date_unique_check"` + DateUniqueRef sql.NullTime `db:"date_unique_ref"` + DateUniqueDefConst sql.NullTime `db:"date_unique_def_const"` + DateUniqueDefFunc sql.NullTime `db:"date_unique_def_func"` + DateCheck sql.NullTime `db:"date_check"` + DateCheckRef sql.NullTime `db:"date_check_ref"` + DateCheckDefConst sql.NullTime `db:"date_check_def_const"` + DateCheckDefFunc sql.NullTime `db:"date_check_def_func"` + DateRef sql.NullTime `db:"date_ref"` + DateRefDefConst sql.NullTime `db:"date_ref_def_const"` + DateRefDefFunc sql.NullTime `db:"date_ref_def_func"` + DateRefUniqueCheck sql.NullTime `db:"date_ref_unique_check"` + DateDefConst sql.NullTime `db:"date_def_const"` + DateDefConstUniqueCheck sql.NullTime `db:"date_def_const_unique_check"` + DateDefFunc sql.NullTime `db:"date_def_func"` + DateDefFuncUniqueCheck sql.NullTime `db:"date_def_func_unique_check"` +} diff --git a/internal/integration_tests/postgres/defaultsettings/DateCheckPk.go b/internal/integration_tests/postgres/defaultsettings/DateCheckPk.go new file mode 100644 index 00000000..6cb1844e --- /dev/null +++ b/internal/integration_tests/postgres/defaultsettings/DateCheckPk.go @@ -0,0 +1,9 @@ +package dto + +import ( + "time" +) + +type DateCheckPk struct { + DateCheckPk time.Time `db:"date_check_pk"` +} diff --git a/internal/integration_tests/postgres/defaultsettings/DateDefConstUniqueCheckPk.go b/internal/integration_tests/postgres/defaultsettings/DateDefConstUniqueCheckPk.go new file mode 100644 index 00000000..e07a7ed5 --- /dev/null +++ b/internal/integration_tests/postgres/defaultsettings/DateDefConstUniqueCheckPk.go @@ -0,0 +1,9 @@ +package dto + +import ( + "time" +) + +type DateDefConstUniqueCheckPk struct { + DateDefConstUniqueCheckPk time.Time `db:"date_def_const_unique_check_pk"` +} diff --git a/internal/integration_tests/postgres/defaultsettings/DateDefConstUniqueCheckPkRef.go b/internal/integration_tests/postgres/defaultsettings/DateDefConstUniqueCheckPkRef.go new file mode 100644 index 00000000..3b99928e --- /dev/null +++ b/internal/integration_tests/postgres/defaultsettings/DateDefConstUniqueCheckPkRef.go @@ -0,0 +1,9 @@ +package dto + +import ( + "time" +) + +type DateDefConstUniqueCheckPkRef struct { + DateDefConstUniqueCheckPkRef time.Time `db:"date_def_const_unique_check_pk_ref"` +} diff --git a/internal/integration_tests/postgres/defaultsettings/DateDefFuncUniqueCheckPk.go b/internal/integration_tests/postgres/defaultsettings/DateDefFuncUniqueCheckPk.go new file mode 100644 index 00000000..12934d64 --- /dev/null +++ b/internal/integration_tests/postgres/defaultsettings/DateDefFuncUniqueCheckPk.go @@ -0,0 +1,9 @@ +package dto + +import ( + "time" +) + +type DateDefFuncUniqueCheckPk struct { + DateDefFuncUniqueCheckPk time.Time `db:"date_def_func_unique_check_pk"` +} diff --git a/internal/integration_tests/postgres/defaultsettings/DateDefFuncUniqueCheckPkRef.go b/internal/integration_tests/postgres/defaultsettings/DateDefFuncUniqueCheckPkRef.go new file mode 100644 index 00000000..19ed2d94 --- /dev/null +++ b/internal/integration_tests/postgres/defaultsettings/DateDefFuncUniqueCheckPkRef.go @@ -0,0 +1,9 @@ +package dto + +import ( + "time" +) + +type DateDefFuncUniqueCheckPkRef struct { + DateDefFuncUniqueCheckPkRef time.Time `db:"date_def_func_unique_check_pk_ref"` +} diff --git a/internal/integration_tests/postgres/defaultsettings/DateNnPk.go b/internal/integration_tests/postgres/defaultsettings/DateNnPk.go new file mode 100644 index 00000000..24f7dc12 --- /dev/null +++ b/internal/integration_tests/postgres/defaultsettings/DateNnPk.go @@ -0,0 +1,9 @@ +package dto + +import ( + "time" +) + +type DateNnPk struct { + DateNnPk time.Time `db:"date_nn_pk"` +} diff --git a/internal/integration_tests/postgres/defaultsettings/DateNnUniqueCheckPk.go b/internal/integration_tests/postgres/defaultsettings/DateNnUniqueCheckPk.go new file mode 100644 index 00000000..162ceee5 --- /dev/null +++ b/internal/integration_tests/postgres/defaultsettings/DateNnUniqueCheckPk.go @@ -0,0 +1,9 @@ +package dto + +import ( + "time" +) + +type DateNnUniqueCheckPk struct { + DateNnUniqueCheckPk time.Time `db:"date_nn_unique_check_pk"` +} diff --git a/internal/integration_tests/postgres/defaultsettings/DateNnUniqueCheckPkRef.go b/internal/integration_tests/postgres/defaultsettings/DateNnUniqueCheckPkRef.go new file mode 100644 index 00000000..57c61fce --- /dev/null +++ b/internal/integration_tests/postgres/defaultsettings/DateNnUniqueCheckPkRef.go @@ -0,0 +1,9 @@ +package dto + +import ( + "time" +) + +type DateNnUniqueCheckPkRef struct { + DateNnUniqueCheckPkRef time.Time `db:"date_nn_unique_check_pk_ref"` +} diff --git a/internal/integration_tests/postgres/defaultsettings/DatePk.go b/internal/integration_tests/postgres/defaultsettings/DatePk.go new file mode 100644 index 00000000..d006be42 --- /dev/null +++ b/internal/integration_tests/postgres/defaultsettings/DatePk.go @@ -0,0 +1,9 @@ +package dto + +import ( + "time" +) + +type DatePk struct { + DatePk time.Time `db:"date_pk"` +} diff --git a/internal/integration_tests/postgres/defaultsettings/DatePkDefConst.go b/internal/integration_tests/postgres/defaultsettings/DatePkDefConst.go new file mode 100644 index 00000000..b10866e0 --- /dev/null +++ b/internal/integration_tests/postgres/defaultsettings/DatePkDefConst.go @@ -0,0 +1,9 @@ +package dto + +import ( + "time" +) + +type DatePkDefConst struct { + DatePkDefConst time.Time `db:"date_pk_def_const"` +} diff --git a/internal/integration_tests/postgres/defaultsettings/DatePkDefFunc.go b/internal/integration_tests/postgres/defaultsettings/DatePkDefFunc.go new file mode 100644 index 00000000..133d388a --- /dev/null +++ b/internal/integration_tests/postgres/defaultsettings/DatePkDefFunc.go @@ -0,0 +1,9 @@ +package dto + +import ( + "time" +) + +type DatePkDefFunc struct { + DatePkDefFunc time.Time `db:"date_pk_def_func"` +} diff --git a/internal/integration_tests/postgres/defaultsettings/DatePkRef.go b/internal/integration_tests/postgres/defaultsettings/DatePkRef.go new file mode 100644 index 00000000..e4f6d521 --- /dev/null +++ b/internal/integration_tests/postgres/defaultsettings/DatePkRef.go @@ -0,0 +1,9 @@ +package dto + +import ( + "time" +) + +type DatePkRef struct { + DatePkRef time.Time `db:"date_pk_ref"` +} diff --git a/internal/integration_tests/postgres/defaultsettings/DateRef.go b/internal/integration_tests/postgres/defaultsettings/DateRef.go new file mode 100644 index 00000000..aef0b9fa --- /dev/null +++ b/internal/integration_tests/postgres/defaultsettings/DateRef.go @@ -0,0 +1,9 @@ +package dto + +import ( + "database/sql" +) + +type DateRef struct { + DateRef sql.NullTime `db:"date_ref"` +} diff --git a/internal/integration_tests/postgres/defaultsettings/DateUniqueCheckPk.go b/internal/integration_tests/postgres/defaultsettings/DateUniqueCheckPk.go new file mode 100644 index 00000000..de81a9ee --- /dev/null +++ b/internal/integration_tests/postgres/defaultsettings/DateUniqueCheckPk.go @@ -0,0 +1,9 @@ +package dto + +import ( + "time" +) + +type DateUniqueCheckPk struct { + DateUniqueCheckPk time.Time `db:"date_unique_check_pk"` +} diff --git a/internal/integration_tests/postgres/defaultsettings/DateUniqueCheckPkRef.go b/internal/integration_tests/postgres/defaultsettings/DateUniqueCheckPkRef.go new file mode 100644 index 00000000..9c44f9cd --- /dev/null +++ b/internal/integration_tests/postgres/defaultsettings/DateUniqueCheckPkRef.go @@ -0,0 +1,9 @@ +package dto + +import ( + "time" +) + +type DateUniqueCheckPkRef struct { + DateUniqueCheckPkRef time.Time `db:"date_unique_check_pk_ref"` +} diff --git a/internal/integration_tests/postgres/defaultsettings/DateUniquePk.go b/internal/integration_tests/postgres/defaultsettings/DateUniquePk.go new file mode 100644 index 00000000..8a2081d9 --- /dev/null +++ b/internal/integration_tests/postgres/defaultsettings/DateUniquePk.go @@ -0,0 +1,9 @@ +package dto + +import ( + "time" +) + +type DateUniquePk struct { + DateUniquePk time.Time `db:"date_unique_pk"` +} diff --git a/internal/integration_tests/postgres/defaultsettings/Decimal.go b/internal/integration_tests/postgres/defaultsettings/Decimal.go new file mode 100644 index 00000000..e661b8a4 --- /dev/null +++ b/internal/integration_tests/postgres/defaultsettings/Decimal.go @@ -0,0 +1,33 @@ +package dto + +import ( + "database/sql" +) + +type Decimal struct { + Decimal sql.NullFloat64 `db:"decimal"` + DecimalNn float64 `db:"decimal_nn"` + DecimalNnUnique float64 `db:"decimal_nn_unique"` + DecimalNnCheck float64 `db:"decimal_nn_check"` + DecimalNnRef float64 `db:"decimal_nn_ref"` + DecimalNnDefConst float64 `db:"decimal_nn_def_const"` + DecimalNnDefFunc float64 `db:"decimal_nn_def_func"` + DecimalNnUniqueCheck float64 `db:"decimal_nn_unique_check"` + DecimalUnique sql.NullFloat64 `db:"decimal_unique"` + DecimalUniqueCheck sql.NullFloat64 `db:"decimal_unique_check"` + DecimalUniqueRef sql.NullFloat64 `db:"decimal_unique_ref"` + DecimalUniqueDefConst sql.NullFloat64 `db:"decimal_unique_def_const"` + DecimalUniqueDefFunc sql.NullFloat64 `db:"decimal_unique_def_func"` + DecimalCheck sql.NullFloat64 `db:"decimal_check"` + DecimalCheckRef sql.NullFloat64 `db:"decimal_check_ref"` + DecimalCheckDefConst sql.NullFloat64 `db:"decimal_check_def_const"` + DecimalCheckDefFunc sql.NullFloat64 `db:"decimal_check_def_func"` + DecimalRef sql.NullFloat64 `db:"decimal_ref"` + DecimalRefDefConst sql.NullFloat64 `db:"decimal_ref_def_const"` + DecimalRefDefFunc sql.NullFloat64 `db:"decimal_ref_def_func"` + DecimalRefUniqueCheck sql.NullFloat64 `db:"decimal_ref_unique_check"` + DecimalDefConst sql.NullFloat64 `db:"decimal_def_const"` + DecimalDefConstUniqueCheck sql.NullFloat64 `db:"decimal_def_const_unique_check"` + DecimalDefFunc sql.NullFloat64 `db:"decimal_def_func"` + DecimalDefFuncUniqueCheck sql.NullFloat64 `db:"decimal_def_func_unique_check"` +} diff --git a/internal/integration_tests/postgres/defaultsettings/DecimalCheckPk.go b/internal/integration_tests/postgres/defaultsettings/DecimalCheckPk.go new file mode 100644 index 00000000..e51ea81a --- /dev/null +++ b/internal/integration_tests/postgres/defaultsettings/DecimalCheckPk.go @@ -0,0 +1,5 @@ +package dto + +type DecimalCheckPk struct { + DecimalCheckPk float64 `db:"decimal_check_pk"` +} diff --git a/internal/integration_tests/postgres/defaultsettings/DecimalDefConstUniqueCheckPk.go b/internal/integration_tests/postgres/defaultsettings/DecimalDefConstUniqueCheckPk.go new file mode 100644 index 00000000..725b1900 --- /dev/null +++ b/internal/integration_tests/postgres/defaultsettings/DecimalDefConstUniqueCheckPk.go @@ -0,0 +1,5 @@ +package dto + +type DecimalDefConstUniqueCheckPk struct { + DecimalDefConstUniqueCheckPk float64 `db:"decimal_def_const_unique_check_pk"` +} diff --git a/internal/integration_tests/postgres/defaultsettings/DecimalDefConstUniqueCheckPkRef.go b/internal/integration_tests/postgres/defaultsettings/DecimalDefConstUniqueCheckPkRef.go new file mode 100644 index 00000000..47a13f96 --- /dev/null +++ b/internal/integration_tests/postgres/defaultsettings/DecimalDefConstUniqueCheckPkRef.go @@ -0,0 +1,5 @@ +package dto + +type DecimalDefConstUniqueCheckPkRef struct { + DecimalDefConstUniqueCheckPkRef float64 `db:"decimal_def_const_unique_check_pk_ref"` +} diff --git a/internal/integration_tests/postgres/defaultsettings/DecimalDefFuncUniqueCheckPk.go b/internal/integration_tests/postgres/defaultsettings/DecimalDefFuncUniqueCheckPk.go new file mode 100644 index 00000000..689faf76 --- /dev/null +++ b/internal/integration_tests/postgres/defaultsettings/DecimalDefFuncUniqueCheckPk.go @@ -0,0 +1,5 @@ +package dto + +type DecimalDefFuncUniqueCheckPk struct { + DecimalDefFuncUniqueCheckPk float64 `db:"decimal_def_func_unique_check_pk"` +} diff --git a/internal/integration_tests/postgres/defaultsettings/DecimalDefFuncUniqueCheckPkRef.go b/internal/integration_tests/postgres/defaultsettings/DecimalDefFuncUniqueCheckPkRef.go new file mode 100644 index 00000000..212509c5 --- /dev/null +++ b/internal/integration_tests/postgres/defaultsettings/DecimalDefFuncUniqueCheckPkRef.go @@ -0,0 +1,5 @@ +package dto + +type DecimalDefFuncUniqueCheckPkRef struct { + DecimalDefFuncUniqueCheckPkRef float64 `db:"decimal_def_func_unique_check_pk_ref"` +} diff --git a/internal/integration_tests/postgres/defaultsettings/DecimalNnPk.go b/internal/integration_tests/postgres/defaultsettings/DecimalNnPk.go new file mode 100644 index 00000000..cd8f4912 --- /dev/null +++ b/internal/integration_tests/postgres/defaultsettings/DecimalNnPk.go @@ -0,0 +1,5 @@ +package dto + +type DecimalNnPk struct { + DecimalNnPk float64 `db:"decimal_nn_pk"` +} diff --git a/internal/integration_tests/postgres/defaultsettings/DecimalNnUniqueCheckPk.go b/internal/integration_tests/postgres/defaultsettings/DecimalNnUniqueCheckPk.go new file mode 100644 index 00000000..fa82e68b --- /dev/null +++ b/internal/integration_tests/postgres/defaultsettings/DecimalNnUniqueCheckPk.go @@ -0,0 +1,5 @@ +package dto + +type DecimalNnUniqueCheckPk struct { + DecimalNnUniqueCheckPk float64 `db:"decimal_nn_unique_check_pk"` +} diff --git a/internal/integration_tests/postgres/defaultsettings/DecimalNnUniqueCheckPkRef.go b/internal/integration_tests/postgres/defaultsettings/DecimalNnUniqueCheckPkRef.go new file mode 100644 index 00000000..f9003bf2 --- /dev/null +++ b/internal/integration_tests/postgres/defaultsettings/DecimalNnUniqueCheckPkRef.go @@ -0,0 +1,5 @@ +package dto + +type DecimalNnUniqueCheckPkRef struct { + DecimalNnUniqueCheckPkRef float64 `db:"decimal_nn_unique_check_pk_ref"` +} diff --git a/internal/integration_tests/postgres/defaultsettings/DecimalPk.go b/internal/integration_tests/postgres/defaultsettings/DecimalPk.go new file mode 100644 index 00000000..42a811a1 --- /dev/null +++ b/internal/integration_tests/postgres/defaultsettings/DecimalPk.go @@ -0,0 +1,5 @@ +package dto + +type DecimalPk struct { + DecimalPk float64 `db:"decimal_pk"` +} diff --git a/internal/integration_tests/postgres/defaultsettings/DecimalPkDefConst.go b/internal/integration_tests/postgres/defaultsettings/DecimalPkDefConst.go new file mode 100644 index 00000000..844cf9d1 --- /dev/null +++ b/internal/integration_tests/postgres/defaultsettings/DecimalPkDefConst.go @@ -0,0 +1,5 @@ +package dto + +type DecimalPkDefConst struct { + DecimalPkDefConst float64 `db:"decimal_pk_def_const"` +} diff --git a/internal/integration_tests/postgres/defaultsettings/DecimalPkDefFunc.go b/internal/integration_tests/postgres/defaultsettings/DecimalPkDefFunc.go new file mode 100644 index 00000000..82ec62c8 --- /dev/null +++ b/internal/integration_tests/postgres/defaultsettings/DecimalPkDefFunc.go @@ -0,0 +1,5 @@ +package dto + +type DecimalPkDefFunc struct { + DecimalPkDefFunc float64 `db:"decimal_pk_def_func"` +} diff --git a/internal/integration_tests/postgres/defaultsettings/DecimalPkRef.go b/internal/integration_tests/postgres/defaultsettings/DecimalPkRef.go new file mode 100644 index 00000000..bd5ef076 --- /dev/null +++ b/internal/integration_tests/postgres/defaultsettings/DecimalPkRef.go @@ -0,0 +1,5 @@ +package dto + +type DecimalPkRef struct { + DecimalPkRef float64 `db:"decimal_pk_ref"` +} diff --git a/internal/integration_tests/postgres/defaultsettings/DecimalRef.go b/internal/integration_tests/postgres/defaultsettings/DecimalRef.go new file mode 100644 index 00000000..2b6e7a24 --- /dev/null +++ b/internal/integration_tests/postgres/defaultsettings/DecimalRef.go @@ -0,0 +1,9 @@ +package dto + +import ( + "database/sql" +) + +type DecimalRef struct { + DecimalRef sql.NullFloat64 `db:"decimal_ref"` +} diff --git a/internal/integration_tests/postgres/defaultsettings/DecimalUniqueCheckPk.go b/internal/integration_tests/postgres/defaultsettings/DecimalUniqueCheckPk.go new file mode 100644 index 00000000..f6df5c3e --- /dev/null +++ b/internal/integration_tests/postgres/defaultsettings/DecimalUniqueCheckPk.go @@ -0,0 +1,5 @@ +package dto + +type DecimalUniqueCheckPk struct { + DecimalUniqueCheckPk float64 `db:"decimal_unique_check_pk"` +} diff --git a/internal/integration_tests/postgres/defaultsettings/DecimalUniqueCheckPkRef.go b/internal/integration_tests/postgres/defaultsettings/DecimalUniqueCheckPkRef.go new file mode 100644 index 00000000..c94f982e --- /dev/null +++ b/internal/integration_tests/postgres/defaultsettings/DecimalUniqueCheckPkRef.go @@ -0,0 +1,5 @@ +package dto + +type DecimalUniqueCheckPkRef struct { + DecimalUniqueCheckPkRef float64 `db:"decimal_unique_check_pk_ref"` +} diff --git a/internal/integration_tests/postgres/defaultsettings/DecimalUniquePk.go b/internal/integration_tests/postgres/defaultsettings/DecimalUniquePk.go new file mode 100644 index 00000000..ca299e19 --- /dev/null +++ b/internal/integration_tests/postgres/defaultsettings/DecimalUniquePk.go @@ -0,0 +1,5 @@ +package dto + +type DecimalUniquePk struct { + DecimalUniquePk float64 `db:"decimal_unique_pk"` +} diff --git a/internal/integration_tests/postgres/defaultsettings/DoublePrecision.go b/internal/integration_tests/postgres/defaultsettings/DoublePrecision.go new file mode 100644 index 00000000..5f3f6b77 --- /dev/null +++ b/internal/integration_tests/postgres/defaultsettings/DoublePrecision.go @@ -0,0 +1,33 @@ +package dto + +import ( + "database/sql" +) + +type DoublePrecision struct { + DoublePrecision sql.NullFloat64 `db:"double_precision"` + DoublePrecisionNn float64 `db:"double_precision_nn"` + DoublePrecisionNnUnique float64 `db:"double_precision_nn_unique"` + DoublePrecisionNnCheck float64 `db:"double_precision_nn_check"` + DoublePrecisionNnRef float64 `db:"double_precision_nn_ref"` + DoublePrecisionNnDefConst float64 `db:"double_precision_nn_def_const"` + DoublePrecisionNnDefFunc float64 `db:"double_precision_nn_def_func"` + DoublePrecisionNnUniqueCheck float64 `db:"double_precision_nn_unique_check"` + DoublePrecisionUnique sql.NullFloat64 `db:"double_precision_unique"` + DoublePrecisionUniqueCheck sql.NullFloat64 `db:"double_precision_unique_check"` + DoublePrecisionUniqueRef sql.NullFloat64 `db:"double_precision_unique_ref"` + DoublePrecisionUniqueDefConst sql.NullFloat64 `db:"double_precision_unique_def_const"` + DoublePrecisionUniqueDefFunc sql.NullFloat64 `db:"double_precision_unique_def_func"` + DoublePrecisionCheck sql.NullFloat64 `db:"double_precision_check"` + DoublePrecisionCheckRef sql.NullFloat64 `db:"double_precision_check_ref"` + DoublePrecisionCheckDefConst sql.NullFloat64 `db:"double_precision_check_def_const"` + DoublePrecisionCheckDefFunc sql.NullFloat64 `db:"double_precision_check_def_func"` + DoublePrecisionRef sql.NullFloat64 `db:"double_precision_ref"` + DoublePrecisionRefDefConst sql.NullFloat64 `db:"double_precision_ref_def_const"` + DoublePrecisionRefDefFunc sql.NullFloat64 `db:"double_precision_ref_def_func"` + DoublePrecisionRefUniqueCheck sql.NullFloat64 `db:"double_precision_ref_unique_check"` + DoublePrecisionDefConst sql.NullFloat64 `db:"double_precision_def_const"` + DoublePrecisionDefConstUniqueCheck sql.NullFloat64 `db:"double_precision_def_const_unique_check"` + DoublePrecisionDefFunc sql.NullFloat64 `db:"double_precision_def_func"` + DoublePrecisionDefFuncUniqueCheck sql.NullFloat64 `db:"double_precision_def_func_unique_check"` +} diff --git a/internal/integration_tests/postgres/defaultsettings/DoublePrecisionCheckPk.go b/internal/integration_tests/postgres/defaultsettings/DoublePrecisionCheckPk.go new file mode 100644 index 00000000..b371f477 --- /dev/null +++ b/internal/integration_tests/postgres/defaultsettings/DoublePrecisionCheckPk.go @@ -0,0 +1,5 @@ +package dto + +type DoublePrecisionCheckPk struct { + DoublePrecisionCheckPk float64 `db:"double_precision_check_pk"` +} diff --git a/internal/integration_tests/postgres/defaultsettings/DoublePrecisionDefConstUniqueCheckPk.go b/internal/integration_tests/postgres/defaultsettings/DoublePrecisionDefConstUniqueCheckPk.go new file mode 100644 index 00000000..aed14fe8 --- /dev/null +++ b/internal/integration_tests/postgres/defaultsettings/DoublePrecisionDefConstUniqueCheckPk.go @@ -0,0 +1,5 @@ +package dto + +type DoublePrecisionDefConstUniqueCheckPk struct { + DoublePrecisionDefConstUniqueCheckPk float64 `db:"double_precision_def_const_unique_check_pk"` +} diff --git a/internal/integration_tests/postgres/defaultsettings/DoublePrecisionDefConstUniqueCheckPkRef.go b/internal/integration_tests/postgres/defaultsettings/DoublePrecisionDefConstUniqueCheckPkRef.go new file mode 100644 index 00000000..f3fd6f6f --- /dev/null +++ b/internal/integration_tests/postgres/defaultsettings/DoublePrecisionDefConstUniqueCheckPkRef.go @@ -0,0 +1,5 @@ +package dto + +type DoublePrecisionDefConstUniqueCheckPkRef struct { + DoublePrecisionDefConstUniqueCheckPkRef float64 `db:"double_precision_def_const_unique_check_pk_ref"` +} diff --git a/internal/integration_tests/postgres/defaultsettings/DoublePrecisionDefFuncUniqueCheckPk.go b/internal/integration_tests/postgres/defaultsettings/DoublePrecisionDefFuncUniqueCheckPk.go new file mode 100644 index 00000000..d868ad99 --- /dev/null +++ b/internal/integration_tests/postgres/defaultsettings/DoublePrecisionDefFuncUniqueCheckPk.go @@ -0,0 +1,5 @@ +package dto + +type DoublePrecisionDefFuncUniqueCheckPk struct { + DoublePrecisionDefFuncUniqueCheckPk float64 `db:"double_precision_def_func_unique_check_pk"` +} diff --git a/internal/integration_tests/postgres/defaultsettings/DoublePrecisionDefFuncUniqueCheckPkRef.go b/internal/integration_tests/postgres/defaultsettings/DoublePrecisionDefFuncUniqueCheckPkRef.go new file mode 100644 index 00000000..cfc1fd16 --- /dev/null +++ b/internal/integration_tests/postgres/defaultsettings/DoublePrecisionDefFuncUniqueCheckPkRef.go @@ -0,0 +1,5 @@ +package dto + +type DoublePrecisionDefFuncUniqueCheckPkRef struct { + DoublePrecisionDefFuncUniqueCheckPkRef float64 `db:"double_precision_def_func_unique_check_pk_ref"` +} diff --git a/internal/integration_tests/postgres/defaultsettings/DoublePrecisionNnPk.go b/internal/integration_tests/postgres/defaultsettings/DoublePrecisionNnPk.go new file mode 100644 index 00000000..cdd85c7c --- /dev/null +++ b/internal/integration_tests/postgres/defaultsettings/DoublePrecisionNnPk.go @@ -0,0 +1,5 @@ +package dto + +type DoublePrecisionNnPk struct { + DoublePrecisionNnPk float64 `db:"double_precision_nn_pk"` +} diff --git a/internal/integration_tests/postgres/defaultsettings/DoublePrecisionNnUniqueCheckPk.go b/internal/integration_tests/postgres/defaultsettings/DoublePrecisionNnUniqueCheckPk.go new file mode 100644 index 00000000..4c6f76fd --- /dev/null +++ b/internal/integration_tests/postgres/defaultsettings/DoublePrecisionNnUniqueCheckPk.go @@ -0,0 +1,5 @@ +package dto + +type DoublePrecisionNnUniqueCheckPk struct { + DoublePrecisionNnUniqueCheckPk float64 `db:"double_precision_nn_unique_check_pk"` +} diff --git a/internal/integration_tests/postgres/defaultsettings/DoublePrecisionNnUniqueCheckPkRef.go b/internal/integration_tests/postgres/defaultsettings/DoublePrecisionNnUniqueCheckPkRef.go new file mode 100644 index 00000000..46f9308c --- /dev/null +++ b/internal/integration_tests/postgres/defaultsettings/DoublePrecisionNnUniqueCheckPkRef.go @@ -0,0 +1,5 @@ +package dto + +type DoublePrecisionNnUniqueCheckPkRef struct { + DoublePrecisionNnUniqueCheckPkRef float64 `db:"double_precision_nn_unique_check_pk_ref"` +} diff --git a/internal/integration_tests/postgres/defaultsettings/DoublePrecisionPk.go b/internal/integration_tests/postgres/defaultsettings/DoublePrecisionPk.go new file mode 100644 index 00000000..dd4230cd --- /dev/null +++ b/internal/integration_tests/postgres/defaultsettings/DoublePrecisionPk.go @@ -0,0 +1,5 @@ +package dto + +type DoublePrecisionPk struct { + DoublePrecisionPk float64 `db:"double_precision_pk"` +} diff --git a/internal/integration_tests/postgres/defaultsettings/DoublePrecisionPkDefConst.go b/internal/integration_tests/postgres/defaultsettings/DoublePrecisionPkDefConst.go new file mode 100644 index 00000000..88e67c92 --- /dev/null +++ b/internal/integration_tests/postgres/defaultsettings/DoublePrecisionPkDefConst.go @@ -0,0 +1,5 @@ +package dto + +type DoublePrecisionPkDefConst struct { + DoublePrecisionPkDefConst float64 `db:"double_precision_pk_def_const"` +} diff --git a/internal/integration_tests/postgres/defaultsettings/DoublePrecisionPkDefFunc.go b/internal/integration_tests/postgres/defaultsettings/DoublePrecisionPkDefFunc.go new file mode 100644 index 00000000..a61e3112 --- /dev/null +++ b/internal/integration_tests/postgres/defaultsettings/DoublePrecisionPkDefFunc.go @@ -0,0 +1,5 @@ +package dto + +type DoublePrecisionPkDefFunc struct { + DoublePrecisionPkDefFunc float64 `db:"double_precision_pk_def_func"` +} diff --git a/internal/integration_tests/postgres/defaultsettings/DoublePrecisionPkRef.go b/internal/integration_tests/postgres/defaultsettings/DoublePrecisionPkRef.go new file mode 100644 index 00000000..0ef20e93 --- /dev/null +++ b/internal/integration_tests/postgres/defaultsettings/DoublePrecisionPkRef.go @@ -0,0 +1,5 @@ +package dto + +type DoublePrecisionPkRef struct { + DoublePrecisionPkRef float64 `db:"double_precision_pk_ref"` +} diff --git a/internal/integration_tests/postgres/defaultsettings/DoublePrecisionRef.go b/internal/integration_tests/postgres/defaultsettings/DoublePrecisionRef.go new file mode 100644 index 00000000..569451b6 --- /dev/null +++ b/internal/integration_tests/postgres/defaultsettings/DoublePrecisionRef.go @@ -0,0 +1,9 @@ +package dto + +import ( + "database/sql" +) + +type DoublePrecisionRef struct { + DoublePrecisionRef sql.NullFloat64 `db:"double_precision_ref"` +} diff --git a/internal/integration_tests/postgres/defaultsettings/DoublePrecisionUniqueCheckPk.go b/internal/integration_tests/postgres/defaultsettings/DoublePrecisionUniqueCheckPk.go new file mode 100644 index 00000000..3e3cf20b --- /dev/null +++ b/internal/integration_tests/postgres/defaultsettings/DoublePrecisionUniqueCheckPk.go @@ -0,0 +1,5 @@ +package dto + +type DoublePrecisionUniqueCheckPk struct { + DoublePrecisionUniqueCheckPk float64 `db:"double_precision_unique_check_pk"` +} diff --git a/internal/integration_tests/postgres/defaultsettings/DoublePrecisionUniqueCheckPkRef.go b/internal/integration_tests/postgres/defaultsettings/DoublePrecisionUniqueCheckPkRef.go new file mode 100644 index 00000000..3655f585 --- /dev/null +++ b/internal/integration_tests/postgres/defaultsettings/DoublePrecisionUniqueCheckPkRef.go @@ -0,0 +1,5 @@ +package dto + +type DoublePrecisionUniqueCheckPkRef struct { + DoublePrecisionUniqueCheckPkRef float64 `db:"double_precision_unique_check_pk_ref"` +} diff --git a/internal/integration_tests/postgres/defaultsettings/DoublePrecisionUniquePk.go b/internal/integration_tests/postgres/defaultsettings/DoublePrecisionUniquePk.go new file mode 100644 index 00000000..df2b18cc --- /dev/null +++ b/internal/integration_tests/postgres/defaultsettings/DoublePrecisionUniquePk.go @@ -0,0 +1,5 @@ +package dto + +type DoublePrecisionUniquePk struct { + DoublePrecisionUniquePk float64 `db:"double_precision_unique_pk"` +} diff --git a/internal/integration_tests/postgres/defaultsettings/Float.go b/internal/integration_tests/postgres/defaultsettings/Float.go new file mode 100644 index 00000000..2cd5e08e --- /dev/null +++ b/internal/integration_tests/postgres/defaultsettings/Float.go @@ -0,0 +1,33 @@ +package dto + +import ( + "database/sql" +) + +type Float struct { + Float sql.NullFloat64 `db:"float"` + FloatNn float64 `db:"float_nn"` + FloatNnUnique float64 `db:"float_nn_unique"` + FloatNnCheck float64 `db:"float_nn_check"` + FloatNnRef float64 `db:"float_nn_ref"` + FloatNnDefConst float64 `db:"float_nn_def_const"` + FloatNnDefFunc float64 `db:"float_nn_def_func"` + FloatNnUniqueCheck float64 `db:"float_nn_unique_check"` + FloatUnique sql.NullFloat64 `db:"float_unique"` + FloatUniqueCheck sql.NullFloat64 `db:"float_unique_check"` + FloatUniqueRef sql.NullFloat64 `db:"float_unique_ref"` + FloatUniqueDefConst sql.NullFloat64 `db:"float_unique_def_const"` + FloatUniqueDefFunc sql.NullFloat64 `db:"float_unique_def_func"` + FloatCheck sql.NullFloat64 `db:"float_check"` + FloatCheckRef sql.NullFloat64 `db:"float_check_ref"` + FloatCheckDefConst sql.NullFloat64 `db:"float_check_def_const"` + FloatCheckDefFunc sql.NullFloat64 `db:"float_check_def_func"` + FloatRef sql.NullFloat64 `db:"float_ref"` + FloatRefDefConst sql.NullFloat64 `db:"float_ref_def_const"` + FloatRefDefFunc sql.NullFloat64 `db:"float_ref_def_func"` + FloatRefUniqueCheck sql.NullFloat64 `db:"float_ref_unique_check"` + FloatDefConst sql.NullFloat64 `db:"float_def_const"` + FloatDefConstUniqueCheck sql.NullFloat64 `db:"float_def_const_unique_check"` + FloatDefFunc sql.NullFloat64 `db:"float_def_func"` + FloatDefFuncUniqueCheck sql.NullFloat64 `db:"float_def_func_unique_check"` +} diff --git a/internal/integration_tests/postgres/defaultsettings/Float4.go b/internal/integration_tests/postgres/defaultsettings/Float4.go new file mode 100644 index 00000000..ab0bf967 --- /dev/null +++ b/internal/integration_tests/postgres/defaultsettings/Float4.go @@ -0,0 +1,33 @@ +package dto + +import ( + "database/sql" +) + +type Float4 struct { + Float4 sql.NullFloat64 `db:"float4"` + Float4Nn float64 `db:"float4_nn"` + Float4NnUnique float64 `db:"float4_nn_unique"` + Float4NnCheck float64 `db:"float4_nn_check"` + Float4NnRef float64 `db:"float4_nn_ref"` + Float4NnDefConst float64 `db:"float4_nn_def_const"` + Float4NnDefFunc float64 `db:"float4_nn_def_func"` + Float4NnUniqueCheck float64 `db:"float4_nn_unique_check"` + Float4Unique sql.NullFloat64 `db:"float4_unique"` + Float4UniqueCheck sql.NullFloat64 `db:"float4_unique_check"` + Float4UniqueRef sql.NullFloat64 `db:"float4_unique_ref"` + Float4UniqueDefConst sql.NullFloat64 `db:"float4_unique_def_const"` + Float4UniqueDefFunc sql.NullFloat64 `db:"float4_unique_def_func"` + Float4Check sql.NullFloat64 `db:"float4_check"` + Float4CheckRef sql.NullFloat64 `db:"float4_check_ref"` + Float4CheckDefConst sql.NullFloat64 `db:"float4_check_def_const"` + Float4CheckDefFunc sql.NullFloat64 `db:"float4_check_def_func"` + Float4Ref sql.NullFloat64 `db:"float4_ref"` + Float4RefDefConst sql.NullFloat64 `db:"float4_ref_def_const"` + Float4RefDefFunc sql.NullFloat64 `db:"float4_ref_def_func"` + Float4RefUniqueCheck sql.NullFloat64 `db:"float4_ref_unique_check"` + Float4DefConst sql.NullFloat64 `db:"float4_def_const"` + Float4DefConstUniqueCheck sql.NullFloat64 `db:"float4_def_const_unique_check"` + Float4DefFunc sql.NullFloat64 `db:"float4_def_func"` + Float4DefFuncUniqueCheck sql.NullFloat64 `db:"float4_def_func_unique_check"` +} diff --git a/internal/integration_tests/postgres/defaultsettings/Float4CheckPk.go b/internal/integration_tests/postgres/defaultsettings/Float4CheckPk.go new file mode 100644 index 00000000..232871a2 --- /dev/null +++ b/internal/integration_tests/postgres/defaultsettings/Float4CheckPk.go @@ -0,0 +1,5 @@ +package dto + +type Float4CheckPk struct { + Float4CheckPk float64 `db:"float4_check_pk"` +} diff --git a/internal/integration_tests/postgres/defaultsettings/Float4DefConstUniqueCheckPk.go b/internal/integration_tests/postgres/defaultsettings/Float4DefConstUniqueCheckPk.go new file mode 100644 index 00000000..aecebcfc --- /dev/null +++ b/internal/integration_tests/postgres/defaultsettings/Float4DefConstUniqueCheckPk.go @@ -0,0 +1,5 @@ +package dto + +type Float4DefConstUniqueCheckPk struct { + Float4DefConstUniqueCheckPk float64 `db:"float4_def_const_unique_check_pk"` +} diff --git a/internal/integration_tests/postgres/defaultsettings/Float4DefConstUniqueCheckPkRef.go b/internal/integration_tests/postgres/defaultsettings/Float4DefConstUniqueCheckPkRef.go new file mode 100644 index 00000000..c3536b06 --- /dev/null +++ b/internal/integration_tests/postgres/defaultsettings/Float4DefConstUniqueCheckPkRef.go @@ -0,0 +1,5 @@ +package dto + +type Float4DefConstUniqueCheckPkRef struct { + Float4DefConstUniqueCheckPkRef float64 `db:"float4_def_const_unique_check_pk_ref"` +} diff --git a/internal/integration_tests/postgres/defaultsettings/Float4DefFuncUniqueCheckPk.go b/internal/integration_tests/postgres/defaultsettings/Float4DefFuncUniqueCheckPk.go new file mode 100644 index 00000000..35543a4f --- /dev/null +++ b/internal/integration_tests/postgres/defaultsettings/Float4DefFuncUniqueCheckPk.go @@ -0,0 +1,5 @@ +package dto + +type Float4DefFuncUniqueCheckPk struct { + Float4DefFuncUniqueCheckPk float64 `db:"float4_def_func_unique_check_pk"` +} diff --git a/internal/integration_tests/postgres/defaultsettings/Float4DefFuncUniqueCheckPkRef.go b/internal/integration_tests/postgres/defaultsettings/Float4DefFuncUniqueCheckPkRef.go new file mode 100644 index 00000000..9cee3cd2 --- /dev/null +++ b/internal/integration_tests/postgres/defaultsettings/Float4DefFuncUniqueCheckPkRef.go @@ -0,0 +1,5 @@ +package dto + +type Float4DefFuncUniqueCheckPkRef struct { + Float4DefFuncUniqueCheckPkRef float64 `db:"float4_def_func_unique_check_pk_ref"` +} diff --git a/internal/integration_tests/postgres/defaultsettings/Float4NnPk.go b/internal/integration_tests/postgres/defaultsettings/Float4NnPk.go new file mode 100644 index 00000000..8f47359a --- /dev/null +++ b/internal/integration_tests/postgres/defaultsettings/Float4NnPk.go @@ -0,0 +1,5 @@ +package dto + +type Float4NnPk struct { + Float4NnPk float64 `db:"float4_nn_pk"` +} diff --git a/internal/integration_tests/postgres/defaultsettings/Float4NnUniqueCheckPk.go b/internal/integration_tests/postgres/defaultsettings/Float4NnUniqueCheckPk.go new file mode 100644 index 00000000..95a57d4a --- /dev/null +++ b/internal/integration_tests/postgres/defaultsettings/Float4NnUniqueCheckPk.go @@ -0,0 +1,5 @@ +package dto + +type Float4NnUniqueCheckPk struct { + Float4NnUniqueCheckPk float64 `db:"float4_nn_unique_check_pk"` +} diff --git a/internal/integration_tests/postgres/defaultsettings/Float4NnUniqueCheckPkRef.go b/internal/integration_tests/postgres/defaultsettings/Float4NnUniqueCheckPkRef.go new file mode 100644 index 00000000..b10e51e6 --- /dev/null +++ b/internal/integration_tests/postgres/defaultsettings/Float4NnUniqueCheckPkRef.go @@ -0,0 +1,5 @@ +package dto + +type Float4NnUniqueCheckPkRef struct { + Float4NnUniqueCheckPkRef float64 `db:"float4_nn_unique_check_pk_ref"` +} diff --git a/internal/integration_tests/postgres/defaultsettings/Float4Pk.go b/internal/integration_tests/postgres/defaultsettings/Float4Pk.go new file mode 100644 index 00000000..ee8c6d34 --- /dev/null +++ b/internal/integration_tests/postgres/defaultsettings/Float4Pk.go @@ -0,0 +1,5 @@ +package dto + +type Float4Pk struct { + Float4Pk float64 `db:"float4_pk"` +} diff --git a/internal/integration_tests/postgres/defaultsettings/Float4PkDefConst.go b/internal/integration_tests/postgres/defaultsettings/Float4PkDefConst.go new file mode 100644 index 00000000..9a5df2a4 --- /dev/null +++ b/internal/integration_tests/postgres/defaultsettings/Float4PkDefConst.go @@ -0,0 +1,5 @@ +package dto + +type Float4PkDefConst struct { + Float4PkDefConst float64 `db:"float4_pk_def_const"` +} diff --git a/internal/integration_tests/postgres/defaultsettings/Float4PkDefFunc.go b/internal/integration_tests/postgres/defaultsettings/Float4PkDefFunc.go new file mode 100644 index 00000000..3d43a5a1 --- /dev/null +++ b/internal/integration_tests/postgres/defaultsettings/Float4PkDefFunc.go @@ -0,0 +1,5 @@ +package dto + +type Float4PkDefFunc struct { + Float4PkDefFunc float64 `db:"float4_pk_def_func"` +} diff --git a/internal/integration_tests/postgres/defaultsettings/Float4PkRef.go b/internal/integration_tests/postgres/defaultsettings/Float4PkRef.go new file mode 100644 index 00000000..ee7d8c12 --- /dev/null +++ b/internal/integration_tests/postgres/defaultsettings/Float4PkRef.go @@ -0,0 +1,5 @@ +package dto + +type Float4PkRef struct { + Float4PkRef float64 `db:"float4_pk_ref"` +} diff --git a/internal/integration_tests/postgres/defaultsettings/Float4Ref.go b/internal/integration_tests/postgres/defaultsettings/Float4Ref.go new file mode 100644 index 00000000..1408f6bf --- /dev/null +++ b/internal/integration_tests/postgres/defaultsettings/Float4Ref.go @@ -0,0 +1,9 @@ +package dto + +import ( + "database/sql" +) + +type Float4Ref struct { + Float4Ref sql.NullFloat64 `db:"float4_ref"` +} diff --git a/internal/integration_tests/postgres/defaultsettings/Float4UniqueCheckPk.go b/internal/integration_tests/postgres/defaultsettings/Float4UniqueCheckPk.go new file mode 100644 index 00000000..6d4cd238 --- /dev/null +++ b/internal/integration_tests/postgres/defaultsettings/Float4UniqueCheckPk.go @@ -0,0 +1,5 @@ +package dto + +type Float4UniqueCheckPk struct { + Float4UniqueCheckPk float64 `db:"float4_unique_check_pk"` +} diff --git a/internal/integration_tests/postgres/defaultsettings/Float4UniqueCheckPkRef.go b/internal/integration_tests/postgres/defaultsettings/Float4UniqueCheckPkRef.go new file mode 100644 index 00000000..9b4bd96a --- /dev/null +++ b/internal/integration_tests/postgres/defaultsettings/Float4UniqueCheckPkRef.go @@ -0,0 +1,5 @@ +package dto + +type Float4UniqueCheckPkRef struct { + Float4UniqueCheckPkRef float64 `db:"float4_unique_check_pk_ref"` +} diff --git a/internal/integration_tests/postgres/defaultsettings/Float4UniquePk.go b/internal/integration_tests/postgres/defaultsettings/Float4UniquePk.go new file mode 100644 index 00000000..9139de41 --- /dev/null +++ b/internal/integration_tests/postgres/defaultsettings/Float4UniquePk.go @@ -0,0 +1,5 @@ +package dto + +type Float4UniquePk struct { + Float4UniquePk float64 `db:"float4_unique_pk"` +} diff --git a/internal/integration_tests/postgres/defaultsettings/Float8.go b/internal/integration_tests/postgres/defaultsettings/Float8.go new file mode 100644 index 00000000..e1244cee --- /dev/null +++ b/internal/integration_tests/postgres/defaultsettings/Float8.go @@ -0,0 +1,33 @@ +package dto + +import ( + "database/sql" +) + +type Float8 struct { + Float8 sql.NullFloat64 `db:"float8"` + Float8Nn float64 `db:"float8_nn"` + Float8NnUnique float64 `db:"float8_nn_unique"` + Float8NnCheck float64 `db:"float8_nn_check"` + Float8NnRef float64 `db:"float8_nn_ref"` + Float8NnDefConst float64 `db:"float8_nn_def_const"` + Float8NnDefFunc float64 `db:"float8_nn_def_func"` + Float8NnUniqueCheck float64 `db:"float8_nn_unique_check"` + Float8Unique sql.NullFloat64 `db:"float8_unique"` + Float8UniqueCheck sql.NullFloat64 `db:"float8_unique_check"` + Float8UniqueRef sql.NullFloat64 `db:"float8_unique_ref"` + Float8UniqueDefConst sql.NullFloat64 `db:"float8_unique_def_const"` + Float8UniqueDefFunc sql.NullFloat64 `db:"float8_unique_def_func"` + Float8Check sql.NullFloat64 `db:"float8_check"` + Float8CheckRef sql.NullFloat64 `db:"float8_check_ref"` + Float8CheckDefConst sql.NullFloat64 `db:"float8_check_def_const"` + Float8CheckDefFunc sql.NullFloat64 `db:"float8_check_def_func"` + Float8Ref sql.NullFloat64 `db:"float8_ref"` + Float8RefDefConst sql.NullFloat64 `db:"float8_ref_def_const"` + Float8RefDefFunc sql.NullFloat64 `db:"float8_ref_def_func"` + Float8RefUniqueCheck sql.NullFloat64 `db:"float8_ref_unique_check"` + Float8DefConst sql.NullFloat64 `db:"float8_def_const"` + Float8DefConstUniqueCheck sql.NullFloat64 `db:"float8_def_const_unique_check"` + Float8DefFunc sql.NullFloat64 `db:"float8_def_func"` + Float8DefFuncUniqueCheck sql.NullFloat64 `db:"float8_def_func_unique_check"` +} diff --git a/internal/integration_tests/postgres/defaultsettings/Float8CheckPk.go b/internal/integration_tests/postgres/defaultsettings/Float8CheckPk.go new file mode 100644 index 00000000..12f8e87c --- /dev/null +++ b/internal/integration_tests/postgres/defaultsettings/Float8CheckPk.go @@ -0,0 +1,5 @@ +package dto + +type Float8CheckPk struct { + Float8CheckPk float64 `db:"float8_check_pk"` +} diff --git a/internal/integration_tests/postgres/defaultsettings/Float8DefConstUniqueCheckPk.go b/internal/integration_tests/postgres/defaultsettings/Float8DefConstUniqueCheckPk.go new file mode 100644 index 00000000..f6027189 --- /dev/null +++ b/internal/integration_tests/postgres/defaultsettings/Float8DefConstUniqueCheckPk.go @@ -0,0 +1,5 @@ +package dto + +type Float8DefConstUniqueCheckPk struct { + Float8DefConstUniqueCheckPk float64 `db:"float8_def_const_unique_check_pk"` +} diff --git a/internal/integration_tests/postgres/defaultsettings/Float8DefConstUniqueCheckPkRef.go b/internal/integration_tests/postgres/defaultsettings/Float8DefConstUniqueCheckPkRef.go new file mode 100644 index 00000000..1a7c9315 --- /dev/null +++ b/internal/integration_tests/postgres/defaultsettings/Float8DefConstUniqueCheckPkRef.go @@ -0,0 +1,5 @@ +package dto + +type Float8DefConstUniqueCheckPkRef struct { + Float8DefConstUniqueCheckPkRef float64 `db:"float8_def_const_unique_check_pk_ref"` +} diff --git a/internal/integration_tests/postgres/defaultsettings/Float8DefFuncUniqueCheckPk.go b/internal/integration_tests/postgres/defaultsettings/Float8DefFuncUniqueCheckPk.go new file mode 100644 index 00000000..904ebdad --- /dev/null +++ b/internal/integration_tests/postgres/defaultsettings/Float8DefFuncUniqueCheckPk.go @@ -0,0 +1,5 @@ +package dto + +type Float8DefFuncUniqueCheckPk struct { + Float8DefFuncUniqueCheckPk float64 `db:"float8_def_func_unique_check_pk"` +} diff --git a/internal/integration_tests/postgres/defaultsettings/Float8DefFuncUniqueCheckPkRef.go b/internal/integration_tests/postgres/defaultsettings/Float8DefFuncUniqueCheckPkRef.go new file mode 100644 index 00000000..32d018dd --- /dev/null +++ b/internal/integration_tests/postgres/defaultsettings/Float8DefFuncUniqueCheckPkRef.go @@ -0,0 +1,5 @@ +package dto + +type Float8DefFuncUniqueCheckPkRef struct { + Float8DefFuncUniqueCheckPkRef float64 `db:"float8_def_func_unique_check_pk_ref"` +} diff --git a/internal/integration_tests/postgres/defaultsettings/Float8NnPk.go b/internal/integration_tests/postgres/defaultsettings/Float8NnPk.go new file mode 100644 index 00000000..bd46df14 --- /dev/null +++ b/internal/integration_tests/postgres/defaultsettings/Float8NnPk.go @@ -0,0 +1,5 @@ +package dto + +type Float8NnPk struct { + Float8NnPk float64 `db:"float8_nn_pk"` +} diff --git a/internal/integration_tests/postgres/defaultsettings/Float8NnUniqueCheckPk.go b/internal/integration_tests/postgres/defaultsettings/Float8NnUniqueCheckPk.go new file mode 100644 index 00000000..71876ee4 --- /dev/null +++ b/internal/integration_tests/postgres/defaultsettings/Float8NnUniqueCheckPk.go @@ -0,0 +1,5 @@ +package dto + +type Float8NnUniqueCheckPk struct { + Float8NnUniqueCheckPk float64 `db:"float8_nn_unique_check_pk"` +} diff --git a/internal/integration_tests/postgres/defaultsettings/Float8NnUniqueCheckPkRef.go b/internal/integration_tests/postgres/defaultsettings/Float8NnUniqueCheckPkRef.go new file mode 100644 index 00000000..948a75c2 --- /dev/null +++ b/internal/integration_tests/postgres/defaultsettings/Float8NnUniqueCheckPkRef.go @@ -0,0 +1,5 @@ +package dto + +type Float8NnUniqueCheckPkRef struct { + Float8NnUniqueCheckPkRef float64 `db:"float8_nn_unique_check_pk_ref"` +} diff --git a/internal/integration_tests/postgres/defaultsettings/Float8Pk.go b/internal/integration_tests/postgres/defaultsettings/Float8Pk.go new file mode 100644 index 00000000..24966b5f --- /dev/null +++ b/internal/integration_tests/postgres/defaultsettings/Float8Pk.go @@ -0,0 +1,5 @@ +package dto + +type Float8Pk struct { + Float8Pk float64 `db:"float8_pk"` +} diff --git a/internal/integration_tests/postgres/defaultsettings/Float8PkDefConst.go b/internal/integration_tests/postgres/defaultsettings/Float8PkDefConst.go new file mode 100644 index 00000000..5fbc4c3f --- /dev/null +++ b/internal/integration_tests/postgres/defaultsettings/Float8PkDefConst.go @@ -0,0 +1,5 @@ +package dto + +type Float8PkDefConst struct { + Float8PkDefConst float64 `db:"float8_pk_def_const"` +} diff --git a/internal/integration_tests/postgres/defaultsettings/Float8PkDefFunc.go b/internal/integration_tests/postgres/defaultsettings/Float8PkDefFunc.go new file mode 100644 index 00000000..644007b8 --- /dev/null +++ b/internal/integration_tests/postgres/defaultsettings/Float8PkDefFunc.go @@ -0,0 +1,5 @@ +package dto + +type Float8PkDefFunc struct { + Float8PkDefFunc float64 `db:"float8_pk_def_func"` +} diff --git a/internal/integration_tests/postgres/defaultsettings/Float8PkRef.go b/internal/integration_tests/postgres/defaultsettings/Float8PkRef.go new file mode 100644 index 00000000..1d2b92d2 --- /dev/null +++ b/internal/integration_tests/postgres/defaultsettings/Float8PkRef.go @@ -0,0 +1,5 @@ +package dto + +type Float8PkRef struct { + Float8PkRef float64 `db:"float8_pk_ref"` +} diff --git a/internal/integration_tests/postgres/defaultsettings/Float8Ref.go b/internal/integration_tests/postgres/defaultsettings/Float8Ref.go new file mode 100644 index 00000000..8e5eda44 --- /dev/null +++ b/internal/integration_tests/postgres/defaultsettings/Float8Ref.go @@ -0,0 +1,9 @@ +package dto + +import ( + "database/sql" +) + +type Float8Ref struct { + Float8Ref sql.NullFloat64 `db:"float8_ref"` +} diff --git a/internal/integration_tests/postgres/defaultsettings/Float8UniqueCheckPk.go b/internal/integration_tests/postgres/defaultsettings/Float8UniqueCheckPk.go new file mode 100644 index 00000000..549ea1ba --- /dev/null +++ b/internal/integration_tests/postgres/defaultsettings/Float8UniqueCheckPk.go @@ -0,0 +1,5 @@ +package dto + +type Float8UniqueCheckPk struct { + Float8UniqueCheckPk float64 `db:"float8_unique_check_pk"` +} diff --git a/internal/integration_tests/postgres/defaultsettings/Float8UniqueCheckPkRef.go b/internal/integration_tests/postgres/defaultsettings/Float8UniqueCheckPkRef.go new file mode 100644 index 00000000..f89c6531 --- /dev/null +++ b/internal/integration_tests/postgres/defaultsettings/Float8UniqueCheckPkRef.go @@ -0,0 +1,5 @@ +package dto + +type Float8UniqueCheckPkRef struct { + Float8UniqueCheckPkRef float64 `db:"float8_unique_check_pk_ref"` +} diff --git a/internal/integration_tests/postgres/defaultsettings/Float8UniquePk.go b/internal/integration_tests/postgres/defaultsettings/Float8UniquePk.go new file mode 100644 index 00000000..834e76a3 --- /dev/null +++ b/internal/integration_tests/postgres/defaultsettings/Float8UniquePk.go @@ -0,0 +1,5 @@ +package dto + +type Float8UniquePk struct { + Float8UniquePk float64 `db:"float8_unique_pk"` +} diff --git a/internal/integration_tests/postgres/defaultsettings/FloatCheckPk.go b/internal/integration_tests/postgres/defaultsettings/FloatCheckPk.go new file mode 100644 index 00000000..e40adfb8 --- /dev/null +++ b/internal/integration_tests/postgres/defaultsettings/FloatCheckPk.go @@ -0,0 +1,5 @@ +package dto + +type FloatCheckPk struct { + FloatCheckPk float64 `db:"float_check_pk"` +} diff --git a/internal/integration_tests/postgres/defaultsettings/FloatDefConstUniqueCheckPk.go b/internal/integration_tests/postgres/defaultsettings/FloatDefConstUniqueCheckPk.go new file mode 100644 index 00000000..57baef77 --- /dev/null +++ b/internal/integration_tests/postgres/defaultsettings/FloatDefConstUniqueCheckPk.go @@ -0,0 +1,5 @@ +package dto + +type FloatDefConstUniqueCheckPk struct { + FloatDefConstUniqueCheckPk float64 `db:"float_def_const_unique_check_pk"` +} diff --git a/internal/integration_tests/postgres/defaultsettings/FloatDefConstUniqueCheckPkRef.go b/internal/integration_tests/postgres/defaultsettings/FloatDefConstUniqueCheckPkRef.go new file mode 100644 index 00000000..6125761b --- /dev/null +++ b/internal/integration_tests/postgres/defaultsettings/FloatDefConstUniqueCheckPkRef.go @@ -0,0 +1,5 @@ +package dto + +type FloatDefConstUniqueCheckPkRef struct { + FloatDefConstUniqueCheckPkRef float64 `db:"float_def_const_unique_check_pk_ref"` +} diff --git a/internal/integration_tests/postgres/defaultsettings/FloatDefFuncUniqueCheckPk.go b/internal/integration_tests/postgres/defaultsettings/FloatDefFuncUniqueCheckPk.go new file mode 100644 index 00000000..00622747 --- /dev/null +++ b/internal/integration_tests/postgres/defaultsettings/FloatDefFuncUniqueCheckPk.go @@ -0,0 +1,5 @@ +package dto + +type FloatDefFuncUniqueCheckPk struct { + FloatDefFuncUniqueCheckPk float64 `db:"float_def_func_unique_check_pk"` +} diff --git a/internal/integration_tests/postgres/defaultsettings/FloatDefFuncUniqueCheckPkRef.go b/internal/integration_tests/postgres/defaultsettings/FloatDefFuncUniqueCheckPkRef.go new file mode 100644 index 00000000..8d025ad4 --- /dev/null +++ b/internal/integration_tests/postgres/defaultsettings/FloatDefFuncUniqueCheckPkRef.go @@ -0,0 +1,5 @@ +package dto + +type FloatDefFuncUniqueCheckPkRef struct { + FloatDefFuncUniqueCheckPkRef float64 `db:"float_def_func_unique_check_pk_ref"` +} diff --git a/internal/integration_tests/postgres/defaultsettings/FloatNnPk.go b/internal/integration_tests/postgres/defaultsettings/FloatNnPk.go new file mode 100644 index 00000000..aa175645 --- /dev/null +++ b/internal/integration_tests/postgres/defaultsettings/FloatNnPk.go @@ -0,0 +1,5 @@ +package dto + +type FloatNnPk struct { + FloatNnPk float64 `db:"float_nn_pk"` +} diff --git a/internal/integration_tests/postgres/defaultsettings/FloatNnUniqueCheckPk.go b/internal/integration_tests/postgres/defaultsettings/FloatNnUniqueCheckPk.go new file mode 100644 index 00000000..a65f5786 --- /dev/null +++ b/internal/integration_tests/postgres/defaultsettings/FloatNnUniqueCheckPk.go @@ -0,0 +1,5 @@ +package dto + +type FloatNnUniqueCheckPk struct { + FloatNnUniqueCheckPk float64 `db:"float_nn_unique_check_pk"` +} diff --git a/internal/integration_tests/postgres/defaultsettings/FloatNnUniqueCheckPkRef.go b/internal/integration_tests/postgres/defaultsettings/FloatNnUniqueCheckPkRef.go new file mode 100644 index 00000000..a3253c3f --- /dev/null +++ b/internal/integration_tests/postgres/defaultsettings/FloatNnUniqueCheckPkRef.go @@ -0,0 +1,5 @@ +package dto + +type FloatNnUniqueCheckPkRef struct { + FloatNnUniqueCheckPkRef float64 `db:"float_nn_unique_check_pk_ref"` +} diff --git a/internal/integration_tests/postgres/defaultsettings/FloatPk.go b/internal/integration_tests/postgres/defaultsettings/FloatPk.go new file mode 100644 index 00000000..60ca0fcb --- /dev/null +++ b/internal/integration_tests/postgres/defaultsettings/FloatPk.go @@ -0,0 +1,5 @@ +package dto + +type FloatPk struct { + FloatPk float64 `db:"float_pk"` +} diff --git a/internal/integration_tests/postgres/defaultsettings/FloatPkDefConst.go b/internal/integration_tests/postgres/defaultsettings/FloatPkDefConst.go new file mode 100644 index 00000000..1660a67a --- /dev/null +++ b/internal/integration_tests/postgres/defaultsettings/FloatPkDefConst.go @@ -0,0 +1,5 @@ +package dto + +type FloatPkDefConst struct { + FloatPkDefConst float64 `db:"float_pk_def_const"` +} diff --git a/internal/integration_tests/postgres/defaultsettings/FloatPkDefFunc.go b/internal/integration_tests/postgres/defaultsettings/FloatPkDefFunc.go new file mode 100644 index 00000000..e2de6364 --- /dev/null +++ b/internal/integration_tests/postgres/defaultsettings/FloatPkDefFunc.go @@ -0,0 +1,5 @@ +package dto + +type FloatPkDefFunc struct { + FloatPkDefFunc float64 `db:"float_pk_def_func"` +} diff --git a/internal/integration_tests/postgres/defaultsettings/FloatPkRef.go b/internal/integration_tests/postgres/defaultsettings/FloatPkRef.go new file mode 100644 index 00000000..476d656e --- /dev/null +++ b/internal/integration_tests/postgres/defaultsettings/FloatPkRef.go @@ -0,0 +1,5 @@ +package dto + +type FloatPkRef struct { + FloatPkRef float64 `db:"float_pk_ref"` +} diff --git a/internal/integration_tests/postgres/defaultsettings/FloatRef.go b/internal/integration_tests/postgres/defaultsettings/FloatRef.go new file mode 100644 index 00000000..9a43e1af --- /dev/null +++ b/internal/integration_tests/postgres/defaultsettings/FloatRef.go @@ -0,0 +1,9 @@ +package dto + +import ( + "database/sql" +) + +type FloatRef struct { + FloatRef sql.NullFloat64 `db:"float_ref"` +} diff --git a/internal/integration_tests/postgres/defaultsettings/FloatUniqueCheckPk.go b/internal/integration_tests/postgres/defaultsettings/FloatUniqueCheckPk.go new file mode 100644 index 00000000..81ddc37f --- /dev/null +++ b/internal/integration_tests/postgres/defaultsettings/FloatUniqueCheckPk.go @@ -0,0 +1,5 @@ +package dto + +type FloatUniqueCheckPk struct { + FloatUniqueCheckPk float64 `db:"float_unique_check_pk"` +} diff --git a/internal/integration_tests/postgres/defaultsettings/FloatUniqueCheckPkRef.go b/internal/integration_tests/postgres/defaultsettings/FloatUniqueCheckPkRef.go new file mode 100644 index 00000000..530d26cc --- /dev/null +++ b/internal/integration_tests/postgres/defaultsettings/FloatUniqueCheckPkRef.go @@ -0,0 +1,5 @@ +package dto + +type FloatUniqueCheckPkRef struct { + FloatUniqueCheckPkRef float64 `db:"float_unique_check_pk_ref"` +} diff --git a/internal/integration_tests/postgres/defaultsettings/FloatUniquePk.go b/internal/integration_tests/postgres/defaultsettings/FloatUniquePk.go new file mode 100644 index 00000000..6f0e1fbd --- /dev/null +++ b/internal/integration_tests/postgres/defaultsettings/FloatUniquePk.go @@ -0,0 +1,5 @@ +package dto + +type FloatUniquePk struct { + FloatUniquePk float64 `db:"float_unique_pk"` +} diff --git a/internal/integration_tests/postgres/defaultsettings/Int2.go b/internal/integration_tests/postgres/defaultsettings/Int2.go new file mode 100644 index 00000000..6f1ee461 --- /dev/null +++ b/internal/integration_tests/postgres/defaultsettings/Int2.go @@ -0,0 +1,33 @@ +package dto + +import ( + "database/sql" +) + +type Int2 struct { + Int2 sql.NullInt64 `db:"int2"` + Int2Nn int `db:"int2_nn"` + Int2NnUnique int `db:"int2_nn_unique"` + Int2NnCheck int `db:"int2_nn_check"` + Int2NnRef int `db:"int2_nn_ref"` + Int2NnDefConst int `db:"int2_nn_def_const"` + Int2NnDefFunc int `db:"int2_nn_def_func"` + Int2NnUniqueCheck int `db:"int2_nn_unique_check"` + Int2Unique sql.NullInt64 `db:"int2_unique"` + Int2UniqueCheck sql.NullInt64 `db:"int2_unique_check"` + Int2UniqueRef sql.NullInt64 `db:"int2_unique_ref"` + Int2UniqueDefConst sql.NullInt64 `db:"int2_unique_def_const"` + Int2UniqueDefFunc sql.NullInt64 `db:"int2_unique_def_func"` + Int2Check sql.NullInt64 `db:"int2_check"` + Int2CheckRef sql.NullInt64 `db:"int2_check_ref"` + Int2CheckDefConst sql.NullInt64 `db:"int2_check_def_const"` + Int2CheckDefFunc sql.NullInt64 `db:"int2_check_def_func"` + Int2Ref sql.NullInt64 `db:"int2_ref"` + Int2RefDefConst sql.NullInt64 `db:"int2_ref_def_const"` + Int2RefDefFunc sql.NullInt64 `db:"int2_ref_def_func"` + Int2RefUniqueCheck sql.NullInt64 `db:"int2_ref_unique_check"` + Int2DefConst sql.NullInt64 `db:"int2_def_const"` + Int2DefConstUniqueCheck sql.NullInt64 `db:"int2_def_const_unique_check"` + Int2DefFunc sql.NullInt64 `db:"int2_def_func"` + Int2DefFuncUniqueCheck sql.NullInt64 `db:"int2_def_func_unique_check"` +} diff --git a/internal/integration_tests/postgres/defaultsettings/Int2CheckPk.go b/internal/integration_tests/postgres/defaultsettings/Int2CheckPk.go new file mode 100644 index 00000000..c409012d --- /dev/null +++ b/internal/integration_tests/postgres/defaultsettings/Int2CheckPk.go @@ -0,0 +1,5 @@ +package dto + +type Int2CheckPk struct { + Int2CheckPk int `db:"int2_check_pk"` +} diff --git a/internal/integration_tests/postgres/defaultsettings/Int2DefConstUniqueCheckPk.go b/internal/integration_tests/postgres/defaultsettings/Int2DefConstUniqueCheckPk.go new file mode 100644 index 00000000..772481e0 --- /dev/null +++ b/internal/integration_tests/postgres/defaultsettings/Int2DefConstUniqueCheckPk.go @@ -0,0 +1,5 @@ +package dto + +type Int2DefConstUniqueCheckPk struct { + Int2DefConstUniqueCheckPk int `db:"int2_def_const_unique_check_pk"` +} diff --git a/internal/integration_tests/postgres/defaultsettings/Int2DefConstUniqueCheckPkRef.go b/internal/integration_tests/postgres/defaultsettings/Int2DefConstUniqueCheckPkRef.go new file mode 100644 index 00000000..5f1eba0a --- /dev/null +++ b/internal/integration_tests/postgres/defaultsettings/Int2DefConstUniqueCheckPkRef.go @@ -0,0 +1,5 @@ +package dto + +type Int2DefConstUniqueCheckPkRef struct { + Int2DefConstUniqueCheckPkRef int `db:"int2_def_const_unique_check_pk_ref"` +} diff --git a/internal/integration_tests/postgres/defaultsettings/Int2DefFuncUniqueCheckPk.go b/internal/integration_tests/postgres/defaultsettings/Int2DefFuncUniqueCheckPk.go new file mode 100644 index 00000000..543fe608 --- /dev/null +++ b/internal/integration_tests/postgres/defaultsettings/Int2DefFuncUniqueCheckPk.go @@ -0,0 +1,5 @@ +package dto + +type Int2DefFuncUniqueCheckPk struct { + Int2DefFuncUniqueCheckPk int `db:"int2_def_func_unique_check_pk"` +} diff --git a/internal/integration_tests/postgres/defaultsettings/Int2DefFuncUniqueCheckPkRef.go b/internal/integration_tests/postgres/defaultsettings/Int2DefFuncUniqueCheckPkRef.go new file mode 100644 index 00000000..4920bc81 --- /dev/null +++ b/internal/integration_tests/postgres/defaultsettings/Int2DefFuncUniqueCheckPkRef.go @@ -0,0 +1,5 @@ +package dto + +type Int2DefFuncUniqueCheckPkRef struct { + Int2DefFuncUniqueCheckPkRef int `db:"int2_def_func_unique_check_pk_ref"` +} diff --git a/internal/integration_tests/postgres/defaultsettings/Int2NnPk.go b/internal/integration_tests/postgres/defaultsettings/Int2NnPk.go new file mode 100644 index 00000000..bf785b43 --- /dev/null +++ b/internal/integration_tests/postgres/defaultsettings/Int2NnPk.go @@ -0,0 +1,5 @@ +package dto + +type Int2NnPk struct { + Int2NnPk int `db:"int2_nn_pk"` +} diff --git a/internal/integration_tests/postgres/defaultsettings/Int2NnUniqueCheckPk.go b/internal/integration_tests/postgres/defaultsettings/Int2NnUniqueCheckPk.go new file mode 100644 index 00000000..e0418ee3 --- /dev/null +++ b/internal/integration_tests/postgres/defaultsettings/Int2NnUniqueCheckPk.go @@ -0,0 +1,5 @@ +package dto + +type Int2NnUniqueCheckPk struct { + Int2NnUniqueCheckPk int `db:"int2_nn_unique_check_pk"` +} diff --git a/internal/integration_tests/postgres/defaultsettings/Int2NnUniqueCheckPkRef.go b/internal/integration_tests/postgres/defaultsettings/Int2NnUniqueCheckPkRef.go new file mode 100644 index 00000000..c4c5061f --- /dev/null +++ b/internal/integration_tests/postgres/defaultsettings/Int2NnUniqueCheckPkRef.go @@ -0,0 +1,5 @@ +package dto + +type Int2NnUniqueCheckPkRef struct { + Int2NnUniqueCheckPkRef int `db:"int2_nn_unique_check_pk_ref"` +} diff --git a/internal/integration_tests/postgres/defaultsettings/Int2Pk.go b/internal/integration_tests/postgres/defaultsettings/Int2Pk.go new file mode 100644 index 00000000..afaa5495 --- /dev/null +++ b/internal/integration_tests/postgres/defaultsettings/Int2Pk.go @@ -0,0 +1,5 @@ +package dto + +type Int2Pk struct { + Int2Pk int `db:"int2_pk"` +} diff --git a/internal/integration_tests/postgres/defaultsettings/Int2PkDefConst.go b/internal/integration_tests/postgres/defaultsettings/Int2PkDefConst.go new file mode 100644 index 00000000..4f11bad2 --- /dev/null +++ b/internal/integration_tests/postgres/defaultsettings/Int2PkDefConst.go @@ -0,0 +1,5 @@ +package dto + +type Int2PkDefConst struct { + Int2PkDefConst int `db:"int2_pk_def_const"` +} diff --git a/internal/integration_tests/postgres/defaultsettings/Int2PkDefFunc.go b/internal/integration_tests/postgres/defaultsettings/Int2PkDefFunc.go new file mode 100644 index 00000000..a81ce4b5 --- /dev/null +++ b/internal/integration_tests/postgres/defaultsettings/Int2PkDefFunc.go @@ -0,0 +1,5 @@ +package dto + +type Int2PkDefFunc struct { + Int2PkDefFunc int `db:"int2_pk_def_func"` +} diff --git a/internal/integration_tests/postgres/defaultsettings/Int2PkRef.go b/internal/integration_tests/postgres/defaultsettings/Int2PkRef.go new file mode 100644 index 00000000..8503dd8e --- /dev/null +++ b/internal/integration_tests/postgres/defaultsettings/Int2PkRef.go @@ -0,0 +1,5 @@ +package dto + +type Int2PkRef struct { + Int2PkRef int `db:"int2_pk_ref"` +} diff --git a/internal/integration_tests/postgres/defaultsettings/Int2Ref.go b/internal/integration_tests/postgres/defaultsettings/Int2Ref.go new file mode 100644 index 00000000..339c8757 --- /dev/null +++ b/internal/integration_tests/postgres/defaultsettings/Int2Ref.go @@ -0,0 +1,9 @@ +package dto + +import ( + "database/sql" +) + +type Int2Ref struct { + Int2Ref sql.NullInt64 `db:"int2_ref"` +} diff --git a/internal/integration_tests/postgres/defaultsettings/Int2UniqueCheckPk.go b/internal/integration_tests/postgres/defaultsettings/Int2UniqueCheckPk.go new file mode 100644 index 00000000..7f2e43df --- /dev/null +++ b/internal/integration_tests/postgres/defaultsettings/Int2UniqueCheckPk.go @@ -0,0 +1,5 @@ +package dto + +type Int2UniqueCheckPk struct { + Int2UniqueCheckPk int `db:"int2_unique_check_pk"` +} diff --git a/internal/integration_tests/postgres/defaultsettings/Int2UniqueCheckPkRef.go b/internal/integration_tests/postgres/defaultsettings/Int2UniqueCheckPkRef.go new file mode 100644 index 00000000..8a988d5a --- /dev/null +++ b/internal/integration_tests/postgres/defaultsettings/Int2UniqueCheckPkRef.go @@ -0,0 +1,5 @@ +package dto + +type Int2UniqueCheckPkRef struct { + Int2UniqueCheckPkRef int `db:"int2_unique_check_pk_ref"` +} diff --git a/internal/integration_tests/postgres/defaultsettings/Int2UniquePk.go b/internal/integration_tests/postgres/defaultsettings/Int2UniquePk.go new file mode 100644 index 00000000..6b3535ad --- /dev/null +++ b/internal/integration_tests/postgres/defaultsettings/Int2UniquePk.go @@ -0,0 +1,5 @@ +package dto + +type Int2UniquePk struct { + Int2UniquePk int `db:"int2_unique_pk"` +} diff --git a/internal/integration_tests/postgres/defaultsettings/Int4.go b/internal/integration_tests/postgres/defaultsettings/Int4.go new file mode 100644 index 00000000..6d869c16 --- /dev/null +++ b/internal/integration_tests/postgres/defaultsettings/Int4.go @@ -0,0 +1,33 @@ +package dto + +import ( + "database/sql" +) + +type Int4 struct { + Int4 sql.NullInt64 `db:"int4"` + Int4Nn int `db:"int4_nn"` + Int4NnUnique int `db:"int4_nn_unique"` + Int4NnCheck int `db:"int4_nn_check"` + Int4NnRef int `db:"int4_nn_ref"` + Int4NnDefConst int `db:"int4_nn_def_const"` + Int4NnDefFunc int `db:"int4_nn_def_func"` + Int4NnUniqueCheck int `db:"int4_nn_unique_check"` + Int4Unique sql.NullInt64 `db:"int4_unique"` + Int4UniqueCheck sql.NullInt64 `db:"int4_unique_check"` + Int4UniqueRef sql.NullInt64 `db:"int4_unique_ref"` + Int4UniqueDefConst sql.NullInt64 `db:"int4_unique_def_const"` + Int4UniqueDefFunc sql.NullInt64 `db:"int4_unique_def_func"` + Int4Check sql.NullInt64 `db:"int4_check"` + Int4CheckRef sql.NullInt64 `db:"int4_check_ref"` + Int4CheckDefConst sql.NullInt64 `db:"int4_check_def_const"` + Int4CheckDefFunc sql.NullInt64 `db:"int4_check_def_func"` + Int4Ref sql.NullInt64 `db:"int4_ref"` + Int4RefDefConst sql.NullInt64 `db:"int4_ref_def_const"` + Int4RefDefFunc sql.NullInt64 `db:"int4_ref_def_func"` + Int4RefUniqueCheck sql.NullInt64 `db:"int4_ref_unique_check"` + Int4DefConst sql.NullInt64 `db:"int4_def_const"` + Int4DefConstUniqueCheck sql.NullInt64 `db:"int4_def_const_unique_check"` + Int4DefFunc sql.NullInt64 `db:"int4_def_func"` + Int4DefFuncUniqueCheck sql.NullInt64 `db:"int4_def_func_unique_check"` +} diff --git a/internal/integration_tests/postgres/defaultsettings/Int4CheckPk.go b/internal/integration_tests/postgres/defaultsettings/Int4CheckPk.go new file mode 100644 index 00000000..49c85faa --- /dev/null +++ b/internal/integration_tests/postgres/defaultsettings/Int4CheckPk.go @@ -0,0 +1,5 @@ +package dto + +type Int4CheckPk struct { + Int4CheckPk int `db:"int4_check_pk"` +} diff --git a/internal/integration_tests/postgres/defaultsettings/Int4DefConstUniqueCheckPk.go b/internal/integration_tests/postgres/defaultsettings/Int4DefConstUniqueCheckPk.go new file mode 100644 index 00000000..a355bb5b --- /dev/null +++ b/internal/integration_tests/postgres/defaultsettings/Int4DefConstUniqueCheckPk.go @@ -0,0 +1,5 @@ +package dto + +type Int4DefConstUniqueCheckPk struct { + Int4DefConstUniqueCheckPk int `db:"int4_def_const_unique_check_pk"` +} diff --git a/internal/integration_tests/postgres/defaultsettings/Int4DefConstUniqueCheckPkRef.go b/internal/integration_tests/postgres/defaultsettings/Int4DefConstUniqueCheckPkRef.go new file mode 100644 index 00000000..3090d90d --- /dev/null +++ b/internal/integration_tests/postgres/defaultsettings/Int4DefConstUniqueCheckPkRef.go @@ -0,0 +1,5 @@ +package dto + +type Int4DefConstUniqueCheckPkRef struct { + Int4DefConstUniqueCheckPkRef int `db:"int4_def_const_unique_check_pk_ref"` +} diff --git a/internal/integration_tests/postgres/defaultsettings/Int4DefFuncUniqueCheckPk.go b/internal/integration_tests/postgres/defaultsettings/Int4DefFuncUniqueCheckPk.go new file mode 100644 index 00000000..bff8c96e --- /dev/null +++ b/internal/integration_tests/postgres/defaultsettings/Int4DefFuncUniqueCheckPk.go @@ -0,0 +1,5 @@ +package dto + +type Int4DefFuncUniqueCheckPk struct { + Int4DefFuncUniqueCheckPk int `db:"int4_def_func_unique_check_pk"` +} diff --git a/internal/integration_tests/postgres/defaultsettings/Int4DefFuncUniqueCheckPkRef.go b/internal/integration_tests/postgres/defaultsettings/Int4DefFuncUniqueCheckPkRef.go new file mode 100644 index 00000000..3a5fca6c --- /dev/null +++ b/internal/integration_tests/postgres/defaultsettings/Int4DefFuncUniqueCheckPkRef.go @@ -0,0 +1,5 @@ +package dto + +type Int4DefFuncUniqueCheckPkRef struct { + Int4DefFuncUniqueCheckPkRef int `db:"int4_def_func_unique_check_pk_ref"` +} diff --git a/internal/integration_tests/postgres/defaultsettings/Int4NnPk.go b/internal/integration_tests/postgres/defaultsettings/Int4NnPk.go new file mode 100644 index 00000000..8f874f74 --- /dev/null +++ b/internal/integration_tests/postgres/defaultsettings/Int4NnPk.go @@ -0,0 +1,5 @@ +package dto + +type Int4NnPk struct { + Int4NnPk int `db:"int4_nn_pk"` +} diff --git a/internal/integration_tests/postgres/defaultsettings/Int4NnUniqueCheckPk.go b/internal/integration_tests/postgres/defaultsettings/Int4NnUniqueCheckPk.go new file mode 100644 index 00000000..6367e902 --- /dev/null +++ b/internal/integration_tests/postgres/defaultsettings/Int4NnUniqueCheckPk.go @@ -0,0 +1,5 @@ +package dto + +type Int4NnUniqueCheckPk struct { + Int4NnUniqueCheckPk int `db:"int4_nn_unique_check_pk"` +} diff --git a/internal/integration_tests/postgres/defaultsettings/Int4NnUniqueCheckPkRef.go b/internal/integration_tests/postgres/defaultsettings/Int4NnUniqueCheckPkRef.go new file mode 100644 index 00000000..78c405e5 --- /dev/null +++ b/internal/integration_tests/postgres/defaultsettings/Int4NnUniqueCheckPkRef.go @@ -0,0 +1,5 @@ +package dto + +type Int4NnUniqueCheckPkRef struct { + Int4NnUniqueCheckPkRef int `db:"int4_nn_unique_check_pk_ref"` +} diff --git a/internal/integration_tests/postgres/defaultsettings/Int4Pk.go b/internal/integration_tests/postgres/defaultsettings/Int4Pk.go new file mode 100644 index 00000000..f7924a64 --- /dev/null +++ b/internal/integration_tests/postgres/defaultsettings/Int4Pk.go @@ -0,0 +1,5 @@ +package dto + +type Int4Pk struct { + Int4Pk int `db:"int4_pk"` +} diff --git a/internal/integration_tests/postgres/defaultsettings/Int4PkDefConst.go b/internal/integration_tests/postgres/defaultsettings/Int4PkDefConst.go new file mode 100644 index 00000000..aea720b4 --- /dev/null +++ b/internal/integration_tests/postgres/defaultsettings/Int4PkDefConst.go @@ -0,0 +1,5 @@ +package dto + +type Int4PkDefConst struct { + Int4PkDefConst int `db:"int4_pk_def_const"` +} diff --git a/internal/integration_tests/postgres/defaultsettings/Int4PkDefFunc.go b/internal/integration_tests/postgres/defaultsettings/Int4PkDefFunc.go new file mode 100644 index 00000000..0336d90a --- /dev/null +++ b/internal/integration_tests/postgres/defaultsettings/Int4PkDefFunc.go @@ -0,0 +1,5 @@ +package dto + +type Int4PkDefFunc struct { + Int4PkDefFunc int `db:"int4_pk_def_func"` +} diff --git a/internal/integration_tests/postgres/defaultsettings/Int4PkRef.go b/internal/integration_tests/postgres/defaultsettings/Int4PkRef.go new file mode 100644 index 00000000..a6cf4d57 --- /dev/null +++ b/internal/integration_tests/postgres/defaultsettings/Int4PkRef.go @@ -0,0 +1,5 @@ +package dto + +type Int4PkRef struct { + Int4PkRef int `db:"int4_pk_ref"` +} diff --git a/internal/integration_tests/postgres/defaultsettings/Int4Ref.go b/internal/integration_tests/postgres/defaultsettings/Int4Ref.go new file mode 100644 index 00000000..469b7498 --- /dev/null +++ b/internal/integration_tests/postgres/defaultsettings/Int4Ref.go @@ -0,0 +1,9 @@ +package dto + +import ( + "database/sql" +) + +type Int4Ref struct { + Int4Ref sql.NullInt64 `db:"int4_ref"` +} diff --git a/internal/integration_tests/postgres/defaultsettings/Int4UniqueCheckPk.go b/internal/integration_tests/postgres/defaultsettings/Int4UniqueCheckPk.go new file mode 100644 index 00000000..36a0c899 --- /dev/null +++ b/internal/integration_tests/postgres/defaultsettings/Int4UniqueCheckPk.go @@ -0,0 +1,5 @@ +package dto + +type Int4UniqueCheckPk struct { + Int4UniqueCheckPk int `db:"int4_unique_check_pk"` +} diff --git a/internal/integration_tests/postgres/defaultsettings/Int4UniqueCheckPkRef.go b/internal/integration_tests/postgres/defaultsettings/Int4UniqueCheckPkRef.go new file mode 100644 index 00000000..b47a5879 --- /dev/null +++ b/internal/integration_tests/postgres/defaultsettings/Int4UniqueCheckPkRef.go @@ -0,0 +1,5 @@ +package dto + +type Int4UniqueCheckPkRef struct { + Int4UniqueCheckPkRef int `db:"int4_unique_check_pk_ref"` +} diff --git a/internal/integration_tests/postgres/defaultsettings/Int4UniquePk.go b/internal/integration_tests/postgres/defaultsettings/Int4UniquePk.go new file mode 100644 index 00000000..f716106b --- /dev/null +++ b/internal/integration_tests/postgres/defaultsettings/Int4UniquePk.go @@ -0,0 +1,5 @@ +package dto + +type Int4UniquePk struct { + Int4UniquePk int `db:"int4_unique_pk"` +} diff --git a/internal/integration_tests/postgres/defaultsettings/Int8.go b/internal/integration_tests/postgres/defaultsettings/Int8.go new file mode 100644 index 00000000..7b2b4244 --- /dev/null +++ b/internal/integration_tests/postgres/defaultsettings/Int8.go @@ -0,0 +1,33 @@ +package dto + +import ( + "database/sql" +) + +type Int8 struct { + Int8 sql.NullInt64 `db:"int8"` + Int8Nn int `db:"int8_nn"` + Int8NnUnique int `db:"int8_nn_unique"` + Int8NnCheck int `db:"int8_nn_check"` + Int8NnRef int `db:"int8_nn_ref"` + Int8NnDefConst int `db:"int8_nn_def_const"` + Int8NnDefFunc int `db:"int8_nn_def_func"` + Int8NnUniqueCheck int `db:"int8_nn_unique_check"` + Int8Unique sql.NullInt64 `db:"int8_unique"` + Int8UniqueCheck sql.NullInt64 `db:"int8_unique_check"` + Int8UniqueRef sql.NullInt64 `db:"int8_unique_ref"` + Int8UniqueDefConst sql.NullInt64 `db:"int8_unique_def_const"` + Int8UniqueDefFunc sql.NullInt64 `db:"int8_unique_def_func"` + Int8Check sql.NullInt64 `db:"int8_check"` + Int8CheckRef sql.NullInt64 `db:"int8_check_ref"` + Int8CheckDefConst sql.NullInt64 `db:"int8_check_def_const"` + Int8CheckDefFunc sql.NullInt64 `db:"int8_check_def_func"` + Int8Ref sql.NullInt64 `db:"int8_ref"` + Int8RefDefConst sql.NullInt64 `db:"int8_ref_def_const"` + Int8RefDefFunc sql.NullInt64 `db:"int8_ref_def_func"` + Int8RefUniqueCheck sql.NullInt64 `db:"int8_ref_unique_check"` + Int8DefConst sql.NullInt64 `db:"int8_def_const"` + Int8DefConstUniqueCheck sql.NullInt64 `db:"int8_def_const_unique_check"` + Int8DefFunc sql.NullInt64 `db:"int8_def_func"` + Int8DefFuncUniqueCheck sql.NullInt64 `db:"int8_def_func_unique_check"` +} diff --git a/internal/integration_tests/postgres/defaultsettings/Int8CheckPk.go b/internal/integration_tests/postgres/defaultsettings/Int8CheckPk.go new file mode 100644 index 00000000..778aaa36 --- /dev/null +++ b/internal/integration_tests/postgres/defaultsettings/Int8CheckPk.go @@ -0,0 +1,5 @@ +package dto + +type Int8CheckPk struct { + Int8CheckPk int `db:"int8_check_pk"` +} diff --git a/internal/integration_tests/postgres/defaultsettings/Int8DefConstUniqueCheckPk.go b/internal/integration_tests/postgres/defaultsettings/Int8DefConstUniqueCheckPk.go new file mode 100644 index 00000000..201fb0a9 --- /dev/null +++ b/internal/integration_tests/postgres/defaultsettings/Int8DefConstUniqueCheckPk.go @@ -0,0 +1,5 @@ +package dto + +type Int8DefConstUniqueCheckPk struct { + Int8DefConstUniqueCheckPk int `db:"int8_def_const_unique_check_pk"` +} diff --git a/internal/integration_tests/postgres/defaultsettings/Int8DefConstUniqueCheckPkRef.go b/internal/integration_tests/postgres/defaultsettings/Int8DefConstUniqueCheckPkRef.go new file mode 100644 index 00000000..caf8b85e --- /dev/null +++ b/internal/integration_tests/postgres/defaultsettings/Int8DefConstUniqueCheckPkRef.go @@ -0,0 +1,5 @@ +package dto + +type Int8DefConstUniqueCheckPkRef struct { + Int8DefConstUniqueCheckPkRef int `db:"int8_def_const_unique_check_pk_ref"` +} diff --git a/internal/integration_tests/postgres/defaultsettings/Int8DefFuncUniqueCheckPk.go b/internal/integration_tests/postgres/defaultsettings/Int8DefFuncUniqueCheckPk.go new file mode 100644 index 00000000..c77123a4 --- /dev/null +++ b/internal/integration_tests/postgres/defaultsettings/Int8DefFuncUniqueCheckPk.go @@ -0,0 +1,5 @@ +package dto + +type Int8DefFuncUniqueCheckPk struct { + Int8DefFuncUniqueCheckPk int `db:"int8_def_func_unique_check_pk"` +} diff --git a/internal/integration_tests/postgres/defaultsettings/Int8DefFuncUniqueCheckPkRef.go b/internal/integration_tests/postgres/defaultsettings/Int8DefFuncUniqueCheckPkRef.go new file mode 100644 index 00000000..a0f68b8d --- /dev/null +++ b/internal/integration_tests/postgres/defaultsettings/Int8DefFuncUniqueCheckPkRef.go @@ -0,0 +1,5 @@ +package dto + +type Int8DefFuncUniqueCheckPkRef struct { + Int8DefFuncUniqueCheckPkRef int `db:"int8_def_func_unique_check_pk_ref"` +} diff --git a/internal/integration_tests/postgres/defaultsettings/Int8NnPk.go b/internal/integration_tests/postgres/defaultsettings/Int8NnPk.go new file mode 100644 index 00000000..9d31270b --- /dev/null +++ b/internal/integration_tests/postgres/defaultsettings/Int8NnPk.go @@ -0,0 +1,5 @@ +package dto + +type Int8NnPk struct { + Int8NnPk int `db:"int8_nn_pk"` +} diff --git a/internal/integration_tests/postgres/defaultsettings/Int8NnUniqueCheckPk.go b/internal/integration_tests/postgres/defaultsettings/Int8NnUniqueCheckPk.go new file mode 100644 index 00000000..1758577b --- /dev/null +++ b/internal/integration_tests/postgres/defaultsettings/Int8NnUniqueCheckPk.go @@ -0,0 +1,5 @@ +package dto + +type Int8NnUniqueCheckPk struct { + Int8NnUniqueCheckPk int `db:"int8_nn_unique_check_pk"` +} diff --git a/internal/integration_tests/postgres/defaultsettings/Int8NnUniqueCheckPkRef.go b/internal/integration_tests/postgres/defaultsettings/Int8NnUniqueCheckPkRef.go new file mode 100644 index 00000000..018cde2d --- /dev/null +++ b/internal/integration_tests/postgres/defaultsettings/Int8NnUniqueCheckPkRef.go @@ -0,0 +1,5 @@ +package dto + +type Int8NnUniqueCheckPkRef struct { + Int8NnUniqueCheckPkRef int `db:"int8_nn_unique_check_pk_ref"` +} diff --git a/internal/integration_tests/postgres/defaultsettings/Int8Pk.go b/internal/integration_tests/postgres/defaultsettings/Int8Pk.go new file mode 100644 index 00000000..4b09f0a7 --- /dev/null +++ b/internal/integration_tests/postgres/defaultsettings/Int8Pk.go @@ -0,0 +1,5 @@ +package dto + +type Int8Pk struct { + Int8Pk int `db:"int8_pk"` +} diff --git a/internal/integration_tests/postgres/defaultsettings/Int8PkDefConst.go b/internal/integration_tests/postgres/defaultsettings/Int8PkDefConst.go new file mode 100644 index 00000000..35d13ea4 --- /dev/null +++ b/internal/integration_tests/postgres/defaultsettings/Int8PkDefConst.go @@ -0,0 +1,5 @@ +package dto + +type Int8PkDefConst struct { + Int8PkDefConst int `db:"int8_pk_def_const"` +} diff --git a/internal/integration_tests/postgres/defaultsettings/Int8PkDefFunc.go b/internal/integration_tests/postgres/defaultsettings/Int8PkDefFunc.go new file mode 100644 index 00000000..2a833393 --- /dev/null +++ b/internal/integration_tests/postgres/defaultsettings/Int8PkDefFunc.go @@ -0,0 +1,5 @@ +package dto + +type Int8PkDefFunc struct { + Int8PkDefFunc int `db:"int8_pk_def_func"` +} diff --git a/internal/integration_tests/postgres/defaultsettings/Int8PkRef.go b/internal/integration_tests/postgres/defaultsettings/Int8PkRef.go new file mode 100644 index 00000000..4d4d7e1b --- /dev/null +++ b/internal/integration_tests/postgres/defaultsettings/Int8PkRef.go @@ -0,0 +1,5 @@ +package dto + +type Int8PkRef struct { + Int8PkRef int `db:"int8_pk_ref"` +} diff --git a/internal/integration_tests/postgres/defaultsettings/Int8Ref.go b/internal/integration_tests/postgres/defaultsettings/Int8Ref.go new file mode 100644 index 00000000..792abd77 --- /dev/null +++ b/internal/integration_tests/postgres/defaultsettings/Int8Ref.go @@ -0,0 +1,9 @@ +package dto + +import ( + "database/sql" +) + +type Int8Ref struct { + Int8Ref sql.NullInt64 `db:"int8_ref"` +} diff --git a/internal/integration_tests/postgres/defaultsettings/Int8UniqueCheckPk.go b/internal/integration_tests/postgres/defaultsettings/Int8UniqueCheckPk.go new file mode 100644 index 00000000..12ac4b27 --- /dev/null +++ b/internal/integration_tests/postgres/defaultsettings/Int8UniqueCheckPk.go @@ -0,0 +1,5 @@ +package dto + +type Int8UniqueCheckPk struct { + Int8UniqueCheckPk int `db:"int8_unique_check_pk"` +} diff --git a/internal/integration_tests/postgres/defaultsettings/Int8UniqueCheckPkRef.go b/internal/integration_tests/postgres/defaultsettings/Int8UniqueCheckPkRef.go new file mode 100644 index 00000000..7f3d06c7 --- /dev/null +++ b/internal/integration_tests/postgres/defaultsettings/Int8UniqueCheckPkRef.go @@ -0,0 +1,5 @@ +package dto + +type Int8UniqueCheckPkRef struct { + Int8UniqueCheckPkRef int `db:"int8_unique_check_pk_ref"` +} diff --git a/internal/integration_tests/postgres/defaultsettings/Int8UniquePk.go b/internal/integration_tests/postgres/defaultsettings/Int8UniquePk.go new file mode 100644 index 00000000..e66c4bb2 --- /dev/null +++ b/internal/integration_tests/postgres/defaultsettings/Int8UniquePk.go @@ -0,0 +1,5 @@ +package dto + +type Int8UniquePk struct { + Int8UniquePk int `db:"int8_unique_pk"` +} diff --git a/internal/integration_tests/postgres/defaultsettings/Integer.go b/internal/integration_tests/postgres/defaultsettings/Integer.go new file mode 100644 index 00000000..f41b6051 --- /dev/null +++ b/internal/integration_tests/postgres/defaultsettings/Integer.go @@ -0,0 +1,33 @@ +package dto + +import ( + "database/sql" +) + +type Integer struct { + Integer sql.NullInt64 `db:"integer"` + IntegerNn int `db:"integer_nn"` + IntegerNnUnique int `db:"integer_nn_unique"` + IntegerNnCheck int `db:"integer_nn_check"` + IntegerNnRef int `db:"integer_nn_ref"` + IntegerNnDefConst int `db:"integer_nn_def_const"` + IntegerNnDefFunc int `db:"integer_nn_def_func"` + IntegerNnUniqueCheck int `db:"integer_nn_unique_check"` + IntegerUnique sql.NullInt64 `db:"integer_unique"` + IntegerUniqueCheck sql.NullInt64 `db:"integer_unique_check"` + IntegerUniqueRef sql.NullInt64 `db:"integer_unique_ref"` + IntegerUniqueDefConst sql.NullInt64 `db:"integer_unique_def_const"` + IntegerUniqueDefFunc sql.NullInt64 `db:"integer_unique_def_func"` + IntegerCheck sql.NullInt64 `db:"integer_check"` + IntegerCheckRef sql.NullInt64 `db:"integer_check_ref"` + IntegerCheckDefConst sql.NullInt64 `db:"integer_check_def_const"` + IntegerCheckDefFunc sql.NullInt64 `db:"integer_check_def_func"` + IntegerRef sql.NullInt64 `db:"integer_ref"` + IntegerRefDefConst sql.NullInt64 `db:"integer_ref_def_const"` + IntegerRefDefFunc sql.NullInt64 `db:"integer_ref_def_func"` + IntegerRefUniqueCheck sql.NullInt64 `db:"integer_ref_unique_check"` + IntegerDefConst sql.NullInt64 `db:"integer_def_const"` + IntegerDefConstUniqueCheck sql.NullInt64 `db:"integer_def_const_unique_check"` + IntegerDefFunc sql.NullInt64 `db:"integer_def_func"` + IntegerDefFuncUniqueCheck sql.NullInt64 `db:"integer_def_func_unique_check"` +} diff --git a/internal/integration_tests/postgres/defaultsettings/IntegerCheckPk.go b/internal/integration_tests/postgres/defaultsettings/IntegerCheckPk.go new file mode 100644 index 00000000..ad7c9d02 --- /dev/null +++ b/internal/integration_tests/postgres/defaultsettings/IntegerCheckPk.go @@ -0,0 +1,5 @@ +package dto + +type IntegerCheckPk struct { + IntegerCheckPk int `db:"integer_check_pk"` +} diff --git a/internal/integration_tests/postgres/defaultsettings/IntegerDefConstUniqueCheckPk.go b/internal/integration_tests/postgres/defaultsettings/IntegerDefConstUniqueCheckPk.go new file mode 100644 index 00000000..72165e92 --- /dev/null +++ b/internal/integration_tests/postgres/defaultsettings/IntegerDefConstUniqueCheckPk.go @@ -0,0 +1,5 @@ +package dto + +type IntegerDefConstUniqueCheckPk struct { + IntegerDefConstUniqueCheckPk int `db:"integer_def_const_unique_check_pk"` +} diff --git a/internal/integration_tests/postgres/defaultsettings/IntegerDefConstUniqueCheckPkRef.go b/internal/integration_tests/postgres/defaultsettings/IntegerDefConstUniqueCheckPkRef.go new file mode 100644 index 00000000..3345b997 --- /dev/null +++ b/internal/integration_tests/postgres/defaultsettings/IntegerDefConstUniqueCheckPkRef.go @@ -0,0 +1,5 @@ +package dto + +type IntegerDefConstUniqueCheckPkRef struct { + IntegerDefConstUniqueCheckPkRef int `db:"integer_def_const_unique_check_pk_ref"` +} diff --git a/internal/integration_tests/postgres/defaultsettings/IntegerDefFuncUniqueCheckPk.go b/internal/integration_tests/postgres/defaultsettings/IntegerDefFuncUniqueCheckPk.go new file mode 100644 index 00000000..842dc704 --- /dev/null +++ b/internal/integration_tests/postgres/defaultsettings/IntegerDefFuncUniqueCheckPk.go @@ -0,0 +1,5 @@ +package dto + +type IntegerDefFuncUniqueCheckPk struct { + IntegerDefFuncUniqueCheckPk int `db:"integer_def_func_unique_check_pk"` +} diff --git a/internal/integration_tests/postgres/defaultsettings/IntegerDefFuncUniqueCheckPkRef.go b/internal/integration_tests/postgres/defaultsettings/IntegerDefFuncUniqueCheckPkRef.go new file mode 100644 index 00000000..8f406218 --- /dev/null +++ b/internal/integration_tests/postgres/defaultsettings/IntegerDefFuncUniqueCheckPkRef.go @@ -0,0 +1,5 @@ +package dto + +type IntegerDefFuncUniqueCheckPkRef struct { + IntegerDefFuncUniqueCheckPkRef int `db:"integer_def_func_unique_check_pk_ref"` +} diff --git a/internal/integration_tests/postgres/defaultsettings/IntegerNnPk.go b/internal/integration_tests/postgres/defaultsettings/IntegerNnPk.go new file mode 100644 index 00000000..2ec86875 --- /dev/null +++ b/internal/integration_tests/postgres/defaultsettings/IntegerNnPk.go @@ -0,0 +1,5 @@ +package dto + +type IntegerNnPk struct { + IntegerNnPk int `db:"integer_nn_pk"` +} diff --git a/internal/integration_tests/postgres/defaultsettings/IntegerNnUniqueCheckPk.go b/internal/integration_tests/postgres/defaultsettings/IntegerNnUniqueCheckPk.go new file mode 100644 index 00000000..f9311f0e --- /dev/null +++ b/internal/integration_tests/postgres/defaultsettings/IntegerNnUniqueCheckPk.go @@ -0,0 +1,5 @@ +package dto + +type IntegerNnUniqueCheckPk struct { + IntegerNnUniqueCheckPk int `db:"integer_nn_unique_check_pk"` +} diff --git a/internal/integration_tests/postgres/defaultsettings/IntegerNnUniqueCheckPkRef.go b/internal/integration_tests/postgres/defaultsettings/IntegerNnUniqueCheckPkRef.go new file mode 100644 index 00000000..9dca594a --- /dev/null +++ b/internal/integration_tests/postgres/defaultsettings/IntegerNnUniqueCheckPkRef.go @@ -0,0 +1,5 @@ +package dto + +type IntegerNnUniqueCheckPkRef struct { + IntegerNnUniqueCheckPkRef int `db:"integer_nn_unique_check_pk_ref"` +} diff --git a/internal/integration_tests/postgres/defaultsettings/IntegerPk.go b/internal/integration_tests/postgres/defaultsettings/IntegerPk.go new file mode 100644 index 00000000..4ad7290a --- /dev/null +++ b/internal/integration_tests/postgres/defaultsettings/IntegerPk.go @@ -0,0 +1,5 @@ +package dto + +type IntegerPk struct { + IntegerPk int `db:"integer_pk"` +} diff --git a/internal/integration_tests/postgres/defaultsettings/IntegerPkDefConst.go b/internal/integration_tests/postgres/defaultsettings/IntegerPkDefConst.go new file mode 100644 index 00000000..16ca6af6 --- /dev/null +++ b/internal/integration_tests/postgres/defaultsettings/IntegerPkDefConst.go @@ -0,0 +1,5 @@ +package dto + +type IntegerPkDefConst struct { + IntegerPkDefConst int `db:"integer_pk_def_const"` +} diff --git a/internal/integration_tests/postgres/defaultsettings/IntegerPkDefFunc.go b/internal/integration_tests/postgres/defaultsettings/IntegerPkDefFunc.go new file mode 100644 index 00000000..902032a0 --- /dev/null +++ b/internal/integration_tests/postgres/defaultsettings/IntegerPkDefFunc.go @@ -0,0 +1,5 @@ +package dto + +type IntegerPkDefFunc struct { + IntegerPkDefFunc int `db:"integer_pk_def_func"` +} diff --git a/internal/integration_tests/postgres/defaultsettings/IntegerPkRef.go b/internal/integration_tests/postgres/defaultsettings/IntegerPkRef.go new file mode 100644 index 00000000..4b526720 --- /dev/null +++ b/internal/integration_tests/postgres/defaultsettings/IntegerPkRef.go @@ -0,0 +1,5 @@ +package dto + +type IntegerPkRef struct { + IntegerPkRef int `db:"integer_pk_ref"` +} diff --git a/internal/integration_tests/postgres/defaultsettings/IntegerRef.go b/internal/integration_tests/postgres/defaultsettings/IntegerRef.go new file mode 100644 index 00000000..0c130331 --- /dev/null +++ b/internal/integration_tests/postgres/defaultsettings/IntegerRef.go @@ -0,0 +1,9 @@ +package dto + +import ( + "database/sql" +) + +type IntegerRef struct { + IntegerRef sql.NullInt64 `db:"integer_ref"` +} diff --git a/internal/integration_tests/postgres/defaultsettings/IntegerUniqueCheckPk.go b/internal/integration_tests/postgres/defaultsettings/IntegerUniqueCheckPk.go new file mode 100644 index 00000000..e9752b8b --- /dev/null +++ b/internal/integration_tests/postgres/defaultsettings/IntegerUniqueCheckPk.go @@ -0,0 +1,5 @@ +package dto + +type IntegerUniqueCheckPk struct { + IntegerUniqueCheckPk int `db:"integer_unique_check_pk"` +} diff --git a/internal/integration_tests/postgres/defaultsettings/IntegerUniqueCheckPkRef.go b/internal/integration_tests/postgres/defaultsettings/IntegerUniqueCheckPkRef.go new file mode 100644 index 00000000..23ec56d9 --- /dev/null +++ b/internal/integration_tests/postgres/defaultsettings/IntegerUniqueCheckPkRef.go @@ -0,0 +1,5 @@ +package dto + +type IntegerUniqueCheckPkRef struct { + IntegerUniqueCheckPkRef int `db:"integer_unique_check_pk_ref"` +} diff --git a/internal/integration_tests/postgres/defaultsettings/IntegerUniquePk.go b/internal/integration_tests/postgres/defaultsettings/IntegerUniquePk.go new file mode 100644 index 00000000..460e2616 --- /dev/null +++ b/internal/integration_tests/postgres/defaultsettings/IntegerUniquePk.go @@ -0,0 +1,5 @@ +package dto + +type IntegerUniquePk struct { + IntegerUniquePk int `db:"integer_unique_pk"` +} diff --git a/internal/integration_tests/postgres/defaultsettings/Numeric.go b/internal/integration_tests/postgres/defaultsettings/Numeric.go new file mode 100644 index 00000000..40fc7eb6 --- /dev/null +++ b/internal/integration_tests/postgres/defaultsettings/Numeric.go @@ -0,0 +1,35 @@ +package dto + +import ( + "database/sql" +) + +type Numeric struct { + Numeric sql.NullFloat64 `db:"numeric"` + NumericPrec sql.NullFloat64 `db:"numeric_prec"` + NumericPrecScale sql.NullFloat64 `db:"numeric_prec_scale"` + NumericNn float64 `db:"numeric_nn"` + NumericNnUnique float64 `db:"numeric_nn_unique"` + NumericNnCheck float64 `db:"numeric_nn_check"` + NumericNnRef float64 `db:"numeric_nn_ref"` + NumericNnDefConst float64 `db:"numeric_nn_def_const"` + NumericNnDefFunc float64 `db:"numeric_nn_def_func"` + NumericNnUniqueCheck float64 `db:"numeric_nn_unique_check"` + NumericUnique sql.NullFloat64 `db:"numeric_unique"` + NumericUniqueCheck sql.NullFloat64 `db:"numeric_unique_check"` + NumericUniqueRef sql.NullFloat64 `db:"numeric_unique_ref"` + NumericUniqueDefConst sql.NullFloat64 `db:"numeric_unique_def_const"` + NumericUniqueDefFunc sql.NullFloat64 `db:"numeric_unique_def_func"` + NumericCheck sql.NullFloat64 `db:"numeric_check"` + NumericCheckRef sql.NullFloat64 `db:"numeric_check_ref"` + NumericCheckDefConst sql.NullFloat64 `db:"numeric_check_def_const"` + NumericCheckDefFunc sql.NullFloat64 `db:"numeric_check_def_func"` + NumericRef sql.NullFloat64 `db:"numeric_ref"` + NumericRefDefConst sql.NullFloat64 `db:"numeric_ref_def_const"` + NumericRefDefFunc sql.NullFloat64 `db:"numeric_ref_def_func"` + NumericRefUniqueCheck sql.NullFloat64 `db:"numeric_ref_unique_check"` + NumericDefConst sql.NullFloat64 `db:"numeric_def_const"` + NumericDefConstUniqueCheck sql.NullFloat64 `db:"numeric_def_const_unique_check"` + NumericDefFunc sql.NullFloat64 `db:"numeric_def_func"` + NumericDefFuncUniqueCheck sql.NullFloat64 `db:"numeric_def_func_unique_check"` +} diff --git a/internal/integration_tests/postgres/defaultsettings/NumericCheckPk.go b/internal/integration_tests/postgres/defaultsettings/NumericCheckPk.go new file mode 100644 index 00000000..58709a6e --- /dev/null +++ b/internal/integration_tests/postgres/defaultsettings/NumericCheckPk.go @@ -0,0 +1,5 @@ +package dto + +type NumericCheckPk struct { + NumericCheckPk float64 `db:"numeric_check_pk"` +} diff --git a/internal/integration_tests/postgres/defaultsettings/NumericDefConstUniqueCheckPk.go b/internal/integration_tests/postgres/defaultsettings/NumericDefConstUniqueCheckPk.go new file mode 100644 index 00000000..e6fdd1a2 --- /dev/null +++ b/internal/integration_tests/postgres/defaultsettings/NumericDefConstUniqueCheckPk.go @@ -0,0 +1,5 @@ +package dto + +type NumericDefConstUniqueCheckPk struct { + NumericDefConstUniqueCheckPk float64 `db:"numeric_def_const_unique_check_pk"` +} diff --git a/internal/integration_tests/postgres/defaultsettings/NumericDefConstUniqueCheckPkRef.go b/internal/integration_tests/postgres/defaultsettings/NumericDefConstUniqueCheckPkRef.go new file mode 100644 index 00000000..cdaee17e --- /dev/null +++ b/internal/integration_tests/postgres/defaultsettings/NumericDefConstUniqueCheckPkRef.go @@ -0,0 +1,5 @@ +package dto + +type NumericDefConstUniqueCheckPkRef struct { + NumericDefConstUniqueCheckPkRef float64 `db:"numeric_def_const_unique_check_pk_ref"` +} diff --git a/internal/integration_tests/postgres/defaultsettings/NumericDefFuncUniqueCheckPk.go b/internal/integration_tests/postgres/defaultsettings/NumericDefFuncUniqueCheckPk.go new file mode 100644 index 00000000..7747f0a7 --- /dev/null +++ b/internal/integration_tests/postgres/defaultsettings/NumericDefFuncUniqueCheckPk.go @@ -0,0 +1,5 @@ +package dto + +type NumericDefFuncUniqueCheckPk struct { + NumericDefFuncUniqueCheckPk float64 `db:"numeric_def_func_unique_check_pk"` +} diff --git a/internal/integration_tests/postgres/defaultsettings/NumericDefFuncUniqueCheckPkRef.go b/internal/integration_tests/postgres/defaultsettings/NumericDefFuncUniqueCheckPkRef.go new file mode 100644 index 00000000..ade94a23 --- /dev/null +++ b/internal/integration_tests/postgres/defaultsettings/NumericDefFuncUniqueCheckPkRef.go @@ -0,0 +1,5 @@ +package dto + +type NumericDefFuncUniqueCheckPkRef struct { + NumericDefFuncUniqueCheckPkRef float64 `db:"numeric_def_func_unique_check_pk_ref"` +} diff --git a/internal/integration_tests/postgres/defaultsettings/NumericNnPk.go b/internal/integration_tests/postgres/defaultsettings/NumericNnPk.go new file mode 100644 index 00000000..d4f8dba5 --- /dev/null +++ b/internal/integration_tests/postgres/defaultsettings/NumericNnPk.go @@ -0,0 +1,5 @@ +package dto + +type NumericNnPk struct { + NumericNnPk float64 `db:"numeric_nn_pk"` +} diff --git a/internal/integration_tests/postgres/defaultsettings/NumericNnUniqueCheckPk.go b/internal/integration_tests/postgres/defaultsettings/NumericNnUniqueCheckPk.go new file mode 100644 index 00000000..bad0e84f --- /dev/null +++ b/internal/integration_tests/postgres/defaultsettings/NumericNnUniqueCheckPk.go @@ -0,0 +1,5 @@ +package dto + +type NumericNnUniqueCheckPk struct { + NumericNnUniqueCheckPk float64 `db:"numeric_nn_unique_check_pk"` +} diff --git a/internal/integration_tests/postgres/defaultsettings/NumericNnUniqueCheckPkRef.go b/internal/integration_tests/postgres/defaultsettings/NumericNnUniqueCheckPkRef.go new file mode 100644 index 00000000..c4d76752 --- /dev/null +++ b/internal/integration_tests/postgres/defaultsettings/NumericNnUniqueCheckPkRef.go @@ -0,0 +1,5 @@ +package dto + +type NumericNnUniqueCheckPkRef struct { + NumericNnUniqueCheckPkRef float64 `db:"numeric_nn_unique_check_pk_ref"` +} diff --git a/internal/integration_tests/postgres/defaultsettings/NumericPk.go b/internal/integration_tests/postgres/defaultsettings/NumericPk.go new file mode 100644 index 00000000..c2d654cc --- /dev/null +++ b/internal/integration_tests/postgres/defaultsettings/NumericPk.go @@ -0,0 +1,5 @@ +package dto + +type NumericPk struct { + NumericPk float64 `db:"numeric_pk"` +} diff --git a/internal/integration_tests/postgres/defaultsettings/NumericPkDefConst.go b/internal/integration_tests/postgres/defaultsettings/NumericPkDefConst.go new file mode 100644 index 00000000..b501ee37 --- /dev/null +++ b/internal/integration_tests/postgres/defaultsettings/NumericPkDefConst.go @@ -0,0 +1,5 @@ +package dto + +type NumericPkDefConst struct { + NumericPkDefConst float64 `db:"numeric_pk_def_const"` +} diff --git a/internal/integration_tests/postgres/defaultsettings/NumericPkDefFunc.go b/internal/integration_tests/postgres/defaultsettings/NumericPkDefFunc.go new file mode 100644 index 00000000..13dd726d --- /dev/null +++ b/internal/integration_tests/postgres/defaultsettings/NumericPkDefFunc.go @@ -0,0 +1,5 @@ +package dto + +type NumericPkDefFunc struct { + NumericPkDefFunc float64 `db:"numeric_pk_def_func"` +} diff --git a/internal/integration_tests/postgres/defaultsettings/NumericPkRef.go b/internal/integration_tests/postgres/defaultsettings/NumericPkRef.go new file mode 100644 index 00000000..af53186e --- /dev/null +++ b/internal/integration_tests/postgres/defaultsettings/NumericPkRef.go @@ -0,0 +1,5 @@ +package dto + +type NumericPkRef struct { + NumericPkRef float64 `db:"numeric_pk_ref"` +} diff --git a/internal/integration_tests/postgres/defaultsettings/NumericRef.go b/internal/integration_tests/postgres/defaultsettings/NumericRef.go new file mode 100644 index 00000000..2adb8d6d --- /dev/null +++ b/internal/integration_tests/postgres/defaultsettings/NumericRef.go @@ -0,0 +1,9 @@ +package dto + +import ( + "database/sql" +) + +type NumericRef struct { + NumericRef sql.NullFloat64 `db:"numeric_ref"` +} diff --git a/internal/integration_tests/postgres/defaultsettings/NumericUniqueCheckPk.go b/internal/integration_tests/postgres/defaultsettings/NumericUniqueCheckPk.go new file mode 100644 index 00000000..e48c41ec --- /dev/null +++ b/internal/integration_tests/postgres/defaultsettings/NumericUniqueCheckPk.go @@ -0,0 +1,5 @@ +package dto + +type NumericUniqueCheckPk struct { + NumericUniqueCheckPk float64 `db:"numeric_unique_check_pk"` +} diff --git a/internal/integration_tests/postgres/defaultsettings/NumericUniqueCheckPkRef.go b/internal/integration_tests/postgres/defaultsettings/NumericUniqueCheckPkRef.go new file mode 100644 index 00000000..d230e9c3 --- /dev/null +++ b/internal/integration_tests/postgres/defaultsettings/NumericUniqueCheckPkRef.go @@ -0,0 +1,5 @@ +package dto + +type NumericUniqueCheckPkRef struct { + NumericUniqueCheckPkRef float64 `db:"numeric_unique_check_pk_ref"` +} diff --git a/internal/integration_tests/postgres/defaultsettings/NumericUniquePk.go b/internal/integration_tests/postgres/defaultsettings/NumericUniquePk.go new file mode 100644 index 00000000..308c1b60 --- /dev/null +++ b/internal/integration_tests/postgres/defaultsettings/NumericUniquePk.go @@ -0,0 +1,5 @@ +package dto + +type NumericUniquePk struct { + NumericUniquePk float64 `db:"numeric_unique_pk"` +} diff --git a/internal/integration_tests/postgres/defaultsettings/Real.go b/internal/integration_tests/postgres/defaultsettings/Real.go new file mode 100644 index 00000000..2f10c1dc --- /dev/null +++ b/internal/integration_tests/postgres/defaultsettings/Real.go @@ -0,0 +1,33 @@ +package dto + +import ( + "database/sql" +) + +type Real struct { + Real sql.NullFloat64 `db:"real"` + RealNn float64 `db:"real_nn"` + RealNnUnique float64 `db:"real_nn_unique"` + RealNnCheck float64 `db:"real_nn_check"` + RealNnRef float64 `db:"real_nn_ref"` + RealNnDefConst float64 `db:"real_nn_def_const"` + RealNnDefFunc float64 `db:"real_nn_def_func"` + RealNnUniqueCheck float64 `db:"real_nn_unique_check"` + RealUnique sql.NullFloat64 `db:"real_unique"` + RealUniqueCheck sql.NullFloat64 `db:"real_unique_check"` + RealUniqueRef sql.NullFloat64 `db:"real_unique_ref"` + RealUniqueDefConst sql.NullFloat64 `db:"real_unique_def_const"` + RealUniqueDefFunc sql.NullFloat64 `db:"real_unique_def_func"` + RealCheck sql.NullFloat64 `db:"real_check"` + RealCheckRef sql.NullFloat64 `db:"real_check_ref"` + RealCheckDefConst sql.NullFloat64 `db:"real_check_def_const"` + RealCheckDefFunc sql.NullFloat64 `db:"real_check_def_func"` + RealRef sql.NullFloat64 `db:"real_ref"` + RealRefDefConst sql.NullFloat64 `db:"real_ref_def_const"` + RealRefDefFunc sql.NullFloat64 `db:"real_ref_def_func"` + RealRefUniqueCheck sql.NullFloat64 `db:"real_ref_unique_check"` + RealDefConst sql.NullFloat64 `db:"real_def_const"` + RealDefConstUniqueCheck sql.NullFloat64 `db:"real_def_const_unique_check"` + RealDefFunc sql.NullFloat64 `db:"real_def_func"` + RealDefFuncUniqueCheck sql.NullFloat64 `db:"real_def_func_unique_check"` +} diff --git a/internal/integration_tests/postgres/defaultsettings/RealCheckPk.go b/internal/integration_tests/postgres/defaultsettings/RealCheckPk.go new file mode 100644 index 00000000..41bbff57 --- /dev/null +++ b/internal/integration_tests/postgres/defaultsettings/RealCheckPk.go @@ -0,0 +1,5 @@ +package dto + +type RealCheckPk struct { + RealCheckPk float64 `db:"real_check_pk"` +} diff --git a/internal/integration_tests/postgres/defaultsettings/RealDefConstUniqueCheckPk.go b/internal/integration_tests/postgres/defaultsettings/RealDefConstUniqueCheckPk.go new file mode 100644 index 00000000..9be61d5c --- /dev/null +++ b/internal/integration_tests/postgres/defaultsettings/RealDefConstUniqueCheckPk.go @@ -0,0 +1,5 @@ +package dto + +type RealDefConstUniqueCheckPk struct { + RealDefConstUniqueCheckPk float64 `db:"real_def_const_unique_check_pk"` +} diff --git a/internal/integration_tests/postgres/defaultsettings/RealDefConstUniqueCheckPkRef.go b/internal/integration_tests/postgres/defaultsettings/RealDefConstUniqueCheckPkRef.go new file mode 100644 index 00000000..af58466f --- /dev/null +++ b/internal/integration_tests/postgres/defaultsettings/RealDefConstUniqueCheckPkRef.go @@ -0,0 +1,5 @@ +package dto + +type RealDefConstUniqueCheckPkRef struct { + RealDefConstUniqueCheckPkRef float64 `db:"real_def_const_unique_check_pk_ref"` +} diff --git a/internal/integration_tests/postgres/defaultsettings/RealDefFuncUniqueCheckPk.go b/internal/integration_tests/postgres/defaultsettings/RealDefFuncUniqueCheckPk.go new file mode 100644 index 00000000..2619719a --- /dev/null +++ b/internal/integration_tests/postgres/defaultsettings/RealDefFuncUniqueCheckPk.go @@ -0,0 +1,5 @@ +package dto + +type RealDefFuncUniqueCheckPk struct { + RealDefFuncUniqueCheckPk float64 `db:"real_def_func_unique_check_pk"` +} diff --git a/internal/integration_tests/postgres/defaultsettings/RealDefFuncUniqueCheckPkRef.go b/internal/integration_tests/postgres/defaultsettings/RealDefFuncUniqueCheckPkRef.go new file mode 100644 index 00000000..1c085edc --- /dev/null +++ b/internal/integration_tests/postgres/defaultsettings/RealDefFuncUniqueCheckPkRef.go @@ -0,0 +1,5 @@ +package dto + +type RealDefFuncUniqueCheckPkRef struct { + RealDefFuncUniqueCheckPkRef float64 `db:"real_def_func_unique_check_pk_ref"` +} diff --git a/internal/integration_tests/postgres/defaultsettings/RealNnPk.go b/internal/integration_tests/postgres/defaultsettings/RealNnPk.go new file mode 100644 index 00000000..c9efd760 --- /dev/null +++ b/internal/integration_tests/postgres/defaultsettings/RealNnPk.go @@ -0,0 +1,5 @@ +package dto + +type RealNnPk struct { + RealNnPk float64 `db:"real_nn_pk"` +} diff --git a/internal/integration_tests/postgres/defaultsettings/RealNnUniqueCheckPk.go b/internal/integration_tests/postgres/defaultsettings/RealNnUniqueCheckPk.go new file mode 100644 index 00000000..bcd80e13 --- /dev/null +++ b/internal/integration_tests/postgres/defaultsettings/RealNnUniqueCheckPk.go @@ -0,0 +1,5 @@ +package dto + +type RealNnUniqueCheckPk struct { + RealNnUniqueCheckPk float64 `db:"real_nn_unique_check_pk"` +} diff --git a/internal/integration_tests/postgres/defaultsettings/RealNnUniqueCheckPkRef.go b/internal/integration_tests/postgres/defaultsettings/RealNnUniqueCheckPkRef.go new file mode 100644 index 00000000..1ab6f733 --- /dev/null +++ b/internal/integration_tests/postgres/defaultsettings/RealNnUniqueCheckPkRef.go @@ -0,0 +1,5 @@ +package dto + +type RealNnUniqueCheckPkRef struct { + RealNnUniqueCheckPkRef float64 `db:"real_nn_unique_check_pk_ref"` +} diff --git a/internal/integration_tests/postgres/defaultsettings/RealPk.go b/internal/integration_tests/postgres/defaultsettings/RealPk.go new file mode 100644 index 00000000..aae62539 --- /dev/null +++ b/internal/integration_tests/postgres/defaultsettings/RealPk.go @@ -0,0 +1,5 @@ +package dto + +type RealPk struct { + RealPk float64 `db:"real_pk"` +} diff --git a/internal/integration_tests/postgres/defaultsettings/RealPkDefConst.go b/internal/integration_tests/postgres/defaultsettings/RealPkDefConst.go new file mode 100644 index 00000000..dcb3b0fa --- /dev/null +++ b/internal/integration_tests/postgres/defaultsettings/RealPkDefConst.go @@ -0,0 +1,5 @@ +package dto + +type RealPkDefConst struct { + RealPkDefConst float64 `db:"real_pk_def_const"` +} diff --git a/internal/integration_tests/postgres/defaultsettings/RealPkDefFunc.go b/internal/integration_tests/postgres/defaultsettings/RealPkDefFunc.go new file mode 100644 index 00000000..85041669 --- /dev/null +++ b/internal/integration_tests/postgres/defaultsettings/RealPkDefFunc.go @@ -0,0 +1,5 @@ +package dto + +type RealPkDefFunc struct { + RealPkDefFunc float64 `db:"real_pk_def_func"` +} diff --git a/internal/integration_tests/postgres/defaultsettings/RealPkRef.go b/internal/integration_tests/postgres/defaultsettings/RealPkRef.go new file mode 100644 index 00000000..99800028 --- /dev/null +++ b/internal/integration_tests/postgres/defaultsettings/RealPkRef.go @@ -0,0 +1,5 @@ +package dto + +type RealPkRef struct { + RealPkRef float64 `db:"real_pk_ref"` +} diff --git a/internal/integration_tests/postgres/defaultsettings/RealRef.go b/internal/integration_tests/postgres/defaultsettings/RealRef.go new file mode 100644 index 00000000..631f836c --- /dev/null +++ b/internal/integration_tests/postgres/defaultsettings/RealRef.go @@ -0,0 +1,9 @@ +package dto + +import ( + "database/sql" +) + +type RealRef struct { + RealRef sql.NullFloat64 `db:"real_ref"` +} diff --git a/internal/integration_tests/postgres/defaultsettings/RealUniqueCheckPk.go b/internal/integration_tests/postgres/defaultsettings/RealUniqueCheckPk.go new file mode 100644 index 00000000..68483d8a --- /dev/null +++ b/internal/integration_tests/postgres/defaultsettings/RealUniqueCheckPk.go @@ -0,0 +1,5 @@ +package dto + +type RealUniqueCheckPk struct { + RealUniqueCheckPk float64 `db:"real_unique_check_pk"` +} diff --git a/internal/integration_tests/postgres/defaultsettings/RealUniqueCheckPkRef.go b/internal/integration_tests/postgres/defaultsettings/RealUniqueCheckPkRef.go new file mode 100644 index 00000000..bc4b0d90 --- /dev/null +++ b/internal/integration_tests/postgres/defaultsettings/RealUniqueCheckPkRef.go @@ -0,0 +1,5 @@ +package dto + +type RealUniqueCheckPkRef struct { + RealUniqueCheckPkRef float64 `db:"real_unique_check_pk_ref"` +} diff --git a/internal/integration_tests/postgres/defaultsettings/RealUniquePk.go b/internal/integration_tests/postgres/defaultsettings/RealUniquePk.go new file mode 100644 index 00000000..8d22f752 --- /dev/null +++ b/internal/integration_tests/postgres/defaultsettings/RealUniquePk.go @@ -0,0 +1,5 @@ +package dto + +type RealUniquePk struct { + RealUniquePk float64 `db:"real_unique_pk"` +} diff --git a/internal/integration_tests/postgres/defaultsettings/Serial.go b/internal/integration_tests/postgres/defaultsettings/Serial.go new file mode 100644 index 00000000..074fa24a --- /dev/null +++ b/internal/integration_tests/postgres/defaultsettings/Serial.go @@ -0,0 +1,5 @@ +package dto + +type Serial struct { + Serial int `db:"serial"` +} diff --git a/internal/integration_tests/postgres/defaultsettings/Serial2.go b/internal/integration_tests/postgres/defaultsettings/Serial2.go new file mode 100644 index 00000000..65429d08 --- /dev/null +++ b/internal/integration_tests/postgres/defaultsettings/Serial2.go @@ -0,0 +1,5 @@ +package dto + +type Serial2 struct { + Serial2 int `db:"serial2"` +} diff --git a/internal/integration_tests/postgres/defaultsettings/Serial2Check.go b/internal/integration_tests/postgres/defaultsettings/Serial2Check.go new file mode 100644 index 00000000..983eebf1 --- /dev/null +++ b/internal/integration_tests/postgres/defaultsettings/Serial2Check.go @@ -0,0 +1,5 @@ +package dto + +type Serial2Check struct { + Serial2 int `db:"serial2"` +} diff --git a/internal/integration_tests/postgres/defaultsettings/Serial2Notnull.go b/internal/integration_tests/postgres/defaultsettings/Serial2Notnull.go new file mode 100644 index 00000000..ae42f28b --- /dev/null +++ b/internal/integration_tests/postgres/defaultsettings/Serial2Notnull.go @@ -0,0 +1,5 @@ +package dto + +type Serial2Notnull struct { + Serial2 int `db:"serial2"` +} diff --git a/internal/integration_tests/postgres/defaultsettings/Serial2Pk.go b/internal/integration_tests/postgres/defaultsettings/Serial2Pk.go new file mode 100644 index 00000000..f8319410 --- /dev/null +++ b/internal/integration_tests/postgres/defaultsettings/Serial2Pk.go @@ -0,0 +1,5 @@ +package dto + +type Serial2Pk struct { + Serial2 int `db:"serial2"` +} diff --git a/internal/integration_tests/postgres/defaultsettings/Serial2Ref.go b/internal/integration_tests/postgres/defaultsettings/Serial2Ref.go new file mode 100644 index 00000000..fdc79172 --- /dev/null +++ b/internal/integration_tests/postgres/defaultsettings/Serial2Ref.go @@ -0,0 +1,5 @@ +package dto + +type Serial2Ref struct { + Serial2Ref int `db:"serial2_ref"` +} diff --git a/internal/integration_tests/postgres/defaultsettings/Serial2References.go b/internal/integration_tests/postgres/defaultsettings/Serial2References.go new file mode 100644 index 00000000..44b654ea --- /dev/null +++ b/internal/integration_tests/postgres/defaultsettings/Serial2References.go @@ -0,0 +1,5 @@ +package dto + +type Serial2References struct { + Serial2 int `db:"serial2"` +} diff --git a/internal/integration_tests/postgres/defaultsettings/Serial2Unique.go b/internal/integration_tests/postgres/defaultsettings/Serial2Unique.go new file mode 100644 index 00000000..30253e13 --- /dev/null +++ b/internal/integration_tests/postgres/defaultsettings/Serial2Unique.go @@ -0,0 +1,5 @@ +package dto + +type Serial2Unique struct { + Serial2 int `db:"serial2"` +} diff --git a/internal/integration_tests/postgres/defaultsettings/Serial2UniqueCheck.go b/internal/integration_tests/postgres/defaultsettings/Serial2UniqueCheck.go new file mode 100644 index 00000000..a446a09b --- /dev/null +++ b/internal/integration_tests/postgres/defaultsettings/Serial2UniqueCheck.go @@ -0,0 +1,5 @@ +package dto + +type Serial2UniqueCheck struct { + Serial2 int `db:"serial2"` +} diff --git a/internal/integration_tests/postgres/defaultsettings/Serial2UniqueCheckPk.go b/internal/integration_tests/postgres/defaultsettings/Serial2UniqueCheckPk.go new file mode 100644 index 00000000..3b802b6d --- /dev/null +++ b/internal/integration_tests/postgres/defaultsettings/Serial2UniqueCheckPk.go @@ -0,0 +1,5 @@ +package dto + +type Serial2UniqueCheckPk struct { + Serial2 int `db:"serial2"` +} diff --git a/internal/integration_tests/postgres/defaultsettings/Serial2UniqueCheckPkRef.go b/internal/integration_tests/postgres/defaultsettings/Serial2UniqueCheckPkRef.go new file mode 100644 index 00000000..4c9947dd --- /dev/null +++ b/internal/integration_tests/postgres/defaultsettings/Serial2UniqueCheckPkRef.go @@ -0,0 +1,5 @@ +package dto + +type Serial2UniqueCheckPkRef struct { + Serial2 int `db:"serial2"` +} diff --git a/internal/integration_tests/postgres/defaultsettings/Serial2UniqueCheckRef.go b/internal/integration_tests/postgres/defaultsettings/Serial2UniqueCheckRef.go new file mode 100644 index 00000000..ddac5722 --- /dev/null +++ b/internal/integration_tests/postgres/defaultsettings/Serial2UniqueCheckRef.go @@ -0,0 +1,5 @@ +package dto + +type Serial2UniqueCheckRef struct { + Serial2 int `db:"serial2"` +} diff --git a/internal/integration_tests/postgres/defaultsettings/Serial4.go b/internal/integration_tests/postgres/defaultsettings/Serial4.go new file mode 100644 index 00000000..fbb8ec97 --- /dev/null +++ b/internal/integration_tests/postgres/defaultsettings/Serial4.go @@ -0,0 +1,5 @@ +package dto + +type Serial4 struct { + Serial4 int `db:"serial4"` +} diff --git a/internal/integration_tests/postgres/defaultsettings/Serial4Check.go b/internal/integration_tests/postgres/defaultsettings/Serial4Check.go new file mode 100644 index 00000000..149274fc --- /dev/null +++ b/internal/integration_tests/postgres/defaultsettings/Serial4Check.go @@ -0,0 +1,5 @@ +package dto + +type Serial4Check struct { + Serial4 int `db:"serial4"` +} diff --git a/internal/integration_tests/postgres/defaultsettings/Serial4Notnull.go b/internal/integration_tests/postgres/defaultsettings/Serial4Notnull.go new file mode 100644 index 00000000..02d59de8 --- /dev/null +++ b/internal/integration_tests/postgres/defaultsettings/Serial4Notnull.go @@ -0,0 +1,5 @@ +package dto + +type Serial4Notnull struct { + Serial4 int `db:"serial4"` +} diff --git a/internal/integration_tests/postgres/defaultsettings/Serial4Pk.go b/internal/integration_tests/postgres/defaultsettings/Serial4Pk.go new file mode 100644 index 00000000..78956c15 --- /dev/null +++ b/internal/integration_tests/postgres/defaultsettings/Serial4Pk.go @@ -0,0 +1,5 @@ +package dto + +type Serial4Pk struct { + Serial4 int `db:"serial4"` +} diff --git a/internal/integration_tests/postgres/defaultsettings/Serial4Ref.go b/internal/integration_tests/postgres/defaultsettings/Serial4Ref.go new file mode 100644 index 00000000..d93b7703 --- /dev/null +++ b/internal/integration_tests/postgres/defaultsettings/Serial4Ref.go @@ -0,0 +1,5 @@ +package dto + +type Serial4Ref struct { + Serial4Ref int `db:"serial4_ref"` +} diff --git a/internal/integration_tests/postgres/defaultsettings/Serial4References.go b/internal/integration_tests/postgres/defaultsettings/Serial4References.go new file mode 100644 index 00000000..1244033d --- /dev/null +++ b/internal/integration_tests/postgres/defaultsettings/Serial4References.go @@ -0,0 +1,5 @@ +package dto + +type Serial4References struct { + Serial4 int `db:"serial4"` +} diff --git a/internal/integration_tests/postgres/defaultsettings/Serial4Unique.go b/internal/integration_tests/postgres/defaultsettings/Serial4Unique.go new file mode 100644 index 00000000..4ebcf67f --- /dev/null +++ b/internal/integration_tests/postgres/defaultsettings/Serial4Unique.go @@ -0,0 +1,5 @@ +package dto + +type Serial4Unique struct { + Serial4 int `db:"serial4"` +} diff --git a/internal/integration_tests/postgres/defaultsettings/Serial4UniqueCheck.go b/internal/integration_tests/postgres/defaultsettings/Serial4UniqueCheck.go new file mode 100644 index 00000000..2636dccb --- /dev/null +++ b/internal/integration_tests/postgres/defaultsettings/Serial4UniqueCheck.go @@ -0,0 +1,5 @@ +package dto + +type Serial4UniqueCheck struct { + Serial4 int `db:"serial4"` +} diff --git a/internal/integration_tests/postgres/defaultsettings/Serial4UniqueCheckPk.go b/internal/integration_tests/postgres/defaultsettings/Serial4UniqueCheckPk.go new file mode 100644 index 00000000..edf8f9f9 --- /dev/null +++ b/internal/integration_tests/postgres/defaultsettings/Serial4UniqueCheckPk.go @@ -0,0 +1,5 @@ +package dto + +type Serial4UniqueCheckPk struct { + Serial4 int `db:"serial4"` +} diff --git a/internal/integration_tests/postgres/defaultsettings/Serial4UniqueCheckPkRef.go b/internal/integration_tests/postgres/defaultsettings/Serial4UniqueCheckPkRef.go new file mode 100644 index 00000000..d7a844eb --- /dev/null +++ b/internal/integration_tests/postgres/defaultsettings/Serial4UniqueCheckPkRef.go @@ -0,0 +1,5 @@ +package dto + +type Serial4UniqueCheckPkRef struct { + Serial4 int `db:"serial4"` +} diff --git a/internal/integration_tests/postgres/defaultsettings/Serial4UniqueCheckRef.go b/internal/integration_tests/postgres/defaultsettings/Serial4UniqueCheckRef.go new file mode 100644 index 00000000..2fb663b8 --- /dev/null +++ b/internal/integration_tests/postgres/defaultsettings/Serial4UniqueCheckRef.go @@ -0,0 +1,5 @@ +package dto + +type Serial4UniqueCheckRef struct { + Serial4 int `db:"serial4"` +} diff --git a/internal/integration_tests/postgres/defaultsettings/Serial8.go b/internal/integration_tests/postgres/defaultsettings/Serial8.go new file mode 100644 index 00000000..5b06a4ce --- /dev/null +++ b/internal/integration_tests/postgres/defaultsettings/Serial8.go @@ -0,0 +1,5 @@ +package dto + +type Serial8 struct { + Serial8 int `db:"serial8"` +} diff --git a/internal/integration_tests/postgres/defaultsettings/Serial8Check.go b/internal/integration_tests/postgres/defaultsettings/Serial8Check.go new file mode 100644 index 00000000..526054e4 --- /dev/null +++ b/internal/integration_tests/postgres/defaultsettings/Serial8Check.go @@ -0,0 +1,5 @@ +package dto + +type Serial8Check struct { + Serial8 int `db:"serial8"` +} diff --git a/internal/integration_tests/postgres/defaultsettings/Serial8Notnull.go b/internal/integration_tests/postgres/defaultsettings/Serial8Notnull.go new file mode 100644 index 00000000..d9d87b15 --- /dev/null +++ b/internal/integration_tests/postgres/defaultsettings/Serial8Notnull.go @@ -0,0 +1,5 @@ +package dto + +type Serial8Notnull struct { + Serial8 int `db:"serial8"` +} diff --git a/internal/integration_tests/postgres/defaultsettings/Serial8Pk.go b/internal/integration_tests/postgres/defaultsettings/Serial8Pk.go new file mode 100644 index 00000000..3ea4311d --- /dev/null +++ b/internal/integration_tests/postgres/defaultsettings/Serial8Pk.go @@ -0,0 +1,5 @@ +package dto + +type Serial8Pk struct { + Serial8 int `db:"serial8"` +} diff --git a/internal/integration_tests/postgres/defaultsettings/Serial8Ref.go b/internal/integration_tests/postgres/defaultsettings/Serial8Ref.go new file mode 100644 index 00000000..d2de2658 --- /dev/null +++ b/internal/integration_tests/postgres/defaultsettings/Serial8Ref.go @@ -0,0 +1,5 @@ +package dto + +type Serial8Ref struct { + Serial8Ref int `db:"serial8_ref"` +} diff --git a/internal/integration_tests/postgres/defaultsettings/Serial8References.go b/internal/integration_tests/postgres/defaultsettings/Serial8References.go new file mode 100644 index 00000000..2586c9ca --- /dev/null +++ b/internal/integration_tests/postgres/defaultsettings/Serial8References.go @@ -0,0 +1,5 @@ +package dto + +type Serial8References struct { + Serial8 int `db:"serial8"` +} diff --git a/internal/integration_tests/postgres/defaultsettings/Serial8Unique.go b/internal/integration_tests/postgres/defaultsettings/Serial8Unique.go new file mode 100644 index 00000000..d912158c --- /dev/null +++ b/internal/integration_tests/postgres/defaultsettings/Serial8Unique.go @@ -0,0 +1,5 @@ +package dto + +type Serial8Unique struct { + Serial8 int `db:"serial8"` +} diff --git a/internal/integration_tests/postgres/defaultsettings/Serial8UniqueCheck.go b/internal/integration_tests/postgres/defaultsettings/Serial8UniqueCheck.go new file mode 100644 index 00000000..352e5651 --- /dev/null +++ b/internal/integration_tests/postgres/defaultsettings/Serial8UniqueCheck.go @@ -0,0 +1,5 @@ +package dto + +type Serial8UniqueCheck struct { + Serial8 int `db:"serial8"` +} diff --git a/internal/integration_tests/postgres/defaultsettings/Serial8UniqueCheckPk.go b/internal/integration_tests/postgres/defaultsettings/Serial8UniqueCheckPk.go new file mode 100644 index 00000000..14d4c662 --- /dev/null +++ b/internal/integration_tests/postgres/defaultsettings/Serial8UniqueCheckPk.go @@ -0,0 +1,5 @@ +package dto + +type Serial8UniqueCheckPk struct { + Serial8 int `db:"serial8"` +} diff --git a/internal/integration_tests/postgres/defaultsettings/Serial8UniqueCheckPkRef.go b/internal/integration_tests/postgres/defaultsettings/Serial8UniqueCheckPkRef.go new file mode 100644 index 00000000..181b67c6 --- /dev/null +++ b/internal/integration_tests/postgres/defaultsettings/Serial8UniqueCheckPkRef.go @@ -0,0 +1,5 @@ +package dto + +type Serial8UniqueCheckPkRef struct { + Serial8 int `db:"serial8"` +} diff --git a/internal/integration_tests/postgres/defaultsettings/Serial8UniqueCheckRef.go b/internal/integration_tests/postgres/defaultsettings/Serial8UniqueCheckRef.go new file mode 100644 index 00000000..0421b751 --- /dev/null +++ b/internal/integration_tests/postgres/defaultsettings/Serial8UniqueCheckRef.go @@ -0,0 +1,5 @@ +package dto + +type Serial8UniqueCheckRef struct { + Serial8 int `db:"serial8"` +} diff --git a/internal/integration_tests/postgres/defaultsettings/SerialCheck.go b/internal/integration_tests/postgres/defaultsettings/SerialCheck.go new file mode 100644 index 00000000..eda36e57 --- /dev/null +++ b/internal/integration_tests/postgres/defaultsettings/SerialCheck.go @@ -0,0 +1,5 @@ +package dto + +type SerialCheck struct { + Serial int `db:"serial"` +} diff --git a/internal/integration_tests/postgres/defaultsettings/SerialNotnull.go b/internal/integration_tests/postgres/defaultsettings/SerialNotnull.go new file mode 100644 index 00000000..71503aac --- /dev/null +++ b/internal/integration_tests/postgres/defaultsettings/SerialNotnull.go @@ -0,0 +1,5 @@ +package dto + +type SerialNotnull struct { + Serial int `db:"serial"` +} diff --git a/internal/integration_tests/postgres/defaultsettings/SerialPk.go b/internal/integration_tests/postgres/defaultsettings/SerialPk.go new file mode 100644 index 00000000..38e98376 --- /dev/null +++ b/internal/integration_tests/postgres/defaultsettings/SerialPk.go @@ -0,0 +1,5 @@ +package dto + +type SerialPk struct { + Serial int `db:"serial"` +} diff --git a/internal/integration_tests/postgres/defaultsettings/SerialRef.go b/internal/integration_tests/postgres/defaultsettings/SerialRef.go new file mode 100644 index 00000000..4e00e64c --- /dev/null +++ b/internal/integration_tests/postgres/defaultsettings/SerialRef.go @@ -0,0 +1,5 @@ +package dto + +type SerialRef struct { + SerialRef int `db:"serial_ref"` +} diff --git a/internal/integration_tests/postgres/defaultsettings/SerialReferences.go b/internal/integration_tests/postgres/defaultsettings/SerialReferences.go new file mode 100644 index 00000000..db60a6c6 --- /dev/null +++ b/internal/integration_tests/postgres/defaultsettings/SerialReferences.go @@ -0,0 +1,5 @@ +package dto + +type SerialReferences struct { + Serial int `db:"serial"` +} diff --git a/internal/integration_tests/postgres/defaultsettings/SerialUnique.go b/internal/integration_tests/postgres/defaultsettings/SerialUnique.go new file mode 100644 index 00000000..6f485376 --- /dev/null +++ b/internal/integration_tests/postgres/defaultsettings/SerialUnique.go @@ -0,0 +1,5 @@ +package dto + +type SerialUnique struct { + Serial int `db:"serial"` +} diff --git a/internal/integration_tests/postgres/defaultsettings/SerialUniqueCheck.go b/internal/integration_tests/postgres/defaultsettings/SerialUniqueCheck.go new file mode 100644 index 00000000..84598f1d --- /dev/null +++ b/internal/integration_tests/postgres/defaultsettings/SerialUniqueCheck.go @@ -0,0 +1,5 @@ +package dto + +type SerialUniqueCheck struct { + Serial int `db:"serial"` +} diff --git a/internal/integration_tests/postgres/defaultsettings/SerialUniqueCheckPk.go b/internal/integration_tests/postgres/defaultsettings/SerialUniqueCheckPk.go new file mode 100644 index 00000000..ac7ae766 --- /dev/null +++ b/internal/integration_tests/postgres/defaultsettings/SerialUniqueCheckPk.go @@ -0,0 +1,5 @@ +package dto + +type SerialUniqueCheckPk struct { + Serial int `db:"serial"` +} diff --git a/internal/integration_tests/postgres/defaultsettings/SerialUniqueCheckPkRef.go b/internal/integration_tests/postgres/defaultsettings/SerialUniqueCheckPkRef.go new file mode 100644 index 00000000..7a422f6e --- /dev/null +++ b/internal/integration_tests/postgres/defaultsettings/SerialUniqueCheckPkRef.go @@ -0,0 +1,5 @@ +package dto + +type SerialUniqueCheckPkRef struct { + Serial int `db:"serial"` +} diff --git a/internal/integration_tests/postgres/defaultsettings/SerialUniqueCheckRef.go b/internal/integration_tests/postgres/defaultsettings/SerialUniqueCheckRef.go new file mode 100644 index 00000000..ddadb8ff --- /dev/null +++ b/internal/integration_tests/postgres/defaultsettings/SerialUniqueCheckRef.go @@ -0,0 +1,5 @@ +package dto + +type SerialUniqueCheckRef struct { + Serial int `db:"serial"` +} diff --git a/internal/integration_tests/postgres/defaultsettings/Smallint.go b/internal/integration_tests/postgres/defaultsettings/Smallint.go new file mode 100644 index 00000000..bdd10f42 --- /dev/null +++ b/internal/integration_tests/postgres/defaultsettings/Smallint.go @@ -0,0 +1,33 @@ +package dto + +import ( + "database/sql" +) + +type Smallint struct { + Smallint sql.NullInt64 `db:"smallint"` + SmallintNn int `db:"smallint_nn"` + SmallintNnUnique int `db:"smallint_nn_unique"` + SmallintNnCheck int `db:"smallint_nn_check"` + SmallintNnRef int `db:"smallint_nn_ref"` + SmallintNnDefConst int `db:"smallint_nn_def_const"` + SmallintNnDefFunc int `db:"smallint_nn_def_func"` + SmallintNnUniqueCheck int `db:"smallint_nn_unique_check"` + SmallintUnique sql.NullInt64 `db:"smallint_unique"` + SmallintUniqueCheck sql.NullInt64 `db:"smallint_unique_check"` + SmallintUniqueRef sql.NullInt64 `db:"smallint_unique_ref"` + SmallintUniqueDefConst sql.NullInt64 `db:"smallint_unique_def_const"` + SmallintUniqueDefFunc sql.NullInt64 `db:"smallint_unique_def_func"` + SmallintCheck sql.NullInt64 `db:"smallint_check"` + SmallintCheckRef sql.NullInt64 `db:"smallint_check_ref"` + SmallintCheckDefConst sql.NullInt64 `db:"smallint_check_def_const"` + SmallintCheckDefFunc sql.NullInt64 `db:"smallint_check_def_func"` + SmallintRef sql.NullInt64 `db:"smallint_ref"` + SmallintRefDefConst sql.NullInt64 `db:"smallint_ref_def_const"` + SmallintRefDefFunc sql.NullInt64 `db:"smallint_ref_def_func"` + SmallintRefUniqueCheck sql.NullInt64 `db:"smallint_ref_unique_check"` + SmallintDefConst sql.NullInt64 `db:"smallint_def_const"` + SmallintDefConstUniqueCheck sql.NullInt64 `db:"smallint_def_const_unique_check"` + SmallintDefFunc sql.NullInt64 `db:"smallint_def_func"` + SmallintDefFuncUniqueCheck sql.NullInt64 `db:"smallint_def_func_unique_check"` +} diff --git a/internal/integration_tests/postgres/defaultsettings/SmallintCheckPk.go b/internal/integration_tests/postgres/defaultsettings/SmallintCheckPk.go new file mode 100644 index 00000000..b751015a --- /dev/null +++ b/internal/integration_tests/postgres/defaultsettings/SmallintCheckPk.go @@ -0,0 +1,5 @@ +package dto + +type SmallintCheckPk struct { + SmallintCheckPk int `db:"smallint_check_pk"` +} diff --git a/internal/integration_tests/postgres/defaultsettings/SmallintDefConstUniqueCheckPk.go b/internal/integration_tests/postgres/defaultsettings/SmallintDefConstUniqueCheckPk.go new file mode 100644 index 00000000..e2e17b6f --- /dev/null +++ b/internal/integration_tests/postgres/defaultsettings/SmallintDefConstUniqueCheckPk.go @@ -0,0 +1,5 @@ +package dto + +type SmallintDefConstUniqueCheckPk struct { + SmallintDefConstUniqueCheckPk int `db:"smallint_def_const_unique_check_pk"` +} diff --git a/internal/integration_tests/postgres/defaultsettings/SmallintDefConstUniqueCheckPkRef.go b/internal/integration_tests/postgres/defaultsettings/SmallintDefConstUniqueCheckPkRef.go new file mode 100644 index 00000000..827d36f7 --- /dev/null +++ b/internal/integration_tests/postgres/defaultsettings/SmallintDefConstUniqueCheckPkRef.go @@ -0,0 +1,5 @@ +package dto + +type SmallintDefConstUniqueCheckPkRef struct { + SmallintDefConstUniqueCheckPkRef int `db:"smallint_def_const_unique_check_pk_ref"` +} diff --git a/internal/integration_tests/postgres/defaultsettings/SmallintDefFuncUniqueCheckPk.go b/internal/integration_tests/postgres/defaultsettings/SmallintDefFuncUniqueCheckPk.go new file mode 100644 index 00000000..ab2612af --- /dev/null +++ b/internal/integration_tests/postgres/defaultsettings/SmallintDefFuncUniqueCheckPk.go @@ -0,0 +1,5 @@ +package dto + +type SmallintDefFuncUniqueCheckPk struct { + SmallintDefFuncUniqueCheckPk int `db:"smallint_def_func_unique_check_pk"` +} diff --git a/internal/integration_tests/postgres/defaultsettings/SmallintDefFuncUniqueCheckPkRef.go b/internal/integration_tests/postgres/defaultsettings/SmallintDefFuncUniqueCheckPkRef.go new file mode 100644 index 00000000..3aef8dba --- /dev/null +++ b/internal/integration_tests/postgres/defaultsettings/SmallintDefFuncUniqueCheckPkRef.go @@ -0,0 +1,5 @@ +package dto + +type SmallintDefFuncUniqueCheckPkRef struct { + SmallintDefFuncUniqueCheckPkRef int `db:"smallint_def_func_unique_check_pk_ref"` +} diff --git a/internal/integration_tests/postgres/defaultsettings/SmallintNnPk.go b/internal/integration_tests/postgres/defaultsettings/SmallintNnPk.go new file mode 100644 index 00000000..e860d504 --- /dev/null +++ b/internal/integration_tests/postgres/defaultsettings/SmallintNnPk.go @@ -0,0 +1,5 @@ +package dto + +type SmallintNnPk struct { + SmallintNnPk int `db:"smallint_nn_pk"` +} diff --git a/internal/integration_tests/postgres/defaultsettings/SmallintNnUniqueCheckPk.go b/internal/integration_tests/postgres/defaultsettings/SmallintNnUniqueCheckPk.go new file mode 100644 index 00000000..09158e0c --- /dev/null +++ b/internal/integration_tests/postgres/defaultsettings/SmallintNnUniqueCheckPk.go @@ -0,0 +1,5 @@ +package dto + +type SmallintNnUniqueCheckPk struct { + SmallintNnUniqueCheckPk int `db:"smallint_nn_unique_check_pk"` +} diff --git a/internal/integration_tests/postgres/defaultsettings/SmallintNnUniqueCheckPkRef.go b/internal/integration_tests/postgres/defaultsettings/SmallintNnUniqueCheckPkRef.go new file mode 100644 index 00000000..29099ecd --- /dev/null +++ b/internal/integration_tests/postgres/defaultsettings/SmallintNnUniqueCheckPkRef.go @@ -0,0 +1,5 @@ +package dto + +type SmallintNnUniqueCheckPkRef struct { + SmallintNnUniqueCheckPkRef int `db:"smallint_nn_unique_check_pk_ref"` +} diff --git a/internal/integration_tests/postgres/defaultsettings/SmallintPk.go b/internal/integration_tests/postgres/defaultsettings/SmallintPk.go new file mode 100644 index 00000000..7e31ea21 --- /dev/null +++ b/internal/integration_tests/postgres/defaultsettings/SmallintPk.go @@ -0,0 +1,5 @@ +package dto + +type SmallintPk struct { + SmallintPk int `db:"smallint_pk"` +} diff --git a/internal/integration_tests/postgres/defaultsettings/SmallintPkDefConst.go b/internal/integration_tests/postgres/defaultsettings/SmallintPkDefConst.go new file mode 100644 index 00000000..6674cb63 --- /dev/null +++ b/internal/integration_tests/postgres/defaultsettings/SmallintPkDefConst.go @@ -0,0 +1,5 @@ +package dto + +type SmallintPkDefConst struct { + SmallintPkDefConst int `db:"smallint_pk_def_const"` +} diff --git a/internal/integration_tests/postgres/defaultsettings/SmallintPkDefFunc.go b/internal/integration_tests/postgres/defaultsettings/SmallintPkDefFunc.go new file mode 100644 index 00000000..3951e6bf --- /dev/null +++ b/internal/integration_tests/postgres/defaultsettings/SmallintPkDefFunc.go @@ -0,0 +1,5 @@ +package dto + +type SmallintPkDefFunc struct { + SmallintPkDefFunc int `db:"smallint_pk_def_func"` +} diff --git a/internal/integration_tests/postgres/defaultsettings/SmallintPkRef.go b/internal/integration_tests/postgres/defaultsettings/SmallintPkRef.go new file mode 100644 index 00000000..fc0176ef --- /dev/null +++ b/internal/integration_tests/postgres/defaultsettings/SmallintPkRef.go @@ -0,0 +1,5 @@ +package dto + +type SmallintPkRef struct { + SmallintPkRef int `db:"smallint_pk_ref"` +} diff --git a/internal/integration_tests/postgres/defaultsettings/SmallintRef.go b/internal/integration_tests/postgres/defaultsettings/SmallintRef.go new file mode 100644 index 00000000..c2924ae4 --- /dev/null +++ b/internal/integration_tests/postgres/defaultsettings/SmallintRef.go @@ -0,0 +1,9 @@ +package dto + +import ( + "database/sql" +) + +type SmallintRef struct { + SmallintRef sql.NullInt64 `db:"smallint_ref"` +} diff --git a/internal/integration_tests/postgres/defaultsettings/SmallintUniqueCheckPk.go b/internal/integration_tests/postgres/defaultsettings/SmallintUniqueCheckPk.go new file mode 100644 index 00000000..3cf7cccc --- /dev/null +++ b/internal/integration_tests/postgres/defaultsettings/SmallintUniqueCheckPk.go @@ -0,0 +1,5 @@ +package dto + +type SmallintUniqueCheckPk struct { + SmallintUniqueCheckPk int `db:"smallint_unique_check_pk"` +} diff --git a/internal/integration_tests/postgres/defaultsettings/SmallintUniqueCheckPkRef.go b/internal/integration_tests/postgres/defaultsettings/SmallintUniqueCheckPkRef.go new file mode 100644 index 00000000..2dc8bfd8 --- /dev/null +++ b/internal/integration_tests/postgres/defaultsettings/SmallintUniqueCheckPkRef.go @@ -0,0 +1,5 @@ +package dto + +type SmallintUniqueCheckPkRef struct { + SmallintUniqueCheckPkRef int `db:"smallint_unique_check_pk_ref"` +} diff --git a/internal/integration_tests/postgres/defaultsettings/SmallintUniquePk.go b/internal/integration_tests/postgres/defaultsettings/SmallintUniquePk.go new file mode 100644 index 00000000..1814500f --- /dev/null +++ b/internal/integration_tests/postgres/defaultsettings/SmallintUniquePk.go @@ -0,0 +1,5 @@ +package dto + +type SmallintUniquePk struct { + SmallintUniquePk int `db:"smallint_unique_pk"` +} diff --git a/internal/integration_tests/postgres/defaultsettings/Smallserial.go b/internal/integration_tests/postgres/defaultsettings/Smallserial.go new file mode 100644 index 00000000..e149ab37 --- /dev/null +++ b/internal/integration_tests/postgres/defaultsettings/Smallserial.go @@ -0,0 +1,5 @@ +package dto + +type Smallserial struct { + Smallserial int `db:"smallserial"` +} diff --git a/internal/integration_tests/postgres/defaultsettings/SmallserialCheck.go b/internal/integration_tests/postgres/defaultsettings/SmallserialCheck.go new file mode 100644 index 00000000..996c751c --- /dev/null +++ b/internal/integration_tests/postgres/defaultsettings/SmallserialCheck.go @@ -0,0 +1,5 @@ +package dto + +type SmallserialCheck struct { + Smallserial int `db:"smallserial"` +} diff --git a/internal/integration_tests/postgres/defaultsettings/SmallserialNotnull.go b/internal/integration_tests/postgres/defaultsettings/SmallserialNotnull.go new file mode 100644 index 00000000..d3b27168 --- /dev/null +++ b/internal/integration_tests/postgres/defaultsettings/SmallserialNotnull.go @@ -0,0 +1,5 @@ +package dto + +type SmallserialNotnull struct { + Smallserial int `db:"smallserial"` +} diff --git a/internal/integration_tests/postgres/defaultsettings/SmallserialPk.go b/internal/integration_tests/postgres/defaultsettings/SmallserialPk.go new file mode 100644 index 00000000..44adb058 --- /dev/null +++ b/internal/integration_tests/postgres/defaultsettings/SmallserialPk.go @@ -0,0 +1,5 @@ +package dto + +type SmallserialPk struct { + Smallserial int `db:"smallserial"` +} diff --git a/internal/integration_tests/postgres/defaultsettings/SmallserialRef.go b/internal/integration_tests/postgres/defaultsettings/SmallserialRef.go new file mode 100644 index 00000000..0b87f668 --- /dev/null +++ b/internal/integration_tests/postgres/defaultsettings/SmallserialRef.go @@ -0,0 +1,5 @@ +package dto + +type SmallserialRef struct { + SmallserialRef int `db:"smallserial_ref"` +} diff --git a/internal/integration_tests/postgres/defaultsettings/SmallserialReferences.go b/internal/integration_tests/postgres/defaultsettings/SmallserialReferences.go new file mode 100644 index 00000000..632d8427 --- /dev/null +++ b/internal/integration_tests/postgres/defaultsettings/SmallserialReferences.go @@ -0,0 +1,5 @@ +package dto + +type SmallserialReferences struct { + Smallserial int `db:"smallserial"` +} diff --git a/internal/integration_tests/postgres/defaultsettings/SmallserialUnique.go b/internal/integration_tests/postgres/defaultsettings/SmallserialUnique.go new file mode 100644 index 00000000..1848f100 --- /dev/null +++ b/internal/integration_tests/postgres/defaultsettings/SmallserialUnique.go @@ -0,0 +1,5 @@ +package dto + +type SmallserialUnique struct { + Smallserial int `db:"smallserial"` +} diff --git a/internal/integration_tests/postgres/defaultsettings/SmallserialUniqueCheck.go b/internal/integration_tests/postgres/defaultsettings/SmallserialUniqueCheck.go new file mode 100644 index 00000000..d8ba7e2e --- /dev/null +++ b/internal/integration_tests/postgres/defaultsettings/SmallserialUniqueCheck.go @@ -0,0 +1,5 @@ +package dto + +type SmallserialUniqueCheck struct { + Smallserial int `db:"smallserial"` +} diff --git a/internal/integration_tests/postgres/defaultsettings/SmallserialUniqueCheckPk.go b/internal/integration_tests/postgres/defaultsettings/SmallserialUniqueCheckPk.go new file mode 100644 index 00000000..08928c7c --- /dev/null +++ b/internal/integration_tests/postgres/defaultsettings/SmallserialUniqueCheckPk.go @@ -0,0 +1,5 @@ +package dto + +type SmallserialUniqueCheckPk struct { + Smallserial int `db:"smallserial"` +} diff --git a/internal/integration_tests/postgres/defaultsettings/SmallserialUniqueCheckPkRef.go b/internal/integration_tests/postgres/defaultsettings/SmallserialUniqueCheckPkRef.go new file mode 100644 index 00000000..1fee4e9a --- /dev/null +++ b/internal/integration_tests/postgres/defaultsettings/SmallserialUniqueCheckPkRef.go @@ -0,0 +1,5 @@ +package dto + +type SmallserialUniqueCheckPkRef struct { + Smallserial int `db:"smallserial"` +} diff --git a/internal/integration_tests/postgres/defaultsettings/SmallserialUniqueCheckRef.go b/internal/integration_tests/postgres/defaultsettings/SmallserialUniqueCheckRef.go new file mode 100644 index 00000000..0e8da3ee --- /dev/null +++ b/internal/integration_tests/postgres/defaultsettings/SmallserialUniqueCheckRef.go @@ -0,0 +1,5 @@ +package dto + +type SmallserialUniqueCheckRef struct { + Smallserial int `db:"smallserial"` +} diff --git a/internal/integration_tests/postgres/defaultsettings/Text.go b/internal/integration_tests/postgres/defaultsettings/Text.go new file mode 100644 index 00000000..4f49b171 --- /dev/null +++ b/internal/integration_tests/postgres/defaultsettings/Text.go @@ -0,0 +1,34 @@ +package dto + +import ( + "database/sql" +) + +type Text struct { + Text sql.NullString `db:"text"` + TextNn string `db:"text_nn"` + TextNnUnique string `db:"text_nn_unique"` + TextNnCheckCmp string `db:"text_nn_check_cmp"` + TextNnCheckFn string `db:"text_nn_check_fn"` + TextNnRef string `db:"text_nn_ref"` + TextNnDefConst string `db:"text_nn_def_const"` + TextNnDefFunc string `db:"text_nn_def_func"` + TextNnUniqueCheck string `db:"text_nn_unique_check"` + TextUnique sql.NullString `db:"text_unique"` + TextUniqueCheck sql.NullString `db:"text_unique_check"` + TextUniqueRef sql.NullString `db:"text_unique_ref"` + TextUniqueDefConst sql.NullString `db:"text_unique_def_const"` + TextUniqueDefFunc sql.NullString `db:"text_unique_def_func"` + TextCheck sql.NullString `db:"text_check"` + TextCheckRef sql.NullString `db:"text_check_ref"` + TextCheckDefConst sql.NullString `db:"text_check_def_const"` + TextCheckDefFunc sql.NullString `db:"text_check_def_func"` + TextRef sql.NullString `db:"text_ref"` + TextRefDefConst sql.NullString `db:"text_ref_def_const"` + TextRefDefFunc sql.NullString `db:"text_ref_def_func"` + TextRefUniqueCheck sql.NullString `db:"text_ref_unique_check"` + TextDefConst sql.NullString `db:"text_def_const"` + TextDefConstUniqueCheck sql.NullString `db:"text_def_const_unique_check"` + TextDefFunc sql.NullString `db:"text_def_func"` + TextDefFuncUniqueCheck sql.NullString `db:"text_def_func_unique_check"` +} diff --git a/internal/integration_tests/postgres/defaultsettings/TextCheckPk.go b/internal/integration_tests/postgres/defaultsettings/TextCheckPk.go new file mode 100644 index 00000000..90f2142b --- /dev/null +++ b/internal/integration_tests/postgres/defaultsettings/TextCheckPk.go @@ -0,0 +1,5 @@ +package dto + +type TextCheckPk struct { + TextCheckPk string `db:"text_check_pk"` +} diff --git a/internal/integration_tests/postgres/defaultsettings/TextDefConstUniqueCheckPk.go b/internal/integration_tests/postgres/defaultsettings/TextDefConstUniqueCheckPk.go new file mode 100644 index 00000000..54dc441e --- /dev/null +++ b/internal/integration_tests/postgres/defaultsettings/TextDefConstUniqueCheckPk.go @@ -0,0 +1,5 @@ +package dto + +type TextDefConstUniqueCheckPk struct { + TextDefConstUniqueCheckPk string `db:"text_def_const_unique_check_pk"` +} diff --git a/internal/integration_tests/postgres/defaultsettings/TextDefConstUniqueCheckPkRef.go b/internal/integration_tests/postgres/defaultsettings/TextDefConstUniqueCheckPkRef.go new file mode 100644 index 00000000..5a08cce5 --- /dev/null +++ b/internal/integration_tests/postgres/defaultsettings/TextDefConstUniqueCheckPkRef.go @@ -0,0 +1,5 @@ +package dto + +type TextDefConstUniqueCheckPkRef struct { + TextDefConstUniqueCheckPkRef string `db:"text_def_const_unique_check_pk_ref"` +} diff --git a/internal/integration_tests/postgres/defaultsettings/TextDefFuncUniqueCheckPk.go b/internal/integration_tests/postgres/defaultsettings/TextDefFuncUniqueCheckPk.go new file mode 100644 index 00000000..64dc70e0 --- /dev/null +++ b/internal/integration_tests/postgres/defaultsettings/TextDefFuncUniqueCheckPk.go @@ -0,0 +1,5 @@ +package dto + +type TextDefFuncUniqueCheckPk struct { + TextDefFuncUniqueCheckPk string `db:"text_def_func_unique_check_pk"` +} diff --git a/internal/integration_tests/postgres/defaultsettings/TextDefFuncUniqueCheckPkRef.go b/internal/integration_tests/postgres/defaultsettings/TextDefFuncUniqueCheckPkRef.go new file mode 100644 index 00000000..8d7f4734 --- /dev/null +++ b/internal/integration_tests/postgres/defaultsettings/TextDefFuncUniqueCheckPkRef.go @@ -0,0 +1,5 @@ +package dto + +type TextDefFuncUniqueCheckPkRef struct { + TextDefFuncUniqueCheckPkRef string `db:"text_def_func_unique_check_pk_ref"` +} diff --git a/internal/integration_tests/postgres/defaultsettings/TextNnPk.go b/internal/integration_tests/postgres/defaultsettings/TextNnPk.go new file mode 100644 index 00000000..78dfe973 --- /dev/null +++ b/internal/integration_tests/postgres/defaultsettings/TextNnPk.go @@ -0,0 +1,5 @@ +package dto + +type TextNnPk struct { + TextNnPk string `db:"text_nn_pk"` +} diff --git a/internal/integration_tests/postgres/defaultsettings/TextNnUniqueCheckPk.go b/internal/integration_tests/postgres/defaultsettings/TextNnUniqueCheckPk.go new file mode 100644 index 00000000..8d3223d1 --- /dev/null +++ b/internal/integration_tests/postgres/defaultsettings/TextNnUniqueCheckPk.go @@ -0,0 +1,5 @@ +package dto + +type TextNnUniqueCheckPk struct { + TextNnUniqueCheckPk string `db:"text_nn_unique_check_pk"` +} diff --git a/internal/integration_tests/postgres/defaultsettings/TextNnUniqueCheckPkRef.go b/internal/integration_tests/postgres/defaultsettings/TextNnUniqueCheckPkRef.go new file mode 100644 index 00000000..15cfa8ef --- /dev/null +++ b/internal/integration_tests/postgres/defaultsettings/TextNnUniqueCheckPkRef.go @@ -0,0 +1,5 @@ +package dto + +type TextNnUniqueCheckPkRef struct { + TextNnUniqueCheckPkRef string `db:"text_nn_unique_check_pk_ref"` +} diff --git a/internal/integration_tests/postgres/defaultsettings/TextPk.go b/internal/integration_tests/postgres/defaultsettings/TextPk.go new file mode 100644 index 00000000..32cd8a41 --- /dev/null +++ b/internal/integration_tests/postgres/defaultsettings/TextPk.go @@ -0,0 +1,5 @@ +package dto + +type TextPk struct { + TextPk string `db:"text_pk"` +} diff --git a/internal/integration_tests/postgres/defaultsettings/TextPkDefConst.go b/internal/integration_tests/postgres/defaultsettings/TextPkDefConst.go new file mode 100644 index 00000000..362e51cb --- /dev/null +++ b/internal/integration_tests/postgres/defaultsettings/TextPkDefConst.go @@ -0,0 +1,5 @@ +package dto + +type TextPkDefConst struct { + TextPkDefConst string `db:"text_pk_def_const"` +} diff --git a/internal/integration_tests/postgres/defaultsettings/TextPkDefFunc.go b/internal/integration_tests/postgres/defaultsettings/TextPkDefFunc.go new file mode 100644 index 00000000..c6af48c3 --- /dev/null +++ b/internal/integration_tests/postgres/defaultsettings/TextPkDefFunc.go @@ -0,0 +1,5 @@ +package dto + +type TextPkDefFunc struct { + TextPkDefFunc string `db:"text_pk_def_func"` +} diff --git a/internal/integration_tests/postgres/defaultsettings/TextPkRef.go b/internal/integration_tests/postgres/defaultsettings/TextPkRef.go new file mode 100644 index 00000000..8c4e5d9f --- /dev/null +++ b/internal/integration_tests/postgres/defaultsettings/TextPkRef.go @@ -0,0 +1,5 @@ +package dto + +type TextPkRef struct { + TextPkRef string `db:"text_pk_ref"` +} diff --git a/internal/integration_tests/postgres/defaultsettings/TextRef.go b/internal/integration_tests/postgres/defaultsettings/TextRef.go new file mode 100644 index 00000000..a5022870 --- /dev/null +++ b/internal/integration_tests/postgres/defaultsettings/TextRef.go @@ -0,0 +1,9 @@ +package dto + +import ( + "database/sql" +) + +type TextRef struct { + TextRef sql.NullString `db:"text_ref"` +} diff --git a/internal/integration_tests/postgres/defaultsettings/TextUniqueCheckPk.go b/internal/integration_tests/postgres/defaultsettings/TextUniqueCheckPk.go new file mode 100644 index 00000000..26e3223a --- /dev/null +++ b/internal/integration_tests/postgres/defaultsettings/TextUniqueCheckPk.go @@ -0,0 +1,5 @@ +package dto + +type TextUniqueCheckPk struct { + TextUniqueCheckPk string `db:"text_unique_check_pk"` +} diff --git a/internal/integration_tests/postgres/defaultsettings/TextUniqueCheckPkRef.go b/internal/integration_tests/postgres/defaultsettings/TextUniqueCheckPkRef.go new file mode 100644 index 00000000..13838eb5 --- /dev/null +++ b/internal/integration_tests/postgres/defaultsettings/TextUniqueCheckPkRef.go @@ -0,0 +1,5 @@ +package dto + +type TextUniqueCheckPkRef struct { + TextUniqueCheckPkRef string `db:"text_unique_check_pk_ref"` +} diff --git a/internal/integration_tests/postgres/defaultsettings/TextUniquePk.go b/internal/integration_tests/postgres/defaultsettings/TextUniquePk.go new file mode 100644 index 00000000..cc327e98 --- /dev/null +++ b/internal/integration_tests/postgres/defaultsettings/TextUniquePk.go @@ -0,0 +1,5 @@ +package dto + +type TextUniquePk struct { + TextUniquePk string `db:"text_unique_pk"` +} diff --git a/internal/integration_tests/postgres/defaultsettings/Time.go b/internal/integration_tests/postgres/defaultsettings/Time.go new file mode 100644 index 00000000..f1c4cda1 --- /dev/null +++ b/internal/integration_tests/postgres/defaultsettings/Time.go @@ -0,0 +1,34 @@ +package dto + +import ( + "database/sql" + "time" +) + +type Time struct { + Time sql.NullTime `db:"time"` + TimeNn time.Time `db:"time_nn"` + TimeNnUnique time.Time `db:"time_nn_unique"` + TimeNnCheck time.Time `db:"time_nn_check"` + TimeNnRef time.Time `db:"time_nn_ref"` + TimeNnDefConst time.Time `db:"time_nn_def_const"` + TimeNnDefFunc time.Time `db:"time_nn_def_func"` + TimeNnUniqueCheck time.Time `db:"time_nn_unique_check"` + TimeUnique sql.NullTime `db:"time_unique"` + TimeUniqueCheck sql.NullTime `db:"time_unique_check"` + TimeUniqueRef sql.NullTime `db:"time_unique_ref"` + TimeUniqueDefConst sql.NullTime `db:"time_unique_def_const"` + TimeUniqueDefFunc sql.NullTime `db:"time_unique_def_func"` + TimeCheck sql.NullTime `db:"time_check"` + TimeCheckRef sql.NullTime `db:"time_check_ref"` + TimeCheckDefConst sql.NullTime `db:"time_check_def_const"` + TimeCheckDefFunc sql.NullTime `db:"time_check_def_func"` + TimeRef sql.NullTime `db:"time_ref"` + TimeRefDefConst sql.NullTime `db:"time_ref_def_const"` + TimeRefDefFunc sql.NullTime `db:"time_ref_def_func"` + TimeRefUniqueCheck sql.NullTime `db:"time_ref_unique_check"` + TimeDefConst sql.NullTime `db:"time_def_const"` + TimeDefConstUniqueCheck sql.NullTime `db:"time_def_const_unique_check"` + TimeDefFunc sql.NullTime `db:"time_def_func"` + TimeDefFuncUniqueCheck sql.NullTime `db:"time_def_func_unique_check"` +} diff --git a/internal/integration_tests/postgres/defaultsettings/TimeCheckPk.go b/internal/integration_tests/postgres/defaultsettings/TimeCheckPk.go new file mode 100644 index 00000000..8ac4498b --- /dev/null +++ b/internal/integration_tests/postgres/defaultsettings/TimeCheckPk.go @@ -0,0 +1,9 @@ +package dto + +import ( + "time" +) + +type TimeCheckPk struct { + TimeCheckPk time.Time `db:"time_check_pk"` +} diff --git a/internal/integration_tests/postgres/defaultsettings/TimeDefConstUniqueCheckPk.go b/internal/integration_tests/postgres/defaultsettings/TimeDefConstUniqueCheckPk.go new file mode 100644 index 00000000..f9d70c06 --- /dev/null +++ b/internal/integration_tests/postgres/defaultsettings/TimeDefConstUniqueCheckPk.go @@ -0,0 +1,9 @@ +package dto + +import ( + "time" +) + +type TimeDefConstUniqueCheckPk struct { + TimeDefConstUniqueCheckPk time.Time `db:"time_def_const_unique_check_pk"` +} diff --git a/internal/integration_tests/postgres/defaultsettings/TimeDefConstUniqueCheckPkRef.go b/internal/integration_tests/postgres/defaultsettings/TimeDefConstUniqueCheckPkRef.go new file mode 100644 index 00000000..227c15c5 --- /dev/null +++ b/internal/integration_tests/postgres/defaultsettings/TimeDefConstUniqueCheckPkRef.go @@ -0,0 +1,9 @@ +package dto + +import ( + "time" +) + +type TimeDefConstUniqueCheckPkRef struct { + TimeDefConstUniqueCheckPkRef time.Time `db:"time_def_const_unique_check_pk_ref"` +} diff --git a/internal/integration_tests/postgres/defaultsettings/TimeDefFuncUniqueCheckPk.go b/internal/integration_tests/postgres/defaultsettings/TimeDefFuncUniqueCheckPk.go new file mode 100644 index 00000000..5058c3c9 --- /dev/null +++ b/internal/integration_tests/postgres/defaultsettings/TimeDefFuncUniqueCheckPk.go @@ -0,0 +1,9 @@ +package dto + +import ( + "time" +) + +type TimeDefFuncUniqueCheckPk struct { + TimeDefFuncUniqueCheckPk time.Time `db:"time_def_func_unique_check_pk"` +} diff --git a/internal/integration_tests/postgres/defaultsettings/TimeDefFuncUniqueCheckPkRef.go b/internal/integration_tests/postgres/defaultsettings/TimeDefFuncUniqueCheckPkRef.go new file mode 100644 index 00000000..c07b24c2 --- /dev/null +++ b/internal/integration_tests/postgres/defaultsettings/TimeDefFuncUniqueCheckPkRef.go @@ -0,0 +1,9 @@ +package dto + +import ( + "time" +) + +type TimeDefFuncUniqueCheckPkRef struct { + TimeDefFuncUniqueCheckPkRef time.Time `db:"time_def_func_unique_check_pk_ref"` +} diff --git a/internal/integration_tests/postgres/defaultsettings/TimeNnPk.go b/internal/integration_tests/postgres/defaultsettings/TimeNnPk.go new file mode 100644 index 00000000..9b53ef52 --- /dev/null +++ b/internal/integration_tests/postgres/defaultsettings/TimeNnPk.go @@ -0,0 +1,9 @@ +package dto + +import ( + "time" +) + +type TimeNnPk struct { + TimeNnPk time.Time `db:"time_nn_pk"` +} diff --git a/internal/integration_tests/postgres/defaultsettings/TimeNnUniqueCheckPk.go b/internal/integration_tests/postgres/defaultsettings/TimeNnUniqueCheckPk.go new file mode 100644 index 00000000..ab75df92 --- /dev/null +++ b/internal/integration_tests/postgres/defaultsettings/TimeNnUniqueCheckPk.go @@ -0,0 +1,9 @@ +package dto + +import ( + "time" +) + +type TimeNnUniqueCheckPk struct { + TimeNnUniqueCheckPk time.Time `db:"time_nn_unique_check_pk"` +} diff --git a/internal/integration_tests/postgres/defaultsettings/TimeNnUniqueCheckPkRef.go b/internal/integration_tests/postgres/defaultsettings/TimeNnUniqueCheckPkRef.go new file mode 100644 index 00000000..37926bf8 --- /dev/null +++ b/internal/integration_tests/postgres/defaultsettings/TimeNnUniqueCheckPkRef.go @@ -0,0 +1,9 @@ +package dto + +import ( + "time" +) + +type TimeNnUniqueCheckPkRef struct { + TimeNnUniqueCheckPkRef time.Time `db:"time_nn_unique_check_pk_ref"` +} diff --git a/internal/integration_tests/postgres/defaultsettings/TimePk.go b/internal/integration_tests/postgres/defaultsettings/TimePk.go new file mode 100644 index 00000000..4cb08dc4 --- /dev/null +++ b/internal/integration_tests/postgres/defaultsettings/TimePk.go @@ -0,0 +1,9 @@ +package dto + +import ( + "time" +) + +type TimePk struct { + TimePk time.Time `db:"time_pk"` +} diff --git a/internal/integration_tests/postgres/defaultsettings/TimePkDefConst.go b/internal/integration_tests/postgres/defaultsettings/TimePkDefConst.go new file mode 100644 index 00000000..7f119e6f --- /dev/null +++ b/internal/integration_tests/postgres/defaultsettings/TimePkDefConst.go @@ -0,0 +1,9 @@ +package dto + +import ( + "time" +) + +type TimePkDefConst struct { + TimePkDefConst time.Time `db:"time_pk_def_const"` +} diff --git a/internal/integration_tests/postgres/defaultsettings/TimePkDefFunc.go b/internal/integration_tests/postgres/defaultsettings/TimePkDefFunc.go new file mode 100644 index 00000000..6b5c04c3 --- /dev/null +++ b/internal/integration_tests/postgres/defaultsettings/TimePkDefFunc.go @@ -0,0 +1,9 @@ +package dto + +import ( + "time" +) + +type TimePkDefFunc struct { + TimePkDefFunc time.Time `db:"time_pk_def_func"` +} diff --git a/internal/integration_tests/postgres/defaultsettings/TimePkRef.go b/internal/integration_tests/postgres/defaultsettings/TimePkRef.go new file mode 100644 index 00000000..f2f24a81 --- /dev/null +++ b/internal/integration_tests/postgres/defaultsettings/TimePkRef.go @@ -0,0 +1,9 @@ +package dto + +import ( + "time" +) + +type TimePkRef struct { + TimePkRef time.Time `db:"time_pk_ref"` +} diff --git a/internal/integration_tests/postgres/defaultsettings/TimeRef.go b/internal/integration_tests/postgres/defaultsettings/TimeRef.go new file mode 100644 index 00000000..d31ee043 --- /dev/null +++ b/internal/integration_tests/postgres/defaultsettings/TimeRef.go @@ -0,0 +1,9 @@ +package dto + +import ( + "database/sql" +) + +type TimeRef struct { + TimeRef sql.NullTime `db:"time_ref"` +} diff --git a/internal/integration_tests/postgres/defaultsettings/TimeUniqueCheckPk.go b/internal/integration_tests/postgres/defaultsettings/TimeUniqueCheckPk.go new file mode 100644 index 00000000..24140cb6 --- /dev/null +++ b/internal/integration_tests/postgres/defaultsettings/TimeUniqueCheckPk.go @@ -0,0 +1,9 @@ +package dto + +import ( + "time" +) + +type TimeUniqueCheckPk struct { + TimeUniqueCheckPk time.Time `db:"time_unique_check_pk"` +} diff --git a/internal/integration_tests/postgres/defaultsettings/TimeUniqueCheckPkRef.go b/internal/integration_tests/postgres/defaultsettings/TimeUniqueCheckPkRef.go new file mode 100644 index 00000000..4772a2c9 --- /dev/null +++ b/internal/integration_tests/postgres/defaultsettings/TimeUniqueCheckPkRef.go @@ -0,0 +1,9 @@ +package dto + +import ( + "time" +) + +type TimeUniqueCheckPkRef struct { + TimeUniqueCheckPkRef time.Time `db:"time_unique_check_pk_ref"` +} diff --git a/internal/integration_tests/postgres/defaultsettings/TimeUniquePk.go b/internal/integration_tests/postgres/defaultsettings/TimeUniquePk.go new file mode 100644 index 00000000..4a5a293b --- /dev/null +++ b/internal/integration_tests/postgres/defaultsettings/TimeUniquePk.go @@ -0,0 +1,9 @@ +package dto + +import ( + "time" +) + +type TimeUniquePk struct { + TimeUniquePk time.Time `db:"time_unique_pk"` +} diff --git a/internal/integration_tests/postgres/defaultsettings/TimeWithTimeZone.go b/internal/integration_tests/postgres/defaultsettings/TimeWithTimeZone.go new file mode 100644 index 00000000..9659a6fb --- /dev/null +++ b/internal/integration_tests/postgres/defaultsettings/TimeWithTimeZone.go @@ -0,0 +1,34 @@ +package dto + +import ( + "database/sql" + "time" +) + +type TimeWithTimeZone struct { + TimeWithTimeZone sql.NullTime `db:"time_with_time_zone"` + TimeWithTimeZoneNn time.Time `db:"time_with_time_zone_nn"` + TimeWithTimeZoneNnUnique time.Time `db:"time_with_time_zone_nn_unique"` + TimeWithTimeZoneNnCheck time.Time `db:"time_with_time_zone_nn_check"` + TimeWithTimeZoneNnRef time.Time `db:"time_with_time_zone_nn_ref"` + TimeWithTimeZoneNnDefConst time.Time `db:"time_with_time_zone_nn_def_const"` + TimeWithTimeZoneNnDefFunc time.Time `db:"time_with_time_zone_nn_def_func"` + TimeWithTimeZoneNnUniqueCheck time.Time `db:"time_with_time_zone_nn_unique_check"` + TimeWithTimeZoneUnique sql.NullTime `db:"time_with_time_zone_unique"` + TimeWithTimeZoneUniqueCheck sql.NullTime `db:"time_with_time_zone_unique_check"` + TimeWithTimeZoneUniqueRef sql.NullTime `db:"time_with_time_zone_unique_ref"` + TimeWithTimeZoneUniqueDefConst sql.NullTime `db:"time_with_time_zone_unique_def_const"` + TimeWithTimeZoneUniqueDefFunc sql.NullTime `db:"time_with_time_zone_unique_def_func"` + TimeWithTimeZoneCheck sql.NullTime `db:"time_with_time_zone_check"` + TimeWithTimeZoneCheckRef sql.NullTime `db:"time_with_time_zone_check_ref"` + TimeWithTimeZoneCheckDefConst sql.NullTime `db:"time_with_time_zone_check_def_const"` + TimeWithTimeZoneCheckDefFunc sql.NullTime `db:"time_with_time_zone_check_def_func"` + TimeWithTimeZoneRef sql.NullTime `db:"time_with_time_zone_ref"` + TimeWithTimeZoneRefDefConst sql.NullTime `db:"time_with_time_zone_ref_def_const"` + TimeWithTimeZoneRefDefFunc sql.NullTime `db:"time_with_time_zone_ref_def_func"` + TimeWithTimeZoneRefUniqueCheck sql.NullTime `db:"time_with_time_zone_ref_unique_check"` + TimeWithTimeZoneDefConst sql.NullTime `db:"time_with_time_zone_def_const"` + TimeWithTimeZoneDefConstUniqueCheck sql.NullTime `db:"time_with_time_zone_def_const_unique_check"` + TimeWithTimeZoneDefFunc sql.NullTime `db:"time_with_time_zone_def_func"` + TimeWithTimeZoneDefFuncUniqueCheck sql.NullTime `db:"time_with_time_zone_def_func_unique_check"` +} diff --git a/internal/integration_tests/postgres/defaultsettings/TimeWithTimeZoneCheckPk.go b/internal/integration_tests/postgres/defaultsettings/TimeWithTimeZoneCheckPk.go new file mode 100644 index 00000000..7c565940 --- /dev/null +++ b/internal/integration_tests/postgres/defaultsettings/TimeWithTimeZoneCheckPk.go @@ -0,0 +1,9 @@ +package dto + +import ( + "time" +) + +type TimeWithTimeZoneCheckPk struct { + TimeWithTimeZoneCheckPk time.Time `db:"time_with_time_zone_check_pk"` +} diff --git a/internal/integration_tests/postgres/defaultsettings/TimeWithTimeZoneDefConstUniqueCheckPk.go b/internal/integration_tests/postgres/defaultsettings/TimeWithTimeZoneDefConstUniqueCheckPk.go new file mode 100644 index 00000000..ac2adcc0 --- /dev/null +++ b/internal/integration_tests/postgres/defaultsettings/TimeWithTimeZoneDefConstUniqueCheckPk.go @@ -0,0 +1,9 @@ +package dto + +import ( + "time" +) + +type TimeWithTimeZoneDefConstUniqueCheckPk struct { + TimeWithTimeZoneDefConstUniqueCheckPk time.Time `db:"time_with_time_zone_def_const_unique_check_pk"` +} diff --git a/internal/integration_tests/postgres/defaultsettings/TimeWithTimeZoneDefConstUniqueCheckPkRef.go b/internal/integration_tests/postgres/defaultsettings/TimeWithTimeZoneDefConstUniqueCheckPkRef.go new file mode 100644 index 00000000..65daadc5 --- /dev/null +++ b/internal/integration_tests/postgres/defaultsettings/TimeWithTimeZoneDefConstUniqueCheckPkRef.go @@ -0,0 +1,9 @@ +package dto + +import ( + "time" +) + +type TimeWithTimeZoneDefConstUniqueCheckPkRef struct { + TimeWithTimeZoneDefConstUniqueCheckPkRef time.Time `db:"time_with_time_zone_def_const_unique_check_pk_ref"` +} diff --git a/internal/integration_tests/postgres/defaultsettings/TimeWithTimeZoneDefFuncUniqueCheckPk.go b/internal/integration_tests/postgres/defaultsettings/TimeWithTimeZoneDefFuncUniqueCheckPk.go new file mode 100644 index 00000000..f0c0f8e3 --- /dev/null +++ b/internal/integration_tests/postgres/defaultsettings/TimeWithTimeZoneDefFuncUniqueCheckPk.go @@ -0,0 +1,9 @@ +package dto + +import ( + "time" +) + +type TimeWithTimeZoneDefFuncUniqueCheckPk struct { + TimeWithTimeZoneDefFuncUniqueCheckPk time.Time `db:"time_with_time_zone_def_func_unique_check_pk"` +} diff --git a/internal/integration_tests/postgres/defaultsettings/TimeWithTimeZoneDefFuncUniqueCheckPkRef.go b/internal/integration_tests/postgres/defaultsettings/TimeWithTimeZoneDefFuncUniqueCheckPkRef.go new file mode 100644 index 00000000..f132ea1b --- /dev/null +++ b/internal/integration_tests/postgres/defaultsettings/TimeWithTimeZoneDefFuncUniqueCheckPkRef.go @@ -0,0 +1,9 @@ +package dto + +import ( + "time" +) + +type TimeWithTimeZoneDefFuncUniqueCheckPkRef struct { + TimeWithTimeZoneDefFuncUniqueCheckPkRef time.Time `db:"time_with_time_zone_def_func_unique_check_pk_ref"` +} diff --git a/internal/integration_tests/postgres/defaultsettings/TimeWithTimeZoneNnPk.go b/internal/integration_tests/postgres/defaultsettings/TimeWithTimeZoneNnPk.go new file mode 100644 index 00000000..30466426 --- /dev/null +++ b/internal/integration_tests/postgres/defaultsettings/TimeWithTimeZoneNnPk.go @@ -0,0 +1,9 @@ +package dto + +import ( + "time" +) + +type TimeWithTimeZoneNnPk struct { + TimeWithTimeZoneNnPk time.Time `db:"time_with_time_zone_nn_pk"` +} diff --git a/internal/integration_tests/postgres/defaultsettings/TimeWithTimeZoneNnUniqueCheckPk.go b/internal/integration_tests/postgres/defaultsettings/TimeWithTimeZoneNnUniqueCheckPk.go new file mode 100644 index 00000000..bad71816 --- /dev/null +++ b/internal/integration_tests/postgres/defaultsettings/TimeWithTimeZoneNnUniqueCheckPk.go @@ -0,0 +1,9 @@ +package dto + +import ( + "time" +) + +type TimeWithTimeZoneNnUniqueCheckPk struct { + TimeWithTimeZoneNnUniqueCheckPk time.Time `db:"time_with_time_zone_nn_unique_check_pk"` +} diff --git a/internal/integration_tests/postgres/defaultsettings/TimeWithTimeZoneNnUniqueCheckPkRef.go b/internal/integration_tests/postgres/defaultsettings/TimeWithTimeZoneNnUniqueCheckPkRef.go new file mode 100644 index 00000000..c661a0ee --- /dev/null +++ b/internal/integration_tests/postgres/defaultsettings/TimeWithTimeZoneNnUniqueCheckPkRef.go @@ -0,0 +1,9 @@ +package dto + +import ( + "time" +) + +type TimeWithTimeZoneNnUniqueCheckPkRef struct { + TimeWithTimeZoneNnUniqueCheckPkRef time.Time `db:"time_with_time_zone_nn_unique_check_pk_ref"` +} diff --git a/internal/integration_tests/postgres/defaultsettings/TimeWithTimeZonePk.go b/internal/integration_tests/postgres/defaultsettings/TimeWithTimeZonePk.go new file mode 100644 index 00000000..c2c66a5e --- /dev/null +++ b/internal/integration_tests/postgres/defaultsettings/TimeWithTimeZonePk.go @@ -0,0 +1,9 @@ +package dto + +import ( + "time" +) + +type TimeWithTimeZonePk struct { + TimeWithTimeZonePk time.Time `db:"time_with_time_zone_pk"` +} diff --git a/internal/integration_tests/postgres/defaultsettings/TimeWithTimeZonePkDefConst.go b/internal/integration_tests/postgres/defaultsettings/TimeWithTimeZonePkDefConst.go new file mode 100644 index 00000000..0424b0ca --- /dev/null +++ b/internal/integration_tests/postgres/defaultsettings/TimeWithTimeZonePkDefConst.go @@ -0,0 +1,9 @@ +package dto + +import ( + "time" +) + +type TimeWithTimeZonePkDefConst struct { + TimeWithTimeZonePkDefConst time.Time `db:"time_with_time_zone_pk_def_const"` +} diff --git a/internal/integration_tests/postgres/defaultsettings/TimeWithTimeZonePkDefFunc.go b/internal/integration_tests/postgres/defaultsettings/TimeWithTimeZonePkDefFunc.go new file mode 100644 index 00000000..c6c98deb --- /dev/null +++ b/internal/integration_tests/postgres/defaultsettings/TimeWithTimeZonePkDefFunc.go @@ -0,0 +1,9 @@ +package dto + +import ( + "time" +) + +type TimeWithTimeZonePkDefFunc struct { + TimeWithTimeZonePkDefFunc time.Time `db:"time_with_time_zone_pk_def_func"` +} diff --git a/internal/integration_tests/postgres/defaultsettings/TimeWithTimeZonePkRef.go b/internal/integration_tests/postgres/defaultsettings/TimeWithTimeZonePkRef.go new file mode 100644 index 00000000..6924257d --- /dev/null +++ b/internal/integration_tests/postgres/defaultsettings/TimeWithTimeZonePkRef.go @@ -0,0 +1,9 @@ +package dto + +import ( + "time" +) + +type TimeWithTimeZonePkRef struct { + TimeWithTimeZonePkRef time.Time `db:"time_with_time_zone_pk_ref"` +} diff --git a/internal/integration_tests/postgres/defaultsettings/TimeWithTimeZoneRef.go b/internal/integration_tests/postgres/defaultsettings/TimeWithTimeZoneRef.go new file mode 100644 index 00000000..dbcd2d94 --- /dev/null +++ b/internal/integration_tests/postgres/defaultsettings/TimeWithTimeZoneRef.go @@ -0,0 +1,9 @@ +package dto + +import ( + "database/sql" +) + +type TimeWithTimeZoneRef struct { + TimeWithTimeZoneRef sql.NullTime `db:"time_with_time_zone_ref"` +} diff --git a/internal/integration_tests/postgres/defaultsettings/TimeWithTimeZoneUniqueCheckPk.go b/internal/integration_tests/postgres/defaultsettings/TimeWithTimeZoneUniqueCheckPk.go new file mode 100644 index 00000000..423b27b9 --- /dev/null +++ b/internal/integration_tests/postgres/defaultsettings/TimeWithTimeZoneUniqueCheckPk.go @@ -0,0 +1,9 @@ +package dto + +import ( + "time" +) + +type TimeWithTimeZoneUniqueCheckPk struct { + TimeWithTimeZoneUniqueCheckPk time.Time `db:"time_with_time_zone_unique_check_pk"` +} diff --git a/internal/integration_tests/postgres/defaultsettings/TimeWithTimeZoneUniqueCheckPkRef.go b/internal/integration_tests/postgres/defaultsettings/TimeWithTimeZoneUniqueCheckPkRef.go new file mode 100644 index 00000000..78e20af0 --- /dev/null +++ b/internal/integration_tests/postgres/defaultsettings/TimeWithTimeZoneUniqueCheckPkRef.go @@ -0,0 +1,9 @@ +package dto + +import ( + "time" +) + +type TimeWithTimeZoneUniqueCheckPkRef struct { + TimeWithTimeZoneUniqueCheckPkRef time.Time `db:"time_with_time_zone_unique_check_pk_ref"` +} diff --git a/internal/integration_tests/postgres/defaultsettings/TimeWithTimeZoneUniquePk.go b/internal/integration_tests/postgres/defaultsettings/TimeWithTimeZoneUniquePk.go new file mode 100644 index 00000000..85bc1bcb --- /dev/null +++ b/internal/integration_tests/postgres/defaultsettings/TimeWithTimeZoneUniquePk.go @@ -0,0 +1,9 @@ +package dto + +import ( + "time" +) + +type TimeWithTimeZoneUniquePk struct { + TimeWithTimeZoneUniquePk time.Time `db:"time_with_time_zone_unique_pk"` +} diff --git a/internal/integration_tests/postgres/defaultsettings/TimeWithoutTimeZone.go b/internal/integration_tests/postgres/defaultsettings/TimeWithoutTimeZone.go new file mode 100644 index 00000000..a5dd652c --- /dev/null +++ b/internal/integration_tests/postgres/defaultsettings/TimeWithoutTimeZone.go @@ -0,0 +1,34 @@ +package dto + +import ( + "database/sql" + "time" +) + +type TimeWithoutTimeZone struct { + TimeWithoutTimeZone sql.NullTime `db:"time_without_time_zone"` + TimeWithoutTimeZoneNn time.Time `db:"time_without_time_zone_nn"` + TimeWithoutTimeZoneNnUnique time.Time `db:"time_without_time_zone_nn_unique"` + TimeWithoutTimeZoneNnCheck time.Time `db:"time_without_time_zone_nn_check"` + TimeWithoutTimeZoneNnRef time.Time `db:"time_without_time_zone_nn_ref"` + TimeWithoutTimeZoneNnDefConst time.Time `db:"time_without_time_zone_nn_def_const"` + TimeWithoutTimeZoneNnDefFunc time.Time `db:"time_without_time_zone_nn_def_func"` + TimeWithoutTimeZoneNnUniqueCheck time.Time `db:"time_without_time_zone_nn_unique_check"` + TimeWithoutTimeZoneUnique sql.NullTime `db:"time_without_time_zone_unique"` + TimeWithoutTimeZoneUniqueCheck sql.NullTime `db:"time_without_time_zone_unique_check"` + TimeWithoutTimeZoneUniqueRef sql.NullTime `db:"time_without_time_zone_unique_ref"` + TimeWithoutTimeZoneUniqueDefConst sql.NullTime `db:"time_without_time_zone_unique_def_const"` + TimeWithoutTimeZoneUniqueDefFunc sql.NullTime `db:"time_without_time_zone_unique_def_func"` + TimeWithoutTimeZoneCheck sql.NullTime `db:"time_without_time_zone_check"` + TimeWithoutTimeZoneCheckRef sql.NullTime `db:"time_without_time_zone_check_ref"` + TimeWithoutTimeZoneCheckDefConst sql.NullTime `db:"time_without_time_zone_check_def_const"` + TimeWithoutTimeZoneCheckDefFunc sql.NullTime `db:"time_without_time_zone_check_def_func"` + TimeWithoutTimeZoneRef sql.NullTime `db:"time_without_time_zone_ref"` + TimeWithoutTimeZoneRefDefConst sql.NullTime `db:"time_without_time_zone_ref_def_const"` + TimeWithoutTimeZoneRefDefFunc sql.NullTime `db:"time_without_time_zone_ref_def_func"` + TimeWithoutTimeZoneRefUniqueCheck sql.NullTime `db:"time_without_time_zone_ref_unique_check"` + TimeWithoutTimeZoneDefConst sql.NullTime `db:"time_without_time_zone_def_const"` + TimeWithoutTimeZoneDefConstUniqueCheck sql.NullTime `db:"time_without_time_zone_def_const_unique_check"` + TimeWithoutTimeZoneDefFunc sql.NullTime `db:"time_without_time_zone_def_func"` + TimeWithoutTimeZoneDefFuncUniqueCheck sql.NullTime `db:"time_without_time_zone_def_func_unique_check"` +} diff --git a/internal/integration_tests/postgres/defaultsettings/TimeWithoutTimeZoneCheckPk.go b/internal/integration_tests/postgres/defaultsettings/TimeWithoutTimeZoneCheckPk.go new file mode 100644 index 00000000..4105570a --- /dev/null +++ b/internal/integration_tests/postgres/defaultsettings/TimeWithoutTimeZoneCheckPk.go @@ -0,0 +1,9 @@ +package dto + +import ( + "time" +) + +type TimeWithoutTimeZoneCheckPk struct { + TimeWithoutTimeZoneCheckPk time.Time `db:"time_without_time_zone_check_pk"` +} diff --git a/internal/integration_tests/postgres/defaultsettings/TimeWithoutTimeZoneDefConstUniqueCheckPk.go b/internal/integration_tests/postgres/defaultsettings/TimeWithoutTimeZoneDefConstUniqueCheckPk.go new file mode 100644 index 00000000..4e089da5 --- /dev/null +++ b/internal/integration_tests/postgres/defaultsettings/TimeWithoutTimeZoneDefConstUniqueCheckPk.go @@ -0,0 +1,9 @@ +package dto + +import ( + "time" +) + +type TimeWithoutTimeZoneDefConstUniqueCheckPk struct { + TimeWithoutTimeZoneDefConstUniqueCheckPk time.Time `db:"time_without_time_zone_def_const_unique_check_pk"` +} diff --git a/internal/integration_tests/postgres/defaultsettings/TimeWithoutTimeZoneDefConstUniqueCheckPkRef.go b/internal/integration_tests/postgres/defaultsettings/TimeWithoutTimeZoneDefConstUniqueCheckPkRef.go new file mode 100644 index 00000000..6c2249c2 --- /dev/null +++ b/internal/integration_tests/postgres/defaultsettings/TimeWithoutTimeZoneDefConstUniqueCheckPkRef.go @@ -0,0 +1,9 @@ +package dto + +import ( + "time" +) + +type TimeWithoutTimeZoneDefConstUniqueCheckPkRef struct { + TimeWithoutTimeZoneDefConstUniqueCheckPkRef time.Time `db:"time_without_time_zone_def_const_unique_check_pk_ref"` +} diff --git a/internal/integration_tests/postgres/defaultsettings/TimeWithoutTimeZoneDefFuncUniqueCheckPk.go b/internal/integration_tests/postgres/defaultsettings/TimeWithoutTimeZoneDefFuncUniqueCheckPk.go new file mode 100644 index 00000000..281014dd --- /dev/null +++ b/internal/integration_tests/postgres/defaultsettings/TimeWithoutTimeZoneDefFuncUniqueCheckPk.go @@ -0,0 +1,9 @@ +package dto + +import ( + "time" +) + +type TimeWithoutTimeZoneDefFuncUniqueCheckPk struct { + TimeWithoutTimeZoneDefFuncUniqueCheckPk time.Time `db:"time_without_time_zone_def_func_unique_check_pk"` +} diff --git a/internal/integration_tests/postgres/defaultsettings/TimeWithoutTimeZoneDefFuncUniqueCheckPkRef.go b/internal/integration_tests/postgres/defaultsettings/TimeWithoutTimeZoneDefFuncUniqueCheckPkRef.go new file mode 100644 index 00000000..5f359a71 --- /dev/null +++ b/internal/integration_tests/postgres/defaultsettings/TimeWithoutTimeZoneDefFuncUniqueCheckPkRef.go @@ -0,0 +1,9 @@ +package dto + +import ( + "time" +) + +type TimeWithoutTimeZoneDefFuncUniqueCheckPkRef struct { + TimeWithoutTimeZoneDefFuncUniqueCheckPkRef time.Time `db:"time_without_time_zone_def_func_unique_check_pk_ref"` +} diff --git a/internal/integration_tests/postgres/defaultsettings/TimeWithoutTimeZoneNnPk.go b/internal/integration_tests/postgres/defaultsettings/TimeWithoutTimeZoneNnPk.go new file mode 100644 index 00000000..79316c7e --- /dev/null +++ b/internal/integration_tests/postgres/defaultsettings/TimeWithoutTimeZoneNnPk.go @@ -0,0 +1,9 @@ +package dto + +import ( + "time" +) + +type TimeWithoutTimeZoneNnPk struct { + TimeWithoutTimeZoneNnPk time.Time `db:"time_without_time_zone_nn_pk"` +} diff --git a/internal/integration_tests/postgres/defaultsettings/TimeWithoutTimeZoneNnUniqueCheckPk.go b/internal/integration_tests/postgres/defaultsettings/TimeWithoutTimeZoneNnUniqueCheckPk.go new file mode 100644 index 00000000..9381fe3e --- /dev/null +++ b/internal/integration_tests/postgres/defaultsettings/TimeWithoutTimeZoneNnUniqueCheckPk.go @@ -0,0 +1,9 @@ +package dto + +import ( + "time" +) + +type TimeWithoutTimeZoneNnUniqueCheckPk struct { + TimeWithoutTimeZoneNnUniqueCheckPk time.Time `db:"time_without_time_zone_nn_unique_check_pk"` +} diff --git a/internal/integration_tests/postgres/defaultsettings/TimeWithoutTimeZoneNnUniqueCheckPkRef.go b/internal/integration_tests/postgres/defaultsettings/TimeWithoutTimeZoneNnUniqueCheckPkRef.go new file mode 100644 index 00000000..3c7930de --- /dev/null +++ b/internal/integration_tests/postgres/defaultsettings/TimeWithoutTimeZoneNnUniqueCheckPkRef.go @@ -0,0 +1,9 @@ +package dto + +import ( + "time" +) + +type TimeWithoutTimeZoneNnUniqueCheckPkRef struct { + TimeWithoutTimeZoneNnUniqueCheckPkRef time.Time `db:"time_without_time_zone_nn_unique_check_pk_ref"` +} diff --git a/internal/integration_tests/postgres/defaultsettings/TimeWithoutTimeZonePk.go b/internal/integration_tests/postgres/defaultsettings/TimeWithoutTimeZonePk.go new file mode 100644 index 00000000..18be5c5d --- /dev/null +++ b/internal/integration_tests/postgres/defaultsettings/TimeWithoutTimeZonePk.go @@ -0,0 +1,9 @@ +package dto + +import ( + "time" +) + +type TimeWithoutTimeZonePk struct { + TimeWithoutTimeZonePk time.Time `db:"time_without_time_zone_pk"` +} diff --git a/internal/integration_tests/postgres/defaultsettings/TimeWithoutTimeZonePkDefConst.go b/internal/integration_tests/postgres/defaultsettings/TimeWithoutTimeZonePkDefConst.go new file mode 100644 index 00000000..b00600d5 --- /dev/null +++ b/internal/integration_tests/postgres/defaultsettings/TimeWithoutTimeZonePkDefConst.go @@ -0,0 +1,9 @@ +package dto + +import ( + "time" +) + +type TimeWithoutTimeZonePkDefConst struct { + TimeWithoutTimeZonePkDefConst time.Time `db:"time_without_time_zone_pk_def_const"` +} diff --git a/internal/integration_tests/postgres/defaultsettings/TimeWithoutTimeZonePkDefFunc.go b/internal/integration_tests/postgres/defaultsettings/TimeWithoutTimeZonePkDefFunc.go new file mode 100644 index 00000000..2c4f235c --- /dev/null +++ b/internal/integration_tests/postgres/defaultsettings/TimeWithoutTimeZonePkDefFunc.go @@ -0,0 +1,9 @@ +package dto + +import ( + "time" +) + +type TimeWithoutTimeZonePkDefFunc struct { + TimeWithoutTimeZonePkDefFunc time.Time `db:"time_without_time_zone_pk_def_func"` +} diff --git a/internal/integration_tests/postgres/defaultsettings/TimeWithoutTimeZonePkRef.go b/internal/integration_tests/postgres/defaultsettings/TimeWithoutTimeZonePkRef.go new file mode 100644 index 00000000..0302cdd8 --- /dev/null +++ b/internal/integration_tests/postgres/defaultsettings/TimeWithoutTimeZonePkRef.go @@ -0,0 +1,9 @@ +package dto + +import ( + "time" +) + +type TimeWithoutTimeZonePkRef struct { + TimeWithoutTimeZonePkRef time.Time `db:"time_without_time_zone_pk_ref"` +} diff --git a/internal/integration_tests/postgres/defaultsettings/TimeWithoutTimeZoneRef.go b/internal/integration_tests/postgres/defaultsettings/TimeWithoutTimeZoneRef.go new file mode 100644 index 00000000..4843f7a2 --- /dev/null +++ b/internal/integration_tests/postgres/defaultsettings/TimeWithoutTimeZoneRef.go @@ -0,0 +1,9 @@ +package dto + +import ( + "database/sql" +) + +type TimeWithoutTimeZoneRef struct { + TimeWithoutTimeZoneRef sql.NullTime `db:"time_without_time_zone_ref"` +} diff --git a/internal/integration_tests/postgres/defaultsettings/TimeWithoutTimeZoneUniqueCheckPk.go b/internal/integration_tests/postgres/defaultsettings/TimeWithoutTimeZoneUniqueCheckPk.go new file mode 100644 index 00000000..25b5be4a --- /dev/null +++ b/internal/integration_tests/postgres/defaultsettings/TimeWithoutTimeZoneUniqueCheckPk.go @@ -0,0 +1,9 @@ +package dto + +import ( + "time" +) + +type TimeWithoutTimeZoneUniqueCheckPk struct { + TimeWithoutTimeZoneUniqueCheckPk time.Time `db:"time_without_time_zone_unique_check_pk"` +} diff --git a/internal/integration_tests/postgres/defaultsettings/TimeWithoutTimeZoneUniqueCheckPkRef.go b/internal/integration_tests/postgres/defaultsettings/TimeWithoutTimeZoneUniqueCheckPkRef.go new file mode 100644 index 00000000..97d3505f --- /dev/null +++ b/internal/integration_tests/postgres/defaultsettings/TimeWithoutTimeZoneUniqueCheckPkRef.go @@ -0,0 +1,9 @@ +package dto + +import ( + "time" +) + +type TimeWithoutTimeZoneUniqueCheckPkRef struct { + TimeWithoutTimeZoneUniqueCheckPkRef time.Time `db:"time_without_time_zone_unique_check_pk_ref"` +} diff --git a/internal/integration_tests/postgres/defaultsettings/TimeWithoutTimeZoneUniquePk.go b/internal/integration_tests/postgres/defaultsettings/TimeWithoutTimeZoneUniquePk.go new file mode 100644 index 00000000..2e1074f2 --- /dev/null +++ b/internal/integration_tests/postgres/defaultsettings/TimeWithoutTimeZoneUniquePk.go @@ -0,0 +1,9 @@ +package dto + +import ( + "time" +) + +type TimeWithoutTimeZoneUniquePk struct { + TimeWithoutTimeZoneUniquePk time.Time `db:"time_without_time_zone_unique_pk"` +} diff --git a/internal/integration_tests/postgres/defaultsettings/Timestamp.go b/internal/integration_tests/postgres/defaultsettings/Timestamp.go new file mode 100644 index 00000000..83a2ec4d --- /dev/null +++ b/internal/integration_tests/postgres/defaultsettings/Timestamp.go @@ -0,0 +1,34 @@ +package dto + +import ( + "database/sql" + "time" +) + +type Timestamp struct { + Timestamp sql.NullTime `db:"timestamp"` + TimestampNn time.Time `db:"timestamp_nn"` + TimestampNnUnique time.Time `db:"timestamp_nn_unique"` + TimestampNnCheck time.Time `db:"timestamp_nn_check"` + TimestampNnRef time.Time `db:"timestamp_nn_ref"` + TimestampNnDefConst time.Time `db:"timestamp_nn_def_const"` + TimestampNnDefFunc time.Time `db:"timestamp_nn_def_func"` + TimestampNnUniqueCheck time.Time `db:"timestamp_nn_unique_check"` + TimestampUnique sql.NullTime `db:"timestamp_unique"` + TimestampUniqueCheck sql.NullTime `db:"timestamp_unique_check"` + TimestampUniqueRef sql.NullTime `db:"timestamp_unique_ref"` + TimestampUniqueDefConst sql.NullTime `db:"timestamp_unique_def_const"` + TimestampUniqueDefFunc sql.NullTime `db:"timestamp_unique_def_func"` + TimestampCheck sql.NullTime `db:"timestamp_check"` + TimestampCheckRef sql.NullTime `db:"timestamp_check_ref"` + TimestampCheckDefConst sql.NullTime `db:"timestamp_check_def_const"` + TimestampCheckDefFunc sql.NullTime `db:"timestamp_check_def_func"` + TimestampRef sql.NullTime `db:"timestamp_ref"` + TimestampRefDefConst sql.NullTime `db:"timestamp_ref_def_const"` + TimestampRefDefFunc sql.NullTime `db:"timestamp_ref_def_func"` + TimestampRefUniqueCheck sql.NullTime `db:"timestamp_ref_unique_check"` + TimestampDefConst sql.NullTime `db:"timestamp_def_const"` + TimestampDefConstUniqueCheck sql.NullTime `db:"timestamp_def_const_unique_check"` + TimestampDefFunc sql.NullTime `db:"timestamp_def_func"` + TimestampDefFuncUniqueCheck sql.NullTime `db:"timestamp_def_func_unique_check"` +} diff --git a/internal/integration_tests/postgres/defaultsettings/TimestampCheckPk.go b/internal/integration_tests/postgres/defaultsettings/TimestampCheckPk.go new file mode 100644 index 00000000..11d9aac0 --- /dev/null +++ b/internal/integration_tests/postgres/defaultsettings/TimestampCheckPk.go @@ -0,0 +1,9 @@ +package dto + +import ( + "time" +) + +type TimestampCheckPk struct { + TimestampCheckPk time.Time `db:"timestamp_check_pk"` +} diff --git a/internal/integration_tests/postgres/defaultsettings/TimestampDefConstUniqueCheckPk.go b/internal/integration_tests/postgres/defaultsettings/TimestampDefConstUniqueCheckPk.go new file mode 100644 index 00000000..76291a17 --- /dev/null +++ b/internal/integration_tests/postgres/defaultsettings/TimestampDefConstUniqueCheckPk.go @@ -0,0 +1,9 @@ +package dto + +import ( + "time" +) + +type TimestampDefConstUniqueCheckPk struct { + TimestampDefConstUniqueCheckPk time.Time `db:"timestamp_def_const_unique_check_pk"` +} diff --git a/internal/integration_tests/postgres/defaultsettings/TimestampDefConstUniqueCheckPkRef.go b/internal/integration_tests/postgres/defaultsettings/TimestampDefConstUniqueCheckPkRef.go new file mode 100644 index 00000000..b5bd7f6d --- /dev/null +++ b/internal/integration_tests/postgres/defaultsettings/TimestampDefConstUniqueCheckPkRef.go @@ -0,0 +1,9 @@ +package dto + +import ( + "time" +) + +type TimestampDefConstUniqueCheckPkRef struct { + TimestampDefConstUniqueCheckPkRef time.Time `db:"timestamp_def_const_unique_check_pk_ref"` +} diff --git a/internal/integration_tests/postgres/defaultsettings/TimestampDefFuncUniqueCheckPk.go b/internal/integration_tests/postgres/defaultsettings/TimestampDefFuncUniqueCheckPk.go new file mode 100644 index 00000000..07987edb --- /dev/null +++ b/internal/integration_tests/postgres/defaultsettings/TimestampDefFuncUniqueCheckPk.go @@ -0,0 +1,9 @@ +package dto + +import ( + "time" +) + +type TimestampDefFuncUniqueCheckPk struct { + TimestampDefFuncUniqueCheckPk time.Time `db:"timestamp_def_func_unique_check_pk"` +} diff --git a/internal/integration_tests/postgres/defaultsettings/TimestampDefFuncUniqueCheckPkRef.go b/internal/integration_tests/postgres/defaultsettings/TimestampDefFuncUniqueCheckPkRef.go new file mode 100644 index 00000000..db425463 --- /dev/null +++ b/internal/integration_tests/postgres/defaultsettings/TimestampDefFuncUniqueCheckPkRef.go @@ -0,0 +1,9 @@ +package dto + +import ( + "time" +) + +type TimestampDefFuncUniqueCheckPkRef struct { + TimestampDefFuncUniqueCheckPkRef time.Time `db:"timestamp_def_func_unique_check_pk_ref"` +} diff --git a/internal/integration_tests/postgres/defaultsettings/TimestampNnPk.go b/internal/integration_tests/postgres/defaultsettings/TimestampNnPk.go new file mode 100644 index 00000000..24d62061 --- /dev/null +++ b/internal/integration_tests/postgres/defaultsettings/TimestampNnPk.go @@ -0,0 +1,9 @@ +package dto + +import ( + "time" +) + +type TimestampNnPk struct { + TimestampNnPk time.Time `db:"timestamp_nn_pk"` +} diff --git a/internal/integration_tests/postgres/defaultsettings/TimestampNnUniqueCheckPk.go b/internal/integration_tests/postgres/defaultsettings/TimestampNnUniqueCheckPk.go new file mode 100644 index 00000000..21ae8031 --- /dev/null +++ b/internal/integration_tests/postgres/defaultsettings/TimestampNnUniqueCheckPk.go @@ -0,0 +1,9 @@ +package dto + +import ( + "time" +) + +type TimestampNnUniqueCheckPk struct { + TimestampNnUniqueCheckPk time.Time `db:"timestamp_nn_unique_check_pk"` +} diff --git a/internal/integration_tests/postgres/defaultsettings/TimestampNnUniqueCheckPkRef.go b/internal/integration_tests/postgres/defaultsettings/TimestampNnUniqueCheckPkRef.go new file mode 100644 index 00000000..1c20c377 --- /dev/null +++ b/internal/integration_tests/postgres/defaultsettings/TimestampNnUniqueCheckPkRef.go @@ -0,0 +1,9 @@ +package dto + +import ( + "time" +) + +type TimestampNnUniqueCheckPkRef struct { + TimestampNnUniqueCheckPkRef time.Time `db:"timestamp_nn_unique_check_pk_ref"` +} diff --git a/internal/integration_tests/postgres/defaultsettings/TimestampPk.go b/internal/integration_tests/postgres/defaultsettings/TimestampPk.go new file mode 100644 index 00000000..5c10b8d9 --- /dev/null +++ b/internal/integration_tests/postgres/defaultsettings/TimestampPk.go @@ -0,0 +1,9 @@ +package dto + +import ( + "time" +) + +type TimestampPk struct { + TimestampPk time.Time `db:"timestamp_pk"` +} diff --git a/internal/integration_tests/postgres/defaultsettings/TimestampPkDefConst.go b/internal/integration_tests/postgres/defaultsettings/TimestampPkDefConst.go new file mode 100644 index 00000000..1aae107b --- /dev/null +++ b/internal/integration_tests/postgres/defaultsettings/TimestampPkDefConst.go @@ -0,0 +1,9 @@ +package dto + +import ( + "time" +) + +type TimestampPkDefConst struct { + TimestampPkDefConst time.Time `db:"timestamp_pk_def_const"` +} diff --git a/internal/integration_tests/postgres/defaultsettings/TimestampPkDefFunc.go b/internal/integration_tests/postgres/defaultsettings/TimestampPkDefFunc.go new file mode 100644 index 00000000..2e17c253 --- /dev/null +++ b/internal/integration_tests/postgres/defaultsettings/TimestampPkDefFunc.go @@ -0,0 +1,9 @@ +package dto + +import ( + "time" +) + +type TimestampPkDefFunc struct { + TimestampPkDefFunc time.Time `db:"timestamp_pk_def_func"` +} diff --git a/internal/integration_tests/postgres/defaultsettings/TimestampPkRef.go b/internal/integration_tests/postgres/defaultsettings/TimestampPkRef.go new file mode 100644 index 00000000..c36c99c4 --- /dev/null +++ b/internal/integration_tests/postgres/defaultsettings/TimestampPkRef.go @@ -0,0 +1,9 @@ +package dto + +import ( + "time" +) + +type TimestampPkRef struct { + TimestampPkRef time.Time `db:"timestamp_pk_ref"` +} diff --git a/internal/integration_tests/postgres/defaultsettings/TimestampRef.go b/internal/integration_tests/postgres/defaultsettings/TimestampRef.go new file mode 100644 index 00000000..b423232b --- /dev/null +++ b/internal/integration_tests/postgres/defaultsettings/TimestampRef.go @@ -0,0 +1,9 @@ +package dto + +import ( + "database/sql" +) + +type TimestampRef struct { + TimestampRef sql.NullTime `db:"timestamp_ref"` +} diff --git a/internal/integration_tests/postgres/defaultsettings/TimestampUniqueCheckPk.go b/internal/integration_tests/postgres/defaultsettings/TimestampUniqueCheckPk.go new file mode 100644 index 00000000..af5f08ff --- /dev/null +++ b/internal/integration_tests/postgres/defaultsettings/TimestampUniqueCheckPk.go @@ -0,0 +1,9 @@ +package dto + +import ( + "time" +) + +type TimestampUniqueCheckPk struct { + TimestampUniqueCheckPk time.Time `db:"timestamp_unique_check_pk"` +} diff --git a/internal/integration_tests/postgres/defaultsettings/TimestampUniqueCheckPkRef.go b/internal/integration_tests/postgres/defaultsettings/TimestampUniqueCheckPkRef.go new file mode 100644 index 00000000..a3880c53 --- /dev/null +++ b/internal/integration_tests/postgres/defaultsettings/TimestampUniqueCheckPkRef.go @@ -0,0 +1,9 @@ +package dto + +import ( + "time" +) + +type TimestampUniqueCheckPkRef struct { + TimestampUniqueCheckPkRef time.Time `db:"timestamp_unique_check_pk_ref"` +} diff --git a/internal/integration_tests/postgres/defaultsettings/TimestampUniquePk.go b/internal/integration_tests/postgres/defaultsettings/TimestampUniquePk.go new file mode 100644 index 00000000..6ef3e9ee --- /dev/null +++ b/internal/integration_tests/postgres/defaultsettings/TimestampUniquePk.go @@ -0,0 +1,9 @@ +package dto + +import ( + "time" +) + +type TimestampUniquePk struct { + TimestampUniquePk time.Time `db:"timestamp_unique_pk"` +} diff --git a/internal/integration_tests/postgres/defaultsettings/TimestampWithTimeZone.go b/internal/integration_tests/postgres/defaultsettings/TimestampWithTimeZone.go new file mode 100644 index 00000000..0a597e3e --- /dev/null +++ b/internal/integration_tests/postgres/defaultsettings/TimestampWithTimeZone.go @@ -0,0 +1,34 @@ +package dto + +import ( + "database/sql" + "time" +) + +type TimestampWithTimeZone struct { + TimestampWithTimeZone sql.NullTime `db:"timestamp_with_time_zone"` + TimestampWithTimeZoneNn time.Time `db:"timestamp_with_time_zone_nn"` + TimestampWithTimeZoneNnUnique time.Time `db:"timestamp_with_time_zone_nn_unique"` + TimestampWithTimeZoneNnCheck time.Time `db:"timestamp_with_time_zone_nn_check"` + TimestampWithTimeZoneNnRef time.Time `db:"timestamp_with_time_zone_nn_ref"` + TimestampWithTimeZoneNnDefConst time.Time `db:"timestamp_with_time_zone_nn_def_const"` + TimestampWithTimeZoneNnDefFunc time.Time `db:"timestamp_with_time_zone_nn_def_func"` + TimestampWithTimeZoneNnUniqueCheck time.Time `db:"timestamp_with_time_zone_nn_unique_check"` + TimestampWithTimeZoneUnique sql.NullTime `db:"timestamp_with_time_zone_unique"` + TimestampWithTimeZoneUniqueCheck sql.NullTime `db:"timestamp_with_time_zone_unique_check"` + TimestampWithTimeZoneUniqueRef sql.NullTime `db:"timestamp_with_time_zone_unique_ref"` + TimestampWithTimeZoneUniqueDefConst sql.NullTime `db:"timestamp_with_time_zone_unique_def_const"` + TimestampWithTimeZoneUniqueDefFunc sql.NullTime `db:"timestamp_with_time_zone_unique_def_func"` + TimestampWithTimeZoneCheck sql.NullTime `db:"timestamp_with_time_zone_check"` + TimestampWithTimeZoneCheckRef sql.NullTime `db:"timestamp_with_time_zone_check_ref"` + TimestampWithTimeZoneCheckDefConst sql.NullTime `db:"timestamp_with_time_zone_check_def_const"` + TimestampWithTimeZoneCheckDefFunc sql.NullTime `db:"timestamp_with_time_zone_check_def_func"` + TimestampWithTimeZoneRef sql.NullTime `db:"timestamp_with_time_zone_ref"` + TimestampWithTimeZoneRefDefConst sql.NullTime `db:"timestamp_with_time_zone_ref_def_const"` + TimestampWithTimeZoneRefDefFunc sql.NullTime `db:"timestamp_with_time_zone_ref_def_func"` + TimestampWithTimeZoneRefUniqueCheck sql.NullTime `db:"timestamp_with_time_zone_ref_unique_check"` + TimestampWithTimeZoneDefConst sql.NullTime `db:"timestamp_with_time_zone_def_const"` + TimestampWithTimeZoneDefConstUniqueCheck sql.NullTime `db:"timestamp_with_time_zone_def_const_unique_check"` + TimestampWithTimeZoneDefFunc sql.NullTime `db:"timestamp_with_time_zone_def_func"` + TimestampWithTimeZoneDefFuncUniqueCheck sql.NullTime `db:"timestamp_with_time_zone_def_func_unique_check"` +} diff --git a/internal/integration_tests/postgres/defaultsettings/TimestampWithTimeZoneCheckPk.go b/internal/integration_tests/postgres/defaultsettings/TimestampWithTimeZoneCheckPk.go new file mode 100644 index 00000000..652bd39d --- /dev/null +++ b/internal/integration_tests/postgres/defaultsettings/TimestampWithTimeZoneCheckPk.go @@ -0,0 +1,9 @@ +package dto + +import ( + "time" +) + +type TimestampWithTimeZoneCheckPk struct { + TimestampWithTimeZoneCheckPk time.Time `db:"timestamp_with_time_zone_check_pk"` +} diff --git a/internal/integration_tests/postgres/defaultsettings/TimestampWithTimeZoneDefConstUniqueCheckPk.go b/internal/integration_tests/postgres/defaultsettings/TimestampWithTimeZoneDefConstUniqueCheckPk.go new file mode 100644 index 00000000..392065a1 --- /dev/null +++ b/internal/integration_tests/postgres/defaultsettings/TimestampWithTimeZoneDefConstUniqueCheckPk.go @@ -0,0 +1,9 @@ +package dto + +import ( + "time" +) + +type TimestampWithTimeZoneDefConstUniqueCheckPk struct { + TimestampWithTimeZoneDefConstUniqueCheckPk time.Time `db:"timestamp_with_time_zone_def_const_unique_check_pk"` +} diff --git a/internal/integration_tests/postgres/defaultsettings/TimestampWithTimeZoneDefConstUniqueCheckPkRef.go b/internal/integration_tests/postgres/defaultsettings/TimestampWithTimeZoneDefConstUniqueCheckPkRef.go new file mode 100644 index 00000000..d63b2f24 --- /dev/null +++ b/internal/integration_tests/postgres/defaultsettings/TimestampWithTimeZoneDefConstUniqueCheckPkRef.go @@ -0,0 +1,9 @@ +package dto + +import ( + "time" +) + +type TimestampWithTimeZoneDefConstUniqueCheckPkRef struct { + TimestampWithTimeZoneDefConstUniqueCheckPkRef time.Time `db:"timestamp_with_time_zone_def_const_unique_check_pk_ref"` +} diff --git a/internal/integration_tests/postgres/defaultsettings/TimestampWithTimeZoneDefFuncUniqueCheckPk.go b/internal/integration_tests/postgres/defaultsettings/TimestampWithTimeZoneDefFuncUniqueCheckPk.go new file mode 100644 index 00000000..cdbf5b5b --- /dev/null +++ b/internal/integration_tests/postgres/defaultsettings/TimestampWithTimeZoneDefFuncUniqueCheckPk.go @@ -0,0 +1,9 @@ +package dto + +import ( + "time" +) + +type TimestampWithTimeZoneDefFuncUniqueCheckPk struct { + TimestampWithTimeZoneDefFuncUniqueCheckPk time.Time `db:"timestamp_with_time_zone_def_func_unique_check_pk"` +} diff --git a/internal/integration_tests/postgres/defaultsettings/TimestampWithTimeZoneDefFuncUniqueCheckPkRef.go b/internal/integration_tests/postgres/defaultsettings/TimestampWithTimeZoneDefFuncUniqueCheckPkRef.go new file mode 100644 index 00000000..7057fee5 --- /dev/null +++ b/internal/integration_tests/postgres/defaultsettings/TimestampWithTimeZoneDefFuncUniqueCheckPkRef.go @@ -0,0 +1,9 @@ +package dto + +import ( + "time" +) + +type TimestampWithTimeZoneDefFuncUniqueCheckPkRef struct { + TimestampWithTimeZoneDefFuncUniqueCheckPkRef time.Time `db:"timestamp_with_time_zone_def_func_unique_check_pk_ref"` +} diff --git a/internal/integration_tests/postgres/defaultsettings/TimestampWithTimeZoneNnPk.go b/internal/integration_tests/postgres/defaultsettings/TimestampWithTimeZoneNnPk.go new file mode 100644 index 00000000..5f52f0f9 --- /dev/null +++ b/internal/integration_tests/postgres/defaultsettings/TimestampWithTimeZoneNnPk.go @@ -0,0 +1,9 @@ +package dto + +import ( + "time" +) + +type TimestampWithTimeZoneNnPk struct { + TimestampWithTimeZoneNnPk time.Time `db:"timestamp_with_time_zone_nn_pk"` +} diff --git a/internal/integration_tests/postgres/defaultsettings/TimestampWithTimeZoneNnUniqueCheckPk.go b/internal/integration_tests/postgres/defaultsettings/TimestampWithTimeZoneNnUniqueCheckPk.go new file mode 100644 index 00000000..2bf18ac6 --- /dev/null +++ b/internal/integration_tests/postgres/defaultsettings/TimestampWithTimeZoneNnUniqueCheckPk.go @@ -0,0 +1,9 @@ +package dto + +import ( + "time" +) + +type TimestampWithTimeZoneNnUniqueCheckPk struct { + TimestampWithTimeZoneNnUniqueCheckPk time.Time `db:"timestamp_with_time_zone_nn_unique_check_pk"` +} diff --git a/internal/integration_tests/postgres/defaultsettings/TimestampWithTimeZoneNnUniqueCheckPkRef.go b/internal/integration_tests/postgres/defaultsettings/TimestampWithTimeZoneNnUniqueCheckPkRef.go new file mode 100644 index 00000000..e1bac907 --- /dev/null +++ b/internal/integration_tests/postgres/defaultsettings/TimestampWithTimeZoneNnUniqueCheckPkRef.go @@ -0,0 +1,9 @@ +package dto + +import ( + "time" +) + +type TimestampWithTimeZoneNnUniqueCheckPkRef struct { + TimestampWithTimeZoneNnUniqueCheckPkRef time.Time `db:"timestamp_with_time_zone_nn_unique_check_pk_ref"` +} diff --git a/internal/integration_tests/postgres/defaultsettings/TimestampWithTimeZonePk.go b/internal/integration_tests/postgres/defaultsettings/TimestampWithTimeZonePk.go new file mode 100644 index 00000000..15c05bd6 --- /dev/null +++ b/internal/integration_tests/postgres/defaultsettings/TimestampWithTimeZonePk.go @@ -0,0 +1,9 @@ +package dto + +import ( + "time" +) + +type TimestampWithTimeZonePk struct { + TimestampWithTimeZonePk time.Time `db:"timestamp_with_time_zone_pk"` +} diff --git a/internal/integration_tests/postgres/defaultsettings/TimestampWithTimeZonePkDefConst.go b/internal/integration_tests/postgres/defaultsettings/TimestampWithTimeZonePkDefConst.go new file mode 100644 index 00000000..18078b70 --- /dev/null +++ b/internal/integration_tests/postgres/defaultsettings/TimestampWithTimeZonePkDefConst.go @@ -0,0 +1,9 @@ +package dto + +import ( + "time" +) + +type TimestampWithTimeZonePkDefConst struct { + TimestampWithTimeZonePkDefConst time.Time `db:"timestamp_with_time_zone_pk_def_const"` +} diff --git a/internal/integration_tests/postgres/defaultsettings/TimestampWithTimeZonePkDefFunc.go b/internal/integration_tests/postgres/defaultsettings/TimestampWithTimeZonePkDefFunc.go new file mode 100644 index 00000000..f83a72a7 --- /dev/null +++ b/internal/integration_tests/postgres/defaultsettings/TimestampWithTimeZonePkDefFunc.go @@ -0,0 +1,9 @@ +package dto + +import ( + "time" +) + +type TimestampWithTimeZonePkDefFunc struct { + TimestampWithTimeZonePkDefFunc time.Time `db:"timestamp_with_time_zone_pk_def_func"` +} diff --git a/internal/integration_tests/postgres/defaultsettings/TimestampWithTimeZonePkRef.go b/internal/integration_tests/postgres/defaultsettings/TimestampWithTimeZonePkRef.go new file mode 100644 index 00000000..d01d43bd --- /dev/null +++ b/internal/integration_tests/postgres/defaultsettings/TimestampWithTimeZonePkRef.go @@ -0,0 +1,9 @@ +package dto + +import ( + "time" +) + +type TimestampWithTimeZonePkRef struct { + TimestampWithTimeZonePkRef time.Time `db:"timestamp_with_time_zone_pk_ref"` +} diff --git a/internal/integration_tests/postgres/defaultsettings/TimestampWithTimeZoneRef.go b/internal/integration_tests/postgres/defaultsettings/TimestampWithTimeZoneRef.go new file mode 100644 index 00000000..4e6ae724 --- /dev/null +++ b/internal/integration_tests/postgres/defaultsettings/TimestampWithTimeZoneRef.go @@ -0,0 +1,9 @@ +package dto + +import ( + "database/sql" +) + +type TimestampWithTimeZoneRef struct { + TimestampWithTimeZoneRef sql.NullTime `db:"timestamp_with_time_zone_ref"` +} diff --git a/internal/integration_tests/postgres/defaultsettings/TimestampWithTimeZoneUniqueCheckPk.go b/internal/integration_tests/postgres/defaultsettings/TimestampWithTimeZoneUniqueCheckPk.go new file mode 100644 index 00000000..6702c211 --- /dev/null +++ b/internal/integration_tests/postgres/defaultsettings/TimestampWithTimeZoneUniqueCheckPk.go @@ -0,0 +1,9 @@ +package dto + +import ( + "time" +) + +type TimestampWithTimeZoneUniqueCheckPk struct { + TimestampWithTimeZoneUniqueCheckPk time.Time `db:"timestamp_with_time_zone_unique_check_pk"` +} diff --git a/internal/integration_tests/postgres/defaultsettings/TimestampWithTimeZoneUniqueCheckPkRef.go b/internal/integration_tests/postgres/defaultsettings/TimestampWithTimeZoneUniqueCheckPkRef.go new file mode 100644 index 00000000..d23aa821 --- /dev/null +++ b/internal/integration_tests/postgres/defaultsettings/TimestampWithTimeZoneUniqueCheckPkRef.go @@ -0,0 +1,9 @@ +package dto + +import ( + "time" +) + +type TimestampWithTimeZoneUniqueCheckPkRef struct { + TimestampWithTimeZoneUniqueCheckPkRef time.Time `db:"timestamp_with_time_zone_unique_check_pk_ref"` +} diff --git a/internal/integration_tests/postgres/defaultsettings/TimestampWithTimeZoneUniquePk.go b/internal/integration_tests/postgres/defaultsettings/TimestampWithTimeZoneUniquePk.go new file mode 100644 index 00000000..86045e55 --- /dev/null +++ b/internal/integration_tests/postgres/defaultsettings/TimestampWithTimeZoneUniquePk.go @@ -0,0 +1,9 @@ +package dto + +import ( + "time" +) + +type TimestampWithTimeZoneUniquePk struct { + TimestampWithTimeZoneUniquePk time.Time `db:"timestamp_with_time_zone_unique_pk"` +} diff --git a/internal/integration_tests/postgres/defaultsettings/TimestampWithoutTimeZone.go b/internal/integration_tests/postgres/defaultsettings/TimestampWithoutTimeZone.go new file mode 100644 index 00000000..f45ce284 --- /dev/null +++ b/internal/integration_tests/postgres/defaultsettings/TimestampWithoutTimeZone.go @@ -0,0 +1,34 @@ +package dto + +import ( + "database/sql" + "time" +) + +type TimestampWithoutTimeZone struct { + TimestampWithoutTimeZone sql.NullTime `db:"timestamp_without_time_zone"` + TimestampWithoutTimeZoneNn time.Time `db:"timestamp_without_time_zone_nn"` + TimestampWithoutTimeZoneNnUnique time.Time `db:"timestamp_without_time_zone_nn_unique"` + TimestampWithoutTimeZoneNnCheck time.Time `db:"timestamp_without_time_zone_nn_check"` + TimestampWithoutTimeZoneNnRef time.Time `db:"timestamp_without_time_zone_nn_ref"` + TimestampWithoutTimeZoneNnDefConst time.Time `db:"timestamp_without_time_zone_nn_def_const"` + TimestampWithoutTimeZoneNnDefFunc time.Time `db:"timestamp_without_time_zone_nn_def_func"` + TimestampWithoutTimeZoneNnUniqueCheck time.Time `db:"timestamp_without_time_zone_nn_unique_check"` + TimestampWithoutTimeZoneUnique sql.NullTime `db:"timestamp_without_time_zone_unique"` + TimestampWithoutTimeZoneUniqueCheck sql.NullTime `db:"timestamp_without_time_zone_unique_check"` + TimestampWithoutTimeZoneUniqueRef sql.NullTime `db:"timestamp_without_time_zone_unique_ref"` + TimestampWithoutTimeZoneUniqueDefConst sql.NullTime `db:"timestamp_without_time_zone_unique_def_const"` + TimestampWithoutTimeZoneUniqueDefFunc sql.NullTime `db:"timestamp_without_time_zone_unique_def_func"` + TimestampWithoutTimeZoneCheck sql.NullTime `db:"timestamp_without_time_zone_check"` + TimestampWithoutTimeZoneCheckRef sql.NullTime `db:"timestamp_without_time_zone_check_ref"` + TimestampWithoutTimeZoneCheckDefConst sql.NullTime `db:"timestamp_without_time_zone_check_def_const"` + TimestampWithoutTimeZoneCheckDefFunc sql.NullTime `db:"timestamp_without_time_zone_check_def_func"` + TimestampWithoutTimeZoneRef sql.NullTime `db:"timestamp_without_time_zone_ref"` + TimestampWithoutTimeZoneRefDefConst sql.NullTime `db:"timestamp_without_time_zone_ref_def_const"` + TimestampWithoutTimeZoneRefDefFunc sql.NullTime `db:"timestamp_without_time_zone_ref_def_func"` + TimestampWithoutTimeZoneRefUniqueCheck sql.NullTime `db:"timestamp_without_time_zone_ref_unique_check"` + TimestampWithoutTimeZoneDefConst sql.NullTime `db:"timestamp_without_time_zone_def_const"` + TimestampWithoutTimeZoneDefConstUniqueCheck sql.NullTime `db:"timestamp_without_time_zone_def_const_unique_check"` + TimestampWithoutTimeZoneDefFunc sql.NullTime `db:"timestamp_without_time_zone_def_func"` + TimestampWithoutTimeZoneDefFuncUniqueCheck sql.NullTime `db:"timestamp_without_time_zone_def_func_unique_check"` +} diff --git a/internal/integration_tests/postgres/defaultsettings/TimestampWithoutTimeZoneCheckPk.go b/internal/integration_tests/postgres/defaultsettings/TimestampWithoutTimeZoneCheckPk.go new file mode 100644 index 00000000..6595a90d --- /dev/null +++ b/internal/integration_tests/postgres/defaultsettings/TimestampWithoutTimeZoneCheckPk.go @@ -0,0 +1,9 @@ +package dto + +import ( + "time" +) + +type TimestampWithoutTimeZoneCheckPk struct { + TimestampWithoutTimeZoneCheckPk time.Time `db:"timestamp_without_time_zone_check_pk"` +} diff --git a/internal/integration_tests/postgres/defaultsettings/TimestampWithoutTimeZoneDefConstUniqueCheckPk.go b/internal/integration_tests/postgres/defaultsettings/TimestampWithoutTimeZoneDefConstUniqueCheckPk.go new file mode 100644 index 00000000..67f7dd3d --- /dev/null +++ b/internal/integration_tests/postgres/defaultsettings/TimestampWithoutTimeZoneDefConstUniqueCheckPk.go @@ -0,0 +1,9 @@ +package dto + +import ( + "time" +) + +type TimestampWithoutTimeZoneDefConstUniqueCheckPk struct { + TimestampWithoutTimeZoneDefConstUniqueCheckPk time.Time `db:"timestamp_without_time_zone_def_const_unique_check_pk"` +} diff --git a/internal/integration_tests/postgres/defaultsettings/TimestampWithoutTimeZoneDefConstUniqueCheckPkRef.go b/internal/integration_tests/postgres/defaultsettings/TimestampWithoutTimeZoneDefConstUniqueCheckPkRef.go new file mode 100644 index 00000000..9cb78a40 --- /dev/null +++ b/internal/integration_tests/postgres/defaultsettings/TimestampWithoutTimeZoneDefConstUniqueCheckPkRef.go @@ -0,0 +1,9 @@ +package dto + +import ( + "time" +) + +type TimestampWithoutTimeZoneDefConstUniqueCheckPkRef struct { + TimestampWithoutTimeZoneDefConstUniqueCheckPkRef time.Time `db:"timestamp_without_time_zone_def_const_unique_check_pk_ref"` +} diff --git a/internal/integration_tests/postgres/defaultsettings/TimestampWithoutTimeZoneDefFuncUniqueCheckPk.go b/internal/integration_tests/postgres/defaultsettings/TimestampWithoutTimeZoneDefFuncUniqueCheckPk.go new file mode 100644 index 00000000..d656400c --- /dev/null +++ b/internal/integration_tests/postgres/defaultsettings/TimestampWithoutTimeZoneDefFuncUniqueCheckPk.go @@ -0,0 +1,9 @@ +package dto + +import ( + "time" +) + +type TimestampWithoutTimeZoneDefFuncUniqueCheckPk struct { + TimestampWithoutTimeZoneDefFuncUniqueCheckPk time.Time `db:"timestamp_without_time_zone_def_func_unique_check_pk"` +} diff --git a/internal/integration_tests/postgres/defaultsettings/TimestampWithoutTimeZoneDefFuncUniqueCheckPkRef.go b/internal/integration_tests/postgres/defaultsettings/TimestampWithoutTimeZoneDefFuncUniqueCheckPkRef.go new file mode 100644 index 00000000..2868f779 --- /dev/null +++ b/internal/integration_tests/postgres/defaultsettings/TimestampWithoutTimeZoneDefFuncUniqueCheckPkRef.go @@ -0,0 +1,9 @@ +package dto + +import ( + "time" +) + +type TimestampWithoutTimeZoneDefFuncUniqueCheckPkRef struct { + TimestampWithoutTimeZoneDefFuncUniqueCheckPkRef time.Time `db:"timestamp_without_time_zone_def_func_unique_check_pk_ref"` +} diff --git a/internal/integration_tests/postgres/defaultsettings/TimestampWithoutTimeZoneNnPk.go b/internal/integration_tests/postgres/defaultsettings/TimestampWithoutTimeZoneNnPk.go new file mode 100644 index 00000000..21aca913 --- /dev/null +++ b/internal/integration_tests/postgres/defaultsettings/TimestampWithoutTimeZoneNnPk.go @@ -0,0 +1,9 @@ +package dto + +import ( + "time" +) + +type TimestampWithoutTimeZoneNnPk struct { + TimestampWithoutTimeZoneNnPk time.Time `db:"timestamp_without_time_zone_nn_pk"` +} diff --git a/internal/integration_tests/postgres/defaultsettings/TimestampWithoutTimeZoneNnUniqueCheckPk.go b/internal/integration_tests/postgres/defaultsettings/TimestampWithoutTimeZoneNnUniqueCheckPk.go new file mode 100644 index 00000000..a4a1b3c5 --- /dev/null +++ b/internal/integration_tests/postgres/defaultsettings/TimestampWithoutTimeZoneNnUniqueCheckPk.go @@ -0,0 +1,9 @@ +package dto + +import ( + "time" +) + +type TimestampWithoutTimeZoneNnUniqueCheckPk struct { + TimestampWithoutTimeZoneNnUniqueCheckPk time.Time `db:"timestamp_without_time_zone_nn_unique_check_pk"` +} diff --git a/internal/integration_tests/postgres/defaultsettings/TimestampWithoutTimeZoneNnUniqueCheckPkRef.go b/internal/integration_tests/postgres/defaultsettings/TimestampWithoutTimeZoneNnUniqueCheckPkRef.go new file mode 100644 index 00000000..2de8d6e4 --- /dev/null +++ b/internal/integration_tests/postgres/defaultsettings/TimestampWithoutTimeZoneNnUniqueCheckPkRef.go @@ -0,0 +1,9 @@ +package dto + +import ( + "time" +) + +type TimestampWithoutTimeZoneNnUniqueCheckPkRef struct { + TimestampWithoutTimeZoneNnUniqueCheckPkRef time.Time `db:"timestamp_without_time_zone_nn_unique_check_pk_ref"` +} diff --git a/internal/integration_tests/postgres/defaultsettings/TimestampWithoutTimeZonePk.go b/internal/integration_tests/postgres/defaultsettings/TimestampWithoutTimeZonePk.go new file mode 100644 index 00000000..f76e1853 --- /dev/null +++ b/internal/integration_tests/postgres/defaultsettings/TimestampWithoutTimeZonePk.go @@ -0,0 +1,9 @@ +package dto + +import ( + "time" +) + +type TimestampWithoutTimeZonePk struct { + TimestampWithoutTimeZonePk time.Time `db:"timestamp_without_time_zone_pk"` +} diff --git a/internal/integration_tests/postgres/defaultsettings/TimestampWithoutTimeZonePkDefConst.go b/internal/integration_tests/postgres/defaultsettings/TimestampWithoutTimeZonePkDefConst.go new file mode 100644 index 00000000..993f1dd5 --- /dev/null +++ b/internal/integration_tests/postgres/defaultsettings/TimestampWithoutTimeZonePkDefConst.go @@ -0,0 +1,9 @@ +package dto + +import ( + "time" +) + +type TimestampWithoutTimeZonePkDefConst struct { + TimestampWithoutTimeZonePkDefConst time.Time `db:"timestamp_without_time_zone_pk_def_const"` +} diff --git a/internal/integration_tests/postgres/defaultsettings/TimestampWithoutTimeZonePkDefFunc.go b/internal/integration_tests/postgres/defaultsettings/TimestampWithoutTimeZonePkDefFunc.go new file mode 100644 index 00000000..e859ae54 --- /dev/null +++ b/internal/integration_tests/postgres/defaultsettings/TimestampWithoutTimeZonePkDefFunc.go @@ -0,0 +1,9 @@ +package dto + +import ( + "time" +) + +type TimestampWithoutTimeZonePkDefFunc struct { + TimestampWithoutTimeZonePkDefFunc time.Time `db:"timestamp_without_time_zone_pk_def_func"` +} diff --git a/internal/integration_tests/postgres/defaultsettings/TimestampWithoutTimeZonePkRef.go b/internal/integration_tests/postgres/defaultsettings/TimestampWithoutTimeZonePkRef.go new file mode 100644 index 00000000..eefa80d7 --- /dev/null +++ b/internal/integration_tests/postgres/defaultsettings/TimestampWithoutTimeZonePkRef.go @@ -0,0 +1,9 @@ +package dto + +import ( + "time" +) + +type TimestampWithoutTimeZonePkRef struct { + TimestampWithoutTimeZonePkRef time.Time `db:"timestamp_without_time_zone_pk_ref"` +} diff --git a/internal/integration_tests/postgres/defaultsettings/TimestampWithoutTimeZoneRef.go b/internal/integration_tests/postgres/defaultsettings/TimestampWithoutTimeZoneRef.go new file mode 100644 index 00000000..639bb7c1 --- /dev/null +++ b/internal/integration_tests/postgres/defaultsettings/TimestampWithoutTimeZoneRef.go @@ -0,0 +1,9 @@ +package dto + +import ( + "database/sql" +) + +type TimestampWithoutTimeZoneRef struct { + TimestampWithoutTimeZoneRef sql.NullTime `db:"timestamp_without_time_zone_ref"` +} diff --git a/internal/integration_tests/postgres/defaultsettings/TimestampWithoutTimeZoneUniqueCheckPk.go b/internal/integration_tests/postgres/defaultsettings/TimestampWithoutTimeZoneUniqueCheckPk.go new file mode 100644 index 00000000..9d023d15 --- /dev/null +++ b/internal/integration_tests/postgres/defaultsettings/TimestampWithoutTimeZoneUniqueCheckPk.go @@ -0,0 +1,9 @@ +package dto + +import ( + "time" +) + +type TimestampWithoutTimeZoneUniqueCheckPk struct { + TimestampWithoutTimeZoneUniqueCheckPk time.Time `db:"timestamp_without_time_zone_unique_check_pk"` +} diff --git a/internal/integration_tests/postgres/defaultsettings/TimestampWithoutTimeZoneUniqueCheckPkRef.go b/internal/integration_tests/postgres/defaultsettings/TimestampWithoutTimeZoneUniqueCheckPkRef.go new file mode 100644 index 00000000..3603a787 --- /dev/null +++ b/internal/integration_tests/postgres/defaultsettings/TimestampWithoutTimeZoneUniqueCheckPkRef.go @@ -0,0 +1,9 @@ +package dto + +import ( + "time" +) + +type TimestampWithoutTimeZoneUniqueCheckPkRef struct { + TimestampWithoutTimeZoneUniqueCheckPkRef time.Time `db:"timestamp_without_time_zone_unique_check_pk_ref"` +} diff --git a/internal/integration_tests/postgres/defaultsettings/TimestampWithoutTimeZoneUniquePk.go b/internal/integration_tests/postgres/defaultsettings/TimestampWithoutTimeZoneUniquePk.go new file mode 100644 index 00000000..d55e799a --- /dev/null +++ b/internal/integration_tests/postgres/defaultsettings/TimestampWithoutTimeZoneUniquePk.go @@ -0,0 +1,9 @@ +package dto + +import ( + "time" +) + +type TimestampWithoutTimeZoneUniquePk struct { + TimestampWithoutTimeZoneUniquePk time.Time `db:"timestamp_without_time_zone_unique_pk"` +} diff --git a/internal/integration_tests/postgres/defaultsettings/Timestamptz.go b/internal/integration_tests/postgres/defaultsettings/Timestamptz.go new file mode 100644 index 00000000..a657ed69 --- /dev/null +++ b/internal/integration_tests/postgres/defaultsettings/Timestamptz.go @@ -0,0 +1,34 @@ +package dto + +import ( + "database/sql" + "time" +) + +type Timestamptz struct { + Timestamptz sql.NullTime `db:"timestamptz"` + TimestamptzNn time.Time `db:"timestamptz_nn"` + TimestamptzNnUnique time.Time `db:"timestamptz_nn_unique"` + TimestamptzNnCheck time.Time `db:"timestamptz_nn_check"` + TimestamptzNnRef time.Time `db:"timestamptz_nn_ref"` + TimestamptzNnDefConst time.Time `db:"timestamptz_nn_def_const"` + TimestamptzNnDefFunc time.Time `db:"timestamptz_nn_def_func"` + TimestamptzNnUniqueCheck time.Time `db:"timestamptz_nn_unique_check"` + TimestamptzUnique sql.NullTime `db:"timestamptz_unique"` + TimestamptzUniqueCheck sql.NullTime `db:"timestamptz_unique_check"` + TimestamptzUniqueRef sql.NullTime `db:"timestamptz_unique_ref"` + TimestamptzUniqueDefConst sql.NullTime `db:"timestamptz_unique_def_const"` + TimestamptzUniqueDefFunc sql.NullTime `db:"timestamptz_unique_def_func"` + TimestamptzCheck sql.NullTime `db:"timestamptz_check"` + TimestamptzCheckRef sql.NullTime `db:"timestamptz_check_ref"` + TimestamptzCheckDefConst sql.NullTime `db:"timestamptz_check_def_const"` + TimestamptzCheckDefFunc sql.NullTime `db:"timestamptz_check_def_func"` + TimestamptzRef sql.NullTime `db:"timestamptz_ref"` + TimestamptzRefDefConst sql.NullTime `db:"timestamptz_ref_def_const"` + TimestamptzRefDefFunc sql.NullTime `db:"timestamptz_ref_def_func"` + TimestamptzRefUniqueCheck sql.NullTime `db:"timestamptz_ref_unique_check"` + TimestamptzDefConst sql.NullTime `db:"timestamptz_def_const"` + TimestamptzDefConstUniqueCheck sql.NullTime `db:"timestamptz_def_const_unique_check"` + TimestamptzDefFunc sql.NullTime `db:"timestamptz_def_func"` + TimestamptzDefFuncUniqueCheck sql.NullTime `db:"timestamptz_def_func_unique_check"` +} diff --git a/internal/integration_tests/postgres/defaultsettings/TimestamptzCheckPk.go b/internal/integration_tests/postgres/defaultsettings/TimestamptzCheckPk.go new file mode 100644 index 00000000..b5cc44a9 --- /dev/null +++ b/internal/integration_tests/postgres/defaultsettings/TimestamptzCheckPk.go @@ -0,0 +1,9 @@ +package dto + +import ( + "time" +) + +type TimestamptzCheckPk struct { + TimestamptzCheckPk time.Time `db:"timestamptz_check_pk"` +} diff --git a/internal/integration_tests/postgres/defaultsettings/TimestamptzDefConstUniqueCheckPk.go b/internal/integration_tests/postgres/defaultsettings/TimestamptzDefConstUniqueCheckPk.go new file mode 100644 index 00000000..ca479c07 --- /dev/null +++ b/internal/integration_tests/postgres/defaultsettings/TimestamptzDefConstUniqueCheckPk.go @@ -0,0 +1,9 @@ +package dto + +import ( + "time" +) + +type TimestamptzDefConstUniqueCheckPk struct { + TimestamptzDefConstUniqueCheckPk time.Time `db:"timestamptz_def_const_unique_check_pk"` +} diff --git a/internal/integration_tests/postgres/defaultsettings/TimestamptzDefConstUniqueCheckPkRef.go b/internal/integration_tests/postgres/defaultsettings/TimestamptzDefConstUniqueCheckPkRef.go new file mode 100644 index 00000000..52a98804 --- /dev/null +++ b/internal/integration_tests/postgres/defaultsettings/TimestamptzDefConstUniqueCheckPkRef.go @@ -0,0 +1,9 @@ +package dto + +import ( + "time" +) + +type TimestamptzDefConstUniqueCheckPkRef struct { + TimestamptzDefConstUniqueCheckPkRef time.Time `db:"timestamptz_def_const_unique_check_pk_ref"` +} diff --git a/internal/integration_tests/postgres/defaultsettings/TimestamptzDefFuncUniqueCheckPk.go b/internal/integration_tests/postgres/defaultsettings/TimestamptzDefFuncUniqueCheckPk.go new file mode 100644 index 00000000..aac32a60 --- /dev/null +++ b/internal/integration_tests/postgres/defaultsettings/TimestamptzDefFuncUniqueCheckPk.go @@ -0,0 +1,9 @@ +package dto + +import ( + "time" +) + +type TimestamptzDefFuncUniqueCheckPk struct { + TimestamptzDefFuncUniqueCheckPk time.Time `db:"timestamptz_def_func_unique_check_pk"` +} diff --git a/internal/integration_tests/postgres/defaultsettings/TimestamptzDefFuncUniqueCheckPkRef.go b/internal/integration_tests/postgres/defaultsettings/TimestamptzDefFuncUniqueCheckPkRef.go new file mode 100644 index 00000000..80a988ef --- /dev/null +++ b/internal/integration_tests/postgres/defaultsettings/TimestamptzDefFuncUniqueCheckPkRef.go @@ -0,0 +1,9 @@ +package dto + +import ( + "time" +) + +type TimestamptzDefFuncUniqueCheckPkRef struct { + TimestamptzDefFuncUniqueCheckPkRef time.Time `db:"timestamptz_def_func_unique_check_pk_ref"` +} diff --git a/internal/integration_tests/postgres/defaultsettings/TimestamptzNnPk.go b/internal/integration_tests/postgres/defaultsettings/TimestamptzNnPk.go new file mode 100644 index 00000000..56a17109 --- /dev/null +++ b/internal/integration_tests/postgres/defaultsettings/TimestamptzNnPk.go @@ -0,0 +1,9 @@ +package dto + +import ( + "time" +) + +type TimestamptzNnPk struct { + TimestamptzNnPk time.Time `db:"timestamptz_nn_pk"` +} diff --git a/internal/integration_tests/postgres/defaultsettings/TimestamptzNnUniqueCheckPk.go b/internal/integration_tests/postgres/defaultsettings/TimestamptzNnUniqueCheckPk.go new file mode 100644 index 00000000..d1bf3b6c --- /dev/null +++ b/internal/integration_tests/postgres/defaultsettings/TimestamptzNnUniqueCheckPk.go @@ -0,0 +1,9 @@ +package dto + +import ( + "time" +) + +type TimestamptzNnUniqueCheckPk struct { + TimestamptzNnUniqueCheckPk time.Time `db:"timestamptz_nn_unique_check_pk"` +} diff --git a/internal/integration_tests/postgres/defaultsettings/TimestamptzNnUniqueCheckPkRef.go b/internal/integration_tests/postgres/defaultsettings/TimestamptzNnUniqueCheckPkRef.go new file mode 100644 index 00000000..1c9746e0 --- /dev/null +++ b/internal/integration_tests/postgres/defaultsettings/TimestamptzNnUniqueCheckPkRef.go @@ -0,0 +1,9 @@ +package dto + +import ( + "time" +) + +type TimestamptzNnUniqueCheckPkRef struct { + TimestamptzNnUniqueCheckPkRef time.Time `db:"timestamptz_nn_unique_check_pk_ref"` +} diff --git a/internal/integration_tests/postgres/defaultsettings/TimestamptzPk.go b/internal/integration_tests/postgres/defaultsettings/TimestamptzPk.go new file mode 100644 index 00000000..83559720 --- /dev/null +++ b/internal/integration_tests/postgres/defaultsettings/TimestamptzPk.go @@ -0,0 +1,9 @@ +package dto + +import ( + "time" +) + +type TimestamptzPk struct { + TimestamptzPk time.Time `db:"timestamptz_pk"` +} diff --git a/internal/integration_tests/postgres/defaultsettings/TimestamptzPkDefConst.go b/internal/integration_tests/postgres/defaultsettings/TimestamptzPkDefConst.go new file mode 100644 index 00000000..bc9e62d4 --- /dev/null +++ b/internal/integration_tests/postgres/defaultsettings/TimestamptzPkDefConst.go @@ -0,0 +1,9 @@ +package dto + +import ( + "time" +) + +type TimestamptzPkDefConst struct { + TimestamptzPkDefConst time.Time `db:"timestamptz_pk_def_const"` +} diff --git a/internal/integration_tests/postgres/defaultsettings/TimestamptzPkDefFunc.go b/internal/integration_tests/postgres/defaultsettings/TimestamptzPkDefFunc.go new file mode 100644 index 00000000..5951f4f2 --- /dev/null +++ b/internal/integration_tests/postgres/defaultsettings/TimestamptzPkDefFunc.go @@ -0,0 +1,9 @@ +package dto + +import ( + "time" +) + +type TimestamptzPkDefFunc struct { + TimestamptzPkDefFunc time.Time `db:"timestamptz_pk_def_func"` +} diff --git a/internal/integration_tests/postgres/defaultsettings/TimestamptzPkRef.go b/internal/integration_tests/postgres/defaultsettings/TimestamptzPkRef.go new file mode 100644 index 00000000..3b5257f4 --- /dev/null +++ b/internal/integration_tests/postgres/defaultsettings/TimestamptzPkRef.go @@ -0,0 +1,9 @@ +package dto + +import ( + "time" +) + +type TimestamptzPkRef struct { + TimestamptzPkRef time.Time `db:"timestamptz_pk_ref"` +} diff --git a/internal/integration_tests/postgres/defaultsettings/TimestamptzRef.go b/internal/integration_tests/postgres/defaultsettings/TimestamptzRef.go new file mode 100644 index 00000000..0d8b5bbf --- /dev/null +++ b/internal/integration_tests/postgres/defaultsettings/TimestamptzRef.go @@ -0,0 +1,9 @@ +package dto + +import ( + "database/sql" +) + +type TimestamptzRef struct { + TimestamptzRef sql.NullTime `db:"timestamptz_ref"` +} diff --git a/internal/integration_tests/postgres/defaultsettings/TimestamptzUniqueCheckPk.go b/internal/integration_tests/postgres/defaultsettings/TimestamptzUniqueCheckPk.go new file mode 100644 index 00000000..3b8ea74f --- /dev/null +++ b/internal/integration_tests/postgres/defaultsettings/TimestamptzUniqueCheckPk.go @@ -0,0 +1,9 @@ +package dto + +import ( + "time" +) + +type TimestamptzUniqueCheckPk struct { + TimestamptzUniqueCheckPk time.Time `db:"timestamptz_unique_check_pk"` +} diff --git a/internal/integration_tests/postgres/defaultsettings/TimestamptzUniqueCheckPkRef.go b/internal/integration_tests/postgres/defaultsettings/TimestamptzUniqueCheckPkRef.go new file mode 100644 index 00000000..7e9ff3c8 --- /dev/null +++ b/internal/integration_tests/postgres/defaultsettings/TimestamptzUniqueCheckPkRef.go @@ -0,0 +1,9 @@ +package dto + +import ( + "time" +) + +type TimestamptzUniqueCheckPkRef struct { + TimestamptzUniqueCheckPkRef time.Time `db:"timestamptz_unique_check_pk_ref"` +} diff --git a/internal/integration_tests/postgres/defaultsettings/TimestamptzUniquePk.go b/internal/integration_tests/postgres/defaultsettings/TimestamptzUniquePk.go new file mode 100644 index 00000000..fc8d2b5a --- /dev/null +++ b/internal/integration_tests/postgres/defaultsettings/TimestamptzUniquePk.go @@ -0,0 +1,9 @@ +package dto + +import ( + "time" +) + +type TimestamptzUniquePk struct { + TimestamptzUniquePk time.Time `db:"timestamptz_unique_pk"` +} diff --git a/internal/integration_tests/postgres/defaultsettings/Varchar.go b/internal/integration_tests/postgres/defaultsettings/Varchar.go new file mode 100644 index 00000000..290a3493 --- /dev/null +++ b/internal/integration_tests/postgres/defaultsettings/Varchar.go @@ -0,0 +1,35 @@ +package dto + +import ( + "database/sql" +) + +type Varchar struct { + Varchar sql.NullString `db:"varchar"` + VarcharCap sql.NullString `db:"varchar_cap"` + VarcharNn string `db:"varchar_nn"` + VarcharNnUnique string `db:"varchar_nn_unique"` + VarcharNnCheckCmp string `db:"varchar_nn_check_cmp"` + VarcharNnCheckFn string `db:"varchar_nn_check_fn"` + VarcharNnRef string `db:"varchar_nn_ref"` + VarcharNnDefConst string `db:"varchar_nn_def_const"` + VarcharNnDefFunc string `db:"varchar_nn_def_func"` + VarcharNnUniqueCheck string `db:"varchar_nn_unique_check"` + VarcharUnique sql.NullString `db:"varchar_unique"` + VarcharUniqueCheck sql.NullString `db:"varchar_unique_check"` + VarcharUniqueRef sql.NullString `db:"varchar_unique_ref"` + VarcharUniqueDefConst sql.NullString `db:"varchar_unique_def_const"` + VarcharUniqueDefFunc sql.NullString `db:"varchar_unique_def_func"` + VarcharCheck sql.NullString `db:"varchar_check"` + VarcharCheckRef sql.NullString `db:"varchar_check_ref"` + VarcharCheckDefConst sql.NullString `db:"varchar_check_def_const"` + VarcharCheckDefFunc sql.NullString `db:"varchar_check_def_func"` + VarcharRef sql.NullString `db:"varchar_ref"` + VarcharRefDefConst sql.NullString `db:"varchar_ref_def_const"` + VarcharRefDefFunc sql.NullString `db:"varchar_ref_def_func"` + VarcharRefUniqueCheck sql.NullString `db:"varchar_ref_unique_check"` + VarcharDefConst sql.NullString `db:"varchar_def_const"` + VarcharDefConstUniqueCheck sql.NullString `db:"varchar_def_const_unique_check"` + VarcharDefFunc sql.NullString `db:"varchar_def_func"` + VarcharDefFuncUniqueCheck sql.NullString `db:"varchar_def_func_unique_check"` +} diff --git a/internal/integration_tests/postgres/defaultsettings/VarcharCheckPk.go b/internal/integration_tests/postgres/defaultsettings/VarcharCheckPk.go new file mode 100644 index 00000000..3f42d91f --- /dev/null +++ b/internal/integration_tests/postgres/defaultsettings/VarcharCheckPk.go @@ -0,0 +1,5 @@ +package dto + +type VarcharCheckPk struct { + VarcharCheckPk string `db:"varchar_check_pk"` +} diff --git a/internal/integration_tests/postgres/defaultsettings/VarcharDefConstUniqueCheckPk.go b/internal/integration_tests/postgres/defaultsettings/VarcharDefConstUniqueCheckPk.go new file mode 100644 index 00000000..b0c8f76b --- /dev/null +++ b/internal/integration_tests/postgres/defaultsettings/VarcharDefConstUniqueCheckPk.go @@ -0,0 +1,5 @@ +package dto + +type VarcharDefConstUniqueCheckPk struct { + VarcharDefConstUniqueCheckPk string `db:"varchar_def_const_unique_check_pk"` +} diff --git a/internal/integration_tests/postgres/defaultsettings/VarcharDefConstUniqueCheckPkRef.go b/internal/integration_tests/postgres/defaultsettings/VarcharDefConstUniqueCheckPkRef.go new file mode 100644 index 00000000..55840733 --- /dev/null +++ b/internal/integration_tests/postgres/defaultsettings/VarcharDefConstUniqueCheckPkRef.go @@ -0,0 +1,5 @@ +package dto + +type VarcharDefConstUniqueCheckPkRef struct { + VarcharDefConstUniqueCheckPkRef string `db:"varchar_def_const_unique_check_pk_ref"` +} diff --git a/internal/integration_tests/postgres/defaultsettings/VarcharDefFuncUniqueCheckPk.go b/internal/integration_tests/postgres/defaultsettings/VarcharDefFuncUniqueCheckPk.go new file mode 100644 index 00000000..eb63e5d1 --- /dev/null +++ b/internal/integration_tests/postgres/defaultsettings/VarcharDefFuncUniqueCheckPk.go @@ -0,0 +1,5 @@ +package dto + +type VarcharDefFuncUniqueCheckPk struct { + VarcharDefFuncUniqueCheckPk string `db:"varchar_def_func_unique_check_pk"` +} diff --git a/internal/integration_tests/postgres/defaultsettings/VarcharDefFuncUniqueCheckPkRef.go b/internal/integration_tests/postgres/defaultsettings/VarcharDefFuncUniqueCheckPkRef.go new file mode 100644 index 00000000..8b002629 --- /dev/null +++ b/internal/integration_tests/postgres/defaultsettings/VarcharDefFuncUniqueCheckPkRef.go @@ -0,0 +1,5 @@ +package dto + +type VarcharDefFuncUniqueCheckPkRef struct { + VarcharDefFuncUniqueCheckPkRef string `db:"varchar_def_func_unique_check_pk_ref"` +} diff --git a/internal/integration_tests/postgres/defaultsettings/VarcharNnPk.go b/internal/integration_tests/postgres/defaultsettings/VarcharNnPk.go new file mode 100644 index 00000000..b8364e86 --- /dev/null +++ b/internal/integration_tests/postgres/defaultsettings/VarcharNnPk.go @@ -0,0 +1,5 @@ +package dto + +type VarcharNnPk struct { + VarcharNnPk string `db:"varchar_nn_pk"` +} diff --git a/internal/integration_tests/postgres/defaultsettings/VarcharNnUniqueCheckPk.go b/internal/integration_tests/postgres/defaultsettings/VarcharNnUniqueCheckPk.go new file mode 100644 index 00000000..0a24372c --- /dev/null +++ b/internal/integration_tests/postgres/defaultsettings/VarcharNnUniqueCheckPk.go @@ -0,0 +1,5 @@ +package dto + +type VarcharNnUniqueCheckPk struct { + VarcharNnUniqueCheckPk string `db:"varchar_nn_unique_check_pk"` +} diff --git a/internal/integration_tests/postgres/defaultsettings/VarcharNnUniqueCheckPkRef.go b/internal/integration_tests/postgres/defaultsettings/VarcharNnUniqueCheckPkRef.go new file mode 100644 index 00000000..419161c0 --- /dev/null +++ b/internal/integration_tests/postgres/defaultsettings/VarcharNnUniqueCheckPkRef.go @@ -0,0 +1,5 @@ +package dto + +type VarcharNnUniqueCheckPkRef struct { + VarcharNnUniqueCheckPkRef string `db:"varchar_nn_unique_check_pk_ref"` +} diff --git a/internal/integration_tests/postgres/defaultsettings/VarcharPk.go b/internal/integration_tests/postgres/defaultsettings/VarcharPk.go new file mode 100644 index 00000000..d04cc77d --- /dev/null +++ b/internal/integration_tests/postgres/defaultsettings/VarcharPk.go @@ -0,0 +1,5 @@ +package dto + +type VarcharPk struct { + VarcharPk string `db:"varchar_pk"` +} diff --git a/internal/integration_tests/postgres/defaultsettings/VarcharPkDefConst.go b/internal/integration_tests/postgres/defaultsettings/VarcharPkDefConst.go new file mode 100644 index 00000000..2b5b3bce --- /dev/null +++ b/internal/integration_tests/postgres/defaultsettings/VarcharPkDefConst.go @@ -0,0 +1,5 @@ +package dto + +type VarcharPkDefConst struct { + VarcharPkDefConst string `db:"varchar_pk_def_const"` +} diff --git a/internal/integration_tests/postgres/defaultsettings/VarcharPkDefFunc.go b/internal/integration_tests/postgres/defaultsettings/VarcharPkDefFunc.go new file mode 100644 index 00000000..8e0d43b6 --- /dev/null +++ b/internal/integration_tests/postgres/defaultsettings/VarcharPkDefFunc.go @@ -0,0 +1,5 @@ +package dto + +type VarcharPkDefFunc struct { + VarcharPkDefFunc string `db:"varchar_pk_def_func"` +} diff --git a/internal/integration_tests/postgres/defaultsettings/VarcharPkRef.go b/internal/integration_tests/postgres/defaultsettings/VarcharPkRef.go new file mode 100644 index 00000000..1237c5d4 --- /dev/null +++ b/internal/integration_tests/postgres/defaultsettings/VarcharPkRef.go @@ -0,0 +1,5 @@ +package dto + +type VarcharPkRef struct { + VarcharPkRef string `db:"varchar_pk_ref"` +} diff --git a/internal/integration_tests/postgres/defaultsettings/VarcharRef.go b/internal/integration_tests/postgres/defaultsettings/VarcharRef.go new file mode 100644 index 00000000..4add70ab --- /dev/null +++ b/internal/integration_tests/postgres/defaultsettings/VarcharRef.go @@ -0,0 +1,9 @@ +package dto + +import ( + "database/sql" +) + +type VarcharRef struct { + VarcharRef sql.NullString `db:"varchar_ref"` +} diff --git a/internal/integration_tests/postgres/defaultsettings/VarcharUniqueCheckPk.go b/internal/integration_tests/postgres/defaultsettings/VarcharUniqueCheckPk.go new file mode 100644 index 00000000..98513a8f --- /dev/null +++ b/internal/integration_tests/postgres/defaultsettings/VarcharUniqueCheckPk.go @@ -0,0 +1,5 @@ +package dto + +type VarcharUniqueCheckPk struct { + VarcharUniqueCheckPk string `db:"varchar_unique_check_pk"` +} diff --git a/internal/integration_tests/postgres/defaultsettings/VarcharUniqueCheckPkRef.go b/internal/integration_tests/postgres/defaultsettings/VarcharUniqueCheckPkRef.go new file mode 100644 index 00000000..9e078bac --- /dev/null +++ b/internal/integration_tests/postgres/defaultsettings/VarcharUniqueCheckPkRef.go @@ -0,0 +1,5 @@ +package dto + +type VarcharUniqueCheckPkRef struct { + VarcharUniqueCheckPkRef string `db:"varchar_unique_check_pk_ref"` +} diff --git a/internal/integration_tests/postgres/defaultsettings/VarcharUniquePk.go b/internal/integration_tests/postgres/defaultsettings/VarcharUniquePk.go new file mode 100644 index 00000000..66a68448 --- /dev/null +++ b/internal/integration_tests/postgres/defaultsettings/VarcharUniquePk.go @@ -0,0 +1,5 @@ +package dto + +type VarcharUniquePk struct { + VarcharUniquePk string `db:"varchar_unique_pk"` +} diff --git a/internal/integration_tests/postgres/nulltypeprimitive/Bigint.go b/internal/integration_tests/postgres/nulltypeprimitive/Bigint.go new file mode 100644 index 00000000..3fc74ef3 --- /dev/null +++ b/internal/integration_tests/postgres/nulltypeprimitive/Bigint.go @@ -0,0 +1,29 @@ +package dto + +type Bigint struct { + Bigint *int `db:"bigint"` + BigintNn int `db:"bigint_nn"` + BigintNnUnique int `db:"bigint_nn_unique"` + BigintNnCheck int `db:"bigint_nn_check"` + BigintNnRef int `db:"bigint_nn_ref"` + BigintNnDefConst int `db:"bigint_nn_def_const"` + BigintNnDefFunc int `db:"bigint_nn_def_func"` + BigintNnUniqueCheck int `db:"bigint_nn_unique_check"` + BigintUnique *int `db:"bigint_unique"` + BigintUniqueCheck *int `db:"bigint_unique_check"` + BigintUniqueRef *int `db:"bigint_unique_ref"` + BigintUniqueDefConst *int `db:"bigint_unique_def_const"` + BigintUniqueDefFunc *int `db:"bigint_unique_def_func"` + BigintCheck *int `db:"bigint_check"` + BigintCheckRef *int `db:"bigint_check_ref"` + BigintCheckDefConst *int `db:"bigint_check_def_const"` + BigintCheckDefFunc *int `db:"bigint_check_def_func"` + BigintRef *int `db:"bigint_ref"` + BigintRefDefConst *int `db:"bigint_ref_def_const"` + BigintRefDefFunc *int `db:"bigint_ref_def_func"` + BigintRefUniqueCheck *int `db:"bigint_ref_unique_check"` + BigintDefConst *int `db:"bigint_def_const"` + BigintDefConstUniqueCheck *int `db:"bigint_def_const_unique_check"` + BigintDefFunc *int `db:"bigint_def_func"` + BigintDefFuncUniqueCheck *int `db:"bigint_def_func_unique_check"` +} diff --git a/internal/integration_tests/postgres/nulltypeprimitive/BigintCheckPk.go b/internal/integration_tests/postgres/nulltypeprimitive/BigintCheckPk.go new file mode 100644 index 00000000..2474c3d5 --- /dev/null +++ b/internal/integration_tests/postgres/nulltypeprimitive/BigintCheckPk.go @@ -0,0 +1,5 @@ +package dto + +type BigintCheckPk struct { + BigintCheckPk int `db:"bigint_check_pk"` +} diff --git a/internal/integration_tests/postgres/nulltypeprimitive/BigintDefConstUniqueCheckPk.go b/internal/integration_tests/postgres/nulltypeprimitive/BigintDefConstUniqueCheckPk.go new file mode 100644 index 00000000..808e31f2 --- /dev/null +++ b/internal/integration_tests/postgres/nulltypeprimitive/BigintDefConstUniqueCheckPk.go @@ -0,0 +1,5 @@ +package dto + +type BigintDefConstUniqueCheckPk struct { + BigintDefConstUniqueCheckPk int `db:"bigint_def_const_unique_check_pk"` +} diff --git a/internal/integration_tests/postgres/nulltypeprimitive/BigintDefConstUniqueCheckPkRef.go b/internal/integration_tests/postgres/nulltypeprimitive/BigintDefConstUniqueCheckPkRef.go new file mode 100644 index 00000000..64fcb8c8 --- /dev/null +++ b/internal/integration_tests/postgres/nulltypeprimitive/BigintDefConstUniqueCheckPkRef.go @@ -0,0 +1,5 @@ +package dto + +type BigintDefConstUniqueCheckPkRef struct { + BigintDefConstUniqueCheckPkRef int `db:"bigint_def_const_unique_check_pk_ref"` +} diff --git a/internal/integration_tests/postgres/nulltypeprimitive/BigintDefFuncUniqueCheckPk.go b/internal/integration_tests/postgres/nulltypeprimitive/BigintDefFuncUniqueCheckPk.go new file mode 100644 index 00000000..68117369 --- /dev/null +++ b/internal/integration_tests/postgres/nulltypeprimitive/BigintDefFuncUniqueCheckPk.go @@ -0,0 +1,5 @@ +package dto + +type BigintDefFuncUniqueCheckPk struct { + BigintDefFuncUniqueCheckPk int `db:"bigint_def_func_unique_check_pk"` +} diff --git a/internal/integration_tests/postgres/nulltypeprimitive/BigintDefFuncUniqueCheckPkRef.go b/internal/integration_tests/postgres/nulltypeprimitive/BigintDefFuncUniqueCheckPkRef.go new file mode 100644 index 00000000..dbd5da9d --- /dev/null +++ b/internal/integration_tests/postgres/nulltypeprimitive/BigintDefFuncUniqueCheckPkRef.go @@ -0,0 +1,5 @@ +package dto + +type BigintDefFuncUniqueCheckPkRef struct { + BigintDefFuncUniqueCheckPkRef int `db:"bigint_def_func_unique_check_pk_ref"` +} diff --git a/internal/integration_tests/postgres/nulltypeprimitive/BigintNnPk.go b/internal/integration_tests/postgres/nulltypeprimitive/BigintNnPk.go new file mode 100644 index 00000000..f4ddc4aa --- /dev/null +++ b/internal/integration_tests/postgres/nulltypeprimitive/BigintNnPk.go @@ -0,0 +1,5 @@ +package dto + +type BigintNnPk struct { + BigintNnPk int `db:"bigint_nn_pk"` +} diff --git a/internal/integration_tests/postgres/nulltypeprimitive/BigintNnUniqueCheckPk.go b/internal/integration_tests/postgres/nulltypeprimitive/BigintNnUniqueCheckPk.go new file mode 100644 index 00000000..ce5d15c5 --- /dev/null +++ b/internal/integration_tests/postgres/nulltypeprimitive/BigintNnUniqueCheckPk.go @@ -0,0 +1,5 @@ +package dto + +type BigintNnUniqueCheckPk struct { + BigintNnUniqueCheckPk int `db:"bigint_nn_unique_check_pk"` +} diff --git a/internal/integration_tests/postgres/nulltypeprimitive/BigintNnUniqueCheckPkRef.go b/internal/integration_tests/postgres/nulltypeprimitive/BigintNnUniqueCheckPkRef.go new file mode 100644 index 00000000..4c065777 --- /dev/null +++ b/internal/integration_tests/postgres/nulltypeprimitive/BigintNnUniqueCheckPkRef.go @@ -0,0 +1,5 @@ +package dto + +type BigintNnUniqueCheckPkRef struct { + BigintNnUniqueCheckPkRef int `db:"bigint_nn_unique_check_pk_ref"` +} diff --git a/internal/integration_tests/postgres/nulltypeprimitive/BigintPk.go b/internal/integration_tests/postgres/nulltypeprimitive/BigintPk.go new file mode 100644 index 00000000..0b34e55b --- /dev/null +++ b/internal/integration_tests/postgres/nulltypeprimitive/BigintPk.go @@ -0,0 +1,5 @@ +package dto + +type BigintPk struct { + BigintPk int `db:"bigint_pk"` +} diff --git a/internal/integration_tests/postgres/nulltypeprimitive/BigintPkDefConst.go b/internal/integration_tests/postgres/nulltypeprimitive/BigintPkDefConst.go new file mode 100644 index 00000000..08c26cbd --- /dev/null +++ b/internal/integration_tests/postgres/nulltypeprimitive/BigintPkDefConst.go @@ -0,0 +1,5 @@ +package dto + +type BigintPkDefConst struct { + BigintPkDefConst int `db:"bigint_pk_def_const"` +} diff --git a/internal/integration_tests/postgres/nulltypeprimitive/BigintPkDefFunc.go b/internal/integration_tests/postgres/nulltypeprimitive/BigintPkDefFunc.go new file mode 100644 index 00000000..656fadc9 --- /dev/null +++ b/internal/integration_tests/postgres/nulltypeprimitive/BigintPkDefFunc.go @@ -0,0 +1,5 @@ +package dto + +type BigintPkDefFunc struct { + BigintPkDefFunc int `db:"bigint_pk_def_func"` +} diff --git a/internal/integration_tests/postgres/nulltypeprimitive/BigintPkRef.go b/internal/integration_tests/postgres/nulltypeprimitive/BigintPkRef.go new file mode 100644 index 00000000..21608d8c --- /dev/null +++ b/internal/integration_tests/postgres/nulltypeprimitive/BigintPkRef.go @@ -0,0 +1,5 @@ +package dto + +type BigintPkRef struct { + BigintPkRef int `db:"bigint_pk_ref"` +} diff --git a/internal/integration_tests/postgres/nulltypeprimitive/BigintRef.go b/internal/integration_tests/postgres/nulltypeprimitive/BigintRef.go new file mode 100644 index 00000000..377b5cd8 --- /dev/null +++ b/internal/integration_tests/postgres/nulltypeprimitive/BigintRef.go @@ -0,0 +1,5 @@ +package dto + +type BigintRef struct { + BigintRef *int `db:"bigint_ref"` +} diff --git a/internal/integration_tests/postgres/nulltypeprimitive/BigintUniqueCheckPk.go b/internal/integration_tests/postgres/nulltypeprimitive/BigintUniqueCheckPk.go new file mode 100644 index 00000000..d2cd0c7e --- /dev/null +++ b/internal/integration_tests/postgres/nulltypeprimitive/BigintUniqueCheckPk.go @@ -0,0 +1,5 @@ +package dto + +type BigintUniqueCheckPk struct { + BigintUniqueCheckPk int `db:"bigint_unique_check_pk"` +} diff --git a/internal/integration_tests/postgres/nulltypeprimitive/BigintUniqueCheckPkRef.go b/internal/integration_tests/postgres/nulltypeprimitive/BigintUniqueCheckPkRef.go new file mode 100644 index 00000000..f41b59bf --- /dev/null +++ b/internal/integration_tests/postgres/nulltypeprimitive/BigintUniqueCheckPkRef.go @@ -0,0 +1,5 @@ +package dto + +type BigintUniqueCheckPkRef struct { + BigintUniqueCheckPkRef int `db:"bigint_unique_check_pk_ref"` +} diff --git a/internal/integration_tests/postgres/nulltypeprimitive/BigintUniquePk.go b/internal/integration_tests/postgres/nulltypeprimitive/BigintUniquePk.go new file mode 100644 index 00000000..06e50c8e --- /dev/null +++ b/internal/integration_tests/postgres/nulltypeprimitive/BigintUniquePk.go @@ -0,0 +1,5 @@ +package dto + +type BigintUniquePk struct { + BigintUniquePk int `db:"bigint_unique_pk"` +} diff --git a/internal/integration_tests/postgres/nulltypeprimitive/Bigserial.go b/internal/integration_tests/postgres/nulltypeprimitive/Bigserial.go new file mode 100644 index 00000000..b7ac1840 --- /dev/null +++ b/internal/integration_tests/postgres/nulltypeprimitive/Bigserial.go @@ -0,0 +1,5 @@ +package dto + +type Bigserial struct { + Bigserial int `db:"bigserial"` +} diff --git a/internal/integration_tests/postgres/nulltypeprimitive/BigserialCheck.go b/internal/integration_tests/postgres/nulltypeprimitive/BigserialCheck.go new file mode 100644 index 00000000..770c067b --- /dev/null +++ b/internal/integration_tests/postgres/nulltypeprimitive/BigserialCheck.go @@ -0,0 +1,5 @@ +package dto + +type BigserialCheck struct { + Bigserial int `db:"bigserial"` +} diff --git a/internal/integration_tests/postgres/nulltypeprimitive/BigserialNotnull.go b/internal/integration_tests/postgres/nulltypeprimitive/BigserialNotnull.go new file mode 100644 index 00000000..defb7802 --- /dev/null +++ b/internal/integration_tests/postgres/nulltypeprimitive/BigserialNotnull.go @@ -0,0 +1,5 @@ +package dto + +type BigserialNotnull struct { + Bigserial int `db:"bigserial"` +} diff --git a/internal/integration_tests/postgres/nulltypeprimitive/BigserialPk.go b/internal/integration_tests/postgres/nulltypeprimitive/BigserialPk.go new file mode 100644 index 00000000..d494fe60 --- /dev/null +++ b/internal/integration_tests/postgres/nulltypeprimitive/BigserialPk.go @@ -0,0 +1,5 @@ +package dto + +type BigserialPk struct { + Bigserial int `db:"bigserial"` +} diff --git a/internal/integration_tests/postgres/nulltypeprimitive/BigserialRef.go b/internal/integration_tests/postgres/nulltypeprimitive/BigserialRef.go new file mode 100644 index 00000000..0cb6df8c --- /dev/null +++ b/internal/integration_tests/postgres/nulltypeprimitive/BigserialRef.go @@ -0,0 +1,5 @@ +package dto + +type BigserialRef struct { + BigserialRef int `db:"bigserial_ref"` +} diff --git a/internal/integration_tests/postgres/nulltypeprimitive/BigserialReferences.go b/internal/integration_tests/postgres/nulltypeprimitive/BigserialReferences.go new file mode 100644 index 00000000..5a8b5d51 --- /dev/null +++ b/internal/integration_tests/postgres/nulltypeprimitive/BigserialReferences.go @@ -0,0 +1,5 @@ +package dto + +type BigserialReferences struct { + Bigserial int `db:"bigserial"` +} diff --git a/internal/integration_tests/postgres/nulltypeprimitive/BigserialUnique.go b/internal/integration_tests/postgres/nulltypeprimitive/BigserialUnique.go new file mode 100644 index 00000000..7884f697 --- /dev/null +++ b/internal/integration_tests/postgres/nulltypeprimitive/BigserialUnique.go @@ -0,0 +1,5 @@ +package dto + +type BigserialUnique struct { + Bigserial int `db:"bigserial"` +} diff --git a/internal/integration_tests/postgres/nulltypeprimitive/BigserialUniqueCheck.go b/internal/integration_tests/postgres/nulltypeprimitive/BigserialUniqueCheck.go new file mode 100644 index 00000000..aa58bc27 --- /dev/null +++ b/internal/integration_tests/postgres/nulltypeprimitive/BigserialUniqueCheck.go @@ -0,0 +1,5 @@ +package dto + +type BigserialUniqueCheck struct { + Bigserial int `db:"bigserial"` +} diff --git a/internal/integration_tests/postgres/nulltypeprimitive/BigserialUniqueCheckPk.go b/internal/integration_tests/postgres/nulltypeprimitive/BigserialUniqueCheckPk.go new file mode 100644 index 00000000..5715fff7 --- /dev/null +++ b/internal/integration_tests/postgres/nulltypeprimitive/BigserialUniqueCheckPk.go @@ -0,0 +1,5 @@ +package dto + +type BigserialUniqueCheckPk struct { + Bigserial int `db:"bigserial"` +} diff --git a/internal/integration_tests/postgres/nulltypeprimitive/BigserialUniqueCheckPkRef.go b/internal/integration_tests/postgres/nulltypeprimitive/BigserialUniqueCheckPkRef.go new file mode 100644 index 00000000..c9b0b21f --- /dev/null +++ b/internal/integration_tests/postgres/nulltypeprimitive/BigserialUniqueCheckPkRef.go @@ -0,0 +1,5 @@ +package dto + +type BigserialUniqueCheckPkRef struct { + Bigserial int `db:"bigserial"` +} diff --git a/internal/integration_tests/postgres/nulltypeprimitive/BigserialUniqueCheckRef.go b/internal/integration_tests/postgres/nulltypeprimitive/BigserialUniqueCheckRef.go new file mode 100644 index 00000000..f12fbe3b --- /dev/null +++ b/internal/integration_tests/postgres/nulltypeprimitive/BigserialUniqueCheckRef.go @@ -0,0 +1,5 @@ +package dto + +type BigserialUniqueCheckRef struct { + Bigserial int `db:"bigserial"` +} diff --git a/internal/integration_tests/postgres/nulltypeprimitive/Char.go b/internal/integration_tests/postgres/nulltypeprimitive/Char.go new file mode 100644 index 00000000..e96a0681 --- /dev/null +++ b/internal/integration_tests/postgres/nulltypeprimitive/Char.go @@ -0,0 +1,31 @@ +package dto + +type Char struct { + Char *string `db:"char"` + CharCap *string `db:"char_cap"` + CharNn string `db:"char_nn"` + CharNnUnique string `db:"char_nn_unique"` + CharNnCheckCmp string `db:"char_nn_check_cmp"` + CharNnCheckFn string `db:"char_nn_check_fn"` + CharNnRef string `db:"char_nn_ref"` + CharNnDefConst string `db:"char_nn_def_const"` + CharNnDefFunc string `db:"char_nn_def_func"` + CharNnUniqueCheck string `db:"char_nn_unique_check"` + CharUnique *string `db:"char_unique"` + CharUniqueCheck *string `db:"char_unique_check"` + CharUniqueRef *string `db:"char_unique_ref"` + CharUniqueDefConst *string `db:"char_unique_def_const"` + CharUniqueDefFunc *string `db:"char_unique_def_func"` + CharCheck *string `db:"char_check"` + CharCheckRef *string `db:"char_check_ref"` + CharCheckDefConst *string `db:"char_check_def_const"` + CharCheckDefFunc *string `db:"char_check_def_func"` + CharRef *string `db:"char_ref"` + CharRefDefConst *string `db:"char_ref_def_const"` + CharRefDefFunc *string `db:"char_ref_def_func"` + CharRefUniqueCheck *string `db:"char_ref_unique_check"` + CharDefConst *string `db:"char_def_const"` + CharDefConstUniqueCheck *string `db:"char_def_const_unique_check"` + CharDefFunc *string `db:"char_def_func"` + CharDefFuncUniqueCheck *string `db:"char_def_func_unique_check"` +} diff --git a/internal/integration_tests/postgres/nulltypeprimitive/CharCheckPk.go b/internal/integration_tests/postgres/nulltypeprimitive/CharCheckPk.go new file mode 100644 index 00000000..3fced3dc --- /dev/null +++ b/internal/integration_tests/postgres/nulltypeprimitive/CharCheckPk.go @@ -0,0 +1,5 @@ +package dto + +type CharCheckPk struct { + CharCheckPk string `db:"char_check_pk"` +} diff --git a/internal/integration_tests/postgres/nulltypeprimitive/CharDefConstUniqueCheckPk.go b/internal/integration_tests/postgres/nulltypeprimitive/CharDefConstUniqueCheckPk.go new file mode 100644 index 00000000..3c69f6ff --- /dev/null +++ b/internal/integration_tests/postgres/nulltypeprimitive/CharDefConstUniqueCheckPk.go @@ -0,0 +1,5 @@ +package dto + +type CharDefConstUniqueCheckPk struct { + CharDefConstUniqueCheckPk string `db:"char_def_const_unique_check_pk"` +} diff --git a/internal/integration_tests/postgres/nulltypeprimitive/CharDefConstUniqueCheckPkRef.go b/internal/integration_tests/postgres/nulltypeprimitive/CharDefConstUniqueCheckPkRef.go new file mode 100644 index 00000000..6b29a7e6 --- /dev/null +++ b/internal/integration_tests/postgres/nulltypeprimitive/CharDefConstUniqueCheckPkRef.go @@ -0,0 +1,5 @@ +package dto + +type CharDefConstUniqueCheckPkRef struct { + CharDefConstUniqueCheckPkRef string `db:"char_def_const_unique_check_pk_ref"` +} diff --git a/internal/integration_tests/postgres/nulltypeprimitive/CharDefFuncUniqueCheckPk.go b/internal/integration_tests/postgres/nulltypeprimitive/CharDefFuncUniqueCheckPk.go new file mode 100644 index 00000000..45d10db8 --- /dev/null +++ b/internal/integration_tests/postgres/nulltypeprimitive/CharDefFuncUniqueCheckPk.go @@ -0,0 +1,5 @@ +package dto + +type CharDefFuncUniqueCheckPk struct { + CharDefFuncUniqueCheckPk string `db:"char_def_func_unique_check_pk"` +} diff --git a/internal/integration_tests/postgres/nulltypeprimitive/CharDefFuncUniqueCheckPkRef.go b/internal/integration_tests/postgres/nulltypeprimitive/CharDefFuncUniqueCheckPkRef.go new file mode 100644 index 00000000..43d48b6b --- /dev/null +++ b/internal/integration_tests/postgres/nulltypeprimitive/CharDefFuncUniqueCheckPkRef.go @@ -0,0 +1,5 @@ +package dto + +type CharDefFuncUniqueCheckPkRef struct { + CharDefFuncUniqueCheckPkRef string `db:"char_def_func_unique_check_pk_ref"` +} diff --git a/internal/integration_tests/postgres/nulltypeprimitive/CharNnPk.go b/internal/integration_tests/postgres/nulltypeprimitive/CharNnPk.go new file mode 100644 index 00000000..309e6e87 --- /dev/null +++ b/internal/integration_tests/postgres/nulltypeprimitive/CharNnPk.go @@ -0,0 +1,5 @@ +package dto + +type CharNnPk struct { + CharNnPk string `db:"char_nn_pk"` +} diff --git a/internal/integration_tests/postgres/nulltypeprimitive/CharNnUniqueCheckPk.go b/internal/integration_tests/postgres/nulltypeprimitive/CharNnUniqueCheckPk.go new file mode 100644 index 00000000..0ffe2059 --- /dev/null +++ b/internal/integration_tests/postgres/nulltypeprimitive/CharNnUniqueCheckPk.go @@ -0,0 +1,5 @@ +package dto + +type CharNnUniqueCheckPk struct { + CharNnUniqueCheckPk string `db:"char_nn_unique_check_pk"` +} diff --git a/internal/integration_tests/postgres/nulltypeprimitive/CharNnUniqueCheckPkRef.go b/internal/integration_tests/postgres/nulltypeprimitive/CharNnUniqueCheckPkRef.go new file mode 100644 index 00000000..62f9b39b --- /dev/null +++ b/internal/integration_tests/postgres/nulltypeprimitive/CharNnUniqueCheckPkRef.go @@ -0,0 +1,5 @@ +package dto + +type CharNnUniqueCheckPkRef struct { + CharNnUniqueCheckPkRef string `db:"char_nn_unique_check_pk_ref"` +} diff --git a/internal/integration_tests/postgres/nulltypeprimitive/CharPk.go b/internal/integration_tests/postgres/nulltypeprimitive/CharPk.go new file mode 100644 index 00000000..82d769ca --- /dev/null +++ b/internal/integration_tests/postgres/nulltypeprimitive/CharPk.go @@ -0,0 +1,5 @@ +package dto + +type CharPk struct { + CharPk string `db:"char_pk"` +} diff --git a/internal/integration_tests/postgres/nulltypeprimitive/CharPkDefConst.go b/internal/integration_tests/postgres/nulltypeprimitive/CharPkDefConst.go new file mode 100644 index 00000000..e386cc95 --- /dev/null +++ b/internal/integration_tests/postgres/nulltypeprimitive/CharPkDefConst.go @@ -0,0 +1,5 @@ +package dto + +type CharPkDefConst struct { + CharPkDefConst string `db:"char_pk_def_const"` +} diff --git a/internal/integration_tests/postgres/nulltypeprimitive/CharPkDefFunc.go b/internal/integration_tests/postgres/nulltypeprimitive/CharPkDefFunc.go new file mode 100644 index 00000000..24a1d17a --- /dev/null +++ b/internal/integration_tests/postgres/nulltypeprimitive/CharPkDefFunc.go @@ -0,0 +1,5 @@ +package dto + +type CharPkDefFunc struct { + CharPkDefFunc string `db:"char_pk_def_func"` +} diff --git a/internal/integration_tests/postgres/nulltypeprimitive/CharPkRef.go b/internal/integration_tests/postgres/nulltypeprimitive/CharPkRef.go new file mode 100644 index 00000000..aed73b7d --- /dev/null +++ b/internal/integration_tests/postgres/nulltypeprimitive/CharPkRef.go @@ -0,0 +1,5 @@ +package dto + +type CharPkRef struct { + CharPkRef string `db:"char_pk_ref"` +} diff --git a/internal/integration_tests/postgres/nulltypeprimitive/CharRef.go b/internal/integration_tests/postgres/nulltypeprimitive/CharRef.go new file mode 100644 index 00000000..369a1e00 --- /dev/null +++ b/internal/integration_tests/postgres/nulltypeprimitive/CharRef.go @@ -0,0 +1,5 @@ +package dto + +type CharRef struct { + CharRef *string `db:"char_ref"` +} diff --git a/internal/integration_tests/postgres/nulltypeprimitive/CharUniqueCheckPk.go b/internal/integration_tests/postgres/nulltypeprimitive/CharUniqueCheckPk.go new file mode 100644 index 00000000..3a27898a --- /dev/null +++ b/internal/integration_tests/postgres/nulltypeprimitive/CharUniqueCheckPk.go @@ -0,0 +1,5 @@ +package dto + +type CharUniqueCheckPk struct { + CharUniqueCheckPk string `db:"char_unique_check_pk"` +} diff --git a/internal/integration_tests/postgres/nulltypeprimitive/CharUniqueCheckPkRef.go b/internal/integration_tests/postgres/nulltypeprimitive/CharUniqueCheckPkRef.go new file mode 100644 index 00000000..47939972 --- /dev/null +++ b/internal/integration_tests/postgres/nulltypeprimitive/CharUniqueCheckPkRef.go @@ -0,0 +1,5 @@ +package dto + +type CharUniqueCheckPkRef struct { + CharUniqueCheckPkRef string `db:"char_unique_check_pk_ref"` +} diff --git a/internal/integration_tests/postgres/nulltypeprimitive/CharUniquePk.go b/internal/integration_tests/postgres/nulltypeprimitive/CharUniquePk.go new file mode 100644 index 00000000..27407394 --- /dev/null +++ b/internal/integration_tests/postgres/nulltypeprimitive/CharUniquePk.go @@ -0,0 +1,5 @@ +package dto + +type CharUniquePk struct { + CharUniquePk string `db:"char_unique_pk"` +} diff --git a/internal/integration_tests/postgres/nulltypeprimitive/Character.go b/internal/integration_tests/postgres/nulltypeprimitive/Character.go new file mode 100644 index 00000000..ae5f1a67 --- /dev/null +++ b/internal/integration_tests/postgres/nulltypeprimitive/Character.go @@ -0,0 +1,31 @@ +package dto + +type Character struct { + Character *string `db:"character"` + CharacterCap *string `db:"character_cap"` + CharacterNn string `db:"character_nn"` + CharacterNnUnique string `db:"character_nn_unique"` + CharacterNnCheckCmp string `db:"character_nn_check_cmp"` + CharacterNnCheckFn string `db:"character_nn_check_fn"` + CharacterNnRef string `db:"character_nn_ref"` + CharacterNnDefConst string `db:"character_nn_def_const"` + CharacterNnDefFunc string `db:"character_nn_def_func"` + CharacterNnUniqueCheck string `db:"character_nn_unique_check"` + CharacterUnique *string `db:"character_unique"` + CharacterUniqueCheck *string `db:"character_unique_check"` + CharacterUniqueRef *string `db:"character_unique_ref"` + CharacterUniqueDefConst *string `db:"character_unique_def_const"` + CharacterUniqueDefFunc *string `db:"character_unique_def_func"` + CharacterCheck *string `db:"character_check"` + CharacterCheckRef *string `db:"character_check_ref"` + CharacterCheckDefConst *string `db:"character_check_def_const"` + CharacterCheckDefFunc *string `db:"character_check_def_func"` + CharacterRef *string `db:"character_ref"` + CharacterRefDefConst *string `db:"character_ref_def_const"` + CharacterRefDefFunc *string `db:"character_ref_def_func"` + CharacterRefUniqueCheck *string `db:"character_ref_unique_check"` + CharacterDefConst *string `db:"character_def_const"` + CharacterDefConstUniqueCheck *string `db:"character_def_const_unique_check"` + CharacterDefFunc *string `db:"character_def_func"` + CharacterDefFuncUniqueCheck *string `db:"character_def_func_unique_check"` +} diff --git a/internal/integration_tests/postgres/nulltypeprimitive/CharacterCheckPk.go b/internal/integration_tests/postgres/nulltypeprimitive/CharacterCheckPk.go new file mode 100644 index 00000000..43a57d0c --- /dev/null +++ b/internal/integration_tests/postgres/nulltypeprimitive/CharacterCheckPk.go @@ -0,0 +1,5 @@ +package dto + +type CharacterCheckPk struct { + CharacterCheckPk string `db:"character_check_pk"` +} diff --git a/internal/integration_tests/postgres/nulltypeprimitive/CharacterDefConstUniqueCheckPk.go b/internal/integration_tests/postgres/nulltypeprimitive/CharacterDefConstUniqueCheckPk.go new file mode 100644 index 00000000..fe2c62e0 --- /dev/null +++ b/internal/integration_tests/postgres/nulltypeprimitive/CharacterDefConstUniqueCheckPk.go @@ -0,0 +1,5 @@ +package dto + +type CharacterDefConstUniqueCheckPk struct { + CharacterDefConstUniqueCheckPk string `db:"character_def_const_unique_check_pk"` +} diff --git a/internal/integration_tests/postgres/nulltypeprimitive/CharacterDefConstUniqueCheckPkRef.go b/internal/integration_tests/postgres/nulltypeprimitive/CharacterDefConstUniqueCheckPkRef.go new file mode 100644 index 00000000..a26c3bf6 --- /dev/null +++ b/internal/integration_tests/postgres/nulltypeprimitive/CharacterDefConstUniqueCheckPkRef.go @@ -0,0 +1,5 @@ +package dto + +type CharacterDefConstUniqueCheckPkRef struct { + CharacterDefConstUniqueCheckPkRef string `db:"character_def_const_unique_check_pk_ref"` +} diff --git a/internal/integration_tests/postgres/nulltypeprimitive/CharacterDefFuncUniqueCheckPk.go b/internal/integration_tests/postgres/nulltypeprimitive/CharacterDefFuncUniqueCheckPk.go new file mode 100644 index 00000000..66f3450b --- /dev/null +++ b/internal/integration_tests/postgres/nulltypeprimitive/CharacterDefFuncUniqueCheckPk.go @@ -0,0 +1,5 @@ +package dto + +type CharacterDefFuncUniqueCheckPk struct { + CharacterDefFuncUniqueCheckPk string `db:"character_def_func_unique_check_pk"` +} diff --git a/internal/integration_tests/postgres/nulltypeprimitive/CharacterDefFuncUniqueCheckPkRef.go b/internal/integration_tests/postgres/nulltypeprimitive/CharacterDefFuncUniqueCheckPkRef.go new file mode 100644 index 00000000..fb65a7e2 --- /dev/null +++ b/internal/integration_tests/postgres/nulltypeprimitive/CharacterDefFuncUniqueCheckPkRef.go @@ -0,0 +1,5 @@ +package dto + +type CharacterDefFuncUniqueCheckPkRef struct { + CharacterDefFuncUniqueCheckPkRef string `db:"character_def_func_unique_check_pk_ref"` +} diff --git a/internal/integration_tests/postgres/nulltypeprimitive/CharacterNnPk.go b/internal/integration_tests/postgres/nulltypeprimitive/CharacterNnPk.go new file mode 100644 index 00000000..43a53a5a --- /dev/null +++ b/internal/integration_tests/postgres/nulltypeprimitive/CharacterNnPk.go @@ -0,0 +1,5 @@ +package dto + +type CharacterNnPk struct { + CharacterNnPk string `db:"character_nn_pk"` +} diff --git a/internal/integration_tests/postgres/nulltypeprimitive/CharacterNnUniqueCheckPk.go b/internal/integration_tests/postgres/nulltypeprimitive/CharacterNnUniqueCheckPk.go new file mode 100644 index 00000000..af7529b3 --- /dev/null +++ b/internal/integration_tests/postgres/nulltypeprimitive/CharacterNnUniqueCheckPk.go @@ -0,0 +1,5 @@ +package dto + +type CharacterNnUniqueCheckPk struct { + CharacterNnUniqueCheckPk string `db:"character_nn_unique_check_pk"` +} diff --git a/internal/integration_tests/postgres/nulltypeprimitive/CharacterNnUniqueCheckPkRef.go b/internal/integration_tests/postgres/nulltypeprimitive/CharacterNnUniqueCheckPkRef.go new file mode 100644 index 00000000..c7d4497c --- /dev/null +++ b/internal/integration_tests/postgres/nulltypeprimitive/CharacterNnUniqueCheckPkRef.go @@ -0,0 +1,5 @@ +package dto + +type CharacterNnUniqueCheckPkRef struct { + CharacterNnUniqueCheckPkRef string `db:"character_nn_unique_check_pk_ref"` +} diff --git a/internal/integration_tests/postgres/nulltypeprimitive/CharacterPk.go b/internal/integration_tests/postgres/nulltypeprimitive/CharacterPk.go new file mode 100644 index 00000000..0e01d927 --- /dev/null +++ b/internal/integration_tests/postgres/nulltypeprimitive/CharacterPk.go @@ -0,0 +1,5 @@ +package dto + +type CharacterPk struct { + CharacterPk string `db:"character_pk"` +} diff --git a/internal/integration_tests/postgres/nulltypeprimitive/CharacterPkDefConst.go b/internal/integration_tests/postgres/nulltypeprimitive/CharacterPkDefConst.go new file mode 100644 index 00000000..39881d67 --- /dev/null +++ b/internal/integration_tests/postgres/nulltypeprimitive/CharacterPkDefConst.go @@ -0,0 +1,5 @@ +package dto + +type CharacterPkDefConst struct { + CharacterPkDefConst string `db:"character_pk_def_const"` +} diff --git a/internal/integration_tests/postgres/nulltypeprimitive/CharacterPkDefFunc.go b/internal/integration_tests/postgres/nulltypeprimitive/CharacterPkDefFunc.go new file mode 100644 index 00000000..f0fdb03d --- /dev/null +++ b/internal/integration_tests/postgres/nulltypeprimitive/CharacterPkDefFunc.go @@ -0,0 +1,5 @@ +package dto + +type CharacterPkDefFunc struct { + CharacterPkDefFunc string `db:"character_pk_def_func"` +} diff --git a/internal/integration_tests/postgres/nulltypeprimitive/CharacterPkRef.go b/internal/integration_tests/postgres/nulltypeprimitive/CharacterPkRef.go new file mode 100644 index 00000000..09953a06 --- /dev/null +++ b/internal/integration_tests/postgres/nulltypeprimitive/CharacterPkRef.go @@ -0,0 +1,5 @@ +package dto + +type CharacterPkRef struct { + CharacterPkRef string `db:"character_pk_ref"` +} diff --git a/internal/integration_tests/postgres/nulltypeprimitive/CharacterRef.go b/internal/integration_tests/postgres/nulltypeprimitive/CharacterRef.go new file mode 100644 index 00000000..ae9809db --- /dev/null +++ b/internal/integration_tests/postgres/nulltypeprimitive/CharacterRef.go @@ -0,0 +1,5 @@ +package dto + +type CharacterRef struct { + CharacterRef *string `db:"character_ref"` +} diff --git a/internal/integration_tests/postgres/nulltypeprimitive/CharacterUniqueCheckPk.go b/internal/integration_tests/postgres/nulltypeprimitive/CharacterUniqueCheckPk.go new file mode 100644 index 00000000..fa003ea8 --- /dev/null +++ b/internal/integration_tests/postgres/nulltypeprimitive/CharacterUniqueCheckPk.go @@ -0,0 +1,5 @@ +package dto + +type CharacterUniqueCheckPk struct { + CharacterUniqueCheckPk string `db:"character_unique_check_pk"` +} diff --git a/internal/integration_tests/postgres/nulltypeprimitive/CharacterUniqueCheckPkRef.go b/internal/integration_tests/postgres/nulltypeprimitive/CharacterUniqueCheckPkRef.go new file mode 100644 index 00000000..e87ec75f --- /dev/null +++ b/internal/integration_tests/postgres/nulltypeprimitive/CharacterUniqueCheckPkRef.go @@ -0,0 +1,5 @@ +package dto + +type CharacterUniqueCheckPkRef struct { + CharacterUniqueCheckPkRef string `db:"character_unique_check_pk_ref"` +} diff --git a/internal/integration_tests/postgres/nulltypeprimitive/CharacterUniquePk.go b/internal/integration_tests/postgres/nulltypeprimitive/CharacterUniquePk.go new file mode 100644 index 00000000..af580474 --- /dev/null +++ b/internal/integration_tests/postgres/nulltypeprimitive/CharacterUniquePk.go @@ -0,0 +1,5 @@ +package dto + +type CharacterUniquePk struct { + CharacterUniquePk string `db:"character_unique_pk"` +} diff --git a/internal/integration_tests/postgres/nulltypeprimitive/CharacterVarying.go b/internal/integration_tests/postgres/nulltypeprimitive/CharacterVarying.go new file mode 100644 index 00000000..00b92cc7 --- /dev/null +++ b/internal/integration_tests/postgres/nulltypeprimitive/CharacterVarying.go @@ -0,0 +1,31 @@ +package dto + +type CharacterVarying struct { + CharacterVarying *string `db:"character_varying"` + CharacterVaryingCap *string `db:"character_varying_cap"` + CharacterVaryingNn string `db:"character_varying_nn"` + CharacterVaryingNnUnique string `db:"character_varying_nn_unique"` + CharacterVaryingNnCheckCmp string `db:"character_varying_nn_check_cmp"` + CharacterVaryingNnCheckFn string `db:"character_varying_nn_check_fn"` + CharacterVaryingNnRef string `db:"character_varying_nn_ref"` + CharacterVaryingNnDefConst string `db:"character_varying_nn_def_const"` + CharacterVaryingNnDefFunc string `db:"character_varying_nn_def_func"` + CharacterVaryingNnUniqueCheck string `db:"character_varying_nn_unique_check"` + CharacterVaryingUnique *string `db:"character_varying_unique"` + CharacterVaryingUniqueCheck *string `db:"character_varying_unique_check"` + CharacterVaryingUniqueRef *string `db:"character_varying_unique_ref"` + CharacterVaryingUniqueDefConst *string `db:"character_varying_unique_def_const"` + CharacterVaryingUniqueDefFunc *string `db:"character_varying_unique_def_func"` + CharacterVaryingCheck *string `db:"character_varying_check"` + CharacterVaryingCheckRef *string `db:"character_varying_check_ref"` + CharacterVaryingCheckDefConst *string `db:"character_varying_check_def_const"` + CharacterVaryingCheckDefFunc *string `db:"character_varying_check_def_func"` + CharacterVaryingRef *string `db:"character_varying_ref"` + CharacterVaryingRefDefConst *string `db:"character_varying_ref_def_const"` + CharacterVaryingRefDefFunc *string `db:"character_varying_ref_def_func"` + CharacterVaryingRefUniqueCheck *string `db:"character_varying_ref_unique_check"` + CharacterVaryingDefConst *string `db:"character_varying_def_const"` + CharacterVaryingDefConstUniqueCheck *string `db:"character_varying_def_const_unique_check"` + CharacterVaryingDefFunc *string `db:"character_varying_def_func"` + CharacterVaryingDefFuncUniqueCheck *string `db:"character_varying_def_func_unique_check"` +} diff --git a/internal/integration_tests/postgres/nulltypeprimitive/CharacterVaryingCheckPk.go b/internal/integration_tests/postgres/nulltypeprimitive/CharacterVaryingCheckPk.go new file mode 100644 index 00000000..a02d2b97 --- /dev/null +++ b/internal/integration_tests/postgres/nulltypeprimitive/CharacterVaryingCheckPk.go @@ -0,0 +1,5 @@ +package dto + +type CharacterVaryingCheckPk struct { + CharacterVaryingCheckPk string `db:"character_varying_check_pk"` +} diff --git a/internal/integration_tests/postgres/nulltypeprimitive/CharacterVaryingDefConstUniqueCheckPk.go b/internal/integration_tests/postgres/nulltypeprimitive/CharacterVaryingDefConstUniqueCheckPk.go new file mode 100644 index 00000000..0e65c023 --- /dev/null +++ b/internal/integration_tests/postgres/nulltypeprimitive/CharacterVaryingDefConstUniqueCheckPk.go @@ -0,0 +1,5 @@ +package dto + +type CharacterVaryingDefConstUniqueCheckPk struct { + CharacterVaryingDefConstUniqueCheckPk string `db:"character_varying_def_const_unique_check_pk"` +} diff --git a/internal/integration_tests/postgres/nulltypeprimitive/CharacterVaryingDefConstUniqueCheckPkRef.go b/internal/integration_tests/postgres/nulltypeprimitive/CharacterVaryingDefConstUniqueCheckPkRef.go new file mode 100644 index 00000000..9bbee877 --- /dev/null +++ b/internal/integration_tests/postgres/nulltypeprimitive/CharacterVaryingDefConstUniqueCheckPkRef.go @@ -0,0 +1,5 @@ +package dto + +type CharacterVaryingDefConstUniqueCheckPkRef struct { + CharacterVaryingDefConstUniqueCheckPkRef string `db:"character_varying_def_const_unique_check_pk_ref"` +} diff --git a/internal/integration_tests/postgres/nulltypeprimitive/CharacterVaryingDefFuncUniqueCheckPk.go b/internal/integration_tests/postgres/nulltypeprimitive/CharacterVaryingDefFuncUniqueCheckPk.go new file mode 100644 index 00000000..c5f22fa4 --- /dev/null +++ b/internal/integration_tests/postgres/nulltypeprimitive/CharacterVaryingDefFuncUniqueCheckPk.go @@ -0,0 +1,5 @@ +package dto + +type CharacterVaryingDefFuncUniqueCheckPk struct { + CharacterVaryingDefFuncUniqueCheckPk string `db:"character_varying_def_func_unique_check_pk"` +} diff --git a/internal/integration_tests/postgres/nulltypeprimitive/CharacterVaryingDefFuncUniqueCheckPkRef.go b/internal/integration_tests/postgres/nulltypeprimitive/CharacterVaryingDefFuncUniqueCheckPkRef.go new file mode 100644 index 00000000..4b728029 --- /dev/null +++ b/internal/integration_tests/postgres/nulltypeprimitive/CharacterVaryingDefFuncUniqueCheckPkRef.go @@ -0,0 +1,5 @@ +package dto + +type CharacterVaryingDefFuncUniqueCheckPkRef struct { + CharacterVaryingDefFuncUniqueCheckPkRef string `db:"character_varying_def_func_unique_check_pk_ref"` +} diff --git a/internal/integration_tests/postgres/nulltypeprimitive/CharacterVaryingNnPk.go b/internal/integration_tests/postgres/nulltypeprimitive/CharacterVaryingNnPk.go new file mode 100644 index 00000000..13cc0e4b --- /dev/null +++ b/internal/integration_tests/postgres/nulltypeprimitive/CharacterVaryingNnPk.go @@ -0,0 +1,5 @@ +package dto + +type CharacterVaryingNnPk struct { + CharacterVaryingNnPk string `db:"character_varying_nn_pk"` +} diff --git a/internal/integration_tests/postgres/nulltypeprimitive/CharacterVaryingNnUniqueCheckPk.go b/internal/integration_tests/postgres/nulltypeprimitive/CharacterVaryingNnUniqueCheckPk.go new file mode 100644 index 00000000..01255678 --- /dev/null +++ b/internal/integration_tests/postgres/nulltypeprimitive/CharacterVaryingNnUniqueCheckPk.go @@ -0,0 +1,5 @@ +package dto + +type CharacterVaryingNnUniqueCheckPk struct { + CharacterVaryingNnUniqueCheckPk string `db:"character_varying_nn_unique_check_pk"` +} diff --git a/internal/integration_tests/postgres/nulltypeprimitive/CharacterVaryingNnUniqueCheckPkRef.go b/internal/integration_tests/postgres/nulltypeprimitive/CharacterVaryingNnUniqueCheckPkRef.go new file mode 100644 index 00000000..58498089 --- /dev/null +++ b/internal/integration_tests/postgres/nulltypeprimitive/CharacterVaryingNnUniqueCheckPkRef.go @@ -0,0 +1,5 @@ +package dto + +type CharacterVaryingNnUniqueCheckPkRef struct { + CharacterVaryingNnUniqueCheckPkRef string `db:"character_varying_nn_unique_check_pk_ref"` +} diff --git a/internal/integration_tests/postgres/nulltypeprimitive/CharacterVaryingPk.go b/internal/integration_tests/postgres/nulltypeprimitive/CharacterVaryingPk.go new file mode 100644 index 00000000..51554509 --- /dev/null +++ b/internal/integration_tests/postgres/nulltypeprimitive/CharacterVaryingPk.go @@ -0,0 +1,5 @@ +package dto + +type CharacterVaryingPk struct { + CharacterVaryingPk string `db:"character_varying_pk"` +} diff --git a/internal/integration_tests/postgres/nulltypeprimitive/CharacterVaryingPkDefConst.go b/internal/integration_tests/postgres/nulltypeprimitive/CharacterVaryingPkDefConst.go new file mode 100644 index 00000000..0dd7e8fd --- /dev/null +++ b/internal/integration_tests/postgres/nulltypeprimitive/CharacterVaryingPkDefConst.go @@ -0,0 +1,5 @@ +package dto + +type CharacterVaryingPkDefConst struct { + CharacterVaryingPkDefConst string `db:"character_varying_pk_def_const"` +} diff --git a/internal/integration_tests/postgres/nulltypeprimitive/CharacterVaryingPkDefFunc.go b/internal/integration_tests/postgres/nulltypeprimitive/CharacterVaryingPkDefFunc.go new file mode 100644 index 00000000..0663e375 --- /dev/null +++ b/internal/integration_tests/postgres/nulltypeprimitive/CharacterVaryingPkDefFunc.go @@ -0,0 +1,5 @@ +package dto + +type CharacterVaryingPkDefFunc struct { + CharacterVaryingPkDefFunc string `db:"character_varying_pk_def_func"` +} diff --git a/internal/integration_tests/postgres/nulltypeprimitive/CharacterVaryingPkRef.go b/internal/integration_tests/postgres/nulltypeprimitive/CharacterVaryingPkRef.go new file mode 100644 index 00000000..57831d46 --- /dev/null +++ b/internal/integration_tests/postgres/nulltypeprimitive/CharacterVaryingPkRef.go @@ -0,0 +1,5 @@ +package dto + +type CharacterVaryingPkRef struct { + CharacterVaryingPkRef string `db:"character_varying_pk_ref"` +} diff --git a/internal/integration_tests/postgres/nulltypeprimitive/CharacterVaryingRef.go b/internal/integration_tests/postgres/nulltypeprimitive/CharacterVaryingRef.go new file mode 100644 index 00000000..bef8f481 --- /dev/null +++ b/internal/integration_tests/postgres/nulltypeprimitive/CharacterVaryingRef.go @@ -0,0 +1,5 @@ +package dto + +type CharacterVaryingRef struct { + CharacterVaryingRef *string `db:"character_varying_ref"` +} diff --git a/internal/integration_tests/postgres/nulltypeprimitive/CharacterVaryingUniqueCheckPk.go b/internal/integration_tests/postgres/nulltypeprimitive/CharacterVaryingUniqueCheckPk.go new file mode 100644 index 00000000..5e362dfc --- /dev/null +++ b/internal/integration_tests/postgres/nulltypeprimitive/CharacterVaryingUniqueCheckPk.go @@ -0,0 +1,5 @@ +package dto + +type CharacterVaryingUniqueCheckPk struct { + CharacterVaryingUniqueCheckPk string `db:"character_varying_unique_check_pk"` +} diff --git a/internal/integration_tests/postgres/nulltypeprimitive/CharacterVaryingUniqueCheckPkRef.go b/internal/integration_tests/postgres/nulltypeprimitive/CharacterVaryingUniqueCheckPkRef.go new file mode 100644 index 00000000..2553e497 --- /dev/null +++ b/internal/integration_tests/postgres/nulltypeprimitive/CharacterVaryingUniqueCheckPkRef.go @@ -0,0 +1,5 @@ +package dto + +type CharacterVaryingUniqueCheckPkRef struct { + CharacterVaryingUniqueCheckPkRef string `db:"character_varying_unique_check_pk_ref"` +} diff --git a/internal/integration_tests/postgres/nulltypeprimitive/CharacterVaryingUniquePk.go b/internal/integration_tests/postgres/nulltypeprimitive/CharacterVaryingUniquePk.go new file mode 100644 index 00000000..1dd51986 --- /dev/null +++ b/internal/integration_tests/postgres/nulltypeprimitive/CharacterVaryingUniquePk.go @@ -0,0 +1,5 @@ +package dto + +type CharacterVaryingUniquePk struct { + CharacterVaryingUniquePk string `db:"character_varying_unique_pk"` +} diff --git a/internal/integration_tests/postgres/nulltypeprimitive/ConstraintComboNonPk.go b/internal/integration_tests/postgres/nulltypeprimitive/ConstraintComboNonPk.go new file mode 100644 index 00000000..575d9778 --- /dev/null +++ b/internal/integration_tests/postgres/nulltypeprimitive/ConstraintComboNonPk.go @@ -0,0 +1,16 @@ +package dto + +type ConstraintComboNonPk struct { + NotNullUniqueCheckDefConst float64 `db:"not_null_unique_check_def_const"` + NotNullUniqueCheckDefFunc float64 `db:"not_null_unique_check_def_func"` + NotNullUniqueRefDefConst float64 `db:"not_null_unique_ref_def_const"` + NotNullUniqueRefDefFunc float64 `db:"not_null_unique_ref_def_func"` + NotNullCheckRefDefConst float64 `db:"not_null_check_ref_def_const"` + NotNullCheckRefDefFunc float64 `db:"not_null_check_ref_def_func"` + NotNullUniqueDefConst float64 `db:"not_null_unique_def_const"` + NotNullUniqueDefFunc float64 `db:"not_null_unique_def_func"` + NotNullCheckDefConst float64 `db:"not_null_check_def_const"` + NotNullCheckDefFunc float64 `db:"not_null_check_def_func"` + NotNullRefDefConst float64 `db:"not_null_ref_def_const"` + NotNullRefDefFunc float64 `db:"not_null_ref_def_func"` +} diff --git a/internal/integration_tests/postgres/nulltypeprimitive/ConstraintComboNotNullCheckPkDefConst.go b/internal/integration_tests/postgres/nulltypeprimitive/ConstraintComboNotNullCheckPkDefConst.go new file mode 100644 index 00000000..4aa890ba --- /dev/null +++ b/internal/integration_tests/postgres/nulltypeprimitive/ConstraintComboNotNullCheckPkDefConst.go @@ -0,0 +1,5 @@ +package dto + +type ConstraintComboNotNullCheckPkDefConst struct { + ConstraintComboNotNullCheckPkDefConst float64 `db:"constraint_combo_not_null_check_pk_def_const"` +} diff --git a/internal/integration_tests/postgres/nulltypeprimitive/ConstraintComboNotNullCheckPkDefFunc.go b/internal/integration_tests/postgres/nulltypeprimitive/ConstraintComboNotNullCheckPkDefFunc.go new file mode 100644 index 00000000..dce0d8b3 --- /dev/null +++ b/internal/integration_tests/postgres/nulltypeprimitive/ConstraintComboNotNullCheckPkDefFunc.go @@ -0,0 +1,5 @@ +package dto + +type ConstraintComboNotNullCheckPkDefFunc struct { + ConstraintComboNotNullCheckPkDefFunc float64 `db:"constraint_combo_not_null_check_pk_def_func"` +} diff --git a/internal/integration_tests/postgres/nulltypeprimitive/ConstraintComboNotNullPkDefConst.go b/internal/integration_tests/postgres/nulltypeprimitive/ConstraintComboNotNullPkDefConst.go new file mode 100644 index 00000000..ca059e7a --- /dev/null +++ b/internal/integration_tests/postgres/nulltypeprimitive/ConstraintComboNotNullPkDefConst.go @@ -0,0 +1,5 @@ +package dto + +type ConstraintComboNotNullPkDefConst struct { + ConstraintComboNotNullPkDefConst float64 `db:"constraint_combo_not_null_pk_def_const"` +} diff --git a/internal/integration_tests/postgres/nulltypeprimitive/ConstraintComboNotNullPkDefFunc.go b/internal/integration_tests/postgres/nulltypeprimitive/ConstraintComboNotNullPkDefFunc.go new file mode 100644 index 00000000..5bb0b531 --- /dev/null +++ b/internal/integration_tests/postgres/nulltypeprimitive/ConstraintComboNotNullPkDefFunc.go @@ -0,0 +1,5 @@ +package dto + +type ConstraintComboNotNullPkDefFunc struct { + ConstraintComboNotNullPkDefFunc float64 `db:"constraint_combo_not_null_pk_def_func"` +} diff --git a/internal/integration_tests/postgres/nulltypeprimitive/ConstraintComboNotNullPkRefDefConst.go b/internal/integration_tests/postgres/nulltypeprimitive/ConstraintComboNotNullPkRefDefConst.go new file mode 100644 index 00000000..4bd7ce91 --- /dev/null +++ b/internal/integration_tests/postgres/nulltypeprimitive/ConstraintComboNotNullPkRefDefConst.go @@ -0,0 +1,5 @@ +package dto + +type ConstraintComboNotNullPkRefDefConst struct { + ConstraintComboNotNullPkRefDefConst float64 `db:"constraint_combo_not_null_pk_ref_def_const"` +} diff --git a/internal/integration_tests/postgres/nulltypeprimitive/ConstraintComboNotNullPkRefDefFunc.go b/internal/integration_tests/postgres/nulltypeprimitive/ConstraintComboNotNullPkRefDefFunc.go new file mode 100644 index 00000000..72c2299b --- /dev/null +++ b/internal/integration_tests/postgres/nulltypeprimitive/ConstraintComboNotNullPkRefDefFunc.go @@ -0,0 +1,5 @@ +package dto + +type ConstraintComboNotNullPkRefDefFunc struct { + ConstraintComboNotNullPkRefDefFunc float64 `db:"constraint_combo_not_null_pk_ref_def_func"` +} diff --git a/internal/integration_tests/postgres/nulltypeprimitive/ConstraintComboNotNullUniquePkDefConst.go b/internal/integration_tests/postgres/nulltypeprimitive/ConstraintComboNotNullUniquePkDefConst.go new file mode 100644 index 00000000..b195d769 --- /dev/null +++ b/internal/integration_tests/postgres/nulltypeprimitive/ConstraintComboNotNullUniquePkDefConst.go @@ -0,0 +1,5 @@ +package dto + +type ConstraintComboNotNullUniquePkDefConst struct { + ConstraintComboNotNullUniquePkDefConst float64 `db:"constraint_combo_not_null_unique_pk_def_const"` +} diff --git a/internal/integration_tests/postgres/nulltypeprimitive/ConstraintComboNotNullUniquePkDefFunc.go b/internal/integration_tests/postgres/nulltypeprimitive/ConstraintComboNotNullUniquePkDefFunc.go new file mode 100644 index 00000000..845d6231 --- /dev/null +++ b/internal/integration_tests/postgres/nulltypeprimitive/ConstraintComboNotNullUniquePkDefFunc.go @@ -0,0 +1,5 @@ +package dto + +type ConstraintComboNotNullUniquePkDefFunc struct { + ConstraintComboNotNullUniquePkDefFunc float64 `db:"constraint_combo_not_null_unique_pk_def_func"` +} diff --git a/internal/integration_tests/postgres/nulltypeprimitive/ConstraintComboRef.go b/internal/integration_tests/postgres/nulltypeprimitive/ConstraintComboRef.go new file mode 100644 index 00000000..85387cf7 --- /dev/null +++ b/internal/integration_tests/postgres/nulltypeprimitive/ConstraintComboRef.go @@ -0,0 +1,5 @@ +package dto + +type ConstraintComboRef struct { + ConstraintComboRef *float64 `db:"constraint_combo_ref"` +} diff --git a/internal/integration_tests/postgres/nulltypeprimitive/Date.go b/internal/integration_tests/postgres/nulltypeprimitive/Date.go new file mode 100644 index 00000000..ea95bc42 --- /dev/null +++ b/internal/integration_tests/postgres/nulltypeprimitive/Date.go @@ -0,0 +1,33 @@ +package dto + +import ( + "time" +) + +type Date struct { + Date *time.Time `db:"date"` + DateNn time.Time `db:"date_nn"` + DateNnUnique time.Time `db:"date_nn_unique"` + DateNnCheck time.Time `db:"date_nn_check"` + DateNnRef time.Time `db:"date_nn_ref"` + DateNnDefConst time.Time `db:"date_nn_def_const"` + DateNnDefFunc time.Time `db:"date_nn_def_func"` + DateNnUniqueCheck time.Time `db:"date_nn_unique_check"` + DateUnique *time.Time `db:"date_unique"` + DateUniqueCheck *time.Time `db:"date_unique_check"` + DateUniqueRef *time.Time `db:"date_unique_ref"` + DateUniqueDefConst *time.Time `db:"date_unique_def_const"` + DateUniqueDefFunc *time.Time `db:"date_unique_def_func"` + DateCheck *time.Time `db:"date_check"` + DateCheckRef *time.Time `db:"date_check_ref"` + DateCheckDefConst *time.Time `db:"date_check_def_const"` + DateCheckDefFunc *time.Time `db:"date_check_def_func"` + DateRef *time.Time `db:"date_ref"` + DateRefDefConst *time.Time `db:"date_ref_def_const"` + DateRefDefFunc *time.Time `db:"date_ref_def_func"` + DateRefUniqueCheck *time.Time `db:"date_ref_unique_check"` + DateDefConst *time.Time `db:"date_def_const"` + DateDefConstUniqueCheck *time.Time `db:"date_def_const_unique_check"` + DateDefFunc *time.Time `db:"date_def_func"` + DateDefFuncUniqueCheck *time.Time `db:"date_def_func_unique_check"` +} diff --git a/internal/integration_tests/postgres/nulltypeprimitive/DateCheckPk.go b/internal/integration_tests/postgres/nulltypeprimitive/DateCheckPk.go new file mode 100644 index 00000000..6cb1844e --- /dev/null +++ b/internal/integration_tests/postgres/nulltypeprimitive/DateCheckPk.go @@ -0,0 +1,9 @@ +package dto + +import ( + "time" +) + +type DateCheckPk struct { + DateCheckPk time.Time `db:"date_check_pk"` +} diff --git a/internal/integration_tests/postgres/nulltypeprimitive/DateDefConstUniqueCheckPk.go b/internal/integration_tests/postgres/nulltypeprimitive/DateDefConstUniqueCheckPk.go new file mode 100644 index 00000000..e07a7ed5 --- /dev/null +++ b/internal/integration_tests/postgres/nulltypeprimitive/DateDefConstUniqueCheckPk.go @@ -0,0 +1,9 @@ +package dto + +import ( + "time" +) + +type DateDefConstUniqueCheckPk struct { + DateDefConstUniqueCheckPk time.Time `db:"date_def_const_unique_check_pk"` +} diff --git a/internal/integration_tests/postgres/nulltypeprimitive/DateDefConstUniqueCheckPkRef.go b/internal/integration_tests/postgres/nulltypeprimitive/DateDefConstUniqueCheckPkRef.go new file mode 100644 index 00000000..3b99928e --- /dev/null +++ b/internal/integration_tests/postgres/nulltypeprimitive/DateDefConstUniqueCheckPkRef.go @@ -0,0 +1,9 @@ +package dto + +import ( + "time" +) + +type DateDefConstUniqueCheckPkRef struct { + DateDefConstUniqueCheckPkRef time.Time `db:"date_def_const_unique_check_pk_ref"` +} diff --git a/internal/integration_tests/postgres/nulltypeprimitive/DateDefFuncUniqueCheckPk.go b/internal/integration_tests/postgres/nulltypeprimitive/DateDefFuncUniqueCheckPk.go new file mode 100644 index 00000000..12934d64 --- /dev/null +++ b/internal/integration_tests/postgres/nulltypeprimitive/DateDefFuncUniqueCheckPk.go @@ -0,0 +1,9 @@ +package dto + +import ( + "time" +) + +type DateDefFuncUniqueCheckPk struct { + DateDefFuncUniqueCheckPk time.Time `db:"date_def_func_unique_check_pk"` +} diff --git a/internal/integration_tests/postgres/nulltypeprimitive/DateDefFuncUniqueCheckPkRef.go b/internal/integration_tests/postgres/nulltypeprimitive/DateDefFuncUniqueCheckPkRef.go new file mode 100644 index 00000000..19ed2d94 --- /dev/null +++ b/internal/integration_tests/postgres/nulltypeprimitive/DateDefFuncUniqueCheckPkRef.go @@ -0,0 +1,9 @@ +package dto + +import ( + "time" +) + +type DateDefFuncUniqueCheckPkRef struct { + DateDefFuncUniqueCheckPkRef time.Time `db:"date_def_func_unique_check_pk_ref"` +} diff --git a/internal/integration_tests/postgres/nulltypeprimitive/DateNnPk.go b/internal/integration_tests/postgres/nulltypeprimitive/DateNnPk.go new file mode 100644 index 00000000..24f7dc12 --- /dev/null +++ b/internal/integration_tests/postgres/nulltypeprimitive/DateNnPk.go @@ -0,0 +1,9 @@ +package dto + +import ( + "time" +) + +type DateNnPk struct { + DateNnPk time.Time `db:"date_nn_pk"` +} diff --git a/internal/integration_tests/postgres/nulltypeprimitive/DateNnUniqueCheckPk.go b/internal/integration_tests/postgres/nulltypeprimitive/DateNnUniqueCheckPk.go new file mode 100644 index 00000000..162ceee5 --- /dev/null +++ b/internal/integration_tests/postgres/nulltypeprimitive/DateNnUniqueCheckPk.go @@ -0,0 +1,9 @@ +package dto + +import ( + "time" +) + +type DateNnUniqueCheckPk struct { + DateNnUniqueCheckPk time.Time `db:"date_nn_unique_check_pk"` +} diff --git a/internal/integration_tests/postgres/nulltypeprimitive/DateNnUniqueCheckPkRef.go b/internal/integration_tests/postgres/nulltypeprimitive/DateNnUniqueCheckPkRef.go new file mode 100644 index 00000000..57c61fce --- /dev/null +++ b/internal/integration_tests/postgres/nulltypeprimitive/DateNnUniqueCheckPkRef.go @@ -0,0 +1,9 @@ +package dto + +import ( + "time" +) + +type DateNnUniqueCheckPkRef struct { + DateNnUniqueCheckPkRef time.Time `db:"date_nn_unique_check_pk_ref"` +} diff --git a/internal/integration_tests/postgres/nulltypeprimitive/DatePk.go b/internal/integration_tests/postgres/nulltypeprimitive/DatePk.go new file mode 100644 index 00000000..d006be42 --- /dev/null +++ b/internal/integration_tests/postgres/nulltypeprimitive/DatePk.go @@ -0,0 +1,9 @@ +package dto + +import ( + "time" +) + +type DatePk struct { + DatePk time.Time `db:"date_pk"` +} diff --git a/internal/integration_tests/postgres/nulltypeprimitive/DatePkDefConst.go b/internal/integration_tests/postgres/nulltypeprimitive/DatePkDefConst.go new file mode 100644 index 00000000..b10866e0 --- /dev/null +++ b/internal/integration_tests/postgres/nulltypeprimitive/DatePkDefConst.go @@ -0,0 +1,9 @@ +package dto + +import ( + "time" +) + +type DatePkDefConst struct { + DatePkDefConst time.Time `db:"date_pk_def_const"` +} diff --git a/internal/integration_tests/postgres/nulltypeprimitive/DatePkDefFunc.go b/internal/integration_tests/postgres/nulltypeprimitive/DatePkDefFunc.go new file mode 100644 index 00000000..133d388a --- /dev/null +++ b/internal/integration_tests/postgres/nulltypeprimitive/DatePkDefFunc.go @@ -0,0 +1,9 @@ +package dto + +import ( + "time" +) + +type DatePkDefFunc struct { + DatePkDefFunc time.Time `db:"date_pk_def_func"` +} diff --git a/internal/integration_tests/postgres/nulltypeprimitive/DatePkRef.go b/internal/integration_tests/postgres/nulltypeprimitive/DatePkRef.go new file mode 100644 index 00000000..e4f6d521 --- /dev/null +++ b/internal/integration_tests/postgres/nulltypeprimitive/DatePkRef.go @@ -0,0 +1,9 @@ +package dto + +import ( + "time" +) + +type DatePkRef struct { + DatePkRef time.Time `db:"date_pk_ref"` +} diff --git a/internal/integration_tests/postgres/nulltypeprimitive/DateRef.go b/internal/integration_tests/postgres/nulltypeprimitive/DateRef.go new file mode 100644 index 00000000..31d25216 --- /dev/null +++ b/internal/integration_tests/postgres/nulltypeprimitive/DateRef.go @@ -0,0 +1,9 @@ +package dto + +import ( + "time" +) + +type DateRef struct { + DateRef *time.Time `db:"date_ref"` +} diff --git a/internal/integration_tests/postgres/nulltypeprimitive/DateUniqueCheckPk.go b/internal/integration_tests/postgres/nulltypeprimitive/DateUniqueCheckPk.go new file mode 100644 index 00000000..de81a9ee --- /dev/null +++ b/internal/integration_tests/postgres/nulltypeprimitive/DateUniqueCheckPk.go @@ -0,0 +1,9 @@ +package dto + +import ( + "time" +) + +type DateUniqueCheckPk struct { + DateUniqueCheckPk time.Time `db:"date_unique_check_pk"` +} diff --git a/internal/integration_tests/postgres/nulltypeprimitive/DateUniqueCheckPkRef.go b/internal/integration_tests/postgres/nulltypeprimitive/DateUniqueCheckPkRef.go new file mode 100644 index 00000000..9c44f9cd --- /dev/null +++ b/internal/integration_tests/postgres/nulltypeprimitive/DateUniqueCheckPkRef.go @@ -0,0 +1,9 @@ +package dto + +import ( + "time" +) + +type DateUniqueCheckPkRef struct { + DateUniqueCheckPkRef time.Time `db:"date_unique_check_pk_ref"` +} diff --git a/internal/integration_tests/postgres/nulltypeprimitive/DateUniquePk.go b/internal/integration_tests/postgres/nulltypeprimitive/DateUniquePk.go new file mode 100644 index 00000000..8a2081d9 --- /dev/null +++ b/internal/integration_tests/postgres/nulltypeprimitive/DateUniquePk.go @@ -0,0 +1,9 @@ +package dto + +import ( + "time" +) + +type DateUniquePk struct { + DateUniquePk time.Time `db:"date_unique_pk"` +} diff --git a/internal/integration_tests/postgres/nulltypeprimitive/Decimal.go b/internal/integration_tests/postgres/nulltypeprimitive/Decimal.go new file mode 100644 index 00000000..4d3e5b25 --- /dev/null +++ b/internal/integration_tests/postgres/nulltypeprimitive/Decimal.go @@ -0,0 +1,29 @@ +package dto + +type Decimal struct { + Decimal *float64 `db:"decimal"` + DecimalNn float64 `db:"decimal_nn"` + DecimalNnUnique float64 `db:"decimal_nn_unique"` + DecimalNnCheck float64 `db:"decimal_nn_check"` + DecimalNnRef float64 `db:"decimal_nn_ref"` + DecimalNnDefConst float64 `db:"decimal_nn_def_const"` + DecimalNnDefFunc float64 `db:"decimal_nn_def_func"` + DecimalNnUniqueCheck float64 `db:"decimal_nn_unique_check"` + DecimalUnique *float64 `db:"decimal_unique"` + DecimalUniqueCheck *float64 `db:"decimal_unique_check"` + DecimalUniqueRef *float64 `db:"decimal_unique_ref"` + DecimalUniqueDefConst *float64 `db:"decimal_unique_def_const"` + DecimalUniqueDefFunc *float64 `db:"decimal_unique_def_func"` + DecimalCheck *float64 `db:"decimal_check"` + DecimalCheckRef *float64 `db:"decimal_check_ref"` + DecimalCheckDefConst *float64 `db:"decimal_check_def_const"` + DecimalCheckDefFunc *float64 `db:"decimal_check_def_func"` + DecimalRef *float64 `db:"decimal_ref"` + DecimalRefDefConst *float64 `db:"decimal_ref_def_const"` + DecimalRefDefFunc *float64 `db:"decimal_ref_def_func"` + DecimalRefUniqueCheck *float64 `db:"decimal_ref_unique_check"` + DecimalDefConst *float64 `db:"decimal_def_const"` + DecimalDefConstUniqueCheck *float64 `db:"decimal_def_const_unique_check"` + DecimalDefFunc *float64 `db:"decimal_def_func"` + DecimalDefFuncUniqueCheck *float64 `db:"decimal_def_func_unique_check"` +} diff --git a/internal/integration_tests/postgres/nulltypeprimitive/DecimalCheckPk.go b/internal/integration_tests/postgres/nulltypeprimitive/DecimalCheckPk.go new file mode 100644 index 00000000..e51ea81a --- /dev/null +++ b/internal/integration_tests/postgres/nulltypeprimitive/DecimalCheckPk.go @@ -0,0 +1,5 @@ +package dto + +type DecimalCheckPk struct { + DecimalCheckPk float64 `db:"decimal_check_pk"` +} diff --git a/internal/integration_tests/postgres/nulltypeprimitive/DecimalDefConstUniqueCheckPk.go b/internal/integration_tests/postgres/nulltypeprimitive/DecimalDefConstUniqueCheckPk.go new file mode 100644 index 00000000..725b1900 --- /dev/null +++ b/internal/integration_tests/postgres/nulltypeprimitive/DecimalDefConstUniqueCheckPk.go @@ -0,0 +1,5 @@ +package dto + +type DecimalDefConstUniqueCheckPk struct { + DecimalDefConstUniqueCheckPk float64 `db:"decimal_def_const_unique_check_pk"` +} diff --git a/internal/integration_tests/postgres/nulltypeprimitive/DecimalDefConstUniqueCheckPkRef.go b/internal/integration_tests/postgres/nulltypeprimitive/DecimalDefConstUniqueCheckPkRef.go new file mode 100644 index 00000000..47a13f96 --- /dev/null +++ b/internal/integration_tests/postgres/nulltypeprimitive/DecimalDefConstUniqueCheckPkRef.go @@ -0,0 +1,5 @@ +package dto + +type DecimalDefConstUniqueCheckPkRef struct { + DecimalDefConstUniqueCheckPkRef float64 `db:"decimal_def_const_unique_check_pk_ref"` +} diff --git a/internal/integration_tests/postgres/nulltypeprimitive/DecimalDefFuncUniqueCheckPk.go b/internal/integration_tests/postgres/nulltypeprimitive/DecimalDefFuncUniqueCheckPk.go new file mode 100644 index 00000000..689faf76 --- /dev/null +++ b/internal/integration_tests/postgres/nulltypeprimitive/DecimalDefFuncUniqueCheckPk.go @@ -0,0 +1,5 @@ +package dto + +type DecimalDefFuncUniqueCheckPk struct { + DecimalDefFuncUniqueCheckPk float64 `db:"decimal_def_func_unique_check_pk"` +} diff --git a/internal/integration_tests/postgres/nulltypeprimitive/DecimalDefFuncUniqueCheckPkRef.go b/internal/integration_tests/postgres/nulltypeprimitive/DecimalDefFuncUniqueCheckPkRef.go new file mode 100644 index 00000000..212509c5 --- /dev/null +++ b/internal/integration_tests/postgres/nulltypeprimitive/DecimalDefFuncUniqueCheckPkRef.go @@ -0,0 +1,5 @@ +package dto + +type DecimalDefFuncUniqueCheckPkRef struct { + DecimalDefFuncUniqueCheckPkRef float64 `db:"decimal_def_func_unique_check_pk_ref"` +} diff --git a/internal/integration_tests/postgres/nulltypeprimitive/DecimalNnPk.go b/internal/integration_tests/postgres/nulltypeprimitive/DecimalNnPk.go new file mode 100644 index 00000000..cd8f4912 --- /dev/null +++ b/internal/integration_tests/postgres/nulltypeprimitive/DecimalNnPk.go @@ -0,0 +1,5 @@ +package dto + +type DecimalNnPk struct { + DecimalNnPk float64 `db:"decimal_nn_pk"` +} diff --git a/internal/integration_tests/postgres/nulltypeprimitive/DecimalNnUniqueCheckPk.go b/internal/integration_tests/postgres/nulltypeprimitive/DecimalNnUniqueCheckPk.go new file mode 100644 index 00000000..fa82e68b --- /dev/null +++ b/internal/integration_tests/postgres/nulltypeprimitive/DecimalNnUniqueCheckPk.go @@ -0,0 +1,5 @@ +package dto + +type DecimalNnUniqueCheckPk struct { + DecimalNnUniqueCheckPk float64 `db:"decimal_nn_unique_check_pk"` +} diff --git a/internal/integration_tests/postgres/nulltypeprimitive/DecimalNnUniqueCheckPkRef.go b/internal/integration_tests/postgres/nulltypeprimitive/DecimalNnUniqueCheckPkRef.go new file mode 100644 index 00000000..f9003bf2 --- /dev/null +++ b/internal/integration_tests/postgres/nulltypeprimitive/DecimalNnUniqueCheckPkRef.go @@ -0,0 +1,5 @@ +package dto + +type DecimalNnUniqueCheckPkRef struct { + DecimalNnUniqueCheckPkRef float64 `db:"decimal_nn_unique_check_pk_ref"` +} diff --git a/internal/integration_tests/postgres/nulltypeprimitive/DecimalPk.go b/internal/integration_tests/postgres/nulltypeprimitive/DecimalPk.go new file mode 100644 index 00000000..42a811a1 --- /dev/null +++ b/internal/integration_tests/postgres/nulltypeprimitive/DecimalPk.go @@ -0,0 +1,5 @@ +package dto + +type DecimalPk struct { + DecimalPk float64 `db:"decimal_pk"` +} diff --git a/internal/integration_tests/postgres/nulltypeprimitive/DecimalPkDefConst.go b/internal/integration_tests/postgres/nulltypeprimitive/DecimalPkDefConst.go new file mode 100644 index 00000000..844cf9d1 --- /dev/null +++ b/internal/integration_tests/postgres/nulltypeprimitive/DecimalPkDefConst.go @@ -0,0 +1,5 @@ +package dto + +type DecimalPkDefConst struct { + DecimalPkDefConst float64 `db:"decimal_pk_def_const"` +} diff --git a/internal/integration_tests/postgres/nulltypeprimitive/DecimalPkDefFunc.go b/internal/integration_tests/postgres/nulltypeprimitive/DecimalPkDefFunc.go new file mode 100644 index 00000000..82ec62c8 --- /dev/null +++ b/internal/integration_tests/postgres/nulltypeprimitive/DecimalPkDefFunc.go @@ -0,0 +1,5 @@ +package dto + +type DecimalPkDefFunc struct { + DecimalPkDefFunc float64 `db:"decimal_pk_def_func"` +} diff --git a/internal/integration_tests/postgres/nulltypeprimitive/DecimalPkRef.go b/internal/integration_tests/postgres/nulltypeprimitive/DecimalPkRef.go new file mode 100644 index 00000000..bd5ef076 --- /dev/null +++ b/internal/integration_tests/postgres/nulltypeprimitive/DecimalPkRef.go @@ -0,0 +1,5 @@ +package dto + +type DecimalPkRef struct { + DecimalPkRef float64 `db:"decimal_pk_ref"` +} diff --git a/internal/integration_tests/postgres/nulltypeprimitive/DecimalRef.go b/internal/integration_tests/postgres/nulltypeprimitive/DecimalRef.go new file mode 100644 index 00000000..46576647 --- /dev/null +++ b/internal/integration_tests/postgres/nulltypeprimitive/DecimalRef.go @@ -0,0 +1,5 @@ +package dto + +type DecimalRef struct { + DecimalRef *float64 `db:"decimal_ref"` +} diff --git a/internal/integration_tests/postgres/nulltypeprimitive/DecimalUniqueCheckPk.go b/internal/integration_tests/postgres/nulltypeprimitive/DecimalUniqueCheckPk.go new file mode 100644 index 00000000..f6df5c3e --- /dev/null +++ b/internal/integration_tests/postgres/nulltypeprimitive/DecimalUniqueCheckPk.go @@ -0,0 +1,5 @@ +package dto + +type DecimalUniqueCheckPk struct { + DecimalUniqueCheckPk float64 `db:"decimal_unique_check_pk"` +} diff --git a/internal/integration_tests/postgres/nulltypeprimitive/DecimalUniqueCheckPkRef.go b/internal/integration_tests/postgres/nulltypeprimitive/DecimalUniqueCheckPkRef.go new file mode 100644 index 00000000..c94f982e --- /dev/null +++ b/internal/integration_tests/postgres/nulltypeprimitive/DecimalUniqueCheckPkRef.go @@ -0,0 +1,5 @@ +package dto + +type DecimalUniqueCheckPkRef struct { + DecimalUniqueCheckPkRef float64 `db:"decimal_unique_check_pk_ref"` +} diff --git a/internal/integration_tests/postgres/nulltypeprimitive/DecimalUniquePk.go b/internal/integration_tests/postgres/nulltypeprimitive/DecimalUniquePk.go new file mode 100644 index 00000000..ca299e19 --- /dev/null +++ b/internal/integration_tests/postgres/nulltypeprimitive/DecimalUniquePk.go @@ -0,0 +1,5 @@ +package dto + +type DecimalUniquePk struct { + DecimalUniquePk float64 `db:"decimal_unique_pk"` +} diff --git a/internal/integration_tests/postgres/nulltypeprimitive/DoublePrecision.go b/internal/integration_tests/postgres/nulltypeprimitive/DoublePrecision.go new file mode 100644 index 00000000..ad963057 --- /dev/null +++ b/internal/integration_tests/postgres/nulltypeprimitive/DoublePrecision.go @@ -0,0 +1,29 @@ +package dto + +type DoublePrecision struct { + DoublePrecision *float64 `db:"double_precision"` + DoublePrecisionNn float64 `db:"double_precision_nn"` + DoublePrecisionNnUnique float64 `db:"double_precision_nn_unique"` + DoublePrecisionNnCheck float64 `db:"double_precision_nn_check"` + DoublePrecisionNnRef float64 `db:"double_precision_nn_ref"` + DoublePrecisionNnDefConst float64 `db:"double_precision_nn_def_const"` + DoublePrecisionNnDefFunc float64 `db:"double_precision_nn_def_func"` + DoublePrecisionNnUniqueCheck float64 `db:"double_precision_nn_unique_check"` + DoublePrecisionUnique *float64 `db:"double_precision_unique"` + DoublePrecisionUniqueCheck *float64 `db:"double_precision_unique_check"` + DoublePrecisionUniqueRef *float64 `db:"double_precision_unique_ref"` + DoublePrecisionUniqueDefConst *float64 `db:"double_precision_unique_def_const"` + DoublePrecisionUniqueDefFunc *float64 `db:"double_precision_unique_def_func"` + DoublePrecisionCheck *float64 `db:"double_precision_check"` + DoublePrecisionCheckRef *float64 `db:"double_precision_check_ref"` + DoublePrecisionCheckDefConst *float64 `db:"double_precision_check_def_const"` + DoublePrecisionCheckDefFunc *float64 `db:"double_precision_check_def_func"` + DoublePrecisionRef *float64 `db:"double_precision_ref"` + DoublePrecisionRefDefConst *float64 `db:"double_precision_ref_def_const"` + DoublePrecisionRefDefFunc *float64 `db:"double_precision_ref_def_func"` + DoublePrecisionRefUniqueCheck *float64 `db:"double_precision_ref_unique_check"` + DoublePrecisionDefConst *float64 `db:"double_precision_def_const"` + DoublePrecisionDefConstUniqueCheck *float64 `db:"double_precision_def_const_unique_check"` + DoublePrecisionDefFunc *float64 `db:"double_precision_def_func"` + DoublePrecisionDefFuncUniqueCheck *float64 `db:"double_precision_def_func_unique_check"` +} diff --git a/internal/integration_tests/postgres/nulltypeprimitive/DoublePrecisionCheckPk.go b/internal/integration_tests/postgres/nulltypeprimitive/DoublePrecisionCheckPk.go new file mode 100644 index 00000000..b371f477 --- /dev/null +++ b/internal/integration_tests/postgres/nulltypeprimitive/DoublePrecisionCheckPk.go @@ -0,0 +1,5 @@ +package dto + +type DoublePrecisionCheckPk struct { + DoublePrecisionCheckPk float64 `db:"double_precision_check_pk"` +} diff --git a/internal/integration_tests/postgres/nulltypeprimitive/DoublePrecisionDefConstUniqueCheckPk.go b/internal/integration_tests/postgres/nulltypeprimitive/DoublePrecisionDefConstUniqueCheckPk.go new file mode 100644 index 00000000..aed14fe8 --- /dev/null +++ b/internal/integration_tests/postgres/nulltypeprimitive/DoublePrecisionDefConstUniqueCheckPk.go @@ -0,0 +1,5 @@ +package dto + +type DoublePrecisionDefConstUniqueCheckPk struct { + DoublePrecisionDefConstUniqueCheckPk float64 `db:"double_precision_def_const_unique_check_pk"` +} diff --git a/internal/integration_tests/postgres/nulltypeprimitive/DoublePrecisionDefConstUniqueCheckPkRef.go b/internal/integration_tests/postgres/nulltypeprimitive/DoublePrecisionDefConstUniqueCheckPkRef.go new file mode 100644 index 00000000..f3fd6f6f --- /dev/null +++ b/internal/integration_tests/postgres/nulltypeprimitive/DoublePrecisionDefConstUniqueCheckPkRef.go @@ -0,0 +1,5 @@ +package dto + +type DoublePrecisionDefConstUniqueCheckPkRef struct { + DoublePrecisionDefConstUniqueCheckPkRef float64 `db:"double_precision_def_const_unique_check_pk_ref"` +} diff --git a/internal/integration_tests/postgres/nulltypeprimitive/DoublePrecisionDefFuncUniqueCheckPk.go b/internal/integration_tests/postgres/nulltypeprimitive/DoublePrecisionDefFuncUniqueCheckPk.go new file mode 100644 index 00000000..d868ad99 --- /dev/null +++ b/internal/integration_tests/postgres/nulltypeprimitive/DoublePrecisionDefFuncUniqueCheckPk.go @@ -0,0 +1,5 @@ +package dto + +type DoublePrecisionDefFuncUniqueCheckPk struct { + DoublePrecisionDefFuncUniqueCheckPk float64 `db:"double_precision_def_func_unique_check_pk"` +} diff --git a/internal/integration_tests/postgres/nulltypeprimitive/DoublePrecisionDefFuncUniqueCheckPkRef.go b/internal/integration_tests/postgres/nulltypeprimitive/DoublePrecisionDefFuncUniqueCheckPkRef.go new file mode 100644 index 00000000..cfc1fd16 --- /dev/null +++ b/internal/integration_tests/postgres/nulltypeprimitive/DoublePrecisionDefFuncUniqueCheckPkRef.go @@ -0,0 +1,5 @@ +package dto + +type DoublePrecisionDefFuncUniqueCheckPkRef struct { + DoublePrecisionDefFuncUniqueCheckPkRef float64 `db:"double_precision_def_func_unique_check_pk_ref"` +} diff --git a/internal/integration_tests/postgres/nulltypeprimitive/DoublePrecisionNnPk.go b/internal/integration_tests/postgres/nulltypeprimitive/DoublePrecisionNnPk.go new file mode 100644 index 00000000..cdd85c7c --- /dev/null +++ b/internal/integration_tests/postgres/nulltypeprimitive/DoublePrecisionNnPk.go @@ -0,0 +1,5 @@ +package dto + +type DoublePrecisionNnPk struct { + DoublePrecisionNnPk float64 `db:"double_precision_nn_pk"` +} diff --git a/internal/integration_tests/postgres/nulltypeprimitive/DoublePrecisionNnUniqueCheckPk.go b/internal/integration_tests/postgres/nulltypeprimitive/DoublePrecisionNnUniqueCheckPk.go new file mode 100644 index 00000000..4c6f76fd --- /dev/null +++ b/internal/integration_tests/postgres/nulltypeprimitive/DoublePrecisionNnUniqueCheckPk.go @@ -0,0 +1,5 @@ +package dto + +type DoublePrecisionNnUniqueCheckPk struct { + DoublePrecisionNnUniqueCheckPk float64 `db:"double_precision_nn_unique_check_pk"` +} diff --git a/internal/integration_tests/postgres/nulltypeprimitive/DoublePrecisionNnUniqueCheckPkRef.go b/internal/integration_tests/postgres/nulltypeprimitive/DoublePrecisionNnUniqueCheckPkRef.go new file mode 100644 index 00000000..46f9308c --- /dev/null +++ b/internal/integration_tests/postgres/nulltypeprimitive/DoublePrecisionNnUniqueCheckPkRef.go @@ -0,0 +1,5 @@ +package dto + +type DoublePrecisionNnUniqueCheckPkRef struct { + DoublePrecisionNnUniqueCheckPkRef float64 `db:"double_precision_nn_unique_check_pk_ref"` +} diff --git a/internal/integration_tests/postgres/nulltypeprimitive/DoublePrecisionPk.go b/internal/integration_tests/postgres/nulltypeprimitive/DoublePrecisionPk.go new file mode 100644 index 00000000..dd4230cd --- /dev/null +++ b/internal/integration_tests/postgres/nulltypeprimitive/DoublePrecisionPk.go @@ -0,0 +1,5 @@ +package dto + +type DoublePrecisionPk struct { + DoublePrecisionPk float64 `db:"double_precision_pk"` +} diff --git a/internal/integration_tests/postgres/nulltypeprimitive/DoublePrecisionPkDefConst.go b/internal/integration_tests/postgres/nulltypeprimitive/DoublePrecisionPkDefConst.go new file mode 100644 index 00000000..88e67c92 --- /dev/null +++ b/internal/integration_tests/postgres/nulltypeprimitive/DoublePrecisionPkDefConst.go @@ -0,0 +1,5 @@ +package dto + +type DoublePrecisionPkDefConst struct { + DoublePrecisionPkDefConst float64 `db:"double_precision_pk_def_const"` +} diff --git a/internal/integration_tests/postgres/nulltypeprimitive/DoublePrecisionPkDefFunc.go b/internal/integration_tests/postgres/nulltypeprimitive/DoublePrecisionPkDefFunc.go new file mode 100644 index 00000000..a61e3112 --- /dev/null +++ b/internal/integration_tests/postgres/nulltypeprimitive/DoublePrecisionPkDefFunc.go @@ -0,0 +1,5 @@ +package dto + +type DoublePrecisionPkDefFunc struct { + DoublePrecisionPkDefFunc float64 `db:"double_precision_pk_def_func"` +} diff --git a/internal/integration_tests/postgres/nulltypeprimitive/DoublePrecisionPkRef.go b/internal/integration_tests/postgres/nulltypeprimitive/DoublePrecisionPkRef.go new file mode 100644 index 00000000..0ef20e93 --- /dev/null +++ b/internal/integration_tests/postgres/nulltypeprimitive/DoublePrecisionPkRef.go @@ -0,0 +1,5 @@ +package dto + +type DoublePrecisionPkRef struct { + DoublePrecisionPkRef float64 `db:"double_precision_pk_ref"` +} diff --git a/internal/integration_tests/postgres/nulltypeprimitive/DoublePrecisionRef.go b/internal/integration_tests/postgres/nulltypeprimitive/DoublePrecisionRef.go new file mode 100644 index 00000000..7b7ec34e --- /dev/null +++ b/internal/integration_tests/postgres/nulltypeprimitive/DoublePrecisionRef.go @@ -0,0 +1,5 @@ +package dto + +type DoublePrecisionRef struct { + DoublePrecisionRef *float64 `db:"double_precision_ref"` +} diff --git a/internal/integration_tests/postgres/nulltypeprimitive/DoublePrecisionUniqueCheckPk.go b/internal/integration_tests/postgres/nulltypeprimitive/DoublePrecisionUniqueCheckPk.go new file mode 100644 index 00000000..3e3cf20b --- /dev/null +++ b/internal/integration_tests/postgres/nulltypeprimitive/DoublePrecisionUniqueCheckPk.go @@ -0,0 +1,5 @@ +package dto + +type DoublePrecisionUniqueCheckPk struct { + DoublePrecisionUniqueCheckPk float64 `db:"double_precision_unique_check_pk"` +} diff --git a/internal/integration_tests/postgres/nulltypeprimitive/DoublePrecisionUniqueCheckPkRef.go b/internal/integration_tests/postgres/nulltypeprimitive/DoublePrecisionUniqueCheckPkRef.go new file mode 100644 index 00000000..3655f585 --- /dev/null +++ b/internal/integration_tests/postgres/nulltypeprimitive/DoublePrecisionUniqueCheckPkRef.go @@ -0,0 +1,5 @@ +package dto + +type DoublePrecisionUniqueCheckPkRef struct { + DoublePrecisionUniqueCheckPkRef float64 `db:"double_precision_unique_check_pk_ref"` +} diff --git a/internal/integration_tests/postgres/nulltypeprimitive/DoublePrecisionUniquePk.go b/internal/integration_tests/postgres/nulltypeprimitive/DoublePrecisionUniquePk.go new file mode 100644 index 00000000..df2b18cc --- /dev/null +++ b/internal/integration_tests/postgres/nulltypeprimitive/DoublePrecisionUniquePk.go @@ -0,0 +1,5 @@ +package dto + +type DoublePrecisionUniquePk struct { + DoublePrecisionUniquePk float64 `db:"double_precision_unique_pk"` +} diff --git a/internal/integration_tests/postgres/nulltypeprimitive/Float.go b/internal/integration_tests/postgres/nulltypeprimitive/Float.go new file mode 100644 index 00000000..5d042b20 --- /dev/null +++ b/internal/integration_tests/postgres/nulltypeprimitive/Float.go @@ -0,0 +1,29 @@ +package dto + +type Float struct { + Float *float64 `db:"float"` + FloatNn float64 `db:"float_nn"` + FloatNnUnique float64 `db:"float_nn_unique"` + FloatNnCheck float64 `db:"float_nn_check"` + FloatNnRef float64 `db:"float_nn_ref"` + FloatNnDefConst float64 `db:"float_nn_def_const"` + FloatNnDefFunc float64 `db:"float_nn_def_func"` + FloatNnUniqueCheck float64 `db:"float_nn_unique_check"` + FloatUnique *float64 `db:"float_unique"` + FloatUniqueCheck *float64 `db:"float_unique_check"` + FloatUniqueRef *float64 `db:"float_unique_ref"` + FloatUniqueDefConst *float64 `db:"float_unique_def_const"` + FloatUniqueDefFunc *float64 `db:"float_unique_def_func"` + FloatCheck *float64 `db:"float_check"` + FloatCheckRef *float64 `db:"float_check_ref"` + FloatCheckDefConst *float64 `db:"float_check_def_const"` + FloatCheckDefFunc *float64 `db:"float_check_def_func"` + FloatRef *float64 `db:"float_ref"` + FloatRefDefConst *float64 `db:"float_ref_def_const"` + FloatRefDefFunc *float64 `db:"float_ref_def_func"` + FloatRefUniqueCheck *float64 `db:"float_ref_unique_check"` + FloatDefConst *float64 `db:"float_def_const"` + FloatDefConstUniqueCheck *float64 `db:"float_def_const_unique_check"` + FloatDefFunc *float64 `db:"float_def_func"` + FloatDefFuncUniqueCheck *float64 `db:"float_def_func_unique_check"` +} diff --git a/internal/integration_tests/postgres/nulltypeprimitive/Float4.go b/internal/integration_tests/postgres/nulltypeprimitive/Float4.go new file mode 100644 index 00000000..3424c666 --- /dev/null +++ b/internal/integration_tests/postgres/nulltypeprimitive/Float4.go @@ -0,0 +1,29 @@ +package dto + +type Float4 struct { + Float4 *float64 `db:"float4"` + Float4Nn float64 `db:"float4_nn"` + Float4NnUnique float64 `db:"float4_nn_unique"` + Float4NnCheck float64 `db:"float4_nn_check"` + Float4NnRef float64 `db:"float4_nn_ref"` + Float4NnDefConst float64 `db:"float4_nn_def_const"` + Float4NnDefFunc float64 `db:"float4_nn_def_func"` + Float4NnUniqueCheck float64 `db:"float4_nn_unique_check"` + Float4Unique *float64 `db:"float4_unique"` + Float4UniqueCheck *float64 `db:"float4_unique_check"` + Float4UniqueRef *float64 `db:"float4_unique_ref"` + Float4UniqueDefConst *float64 `db:"float4_unique_def_const"` + Float4UniqueDefFunc *float64 `db:"float4_unique_def_func"` + Float4Check *float64 `db:"float4_check"` + Float4CheckRef *float64 `db:"float4_check_ref"` + Float4CheckDefConst *float64 `db:"float4_check_def_const"` + Float4CheckDefFunc *float64 `db:"float4_check_def_func"` + Float4Ref *float64 `db:"float4_ref"` + Float4RefDefConst *float64 `db:"float4_ref_def_const"` + Float4RefDefFunc *float64 `db:"float4_ref_def_func"` + Float4RefUniqueCheck *float64 `db:"float4_ref_unique_check"` + Float4DefConst *float64 `db:"float4_def_const"` + Float4DefConstUniqueCheck *float64 `db:"float4_def_const_unique_check"` + Float4DefFunc *float64 `db:"float4_def_func"` + Float4DefFuncUniqueCheck *float64 `db:"float4_def_func_unique_check"` +} diff --git a/internal/integration_tests/postgres/nulltypeprimitive/Float4CheckPk.go b/internal/integration_tests/postgres/nulltypeprimitive/Float4CheckPk.go new file mode 100644 index 00000000..232871a2 --- /dev/null +++ b/internal/integration_tests/postgres/nulltypeprimitive/Float4CheckPk.go @@ -0,0 +1,5 @@ +package dto + +type Float4CheckPk struct { + Float4CheckPk float64 `db:"float4_check_pk"` +} diff --git a/internal/integration_tests/postgres/nulltypeprimitive/Float4DefConstUniqueCheckPk.go b/internal/integration_tests/postgres/nulltypeprimitive/Float4DefConstUniqueCheckPk.go new file mode 100644 index 00000000..aecebcfc --- /dev/null +++ b/internal/integration_tests/postgres/nulltypeprimitive/Float4DefConstUniqueCheckPk.go @@ -0,0 +1,5 @@ +package dto + +type Float4DefConstUniqueCheckPk struct { + Float4DefConstUniqueCheckPk float64 `db:"float4_def_const_unique_check_pk"` +} diff --git a/internal/integration_tests/postgres/nulltypeprimitive/Float4DefConstUniqueCheckPkRef.go b/internal/integration_tests/postgres/nulltypeprimitive/Float4DefConstUniqueCheckPkRef.go new file mode 100644 index 00000000..c3536b06 --- /dev/null +++ b/internal/integration_tests/postgres/nulltypeprimitive/Float4DefConstUniqueCheckPkRef.go @@ -0,0 +1,5 @@ +package dto + +type Float4DefConstUniqueCheckPkRef struct { + Float4DefConstUniqueCheckPkRef float64 `db:"float4_def_const_unique_check_pk_ref"` +} diff --git a/internal/integration_tests/postgres/nulltypeprimitive/Float4DefFuncUniqueCheckPk.go b/internal/integration_tests/postgres/nulltypeprimitive/Float4DefFuncUniqueCheckPk.go new file mode 100644 index 00000000..35543a4f --- /dev/null +++ b/internal/integration_tests/postgres/nulltypeprimitive/Float4DefFuncUniqueCheckPk.go @@ -0,0 +1,5 @@ +package dto + +type Float4DefFuncUniqueCheckPk struct { + Float4DefFuncUniqueCheckPk float64 `db:"float4_def_func_unique_check_pk"` +} diff --git a/internal/integration_tests/postgres/nulltypeprimitive/Float4DefFuncUniqueCheckPkRef.go b/internal/integration_tests/postgres/nulltypeprimitive/Float4DefFuncUniqueCheckPkRef.go new file mode 100644 index 00000000..9cee3cd2 --- /dev/null +++ b/internal/integration_tests/postgres/nulltypeprimitive/Float4DefFuncUniqueCheckPkRef.go @@ -0,0 +1,5 @@ +package dto + +type Float4DefFuncUniqueCheckPkRef struct { + Float4DefFuncUniqueCheckPkRef float64 `db:"float4_def_func_unique_check_pk_ref"` +} diff --git a/internal/integration_tests/postgres/nulltypeprimitive/Float4NnPk.go b/internal/integration_tests/postgres/nulltypeprimitive/Float4NnPk.go new file mode 100644 index 00000000..8f47359a --- /dev/null +++ b/internal/integration_tests/postgres/nulltypeprimitive/Float4NnPk.go @@ -0,0 +1,5 @@ +package dto + +type Float4NnPk struct { + Float4NnPk float64 `db:"float4_nn_pk"` +} diff --git a/internal/integration_tests/postgres/nulltypeprimitive/Float4NnUniqueCheckPk.go b/internal/integration_tests/postgres/nulltypeprimitive/Float4NnUniqueCheckPk.go new file mode 100644 index 00000000..95a57d4a --- /dev/null +++ b/internal/integration_tests/postgres/nulltypeprimitive/Float4NnUniqueCheckPk.go @@ -0,0 +1,5 @@ +package dto + +type Float4NnUniqueCheckPk struct { + Float4NnUniqueCheckPk float64 `db:"float4_nn_unique_check_pk"` +} diff --git a/internal/integration_tests/postgres/nulltypeprimitive/Float4NnUniqueCheckPkRef.go b/internal/integration_tests/postgres/nulltypeprimitive/Float4NnUniqueCheckPkRef.go new file mode 100644 index 00000000..b10e51e6 --- /dev/null +++ b/internal/integration_tests/postgres/nulltypeprimitive/Float4NnUniqueCheckPkRef.go @@ -0,0 +1,5 @@ +package dto + +type Float4NnUniqueCheckPkRef struct { + Float4NnUniqueCheckPkRef float64 `db:"float4_nn_unique_check_pk_ref"` +} diff --git a/internal/integration_tests/postgres/nulltypeprimitive/Float4Pk.go b/internal/integration_tests/postgres/nulltypeprimitive/Float4Pk.go new file mode 100644 index 00000000..ee8c6d34 --- /dev/null +++ b/internal/integration_tests/postgres/nulltypeprimitive/Float4Pk.go @@ -0,0 +1,5 @@ +package dto + +type Float4Pk struct { + Float4Pk float64 `db:"float4_pk"` +} diff --git a/internal/integration_tests/postgres/nulltypeprimitive/Float4PkDefConst.go b/internal/integration_tests/postgres/nulltypeprimitive/Float4PkDefConst.go new file mode 100644 index 00000000..9a5df2a4 --- /dev/null +++ b/internal/integration_tests/postgres/nulltypeprimitive/Float4PkDefConst.go @@ -0,0 +1,5 @@ +package dto + +type Float4PkDefConst struct { + Float4PkDefConst float64 `db:"float4_pk_def_const"` +} diff --git a/internal/integration_tests/postgres/nulltypeprimitive/Float4PkDefFunc.go b/internal/integration_tests/postgres/nulltypeprimitive/Float4PkDefFunc.go new file mode 100644 index 00000000..3d43a5a1 --- /dev/null +++ b/internal/integration_tests/postgres/nulltypeprimitive/Float4PkDefFunc.go @@ -0,0 +1,5 @@ +package dto + +type Float4PkDefFunc struct { + Float4PkDefFunc float64 `db:"float4_pk_def_func"` +} diff --git a/internal/integration_tests/postgres/nulltypeprimitive/Float4PkRef.go b/internal/integration_tests/postgres/nulltypeprimitive/Float4PkRef.go new file mode 100644 index 00000000..ee7d8c12 --- /dev/null +++ b/internal/integration_tests/postgres/nulltypeprimitive/Float4PkRef.go @@ -0,0 +1,5 @@ +package dto + +type Float4PkRef struct { + Float4PkRef float64 `db:"float4_pk_ref"` +} diff --git a/internal/integration_tests/postgres/nulltypeprimitive/Float4Ref.go b/internal/integration_tests/postgres/nulltypeprimitive/Float4Ref.go new file mode 100644 index 00000000..1ac6b3ef --- /dev/null +++ b/internal/integration_tests/postgres/nulltypeprimitive/Float4Ref.go @@ -0,0 +1,5 @@ +package dto + +type Float4Ref struct { + Float4Ref *float64 `db:"float4_ref"` +} diff --git a/internal/integration_tests/postgres/nulltypeprimitive/Float4UniqueCheckPk.go b/internal/integration_tests/postgres/nulltypeprimitive/Float4UniqueCheckPk.go new file mode 100644 index 00000000..6d4cd238 --- /dev/null +++ b/internal/integration_tests/postgres/nulltypeprimitive/Float4UniqueCheckPk.go @@ -0,0 +1,5 @@ +package dto + +type Float4UniqueCheckPk struct { + Float4UniqueCheckPk float64 `db:"float4_unique_check_pk"` +} diff --git a/internal/integration_tests/postgres/nulltypeprimitive/Float4UniqueCheckPkRef.go b/internal/integration_tests/postgres/nulltypeprimitive/Float4UniqueCheckPkRef.go new file mode 100644 index 00000000..9b4bd96a --- /dev/null +++ b/internal/integration_tests/postgres/nulltypeprimitive/Float4UniqueCheckPkRef.go @@ -0,0 +1,5 @@ +package dto + +type Float4UniqueCheckPkRef struct { + Float4UniqueCheckPkRef float64 `db:"float4_unique_check_pk_ref"` +} diff --git a/internal/integration_tests/postgres/nulltypeprimitive/Float4UniquePk.go b/internal/integration_tests/postgres/nulltypeprimitive/Float4UniquePk.go new file mode 100644 index 00000000..9139de41 --- /dev/null +++ b/internal/integration_tests/postgres/nulltypeprimitive/Float4UniquePk.go @@ -0,0 +1,5 @@ +package dto + +type Float4UniquePk struct { + Float4UniquePk float64 `db:"float4_unique_pk"` +} diff --git a/internal/integration_tests/postgres/nulltypeprimitive/Float8.go b/internal/integration_tests/postgres/nulltypeprimitive/Float8.go new file mode 100644 index 00000000..6488746f --- /dev/null +++ b/internal/integration_tests/postgres/nulltypeprimitive/Float8.go @@ -0,0 +1,29 @@ +package dto + +type Float8 struct { + Float8 *float64 `db:"float8"` + Float8Nn float64 `db:"float8_nn"` + Float8NnUnique float64 `db:"float8_nn_unique"` + Float8NnCheck float64 `db:"float8_nn_check"` + Float8NnRef float64 `db:"float8_nn_ref"` + Float8NnDefConst float64 `db:"float8_nn_def_const"` + Float8NnDefFunc float64 `db:"float8_nn_def_func"` + Float8NnUniqueCheck float64 `db:"float8_nn_unique_check"` + Float8Unique *float64 `db:"float8_unique"` + Float8UniqueCheck *float64 `db:"float8_unique_check"` + Float8UniqueRef *float64 `db:"float8_unique_ref"` + Float8UniqueDefConst *float64 `db:"float8_unique_def_const"` + Float8UniqueDefFunc *float64 `db:"float8_unique_def_func"` + Float8Check *float64 `db:"float8_check"` + Float8CheckRef *float64 `db:"float8_check_ref"` + Float8CheckDefConst *float64 `db:"float8_check_def_const"` + Float8CheckDefFunc *float64 `db:"float8_check_def_func"` + Float8Ref *float64 `db:"float8_ref"` + Float8RefDefConst *float64 `db:"float8_ref_def_const"` + Float8RefDefFunc *float64 `db:"float8_ref_def_func"` + Float8RefUniqueCheck *float64 `db:"float8_ref_unique_check"` + Float8DefConst *float64 `db:"float8_def_const"` + Float8DefConstUniqueCheck *float64 `db:"float8_def_const_unique_check"` + Float8DefFunc *float64 `db:"float8_def_func"` + Float8DefFuncUniqueCheck *float64 `db:"float8_def_func_unique_check"` +} diff --git a/internal/integration_tests/postgres/nulltypeprimitive/Float8CheckPk.go b/internal/integration_tests/postgres/nulltypeprimitive/Float8CheckPk.go new file mode 100644 index 00000000..12f8e87c --- /dev/null +++ b/internal/integration_tests/postgres/nulltypeprimitive/Float8CheckPk.go @@ -0,0 +1,5 @@ +package dto + +type Float8CheckPk struct { + Float8CheckPk float64 `db:"float8_check_pk"` +} diff --git a/internal/integration_tests/postgres/nulltypeprimitive/Float8DefConstUniqueCheckPk.go b/internal/integration_tests/postgres/nulltypeprimitive/Float8DefConstUniqueCheckPk.go new file mode 100644 index 00000000..f6027189 --- /dev/null +++ b/internal/integration_tests/postgres/nulltypeprimitive/Float8DefConstUniqueCheckPk.go @@ -0,0 +1,5 @@ +package dto + +type Float8DefConstUniqueCheckPk struct { + Float8DefConstUniqueCheckPk float64 `db:"float8_def_const_unique_check_pk"` +} diff --git a/internal/integration_tests/postgres/nulltypeprimitive/Float8DefConstUniqueCheckPkRef.go b/internal/integration_tests/postgres/nulltypeprimitive/Float8DefConstUniqueCheckPkRef.go new file mode 100644 index 00000000..1a7c9315 --- /dev/null +++ b/internal/integration_tests/postgres/nulltypeprimitive/Float8DefConstUniqueCheckPkRef.go @@ -0,0 +1,5 @@ +package dto + +type Float8DefConstUniqueCheckPkRef struct { + Float8DefConstUniqueCheckPkRef float64 `db:"float8_def_const_unique_check_pk_ref"` +} diff --git a/internal/integration_tests/postgres/nulltypeprimitive/Float8DefFuncUniqueCheckPk.go b/internal/integration_tests/postgres/nulltypeprimitive/Float8DefFuncUniqueCheckPk.go new file mode 100644 index 00000000..904ebdad --- /dev/null +++ b/internal/integration_tests/postgres/nulltypeprimitive/Float8DefFuncUniqueCheckPk.go @@ -0,0 +1,5 @@ +package dto + +type Float8DefFuncUniqueCheckPk struct { + Float8DefFuncUniqueCheckPk float64 `db:"float8_def_func_unique_check_pk"` +} diff --git a/internal/integration_tests/postgres/nulltypeprimitive/Float8DefFuncUniqueCheckPkRef.go b/internal/integration_tests/postgres/nulltypeprimitive/Float8DefFuncUniqueCheckPkRef.go new file mode 100644 index 00000000..32d018dd --- /dev/null +++ b/internal/integration_tests/postgres/nulltypeprimitive/Float8DefFuncUniqueCheckPkRef.go @@ -0,0 +1,5 @@ +package dto + +type Float8DefFuncUniqueCheckPkRef struct { + Float8DefFuncUniqueCheckPkRef float64 `db:"float8_def_func_unique_check_pk_ref"` +} diff --git a/internal/integration_tests/postgres/nulltypeprimitive/Float8NnPk.go b/internal/integration_tests/postgres/nulltypeprimitive/Float8NnPk.go new file mode 100644 index 00000000..bd46df14 --- /dev/null +++ b/internal/integration_tests/postgres/nulltypeprimitive/Float8NnPk.go @@ -0,0 +1,5 @@ +package dto + +type Float8NnPk struct { + Float8NnPk float64 `db:"float8_nn_pk"` +} diff --git a/internal/integration_tests/postgres/nulltypeprimitive/Float8NnUniqueCheckPk.go b/internal/integration_tests/postgres/nulltypeprimitive/Float8NnUniqueCheckPk.go new file mode 100644 index 00000000..71876ee4 --- /dev/null +++ b/internal/integration_tests/postgres/nulltypeprimitive/Float8NnUniqueCheckPk.go @@ -0,0 +1,5 @@ +package dto + +type Float8NnUniqueCheckPk struct { + Float8NnUniqueCheckPk float64 `db:"float8_nn_unique_check_pk"` +} diff --git a/internal/integration_tests/postgres/nulltypeprimitive/Float8NnUniqueCheckPkRef.go b/internal/integration_tests/postgres/nulltypeprimitive/Float8NnUniqueCheckPkRef.go new file mode 100644 index 00000000..948a75c2 --- /dev/null +++ b/internal/integration_tests/postgres/nulltypeprimitive/Float8NnUniqueCheckPkRef.go @@ -0,0 +1,5 @@ +package dto + +type Float8NnUniqueCheckPkRef struct { + Float8NnUniqueCheckPkRef float64 `db:"float8_nn_unique_check_pk_ref"` +} diff --git a/internal/integration_tests/postgres/nulltypeprimitive/Float8Pk.go b/internal/integration_tests/postgres/nulltypeprimitive/Float8Pk.go new file mode 100644 index 00000000..24966b5f --- /dev/null +++ b/internal/integration_tests/postgres/nulltypeprimitive/Float8Pk.go @@ -0,0 +1,5 @@ +package dto + +type Float8Pk struct { + Float8Pk float64 `db:"float8_pk"` +} diff --git a/internal/integration_tests/postgres/nulltypeprimitive/Float8PkDefConst.go b/internal/integration_tests/postgres/nulltypeprimitive/Float8PkDefConst.go new file mode 100644 index 00000000..5fbc4c3f --- /dev/null +++ b/internal/integration_tests/postgres/nulltypeprimitive/Float8PkDefConst.go @@ -0,0 +1,5 @@ +package dto + +type Float8PkDefConst struct { + Float8PkDefConst float64 `db:"float8_pk_def_const"` +} diff --git a/internal/integration_tests/postgres/nulltypeprimitive/Float8PkDefFunc.go b/internal/integration_tests/postgres/nulltypeprimitive/Float8PkDefFunc.go new file mode 100644 index 00000000..644007b8 --- /dev/null +++ b/internal/integration_tests/postgres/nulltypeprimitive/Float8PkDefFunc.go @@ -0,0 +1,5 @@ +package dto + +type Float8PkDefFunc struct { + Float8PkDefFunc float64 `db:"float8_pk_def_func"` +} diff --git a/internal/integration_tests/postgres/nulltypeprimitive/Float8PkRef.go b/internal/integration_tests/postgres/nulltypeprimitive/Float8PkRef.go new file mode 100644 index 00000000..1d2b92d2 --- /dev/null +++ b/internal/integration_tests/postgres/nulltypeprimitive/Float8PkRef.go @@ -0,0 +1,5 @@ +package dto + +type Float8PkRef struct { + Float8PkRef float64 `db:"float8_pk_ref"` +} diff --git a/internal/integration_tests/postgres/nulltypeprimitive/Float8Ref.go b/internal/integration_tests/postgres/nulltypeprimitive/Float8Ref.go new file mode 100644 index 00000000..724d8743 --- /dev/null +++ b/internal/integration_tests/postgres/nulltypeprimitive/Float8Ref.go @@ -0,0 +1,5 @@ +package dto + +type Float8Ref struct { + Float8Ref *float64 `db:"float8_ref"` +} diff --git a/internal/integration_tests/postgres/nulltypeprimitive/Float8UniqueCheckPk.go b/internal/integration_tests/postgres/nulltypeprimitive/Float8UniqueCheckPk.go new file mode 100644 index 00000000..549ea1ba --- /dev/null +++ b/internal/integration_tests/postgres/nulltypeprimitive/Float8UniqueCheckPk.go @@ -0,0 +1,5 @@ +package dto + +type Float8UniqueCheckPk struct { + Float8UniqueCheckPk float64 `db:"float8_unique_check_pk"` +} diff --git a/internal/integration_tests/postgres/nulltypeprimitive/Float8UniqueCheckPkRef.go b/internal/integration_tests/postgres/nulltypeprimitive/Float8UniqueCheckPkRef.go new file mode 100644 index 00000000..f89c6531 --- /dev/null +++ b/internal/integration_tests/postgres/nulltypeprimitive/Float8UniqueCheckPkRef.go @@ -0,0 +1,5 @@ +package dto + +type Float8UniqueCheckPkRef struct { + Float8UniqueCheckPkRef float64 `db:"float8_unique_check_pk_ref"` +} diff --git a/internal/integration_tests/postgres/nulltypeprimitive/Float8UniquePk.go b/internal/integration_tests/postgres/nulltypeprimitive/Float8UniquePk.go new file mode 100644 index 00000000..834e76a3 --- /dev/null +++ b/internal/integration_tests/postgres/nulltypeprimitive/Float8UniquePk.go @@ -0,0 +1,5 @@ +package dto + +type Float8UniquePk struct { + Float8UniquePk float64 `db:"float8_unique_pk"` +} diff --git a/internal/integration_tests/postgres/nulltypeprimitive/FloatCheckPk.go b/internal/integration_tests/postgres/nulltypeprimitive/FloatCheckPk.go new file mode 100644 index 00000000..e40adfb8 --- /dev/null +++ b/internal/integration_tests/postgres/nulltypeprimitive/FloatCheckPk.go @@ -0,0 +1,5 @@ +package dto + +type FloatCheckPk struct { + FloatCheckPk float64 `db:"float_check_pk"` +} diff --git a/internal/integration_tests/postgres/nulltypeprimitive/FloatDefConstUniqueCheckPk.go b/internal/integration_tests/postgres/nulltypeprimitive/FloatDefConstUniqueCheckPk.go new file mode 100644 index 00000000..57baef77 --- /dev/null +++ b/internal/integration_tests/postgres/nulltypeprimitive/FloatDefConstUniqueCheckPk.go @@ -0,0 +1,5 @@ +package dto + +type FloatDefConstUniqueCheckPk struct { + FloatDefConstUniqueCheckPk float64 `db:"float_def_const_unique_check_pk"` +} diff --git a/internal/integration_tests/postgres/nulltypeprimitive/FloatDefConstUniqueCheckPkRef.go b/internal/integration_tests/postgres/nulltypeprimitive/FloatDefConstUniqueCheckPkRef.go new file mode 100644 index 00000000..6125761b --- /dev/null +++ b/internal/integration_tests/postgres/nulltypeprimitive/FloatDefConstUniqueCheckPkRef.go @@ -0,0 +1,5 @@ +package dto + +type FloatDefConstUniqueCheckPkRef struct { + FloatDefConstUniqueCheckPkRef float64 `db:"float_def_const_unique_check_pk_ref"` +} diff --git a/internal/integration_tests/postgres/nulltypeprimitive/FloatDefFuncUniqueCheckPk.go b/internal/integration_tests/postgres/nulltypeprimitive/FloatDefFuncUniqueCheckPk.go new file mode 100644 index 00000000..00622747 --- /dev/null +++ b/internal/integration_tests/postgres/nulltypeprimitive/FloatDefFuncUniqueCheckPk.go @@ -0,0 +1,5 @@ +package dto + +type FloatDefFuncUniqueCheckPk struct { + FloatDefFuncUniqueCheckPk float64 `db:"float_def_func_unique_check_pk"` +} diff --git a/internal/integration_tests/postgres/nulltypeprimitive/FloatDefFuncUniqueCheckPkRef.go b/internal/integration_tests/postgres/nulltypeprimitive/FloatDefFuncUniqueCheckPkRef.go new file mode 100644 index 00000000..8d025ad4 --- /dev/null +++ b/internal/integration_tests/postgres/nulltypeprimitive/FloatDefFuncUniqueCheckPkRef.go @@ -0,0 +1,5 @@ +package dto + +type FloatDefFuncUniqueCheckPkRef struct { + FloatDefFuncUniqueCheckPkRef float64 `db:"float_def_func_unique_check_pk_ref"` +} diff --git a/internal/integration_tests/postgres/nulltypeprimitive/FloatNnPk.go b/internal/integration_tests/postgres/nulltypeprimitive/FloatNnPk.go new file mode 100644 index 00000000..aa175645 --- /dev/null +++ b/internal/integration_tests/postgres/nulltypeprimitive/FloatNnPk.go @@ -0,0 +1,5 @@ +package dto + +type FloatNnPk struct { + FloatNnPk float64 `db:"float_nn_pk"` +} diff --git a/internal/integration_tests/postgres/nulltypeprimitive/FloatNnUniqueCheckPk.go b/internal/integration_tests/postgres/nulltypeprimitive/FloatNnUniqueCheckPk.go new file mode 100644 index 00000000..a65f5786 --- /dev/null +++ b/internal/integration_tests/postgres/nulltypeprimitive/FloatNnUniqueCheckPk.go @@ -0,0 +1,5 @@ +package dto + +type FloatNnUniqueCheckPk struct { + FloatNnUniqueCheckPk float64 `db:"float_nn_unique_check_pk"` +} diff --git a/internal/integration_tests/postgres/nulltypeprimitive/FloatNnUniqueCheckPkRef.go b/internal/integration_tests/postgres/nulltypeprimitive/FloatNnUniqueCheckPkRef.go new file mode 100644 index 00000000..a3253c3f --- /dev/null +++ b/internal/integration_tests/postgres/nulltypeprimitive/FloatNnUniqueCheckPkRef.go @@ -0,0 +1,5 @@ +package dto + +type FloatNnUniqueCheckPkRef struct { + FloatNnUniqueCheckPkRef float64 `db:"float_nn_unique_check_pk_ref"` +} diff --git a/internal/integration_tests/postgres/nulltypeprimitive/FloatPk.go b/internal/integration_tests/postgres/nulltypeprimitive/FloatPk.go new file mode 100644 index 00000000..60ca0fcb --- /dev/null +++ b/internal/integration_tests/postgres/nulltypeprimitive/FloatPk.go @@ -0,0 +1,5 @@ +package dto + +type FloatPk struct { + FloatPk float64 `db:"float_pk"` +} diff --git a/internal/integration_tests/postgres/nulltypeprimitive/FloatPkDefConst.go b/internal/integration_tests/postgres/nulltypeprimitive/FloatPkDefConst.go new file mode 100644 index 00000000..1660a67a --- /dev/null +++ b/internal/integration_tests/postgres/nulltypeprimitive/FloatPkDefConst.go @@ -0,0 +1,5 @@ +package dto + +type FloatPkDefConst struct { + FloatPkDefConst float64 `db:"float_pk_def_const"` +} diff --git a/internal/integration_tests/postgres/nulltypeprimitive/FloatPkDefFunc.go b/internal/integration_tests/postgres/nulltypeprimitive/FloatPkDefFunc.go new file mode 100644 index 00000000..e2de6364 --- /dev/null +++ b/internal/integration_tests/postgres/nulltypeprimitive/FloatPkDefFunc.go @@ -0,0 +1,5 @@ +package dto + +type FloatPkDefFunc struct { + FloatPkDefFunc float64 `db:"float_pk_def_func"` +} diff --git a/internal/integration_tests/postgres/nulltypeprimitive/FloatPkRef.go b/internal/integration_tests/postgres/nulltypeprimitive/FloatPkRef.go new file mode 100644 index 00000000..476d656e --- /dev/null +++ b/internal/integration_tests/postgres/nulltypeprimitive/FloatPkRef.go @@ -0,0 +1,5 @@ +package dto + +type FloatPkRef struct { + FloatPkRef float64 `db:"float_pk_ref"` +} diff --git a/internal/integration_tests/postgres/nulltypeprimitive/FloatRef.go b/internal/integration_tests/postgres/nulltypeprimitive/FloatRef.go new file mode 100644 index 00000000..43b5c303 --- /dev/null +++ b/internal/integration_tests/postgres/nulltypeprimitive/FloatRef.go @@ -0,0 +1,5 @@ +package dto + +type FloatRef struct { + FloatRef *float64 `db:"float_ref"` +} diff --git a/internal/integration_tests/postgres/nulltypeprimitive/FloatUniqueCheckPk.go b/internal/integration_tests/postgres/nulltypeprimitive/FloatUniqueCheckPk.go new file mode 100644 index 00000000..81ddc37f --- /dev/null +++ b/internal/integration_tests/postgres/nulltypeprimitive/FloatUniqueCheckPk.go @@ -0,0 +1,5 @@ +package dto + +type FloatUniqueCheckPk struct { + FloatUniqueCheckPk float64 `db:"float_unique_check_pk"` +} diff --git a/internal/integration_tests/postgres/nulltypeprimitive/FloatUniqueCheckPkRef.go b/internal/integration_tests/postgres/nulltypeprimitive/FloatUniqueCheckPkRef.go new file mode 100644 index 00000000..530d26cc --- /dev/null +++ b/internal/integration_tests/postgres/nulltypeprimitive/FloatUniqueCheckPkRef.go @@ -0,0 +1,5 @@ +package dto + +type FloatUniqueCheckPkRef struct { + FloatUniqueCheckPkRef float64 `db:"float_unique_check_pk_ref"` +} diff --git a/internal/integration_tests/postgres/nulltypeprimitive/FloatUniquePk.go b/internal/integration_tests/postgres/nulltypeprimitive/FloatUniquePk.go new file mode 100644 index 00000000..6f0e1fbd --- /dev/null +++ b/internal/integration_tests/postgres/nulltypeprimitive/FloatUniquePk.go @@ -0,0 +1,5 @@ +package dto + +type FloatUniquePk struct { + FloatUniquePk float64 `db:"float_unique_pk"` +} diff --git a/internal/integration_tests/postgres/nulltypeprimitive/Int2.go b/internal/integration_tests/postgres/nulltypeprimitive/Int2.go new file mode 100644 index 00000000..0853e7d5 --- /dev/null +++ b/internal/integration_tests/postgres/nulltypeprimitive/Int2.go @@ -0,0 +1,29 @@ +package dto + +type Int2 struct { + Int2 *int `db:"int2"` + Int2Nn int `db:"int2_nn"` + Int2NnUnique int `db:"int2_nn_unique"` + Int2NnCheck int `db:"int2_nn_check"` + Int2NnRef int `db:"int2_nn_ref"` + Int2NnDefConst int `db:"int2_nn_def_const"` + Int2NnDefFunc int `db:"int2_nn_def_func"` + Int2NnUniqueCheck int `db:"int2_nn_unique_check"` + Int2Unique *int `db:"int2_unique"` + Int2UniqueCheck *int `db:"int2_unique_check"` + Int2UniqueRef *int `db:"int2_unique_ref"` + Int2UniqueDefConst *int `db:"int2_unique_def_const"` + Int2UniqueDefFunc *int `db:"int2_unique_def_func"` + Int2Check *int `db:"int2_check"` + Int2CheckRef *int `db:"int2_check_ref"` + Int2CheckDefConst *int `db:"int2_check_def_const"` + Int2CheckDefFunc *int `db:"int2_check_def_func"` + Int2Ref *int `db:"int2_ref"` + Int2RefDefConst *int `db:"int2_ref_def_const"` + Int2RefDefFunc *int `db:"int2_ref_def_func"` + Int2RefUniqueCheck *int `db:"int2_ref_unique_check"` + Int2DefConst *int `db:"int2_def_const"` + Int2DefConstUniqueCheck *int `db:"int2_def_const_unique_check"` + Int2DefFunc *int `db:"int2_def_func"` + Int2DefFuncUniqueCheck *int `db:"int2_def_func_unique_check"` +} diff --git a/internal/integration_tests/postgres/nulltypeprimitive/Int2CheckPk.go b/internal/integration_tests/postgres/nulltypeprimitive/Int2CheckPk.go new file mode 100644 index 00000000..c409012d --- /dev/null +++ b/internal/integration_tests/postgres/nulltypeprimitive/Int2CheckPk.go @@ -0,0 +1,5 @@ +package dto + +type Int2CheckPk struct { + Int2CheckPk int `db:"int2_check_pk"` +} diff --git a/internal/integration_tests/postgres/nulltypeprimitive/Int2DefConstUniqueCheckPk.go b/internal/integration_tests/postgres/nulltypeprimitive/Int2DefConstUniqueCheckPk.go new file mode 100644 index 00000000..772481e0 --- /dev/null +++ b/internal/integration_tests/postgres/nulltypeprimitive/Int2DefConstUniqueCheckPk.go @@ -0,0 +1,5 @@ +package dto + +type Int2DefConstUniqueCheckPk struct { + Int2DefConstUniqueCheckPk int `db:"int2_def_const_unique_check_pk"` +} diff --git a/internal/integration_tests/postgres/nulltypeprimitive/Int2DefConstUniqueCheckPkRef.go b/internal/integration_tests/postgres/nulltypeprimitive/Int2DefConstUniqueCheckPkRef.go new file mode 100644 index 00000000..5f1eba0a --- /dev/null +++ b/internal/integration_tests/postgres/nulltypeprimitive/Int2DefConstUniqueCheckPkRef.go @@ -0,0 +1,5 @@ +package dto + +type Int2DefConstUniqueCheckPkRef struct { + Int2DefConstUniqueCheckPkRef int `db:"int2_def_const_unique_check_pk_ref"` +} diff --git a/internal/integration_tests/postgres/nulltypeprimitive/Int2DefFuncUniqueCheckPk.go b/internal/integration_tests/postgres/nulltypeprimitive/Int2DefFuncUniqueCheckPk.go new file mode 100644 index 00000000..543fe608 --- /dev/null +++ b/internal/integration_tests/postgres/nulltypeprimitive/Int2DefFuncUniqueCheckPk.go @@ -0,0 +1,5 @@ +package dto + +type Int2DefFuncUniqueCheckPk struct { + Int2DefFuncUniqueCheckPk int `db:"int2_def_func_unique_check_pk"` +} diff --git a/internal/integration_tests/postgres/nulltypeprimitive/Int2DefFuncUniqueCheckPkRef.go b/internal/integration_tests/postgres/nulltypeprimitive/Int2DefFuncUniqueCheckPkRef.go new file mode 100644 index 00000000..4920bc81 --- /dev/null +++ b/internal/integration_tests/postgres/nulltypeprimitive/Int2DefFuncUniqueCheckPkRef.go @@ -0,0 +1,5 @@ +package dto + +type Int2DefFuncUniqueCheckPkRef struct { + Int2DefFuncUniqueCheckPkRef int `db:"int2_def_func_unique_check_pk_ref"` +} diff --git a/internal/integration_tests/postgres/nulltypeprimitive/Int2NnPk.go b/internal/integration_tests/postgres/nulltypeprimitive/Int2NnPk.go new file mode 100644 index 00000000..bf785b43 --- /dev/null +++ b/internal/integration_tests/postgres/nulltypeprimitive/Int2NnPk.go @@ -0,0 +1,5 @@ +package dto + +type Int2NnPk struct { + Int2NnPk int `db:"int2_nn_pk"` +} diff --git a/internal/integration_tests/postgres/nulltypeprimitive/Int2NnUniqueCheckPk.go b/internal/integration_tests/postgres/nulltypeprimitive/Int2NnUniqueCheckPk.go new file mode 100644 index 00000000..e0418ee3 --- /dev/null +++ b/internal/integration_tests/postgres/nulltypeprimitive/Int2NnUniqueCheckPk.go @@ -0,0 +1,5 @@ +package dto + +type Int2NnUniqueCheckPk struct { + Int2NnUniqueCheckPk int `db:"int2_nn_unique_check_pk"` +} diff --git a/internal/integration_tests/postgres/nulltypeprimitive/Int2NnUniqueCheckPkRef.go b/internal/integration_tests/postgres/nulltypeprimitive/Int2NnUniqueCheckPkRef.go new file mode 100644 index 00000000..c4c5061f --- /dev/null +++ b/internal/integration_tests/postgres/nulltypeprimitive/Int2NnUniqueCheckPkRef.go @@ -0,0 +1,5 @@ +package dto + +type Int2NnUniqueCheckPkRef struct { + Int2NnUniqueCheckPkRef int `db:"int2_nn_unique_check_pk_ref"` +} diff --git a/internal/integration_tests/postgres/nulltypeprimitive/Int2Pk.go b/internal/integration_tests/postgres/nulltypeprimitive/Int2Pk.go new file mode 100644 index 00000000..afaa5495 --- /dev/null +++ b/internal/integration_tests/postgres/nulltypeprimitive/Int2Pk.go @@ -0,0 +1,5 @@ +package dto + +type Int2Pk struct { + Int2Pk int `db:"int2_pk"` +} diff --git a/internal/integration_tests/postgres/nulltypeprimitive/Int2PkDefConst.go b/internal/integration_tests/postgres/nulltypeprimitive/Int2PkDefConst.go new file mode 100644 index 00000000..4f11bad2 --- /dev/null +++ b/internal/integration_tests/postgres/nulltypeprimitive/Int2PkDefConst.go @@ -0,0 +1,5 @@ +package dto + +type Int2PkDefConst struct { + Int2PkDefConst int `db:"int2_pk_def_const"` +} diff --git a/internal/integration_tests/postgres/nulltypeprimitive/Int2PkDefFunc.go b/internal/integration_tests/postgres/nulltypeprimitive/Int2PkDefFunc.go new file mode 100644 index 00000000..a81ce4b5 --- /dev/null +++ b/internal/integration_tests/postgres/nulltypeprimitive/Int2PkDefFunc.go @@ -0,0 +1,5 @@ +package dto + +type Int2PkDefFunc struct { + Int2PkDefFunc int `db:"int2_pk_def_func"` +} diff --git a/internal/integration_tests/postgres/nulltypeprimitive/Int2PkRef.go b/internal/integration_tests/postgres/nulltypeprimitive/Int2PkRef.go new file mode 100644 index 00000000..8503dd8e --- /dev/null +++ b/internal/integration_tests/postgres/nulltypeprimitive/Int2PkRef.go @@ -0,0 +1,5 @@ +package dto + +type Int2PkRef struct { + Int2PkRef int `db:"int2_pk_ref"` +} diff --git a/internal/integration_tests/postgres/nulltypeprimitive/Int2Ref.go b/internal/integration_tests/postgres/nulltypeprimitive/Int2Ref.go new file mode 100644 index 00000000..11d72af6 --- /dev/null +++ b/internal/integration_tests/postgres/nulltypeprimitive/Int2Ref.go @@ -0,0 +1,5 @@ +package dto + +type Int2Ref struct { + Int2Ref *int `db:"int2_ref"` +} diff --git a/internal/integration_tests/postgres/nulltypeprimitive/Int2UniqueCheckPk.go b/internal/integration_tests/postgres/nulltypeprimitive/Int2UniqueCheckPk.go new file mode 100644 index 00000000..7f2e43df --- /dev/null +++ b/internal/integration_tests/postgres/nulltypeprimitive/Int2UniqueCheckPk.go @@ -0,0 +1,5 @@ +package dto + +type Int2UniqueCheckPk struct { + Int2UniqueCheckPk int `db:"int2_unique_check_pk"` +} diff --git a/internal/integration_tests/postgres/nulltypeprimitive/Int2UniqueCheckPkRef.go b/internal/integration_tests/postgres/nulltypeprimitive/Int2UniqueCheckPkRef.go new file mode 100644 index 00000000..8a988d5a --- /dev/null +++ b/internal/integration_tests/postgres/nulltypeprimitive/Int2UniqueCheckPkRef.go @@ -0,0 +1,5 @@ +package dto + +type Int2UniqueCheckPkRef struct { + Int2UniqueCheckPkRef int `db:"int2_unique_check_pk_ref"` +} diff --git a/internal/integration_tests/postgres/nulltypeprimitive/Int2UniquePk.go b/internal/integration_tests/postgres/nulltypeprimitive/Int2UniquePk.go new file mode 100644 index 00000000..6b3535ad --- /dev/null +++ b/internal/integration_tests/postgres/nulltypeprimitive/Int2UniquePk.go @@ -0,0 +1,5 @@ +package dto + +type Int2UniquePk struct { + Int2UniquePk int `db:"int2_unique_pk"` +} diff --git a/internal/integration_tests/postgres/nulltypeprimitive/Int4.go b/internal/integration_tests/postgres/nulltypeprimitive/Int4.go new file mode 100644 index 00000000..f5830ab9 --- /dev/null +++ b/internal/integration_tests/postgres/nulltypeprimitive/Int4.go @@ -0,0 +1,29 @@ +package dto + +type Int4 struct { + Int4 *int `db:"int4"` + Int4Nn int `db:"int4_nn"` + Int4NnUnique int `db:"int4_nn_unique"` + Int4NnCheck int `db:"int4_nn_check"` + Int4NnRef int `db:"int4_nn_ref"` + Int4NnDefConst int `db:"int4_nn_def_const"` + Int4NnDefFunc int `db:"int4_nn_def_func"` + Int4NnUniqueCheck int `db:"int4_nn_unique_check"` + Int4Unique *int `db:"int4_unique"` + Int4UniqueCheck *int `db:"int4_unique_check"` + Int4UniqueRef *int `db:"int4_unique_ref"` + Int4UniqueDefConst *int `db:"int4_unique_def_const"` + Int4UniqueDefFunc *int `db:"int4_unique_def_func"` + Int4Check *int `db:"int4_check"` + Int4CheckRef *int `db:"int4_check_ref"` + Int4CheckDefConst *int `db:"int4_check_def_const"` + Int4CheckDefFunc *int `db:"int4_check_def_func"` + Int4Ref *int `db:"int4_ref"` + Int4RefDefConst *int `db:"int4_ref_def_const"` + Int4RefDefFunc *int `db:"int4_ref_def_func"` + Int4RefUniqueCheck *int `db:"int4_ref_unique_check"` + Int4DefConst *int `db:"int4_def_const"` + Int4DefConstUniqueCheck *int `db:"int4_def_const_unique_check"` + Int4DefFunc *int `db:"int4_def_func"` + Int4DefFuncUniqueCheck *int `db:"int4_def_func_unique_check"` +} diff --git a/internal/integration_tests/postgres/nulltypeprimitive/Int4CheckPk.go b/internal/integration_tests/postgres/nulltypeprimitive/Int4CheckPk.go new file mode 100644 index 00000000..49c85faa --- /dev/null +++ b/internal/integration_tests/postgres/nulltypeprimitive/Int4CheckPk.go @@ -0,0 +1,5 @@ +package dto + +type Int4CheckPk struct { + Int4CheckPk int `db:"int4_check_pk"` +} diff --git a/internal/integration_tests/postgres/nulltypeprimitive/Int4DefConstUniqueCheckPk.go b/internal/integration_tests/postgres/nulltypeprimitive/Int4DefConstUniqueCheckPk.go new file mode 100644 index 00000000..a355bb5b --- /dev/null +++ b/internal/integration_tests/postgres/nulltypeprimitive/Int4DefConstUniqueCheckPk.go @@ -0,0 +1,5 @@ +package dto + +type Int4DefConstUniqueCheckPk struct { + Int4DefConstUniqueCheckPk int `db:"int4_def_const_unique_check_pk"` +} diff --git a/internal/integration_tests/postgres/nulltypeprimitive/Int4DefConstUniqueCheckPkRef.go b/internal/integration_tests/postgres/nulltypeprimitive/Int4DefConstUniqueCheckPkRef.go new file mode 100644 index 00000000..3090d90d --- /dev/null +++ b/internal/integration_tests/postgres/nulltypeprimitive/Int4DefConstUniqueCheckPkRef.go @@ -0,0 +1,5 @@ +package dto + +type Int4DefConstUniqueCheckPkRef struct { + Int4DefConstUniqueCheckPkRef int `db:"int4_def_const_unique_check_pk_ref"` +} diff --git a/internal/integration_tests/postgres/nulltypeprimitive/Int4DefFuncUniqueCheckPk.go b/internal/integration_tests/postgres/nulltypeprimitive/Int4DefFuncUniqueCheckPk.go new file mode 100644 index 00000000..bff8c96e --- /dev/null +++ b/internal/integration_tests/postgres/nulltypeprimitive/Int4DefFuncUniqueCheckPk.go @@ -0,0 +1,5 @@ +package dto + +type Int4DefFuncUniqueCheckPk struct { + Int4DefFuncUniqueCheckPk int `db:"int4_def_func_unique_check_pk"` +} diff --git a/internal/integration_tests/postgres/nulltypeprimitive/Int4DefFuncUniqueCheckPkRef.go b/internal/integration_tests/postgres/nulltypeprimitive/Int4DefFuncUniqueCheckPkRef.go new file mode 100644 index 00000000..3a5fca6c --- /dev/null +++ b/internal/integration_tests/postgres/nulltypeprimitive/Int4DefFuncUniqueCheckPkRef.go @@ -0,0 +1,5 @@ +package dto + +type Int4DefFuncUniqueCheckPkRef struct { + Int4DefFuncUniqueCheckPkRef int `db:"int4_def_func_unique_check_pk_ref"` +} diff --git a/internal/integration_tests/postgres/nulltypeprimitive/Int4NnPk.go b/internal/integration_tests/postgres/nulltypeprimitive/Int4NnPk.go new file mode 100644 index 00000000..8f874f74 --- /dev/null +++ b/internal/integration_tests/postgres/nulltypeprimitive/Int4NnPk.go @@ -0,0 +1,5 @@ +package dto + +type Int4NnPk struct { + Int4NnPk int `db:"int4_nn_pk"` +} diff --git a/internal/integration_tests/postgres/nulltypeprimitive/Int4NnUniqueCheckPk.go b/internal/integration_tests/postgres/nulltypeprimitive/Int4NnUniqueCheckPk.go new file mode 100644 index 00000000..6367e902 --- /dev/null +++ b/internal/integration_tests/postgres/nulltypeprimitive/Int4NnUniqueCheckPk.go @@ -0,0 +1,5 @@ +package dto + +type Int4NnUniqueCheckPk struct { + Int4NnUniqueCheckPk int `db:"int4_nn_unique_check_pk"` +} diff --git a/internal/integration_tests/postgres/nulltypeprimitive/Int4NnUniqueCheckPkRef.go b/internal/integration_tests/postgres/nulltypeprimitive/Int4NnUniqueCheckPkRef.go new file mode 100644 index 00000000..78c405e5 --- /dev/null +++ b/internal/integration_tests/postgres/nulltypeprimitive/Int4NnUniqueCheckPkRef.go @@ -0,0 +1,5 @@ +package dto + +type Int4NnUniqueCheckPkRef struct { + Int4NnUniqueCheckPkRef int `db:"int4_nn_unique_check_pk_ref"` +} diff --git a/internal/integration_tests/postgres/nulltypeprimitive/Int4Pk.go b/internal/integration_tests/postgres/nulltypeprimitive/Int4Pk.go new file mode 100644 index 00000000..f7924a64 --- /dev/null +++ b/internal/integration_tests/postgres/nulltypeprimitive/Int4Pk.go @@ -0,0 +1,5 @@ +package dto + +type Int4Pk struct { + Int4Pk int `db:"int4_pk"` +} diff --git a/internal/integration_tests/postgres/nulltypeprimitive/Int4PkDefConst.go b/internal/integration_tests/postgres/nulltypeprimitive/Int4PkDefConst.go new file mode 100644 index 00000000..aea720b4 --- /dev/null +++ b/internal/integration_tests/postgres/nulltypeprimitive/Int4PkDefConst.go @@ -0,0 +1,5 @@ +package dto + +type Int4PkDefConst struct { + Int4PkDefConst int `db:"int4_pk_def_const"` +} diff --git a/internal/integration_tests/postgres/nulltypeprimitive/Int4PkDefFunc.go b/internal/integration_tests/postgres/nulltypeprimitive/Int4PkDefFunc.go new file mode 100644 index 00000000..0336d90a --- /dev/null +++ b/internal/integration_tests/postgres/nulltypeprimitive/Int4PkDefFunc.go @@ -0,0 +1,5 @@ +package dto + +type Int4PkDefFunc struct { + Int4PkDefFunc int `db:"int4_pk_def_func"` +} diff --git a/internal/integration_tests/postgres/nulltypeprimitive/Int4PkRef.go b/internal/integration_tests/postgres/nulltypeprimitive/Int4PkRef.go new file mode 100644 index 00000000..a6cf4d57 --- /dev/null +++ b/internal/integration_tests/postgres/nulltypeprimitive/Int4PkRef.go @@ -0,0 +1,5 @@ +package dto + +type Int4PkRef struct { + Int4PkRef int `db:"int4_pk_ref"` +} diff --git a/internal/integration_tests/postgres/nulltypeprimitive/Int4Ref.go b/internal/integration_tests/postgres/nulltypeprimitive/Int4Ref.go new file mode 100644 index 00000000..1fa9da17 --- /dev/null +++ b/internal/integration_tests/postgres/nulltypeprimitive/Int4Ref.go @@ -0,0 +1,5 @@ +package dto + +type Int4Ref struct { + Int4Ref *int `db:"int4_ref"` +} diff --git a/internal/integration_tests/postgres/nulltypeprimitive/Int4UniqueCheckPk.go b/internal/integration_tests/postgres/nulltypeprimitive/Int4UniqueCheckPk.go new file mode 100644 index 00000000..36a0c899 --- /dev/null +++ b/internal/integration_tests/postgres/nulltypeprimitive/Int4UniqueCheckPk.go @@ -0,0 +1,5 @@ +package dto + +type Int4UniqueCheckPk struct { + Int4UniqueCheckPk int `db:"int4_unique_check_pk"` +} diff --git a/internal/integration_tests/postgres/nulltypeprimitive/Int4UniqueCheckPkRef.go b/internal/integration_tests/postgres/nulltypeprimitive/Int4UniqueCheckPkRef.go new file mode 100644 index 00000000..b47a5879 --- /dev/null +++ b/internal/integration_tests/postgres/nulltypeprimitive/Int4UniqueCheckPkRef.go @@ -0,0 +1,5 @@ +package dto + +type Int4UniqueCheckPkRef struct { + Int4UniqueCheckPkRef int `db:"int4_unique_check_pk_ref"` +} diff --git a/internal/integration_tests/postgres/nulltypeprimitive/Int4UniquePk.go b/internal/integration_tests/postgres/nulltypeprimitive/Int4UniquePk.go new file mode 100644 index 00000000..f716106b --- /dev/null +++ b/internal/integration_tests/postgres/nulltypeprimitive/Int4UniquePk.go @@ -0,0 +1,5 @@ +package dto + +type Int4UniquePk struct { + Int4UniquePk int `db:"int4_unique_pk"` +} diff --git a/internal/integration_tests/postgres/nulltypeprimitive/Int8.go b/internal/integration_tests/postgres/nulltypeprimitive/Int8.go new file mode 100644 index 00000000..7de8b7c2 --- /dev/null +++ b/internal/integration_tests/postgres/nulltypeprimitive/Int8.go @@ -0,0 +1,29 @@ +package dto + +type Int8 struct { + Int8 *int `db:"int8"` + Int8Nn int `db:"int8_nn"` + Int8NnUnique int `db:"int8_nn_unique"` + Int8NnCheck int `db:"int8_nn_check"` + Int8NnRef int `db:"int8_nn_ref"` + Int8NnDefConst int `db:"int8_nn_def_const"` + Int8NnDefFunc int `db:"int8_nn_def_func"` + Int8NnUniqueCheck int `db:"int8_nn_unique_check"` + Int8Unique *int `db:"int8_unique"` + Int8UniqueCheck *int `db:"int8_unique_check"` + Int8UniqueRef *int `db:"int8_unique_ref"` + Int8UniqueDefConst *int `db:"int8_unique_def_const"` + Int8UniqueDefFunc *int `db:"int8_unique_def_func"` + Int8Check *int `db:"int8_check"` + Int8CheckRef *int `db:"int8_check_ref"` + Int8CheckDefConst *int `db:"int8_check_def_const"` + Int8CheckDefFunc *int `db:"int8_check_def_func"` + Int8Ref *int `db:"int8_ref"` + Int8RefDefConst *int `db:"int8_ref_def_const"` + Int8RefDefFunc *int `db:"int8_ref_def_func"` + Int8RefUniqueCheck *int `db:"int8_ref_unique_check"` + Int8DefConst *int `db:"int8_def_const"` + Int8DefConstUniqueCheck *int `db:"int8_def_const_unique_check"` + Int8DefFunc *int `db:"int8_def_func"` + Int8DefFuncUniqueCheck *int `db:"int8_def_func_unique_check"` +} diff --git a/internal/integration_tests/postgres/nulltypeprimitive/Int8CheckPk.go b/internal/integration_tests/postgres/nulltypeprimitive/Int8CheckPk.go new file mode 100644 index 00000000..778aaa36 --- /dev/null +++ b/internal/integration_tests/postgres/nulltypeprimitive/Int8CheckPk.go @@ -0,0 +1,5 @@ +package dto + +type Int8CheckPk struct { + Int8CheckPk int `db:"int8_check_pk"` +} diff --git a/internal/integration_tests/postgres/nulltypeprimitive/Int8DefConstUniqueCheckPk.go b/internal/integration_tests/postgres/nulltypeprimitive/Int8DefConstUniqueCheckPk.go new file mode 100644 index 00000000..201fb0a9 --- /dev/null +++ b/internal/integration_tests/postgres/nulltypeprimitive/Int8DefConstUniqueCheckPk.go @@ -0,0 +1,5 @@ +package dto + +type Int8DefConstUniqueCheckPk struct { + Int8DefConstUniqueCheckPk int `db:"int8_def_const_unique_check_pk"` +} diff --git a/internal/integration_tests/postgres/nulltypeprimitive/Int8DefConstUniqueCheckPkRef.go b/internal/integration_tests/postgres/nulltypeprimitive/Int8DefConstUniqueCheckPkRef.go new file mode 100644 index 00000000..caf8b85e --- /dev/null +++ b/internal/integration_tests/postgres/nulltypeprimitive/Int8DefConstUniqueCheckPkRef.go @@ -0,0 +1,5 @@ +package dto + +type Int8DefConstUniqueCheckPkRef struct { + Int8DefConstUniqueCheckPkRef int `db:"int8_def_const_unique_check_pk_ref"` +} diff --git a/internal/integration_tests/postgres/nulltypeprimitive/Int8DefFuncUniqueCheckPk.go b/internal/integration_tests/postgres/nulltypeprimitive/Int8DefFuncUniqueCheckPk.go new file mode 100644 index 00000000..c77123a4 --- /dev/null +++ b/internal/integration_tests/postgres/nulltypeprimitive/Int8DefFuncUniqueCheckPk.go @@ -0,0 +1,5 @@ +package dto + +type Int8DefFuncUniqueCheckPk struct { + Int8DefFuncUniqueCheckPk int `db:"int8_def_func_unique_check_pk"` +} diff --git a/internal/integration_tests/postgres/nulltypeprimitive/Int8DefFuncUniqueCheckPkRef.go b/internal/integration_tests/postgres/nulltypeprimitive/Int8DefFuncUniqueCheckPkRef.go new file mode 100644 index 00000000..a0f68b8d --- /dev/null +++ b/internal/integration_tests/postgres/nulltypeprimitive/Int8DefFuncUniqueCheckPkRef.go @@ -0,0 +1,5 @@ +package dto + +type Int8DefFuncUniqueCheckPkRef struct { + Int8DefFuncUniqueCheckPkRef int `db:"int8_def_func_unique_check_pk_ref"` +} diff --git a/internal/integration_tests/postgres/nulltypeprimitive/Int8NnPk.go b/internal/integration_tests/postgres/nulltypeprimitive/Int8NnPk.go new file mode 100644 index 00000000..9d31270b --- /dev/null +++ b/internal/integration_tests/postgres/nulltypeprimitive/Int8NnPk.go @@ -0,0 +1,5 @@ +package dto + +type Int8NnPk struct { + Int8NnPk int `db:"int8_nn_pk"` +} diff --git a/internal/integration_tests/postgres/nulltypeprimitive/Int8NnUniqueCheckPk.go b/internal/integration_tests/postgres/nulltypeprimitive/Int8NnUniqueCheckPk.go new file mode 100644 index 00000000..1758577b --- /dev/null +++ b/internal/integration_tests/postgres/nulltypeprimitive/Int8NnUniqueCheckPk.go @@ -0,0 +1,5 @@ +package dto + +type Int8NnUniqueCheckPk struct { + Int8NnUniqueCheckPk int `db:"int8_nn_unique_check_pk"` +} diff --git a/internal/integration_tests/postgres/nulltypeprimitive/Int8NnUniqueCheckPkRef.go b/internal/integration_tests/postgres/nulltypeprimitive/Int8NnUniqueCheckPkRef.go new file mode 100644 index 00000000..018cde2d --- /dev/null +++ b/internal/integration_tests/postgres/nulltypeprimitive/Int8NnUniqueCheckPkRef.go @@ -0,0 +1,5 @@ +package dto + +type Int8NnUniqueCheckPkRef struct { + Int8NnUniqueCheckPkRef int `db:"int8_nn_unique_check_pk_ref"` +} diff --git a/internal/integration_tests/postgres/nulltypeprimitive/Int8Pk.go b/internal/integration_tests/postgres/nulltypeprimitive/Int8Pk.go new file mode 100644 index 00000000..4b09f0a7 --- /dev/null +++ b/internal/integration_tests/postgres/nulltypeprimitive/Int8Pk.go @@ -0,0 +1,5 @@ +package dto + +type Int8Pk struct { + Int8Pk int `db:"int8_pk"` +} diff --git a/internal/integration_tests/postgres/nulltypeprimitive/Int8PkDefConst.go b/internal/integration_tests/postgres/nulltypeprimitive/Int8PkDefConst.go new file mode 100644 index 00000000..35d13ea4 --- /dev/null +++ b/internal/integration_tests/postgres/nulltypeprimitive/Int8PkDefConst.go @@ -0,0 +1,5 @@ +package dto + +type Int8PkDefConst struct { + Int8PkDefConst int `db:"int8_pk_def_const"` +} diff --git a/internal/integration_tests/postgres/nulltypeprimitive/Int8PkDefFunc.go b/internal/integration_tests/postgres/nulltypeprimitive/Int8PkDefFunc.go new file mode 100644 index 00000000..2a833393 --- /dev/null +++ b/internal/integration_tests/postgres/nulltypeprimitive/Int8PkDefFunc.go @@ -0,0 +1,5 @@ +package dto + +type Int8PkDefFunc struct { + Int8PkDefFunc int `db:"int8_pk_def_func"` +} diff --git a/internal/integration_tests/postgres/nulltypeprimitive/Int8PkRef.go b/internal/integration_tests/postgres/nulltypeprimitive/Int8PkRef.go new file mode 100644 index 00000000..4d4d7e1b --- /dev/null +++ b/internal/integration_tests/postgres/nulltypeprimitive/Int8PkRef.go @@ -0,0 +1,5 @@ +package dto + +type Int8PkRef struct { + Int8PkRef int `db:"int8_pk_ref"` +} diff --git a/internal/integration_tests/postgres/nulltypeprimitive/Int8Ref.go b/internal/integration_tests/postgres/nulltypeprimitive/Int8Ref.go new file mode 100644 index 00000000..9db86c5e --- /dev/null +++ b/internal/integration_tests/postgres/nulltypeprimitive/Int8Ref.go @@ -0,0 +1,5 @@ +package dto + +type Int8Ref struct { + Int8Ref *int `db:"int8_ref"` +} diff --git a/internal/integration_tests/postgres/nulltypeprimitive/Int8UniqueCheckPk.go b/internal/integration_tests/postgres/nulltypeprimitive/Int8UniqueCheckPk.go new file mode 100644 index 00000000..12ac4b27 --- /dev/null +++ b/internal/integration_tests/postgres/nulltypeprimitive/Int8UniqueCheckPk.go @@ -0,0 +1,5 @@ +package dto + +type Int8UniqueCheckPk struct { + Int8UniqueCheckPk int `db:"int8_unique_check_pk"` +} diff --git a/internal/integration_tests/postgres/nulltypeprimitive/Int8UniqueCheckPkRef.go b/internal/integration_tests/postgres/nulltypeprimitive/Int8UniqueCheckPkRef.go new file mode 100644 index 00000000..7f3d06c7 --- /dev/null +++ b/internal/integration_tests/postgres/nulltypeprimitive/Int8UniqueCheckPkRef.go @@ -0,0 +1,5 @@ +package dto + +type Int8UniqueCheckPkRef struct { + Int8UniqueCheckPkRef int `db:"int8_unique_check_pk_ref"` +} diff --git a/internal/integration_tests/postgres/nulltypeprimitive/Int8UniquePk.go b/internal/integration_tests/postgres/nulltypeprimitive/Int8UniquePk.go new file mode 100644 index 00000000..e66c4bb2 --- /dev/null +++ b/internal/integration_tests/postgres/nulltypeprimitive/Int8UniquePk.go @@ -0,0 +1,5 @@ +package dto + +type Int8UniquePk struct { + Int8UniquePk int `db:"int8_unique_pk"` +} diff --git a/internal/integration_tests/postgres/nulltypeprimitive/Integer.go b/internal/integration_tests/postgres/nulltypeprimitive/Integer.go new file mode 100644 index 00000000..f5d4aecf --- /dev/null +++ b/internal/integration_tests/postgres/nulltypeprimitive/Integer.go @@ -0,0 +1,29 @@ +package dto + +type Integer struct { + Integer *int `db:"integer"` + IntegerNn int `db:"integer_nn"` + IntegerNnUnique int `db:"integer_nn_unique"` + IntegerNnCheck int `db:"integer_nn_check"` + IntegerNnRef int `db:"integer_nn_ref"` + IntegerNnDefConst int `db:"integer_nn_def_const"` + IntegerNnDefFunc int `db:"integer_nn_def_func"` + IntegerNnUniqueCheck int `db:"integer_nn_unique_check"` + IntegerUnique *int `db:"integer_unique"` + IntegerUniqueCheck *int `db:"integer_unique_check"` + IntegerUniqueRef *int `db:"integer_unique_ref"` + IntegerUniqueDefConst *int `db:"integer_unique_def_const"` + IntegerUniqueDefFunc *int `db:"integer_unique_def_func"` + IntegerCheck *int `db:"integer_check"` + IntegerCheckRef *int `db:"integer_check_ref"` + IntegerCheckDefConst *int `db:"integer_check_def_const"` + IntegerCheckDefFunc *int `db:"integer_check_def_func"` + IntegerRef *int `db:"integer_ref"` + IntegerRefDefConst *int `db:"integer_ref_def_const"` + IntegerRefDefFunc *int `db:"integer_ref_def_func"` + IntegerRefUniqueCheck *int `db:"integer_ref_unique_check"` + IntegerDefConst *int `db:"integer_def_const"` + IntegerDefConstUniqueCheck *int `db:"integer_def_const_unique_check"` + IntegerDefFunc *int `db:"integer_def_func"` + IntegerDefFuncUniqueCheck *int `db:"integer_def_func_unique_check"` +} diff --git a/internal/integration_tests/postgres/nulltypeprimitive/IntegerCheckPk.go b/internal/integration_tests/postgres/nulltypeprimitive/IntegerCheckPk.go new file mode 100644 index 00000000..ad7c9d02 --- /dev/null +++ b/internal/integration_tests/postgres/nulltypeprimitive/IntegerCheckPk.go @@ -0,0 +1,5 @@ +package dto + +type IntegerCheckPk struct { + IntegerCheckPk int `db:"integer_check_pk"` +} diff --git a/internal/integration_tests/postgres/nulltypeprimitive/IntegerDefConstUniqueCheckPk.go b/internal/integration_tests/postgres/nulltypeprimitive/IntegerDefConstUniqueCheckPk.go new file mode 100644 index 00000000..72165e92 --- /dev/null +++ b/internal/integration_tests/postgres/nulltypeprimitive/IntegerDefConstUniqueCheckPk.go @@ -0,0 +1,5 @@ +package dto + +type IntegerDefConstUniqueCheckPk struct { + IntegerDefConstUniqueCheckPk int `db:"integer_def_const_unique_check_pk"` +} diff --git a/internal/integration_tests/postgres/nulltypeprimitive/IntegerDefConstUniqueCheckPkRef.go b/internal/integration_tests/postgres/nulltypeprimitive/IntegerDefConstUniqueCheckPkRef.go new file mode 100644 index 00000000..3345b997 --- /dev/null +++ b/internal/integration_tests/postgres/nulltypeprimitive/IntegerDefConstUniqueCheckPkRef.go @@ -0,0 +1,5 @@ +package dto + +type IntegerDefConstUniqueCheckPkRef struct { + IntegerDefConstUniqueCheckPkRef int `db:"integer_def_const_unique_check_pk_ref"` +} diff --git a/internal/integration_tests/postgres/nulltypeprimitive/IntegerDefFuncUniqueCheckPk.go b/internal/integration_tests/postgres/nulltypeprimitive/IntegerDefFuncUniqueCheckPk.go new file mode 100644 index 00000000..842dc704 --- /dev/null +++ b/internal/integration_tests/postgres/nulltypeprimitive/IntegerDefFuncUniqueCheckPk.go @@ -0,0 +1,5 @@ +package dto + +type IntegerDefFuncUniqueCheckPk struct { + IntegerDefFuncUniqueCheckPk int `db:"integer_def_func_unique_check_pk"` +} diff --git a/internal/integration_tests/postgres/nulltypeprimitive/IntegerDefFuncUniqueCheckPkRef.go b/internal/integration_tests/postgres/nulltypeprimitive/IntegerDefFuncUniqueCheckPkRef.go new file mode 100644 index 00000000..8f406218 --- /dev/null +++ b/internal/integration_tests/postgres/nulltypeprimitive/IntegerDefFuncUniqueCheckPkRef.go @@ -0,0 +1,5 @@ +package dto + +type IntegerDefFuncUniqueCheckPkRef struct { + IntegerDefFuncUniqueCheckPkRef int `db:"integer_def_func_unique_check_pk_ref"` +} diff --git a/internal/integration_tests/postgres/nulltypeprimitive/IntegerNnPk.go b/internal/integration_tests/postgres/nulltypeprimitive/IntegerNnPk.go new file mode 100644 index 00000000..2ec86875 --- /dev/null +++ b/internal/integration_tests/postgres/nulltypeprimitive/IntegerNnPk.go @@ -0,0 +1,5 @@ +package dto + +type IntegerNnPk struct { + IntegerNnPk int `db:"integer_nn_pk"` +} diff --git a/internal/integration_tests/postgres/nulltypeprimitive/IntegerNnUniqueCheckPk.go b/internal/integration_tests/postgres/nulltypeprimitive/IntegerNnUniqueCheckPk.go new file mode 100644 index 00000000..f9311f0e --- /dev/null +++ b/internal/integration_tests/postgres/nulltypeprimitive/IntegerNnUniqueCheckPk.go @@ -0,0 +1,5 @@ +package dto + +type IntegerNnUniqueCheckPk struct { + IntegerNnUniqueCheckPk int `db:"integer_nn_unique_check_pk"` +} diff --git a/internal/integration_tests/postgres/nulltypeprimitive/IntegerNnUniqueCheckPkRef.go b/internal/integration_tests/postgres/nulltypeprimitive/IntegerNnUniqueCheckPkRef.go new file mode 100644 index 00000000..9dca594a --- /dev/null +++ b/internal/integration_tests/postgres/nulltypeprimitive/IntegerNnUniqueCheckPkRef.go @@ -0,0 +1,5 @@ +package dto + +type IntegerNnUniqueCheckPkRef struct { + IntegerNnUniqueCheckPkRef int `db:"integer_nn_unique_check_pk_ref"` +} diff --git a/internal/integration_tests/postgres/nulltypeprimitive/IntegerPk.go b/internal/integration_tests/postgres/nulltypeprimitive/IntegerPk.go new file mode 100644 index 00000000..4ad7290a --- /dev/null +++ b/internal/integration_tests/postgres/nulltypeprimitive/IntegerPk.go @@ -0,0 +1,5 @@ +package dto + +type IntegerPk struct { + IntegerPk int `db:"integer_pk"` +} diff --git a/internal/integration_tests/postgres/nulltypeprimitive/IntegerPkDefConst.go b/internal/integration_tests/postgres/nulltypeprimitive/IntegerPkDefConst.go new file mode 100644 index 00000000..16ca6af6 --- /dev/null +++ b/internal/integration_tests/postgres/nulltypeprimitive/IntegerPkDefConst.go @@ -0,0 +1,5 @@ +package dto + +type IntegerPkDefConst struct { + IntegerPkDefConst int `db:"integer_pk_def_const"` +} diff --git a/internal/integration_tests/postgres/nulltypeprimitive/IntegerPkDefFunc.go b/internal/integration_tests/postgres/nulltypeprimitive/IntegerPkDefFunc.go new file mode 100644 index 00000000..902032a0 --- /dev/null +++ b/internal/integration_tests/postgres/nulltypeprimitive/IntegerPkDefFunc.go @@ -0,0 +1,5 @@ +package dto + +type IntegerPkDefFunc struct { + IntegerPkDefFunc int `db:"integer_pk_def_func"` +} diff --git a/internal/integration_tests/postgres/nulltypeprimitive/IntegerPkRef.go b/internal/integration_tests/postgres/nulltypeprimitive/IntegerPkRef.go new file mode 100644 index 00000000..4b526720 --- /dev/null +++ b/internal/integration_tests/postgres/nulltypeprimitive/IntegerPkRef.go @@ -0,0 +1,5 @@ +package dto + +type IntegerPkRef struct { + IntegerPkRef int `db:"integer_pk_ref"` +} diff --git a/internal/integration_tests/postgres/nulltypeprimitive/IntegerRef.go b/internal/integration_tests/postgres/nulltypeprimitive/IntegerRef.go new file mode 100644 index 00000000..4b9105ba --- /dev/null +++ b/internal/integration_tests/postgres/nulltypeprimitive/IntegerRef.go @@ -0,0 +1,5 @@ +package dto + +type IntegerRef struct { + IntegerRef *int `db:"integer_ref"` +} diff --git a/internal/integration_tests/postgres/nulltypeprimitive/IntegerUniqueCheckPk.go b/internal/integration_tests/postgres/nulltypeprimitive/IntegerUniqueCheckPk.go new file mode 100644 index 00000000..e9752b8b --- /dev/null +++ b/internal/integration_tests/postgres/nulltypeprimitive/IntegerUniqueCheckPk.go @@ -0,0 +1,5 @@ +package dto + +type IntegerUniqueCheckPk struct { + IntegerUniqueCheckPk int `db:"integer_unique_check_pk"` +} diff --git a/internal/integration_tests/postgres/nulltypeprimitive/IntegerUniqueCheckPkRef.go b/internal/integration_tests/postgres/nulltypeprimitive/IntegerUniqueCheckPkRef.go new file mode 100644 index 00000000..23ec56d9 --- /dev/null +++ b/internal/integration_tests/postgres/nulltypeprimitive/IntegerUniqueCheckPkRef.go @@ -0,0 +1,5 @@ +package dto + +type IntegerUniqueCheckPkRef struct { + IntegerUniqueCheckPkRef int `db:"integer_unique_check_pk_ref"` +} diff --git a/internal/integration_tests/postgres/nulltypeprimitive/IntegerUniquePk.go b/internal/integration_tests/postgres/nulltypeprimitive/IntegerUniquePk.go new file mode 100644 index 00000000..460e2616 --- /dev/null +++ b/internal/integration_tests/postgres/nulltypeprimitive/IntegerUniquePk.go @@ -0,0 +1,5 @@ +package dto + +type IntegerUniquePk struct { + IntegerUniquePk int `db:"integer_unique_pk"` +} diff --git a/internal/integration_tests/postgres/nulltypeprimitive/Numeric.go b/internal/integration_tests/postgres/nulltypeprimitive/Numeric.go new file mode 100644 index 00000000..d29b6bf2 --- /dev/null +++ b/internal/integration_tests/postgres/nulltypeprimitive/Numeric.go @@ -0,0 +1,31 @@ +package dto + +type Numeric struct { + Numeric *float64 `db:"numeric"` + NumericPrec *float64 `db:"numeric_prec"` + NumericPrecScale *float64 `db:"numeric_prec_scale"` + NumericNn float64 `db:"numeric_nn"` + NumericNnUnique float64 `db:"numeric_nn_unique"` + NumericNnCheck float64 `db:"numeric_nn_check"` + NumericNnRef float64 `db:"numeric_nn_ref"` + NumericNnDefConst float64 `db:"numeric_nn_def_const"` + NumericNnDefFunc float64 `db:"numeric_nn_def_func"` + NumericNnUniqueCheck float64 `db:"numeric_nn_unique_check"` + NumericUnique *float64 `db:"numeric_unique"` + NumericUniqueCheck *float64 `db:"numeric_unique_check"` + NumericUniqueRef *float64 `db:"numeric_unique_ref"` + NumericUniqueDefConst *float64 `db:"numeric_unique_def_const"` + NumericUniqueDefFunc *float64 `db:"numeric_unique_def_func"` + NumericCheck *float64 `db:"numeric_check"` + NumericCheckRef *float64 `db:"numeric_check_ref"` + NumericCheckDefConst *float64 `db:"numeric_check_def_const"` + NumericCheckDefFunc *float64 `db:"numeric_check_def_func"` + NumericRef *float64 `db:"numeric_ref"` + NumericRefDefConst *float64 `db:"numeric_ref_def_const"` + NumericRefDefFunc *float64 `db:"numeric_ref_def_func"` + NumericRefUniqueCheck *float64 `db:"numeric_ref_unique_check"` + NumericDefConst *float64 `db:"numeric_def_const"` + NumericDefConstUniqueCheck *float64 `db:"numeric_def_const_unique_check"` + NumericDefFunc *float64 `db:"numeric_def_func"` + NumericDefFuncUniqueCheck *float64 `db:"numeric_def_func_unique_check"` +} diff --git a/internal/integration_tests/postgres/nulltypeprimitive/NumericCheckPk.go b/internal/integration_tests/postgres/nulltypeprimitive/NumericCheckPk.go new file mode 100644 index 00000000..58709a6e --- /dev/null +++ b/internal/integration_tests/postgres/nulltypeprimitive/NumericCheckPk.go @@ -0,0 +1,5 @@ +package dto + +type NumericCheckPk struct { + NumericCheckPk float64 `db:"numeric_check_pk"` +} diff --git a/internal/integration_tests/postgres/nulltypeprimitive/NumericDefConstUniqueCheckPk.go b/internal/integration_tests/postgres/nulltypeprimitive/NumericDefConstUniqueCheckPk.go new file mode 100644 index 00000000..e6fdd1a2 --- /dev/null +++ b/internal/integration_tests/postgres/nulltypeprimitive/NumericDefConstUniqueCheckPk.go @@ -0,0 +1,5 @@ +package dto + +type NumericDefConstUniqueCheckPk struct { + NumericDefConstUniqueCheckPk float64 `db:"numeric_def_const_unique_check_pk"` +} diff --git a/internal/integration_tests/postgres/nulltypeprimitive/NumericDefConstUniqueCheckPkRef.go b/internal/integration_tests/postgres/nulltypeprimitive/NumericDefConstUniqueCheckPkRef.go new file mode 100644 index 00000000..cdaee17e --- /dev/null +++ b/internal/integration_tests/postgres/nulltypeprimitive/NumericDefConstUniqueCheckPkRef.go @@ -0,0 +1,5 @@ +package dto + +type NumericDefConstUniqueCheckPkRef struct { + NumericDefConstUniqueCheckPkRef float64 `db:"numeric_def_const_unique_check_pk_ref"` +} diff --git a/internal/integration_tests/postgres/nulltypeprimitive/NumericDefFuncUniqueCheckPk.go b/internal/integration_tests/postgres/nulltypeprimitive/NumericDefFuncUniqueCheckPk.go new file mode 100644 index 00000000..7747f0a7 --- /dev/null +++ b/internal/integration_tests/postgres/nulltypeprimitive/NumericDefFuncUniqueCheckPk.go @@ -0,0 +1,5 @@ +package dto + +type NumericDefFuncUniqueCheckPk struct { + NumericDefFuncUniqueCheckPk float64 `db:"numeric_def_func_unique_check_pk"` +} diff --git a/internal/integration_tests/postgres/nulltypeprimitive/NumericDefFuncUniqueCheckPkRef.go b/internal/integration_tests/postgres/nulltypeprimitive/NumericDefFuncUniqueCheckPkRef.go new file mode 100644 index 00000000..ade94a23 --- /dev/null +++ b/internal/integration_tests/postgres/nulltypeprimitive/NumericDefFuncUniqueCheckPkRef.go @@ -0,0 +1,5 @@ +package dto + +type NumericDefFuncUniqueCheckPkRef struct { + NumericDefFuncUniqueCheckPkRef float64 `db:"numeric_def_func_unique_check_pk_ref"` +} diff --git a/internal/integration_tests/postgres/nulltypeprimitive/NumericNnPk.go b/internal/integration_tests/postgres/nulltypeprimitive/NumericNnPk.go new file mode 100644 index 00000000..d4f8dba5 --- /dev/null +++ b/internal/integration_tests/postgres/nulltypeprimitive/NumericNnPk.go @@ -0,0 +1,5 @@ +package dto + +type NumericNnPk struct { + NumericNnPk float64 `db:"numeric_nn_pk"` +} diff --git a/internal/integration_tests/postgres/nulltypeprimitive/NumericNnUniqueCheckPk.go b/internal/integration_tests/postgres/nulltypeprimitive/NumericNnUniqueCheckPk.go new file mode 100644 index 00000000..bad0e84f --- /dev/null +++ b/internal/integration_tests/postgres/nulltypeprimitive/NumericNnUniqueCheckPk.go @@ -0,0 +1,5 @@ +package dto + +type NumericNnUniqueCheckPk struct { + NumericNnUniqueCheckPk float64 `db:"numeric_nn_unique_check_pk"` +} diff --git a/internal/integration_tests/postgres/nulltypeprimitive/NumericNnUniqueCheckPkRef.go b/internal/integration_tests/postgres/nulltypeprimitive/NumericNnUniqueCheckPkRef.go new file mode 100644 index 00000000..c4d76752 --- /dev/null +++ b/internal/integration_tests/postgres/nulltypeprimitive/NumericNnUniqueCheckPkRef.go @@ -0,0 +1,5 @@ +package dto + +type NumericNnUniqueCheckPkRef struct { + NumericNnUniqueCheckPkRef float64 `db:"numeric_nn_unique_check_pk_ref"` +} diff --git a/internal/integration_tests/postgres/nulltypeprimitive/NumericPk.go b/internal/integration_tests/postgres/nulltypeprimitive/NumericPk.go new file mode 100644 index 00000000..c2d654cc --- /dev/null +++ b/internal/integration_tests/postgres/nulltypeprimitive/NumericPk.go @@ -0,0 +1,5 @@ +package dto + +type NumericPk struct { + NumericPk float64 `db:"numeric_pk"` +} diff --git a/internal/integration_tests/postgres/nulltypeprimitive/NumericPkDefConst.go b/internal/integration_tests/postgres/nulltypeprimitive/NumericPkDefConst.go new file mode 100644 index 00000000..b501ee37 --- /dev/null +++ b/internal/integration_tests/postgres/nulltypeprimitive/NumericPkDefConst.go @@ -0,0 +1,5 @@ +package dto + +type NumericPkDefConst struct { + NumericPkDefConst float64 `db:"numeric_pk_def_const"` +} diff --git a/internal/integration_tests/postgres/nulltypeprimitive/NumericPkDefFunc.go b/internal/integration_tests/postgres/nulltypeprimitive/NumericPkDefFunc.go new file mode 100644 index 00000000..13dd726d --- /dev/null +++ b/internal/integration_tests/postgres/nulltypeprimitive/NumericPkDefFunc.go @@ -0,0 +1,5 @@ +package dto + +type NumericPkDefFunc struct { + NumericPkDefFunc float64 `db:"numeric_pk_def_func"` +} diff --git a/internal/integration_tests/postgres/nulltypeprimitive/NumericPkRef.go b/internal/integration_tests/postgres/nulltypeprimitive/NumericPkRef.go new file mode 100644 index 00000000..af53186e --- /dev/null +++ b/internal/integration_tests/postgres/nulltypeprimitive/NumericPkRef.go @@ -0,0 +1,5 @@ +package dto + +type NumericPkRef struct { + NumericPkRef float64 `db:"numeric_pk_ref"` +} diff --git a/internal/integration_tests/postgres/nulltypeprimitive/NumericRef.go b/internal/integration_tests/postgres/nulltypeprimitive/NumericRef.go new file mode 100644 index 00000000..a3cac8a7 --- /dev/null +++ b/internal/integration_tests/postgres/nulltypeprimitive/NumericRef.go @@ -0,0 +1,5 @@ +package dto + +type NumericRef struct { + NumericRef *float64 `db:"numeric_ref"` +} diff --git a/internal/integration_tests/postgres/nulltypeprimitive/NumericUniqueCheckPk.go b/internal/integration_tests/postgres/nulltypeprimitive/NumericUniqueCheckPk.go new file mode 100644 index 00000000..e48c41ec --- /dev/null +++ b/internal/integration_tests/postgres/nulltypeprimitive/NumericUniqueCheckPk.go @@ -0,0 +1,5 @@ +package dto + +type NumericUniqueCheckPk struct { + NumericUniqueCheckPk float64 `db:"numeric_unique_check_pk"` +} diff --git a/internal/integration_tests/postgres/nulltypeprimitive/NumericUniqueCheckPkRef.go b/internal/integration_tests/postgres/nulltypeprimitive/NumericUniqueCheckPkRef.go new file mode 100644 index 00000000..d230e9c3 --- /dev/null +++ b/internal/integration_tests/postgres/nulltypeprimitive/NumericUniqueCheckPkRef.go @@ -0,0 +1,5 @@ +package dto + +type NumericUniqueCheckPkRef struct { + NumericUniqueCheckPkRef float64 `db:"numeric_unique_check_pk_ref"` +} diff --git a/internal/integration_tests/postgres/nulltypeprimitive/NumericUniquePk.go b/internal/integration_tests/postgres/nulltypeprimitive/NumericUniquePk.go new file mode 100644 index 00000000..308c1b60 --- /dev/null +++ b/internal/integration_tests/postgres/nulltypeprimitive/NumericUniquePk.go @@ -0,0 +1,5 @@ +package dto + +type NumericUniquePk struct { + NumericUniquePk float64 `db:"numeric_unique_pk"` +} diff --git a/internal/integration_tests/postgres/nulltypeprimitive/Real.go b/internal/integration_tests/postgres/nulltypeprimitive/Real.go new file mode 100644 index 00000000..f079eaa1 --- /dev/null +++ b/internal/integration_tests/postgres/nulltypeprimitive/Real.go @@ -0,0 +1,29 @@ +package dto + +type Real struct { + Real *float64 `db:"real"` + RealNn float64 `db:"real_nn"` + RealNnUnique float64 `db:"real_nn_unique"` + RealNnCheck float64 `db:"real_nn_check"` + RealNnRef float64 `db:"real_nn_ref"` + RealNnDefConst float64 `db:"real_nn_def_const"` + RealNnDefFunc float64 `db:"real_nn_def_func"` + RealNnUniqueCheck float64 `db:"real_nn_unique_check"` + RealUnique *float64 `db:"real_unique"` + RealUniqueCheck *float64 `db:"real_unique_check"` + RealUniqueRef *float64 `db:"real_unique_ref"` + RealUniqueDefConst *float64 `db:"real_unique_def_const"` + RealUniqueDefFunc *float64 `db:"real_unique_def_func"` + RealCheck *float64 `db:"real_check"` + RealCheckRef *float64 `db:"real_check_ref"` + RealCheckDefConst *float64 `db:"real_check_def_const"` + RealCheckDefFunc *float64 `db:"real_check_def_func"` + RealRef *float64 `db:"real_ref"` + RealRefDefConst *float64 `db:"real_ref_def_const"` + RealRefDefFunc *float64 `db:"real_ref_def_func"` + RealRefUniqueCheck *float64 `db:"real_ref_unique_check"` + RealDefConst *float64 `db:"real_def_const"` + RealDefConstUniqueCheck *float64 `db:"real_def_const_unique_check"` + RealDefFunc *float64 `db:"real_def_func"` + RealDefFuncUniqueCheck *float64 `db:"real_def_func_unique_check"` +} diff --git a/internal/integration_tests/postgres/nulltypeprimitive/RealCheckPk.go b/internal/integration_tests/postgres/nulltypeprimitive/RealCheckPk.go new file mode 100644 index 00000000..41bbff57 --- /dev/null +++ b/internal/integration_tests/postgres/nulltypeprimitive/RealCheckPk.go @@ -0,0 +1,5 @@ +package dto + +type RealCheckPk struct { + RealCheckPk float64 `db:"real_check_pk"` +} diff --git a/internal/integration_tests/postgres/nulltypeprimitive/RealDefConstUniqueCheckPk.go b/internal/integration_tests/postgres/nulltypeprimitive/RealDefConstUniqueCheckPk.go new file mode 100644 index 00000000..9be61d5c --- /dev/null +++ b/internal/integration_tests/postgres/nulltypeprimitive/RealDefConstUniqueCheckPk.go @@ -0,0 +1,5 @@ +package dto + +type RealDefConstUniqueCheckPk struct { + RealDefConstUniqueCheckPk float64 `db:"real_def_const_unique_check_pk"` +} diff --git a/internal/integration_tests/postgres/nulltypeprimitive/RealDefConstUniqueCheckPkRef.go b/internal/integration_tests/postgres/nulltypeprimitive/RealDefConstUniqueCheckPkRef.go new file mode 100644 index 00000000..af58466f --- /dev/null +++ b/internal/integration_tests/postgres/nulltypeprimitive/RealDefConstUniqueCheckPkRef.go @@ -0,0 +1,5 @@ +package dto + +type RealDefConstUniqueCheckPkRef struct { + RealDefConstUniqueCheckPkRef float64 `db:"real_def_const_unique_check_pk_ref"` +} diff --git a/internal/integration_tests/postgres/nulltypeprimitive/RealDefFuncUniqueCheckPk.go b/internal/integration_tests/postgres/nulltypeprimitive/RealDefFuncUniqueCheckPk.go new file mode 100644 index 00000000..2619719a --- /dev/null +++ b/internal/integration_tests/postgres/nulltypeprimitive/RealDefFuncUniqueCheckPk.go @@ -0,0 +1,5 @@ +package dto + +type RealDefFuncUniqueCheckPk struct { + RealDefFuncUniqueCheckPk float64 `db:"real_def_func_unique_check_pk"` +} diff --git a/internal/integration_tests/postgres/nulltypeprimitive/RealDefFuncUniqueCheckPkRef.go b/internal/integration_tests/postgres/nulltypeprimitive/RealDefFuncUniqueCheckPkRef.go new file mode 100644 index 00000000..1c085edc --- /dev/null +++ b/internal/integration_tests/postgres/nulltypeprimitive/RealDefFuncUniqueCheckPkRef.go @@ -0,0 +1,5 @@ +package dto + +type RealDefFuncUniqueCheckPkRef struct { + RealDefFuncUniqueCheckPkRef float64 `db:"real_def_func_unique_check_pk_ref"` +} diff --git a/internal/integration_tests/postgres/nulltypeprimitive/RealNnPk.go b/internal/integration_tests/postgres/nulltypeprimitive/RealNnPk.go new file mode 100644 index 00000000..c9efd760 --- /dev/null +++ b/internal/integration_tests/postgres/nulltypeprimitive/RealNnPk.go @@ -0,0 +1,5 @@ +package dto + +type RealNnPk struct { + RealNnPk float64 `db:"real_nn_pk"` +} diff --git a/internal/integration_tests/postgres/nulltypeprimitive/RealNnUniqueCheckPk.go b/internal/integration_tests/postgres/nulltypeprimitive/RealNnUniqueCheckPk.go new file mode 100644 index 00000000..bcd80e13 --- /dev/null +++ b/internal/integration_tests/postgres/nulltypeprimitive/RealNnUniqueCheckPk.go @@ -0,0 +1,5 @@ +package dto + +type RealNnUniqueCheckPk struct { + RealNnUniqueCheckPk float64 `db:"real_nn_unique_check_pk"` +} diff --git a/internal/integration_tests/postgres/nulltypeprimitive/RealNnUniqueCheckPkRef.go b/internal/integration_tests/postgres/nulltypeprimitive/RealNnUniqueCheckPkRef.go new file mode 100644 index 00000000..1ab6f733 --- /dev/null +++ b/internal/integration_tests/postgres/nulltypeprimitive/RealNnUniqueCheckPkRef.go @@ -0,0 +1,5 @@ +package dto + +type RealNnUniqueCheckPkRef struct { + RealNnUniqueCheckPkRef float64 `db:"real_nn_unique_check_pk_ref"` +} diff --git a/internal/integration_tests/postgres/nulltypeprimitive/RealPk.go b/internal/integration_tests/postgres/nulltypeprimitive/RealPk.go new file mode 100644 index 00000000..aae62539 --- /dev/null +++ b/internal/integration_tests/postgres/nulltypeprimitive/RealPk.go @@ -0,0 +1,5 @@ +package dto + +type RealPk struct { + RealPk float64 `db:"real_pk"` +} diff --git a/internal/integration_tests/postgres/nulltypeprimitive/RealPkDefConst.go b/internal/integration_tests/postgres/nulltypeprimitive/RealPkDefConst.go new file mode 100644 index 00000000..dcb3b0fa --- /dev/null +++ b/internal/integration_tests/postgres/nulltypeprimitive/RealPkDefConst.go @@ -0,0 +1,5 @@ +package dto + +type RealPkDefConst struct { + RealPkDefConst float64 `db:"real_pk_def_const"` +} diff --git a/internal/integration_tests/postgres/nulltypeprimitive/RealPkDefFunc.go b/internal/integration_tests/postgres/nulltypeprimitive/RealPkDefFunc.go new file mode 100644 index 00000000..85041669 --- /dev/null +++ b/internal/integration_tests/postgres/nulltypeprimitive/RealPkDefFunc.go @@ -0,0 +1,5 @@ +package dto + +type RealPkDefFunc struct { + RealPkDefFunc float64 `db:"real_pk_def_func"` +} diff --git a/internal/integration_tests/postgres/nulltypeprimitive/RealPkRef.go b/internal/integration_tests/postgres/nulltypeprimitive/RealPkRef.go new file mode 100644 index 00000000..99800028 --- /dev/null +++ b/internal/integration_tests/postgres/nulltypeprimitive/RealPkRef.go @@ -0,0 +1,5 @@ +package dto + +type RealPkRef struct { + RealPkRef float64 `db:"real_pk_ref"` +} diff --git a/internal/integration_tests/postgres/nulltypeprimitive/RealRef.go b/internal/integration_tests/postgres/nulltypeprimitive/RealRef.go new file mode 100644 index 00000000..ab340dbe --- /dev/null +++ b/internal/integration_tests/postgres/nulltypeprimitive/RealRef.go @@ -0,0 +1,5 @@ +package dto + +type RealRef struct { + RealRef *float64 `db:"real_ref"` +} diff --git a/internal/integration_tests/postgres/nulltypeprimitive/RealUniqueCheckPk.go b/internal/integration_tests/postgres/nulltypeprimitive/RealUniqueCheckPk.go new file mode 100644 index 00000000..68483d8a --- /dev/null +++ b/internal/integration_tests/postgres/nulltypeprimitive/RealUniqueCheckPk.go @@ -0,0 +1,5 @@ +package dto + +type RealUniqueCheckPk struct { + RealUniqueCheckPk float64 `db:"real_unique_check_pk"` +} diff --git a/internal/integration_tests/postgres/nulltypeprimitive/RealUniqueCheckPkRef.go b/internal/integration_tests/postgres/nulltypeprimitive/RealUniqueCheckPkRef.go new file mode 100644 index 00000000..bc4b0d90 --- /dev/null +++ b/internal/integration_tests/postgres/nulltypeprimitive/RealUniqueCheckPkRef.go @@ -0,0 +1,5 @@ +package dto + +type RealUniqueCheckPkRef struct { + RealUniqueCheckPkRef float64 `db:"real_unique_check_pk_ref"` +} diff --git a/internal/integration_tests/postgres/nulltypeprimitive/RealUniquePk.go b/internal/integration_tests/postgres/nulltypeprimitive/RealUniquePk.go new file mode 100644 index 00000000..8d22f752 --- /dev/null +++ b/internal/integration_tests/postgres/nulltypeprimitive/RealUniquePk.go @@ -0,0 +1,5 @@ +package dto + +type RealUniquePk struct { + RealUniquePk float64 `db:"real_unique_pk"` +} diff --git a/internal/integration_tests/postgres/nulltypeprimitive/Serial.go b/internal/integration_tests/postgres/nulltypeprimitive/Serial.go new file mode 100644 index 00000000..074fa24a --- /dev/null +++ b/internal/integration_tests/postgres/nulltypeprimitive/Serial.go @@ -0,0 +1,5 @@ +package dto + +type Serial struct { + Serial int `db:"serial"` +} diff --git a/internal/integration_tests/postgres/nulltypeprimitive/Serial2.go b/internal/integration_tests/postgres/nulltypeprimitive/Serial2.go new file mode 100644 index 00000000..65429d08 --- /dev/null +++ b/internal/integration_tests/postgres/nulltypeprimitive/Serial2.go @@ -0,0 +1,5 @@ +package dto + +type Serial2 struct { + Serial2 int `db:"serial2"` +} diff --git a/internal/integration_tests/postgres/nulltypeprimitive/Serial2Check.go b/internal/integration_tests/postgres/nulltypeprimitive/Serial2Check.go new file mode 100644 index 00000000..983eebf1 --- /dev/null +++ b/internal/integration_tests/postgres/nulltypeprimitive/Serial2Check.go @@ -0,0 +1,5 @@ +package dto + +type Serial2Check struct { + Serial2 int `db:"serial2"` +} diff --git a/internal/integration_tests/postgres/nulltypeprimitive/Serial2Notnull.go b/internal/integration_tests/postgres/nulltypeprimitive/Serial2Notnull.go new file mode 100644 index 00000000..ae42f28b --- /dev/null +++ b/internal/integration_tests/postgres/nulltypeprimitive/Serial2Notnull.go @@ -0,0 +1,5 @@ +package dto + +type Serial2Notnull struct { + Serial2 int `db:"serial2"` +} diff --git a/internal/integration_tests/postgres/nulltypeprimitive/Serial2Pk.go b/internal/integration_tests/postgres/nulltypeprimitive/Serial2Pk.go new file mode 100644 index 00000000..f8319410 --- /dev/null +++ b/internal/integration_tests/postgres/nulltypeprimitive/Serial2Pk.go @@ -0,0 +1,5 @@ +package dto + +type Serial2Pk struct { + Serial2 int `db:"serial2"` +} diff --git a/internal/integration_tests/postgres/nulltypeprimitive/Serial2Ref.go b/internal/integration_tests/postgres/nulltypeprimitive/Serial2Ref.go new file mode 100644 index 00000000..fdc79172 --- /dev/null +++ b/internal/integration_tests/postgres/nulltypeprimitive/Serial2Ref.go @@ -0,0 +1,5 @@ +package dto + +type Serial2Ref struct { + Serial2Ref int `db:"serial2_ref"` +} diff --git a/internal/integration_tests/postgres/nulltypeprimitive/Serial2References.go b/internal/integration_tests/postgres/nulltypeprimitive/Serial2References.go new file mode 100644 index 00000000..44b654ea --- /dev/null +++ b/internal/integration_tests/postgres/nulltypeprimitive/Serial2References.go @@ -0,0 +1,5 @@ +package dto + +type Serial2References struct { + Serial2 int `db:"serial2"` +} diff --git a/internal/integration_tests/postgres/nulltypeprimitive/Serial2Unique.go b/internal/integration_tests/postgres/nulltypeprimitive/Serial2Unique.go new file mode 100644 index 00000000..30253e13 --- /dev/null +++ b/internal/integration_tests/postgres/nulltypeprimitive/Serial2Unique.go @@ -0,0 +1,5 @@ +package dto + +type Serial2Unique struct { + Serial2 int `db:"serial2"` +} diff --git a/internal/integration_tests/postgres/nulltypeprimitive/Serial2UniqueCheck.go b/internal/integration_tests/postgres/nulltypeprimitive/Serial2UniqueCheck.go new file mode 100644 index 00000000..a446a09b --- /dev/null +++ b/internal/integration_tests/postgres/nulltypeprimitive/Serial2UniqueCheck.go @@ -0,0 +1,5 @@ +package dto + +type Serial2UniqueCheck struct { + Serial2 int `db:"serial2"` +} diff --git a/internal/integration_tests/postgres/nulltypeprimitive/Serial2UniqueCheckPk.go b/internal/integration_tests/postgres/nulltypeprimitive/Serial2UniqueCheckPk.go new file mode 100644 index 00000000..3b802b6d --- /dev/null +++ b/internal/integration_tests/postgres/nulltypeprimitive/Serial2UniqueCheckPk.go @@ -0,0 +1,5 @@ +package dto + +type Serial2UniqueCheckPk struct { + Serial2 int `db:"serial2"` +} diff --git a/internal/integration_tests/postgres/nulltypeprimitive/Serial2UniqueCheckPkRef.go b/internal/integration_tests/postgres/nulltypeprimitive/Serial2UniqueCheckPkRef.go new file mode 100644 index 00000000..4c9947dd --- /dev/null +++ b/internal/integration_tests/postgres/nulltypeprimitive/Serial2UniqueCheckPkRef.go @@ -0,0 +1,5 @@ +package dto + +type Serial2UniqueCheckPkRef struct { + Serial2 int `db:"serial2"` +} diff --git a/internal/integration_tests/postgres/nulltypeprimitive/Serial2UniqueCheckRef.go b/internal/integration_tests/postgres/nulltypeprimitive/Serial2UniqueCheckRef.go new file mode 100644 index 00000000..ddac5722 --- /dev/null +++ b/internal/integration_tests/postgres/nulltypeprimitive/Serial2UniqueCheckRef.go @@ -0,0 +1,5 @@ +package dto + +type Serial2UniqueCheckRef struct { + Serial2 int `db:"serial2"` +} diff --git a/internal/integration_tests/postgres/nulltypeprimitive/Serial4.go b/internal/integration_tests/postgres/nulltypeprimitive/Serial4.go new file mode 100644 index 00000000..fbb8ec97 --- /dev/null +++ b/internal/integration_tests/postgres/nulltypeprimitive/Serial4.go @@ -0,0 +1,5 @@ +package dto + +type Serial4 struct { + Serial4 int `db:"serial4"` +} diff --git a/internal/integration_tests/postgres/nulltypeprimitive/Serial4Check.go b/internal/integration_tests/postgres/nulltypeprimitive/Serial4Check.go new file mode 100644 index 00000000..149274fc --- /dev/null +++ b/internal/integration_tests/postgres/nulltypeprimitive/Serial4Check.go @@ -0,0 +1,5 @@ +package dto + +type Serial4Check struct { + Serial4 int `db:"serial4"` +} diff --git a/internal/integration_tests/postgres/nulltypeprimitive/Serial4Notnull.go b/internal/integration_tests/postgres/nulltypeprimitive/Serial4Notnull.go new file mode 100644 index 00000000..02d59de8 --- /dev/null +++ b/internal/integration_tests/postgres/nulltypeprimitive/Serial4Notnull.go @@ -0,0 +1,5 @@ +package dto + +type Serial4Notnull struct { + Serial4 int `db:"serial4"` +} diff --git a/internal/integration_tests/postgres/nulltypeprimitive/Serial4Pk.go b/internal/integration_tests/postgres/nulltypeprimitive/Serial4Pk.go new file mode 100644 index 00000000..78956c15 --- /dev/null +++ b/internal/integration_tests/postgres/nulltypeprimitive/Serial4Pk.go @@ -0,0 +1,5 @@ +package dto + +type Serial4Pk struct { + Serial4 int `db:"serial4"` +} diff --git a/internal/integration_tests/postgres/nulltypeprimitive/Serial4Ref.go b/internal/integration_tests/postgres/nulltypeprimitive/Serial4Ref.go new file mode 100644 index 00000000..d93b7703 --- /dev/null +++ b/internal/integration_tests/postgres/nulltypeprimitive/Serial4Ref.go @@ -0,0 +1,5 @@ +package dto + +type Serial4Ref struct { + Serial4Ref int `db:"serial4_ref"` +} diff --git a/internal/integration_tests/postgres/nulltypeprimitive/Serial4References.go b/internal/integration_tests/postgres/nulltypeprimitive/Serial4References.go new file mode 100644 index 00000000..1244033d --- /dev/null +++ b/internal/integration_tests/postgres/nulltypeprimitive/Serial4References.go @@ -0,0 +1,5 @@ +package dto + +type Serial4References struct { + Serial4 int `db:"serial4"` +} diff --git a/internal/integration_tests/postgres/nulltypeprimitive/Serial4Unique.go b/internal/integration_tests/postgres/nulltypeprimitive/Serial4Unique.go new file mode 100644 index 00000000..4ebcf67f --- /dev/null +++ b/internal/integration_tests/postgres/nulltypeprimitive/Serial4Unique.go @@ -0,0 +1,5 @@ +package dto + +type Serial4Unique struct { + Serial4 int `db:"serial4"` +} diff --git a/internal/integration_tests/postgres/nulltypeprimitive/Serial4UniqueCheck.go b/internal/integration_tests/postgres/nulltypeprimitive/Serial4UniqueCheck.go new file mode 100644 index 00000000..2636dccb --- /dev/null +++ b/internal/integration_tests/postgres/nulltypeprimitive/Serial4UniqueCheck.go @@ -0,0 +1,5 @@ +package dto + +type Serial4UniqueCheck struct { + Serial4 int `db:"serial4"` +} diff --git a/internal/integration_tests/postgres/nulltypeprimitive/Serial4UniqueCheckPk.go b/internal/integration_tests/postgres/nulltypeprimitive/Serial4UniqueCheckPk.go new file mode 100644 index 00000000..edf8f9f9 --- /dev/null +++ b/internal/integration_tests/postgres/nulltypeprimitive/Serial4UniqueCheckPk.go @@ -0,0 +1,5 @@ +package dto + +type Serial4UniqueCheckPk struct { + Serial4 int `db:"serial4"` +} diff --git a/internal/integration_tests/postgres/nulltypeprimitive/Serial4UniqueCheckPkRef.go b/internal/integration_tests/postgres/nulltypeprimitive/Serial4UniqueCheckPkRef.go new file mode 100644 index 00000000..d7a844eb --- /dev/null +++ b/internal/integration_tests/postgres/nulltypeprimitive/Serial4UniqueCheckPkRef.go @@ -0,0 +1,5 @@ +package dto + +type Serial4UniqueCheckPkRef struct { + Serial4 int `db:"serial4"` +} diff --git a/internal/integration_tests/postgres/nulltypeprimitive/Serial4UniqueCheckRef.go b/internal/integration_tests/postgres/nulltypeprimitive/Serial4UniqueCheckRef.go new file mode 100644 index 00000000..2fb663b8 --- /dev/null +++ b/internal/integration_tests/postgres/nulltypeprimitive/Serial4UniqueCheckRef.go @@ -0,0 +1,5 @@ +package dto + +type Serial4UniqueCheckRef struct { + Serial4 int `db:"serial4"` +} diff --git a/internal/integration_tests/postgres/nulltypeprimitive/Serial8.go b/internal/integration_tests/postgres/nulltypeprimitive/Serial8.go new file mode 100644 index 00000000..5b06a4ce --- /dev/null +++ b/internal/integration_tests/postgres/nulltypeprimitive/Serial8.go @@ -0,0 +1,5 @@ +package dto + +type Serial8 struct { + Serial8 int `db:"serial8"` +} diff --git a/internal/integration_tests/postgres/nulltypeprimitive/Serial8Check.go b/internal/integration_tests/postgres/nulltypeprimitive/Serial8Check.go new file mode 100644 index 00000000..526054e4 --- /dev/null +++ b/internal/integration_tests/postgres/nulltypeprimitive/Serial8Check.go @@ -0,0 +1,5 @@ +package dto + +type Serial8Check struct { + Serial8 int `db:"serial8"` +} diff --git a/internal/integration_tests/postgres/nulltypeprimitive/Serial8Notnull.go b/internal/integration_tests/postgres/nulltypeprimitive/Serial8Notnull.go new file mode 100644 index 00000000..d9d87b15 --- /dev/null +++ b/internal/integration_tests/postgres/nulltypeprimitive/Serial8Notnull.go @@ -0,0 +1,5 @@ +package dto + +type Serial8Notnull struct { + Serial8 int `db:"serial8"` +} diff --git a/internal/integration_tests/postgres/nulltypeprimitive/Serial8Pk.go b/internal/integration_tests/postgres/nulltypeprimitive/Serial8Pk.go new file mode 100644 index 00000000..3ea4311d --- /dev/null +++ b/internal/integration_tests/postgres/nulltypeprimitive/Serial8Pk.go @@ -0,0 +1,5 @@ +package dto + +type Serial8Pk struct { + Serial8 int `db:"serial8"` +} diff --git a/internal/integration_tests/postgres/nulltypeprimitive/Serial8Ref.go b/internal/integration_tests/postgres/nulltypeprimitive/Serial8Ref.go new file mode 100644 index 00000000..d2de2658 --- /dev/null +++ b/internal/integration_tests/postgres/nulltypeprimitive/Serial8Ref.go @@ -0,0 +1,5 @@ +package dto + +type Serial8Ref struct { + Serial8Ref int `db:"serial8_ref"` +} diff --git a/internal/integration_tests/postgres/nulltypeprimitive/Serial8References.go b/internal/integration_tests/postgres/nulltypeprimitive/Serial8References.go new file mode 100644 index 00000000..2586c9ca --- /dev/null +++ b/internal/integration_tests/postgres/nulltypeprimitive/Serial8References.go @@ -0,0 +1,5 @@ +package dto + +type Serial8References struct { + Serial8 int `db:"serial8"` +} diff --git a/internal/integration_tests/postgres/nulltypeprimitive/Serial8Unique.go b/internal/integration_tests/postgres/nulltypeprimitive/Serial8Unique.go new file mode 100644 index 00000000..d912158c --- /dev/null +++ b/internal/integration_tests/postgres/nulltypeprimitive/Serial8Unique.go @@ -0,0 +1,5 @@ +package dto + +type Serial8Unique struct { + Serial8 int `db:"serial8"` +} diff --git a/internal/integration_tests/postgres/nulltypeprimitive/Serial8UniqueCheck.go b/internal/integration_tests/postgres/nulltypeprimitive/Serial8UniqueCheck.go new file mode 100644 index 00000000..352e5651 --- /dev/null +++ b/internal/integration_tests/postgres/nulltypeprimitive/Serial8UniqueCheck.go @@ -0,0 +1,5 @@ +package dto + +type Serial8UniqueCheck struct { + Serial8 int `db:"serial8"` +} diff --git a/internal/integration_tests/postgres/nulltypeprimitive/Serial8UniqueCheckPk.go b/internal/integration_tests/postgres/nulltypeprimitive/Serial8UniqueCheckPk.go new file mode 100644 index 00000000..14d4c662 --- /dev/null +++ b/internal/integration_tests/postgres/nulltypeprimitive/Serial8UniqueCheckPk.go @@ -0,0 +1,5 @@ +package dto + +type Serial8UniqueCheckPk struct { + Serial8 int `db:"serial8"` +} diff --git a/internal/integration_tests/postgres/nulltypeprimitive/Serial8UniqueCheckPkRef.go b/internal/integration_tests/postgres/nulltypeprimitive/Serial8UniqueCheckPkRef.go new file mode 100644 index 00000000..181b67c6 --- /dev/null +++ b/internal/integration_tests/postgres/nulltypeprimitive/Serial8UniqueCheckPkRef.go @@ -0,0 +1,5 @@ +package dto + +type Serial8UniqueCheckPkRef struct { + Serial8 int `db:"serial8"` +} diff --git a/internal/integration_tests/postgres/nulltypeprimitive/Serial8UniqueCheckRef.go b/internal/integration_tests/postgres/nulltypeprimitive/Serial8UniqueCheckRef.go new file mode 100644 index 00000000..0421b751 --- /dev/null +++ b/internal/integration_tests/postgres/nulltypeprimitive/Serial8UniqueCheckRef.go @@ -0,0 +1,5 @@ +package dto + +type Serial8UniqueCheckRef struct { + Serial8 int `db:"serial8"` +} diff --git a/internal/integration_tests/postgres/nulltypeprimitive/SerialCheck.go b/internal/integration_tests/postgres/nulltypeprimitive/SerialCheck.go new file mode 100644 index 00000000..eda36e57 --- /dev/null +++ b/internal/integration_tests/postgres/nulltypeprimitive/SerialCheck.go @@ -0,0 +1,5 @@ +package dto + +type SerialCheck struct { + Serial int `db:"serial"` +} diff --git a/internal/integration_tests/postgres/nulltypeprimitive/SerialNotnull.go b/internal/integration_tests/postgres/nulltypeprimitive/SerialNotnull.go new file mode 100644 index 00000000..71503aac --- /dev/null +++ b/internal/integration_tests/postgres/nulltypeprimitive/SerialNotnull.go @@ -0,0 +1,5 @@ +package dto + +type SerialNotnull struct { + Serial int `db:"serial"` +} diff --git a/internal/integration_tests/postgres/nulltypeprimitive/SerialPk.go b/internal/integration_tests/postgres/nulltypeprimitive/SerialPk.go new file mode 100644 index 00000000..38e98376 --- /dev/null +++ b/internal/integration_tests/postgres/nulltypeprimitive/SerialPk.go @@ -0,0 +1,5 @@ +package dto + +type SerialPk struct { + Serial int `db:"serial"` +} diff --git a/internal/integration_tests/postgres/nulltypeprimitive/SerialRef.go b/internal/integration_tests/postgres/nulltypeprimitive/SerialRef.go new file mode 100644 index 00000000..4e00e64c --- /dev/null +++ b/internal/integration_tests/postgres/nulltypeprimitive/SerialRef.go @@ -0,0 +1,5 @@ +package dto + +type SerialRef struct { + SerialRef int `db:"serial_ref"` +} diff --git a/internal/integration_tests/postgres/nulltypeprimitive/SerialReferences.go b/internal/integration_tests/postgres/nulltypeprimitive/SerialReferences.go new file mode 100644 index 00000000..db60a6c6 --- /dev/null +++ b/internal/integration_tests/postgres/nulltypeprimitive/SerialReferences.go @@ -0,0 +1,5 @@ +package dto + +type SerialReferences struct { + Serial int `db:"serial"` +} diff --git a/internal/integration_tests/postgres/nulltypeprimitive/SerialUnique.go b/internal/integration_tests/postgres/nulltypeprimitive/SerialUnique.go new file mode 100644 index 00000000..6f485376 --- /dev/null +++ b/internal/integration_tests/postgres/nulltypeprimitive/SerialUnique.go @@ -0,0 +1,5 @@ +package dto + +type SerialUnique struct { + Serial int `db:"serial"` +} diff --git a/internal/integration_tests/postgres/nulltypeprimitive/SerialUniqueCheck.go b/internal/integration_tests/postgres/nulltypeprimitive/SerialUniqueCheck.go new file mode 100644 index 00000000..84598f1d --- /dev/null +++ b/internal/integration_tests/postgres/nulltypeprimitive/SerialUniqueCheck.go @@ -0,0 +1,5 @@ +package dto + +type SerialUniqueCheck struct { + Serial int `db:"serial"` +} diff --git a/internal/integration_tests/postgres/nulltypeprimitive/SerialUniqueCheckPk.go b/internal/integration_tests/postgres/nulltypeprimitive/SerialUniqueCheckPk.go new file mode 100644 index 00000000..ac7ae766 --- /dev/null +++ b/internal/integration_tests/postgres/nulltypeprimitive/SerialUniqueCheckPk.go @@ -0,0 +1,5 @@ +package dto + +type SerialUniqueCheckPk struct { + Serial int `db:"serial"` +} diff --git a/internal/integration_tests/postgres/nulltypeprimitive/SerialUniqueCheckPkRef.go b/internal/integration_tests/postgres/nulltypeprimitive/SerialUniqueCheckPkRef.go new file mode 100644 index 00000000..7a422f6e --- /dev/null +++ b/internal/integration_tests/postgres/nulltypeprimitive/SerialUniqueCheckPkRef.go @@ -0,0 +1,5 @@ +package dto + +type SerialUniqueCheckPkRef struct { + Serial int `db:"serial"` +} diff --git a/internal/integration_tests/postgres/nulltypeprimitive/SerialUniqueCheckRef.go b/internal/integration_tests/postgres/nulltypeprimitive/SerialUniqueCheckRef.go new file mode 100644 index 00000000..ddadb8ff --- /dev/null +++ b/internal/integration_tests/postgres/nulltypeprimitive/SerialUniqueCheckRef.go @@ -0,0 +1,5 @@ +package dto + +type SerialUniqueCheckRef struct { + Serial int `db:"serial"` +} diff --git a/internal/integration_tests/postgres/nulltypeprimitive/Smallint.go b/internal/integration_tests/postgres/nulltypeprimitive/Smallint.go new file mode 100644 index 00000000..6dcdc461 --- /dev/null +++ b/internal/integration_tests/postgres/nulltypeprimitive/Smallint.go @@ -0,0 +1,29 @@ +package dto + +type Smallint struct { + Smallint *int `db:"smallint"` + SmallintNn int `db:"smallint_nn"` + SmallintNnUnique int `db:"smallint_nn_unique"` + SmallintNnCheck int `db:"smallint_nn_check"` + SmallintNnRef int `db:"smallint_nn_ref"` + SmallintNnDefConst int `db:"smallint_nn_def_const"` + SmallintNnDefFunc int `db:"smallint_nn_def_func"` + SmallintNnUniqueCheck int `db:"smallint_nn_unique_check"` + SmallintUnique *int `db:"smallint_unique"` + SmallintUniqueCheck *int `db:"smallint_unique_check"` + SmallintUniqueRef *int `db:"smallint_unique_ref"` + SmallintUniqueDefConst *int `db:"smallint_unique_def_const"` + SmallintUniqueDefFunc *int `db:"smallint_unique_def_func"` + SmallintCheck *int `db:"smallint_check"` + SmallintCheckRef *int `db:"smallint_check_ref"` + SmallintCheckDefConst *int `db:"smallint_check_def_const"` + SmallintCheckDefFunc *int `db:"smallint_check_def_func"` + SmallintRef *int `db:"smallint_ref"` + SmallintRefDefConst *int `db:"smallint_ref_def_const"` + SmallintRefDefFunc *int `db:"smallint_ref_def_func"` + SmallintRefUniqueCheck *int `db:"smallint_ref_unique_check"` + SmallintDefConst *int `db:"smallint_def_const"` + SmallintDefConstUniqueCheck *int `db:"smallint_def_const_unique_check"` + SmallintDefFunc *int `db:"smallint_def_func"` + SmallintDefFuncUniqueCheck *int `db:"smallint_def_func_unique_check"` +} diff --git a/internal/integration_tests/postgres/nulltypeprimitive/SmallintCheckPk.go b/internal/integration_tests/postgres/nulltypeprimitive/SmallintCheckPk.go new file mode 100644 index 00000000..b751015a --- /dev/null +++ b/internal/integration_tests/postgres/nulltypeprimitive/SmallintCheckPk.go @@ -0,0 +1,5 @@ +package dto + +type SmallintCheckPk struct { + SmallintCheckPk int `db:"smallint_check_pk"` +} diff --git a/internal/integration_tests/postgres/nulltypeprimitive/SmallintDefConstUniqueCheckPk.go b/internal/integration_tests/postgres/nulltypeprimitive/SmallintDefConstUniqueCheckPk.go new file mode 100644 index 00000000..e2e17b6f --- /dev/null +++ b/internal/integration_tests/postgres/nulltypeprimitive/SmallintDefConstUniqueCheckPk.go @@ -0,0 +1,5 @@ +package dto + +type SmallintDefConstUniqueCheckPk struct { + SmallintDefConstUniqueCheckPk int `db:"smallint_def_const_unique_check_pk"` +} diff --git a/internal/integration_tests/postgres/nulltypeprimitive/SmallintDefConstUniqueCheckPkRef.go b/internal/integration_tests/postgres/nulltypeprimitive/SmallintDefConstUniqueCheckPkRef.go new file mode 100644 index 00000000..827d36f7 --- /dev/null +++ b/internal/integration_tests/postgres/nulltypeprimitive/SmallintDefConstUniqueCheckPkRef.go @@ -0,0 +1,5 @@ +package dto + +type SmallintDefConstUniqueCheckPkRef struct { + SmallintDefConstUniqueCheckPkRef int `db:"smallint_def_const_unique_check_pk_ref"` +} diff --git a/internal/integration_tests/postgres/nulltypeprimitive/SmallintDefFuncUniqueCheckPk.go b/internal/integration_tests/postgres/nulltypeprimitive/SmallintDefFuncUniqueCheckPk.go new file mode 100644 index 00000000..ab2612af --- /dev/null +++ b/internal/integration_tests/postgres/nulltypeprimitive/SmallintDefFuncUniqueCheckPk.go @@ -0,0 +1,5 @@ +package dto + +type SmallintDefFuncUniqueCheckPk struct { + SmallintDefFuncUniqueCheckPk int `db:"smallint_def_func_unique_check_pk"` +} diff --git a/internal/integration_tests/postgres/nulltypeprimitive/SmallintDefFuncUniqueCheckPkRef.go b/internal/integration_tests/postgres/nulltypeprimitive/SmallintDefFuncUniqueCheckPkRef.go new file mode 100644 index 00000000..3aef8dba --- /dev/null +++ b/internal/integration_tests/postgres/nulltypeprimitive/SmallintDefFuncUniqueCheckPkRef.go @@ -0,0 +1,5 @@ +package dto + +type SmallintDefFuncUniqueCheckPkRef struct { + SmallintDefFuncUniqueCheckPkRef int `db:"smallint_def_func_unique_check_pk_ref"` +} diff --git a/internal/integration_tests/postgres/nulltypeprimitive/SmallintNnPk.go b/internal/integration_tests/postgres/nulltypeprimitive/SmallintNnPk.go new file mode 100644 index 00000000..e860d504 --- /dev/null +++ b/internal/integration_tests/postgres/nulltypeprimitive/SmallintNnPk.go @@ -0,0 +1,5 @@ +package dto + +type SmallintNnPk struct { + SmallintNnPk int `db:"smallint_nn_pk"` +} diff --git a/internal/integration_tests/postgres/nulltypeprimitive/SmallintNnUniqueCheckPk.go b/internal/integration_tests/postgres/nulltypeprimitive/SmallintNnUniqueCheckPk.go new file mode 100644 index 00000000..09158e0c --- /dev/null +++ b/internal/integration_tests/postgres/nulltypeprimitive/SmallintNnUniqueCheckPk.go @@ -0,0 +1,5 @@ +package dto + +type SmallintNnUniqueCheckPk struct { + SmallintNnUniqueCheckPk int `db:"smallint_nn_unique_check_pk"` +} diff --git a/internal/integration_tests/postgres/nulltypeprimitive/SmallintNnUniqueCheckPkRef.go b/internal/integration_tests/postgres/nulltypeprimitive/SmallintNnUniqueCheckPkRef.go new file mode 100644 index 00000000..29099ecd --- /dev/null +++ b/internal/integration_tests/postgres/nulltypeprimitive/SmallintNnUniqueCheckPkRef.go @@ -0,0 +1,5 @@ +package dto + +type SmallintNnUniqueCheckPkRef struct { + SmallintNnUniqueCheckPkRef int `db:"smallint_nn_unique_check_pk_ref"` +} diff --git a/internal/integration_tests/postgres/nulltypeprimitive/SmallintPk.go b/internal/integration_tests/postgres/nulltypeprimitive/SmallintPk.go new file mode 100644 index 00000000..7e31ea21 --- /dev/null +++ b/internal/integration_tests/postgres/nulltypeprimitive/SmallintPk.go @@ -0,0 +1,5 @@ +package dto + +type SmallintPk struct { + SmallintPk int `db:"smallint_pk"` +} diff --git a/internal/integration_tests/postgres/nulltypeprimitive/SmallintPkDefConst.go b/internal/integration_tests/postgres/nulltypeprimitive/SmallintPkDefConst.go new file mode 100644 index 00000000..6674cb63 --- /dev/null +++ b/internal/integration_tests/postgres/nulltypeprimitive/SmallintPkDefConst.go @@ -0,0 +1,5 @@ +package dto + +type SmallintPkDefConst struct { + SmallintPkDefConst int `db:"smallint_pk_def_const"` +} diff --git a/internal/integration_tests/postgres/nulltypeprimitive/SmallintPkDefFunc.go b/internal/integration_tests/postgres/nulltypeprimitive/SmallintPkDefFunc.go new file mode 100644 index 00000000..3951e6bf --- /dev/null +++ b/internal/integration_tests/postgres/nulltypeprimitive/SmallintPkDefFunc.go @@ -0,0 +1,5 @@ +package dto + +type SmallintPkDefFunc struct { + SmallintPkDefFunc int `db:"smallint_pk_def_func"` +} diff --git a/internal/integration_tests/postgres/nulltypeprimitive/SmallintPkRef.go b/internal/integration_tests/postgres/nulltypeprimitive/SmallintPkRef.go new file mode 100644 index 00000000..fc0176ef --- /dev/null +++ b/internal/integration_tests/postgres/nulltypeprimitive/SmallintPkRef.go @@ -0,0 +1,5 @@ +package dto + +type SmallintPkRef struct { + SmallintPkRef int `db:"smallint_pk_ref"` +} diff --git a/internal/integration_tests/postgres/nulltypeprimitive/SmallintRef.go b/internal/integration_tests/postgres/nulltypeprimitive/SmallintRef.go new file mode 100644 index 00000000..f5e3acb8 --- /dev/null +++ b/internal/integration_tests/postgres/nulltypeprimitive/SmallintRef.go @@ -0,0 +1,5 @@ +package dto + +type SmallintRef struct { + SmallintRef *int `db:"smallint_ref"` +} diff --git a/internal/integration_tests/postgres/nulltypeprimitive/SmallintUniqueCheckPk.go b/internal/integration_tests/postgres/nulltypeprimitive/SmallintUniqueCheckPk.go new file mode 100644 index 00000000..3cf7cccc --- /dev/null +++ b/internal/integration_tests/postgres/nulltypeprimitive/SmallintUniqueCheckPk.go @@ -0,0 +1,5 @@ +package dto + +type SmallintUniqueCheckPk struct { + SmallintUniqueCheckPk int `db:"smallint_unique_check_pk"` +} diff --git a/internal/integration_tests/postgres/nulltypeprimitive/SmallintUniqueCheckPkRef.go b/internal/integration_tests/postgres/nulltypeprimitive/SmallintUniqueCheckPkRef.go new file mode 100644 index 00000000..2dc8bfd8 --- /dev/null +++ b/internal/integration_tests/postgres/nulltypeprimitive/SmallintUniqueCheckPkRef.go @@ -0,0 +1,5 @@ +package dto + +type SmallintUniqueCheckPkRef struct { + SmallintUniqueCheckPkRef int `db:"smallint_unique_check_pk_ref"` +} diff --git a/internal/integration_tests/postgres/nulltypeprimitive/SmallintUniquePk.go b/internal/integration_tests/postgres/nulltypeprimitive/SmallintUniquePk.go new file mode 100644 index 00000000..1814500f --- /dev/null +++ b/internal/integration_tests/postgres/nulltypeprimitive/SmallintUniquePk.go @@ -0,0 +1,5 @@ +package dto + +type SmallintUniquePk struct { + SmallintUniquePk int `db:"smallint_unique_pk"` +} diff --git a/internal/integration_tests/postgres/nulltypeprimitive/Smallserial.go b/internal/integration_tests/postgres/nulltypeprimitive/Smallserial.go new file mode 100644 index 00000000..e149ab37 --- /dev/null +++ b/internal/integration_tests/postgres/nulltypeprimitive/Smallserial.go @@ -0,0 +1,5 @@ +package dto + +type Smallserial struct { + Smallserial int `db:"smallserial"` +} diff --git a/internal/integration_tests/postgres/nulltypeprimitive/SmallserialCheck.go b/internal/integration_tests/postgres/nulltypeprimitive/SmallserialCheck.go new file mode 100644 index 00000000..996c751c --- /dev/null +++ b/internal/integration_tests/postgres/nulltypeprimitive/SmallserialCheck.go @@ -0,0 +1,5 @@ +package dto + +type SmallserialCheck struct { + Smallserial int `db:"smallserial"` +} diff --git a/internal/integration_tests/postgres/nulltypeprimitive/SmallserialNotnull.go b/internal/integration_tests/postgres/nulltypeprimitive/SmallserialNotnull.go new file mode 100644 index 00000000..d3b27168 --- /dev/null +++ b/internal/integration_tests/postgres/nulltypeprimitive/SmallserialNotnull.go @@ -0,0 +1,5 @@ +package dto + +type SmallserialNotnull struct { + Smallserial int `db:"smallserial"` +} diff --git a/internal/integration_tests/postgres/nulltypeprimitive/SmallserialPk.go b/internal/integration_tests/postgres/nulltypeprimitive/SmallserialPk.go new file mode 100644 index 00000000..44adb058 --- /dev/null +++ b/internal/integration_tests/postgres/nulltypeprimitive/SmallserialPk.go @@ -0,0 +1,5 @@ +package dto + +type SmallserialPk struct { + Smallserial int `db:"smallserial"` +} diff --git a/internal/integration_tests/postgres/nulltypeprimitive/SmallserialRef.go b/internal/integration_tests/postgres/nulltypeprimitive/SmallserialRef.go new file mode 100644 index 00000000..0b87f668 --- /dev/null +++ b/internal/integration_tests/postgres/nulltypeprimitive/SmallserialRef.go @@ -0,0 +1,5 @@ +package dto + +type SmallserialRef struct { + SmallserialRef int `db:"smallserial_ref"` +} diff --git a/internal/integration_tests/postgres/nulltypeprimitive/SmallserialReferences.go b/internal/integration_tests/postgres/nulltypeprimitive/SmallserialReferences.go new file mode 100644 index 00000000..632d8427 --- /dev/null +++ b/internal/integration_tests/postgres/nulltypeprimitive/SmallserialReferences.go @@ -0,0 +1,5 @@ +package dto + +type SmallserialReferences struct { + Smallserial int `db:"smallserial"` +} diff --git a/internal/integration_tests/postgres/nulltypeprimitive/SmallserialUnique.go b/internal/integration_tests/postgres/nulltypeprimitive/SmallserialUnique.go new file mode 100644 index 00000000..1848f100 --- /dev/null +++ b/internal/integration_tests/postgres/nulltypeprimitive/SmallserialUnique.go @@ -0,0 +1,5 @@ +package dto + +type SmallserialUnique struct { + Smallserial int `db:"smallserial"` +} diff --git a/internal/integration_tests/postgres/nulltypeprimitive/SmallserialUniqueCheck.go b/internal/integration_tests/postgres/nulltypeprimitive/SmallserialUniqueCheck.go new file mode 100644 index 00000000..d8ba7e2e --- /dev/null +++ b/internal/integration_tests/postgres/nulltypeprimitive/SmallserialUniqueCheck.go @@ -0,0 +1,5 @@ +package dto + +type SmallserialUniqueCheck struct { + Smallserial int `db:"smallserial"` +} diff --git a/internal/integration_tests/postgres/nulltypeprimitive/SmallserialUniqueCheckPk.go b/internal/integration_tests/postgres/nulltypeprimitive/SmallserialUniqueCheckPk.go new file mode 100644 index 00000000..08928c7c --- /dev/null +++ b/internal/integration_tests/postgres/nulltypeprimitive/SmallserialUniqueCheckPk.go @@ -0,0 +1,5 @@ +package dto + +type SmallserialUniqueCheckPk struct { + Smallserial int `db:"smallserial"` +} diff --git a/internal/integration_tests/postgres/nulltypeprimitive/SmallserialUniqueCheckPkRef.go b/internal/integration_tests/postgres/nulltypeprimitive/SmallserialUniqueCheckPkRef.go new file mode 100644 index 00000000..1fee4e9a --- /dev/null +++ b/internal/integration_tests/postgres/nulltypeprimitive/SmallserialUniqueCheckPkRef.go @@ -0,0 +1,5 @@ +package dto + +type SmallserialUniqueCheckPkRef struct { + Smallserial int `db:"smallserial"` +} diff --git a/internal/integration_tests/postgres/nulltypeprimitive/SmallserialUniqueCheckRef.go b/internal/integration_tests/postgres/nulltypeprimitive/SmallserialUniqueCheckRef.go new file mode 100644 index 00000000..0e8da3ee --- /dev/null +++ b/internal/integration_tests/postgres/nulltypeprimitive/SmallserialUniqueCheckRef.go @@ -0,0 +1,5 @@ +package dto + +type SmallserialUniqueCheckRef struct { + Smallserial int `db:"smallserial"` +} diff --git a/internal/integration_tests/postgres/nulltypeprimitive/Text.go b/internal/integration_tests/postgres/nulltypeprimitive/Text.go new file mode 100644 index 00000000..2ebd3c2a --- /dev/null +++ b/internal/integration_tests/postgres/nulltypeprimitive/Text.go @@ -0,0 +1,30 @@ +package dto + +type Text struct { + Text *string `db:"text"` + TextNn string `db:"text_nn"` + TextNnUnique string `db:"text_nn_unique"` + TextNnCheckCmp string `db:"text_nn_check_cmp"` + TextNnCheckFn string `db:"text_nn_check_fn"` + TextNnRef string `db:"text_nn_ref"` + TextNnDefConst string `db:"text_nn_def_const"` + TextNnDefFunc string `db:"text_nn_def_func"` + TextNnUniqueCheck string `db:"text_nn_unique_check"` + TextUnique *string `db:"text_unique"` + TextUniqueCheck *string `db:"text_unique_check"` + TextUniqueRef *string `db:"text_unique_ref"` + TextUniqueDefConst *string `db:"text_unique_def_const"` + TextUniqueDefFunc *string `db:"text_unique_def_func"` + TextCheck *string `db:"text_check"` + TextCheckRef *string `db:"text_check_ref"` + TextCheckDefConst *string `db:"text_check_def_const"` + TextCheckDefFunc *string `db:"text_check_def_func"` + TextRef *string `db:"text_ref"` + TextRefDefConst *string `db:"text_ref_def_const"` + TextRefDefFunc *string `db:"text_ref_def_func"` + TextRefUniqueCheck *string `db:"text_ref_unique_check"` + TextDefConst *string `db:"text_def_const"` + TextDefConstUniqueCheck *string `db:"text_def_const_unique_check"` + TextDefFunc *string `db:"text_def_func"` + TextDefFuncUniqueCheck *string `db:"text_def_func_unique_check"` +} diff --git a/internal/integration_tests/postgres/nulltypeprimitive/TextCheckPk.go b/internal/integration_tests/postgres/nulltypeprimitive/TextCheckPk.go new file mode 100644 index 00000000..90f2142b --- /dev/null +++ b/internal/integration_tests/postgres/nulltypeprimitive/TextCheckPk.go @@ -0,0 +1,5 @@ +package dto + +type TextCheckPk struct { + TextCheckPk string `db:"text_check_pk"` +} diff --git a/internal/integration_tests/postgres/nulltypeprimitive/TextDefConstUniqueCheckPk.go b/internal/integration_tests/postgres/nulltypeprimitive/TextDefConstUniqueCheckPk.go new file mode 100644 index 00000000..54dc441e --- /dev/null +++ b/internal/integration_tests/postgres/nulltypeprimitive/TextDefConstUniqueCheckPk.go @@ -0,0 +1,5 @@ +package dto + +type TextDefConstUniqueCheckPk struct { + TextDefConstUniqueCheckPk string `db:"text_def_const_unique_check_pk"` +} diff --git a/internal/integration_tests/postgres/nulltypeprimitive/TextDefConstUniqueCheckPkRef.go b/internal/integration_tests/postgres/nulltypeprimitive/TextDefConstUniqueCheckPkRef.go new file mode 100644 index 00000000..5a08cce5 --- /dev/null +++ b/internal/integration_tests/postgres/nulltypeprimitive/TextDefConstUniqueCheckPkRef.go @@ -0,0 +1,5 @@ +package dto + +type TextDefConstUniqueCheckPkRef struct { + TextDefConstUniqueCheckPkRef string `db:"text_def_const_unique_check_pk_ref"` +} diff --git a/internal/integration_tests/postgres/nulltypeprimitive/TextDefFuncUniqueCheckPk.go b/internal/integration_tests/postgres/nulltypeprimitive/TextDefFuncUniqueCheckPk.go new file mode 100644 index 00000000..64dc70e0 --- /dev/null +++ b/internal/integration_tests/postgres/nulltypeprimitive/TextDefFuncUniqueCheckPk.go @@ -0,0 +1,5 @@ +package dto + +type TextDefFuncUniqueCheckPk struct { + TextDefFuncUniqueCheckPk string `db:"text_def_func_unique_check_pk"` +} diff --git a/internal/integration_tests/postgres/nulltypeprimitive/TextDefFuncUniqueCheckPkRef.go b/internal/integration_tests/postgres/nulltypeprimitive/TextDefFuncUniqueCheckPkRef.go new file mode 100644 index 00000000..8d7f4734 --- /dev/null +++ b/internal/integration_tests/postgres/nulltypeprimitive/TextDefFuncUniqueCheckPkRef.go @@ -0,0 +1,5 @@ +package dto + +type TextDefFuncUniqueCheckPkRef struct { + TextDefFuncUniqueCheckPkRef string `db:"text_def_func_unique_check_pk_ref"` +} diff --git a/internal/integration_tests/postgres/nulltypeprimitive/TextNnPk.go b/internal/integration_tests/postgres/nulltypeprimitive/TextNnPk.go new file mode 100644 index 00000000..78dfe973 --- /dev/null +++ b/internal/integration_tests/postgres/nulltypeprimitive/TextNnPk.go @@ -0,0 +1,5 @@ +package dto + +type TextNnPk struct { + TextNnPk string `db:"text_nn_pk"` +} diff --git a/internal/integration_tests/postgres/nulltypeprimitive/TextNnUniqueCheckPk.go b/internal/integration_tests/postgres/nulltypeprimitive/TextNnUniqueCheckPk.go new file mode 100644 index 00000000..8d3223d1 --- /dev/null +++ b/internal/integration_tests/postgres/nulltypeprimitive/TextNnUniqueCheckPk.go @@ -0,0 +1,5 @@ +package dto + +type TextNnUniqueCheckPk struct { + TextNnUniqueCheckPk string `db:"text_nn_unique_check_pk"` +} diff --git a/internal/integration_tests/postgres/nulltypeprimitive/TextNnUniqueCheckPkRef.go b/internal/integration_tests/postgres/nulltypeprimitive/TextNnUniqueCheckPkRef.go new file mode 100644 index 00000000..15cfa8ef --- /dev/null +++ b/internal/integration_tests/postgres/nulltypeprimitive/TextNnUniqueCheckPkRef.go @@ -0,0 +1,5 @@ +package dto + +type TextNnUniqueCheckPkRef struct { + TextNnUniqueCheckPkRef string `db:"text_nn_unique_check_pk_ref"` +} diff --git a/internal/integration_tests/postgres/nulltypeprimitive/TextPk.go b/internal/integration_tests/postgres/nulltypeprimitive/TextPk.go new file mode 100644 index 00000000..32cd8a41 --- /dev/null +++ b/internal/integration_tests/postgres/nulltypeprimitive/TextPk.go @@ -0,0 +1,5 @@ +package dto + +type TextPk struct { + TextPk string `db:"text_pk"` +} diff --git a/internal/integration_tests/postgres/nulltypeprimitive/TextPkDefConst.go b/internal/integration_tests/postgres/nulltypeprimitive/TextPkDefConst.go new file mode 100644 index 00000000..362e51cb --- /dev/null +++ b/internal/integration_tests/postgres/nulltypeprimitive/TextPkDefConst.go @@ -0,0 +1,5 @@ +package dto + +type TextPkDefConst struct { + TextPkDefConst string `db:"text_pk_def_const"` +} diff --git a/internal/integration_tests/postgres/nulltypeprimitive/TextPkDefFunc.go b/internal/integration_tests/postgres/nulltypeprimitive/TextPkDefFunc.go new file mode 100644 index 00000000..c6af48c3 --- /dev/null +++ b/internal/integration_tests/postgres/nulltypeprimitive/TextPkDefFunc.go @@ -0,0 +1,5 @@ +package dto + +type TextPkDefFunc struct { + TextPkDefFunc string `db:"text_pk_def_func"` +} diff --git a/internal/integration_tests/postgres/nulltypeprimitive/TextPkRef.go b/internal/integration_tests/postgres/nulltypeprimitive/TextPkRef.go new file mode 100644 index 00000000..8c4e5d9f --- /dev/null +++ b/internal/integration_tests/postgres/nulltypeprimitive/TextPkRef.go @@ -0,0 +1,5 @@ +package dto + +type TextPkRef struct { + TextPkRef string `db:"text_pk_ref"` +} diff --git a/internal/integration_tests/postgres/nulltypeprimitive/TextRef.go b/internal/integration_tests/postgres/nulltypeprimitive/TextRef.go new file mode 100644 index 00000000..af5cdf1a --- /dev/null +++ b/internal/integration_tests/postgres/nulltypeprimitive/TextRef.go @@ -0,0 +1,5 @@ +package dto + +type TextRef struct { + TextRef *string `db:"text_ref"` +} diff --git a/internal/integration_tests/postgres/nulltypeprimitive/TextUniqueCheckPk.go b/internal/integration_tests/postgres/nulltypeprimitive/TextUniqueCheckPk.go new file mode 100644 index 00000000..26e3223a --- /dev/null +++ b/internal/integration_tests/postgres/nulltypeprimitive/TextUniqueCheckPk.go @@ -0,0 +1,5 @@ +package dto + +type TextUniqueCheckPk struct { + TextUniqueCheckPk string `db:"text_unique_check_pk"` +} diff --git a/internal/integration_tests/postgres/nulltypeprimitive/TextUniqueCheckPkRef.go b/internal/integration_tests/postgres/nulltypeprimitive/TextUniqueCheckPkRef.go new file mode 100644 index 00000000..13838eb5 --- /dev/null +++ b/internal/integration_tests/postgres/nulltypeprimitive/TextUniqueCheckPkRef.go @@ -0,0 +1,5 @@ +package dto + +type TextUniqueCheckPkRef struct { + TextUniqueCheckPkRef string `db:"text_unique_check_pk_ref"` +} diff --git a/internal/integration_tests/postgres/nulltypeprimitive/TextUniquePk.go b/internal/integration_tests/postgres/nulltypeprimitive/TextUniquePk.go new file mode 100644 index 00000000..cc327e98 --- /dev/null +++ b/internal/integration_tests/postgres/nulltypeprimitive/TextUniquePk.go @@ -0,0 +1,5 @@ +package dto + +type TextUniquePk struct { + TextUniquePk string `db:"text_unique_pk"` +} diff --git a/internal/integration_tests/postgres/nulltypeprimitive/Time.go b/internal/integration_tests/postgres/nulltypeprimitive/Time.go new file mode 100644 index 00000000..ff86732b --- /dev/null +++ b/internal/integration_tests/postgres/nulltypeprimitive/Time.go @@ -0,0 +1,33 @@ +package dto + +import ( + "time" +) + +type Time struct { + Time *time.Time `db:"time"` + TimeNn time.Time `db:"time_nn"` + TimeNnUnique time.Time `db:"time_nn_unique"` + TimeNnCheck time.Time `db:"time_nn_check"` + TimeNnRef time.Time `db:"time_nn_ref"` + TimeNnDefConst time.Time `db:"time_nn_def_const"` + TimeNnDefFunc time.Time `db:"time_nn_def_func"` + TimeNnUniqueCheck time.Time `db:"time_nn_unique_check"` + TimeUnique *time.Time `db:"time_unique"` + TimeUniqueCheck *time.Time `db:"time_unique_check"` + TimeUniqueRef *time.Time `db:"time_unique_ref"` + TimeUniqueDefConst *time.Time `db:"time_unique_def_const"` + TimeUniqueDefFunc *time.Time `db:"time_unique_def_func"` + TimeCheck *time.Time `db:"time_check"` + TimeCheckRef *time.Time `db:"time_check_ref"` + TimeCheckDefConst *time.Time `db:"time_check_def_const"` + TimeCheckDefFunc *time.Time `db:"time_check_def_func"` + TimeRef *time.Time `db:"time_ref"` + TimeRefDefConst *time.Time `db:"time_ref_def_const"` + TimeRefDefFunc *time.Time `db:"time_ref_def_func"` + TimeRefUniqueCheck *time.Time `db:"time_ref_unique_check"` + TimeDefConst *time.Time `db:"time_def_const"` + TimeDefConstUniqueCheck *time.Time `db:"time_def_const_unique_check"` + TimeDefFunc *time.Time `db:"time_def_func"` + TimeDefFuncUniqueCheck *time.Time `db:"time_def_func_unique_check"` +} diff --git a/internal/integration_tests/postgres/nulltypeprimitive/TimeCheckPk.go b/internal/integration_tests/postgres/nulltypeprimitive/TimeCheckPk.go new file mode 100644 index 00000000..8ac4498b --- /dev/null +++ b/internal/integration_tests/postgres/nulltypeprimitive/TimeCheckPk.go @@ -0,0 +1,9 @@ +package dto + +import ( + "time" +) + +type TimeCheckPk struct { + TimeCheckPk time.Time `db:"time_check_pk"` +} diff --git a/internal/integration_tests/postgres/nulltypeprimitive/TimeDefConstUniqueCheckPk.go b/internal/integration_tests/postgres/nulltypeprimitive/TimeDefConstUniqueCheckPk.go new file mode 100644 index 00000000..f9d70c06 --- /dev/null +++ b/internal/integration_tests/postgres/nulltypeprimitive/TimeDefConstUniqueCheckPk.go @@ -0,0 +1,9 @@ +package dto + +import ( + "time" +) + +type TimeDefConstUniqueCheckPk struct { + TimeDefConstUniqueCheckPk time.Time `db:"time_def_const_unique_check_pk"` +} diff --git a/internal/integration_tests/postgres/nulltypeprimitive/TimeDefConstUniqueCheckPkRef.go b/internal/integration_tests/postgres/nulltypeprimitive/TimeDefConstUniqueCheckPkRef.go new file mode 100644 index 00000000..227c15c5 --- /dev/null +++ b/internal/integration_tests/postgres/nulltypeprimitive/TimeDefConstUniqueCheckPkRef.go @@ -0,0 +1,9 @@ +package dto + +import ( + "time" +) + +type TimeDefConstUniqueCheckPkRef struct { + TimeDefConstUniqueCheckPkRef time.Time `db:"time_def_const_unique_check_pk_ref"` +} diff --git a/internal/integration_tests/postgres/nulltypeprimitive/TimeDefFuncUniqueCheckPk.go b/internal/integration_tests/postgres/nulltypeprimitive/TimeDefFuncUniqueCheckPk.go new file mode 100644 index 00000000..5058c3c9 --- /dev/null +++ b/internal/integration_tests/postgres/nulltypeprimitive/TimeDefFuncUniqueCheckPk.go @@ -0,0 +1,9 @@ +package dto + +import ( + "time" +) + +type TimeDefFuncUniqueCheckPk struct { + TimeDefFuncUniqueCheckPk time.Time `db:"time_def_func_unique_check_pk"` +} diff --git a/internal/integration_tests/postgres/nulltypeprimitive/TimeDefFuncUniqueCheckPkRef.go b/internal/integration_tests/postgres/nulltypeprimitive/TimeDefFuncUniqueCheckPkRef.go new file mode 100644 index 00000000..c07b24c2 --- /dev/null +++ b/internal/integration_tests/postgres/nulltypeprimitive/TimeDefFuncUniqueCheckPkRef.go @@ -0,0 +1,9 @@ +package dto + +import ( + "time" +) + +type TimeDefFuncUniqueCheckPkRef struct { + TimeDefFuncUniqueCheckPkRef time.Time `db:"time_def_func_unique_check_pk_ref"` +} diff --git a/internal/integration_tests/postgres/nulltypeprimitive/TimeNnPk.go b/internal/integration_tests/postgres/nulltypeprimitive/TimeNnPk.go new file mode 100644 index 00000000..9b53ef52 --- /dev/null +++ b/internal/integration_tests/postgres/nulltypeprimitive/TimeNnPk.go @@ -0,0 +1,9 @@ +package dto + +import ( + "time" +) + +type TimeNnPk struct { + TimeNnPk time.Time `db:"time_nn_pk"` +} diff --git a/internal/integration_tests/postgres/nulltypeprimitive/TimeNnUniqueCheckPk.go b/internal/integration_tests/postgres/nulltypeprimitive/TimeNnUniqueCheckPk.go new file mode 100644 index 00000000..ab75df92 --- /dev/null +++ b/internal/integration_tests/postgres/nulltypeprimitive/TimeNnUniqueCheckPk.go @@ -0,0 +1,9 @@ +package dto + +import ( + "time" +) + +type TimeNnUniqueCheckPk struct { + TimeNnUniqueCheckPk time.Time `db:"time_nn_unique_check_pk"` +} diff --git a/internal/integration_tests/postgres/nulltypeprimitive/TimeNnUniqueCheckPkRef.go b/internal/integration_tests/postgres/nulltypeprimitive/TimeNnUniqueCheckPkRef.go new file mode 100644 index 00000000..37926bf8 --- /dev/null +++ b/internal/integration_tests/postgres/nulltypeprimitive/TimeNnUniqueCheckPkRef.go @@ -0,0 +1,9 @@ +package dto + +import ( + "time" +) + +type TimeNnUniqueCheckPkRef struct { + TimeNnUniqueCheckPkRef time.Time `db:"time_nn_unique_check_pk_ref"` +} diff --git a/internal/integration_tests/postgres/nulltypeprimitive/TimePk.go b/internal/integration_tests/postgres/nulltypeprimitive/TimePk.go new file mode 100644 index 00000000..4cb08dc4 --- /dev/null +++ b/internal/integration_tests/postgres/nulltypeprimitive/TimePk.go @@ -0,0 +1,9 @@ +package dto + +import ( + "time" +) + +type TimePk struct { + TimePk time.Time `db:"time_pk"` +} diff --git a/internal/integration_tests/postgres/nulltypeprimitive/TimePkDefConst.go b/internal/integration_tests/postgres/nulltypeprimitive/TimePkDefConst.go new file mode 100644 index 00000000..7f119e6f --- /dev/null +++ b/internal/integration_tests/postgres/nulltypeprimitive/TimePkDefConst.go @@ -0,0 +1,9 @@ +package dto + +import ( + "time" +) + +type TimePkDefConst struct { + TimePkDefConst time.Time `db:"time_pk_def_const"` +} diff --git a/internal/integration_tests/postgres/nulltypeprimitive/TimePkDefFunc.go b/internal/integration_tests/postgres/nulltypeprimitive/TimePkDefFunc.go new file mode 100644 index 00000000..6b5c04c3 --- /dev/null +++ b/internal/integration_tests/postgres/nulltypeprimitive/TimePkDefFunc.go @@ -0,0 +1,9 @@ +package dto + +import ( + "time" +) + +type TimePkDefFunc struct { + TimePkDefFunc time.Time `db:"time_pk_def_func"` +} diff --git a/internal/integration_tests/postgres/nulltypeprimitive/TimePkRef.go b/internal/integration_tests/postgres/nulltypeprimitive/TimePkRef.go new file mode 100644 index 00000000..f2f24a81 --- /dev/null +++ b/internal/integration_tests/postgres/nulltypeprimitive/TimePkRef.go @@ -0,0 +1,9 @@ +package dto + +import ( + "time" +) + +type TimePkRef struct { + TimePkRef time.Time `db:"time_pk_ref"` +} diff --git a/internal/integration_tests/postgres/nulltypeprimitive/TimeRef.go b/internal/integration_tests/postgres/nulltypeprimitive/TimeRef.go new file mode 100644 index 00000000..5b80230f --- /dev/null +++ b/internal/integration_tests/postgres/nulltypeprimitive/TimeRef.go @@ -0,0 +1,9 @@ +package dto + +import ( + "time" +) + +type TimeRef struct { + TimeRef *time.Time `db:"time_ref"` +} diff --git a/internal/integration_tests/postgres/nulltypeprimitive/TimeUniqueCheckPk.go b/internal/integration_tests/postgres/nulltypeprimitive/TimeUniqueCheckPk.go new file mode 100644 index 00000000..24140cb6 --- /dev/null +++ b/internal/integration_tests/postgres/nulltypeprimitive/TimeUniqueCheckPk.go @@ -0,0 +1,9 @@ +package dto + +import ( + "time" +) + +type TimeUniqueCheckPk struct { + TimeUniqueCheckPk time.Time `db:"time_unique_check_pk"` +} diff --git a/internal/integration_tests/postgres/nulltypeprimitive/TimeUniqueCheckPkRef.go b/internal/integration_tests/postgres/nulltypeprimitive/TimeUniqueCheckPkRef.go new file mode 100644 index 00000000..4772a2c9 --- /dev/null +++ b/internal/integration_tests/postgres/nulltypeprimitive/TimeUniqueCheckPkRef.go @@ -0,0 +1,9 @@ +package dto + +import ( + "time" +) + +type TimeUniqueCheckPkRef struct { + TimeUniqueCheckPkRef time.Time `db:"time_unique_check_pk_ref"` +} diff --git a/internal/integration_tests/postgres/nulltypeprimitive/TimeUniquePk.go b/internal/integration_tests/postgres/nulltypeprimitive/TimeUniquePk.go new file mode 100644 index 00000000..4a5a293b --- /dev/null +++ b/internal/integration_tests/postgres/nulltypeprimitive/TimeUniquePk.go @@ -0,0 +1,9 @@ +package dto + +import ( + "time" +) + +type TimeUniquePk struct { + TimeUniquePk time.Time `db:"time_unique_pk"` +} diff --git a/internal/integration_tests/postgres/nulltypeprimitive/TimeWithTimeZone.go b/internal/integration_tests/postgres/nulltypeprimitive/TimeWithTimeZone.go new file mode 100644 index 00000000..46886386 --- /dev/null +++ b/internal/integration_tests/postgres/nulltypeprimitive/TimeWithTimeZone.go @@ -0,0 +1,33 @@ +package dto + +import ( + "time" +) + +type TimeWithTimeZone struct { + TimeWithTimeZone *time.Time `db:"time_with_time_zone"` + TimeWithTimeZoneNn time.Time `db:"time_with_time_zone_nn"` + TimeWithTimeZoneNnUnique time.Time `db:"time_with_time_zone_nn_unique"` + TimeWithTimeZoneNnCheck time.Time `db:"time_with_time_zone_nn_check"` + TimeWithTimeZoneNnRef time.Time `db:"time_with_time_zone_nn_ref"` + TimeWithTimeZoneNnDefConst time.Time `db:"time_with_time_zone_nn_def_const"` + TimeWithTimeZoneNnDefFunc time.Time `db:"time_with_time_zone_nn_def_func"` + TimeWithTimeZoneNnUniqueCheck time.Time `db:"time_with_time_zone_nn_unique_check"` + TimeWithTimeZoneUnique *time.Time `db:"time_with_time_zone_unique"` + TimeWithTimeZoneUniqueCheck *time.Time `db:"time_with_time_zone_unique_check"` + TimeWithTimeZoneUniqueRef *time.Time `db:"time_with_time_zone_unique_ref"` + TimeWithTimeZoneUniqueDefConst *time.Time `db:"time_with_time_zone_unique_def_const"` + TimeWithTimeZoneUniqueDefFunc *time.Time `db:"time_with_time_zone_unique_def_func"` + TimeWithTimeZoneCheck *time.Time `db:"time_with_time_zone_check"` + TimeWithTimeZoneCheckRef *time.Time `db:"time_with_time_zone_check_ref"` + TimeWithTimeZoneCheckDefConst *time.Time `db:"time_with_time_zone_check_def_const"` + TimeWithTimeZoneCheckDefFunc *time.Time `db:"time_with_time_zone_check_def_func"` + TimeWithTimeZoneRef *time.Time `db:"time_with_time_zone_ref"` + TimeWithTimeZoneRefDefConst *time.Time `db:"time_with_time_zone_ref_def_const"` + TimeWithTimeZoneRefDefFunc *time.Time `db:"time_with_time_zone_ref_def_func"` + TimeWithTimeZoneRefUniqueCheck *time.Time `db:"time_with_time_zone_ref_unique_check"` + TimeWithTimeZoneDefConst *time.Time `db:"time_with_time_zone_def_const"` + TimeWithTimeZoneDefConstUniqueCheck *time.Time `db:"time_with_time_zone_def_const_unique_check"` + TimeWithTimeZoneDefFunc *time.Time `db:"time_with_time_zone_def_func"` + TimeWithTimeZoneDefFuncUniqueCheck *time.Time `db:"time_with_time_zone_def_func_unique_check"` +} diff --git a/internal/integration_tests/postgres/nulltypeprimitive/TimeWithTimeZoneCheckPk.go b/internal/integration_tests/postgres/nulltypeprimitive/TimeWithTimeZoneCheckPk.go new file mode 100644 index 00000000..7c565940 --- /dev/null +++ b/internal/integration_tests/postgres/nulltypeprimitive/TimeWithTimeZoneCheckPk.go @@ -0,0 +1,9 @@ +package dto + +import ( + "time" +) + +type TimeWithTimeZoneCheckPk struct { + TimeWithTimeZoneCheckPk time.Time `db:"time_with_time_zone_check_pk"` +} diff --git a/internal/integration_tests/postgres/nulltypeprimitive/TimeWithTimeZoneDefConstUniqueCheckPk.go b/internal/integration_tests/postgres/nulltypeprimitive/TimeWithTimeZoneDefConstUniqueCheckPk.go new file mode 100644 index 00000000..ac2adcc0 --- /dev/null +++ b/internal/integration_tests/postgres/nulltypeprimitive/TimeWithTimeZoneDefConstUniqueCheckPk.go @@ -0,0 +1,9 @@ +package dto + +import ( + "time" +) + +type TimeWithTimeZoneDefConstUniqueCheckPk struct { + TimeWithTimeZoneDefConstUniqueCheckPk time.Time `db:"time_with_time_zone_def_const_unique_check_pk"` +} diff --git a/internal/integration_tests/postgres/nulltypeprimitive/TimeWithTimeZoneDefConstUniqueCheckPkRef.go b/internal/integration_tests/postgres/nulltypeprimitive/TimeWithTimeZoneDefConstUniqueCheckPkRef.go new file mode 100644 index 00000000..65daadc5 --- /dev/null +++ b/internal/integration_tests/postgres/nulltypeprimitive/TimeWithTimeZoneDefConstUniqueCheckPkRef.go @@ -0,0 +1,9 @@ +package dto + +import ( + "time" +) + +type TimeWithTimeZoneDefConstUniqueCheckPkRef struct { + TimeWithTimeZoneDefConstUniqueCheckPkRef time.Time `db:"time_with_time_zone_def_const_unique_check_pk_ref"` +} diff --git a/internal/integration_tests/postgres/nulltypeprimitive/TimeWithTimeZoneDefFuncUniqueCheckPk.go b/internal/integration_tests/postgres/nulltypeprimitive/TimeWithTimeZoneDefFuncUniqueCheckPk.go new file mode 100644 index 00000000..f0c0f8e3 --- /dev/null +++ b/internal/integration_tests/postgres/nulltypeprimitive/TimeWithTimeZoneDefFuncUniqueCheckPk.go @@ -0,0 +1,9 @@ +package dto + +import ( + "time" +) + +type TimeWithTimeZoneDefFuncUniqueCheckPk struct { + TimeWithTimeZoneDefFuncUniqueCheckPk time.Time `db:"time_with_time_zone_def_func_unique_check_pk"` +} diff --git a/internal/integration_tests/postgres/nulltypeprimitive/TimeWithTimeZoneDefFuncUniqueCheckPkRef.go b/internal/integration_tests/postgres/nulltypeprimitive/TimeWithTimeZoneDefFuncUniqueCheckPkRef.go new file mode 100644 index 00000000..f132ea1b --- /dev/null +++ b/internal/integration_tests/postgres/nulltypeprimitive/TimeWithTimeZoneDefFuncUniqueCheckPkRef.go @@ -0,0 +1,9 @@ +package dto + +import ( + "time" +) + +type TimeWithTimeZoneDefFuncUniqueCheckPkRef struct { + TimeWithTimeZoneDefFuncUniqueCheckPkRef time.Time `db:"time_with_time_zone_def_func_unique_check_pk_ref"` +} diff --git a/internal/integration_tests/postgres/nulltypeprimitive/TimeWithTimeZoneNnPk.go b/internal/integration_tests/postgres/nulltypeprimitive/TimeWithTimeZoneNnPk.go new file mode 100644 index 00000000..30466426 --- /dev/null +++ b/internal/integration_tests/postgres/nulltypeprimitive/TimeWithTimeZoneNnPk.go @@ -0,0 +1,9 @@ +package dto + +import ( + "time" +) + +type TimeWithTimeZoneNnPk struct { + TimeWithTimeZoneNnPk time.Time `db:"time_with_time_zone_nn_pk"` +} diff --git a/internal/integration_tests/postgres/nulltypeprimitive/TimeWithTimeZoneNnUniqueCheckPk.go b/internal/integration_tests/postgres/nulltypeprimitive/TimeWithTimeZoneNnUniqueCheckPk.go new file mode 100644 index 00000000..bad71816 --- /dev/null +++ b/internal/integration_tests/postgres/nulltypeprimitive/TimeWithTimeZoneNnUniqueCheckPk.go @@ -0,0 +1,9 @@ +package dto + +import ( + "time" +) + +type TimeWithTimeZoneNnUniqueCheckPk struct { + TimeWithTimeZoneNnUniqueCheckPk time.Time `db:"time_with_time_zone_nn_unique_check_pk"` +} diff --git a/internal/integration_tests/postgres/nulltypeprimitive/TimeWithTimeZoneNnUniqueCheckPkRef.go b/internal/integration_tests/postgres/nulltypeprimitive/TimeWithTimeZoneNnUniqueCheckPkRef.go new file mode 100644 index 00000000..c661a0ee --- /dev/null +++ b/internal/integration_tests/postgres/nulltypeprimitive/TimeWithTimeZoneNnUniqueCheckPkRef.go @@ -0,0 +1,9 @@ +package dto + +import ( + "time" +) + +type TimeWithTimeZoneNnUniqueCheckPkRef struct { + TimeWithTimeZoneNnUniqueCheckPkRef time.Time `db:"time_with_time_zone_nn_unique_check_pk_ref"` +} diff --git a/internal/integration_tests/postgres/nulltypeprimitive/TimeWithTimeZonePk.go b/internal/integration_tests/postgres/nulltypeprimitive/TimeWithTimeZonePk.go new file mode 100644 index 00000000..c2c66a5e --- /dev/null +++ b/internal/integration_tests/postgres/nulltypeprimitive/TimeWithTimeZonePk.go @@ -0,0 +1,9 @@ +package dto + +import ( + "time" +) + +type TimeWithTimeZonePk struct { + TimeWithTimeZonePk time.Time `db:"time_with_time_zone_pk"` +} diff --git a/internal/integration_tests/postgres/nulltypeprimitive/TimeWithTimeZonePkDefConst.go b/internal/integration_tests/postgres/nulltypeprimitive/TimeWithTimeZonePkDefConst.go new file mode 100644 index 00000000..0424b0ca --- /dev/null +++ b/internal/integration_tests/postgres/nulltypeprimitive/TimeWithTimeZonePkDefConst.go @@ -0,0 +1,9 @@ +package dto + +import ( + "time" +) + +type TimeWithTimeZonePkDefConst struct { + TimeWithTimeZonePkDefConst time.Time `db:"time_with_time_zone_pk_def_const"` +} diff --git a/internal/integration_tests/postgres/nulltypeprimitive/TimeWithTimeZonePkDefFunc.go b/internal/integration_tests/postgres/nulltypeprimitive/TimeWithTimeZonePkDefFunc.go new file mode 100644 index 00000000..c6c98deb --- /dev/null +++ b/internal/integration_tests/postgres/nulltypeprimitive/TimeWithTimeZonePkDefFunc.go @@ -0,0 +1,9 @@ +package dto + +import ( + "time" +) + +type TimeWithTimeZonePkDefFunc struct { + TimeWithTimeZonePkDefFunc time.Time `db:"time_with_time_zone_pk_def_func"` +} diff --git a/internal/integration_tests/postgres/nulltypeprimitive/TimeWithTimeZonePkRef.go b/internal/integration_tests/postgres/nulltypeprimitive/TimeWithTimeZonePkRef.go new file mode 100644 index 00000000..6924257d --- /dev/null +++ b/internal/integration_tests/postgres/nulltypeprimitive/TimeWithTimeZonePkRef.go @@ -0,0 +1,9 @@ +package dto + +import ( + "time" +) + +type TimeWithTimeZonePkRef struct { + TimeWithTimeZonePkRef time.Time `db:"time_with_time_zone_pk_ref"` +} diff --git a/internal/integration_tests/postgres/nulltypeprimitive/TimeWithTimeZoneRef.go b/internal/integration_tests/postgres/nulltypeprimitive/TimeWithTimeZoneRef.go new file mode 100644 index 00000000..2f7667d3 --- /dev/null +++ b/internal/integration_tests/postgres/nulltypeprimitive/TimeWithTimeZoneRef.go @@ -0,0 +1,9 @@ +package dto + +import ( + "time" +) + +type TimeWithTimeZoneRef struct { + TimeWithTimeZoneRef *time.Time `db:"time_with_time_zone_ref"` +} diff --git a/internal/integration_tests/postgres/nulltypeprimitive/TimeWithTimeZoneUniqueCheckPk.go b/internal/integration_tests/postgres/nulltypeprimitive/TimeWithTimeZoneUniqueCheckPk.go new file mode 100644 index 00000000..423b27b9 --- /dev/null +++ b/internal/integration_tests/postgres/nulltypeprimitive/TimeWithTimeZoneUniqueCheckPk.go @@ -0,0 +1,9 @@ +package dto + +import ( + "time" +) + +type TimeWithTimeZoneUniqueCheckPk struct { + TimeWithTimeZoneUniqueCheckPk time.Time `db:"time_with_time_zone_unique_check_pk"` +} diff --git a/internal/integration_tests/postgres/nulltypeprimitive/TimeWithTimeZoneUniqueCheckPkRef.go b/internal/integration_tests/postgres/nulltypeprimitive/TimeWithTimeZoneUniqueCheckPkRef.go new file mode 100644 index 00000000..78e20af0 --- /dev/null +++ b/internal/integration_tests/postgres/nulltypeprimitive/TimeWithTimeZoneUniqueCheckPkRef.go @@ -0,0 +1,9 @@ +package dto + +import ( + "time" +) + +type TimeWithTimeZoneUniqueCheckPkRef struct { + TimeWithTimeZoneUniqueCheckPkRef time.Time `db:"time_with_time_zone_unique_check_pk_ref"` +} diff --git a/internal/integration_tests/postgres/nulltypeprimitive/TimeWithTimeZoneUniquePk.go b/internal/integration_tests/postgres/nulltypeprimitive/TimeWithTimeZoneUniquePk.go new file mode 100644 index 00000000..85bc1bcb --- /dev/null +++ b/internal/integration_tests/postgres/nulltypeprimitive/TimeWithTimeZoneUniquePk.go @@ -0,0 +1,9 @@ +package dto + +import ( + "time" +) + +type TimeWithTimeZoneUniquePk struct { + TimeWithTimeZoneUniquePk time.Time `db:"time_with_time_zone_unique_pk"` +} diff --git a/internal/integration_tests/postgres/nulltypeprimitive/TimeWithoutTimeZone.go b/internal/integration_tests/postgres/nulltypeprimitive/TimeWithoutTimeZone.go new file mode 100644 index 00000000..7f68a0bf --- /dev/null +++ b/internal/integration_tests/postgres/nulltypeprimitive/TimeWithoutTimeZone.go @@ -0,0 +1,33 @@ +package dto + +import ( + "time" +) + +type TimeWithoutTimeZone struct { + TimeWithoutTimeZone *time.Time `db:"time_without_time_zone"` + TimeWithoutTimeZoneNn time.Time `db:"time_without_time_zone_nn"` + TimeWithoutTimeZoneNnUnique time.Time `db:"time_without_time_zone_nn_unique"` + TimeWithoutTimeZoneNnCheck time.Time `db:"time_without_time_zone_nn_check"` + TimeWithoutTimeZoneNnRef time.Time `db:"time_without_time_zone_nn_ref"` + TimeWithoutTimeZoneNnDefConst time.Time `db:"time_without_time_zone_nn_def_const"` + TimeWithoutTimeZoneNnDefFunc time.Time `db:"time_without_time_zone_nn_def_func"` + TimeWithoutTimeZoneNnUniqueCheck time.Time `db:"time_without_time_zone_nn_unique_check"` + TimeWithoutTimeZoneUnique *time.Time `db:"time_without_time_zone_unique"` + TimeWithoutTimeZoneUniqueCheck *time.Time `db:"time_without_time_zone_unique_check"` + TimeWithoutTimeZoneUniqueRef *time.Time `db:"time_without_time_zone_unique_ref"` + TimeWithoutTimeZoneUniqueDefConst *time.Time `db:"time_without_time_zone_unique_def_const"` + TimeWithoutTimeZoneUniqueDefFunc *time.Time `db:"time_without_time_zone_unique_def_func"` + TimeWithoutTimeZoneCheck *time.Time `db:"time_without_time_zone_check"` + TimeWithoutTimeZoneCheckRef *time.Time `db:"time_without_time_zone_check_ref"` + TimeWithoutTimeZoneCheckDefConst *time.Time `db:"time_without_time_zone_check_def_const"` + TimeWithoutTimeZoneCheckDefFunc *time.Time `db:"time_without_time_zone_check_def_func"` + TimeWithoutTimeZoneRef *time.Time `db:"time_without_time_zone_ref"` + TimeWithoutTimeZoneRefDefConst *time.Time `db:"time_without_time_zone_ref_def_const"` + TimeWithoutTimeZoneRefDefFunc *time.Time `db:"time_without_time_zone_ref_def_func"` + TimeWithoutTimeZoneRefUniqueCheck *time.Time `db:"time_without_time_zone_ref_unique_check"` + TimeWithoutTimeZoneDefConst *time.Time `db:"time_without_time_zone_def_const"` + TimeWithoutTimeZoneDefConstUniqueCheck *time.Time `db:"time_without_time_zone_def_const_unique_check"` + TimeWithoutTimeZoneDefFunc *time.Time `db:"time_without_time_zone_def_func"` + TimeWithoutTimeZoneDefFuncUniqueCheck *time.Time `db:"time_without_time_zone_def_func_unique_check"` +} diff --git a/internal/integration_tests/postgres/nulltypeprimitive/TimeWithoutTimeZoneCheckPk.go b/internal/integration_tests/postgres/nulltypeprimitive/TimeWithoutTimeZoneCheckPk.go new file mode 100644 index 00000000..4105570a --- /dev/null +++ b/internal/integration_tests/postgres/nulltypeprimitive/TimeWithoutTimeZoneCheckPk.go @@ -0,0 +1,9 @@ +package dto + +import ( + "time" +) + +type TimeWithoutTimeZoneCheckPk struct { + TimeWithoutTimeZoneCheckPk time.Time `db:"time_without_time_zone_check_pk"` +} diff --git a/internal/integration_tests/postgres/nulltypeprimitive/TimeWithoutTimeZoneDefConstUniqueCheckPk.go b/internal/integration_tests/postgres/nulltypeprimitive/TimeWithoutTimeZoneDefConstUniqueCheckPk.go new file mode 100644 index 00000000..4e089da5 --- /dev/null +++ b/internal/integration_tests/postgres/nulltypeprimitive/TimeWithoutTimeZoneDefConstUniqueCheckPk.go @@ -0,0 +1,9 @@ +package dto + +import ( + "time" +) + +type TimeWithoutTimeZoneDefConstUniqueCheckPk struct { + TimeWithoutTimeZoneDefConstUniqueCheckPk time.Time `db:"time_without_time_zone_def_const_unique_check_pk"` +} diff --git a/internal/integration_tests/postgres/nulltypeprimitive/TimeWithoutTimeZoneDefConstUniqueCheckPkRef.go b/internal/integration_tests/postgres/nulltypeprimitive/TimeWithoutTimeZoneDefConstUniqueCheckPkRef.go new file mode 100644 index 00000000..6c2249c2 --- /dev/null +++ b/internal/integration_tests/postgres/nulltypeprimitive/TimeWithoutTimeZoneDefConstUniqueCheckPkRef.go @@ -0,0 +1,9 @@ +package dto + +import ( + "time" +) + +type TimeWithoutTimeZoneDefConstUniqueCheckPkRef struct { + TimeWithoutTimeZoneDefConstUniqueCheckPkRef time.Time `db:"time_without_time_zone_def_const_unique_check_pk_ref"` +} diff --git a/internal/integration_tests/postgres/nulltypeprimitive/TimeWithoutTimeZoneDefFuncUniqueCheckPk.go b/internal/integration_tests/postgres/nulltypeprimitive/TimeWithoutTimeZoneDefFuncUniqueCheckPk.go new file mode 100644 index 00000000..281014dd --- /dev/null +++ b/internal/integration_tests/postgres/nulltypeprimitive/TimeWithoutTimeZoneDefFuncUniqueCheckPk.go @@ -0,0 +1,9 @@ +package dto + +import ( + "time" +) + +type TimeWithoutTimeZoneDefFuncUniqueCheckPk struct { + TimeWithoutTimeZoneDefFuncUniqueCheckPk time.Time `db:"time_without_time_zone_def_func_unique_check_pk"` +} diff --git a/internal/integration_tests/postgres/nulltypeprimitive/TimeWithoutTimeZoneDefFuncUniqueCheckPkRef.go b/internal/integration_tests/postgres/nulltypeprimitive/TimeWithoutTimeZoneDefFuncUniqueCheckPkRef.go new file mode 100644 index 00000000..5f359a71 --- /dev/null +++ b/internal/integration_tests/postgres/nulltypeprimitive/TimeWithoutTimeZoneDefFuncUniqueCheckPkRef.go @@ -0,0 +1,9 @@ +package dto + +import ( + "time" +) + +type TimeWithoutTimeZoneDefFuncUniqueCheckPkRef struct { + TimeWithoutTimeZoneDefFuncUniqueCheckPkRef time.Time `db:"time_without_time_zone_def_func_unique_check_pk_ref"` +} diff --git a/internal/integration_tests/postgres/nulltypeprimitive/TimeWithoutTimeZoneNnPk.go b/internal/integration_tests/postgres/nulltypeprimitive/TimeWithoutTimeZoneNnPk.go new file mode 100644 index 00000000..79316c7e --- /dev/null +++ b/internal/integration_tests/postgres/nulltypeprimitive/TimeWithoutTimeZoneNnPk.go @@ -0,0 +1,9 @@ +package dto + +import ( + "time" +) + +type TimeWithoutTimeZoneNnPk struct { + TimeWithoutTimeZoneNnPk time.Time `db:"time_without_time_zone_nn_pk"` +} diff --git a/internal/integration_tests/postgres/nulltypeprimitive/TimeWithoutTimeZoneNnUniqueCheckPk.go b/internal/integration_tests/postgres/nulltypeprimitive/TimeWithoutTimeZoneNnUniqueCheckPk.go new file mode 100644 index 00000000..9381fe3e --- /dev/null +++ b/internal/integration_tests/postgres/nulltypeprimitive/TimeWithoutTimeZoneNnUniqueCheckPk.go @@ -0,0 +1,9 @@ +package dto + +import ( + "time" +) + +type TimeWithoutTimeZoneNnUniqueCheckPk struct { + TimeWithoutTimeZoneNnUniqueCheckPk time.Time `db:"time_without_time_zone_nn_unique_check_pk"` +} diff --git a/internal/integration_tests/postgres/nulltypeprimitive/TimeWithoutTimeZoneNnUniqueCheckPkRef.go b/internal/integration_tests/postgres/nulltypeprimitive/TimeWithoutTimeZoneNnUniqueCheckPkRef.go new file mode 100644 index 00000000..3c7930de --- /dev/null +++ b/internal/integration_tests/postgres/nulltypeprimitive/TimeWithoutTimeZoneNnUniqueCheckPkRef.go @@ -0,0 +1,9 @@ +package dto + +import ( + "time" +) + +type TimeWithoutTimeZoneNnUniqueCheckPkRef struct { + TimeWithoutTimeZoneNnUniqueCheckPkRef time.Time `db:"time_without_time_zone_nn_unique_check_pk_ref"` +} diff --git a/internal/integration_tests/postgres/nulltypeprimitive/TimeWithoutTimeZonePk.go b/internal/integration_tests/postgres/nulltypeprimitive/TimeWithoutTimeZonePk.go new file mode 100644 index 00000000..18be5c5d --- /dev/null +++ b/internal/integration_tests/postgres/nulltypeprimitive/TimeWithoutTimeZonePk.go @@ -0,0 +1,9 @@ +package dto + +import ( + "time" +) + +type TimeWithoutTimeZonePk struct { + TimeWithoutTimeZonePk time.Time `db:"time_without_time_zone_pk"` +} diff --git a/internal/integration_tests/postgres/nulltypeprimitive/TimeWithoutTimeZonePkDefConst.go b/internal/integration_tests/postgres/nulltypeprimitive/TimeWithoutTimeZonePkDefConst.go new file mode 100644 index 00000000..b00600d5 --- /dev/null +++ b/internal/integration_tests/postgres/nulltypeprimitive/TimeWithoutTimeZonePkDefConst.go @@ -0,0 +1,9 @@ +package dto + +import ( + "time" +) + +type TimeWithoutTimeZonePkDefConst struct { + TimeWithoutTimeZonePkDefConst time.Time `db:"time_without_time_zone_pk_def_const"` +} diff --git a/internal/integration_tests/postgres/nulltypeprimitive/TimeWithoutTimeZonePkDefFunc.go b/internal/integration_tests/postgres/nulltypeprimitive/TimeWithoutTimeZonePkDefFunc.go new file mode 100644 index 00000000..2c4f235c --- /dev/null +++ b/internal/integration_tests/postgres/nulltypeprimitive/TimeWithoutTimeZonePkDefFunc.go @@ -0,0 +1,9 @@ +package dto + +import ( + "time" +) + +type TimeWithoutTimeZonePkDefFunc struct { + TimeWithoutTimeZonePkDefFunc time.Time `db:"time_without_time_zone_pk_def_func"` +} diff --git a/internal/integration_tests/postgres/nulltypeprimitive/TimeWithoutTimeZonePkRef.go b/internal/integration_tests/postgres/nulltypeprimitive/TimeWithoutTimeZonePkRef.go new file mode 100644 index 00000000..0302cdd8 --- /dev/null +++ b/internal/integration_tests/postgres/nulltypeprimitive/TimeWithoutTimeZonePkRef.go @@ -0,0 +1,9 @@ +package dto + +import ( + "time" +) + +type TimeWithoutTimeZonePkRef struct { + TimeWithoutTimeZonePkRef time.Time `db:"time_without_time_zone_pk_ref"` +} diff --git a/internal/integration_tests/postgres/nulltypeprimitive/TimeWithoutTimeZoneRef.go b/internal/integration_tests/postgres/nulltypeprimitive/TimeWithoutTimeZoneRef.go new file mode 100644 index 00000000..c32a961f --- /dev/null +++ b/internal/integration_tests/postgres/nulltypeprimitive/TimeWithoutTimeZoneRef.go @@ -0,0 +1,9 @@ +package dto + +import ( + "time" +) + +type TimeWithoutTimeZoneRef struct { + TimeWithoutTimeZoneRef *time.Time `db:"time_without_time_zone_ref"` +} diff --git a/internal/integration_tests/postgres/nulltypeprimitive/TimeWithoutTimeZoneUniqueCheckPk.go b/internal/integration_tests/postgres/nulltypeprimitive/TimeWithoutTimeZoneUniqueCheckPk.go new file mode 100644 index 00000000..25b5be4a --- /dev/null +++ b/internal/integration_tests/postgres/nulltypeprimitive/TimeWithoutTimeZoneUniqueCheckPk.go @@ -0,0 +1,9 @@ +package dto + +import ( + "time" +) + +type TimeWithoutTimeZoneUniqueCheckPk struct { + TimeWithoutTimeZoneUniqueCheckPk time.Time `db:"time_without_time_zone_unique_check_pk"` +} diff --git a/internal/integration_tests/postgres/nulltypeprimitive/TimeWithoutTimeZoneUniqueCheckPkRef.go b/internal/integration_tests/postgres/nulltypeprimitive/TimeWithoutTimeZoneUniqueCheckPkRef.go new file mode 100644 index 00000000..97d3505f --- /dev/null +++ b/internal/integration_tests/postgres/nulltypeprimitive/TimeWithoutTimeZoneUniqueCheckPkRef.go @@ -0,0 +1,9 @@ +package dto + +import ( + "time" +) + +type TimeWithoutTimeZoneUniqueCheckPkRef struct { + TimeWithoutTimeZoneUniqueCheckPkRef time.Time `db:"time_without_time_zone_unique_check_pk_ref"` +} diff --git a/internal/integration_tests/postgres/nulltypeprimitive/TimeWithoutTimeZoneUniquePk.go b/internal/integration_tests/postgres/nulltypeprimitive/TimeWithoutTimeZoneUniquePk.go new file mode 100644 index 00000000..2e1074f2 --- /dev/null +++ b/internal/integration_tests/postgres/nulltypeprimitive/TimeWithoutTimeZoneUniquePk.go @@ -0,0 +1,9 @@ +package dto + +import ( + "time" +) + +type TimeWithoutTimeZoneUniquePk struct { + TimeWithoutTimeZoneUniquePk time.Time `db:"time_without_time_zone_unique_pk"` +} diff --git a/internal/integration_tests/postgres/nulltypeprimitive/Timestamp.go b/internal/integration_tests/postgres/nulltypeprimitive/Timestamp.go new file mode 100644 index 00000000..9bee3142 --- /dev/null +++ b/internal/integration_tests/postgres/nulltypeprimitive/Timestamp.go @@ -0,0 +1,33 @@ +package dto + +import ( + "time" +) + +type Timestamp struct { + Timestamp *time.Time `db:"timestamp"` + TimestampNn time.Time `db:"timestamp_nn"` + TimestampNnUnique time.Time `db:"timestamp_nn_unique"` + TimestampNnCheck time.Time `db:"timestamp_nn_check"` + TimestampNnRef time.Time `db:"timestamp_nn_ref"` + TimestampNnDefConst time.Time `db:"timestamp_nn_def_const"` + TimestampNnDefFunc time.Time `db:"timestamp_nn_def_func"` + TimestampNnUniqueCheck time.Time `db:"timestamp_nn_unique_check"` + TimestampUnique *time.Time `db:"timestamp_unique"` + TimestampUniqueCheck *time.Time `db:"timestamp_unique_check"` + TimestampUniqueRef *time.Time `db:"timestamp_unique_ref"` + TimestampUniqueDefConst *time.Time `db:"timestamp_unique_def_const"` + TimestampUniqueDefFunc *time.Time `db:"timestamp_unique_def_func"` + TimestampCheck *time.Time `db:"timestamp_check"` + TimestampCheckRef *time.Time `db:"timestamp_check_ref"` + TimestampCheckDefConst *time.Time `db:"timestamp_check_def_const"` + TimestampCheckDefFunc *time.Time `db:"timestamp_check_def_func"` + TimestampRef *time.Time `db:"timestamp_ref"` + TimestampRefDefConst *time.Time `db:"timestamp_ref_def_const"` + TimestampRefDefFunc *time.Time `db:"timestamp_ref_def_func"` + TimestampRefUniqueCheck *time.Time `db:"timestamp_ref_unique_check"` + TimestampDefConst *time.Time `db:"timestamp_def_const"` + TimestampDefConstUniqueCheck *time.Time `db:"timestamp_def_const_unique_check"` + TimestampDefFunc *time.Time `db:"timestamp_def_func"` + TimestampDefFuncUniqueCheck *time.Time `db:"timestamp_def_func_unique_check"` +} diff --git a/internal/integration_tests/postgres/nulltypeprimitive/TimestampCheckPk.go b/internal/integration_tests/postgres/nulltypeprimitive/TimestampCheckPk.go new file mode 100644 index 00000000..11d9aac0 --- /dev/null +++ b/internal/integration_tests/postgres/nulltypeprimitive/TimestampCheckPk.go @@ -0,0 +1,9 @@ +package dto + +import ( + "time" +) + +type TimestampCheckPk struct { + TimestampCheckPk time.Time `db:"timestamp_check_pk"` +} diff --git a/internal/integration_tests/postgres/nulltypeprimitive/TimestampDefConstUniqueCheckPk.go b/internal/integration_tests/postgres/nulltypeprimitive/TimestampDefConstUniqueCheckPk.go new file mode 100644 index 00000000..76291a17 --- /dev/null +++ b/internal/integration_tests/postgres/nulltypeprimitive/TimestampDefConstUniqueCheckPk.go @@ -0,0 +1,9 @@ +package dto + +import ( + "time" +) + +type TimestampDefConstUniqueCheckPk struct { + TimestampDefConstUniqueCheckPk time.Time `db:"timestamp_def_const_unique_check_pk"` +} diff --git a/internal/integration_tests/postgres/nulltypeprimitive/TimestampDefConstUniqueCheckPkRef.go b/internal/integration_tests/postgres/nulltypeprimitive/TimestampDefConstUniqueCheckPkRef.go new file mode 100644 index 00000000..b5bd7f6d --- /dev/null +++ b/internal/integration_tests/postgres/nulltypeprimitive/TimestampDefConstUniqueCheckPkRef.go @@ -0,0 +1,9 @@ +package dto + +import ( + "time" +) + +type TimestampDefConstUniqueCheckPkRef struct { + TimestampDefConstUniqueCheckPkRef time.Time `db:"timestamp_def_const_unique_check_pk_ref"` +} diff --git a/internal/integration_tests/postgres/nulltypeprimitive/TimestampDefFuncUniqueCheckPk.go b/internal/integration_tests/postgres/nulltypeprimitive/TimestampDefFuncUniqueCheckPk.go new file mode 100644 index 00000000..07987edb --- /dev/null +++ b/internal/integration_tests/postgres/nulltypeprimitive/TimestampDefFuncUniqueCheckPk.go @@ -0,0 +1,9 @@ +package dto + +import ( + "time" +) + +type TimestampDefFuncUniqueCheckPk struct { + TimestampDefFuncUniqueCheckPk time.Time `db:"timestamp_def_func_unique_check_pk"` +} diff --git a/internal/integration_tests/postgres/nulltypeprimitive/TimestampDefFuncUniqueCheckPkRef.go b/internal/integration_tests/postgres/nulltypeprimitive/TimestampDefFuncUniqueCheckPkRef.go new file mode 100644 index 00000000..db425463 --- /dev/null +++ b/internal/integration_tests/postgres/nulltypeprimitive/TimestampDefFuncUniqueCheckPkRef.go @@ -0,0 +1,9 @@ +package dto + +import ( + "time" +) + +type TimestampDefFuncUniqueCheckPkRef struct { + TimestampDefFuncUniqueCheckPkRef time.Time `db:"timestamp_def_func_unique_check_pk_ref"` +} diff --git a/internal/integration_tests/postgres/nulltypeprimitive/TimestampNnPk.go b/internal/integration_tests/postgres/nulltypeprimitive/TimestampNnPk.go new file mode 100644 index 00000000..24d62061 --- /dev/null +++ b/internal/integration_tests/postgres/nulltypeprimitive/TimestampNnPk.go @@ -0,0 +1,9 @@ +package dto + +import ( + "time" +) + +type TimestampNnPk struct { + TimestampNnPk time.Time `db:"timestamp_nn_pk"` +} diff --git a/internal/integration_tests/postgres/nulltypeprimitive/TimestampNnUniqueCheckPk.go b/internal/integration_tests/postgres/nulltypeprimitive/TimestampNnUniqueCheckPk.go new file mode 100644 index 00000000..21ae8031 --- /dev/null +++ b/internal/integration_tests/postgres/nulltypeprimitive/TimestampNnUniqueCheckPk.go @@ -0,0 +1,9 @@ +package dto + +import ( + "time" +) + +type TimestampNnUniqueCheckPk struct { + TimestampNnUniqueCheckPk time.Time `db:"timestamp_nn_unique_check_pk"` +} diff --git a/internal/integration_tests/postgres/nulltypeprimitive/TimestampNnUniqueCheckPkRef.go b/internal/integration_tests/postgres/nulltypeprimitive/TimestampNnUniqueCheckPkRef.go new file mode 100644 index 00000000..1c20c377 --- /dev/null +++ b/internal/integration_tests/postgres/nulltypeprimitive/TimestampNnUniqueCheckPkRef.go @@ -0,0 +1,9 @@ +package dto + +import ( + "time" +) + +type TimestampNnUniqueCheckPkRef struct { + TimestampNnUniqueCheckPkRef time.Time `db:"timestamp_nn_unique_check_pk_ref"` +} diff --git a/internal/integration_tests/postgres/nulltypeprimitive/TimestampPk.go b/internal/integration_tests/postgres/nulltypeprimitive/TimestampPk.go new file mode 100644 index 00000000..5c10b8d9 --- /dev/null +++ b/internal/integration_tests/postgres/nulltypeprimitive/TimestampPk.go @@ -0,0 +1,9 @@ +package dto + +import ( + "time" +) + +type TimestampPk struct { + TimestampPk time.Time `db:"timestamp_pk"` +} diff --git a/internal/integration_tests/postgres/nulltypeprimitive/TimestampPkDefConst.go b/internal/integration_tests/postgres/nulltypeprimitive/TimestampPkDefConst.go new file mode 100644 index 00000000..1aae107b --- /dev/null +++ b/internal/integration_tests/postgres/nulltypeprimitive/TimestampPkDefConst.go @@ -0,0 +1,9 @@ +package dto + +import ( + "time" +) + +type TimestampPkDefConst struct { + TimestampPkDefConst time.Time `db:"timestamp_pk_def_const"` +} diff --git a/internal/integration_tests/postgres/nulltypeprimitive/TimestampPkDefFunc.go b/internal/integration_tests/postgres/nulltypeprimitive/TimestampPkDefFunc.go new file mode 100644 index 00000000..2e17c253 --- /dev/null +++ b/internal/integration_tests/postgres/nulltypeprimitive/TimestampPkDefFunc.go @@ -0,0 +1,9 @@ +package dto + +import ( + "time" +) + +type TimestampPkDefFunc struct { + TimestampPkDefFunc time.Time `db:"timestamp_pk_def_func"` +} diff --git a/internal/integration_tests/postgres/nulltypeprimitive/TimestampPkRef.go b/internal/integration_tests/postgres/nulltypeprimitive/TimestampPkRef.go new file mode 100644 index 00000000..c36c99c4 --- /dev/null +++ b/internal/integration_tests/postgres/nulltypeprimitive/TimestampPkRef.go @@ -0,0 +1,9 @@ +package dto + +import ( + "time" +) + +type TimestampPkRef struct { + TimestampPkRef time.Time `db:"timestamp_pk_ref"` +} diff --git a/internal/integration_tests/postgres/nulltypeprimitive/TimestampRef.go b/internal/integration_tests/postgres/nulltypeprimitive/TimestampRef.go new file mode 100644 index 00000000..44fbd7f5 --- /dev/null +++ b/internal/integration_tests/postgres/nulltypeprimitive/TimestampRef.go @@ -0,0 +1,9 @@ +package dto + +import ( + "time" +) + +type TimestampRef struct { + TimestampRef *time.Time `db:"timestamp_ref"` +} diff --git a/internal/integration_tests/postgres/nulltypeprimitive/TimestampUniqueCheckPk.go b/internal/integration_tests/postgres/nulltypeprimitive/TimestampUniqueCheckPk.go new file mode 100644 index 00000000..af5f08ff --- /dev/null +++ b/internal/integration_tests/postgres/nulltypeprimitive/TimestampUniqueCheckPk.go @@ -0,0 +1,9 @@ +package dto + +import ( + "time" +) + +type TimestampUniqueCheckPk struct { + TimestampUniqueCheckPk time.Time `db:"timestamp_unique_check_pk"` +} diff --git a/internal/integration_tests/postgres/nulltypeprimitive/TimestampUniqueCheckPkRef.go b/internal/integration_tests/postgres/nulltypeprimitive/TimestampUniqueCheckPkRef.go new file mode 100644 index 00000000..a3880c53 --- /dev/null +++ b/internal/integration_tests/postgres/nulltypeprimitive/TimestampUniqueCheckPkRef.go @@ -0,0 +1,9 @@ +package dto + +import ( + "time" +) + +type TimestampUniqueCheckPkRef struct { + TimestampUniqueCheckPkRef time.Time `db:"timestamp_unique_check_pk_ref"` +} diff --git a/internal/integration_tests/postgres/nulltypeprimitive/TimestampUniquePk.go b/internal/integration_tests/postgres/nulltypeprimitive/TimestampUniquePk.go new file mode 100644 index 00000000..6ef3e9ee --- /dev/null +++ b/internal/integration_tests/postgres/nulltypeprimitive/TimestampUniquePk.go @@ -0,0 +1,9 @@ +package dto + +import ( + "time" +) + +type TimestampUniquePk struct { + TimestampUniquePk time.Time `db:"timestamp_unique_pk"` +} diff --git a/internal/integration_tests/postgres/nulltypeprimitive/TimestampWithTimeZone.go b/internal/integration_tests/postgres/nulltypeprimitive/TimestampWithTimeZone.go new file mode 100644 index 00000000..6f671bd4 --- /dev/null +++ b/internal/integration_tests/postgres/nulltypeprimitive/TimestampWithTimeZone.go @@ -0,0 +1,33 @@ +package dto + +import ( + "time" +) + +type TimestampWithTimeZone struct { + TimestampWithTimeZone *time.Time `db:"timestamp_with_time_zone"` + TimestampWithTimeZoneNn time.Time `db:"timestamp_with_time_zone_nn"` + TimestampWithTimeZoneNnUnique time.Time `db:"timestamp_with_time_zone_nn_unique"` + TimestampWithTimeZoneNnCheck time.Time `db:"timestamp_with_time_zone_nn_check"` + TimestampWithTimeZoneNnRef time.Time `db:"timestamp_with_time_zone_nn_ref"` + TimestampWithTimeZoneNnDefConst time.Time `db:"timestamp_with_time_zone_nn_def_const"` + TimestampWithTimeZoneNnDefFunc time.Time `db:"timestamp_with_time_zone_nn_def_func"` + TimestampWithTimeZoneNnUniqueCheck time.Time `db:"timestamp_with_time_zone_nn_unique_check"` + TimestampWithTimeZoneUnique *time.Time `db:"timestamp_with_time_zone_unique"` + TimestampWithTimeZoneUniqueCheck *time.Time `db:"timestamp_with_time_zone_unique_check"` + TimestampWithTimeZoneUniqueRef *time.Time `db:"timestamp_with_time_zone_unique_ref"` + TimestampWithTimeZoneUniqueDefConst *time.Time `db:"timestamp_with_time_zone_unique_def_const"` + TimestampWithTimeZoneUniqueDefFunc *time.Time `db:"timestamp_with_time_zone_unique_def_func"` + TimestampWithTimeZoneCheck *time.Time `db:"timestamp_with_time_zone_check"` + TimestampWithTimeZoneCheckRef *time.Time `db:"timestamp_with_time_zone_check_ref"` + TimestampWithTimeZoneCheckDefConst *time.Time `db:"timestamp_with_time_zone_check_def_const"` + TimestampWithTimeZoneCheckDefFunc *time.Time `db:"timestamp_with_time_zone_check_def_func"` + TimestampWithTimeZoneRef *time.Time `db:"timestamp_with_time_zone_ref"` + TimestampWithTimeZoneRefDefConst *time.Time `db:"timestamp_with_time_zone_ref_def_const"` + TimestampWithTimeZoneRefDefFunc *time.Time `db:"timestamp_with_time_zone_ref_def_func"` + TimestampWithTimeZoneRefUniqueCheck *time.Time `db:"timestamp_with_time_zone_ref_unique_check"` + TimestampWithTimeZoneDefConst *time.Time `db:"timestamp_with_time_zone_def_const"` + TimestampWithTimeZoneDefConstUniqueCheck *time.Time `db:"timestamp_with_time_zone_def_const_unique_check"` + TimestampWithTimeZoneDefFunc *time.Time `db:"timestamp_with_time_zone_def_func"` + TimestampWithTimeZoneDefFuncUniqueCheck *time.Time `db:"timestamp_with_time_zone_def_func_unique_check"` +} diff --git a/internal/integration_tests/postgres/nulltypeprimitive/TimestampWithTimeZoneCheckPk.go b/internal/integration_tests/postgres/nulltypeprimitive/TimestampWithTimeZoneCheckPk.go new file mode 100644 index 00000000..652bd39d --- /dev/null +++ b/internal/integration_tests/postgres/nulltypeprimitive/TimestampWithTimeZoneCheckPk.go @@ -0,0 +1,9 @@ +package dto + +import ( + "time" +) + +type TimestampWithTimeZoneCheckPk struct { + TimestampWithTimeZoneCheckPk time.Time `db:"timestamp_with_time_zone_check_pk"` +} diff --git a/internal/integration_tests/postgres/nulltypeprimitive/TimestampWithTimeZoneDefConstUniqueCheckPk.go b/internal/integration_tests/postgres/nulltypeprimitive/TimestampWithTimeZoneDefConstUniqueCheckPk.go new file mode 100644 index 00000000..392065a1 --- /dev/null +++ b/internal/integration_tests/postgres/nulltypeprimitive/TimestampWithTimeZoneDefConstUniqueCheckPk.go @@ -0,0 +1,9 @@ +package dto + +import ( + "time" +) + +type TimestampWithTimeZoneDefConstUniqueCheckPk struct { + TimestampWithTimeZoneDefConstUniqueCheckPk time.Time `db:"timestamp_with_time_zone_def_const_unique_check_pk"` +} diff --git a/internal/integration_tests/postgres/nulltypeprimitive/TimestampWithTimeZoneDefConstUniqueCheckPkRef.go b/internal/integration_tests/postgres/nulltypeprimitive/TimestampWithTimeZoneDefConstUniqueCheckPkRef.go new file mode 100644 index 00000000..d63b2f24 --- /dev/null +++ b/internal/integration_tests/postgres/nulltypeprimitive/TimestampWithTimeZoneDefConstUniqueCheckPkRef.go @@ -0,0 +1,9 @@ +package dto + +import ( + "time" +) + +type TimestampWithTimeZoneDefConstUniqueCheckPkRef struct { + TimestampWithTimeZoneDefConstUniqueCheckPkRef time.Time `db:"timestamp_with_time_zone_def_const_unique_check_pk_ref"` +} diff --git a/internal/integration_tests/postgres/nulltypeprimitive/TimestampWithTimeZoneDefFuncUniqueCheckPk.go b/internal/integration_tests/postgres/nulltypeprimitive/TimestampWithTimeZoneDefFuncUniqueCheckPk.go new file mode 100644 index 00000000..cdbf5b5b --- /dev/null +++ b/internal/integration_tests/postgres/nulltypeprimitive/TimestampWithTimeZoneDefFuncUniqueCheckPk.go @@ -0,0 +1,9 @@ +package dto + +import ( + "time" +) + +type TimestampWithTimeZoneDefFuncUniqueCheckPk struct { + TimestampWithTimeZoneDefFuncUniqueCheckPk time.Time `db:"timestamp_with_time_zone_def_func_unique_check_pk"` +} diff --git a/internal/integration_tests/postgres/nulltypeprimitive/TimestampWithTimeZoneDefFuncUniqueCheckPkRef.go b/internal/integration_tests/postgres/nulltypeprimitive/TimestampWithTimeZoneDefFuncUniqueCheckPkRef.go new file mode 100644 index 00000000..7057fee5 --- /dev/null +++ b/internal/integration_tests/postgres/nulltypeprimitive/TimestampWithTimeZoneDefFuncUniqueCheckPkRef.go @@ -0,0 +1,9 @@ +package dto + +import ( + "time" +) + +type TimestampWithTimeZoneDefFuncUniqueCheckPkRef struct { + TimestampWithTimeZoneDefFuncUniqueCheckPkRef time.Time `db:"timestamp_with_time_zone_def_func_unique_check_pk_ref"` +} diff --git a/internal/integration_tests/postgres/nulltypeprimitive/TimestampWithTimeZoneNnPk.go b/internal/integration_tests/postgres/nulltypeprimitive/TimestampWithTimeZoneNnPk.go new file mode 100644 index 00000000..5f52f0f9 --- /dev/null +++ b/internal/integration_tests/postgres/nulltypeprimitive/TimestampWithTimeZoneNnPk.go @@ -0,0 +1,9 @@ +package dto + +import ( + "time" +) + +type TimestampWithTimeZoneNnPk struct { + TimestampWithTimeZoneNnPk time.Time `db:"timestamp_with_time_zone_nn_pk"` +} diff --git a/internal/integration_tests/postgres/nulltypeprimitive/TimestampWithTimeZoneNnUniqueCheckPk.go b/internal/integration_tests/postgres/nulltypeprimitive/TimestampWithTimeZoneNnUniqueCheckPk.go new file mode 100644 index 00000000..2bf18ac6 --- /dev/null +++ b/internal/integration_tests/postgres/nulltypeprimitive/TimestampWithTimeZoneNnUniqueCheckPk.go @@ -0,0 +1,9 @@ +package dto + +import ( + "time" +) + +type TimestampWithTimeZoneNnUniqueCheckPk struct { + TimestampWithTimeZoneNnUniqueCheckPk time.Time `db:"timestamp_with_time_zone_nn_unique_check_pk"` +} diff --git a/internal/integration_tests/postgres/nulltypeprimitive/TimestampWithTimeZoneNnUniqueCheckPkRef.go b/internal/integration_tests/postgres/nulltypeprimitive/TimestampWithTimeZoneNnUniqueCheckPkRef.go new file mode 100644 index 00000000..e1bac907 --- /dev/null +++ b/internal/integration_tests/postgres/nulltypeprimitive/TimestampWithTimeZoneNnUniqueCheckPkRef.go @@ -0,0 +1,9 @@ +package dto + +import ( + "time" +) + +type TimestampWithTimeZoneNnUniqueCheckPkRef struct { + TimestampWithTimeZoneNnUniqueCheckPkRef time.Time `db:"timestamp_with_time_zone_nn_unique_check_pk_ref"` +} diff --git a/internal/integration_tests/postgres/nulltypeprimitive/TimestampWithTimeZonePk.go b/internal/integration_tests/postgres/nulltypeprimitive/TimestampWithTimeZonePk.go new file mode 100644 index 00000000..15c05bd6 --- /dev/null +++ b/internal/integration_tests/postgres/nulltypeprimitive/TimestampWithTimeZonePk.go @@ -0,0 +1,9 @@ +package dto + +import ( + "time" +) + +type TimestampWithTimeZonePk struct { + TimestampWithTimeZonePk time.Time `db:"timestamp_with_time_zone_pk"` +} diff --git a/internal/integration_tests/postgres/nulltypeprimitive/TimestampWithTimeZonePkDefConst.go b/internal/integration_tests/postgres/nulltypeprimitive/TimestampWithTimeZonePkDefConst.go new file mode 100644 index 00000000..18078b70 --- /dev/null +++ b/internal/integration_tests/postgres/nulltypeprimitive/TimestampWithTimeZonePkDefConst.go @@ -0,0 +1,9 @@ +package dto + +import ( + "time" +) + +type TimestampWithTimeZonePkDefConst struct { + TimestampWithTimeZonePkDefConst time.Time `db:"timestamp_with_time_zone_pk_def_const"` +} diff --git a/internal/integration_tests/postgres/nulltypeprimitive/TimestampWithTimeZonePkDefFunc.go b/internal/integration_tests/postgres/nulltypeprimitive/TimestampWithTimeZonePkDefFunc.go new file mode 100644 index 00000000..f83a72a7 --- /dev/null +++ b/internal/integration_tests/postgres/nulltypeprimitive/TimestampWithTimeZonePkDefFunc.go @@ -0,0 +1,9 @@ +package dto + +import ( + "time" +) + +type TimestampWithTimeZonePkDefFunc struct { + TimestampWithTimeZonePkDefFunc time.Time `db:"timestamp_with_time_zone_pk_def_func"` +} diff --git a/internal/integration_tests/postgres/nulltypeprimitive/TimestampWithTimeZonePkRef.go b/internal/integration_tests/postgres/nulltypeprimitive/TimestampWithTimeZonePkRef.go new file mode 100644 index 00000000..d01d43bd --- /dev/null +++ b/internal/integration_tests/postgres/nulltypeprimitive/TimestampWithTimeZonePkRef.go @@ -0,0 +1,9 @@ +package dto + +import ( + "time" +) + +type TimestampWithTimeZonePkRef struct { + TimestampWithTimeZonePkRef time.Time `db:"timestamp_with_time_zone_pk_ref"` +} diff --git a/internal/integration_tests/postgres/nulltypeprimitive/TimestampWithTimeZoneRef.go b/internal/integration_tests/postgres/nulltypeprimitive/TimestampWithTimeZoneRef.go new file mode 100644 index 00000000..403bdcda --- /dev/null +++ b/internal/integration_tests/postgres/nulltypeprimitive/TimestampWithTimeZoneRef.go @@ -0,0 +1,9 @@ +package dto + +import ( + "time" +) + +type TimestampWithTimeZoneRef struct { + TimestampWithTimeZoneRef *time.Time `db:"timestamp_with_time_zone_ref"` +} diff --git a/internal/integration_tests/postgres/nulltypeprimitive/TimestampWithTimeZoneUniqueCheckPk.go b/internal/integration_tests/postgres/nulltypeprimitive/TimestampWithTimeZoneUniqueCheckPk.go new file mode 100644 index 00000000..6702c211 --- /dev/null +++ b/internal/integration_tests/postgres/nulltypeprimitive/TimestampWithTimeZoneUniqueCheckPk.go @@ -0,0 +1,9 @@ +package dto + +import ( + "time" +) + +type TimestampWithTimeZoneUniqueCheckPk struct { + TimestampWithTimeZoneUniqueCheckPk time.Time `db:"timestamp_with_time_zone_unique_check_pk"` +} diff --git a/internal/integration_tests/postgres/nulltypeprimitive/TimestampWithTimeZoneUniqueCheckPkRef.go b/internal/integration_tests/postgres/nulltypeprimitive/TimestampWithTimeZoneUniqueCheckPkRef.go new file mode 100644 index 00000000..d23aa821 --- /dev/null +++ b/internal/integration_tests/postgres/nulltypeprimitive/TimestampWithTimeZoneUniqueCheckPkRef.go @@ -0,0 +1,9 @@ +package dto + +import ( + "time" +) + +type TimestampWithTimeZoneUniqueCheckPkRef struct { + TimestampWithTimeZoneUniqueCheckPkRef time.Time `db:"timestamp_with_time_zone_unique_check_pk_ref"` +} diff --git a/internal/integration_tests/postgres/nulltypeprimitive/TimestampWithTimeZoneUniquePk.go b/internal/integration_tests/postgres/nulltypeprimitive/TimestampWithTimeZoneUniquePk.go new file mode 100644 index 00000000..86045e55 --- /dev/null +++ b/internal/integration_tests/postgres/nulltypeprimitive/TimestampWithTimeZoneUniquePk.go @@ -0,0 +1,9 @@ +package dto + +import ( + "time" +) + +type TimestampWithTimeZoneUniquePk struct { + TimestampWithTimeZoneUniquePk time.Time `db:"timestamp_with_time_zone_unique_pk"` +} diff --git a/internal/integration_tests/postgres/nulltypeprimitive/TimestampWithoutTimeZone.go b/internal/integration_tests/postgres/nulltypeprimitive/TimestampWithoutTimeZone.go new file mode 100644 index 00000000..e4719b3b --- /dev/null +++ b/internal/integration_tests/postgres/nulltypeprimitive/TimestampWithoutTimeZone.go @@ -0,0 +1,33 @@ +package dto + +import ( + "time" +) + +type TimestampWithoutTimeZone struct { + TimestampWithoutTimeZone *time.Time `db:"timestamp_without_time_zone"` + TimestampWithoutTimeZoneNn time.Time `db:"timestamp_without_time_zone_nn"` + TimestampWithoutTimeZoneNnUnique time.Time `db:"timestamp_without_time_zone_nn_unique"` + TimestampWithoutTimeZoneNnCheck time.Time `db:"timestamp_without_time_zone_nn_check"` + TimestampWithoutTimeZoneNnRef time.Time `db:"timestamp_without_time_zone_nn_ref"` + TimestampWithoutTimeZoneNnDefConst time.Time `db:"timestamp_without_time_zone_nn_def_const"` + TimestampWithoutTimeZoneNnDefFunc time.Time `db:"timestamp_without_time_zone_nn_def_func"` + TimestampWithoutTimeZoneNnUniqueCheck time.Time `db:"timestamp_without_time_zone_nn_unique_check"` + TimestampWithoutTimeZoneUnique *time.Time `db:"timestamp_without_time_zone_unique"` + TimestampWithoutTimeZoneUniqueCheck *time.Time `db:"timestamp_without_time_zone_unique_check"` + TimestampWithoutTimeZoneUniqueRef *time.Time `db:"timestamp_without_time_zone_unique_ref"` + TimestampWithoutTimeZoneUniqueDefConst *time.Time `db:"timestamp_without_time_zone_unique_def_const"` + TimestampWithoutTimeZoneUniqueDefFunc *time.Time `db:"timestamp_without_time_zone_unique_def_func"` + TimestampWithoutTimeZoneCheck *time.Time `db:"timestamp_without_time_zone_check"` + TimestampWithoutTimeZoneCheckRef *time.Time `db:"timestamp_without_time_zone_check_ref"` + TimestampWithoutTimeZoneCheckDefConst *time.Time `db:"timestamp_without_time_zone_check_def_const"` + TimestampWithoutTimeZoneCheckDefFunc *time.Time `db:"timestamp_without_time_zone_check_def_func"` + TimestampWithoutTimeZoneRef *time.Time `db:"timestamp_without_time_zone_ref"` + TimestampWithoutTimeZoneRefDefConst *time.Time `db:"timestamp_without_time_zone_ref_def_const"` + TimestampWithoutTimeZoneRefDefFunc *time.Time `db:"timestamp_without_time_zone_ref_def_func"` + TimestampWithoutTimeZoneRefUniqueCheck *time.Time `db:"timestamp_without_time_zone_ref_unique_check"` + TimestampWithoutTimeZoneDefConst *time.Time `db:"timestamp_without_time_zone_def_const"` + TimestampWithoutTimeZoneDefConstUniqueCheck *time.Time `db:"timestamp_without_time_zone_def_const_unique_check"` + TimestampWithoutTimeZoneDefFunc *time.Time `db:"timestamp_without_time_zone_def_func"` + TimestampWithoutTimeZoneDefFuncUniqueCheck *time.Time `db:"timestamp_without_time_zone_def_func_unique_check"` +} diff --git a/internal/integration_tests/postgres/nulltypeprimitive/TimestampWithoutTimeZoneCheckPk.go b/internal/integration_tests/postgres/nulltypeprimitive/TimestampWithoutTimeZoneCheckPk.go new file mode 100644 index 00000000..6595a90d --- /dev/null +++ b/internal/integration_tests/postgres/nulltypeprimitive/TimestampWithoutTimeZoneCheckPk.go @@ -0,0 +1,9 @@ +package dto + +import ( + "time" +) + +type TimestampWithoutTimeZoneCheckPk struct { + TimestampWithoutTimeZoneCheckPk time.Time `db:"timestamp_without_time_zone_check_pk"` +} diff --git a/internal/integration_tests/postgres/nulltypeprimitive/TimestampWithoutTimeZoneDefConstUniqueCheckPk.go b/internal/integration_tests/postgres/nulltypeprimitive/TimestampWithoutTimeZoneDefConstUniqueCheckPk.go new file mode 100644 index 00000000..67f7dd3d --- /dev/null +++ b/internal/integration_tests/postgres/nulltypeprimitive/TimestampWithoutTimeZoneDefConstUniqueCheckPk.go @@ -0,0 +1,9 @@ +package dto + +import ( + "time" +) + +type TimestampWithoutTimeZoneDefConstUniqueCheckPk struct { + TimestampWithoutTimeZoneDefConstUniqueCheckPk time.Time `db:"timestamp_without_time_zone_def_const_unique_check_pk"` +} diff --git a/internal/integration_tests/postgres/nulltypeprimitive/TimestampWithoutTimeZoneDefConstUniqueCheckPkRef.go b/internal/integration_tests/postgres/nulltypeprimitive/TimestampWithoutTimeZoneDefConstUniqueCheckPkRef.go new file mode 100644 index 00000000..9cb78a40 --- /dev/null +++ b/internal/integration_tests/postgres/nulltypeprimitive/TimestampWithoutTimeZoneDefConstUniqueCheckPkRef.go @@ -0,0 +1,9 @@ +package dto + +import ( + "time" +) + +type TimestampWithoutTimeZoneDefConstUniqueCheckPkRef struct { + TimestampWithoutTimeZoneDefConstUniqueCheckPkRef time.Time `db:"timestamp_without_time_zone_def_const_unique_check_pk_ref"` +} diff --git a/internal/integration_tests/postgres/nulltypeprimitive/TimestampWithoutTimeZoneDefFuncUniqueCheckPk.go b/internal/integration_tests/postgres/nulltypeprimitive/TimestampWithoutTimeZoneDefFuncUniqueCheckPk.go new file mode 100644 index 00000000..d656400c --- /dev/null +++ b/internal/integration_tests/postgres/nulltypeprimitive/TimestampWithoutTimeZoneDefFuncUniqueCheckPk.go @@ -0,0 +1,9 @@ +package dto + +import ( + "time" +) + +type TimestampWithoutTimeZoneDefFuncUniqueCheckPk struct { + TimestampWithoutTimeZoneDefFuncUniqueCheckPk time.Time `db:"timestamp_without_time_zone_def_func_unique_check_pk"` +} diff --git a/internal/integration_tests/postgres/nulltypeprimitive/TimestampWithoutTimeZoneDefFuncUniqueCheckPkRef.go b/internal/integration_tests/postgres/nulltypeprimitive/TimestampWithoutTimeZoneDefFuncUniqueCheckPkRef.go new file mode 100644 index 00000000..2868f779 --- /dev/null +++ b/internal/integration_tests/postgres/nulltypeprimitive/TimestampWithoutTimeZoneDefFuncUniqueCheckPkRef.go @@ -0,0 +1,9 @@ +package dto + +import ( + "time" +) + +type TimestampWithoutTimeZoneDefFuncUniqueCheckPkRef struct { + TimestampWithoutTimeZoneDefFuncUniqueCheckPkRef time.Time `db:"timestamp_without_time_zone_def_func_unique_check_pk_ref"` +} diff --git a/internal/integration_tests/postgres/nulltypeprimitive/TimestampWithoutTimeZoneNnPk.go b/internal/integration_tests/postgres/nulltypeprimitive/TimestampWithoutTimeZoneNnPk.go new file mode 100644 index 00000000..21aca913 --- /dev/null +++ b/internal/integration_tests/postgres/nulltypeprimitive/TimestampWithoutTimeZoneNnPk.go @@ -0,0 +1,9 @@ +package dto + +import ( + "time" +) + +type TimestampWithoutTimeZoneNnPk struct { + TimestampWithoutTimeZoneNnPk time.Time `db:"timestamp_without_time_zone_nn_pk"` +} diff --git a/internal/integration_tests/postgres/nulltypeprimitive/TimestampWithoutTimeZoneNnUniqueCheckPk.go b/internal/integration_tests/postgres/nulltypeprimitive/TimestampWithoutTimeZoneNnUniqueCheckPk.go new file mode 100644 index 00000000..a4a1b3c5 --- /dev/null +++ b/internal/integration_tests/postgres/nulltypeprimitive/TimestampWithoutTimeZoneNnUniqueCheckPk.go @@ -0,0 +1,9 @@ +package dto + +import ( + "time" +) + +type TimestampWithoutTimeZoneNnUniqueCheckPk struct { + TimestampWithoutTimeZoneNnUniqueCheckPk time.Time `db:"timestamp_without_time_zone_nn_unique_check_pk"` +} diff --git a/internal/integration_tests/postgres/nulltypeprimitive/TimestampWithoutTimeZoneNnUniqueCheckPkRef.go b/internal/integration_tests/postgres/nulltypeprimitive/TimestampWithoutTimeZoneNnUniqueCheckPkRef.go new file mode 100644 index 00000000..2de8d6e4 --- /dev/null +++ b/internal/integration_tests/postgres/nulltypeprimitive/TimestampWithoutTimeZoneNnUniqueCheckPkRef.go @@ -0,0 +1,9 @@ +package dto + +import ( + "time" +) + +type TimestampWithoutTimeZoneNnUniqueCheckPkRef struct { + TimestampWithoutTimeZoneNnUniqueCheckPkRef time.Time `db:"timestamp_without_time_zone_nn_unique_check_pk_ref"` +} diff --git a/internal/integration_tests/postgres/nulltypeprimitive/TimestampWithoutTimeZonePk.go b/internal/integration_tests/postgres/nulltypeprimitive/TimestampWithoutTimeZonePk.go new file mode 100644 index 00000000..f76e1853 --- /dev/null +++ b/internal/integration_tests/postgres/nulltypeprimitive/TimestampWithoutTimeZonePk.go @@ -0,0 +1,9 @@ +package dto + +import ( + "time" +) + +type TimestampWithoutTimeZonePk struct { + TimestampWithoutTimeZonePk time.Time `db:"timestamp_without_time_zone_pk"` +} diff --git a/internal/integration_tests/postgres/nulltypeprimitive/TimestampWithoutTimeZonePkDefConst.go b/internal/integration_tests/postgres/nulltypeprimitive/TimestampWithoutTimeZonePkDefConst.go new file mode 100644 index 00000000..993f1dd5 --- /dev/null +++ b/internal/integration_tests/postgres/nulltypeprimitive/TimestampWithoutTimeZonePkDefConst.go @@ -0,0 +1,9 @@ +package dto + +import ( + "time" +) + +type TimestampWithoutTimeZonePkDefConst struct { + TimestampWithoutTimeZonePkDefConst time.Time `db:"timestamp_without_time_zone_pk_def_const"` +} diff --git a/internal/integration_tests/postgres/nulltypeprimitive/TimestampWithoutTimeZonePkDefFunc.go b/internal/integration_tests/postgres/nulltypeprimitive/TimestampWithoutTimeZonePkDefFunc.go new file mode 100644 index 00000000..e859ae54 --- /dev/null +++ b/internal/integration_tests/postgres/nulltypeprimitive/TimestampWithoutTimeZonePkDefFunc.go @@ -0,0 +1,9 @@ +package dto + +import ( + "time" +) + +type TimestampWithoutTimeZonePkDefFunc struct { + TimestampWithoutTimeZonePkDefFunc time.Time `db:"timestamp_without_time_zone_pk_def_func"` +} diff --git a/internal/integration_tests/postgres/nulltypeprimitive/TimestampWithoutTimeZonePkRef.go b/internal/integration_tests/postgres/nulltypeprimitive/TimestampWithoutTimeZonePkRef.go new file mode 100644 index 00000000..eefa80d7 --- /dev/null +++ b/internal/integration_tests/postgres/nulltypeprimitive/TimestampWithoutTimeZonePkRef.go @@ -0,0 +1,9 @@ +package dto + +import ( + "time" +) + +type TimestampWithoutTimeZonePkRef struct { + TimestampWithoutTimeZonePkRef time.Time `db:"timestamp_without_time_zone_pk_ref"` +} diff --git a/internal/integration_tests/postgres/nulltypeprimitive/TimestampWithoutTimeZoneRef.go b/internal/integration_tests/postgres/nulltypeprimitive/TimestampWithoutTimeZoneRef.go new file mode 100644 index 00000000..217e973a --- /dev/null +++ b/internal/integration_tests/postgres/nulltypeprimitive/TimestampWithoutTimeZoneRef.go @@ -0,0 +1,9 @@ +package dto + +import ( + "time" +) + +type TimestampWithoutTimeZoneRef struct { + TimestampWithoutTimeZoneRef *time.Time `db:"timestamp_without_time_zone_ref"` +} diff --git a/internal/integration_tests/postgres/nulltypeprimitive/TimestampWithoutTimeZoneUniqueCheckPk.go b/internal/integration_tests/postgres/nulltypeprimitive/TimestampWithoutTimeZoneUniqueCheckPk.go new file mode 100644 index 00000000..9d023d15 --- /dev/null +++ b/internal/integration_tests/postgres/nulltypeprimitive/TimestampWithoutTimeZoneUniqueCheckPk.go @@ -0,0 +1,9 @@ +package dto + +import ( + "time" +) + +type TimestampWithoutTimeZoneUniqueCheckPk struct { + TimestampWithoutTimeZoneUniqueCheckPk time.Time `db:"timestamp_without_time_zone_unique_check_pk"` +} diff --git a/internal/integration_tests/postgres/nulltypeprimitive/TimestampWithoutTimeZoneUniqueCheckPkRef.go b/internal/integration_tests/postgres/nulltypeprimitive/TimestampWithoutTimeZoneUniqueCheckPkRef.go new file mode 100644 index 00000000..3603a787 --- /dev/null +++ b/internal/integration_tests/postgres/nulltypeprimitive/TimestampWithoutTimeZoneUniqueCheckPkRef.go @@ -0,0 +1,9 @@ +package dto + +import ( + "time" +) + +type TimestampWithoutTimeZoneUniqueCheckPkRef struct { + TimestampWithoutTimeZoneUniqueCheckPkRef time.Time `db:"timestamp_without_time_zone_unique_check_pk_ref"` +} diff --git a/internal/integration_tests/postgres/nulltypeprimitive/TimestampWithoutTimeZoneUniquePk.go b/internal/integration_tests/postgres/nulltypeprimitive/TimestampWithoutTimeZoneUniquePk.go new file mode 100644 index 00000000..d55e799a --- /dev/null +++ b/internal/integration_tests/postgres/nulltypeprimitive/TimestampWithoutTimeZoneUniquePk.go @@ -0,0 +1,9 @@ +package dto + +import ( + "time" +) + +type TimestampWithoutTimeZoneUniquePk struct { + TimestampWithoutTimeZoneUniquePk time.Time `db:"timestamp_without_time_zone_unique_pk"` +} diff --git a/internal/integration_tests/postgres/nulltypeprimitive/Timestamptz.go b/internal/integration_tests/postgres/nulltypeprimitive/Timestamptz.go new file mode 100644 index 00000000..e6e4396f --- /dev/null +++ b/internal/integration_tests/postgres/nulltypeprimitive/Timestamptz.go @@ -0,0 +1,33 @@ +package dto + +import ( + "time" +) + +type Timestamptz struct { + Timestamptz *time.Time `db:"timestamptz"` + TimestamptzNn time.Time `db:"timestamptz_nn"` + TimestamptzNnUnique time.Time `db:"timestamptz_nn_unique"` + TimestamptzNnCheck time.Time `db:"timestamptz_nn_check"` + TimestamptzNnRef time.Time `db:"timestamptz_nn_ref"` + TimestamptzNnDefConst time.Time `db:"timestamptz_nn_def_const"` + TimestamptzNnDefFunc time.Time `db:"timestamptz_nn_def_func"` + TimestamptzNnUniqueCheck time.Time `db:"timestamptz_nn_unique_check"` + TimestamptzUnique *time.Time `db:"timestamptz_unique"` + TimestamptzUniqueCheck *time.Time `db:"timestamptz_unique_check"` + TimestamptzUniqueRef *time.Time `db:"timestamptz_unique_ref"` + TimestamptzUniqueDefConst *time.Time `db:"timestamptz_unique_def_const"` + TimestamptzUniqueDefFunc *time.Time `db:"timestamptz_unique_def_func"` + TimestamptzCheck *time.Time `db:"timestamptz_check"` + TimestamptzCheckRef *time.Time `db:"timestamptz_check_ref"` + TimestamptzCheckDefConst *time.Time `db:"timestamptz_check_def_const"` + TimestamptzCheckDefFunc *time.Time `db:"timestamptz_check_def_func"` + TimestamptzRef *time.Time `db:"timestamptz_ref"` + TimestamptzRefDefConst *time.Time `db:"timestamptz_ref_def_const"` + TimestamptzRefDefFunc *time.Time `db:"timestamptz_ref_def_func"` + TimestamptzRefUniqueCheck *time.Time `db:"timestamptz_ref_unique_check"` + TimestamptzDefConst *time.Time `db:"timestamptz_def_const"` + TimestamptzDefConstUniqueCheck *time.Time `db:"timestamptz_def_const_unique_check"` + TimestamptzDefFunc *time.Time `db:"timestamptz_def_func"` + TimestamptzDefFuncUniqueCheck *time.Time `db:"timestamptz_def_func_unique_check"` +} diff --git a/internal/integration_tests/postgres/nulltypeprimitive/TimestamptzCheckPk.go b/internal/integration_tests/postgres/nulltypeprimitive/TimestamptzCheckPk.go new file mode 100644 index 00000000..b5cc44a9 --- /dev/null +++ b/internal/integration_tests/postgres/nulltypeprimitive/TimestamptzCheckPk.go @@ -0,0 +1,9 @@ +package dto + +import ( + "time" +) + +type TimestamptzCheckPk struct { + TimestamptzCheckPk time.Time `db:"timestamptz_check_pk"` +} diff --git a/internal/integration_tests/postgres/nulltypeprimitive/TimestamptzDefConstUniqueCheckPk.go b/internal/integration_tests/postgres/nulltypeprimitive/TimestamptzDefConstUniqueCheckPk.go new file mode 100644 index 00000000..ca479c07 --- /dev/null +++ b/internal/integration_tests/postgres/nulltypeprimitive/TimestamptzDefConstUniqueCheckPk.go @@ -0,0 +1,9 @@ +package dto + +import ( + "time" +) + +type TimestamptzDefConstUniqueCheckPk struct { + TimestamptzDefConstUniqueCheckPk time.Time `db:"timestamptz_def_const_unique_check_pk"` +} diff --git a/internal/integration_tests/postgres/nulltypeprimitive/TimestamptzDefConstUniqueCheckPkRef.go b/internal/integration_tests/postgres/nulltypeprimitive/TimestamptzDefConstUniqueCheckPkRef.go new file mode 100644 index 00000000..52a98804 --- /dev/null +++ b/internal/integration_tests/postgres/nulltypeprimitive/TimestamptzDefConstUniqueCheckPkRef.go @@ -0,0 +1,9 @@ +package dto + +import ( + "time" +) + +type TimestamptzDefConstUniqueCheckPkRef struct { + TimestamptzDefConstUniqueCheckPkRef time.Time `db:"timestamptz_def_const_unique_check_pk_ref"` +} diff --git a/internal/integration_tests/postgres/nulltypeprimitive/TimestamptzDefFuncUniqueCheckPk.go b/internal/integration_tests/postgres/nulltypeprimitive/TimestamptzDefFuncUniqueCheckPk.go new file mode 100644 index 00000000..aac32a60 --- /dev/null +++ b/internal/integration_tests/postgres/nulltypeprimitive/TimestamptzDefFuncUniqueCheckPk.go @@ -0,0 +1,9 @@ +package dto + +import ( + "time" +) + +type TimestamptzDefFuncUniqueCheckPk struct { + TimestamptzDefFuncUniqueCheckPk time.Time `db:"timestamptz_def_func_unique_check_pk"` +} diff --git a/internal/integration_tests/postgres/nulltypeprimitive/TimestamptzDefFuncUniqueCheckPkRef.go b/internal/integration_tests/postgres/nulltypeprimitive/TimestamptzDefFuncUniqueCheckPkRef.go new file mode 100644 index 00000000..80a988ef --- /dev/null +++ b/internal/integration_tests/postgres/nulltypeprimitive/TimestamptzDefFuncUniqueCheckPkRef.go @@ -0,0 +1,9 @@ +package dto + +import ( + "time" +) + +type TimestamptzDefFuncUniqueCheckPkRef struct { + TimestamptzDefFuncUniqueCheckPkRef time.Time `db:"timestamptz_def_func_unique_check_pk_ref"` +} diff --git a/internal/integration_tests/postgres/nulltypeprimitive/TimestamptzNnPk.go b/internal/integration_tests/postgres/nulltypeprimitive/TimestamptzNnPk.go new file mode 100644 index 00000000..56a17109 --- /dev/null +++ b/internal/integration_tests/postgres/nulltypeprimitive/TimestamptzNnPk.go @@ -0,0 +1,9 @@ +package dto + +import ( + "time" +) + +type TimestamptzNnPk struct { + TimestamptzNnPk time.Time `db:"timestamptz_nn_pk"` +} diff --git a/internal/integration_tests/postgres/nulltypeprimitive/TimestamptzNnUniqueCheckPk.go b/internal/integration_tests/postgres/nulltypeprimitive/TimestamptzNnUniqueCheckPk.go new file mode 100644 index 00000000..d1bf3b6c --- /dev/null +++ b/internal/integration_tests/postgres/nulltypeprimitive/TimestamptzNnUniqueCheckPk.go @@ -0,0 +1,9 @@ +package dto + +import ( + "time" +) + +type TimestamptzNnUniqueCheckPk struct { + TimestamptzNnUniqueCheckPk time.Time `db:"timestamptz_nn_unique_check_pk"` +} diff --git a/internal/integration_tests/postgres/nulltypeprimitive/TimestamptzNnUniqueCheckPkRef.go b/internal/integration_tests/postgres/nulltypeprimitive/TimestamptzNnUniqueCheckPkRef.go new file mode 100644 index 00000000..1c9746e0 --- /dev/null +++ b/internal/integration_tests/postgres/nulltypeprimitive/TimestamptzNnUniqueCheckPkRef.go @@ -0,0 +1,9 @@ +package dto + +import ( + "time" +) + +type TimestamptzNnUniqueCheckPkRef struct { + TimestamptzNnUniqueCheckPkRef time.Time `db:"timestamptz_nn_unique_check_pk_ref"` +} diff --git a/internal/integration_tests/postgres/nulltypeprimitive/TimestamptzPk.go b/internal/integration_tests/postgres/nulltypeprimitive/TimestamptzPk.go new file mode 100644 index 00000000..83559720 --- /dev/null +++ b/internal/integration_tests/postgres/nulltypeprimitive/TimestamptzPk.go @@ -0,0 +1,9 @@ +package dto + +import ( + "time" +) + +type TimestamptzPk struct { + TimestamptzPk time.Time `db:"timestamptz_pk"` +} diff --git a/internal/integration_tests/postgres/nulltypeprimitive/TimestamptzPkDefConst.go b/internal/integration_tests/postgres/nulltypeprimitive/TimestamptzPkDefConst.go new file mode 100644 index 00000000..bc9e62d4 --- /dev/null +++ b/internal/integration_tests/postgres/nulltypeprimitive/TimestamptzPkDefConst.go @@ -0,0 +1,9 @@ +package dto + +import ( + "time" +) + +type TimestamptzPkDefConst struct { + TimestamptzPkDefConst time.Time `db:"timestamptz_pk_def_const"` +} diff --git a/internal/integration_tests/postgres/nulltypeprimitive/TimestamptzPkDefFunc.go b/internal/integration_tests/postgres/nulltypeprimitive/TimestamptzPkDefFunc.go new file mode 100644 index 00000000..5951f4f2 --- /dev/null +++ b/internal/integration_tests/postgres/nulltypeprimitive/TimestamptzPkDefFunc.go @@ -0,0 +1,9 @@ +package dto + +import ( + "time" +) + +type TimestamptzPkDefFunc struct { + TimestamptzPkDefFunc time.Time `db:"timestamptz_pk_def_func"` +} diff --git a/internal/integration_tests/postgres/nulltypeprimitive/TimestamptzPkRef.go b/internal/integration_tests/postgres/nulltypeprimitive/TimestamptzPkRef.go new file mode 100644 index 00000000..3b5257f4 --- /dev/null +++ b/internal/integration_tests/postgres/nulltypeprimitive/TimestamptzPkRef.go @@ -0,0 +1,9 @@ +package dto + +import ( + "time" +) + +type TimestamptzPkRef struct { + TimestamptzPkRef time.Time `db:"timestamptz_pk_ref"` +} diff --git a/internal/integration_tests/postgres/nulltypeprimitive/TimestamptzRef.go b/internal/integration_tests/postgres/nulltypeprimitive/TimestamptzRef.go new file mode 100644 index 00000000..3986816d --- /dev/null +++ b/internal/integration_tests/postgres/nulltypeprimitive/TimestamptzRef.go @@ -0,0 +1,9 @@ +package dto + +import ( + "time" +) + +type TimestamptzRef struct { + TimestamptzRef *time.Time `db:"timestamptz_ref"` +} diff --git a/internal/integration_tests/postgres/nulltypeprimitive/TimestamptzUniqueCheckPk.go b/internal/integration_tests/postgres/nulltypeprimitive/TimestamptzUniqueCheckPk.go new file mode 100644 index 00000000..3b8ea74f --- /dev/null +++ b/internal/integration_tests/postgres/nulltypeprimitive/TimestamptzUniqueCheckPk.go @@ -0,0 +1,9 @@ +package dto + +import ( + "time" +) + +type TimestamptzUniqueCheckPk struct { + TimestamptzUniqueCheckPk time.Time `db:"timestamptz_unique_check_pk"` +} diff --git a/internal/integration_tests/postgres/nulltypeprimitive/TimestamptzUniqueCheckPkRef.go b/internal/integration_tests/postgres/nulltypeprimitive/TimestamptzUniqueCheckPkRef.go new file mode 100644 index 00000000..7e9ff3c8 --- /dev/null +++ b/internal/integration_tests/postgres/nulltypeprimitive/TimestamptzUniqueCheckPkRef.go @@ -0,0 +1,9 @@ +package dto + +import ( + "time" +) + +type TimestamptzUniqueCheckPkRef struct { + TimestamptzUniqueCheckPkRef time.Time `db:"timestamptz_unique_check_pk_ref"` +} diff --git a/internal/integration_tests/postgres/nulltypeprimitive/TimestamptzUniquePk.go b/internal/integration_tests/postgres/nulltypeprimitive/TimestamptzUniquePk.go new file mode 100644 index 00000000..fc8d2b5a --- /dev/null +++ b/internal/integration_tests/postgres/nulltypeprimitive/TimestamptzUniquePk.go @@ -0,0 +1,9 @@ +package dto + +import ( + "time" +) + +type TimestamptzUniquePk struct { + TimestamptzUniquePk time.Time `db:"timestamptz_unique_pk"` +} diff --git a/internal/integration_tests/postgres/nulltypeprimitive/Varchar.go b/internal/integration_tests/postgres/nulltypeprimitive/Varchar.go new file mode 100644 index 00000000..ecc2d9fb --- /dev/null +++ b/internal/integration_tests/postgres/nulltypeprimitive/Varchar.go @@ -0,0 +1,31 @@ +package dto + +type Varchar struct { + Varchar *string `db:"varchar"` + VarcharCap *string `db:"varchar_cap"` + VarcharNn string `db:"varchar_nn"` + VarcharNnUnique string `db:"varchar_nn_unique"` + VarcharNnCheckCmp string `db:"varchar_nn_check_cmp"` + VarcharNnCheckFn string `db:"varchar_nn_check_fn"` + VarcharNnRef string `db:"varchar_nn_ref"` + VarcharNnDefConst string `db:"varchar_nn_def_const"` + VarcharNnDefFunc string `db:"varchar_nn_def_func"` + VarcharNnUniqueCheck string `db:"varchar_nn_unique_check"` + VarcharUnique *string `db:"varchar_unique"` + VarcharUniqueCheck *string `db:"varchar_unique_check"` + VarcharUniqueRef *string `db:"varchar_unique_ref"` + VarcharUniqueDefConst *string `db:"varchar_unique_def_const"` + VarcharUniqueDefFunc *string `db:"varchar_unique_def_func"` + VarcharCheck *string `db:"varchar_check"` + VarcharCheckRef *string `db:"varchar_check_ref"` + VarcharCheckDefConst *string `db:"varchar_check_def_const"` + VarcharCheckDefFunc *string `db:"varchar_check_def_func"` + VarcharRef *string `db:"varchar_ref"` + VarcharRefDefConst *string `db:"varchar_ref_def_const"` + VarcharRefDefFunc *string `db:"varchar_ref_def_func"` + VarcharRefUniqueCheck *string `db:"varchar_ref_unique_check"` + VarcharDefConst *string `db:"varchar_def_const"` + VarcharDefConstUniqueCheck *string `db:"varchar_def_const_unique_check"` + VarcharDefFunc *string `db:"varchar_def_func"` + VarcharDefFuncUniqueCheck *string `db:"varchar_def_func_unique_check"` +} diff --git a/internal/integration_tests/postgres/nulltypeprimitive/VarcharCheckPk.go b/internal/integration_tests/postgres/nulltypeprimitive/VarcharCheckPk.go new file mode 100644 index 00000000..3f42d91f --- /dev/null +++ b/internal/integration_tests/postgres/nulltypeprimitive/VarcharCheckPk.go @@ -0,0 +1,5 @@ +package dto + +type VarcharCheckPk struct { + VarcharCheckPk string `db:"varchar_check_pk"` +} diff --git a/internal/integration_tests/postgres/nulltypeprimitive/VarcharDefConstUniqueCheckPk.go b/internal/integration_tests/postgres/nulltypeprimitive/VarcharDefConstUniqueCheckPk.go new file mode 100644 index 00000000..b0c8f76b --- /dev/null +++ b/internal/integration_tests/postgres/nulltypeprimitive/VarcharDefConstUniqueCheckPk.go @@ -0,0 +1,5 @@ +package dto + +type VarcharDefConstUniqueCheckPk struct { + VarcharDefConstUniqueCheckPk string `db:"varchar_def_const_unique_check_pk"` +} diff --git a/internal/integration_tests/postgres/nulltypeprimitive/VarcharDefConstUniqueCheckPkRef.go b/internal/integration_tests/postgres/nulltypeprimitive/VarcharDefConstUniqueCheckPkRef.go new file mode 100644 index 00000000..55840733 --- /dev/null +++ b/internal/integration_tests/postgres/nulltypeprimitive/VarcharDefConstUniqueCheckPkRef.go @@ -0,0 +1,5 @@ +package dto + +type VarcharDefConstUniqueCheckPkRef struct { + VarcharDefConstUniqueCheckPkRef string `db:"varchar_def_const_unique_check_pk_ref"` +} diff --git a/internal/integration_tests/postgres/nulltypeprimitive/VarcharDefFuncUniqueCheckPk.go b/internal/integration_tests/postgres/nulltypeprimitive/VarcharDefFuncUniqueCheckPk.go new file mode 100644 index 00000000..eb63e5d1 --- /dev/null +++ b/internal/integration_tests/postgres/nulltypeprimitive/VarcharDefFuncUniqueCheckPk.go @@ -0,0 +1,5 @@ +package dto + +type VarcharDefFuncUniqueCheckPk struct { + VarcharDefFuncUniqueCheckPk string `db:"varchar_def_func_unique_check_pk"` +} diff --git a/internal/integration_tests/postgres/nulltypeprimitive/VarcharDefFuncUniqueCheckPkRef.go b/internal/integration_tests/postgres/nulltypeprimitive/VarcharDefFuncUniqueCheckPkRef.go new file mode 100644 index 00000000..8b002629 --- /dev/null +++ b/internal/integration_tests/postgres/nulltypeprimitive/VarcharDefFuncUniqueCheckPkRef.go @@ -0,0 +1,5 @@ +package dto + +type VarcharDefFuncUniqueCheckPkRef struct { + VarcharDefFuncUniqueCheckPkRef string `db:"varchar_def_func_unique_check_pk_ref"` +} diff --git a/internal/integration_tests/postgres/nulltypeprimitive/VarcharNnPk.go b/internal/integration_tests/postgres/nulltypeprimitive/VarcharNnPk.go new file mode 100644 index 00000000..b8364e86 --- /dev/null +++ b/internal/integration_tests/postgres/nulltypeprimitive/VarcharNnPk.go @@ -0,0 +1,5 @@ +package dto + +type VarcharNnPk struct { + VarcharNnPk string `db:"varchar_nn_pk"` +} diff --git a/internal/integration_tests/postgres/nulltypeprimitive/VarcharNnUniqueCheckPk.go b/internal/integration_tests/postgres/nulltypeprimitive/VarcharNnUniqueCheckPk.go new file mode 100644 index 00000000..0a24372c --- /dev/null +++ b/internal/integration_tests/postgres/nulltypeprimitive/VarcharNnUniqueCheckPk.go @@ -0,0 +1,5 @@ +package dto + +type VarcharNnUniqueCheckPk struct { + VarcharNnUniqueCheckPk string `db:"varchar_nn_unique_check_pk"` +} diff --git a/internal/integration_tests/postgres/nulltypeprimitive/VarcharNnUniqueCheckPkRef.go b/internal/integration_tests/postgres/nulltypeprimitive/VarcharNnUniqueCheckPkRef.go new file mode 100644 index 00000000..419161c0 --- /dev/null +++ b/internal/integration_tests/postgres/nulltypeprimitive/VarcharNnUniqueCheckPkRef.go @@ -0,0 +1,5 @@ +package dto + +type VarcharNnUniqueCheckPkRef struct { + VarcharNnUniqueCheckPkRef string `db:"varchar_nn_unique_check_pk_ref"` +} diff --git a/internal/integration_tests/postgres/nulltypeprimitive/VarcharPk.go b/internal/integration_tests/postgres/nulltypeprimitive/VarcharPk.go new file mode 100644 index 00000000..d04cc77d --- /dev/null +++ b/internal/integration_tests/postgres/nulltypeprimitive/VarcharPk.go @@ -0,0 +1,5 @@ +package dto + +type VarcharPk struct { + VarcharPk string `db:"varchar_pk"` +} diff --git a/internal/integration_tests/postgres/nulltypeprimitive/VarcharPkDefConst.go b/internal/integration_tests/postgres/nulltypeprimitive/VarcharPkDefConst.go new file mode 100644 index 00000000..2b5b3bce --- /dev/null +++ b/internal/integration_tests/postgres/nulltypeprimitive/VarcharPkDefConst.go @@ -0,0 +1,5 @@ +package dto + +type VarcharPkDefConst struct { + VarcharPkDefConst string `db:"varchar_pk_def_const"` +} diff --git a/internal/integration_tests/postgres/nulltypeprimitive/VarcharPkDefFunc.go b/internal/integration_tests/postgres/nulltypeprimitive/VarcharPkDefFunc.go new file mode 100644 index 00000000..8e0d43b6 --- /dev/null +++ b/internal/integration_tests/postgres/nulltypeprimitive/VarcharPkDefFunc.go @@ -0,0 +1,5 @@ +package dto + +type VarcharPkDefFunc struct { + VarcharPkDefFunc string `db:"varchar_pk_def_func"` +} diff --git a/internal/integration_tests/postgres/nulltypeprimitive/VarcharPkRef.go b/internal/integration_tests/postgres/nulltypeprimitive/VarcharPkRef.go new file mode 100644 index 00000000..1237c5d4 --- /dev/null +++ b/internal/integration_tests/postgres/nulltypeprimitive/VarcharPkRef.go @@ -0,0 +1,5 @@ +package dto + +type VarcharPkRef struct { + VarcharPkRef string `db:"varchar_pk_ref"` +} diff --git a/internal/integration_tests/postgres/nulltypeprimitive/VarcharRef.go b/internal/integration_tests/postgres/nulltypeprimitive/VarcharRef.go new file mode 100644 index 00000000..2f7810a0 --- /dev/null +++ b/internal/integration_tests/postgres/nulltypeprimitive/VarcharRef.go @@ -0,0 +1,5 @@ +package dto + +type VarcharRef struct { + VarcharRef *string `db:"varchar_ref"` +} diff --git a/internal/integration_tests/postgres/nulltypeprimitive/VarcharUniqueCheckPk.go b/internal/integration_tests/postgres/nulltypeprimitive/VarcharUniqueCheckPk.go new file mode 100644 index 00000000..98513a8f --- /dev/null +++ b/internal/integration_tests/postgres/nulltypeprimitive/VarcharUniqueCheckPk.go @@ -0,0 +1,5 @@ +package dto + +type VarcharUniqueCheckPk struct { + VarcharUniqueCheckPk string `db:"varchar_unique_check_pk"` +} diff --git a/internal/integration_tests/postgres/nulltypeprimitive/VarcharUniqueCheckPkRef.go b/internal/integration_tests/postgres/nulltypeprimitive/VarcharUniqueCheckPkRef.go new file mode 100644 index 00000000..9e078bac --- /dev/null +++ b/internal/integration_tests/postgres/nulltypeprimitive/VarcharUniqueCheckPkRef.go @@ -0,0 +1,5 @@ +package dto + +type VarcharUniqueCheckPkRef struct { + VarcharUniqueCheckPkRef string `db:"varchar_unique_check_pk_ref"` +} diff --git a/internal/integration_tests/postgres/nulltypeprimitive/VarcharUniquePk.go b/internal/integration_tests/postgres/nulltypeprimitive/VarcharUniquePk.go new file mode 100644 index 00000000..66a68448 --- /dev/null +++ b/internal/integration_tests/postgres/nulltypeprimitive/VarcharUniquePk.go @@ -0,0 +1,5 @@ +package dto + +type VarcharUniquePk struct { + VarcharUniquePk string `db:"varchar_unique_pk"` +} diff --git a/internal/integration_tests/postgres/tablesflag/Date.go b/internal/integration_tests/postgres/tablesflag/Date.go new file mode 100644 index 00000000..f5a4e6f5 --- /dev/null +++ b/internal/integration_tests/postgres/tablesflag/Date.go @@ -0,0 +1,34 @@ +package dto + +import ( + "database/sql" + "time" +) + +type Date struct { + Date sql.NullTime `db:"date"` + DateNn time.Time `db:"date_nn"` + DateNnUnique time.Time `db:"date_nn_unique"` + DateNnCheck time.Time `db:"date_nn_check"` + DateNnRef time.Time `db:"date_nn_ref"` + DateNnDefConst time.Time `db:"date_nn_def_const"` + DateNnDefFunc time.Time `db:"date_nn_def_func"` + DateNnUniqueCheck time.Time `db:"date_nn_unique_check"` + DateUnique sql.NullTime `db:"date_unique"` + DateUniqueCheck sql.NullTime `db:"date_unique_check"` + DateUniqueRef sql.NullTime `db:"date_unique_ref"` + DateUniqueDefConst sql.NullTime `db:"date_unique_def_const"` + DateUniqueDefFunc sql.NullTime `db:"date_unique_def_func"` + DateCheck sql.NullTime `db:"date_check"` + DateCheckRef sql.NullTime `db:"date_check_ref"` + DateCheckDefConst sql.NullTime `db:"date_check_def_const"` + DateCheckDefFunc sql.NullTime `db:"date_check_def_func"` + DateRef sql.NullTime `db:"date_ref"` + DateRefDefConst sql.NullTime `db:"date_ref_def_const"` + DateRefDefFunc sql.NullTime `db:"date_ref_def_func"` + DateRefUniqueCheck sql.NullTime `db:"date_ref_unique_check"` + DateDefConst sql.NullTime `db:"date_def_const"` + DateDefConstUniqueCheck sql.NullTime `db:"date_def_const_unique_check"` + DateDefFunc sql.NullTime `db:"date_def_func"` + DateDefFuncUniqueCheck sql.NullTime `db:"date_def_func_unique_check"` +} diff --git a/internal/integration_tests/postgres/tablesflag/Float.go b/internal/integration_tests/postgres/tablesflag/Float.go new file mode 100644 index 00000000..2cd5e08e --- /dev/null +++ b/internal/integration_tests/postgres/tablesflag/Float.go @@ -0,0 +1,33 @@ +package dto + +import ( + "database/sql" +) + +type Float struct { + Float sql.NullFloat64 `db:"float"` + FloatNn float64 `db:"float_nn"` + FloatNnUnique float64 `db:"float_nn_unique"` + FloatNnCheck float64 `db:"float_nn_check"` + FloatNnRef float64 `db:"float_nn_ref"` + FloatNnDefConst float64 `db:"float_nn_def_const"` + FloatNnDefFunc float64 `db:"float_nn_def_func"` + FloatNnUniqueCheck float64 `db:"float_nn_unique_check"` + FloatUnique sql.NullFloat64 `db:"float_unique"` + FloatUniqueCheck sql.NullFloat64 `db:"float_unique_check"` + FloatUniqueRef sql.NullFloat64 `db:"float_unique_ref"` + FloatUniqueDefConst sql.NullFloat64 `db:"float_unique_def_const"` + FloatUniqueDefFunc sql.NullFloat64 `db:"float_unique_def_func"` + FloatCheck sql.NullFloat64 `db:"float_check"` + FloatCheckRef sql.NullFloat64 `db:"float_check_ref"` + FloatCheckDefConst sql.NullFloat64 `db:"float_check_def_const"` + FloatCheckDefFunc sql.NullFloat64 `db:"float_check_def_func"` + FloatRef sql.NullFloat64 `db:"float_ref"` + FloatRefDefConst sql.NullFloat64 `db:"float_ref_def_const"` + FloatRefDefFunc sql.NullFloat64 `db:"float_ref_def_func"` + FloatRefUniqueCheck sql.NullFloat64 `db:"float_ref_unique_check"` + FloatDefConst sql.NullFloat64 `db:"float_def_const"` + FloatDefConstUniqueCheck sql.NullFloat64 `db:"float_def_const_unique_check"` + FloatDefFunc sql.NullFloat64 `db:"float_def_func"` + FloatDefFuncUniqueCheck sql.NullFloat64 `db:"float_def_func_unique_check"` +} diff --git a/internal/integration_tests/postgres/tablesflag/Varchar.go b/internal/integration_tests/postgres/tablesflag/Varchar.go new file mode 100644 index 00000000..290a3493 --- /dev/null +++ b/internal/integration_tests/postgres/tablesflag/Varchar.go @@ -0,0 +1,35 @@ +package dto + +import ( + "database/sql" +) + +type Varchar struct { + Varchar sql.NullString `db:"varchar"` + VarcharCap sql.NullString `db:"varchar_cap"` + VarcharNn string `db:"varchar_nn"` + VarcharNnUnique string `db:"varchar_nn_unique"` + VarcharNnCheckCmp string `db:"varchar_nn_check_cmp"` + VarcharNnCheckFn string `db:"varchar_nn_check_fn"` + VarcharNnRef string `db:"varchar_nn_ref"` + VarcharNnDefConst string `db:"varchar_nn_def_const"` + VarcharNnDefFunc string `db:"varchar_nn_def_func"` + VarcharNnUniqueCheck string `db:"varchar_nn_unique_check"` + VarcharUnique sql.NullString `db:"varchar_unique"` + VarcharUniqueCheck sql.NullString `db:"varchar_unique_check"` + VarcharUniqueRef sql.NullString `db:"varchar_unique_ref"` + VarcharUniqueDefConst sql.NullString `db:"varchar_unique_def_const"` + VarcharUniqueDefFunc sql.NullString `db:"varchar_unique_def_func"` + VarcharCheck sql.NullString `db:"varchar_check"` + VarcharCheckRef sql.NullString `db:"varchar_check_ref"` + VarcharCheckDefConst sql.NullString `db:"varchar_check_def_const"` + VarcharCheckDefFunc sql.NullString `db:"varchar_check_def_func"` + VarcharRef sql.NullString `db:"varchar_ref"` + VarcharRefDefConst sql.NullString `db:"varchar_ref_def_const"` + VarcharRefDefFunc sql.NullString `db:"varchar_ref_def_func"` + VarcharRefUniqueCheck sql.NullString `db:"varchar_ref_unique_check"` + VarcharDefConst sql.NullString `db:"varchar_def_const"` + VarcharDefConstUniqueCheck sql.NullString `db:"varchar_def_const_unique_check"` + VarcharDefFunc sql.NullString `db:"varchar_def_func"` + VarcharDefFuncUniqueCheck sql.NullString `db:"varchar_def_func_unique_check"` +} diff --git a/internal/integration_tests/postgres/testdata/bigint.sql b/internal/integration_tests/postgres/testdata/bigint.sql new file mode 100644 index 00000000..0966b2c9 --- /dev/null +++ b/internal/integration_tests/postgres/testdata/bigint.sql @@ -0,0 +1,130 @@ +DROP TABLE IF EXISTS bigint_ref CASCADE; +CREATE TABLE bigint_ref +( + bigint_ref bigint UNIQUE +); + +DROP TABLE IF EXISTS bigint; +CREATE TABLE bigint +( + bigint bigint, + bigint_nn bigint NOT NULL, + bigint_nn_unique bigint NOT NULL UNIQUE, + bigint_nn_check bigint NOT NULL CHECK ( bigint > 0 ), + bigint_nn_ref bigint NOT NULL REFERENCES bigint_ref (bigint_ref), + bigint_nn_def_const bigint NOT NULL DEFAULT 42, + bigint_nn_def_func bigint NOT NULL DEFAULT pi(), + bigint_nn_unique_check bigint NOT NULL UNIQUE CHECK ( bigint > 0 ), + + bigint_unique bigint UNIQUE, + bigint_unique_check bigint UNIQUE CHECK ( bigint > 0 ), + bigint_unique_ref bigint UNIQUE REFERENCES bigint_ref (bigint_ref), + bigint_unique_def_const bigint UNIQUE DEFAULT 42, + bigint_unique_def_func bigint UNIQUE DEFAULT pi(), + + bigint_check bigint CHECK ( bigint > 0 ), + bigint_check_ref bigint CHECK ( bigint > 0 ) REFERENCES bigint_ref (bigint_ref), + bigint_check_def_const bigint CHECK ( bigint > 0 ) DEFAULT 42, + bigint_check_def_func bigint CHECK ( bigint > 0 ) DEFAULT pi(), + + bigint_ref bigint REFERENCES bigint_ref (bigint_ref), + bigint_ref_def_const bigint REFERENCES bigint_ref (bigint_ref) DEFAULT 42, + bigint_ref_def_func bigint REFERENCES bigint_ref (bigint_ref) DEFAULT pi(), + bigint_ref_unique_check bigint UNIQUE CHECK ( bigint > 0 ) REFERENCES bigint_ref (bigint_ref), + + bigint_def_const bigint DEFAULT 42, + bigint_def_const_unique_check bigint UNIQUE CHECK ( bigint > 0 ) DEFAULT 42, + + bigint_def_func bigint DEFAULT pi(), + bigint_def_func_unique_check bigint UNIQUE CHECK ( bigint > 0 ) DEFAULT pi() +); + +DROP TABLE IF EXISTS bigint_pk; +CREATE TABLE bigint_pk +( + bigint_pk bigint PRIMARY KEY +); + +DROP TABLE IF EXISTS bigint_pk_ref; +CREATE TABLE bigint_pk_ref +( + bigint_pk_ref bigint PRIMARY KEY REFERENCES bigint_ref (bigint_ref) +); + +DROP TABLE IF EXISTS bigint_pk_def_const; +CREATE TABLE bigint_pk_def_const +( + bigint_pk_def_const bigint PRIMARY KEY DEFAULT 42 +); + +DROP TABLE IF EXISTS bigint_pk_def_func; +CREATE TABLE bigint_pk_def_func +( + bigint_pk_def_func bigint PRIMARY KEY DEFAULT pi() +); + +DROP TABLE IF EXISTS bigint_nn_pk; +CREATE TABLE bigint_nn_pk +( + bigint_nn_pk bigint NOT NULL PRIMARY KEY +); + +DROP TABLE IF EXISTS bigint_nn_unique_check_pk; +CREATE TABLE bigint_nn_unique_check_pk +( + bigint_nn_unique_check_pk bigint PRIMARY KEY NOT NULL UNIQUE CHECK ( bigint_nn_unique_check_pk > 0) +); + +DROP TABLE IF EXISTS bigint_nn_unique_check_pk_ref; +CREATE TABLE bigint_nn_unique_check_pk_ref +( + bigint_nn_unique_check_pk_ref bigint PRIMARY KEY NOT NULL UNIQUE CHECK ( bigint_nn_unique_check_pk_ref > 0) REFERENCES bigint_ref (bigint_ref) +); + +DROP TABLE IF EXISTS bigint_unique_pk; +CREATE TABLE bigint_unique_pk +( + bigint_unique_pk bigint PRIMARY KEY UNIQUE +); + +DROP TABLE IF EXISTS bigint_unique_check_pk; +CREATE TABLE bigint_unique_check_pk +( + bigint_unique_check_pk bigint PRIMARY KEY UNIQUE CHECK ( bigint_unique_check_pk > 0 ) +); + +DROP TABLE IF EXISTS bigint_unique_check_pk_ref; +CREATE TABLE bigint_unique_check_pk_ref +( + bigint_unique_check_pk_ref bigint PRIMARY KEY UNIQUE CHECK ( bigint_unique_check_pk_ref > 0) REFERENCES bigint_ref (bigint_ref) +); + +DROP TABLE IF EXISTS bigint_check_pk; +CREATE TABLE bigint_check_pk +( + bigint_check_pk bigint PRIMARY KEY CHECK ( bigint_check_pk > 0 ) +); + +DROP TABLE IF EXISTS bigint_def_const_unique_check_pk; +CREATE TABLE bigint_def_const_unique_check_pk +( + bigint_def_const_unique_check_pk bigint PRIMARY KEY UNIQUE CHECK ( bigint_def_const_unique_check_pk > 0 ) DEFAULT 42 +); + +DROP TABLE IF EXISTS bigint_def_const_unique_check_pk_ref; +CREATE TABLE bigint_def_const_unique_check_pk_ref +( + bigint_def_const_unique_check_pk_ref bigint PRIMARY KEY UNIQUE CHECK ( bigint_def_const_unique_check_pk_ref > 0 ) DEFAULT 42 REFERENCES bigint_ref (bigint_ref) +); + +DROP TABLE IF EXISTS bigint_def_func_unique_check_pk; +CREATE TABLE bigint_def_func_unique_check_pk +( + bigint_def_func_unique_check_pk bigint PRIMARY KEY UNIQUE CHECK ( bigint_def_func_unique_check_pk > 0 ) DEFAULT pi() +); + +DROP TABLE IF EXISTS bigint_def_func_unique_check_pk_ref; +CREATE TABLE bigint_def_func_unique_check_pk_ref +( + bigint_def_func_unique_check_pk_ref bigint PRIMARY KEY UNIQUE CHECK ( bigint_def_func_unique_check_pk_ref > 0 ) DEFAULT pi() REFERENCES bigint_ref (bigint_ref) +); diff --git a/internal/integration_tests/postgres/testdata/bigserial.sql b/internal/integration_tests/postgres/testdata/bigserial.sql new file mode 100644 index 00000000..fda76bf7 --- /dev/null +++ b/internal/integration_tests/postgres/testdata/bigserial.sql @@ -0,0 +1,65 @@ +DROP TABLE IF EXISTS bigserial_ref CASCADE; +CREATE TABLE bigserial_ref +( + bigserial_ref bigserial UNIQUE +); + +DROP TABLE IF EXISTS bigserial; +CREATE TABLE bigserial +( + bigserial bigserial +); + +DROP TABLE IF EXISTS bigserial_notnull; +CREATE TABLE bigserial_notnull +( + bigserial bigserial NOT NULL +); + +DROP TABLE IF EXISTS bigserial_unique; +CREATE TABLE bigserial_unique +( + bigserial bigserial UNIQUE +); + +DROP TABLE IF EXISTS bigserial_check; +CREATE TABLE bigserial_check +( + bigserial bigserial CHECK ( bigserial > 0 ) +); + +DROP TABLE IF EXISTS bigserial_pk; +CREATE TABLE bigserial_pk +( + bigserial bigserial PRIMARY KEY +); + +DROP TABLE IF EXISTS bigserial_references; +CREATE TABLE bigserial_references +( + bigserial bigserial REFERENCES bigserial_ref (bigserial_ref) +); + +DROP TABLE IF EXISTS bigserial_unique_check; +CREATE TABLE bigserial_unique_check +( + bigserial bigserial UNIQUE CHECK ( bigserial > 0 ) +); + +DROP TABLE IF EXISTS bigserial_unique_check_pk; +CREATE TABLE bigserial_unique_check_pk +( + bigserial bigserial PRIMARY KEY UNIQUE CHECK ( bigserial > 0 ) +); + +DROP TABLE IF EXISTS bigserial_unique_check_pk_ref; +CREATE TABLE bigserial_unique_check_pk_ref +( + bigserial bigserial PRIMARY KEY UNIQUE CHECK ( bigserial > 0 ) REFERENCES bigserial_ref (bigserial_ref) +); + +DROP TABLE IF EXISTS bigserial_unique_check_ref; +CREATE TABLE bigserial_unique_check_ref +( + bigserial bigserial UNIQUE CHECK ( bigserial > 0 ) REFERENCES bigserial_ref (bigserial_ref) +); \ No newline at end of file diff --git a/internal/integration_tests/postgres/testdata/char.sql b/internal/integration_tests/postgres/testdata/char.sql new file mode 100644 index 00000000..c8c8abab --- /dev/null +++ b/internal/integration_tests/postgres/testdata/char.sql @@ -0,0 +1,133 @@ +DROP TABLE IF EXISTS char_ref CASCADE; +CREATE TABLE char_ref +( + char_ref char UNIQUE +); + +DROP TABLE IF EXISTS char; +CREATE TABLE char +( + char char, + char_cap char(255), + char_nn char NOT NULL, + char_nn_unique char NOT NULL UNIQUE, + char_nn_check_cmp char NOT NULL CHECK ( char = '42' +) , + char_nn_check_fn char NOT NULL CHECK ( length(char) > 0 ), + char_nn_ref char NOT NULL REFERENCES char_ref(char_ref), + char_nn_def_const char NOT NULL DEFAULT '42', + char_nn_def_func char NOT NULL DEFAULT pi(), + char_nn_unique_check char NOT NULL UNIQUE CHECK ( length(char) > 0 ), + + char_unique char UNIQUE, + char_unique_check char UNIQUE CHECK ( length(char) > 0 ), + char_unique_ref char UNIQUE REFERENCES char_ref(char_ref), + char_unique_def_const char UNIQUE DEFAULT '42', + char_unique_def_func char UNIQUE DEFAULT pi(), + + char_check char CHECK ( length(char) > 0 ), + char_check_ref char CHECK ( length(char) > 0 ) REFERENCES char_ref(char_ref), + char_check_def_const char CHECK ( length(char) > 0 ) DEFAULT '42', + char_check_def_func char CHECK ( length(char) > 0 ) DEFAULT pi(), + + char_ref char REFERENCES char_ref(char_ref), + char_ref_def_const char REFERENCES char_ref(char_ref) DEFAULT '42', + char_ref_def_func char REFERENCES char_ref(char_ref) DEFAULT pi(), + char_ref_unique_check char UNIQUE CHECK ( length(char) > 0 ) REFERENCES char_ref(char_ref), + + char_def_const char DEFAULT '42', + char_def_const_unique_check char UNIQUE CHECK ( length(char) > 0 ) DEFAULT '42', + + char_def_func char DEFAULT pi(), + char_def_func_unique_check char UNIQUE CHECK ( length(char) > 0 ) DEFAULT pi() +); + +DROP TABLE IF EXISTS char_pk; +CREATE TABLE char_pk +( + char_pk char PRIMARY KEY +); + +DROP TABLE IF EXISTS char_pk_ref; +CREATE TABLE char_pk_ref +( + char_pk_ref char PRIMARY KEY REFERENCES char_ref (char_ref) +); + +DROP TABLE IF EXISTS char_pk_def_const; +CREATE TABLE char_pk_def_const +( + char_pk_def_const char PRIMARY KEY DEFAULT '42' +); + +DROP TABLE IF EXISTS char_pk_def_func; +CREATE TABLE char_pk_def_func +( + char_pk_def_func char PRIMARY KEY DEFAULT pi() +); + +DROP TABLE IF EXISTS char_nn_pk; +CREATE TABLE char_nn_pk +( + char_nn_pk char NOT NULL PRIMARY KEY +); + +DROP TABLE IF EXISTS char_nn_unique_check_pk; +CREATE TABLE char_nn_unique_check_pk +( + char_nn_unique_check_pk char PRIMARY KEY NOT NULL UNIQUE CHECK ( length(char_nn_unique_check_pk) > 0) +); + +DROP TABLE IF EXISTS char_nn_unique_check_pk_ref; +CREATE TABLE char_nn_unique_check_pk_ref +( + char_nn_unique_check_pk_ref char PRIMARY KEY NOT NULL UNIQUE CHECK ( length(char_nn_unique_check_pk_ref) > 0) REFERENCES char_ref (char_ref) +); + +DROP TABLE IF EXISTS char_unique_pk; +CREATE TABLE char_unique_pk +( + char_unique_pk char PRIMARY KEY UNIQUE +); + +DROP TABLE IF EXISTS char_unique_check_pk; +CREATE TABLE char_unique_check_pk +( + char_unique_check_pk char PRIMARY KEY UNIQUE CHECK ( length(char_unique_check_pk) > 0 ) +); + +DROP TABLE IF EXISTS char_unique_check_pk_ref; +CREATE TABLE char_unique_check_pk_ref +( + char_unique_check_pk_ref char PRIMARY KEY UNIQUE CHECK ( length(char_unique_check_pk_ref) > 0) REFERENCES char_ref (char_ref) +); + +DROP TABLE IF EXISTS char_check_pk; +CREATE TABLE char_check_pk +( + char_check_pk char PRIMARY KEY CHECK ( length(char_check_pk) > 0 ) +); + +DROP TABLE IF EXISTS char_def_const_unique_check_pk; +CREATE TABLE char_def_const_unique_check_pk +( + char_def_const_unique_check_pk char PRIMARY KEY UNIQUE CHECK ( length(char_def_const_unique_check_pk) > 0 ) DEFAULT '42' +); + +DROP TABLE IF EXISTS char_def_const_unique_check_pk_ref; +CREATE TABLE char_def_const_unique_check_pk_ref +( + char_def_const_unique_check_pk_ref char PRIMARY KEY UNIQUE CHECK ( length(char_def_const_unique_check_pk_ref) > 0 ) DEFAULT '42' REFERENCES char_ref (char_ref) +); + +DROP TABLE IF EXISTS char_def_func_unique_check_pk; +CREATE TABLE char_def_func_unique_check_pk +( + char_def_func_unique_check_pk char PRIMARY KEY UNIQUE CHECK ( length(char_def_func_unique_check_pk) > 0 ) DEFAULT pi() +); + +DROP TABLE IF EXISTS char_def_func_unique_check_pk_ref; +CREATE TABLE char_def_func_unique_check_pk_ref +( + char_def_func_unique_check_pk_ref char PRIMARY KEY UNIQUE CHECK ( length(char_def_func_unique_check_pk_ref) > 0 ) DEFAULT pi() REFERENCES char_ref (char_ref) +); diff --git a/internal/integration_tests/postgres/testdata/character.sql b/internal/integration_tests/postgres/testdata/character.sql new file mode 100644 index 00000000..afa3be69 --- /dev/null +++ b/internal/integration_tests/postgres/testdata/character.sql @@ -0,0 +1,133 @@ +DROP TABLE IF EXISTS character_ref CASCADE; +CREATE TABLE character_ref +( + character_ref character UNIQUE +); + +DROP TABLE IF EXISTS character; +CREATE TABLE character +( + character character, + character_cap character(255), + character_nn character NOT NULL, + character_nn_unique character NOT NULL UNIQUE, + character_nn_check_cmp character NOT NULL CHECK ( character = '42' +) , + character_nn_check_fn character NOT NULL CHECK ( length(character) > 0 ), + character_nn_ref character NOT NULL REFERENCES character_ref(character_ref), + character_nn_def_const character NOT NULL DEFAULT '42', + character_nn_def_func character NOT NULL DEFAULT pi(), + character_nn_unique_check character NOT NULL UNIQUE CHECK ( length(character) > 0 ), + + character_unique character UNIQUE, + character_unique_check character UNIQUE CHECK ( length(character) > 0 ), + character_unique_ref character UNIQUE REFERENCES character_ref(character_ref), + character_unique_def_const character UNIQUE DEFAULT '42', + character_unique_def_func character UNIQUE DEFAULT pi(), + + character_check character CHECK ( length(character) > 0 ), + character_check_ref character CHECK ( length(character) > 0 ) REFERENCES character_ref(character_ref), + character_check_def_const character CHECK ( length(character) > 0 ) DEFAULT '42', + character_check_def_func character CHECK ( length(character) > 0 ) DEFAULT pi(), + + character_ref character REFERENCES character_ref(character_ref), + character_ref_def_const character REFERENCES character_ref(character_ref) DEFAULT '42', + character_ref_def_func character REFERENCES character_ref(character_ref) DEFAULT pi(), + character_ref_unique_check character UNIQUE CHECK ( length(character) > 0 ) REFERENCES character_ref(character_ref), + + character_def_const character DEFAULT '42', + character_def_const_unique_check character UNIQUE CHECK ( length(character) > 0 ) DEFAULT '42', + + character_def_func character DEFAULT pi(), + character_def_func_unique_check character UNIQUE CHECK ( length(character) > 0 ) DEFAULT pi() +); + +DROP TABLE IF EXISTS character_pk; +CREATE TABLE character_pk +( + character_pk character PRIMARY KEY +); + +DROP TABLE IF EXISTS character_pk_ref; +CREATE TABLE character_pk_ref +( + character_pk_ref character PRIMARY KEY REFERENCES character_ref (character_ref) +); + +DROP TABLE IF EXISTS character_pk_def_const; +CREATE TABLE character_pk_def_const +( + character_pk_def_const character PRIMARY KEY DEFAULT '42' +); + +DROP TABLE IF EXISTS character_pk_def_func; +CREATE TABLE character_pk_def_func +( + character_pk_def_func character PRIMARY KEY DEFAULT pi() +); + +DROP TABLE IF EXISTS character_nn_pk; +CREATE TABLE character_nn_pk +( + character_nn_pk character NOT NULL PRIMARY KEY +); + +DROP TABLE IF EXISTS character_nn_unique_check_pk; +CREATE TABLE character_nn_unique_check_pk +( + character_nn_unique_check_pk character PRIMARY KEY NOT NULL UNIQUE CHECK ( length(character_nn_unique_check_pk) > 0) +); + +DROP TABLE IF EXISTS character_nn_unique_check_pk_ref; +CREATE TABLE character_nn_unique_check_pk_ref +( + character_nn_unique_check_pk_ref character PRIMARY KEY NOT NULL UNIQUE CHECK ( length(character_nn_unique_check_pk_ref) > 0) REFERENCES character_ref (character_ref) +); + +DROP TABLE IF EXISTS character_unique_pk; +CREATE TABLE character_unique_pk +( + character_unique_pk character PRIMARY KEY UNIQUE +); + +DROP TABLE IF EXISTS character_unique_check_pk; +CREATE TABLE character_unique_check_pk +( + character_unique_check_pk character PRIMARY KEY UNIQUE CHECK ( length(character_unique_check_pk) > 0 ) +); + +DROP TABLE IF EXISTS character_unique_check_pk_ref; +CREATE TABLE character_unique_check_pk_ref +( + character_unique_check_pk_ref character PRIMARY KEY UNIQUE CHECK ( length(character_unique_check_pk_ref) > 0) REFERENCES character_ref (character_ref) +); + +DROP TABLE IF EXISTS character_check_pk; +CREATE TABLE character_check_pk +( + character_check_pk character PRIMARY KEY CHECK ( length(character_check_pk) > 0 ) +); + +DROP TABLE IF EXISTS character_def_const_unique_check_pk; +CREATE TABLE character_def_const_unique_check_pk +( + character_def_const_unique_check_pk character PRIMARY KEY UNIQUE CHECK ( length(character_def_const_unique_check_pk) > 0 ) DEFAULT '42' +); + +DROP TABLE IF EXISTS character_def_const_unique_check_pk_ref; +CREATE TABLE character_def_const_unique_check_pk_ref +( + character_def_const_unique_check_pk_ref character PRIMARY KEY UNIQUE CHECK ( length(character_def_const_unique_check_pk_ref) > 0 ) DEFAULT '42' REFERENCES character_ref (character_ref) +); + +DROP TABLE IF EXISTS character_def_func_unique_check_pk; +CREATE TABLE character_def_func_unique_check_pk +( + character_def_func_unique_check_pk character PRIMARY KEY UNIQUE CHECK ( length(character_def_func_unique_check_pk) > 0 ) DEFAULT pi() +); + +DROP TABLE IF EXISTS character_def_func_unique_check_pk_ref; +CREATE TABLE character_def_func_unique_check_pk_ref +( + character_def_func_unique_check_pk_ref character PRIMARY KEY UNIQUE CHECK ( length(character_def_func_unique_check_pk_ref) > 0 ) DEFAULT pi() REFERENCES character_ref (character_ref) +); diff --git a/internal/integration_tests/postgres/testdata/charvar.sql b/internal/integration_tests/postgres/testdata/charvar.sql new file mode 100644 index 00000000..e558c535 --- /dev/null +++ b/internal/integration_tests/postgres/testdata/charvar.sql @@ -0,0 +1,132 @@ +DROP TABLE IF EXISTS character_varying_ref CASCADE; +CREATE TABLE character_varying_ref +( + character_varying_ref character varying UNIQUE +); + +DROP TABLE IF EXISTS character_varying; +CREATE TABLE character_varying +( + character_varying character varying, + character_varying_cap character varying(255), + character_varying_nn character varying NOT NULL, + character_varying_nn_unique character varying NOT NULL UNIQUE, + character_varying_nn_check_cmp character varying NOT NULL CHECK ( character_varying = '42' ), + character_varying_nn_check_fn character varying NOT NULL CHECK ( length(character_varying) > 0 ), + character_varying_nn_ref character varying NOT NULL REFERENCES character_varying_ref (character_varying_ref), + character_varying_nn_def_const character varying NOT NULL DEFAULT '42', + character_varying_nn_def_func character varying NOT NULL DEFAULT pi(), + character_varying_nn_unique_check character varying NOT NULL UNIQUE CHECK ( length(character_varying) > 0 ), + + character_varying_unique character varying UNIQUE, + character_varying_unique_check character varying UNIQUE CHECK ( length(character_varying) > 0 ), + character_varying_unique_ref character varying UNIQUE REFERENCES character_varying_ref (character_varying_ref), + character_varying_unique_def_const character varying UNIQUE DEFAULT '42', + character_varying_unique_def_func character varying UNIQUE DEFAULT pi(), + + character_varying_check character varying CHECK ( length(character_varying) > 0 ), + character_varying_check_ref character varying CHECK ( length(character_varying) > 0 ) REFERENCES character_varying_ref (character_varying_ref), + character_varying_check_def_const character varying CHECK ( length(character_varying) > 0 ) DEFAULT '42', + character_varying_check_def_func character varying CHECK ( length(character_varying) > 0 ) DEFAULT pi(), + + character_varying_ref character varying REFERENCES character_varying_ref (character_varying_ref), + character_varying_ref_def_const character varying REFERENCES character_varying_ref (character_varying_ref) DEFAULT '42', + character_varying_ref_def_func character varying REFERENCES character_varying_ref (character_varying_ref) DEFAULT pi(), + character_varying_ref_unique_check character varying UNIQUE CHECK ( length(character_varying) > 0 ) REFERENCES character_varying_ref (character_varying_ref), + + character_varying_def_const character varying DEFAULT '42', + character_varying_def_const_unique_check character varying UNIQUE CHECK ( length(character_varying) > 0 ) DEFAULT '42', + + character_varying_def_func character varying DEFAULT pi(), + character_varying_def_func_unique_check character varying UNIQUE CHECK ( length(character_varying) > 0 ) DEFAULT pi() +); + +DROP TABLE IF EXISTS character_varying_pk; +CREATE TABLE character_varying_pk +( + character_varying_pk character varying PRIMARY KEY +); + +DROP TABLE IF EXISTS character_varying_pk_ref; +CREATE TABLE character_varying_pk_ref +( + character_varying_pk_ref character varying PRIMARY KEY REFERENCES character_varying_ref (character_varying_ref) +); + +DROP TABLE IF EXISTS character_varying_pk_def_const; +CREATE TABLE character_varying_pk_def_const +( + character_varying_pk_def_const character varying PRIMARY KEY DEFAULT '42' +); + +DROP TABLE IF EXISTS character_varying_pk_def_func; +CREATE TABLE character_varying_pk_def_func +( + character_varying_pk_def_func character varying PRIMARY KEY DEFAULT pi() +); + +DROP TABLE IF EXISTS character_varying_nn_pk; +CREATE TABLE character_varying_nn_pk +( + character_varying_nn_pk character varying NOT NULL PRIMARY KEY +); + +DROP TABLE IF EXISTS character_varying_nn_unique_check_pk; +CREATE TABLE character_varying_nn_unique_check_pk +( + character_varying_nn_unique_check_pk character varying PRIMARY KEY NOT NULL UNIQUE CHECK ( length(character_varying_nn_unique_check_pk) > 0) +); + +DROP TABLE IF EXISTS character_varying_nn_unique_check_pk_ref; +CREATE TABLE character_varying_nn_unique_check_pk_ref +( + character_varying_nn_unique_check_pk_ref character varying PRIMARY KEY NOT NULL UNIQUE CHECK ( length(character_varying_nn_unique_check_pk_ref) > 0) REFERENCES character_varying_ref (character_varying_ref) +); + +DROP TABLE IF EXISTS character_varying_unique_pk; +CREATE TABLE character_varying_unique_pk +( + character_varying_unique_pk character varying PRIMARY KEY UNIQUE +); + +DROP TABLE IF EXISTS character_varying_unique_check_pk; +CREATE TABLE character_varying_unique_check_pk +( + character_varying_unique_check_pk character varying PRIMARY KEY UNIQUE CHECK ( length(character_varying_unique_check_pk) > 0 ) +); + +DROP TABLE IF EXISTS character_varying_unique_check_pk_ref; +CREATE TABLE character_varying_unique_check_pk_ref +( + character_varying_unique_check_pk_ref character varying PRIMARY KEY UNIQUE CHECK ( length(character_varying_unique_check_pk_ref) > 0) REFERENCES character_varying_ref (character_varying_ref) +); + +DROP TABLE IF EXISTS character_varying_check_pk; +CREATE TABLE character_varying_check_pk +( + character_varying_check_pk character varying PRIMARY KEY CHECK ( length(character_varying_check_pk) > 0 ) +); + +DROP TABLE IF EXISTS character_varying_def_const_unique_check_pk; +CREATE TABLE character_varying_def_const_unique_check_pk +( + character_varying_def_const_unique_check_pk character varying PRIMARY KEY UNIQUE CHECK ( length(character_varying_def_const_unique_check_pk) > 0 ) DEFAULT '42' +); + +DROP TABLE IF EXISTS character_varying_def_const_unique_check_pk_ref; +CREATE TABLE character_varying_def_const_unique_check_pk_ref +( + character_varying_def_const_unique_check_pk_ref character varying PRIMARY KEY UNIQUE CHECK ( length(character_varying_def_const_unique_check_pk_ref) > 0 ) DEFAULT '42' REFERENCES character_varying_ref (character_varying_ref) +); + +DROP TABLE IF EXISTS character_varying_def_func_unique_check_pk; +CREATE TABLE character_varying_def_func_unique_check_pk +( + character_varying_def_func_unique_check_pk character varying PRIMARY KEY UNIQUE CHECK ( length(character_varying_def_func_unique_check_pk) > 0 ) DEFAULT pi() +); + +DROP TABLE IF EXISTS character_varying_def_func_unique_check_pk_ref; +CREATE TABLE character_varying_def_func_unique_check_pk_ref +( + character_varying_def_func_unique_check_pk_ref character varying PRIMARY KEY UNIQUE CHECK ( length(character_varying_def_func_unique_check_pk_ref) > 0 ) DEFAULT pi() REFERENCES character_varying_ref (character_varying_ref) +); diff --git a/internal/integration_tests/postgres/testdata/constraint_combinations.sql b/internal/integration_tests/postgres/testdata/constraint_combinations.sql new file mode 100644 index 00000000..60e4a104 --- /dev/null +++ b/internal/integration_tests/postgres/testdata/constraint_combinations.sql @@ -0,0 +1,70 @@ +DROP TABLE IF EXISTS constraint_combo_ref CASCADE; +CREATE TABLE constraint_combo_ref +( + constraint_combo_ref double precision UNIQUE +); + +DROP TABLE IF EXISTS constraint_combo_non_pk CASCADE; +CREATE TABLE constraint_combo_non_pk +( + not_null_unique_check_def_const double precision NOT NULL UNIQUE CHECK (not_null_unique_check_def_const > 0) DEFAULT 42, + not_null_unique_check_def_func double precision NOT NULL UNIQUE CHECK (not_null_unique_check_def_func > 0) DEFAULT pi(), + not_null_unique_ref_def_const double precision NOT NULL UNIQUE DEFAULT 42 REFERENCES constraint_combo_ref (constraint_combo_ref), + not_null_unique_ref_def_func double precision NOT NULL UNIQUE DEFAULT pi() REFERENCES constraint_combo_ref (constraint_combo_ref), + not_null_check_ref_def_const double precision NOT NULL CHECK (not_null_check_ref_def_const > 0) DEFAULT 42 REFERENCES constraint_combo_ref (constraint_combo_ref), + not_null_check_ref_def_func double precision NOT NULL CHECK (not_null_check_ref_def_func > 0) DEFAULT pi() REFERENCES constraint_combo_ref (constraint_combo_ref), + not_null_unique_def_const double precision NOT NULL UNIQUE DEFAULT 42, + not_null_unique_def_func double precision NOT NULL UNIQUE DEFAULT pi(), + not_null_check_def_const double precision NOT NULL CHECK (not_null_check_def_const > 0) DEFAULT 42, + not_null_check_def_func double precision NOT NULL CHECK (not_null_check_def_func > 0) DEFAULT pi(), + not_null_ref_def_const double precision NOT NULL DEFAULT 42 REFERENCES constraint_combo_ref (constraint_combo_ref), + not_null_ref_def_func double precision NOT NULL DEFAULT pi() REFERENCES constraint_combo_ref (constraint_combo_ref) +); + +DROP TABLE IF EXISTS constraint_combo_not_null_unique_pk_def_const CASCADE; +CREATE TABLE constraint_combo_not_null_unique_pk_def_const +( + constraint_combo_not_null_unique_pk_def_const double precision PRIMARY KEY NOT NULL UNIQUE DEFAULT 42 +); + +DROP TABLE IF EXISTS constraint_combo_not_null_unique_pk_def_func CASCADE; +CREATE TABLE constraint_combo_not_null_unique_pk_def_func +( + constraint_combo_not_null_unique_pk_def_func double precision PRIMARY KEY NOT NULL UNIQUE DEFAULT pi() +); + +DROP TABLE IF EXISTS constraint_combo_not_null_check_pk_def_const CASCADE; +CREATE TABLE constraint_combo_not_null_check_pk_def_const +( + constraint_combo_not_null_check_pk_def_const double precision PRIMARY KEY NOT NULL CHECK (constraint_combo_not_null_check_pk_def_const > 0) DEFAULT 42 +); + +DROP TABLE IF EXISTS constraint_combo_not_null_check_pk_def_func CASCADE; +CREATE TABLE constraint_combo_not_null_check_pk_def_func +( + constraint_combo_not_null_check_pk_def_func double precision PRIMARY KEY NOT NULL CHECK (constraint_combo_not_null_check_pk_def_func > 0) DEFAULT pi() +); + +DROP TABLE IF EXISTS constraint_combo_not_null_pk_ref_def_const CASCADE; +CREATE TABLE constraint_combo_not_null_pk_ref_def_const +( + constraint_combo_not_null_pk_ref_def_const double precision PRIMARY KEY NOT NULL DEFAULT 42 REFERENCES constraint_combo_ref (constraint_combo_ref) +); + +DROP TABLE IF EXISTS constraint_combo_not_null_pk_ref_def_func CASCADE; +CREATE TABLE constraint_combo_not_null_pk_ref_def_func +( + constraint_combo_not_null_pk_ref_def_func double precision PRIMARY KEY NOT NULL DEFAULT pi() REFERENCES constraint_combo_ref (constraint_combo_ref) +); + +DROP TABLE IF EXISTS constraint_combo_not_null_pk_def_const CASCADE; +CREATE TABLE constraint_combo_not_null_pk_def_const +( + constraint_combo_not_null_pk_def_const double precision NOT NULL PRIMARY KEY DEFAULT 42 +); + +DROP TABLE IF EXISTS constraint_combo_not_null_pk_def_func CASCADE; +CREATE TABLE constraint_combo_not_null_pk_def_func +( + constraint_combo_not_null_pk_def_func double precision NOT NULL PRIMARY KEY DEFAULT pi() +); diff --git a/internal/integration_tests/postgres/testdata/date.sql b/internal/integration_tests/postgres/testdata/date.sql new file mode 100644 index 00000000..c974573c --- /dev/null +++ b/internal/integration_tests/postgres/testdata/date.sql @@ -0,0 +1,131 @@ +DROP TABLE IF EXISTS date_ref CASCADE; +CREATE TABLE date_ref +( + date_ref date UNIQUE +); + +DROP TABLE IF EXISTS date; +CREATE TABLE date +( + date date, + date_nn date NOT NULL, + date_nn_unique date NOT NULL UNIQUE, + date_nn_check date NOT NULL CHECK ( date > '2020-03-01' +) , + date_nn_ref date NOT NULL REFERENCES date_ref(date_ref), + date_nn_def_const date NOT NULL DEFAULT '2020-03-01', + date_nn_def_func date NOT NULL DEFAULT now(), + date_nn_unique_check date NOT NULL UNIQUE CHECK ( date > '2020-03-01' ), + + date_unique date UNIQUE, + date_unique_check date UNIQUE CHECK ( date > '2020-03-01' ), + date_unique_ref date UNIQUE REFERENCES date_ref(date_ref), + date_unique_def_const date UNIQUE DEFAULT '2020-03-01', + date_unique_def_func date UNIQUE DEFAULT now(), + + date_check date CHECK ( date > '2020-03-01' ), + date_check_ref date CHECK ( date > '2020-03-01' ) REFERENCES date_ref(date_ref), + date_check_def_const date CHECK ( date > '2020-03-01' ) DEFAULT '2020-03-01', + date_check_def_func date CHECK ( date > '2020-03-01' ) DEFAULT now(), + + date_ref date REFERENCES date_ref(date_ref), + date_ref_def_const date REFERENCES date_ref(date_ref) DEFAULT '2020-03-01', + date_ref_def_func date REFERENCES date_ref(date_ref) DEFAULT now(), + date_ref_unique_check date UNIQUE CHECK ( date > '2020-03-01' ) REFERENCES date_ref(date_ref), + + date_def_const date DEFAULT '2020-03-01', + date_def_const_unique_check date UNIQUE CHECK ( date > '2020-03-01' )DEFAULT '2020-03-01', + + date_def_func date DEFAULT now(), + date_def_func_unique_check date UNIQUE CHECK ( date > '2020-03-01' ) DEFAULT now() +); + +DROP TABLE IF EXISTS date_pk; +CREATE TABLE date_pk +( + date_pk date PRIMARY KEY +); + +DROP TABLE IF EXISTS date_pk_ref; +CREATE TABLE date_pk_ref +( + date_pk_ref date PRIMARY KEY REFERENCES date_ref (date_ref) +); + +DROP TABLE IF EXISTS date_pk_def_const; +CREATE TABLE date_pk_def_const +( + date_pk_def_const date PRIMARY KEY DEFAULT '2020-03-01' +); + +DROP TABLE IF EXISTS date_pk_def_func; +CREATE TABLE date_pk_def_func +( + date_pk_def_func date PRIMARY KEY DEFAULT now() +); + +DROP TABLE IF EXISTS date_nn_pk; +CREATE TABLE date_nn_pk +( + date_nn_pk date NOT NULL PRIMARY KEY +); + +DROP TABLE IF EXISTS date_nn_unique_check_pk; +CREATE TABLE date_nn_unique_check_pk +( + date_nn_unique_check_pk date PRIMARY KEY NOT NULL UNIQUE CHECK ( date_nn_unique_check_pk > '2020-03-01' ) +); + +DROP TABLE IF EXISTS date_nn_unique_check_pk_ref; +CREATE TABLE date_nn_unique_check_pk_ref +( + date_nn_unique_check_pk_ref date PRIMARY KEY NOT NULL UNIQUE CHECK ( date_nn_unique_check_pk_ref > '2020-03-01' ) REFERENCES date_ref (date_ref) +); + +DROP TABLE IF EXISTS date_unique_pk; +CREATE TABLE date_unique_pk +( + date_unique_pk date PRIMARY KEY UNIQUE +); + +DROP TABLE IF EXISTS date_unique_check_pk; +CREATE TABLE date_unique_check_pk +( + date_unique_check_pk date PRIMARY KEY UNIQUE CHECK ( date_unique_check_pk > '2020-03-01' ) +); + +DROP TABLE IF EXISTS date_unique_check_pk_ref; +CREATE TABLE date_unique_check_pk_ref +( + date_unique_check_pk_ref date PRIMARY KEY UNIQUE CHECK ( date_unique_check_pk_ref > '2020-03-01' ) REFERENCES date_ref (date_ref) +); + +DROP TABLE IF EXISTS date_check_pk; +CREATE TABLE date_check_pk +( + date_check_pk date PRIMARY KEY CHECK ( date_check_pk > '2020-03-01' ) +); + +DROP TABLE IF EXISTS date_def_const_unique_check_pk; +CREATE TABLE date_def_const_unique_check_pk +( + date_def_const_unique_check_pk date PRIMARY KEY UNIQUE CHECK ( date_def_const_unique_check_pk > '2020-03-01' ) DEFAULT '2020-03-01' +); + +DROP TABLE IF EXISTS date_def_const_unique_check_pk_ref; +CREATE TABLE date_def_const_unique_check_pk_ref +( + date_def_const_unique_check_pk_ref date PRIMARY KEY UNIQUE CHECK ( date_def_const_unique_check_pk_ref > '2020-03-01' ) DEFAULT '2020-03-01' REFERENCES date_ref (date_ref) +); + +DROP TABLE IF EXISTS date_def_func_unique_check_pk; +CREATE TABLE date_def_func_unique_check_pk +( + date_def_func_unique_check_pk date PRIMARY KEY UNIQUE CHECK ( date_def_func_unique_check_pk > '2020-03-01' ) DEFAULT now() +); + +DROP TABLE IF EXISTS date_def_func_unique_check_pk_ref; +CREATE TABLE date_def_func_unique_check_pk_ref +( + date_def_func_unique_check_pk_ref date PRIMARY KEY UNIQUE CHECK ( date_def_func_unique_check_pk_ref > '2020-03-01' ) DEFAULT now() REFERENCES date_ref (date_ref) +); diff --git a/internal/integration_tests/postgres/testdata/decimal.sql b/internal/integration_tests/postgres/testdata/decimal.sql new file mode 100644 index 00000000..a54bd4dc --- /dev/null +++ b/internal/integration_tests/postgres/testdata/decimal.sql @@ -0,0 +1,131 @@ +DROP TABLE IF EXISTS decimal_ref CASCADE; +CREATE TABLE decimal_ref +( + decimal_ref decimal UNIQUE +); + +DROP TABLE IF EXISTS decimal; +CREATE TABLE decimal +( + decimal decimal, + decimal_nn decimal NOT NULL, + decimal_nn_unique decimal NOT NULL UNIQUE, + decimal_nn_check decimal NOT NULL CHECK ( decimal > 0 +) , + decimal_nn_ref decimal NOT NULL REFERENCES decimal_ref(decimal_ref), + decimal_nn_def_const decimal NOT NULL DEFAULT 42, + decimal_nn_def_func decimal NOT NULL DEFAULT pi(), + decimal_nn_unique_check decimal NOT NULL UNIQUE CHECK ( decimal > 0 ), + + decimal_unique decimal UNIQUE, + decimal_unique_check decimal UNIQUE CHECK ( decimal > 0 ), + decimal_unique_ref decimal UNIQUE REFERENCES decimal_ref(decimal_ref), + decimal_unique_def_const decimal UNIQUE DEFAULT 42, + decimal_unique_def_func decimal UNIQUE DEFAULT pi(), + + decimal_check decimal CHECK ( decimal > 0 ), + decimal_check_ref decimal CHECK ( decimal > 0 ) REFERENCES decimal_ref(decimal_ref), + decimal_check_def_const decimal CHECK ( decimal > 0 ) DEFAULT 42, + decimal_check_def_func decimal CHECK ( decimal > 0 ) DEFAULT pi(), + + decimal_ref decimal REFERENCES decimal_ref(decimal_ref), + decimal_ref_def_const decimal REFERENCES decimal_ref(decimal_ref) DEFAULT 42, + decimal_ref_def_func decimal REFERENCES decimal_ref(decimal_ref) DEFAULT pi(), + decimal_ref_unique_check decimal UNIQUE CHECK ( decimal > 0 ) REFERENCES decimal_ref(decimal_ref), + + decimal_def_const decimal DEFAULT 42, + decimal_def_const_unique_check decimal UNIQUE CHECK ( decimal > 0 )DEFAULT 42, + + decimal_def_func decimal DEFAULT pi(), + decimal_def_func_unique_check decimal UNIQUE CHECK ( decimal > 0 ) DEFAULT pi() +); + +DROP TABLE IF EXISTS decimal_pk; +CREATE TABLE decimal_pk +( + decimal_pk decimal PRIMARY KEY +); + +DROP TABLE IF EXISTS decimal_pk_ref; +CREATE TABLE decimal_pk_ref +( + decimal_pk_ref decimal PRIMARY KEY REFERENCES decimal_ref (decimal_ref) +); + +DROP TABLE IF EXISTS decimal_pk_def_const; +CREATE TABLE decimal_pk_def_const +( + decimal_pk_def_const decimal PRIMARY KEY DEFAULT 42 +); + +DROP TABLE IF EXISTS decimal_pk_def_func; +CREATE TABLE decimal_pk_def_func +( + decimal_pk_def_func decimal PRIMARY KEY DEFAULT pi() +); + +DROP TABLE IF EXISTS decimal_nn_pk; +CREATE TABLE decimal_nn_pk +( + decimal_nn_pk decimal NOT NULL PRIMARY KEY +); + +DROP TABLE IF EXISTS decimal_nn_unique_check_pk; +CREATE TABLE decimal_nn_unique_check_pk +( + decimal_nn_unique_check_pk decimal PRIMARY KEY NOT NULL UNIQUE CHECK ( decimal_nn_unique_check_pk > 0) +); + +DROP TABLE IF EXISTS decimal_nn_unique_check_pk_ref; +CREATE TABLE decimal_nn_unique_check_pk_ref +( + decimal_nn_unique_check_pk_ref decimal PRIMARY KEY NOT NULL UNIQUE CHECK ( decimal_nn_unique_check_pk_ref > 0) REFERENCES decimal_ref (decimal_ref) +); + +DROP TABLE IF EXISTS decimal_unique_pk; +CREATE TABLE decimal_unique_pk +( + decimal_unique_pk decimal PRIMARY KEY UNIQUE +); + +DROP TABLE IF EXISTS decimal_unique_check_pk; +CREATE TABLE decimal_unique_check_pk +( + decimal_unique_check_pk decimal PRIMARY KEY UNIQUE CHECK ( decimal_unique_check_pk > 0 ) +); + +DROP TABLE IF EXISTS decimal_unique_check_pk_ref; +CREATE TABLE decimal_unique_check_pk_ref +( + decimal_unique_check_pk_ref decimal PRIMARY KEY UNIQUE CHECK ( decimal_unique_check_pk_ref > 0) REFERENCES decimal_ref (decimal_ref) +); + +DROP TABLE IF EXISTS decimal_check_pk; +CREATE TABLE decimal_check_pk +( + decimal_check_pk decimal PRIMARY KEY CHECK ( decimal_check_pk > 0 ) +); + +DROP TABLE IF EXISTS decimal_def_const_unique_check_pk; +CREATE TABLE decimal_def_const_unique_check_pk +( + decimal_def_const_unique_check_pk decimal PRIMARY KEY UNIQUE CHECK ( decimal_def_const_unique_check_pk > 0 ) DEFAULT 42 +); + +DROP TABLE IF EXISTS decimal_def_const_unique_check_pk_ref; +CREATE TABLE decimal_def_const_unique_check_pk_ref +( + decimal_def_const_unique_check_pk_ref decimal PRIMARY KEY UNIQUE CHECK ( decimal_def_const_unique_check_pk_ref > 0 ) DEFAULT 42 REFERENCES decimal_ref (decimal_ref) +); + +DROP TABLE IF EXISTS decimal_def_func_unique_check_pk; +CREATE TABLE decimal_def_func_unique_check_pk +( + decimal_def_func_unique_check_pk decimal PRIMARY KEY UNIQUE CHECK ( decimal_def_func_unique_check_pk > 0 ) DEFAULT pi() +); + +DROP TABLE IF EXISTS decimal_def_func_unique_check_pk_ref; +CREATE TABLE decimal_def_func_unique_check_pk_ref +( + decimal_def_func_unique_check_pk_ref decimal PRIMARY KEY UNIQUE CHECK ( decimal_def_func_unique_check_pk_ref > 0 ) DEFAULT pi() REFERENCES decimal_ref (decimal_ref) +); diff --git a/internal/integration_tests/postgres/testdata/doubleprecision.sql b/internal/integration_tests/postgres/testdata/doubleprecision.sql new file mode 100644 index 00000000..358a05ad --- /dev/null +++ b/internal/integration_tests/postgres/testdata/doubleprecision.sql @@ -0,0 +1,130 @@ +DROP TABLE IF EXISTS double_precision_ref CASCADE; +CREATE TABLE double_precision_ref +( + double_precision_ref double precision UNIQUE +); + +DROP TABLE IF EXISTS double_precision; +CREATE TABLE double_precision +( + double_precision double precision, + double_precision_nn double precision NOT NULL, + double_precision_nn_unique double precision NOT NULL UNIQUE, + double_precision_nn_check double precision NOT NULL CHECK ( double_precision > 0 ), + double_precision_nn_ref double precision NOT NULL REFERENCES double_precision_ref (double_precision_ref), + double_precision_nn_def_const double precision NOT NULL DEFAULT 42, + double_precision_nn_def_func double precision NOT NULL DEFAULT pi(), + double_precision_nn_unique_check double precision NOT NULL UNIQUE CHECK ( double_precision > 0 ), + + double_precision_unique double precision UNIQUE, + double_precision_unique_check double precision UNIQUE CHECK ( double_precision > 0 ), + double_precision_unique_ref double precision UNIQUE REFERENCES double_precision_ref (double_precision_ref), + double_precision_unique_def_const double precision UNIQUE DEFAULT 42, + double_precision_unique_def_func double precision UNIQUE DEFAULT pi(), + + double_precision_check double precision CHECK ( double_precision > 0 ), + double_precision_check_ref double precision CHECK ( double_precision > 0 ) REFERENCES double_precision_ref (double_precision_ref), + double_precision_check_def_const double precision CHECK ( double_precision > 0 ) DEFAULT 42, + double_precision_check_def_func double precision CHECK ( double_precision > 0 ) DEFAULT pi(), + + double_precision_ref double precision REFERENCES double_precision_ref (double_precision_ref), + double_precision_ref_def_const double precision REFERENCES double_precision_ref (double_precision_ref) DEFAULT 42, + double_precision_ref_def_func double precision REFERENCES double_precision_ref (double_precision_ref) DEFAULT pi(), + double_precision_ref_unique_check double precision UNIQUE CHECK ( double_precision > 0 ) REFERENCES double_precision_ref (double_precision_ref), + + double_precision_def_const double precision DEFAULT 42, + double_precision_def_const_unique_check double precision UNIQUE CHECK ( double_precision > 0 ) DEFAULT 42, + + double_precision_def_func double precision DEFAULT pi(), + double_precision_def_func_unique_check double precision UNIQUE CHECK ( double_precision > 0 ) DEFAULT pi() +); + +DROP TABLE IF EXISTS double_precision_pk; +CREATE TABLE double_precision_pk +( + double_precision_pk double precision PRIMARY KEY +); + +DROP TABLE IF EXISTS double_precision_pk_ref; +CREATE TABLE double_precision_pk_ref +( + double_precision_pk_ref double precision PRIMARY KEY REFERENCES double_precision_ref (double_precision_ref) +); + +DROP TABLE IF EXISTS double_precision_pk_def_const; +CREATE TABLE double_precision_pk_def_const +( + double_precision_pk_def_const double precision PRIMARY KEY DEFAULT 42 +); + +DROP TABLE IF EXISTS double_precision_pk_def_func; +CREATE TABLE double_precision_pk_def_func +( + double_precision_pk_def_func double precision PRIMARY KEY DEFAULT pi() +); + +DROP TABLE IF EXISTS double_precision_nn_pk; +CREATE TABLE double_precision_nn_pk +( + double_precision_nn_pk double precision NOT NULL PRIMARY KEY +); + +DROP TABLE IF EXISTS double_precision_nn_unique_check_pk; +CREATE TABLE double_precision_nn_unique_check_pk +( + double_precision_nn_unique_check_pk double precision PRIMARY KEY NOT NULL UNIQUE CHECK ( double_precision_nn_unique_check_pk > 0) +); + +DROP TABLE IF EXISTS double_precision_nn_unique_check_pk_ref; +CREATE TABLE double_precision_nn_unique_check_pk_ref +( + double_precision_nn_unique_check_pk_ref double precision PRIMARY KEY NOT NULL UNIQUE CHECK ( double_precision_nn_unique_check_pk_ref > 0) REFERENCES double_precision_ref (double_precision_ref) +); + +DROP TABLE IF EXISTS double_precision_unique_pk; +CREATE TABLE double_precision_unique_pk +( + double_precision_unique_pk double precision PRIMARY KEY UNIQUE +); + +DROP TABLE IF EXISTS double_precision_unique_check_pk; +CREATE TABLE double_precision_unique_check_pk +( + double_precision_unique_check_pk double precision PRIMARY KEY UNIQUE CHECK ( double_precision_unique_check_pk > 0 ) +); + +DROP TABLE IF EXISTS double_precision_unique_check_pk_ref; +CREATE TABLE double_precision_unique_check_pk_ref +( + double_precision_unique_check_pk_ref double precision PRIMARY KEY UNIQUE CHECK ( double_precision_unique_check_pk_ref > 0) REFERENCES double_precision_ref (double_precision_ref) +); + +DROP TABLE IF EXISTS double_precision_check_pk; +CREATE TABLE double_precision_check_pk +( + double_precision_check_pk double precision PRIMARY KEY CHECK ( double_precision_check_pk > 0 ) +); + +DROP TABLE IF EXISTS double_precision_def_const_unique_check_pk; +CREATE TABLE double_precision_def_const_unique_check_pk +( + double_precision_def_const_unique_check_pk double precision PRIMARY KEY UNIQUE CHECK ( double_precision_def_const_unique_check_pk > 0 ) DEFAULT 42 +); + +DROP TABLE IF EXISTS double_precision_def_const_unique_check_pk_ref; +CREATE TABLE double_precision_def_const_unique_check_pk_ref +( + double_precision_def_const_unique_check_pk_ref double precision PRIMARY KEY UNIQUE CHECK ( double_precision_def_const_unique_check_pk_ref > 0 ) DEFAULT 42 REFERENCES double_precision_ref (double_precision_ref) +); + +DROP TABLE IF EXISTS double_precision_def_func_unique_check_pk; +CREATE TABLE double_precision_def_func_unique_check_pk +( + double_precision_def_func_unique_check_pk double precision PRIMARY KEY UNIQUE CHECK ( double_precision_def_func_unique_check_pk > 0 ) DEFAULT pi() +); + +DROP TABLE IF EXISTS double_precision_def_func_unique_check_pk_ref; +CREATE TABLE double_precision_def_func_unique_check_pk_ref +( + double_precision_def_func_unique_check_pk_ref double precision PRIMARY KEY UNIQUE CHECK ( double_precision_def_func_unique_check_pk_ref > 0 ) DEFAULT pi() REFERENCES double_precision_ref (double_precision_ref) +); diff --git a/internal/integration_tests/postgres/testdata/float.sql b/internal/integration_tests/postgres/testdata/float.sql new file mode 100644 index 00000000..03a50398 --- /dev/null +++ b/internal/integration_tests/postgres/testdata/float.sql @@ -0,0 +1,131 @@ +DROP TABLE IF EXISTS float_ref CASCADE; +CREATE TABLE float_ref +( + float_ref float UNIQUE +); + +DROP TABLE IF EXISTS float; +CREATE TABLE float +( + float float, + float_nn float NOT NULL, + float_nn_unique float NOT NULL UNIQUE, + float_nn_check float NOT NULL CHECK ( float > 0 +) , + float_nn_ref float NOT NULL REFERENCES float_ref(float_ref), + float_nn_def_const float NOT NULL DEFAULT 42, + float_nn_def_func float NOT NULL DEFAULT pi(), + float_nn_unique_check float NOT NULL UNIQUE CHECK ( float > 0 ), + + float_unique float UNIQUE, + float_unique_check float UNIQUE CHECK ( float > 0 ), + float_unique_ref float UNIQUE REFERENCES float_ref(float_ref), + float_unique_def_const float UNIQUE DEFAULT 42, + float_unique_def_func float UNIQUE DEFAULT pi(), + + float_check float CHECK ( float > 0 ), + float_check_ref float CHECK ( float > 0 ) REFERENCES float_ref(float_ref), + float_check_def_const float CHECK ( float > 0 ) DEFAULT 42, + float_check_def_func float CHECK ( float > 0 ) DEFAULT pi(), + + float_ref float REFERENCES float_ref(float_ref), + float_ref_def_const float REFERENCES float_ref(float_ref) DEFAULT 42, + float_ref_def_func float REFERENCES float_ref(float_ref) DEFAULT pi(), + float_ref_unique_check float UNIQUE CHECK ( float > 0 ) REFERENCES float_ref(float_ref), + + float_def_const float DEFAULT 42, + float_def_const_unique_check float UNIQUE CHECK ( float > 0 )DEFAULT 42, + + float_def_func float DEFAULT pi(), + float_def_func_unique_check float UNIQUE CHECK ( float > 0 ) DEFAULT pi() +); + +DROP TABLE IF EXISTS float_pk; +CREATE TABLE float_pk +( + float_pk float PRIMARY KEY +); + +DROP TABLE IF EXISTS float_pk_ref; +CREATE TABLE float_pk_ref +( + float_pk_ref float PRIMARY KEY REFERENCES float_ref (float_ref) +); + +DROP TABLE IF EXISTS float_pk_def_const; +CREATE TABLE float_pk_def_const +( + float_pk_def_const float PRIMARY KEY DEFAULT 42 +); + +DROP TABLE IF EXISTS float_pk_def_func; +CREATE TABLE float_pk_def_func +( + float_pk_def_func float PRIMARY KEY DEFAULT pi() +); + +DROP TABLE IF EXISTS float_nn_pk; +CREATE TABLE float_nn_pk +( + float_nn_pk float NOT NULL PRIMARY KEY +); + +DROP TABLE IF EXISTS float_nn_unique_check_pk; +CREATE TABLE float_nn_unique_check_pk +( + float_nn_unique_check_pk float PRIMARY KEY NOT NULL UNIQUE CHECK ( float_nn_unique_check_pk > 0) +); + +DROP TABLE IF EXISTS float_nn_unique_check_pk_ref; +CREATE TABLE float_nn_unique_check_pk_ref +( + float_nn_unique_check_pk_ref float PRIMARY KEY NOT NULL UNIQUE CHECK ( float_nn_unique_check_pk_ref > 0) REFERENCES float_ref (float_ref) +); + +DROP TABLE IF EXISTS float_unique_pk; +CREATE TABLE float_unique_pk +( + float_unique_pk float PRIMARY KEY UNIQUE +); + +DROP TABLE IF EXISTS float_unique_check_pk; +CREATE TABLE float_unique_check_pk +( + float_unique_check_pk float PRIMARY KEY UNIQUE CHECK ( float_unique_check_pk > 0 ) +); + +DROP TABLE IF EXISTS float_unique_check_pk_ref; +CREATE TABLE float_unique_check_pk_ref +( + float_unique_check_pk_ref float PRIMARY KEY UNIQUE CHECK ( float_unique_check_pk_ref > 0) REFERENCES float_ref (float_ref) +); + +DROP TABLE IF EXISTS float_check_pk; +CREATE TABLE float_check_pk +( + float_check_pk float PRIMARY KEY CHECK ( float_check_pk > 0 ) +); + +DROP TABLE IF EXISTS float_def_const_unique_check_pk; +CREATE TABLE float_def_const_unique_check_pk +( + float_def_const_unique_check_pk float PRIMARY KEY UNIQUE CHECK ( float_def_const_unique_check_pk > 0 ) DEFAULT 42 +); + +DROP TABLE IF EXISTS float_def_const_unique_check_pk_ref; +CREATE TABLE float_def_const_unique_check_pk_ref +( + float_def_const_unique_check_pk_ref float PRIMARY KEY UNIQUE CHECK ( float_def_const_unique_check_pk_ref > 0 ) DEFAULT 42 REFERENCES float_ref (float_ref) +); + +DROP TABLE IF EXISTS float_def_func_unique_check_pk; +CREATE TABLE float_def_func_unique_check_pk +( + float_def_func_unique_check_pk float PRIMARY KEY UNIQUE CHECK ( float_def_func_unique_check_pk > 0 ) DEFAULT pi() +); + +DROP TABLE IF EXISTS float_def_func_unique_check_pk_ref; +CREATE TABLE float_def_func_unique_check_pk_ref +( + float_def_func_unique_check_pk_ref float PRIMARY KEY UNIQUE CHECK ( float_def_func_unique_check_pk_ref > 0 ) DEFAULT pi() REFERENCES float_ref (float_ref) +); diff --git a/internal/integration_tests/postgres/testdata/float4.sql b/internal/integration_tests/postgres/testdata/float4.sql new file mode 100644 index 00000000..594f48d1 --- /dev/null +++ b/internal/integration_tests/postgres/testdata/float4.sql @@ -0,0 +1,130 @@ +DROP TABLE IF EXISTS float4_ref CASCADE; +CREATE TABLE float4_ref +( + float4_ref float4 UNIQUE +); + +DROP TABLE IF EXISTS float4; +CREATE TABLE float4 +( + float4 float4, + float4_nn float4 NOT NULL, + float4_nn_unique float4 NOT NULL UNIQUE, + float4_nn_check float4 NOT NULL CHECK ( float4 > 0 ), + float4_nn_ref float4 NOT NULL REFERENCES float4_ref (float4_ref), + float4_nn_def_const float4 NOT NULL DEFAULT 42, + float4_nn_def_func float4 NOT NULL DEFAULT pi(), + float4_nn_unique_check float4 NOT NULL UNIQUE CHECK ( float4 > 0 ), + + float4_unique float4 UNIQUE, + float4_unique_check float4 UNIQUE CHECK ( float4 > 0 ), + float4_unique_ref float4 UNIQUE REFERENCES float4_ref (float4_ref), + float4_unique_def_const float4 UNIQUE DEFAULT 42, + float4_unique_def_func float4 UNIQUE DEFAULT pi(), + + float4_check float4 CHECK ( float4 > 0 ), + float4_check_ref float4 CHECK ( float4 > 0 ) REFERENCES float4_ref (float4_ref), + float4_check_def_const float4 CHECK ( float4 > 0 ) DEFAULT 42, + float4_check_def_func float4 CHECK ( float4 > 0 ) DEFAULT pi(), + + float4_ref float4 REFERENCES float4_ref (float4_ref), + float4_ref_def_const float4 REFERENCES float4_ref (float4_ref) DEFAULT 42, + float4_ref_def_func float4 REFERENCES float4_ref (float4_ref) DEFAULT pi(), + float4_ref_unique_check float4 UNIQUE CHECK ( float4 > 0 ) REFERENCES float4_ref (float4_ref), + + float4_def_const float4 DEFAULT 42, + float4_def_const_unique_check float4 UNIQUE CHECK ( float4 > 0 ) DEFAULT 42, + + float4_def_func float4 DEFAULT pi(), + float4_def_func_unique_check float4 UNIQUE CHECK ( float4 > 0 ) DEFAULT pi() +); + +DROP TABLE IF EXISTS float4_pk; +CREATE TABLE float4_pk +( + float4_pk float4 PRIMARY KEY +); + +DROP TABLE IF EXISTS float4_pk_ref; +CREATE TABLE float4_pk_ref +( + float4_pk_ref float4 PRIMARY KEY REFERENCES float4_ref (float4_ref) +); + +DROP TABLE IF EXISTS float4_pk_def_const; +CREATE TABLE float4_pk_def_const +( + float4_pk_def_const float4 PRIMARY KEY DEFAULT 42 +); + +DROP TABLE IF EXISTS float4_pk_def_func; +CREATE TABLE float4_pk_def_func +( + float4_pk_def_func float4 PRIMARY KEY DEFAULT pi() +); + +DROP TABLE IF EXISTS float4_nn_pk; +CREATE TABLE float4_nn_pk +( + float4_nn_pk float4 NOT NULL PRIMARY KEY +); + +DROP TABLE IF EXISTS float4_nn_unique_check_pk; +CREATE TABLE float4_nn_unique_check_pk +( + float4_nn_unique_check_pk float4 PRIMARY KEY NOT NULL UNIQUE CHECK ( float4_nn_unique_check_pk > 0) +); + +DROP TABLE IF EXISTS float4_nn_unique_check_pk_ref; +CREATE TABLE float4_nn_unique_check_pk_ref +( + float4_nn_unique_check_pk_ref float4 PRIMARY KEY NOT NULL UNIQUE CHECK ( float4_nn_unique_check_pk_ref > 0) REFERENCES float4_ref (float4_ref) +); + +DROP TABLE IF EXISTS float4_unique_pk; +CREATE TABLE float4_unique_pk +( + float4_unique_pk float4 PRIMARY KEY UNIQUE +); + +DROP TABLE IF EXISTS float4_unique_check_pk; +CREATE TABLE float4_unique_check_pk +( + float4_unique_check_pk float4 PRIMARY KEY UNIQUE CHECK ( float4_unique_check_pk > 0 ) +); + +DROP TABLE IF EXISTS float4_unique_check_pk_ref; +CREATE TABLE float4_unique_check_pk_ref +( + float4_unique_check_pk_ref float4 PRIMARY KEY UNIQUE CHECK ( float4_unique_check_pk_ref > 0) REFERENCES float4_ref (float4_ref) +); + +DROP TABLE IF EXISTS float4_check_pk; +CREATE TABLE float4_check_pk +( + float4_check_pk float4 PRIMARY KEY CHECK ( float4_check_pk > 0 ) +); + +DROP TABLE IF EXISTS float4_def_const_unique_check_pk; +CREATE TABLE float4_def_const_unique_check_pk +( + float4_def_const_unique_check_pk float4 PRIMARY KEY UNIQUE CHECK ( float4_def_const_unique_check_pk > 0 ) DEFAULT 42 +); + +DROP TABLE IF EXISTS float4_def_const_unique_check_pk_ref; +CREATE TABLE float4_def_const_unique_check_pk_ref +( + float4_def_const_unique_check_pk_ref float4 PRIMARY KEY UNIQUE CHECK ( float4_def_const_unique_check_pk_ref > 0 ) DEFAULT 42 REFERENCES float4_ref (float4_ref) +); + +DROP TABLE IF EXISTS float4_def_func_unique_check_pk; +CREATE TABLE float4_def_func_unique_check_pk +( + float4_def_func_unique_check_pk float4 PRIMARY KEY UNIQUE CHECK ( float4_def_func_unique_check_pk > 0 ) DEFAULT pi() +); + +DROP TABLE IF EXISTS float4_def_func_unique_check_pk_ref; +CREATE TABLE float4_def_func_unique_check_pk_ref +( + float4_def_func_unique_check_pk_ref float4 PRIMARY KEY UNIQUE CHECK ( float4_def_func_unique_check_pk_ref > 0 ) DEFAULT pi() REFERENCES float4_ref (float4_ref) +); diff --git a/internal/integration_tests/postgres/testdata/float8.sql b/internal/integration_tests/postgres/testdata/float8.sql new file mode 100644 index 00000000..d33ec4be --- /dev/null +++ b/internal/integration_tests/postgres/testdata/float8.sql @@ -0,0 +1,130 @@ +DROP TABLE IF EXISTS float8_ref CASCADE; +CREATE TABLE float8_ref +( + float8_ref float8 UNIQUE +); + +DROP TABLE IF EXISTS float8; +CREATE TABLE float8 +( + float8 float8, + float8_nn float8 NOT NULL, + float8_nn_unique float8 NOT NULL UNIQUE, + float8_nn_check float8 NOT NULL CHECK ( float8 > 0 ), + float8_nn_ref float8 NOT NULL REFERENCES float8_ref (float8_ref), + float8_nn_def_const float8 NOT NULL DEFAULT 42, + float8_nn_def_func float8 NOT NULL DEFAULT pi(), + float8_nn_unique_check float8 NOT NULL UNIQUE CHECK ( float8 > 0 ), + + float8_unique float8 UNIQUE, + float8_unique_check float8 UNIQUE CHECK ( float8 > 0 ), + float8_unique_ref float8 UNIQUE REFERENCES float8_ref (float8_ref), + float8_unique_def_const float8 UNIQUE DEFAULT 42, + float8_unique_def_func float8 UNIQUE DEFAULT pi(), + + float8_check float8 CHECK ( float8 > 0 ), + float8_check_ref float8 CHECK ( float8 > 0 ) REFERENCES float8_ref (float8_ref), + float8_check_def_const float8 CHECK ( float8 > 0 ) DEFAULT 42, + float8_check_def_func float8 CHECK ( float8 > 0 ) DEFAULT pi(), + + float8_ref float8 REFERENCES float8_ref (float8_ref), + float8_ref_def_const float8 REFERENCES float8_ref (float8_ref) DEFAULT 42, + float8_ref_def_func float8 REFERENCES float8_ref (float8_ref) DEFAULT pi(), + float8_ref_unique_check float8 UNIQUE CHECK ( float8 > 0 ) REFERENCES float8_ref (float8_ref), + + float8_def_const float8 DEFAULT 42, + float8_def_const_unique_check float8 UNIQUE CHECK ( float8 > 0 ) DEFAULT 42, + + float8_def_func float8 DEFAULT pi(), + float8_def_func_unique_check float8 UNIQUE CHECK ( float8 > 0 ) DEFAULT pi() +); + +DROP TABLE IF EXISTS float8_pk; +CREATE TABLE float8_pk +( + float8_pk float8 PRIMARY KEY +); + +DROP TABLE IF EXISTS float8_pk_ref; +CREATE TABLE float8_pk_ref +( + float8_pk_ref float8 PRIMARY KEY REFERENCES float8_ref (float8_ref) +); + +DROP TABLE IF EXISTS float8_pk_def_const; +CREATE TABLE float8_pk_def_const +( + float8_pk_def_const float8 PRIMARY KEY DEFAULT 42 +); + +DROP TABLE IF EXISTS float8_pk_def_func; +CREATE TABLE float8_pk_def_func +( + float8_pk_def_func float8 PRIMARY KEY DEFAULT pi() +); + +DROP TABLE IF EXISTS float8_nn_pk; +CREATE TABLE float8_nn_pk +( + float8_nn_pk float8 NOT NULL PRIMARY KEY +); + +DROP TABLE IF EXISTS float8_nn_unique_check_pk; +CREATE TABLE float8_nn_unique_check_pk +( + float8_nn_unique_check_pk float8 PRIMARY KEY NOT NULL UNIQUE CHECK ( float8_nn_unique_check_pk > 0) +); + +DROP TABLE IF EXISTS float8_nn_unique_check_pk_ref; +CREATE TABLE float8_nn_unique_check_pk_ref +( + float8_nn_unique_check_pk_ref float8 PRIMARY KEY NOT NULL UNIQUE CHECK ( float8_nn_unique_check_pk_ref > 0) REFERENCES float8_ref (float8_ref) +); + +DROP TABLE IF EXISTS float8_unique_pk; +CREATE TABLE float8_unique_pk +( + float8_unique_pk float8 PRIMARY KEY UNIQUE +); + +DROP TABLE IF EXISTS float8_unique_check_pk; +CREATE TABLE float8_unique_check_pk +( + float8_unique_check_pk float8 PRIMARY KEY UNIQUE CHECK ( float8_unique_check_pk > 0 ) +); + +DROP TABLE IF EXISTS float8_unique_check_pk_ref; +CREATE TABLE float8_unique_check_pk_ref +( + float8_unique_check_pk_ref float8 PRIMARY KEY UNIQUE CHECK ( float8_unique_check_pk_ref > 0) REFERENCES float8_ref (float8_ref) +); + +DROP TABLE IF EXISTS float8_check_pk; +CREATE TABLE float8_check_pk +( + float8_check_pk float8 PRIMARY KEY CHECK ( float8_check_pk > 0 ) +); + +DROP TABLE IF EXISTS float8_def_const_unique_check_pk; +CREATE TABLE float8_def_const_unique_check_pk +( + float8_def_const_unique_check_pk float8 PRIMARY KEY UNIQUE CHECK ( float8_def_const_unique_check_pk > 0 ) DEFAULT 42 +); + +DROP TABLE IF EXISTS float8_def_const_unique_check_pk_ref; +CREATE TABLE float8_def_const_unique_check_pk_ref +( + float8_def_const_unique_check_pk_ref float8 PRIMARY KEY UNIQUE CHECK ( float8_def_const_unique_check_pk_ref > 0 ) DEFAULT 42 REFERENCES float8_ref (float8_ref) +); + +DROP TABLE IF EXISTS float8_def_func_unique_check_pk; +CREATE TABLE float8_def_func_unique_check_pk +( + float8_def_func_unique_check_pk float8 PRIMARY KEY UNIQUE CHECK ( float8_def_func_unique_check_pk > 0 ) DEFAULT pi() +); + +DROP TABLE IF EXISTS float8_def_func_unique_check_pk_ref; +CREATE TABLE float8_def_func_unique_check_pk_ref +( + float8_def_func_unique_check_pk_ref float8 PRIMARY KEY UNIQUE CHECK ( float8_def_func_unique_check_pk_ref > 0 ) DEFAULT pi() REFERENCES float8_ref (float8_ref) +); diff --git a/internal/integration_tests/postgres/testdata/int2.sql b/internal/integration_tests/postgres/testdata/int2.sql new file mode 100644 index 00000000..ae7f495c --- /dev/null +++ b/internal/integration_tests/postgres/testdata/int2.sql @@ -0,0 +1,130 @@ +DROP TABLE IF EXISTS int2_ref CASCADE; +CREATE TABLE int2_ref +( + int2_ref int2 UNIQUE +); + +DROP TABLE IF EXISTS int2; +CREATE TABLE int2 +( + int2 int2, + int2_nn int2 NOT NULL, + int2_nn_unique int2 NOT NULL UNIQUE, + int2_nn_check int2 NOT NULL CHECK ( int2 > 0 ), + int2_nn_ref int2 NOT NULL REFERENCES int2_ref (int2_ref), + int2_nn_def_const int2 NOT NULL DEFAULT 42, + int2_nn_def_func int2 NOT NULL DEFAULT pi(), + int2_nn_unique_check int2 NOT NULL UNIQUE CHECK ( int2 > 0 ), + + int2_unique int2 UNIQUE, + int2_unique_check int2 UNIQUE CHECK ( int2 > 0 ), + int2_unique_ref int2 UNIQUE REFERENCES int2_ref (int2_ref), + int2_unique_def_const int2 UNIQUE DEFAULT 42, + int2_unique_def_func int2 UNIQUE DEFAULT pi(), + + int2_check int2 CHECK ( int2 > 0 ), + int2_check_ref int2 CHECK ( int2 > 0 ) REFERENCES int2_ref (int2_ref), + int2_check_def_const int2 CHECK ( int2 > 0 ) DEFAULT 42, + int2_check_def_func int2 CHECK ( int2 > 0 ) DEFAULT pi(), + + int2_ref int2 REFERENCES int2_ref (int2_ref), + int2_ref_def_const int2 REFERENCES int2_ref (int2_ref) DEFAULT 42, + int2_ref_def_func int2 REFERENCES int2_ref (int2_ref) DEFAULT pi(), + int2_ref_unique_check int2 UNIQUE CHECK ( int2 > 0 ) REFERENCES int2_ref (int2_ref), + + int2_def_const int2 DEFAULT 42, + int2_def_const_unique_check int2 UNIQUE CHECK ( int2 > 0 ) DEFAULT 42, + + int2_def_func int2 DEFAULT pi(), + int2_def_func_unique_check int2 UNIQUE CHECK ( int2 > 0 ) DEFAULT pi() +); + +DROP TABLE IF EXISTS int2_pk; +CREATE TABLE int2_pk +( + int2_pk int2 PRIMARY KEY +); + +DROP TABLE IF EXISTS int2_pk_ref; +CREATE TABLE int2_pk_ref +( + int2_pk_ref int2 PRIMARY KEY REFERENCES int2_ref (int2_ref) +); + +DROP TABLE IF EXISTS int2_pk_def_const; +CREATE TABLE int2_pk_def_const +( + int2_pk_def_const int2 PRIMARY KEY DEFAULT 42 +); + +DROP TABLE IF EXISTS int2_pk_def_func; +CREATE TABLE int2_pk_def_func +( + int2_pk_def_func int2 PRIMARY KEY DEFAULT pi() +); + +DROP TABLE IF EXISTS int2_nn_pk; +CREATE TABLE int2_nn_pk +( + int2_nn_pk int2 NOT NULL PRIMARY KEY +); + +DROP TABLE IF EXISTS int2_nn_unique_check_pk; +CREATE TABLE int2_nn_unique_check_pk +( + int2_nn_unique_check_pk int2 PRIMARY KEY NOT NULL UNIQUE CHECK ( int2_nn_unique_check_pk > 0) +); + +DROP TABLE IF EXISTS int2_nn_unique_check_pk_ref; +CREATE TABLE int2_nn_unique_check_pk_ref +( + int2_nn_unique_check_pk_ref int2 PRIMARY KEY NOT NULL UNIQUE CHECK ( int2_nn_unique_check_pk_ref > 0) REFERENCES int2_ref (int2_ref) +); + +DROP TABLE IF EXISTS int2_unique_pk; +CREATE TABLE int2_unique_pk +( + int2_unique_pk int2 PRIMARY KEY UNIQUE +); + +DROP TABLE IF EXISTS int2_unique_check_pk; +CREATE TABLE int2_unique_check_pk +( + int2_unique_check_pk int2 PRIMARY KEY UNIQUE CHECK ( int2_unique_check_pk > 0 ) +); + +DROP TABLE IF EXISTS int2_unique_check_pk_ref; +CREATE TABLE int2_unique_check_pk_ref +( + int2_unique_check_pk_ref int2 PRIMARY KEY UNIQUE CHECK ( int2_unique_check_pk_ref > 0) REFERENCES int2_ref (int2_ref) +); + +DROP TABLE IF EXISTS int2_check_pk; +CREATE TABLE int2_check_pk +( + int2_check_pk int2 PRIMARY KEY CHECK ( int2_check_pk > 0 ) +); + +DROP TABLE IF EXISTS int2_def_const_unique_check_pk; +CREATE TABLE int2_def_const_unique_check_pk +( + int2_def_const_unique_check_pk int2 PRIMARY KEY UNIQUE CHECK ( int2_def_const_unique_check_pk > 0 ) DEFAULT 42 +); + +DROP TABLE IF EXISTS int2_def_const_unique_check_pk_ref; +CREATE TABLE int2_def_const_unique_check_pk_ref +( + int2_def_const_unique_check_pk_ref int2 PRIMARY KEY UNIQUE CHECK ( int2_def_const_unique_check_pk_ref > 0 ) DEFAULT 42 REFERENCES int2_ref (int2_ref) +); + +DROP TABLE IF EXISTS int2_def_func_unique_check_pk; +CREATE TABLE int2_def_func_unique_check_pk +( + int2_def_func_unique_check_pk int2 PRIMARY KEY UNIQUE CHECK ( int2_def_func_unique_check_pk > 0 ) DEFAULT pi() +); + +DROP TABLE IF EXISTS int2_def_func_unique_check_pk_ref; +CREATE TABLE int2_def_func_unique_check_pk_ref +( + int2_def_func_unique_check_pk_ref int2 PRIMARY KEY UNIQUE CHECK ( int2_def_func_unique_check_pk_ref > 0 ) DEFAULT pi() REFERENCES int2_ref (int2_ref) +); diff --git a/internal/integration_tests/postgres/testdata/int4.sql b/internal/integration_tests/postgres/testdata/int4.sql new file mode 100644 index 00000000..7a73bb7b --- /dev/null +++ b/internal/integration_tests/postgres/testdata/int4.sql @@ -0,0 +1,130 @@ +DROP TABLE IF EXISTS int4_ref CASCADE; +CREATE TABLE int4_ref +( + int4_ref int4 UNIQUE +); + +DROP TABLE IF EXISTS int4; +CREATE TABLE int4 +( + int4 int4, + int4_nn int4 NOT NULL, + int4_nn_unique int4 NOT NULL UNIQUE, + int4_nn_check int4 NOT NULL CHECK ( int4 > 0 ), + int4_nn_ref int4 NOT NULL REFERENCES int4_ref (int4_ref), + int4_nn_def_const int4 NOT NULL DEFAULT 42, + int4_nn_def_func int4 NOT NULL DEFAULT pi(), + int4_nn_unique_check int4 NOT NULL UNIQUE CHECK ( int4 > 0 ), + + int4_unique int4 UNIQUE, + int4_unique_check int4 UNIQUE CHECK ( int4 > 0 ), + int4_unique_ref int4 UNIQUE REFERENCES int4_ref (int4_ref), + int4_unique_def_const int4 UNIQUE DEFAULT 42, + int4_unique_def_func int4 UNIQUE DEFAULT pi(), + + int4_check int4 CHECK ( int4 > 0 ), + int4_check_ref int4 CHECK ( int4 > 0 ) REFERENCES int4_ref (int4_ref), + int4_check_def_const int4 CHECK ( int4 > 0 ) DEFAULT 42, + int4_check_def_func int4 CHECK ( int4 > 0 ) DEFAULT pi(), + + int4_ref int4 REFERENCES int4_ref (int4_ref), + int4_ref_def_const int4 REFERENCES int4_ref (int4_ref) DEFAULT 42, + int4_ref_def_func int4 REFERENCES int4_ref (int4_ref) DEFAULT pi(), + int4_ref_unique_check int4 UNIQUE CHECK ( int4 > 0 ) REFERENCES int4_ref (int4_ref), + + int4_def_const int4 DEFAULT 42, + int4_def_const_unique_check int4 UNIQUE CHECK ( int4 > 0 ) DEFAULT 42, + + int4_def_func int4 DEFAULT pi(), + int4_def_func_unique_check int4 UNIQUE CHECK ( int4 > 0 ) DEFAULT pi() +); + +DROP TABLE IF EXISTS int4_pk; +CREATE TABLE int4_pk +( + int4_pk int4 PRIMARY KEY +); + +DROP TABLE IF EXISTS int4_pk_ref; +CREATE TABLE int4_pk_ref +( + int4_pk_ref int4 PRIMARY KEY REFERENCES int4_ref (int4_ref) +); + +DROP TABLE IF EXISTS int4_pk_def_const; +CREATE TABLE int4_pk_def_const +( + int4_pk_def_const int4 PRIMARY KEY DEFAULT 42 +); + +DROP TABLE IF EXISTS int4_pk_def_func; +CREATE TABLE int4_pk_def_func +( + int4_pk_def_func int4 PRIMARY KEY DEFAULT pi() +); + +DROP TABLE IF EXISTS int4_nn_pk; +CREATE TABLE int4_nn_pk +( + int4_nn_pk int4 NOT NULL PRIMARY KEY +); + +DROP TABLE IF EXISTS int4_nn_unique_check_pk; +CREATE TABLE int4_nn_unique_check_pk +( + int4_nn_unique_check_pk int4 PRIMARY KEY NOT NULL UNIQUE CHECK ( int4_nn_unique_check_pk > 0) +); + +DROP TABLE IF EXISTS int4_nn_unique_check_pk_ref; +CREATE TABLE int4_nn_unique_check_pk_ref +( + int4_nn_unique_check_pk_ref int4 PRIMARY KEY NOT NULL UNIQUE CHECK ( int4_nn_unique_check_pk_ref > 0) REFERENCES int4_ref (int4_ref) +); + +DROP TABLE IF EXISTS int4_unique_pk; +CREATE TABLE int4_unique_pk +( + int4_unique_pk int4 PRIMARY KEY UNIQUE +); + +DROP TABLE IF EXISTS int4_unique_check_pk; +CREATE TABLE int4_unique_check_pk +( + int4_unique_check_pk int4 PRIMARY KEY UNIQUE CHECK ( int4_unique_check_pk > 0 ) +); + +DROP TABLE IF EXISTS int4_unique_check_pk_ref; +CREATE TABLE int4_unique_check_pk_ref +( + int4_unique_check_pk_ref int4 PRIMARY KEY UNIQUE CHECK ( int4_unique_check_pk_ref > 0) REFERENCES int4_ref (int4_ref) +); + +DROP TABLE IF EXISTS int4_check_pk; +CREATE TABLE int4_check_pk +( + int4_check_pk int4 PRIMARY KEY CHECK ( int4_check_pk > 0 ) +); + +DROP TABLE IF EXISTS int4_def_const_unique_check_pk; +CREATE TABLE int4_def_const_unique_check_pk +( + int4_def_const_unique_check_pk int4 PRIMARY KEY UNIQUE CHECK ( int4_def_const_unique_check_pk > 0 ) DEFAULT 42 +); + +DROP TABLE IF EXISTS int4_def_const_unique_check_pk_ref; +CREATE TABLE int4_def_const_unique_check_pk_ref +( + int4_def_const_unique_check_pk_ref int4 PRIMARY KEY UNIQUE CHECK ( int4_def_const_unique_check_pk_ref > 0 ) DEFAULT 42 REFERENCES int4_ref (int4_ref) +); + +DROP TABLE IF EXISTS int4_def_func_unique_check_pk; +CREATE TABLE int4_def_func_unique_check_pk +( + int4_def_func_unique_check_pk int4 PRIMARY KEY UNIQUE CHECK ( int4_def_func_unique_check_pk > 0 ) DEFAULT pi() +); + +DROP TABLE IF EXISTS int4_def_func_unique_check_pk_ref; +CREATE TABLE int4_def_func_unique_check_pk_ref +( + int4_def_func_unique_check_pk_ref int4 PRIMARY KEY UNIQUE CHECK ( int4_def_func_unique_check_pk_ref > 0 ) DEFAULT pi() REFERENCES int4_ref (int4_ref) +); diff --git a/internal/integration_tests/postgres/testdata/int8.sql b/internal/integration_tests/postgres/testdata/int8.sql new file mode 100644 index 00000000..c0c2f3ad --- /dev/null +++ b/internal/integration_tests/postgres/testdata/int8.sql @@ -0,0 +1,130 @@ +DROP TABLE IF EXISTS int8_ref CASCADE; +CREATE TABLE int8_ref +( + int8_ref int8 UNIQUE +); + +DROP TABLE IF EXISTS int8; +CREATE TABLE int8 +( + int8 int8, + int8_nn int8 NOT NULL, + int8_nn_unique int8 NOT NULL UNIQUE, + int8_nn_check int8 NOT NULL CHECK ( int8 > 0 ), + int8_nn_ref int8 NOT NULL REFERENCES int8_ref (int8_ref), + int8_nn_def_const int8 NOT NULL DEFAULT 42, + int8_nn_def_func int8 NOT NULL DEFAULT pi(), + int8_nn_unique_check int8 NOT NULL UNIQUE CHECK ( int8 > 0 ), + + int8_unique int8 UNIQUE, + int8_unique_check int8 UNIQUE CHECK ( int8 > 0 ), + int8_unique_ref int8 UNIQUE REFERENCES int8_ref (int8_ref), + int8_unique_def_const int8 UNIQUE DEFAULT 42, + int8_unique_def_func int8 UNIQUE DEFAULT pi(), + + int8_check int8 CHECK ( int8 > 0 ), + int8_check_ref int8 CHECK ( int8 > 0 ) REFERENCES int8_ref (int8_ref), + int8_check_def_const int8 CHECK ( int8 > 0 ) DEFAULT 42, + int8_check_def_func int8 CHECK ( int8 > 0 ) DEFAULT pi(), + + int8_ref int8 REFERENCES int8_ref (int8_ref), + int8_ref_def_const int8 REFERENCES int8_ref (int8_ref) DEFAULT 42, + int8_ref_def_func int8 REFERENCES int8_ref (int8_ref) DEFAULT pi(), + int8_ref_unique_check int8 UNIQUE CHECK ( int8 > 0 ) REFERENCES int8_ref (int8_ref), + + int8_def_const int8 DEFAULT 42, + int8_def_const_unique_check int8 UNIQUE CHECK ( int8 > 0 ) DEFAULT 42, + + int8_def_func int8 DEFAULT pi(), + int8_def_func_unique_check int8 UNIQUE CHECK ( int8 > 0 ) DEFAULT pi() +); + +DROP TABLE IF EXISTS int8_pk; +CREATE TABLE int8_pk +( + int8_pk int8 PRIMARY KEY +); + +DROP TABLE IF EXISTS int8_pk_ref; +CREATE TABLE int8_pk_ref +( + int8_pk_ref int8 PRIMARY KEY REFERENCES int8_ref (int8_ref) +); + +DROP TABLE IF EXISTS int8_pk_def_const; +CREATE TABLE int8_pk_def_const +( + int8_pk_def_const int8 PRIMARY KEY DEFAULT 42 +); + +DROP TABLE IF EXISTS int8_pk_def_func; +CREATE TABLE int8_pk_def_func +( + int8_pk_def_func int8 PRIMARY KEY DEFAULT pi() +); + +DROP TABLE IF EXISTS int8_nn_pk; +CREATE TABLE int8_nn_pk +( + int8_nn_pk int8 NOT NULL PRIMARY KEY +); + +DROP TABLE IF EXISTS int8_nn_unique_check_pk; +CREATE TABLE int8_nn_unique_check_pk +( + int8_nn_unique_check_pk int8 PRIMARY KEY NOT NULL UNIQUE CHECK ( int8_nn_unique_check_pk > 0) +); + +DROP TABLE IF EXISTS int8_nn_unique_check_pk_ref; +CREATE TABLE int8_nn_unique_check_pk_ref +( + int8_nn_unique_check_pk_ref int8 PRIMARY KEY NOT NULL UNIQUE CHECK ( int8_nn_unique_check_pk_ref > 0) REFERENCES int8_ref (int8_ref) +); + +DROP TABLE IF EXISTS int8_unique_pk; +CREATE TABLE int8_unique_pk +( + int8_unique_pk int8 PRIMARY KEY UNIQUE +); + +DROP TABLE IF EXISTS int8_unique_check_pk; +CREATE TABLE int8_unique_check_pk +( + int8_unique_check_pk int8 PRIMARY KEY UNIQUE CHECK ( int8_unique_check_pk > 0 ) +); + +DROP TABLE IF EXISTS int8_unique_check_pk_ref; +CREATE TABLE int8_unique_check_pk_ref +( + int8_unique_check_pk_ref int8 PRIMARY KEY UNIQUE CHECK ( int8_unique_check_pk_ref > 0) REFERENCES int8_ref (int8_ref) +); + +DROP TABLE IF EXISTS int8_check_pk; +CREATE TABLE int8_check_pk +( + int8_check_pk int8 PRIMARY KEY CHECK ( int8_check_pk > 0 ) +); + +DROP TABLE IF EXISTS int8_def_const_unique_check_pk; +CREATE TABLE int8_def_const_unique_check_pk +( + int8_def_const_unique_check_pk int8 PRIMARY KEY UNIQUE CHECK ( int8_def_const_unique_check_pk > 0 ) DEFAULT 42 +); + +DROP TABLE IF EXISTS int8_def_const_unique_check_pk_ref; +CREATE TABLE int8_def_const_unique_check_pk_ref +( + int8_def_const_unique_check_pk_ref int8 PRIMARY KEY UNIQUE CHECK ( int8_def_const_unique_check_pk_ref > 0 ) DEFAULT 42 REFERENCES int8_ref (int8_ref) +); + +DROP TABLE IF EXISTS int8_def_func_unique_check_pk; +CREATE TABLE int8_def_func_unique_check_pk +( + int8_def_func_unique_check_pk int8 PRIMARY KEY UNIQUE CHECK ( int8_def_func_unique_check_pk > 0 ) DEFAULT pi() +); + +DROP TABLE IF EXISTS int8_def_func_unique_check_pk_ref; +CREATE TABLE int8_def_func_unique_check_pk_ref +( + int8_def_func_unique_check_pk_ref int8 PRIMARY KEY UNIQUE CHECK ( int8_def_func_unique_check_pk_ref > 0 ) DEFAULT pi() REFERENCES int8_ref (int8_ref) +); diff --git a/internal/integration_tests/postgres/testdata/integer.sql b/internal/integration_tests/postgres/testdata/integer.sql new file mode 100644 index 00000000..476574f3 --- /dev/null +++ b/internal/integration_tests/postgres/testdata/integer.sql @@ -0,0 +1,131 @@ +DROP TABLE IF EXISTS integer_ref CASCADE; +CREATE TABLE integer_ref +( + integer_ref integer UNIQUE +); + +DROP TABLE IF EXISTS integer; +CREATE TABLE integer +( + integer integer, + integer_nn integer NOT NULL, + integer_nn_unique integer NOT NULL UNIQUE, + integer_nn_check integer NOT NULL CHECK ( integer > 0 +) , + integer_nn_ref integer NOT NULL REFERENCES integer_ref(integer_ref), + integer_nn_def_const integer NOT NULL DEFAULT 42, + integer_nn_def_func integer NOT NULL DEFAULT pi(), + integer_nn_unique_check integer NOT NULL UNIQUE CHECK ( integer > 0 ), + + integer_unique integer UNIQUE, + integer_unique_check integer UNIQUE CHECK ( integer > 0 ), + integer_unique_ref integer UNIQUE REFERENCES integer_ref(integer_ref), + integer_unique_def_const integer UNIQUE DEFAULT 42, + integer_unique_def_func integer UNIQUE DEFAULT pi(), + + integer_check integer CHECK ( integer > 0 ), + integer_check_ref integer CHECK ( integer > 0 ) REFERENCES integer_ref(integer_ref), + integer_check_def_const integer CHECK ( integer > 0 ) DEFAULT 42, + integer_check_def_func integer CHECK ( integer > 0 ) DEFAULT pi(), + + integer_ref integer REFERENCES integer_ref(integer_ref), + integer_ref_def_const integer REFERENCES integer_ref(integer_ref) DEFAULT 42, + integer_ref_def_func integer REFERENCES integer_ref(integer_ref) DEFAULT pi(), + integer_ref_unique_check integer UNIQUE CHECK ( integer > 0 ) REFERENCES integer_ref(integer_ref), + + integer_def_const integer DEFAULT 42, + integer_def_const_unique_check integer UNIQUE CHECK ( integer > 0 )DEFAULT 42, + + integer_def_func integer DEFAULT pi(), + integer_def_func_unique_check integer UNIQUE CHECK ( integer > 0 ) DEFAULT pi() +); + +DROP TABLE IF EXISTS integer_pk; +CREATE TABLE integer_pk +( + integer_pk integer PRIMARY KEY +); + +DROP TABLE IF EXISTS integer_pk_ref; +CREATE TABLE integer_pk_ref +( + integer_pk_ref integer PRIMARY KEY REFERENCES integer_ref (integer_ref) +); + +DROP TABLE IF EXISTS integer_pk_def_const; +CREATE TABLE integer_pk_def_const +( + integer_pk_def_const integer PRIMARY KEY DEFAULT 42 +); + +DROP TABLE IF EXISTS integer_pk_def_func; +CREATE TABLE integer_pk_def_func +( + integer_pk_def_func integer PRIMARY KEY DEFAULT pi() +); + +DROP TABLE IF EXISTS integer_nn_pk; +CREATE TABLE integer_nn_pk +( + integer_nn_pk integer NOT NULL PRIMARY KEY +); + +DROP TABLE IF EXISTS integer_nn_unique_check_pk; +CREATE TABLE integer_nn_unique_check_pk +( + integer_nn_unique_check_pk integer PRIMARY KEY NOT NULL UNIQUE CHECK ( integer_nn_unique_check_pk > 0) +); + +DROP TABLE IF EXISTS integer_nn_unique_check_pk_ref; +CREATE TABLE integer_nn_unique_check_pk_ref +( + integer_nn_unique_check_pk_ref integer PRIMARY KEY NOT NULL UNIQUE CHECK ( integer_nn_unique_check_pk_ref > 0) REFERENCES integer_ref (integer_ref) +); + +DROP TABLE IF EXISTS integer_unique_pk; +CREATE TABLE integer_unique_pk +( + integer_unique_pk integer PRIMARY KEY UNIQUE +); + +DROP TABLE IF EXISTS integer_unique_check_pk; +CREATE TABLE integer_unique_check_pk +( + integer_unique_check_pk integer PRIMARY KEY UNIQUE CHECK ( integer_unique_check_pk > 0 ) +); + +DROP TABLE IF EXISTS integer_unique_check_pk_ref; +CREATE TABLE integer_unique_check_pk_ref +( + integer_unique_check_pk_ref integer PRIMARY KEY UNIQUE CHECK ( integer_unique_check_pk_ref > 0) REFERENCES integer_ref (integer_ref) +); + +DROP TABLE IF EXISTS integer_check_pk; +CREATE TABLE integer_check_pk +( + integer_check_pk integer PRIMARY KEY CHECK ( integer_check_pk > 0 ) +); + +DROP TABLE IF EXISTS integer_def_const_unique_check_pk; +CREATE TABLE integer_def_const_unique_check_pk +( + integer_def_const_unique_check_pk integer PRIMARY KEY UNIQUE CHECK ( integer_def_const_unique_check_pk > 0 ) DEFAULT 42 +); + +DROP TABLE IF EXISTS integer_def_const_unique_check_pk_ref; +CREATE TABLE integer_def_const_unique_check_pk_ref +( + integer_def_const_unique_check_pk_ref integer PRIMARY KEY UNIQUE CHECK ( integer_def_const_unique_check_pk_ref > 0 ) DEFAULT 42 REFERENCES integer_ref (integer_ref) +); + +DROP TABLE IF EXISTS integer_def_func_unique_check_pk; +CREATE TABLE integer_def_func_unique_check_pk +( + integer_def_func_unique_check_pk integer PRIMARY KEY UNIQUE CHECK ( integer_def_func_unique_check_pk > 0 ) DEFAULT pi() +); + +DROP TABLE IF EXISTS integer_def_func_unique_check_pk_ref; +CREATE TABLE integer_def_func_unique_check_pk_ref +( + integer_def_func_unique_check_pk_ref integer PRIMARY KEY UNIQUE CHECK ( integer_def_func_unique_check_pk_ref > 0 ) DEFAULT pi() REFERENCES integer_ref (integer_ref) +); diff --git a/internal/integration_tests/postgres/testdata/numeric.sql b/internal/integration_tests/postgres/testdata/numeric.sql new file mode 100644 index 00000000..1b1e5233 --- /dev/null +++ b/internal/integration_tests/postgres/testdata/numeric.sql @@ -0,0 +1,133 @@ +DROP TABLE IF EXISTS numeric_ref CASCADE; +CREATE TABLE numeric_ref +( + numeric_ref numeric UNIQUE +); + +DROP TABLE IF EXISTS numeric; +CREATE TABLE numeric +( + numeric numeric, + numeric_prec numeric(10), + numeric_prec_scale numeric(10, 5), + numeric_nn numeric NOT NULL, + numeric_nn_unique numeric NOT NULL UNIQUE, + numeric_nn_check numeric NOT NULL CHECK ( numeric > 0 +) , + numeric_nn_ref numeric NOT NULL REFERENCES numeric_ref(numeric_ref), + numeric_nn_def_const numeric NOT NULL DEFAULT 42, + numeric_nn_def_func numeric NOT NULL DEFAULT pi(), + numeric_nn_unique_check numeric NOT NULL UNIQUE CHECK ( numeric > 0 ), + + numeric_unique numeric UNIQUE, + numeric_unique_check numeric UNIQUE CHECK ( numeric > 0 ), + numeric_unique_ref numeric UNIQUE REFERENCES numeric_ref(numeric_ref), + numeric_unique_def_const numeric UNIQUE DEFAULT 42, + numeric_unique_def_func numeric UNIQUE DEFAULT pi(), + + numeric_check numeric CHECK ( numeric > 0 ), + numeric_check_ref numeric CHECK ( numeric > 0 ) REFERENCES numeric_ref(numeric_ref), + numeric_check_def_const numeric CHECK ( numeric > 0 ) DEFAULT 42, + numeric_check_def_func numeric CHECK ( numeric > 0 ) DEFAULT pi(), + + numeric_ref numeric REFERENCES numeric_ref(numeric_ref), + numeric_ref_def_const numeric REFERENCES numeric_ref(numeric_ref) DEFAULT 42, + numeric_ref_def_func numeric REFERENCES numeric_ref(numeric_ref) DEFAULT pi(), + numeric_ref_unique_check numeric UNIQUE CHECK ( numeric > 0 ) REFERENCES numeric_ref(numeric_ref), + + numeric_def_const numeric DEFAULT 42, + numeric_def_const_unique_check numeric UNIQUE CHECK ( numeric > 0 )DEFAULT 42, + + numeric_def_func numeric DEFAULT pi(), + numeric_def_func_unique_check numeric UNIQUE CHECK ( numeric > 0 ) DEFAULT pi() +); + +DROP TABLE IF EXISTS numeric_pk; +CREATE TABLE numeric_pk +( + numeric_pk numeric PRIMARY KEY +); + +DROP TABLE IF EXISTS numeric_pk_ref; +CREATE TABLE numeric_pk_ref +( + numeric_pk_ref numeric PRIMARY KEY REFERENCES numeric_ref (numeric_ref) +); + +DROP TABLE IF EXISTS numeric_pk_def_const; +CREATE TABLE numeric_pk_def_const +( + numeric_pk_def_const numeric PRIMARY KEY DEFAULT 42 +); + +DROP TABLE IF EXISTS numeric_pk_def_func; +CREATE TABLE numeric_pk_def_func +( + numeric_pk_def_func numeric PRIMARY KEY DEFAULT pi() +); + +DROP TABLE IF EXISTS numeric_nn_pk; +CREATE TABLE numeric_nn_pk +( + numeric_nn_pk numeric NOT NULL PRIMARY KEY +); + +DROP TABLE IF EXISTS numeric_nn_unique_check_pk; +CREATE TABLE numeric_nn_unique_check_pk +( + numeric_nn_unique_check_pk numeric PRIMARY KEY NOT NULL UNIQUE CHECK ( numeric_nn_unique_check_pk > 0) +); + +DROP TABLE IF EXISTS numeric_nn_unique_check_pk_ref; +CREATE TABLE numeric_nn_unique_check_pk_ref +( + numeric_nn_unique_check_pk_ref numeric PRIMARY KEY NOT NULL UNIQUE CHECK ( numeric_nn_unique_check_pk_ref > 0) REFERENCES numeric_ref (numeric_ref) +); + +DROP TABLE IF EXISTS numeric_unique_pk; +CREATE TABLE numeric_unique_pk +( + numeric_unique_pk numeric PRIMARY KEY UNIQUE +); + +DROP TABLE IF EXISTS numeric_unique_check_pk; +CREATE TABLE numeric_unique_check_pk +( + numeric_unique_check_pk numeric PRIMARY KEY UNIQUE CHECK ( numeric_unique_check_pk > 0 ) +); + +DROP TABLE IF EXISTS numeric_unique_check_pk_ref; +CREATE TABLE numeric_unique_check_pk_ref +( + numeric_unique_check_pk_ref numeric PRIMARY KEY UNIQUE CHECK ( numeric_unique_check_pk_ref > 0) REFERENCES numeric_ref (numeric_ref) +); + +DROP TABLE IF EXISTS numeric_check_pk; +CREATE TABLE numeric_check_pk +( + numeric_check_pk numeric PRIMARY KEY CHECK ( numeric_check_pk > 0 ) +); + +DROP TABLE IF EXISTS numeric_def_const_unique_check_pk; +CREATE TABLE numeric_def_const_unique_check_pk +( + numeric_def_const_unique_check_pk numeric PRIMARY KEY UNIQUE CHECK ( numeric_def_const_unique_check_pk > 0 ) DEFAULT 42 +); + +DROP TABLE IF EXISTS numeric_def_const_unique_check_pk_ref; +CREATE TABLE numeric_def_const_unique_check_pk_ref +( + numeric_def_const_unique_check_pk_ref numeric PRIMARY KEY UNIQUE CHECK ( numeric_def_const_unique_check_pk_ref > 0 ) DEFAULT 42 REFERENCES numeric_ref (numeric_ref) +); + +DROP TABLE IF EXISTS numeric_def_func_unique_check_pk; +CREATE TABLE numeric_def_func_unique_check_pk +( + numeric_def_func_unique_check_pk numeric PRIMARY KEY UNIQUE CHECK ( numeric_def_func_unique_check_pk > 0 ) DEFAULT pi() +); + +DROP TABLE IF EXISTS numeric_def_func_unique_check_pk_ref; +CREATE TABLE numeric_def_func_unique_check_pk_ref +( + numeric_def_func_unique_check_pk_ref numeric PRIMARY KEY UNIQUE CHECK ( numeric_def_func_unique_check_pk_ref > 0 ) DEFAULT pi() REFERENCES numeric_ref (numeric_ref) +); diff --git a/internal/integration_tests/postgres/testdata/real.sql b/internal/integration_tests/postgres/testdata/real.sql new file mode 100644 index 00000000..9cfd94e4 --- /dev/null +++ b/internal/integration_tests/postgres/testdata/real.sql @@ -0,0 +1,131 @@ +DROP TABLE IF EXISTS real_ref CASCADE; +CREATE TABLE real_ref +( + real_ref real UNIQUE +); + +DROP TABLE IF EXISTS real; +CREATE TABLE real +( + real real, + real_nn real NOT NULL, + real_nn_unique real NOT NULL UNIQUE, + real_nn_check real NOT NULL CHECK ( real > 0 +) , + real_nn_ref real NOT NULL REFERENCES real_ref(real_ref), + real_nn_def_const real NOT NULL DEFAULT 42, + real_nn_def_func real NOT NULL DEFAULT pi(), + real_nn_unique_check real NOT NULL UNIQUE CHECK ( real > 0 ), + + real_unique real UNIQUE, + real_unique_check real UNIQUE CHECK ( real > 0 ), + real_unique_ref real UNIQUE REFERENCES real_ref(real_ref), + real_unique_def_const real UNIQUE DEFAULT 42, + real_unique_def_func real UNIQUE DEFAULT pi(), + + real_check real CHECK ( real > 0 ), + real_check_ref real CHECK ( real > 0 ) REFERENCES real_ref(real_ref), + real_check_def_const real CHECK ( real > 0 ) DEFAULT 42, + real_check_def_func real CHECK ( real > 0 ) DEFAULT pi(), + + real_ref real REFERENCES real_ref(real_ref), + real_ref_def_const real REFERENCES real_ref(real_ref) DEFAULT 42, + real_ref_def_func real REFERENCES real_ref(real_ref) DEFAULT pi(), + real_ref_unique_check real UNIQUE CHECK ( real > 0 ) REFERENCES real_ref(real_ref), + + real_def_const real DEFAULT 42, + real_def_const_unique_check real UNIQUE CHECK ( real > 0 )DEFAULT 42, + + real_def_func real DEFAULT pi(), + real_def_func_unique_check real UNIQUE CHECK ( real > 0 ) DEFAULT pi() +); + +DROP TABLE IF EXISTS real_pk; +CREATE TABLE real_pk +( + real_pk real PRIMARY KEY +); + +DROP TABLE IF EXISTS real_pk_ref; +CREATE TABLE real_pk_ref +( + real_pk_ref real PRIMARY KEY REFERENCES real_ref (real_ref) +); + +DROP TABLE IF EXISTS real_pk_def_const; +CREATE TABLE real_pk_def_const +( + real_pk_def_const real PRIMARY KEY DEFAULT 42 +); + +DROP TABLE IF EXISTS real_pk_def_func; +CREATE TABLE real_pk_def_func +( + real_pk_def_func real PRIMARY KEY DEFAULT pi() +); + +DROP TABLE IF EXISTS real_nn_pk; +CREATE TABLE real_nn_pk +( + real_nn_pk real NOT NULL PRIMARY KEY +); + +DROP TABLE IF EXISTS real_nn_unique_check_pk; +CREATE TABLE real_nn_unique_check_pk +( + real_nn_unique_check_pk real PRIMARY KEY NOT NULL UNIQUE CHECK ( real_nn_unique_check_pk > 0) +); + +DROP TABLE IF EXISTS real_nn_unique_check_pk_ref; +CREATE TABLE real_nn_unique_check_pk_ref +( + real_nn_unique_check_pk_ref real PRIMARY KEY NOT NULL UNIQUE CHECK ( real_nn_unique_check_pk_ref > 0) REFERENCES real_ref (real_ref) +); + +DROP TABLE IF EXISTS real_unique_pk; +CREATE TABLE real_unique_pk +( + real_unique_pk real PRIMARY KEY UNIQUE +); + +DROP TABLE IF EXISTS real_unique_check_pk; +CREATE TABLE real_unique_check_pk +( + real_unique_check_pk real PRIMARY KEY UNIQUE CHECK ( real_unique_check_pk > 0 ) +); + +DROP TABLE IF EXISTS real_unique_check_pk_ref; +CREATE TABLE real_unique_check_pk_ref +( + real_unique_check_pk_ref real PRIMARY KEY UNIQUE CHECK ( real_unique_check_pk_ref > 0) REFERENCES real_ref (real_ref) +); + +DROP TABLE IF EXISTS real_check_pk; +CREATE TABLE real_check_pk +( + real_check_pk real PRIMARY KEY CHECK ( real_check_pk > 0 ) +); + +DROP TABLE IF EXISTS real_def_const_unique_check_pk; +CREATE TABLE real_def_const_unique_check_pk +( + real_def_const_unique_check_pk real PRIMARY KEY UNIQUE CHECK ( real_def_const_unique_check_pk > 0 ) DEFAULT 42 +); + +DROP TABLE IF EXISTS real_def_const_unique_check_pk_ref; +CREATE TABLE real_def_const_unique_check_pk_ref +( + real_def_const_unique_check_pk_ref real PRIMARY KEY UNIQUE CHECK ( real_def_const_unique_check_pk_ref > 0 ) DEFAULT 42 REFERENCES real_ref (real_ref) +); + +DROP TABLE IF EXISTS real_def_func_unique_check_pk; +CREATE TABLE real_def_func_unique_check_pk +( + real_def_func_unique_check_pk real PRIMARY KEY UNIQUE CHECK ( real_def_func_unique_check_pk > 0 ) DEFAULT pi() +); + +DROP TABLE IF EXISTS real_def_func_unique_check_pk_ref; +CREATE TABLE real_def_func_unique_check_pk_ref +( + real_def_func_unique_check_pk_ref real PRIMARY KEY UNIQUE CHECK ( real_def_func_unique_check_pk_ref > 0 ) DEFAULT pi() REFERENCES real_ref (real_ref) +); diff --git a/internal/integration_tests/postgres/testdata/serial.sql b/internal/integration_tests/postgres/testdata/serial.sql new file mode 100644 index 00000000..9844c0d4 --- /dev/null +++ b/internal/integration_tests/postgres/testdata/serial.sql @@ -0,0 +1,65 @@ +DROP TABLE IF EXISTS serial_ref CASCADE; +CREATE TABLE serial_ref +( + serial_ref serial UNIQUE +); + +DROP TABLE IF EXISTS serial; +CREATE TABLE serial +( + serial serial +); + +DROP TABLE IF EXISTS serial_notnull; +CREATE TABLE serial_notnull +( + serial serial NOT NULL +); + +DROP TABLE IF EXISTS serial_unique; +CREATE TABLE serial_unique +( + serial serial UNIQUE +); + +DROP TABLE IF EXISTS serial_check; +CREATE TABLE serial_check +( + serial serial CHECK ( serial > 0 ) +); + +DROP TABLE IF EXISTS serial_pk; +CREATE TABLE serial_pk +( + serial serial PRIMARY KEY +); + +DROP TABLE IF EXISTS serial_references; +CREATE TABLE serial_references +( + serial serial REFERENCES serial_ref (serial_ref) +); + +DROP TABLE IF EXISTS serial_unique_check; +CREATE TABLE serial_unique_check +( + serial serial UNIQUE CHECK ( serial > 0 ) +); + +DROP TABLE IF EXISTS serial_unique_check_pk; +CREATE TABLE serial_unique_check_pk +( + serial serial PRIMARY KEY UNIQUE CHECK ( serial > 0 ) +); + +DROP TABLE IF EXISTS serial_unique_check_pk_ref; +CREATE TABLE serial_unique_check_pk_ref +( + serial serial PRIMARY KEY UNIQUE CHECK ( serial > 0 ) REFERENCES serial_ref (serial_ref) +); + +DROP TABLE IF EXISTS serial_unique_check_ref; +CREATE TABLE serial_unique_check_ref +( + serial serial UNIQUE CHECK ( serial > 0 ) REFERENCES serial_ref (serial_ref) +); \ No newline at end of file diff --git a/internal/integration_tests/postgres/testdata/serial2.sql b/internal/integration_tests/postgres/testdata/serial2.sql new file mode 100644 index 00000000..caff8dee --- /dev/null +++ b/internal/integration_tests/postgres/testdata/serial2.sql @@ -0,0 +1,65 @@ +DROP TABLE IF EXISTS serial2_ref CASCADE; +CREATE TABLE serial2_ref +( + serial2_ref serial2 UNIQUE +); + +DROP TABLE IF EXISTS serial2; +CREATE TABLE serial2 +( + serial2 serial2 +); + +DROP TABLE IF EXISTS serial2_notnull; +CREATE TABLE serial2_notnull +( + serial2 serial2 NOT NULL +); + +DROP TABLE IF EXISTS serial2_unique; +CREATE TABLE serial2_unique +( + serial2 serial2 UNIQUE +); + +DROP TABLE IF EXISTS serial2_check; +CREATE TABLE serial2_check +( + serial2 serial2 CHECK ( serial2 > 0 ) +); + +DROP TABLE IF EXISTS serial2_pk; +CREATE TABLE serial2_pk +( + serial2 serial2 PRIMARY KEY +); + +DROP TABLE IF EXISTS serial2_references; +CREATE TABLE serial2_references +( + serial2 serial2 REFERENCES serial2_ref (serial2_ref) +); + +DROP TABLE IF EXISTS serial2_unique_check; +CREATE TABLE serial2_unique_check +( + serial2 serial2 UNIQUE CHECK ( serial2 > 0 ) +); + +DROP TABLE IF EXISTS serial2_unique_check_pk; +CREATE TABLE serial2_unique_check_pk +( + serial2 serial2 PRIMARY KEY UNIQUE CHECK ( serial2 > 0 ) +); + +DROP TABLE IF EXISTS serial2_unique_check_pk_ref; +CREATE TABLE serial2_unique_check_pk_ref +( + serial2 serial2 PRIMARY KEY UNIQUE CHECK ( serial2 > 0 ) REFERENCES serial2_ref (serial2_ref) +); + +DROP TABLE IF EXISTS serial2_unique_check_ref; +CREATE TABLE serial2_unique_check_ref +( + serial2 serial2 UNIQUE CHECK ( serial2 > 0 ) REFERENCES serial2_ref (serial2_ref) +); \ No newline at end of file diff --git a/internal/integration_tests/postgres/testdata/serial4.sql b/internal/integration_tests/postgres/testdata/serial4.sql new file mode 100644 index 00000000..2019fb1d --- /dev/null +++ b/internal/integration_tests/postgres/testdata/serial4.sql @@ -0,0 +1,65 @@ +DROP TABLE IF EXISTS serial4_ref CASCADE; +CREATE TABLE serial4_ref +( + serial4_ref serial4 UNIQUE +); + +DROP TABLE IF EXISTS serial4; +CREATE TABLE serial4 +( + serial4 serial4 +); + +DROP TABLE IF EXISTS serial4_notnull; +CREATE TABLE serial4_notnull +( + serial4 serial4 NOT NULL +); + +DROP TABLE IF EXISTS serial4_unique; +CREATE TABLE serial4_unique +( + serial4 serial4 UNIQUE +); + +DROP TABLE IF EXISTS serial4_check; +CREATE TABLE serial4_check +( + serial4 serial4 CHECK ( serial4 > 0 ) +); + +DROP TABLE IF EXISTS serial4_pk; +CREATE TABLE serial4_pk +( + serial4 serial4 PRIMARY KEY +); + +DROP TABLE IF EXISTS serial4_references; +CREATE TABLE serial4_references +( + serial4 serial4 REFERENCES serial4_ref (serial4_ref) +); + +DROP TABLE IF EXISTS serial4_unique_check; +CREATE TABLE serial4_unique_check +( + serial4 serial4 UNIQUE CHECK ( serial4 > 0 ) +); + +DROP TABLE IF EXISTS serial4_unique_check_pk; +CREATE TABLE serial4_unique_check_pk +( + serial4 serial4 PRIMARY KEY UNIQUE CHECK ( serial4 > 0 ) +); + +DROP TABLE IF EXISTS serial4_unique_check_pk_ref; +CREATE TABLE serial4_unique_check_pk_ref +( + serial4 serial4 PRIMARY KEY UNIQUE CHECK ( serial4 > 0 ) REFERENCES serial4_ref (serial4_ref) +); + +DROP TABLE IF EXISTS serial4_unique_check_ref; +CREATE TABLE serial4_unique_check_ref +( + serial4 serial4 UNIQUE CHECK ( serial4 > 0 ) REFERENCES serial4_ref (serial4_ref) +); diff --git a/internal/integration_tests/postgres/testdata/serial8.sql b/internal/integration_tests/postgres/testdata/serial8.sql new file mode 100644 index 00000000..e7d3993c --- /dev/null +++ b/internal/integration_tests/postgres/testdata/serial8.sql @@ -0,0 +1,65 @@ +DROP TABLE IF EXISTS serial8_ref CASCADE; +CREATE TABLE serial8_ref +( + serial8_ref serial8 UNIQUE +); + +DROP TABLE IF EXISTS serial8; +CREATE TABLE serial8 +( + serial8 serial8 +); + +DROP TABLE IF EXISTS serial8_notnull; +CREATE TABLE serial8_notnull +( + serial8 serial8 NOT NULL +); + +DROP TABLE IF EXISTS serial8_unique; +CREATE TABLE serial8_unique +( + serial8 serial8 UNIQUE +); + +DROP TABLE IF EXISTS serial8_check; +CREATE TABLE serial8_check +( + serial8 serial8 CHECK ( serial8 > 0 ) +); + +DROP TABLE IF EXISTS serial8_pk; +CREATE TABLE serial8_pk +( + serial8 serial8 PRIMARY KEY +); + +DROP TABLE IF EXISTS serial8_references; +CREATE TABLE serial8_references +( + serial8 serial8 REFERENCES serial8_ref (serial8_ref) +); + +DROP TABLE IF EXISTS serial8_unique_check; +CREATE TABLE serial8_unique_check +( + serial8 serial8 UNIQUE CHECK ( serial8 > 0 ) +); + +DROP TABLE IF EXISTS serial8_unique_check_pk; +CREATE TABLE serial8_unique_check_pk +( + serial8 serial8 PRIMARY KEY UNIQUE CHECK ( serial8 > 0 ) +); + +DROP TABLE IF EXISTS serial8_unique_check_pk_ref; +CREATE TABLE serial8_unique_check_pk_ref +( + serial8 serial8 PRIMARY KEY UNIQUE CHECK ( serial8 > 0 ) REFERENCES serial8_ref (serial8_ref) +); + +DROP TABLE IF EXISTS serial8_unique_check_ref; +CREATE TABLE serial8_unique_check_ref +( + serial8 serial8 UNIQUE CHECK ( serial8 > 0 ) REFERENCES serial8_ref (serial8_ref) +); diff --git a/internal/integration_tests/postgres/testdata/smallint.sql b/internal/integration_tests/postgres/testdata/smallint.sql new file mode 100644 index 00000000..edeb1c39 --- /dev/null +++ b/internal/integration_tests/postgres/testdata/smallint.sql @@ -0,0 +1,131 @@ +DROP TABLE IF EXISTS smallint_ref CASCADE; +CREATE TABLE smallint_ref +( + smallint_ref smallint UNIQUE +); + +DROP TABLE IF EXISTS smallint; +CREATE TABLE smallint +( + smallint smallint, + smallint_nn smallint NOT NULL, + smallint_nn_unique smallint NOT NULL UNIQUE, + smallint_nn_check smallint NOT NULL CHECK ( smallint > 0 +) , + smallint_nn_ref smallint NOT NULL REFERENCES smallint_ref(smallint_ref), + smallint_nn_def_const smallint NOT NULL DEFAULT 42, + smallint_nn_def_func smallint NOT NULL DEFAULT pi(), + smallint_nn_unique_check smallint NOT NULL UNIQUE CHECK ( smallint > 0 ), + + smallint_unique smallint UNIQUE, + smallint_unique_check smallint UNIQUE CHECK ( smallint > 0 ), + smallint_unique_ref smallint UNIQUE REFERENCES smallint_ref(smallint_ref), + smallint_unique_def_const smallint UNIQUE DEFAULT 42, + smallint_unique_def_func smallint UNIQUE DEFAULT pi(), + + smallint_check smallint CHECK ( smallint > 0 ), + smallint_check_ref smallint CHECK ( smallint > 0 ) REFERENCES smallint_ref(smallint_ref), + smallint_check_def_const smallint CHECK ( smallint > 0 ) DEFAULT 42, + smallint_check_def_func smallint CHECK ( smallint > 0 ) DEFAULT pi(), + + smallint_ref smallint REFERENCES smallint_ref(smallint_ref), + smallint_ref_def_const smallint REFERENCES smallint_ref(smallint_ref) DEFAULT 42, + smallint_ref_def_func smallint REFERENCES smallint_ref(smallint_ref) DEFAULT pi(), + smallint_ref_unique_check smallint UNIQUE CHECK ( smallint > 0 ) REFERENCES smallint_ref(smallint_ref), + + smallint_def_const smallint DEFAULT 42, + smallint_def_const_unique_check smallint UNIQUE CHECK ( smallint > 0 )DEFAULT 42, + + smallint_def_func smallint DEFAULT pi(), + smallint_def_func_unique_check smallint UNIQUE CHECK ( smallint > 0 ) DEFAULT pi() +); + +DROP TABLE IF EXISTS smallint_pk; +CREATE TABLE smallint_pk +( + smallint_pk smallint PRIMARY KEY +); + +DROP TABLE IF EXISTS smallint_pk_ref; +CREATE TABLE smallint_pk_ref +( + smallint_pk_ref smallint PRIMARY KEY REFERENCES smallint_ref (smallint_ref) +); + +DROP TABLE IF EXISTS smallint_pk_def_const; +CREATE TABLE smallint_pk_def_const +( + smallint_pk_def_const smallint PRIMARY KEY DEFAULT 42 +); + +DROP TABLE IF EXISTS smallint_pk_def_func; +CREATE TABLE smallint_pk_def_func +( + smallint_pk_def_func smallint PRIMARY KEY DEFAULT pi() +); + +DROP TABLE IF EXISTS smallint_nn_pk; +CREATE TABLE smallint_nn_pk +( + smallint_nn_pk smallint NOT NULL PRIMARY KEY +); + +DROP TABLE IF EXISTS smallint_nn_unique_check_pk; +CREATE TABLE smallint_nn_unique_check_pk +( + smallint_nn_unique_check_pk smallint PRIMARY KEY NOT NULL UNIQUE CHECK ( smallint_nn_unique_check_pk > 0) +); + +DROP TABLE IF EXISTS smallint_nn_unique_check_pk_ref; +CREATE TABLE smallint_nn_unique_check_pk_ref +( + smallint_nn_unique_check_pk_ref smallint PRIMARY KEY NOT NULL UNIQUE CHECK ( smallint_nn_unique_check_pk_ref > 0) REFERENCES smallint_ref (smallint_ref) +); + +DROP TABLE IF EXISTS smallint_unique_pk; +CREATE TABLE smallint_unique_pk +( + smallint_unique_pk smallint PRIMARY KEY UNIQUE +); + +DROP TABLE IF EXISTS smallint_unique_check_pk; +CREATE TABLE smallint_unique_check_pk +( + smallint_unique_check_pk smallint PRIMARY KEY UNIQUE CHECK ( smallint_unique_check_pk > 0 ) +); + +DROP TABLE IF EXISTS smallint_unique_check_pk_ref; +CREATE TABLE smallint_unique_check_pk_ref +( + smallint_unique_check_pk_ref smallint PRIMARY KEY UNIQUE CHECK ( smallint_unique_check_pk_ref > 0) REFERENCES smallint_ref (smallint_ref) +); + +DROP TABLE IF EXISTS smallint_check_pk; +CREATE TABLE smallint_check_pk +( + smallint_check_pk smallint PRIMARY KEY CHECK ( smallint_check_pk > 0 ) +); + +DROP TABLE IF EXISTS smallint_def_const_unique_check_pk; +CREATE TABLE smallint_def_const_unique_check_pk +( + smallint_def_const_unique_check_pk smallint PRIMARY KEY UNIQUE CHECK ( smallint_def_const_unique_check_pk > 0 ) DEFAULT 42 +); + +DROP TABLE IF EXISTS smallint_def_const_unique_check_pk_ref; +CREATE TABLE smallint_def_const_unique_check_pk_ref +( + smallint_def_const_unique_check_pk_ref smallint PRIMARY KEY UNIQUE CHECK ( smallint_def_const_unique_check_pk_ref > 0 ) DEFAULT 42 REFERENCES smallint_ref (smallint_ref) +); + +DROP TABLE IF EXISTS smallint_def_func_unique_check_pk; +CREATE TABLE smallint_def_func_unique_check_pk +( + smallint_def_func_unique_check_pk smallint PRIMARY KEY UNIQUE CHECK ( smallint_def_func_unique_check_pk > 0 ) DEFAULT pi() +); + +DROP TABLE IF EXISTS smallint_def_func_unique_check_pk_ref; +CREATE TABLE smallint_def_func_unique_check_pk_ref +( + smallint_def_func_unique_check_pk_ref smallint PRIMARY KEY UNIQUE CHECK ( smallint_def_func_unique_check_pk_ref > 0 ) DEFAULT pi() REFERENCES smallint_ref (smallint_ref) +); diff --git a/internal/integration_tests/postgres/testdata/smallserial.sql b/internal/integration_tests/postgres/testdata/smallserial.sql new file mode 100644 index 00000000..56ef00ad --- /dev/null +++ b/internal/integration_tests/postgres/testdata/smallserial.sql @@ -0,0 +1,65 @@ +DROP TABLE IF EXISTS smallserial_ref CASCADE; +CREATE TABLE smallserial_ref +( + smallserial_ref smallserial UNIQUE +); + +DROP TABLE IF EXISTS smallserial; +CREATE TABLE smallserial +( + smallserial smallserial +); + +DROP TABLE IF EXISTS smallserial_notnull; +CREATE TABLE smallserial_notnull +( + smallserial smallserial NOT NULL +); + +DROP TABLE IF EXISTS smallserial_unique; +CREATE TABLE smallserial_unique +( + smallserial smallserial UNIQUE +); + +DROP TABLE IF EXISTS smallserial_check; +CREATE TABLE smallserial_check +( + smallserial smallserial CHECK ( smallserial > 0 ) +); + +DROP TABLE IF EXISTS smallserial_pk; +CREATE TABLE smallserial_pk +( + smallserial smallserial PRIMARY KEY +); + +DROP TABLE IF EXISTS smallserial_references; +CREATE TABLE smallserial_references +( + smallserial smallserial REFERENCES smallserial_ref (smallserial_ref) +); + +DROP TABLE IF EXISTS smallserial_unique_check; +CREATE TABLE smallserial_unique_check +( + smallserial smallserial UNIQUE CHECK ( smallserial > 0 ) +); + +DROP TABLE IF EXISTS smallserial_unique_check_pk; +CREATE TABLE smallserial_unique_check_pk +( + smallserial smallserial PRIMARY KEY UNIQUE CHECK ( smallserial > 0 ) +); + +DROP TABLE IF EXISTS smallserial_unique_check_pk_ref; +CREATE TABLE smallserial_unique_check_pk_ref +( + smallserial smallserial PRIMARY KEY UNIQUE CHECK ( smallserial > 0 ) REFERENCES smallserial_ref (smallserial_ref) +); + +DROP TABLE IF EXISTS smallserial_unique_check_ref; +CREATE TABLE smallserial_unique_check_ref +( + smallserial smallserial UNIQUE CHECK ( smallserial > 0 ) REFERENCES smallserial_ref (smallserial_ref) +); \ No newline at end of file diff --git a/internal/integration_tests/postgres/testdata/text.sql b/internal/integration_tests/postgres/testdata/text.sql new file mode 100644 index 00000000..16748a72 --- /dev/null +++ b/internal/integration_tests/postgres/testdata/text.sql @@ -0,0 +1,131 @@ +DROP TABLE IF EXISTS text_ref CASCADE; +CREATE TABLE text_ref +( + text_ref text UNIQUE +); + +DROP TABLE IF EXISTS text; +CREATE TABLE text +( + text text, + text_nn text NOT NULL, + text_nn_unique text NOT NULL UNIQUE, + text_nn_check_cmp text NOT NULL CHECK ( text = '42' ), + text_nn_check_fn text NOT NULL CHECK ( length(text) > 0 ), + text_nn_ref text NOT NULL REFERENCES text_ref (text_ref), + text_nn_def_const text NOT NULL DEFAULT '42', + text_nn_def_func text NOT NULL DEFAULT pi(), + text_nn_unique_check text NOT NULL UNIQUE CHECK ( length(text) > 0 ), + + text_unique text UNIQUE, + text_unique_check text UNIQUE CHECK ( length(text) > 0 ), + text_unique_ref text UNIQUE REFERENCES text_ref (text_ref), + text_unique_def_const text UNIQUE DEFAULT '42', + text_unique_def_func text UNIQUE DEFAULT pi(), + + text_check text CHECK ( length(text) > 0 ), + text_check_ref text CHECK ( length(text) > 0 ) REFERENCES text_ref (text_ref), + text_check_def_const text CHECK ( length(text) > 0 ) DEFAULT '42', + text_check_def_func text CHECK ( length(text) > 0 ) DEFAULT pi(), + + text_ref text REFERENCES text_ref (text_ref), + text_ref_def_const text REFERENCES text_ref (text_ref) DEFAULT '42', + text_ref_def_func text REFERENCES text_ref (text_ref) DEFAULT pi(), + text_ref_unique_check text UNIQUE CHECK ( length(text) > 0 ) REFERENCES text_ref (text_ref), + + text_def_const text DEFAULT '42', + text_def_const_unique_check text UNIQUE CHECK ( length(text) > 0 ) DEFAULT '42', + + text_def_func text DEFAULT pi(), + text_def_func_unique_check text UNIQUE CHECK ( length(text) > 0 ) DEFAULT pi() +); + +DROP TABLE IF EXISTS text_pk; +CREATE TABLE text_pk +( + text_pk text PRIMARY KEY +); + +DROP TABLE IF EXISTS text_pk_ref; +CREATE TABLE text_pk_ref +( + text_pk_ref text PRIMARY KEY REFERENCES text_ref (text_ref) +); + +DROP TABLE IF EXISTS text_pk_def_const; +CREATE TABLE text_pk_def_const +( + text_pk_def_const text PRIMARY KEY DEFAULT '42' +); + +DROP TABLE IF EXISTS text_pk_def_func; +CREATE TABLE text_pk_def_func +( + text_pk_def_func text PRIMARY KEY DEFAULT pi() +); + +DROP TABLE IF EXISTS text_nn_pk; +CREATE TABLE text_nn_pk +( + text_nn_pk text NOT NULL PRIMARY KEY +); + +DROP TABLE IF EXISTS text_nn_unique_check_pk; +CREATE TABLE text_nn_unique_check_pk +( + text_nn_unique_check_pk text PRIMARY KEY NOT NULL UNIQUE CHECK ( length(text_nn_unique_check_pk) > 0) +); + +DROP TABLE IF EXISTS text_nn_unique_check_pk_ref; +CREATE TABLE text_nn_unique_check_pk_ref +( + text_nn_unique_check_pk_ref text PRIMARY KEY NOT NULL UNIQUE CHECK ( length(text_nn_unique_check_pk_ref) > 0) REFERENCES text_ref (text_ref) +); + +DROP TABLE IF EXISTS text_unique_pk; +CREATE TABLE text_unique_pk +( + text_unique_pk text PRIMARY KEY UNIQUE +); + +DROP TABLE IF EXISTS text_unique_check_pk; +CREATE TABLE text_unique_check_pk +( + text_unique_check_pk text PRIMARY KEY UNIQUE CHECK ( length(text_unique_check_pk) > 0 ) +); + +DROP TABLE IF EXISTS text_unique_check_pk_ref; +CREATE TABLE text_unique_check_pk_ref +( + text_unique_check_pk_ref text PRIMARY KEY UNIQUE CHECK ( length(text_unique_check_pk_ref) > 0) REFERENCES text_ref (text_ref) +); + +DROP TABLE IF EXISTS text_check_pk; +CREATE TABLE text_check_pk +( + text_check_pk text PRIMARY KEY CHECK ( length(text_check_pk) > 0 ) +); + +DROP TABLE IF EXISTS text_def_const_unique_check_pk; +CREATE TABLE text_def_const_unique_check_pk +( + text_def_const_unique_check_pk text PRIMARY KEY UNIQUE CHECK ( length(text_def_const_unique_check_pk) > 0 ) DEFAULT '42' +); + +DROP TABLE IF EXISTS text_def_const_unique_check_pk_ref; +CREATE TABLE text_def_const_unique_check_pk_ref +( + text_def_const_unique_check_pk_ref text PRIMARY KEY UNIQUE CHECK ( length(text_def_const_unique_check_pk_ref) > 0 ) DEFAULT '42' REFERENCES text_ref (text_ref) +); + +DROP TABLE IF EXISTS text_def_func_unique_check_pk; +CREATE TABLE text_def_func_unique_check_pk +( + text_def_func_unique_check_pk text PRIMARY KEY UNIQUE CHECK ( length(text_def_func_unique_check_pk) > 0 ) DEFAULT pi() +); + +DROP TABLE IF EXISTS text_def_func_unique_check_pk_ref; +CREATE TABLE text_def_func_unique_check_pk_ref +( + text_def_func_unique_check_pk_ref text PRIMARY KEY UNIQUE CHECK ( length(text_def_func_unique_check_pk_ref) > 0 ) DEFAULT pi() REFERENCES text_ref (text_ref) +); diff --git a/internal/integration_tests/postgres/testdata/time.sql b/internal/integration_tests/postgres/testdata/time.sql new file mode 100644 index 00000000..83cc4575 --- /dev/null +++ b/internal/integration_tests/postgres/testdata/time.sql @@ -0,0 +1,131 @@ +DROP TABLE IF EXISTS time_ref CASCADE; +CREATE TABLE time_ref +( + time_ref time UNIQUE +); + +DROP TABLE IF EXISTS time; +CREATE TABLE time +( + time time, + time_nn time NOT NULL, + time_nn_unique time NOT NULL UNIQUE, + time_nn_check time NOT NULL CHECK ( time > '12:34:56' +) , + time_nn_ref time NOT NULL REFERENCES time_ref(time_ref), + time_nn_def_const time NOT NULL DEFAULT '12:34:56', + time_nn_def_func time NOT NULL DEFAULT now(), + time_nn_unique_check time NOT NULL UNIQUE CHECK ( time > '12:34:56' ), + + time_unique time UNIQUE, + time_unique_check time UNIQUE CHECK ( time > '12:34:56' ), + time_unique_ref time UNIQUE REFERENCES time_ref(time_ref), + time_unique_def_const time UNIQUE DEFAULT '12:34:56', + time_unique_def_func time UNIQUE DEFAULT now(), + + time_check time CHECK ( time > '12:34:56' ), + time_check_ref time CHECK ( time > '12:34:56' ) REFERENCES time_ref(time_ref), + time_check_def_const time CHECK ( time > '12:34:56' ) DEFAULT '12:34:56', + time_check_def_func time CHECK ( time > '12:34:56' ) DEFAULT now(), + + time_ref time REFERENCES time_ref(time_ref), + time_ref_def_const time REFERENCES time_ref(time_ref) DEFAULT '12:34:56', + time_ref_def_func time REFERENCES time_ref(time_ref) DEFAULT now(), + time_ref_unique_check time UNIQUE CHECK ( time > '12:34:56' ) REFERENCES time_ref(time_ref), + + time_def_const time DEFAULT '12:34:56', + time_def_const_unique_check time UNIQUE CHECK ( time > '12:34:56' )DEFAULT '12:34:56', + + time_def_func time DEFAULT now(), + time_def_func_unique_check time UNIQUE CHECK ( time > '12:34:56' ) DEFAULT now() +); + +DROP TABLE IF EXISTS time_pk; +CREATE TABLE time_pk +( + time_pk time PRIMARY KEY +); + +DROP TABLE IF EXISTS time_pk_ref; +CREATE TABLE time_pk_ref +( + time_pk_ref time PRIMARY KEY REFERENCES time_ref (time_ref) +); + +DROP TABLE IF EXISTS time_pk_def_const; +CREATE TABLE time_pk_def_const +( + time_pk_def_const time PRIMARY KEY DEFAULT '12:34:56' +); + +DROP TABLE IF EXISTS time_pk_def_func; +CREATE TABLE time_pk_def_func +( + time_pk_def_func time PRIMARY KEY DEFAULT now() +); + +DROP TABLE IF EXISTS time_nn_pk; +CREATE TABLE time_nn_pk +( + time_nn_pk time NOT NULL PRIMARY KEY +); + +DROP TABLE IF EXISTS time_nn_unique_check_pk; +CREATE TABLE time_nn_unique_check_pk +( + time_nn_unique_check_pk time PRIMARY KEY NOT NULL UNIQUE CHECK ( time_nn_unique_check_pk > '12:34:56' ) +); + +DROP TABLE IF EXISTS time_nn_unique_check_pk_ref; +CREATE TABLE time_nn_unique_check_pk_ref +( + time_nn_unique_check_pk_ref time PRIMARY KEY NOT NULL UNIQUE CHECK ( time_nn_unique_check_pk_ref > '12:34:56' ) REFERENCES time_ref (time_ref) +); + +DROP TABLE IF EXISTS time_unique_pk; +CREATE TABLE time_unique_pk +( + time_unique_pk time PRIMARY KEY UNIQUE +); + +DROP TABLE IF EXISTS time_unique_check_pk; +CREATE TABLE time_unique_check_pk +( + time_unique_check_pk time PRIMARY KEY UNIQUE CHECK ( time_unique_check_pk > '12:34:56' ) +); + +DROP TABLE IF EXISTS time_unique_check_pk_ref; +CREATE TABLE time_unique_check_pk_ref +( + time_unique_check_pk_ref time PRIMARY KEY UNIQUE CHECK ( time_unique_check_pk_ref > '12:34:56' ) REFERENCES time_ref (time_ref) +); + +DROP TABLE IF EXISTS time_check_pk; +CREATE TABLE time_check_pk +( + time_check_pk time PRIMARY KEY CHECK ( time_check_pk > '12:34:56' ) +); + +DROP TABLE IF EXISTS time_def_const_unique_check_pk; +CREATE TABLE time_def_const_unique_check_pk +( + time_def_const_unique_check_pk time PRIMARY KEY UNIQUE CHECK ( time_def_const_unique_check_pk > '12:34:56' ) DEFAULT '12:34:56' +); + +DROP TABLE IF EXISTS time_def_const_unique_check_pk_ref; +CREATE TABLE time_def_const_unique_check_pk_ref +( + time_def_const_unique_check_pk_ref time PRIMARY KEY UNIQUE CHECK ( time_def_const_unique_check_pk_ref > '12:34:56' ) DEFAULT '12:34:56' REFERENCES time_ref (time_ref) +); + +DROP TABLE IF EXISTS time_def_func_unique_check_pk; +CREATE TABLE time_def_func_unique_check_pk +( + time_def_func_unique_check_pk time PRIMARY KEY UNIQUE CHECK ( time_def_func_unique_check_pk > '12:34:56' ) DEFAULT now() +); + +DROP TABLE IF EXISTS time_def_func_unique_check_pk_ref; +CREATE TABLE time_def_func_unique_check_pk_ref +( + time_def_func_unique_check_pk_ref time PRIMARY KEY UNIQUE CHECK ( time_def_func_unique_check_pk_ref > '12:34:56' ) DEFAULT now() REFERENCES time_ref (time_ref) +); diff --git a/internal/integration_tests/postgres/testdata/timestamp.sql b/internal/integration_tests/postgres/testdata/timestamp.sql new file mode 100644 index 00000000..842dbff0 --- /dev/null +++ b/internal/integration_tests/postgres/testdata/timestamp.sql @@ -0,0 +1,131 @@ +DROP TABLE IF EXISTS timestamp_ref CASCADE; +CREATE TABLE timestamp_ref +( + timestamp_ref timestamp UNIQUE +); + +DROP TABLE IF EXISTS timestamp; +CREATE TABLE timestamp +( + timestamp timestamp, + timestamp_nn timestamp NOT NULL, + timestamp_nn_unique timestamp NOT NULL UNIQUE, + timestamp_nn_check timestamp NOT NULL CHECK ( timestamp > '2020-03-01 12:34:56' +) , + timestamp_nn_ref timestamp NOT NULL REFERENCES timestamp_ref(timestamp_ref), + timestamp_nn_def_const timestamp NOT NULL DEFAULT '2020-03-01 12:34:56', + timestamp_nn_def_func timestamp NOT NULL DEFAULT now(), + timestamp_nn_unique_check timestamp NOT NULL UNIQUE CHECK ( timestamp > '2020-03-01 12:34:56' ), + + timestamp_unique timestamp UNIQUE, + timestamp_unique_check timestamp UNIQUE CHECK ( timestamp > '2020-03-01 12:34:56' ), + timestamp_unique_ref timestamp UNIQUE REFERENCES timestamp_ref(timestamp_ref), + timestamp_unique_def_const timestamp UNIQUE DEFAULT '2020-03-01 12:34:56', + timestamp_unique_def_func timestamp UNIQUE DEFAULT now(), + + timestamp_check timestamp CHECK ( timestamp > '2020-03-01 12:34:56' ), + timestamp_check_ref timestamp CHECK ( timestamp > '2020-03-01 12:34:56' ) REFERENCES timestamp_ref(timestamp_ref), + timestamp_check_def_const timestamp CHECK ( timestamp > '2020-03-01 12:34:56' ) DEFAULT '2020-03-01 12:34:56', + timestamp_check_def_func timestamp CHECK ( timestamp > '2020-03-01 12:34:56' ) DEFAULT now(), + + timestamp_ref timestamp REFERENCES timestamp_ref(timestamp_ref), + timestamp_ref_def_const timestamp REFERENCES timestamp_ref(timestamp_ref) DEFAULT '2020-03-01 12:34:56', + timestamp_ref_def_func timestamp REFERENCES timestamp_ref(timestamp_ref) DEFAULT now(), + timestamp_ref_unique_check timestamp UNIQUE CHECK ( timestamp > '2020-03-01 12:34:56' ) REFERENCES timestamp_ref(timestamp_ref), + + timestamp_def_const timestamp DEFAULT '2020-03-01 12:34:56', + timestamp_def_const_unique_check timestamp UNIQUE CHECK ( timestamp > '2020-03-01 12:34:56' )DEFAULT '2020-03-01 12:34:56', + + timestamp_def_func timestamp DEFAULT now(), + timestamp_def_func_unique_check timestamp UNIQUE CHECK ( timestamp > '2020-03-01 12:34:56' ) DEFAULT now() +); + +DROP TABLE IF EXISTS timestamp_pk; +CREATE TABLE timestamp_pk +( + timestamp_pk timestamp PRIMARY KEY +); + +DROP TABLE IF EXISTS timestamp_pk_ref; +CREATE TABLE timestamp_pk_ref +( + timestamp_pk_ref timestamp PRIMARY KEY REFERENCES timestamp_ref (timestamp_ref) +); + +DROP TABLE IF EXISTS timestamp_pk_def_const; +CREATE TABLE timestamp_pk_def_const +( + timestamp_pk_def_const timestamp PRIMARY KEY DEFAULT '2020-03-01 12:34:56' +); + +DROP TABLE IF EXISTS timestamp_pk_def_func; +CREATE TABLE timestamp_pk_def_func +( + timestamp_pk_def_func timestamp PRIMARY KEY DEFAULT now() +); + +DROP TABLE IF EXISTS timestamp_nn_pk; +CREATE TABLE timestamp_nn_pk +( + timestamp_nn_pk timestamp NOT NULL PRIMARY KEY +); + +DROP TABLE IF EXISTS timestamp_nn_unique_check_pk; +CREATE TABLE timestamp_nn_unique_check_pk +( + timestamp_nn_unique_check_pk timestamp PRIMARY KEY NOT NULL UNIQUE CHECK ( timestamp_nn_unique_check_pk > '2020-03-01 12:34:56' ) +); + +DROP TABLE IF EXISTS timestamp_nn_unique_check_pk_ref; +CREATE TABLE timestamp_nn_unique_check_pk_ref +( + timestamp_nn_unique_check_pk_ref timestamp PRIMARY KEY NOT NULL UNIQUE CHECK ( timestamp_nn_unique_check_pk_ref > '2020-03-01 12:34:56' ) REFERENCES timestamp_ref (timestamp_ref) +); + +DROP TABLE IF EXISTS timestamp_unique_pk; +CREATE TABLE timestamp_unique_pk +( + timestamp_unique_pk timestamp PRIMARY KEY UNIQUE +); + +DROP TABLE IF EXISTS timestamp_unique_check_pk; +CREATE TABLE timestamp_unique_check_pk +( + timestamp_unique_check_pk timestamp PRIMARY KEY UNIQUE CHECK ( timestamp_unique_check_pk > '2020-03-01 12:34:56' ) +); + +DROP TABLE IF EXISTS timestamp_unique_check_pk_ref; +CREATE TABLE timestamp_unique_check_pk_ref +( + timestamp_unique_check_pk_ref timestamp PRIMARY KEY UNIQUE CHECK ( timestamp_unique_check_pk_ref > '2020-03-01 12:34:56' ) REFERENCES timestamp_ref (timestamp_ref) +); + +DROP TABLE IF EXISTS timestamp_check_pk; +CREATE TABLE timestamp_check_pk +( + timestamp_check_pk timestamp PRIMARY KEY CHECK ( timestamp_check_pk > '2020-03-01 12:34:56' ) +); + +DROP TABLE IF EXISTS timestamp_def_const_unique_check_pk; +CREATE TABLE timestamp_def_const_unique_check_pk +( + timestamp_def_const_unique_check_pk timestamp PRIMARY KEY UNIQUE CHECK ( timestamp_def_const_unique_check_pk > '2020-03-01 12:34:56' ) DEFAULT '2020-03-01 12:34:56' +); + +DROP TABLE IF EXISTS timestamp_def_const_unique_check_pk_ref; +CREATE TABLE timestamp_def_const_unique_check_pk_ref +( + timestamp_def_const_unique_check_pk_ref timestamp PRIMARY KEY UNIQUE CHECK ( timestamp_def_const_unique_check_pk_ref > '2020-03-01 12:34:56' ) DEFAULT '2020-03-01 12:34:56' REFERENCES timestamp_ref (timestamp_ref) +); + +DROP TABLE IF EXISTS timestamp_def_func_unique_check_pk; +CREATE TABLE timestamp_def_func_unique_check_pk +( + timestamp_def_func_unique_check_pk timestamp PRIMARY KEY UNIQUE CHECK ( timestamp_def_func_unique_check_pk > '2020-03-01 12:34:56' ) DEFAULT now() +); + +DROP TABLE IF EXISTS timestamp_def_func_unique_check_pk_ref; +CREATE TABLE timestamp_def_func_unique_check_pk_ref +( + timestamp_def_func_unique_check_pk_ref timestamp PRIMARY KEY UNIQUE CHECK ( timestamp_def_func_unique_check_pk_ref > '2020-03-01 12:34:56' ) DEFAULT now() REFERENCES timestamp_ref (timestamp_ref) +); diff --git a/internal/integration_tests/postgres/testdata/timestamptz.sql b/internal/integration_tests/postgres/testdata/timestamptz.sql new file mode 100644 index 00000000..1d0742e2 --- /dev/null +++ b/internal/integration_tests/postgres/testdata/timestamptz.sql @@ -0,0 +1,130 @@ +DROP TABLE IF EXISTS timestamptz_ref CASCADE; +CREATE TABLE timestamptz_ref +( + timestamptz_ref timestamptz UNIQUE +); + +DROP TABLE IF EXISTS timestamptz; +CREATE TABLE timestamptz +( + timestamptz timestamptz, + timestamptz_nn timestamptz NOT NULL, + timestamptz_nn_unique timestamptz NOT NULL UNIQUE, + timestamptz_nn_check timestamptz NOT NULL CHECK ( timestamptz > '2020-03-01 12:34:56+8' ), + timestamptz_nn_ref timestamptz NOT NULL REFERENCES timestamptz_ref (timestamptz_ref), + timestamptz_nn_def_const timestamptz NOT NULL DEFAULT '2020-03-01 12:34:56+8', + timestamptz_nn_def_func timestamptz NOT NULL DEFAULT now(), + timestamptz_nn_unique_check timestamptz NOT NULL UNIQUE CHECK ( timestamptz > '2020-03-01 12:34:56+8' ), + + timestamptz_unique timestamptz UNIQUE, + timestamptz_unique_check timestamptz UNIQUE CHECK ( timestamptz > '2020-03-01 12:34:56+8' ), + timestamptz_unique_ref timestamptz UNIQUE REFERENCES timestamptz_ref (timestamptz_ref), + timestamptz_unique_def_const timestamptz UNIQUE DEFAULT '2020-03-01 12:34:56+8', + timestamptz_unique_def_func timestamptz UNIQUE DEFAULT now(), + + timestamptz_check timestamptz CHECK ( timestamptz > '2020-03-01 12:34:56+8' ), + timestamptz_check_ref timestamptz CHECK ( timestamptz > '2020-03-01 12:34:56+8' ) REFERENCES timestamptz_ref (timestamptz_ref), + timestamptz_check_def_const timestamptz CHECK ( timestamptz > '2020-03-01 12:34:56+8' ) DEFAULT '2020-03-01 12:34:56+8', + timestamptz_check_def_func timestamptz CHECK ( timestamptz > '2020-03-01 12:34:56+8' ) DEFAULT now(), + + timestamptz_ref timestamptz REFERENCES timestamptz_ref (timestamptz_ref), + timestamptz_ref_def_const timestamptz REFERENCES timestamptz_ref (timestamptz_ref) DEFAULT '2020-03-01 12:34:56+8', + timestamptz_ref_def_func timestamptz REFERENCES timestamptz_ref (timestamptz_ref) DEFAULT now(), + timestamptz_ref_unique_check timestamptz UNIQUE CHECK ( timestamptz > '2020-03-01 12:34:56+8' ) REFERENCES timestamptz_ref (timestamptz_ref), + + timestamptz_def_const timestamptz DEFAULT '2020-03-01 12:34:56+8', + timestamptz_def_const_unique_check timestamptz UNIQUE CHECK ( timestamptz > '2020-03-01 12:34:56+8' ) DEFAULT '2020-03-01 12:34:56+8', + + timestamptz_def_func timestamptz DEFAULT now(), + timestamptz_def_func_unique_check timestamptz UNIQUE CHECK ( timestamptz > '2020-03-01 12:34:56+8' ) DEFAULT now() +); + +DROP TABLE IF EXISTS timestamptz_pk; +CREATE TABLE timestamptz_pk +( + timestamptz_pk timestamptz PRIMARY KEY +); + +DROP TABLE IF EXISTS timestamptz_pk_ref; +CREATE TABLE timestamptz_pk_ref +( + timestamptz_pk_ref timestamptz PRIMARY KEY REFERENCES timestamptz_ref (timestamptz_ref) +); + +DROP TABLE IF EXISTS timestamptz_pk_def_const; +CREATE TABLE timestamptz_pk_def_const +( + timestamptz_pk_def_const timestamptz PRIMARY KEY DEFAULT '2020-03-01 12:34:56+8' +); + +DROP TABLE IF EXISTS timestamptz_pk_def_func; +CREATE TABLE timestamptz_pk_def_func +( + timestamptz_pk_def_func timestamptz PRIMARY KEY DEFAULT now() +); + +DROP TABLE IF EXISTS timestamptz_nn_pk; +CREATE TABLE timestamptz_nn_pk +( + timestamptz_nn_pk timestamptz NOT NULL PRIMARY KEY +); + +DROP TABLE IF EXISTS timestamptz_nn_unique_check_pk; +CREATE TABLE timestamptz_nn_unique_check_pk +( + timestamptz_nn_unique_check_pk timestamptz PRIMARY KEY NOT NULL UNIQUE CHECK ( timestamptz_nn_unique_check_pk > '2020-03-01 12:34:56+8' ) +); + +DROP TABLE IF EXISTS timestamptz_nn_unique_check_pk_ref; +CREATE TABLE timestamptz_nn_unique_check_pk_ref +( + timestamptz_nn_unique_check_pk_ref timestamptz PRIMARY KEY NOT NULL UNIQUE CHECK ( timestamptz_nn_unique_check_pk_ref > '2020-03-01 12:34:56+8' ) REFERENCES timestamptz_ref (timestamptz_ref) +); + +DROP TABLE IF EXISTS timestamptz_unique_pk; +CREATE TABLE timestamptz_unique_pk +( + timestamptz_unique_pk timestamptz PRIMARY KEY UNIQUE +); + +DROP TABLE IF EXISTS timestamptz_unique_check_pk; +CREATE TABLE timestamptz_unique_check_pk +( + timestamptz_unique_check_pk timestamptz PRIMARY KEY UNIQUE CHECK ( timestamptz_unique_check_pk > '2020-03-01 12:34:56+8' ) +); + +DROP TABLE IF EXISTS timestamptz_unique_check_pk_ref; +CREATE TABLE timestamptz_unique_check_pk_ref +( + timestamptz_unique_check_pk_ref timestamptz PRIMARY KEY UNIQUE CHECK ( timestamptz_unique_check_pk_ref > '2020-03-01 12:34:56+8' ) REFERENCES timestamptz_ref (timestamptz_ref) +); + +DROP TABLE IF EXISTS timestamptz_check_pk; +CREATE TABLE timestamptz_check_pk +( + timestamptz_check_pk timestamptz PRIMARY KEY CHECK ( timestamptz_check_pk > '2020-03-01 12:34:56+8' ) +); + +DROP TABLE IF EXISTS timestamptz_def_const_unique_check_pk; +CREATE TABLE timestamptz_def_const_unique_check_pk +( + timestamptz_def_const_unique_check_pk timestamptz PRIMARY KEY UNIQUE CHECK ( timestamptz_def_const_unique_check_pk > '2020-03-01 12:34:56+8' ) DEFAULT '2020-03-01 12:34:56+8' +); + +DROP TABLE IF EXISTS timestamptz_def_const_unique_check_pk_ref; +CREATE TABLE timestamptz_def_const_unique_check_pk_ref +( + timestamptz_def_const_unique_check_pk_ref timestamptz PRIMARY KEY UNIQUE CHECK ( timestamptz_def_const_unique_check_pk_ref > '2020-03-01 12:34:56+8' ) DEFAULT '2020-03-01 12:34:56+8' REFERENCES timestamptz_ref (timestamptz_ref) +); + +DROP TABLE IF EXISTS timestamptz_def_func_unique_check_pk; +CREATE TABLE timestamptz_def_func_unique_check_pk +( + timestamptz_def_func_unique_check_pk timestamptz PRIMARY KEY UNIQUE CHECK ( timestamptz_def_func_unique_check_pk > '2020-03-01 12:34:56+8' ) DEFAULT now() +); + +DROP TABLE IF EXISTS timestamptz_def_func_unique_check_pk_ref; +CREATE TABLE timestamptz_def_func_unique_check_pk_ref +( + timestamptz_def_func_unique_check_pk_ref timestamptz PRIMARY KEY UNIQUE CHECK ( timestamptz_def_func_unique_check_pk_ref > '2020-03-01 12:34:56+8' ) DEFAULT now() REFERENCES timestamptz_ref (timestamptz_ref) +); diff --git a/internal/integration_tests/postgres/testdata/timestampwithouttz.sql b/internal/integration_tests/postgres/testdata/timestampwithouttz.sql new file mode 100644 index 00000000..4a99a13a --- /dev/null +++ b/internal/integration_tests/postgres/testdata/timestampwithouttz.sql @@ -0,0 +1,130 @@ +DROP TABLE IF EXISTS timestamp_without_time_zone_ref CASCADE; +CREATE TABLE timestamp_without_time_zone_ref +( + timestamp_without_time_zone_ref timestamp without time zone UNIQUE +); + +DROP TABLE IF EXISTS timestamp_without_time_zone; +CREATE TABLE timestamp_without_time_zone +( + timestamp_without_time_zone timestamp without time zone, + timestamp_without_time_zone_nn timestamp without time zone NOT NULL, + timestamp_without_time_zone_nn_unique timestamp without time zone NOT NULL UNIQUE, + timestamp_without_time_zone_nn_check timestamp without time zone NOT NULL CHECK ( timestamp_without_time_zone > '2020-03-01 12:34:56' ), + timestamp_without_time_zone_nn_ref timestamp without time zone NOT NULL REFERENCES timestamp_without_time_zone_ref(timestamp_without_time_zone_ref), + timestamp_without_time_zone_nn_def_const timestamp without time zone NOT NULL DEFAULT '2020-03-01 12:34:56', + timestamp_without_time_zone_nn_def_func timestamp without time zone NOT NULL DEFAULT now(), + timestamp_without_time_zone_nn_unique_check timestamp without time zone NOT NULL UNIQUE CHECK ( timestamp_without_time_zone > '2020-03-01 12:34:56' ), + + timestamp_without_time_zone_unique timestamp without time zone UNIQUE, + timestamp_without_time_zone_unique_check timestamp without time zone UNIQUE CHECK ( timestamp_without_time_zone > '2020-03-01 12:34:56' ), + timestamp_without_time_zone_unique_ref timestamp without time zone UNIQUE REFERENCES timestamp_without_time_zone_ref(timestamp_without_time_zone_ref), + timestamp_without_time_zone_unique_def_const timestamp without time zone UNIQUE DEFAULT '2020-03-01 12:34:56', + timestamp_without_time_zone_unique_def_func timestamp without time zone UNIQUE DEFAULT now(), + + timestamp_without_time_zone_check timestamp without time zone CHECK ( timestamp_without_time_zone > '2020-03-01 12:34:56' ), + timestamp_without_time_zone_check_ref timestamp without time zone CHECK ( timestamp_without_time_zone > '2020-03-01 12:34:56' ) REFERENCES timestamp_without_time_zone_ref(timestamp_without_time_zone_ref), + timestamp_without_time_zone_check_def_const timestamp without time zone CHECK ( timestamp_without_time_zone > '2020-03-01 12:34:56' ) DEFAULT '2020-03-01 12:34:56', + timestamp_without_time_zone_check_def_func timestamp without time zone CHECK ( timestamp_without_time_zone > '2020-03-01 12:34:56' ) DEFAULT now(), + + timestamp_without_time_zone_ref timestamp without time zone REFERENCES timestamp_without_time_zone_ref(timestamp_without_time_zone_ref), + timestamp_without_time_zone_ref_def_const timestamp without time zone REFERENCES timestamp_without_time_zone_ref(timestamp_without_time_zone_ref) DEFAULT '2020-03-01 12:34:56', + timestamp_without_time_zone_ref_def_func timestamp without time zone REFERENCES timestamp_without_time_zone_ref(timestamp_without_time_zone_ref) DEFAULT now(), + timestamp_without_time_zone_ref_unique_check timestamp without time zone UNIQUE CHECK ( timestamp_without_time_zone > '2020-03-01 12:34:56' ) REFERENCES timestamp_without_time_zone_ref(timestamp_without_time_zone_ref), + + timestamp_without_time_zone_def_const timestamp without time zone DEFAULT '2020-03-01 12:34:56', + timestamp_without_time_zone_def_const_unique_check timestamp without time zone UNIQUE CHECK ( timestamp_without_time_zone > '2020-03-01 12:34:56' )DEFAULT '2020-03-01 12:34:56', + + timestamp_without_time_zone_def_func timestamp without time zone DEFAULT now(), + timestamp_without_time_zone_def_func_unique_check timestamp without time zone UNIQUE CHECK ( timestamp_without_time_zone > '2020-03-01 12:34:56' ) DEFAULT now() +); + +DROP TABLE IF EXISTS timestamp_without_time_zone_pk; +CREATE TABLE timestamp_without_time_zone_pk +( + timestamp_without_time_zone_pk timestamp without time zone PRIMARY KEY +); + +DROP TABLE IF EXISTS timestamp_without_time_zone_pk_ref; +CREATE TABLE timestamp_without_time_zone_pk_ref +( + timestamp_without_time_zone_pk_ref timestamp without time zone PRIMARY KEY REFERENCES timestamp_without_time_zone_ref(timestamp_without_time_zone_ref) +); + +DROP TABLE IF EXISTS timestamp_without_time_zone_pk_def_const; +CREATE TABLE timestamp_without_time_zone_pk_def_const +( + timestamp_without_time_zone_pk_def_const timestamp without time zone PRIMARY KEY DEFAULT '2020-03-01 12:34:56' +); + +DROP TABLE IF EXISTS timestamp_without_time_zone_pk_def_func; +CREATE TABLE timestamp_without_time_zone_pk_def_func +( + timestamp_without_time_zone_pk_def_func timestamp without time zone PRIMARY KEY DEFAULT now() +); + +DROP TABLE IF EXISTS timestamp_without_time_zone_nn_pk; +CREATE TABLE timestamp_without_time_zone_nn_pk +( + timestamp_without_time_zone_nn_pk timestamp without time zone NOT NULL PRIMARY KEY +); + +DROP TABLE IF EXISTS timestamp_without_time_zone_nn_unique_check_pk; +CREATE TABLE timestamp_without_time_zone_nn_unique_check_pk +( + timestamp_without_time_zone_nn_unique_check_pk timestamp without time zone PRIMARY KEY NOT NULL UNIQUE CHECK ( timestamp_without_time_zone_nn_unique_check_pk > '2020-03-01 12:34:56' ) +); + +DROP TABLE IF EXISTS timestamp_without_time_zone_nn_unique_check_pk_ref; +CREATE TABLE timestamp_without_time_zone_nn_unique_check_pk_ref +( + timestamp_without_time_zone_nn_unique_check_pk_ref timestamp without time zone PRIMARY KEY NOT NULL UNIQUE CHECK ( timestamp_without_time_zone_nn_unique_check_pk_ref > '2020-03-01 12:34:56' ) REFERENCES timestamp_without_time_zone_ref(timestamp_without_time_zone_ref) +); + +DROP TABLE IF EXISTS timestamp_without_time_zone_unique_pk; +CREATE TABLE timestamp_without_time_zone_unique_pk +( + timestamp_without_time_zone_unique_pk timestamp without time zone PRIMARY KEY UNIQUE +); + +DROP TABLE IF EXISTS timestamp_without_time_zone_unique_check_pk; +CREATE TABLE timestamp_without_time_zone_unique_check_pk +( + timestamp_without_time_zone_unique_check_pk timestamp without time zone PRIMARY KEY UNIQUE CHECK ( timestamp_without_time_zone_unique_check_pk > '2020-03-01 12:34:56' ) +); + +DROP TABLE IF EXISTS timestamp_without_time_zone_unique_check_pk_ref; +CREATE TABLE timestamp_without_time_zone_unique_check_pk_ref +( + timestamp_without_time_zone_unique_check_pk_ref timestamp without time zone PRIMARY KEY UNIQUE CHECK ( timestamp_without_time_zone_unique_check_pk_ref > '2020-03-01 12:34:56' ) REFERENCES timestamp_without_time_zone_ref(timestamp_without_time_zone_ref) +); + +DROP TABLE IF EXISTS timestamp_without_time_zone_check_pk; +CREATE TABLE timestamp_without_time_zone_check_pk +( + timestamp_without_time_zone_check_pk timestamp without time zone PRIMARY KEY CHECK ( timestamp_without_time_zone_check_pk > '2020-03-01 12:34:56' ) +); + +DROP TABLE IF EXISTS timestamp_without_time_zone_def_const_unique_check_pk; +CREATE TABLE timestamp_without_time_zone_def_const_unique_check_pk +( + timestamp_without_time_zone_def_const_unique_check_pk timestamp without time zone PRIMARY KEY UNIQUE CHECK ( timestamp_without_time_zone_def_const_unique_check_pk > '2020-03-01 12:34:56' ) DEFAULT '2020-03-01 12:34:56' +); + +DROP TABLE IF EXISTS timestamp_without_time_zone_def_const_unique_check_pk_ref; +CREATE TABLE timestamp_without_time_zone_def_const_unique_check_pk_ref +( + timestamp_without_time_zone_def_const_unique_check_pk_ref timestamp without time zone PRIMARY KEY UNIQUE CHECK ( timestamp_without_time_zone_def_const_unique_check_pk_ref > '2020-03-01 12:34:56' ) DEFAULT '2020-03-01 12:34:56' REFERENCES timestamp_without_time_zone_ref(timestamp_without_time_zone_ref) +); + +DROP TABLE IF EXISTS timestamp_without_time_zone_def_func_unique_check_pk; +CREATE TABLE timestamp_without_time_zone_def_func_unique_check_pk +( + timestamp_without_time_zone_def_func_unique_check_pk timestamp without time zone PRIMARY KEY UNIQUE CHECK ( timestamp_without_time_zone_def_func_unique_check_pk > '2020-03-01 12:34:56' ) DEFAULT now() +); + +DROP TABLE IF EXISTS timestamp_without_time_zone_def_func_unique_check_pk_ref; +CREATE TABLE timestamp_without_time_zone_def_func_unique_check_pk_ref +( + timestamp_without_time_zone_def_func_unique_check_pk_ref timestamp without time zone PRIMARY KEY UNIQUE CHECK ( timestamp_without_time_zone_def_func_unique_check_pk_ref > '2020-03-01 12:34:56' ) DEFAULT now() REFERENCES timestamp_without_time_zone_ref(timestamp_without_time_zone_ref) +); diff --git a/internal/integration_tests/postgres/testdata/timestampwithtz.sql b/internal/integration_tests/postgres/testdata/timestampwithtz.sql new file mode 100644 index 00000000..5f00d9a3 --- /dev/null +++ b/internal/integration_tests/postgres/testdata/timestampwithtz.sql @@ -0,0 +1,136 @@ +DROP TABLE IF EXISTS timestamp_with_time_zone_ref CASCADE; +CREATE TABLE timestamp_with_time_zone_ref +( + timestamp_with_time_zone_ref timestamp with time zone UNIQUE +); + +DROP TABLE IF EXISTS timestamp_with_time_zone; +CREATE TABLE timestamp_with_time_zone +( + timestamp_with_time_zone timestamp with time zone, + timestamp_with_time_zone_nn timestamp with time zone NOT NULL, + timestamp_with_time_zone_nn_unique timestamp with time zone NOT NULL UNIQUE, + timestamp_with_time_zone_nn_check timestamp with time zone NOT NULL CHECK ( timestamp_with_time_zone > '2020-03-01 12:34:56+8' ), + timestamp_with_time_zone_nn_ref timestamp with time zone NOT NULL REFERENCES timestamp_with_time_zone_ref (timestamp_with_time_zone_ref), + timestamp_with_time_zone_nn_def_const timestamp with time zone NOT NULL DEFAULT '2020-03-01 12:34:56+8', + timestamp_with_time_zone_nn_def_func timestamp with time zone NOT NULL DEFAULT now(), + timestamp_with_time_zone_nn_unique_check timestamp with time zone NOT NULL UNIQUE CHECK ( timestamp_with_time_zone > '2020-03-01 12:34:56+8' ), + + timestamp_with_time_zone_unique timestamp with time zone UNIQUE, + timestamp_with_time_zone_unique_check timestamp with time zone UNIQUE CHECK ( timestamp_with_time_zone > '2020-03-01 12:34:56+8' ), + timestamp_with_time_zone_unique_ref timestamp with time zone UNIQUE REFERENCES timestamp_with_time_zone_ref (timestamp_with_time_zone_ref), + timestamp_with_time_zone_unique_def_const timestamp with time zone UNIQUE DEFAULT '2020-03-01 12:34:56+8', + timestamp_with_time_zone_unique_def_func timestamp with time zone UNIQUE DEFAULT now(), + + timestamp_with_time_zone_check timestamp with time zone CHECK ( timestamp_with_time_zone > '2020-03-01 12:34:56+8' ), + timestamp_with_time_zone_check_ref timestamp with time zone CHECK ( timestamp_with_time_zone > '2020-03-01 12:34:56+8' ) REFERENCES timestamp_with_time_zone_ref (timestamp_with_time_zone_ref), + timestamp_with_time_zone_check_def_const timestamp with time zone CHECK ( timestamp_with_time_zone > '2020-03-01 12:34:56+8' ) DEFAULT '2020-03-01 12:34:56+8', + timestamp_with_time_zone_check_def_func timestamp with time zone CHECK ( timestamp_with_time_zone > '2020-03-01 12:34:56+8' ) DEFAULT now(), + + timestamp_with_time_zone_ref timestamp with time zone REFERENCES timestamp_with_time_zone_ref (timestamp_with_time_zone_ref), + timestamp_with_time_zone_ref_def_const timestamp with time zone REFERENCES timestamp_with_time_zone_ref (timestamp_with_time_zone_ref) DEFAULT '2020-03-01 12:34:56+8', + timestamp_with_time_zone_ref_def_func timestamp with time zone REFERENCES timestamp_with_time_zone_ref (timestamp_with_time_zone_ref) DEFAULT now(), + timestamp_with_time_zone_ref_unique_check timestamp with time zone UNIQUE CHECK ( timestamp_with_time_zone > '2020-03-01 12:34:56+8' ) REFERENCES timestamp_with_time_zone_ref (timestamp_with_time_zone_ref), + + timestamp_with_time_zone_def_const timestamp with time zone DEFAULT '2020-03-01 12:34:56+8', + timestamp_with_time_zone_def_const_unique_check timestamp with time zone UNIQUE CHECK ( timestamp_with_time_zone > '2020-03-01 12:34:56+8' ) DEFAULT '2020-03-01 12:34:56+8', + + timestamp_with_time_zone_def_func timestamp with time zone DEFAULT now(), + timestamp_with_time_zone_def_func_unique_check timestamp with time zone UNIQUE CHECK ( timestamp_with_time_zone > '2020-03-01 12:34:56+8' ) DEFAULT now() +); + +DROP TABLE IF EXISTS timestamp_with_time_zone_pk; +CREATE TABLE timestamp_with_time_zone_pk +( + timestamp_with_time_zone_pk timestamp with time zone PRIMARY KEY +); + +DROP TABLE IF EXISTS timestamp_with_time_zone_pk_ref; +CREATE TABLE timestamp_with_time_zone_pk_ref +( + timestamp_with_time_zone_pk_ref timestamp with time zone PRIMARY KEY REFERENCES timestamp_with_time_zone_ref (timestamp_with_time_zone_ref) +); + +DROP TABLE IF EXISTS timestamp_with_time_zone_pk_def_const; +CREATE TABLE timestamp_with_time_zone_pk_def_const +( + timestamp_with_time_zone_pk_def_const timestamp with time zone PRIMARY KEY DEFAULT '2020-03-01 12:34:56+8' +); + +DROP TABLE IF EXISTS timestamp_with_time_zone_pk_def_func; +CREATE TABLE timestamp_with_time_zone_pk_def_func +( + timestamp_with_time_zone_pk_def_func timestamp with time zone PRIMARY KEY DEFAULT now() +); + +DROP TABLE IF EXISTS timestamp_with_time_zone_nn_pk; +CREATE TABLE timestamp_with_time_zone_nn_pk +( + timestamp_with_time_zone_nn_pk timestamp with time zone NOT NULL PRIMARY KEY +); + +DROP TABLE IF EXISTS timestamp_with_time_zone_nn_unique_check_pk; +CREATE TABLE timestamp_with_time_zone_nn_unique_check_pk +( + timestamp_with_time_zone_nn_unique_check_pk timestamp with time zone PRIMARY KEY NOT NULL UNIQUE CHECK ( timestamp_with_time_zone_nn_unique_check_pk > '2020-03-01 12:34:56+8' ) +); + +DROP TABLE IF EXISTS timestamp_with_time_zone_nn_unique_check_pk_ref; +CREATE TABLE timestamp_with_time_zone_nn_unique_check_pk_ref +( + timestamp_with_time_zone_nn_unique_check_pk_ref timestamp with time zone PRIMARY KEY NOT NULL UNIQUE CHECK ( timestamp_with_time_zone_nn_unique_check_pk_ref > '2020-03-01 12:34:56+8' ) REFERENCES timestamp_with_time_zone_ref (timestamp_with_time_zone_ref) +); + +DROP TABLE IF EXISTS timestamp_with_time_zone_unique_pk; +CREATE TABLE timestamp_with_time_zone_unique_pk +( + timestamp_with_time_zone_unique_pk timestamp with time zone PRIMARY KEY UNIQUE +); + +DROP TABLE IF EXISTS timestamp_with_time_zone_unique_check_pk; +CREATE TABLE timestamp_with_time_zone_unique_check_pk +( + timestamp_with_time_zone_unique_check_pk timestamp with time zone PRIMARY KEY UNIQUE CHECK ( timestamp_with_time_zone_unique_check_pk > '2020-03-01 12:34:56+8' ) +); + +DROP TABLE IF EXISTS timestamp_with_time_zone_unique_check_pk_ref; +CREATE TABLE timestamp_with_time_zone_unique_check_pk_ref +( + timestamp_with_time_zone_unique_check_pk_ref timestamp with time zone PRIMARY KEY UNIQUE CHECK ( timestamp_with_time_zone_unique_check_pk_ref > '2020-03-01 12:34:56+8' ) REFERENCES timestamp_with_time_zone_ref (timestamp_with_time_zone_ref) +); + +DROP TABLE IF EXISTS timestamp_with_time_zone_check_pk; +CREATE TABLE timestamp_with_time_zone_check_pk +( + timestamp_with_time_zone_check_pk timestamp with time zone PRIMARY KEY CHECK ( timestamp_with_time_zone_check_pk > '2020-03-01 12:34:56+8' ) +); + +DROP TABLE IF EXISTS timestamp_with_time_zone_def_const_unique_check_pk; +CREATE TABLE timestamp_with_time_zone_def_const_unique_check_pk +( + timestamp_with_time_zone_def_const_unique_check_pk timestamp with time zone PRIMARY KEY UNIQUE CHECK ( + timestamp_with_time_zone_def_const_unique_check_pk > '2020-03-01 12:34:56+8' ) DEFAULT '2020-03-01 12:34:56+8' +); + +DROP TABLE IF EXISTS timestamp_with_time_zone_def_const_unique_check_pk_ref; +CREATE TABLE timestamp_with_time_zone_def_const_unique_check_pk_ref +( + timestamp_with_time_zone_def_const_unique_check_pk_ref timestamp with time zone PRIMARY KEY UNIQUE CHECK ( + timestamp_with_time_zone_def_const_unique_check_pk_ref > + '2020-03-01 12:34:56+8' ) DEFAULT '2020-03-01 12:34:56+8' REFERENCES timestamp_with_time_zone_ref (timestamp_with_time_zone_ref) +); + +DROP TABLE IF EXISTS timestamp_with_time_zone_def_func_unique_check_pk; +CREATE TABLE timestamp_with_time_zone_def_func_unique_check_pk +( + timestamp_with_time_zone_def_func_unique_check_pk timestamp with time zone PRIMARY KEY UNIQUE CHECK ( + timestamp_with_time_zone_def_func_unique_check_pk > '2020-03-01 12:34:56+8' ) DEFAULT now() +); + +DROP TABLE IF EXISTS timestamp_with_time_zone_def_func_unique_check_pk_ref; +CREATE TABLE timestamp_with_time_zone_def_func_unique_check_pk_ref +( + timestamp_with_time_zone_def_func_unique_check_pk_ref timestamp with time zone PRIMARY KEY UNIQUE CHECK ( + timestamp_with_time_zone_def_func_unique_check_pk_ref > + '2020-03-01 12:34:56+8' ) DEFAULT now() REFERENCES timestamp_with_time_zone_ref (timestamp_with_time_zone_ref) +); diff --git a/internal/integration_tests/postgres/testdata/timewithouttz.sql b/internal/integration_tests/postgres/testdata/timewithouttz.sql new file mode 100644 index 00000000..9f2d7739 --- /dev/null +++ b/internal/integration_tests/postgres/testdata/timewithouttz.sql @@ -0,0 +1,130 @@ +DROP TABLE IF EXISTS time_without_time_zone_ref CASCADE; +CREATE TABLE time_without_time_zone_ref +( + time_without_time_zone_ref time without time zone UNIQUE +); + +DROP TABLE IF EXISTS time_without_time_zone; +CREATE TABLE time_without_time_zone +( + time_without_time_zone time without time zone, + time_without_time_zone_nn time without time zone NOT NULL, + time_without_time_zone_nn_unique time without time zone NOT NULL UNIQUE, + time_without_time_zone_nn_check time without time zone NOT NULL CHECK ( time_without_time_zone > '12:34:56' ), + time_without_time_zone_nn_ref time without time zone NOT NULL REFERENCES time_without_time_zone_ref(time_without_time_zone_ref), + time_without_time_zone_nn_def_const time without time zone NOT NULL DEFAULT '12:34:56', + time_without_time_zone_nn_def_func time without time zone NOT NULL DEFAULT now(), + time_without_time_zone_nn_unique_check time without time zone NOT NULL UNIQUE CHECK ( time_without_time_zone > '12:34:56' ), + + time_without_time_zone_unique time without time zone UNIQUE, + time_without_time_zone_unique_check time without time zone UNIQUE CHECK ( time_without_time_zone > '12:34:56' ), + time_without_time_zone_unique_ref time without time zone UNIQUE REFERENCES time_without_time_zone_ref(time_without_time_zone_ref), + time_without_time_zone_unique_def_const time without time zone UNIQUE DEFAULT '12:34:56', + time_without_time_zone_unique_def_func time without time zone UNIQUE DEFAULT now(), + + time_without_time_zone_check time without time zone CHECK ( time_without_time_zone > '12:34:56' ), + time_without_time_zone_check_ref time without time zone CHECK ( time_without_time_zone > '12:34:56' ) REFERENCES time_without_time_zone_ref(time_without_time_zone_ref), + time_without_time_zone_check_def_const time without time zone CHECK ( time_without_time_zone > '12:34:56' ) DEFAULT '12:34:56', + time_without_time_zone_check_def_func time without time zone CHECK ( time_without_time_zone > '12:34:56' ) DEFAULT now(), + + time_without_time_zone_ref time without time zone REFERENCES time_without_time_zone_ref(time_without_time_zone_ref), + time_without_time_zone_ref_def_const time without time zone REFERENCES time_without_time_zone_ref(time_without_time_zone_ref) DEFAULT '12:34:56', + time_without_time_zone_ref_def_func time without time zone REFERENCES time_without_time_zone_ref(time_without_time_zone_ref) DEFAULT now(), + time_without_time_zone_ref_unique_check time without time zone UNIQUE CHECK ( time_without_time_zone > '12:34:56' ) REFERENCES time_without_time_zone_ref(time_without_time_zone_ref), + + time_without_time_zone_def_const time without time zone DEFAULT '12:34:56', + time_without_time_zone_def_const_unique_check time without time zone UNIQUE CHECK ( time_without_time_zone > '12:34:56' )DEFAULT '12:34:56', + + time_without_time_zone_def_func time without time zone DEFAULT now(), + time_without_time_zone_def_func_unique_check time without time zone UNIQUE CHECK ( time_without_time_zone > '12:34:56' ) DEFAULT now() +); + +DROP TABLE IF EXISTS time_without_time_zone_pk; +CREATE TABLE time_without_time_zone_pk +( + time_without_time_zone_pk time without time zone PRIMARY KEY +); + +DROP TABLE IF EXISTS time_without_time_zone_pk_ref; +CREATE TABLE time_without_time_zone_pk_ref +( + time_without_time_zone_pk_ref time without time zone PRIMARY KEY REFERENCES time_without_time_zone_ref(time_without_time_zone_ref) +); + +DROP TABLE IF EXISTS time_without_time_zone_pk_def_const; +CREATE TABLE time_without_time_zone_pk_def_const +( + time_without_time_zone_pk_def_const time without time zone PRIMARY KEY DEFAULT '12:34:56' +); + +DROP TABLE IF EXISTS time_without_time_zone_pk_def_func; +CREATE TABLE time_without_time_zone_pk_def_func +( + time_without_time_zone_pk_def_func time without time zone PRIMARY KEY DEFAULT now() +); + +DROP TABLE IF EXISTS time_without_time_zone_nn_pk; +CREATE TABLE time_without_time_zone_nn_pk +( + time_without_time_zone_nn_pk time without time zone NOT NULL PRIMARY KEY +); + +DROP TABLE IF EXISTS time_without_time_zone_nn_unique_check_pk; +CREATE TABLE time_without_time_zone_nn_unique_check_pk +( + time_without_time_zone_nn_unique_check_pk time without time zone PRIMARY KEY NOT NULL UNIQUE CHECK ( time_without_time_zone_nn_unique_check_pk > '12:34:56' ) +); + +DROP TABLE IF EXISTS time_without_time_zone_nn_unique_check_pk_ref; +CREATE TABLE time_without_time_zone_nn_unique_check_pk_ref +( + time_without_time_zone_nn_unique_check_pk_ref time without time zone PRIMARY KEY NOT NULL UNIQUE CHECK ( time_without_time_zone_nn_unique_check_pk_ref > '12:34:56' ) REFERENCES time_without_time_zone_ref(time_without_time_zone_ref) +); + +DROP TABLE IF EXISTS time_without_time_zone_unique_pk; +CREATE TABLE time_without_time_zone_unique_pk +( + time_without_time_zone_unique_pk time without time zone PRIMARY KEY UNIQUE +); + +DROP TABLE IF EXISTS time_without_time_zone_unique_check_pk; +CREATE TABLE time_without_time_zone_unique_check_pk +( + time_without_time_zone_unique_check_pk time without time zone PRIMARY KEY UNIQUE CHECK ( time_without_time_zone_unique_check_pk > '12:34:56' ) +); + +DROP TABLE IF EXISTS time_without_time_zone_unique_check_pk_ref; +CREATE TABLE time_without_time_zone_unique_check_pk_ref +( + time_without_time_zone_unique_check_pk_ref time without time zone PRIMARY KEY UNIQUE CHECK ( time_without_time_zone_unique_check_pk_ref > '12:34:56' ) REFERENCES time_without_time_zone_ref(time_without_time_zone_ref) +); + +DROP TABLE IF EXISTS time_without_time_zone_check_pk; +CREATE TABLE time_without_time_zone_check_pk +( + time_without_time_zone_check_pk time without time zone PRIMARY KEY CHECK ( time_without_time_zone_check_pk > '12:34:56' ) +); + +DROP TABLE IF EXISTS time_without_time_zone_def_const_unique_check_pk; +CREATE TABLE time_without_time_zone_def_const_unique_check_pk +( + time_without_time_zone_def_const_unique_check_pk time without time zone PRIMARY KEY UNIQUE CHECK ( time_without_time_zone_def_const_unique_check_pk > '12:34:56' ) DEFAULT '12:34:56' +); + +DROP TABLE IF EXISTS time_without_time_zone_def_const_unique_check_pk_ref; +CREATE TABLE time_without_time_zone_def_const_unique_check_pk_ref +( + time_without_time_zone_def_const_unique_check_pk_ref time without time zone PRIMARY KEY UNIQUE CHECK ( time_without_time_zone_def_const_unique_check_pk_ref > '12:34:56' ) DEFAULT '12:34:56' REFERENCES time_without_time_zone_ref(time_without_time_zone_ref) +); + +DROP TABLE IF EXISTS time_without_time_zone_def_func_unique_check_pk; +CREATE TABLE time_without_time_zone_def_func_unique_check_pk +( + time_without_time_zone_def_func_unique_check_pk time without time zone PRIMARY KEY UNIQUE CHECK ( time_without_time_zone_def_func_unique_check_pk > '12:34:56' ) DEFAULT now() +); + +DROP TABLE IF EXISTS time_without_time_zone_def_func_unique_check_pk_ref; +CREATE TABLE time_without_time_zone_def_func_unique_check_pk_ref +( + time_without_time_zone_def_func_unique_check_pk_ref time without time zone PRIMARY KEY UNIQUE CHECK ( time_without_time_zone_def_func_unique_check_pk_ref > '12:34:56' ) DEFAULT now() REFERENCES time_without_time_zone_ref(time_without_time_zone_ref) +); diff --git a/internal/integration_tests/postgres/testdata/timewithtz.sql b/internal/integration_tests/postgres/testdata/timewithtz.sql new file mode 100644 index 00000000..690b282e --- /dev/null +++ b/internal/integration_tests/postgres/testdata/timewithtz.sql @@ -0,0 +1,130 @@ +DROP TABLE IF EXISTS time_with_time_zone_ref CASCADE; +CREATE TABLE time_with_time_zone_ref +( + time_with_time_zone_ref time with time zone UNIQUE +); + +DROP TABLE IF EXISTS time_with_time_zone; +CREATE TABLE time_with_time_zone +( + time_with_time_zone time with time zone, + time_with_time_zone_nn time with time zone NOT NULL, + time_with_time_zone_nn_unique time with time zone NOT NULL UNIQUE, + time_with_time_zone_nn_check time with time zone NOT NULL CHECK ( time_with_time_zone > '12:34:56+8' ), + time_with_time_zone_nn_ref time with time zone NOT NULL REFERENCES time_with_time_zone_ref (time_with_time_zone_ref), + time_with_time_zone_nn_def_const time with time zone NOT NULL DEFAULT '12:34:56+8', + time_with_time_zone_nn_def_func time with time zone NOT NULL DEFAULT now(), + time_with_time_zone_nn_unique_check time with time zone NOT NULL UNIQUE CHECK ( time_with_time_zone > '12:34:56+8' ), + + time_with_time_zone_unique time with time zone UNIQUE, + time_with_time_zone_unique_check time with time zone UNIQUE CHECK ( time_with_time_zone > '12:34:56+8' ), + time_with_time_zone_unique_ref time with time zone UNIQUE REFERENCES time_with_time_zone_ref (time_with_time_zone_ref), + time_with_time_zone_unique_def_const time with time zone UNIQUE DEFAULT '12:34:56+8', + time_with_time_zone_unique_def_func time with time zone UNIQUE DEFAULT now(), + + time_with_time_zone_check time with time zone CHECK ( time_with_time_zone > '12:34:56+8' ), + time_with_time_zone_check_ref time with time zone CHECK ( time_with_time_zone > '12:34:56+8' ) REFERENCES time_with_time_zone_ref (time_with_time_zone_ref), + time_with_time_zone_check_def_const time with time zone CHECK ( time_with_time_zone > '12:34:56+8' ) DEFAULT '12:34:56+8', + time_with_time_zone_check_def_func time with time zone CHECK ( time_with_time_zone > '12:34:56+8' ) DEFAULT now(), + + time_with_time_zone_ref time with time zone REFERENCES time_with_time_zone_ref (time_with_time_zone_ref), + time_with_time_zone_ref_def_const time with time zone REFERENCES time_with_time_zone_ref (time_with_time_zone_ref) DEFAULT '12:34:56+8', + time_with_time_zone_ref_def_func time with time zone REFERENCES time_with_time_zone_ref (time_with_time_zone_ref) DEFAULT now(), + time_with_time_zone_ref_unique_check time with time zone UNIQUE CHECK ( time_with_time_zone > '12:34:56+8' ) REFERENCES time_with_time_zone_ref (time_with_time_zone_ref), + + time_with_time_zone_def_const time with time zone DEFAULT '12:34:56+8', + time_with_time_zone_def_const_unique_check time with time zone UNIQUE CHECK ( time_with_time_zone > '12:34:56+8' ) DEFAULT '12:34:56+8', + + time_with_time_zone_def_func time with time zone DEFAULT now(), + time_with_time_zone_def_func_unique_check time with time zone UNIQUE CHECK ( time_with_time_zone > '12:34:56+8' ) DEFAULT now() +); + +DROP TABLE IF EXISTS time_with_time_zone_pk; +CREATE TABLE time_with_time_zone_pk +( + time_with_time_zone_pk time with time zone PRIMARY KEY +); + +DROP TABLE IF EXISTS time_with_time_zone_pk_ref; +CREATE TABLE time_with_time_zone_pk_ref +( + time_with_time_zone_pk_ref time with time zone PRIMARY KEY REFERENCES time_with_time_zone_ref (time_with_time_zone_ref) +); + +DROP TABLE IF EXISTS time_with_time_zone_pk_def_const; +CREATE TABLE time_with_time_zone_pk_def_const +( + time_with_time_zone_pk_def_const time with time zone PRIMARY KEY DEFAULT '12:34:56+8' +); + +DROP TABLE IF EXISTS time_with_time_zone_pk_def_func; +CREATE TABLE time_with_time_zone_pk_def_func +( + time_with_time_zone_pk_def_func time with time zone PRIMARY KEY DEFAULT now() +); + +DROP TABLE IF EXISTS time_with_time_zone_nn_pk; +CREATE TABLE time_with_time_zone_nn_pk +( + time_with_time_zone_nn_pk time with time zone NOT NULL PRIMARY KEY +); + +DROP TABLE IF EXISTS time_with_time_zone_nn_unique_check_pk; +CREATE TABLE time_with_time_zone_nn_unique_check_pk +( + time_with_time_zone_nn_unique_check_pk time with time zone PRIMARY KEY NOT NULL UNIQUE CHECK ( time_with_time_zone_nn_unique_check_pk > '12:34:56+8' ) +); + +DROP TABLE IF EXISTS time_with_time_zone_nn_unique_check_pk_ref; +CREATE TABLE time_with_time_zone_nn_unique_check_pk_ref +( + time_with_time_zone_nn_unique_check_pk_ref time with time zone PRIMARY KEY NOT NULL UNIQUE CHECK ( time_with_time_zone_nn_unique_check_pk_ref > '12:34:56+8' ) REFERENCES time_with_time_zone_ref (time_with_time_zone_ref) +); + +DROP TABLE IF EXISTS time_with_time_zone_unique_pk; +CREATE TABLE time_with_time_zone_unique_pk +( + time_with_time_zone_unique_pk time with time zone PRIMARY KEY UNIQUE +); + +DROP TABLE IF EXISTS time_with_time_zone_unique_check_pk; +CREATE TABLE time_with_time_zone_unique_check_pk +( + time_with_time_zone_unique_check_pk time with time zone PRIMARY KEY UNIQUE CHECK ( time_with_time_zone_unique_check_pk > '12:34:56+8' ) +); + +DROP TABLE IF EXISTS time_with_time_zone_unique_check_pk_ref; +CREATE TABLE time_with_time_zone_unique_check_pk_ref +( + time_with_time_zone_unique_check_pk_ref time with time zone PRIMARY KEY UNIQUE CHECK ( time_with_time_zone_unique_check_pk_ref > '12:34:56+8' ) REFERENCES time_with_time_zone_ref (time_with_time_zone_ref) +); + +DROP TABLE IF EXISTS time_with_time_zone_check_pk; +CREATE TABLE time_with_time_zone_check_pk +( + time_with_time_zone_check_pk time with time zone PRIMARY KEY CHECK ( time_with_time_zone_check_pk > '12:34:56+8' ) +); + +DROP TABLE IF EXISTS time_with_time_zone_def_const_unique_check_pk; +CREATE TABLE time_with_time_zone_def_const_unique_check_pk +( + time_with_time_zone_def_const_unique_check_pk time with time zone PRIMARY KEY UNIQUE CHECK ( time_with_time_zone_def_const_unique_check_pk > '12:34:56+8' ) DEFAULT '12:34:56+8' +); + +DROP TABLE IF EXISTS time_with_time_zone_def_const_unique_check_pk_ref; +CREATE TABLE time_with_time_zone_def_const_unique_check_pk_ref +( + time_with_time_zone_def_const_unique_check_pk_ref time with time zone PRIMARY KEY UNIQUE CHECK ( time_with_time_zone_def_const_unique_check_pk_ref > '12:34:56+8' ) DEFAULT '12:34:56+8' REFERENCES time_with_time_zone_ref (time_with_time_zone_ref) +); + +DROP TABLE IF EXISTS time_with_time_zone_def_func_unique_check_pk; +CREATE TABLE time_with_time_zone_def_func_unique_check_pk +( + time_with_time_zone_def_func_unique_check_pk time with time zone PRIMARY KEY UNIQUE CHECK ( time_with_time_zone_def_func_unique_check_pk > '12:34:56+8' ) DEFAULT now() +); + +DROP TABLE IF EXISTS time_with_time_zone_def_func_unique_check_pk_ref; +CREATE TABLE time_with_time_zone_def_func_unique_check_pk_ref +( + time_with_time_zone_def_func_unique_check_pk_ref time with time zone PRIMARY KEY UNIQUE CHECK ( time_with_time_zone_def_func_unique_check_pk_ref > '12:34:56+8' ) DEFAULT now() REFERENCES time_with_time_zone_ref (time_with_time_zone_ref) +); diff --git a/internal/integration_tests/postgres/testdata/varchar.sql b/internal/integration_tests/postgres/testdata/varchar.sql new file mode 100644 index 00000000..22fe8a1e --- /dev/null +++ b/internal/integration_tests/postgres/testdata/varchar.sql @@ -0,0 +1,133 @@ +DROP TABLE IF EXISTS varchar_ref CASCADE; +CREATE TABLE varchar_ref +( + varchar_ref varchar UNIQUE +); + +DROP TABLE IF EXISTS varchar; +CREATE TABLE varchar +( + varchar varchar, + varchar_cap varchar(255), + varchar_nn varchar NOT NULL, + varchar_nn_unique varchar NOT NULL UNIQUE, + varchar_nn_check_cmp varchar NOT NULL CHECK ( varchar = '42' +) , + varchar_nn_check_fn varchar NOT NULL CHECK ( length(varchar) > 0 ), + varchar_nn_ref varchar NOT NULL REFERENCES varchar_ref(varchar_ref), + varchar_nn_def_const varchar NOT NULL DEFAULT '42', + varchar_nn_def_func varchar NOT NULL DEFAULT pi(), + varchar_nn_unique_check varchar NOT NULL UNIQUE CHECK ( length(varchar) > 0 ), + + varchar_unique varchar UNIQUE, + varchar_unique_check varchar UNIQUE CHECK ( length(varchar) > 0 ), + varchar_unique_ref varchar UNIQUE REFERENCES varchar_ref(varchar_ref), + varchar_unique_def_const varchar UNIQUE DEFAULT '42', + varchar_unique_def_func varchar UNIQUE DEFAULT pi(), + + varchar_check varchar CHECK ( length(varchar) > 0 ), + varchar_check_ref varchar CHECK ( length(varchar) > 0 ) REFERENCES varchar_ref(varchar_ref), + varchar_check_def_const varchar CHECK ( length(varchar) > 0 ) DEFAULT '42', + varchar_check_def_func varchar CHECK ( length(varchar) > 0 ) DEFAULT pi(), + + varchar_ref varchar REFERENCES varchar_ref(varchar_ref), + varchar_ref_def_const varchar REFERENCES varchar_ref(varchar_ref) DEFAULT '42', + varchar_ref_def_func varchar REFERENCES varchar_ref(varchar_ref) DEFAULT pi(), + varchar_ref_unique_check varchar UNIQUE CHECK ( length(varchar) > 0 ) REFERENCES varchar_ref(varchar_ref), + + varchar_def_const varchar DEFAULT '42', + varchar_def_const_unique_check varchar UNIQUE CHECK ( length(varchar) > 0 ) DEFAULT '42', + + varchar_def_func varchar DEFAULT pi(), + varchar_def_func_unique_check varchar UNIQUE CHECK ( length(varchar) > 0 ) DEFAULT pi() +); + +DROP TABLE IF EXISTS varchar_pk; +CREATE TABLE varchar_pk +( + varchar_pk varchar PRIMARY KEY +); + +DROP TABLE IF EXISTS varchar_pk_ref; +CREATE TABLE varchar_pk_ref +( + varchar_pk_ref varchar PRIMARY KEY REFERENCES varchar_ref (varchar_ref) +); + +DROP TABLE IF EXISTS varchar_pk_def_const; +CREATE TABLE varchar_pk_def_const +( + varchar_pk_def_const varchar PRIMARY KEY DEFAULT '42' +); + +DROP TABLE IF EXISTS varchar_pk_def_func; +CREATE TABLE varchar_pk_def_func +( + varchar_pk_def_func varchar PRIMARY KEY DEFAULT pi() +); + +DROP TABLE IF EXISTS varchar_nn_pk; +CREATE TABLE varchar_nn_pk +( + varchar_nn_pk varchar NOT NULL PRIMARY KEY +); + +DROP TABLE IF EXISTS varchar_nn_unique_check_pk; +CREATE TABLE varchar_nn_unique_check_pk +( + varchar_nn_unique_check_pk varchar PRIMARY KEY NOT NULL UNIQUE CHECK ( length(varchar_nn_unique_check_pk) > 0) +); + +DROP TABLE IF EXISTS varchar_nn_unique_check_pk_ref; +CREATE TABLE varchar_nn_unique_check_pk_ref +( + varchar_nn_unique_check_pk_ref varchar PRIMARY KEY NOT NULL UNIQUE CHECK ( length(varchar_nn_unique_check_pk_ref) > 0) REFERENCES varchar_ref (varchar_ref) +); + +DROP TABLE IF EXISTS varchar_unique_pk; +CREATE TABLE varchar_unique_pk +( + varchar_unique_pk varchar PRIMARY KEY UNIQUE +); + +DROP TABLE IF EXISTS varchar_unique_check_pk; +CREATE TABLE varchar_unique_check_pk +( + varchar_unique_check_pk varchar PRIMARY KEY UNIQUE CHECK ( length(varchar_unique_check_pk) > 0 ) +); + +DROP TABLE IF EXISTS varchar_unique_check_pk_ref; +CREATE TABLE varchar_unique_check_pk_ref +( + varchar_unique_check_pk_ref varchar PRIMARY KEY UNIQUE CHECK ( length(varchar_unique_check_pk_ref) > 0) REFERENCES varchar_ref (varchar_ref) +); + +DROP TABLE IF EXISTS varchar_check_pk; +CREATE TABLE varchar_check_pk +( + varchar_check_pk varchar PRIMARY KEY CHECK ( length(varchar_check_pk) > 0 ) +); + +DROP TABLE IF EXISTS varchar_def_const_unique_check_pk; +CREATE TABLE varchar_def_const_unique_check_pk +( + varchar_def_const_unique_check_pk varchar PRIMARY KEY UNIQUE CHECK ( length(varchar_def_const_unique_check_pk) > 0 ) DEFAULT '42' +); + +DROP TABLE IF EXISTS varchar_def_const_unique_check_pk_ref; +CREATE TABLE varchar_def_const_unique_check_pk_ref +( + varchar_def_const_unique_check_pk_ref varchar PRIMARY KEY UNIQUE CHECK ( length(varchar_def_const_unique_check_pk_ref) > 0 ) DEFAULT '42' REFERENCES varchar_ref (varchar_ref) +); + +DROP TABLE IF EXISTS varchar_def_func_unique_check_pk; +CREATE TABLE varchar_def_func_unique_check_pk +( + varchar_def_func_unique_check_pk varchar PRIMARY KEY UNIQUE CHECK ( length(varchar_def_func_unique_check_pk) > 0 ) DEFAULT pi() +); + +DROP TABLE IF EXISTS varchar_def_func_unique_check_pk_ref; +CREATE TABLE varchar_def_func_unique_check_pk_ref +( + varchar_def_func_unique_check_pk_ref varchar PRIMARY KEY UNIQUE CHECK ( length(varchar_def_func_unique_check_pk_ref) > 0 ) DEFAULT pi() REFERENCES varchar_ref (varchar_ref) +); diff --git a/pkg/database/database.go b/pkg/database/database.go index f97ad2ab..cbf8f642 100644 --- a/pkg/database/database.go +++ b/pkg/database/database.go @@ -22,9 +22,11 @@ var ( // Database interface for the concrete databases. type Database interface { + SQLDriver() *sqlx.DB DSN() string Connect() error Close() error + Version() (string, error) GetTables(tables ...string) ([]*Table, error) PrepareGetColumnsOfTableStmt() error @@ -78,9 +80,10 @@ type Column struct { // databases it implements partly the Database interface. type GeneralDatabase struct { GetColumnsOfTableStmt *sqlx.Stmt - *sqlx.DB + driver string + *settings.Settings - driver string + *sqlx.DB } // New creates a new Database based on the given type in the settings. @@ -120,6 +123,11 @@ func (gdb *GeneralDatabase) Connect(dsn string) (err error) { return gdb.Ping() } +// SQLDriver returns the underlying SQL driver +func (gdb *GeneralDatabase) SQLDriver() *sqlx.DB { + return gdb.DB +} + // Close closes the database connection. func (gdb *GeneralDatabase) Close() error { return gdb.DB.Close() diff --git a/pkg/database/mysql.go b/pkg/database/mysql.go index f97c40f5..016c09d3 100644 --- a/pkg/database/mysql.go +++ b/pkg/database/mysql.go @@ -34,7 +34,7 @@ func (mysql *MySQL) Connect() error { return mysql.GeneralDatabase.Connect(mysql.DSN()) } -// DSN creates the DSN String to connect to this database. +// DSN creates the data source name string to connect to this database. func (mysql *MySQL) DSN() string { user := mysql.defaultUserName if mysql.Settings.User != "" { @@ -49,6 +49,28 @@ func (mysql *MySQL) DSN() string { user, mysql.Settings.Pswd, mysql.Settings.Host, mysql.Settings.Port, mysql.Settings.DbName) } +// Version reports the actual version of the MySQL database. +func (mysql *MySQL) Version() (string, error) { + var version string + err := mysql.Get(&version, ` + SELECT + CONCAT( + @@version, ' ', + @@version_comment, ', ', + @@version_compile_os, ' ', + @@version_compile_machine) as version + `) + if err != nil { + return "", err + } + return version, nil +} + +// GetDriverImportLibrary returns the golang sql driver specific for the MySQL database. +func (mysql *MySQL) GetDriverImportLibrary() string { + return `"github.com/go-sql-driver/mysql"` +} + // GetTables gets all tables for a given database by name. func (mysql *MySQL) GetTables(tables ...string) ([]*Table, error) { @@ -126,7 +148,7 @@ func (mysql *MySQL) IsAutoIncrement(column Column) bool { return strings.Contains(column.Extra, "auto_increment") } -// GetStringDatatypes returns the string datatypes for the MySQL database. +// GetStringDatatypes returns the string data types for the MySQL database. func (mysql *MySQL) GetStringDatatypes() []string { return []string{ "char", @@ -136,25 +158,31 @@ func (mysql *MySQL) GetStringDatatypes() []string { } } -// IsString returns true if the colum is of type string for the MySQL database. +// IsString returns true if the column is of type string for the MySQL database. func (mysql *MySQL) IsString(column Column) bool { return isStringInSlice(column.DataType, mysql.GetStringDatatypes()) } -// GetTextDatatypes returns the text datatypes for the MySQL database. +// GetTextDatatypes returns the text data types for the MySQL database. func (mysql *MySQL) GetTextDatatypes() []string { return []string{ + "tinytext", "text", + "mediumtext", + "longtext", + "tinyblob", "blob", + "mediumblob", + "longblob", } } -// IsText returns true if colum is of type text for the MySQL database. +// IsText returns true if column is of type text for the MySQL database. func (mysql *MySQL) IsText(column Column) bool { return isStringInSlice(column.DataType, mysql.GetTextDatatypes()) } -// GetIntegerDatatypes returns the integer datatypes for the MySQL database. +// GetIntegerDatatypes returns the integer data types for the MySQL database. func (mysql *MySQL) GetIntegerDatatypes() []string { return []string{ "tinyint", @@ -165,28 +193,28 @@ func (mysql *MySQL) GetIntegerDatatypes() []string { } } -// IsInteger returns true if colum is of type integer for the MySQL database. +// IsInteger returns true if column is of type integer for the MySQL database. func (mysql *MySQL) IsInteger(column Column) bool { return isStringInSlice(column.DataType, mysql.GetIntegerDatatypes()) } -// GetFloatDatatypes returns the float datatypes for the MySQL database. +// GetFloatDatatypes returns the float data types for the MySQL database. func (mysql *MySQL) GetFloatDatatypes() []string { return []string{ "numeric", "decimal", "float", "real", - "double precision", + "double", } } -// IsFloat returns true if colum is of type float for the MySQL database. +// IsFloat returns true if column is of type float for the MySQL database. func (mysql *MySQL) IsFloat(column Column) bool { return isStringInSlice(column.DataType, mysql.GetFloatDatatypes()) } -// GetTemporalDatatypes returns the temporal datatypes for the MySQL database. +// GetTemporalDatatypes returns the temporal data types for the MySQL database. func (mysql *MySQL) GetTemporalDatatypes() []string { return []string{ "time", @@ -197,7 +225,12 @@ func (mysql *MySQL) GetTemporalDatatypes() []string { } } -// IsTemporal returns true if colum is of type temporal for the MySQL database. +// IsTemporal returns true if column is of type temporal for the MySQL database. func (mysql *MySQL) IsTemporal(column Column) bool { return isStringInSlice(column.DataType, mysql.GetTemporalDatatypes()) } + +// GetTemporalDriverDataType returns the time data type specific for the MySQL database. +func (mysql *MySQL) GetTemporalDriverDataType() string { + return "mysql.NullTime" +} diff --git a/pkg/database/postgresql.go b/pkg/database/postgresql.go index c5f75c23..3b7db4b1 100644 --- a/pkg/database/postgresql.go +++ b/pkg/database/postgresql.go @@ -12,11 +12,20 @@ import ( _ "github.com/lib/pq" ) +// These are the column types for the Postgresql database. +const ( + PostgresqlColumnTypePrimaryKey = "PRIMARY KEY" + PostgresqlColumnTypeAutoIncrement = "nextval" + PostgresqlColumnTypeSerial = "serial" +) + // Postgresql implements the Database interface with help of GeneralDatabase. type Postgresql struct { *GeneralDatabase defaultUserName string + + integerDataTypes map[string]struct{} } // NewPostgresql creates a new Postgresql database. @@ -27,6 +36,21 @@ func NewPostgresql(s *settings.Settings) *Postgresql { driver: dbTypeToDriverMap[s.DbType], }, defaultUserName: "postgres", + + integerDataTypes: map[string]struct{}{ + "smallint": {}, + "int2": {}, + "integer": {}, + "int4": {}, + "bigint": {}, + "int8": {}, + "smallserial": {}, + "serial2": {}, + "serial": {}, + "serial4": {}, + "bigserial": {}, + "serial8": {}, + }, } } @@ -36,7 +60,7 @@ func (pg *Postgresql) Connect() error { return pg.GeneralDatabase.Connect(pg.DSN()) } -// DSN creates the DSN String to connect to this database. +// DSN creates the data source name string to connect to this database. func (pg *Postgresql) DSN() string { user := pg.defaultUserName if pg.Settings.User != "" { @@ -50,6 +74,21 @@ func (pg *Postgresql) DSN() string { user, pg.Settings.Pswd, pg.Settings.Host, pg.Settings.Port, pg.Settings.DbName, pg.Settings.SSLMode) } +// Version reports the actual version of the Postgres database. +func (pg *Postgresql) Version() (string, error) { + var version string + err := pg.Get(&version, `SELECT version() as version`) + if err != nil { + return "", err + } + return version, nil +} + +// GetDriverImportLibrary returns the golang sql driver specific fot the Postgres database. +func (pg *Postgresql) GetDriverImportLibrary() string { + return "pg \"github.com/lib/pq\"" +} + // GetTables gets all tables for a given schema by name. func (pg *Postgresql) GetTables(tables ...string) ([]*Table, error) { @@ -124,15 +163,15 @@ func (pg *Postgresql) GetColumnsOfTable(table *Table) (err error) { // IsPrimaryKey checks if the column belongs to the primary key. func (pg *Postgresql) IsPrimaryKey(column Column) bool { - return strings.Contains(column.ConstraintType.String, "PRIMARY KEY") + return strings.Contains(column.ConstraintType.String, PostgresqlColumnTypePrimaryKey) } // IsAutoIncrement checks if the column is an auto_increment column. func (pg *Postgresql) IsAutoIncrement(column Column) bool { - return strings.Contains(column.DefaultValue.String, "nextval") + return strings.Contains(column.DefaultValue.String, PostgresqlColumnTypeAutoIncrement) } -// GetStringDatatypes returns the string datatypes for the Postgresql database. +// GetStringDatatypes returns the string data types for the Postgresql database. func (pg *Postgresql) GetStringDatatypes() []string { return []string{ "character varying", @@ -143,43 +182,48 @@ func (pg *Postgresql) GetStringDatatypes() []string { } } -// IsString returns true if colum is of type string for the Postgresql database. +// IsString returns true if column is of type string for the Postgresql database. func (pg *Postgresql) IsString(column Column) bool { return isStringInSlice(column.DataType, pg.GetStringDatatypes()) } -// GetTextDatatypes returns the text datatypes for the Postgresql database. +// GetTextDatatypes returns the text data types for the Postgresql database. func (pg *Postgresql) GetTextDatatypes() []string { return []string{ "text", } } -// IsText returns true if colum is of type text for the Postgresql database. +// IsText returns true if column is of type text for the Postgresql database. func (pg *Postgresql) IsText(column Column) bool { return isStringInSlice(column.DataType, pg.GetTextDatatypes()) } -// GetIntegerDatatypes returns the integer datatypes for the Postgresql database. +// GetIntegerDatatypes returns the integer data types for the Postgresql database. +// TODO remove these methods func (pg *Postgresql) GetIntegerDatatypes() []string { return []string{ - "smallint", - "integer", - "bigint", - "smallserial", - "serial", - "bigserial", + "smallint", "int2", + "integer", "int4", + "bigint", "int8", + "smallserial", "serial2", + "serial", "serial4", + "bigserial", "serial8", } } -// IsInteger returns true if colum is of type integer for the Postgresql database. +// IsInteger returns true if column is of type integer for the Postgresql database. func (pg *Postgresql) IsInteger(column Column) bool { - return isStringInSlice(column.DataType, pg.GetIntegerDatatypes()) + _, ok := pg.integerDataTypes[column.DataType] + return ok } -// GetFloatDatatypes returns the float datatypes for the Postgresql database. +// GetFloatDatatypes returns the float data types for the Postgresql database. func (pg *Postgresql) GetFloatDatatypes() []string { return []string{ + "float", + "float4", + "float8", "numeric", "decimal", "real", @@ -187,29 +231,35 @@ func (pg *Postgresql) GetFloatDatatypes() []string { } } -// IsFloat returns true if colum is of type float for the Postgresql database. +// IsFloat returns true if column is of type float for the Postgresql database. func (pg *Postgresql) IsFloat(column Column) bool { return isStringInSlice(column.DataType, pg.GetFloatDatatypes()) } -// GetTemporalDatatypes returns the temporal datatypes for the Postgresql database. +// GetTemporalDatatypes returns the temporal data types for the Postgresql database. func (pg *Postgresql) GetTemporalDatatypes() []string { return []string{ "time", "timestamp", "time with time zone", "timestamp with time zone", + "timestamptz", "time without time zone", "timestamp without time zone", "date", } } -// IsTemporal returns true if colum is of type temporal for the Postgresql database. +// IsTemporal returns true if column is of type temporal for the Postgresql database. func (pg *Postgresql) IsTemporal(column Column) bool { return isStringInSlice(column.DataType, pg.GetTemporalDatatypes()) } +// GetTemporalDriverDataType returns the time data type specific for the Postgres database. +func (pg *Postgresql) GetTemporalDriverDataType() string { + return "pg.NullTime" +} + func (*Postgresql) andInClause(field string, params []string, args *[]any) string { if field == "" || len(params) == 0 { return "" diff --git a/pkg/database/sqlite.go b/pkg/database/sqlite.go index 670ace9f..c0b25323 100644 --- a/pkg/database/sqlite.go +++ b/pkg/database/sqlite.go @@ -50,6 +50,21 @@ func (s *SQLite) DSN() string { return strings.ReplaceAll(u.RequestURI(), "_auth=&", "_auth&") } +// Version reports the actual version of the Sqlite database. +func (s *SQLite) Version() (string, error) { + var version string + err := s.Get(&version, `SELECT sqlite_version()`) + if err != nil { + return "", err + } + return version, nil +} + +// GetDriverImportLibrary returns the golang sql driver specific for the Sqlite database. +func (s *SQLite) GetDriverImportLibrary() string { + return `"github.com/mattn/go-sqlite3"` +} + // GetTables gets all tables for a given database by name. func (s *SQLite) GetTables(tables ...string) ([]*Table, error) { @@ -76,7 +91,7 @@ func (s *SQLite) GetTables(tables ...string) ([]*Table, error) { } // PrepareGetColumnsOfTableStmt prepares the statement for retrieving the -// columns of a specific table for a given database. +// columns of a specific table for a given database. Unused in Sqlite. func (s *SQLite) PrepareGetColumnsOfTableStmt() (err error) { return nil } @@ -159,7 +174,7 @@ func (s *SQLite) GetStringDatatypes() []string { } } -// IsString returns true if the colum is of type string for the SQLite database. +// IsString returns true if the column is of type string for the SQLite database. func (s *SQLite) IsString(column Column) bool { return isStringInSlice(column.DataType, s.GetStringDatatypes()) } @@ -171,7 +186,7 @@ func (s *SQLite) GetTextDatatypes() []string { } } -// IsText returns true if colum is of type text for the SQLite database. +// IsText returns true if column is of type text for the SQLite database. func (s *SQLite) IsText(column Column) bool { return isStringInSlice(column.DataType, s.GetTextDatatypes()) } @@ -183,7 +198,7 @@ func (s *SQLite) GetIntegerDatatypes() []string { } } -// IsInteger returns true if colum is of type integer for the SQLite database. +// IsInteger returns true if column is of type integer for the SQLite database. func (s *SQLite) IsInteger(column Column) bool { return isStringInSlice(column.DataType, s.GetIntegerDatatypes()) } @@ -196,7 +211,7 @@ func (s *SQLite) GetFloatDatatypes() []string { } } -// IsFloat returns true if colum is of type float for the SQLite database. +// IsFloat returns true if column is of type float for the SQLite database. func (s *SQLite) IsFloat(column Column) bool { return isStringInSlice(column.DataType, s.GetFloatDatatypes()) } @@ -206,7 +221,12 @@ func (s *SQLite) GetTemporalDatatypes() []string { return []string{} } -// IsTemporal returns true if colum is of type temporal for the SQLite database. +// IsTemporal returns true if column is of type temporal for the SQLite database. func (s *SQLite) IsTemporal(_ Column) bool { return false } + +// GetTemporalDriverDataType returns the time data type specific for the Sqlite database. +func (s *SQLite) GetTemporalDriverDataType() string { + return "" +} diff --git a/vendor/github.com/Masterminds/squirrel/.gitignore b/vendor/github.com/Masterminds/squirrel/.gitignore new file mode 100644 index 00000000..4a0699f0 --- /dev/null +++ b/vendor/github.com/Masterminds/squirrel/.gitignore @@ -0,0 +1 @@ +squirrel.test \ No newline at end of file diff --git a/vendor/github.com/Masterminds/squirrel/.travis.yml b/vendor/github.com/Masterminds/squirrel/.travis.yml new file mode 100644 index 00000000..7bb6da48 --- /dev/null +++ b/vendor/github.com/Masterminds/squirrel/.travis.yml @@ -0,0 +1,30 @@ +language: go + +go: + - 1.11.x + - 1.12.x + - 1.13.x + +services: + - mysql + - postgresql + +# Setting sudo access to false will let Travis CI use containers rather than +# VMs to run the tests. For more details see: +# - http://docs.travis-ci.com/user/workers/container-based-infrastructure/ +# - http://docs.travis-ci.com/user/workers/standard-infrastructure/ +sudo: false + +before_script: + - mysql -e 'CREATE DATABASE squirrel;' + - psql -c 'CREATE DATABASE squirrel;' -U postgres + +script: + - go test + - cd integration + - go test -args -driver sqlite3 + - go test -args -driver mysql -dataSource travis@/squirrel + - go test -args -driver postgres -dataSource 'postgres://postgres@localhost/squirrel?sslmode=disable' + +notifications: + irc: "irc.freenode.net#masterminds" diff --git a/vendor/github.com/Masterminds/squirrel/LICENSE b/vendor/github.com/Masterminds/squirrel/LICENSE new file mode 100644 index 00000000..b459007f --- /dev/null +++ b/vendor/github.com/Masterminds/squirrel/LICENSE @@ -0,0 +1,23 @@ +MIT License + +Squirrel: The Masterminds +Copyright (c) 2014-2015, Lann Martin. Copyright (C) 2015-2016, Google. Copyright (C) 2015, Matt Farina and Matt Butcher. + + +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. diff --git a/vendor/github.com/Masterminds/squirrel/README.md b/vendor/github.com/Masterminds/squirrel/README.md new file mode 100644 index 00000000..1d37f282 --- /dev/null +++ b/vendor/github.com/Masterminds/squirrel/README.md @@ -0,0 +1,142 @@ +[![Stability: Maintenance](https://masterminds.github.io/stability/maintenance.svg)](https://masterminds.github.io/stability/maintenance.html) +### Squirrel is "complete". +Bug fixes will still be merged (slowly). Bug reports are welcome, but I will not necessarily respond to them. If another fork (or substantially similar project) actively improves on what Squirrel does, let me know and I may link to it here. + + +# Squirrel - fluent SQL generator for Go + +```go +import "github.com/Masterminds/squirrel" +``` + + +[![GoDoc](https://godoc.org/github.com/Masterminds/squirrel?status.png)](https://godoc.org/github.com/Masterminds/squirrel) +[![Build Status](https://api.travis-ci.org/Masterminds/squirrel.svg?branch=master)](https://travis-ci.org/Masterminds/squirrel) + +**Squirrel is not an ORM.** For an application of Squirrel, check out +[structable, a table-struct mapper](https://github.com/Masterminds/structable) + + +Squirrel helps you build SQL queries from composable parts: + +```go +import sq "github.com/Masterminds/squirrel" + +users := sq.Select("*").From("users").Join("emails USING (email_id)") + +active := users.Where(sq.Eq{"deleted_at": nil}) + +sql, args, err := active.ToSql() + +sql == "SELECT * FROM users JOIN emails USING (email_id) WHERE deleted_at IS NULL" +``` + +```go +sql, args, err := sq. + Insert("users").Columns("name", "age"). + Values("moe", 13).Values("larry", sq.Expr("? + 5", 12)). + ToSql() + +sql == "INSERT INTO users (name,age) VALUES (?,?),(?,? + 5)" +``` + +Squirrel can also execute queries directly: + +```go +stooges := users.Where(sq.Eq{"username": []string{"moe", "larry", "curly", "shemp"}}) +three_stooges := stooges.Limit(3) +rows, err := three_stooges.RunWith(db).Query() + +// Behaves like: +rows, err := db.Query("SELECT * FROM users WHERE username IN (?,?,?,?) LIMIT 3", + "moe", "larry", "curly", "shemp") +``` + +Squirrel makes conditional query building a breeze: + +```go +if len(q) > 0 { + users = users.Where("name LIKE ?", fmt.Sprint("%", q, "%")) +} +``` + +Squirrel wants to make your life easier: + +```go +// StmtCache caches Prepared Stmts for you +dbCache := sq.NewStmtCache(db) + +// StatementBuilder keeps your syntax neat +mydb := sq.StatementBuilder.RunWith(dbCache) +select_users := mydb.Select("*").From("users") +``` + +Squirrel loves PostgreSQL: + +```go +psql := sq.StatementBuilder.PlaceholderFormat(sq.Dollar) + +// You use question marks for placeholders... +sql, _, _ := psql.Select("*").From("elephants").Where("name IN (?,?)", "Dumbo", "Verna").ToSql() + +/// ...squirrel replaces them using PlaceholderFormat. +sql == "SELECT * FROM elephants WHERE name IN ($1,$2)" + + +/// You can retrieve id ... +query := sq.Insert("nodes"). + Columns("uuid", "type", "data"). + Values(node.Uuid, node.Type, node.Data). + Suffix("RETURNING \"id\""). + RunWith(m.db). + PlaceholderFormat(sq.Dollar) + +query.QueryRow().Scan(&node.id) +``` + +You can escape question marks by inserting two question marks: + +```sql +SELECT * FROM nodes WHERE meta->'format' ??| array[?,?] +``` + +will generate with the Dollar Placeholder: + +```sql +SELECT * FROM nodes WHERE meta->'format' ?| array[$1,$2] +``` + +## FAQ + +* **How can I build an IN query on composite keys / tuples, e.g. `WHERE (col1, col2) IN ((1,2),(3,4))`? ([#104](https://github.com/Masterminds/squirrel/issues/104))** + + Squirrel does not explicitly support tuples, but you can get the same effect with e.g.: + + ```go + sq.Or{ + sq.Eq{"col1": 1, "col2": 2}, + sq.Eq{"col1": 3, "col2": 4}} + ``` + + ```sql + WHERE (col1 = 1 AND col2 = 2) OR (col1 = 3 AND col2 = 4) + ``` + + (which should produce the same query plan as the tuple version) + +* **Why doesn't `Eq{"mynumber": []uint8{1,2,3}}` turn into an `IN` query? ([#114](https://github.com/Masterminds/squirrel/issues/114))** + + Values of type `[]byte` are handled specially by `database/sql`. In Go, [`byte` is just an alias of `uint8`](https://golang.org/pkg/builtin/#byte), so there is no way to distinguish `[]uint8` from `[]byte`. + +* **Some features are poorly documented!** + + This isn't a frequent complaints section! + +* **Some features are poorly documented?** + + Yes. The tests should be considered a part of the documentation; take a look at those for ideas on how to express more complex queries. + +## License + +Squirrel is released under the +[MIT License](http://www.opensource.org/licenses/MIT). diff --git a/vendor/github.com/Masterminds/squirrel/case.go b/vendor/github.com/Masterminds/squirrel/case.go new file mode 100644 index 00000000..299e14b9 --- /dev/null +++ b/vendor/github.com/Masterminds/squirrel/case.go @@ -0,0 +1,128 @@ +package squirrel + +import ( + "bytes" + "errors" + + "github.com/lann/builder" +) + +func init() { + builder.Register(CaseBuilder{}, caseData{}) +} + +// sqlizerBuffer is a helper that allows to write many Sqlizers one by one +// without constant checks for errors that may come from Sqlizer +type sqlizerBuffer struct { + bytes.Buffer + args []interface{} + err error +} + +// WriteSql converts Sqlizer to SQL strings and writes it to buffer +func (b *sqlizerBuffer) WriteSql(item Sqlizer) { + if b.err != nil { + return + } + + var str string + var args []interface{} + str, args, b.err = nestedToSql(item) + + if b.err != nil { + return + } + + b.WriteString(str) + b.WriteByte(' ') + b.args = append(b.args, args...) +} + +func (b *sqlizerBuffer) ToSql() (string, []interface{}, error) { + return b.String(), b.args, b.err +} + +// whenPart is a helper structure to describe SQLs "WHEN ... THEN ..." expression +type whenPart struct { + when Sqlizer + then Sqlizer +} + +func newWhenPart(when interface{}, then interface{}) whenPart { + return whenPart{newPart(when), newPart(then)} +} + +// caseData holds all the data required to build a CASE SQL construct +type caseData struct { + What Sqlizer + WhenParts []whenPart + Else Sqlizer +} + +// ToSql implements Sqlizer +func (d *caseData) ToSql() (sqlStr string, args []interface{}, err error) { + if len(d.WhenParts) == 0 { + err = errors.New("case expression must contain at lease one WHEN clause") + + return + } + + sql := sqlizerBuffer{} + + sql.WriteString("CASE ") + if d.What != nil { + sql.WriteSql(d.What) + } + + for _, p := range d.WhenParts { + sql.WriteString("WHEN ") + sql.WriteSql(p.when) + sql.WriteString("THEN ") + sql.WriteSql(p.then) + } + + if d.Else != nil { + sql.WriteString("ELSE ") + sql.WriteSql(d.Else) + } + + sql.WriteString("END") + + return sql.ToSql() +} + +// CaseBuilder builds SQL CASE construct which could be used as parts of queries. +type CaseBuilder builder.Builder + +// ToSql builds the query into a SQL string and bound args. +func (b CaseBuilder) ToSql() (string, []interface{}, error) { + data := builder.GetStruct(b).(caseData) + return data.ToSql() +} + +// MustSql builds the query into a SQL string and bound args. +// It panics if there are any errors. +func (b CaseBuilder) MustSql() (string, []interface{}) { + sql, args, err := b.ToSql() + if err != nil { + panic(err) + } + return sql, args +} + +// what sets optional value for CASE construct "CASE [value] ..." +func (b CaseBuilder) what(expr interface{}) CaseBuilder { + return builder.Set(b, "What", newPart(expr)).(CaseBuilder) +} + +// When adds "WHEN ... THEN ..." part to CASE construct +func (b CaseBuilder) When(when interface{}, then interface{}) CaseBuilder { + // TODO: performance hint: replace slice of WhenPart with just slice of parts + // where even indices of the slice belong to "when"s and odd indices belong to "then"s + return builder.Append(b, "WhenParts", newWhenPart(when, then)).(CaseBuilder) +} + +// What sets optional "ELSE ..." part for CASE construct +func (b CaseBuilder) Else(expr interface{}) CaseBuilder { + return builder.Set(b, "Else", newPart(expr)).(CaseBuilder) +} diff --git a/vendor/github.com/Masterminds/squirrel/delete.go b/vendor/github.com/Masterminds/squirrel/delete.go new file mode 100644 index 00000000..f3f31e63 --- /dev/null +++ b/vendor/github.com/Masterminds/squirrel/delete.go @@ -0,0 +1,191 @@ +package squirrel + +import ( + "bytes" + "database/sql" + "fmt" + "strings" + + "github.com/lann/builder" +) + +type deleteData struct { + PlaceholderFormat PlaceholderFormat + RunWith BaseRunner + Prefixes []Sqlizer + From string + WhereParts []Sqlizer + OrderBys []string + Limit string + Offset string + Suffixes []Sqlizer +} + +func (d *deleteData) Exec() (sql.Result, error) { + if d.RunWith == nil { + return nil, RunnerNotSet + } + return ExecWith(d.RunWith, d) +} + +func (d *deleteData) ToSql() (sqlStr string, args []interface{}, err error) { + if len(d.From) == 0 { + err = fmt.Errorf("delete statements must specify a From table") + return + } + + sql := &bytes.Buffer{} + + if len(d.Prefixes) > 0 { + args, err = appendToSql(d.Prefixes, sql, " ", args) + if err != nil { + return + } + + sql.WriteString(" ") + } + + sql.WriteString("DELETE FROM ") + sql.WriteString(d.From) + + if len(d.WhereParts) > 0 { + sql.WriteString(" WHERE ") + args, err = appendToSql(d.WhereParts, sql, " AND ", args) + if err != nil { + return + } + } + + if len(d.OrderBys) > 0 { + sql.WriteString(" ORDER BY ") + sql.WriteString(strings.Join(d.OrderBys, ", ")) + } + + if len(d.Limit) > 0 { + sql.WriteString(" LIMIT ") + sql.WriteString(d.Limit) + } + + if len(d.Offset) > 0 { + sql.WriteString(" OFFSET ") + sql.WriteString(d.Offset) + } + + if len(d.Suffixes) > 0 { + sql.WriteString(" ") + args, err = appendToSql(d.Suffixes, sql, " ", args) + if err != nil { + return + } + } + + sqlStr, err = d.PlaceholderFormat.ReplacePlaceholders(sql.String()) + return +} + +// Builder + +// DeleteBuilder builds SQL DELETE statements. +type DeleteBuilder builder.Builder + +func init() { + builder.Register(DeleteBuilder{}, deleteData{}) +} + +// Format methods + +// PlaceholderFormat sets PlaceholderFormat (e.g. Question or Dollar) for the +// query. +func (b DeleteBuilder) PlaceholderFormat(f PlaceholderFormat) DeleteBuilder { + return builder.Set(b, "PlaceholderFormat", f).(DeleteBuilder) +} + +// Runner methods + +// RunWith sets a Runner (like database/sql.DB) to be used with e.g. Exec. +func (b DeleteBuilder) RunWith(runner BaseRunner) DeleteBuilder { + return setRunWith(b, runner).(DeleteBuilder) +} + +// Exec builds and Execs the query with the Runner set by RunWith. +func (b DeleteBuilder) Exec() (sql.Result, error) { + data := builder.GetStruct(b).(deleteData) + return data.Exec() +} + +// SQL methods + +// ToSql builds the query into a SQL string and bound args. +func (b DeleteBuilder) ToSql() (string, []interface{}, error) { + data := builder.GetStruct(b).(deleteData) + return data.ToSql() +} + +// MustSql builds the query into a SQL string and bound args. +// It panics if there are any errors. +func (b DeleteBuilder) MustSql() (string, []interface{}) { + sql, args, err := b.ToSql() + if err != nil { + panic(err) + } + return sql, args +} + +// Prefix adds an expression to the beginning of the query +func (b DeleteBuilder) Prefix(sql string, args ...interface{}) DeleteBuilder { + return b.PrefixExpr(Expr(sql, args...)) +} + +// PrefixExpr adds an expression to the very beginning of the query +func (b DeleteBuilder) PrefixExpr(expr Sqlizer) DeleteBuilder { + return builder.Append(b, "Prefixes", expr).(DeleteBuilder) +} + +// From sets the table to be deleted from. +func (b DeleteBuilder) From(from string) DeleteBuilder { + return builder.Set(b, "From", from).(DeleteBuilder) +} + +// Where adds WHERE expressions to the query. +// +// See SelectBuilder.Where for more information. +func (b DeleteBuilder) Where(pred interface{}, args ...interface{}) DeleteBuilder { + return builder.Append(b, "WhereParts", newWherePart(pred, args...)).(DeleteBuilder) +} + +// OrderBy adds ORDER BY expressions to the query. +func (b DeleteBuilder) OrderBy(orderBys ...string) DeleteBuilder { + return builder.Extend(b, "OrderBys", orderBys).(DeleteBuilder) +} + +// Limit sets a LIMIT clause on the query. +func (b DeleteBuilder) Limit(limit uint64) DeleteBuilder { + return builder.Set(b, "Limit", fmt.Sprintf("%d", limit)).(DeleteBuilder) +} + +// Offset sets a OFFSET clause on the query. +func (b DeleteBuilder) Offset(offset uint64) DeleteBuilder { + return builder.Set(b, "Offset", fmt.Sprintf("%d", offset)).(DeleteBuilder) +} + +// Suffix adds an expression to the end of the query +func (b DeleteBuilder) Suffix(sql string, args ...interface{}) DeleteBuilder { + return b.SuffixExpr(Expr(sql, args...)) +} + +// SuffixExpr adds an expression to the end of the query +func (b DeleteBuilder) SuffixExpr(expr Sqlizer) DeleteBuilder { + return builder.Append(b, "Suffixes", expr).(DeleteBuilder) +} + +func (b DeleteBuilder) Query() (*sql.Rows, error) { + data := builder.GetStruct(b).(deleteData) + return data.Query() +} + +func (d *deleteData) Query() (*sql.Rows, error) { + if d.RunWith == nil { + return nil, RunnerNotSet + } + return QueryWith(d.RunWith, d) +} diff --git a/vendor/github.com/Masterminds/squirrel/delete_ctx.go b/vendor/github.com/Masterminds/squirrel/delete_ctx.go new file mode 100644 index 00000000..de83c55d --- /dev/null +++ b/vendor/github.com/Masterminds/squirrel/delete_ctx.go @@ -0,0 +1,69 @@ +// +build go1.8 + +package squirrel + +import ( + "context" + "database/sql" + + "github.com/lann/builder" +) + +func (d *deleteData) ExecContext(ctx context.Context) (sql.Result, error) { + if d.RunWith == nil { + return nil, RunnerNotSet + } + ctxRunner, ok := d.RunWith.(ExecerContext) + if !ok { + return nil, NoContextSupport + } + return ExecContextWith(ctx, ctxRunner, d) +} + +func (d *deleteData) QueryContext(ctx context.Context) (*sql.Rows, error) { + if d.RunWith == nil { + return nil, RunnerNotSet + } + ctxRunner, ok := d.RunWith.(QueryerContext) + if !ok { + return nil, NoContextSupport + } + return QueryContextWith(ctx, ctxRunner, d) +} + +func (d *deleteData) QueryRowContext(ctx context.Context) RowScanner { + if d.RunWith == nil { + return &Row{err: RunnerNotSet} + } + queryRower, ok := d.RunWith.(QueryRowerContext) + if !ok { + if _, ok := d.RunWith.(QueryerContext); !ok { + return &Row{err: RunnerNotQueryRunner} + } + return &Row{err: NoContextSupport} + } + return QueryRowContextWith(ctx, queryRower, d) +} + +// ExecContext builds and ExecContexts the query with the Runner set by RunWith. +func (b DeleteBuilder) ExecContext(ctx context.Context) (sql.Result, error) { + data := builder.GetStruct(b).(deleteData) + return data.ExecContext(ctx) +} + +// QueryContext builds and QueryContexts the query with the Runner set by RunWith. +func (b DeleteBuilder) QueryContext(ctx context.Context) (*sql.Rows, error) { + data := builder.GetStruct(b).(deleteData) + return data.QueryContext(ctx) +} + +// QueryRowContext builds and QueryRowContexts the query with the Runner set by RunWith. +func (b DeleteBuilder) QueryRowContext(ctx context.Context) RowScanner { + data := builder.GetStruct(b).(deleteData) + return data.QueryRowContext(ctx) +} + +// ScanContext is a shortcut for QueryRowContext().Scan. +func (b DeleteBuilder) ScanContext(ctx context.Context, dest ...interface{}) error { + return b.QueryRowContext(ctx).Scan(dest...) +} diff --git a/vendor/github.com/Masterminds/squirrel/expr.go b/vendor/github.com/Masterminds/squirrel/expr.go new file mode 100644 index 00000000..eba1b457 --- /dev/null +++ b/vendor/github.com/Masterminds/squirrel/expr.go @@ -0,0 +1,419 @@ +package squirrel + +import ( + "bytes" + "database/sql/driver" + "fmt" + "reflect" + "sort" + "strings" +) + +const ( + // Portable true/false literals. + sqlTrue = "(1=1)" + sqlFalse = "(1=0)" +) + +type expr struct { + sql string + args []interface{} +} + +// Expr builds an expression from a SQL fragment and arguments. +// +// Ex: +// Expr("FROM_UNIXTIME(?)", t) +func Expr(sql string, args ...interface{}) Sqlizer { + return expr{sql: sql, args: args} +} + +func (e expr) ToSql() (sql string, args []interface{}, err error) { + simple := true + for _, arg := range e.args { + if _, ok := arg.(Sqlizer); ok { + simple = false + } + } + if simple { + return e.sql, e.args, nil + } + + buf := &bytes.Buffer{} + ap := e.args + sp := e.sql + + var isql string + var iargs []interface{} + + for err == nil && len(ap) > 0 && len(sp) > 0 { + i := strings.Index(sp, "?") + if i < 0 { + // no more placeholders + break + } + if len(sp) > i+1 && sp[i+1:i+2] == "?" { + // escaped "??"; append it and step past + buf.WriteString(sp[:i+2]) + sp = sp[i+2:] + continue + } + + if as, ok := ap[0].(Sqlizer); ok { + // sqlizer argument; expand it and append the result + isql, iargs, err = as.ToSql() + buf.WriteString(sp[:i]) + buf.WriteString(isql) + args = append(args, iargs...) + } else { + // normal argument; append it and the placeholder + buf.WriteString(sp[:i+1]) + args = append(args, ap[0]) + } + + // step past the argument and placeholder + ap = ap[1:] + sp = sp[i+1:] + } + + // append the remaining sql and arguments + buf.WriteString(sp) + return buf.String(), append(args, ap...), err +} + +type concatExpr []interface{} + +func (ce concatExpr) ToSql() (sql string, args []interface{}, err error) { + for _, part := range ce { + switch p := part.(type) { + case string: + sql += p + case Sqlizer: + pSql, pArgs, err := p.ToSql() + if err != nil { + return "", nil, err + } + sql += pSql + args = append(args, pArgs...) + default: + return "", nil, fmt.Errorf("%#v is not a string or Sqlizer", part) + } + } + return +} + +// ConcatExpr builds an expression by concatenating strings and other expressions. +// +// Ex: +// name_expr := Expr("CONCAT(?, ' ', ?)", firstName, lastName) +// ConcatExpr("COALESCE(full_name,", name_expr, ")") +func ConcatExpr(parts ...interface{}) concatExpr { + return concatExpr(parts) +} + +// aliasExpr helps to alias part of SQL query generated with underlying "expr" +type aliasExpr struct { + expr Sqlizer + alias string +} + +// Alias allows to define alias for column in SelectBuilder. Useful when column is +// defined as complex expression like IF or CASE +// Ex: +// .Column(Alias(caseStmt, "case_column")) +func Alias(expr Sqlizer, alias string) aliasExpr { + return aliasExpr{expr, alias} +} + +func (e aliasExpr) ToSql() (sql string, args []interface{}, err error) { + sql, args, err = e.expr.ToSql() + if err == nil { + sql = fmt.Sprintf("(%s) AS %s", sql, e.alias) + } + return +} + +// Eq is syntactic sugar for use with Where/Having/Set methods. +type Eq map[string]interface{} + +func (eq Eq) toSQL(useNotOpr bool) (sql string, args []interface{}, err error) { + if len(eq) == 0 { + // Empty Sql{} evaluates to true. + sql = sqlTrue + return + } + + var ( + exprs []string + equalOpr = "=" + inOpr = "IN" + nullOpr = "IS" + inEmptyExpr = sqlFalse + ) + + if useNotOpr { + equalOpr = "<>" + inOpr = "NOT IN" + nullOpr = "IS NOT" + inEmptyExpr = sqlTrue + } + + sortedKeys := getSortedKeys(eq) + for _, key := range sortedKeys { + var expr string + val := eq[key] + + switch v := val.(type) { + case driver.Valuer: + if val, err = v.Value(); err != nil { + return + } + } + + r := reflect.ValueOf(val) + if r.Kind() == reflect.Ptr { + if r.IsNil() { + val = nil + } else { + val = r.Elem().Interface() + } + } + + if val == nil { + expr = fmt.Sprintf("%s %s NULL", key, nullOpr) + } else { + if isListType(val) { + valVal := reflect.ValueOf(val) + if valVal.Len() == 0 { + expr = inEmptyExpr + if args == nil { + args = []interface{}{} + } + } else { + for i := 0; i < valVal.Len(); i++ { + args = append(args, valVal.Index(i).Interface()) + } + expr = fmt.Sprintf("%s %s (%s)", key, inOpr, Placeholders(valVal.Len())) + } + } else { + expr = fmt.Sprintf("%s %s ?", key, equalOpr) + args = append(args, val) + } + } + exprs = append(exprs, expr) + } + sql = strings.Join(exprs, " AND ") + return +} + +func (eq Eq) ToSql() (sql string, args []interface{}, err error) { + return eq.toSQL(false) +} + +// NotEq is syntactic sugar for use with Where/Having/Set methods. +// Ex: +// .Where(NotEq{"id": 1}) == "id <> 1" +type NotEq Eq + +func (neq NotEq) ToSql() (sql string, args []interface{}, err error) { + return Eq(neq).toSQL(true) +} + +// Like is syntactic sugar for use with LIKE conditions. +// Ex: +// .Where(Like{"name": "%irrel"}) +type Like map[string]interface{} + +func (lk Like) toSql(opr string) (sql string, args []interface{}, err error) { + var exprs []string + for key, val := range lk { + expr := "" + + switch v := val.(type) { + case driver.Valuer: + if val, err = v.Value(); err != nil { + return + } + } + + if val == nil { + err = fmt.Errorf("cannot use null with like operators") + return + } else { + if isListType(val) { + err = fmt.Errorf("cannot use array or slice with like operators") + return + } else { + expr = fmt.Sprintf("%s %s ?", key, opr) + args = append(args, val) + } + } + exprs = append(exprs, expr) + } + sql = strings.Join(exprs, " AND ") + return +} + +func (lk Like) ToSql() (sql string, args []interface{}, err error) { + return lk.toSql("LIKE") +} + +// NotLike is syntactic sugar for use with LIKE conditions. +// Ex: +// .Where(NotLike{"name": "%irrel"}) +type NotLike Like + +func (nlk NotLike) ToSql() (sql string, args []interface{}, err error) { + return Like(nlk).toSql("NOT LIKE") +} + +// ILike is syntactic sugar for use with ILIKE conditions. +// Ex: +// .Where(ILike{"name": "sq%"}) +type ILike Like + +func (ilk ILike) ToSql() (sql string, args []interface{}, err error) { + return Like(ilk).toSql("ILIKE") +} + +// NotILike is syntactic sugar for use with ILIKE conditions. +// Ex: +// .Where(NotILike{"name": "sq%"}) +type NotILike Like + +func (nilk NotILike) ToSql() (sql string, args []interface{}, err error) { + return Like(nilk).toSql("NOT ILIKE") +} + +// Lt is syntactic sugar for use with Where/Having/Set methods. +// Ex: +// .Where(Lt{"id": 1}) +type Lt map[string]interface{} + +func (lt Lt) toSql(opposite, orEq bool) (sql string, args []interface{}, err error) { + var ( + exprs []string + opr = "<" + ) + + if opposite { + opr = ">" + } + + if orEq { + opr = fmt.Sprintf("%s%s", opr, "=") + } + + sortedKeys := getSortedKeys(lt) + for _, key := range sortedKeys { + var expr string + val := lt[key] + + switch v := val.(type) { + case driver.Valuer: + if val, err = v.Value(); err != nil { + return + } + } + + if val == nil { + err = fmt.Errorf("cannot use null with less than or greater than operators") + return + } + if isListType(val) { + err = fmt.Errorf("cannot use array or slice with less than or greater than operators") + return + } + expr = fmt.Sprintf("%s %s ?", key, opr) + args = append(args, val) + + exprs = append(exprs, expr) + } + sql = strings.Join(exprs, " AND ") + return +} + +func (lt Lt) ToSql() (sql string, args []interface{}, err error) { + return lt.toSql(false, false) +} + +// LtOrEq is syntactic sugar for use with Where/Having/Set methods. +// Ex: +// .Where(LtOrEq{"id": 1}) == "id <= 1" +type LtOrEq Lt + +func (ltOrEq LtOrEq) ToSql() (sql string, args []interface{}, err error) { + return Lt(ltOrEq).toSql(false, true) +} + +// Gt is syntactic sugar for use with Where/Having/Set methods. +// Ex: +// .Where(Gt{"id": 1}) == "id > 1" +type Gt Lt + +func (gt Gt) ToSql() (sql string, args []interface{}, err error) { + return Lt(gt).toSql(true, false) +} + +// GtOrEq is syntactic sugar for use with Where/Having/Set methods. +// Ex: +// .Where(GtOrEq{"id": 1}) == "id >= 1" +type GtOrEq Lt + +func (gtOrEq GtOrEq) ToSql() (sql string, args []interface{}, err error) { + return Lt(gtOrEq).toSql(true, true) +} + +type conj []Sqlizer + +func (c conj) join(sep, defaultExpr string) (sql string, args []interface{}, err error) { + if len(c) == 0 { + return defaultExpr, []interface{}{}, nil + } + var sqlParts []string + for _, sqlizer := range c { + partSQL, partArgs, err := nestedToSql(sqlizer) + if err != nil { + return "", nil, err + } + if partSQL != "" { + sqlParts = append(sqlParts, partSQL) + args = append(args, partArgs...) + } + } + if len(sqlParts) > 0 { + sql = fmt.Sprintf("(%s)", strings.Join(sqlParts, sep)) + } + return +} + +// And conjunction Sqlizers +type And conj + +func (a And) ToSql() (string, []interface{}, error) { + return conj(a).join(" AND ", sqlTrue) +} + +// Or conjunction Sqlizers +type Or conj + +func (o Or) ToSql() (string, []interface{}, error) { + return conj(o).join(" OR ", sqlFalse) +} + +func getSortedKeys(exp map[string]interface{}) []string { + sortedKeys := make([]string, 0, len(exp)) + for k := range exp { + sortedKeys = append(sortedKeys, k) + } + sort.Strings(sortedKeys) + return sortedKeys +} + +func isListType(val interface{}) bool { + if driver.IsValue(val) { + return false + } + valVal := reflect.ValueOf(val) + return valVal.Kind() == reflect.Array || valVal.Kind() == reflect.Slice +} diff --git a/vendor/github.com/Masterminds/squirrel/insert.go b/vendor/github.com/Masterminds/squirrel/insert.go new file mode 100644 index 00000000..c23a5793 --- /dev/null +++ b/vendor/github.com/Masterminds/squirrel/insert.go @@ -0,0 +1,298 @@ +package squirrel + +import ( + "bytes" + "database/sql" + "errors" + "fmt" + "io" + "sort" + "strings" + + "github.com/lann/builder" +) + +type insertData struct { + PlaceholderFormat PlaceholderFormat + RunWith BaseRunner + Prefixes []Sqlizer + StatementKeyword string + Options []string + Into string + Columns []string + Values [][]interface{} + Suffixes []Sqlizer + Select *SelectBuilder +} + +func (d *insertData) Exec() (sql.Result, error) { + if d.RunWith == nil { + return nil, RunnerNotSet + } + return ExecWith(d.RunWith, d) +} + +func (d *insertData) Query() (*sql.Rows, error) { + if d.RunWith == nil { + return nil, RunnerNotSet + } + return QueryWith(d.RunWith, d) +} + +func (d *insertData) QueryRow() RowScanner { + if d.RunWith == nil { + return &Row{err: RunnerNotSet} + } + queryRower, ok := d.RunWith.(QueryRower) + if !ok { + return &Row{err: RunnerNotQueryRunner} + } + return QueryRowWith(queryRower, d) +} + +func (d *insertData) ToSql() (sqlStr string, args []interface{}, err error) { + if len(d.Into) == 0 { + err = errors.New("insert statements must specify a table") + return + } + if len(d.Values) == 0 && d.Select == nil { + err = errors.New("insert statements must have at least one set of values or select clause") + return + } + + sql := &bytes.Buffer{} + + if len(d.Prefixes) > 0 { + args, err = appendToSql(d.Prefixes, sql, " ", args) + if err != nil { + return + } + + sql.WriteString(" ") + } + + if d.StatementKeyword == "" { + sql.WriteString("INSERT ") + } else { + sql.WriteString(d.StatementKeyword) + sql.WriteString(" ") + } + + if len(d.Options) > 0 { + sql.WriteString(strings.Join(d.Options, " ")) + sql.WriteString(" ") + } + + sql.WriteString("INTO ") + sql.WriteString(d.Into) + sql.WriteString(" ") + + if len(d.Columns) > 0 { + sql.WriteString("(") + sql.WriteString(strings.Join(d.Columns, ",")) + sql.WriteString(") ") + } + + if d.Select != nil { + args, err = d.appendSelectToSQL(sql, args) + } else { + args, err = d.appendValuesToSQL(sql, args) + } + if err != nil { + return + } + + if len(d.Suffixes) > 0 { + sql.WriteString(" ") + args, err = appendToSql(d.Suffixes, sql, " ", args) + if err != nil { + return + } + } + + sqlStr, err = d.PlaceholderFormat.ReplacePlaceholders(sql.String()) + return +} + +func (d *insertData) appendValuesToSQL(w io.Writer, args []interface{}) ([]interface{}, error) { + if len(d.Values) == 0 { + return args, errors.New("values for insert statements are not set") + } + + io.WriteString(w, "VALUES ") + + valuesStrings := make([]string, len(d.Values)) + for r, row := range d.Values { + valueStrings := make([]string, len(row)) + for v, val := range row { + if vs, ok := val.(Sqlizer); ok { + vsql, vargs, err := vs.ToSql() + if err != nil { + return nil, err + } + valueStrings[v] = vsql + args = append(args, vargs...) + } else { + valueStrings[v] = "?" + args = append(args, val) + } + } + valuesStrings[r] = fmt.Sprintf("(%s)", strings.Join(valueStrings, ",")) + } + + io.WriteString(w, strings.Join(valuesStrings, ",")) + + return args, nil +} + +func (d *insertData) appendSelectToSQL(w io.Writer, args []interface{}) ([]interface{}, error) { + if d.Select == nil { + return args, errors.New("select clause for insert statements are not set") + } + + selectClause, sArgs, err := d.Select.ToSql() + if err != nil { + return args, err + } + + io.WriteString(w, selectClause) + args = append(args, sArgs...) + + return args, nil +} + +// Builder + +// InsertBuilder builds SQL INSERT statements. +type InsertBuilder builder.Builder + +func init() { + builder.Register(InsertBuilder{}, insertData{}) +} + +// Format methods + +// PlaceholderFormat sets PlaceholderFormat (e.g. Question or Dollar) for the +// query. +func (b InsertBuilder) PlaceholderFormat(f PlaceholderFormat) InsertBuilder { + return builder.Set(b, "PlaceholderFormat", f).(InsertBuilder) +} + +// Runner methods + +// RunWith sets a Runner (like database/sql.DB) to be used with e.g. Exec. +func (b InsertBuilder) RunWith(runner BaseRunner) InsertBuilder { + return setRunWith(b, runner).(InsertBuilder) +} + +// Exec builds and Execs the query with the Runner set by RunWith. +func (b InsertBuilder) Exec() (sql.Result, error) { + data := builder.GetStruct(b).(insertData) + return data.Exec() +} + +// Query builds and Querys the query with the Runner set by RunWith. +func (b InsertBuilder) Query() (*sql.Rows, error) { + data := builder.GetStruct(b).(insertData) + return data.Query() +} + +// QueryRow builds and QueryRows the query with the Runner set by RunWith. +func (b InsertBuilder) QueryRow() RowScanner { + data := builder.GetStruct(b).(insertData) + return data.QueryRow() +} + +// Scan is a shortcut for QueryRow().Scan. +func (b InsertBuilder) Scan(dest ...interface{}) error { + return b.QueryRow().Scan(dest...) +} + +// SQL methods + +// ToSql builds the query into a SQL string and bound args. +func (b InsertBuilder) ToSql() (string, []interface{}, error) { + data := builder.GetStruct(b).(insertData) + return data.ToSql() +} + +// MustSql builds the query into a SQL string and bound args. +// It panics if there are any errors. +func (b InsertBuilder) MustSql() (string, []interface{}) { + sql, args, err := b.ToSql() + if err != nil { + panic(err) + } + return sql, args +} + +// Prefix adds an expression to the beginning of the query +func (b InsertBuilder) Prefix(sql string, args ...interface{}) InsertBuilder { + return b.PrefixExpr(Expr(sql, args...)) +} + +// PrefixExpr adds an expression to the very beginning of the query +func (b InsertBuilder) PrefixExpr(expr Sqlizer) InsertBuilder { + return builder.Append(b, "Prefixes", expr).(InsertBuilder) +} + +// Options adds keyword options before the INTO clause of the query. +func (b InsertBuilder) Options(options ...string) InsertBuilder { + return builder.Extend(b, "Options", options).(InsertBuilder) +} + +// Into sets the INTO clause of the query. +func (b InsertBuilder) Into(from string) InsertBuilder { + return builder.Set(b, "Into", from).(InsertBuilder) +} + +// Columns adds insert columns to the query. +func (b InsertBuilder) Columns(columns ...string) InsertBuilder { + return builder.Extend(b, "Columns", columns).(InsertBuilder) +} + +// Values adds a single row's values to the query. +func (b InsertBuilder) Values(values ...interface{}) InsertBuilder { + return builder.Append(b, "Values", values).(InsertBuilder) +} + +// Suffix adds an expression to the end of the query +func (b InsertBuilder) Suffix(sql string, args ...interface{}) InsertBuilder { + return b.SuffixExpr(Expr(sql, args...)) +} + +// SuffixExpr adds an expression to the end of the query +func (b InsertBuilder) SuffixExpr(expr Sqlizer) InsertBuilder { + return builder.Append(b, "Suffixes", expr).(InsertBuilder) +} + +// SetMap set columns and values for insert builder from a map of column name and value +// note that it will reset all previous columns and values was set if any +func (b InsertBuilder) SetMap(clauses map[string]interface{}) InsertBuilder { + // Keep the columns in a consistent order by sorting the column key string. + cols := make([]string, 0, len(clauses)) + for col := range clauses { + cols = append(cols, col) + } + sort.Strings(cols) + + vals := make([]interface{}, 0, len(clauses)) + for _, col := range cols { + vals = append(vals, clauses[col]) + } + + b = builder.Set(b, "Columns", cols).(InsertBuilder) + b = builder.Set(b, "Values", [][]interface{}{vals}).(InsertBuilder) + + return b +} + +// Select set Select clause for insert query +// If Values and Select are used, then Select has higher priority +func (b InsertBuilder) Select(sb SelectBuilder) InsertBuilder { + return builder.Set(b, "Select", &sb).(InsertBuilder) +} + +func (b InsertBuilder) statementKeyword(keyword string) InsertBuilder { + return builder.Set(b, "StatementKeyword", keyword).(InsertBuilder) +} diff --git a/vendor/github.com/Masterminds/squirrel/insert_ctx.go b/vendor/github.com/Masterminds/squirrel/insert_ctx.go new file mode 100644 index 00000000..4541c2fe --- /dev/null +++ b/vendor/github.com/Masterminds/squirrel/insert_ctx.go @@ -0,0 +1,69 @@ +// +build go1.8 + +package squirrel + +import ( + "context" + "database/sql" + + "github.com/lann/builder" +) + +func (d *insertData) ExecContext(ctx context.Context) (sql.Result, error) { + if d.RunWith == nil { + return nil, RunnerNotSet + } + ctxRunner, ok := d.RunWith.(ExecerContext) + if !ok { + return nil, NoContextSupport + } + return ExecContextWith(ctx, ctxRunner, d) +} + +func (d *insertData) QueryContext(ctx context.Context) (*sql.Rows, error) { + if d.RunWith == nil { + return nil, RunnerNotSet + } + ctxRunner, ok := d.RunWith.(QueryerContext) + if !ok { + return nil, NoContextSupport + } + return QueryContextWith(ctx, ctxRunner, d) +} + +func (d *insertData) QueryRowContext(ctx context.Context) RowScanner { + if d.RunWith == nil { + return &Row{err: RunnerNotSet} + } + queryRower, ok := d.RunWith.(QueryRowerContext) + if !ok { + if _, ok := d.RunWith.(QueryerContext); !ok { + return &Row{err: RunnerNotQueryRunner} + } + return &Row{err: NoContextSupport} + } + return QueryRowContextWith(ctx, queryRower, d) +} + +// ExecContext builds and ExecContexts the query with the Runner set by RunWith. +func (b InsertBuilder) ExecContext(ctx context.Context) (sql.Result, error) { + data := builder.GetStruct(b).(insertData) + return data.ExecContext(ctx) +} + +// QueryContext builds and QueryContexts the query with the Runner set by RunWith. +func (b InsertBuilder) QueryContext(ctx context.Context) (*sql.Rows, error) { + data := builder.GetStruct(b).(insertData) + return data.QueryContext(ctx) +} + +// QueryRowContext builds and QueryRowContexts the query with the Runner set by RunWith. +func (b InsertBuilder) QueryRowContext(ctx context.Context) RowScanner { + data := builder.GetStruct(b).(insertData) + return data.QueryRowContext(ctx) +} + +// ScanContext is a shortcut for QueryRowContext().Scan. +func (b InsertBuilder) ScanContext(ctx context.Context, dest ...interface{}) error { + return b.QueryRowContext(ctx).Scan(dest...) +} diff --git a/vendor/github.com/Masterminds/squirrel/part.go b/vendor/github.com/Masterminds/squirrel/part.go new file mode 100644 index 00000000..c58f68f1 --- /dev/null +++ b/vendor/github.com/Masterminds/squirrel/part.go @@ -0,0 +1,63 @@ +package squirrel + +import ( + "fmt" + "io" +) + +type part struct { + pred interface{} + args []interface{} +} + +func newPart(pred interface{}, args ...interface{}) Sqlizer { + return &part{pred, args} +} + +func (p part) ToSql() (sql string, args []interface{}, err error) { + switch pred := p.pred.(type) { + case nil: + // no-op + case Sqlizer: + sql, args, err = nestedToSql(pred) + case string: + sql = pred + args = p.args + default: + err = fmt.Errorf("expected string or Sqlizer, not %T", pred) + } + return +} + +func nestedToSql(s Sqlizer) (string, []interface{}, error) { + if raw, ok := s.(rawSqlizer); ok { + return raw.toSqlRaw() + } else { + return s.ToSql() + } +} + +func appendToSql(parts []Sqlizer, w io.Writer, sep string, args []interface{}) ([]interface{}, error) { + for i, p := range parts { + partSql, partArgs, err := nestedToSql(p) + if err != nil { + return nil, err + } else if len(partSql) == 0 { + continue + } + + if i > 0 { + _, err := io.WriteString(w, sep) + if err != nil { + return nil, err + } + } + + _, err = io.WriteString(w, partSql) + if err != nil { + return nil, err + } + args = append(args, partArgs...) + } + return args, nil +} diff --git a/vendor/github.com/Masterminds/squirrel/placeholder.go b/vendor/github.com/Masterminds/squirrel/placeholder.go new file mode 100644 index 00000000..8e97a6c6 --- /dev/null +++ b/vendor/github.com/Masterminds/squirrel/placeholder.go @@ -0,0 +1,114 @@ +package squirrel + +import ( + "bytes" + "fmt" + "strings" +) + +// PlaceholderFormat is the interface that wraps the ReplacePlaceholders method. +// +// ReplacePlaceholders takes a SQL statement and replaces each question mark +// placeholder with a (possibly different) SQL placeholder. +type PlaceholderFormat interface { + ReplacePlaceholders(sql string) (string, error) +} + +type placeholderDebugger interface { + debugPlaceholder() string +} + +var ( + // Question is a PlaceholderFormat instance that leaves placeholders as + // question marks. + Question = questionFormat{} + + // Dollar is a PlaceholderFormat instance that replaces placeholders with + // dollar-prefixed positional placeholders (e.g. $1, $2, $3). + Dollar = dollarFormat{} + + // Colon is a PlaceholderFormat instance that replaces placeholders with + // colon-prefixed positional placeholders (e.g. :1, :2, :3). + Colon = colonFormat{} + + // AtP is a PlaceholderFormat instance that replaces placeholders with + // "@p"-prefixed positional placeholders (e.g. @p1, @p2, @p3). + AtP = atpFormat{} +) + +type questionFormat struct{} + +func (questionFormat) ReplacePlaceholders(sql string) (string, error) { + return sql, nil +} + +func (questionFormat) debugPlaceholder() string { + return "?" +} + +type dollarFormat struct{} + +func (dollarFormat) ReplacePlaceholders(sql string) (string, error) { + return replacePositionalPlaceholders(sql, "$") +} + +func (dollarFormat) debugPlaceholder() string { + return "$" +} + +type colonFormat struct{} + +func (colonFormat) ReplacePlaceholders(sql string) (string, error) { + return replacePositionalPlaceholders(sql, ":") +} + +func (colonFormat) debugPlaceholder() string { + return ":" +} + +type atpFormat struct{} + +func (atpFormat) ReplacePlaceholders(sql string) (string, error) { + return replacePositionalPlaceholders(sql, "@p") +} + +func (atpFormat) debugPlaceholder() string { + return "@p" +} + +// Placeholders returns a string with count ? placeholders joined with commas. +func Placeholders(count int) string { + if count < 1 { + return "" + } + + return strings.Repeat(",?", count)[1:] +} + +func replacePositionalPlaceholders(sql, prefix string) (string, error) { + buf := &bytes.Buffer{} + i := 0 + for { + p := strings.Index(sql, "?") + if p == -1 { + break + } + + if len(sql[p:]) > 1 && sql[p:p+2] == "??" { // escape ?? => ? + buf.WriteString(sql[:p]) + buf.WriteString("?") + if len(sql[p:]) == 1 { + break + } + sql = sql[p+2:] + } else { + i++ + buf.WriteString(sql[:p]) + fmt.Fprintf(buf, "%s%d", prefix, i) + sql = sql[p+1:] + } + } + + buf.WriteString(sql) + return buf.String(), nil +} diff --git a/vendor/github.com/Masterminds/squirrel/row.go b/vendor/github.com/Masterminds/squirrel/row.go new file mode 100644 index 00000000..74ffda92 --- /dev/null +++ b/vendor/github.com/Masterminds/squirrel/row.go @@ -0,0 +1,22 @@ +package squirrel + +// RowScanner is the interface that wraps the Scan method. +// +// Scan behaves like database/sql.Row.Scan. +type RowScanner interface { + Scan(...interface{}) error +} + +// Row wraps database/sql.Row to let squirrel return new errors on Scan. +type Row struct { + RowScanner + err error +} + +// Scan returns Row.err or calls RowScanner.Scan. +func (r *Row) Scan(dest ...interface{}) error { + if r.err != nil { + return r.err + } + return r.RowScanner.Scan(dest...) +} diff --git a/vendor/github.com/Masterminds/squirrel/select.go b/vendor/github.com/Masterminds/squirrel/select.go new file mode 100644 index 00000000..d55ce4c7 --- /dev/null +++ b/vendor/github.com/Masterminds/squirrel/select.go @@ -0,0 +1,403 @@ +package squirrel + +import ( + "bytes" + "database/sql" + "fmt" + "strings" + + "github.com/lann/builder" +) + +type selectData struct { + PlaceholderFormat PlaceholderFormat + RunWith BaseRunner + Prefixes []Sqlizer + Options []string + Columns []Sqlizer + From Sqlizer + Joins []Sqlizer + WhereParts []Sqlizer + GroupBys []string + HavingParts []Sqlizer + OrderByParts []Sqlizer + Limit string + Offset string + Suffixes []Sqlizer +} + +func (d *selectData) Exec() (sql.Result, error) { + if d.RunWith == nil { + return nil, RunnerNotSet + } + return ExecWith(d.RunWith, d) +} + +func (d *selectData) Query() (*sql.Rows, error) { + if d.RunWith == nil { + return nil, RunnerNotSet + } + return QueryWith(d.RunWith, d) +} + +func (d *selectData) QueryRow() RowScanner { + if d.RunWith == nil { + return &Row{err: RunnerNotSet} + } + queryRower, ok := d.RunWith.(QueryRower) + if !ok { + return &Row{err: RunnerNotQueryRunner} + } + return QueryRowWith(queryRower, d) +} + +func (d *selectData) ToSql() (sqlStr string, args []interface{}, err error) { + sqlStr, args, err = d.toSqlRaw() + if err != nil { + return + } + + sqlStr, err = d.PlaceholderFormat.ReplacePlaceholders(sqlStr) + return +} + +func (d *selectData) toSqlRaw() (sqlStr string, args []interface{}, err error) { + if len(d.Columns) == 0 { + err = fmt.Errorf("select statements must have at least one result column") + return + } + + sql := &bytes.Buffer{} + + if len(d.Prefixes) > 0 { + args, err = appendToSql(d.Prefixes, sql, " ", args) + if err != nil { + return + } + + sql.WriteString(" ") + } + + sql.WriteString("SELECT ") + + if len(d.Options) > 0 { + sql.WriteString(strings.Join(d.Options, " ")) + sql.WriteString(" ") + } + + if len(d.Columns) > 0 { + args, err = appendToSql(d.Columns, sql, ", ", args) + if err != nil { + return + } + } + + if d.From != nil { + sql.WriteString(" FROM ") + args, err = appendToSql([]Sqlizer{d.From}, sql, "", args) + if err != nil { + return + } + } + + if len(d.Joins) > 0 { + sql.WriteString(" ") + args, err = appendToSql(d.Joins, sql, " ", args) + if err != nil { + return + } + } + + if len(d.WhereParts) > 0 { + sql.WriteString(" WHERE ") + args, err = appendToSql(d.WhereParts, sql, " AND ", args) + if err != nil { + return + } + } + + if len(d.GroupBys) > 0 { + sql.WriteString(" GROUP BY ") + sql.WriteString(strings.Join(d.GroupBys, ", ")) + } + + if len(d.HavingParts) > 0 { + sql.WriteString(" HAVING ") + args, err = appendToSql(d.HavingParts, sql, " AND ", args) + if err != nil { + return + } + } + + if len(d.OrderByParts) > 0 { + sql.WriteString(" ORDER BY ") + args, err = appendToSql(d.OrderByParts, sql, ", ", args) + if err != nil { + return + } + } + + if len(d.Limit) > 0 { + sql.WriteString(" LIMIT ") + sql.WriteString(d.Limit) + } + + if len(d.Offset) > 0 { + sql.WriteString(" OFFSET ") + sql.WriteString(d.Offset) + } + + if len(d.Suffixes) > 0 { + sql.WriteString(" ") + + args, err = appendToSql(d.Suffixes, sql, " ", args) + if err != nil { + return + } + } + + sqlStr = sql.String() + return +} + +// Builder + +// SelectBuilder builds SQL SELECT statements. +type SelectBuilder builder.Builder + +func init() { + builder.Register(SelectBuilder{}, selectData{}) +} + +// Format methods + +// PlaceholderFormat sets PlaceholderFormat (e.g. Question or Dollar) for the +// query. +func (b SelectBuilder) PlaceholderFormat(f PlaceholderFormat) SelectBuilder { + return builder.Set(b, "PlaceholderFormat", f).(SelectBuilder) +} + +// Runner methods + +// RunWith sets a Runner (like database/sql.DB) to be used with e.g. Exec. +// For most cases runner will be a database connection. +// +// Internally we use this to mock out the database connection for testing. +func (b SelectBuilder) RunWith(runner BaseRunner) SelectBuilder { + return setRunWith(b, runner).(SelectBuilder) +} + +// Exec builds and Execs the query with the Runner set by RunWith. +func (b SelectBuilder) Exec() (sql.Result, error) { + data := builder.GetStruct(b).(selectData) + return data.Exec() +} + +// Query builds and Querys the query with the Runner set by RunWith. +func (b SelectBuilder) Query() (*sql.Rows, error) { + data := builder.GetStruct(b).(selectData) + return data.Query() +} + +// QueryRow builds and QueryRows the query with the Runner set by RunWith. +func (b SelectBuilder) QueryRow() RowScanner { + data := builder.GetStruct(b).(selectData) + return data.QueryRow() +} + +// Scan is a shortcut for QueryRow().Scan. +func (b SelectBuilder) Scan(dest ...interface{}) error { + return b.QueryRow().Scan(dest...) +} + +// SQL methods + +// ToSql builds the query into a SQL string and bound args. +func (b SelectBuilder) ToSql() (string, []interface{}, error) { + data := builder.GetStruct(b).(selectData) + return data.ToSql() +} + +func (b SelectBuilder) toSqlRaw() (string, []interface{}, error) { + data := builder.GetStruct(b).(selectData) + return data.toSqlRaw() +} + +// MustSql builds the query into a SQL string and bound args. +// It panics if there are any errors. +func (b SelectBuilder) MustSql() (string, []interface{}) { + sql, args, err := b.ToSql() + if err != nil { + panic(err) + } + return sql, args +} + +// Prefix adds an expression to the beginning of the query +func (b SelectBuilder) Prefix(sql string, args ...interface{}) SelectBuilder { + return b.PrefixExpr(Expr(sql, args...)) +} + +// PrefixExpr adds an expression to the very beginning of the query +func (b SelectBuilder) PrefixExpr(expr Sqlizer) SelectBuilder { + return builder.Append(b, "Prefixes", expr).(SelectBuilder) +} + +// Distinct adds a DISTINCT clause to the query. +func (b SelectBuilder) Distinct() SelectBuilder { + return b.Options("DISTINCT") +} + +// Options adds select option to the query +func (b SelectBuilder) Options(options ...string) SelectBuilder { + return builder.Extend(b, "Options", options).(SelectBuilder) +} + +// Columns adds result columns to the query. +func (b SelectBuilder) Columns(columns ...string) SelectBuilder { + parts := make([]interface{}, 0, len(columns)) + for _, str := range columns { + parts = append(parts, newPart(str)) + } + return builder.Extend(b, "Columns", parts).(SelectBuilder) +} + +// RemoveColumns remove all columns from query. +// Must add a new column with Column or Columns methods, otherwise +// return a error. +func (b SelectBuilder) RemoveColumns() SelectBuilder { + return builder.Delete(b, "Columns").(SelectBuilder) +} + +// Column adds a result column to the query. +// Unlike Columns, Column accepts args which will be bound to placeholders in +// the columns string, for example: +// Column("IF(col IN ("+squirrel.Placeholders(3)+"), 1, 0) as col", 1, 2, 3) +func (b SelectBuilder) Column(column interface{}, args ...interface{}) SelectBuilder { + return builder.Append(b, "Columns", newPart(column, args...)).(SelectBuilder) +} + +// From sets the FROM clause of the query. +func (b SelectBuilder) From(from string) SelectBuilder { + return builder.Set(b, "From", newPart(from)).(SelectBuilder) +} + +// FromSelect sets a subquery into the FROM clause of the query. +func (b SelectBuilder) FromSelect(from SelectBuilder, alias string) SelectBuilder { + // Prevent misnumbered parameters in nested selects (#183). + from = from.PlaceholderFormat(Question) + return builder.Set(b, "From", Alias(from, alias)).(SelectBuilder) +} + +// JoinClause adds a join clause to the query. +func (b SelectBuilder) JoinClause(pred interface{}, args ...interface{}) SelectBuilder { + return builder.Append(b, "Joins", newPart(pred, args...)).(SelectBuilder) +} + +// Join adds a JOIN clause to the query. +func (b SelectBuilder) Join(join string, rest ...interface{}) SelectBuilder { + return b.JoinClause("JOIN "+join, rest...) +} + +// LeftJoin adds a LEFT JOIN clause to the query. +func (b SelectBuilder) LeftJoin(join string, rest ...interface{}) SelectBuilder { + return b.JoinClause("LEFT JOIN "+join, rest...) +} + +// RightJoin adds a RIGHT JOIN clause to the query. +func (b SelectBuilder) RightJoin(join string, rest ...interface{}) SelectBuilder { + return b.JoinClause("RIGHT JOIN "+join, rest...) +} + +// InnerJoin adds a INNER JOIN clause to the query. +func (b SelectBuilder) InnerJoin(join string, rest ...interface{}) SelectBuilder { + return b.JoinClause("INNER JOIN "+join, rest...) +} + +// CrossJoin adds a CROSS JOIN clause to the query. +func (b SelectBuilder) CrossJoin(join string, rest ...interface{}) SelectBuilder { + return b.JoinClause("CROSS JOIN "+join, rest...) +} + +// Where adds an expression to the WHERE clause of the query. +// +// Expressions are ANDed together in the generated SQL. +// +// Where accepts several types for its pred argument: +// +// nil OR "" - ignored. +// +// string - SQL expression. +// If the expression has SQL placeholders then a set of arguments must be passed +// as well, one for each placeholder. +// +// map[string]interface{} OR Eq - map of SQL expressions to values. Each key is +// transformed into an expression like " = ?", with the corresponding value +// bound to the placeholder. If the value is nil, the expression will be " +// IS NULL". If the value is an array or slice, the expression will be " IN +// (?,?,...)", with one placeholder for each item in the value. These expressions +// are ANDed together. +// +// Where will panic if pred isn't any of the above types. +func (b SelectBuilder) Where(pred interface{}, args ...interface{}) SelectBuilder { + if pred == nil || pred == "" { + return b + } + return builder.Append(b, "WhereParts", newWherePart(pred, args...)).(SelectBuilder) +} + +// GroupBy adds GROUP BY expressions to the query. +func (b SelectBuilder) GroupBy(groupBys ...string) SelectBuilder { + return builder.Extend(b, "GroupBys", groupBys).(SelectBuilder) +} + +// Having adds an expression to the HAVING clause of the query. +// +// See Where. +func (b SelectBuilder) Having(pred interface{}, rest ...interface{}) SelectBuilder { + return builder.Append(b, "HavingParts", newWherePart(pred, rest...)).(SelectBuilder) +} + +// OrderByClause adds ORDER BY clause to the query. +func (b SelectBuilder) OrderByClause(pred interface{}, args ...interface{}) SelectBuilder { + return builder.Append(b, "OrderByParts", newPart(pred, args...)).(SelectBuilder) +} + +// OrderBy adds ORDER BY expressions to the query. +func (b SelectBuilder) OrderBy(orderBys ...string) SelectBuilder { + for _, orderBy := range orderBys { + b = b.OrderByClause(orderBy) + } + + return b +} + +// Limit sets a LIMIT clause on the query. +func (b SelectBuilder) Limit(limit uint64) SelectBuilder { + return builder.Set(b, "Limit", fmt.Sprintf("%d", limit)).(SelectBuilder) +} + +// Limit ALL allows to access all records with limit +func (b SelectBuilder) RemoveLimit() SelectBuilder { + return builder.Delete(b, "Limit").(SelectBuilder) +} + +// Offset sets a OFFSET clause on the query. +func (b SelectBuilder) Offset(offset uint64) SelectBuilder { + return builder.Set(b, "Offset", fmt.Sprintf("%d", offset)).(SelectBuilder) +} + +// RemoveOffset removes OFFSET clause. +func (b SelectBuilder) RemoveOffset() SelectBuilder { + return builder.Delete(b, "Offset").(SelectBuilder) +} + +// Suffix adds an expression to the end of the query +func (b SelectBuilder) Suffix(sql string, args ...interface{}) SelectBuilder { + return b.SuffixExpr(Expr(sql, args...)) +} + +// SuffixExpr adds an expression to the end of the query +func (b SelectBuilder) SuffixExpr(expr Sqlizer) SelectBuilder { + return builder.Append(b, "Suffixes", expr).(SelectBuilder) +} diff --git a/vendor/github.com/Masterminds/squirrel/select_ctx.go b/vendor/github.com/Masterminds/squirrel/select_ctx.go new file mode 100644 index 00000000..4c42c13f --- /dev/null +++ b/vendor/github.com/Masterminds/squirrel/select_ctx.go @@ -0,0 +1,69 @@ +// +build go1.8 + +package squirrel + +import ( + "context" + "database/sql" + + "github.com/lann/builder" +) + +func (d *selectData) ExecContext(ctx context.Context) (sql.Result, error) { + if d.RunWith == nil { + return nil, RunnerNotSet + } + ctxRunner, ok := d.RunWith.(ExecerContext) + if !ok { + return nil, NoContextSupport + } + return ExecContextWith(ctx, ctxRunner, d) +} + +func (d *selectData) QueryContext(ctx context.Context) (*sql.Rows, error) { + if d.RunWith == nil { + return nil, RunnerNotSet + } + ctxRunner, ok := d.RunWith.(QueryerContext) + if !ok { + return nil, NoContextSupport + } + return QueryContextWith(ctx, ctxRunner, d) +} + +func (d *selectData) QueryRowContext(ctx context.Context) RowScanner { + if d.RunWith == nil { + return &Row{err: RunnerNotSet} + } + queryRower, ok := d.RunWith.(QueryRowerContext) + if !ok { + if _, ok := d.RunWith.(QueryerContext); !ok { + return &Row{err: RunnerNotQueryRunner} + } + return &Row{err: NoContextSupport} + } + return QueryRowContextWith(ctx, queryRower, d) +} + +// ExecContext builds and ExecContexts the query with the Runner set by RunWith. +func (b SelectBuilder) ExecContext(ctx context.Context) (sql.Result, error) { + data := builder.GetStruct(b).(selectData) + return data.ExecContext(ctx) +} + +// QueryContext builds and QueryContexts the query with the Runner set by RunWith. +func (b SelectBuilder) QueryContext(ctx context.Context) (*sql.Rows, error) { + data := builder.GetStruct(b).(selectData) + return data.QueryContext(ctx) +} + +// QueryRowContext builds and QueryRowContexts the query with the Runner set by RunWith. +func (b SelectBuilder) QueryRowContext(ctx context.Context) RowScanner { + data := builder.GetStruct(b).(selectData) + return data.QueryRowContext(ctx) +} + +// ScanContext is a shortcut for QueryRowContext().Scan. +func (b SelectBuilder) ScanContext(ctx context.Context, dest ...interface{}) error { + return b.QueryRowContext(ctx).Scan(dest...) +} diff --git a/vendor/github.com/Masterminds/squirrel/squirrel.go b/vendor/github.com/Masterminds/squirrel/squirrel.go new file mode 100644 index 00000000..46d456eb --- /dev/null +++ b/vendor/github.com/Masterminds/squirrel/squirrel.go @@ -0,0 +1,183 @@ +// Package squirrel provides a fluent SQL generator. +// +// See https://github.com/Masterminds/squirrel for examples. +package squirrel + +import ( + "bytes" + "database/sql" + "fmt" + "strings" + + "github.com/lann/builder" +) + +// Sqlizer is the interface that wraps the ToSql method. +// +// ToSql returns a SQL representation of the Sqlizer, along with a slice of args +// as passed to e.g. database/sql.Exec. It can also return an error. +type Sqlizer interface { + ToSql() (string, []interface{}, error) +} + +// rawSqlizer is expected to do what Sqlizer does, but without finalizing placeholders. +// This is useful for nested queries. +type rawSqlizer interface { + toSqlRaw() (string, []interface{}, error) +} + +// Execer is the interface that wraps the Exec method. +// +// Exec executes the given query as implemented by database/sql.Exec. +type Execer interface { + Exec(query string, args ...interface{}) (sql.Result, error) +} + +// Queryer is the interface that wraps the Query method. +// +// Query executes the given query as implemented by database/sql.Query. +type Queryer interface { + Query(query string, args ...interface{}) (*sql.Rows, error) +} + +// QueryRower is the interface that wraps the QueryRow method. +// +// QueryRow executes the given query as implemented by database/sql.QueryRow. +type QueryRower interface { + QueryRow(query string, args ...interface{}) RowScanner +} + +// BaseRunner groups the Execer and Queryer interfaces. +type BaseRunner interface { + Execer + Queryer +} + +// Runner groups the Execer, Queryer, and QueryRower interfaces. +type Runner interface { + Execer + Queryer + QueryRower +} + +// WrapStdSql wraps a type implementing the standard SQL interface with methods that +// squirrel expects. +func WrapStdSql(stdSql StdSql) Runner { + return &stdsqlRunner{stdSql} +} + +// StdSql encompasses the standard methods of the *sql.DB type, and other types that +// wrap these methods. +type StdSql interface { + Query(string, ...interface{}) (*sql.Rows, error) + QueryRow(string, ...interface{}) *sql.Row + Exec(string, ...interface{}) (sql.Result, error) +} + +type stdsqlRunner struct { + StdSql +} + +func (r *stdsqlRunner) QueryRow(query string, args ...interface{}) RowScanner { + return r.StdSql.QueryRow(query, args...) +} + +func setRunWith(b interface{}, runner BaseRunner) interface{} { + switch r := runner.(type) { + case StdSqlCtx: + runner = WrapStdSqlCtx(r) + case StdSql: + runner = WrapStdSql(r) + } + return builder.Set(b, "RunWith", runner) +} + +// RunnerNotSet is returned by methods that need a Runner if it isn't set. +var RunnerNotSet = fmt.Errorf("cannot run; no Runner set (RunWith)") + +// RunnerNotQueryRunner is returned by QueryRow if the RunWith value doesn't implement QueryRower. +var RunnerNotQueryRunner = fmt.Errorf("cannot QueryRow; Runner is not a QueryRower") + +// ExecWith Execs the SQL returned by s with db. +func ExecWith(db Execer, s Sqlizer) (res sql.Result, err error) { + query, args, err := s.ToSql() + if err != nil { + return + } + return db.Exec(query, args...) +} + +// QueryWith Querys the SQL returned by s with db. +func QueryWith(db Queryer, s Sqlizer) (rows *sql.Rows, err error) { + query, args, err := s.ToSql() + if err != nil { + return + } + return db.Query(query, args...) +} + +// QueryRowWith QueryRows the SQL returned by s with db. +func QueryRowWith(db QueryRower, s Sqlizer) RowScanner { + query, args, err := s.ToSql() + return &Row{RowScanner: db.QueryRow(query, args...), err: err} +} + +// DebugSqlizer calls ToSql on s and shows the approximate SQL to be executed +// +// If ToSql returns an error, the result of this method will look like: +// "[ToSql error: %s]" or "[DebugSqlizer error: %s]" +// +// IMPORTANT: As its name suggests, this function should only be used for +// debugging. While the string result *might* be valid SQL, this function does +// not try very hard to ensure it. Additionally, executing the output of this +// function with any untrusted user input is certainly insecure. +func DebugSqlizer(s Sqlizer) string { + sql, args, err := s.ToSql() + if err != nil { + return fmt.Sprintf("[ToSql error: %s]", err) + } + + var placeholder string + downCast, ok := s.(placeholderDebugger) + if !ok { + placeholder = "?" + } else { + placeholder = downCast.debugPlaceholder() + } + // TODO: dedupe this with placeholder.go + buf := &bytes.Buffer{} + i := 0 + for { + p := strings.Index(sql, placeholder) + if p == -1 { + break + } + if len(sql[p:]) > 1 && sql[p:p+2] == "??" { // escape ?? => ? + buf.WriteString(sql[:p]) + buf.WriteString("?") + if len(sql[p:]) == 1 { + break + } + sql = sql[p+2:] + } else { + if i+1 > len(args) { + return fmt.Sprintf( + "[DebugSqlizer error: too many placeholders in %#v for %d args]", + sql, len(args)) + } + buf.WriteString(sql[:p]) + fmt.Fprintf(buf, "'%v'", args[i]) + // advance our sql string "cursor" beyond the arg we placed + sql = sql[p+1:] + i++ + } + } + if i < len(args) { + return fmt.Sprintf( + "[DebugSqlizer error: not enough placeholders in %#v for %d args]", + sql, len(args)) + } + // "append" any remaning sql that won't need interpolating + buf.WriteString(sql) + return buf.String() +} diff --git a/vendor/github.com/Masterminds/squirrel/squirrel_ctx.go b/vendor/github.com/Masterminds/squirrel/squirrel_ctx.go new file mode 100644 index 00000000..c20148ad --- /dev/null +++ b/vendor/github.com/Masterminds/squirrel/squirrel_ctx.go @@ -0,0 +1,93 @@ +// +build go1.8 + +package squirrel + +import ( + "context" + "database/sql" + "errors" +) + +// NoContextSupport is returned if a db doesn't support Context. +var NoContextSupport = errors.New("DB does not support Context") + +// ExecerContext is the interface that wraps the ExecContext method. +// +// Exec executes the given query as implemented by database/sql.ExecContext. +type ExecerContext interface { + ExecContext(ctx context.Context, query string, args ...interface{}) (sql.Result, error) +} + +// QueryerContext is the interface that wraps the QueryContext method. +// +// QueryContext executes the given query as implemented by database/sql.QueryContext. +type QueryerContext interface { + QueryContext(ctx context.Context, query string, args ...interface{}) (*sql.Rows, error) +} + +// QueryRowerContext is the interface that wraps the QueryRowContext method. +// +// QueryRowContext executes the given query as implemented by database/sql.QueryRowContext. +type QueryRowerContext interface { + QueryRowContext(ctx context.Context, query string, args ...interface{}) RowScanner +} + +// RunnerContext groups the Runner interface, along with the Context versions of each of +// its methods +type RunnerContext interface { + Runner + QueryerContext + QueryRowerContext + ExecerContext +} + +// WrapStdSqlCtx wraps a type implementing the standard SQL interface plus the context +// versions of the methods with methods that squirrel expects. +func WrapStdSqlCtx(stdSqlCtx StdSqlCtx) RunnerContext { + return &stdsqlCtxRunner{stdSqlCtx} +} + +// StdSqlCtx encompasses the standard methods of the *sql.DB type, along with the Context +// versions of those methods, and other types that wrap these methods. +type StdSqlCtx interface { + StdSql + QueryContext(context.Context, string, ...interface{}) (*sql.Rows, error) + QueryRowContext(context.Context, string, ...interface{}) *sql.Row + ExecContext(context.Context, string, ...interface{}) (sql.Result, error) +} + +type stdsqlCtxRunner struct { + StdSqlCtx +} + +func (r *stdsqlCtxRunner) QueryRow(query string, args ...interface{}) RowScanner { + return r.StdSqlCtx.QueryRow(query, args...) +} + +func (r *stdsqlCtxRunner) QueryRowContext(ctx context.Context, query string, args ...interface{}) RowScanner { + return r.StdSqlCtx.QueryRowContext(ctx, query, args...) +} + +// ExecContextWith ExecContexts the SQL returned by s with db. +func ExecContextWith(ctx context.Context, db ExecerContext, s Sqlizer) (res sql.Result, err error) { + query, args, err := s.ToSql() + if err != nil { + return + } + return db.ExecContext(ctx, query, args...) +} + +// QueryContextWith QueryContexts the SQL returned by s with db. +func QueryContextWith(ctx context.Context, db QueryerContext, s Sqlizer) (rows *sql.Rows, err error) { + query, args, err := s.ToSql() + if err != nil { + return + } + return db.QueryContext(ctx, query, args...) +} + +// QueryRowContextWith QueryRowContexts the SQL returned by s with db. +func QueryRowContextWith(ctx context.Context, db QueryRowerContext, s Sqlizer) RowScanner { + query, args, err := s.ToSql() + return &Row{RowScanner: db.QueryRowContext(ctx, query, args...), err: err} +} diff --git a/vendor/github.com/Masterminds/squirrel/statement.go b/vendor/github.com/Masterminds/squirrel/statement.go new file mode 100644 index 00000000..9420c67f --- /dev/null +++ b/vendor/github.com/Masterminds/squirrel/statement.go @@ -0,0 +1,104 @@ +package squirrel + +import "github.com/lann/builder" + +// StatementBuilderType is the type of StatementBuilder. +type StatementBuilderType builder.Builder + +// Select returns a SelectBuilder for this StatementBuilderType. +func (b StatementBuilderType) Select(columns ...string) SelectBuilder { + return SelectBuilder(b).Columns(columns...) +} + +// Insert returns a InsertBuilder for this StatementBuilderType. +func (b StatementBuilderType) Insert(into string) InsertBuilder { + return InsertBuilder(b).Into(into) +} + +// Replace returns a InsertBuilder for this StatementBuilderType with the +// statement keyword set to "REPLACE". +func (b StatementBuilderType) Replace(into string) InsertBuilder { + return InsertBuilder(b).statementKeyword("REPLACE").Into(into) +} + +// Update returns a UpdateBuilder for this StatementBuilderType. +func (b StatementBuilderType) Update(table string) UpdateBuilder { + return UpdateBuilder(b).Table(table) +} + +// Delete returns a DeleteBuilder for this StatementBuilderType. +func (b StatementBuilderType) Delete(from string) DeleteBuilder { + return DeleteBuilder(b).From(from) +} + +// PlaceholderFormat sets the PlaceholderFormat field for any child builders. +func (b StatementBuilderType) PlaceholderFormat(f PlaceholderFormat) StatementBuilderType { + return builder.Set(b, "PlaceholderFormat", f).(StatementBuilderType) +} + +// RunWith sets the RunWith field for any child builders. +func (b StatementBuilderType) RunWith(runner BaseRunner) StatementBuilderType { + return setRunWith(b, runner).(StatementBuilderType) +} + +// Where adds WHERE expressions to the query. +// +// See SelectBuilder.Where for more information. +func (b StatementBuilderType) Where(pred interface{}, args ...interface{}) StatementBuilderType { + return builder.Append(b, "WhereParts", newWherePart(pred, args...)).(StatementBuilderType) +} + +// StatementBuilder is a parent builder for other builders, e.g. SelectBuilder. +var StatementBuilder = StatementBuilderType(builder.EmptyBuilder).PlaceholderFormat(Question) + +// Select returns a new SelectBuilder, optionally setting some result columns. +// +// See SelectBuilder.Columns. +func Select(columns ...string) SelectBuilder { + return StatementBuilder.Select(columns...) +} + +// Insert returns a new InsertBuilder with the given table name. +// +// See InsertBuilder.Into. +func Insert(into string) InsertBuilder { + return StatementBuilder.Insert(into) +} + +// Replace returns a new InsertBuilder with the statement keyword set to +// "REPLACE" and with the given table name. +// +// See InsertBuilder.Into. +func Replace(into string) InsertBuilder { + return StatementBuilder.Replace(into) +} + +// Update returns a new UpdateBuilder with the given table name. +// +// See UpdateBuilder.Table. +func Update(table string) UpdateBuilder { + return StatementBuilder.Update(table) +} + +// Delete returns a new DeleteBuilder with the given table name. +// +// See DeleteBuilder.Table. +func Delete(from string) DeleteBuilder { + return StatementBuilder.Delete(from) +} + +// Case returns a new CaseBuilder +// "what" represents case value +func Case(what ...interface{}) CaseBuilder { + b := CaseBuilder(builder.EmptyBuilder) + + switch len(what) { + case 0: + case 1: + b = b.what(what[0]) + default: + b = b.what(newPart(what[0], what[1:]...)) + + } + return b +} diff --git a/vendor/github.com/Masterminds/squirrel/stmtcacher.go b/vendor/github.com/Masterminds/squirrel/stmtcacher.go new file mode 100644 index 00000000..5bf267a1 --- /dev/null +++ b/vendor/github.com/Masterminds/squirrel/stmtcacher.go @@ -0,0 +1,121 @@ +package squirrel + +import ( + "database/sql" + "fmt" + "sync" +) + +// Prepareer is the interface that wraps the Prepare method. +// +// Prepare executes the given query as implemented by database/sql.Prepare. +type Preparer interface { + Prepare(query string) (*sql.Stmt, error) +} + +// DBProxy groups the Execer, Queryer, QueryRower, and Preparer interfaces. +type DBProxy interface { + Execer + Queryer + QueryRower + Preparer +} + +// NOTE: NewStmtCache is defined in stmtcacher_ctx.go (Go >= 1.8) or stmtcacher_noctx.go (Go < 1.8). + +// StmtCache wraps and delegates down to a Preparer type +// +// It also automatically prepares all statements sent to the underlying Preparer calls +// for Exec, Query and QueryRow and caches the returns *sql.Stmt using the provided +// query as the key. So that it can be automatically re-used. +type StmtCache struct { + prep Preparer + cache map[string]*sql.Stmt + mu sync.Mutex +} + +// Prepare delegates down to the underlying Preparer and caches the result +// using the provided query as a key +func (sc *StmtCache) Prepare(query string) (*sql.Stmt, error) { + sc.mu.Lock() + defer sc.mu.Unlock() + + stmt, ok := sc.cache[query] + if ok { + return stmt, nil + } + stmt, err := sc.prep.Prepare(query) + if err == nil { + sc.cache[query] = stmt + } + return stmt, err +} + +// Exec delegates down to the underlying Preparer using a prepared statement +func (sc *StmtCache) Exec(query string, args ...interface{}) (res sql.Result, err error) { + stmt, err := sc.Prepare(query) + if err != nil { + return + } + return stmt.Exec(args...) +} + +// Query delegates down to the underlying Preparer using a prepared statement +func (sc *StmtCache) Query(query string, args ...interface{}) (rows *sql.Rows, err error) { + stmt, err := sc.Prepare(query) + if err != nil { + return + } + return stmt.Query(args...) +} + +// QueryRow delegates down to the underlying Preparer using a prepared statement +func (sc *StmtCache) QueryRow(query string, args ...interface{}) RowScanner { + stmt, err := sc.Prepare(query) + if err != nil { + return &Row{err: err} + } + return stmt.QueryRow(args...) +} + +// Clear removes and closes all the currently cached prepared statements +func (sc *StmtCache) Clear() (err error) { + sc.mu.Lock() + defer sc.mu.Unlock() + + for key, stmt := range sc.cache { + delete(sc.cache, key) + + if stmt == nil { + continue + } + + if cerr := stmt.Close(); cerr != nil { + err = cerr + } + } + + if err != nil { + return fmt.Errorf("one or more Stmt.Close failed; last error: %v", err) + } + + return +} + +type DBProxyBeginner interface { + DBProxy + Begin() (*sql.Tx, error) +} + +type stmtCacheProxy struct { + DBProxy + db *sql.DB +} + +func NewStmtCacheProxy(db *sql.DB) DBProxyBeginner { + return &stmtCacheProxy{DBProxy: NewStmtCache(db), db: db} +} + +func (sp *stmtCacheProxy) Begin() (*sql.Tx, error) { + return sp.db.Begin() +} diff --git a/vendor/github.com/Masterminds/squirrel/stmtcacher_ctx.go b/vendor/github.com/Masterminds/squirrel/stmtcacher_ctx.go new file mode 100644 index 00000000..53603cf4 --- /dev/null +++ b/vendor/github.com/Masterminds/squirrel/stmtcacher_ctx.go @@ -0,0 +1,86 @@ +// +build go1.8 + +package squirrel + +import ( + "context" + "database/sql" +) + +// PrepareerContext is the interface that wraps the Prepare and PrepareContext methods. +// +// Prepare executes the given query as implemented by database/sql.Prepare. +// PrepareContext executes the given query as implemented by database/sql.PrepareContext. +type PreparerContext interface { + Preparer + PrepareContext(ctx context.Context, query string) (*sql.Stmt, error) +} + +// DBProxyContext groups the Execer, Queryer, QueryRower and PreparerContext interfaces. +type DBProxyContext interface { + Execer + Queryer + QueryRower + PreparerContext +} + +// NewStmtCache returns a *StmtCache wrapping a PreparerContext that caches Prepared Stmts. +// +// Stmts are cached based on the string value of their queries. +func NewStmtCache(prep PreparerContext) *StmtCache { + return &StmtCache{prep: prep, cache: make(map[string]*sql.Stmt)} +} + +// NewStmtCacher is deprecated +// +// Use NewStmtCache instead +func NewStmtCacher(prep PreparerContext) DBProxyContext { + return NewStmtCache(prep) +} + +// PrepareContext delegates down to the underlying PreparerContext and caches the result +// using the provided query as a key +func (sc *StmtCache) PrepareContext(ctx context.Context, query string) (*sql.Stmt, error) { + ctxPrep, ok := sc.prep.(PreparerContext) + if !ok { + return nil, NoContextSupport + } + sc.mu.Lock() + defer sc.mu.Unlock() + stmt, ok := sc.cache[query] + if ok { + return stmt, nil + } + stmt, err := ctxPrep.PrepareContext(ctx, query) + if err == nil { + sc.cache[query] = stmt + } + return stmt, err +} + +// ExecContext delegates down to the underlying PreparerContext using a prepared statement +func (sc *StmtCache) ExecContext(ctx context.Context, query string, args ...interface{}) (res sql.Result, err error) { + stmt, err := sc.PrepareContext(ctx, query) + if err != nil { + return + } + return stmt.ExecContext(ctx, args...) +} + +// QueryContext delegates down to the underlying PreparerContext using a prepared statement +func (sc *StmtCache) QueryContext(ctx context.Context, query string, args ...interface{}) (rows *sql.Rows, err error) { + stmt, err := sc.PrepareContext(ctx, query) + if err != nil { + return + } + return stmt.QueryContext(ctx, args...) +} + +// QueryRowContext delegates down to the underlying PreparerContext using a prepared statement +func (sc *StmtCache) QueryRowContext(ctx context.Context, query string, args ...interface{}) RowScanner { + stmt, err := sc.PrepareContext(ctx, query) + if err != nil { + return &Row{err: err} + } + return stmt.QueryRowContext(ctx, args...) +} diff --git a/vendor/github.com/Masterminds/squirrel/stmtcacher_noctx.go b/vendor/github.com/Masterminds/squirrel/stmtcacher_noctx.go new file mode 100644 index 00000000..deac9677 --- /dev/null +++ b/vendor/github.com/Masterminds/squirrel/stmtcacher_noctx.go @@ -0,0 +1,21 @@ +// +build !go1.8 + +package squirrel + +import ( + "database/sql" +) + +// NewStmtCacher returns a DBProxy wrapping prep that caches Prepared Stmts. +// +// Stmts are cached based on the string value of their queries. +func NewStmtCache(prep Preparer) *StmtCache { + return &StmtCacher{prep: prep, cache: make(map[string]*sql.Stmt)} +} + +// NewStmtCacher is deprecated +// +// Use NewStmtCache instead +func NewStmtCacher(prep Preparer) DBProxy { + return NewStmtCache(prep) +} diff --git a/vendor/github.com/Masterminds/squirrel/update.go b/vendor/github.com/Masterminds/squirrel/update.go new file mode 100644 index 00000000..eb2a9c4d --- /dev/null +++ b/vendor/github.com/Masterminds/squirrel/update.go @@ -0,0 +1,288 @@ +package squirrel + +import ( + "bytes" + "database/sql" + "fmt" + "sort" + "strings" + + "github.com/lann/builder" +) + +type updateData struct { + PlaceholderFormat PlaceholderFormat + RunWith BaseRunner + Prefixes []Sqlizer + Table string + SetClauses []setClause + From Sqlizer + WhereParts []Sqlizer + OrderBys []string + Limit string + Offset string + Suffixes []Sqlizer +} + +type setClause struct { + column string + value interface{} +} + +func (d *updateData) Exec() (sql.Result, error) { + if d.RunWith == nil { + return nil, RunnerNotSet + } + return ExecWith(d.RunWith, d) +} + +func (d *updateData) Query() (*sql.Rows, error) { + if d.RunWith == nil { + return nil, RunnerNotSet + } + return QueryWith(d.RunWith, d) +} + +func (d *updateData) QueryRow() RowScanner { + if d.RunWith == nil { + return &Row{err: RunnerNotSet} + } + queryRower, ok := d.RunWith.(QueryRower) + if !ok { + return &Row{err: RunnerNotQueryRunner} + } + return QueryRowWith(queryRower, d) +} + +func (d *updateData) ToSql() (sqlStr string, args []interface{}, err error) { + if len(d.Table) == 0 { + err = fmt.Errorf("update statements must specify a table") + return + } + if len(d.SetClauses) == 0 { + err = fmt.Errorf("update statements must have at least one Set clause") + return + } + + sql := &bytes.Buffer{} + + if len(d.Prefixes) > 0 { + args, err = appendToSql(d.Prefixes, sql, " ", args) + if err != nil { + return + } + + sql.WriteString(" ") + } + + sql.WriteString("UPDATE ") + sql.WriteString(d.Table) + + sql.WriteString(" SET ") + setSqls := make([]string, len(d.SetClauses)) + for i, setClause := range d.SetClauses { + var valSql string + if vs, ok := setClause.value.(Sqlizer); ok { + vsql, vargs, err := vs.ToSql() + if err != nil { + return "", nil, err + } + if _, ok := vs.(SelectBuilder); ok { + valSql = fmt.Sprintf("(%s)", vsql) + } else { + valSql = vsql + } + args = append(args, vargs...) + } else { + valSql = "?" + args = append(args, setClause.value) + } + setSqls[i] = fmt.Sprintf("%s = %s", setClause.column, valSql) + } + sql.WriteString(strings.Join(setSqls, ", ")) + + if d.From != nil { + sql.WriteString(" FROM ") + args, err = appendToSql([]Sqlizer{d.From}, sql, "", args) + if err != nil { + return + } + } + + if len(d.WhereParts) > 0 { + sql.WriteString(" WHERE ") + args, err = appendToSql(d.WhereParts, sql, " AND ", args) + if err != nil { + return + } + } + + if len(d.OrderBys) > 0 { + sql.WriteString(" ORDER BY ") + sql.WriteString(strings.Join(d.OrderBys, ", ")) + } + + if len(d.Limit) > 0 { + sql.WriteString(" LIMIT ") + sql.WriteString(d.Limit) + } + + if len(d.Offset) > 0 { + sql.WriteString(" OFFSET ") + sql.WriteString(d.Offset) + } + + if len(d.Suffixes) > 0 { + sql.WriteString(" ") + args, err = appendToSql(d.Suffixes, sql, " ", args) + if err != nil { + return + } + } + + sqlStr, err = d.PlaceholderFormat.ReplacePlaceholders(sql.String()) + return +} + +// Builder + +// UpdateBuilder builds SQL UPDATE statements. +type UpdateBuilder builder.Builder + +func init() { + builder.Register(UpdateBuilder{}, updateData{}) +} + +// Format methods + +// PlaceholderFormat sets PlaceholderFormat (e.g. Question or Dollar) for the +// query. +func (b UpdateBuilder) PlaceholderFormat(f PlaceholderFormat) UpdateBuilder { + return builder.Set(b, "PlaceholderFormat", f).(UpdateBuilder) +} + +// Runner methods + +// RunWith sets a Runner (like database/sql.DB) to be used with e.g. Exec. +func (b UpdateBuilder) RunWith(runner BaseRunner) UpdateBuilder { + return setRunWith(b, runner).(UpdateBuilder) +} + +// Exec builds and Execs the query with the Runner set by RunWith. +func (b UpdateBuilder) Exec() (sql.Result, error) { + data := builder.GetStruct(b).(updateData) + return data.Exec() +} + +func (b UpdateBuilder) Query() (*sql.Rows, error) { + data := builder.GetStruct(b).(updateData) + return data.Query() +} + +func (b UpdateBuilder) QueryRow() RowScanner { + data := builder.GetStruct(b).(updateData) + return data.QueryRow() +} + +func (b UpdateBuilder) Scan(dest ...interface{}) error { + return b.QueryRow().Scan(dest...) +} + +// SQL methods + +// ToSql builds the query into a SQL string and bound args. +func (b UpdateBuilder) ToSql() (string, []interface{}, error) { + data := builder.GetStruct(b).(updateData) + return data.ToSql() +} + +// MustSql builds the query into a SQL string and bound args. +// It panics if there are any errors. +func (b UpdateBuilder) MustSql() (string, []interface{}) { + sql, args, err := b.ToSql() + if err != nil { + panic(err) + } + return sql, args +} + +// Prefix adds an expression to the beginning of the query +func (b UpdateBuilder) Prefix(sql string, args ...interface{}) UpdateBuilder { + return b.PrefixExpr(Expr(sql, args...)) +} + +// PrefixExpr adds an expression to the very beginning of the query +func (b UpdateBuilder) PrefixExpr(expr Sqlizer) UpdateBuilder { + return builder.Append(b, "Prefixes", expr).(UpdateBuilder) +} + +// Table sets the table to be updated. +func (b UpdateBuilder) Table(table string) UpdateBuilder { + return builder.Set(b, "Table", table).(UpdateBuilder) +} + +// Set adds SET clauses to the query. +func (b UpdateBuilder) Set(column string, value interface{}) UpdateBuilder { + return builder.Append(b, "SetClauses", setClause{column: column, value: value}).(UpdateBuilder) +} + +// SetMap is a convenience method which calls .Set for each key/value pair in clauses. +func (b UpdateBuilder) SetMap(clauses map[string]interface{}) UpdateBuilder { + keys := make([]string, len(clauses)) + i := 0 + for key := range clauses { + keys[i] = key + i++ + } + sort.Strings(keys) + for _, key := range keys { + val, _ := clauses[key] + b = b.Set(key, val) + } + return b +} + +// From adds FROM clause to the query +// FROM is valid construct in postgresql only. +func (b UpdateBuilder) From(from string) UpdateBuilder { + return builder.Set(b, "From", newPart(from)).(UpdateBuilder) +} + +// FromSelect sets a subquery into the FROM clause of the query. +func (b UpdateBuilder) FromSelect(from SelectBuilder, alias string) UpdateBuilder { + // Prevent misnumbered parameters in nested selects (#183). + from = from.PlaceholderFormat(Question) + return builder.Set(b, "From", Alias(from, alias)).(UpdateBuilder) +} + +// Where adds WHERE expressions to the query. +// +// See SelectBuilder.Where for more information. +func (b UpdateBuilder) Where(pred interface{}, args ...interface{}) UpdateBuilder { + return builder.Append(b, "WhereParts", newWherePart(pred, args...)).(UpdateBuilder) +} + +// OrderBy adds ORDER BY expressions to the query. +func (b UpdateBuilder) OrderBy(orderBys ...string) UpdateBuilder { + return builder.Extend(b, "OrderBys", orderBys).(UpdateBuilder) +} + +// Limit sets a LIMIT clause on the query. +func (b UpdateBuilder) Limit(limit uint64) UpdateBuilder { + return builder.Set(b, "Limit", fmt.Sprintf("%d", limit)).(UpdateBuilder) +} + +// Offset sets a OFFSET clause on the query. +func (b UpdateBuilder) Offset(offset uint64) UpdateBuilder { + return builder.Set(b, "Offset", fmt.Sprintf("%d", offset)).(UpdateBuilder) +} + +// Suffix adds an expression to the end of the query +func (b UpdateBuilder) Suffix(sql string, args ...interface{}) UpdateBuilder { + return b.SuffixExpr(Expr(sql, args...)) +} + +// SuffixExpr adds an expression to the end of the query +func (b UpdateBuilder) SuffixExpr(expr Sqlizer) UpdateBuilder { + return builder.Append(b, "Suffixes", expr).(UpdateBuilder) +} diff --git a/vendor/github.com/Masterminds/squirrel/update_ctx.go b/vendor/github.com/Masterminds/squirrel/update_ctx.go new file mode 100644 index 00000000..ad479f96 --- /dev/null +++ b/vendor/github.com/Masterminds/squirrel/update_ctx.go @@ -0,0 +1,69 @@ +// +build go1.8 + +package squirrel + +import ( + "context" + "database/sql" + + "github.com/lann/builder" +) + +func (d *updateData) ExecContext(ctx context.Context) (sql.Result, error) { + if d.RunWith == nil { + return nil, RunnerNotSet + } + ctxRunner, ok := d.RunWith.(ExecerContext) + if !ok { + return nil, NoContextSupport + } + return ExecContextWith(ctx, ctxRunner, d) +} + +func (d *updateData) QueryContext(ctx context.Context) (*sql.Rows, error) { + if d.RunWith == nil { + return nil, RunnerNotSet + } + ctxRunner, ok := d.RunWith.(QueryerContext) + if !ok { + return nil, NoContextSupport + } + return QueryContextWith(ctx, ctxRunner, d) +} + +func (d *updateData) QueryRowContext(ctx context.Context) RowScanner { + if d.RunWith == nil { + return &Row{err: RunnerNotSet} + } + queryRower, ok := d.RunWith.(QueryRowerContext) + if !ok { + if _, ok := d.RunWith.(QueryerContext); !ok { + return &Row{err: RunnerNotQueryRunner} + } + return &Row{err: NoContextSupport} + } + return QueryRowContextWith(ctx, queryRower, d) +} + +// ExecContext builds and ExecContexts the query with the Runner set by RunWith. +func (b UpdateBuilder) ExecContext(ctx context.Context) (sql.Result, error) { + data := builder.GetStruct(b).(updateData) + return data.ExecContext(ctx) +} + +// QueryContext builds and QueryContexts the query with the Runner set by RunWith. +func (b UpdateBuilder) QueryContext(ctx context.Context) (*sql.Rows, error) { + data := builder.GetStruct(b).(updateData) + return data.QueryContext(ctx) +} + +// QueryRowContext builds and QueryRowContexts the query with the Runner set by RunWith. +func (b UpdateBuilder) QueryRowContext(ctx context.Context) RowScanner { + data := builder.GetStruct(b).(updateData) + return data.QueryRowContext(ctx) +} + +// ScanContext is a shortcut for QueryRowContext().Scan. +func (b UpdateBuilder) ScanContext(ctx context.Context, dest ...interface{}) error { + return b.QueryRowContext(ctx).Scan(dest...) +} diff --git a/vendor/github.com/Masterminds/squirrel/where.go b/vendor/github.com/Masterminds/squirrel/where.go new file mode 100644 index 00000000..976b63ac --- /dev/null +++ b/vendor/github.com/Masterminds/squirrel/where.go @@ -0,0 +1,30 @@ +package squirrel + +import ( + "fmt" +) + +type wherePart part + +func newWherePart(pred interface{}, args ...interface{}) Sqlizer { + return &wherePart{pred: pred, args: args} +} + +func (p wherePart) ToSql() (sql string, args []interface{}, err error) { + switch pred := p.pred.(type) { + case nil: + // no-op + case rawSqlizer: + return pred.toSqlRaw() + case Sqlizer: + return pred.ToSql() + case map[string]interface{}: + return Eq(pred).ToSql() + case string: + sql = pred + args = p.args + default: + err = fmt.Errorf("expected string-keyed map or string, not %T", pred) + } + return +} diff --git a/vendor/github.com/Masterminds/structable/.gitignore b/vendor/github.com/Masterminds/structable/.gitignore new file mode 100644 index 00000000..6a421742 --- /dev/null +++ b/vendor/github.com/Masterminds/structable/.gitignore @@ -0,0 +1,2 @@ +vendor +*.test diff --git a/vendor/github.com/Masterminds/structable/LICENSE.txt b/vendor/github.com/Masterminds/structable/LICENSE.txt new file mode 100644 index 00000000..7810e84c --- /dev/null +++ b/vendor/github.com/Masterminds/structable/LICENSE.txt @@ -0,0 +1,21 @@ +Structable +The Masterminds +Copyright (C) 2014 Matt Butcher + +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. diff --git a/vendor/github.com/Masterminds/structable/Makefile b/vendor/github.com/Masterminds/structable/Makefile new file mode 100644 index 00000000..85eed724 --- /dev/null +++ b/vendor/github.com/Masterminds/structable/Makefile @@ -0,0 +1,7 @@ +.PHONY: test +test: + go test -v -tags sqlite . + +.PHONY: test-fast +test-fast: + go test -v . diff --git a/vendor/github.com/Masterminds/structable/README.md b/vendor/github.com/Masterminds/structable/README.md new file mode 100644 index 00000000..2fc565a8 --- /dev/null +++ b/vendor/github.com/Masterminds/structable/README.md @@ -0,0 +1,157 @@ +# Structable: Struct-Table Mapping for Go +[![Stability: +Sustained](https://masterminds.github.io/stability/sustained.svg)](https://masterminds.github.io/stability/sustained.html) + +**Warning:** This is the Structable 4 development branch. For a stable +release, use version 3.1.0. Structable development happens very slowly. + +This library provides basic struct-to-table mapping for Go. + +It is based on the [Squirrel](https://github.com/Masterminds/squirrel) library. + +## What It Does + +Structable maps a struct (`Record`) to a database table via a +`structable.Recorder`. It is intended to be used as a back-end tool for +building systems like Active Record mappers. + +It is designed to satisfy a CRUD-centered record management system, +filling the following contract: + +```go + type Recorder interface { + Bind(string, Record) Recorder // link struct to table + Interface() interface{} // Get the struct that has been linked + Insert() error // INSERT just one record + Update() error // UPDATE just one record + Delete() error // DELETE just one record + Exists() (bool, error) // Check for just one record + ExistsWhere(cond interface{}, args ...interface{}) (bool, error) + Load() error // SELECT just one record + LoadWhere(cond interface{}, args ...interface{}) error // Alternate Load() + } +``` + +Squirrel already provides the ability to perform more complicated +operations. + +## How To Install It + +The usual way... + +``` +$ glide get github.com/Masterminds/structable +$ # or... +$ go get github.com/Masterminds/structable +``` + +And import it via: + +``` +import "github.com/Masterminds/structable" +``` + +## How To Use It + +[![GoDoc](https://godoc.org/github.com/Masterminds/structable?status.png)](https://godoc.org/github.com/Masterminds/structable) + +Structable works by mapping a struct to columns in a database. + +To annotate a struct, you do something like this: + +```go + type Stool struct { + Id int `stbl:"id, PRIMARY_KEY, AUTO_INCREMENT"` + Legs int `stbl:"number_of_legs"` + Material string `stbl:"material"` + Ignored string // will not be stored. No tag. + } +``` + +To manage instances of this struct, you do something like this: + +```go + stool := new(Stool) + stool.Material = "Wood" + db := getDb() // Get a sql.Db. You're on the hook to do this part. + + // Create a new structable.Recorder and tell it to + // bind the given struct as a row in the given table. + r := structable.New(db, "mysql").Bind("test_table", stool) + + // This will insert the stool into the test_table. + err := r.Insert() +``` + +And of course you have `Load()`, `Update()`, `Delete()` and so on. + +The target use case for Structable is to use it as a backend for an +Active Record pattern. An example of this can be found in the +`structable_test.go` file + +Most of Structable focuses on individual objects, but there are helpers +for listing objects: + +```go +// Get a list of things that have the same type as object. +stool := new(Stool) +items, err := structable.List(stool, offset, limit) + +// Customize a list of things that have the same type as object. +fn = func(object structable.Describer, sql squirrel.SelectBuilder) (squirrel.SelectBuilder, error) { + return sql.Limit(10), nil +} +items, err := structable.ListWhere(stool, fn) +``` + +For example, here is a function that uses `ListWhere` to get collection +of definitions from a table described in a struct named `Table`: + +```go +func (s *SchemaInfo) Tables() ([]*Table, error) { + + // Bind a new recorder. We use an empty object just to get the field + // data for that struct. + t := &Table{} + st := structable.New(s.Queryer, s.Driver).Bind(t.TableName(), t) + + // We want to return no more than 10 of these. + fn := func(d structable.Describer, q squirrel.SelectBuilder) (squirrel.SelectBuilder, error) { + return q.Limit(10), nil + } + + // Fetch a list of Table structs. + items, err := structable.ListWhere(st, fn) + if err != nil { + return []*Table{}, err + } + + // Because we get back a []Recorder, we need to get the original data + // back out. We have to manually convert it back to its real type. + tables := make([]*Table, len(items)) + for i, item := range items { + tables[i] = item.Interface().(*Table) + } + return tables, nil +} +``` + +### Tested On + +- MySQL (5.5) +- PostgreSQL (9.3, 9.4, 9.6) +- SQLite 3 + +## What It Does Not Do + +It does not... + +* Create or manage schemas. +* Guess or enforce table or column names. (You have to tell it how to + map.) +* Provide relational mapping. +* Handle bulk operations (use Squirrel for that) + +## LICENSE + +This software is licensed under an MIT-style license. See LICENSE.txt diff --git a/vendor/github.com/Masterminds/structable/glide.lock b/vendor/github.com/Masterminds/structable/glide.lock new file mode 100644 index 00000000..d4433167 --- /dev/null +++ b/vendor/github.com/Masterminds/structable/glide.lock @@ -0,0 +1,18 @@ +hash: 33914218da2ad50586a54a84aa0f1d94be0f335ca84e9e8ae2ef7719818a3d02 +updated: 2017-01-03T22:16:30.285599458-07:00 +imports: +- name: github.com/codegangsta/cli + version: 0bdeddeeb0f650497d603c4ad7b20cfe685682f6 +- name: github.com/lann/builder + version: f22ce00fd9394014049dad11c244859432bd6820 +- name: github.com/lann/ps + version: 62de8c46ede02a7675c4c79c84883eb164cb71e3 +- name: github.com/lib/pq + version: 8df6253d1317616f36b0c3740eb30c239a7372cb + subpackages: + - oid +- name: github.com/Masterminds/squirrel + version: 20f192218cf52a73397fa2df45bdda720f3e47c8 +- name: github.com/mattn/go-sqlite3 + version: 6f2749a3ca9b233ffb8749ef9684f7f4d88cee7a +devImports: [] diff --git a/vendor/github.com/Masterminds/structable/glide.yaml b/vendor/github.com/Masterminds/structable/glide.yaml new file mode 100644 index 00000000..1ad475e4 --- /dev/null +++ b/vendor/github.com/Masterminds/structable/glide.yaml @@ -0,0 +1,7 @@ +package: github.com/Masterminds/structable +import: + - package: github.com/Masterminds/squirrel + #- package: github.com/lann/builder + #- package: github.com/lann/ps + - package: github.com/lib/pq + - package: github.com/mattn/go-sqlite3 diff --git a/vendor/github.com/Masterminds/structable/structable.go b/vendor/github.com/Masterminds/structable/structable.go new file mode 100644 index 00000000..55b25874 --- /dev/null +++ b/vendor/github.com/Masterminds/structable/structable.go @@ -0,0 +1,768 @@ +/* Structable is a struct-to-table mapper for databases. + +Structable makes a loose distinction between a Record (a description of the +data to be stored) and a Recorder (the thing that does the storing). A +Record is a simple annotated struct that describes the properties of an +object. + +Structable provides the Recorder (an interface usually backed by a *DbRecorder). +The Recorder is capable of doing the following: + + - Bind: Attach the Recorder to a Record + - Load: Load a Record from a database + - Insert: Create a new Record + - Update: Change one or more fields on a Record + - Delete: Destroy a record in the database + - Has: Determine whether a given Record exists in a database + - LoadWhere: Load a record where certain conditions obtain. + +Structable is pragmatic in the sense that it allows ActiveRecord-like extension +of the Record object to allow business logic. A Record does not *have* to be +a simple data-only struct. It can have methods -- even methods that operate +on the database. + +Importantly, Structable does not do any relation management. There is no +magic to convert structs, arrays, or maps to references to other tables. +(If you want that, you may prefer GORM or GORP.) The preferred method of +handling relations is to attach additional methods to the Record struct. + +Structable uses Squirrel for statement building, and you may also use +Squirrel for working with your data. + +Basic Usage + +The following example is taken from the `example/users.go` file. + + + package main + + import ( + "github.com/Masterminds/squirrel" + "github.com/Masterminds/structable" + _ "github.com/lib/pq" + + "database/sql" + "fmt" + ) + + // This is our struct. Notice that we make this a structable.Recorder. + type User struct { + structable.Recorder + builder squirrel.StatementBuilderType + + Id int `stbl:"id,PRIMARY_KEY,SERIAL"` + Name string `stbl:"name"` + Email string `stbl:"email"` + } + + // NewUser creates a new Structable wrapper for a user. + // + // Of particular importance, watch how we intialize the Recorder. + func NewUser(db squirrel.DBProxyBeginner, dbFlavor string) *User { + u := new(User) + u.Recorder = structable.New(db, dbFlavor).Bind(UserTable, u) + return u + } + + func main() { + + // Boilerplate DB setup. + // First, we need to know the database driver. + driver := "postgres" + // Second, we need a database connection. + con, _ := sql.Open(driver, "dbname=structable_test sslmode=disable") + // Third, we wrap in a prepared statement cache for better performance. + cache := squirrel.NewStmtCacheProxy(con) + + // Create an empty new user and give it some properties. + user := NewUser(cache, driver) + user.Name = "Matt" + user.Email = "matt@example.com" + + // Insert this as a new record. + if err := user.Insert(); err != nil { + panic(err.Error()) + } + fmt.Printf("Initial insert has ID %d, name %s, and email %s\n", user.Id, user.Name, user.Email) + + // Now create another empty User and set the user's Name. + again := NewUser(cache, driver) + again.Id = user.Id + + // Load a duplicate copy of our user. This loads by the value of + // again.Id + again.Load() + + again.Email = "technosophos@example.com" + if err := again.Update(); err != nil { + panic(err.Error()) + } + fmt.Printf("Updated user has ID %d and email %s\n", again.Id, again.Email) + + // Delete using the built-in Deleter. (delete by Id.) + if err := again.Delete(); err != nil { + panic(err.Error()) + } + fmt.Printf("Deleted user %d\n", again.Id) + } + +The above pattern closely binds the Recorder to the Record. Essentially, in +this usage Structable works like an ActiveRecord. + +It is also possible to emulate a DAO-type model and use the Recorder as a data +access object and the Record as the data description object. An example of this +method can be found in the `example/fence.go` code. + +The Stbl Tag + +The `stbl` tag is of the form: + + stbl:"field_name [,PRIMARY_KEY[,AUTO_INCREMENT]]" + +The field name is passed verbatim to the database. So `fieldName` will go to the database as `fieldName`. +Structable is not at all opinionated about how you name your tables or fields. Some databases are, though, so +you may need to be careful about your own naming conventions. + +`PRIMARY_KEY` tells Structable that this field is (one of the pieces of) the primary key. Aliases: 'PRIMARY KEY' + +`AUTO_INCREMENT` tells Structable that this field is created by the database, and should never +be assigned during an Insert(). Aliases: SERIAL, AUTO INCREMENT + +Limitations + +Things Structable doesn't do (by design) + + - Guess table or column names. You must specify these. + - Handle relations between tables. + - Manage the schema. + - Transform complex struct fields into simple ones (that is, serialize fields). + +However, Squirrel can ease many of these tasks. + +*/ +package structable + +import ( + "fmt" + "reflect" + "strings" + + "github.com/Masterminds/squirrel" +) + +// 'stbl' is the main tag used for annotating Structable Records. +const StructableTag = "stbl" + +/* Record describes a struct that can be stored. + +Example: + + type Stool struct { + Id int `stbl:"id PRIMARY_KEY AUTO_INCREMENT"` + Legs int `stbl:"number_of_legs"` + Material string `stbl:"material"` + Ignored string // will not be stored. + } + +The above links the Stool record to a database table that has a primary +key (with auto-incrementing values) called 'id', an int field named +'number_of_legs', and a 'material' field that is a VARCHAR or TEXT (depending +on the database implementation). + +*/ +type Record interface{} + +// Internal representation of a field on a database table, and its +// relation to a struct field. +type field struct { + // name = Struct field name + // column = table column name + name, column string + // Is a primary key + isKey bool + // Is an auto increment + isAuto bool +} + +// A Recorder is responsible for managing the persistence of a Record. +// A Recorder is bound to a struct, which it then examines for fields +// that should be stored in the database. From that point on, a recorder +// can manage the persistent lifecycle of the record. +type Recorder interface { + // Bind this Recorder to a table and to a Record. + // + // The table name is used verbatim. DO NOT TRUST USER-SUPPLIED VALUES. + // + // The struct is examined for tags, and those tags are parsed and used to determine + // details about each field. + Bind(string, Record) Recorder + + // Interface provides a way of fetching the record from the Recorder. + // + // A record is bound to a Recorder via Bind, and retrieved from a Recorder + // via Interface(). + // + // This is conceptually similar to reflect.Value.Interface(). + Interface() interface{} + + Loader + Haecceity + Saver + Describer + + // This returns the column names used for the primary key. + //Key() []string +} + +type Loader interface { + // Loads the entire Record using the value of the PRIMARY_KEY(s) + // This will only fetch columns that are mapped on the bound Record. But you can think of it + // as doing something like this: + // + // SELECT * FROM bound_table WHERE id=? LIMIT 1 + // + // And then mapping the result to the currently bound Record. + Load() error + // Load by a WHERE-like clause. See Squirrel's Where(pred, args) + LoadWhere(interface{}, ...interface{}) error +} + +type Saver interface { + // Insert inserts the bound Record into the bound table. + Insert() error + + // Update updates all of the fields on the bound Record based on the PRIMARY_KEY fields. + // + // Essentially, it does something like this: + // UPDATE bound_table SET every=?, field=?, but=?, keys=? WHERE primary_key=? + Update() error + + // Deletes a Record based on its PRIMARY_KEY(s). + Delete() error +} + +// Haecceity indicates whether a thing exists. +// +// Actually, it is responsible for testing whether a thing exists, and is +// what we think it is. +type Haecceity interface { + // Exists verifies that a thing exists and is of this type. + // This uses the PRIMARY_KEY to verify that a record exists. + Exists() (bool, error) + // ExistsWhere verifies that a thing exists and is of the expected type. + // It takes a WHERE clause, and it needs to gaurantee that at least one + // record matches. It need not assure that *only* one item exists. + ExistsWhere(interface{}, ...interface{}) (bool, error) +} + +// Describer is a structable object that can describe its table structure. +type Describer interface { + // Columns gets the columns on this table. + Columns(bool) []string + // FieldReferences gets references to the fields on this object. + FieldReferences(bool) []interface{} + // WhereIds returns a map of ID fields to (current) ID values. + // + // This is useful to quickly generate where clauses. + WhereIds() map[string]interface{} + + // TableName returns the table name. + TableName() string + // Builder returns the builder + Builder() *squirrel.StatementBuilderType + // DB returns a DB-like handle. + DB() squirrel.DBProxyBeginner + + Driver() string + + Init(d squirrel.DBProxyBeginner, flavor string) +} + +// List returns a list of objects of the given kind. +// +// This runs a Select of the given kind, and returns the results. +func List(d Recorder, limit, offset uint64) ([]Recorder, error) { + fn := func(desc Describer, query squirrel.SelectBuilder) (squirrel.SelectBuilder, error) { + return query.Limit(limit).Offset(offset), nil + } + + return ListWhere(d, fn) +} + +// WhereFunc modifies a basic select operation to add conditions. +// +// Technically, conditions are not limited to adding where clauses. It will receive +// a select statement with the 'SELECT ... FROM tablename' portion composed already. +type WhereFunc func(desc Describer, query squirrel.SelectBuilder) (squirrel.SelectBuilder, error) + +// ListWhere takes a Recorder and a query modifying function and executes a query. +// +// The WhereFunc will be given a SELECT d.Colsumns() FROM d.TableName() statement, +// and may modify it. Note that while joining is supported, changing the column +// list will have unpredictable side effects. It is advised that joins be done +// using Squirrel instead. +// +// This will return a list of Recorder objects, where the underlying type +// of each matches the underlying type of the passed-in 'd' Recorder. +func ListWhere(d Recorder, fn WhereFunc) ([]Recorder, error) { + var tn string = d.TableName() + var cols []string = d.Columns(false) + buf := []Recorder{} + + // Base query + q := d.Builder().Select(cols...).From(tn) + + // Allow the fn to modify our query + var err error + q, err = fn(d, q) + if err != nil { + return buf, err + } + + rows, err := q.Query() + if err != nil || rows == nil { + return buf, err + } + defer rows.Close() + + v := reflect.Indirect(reflect.ValueOf(d)) + t := v.Type() + for rows.Next() { + nv := reflect.New(t) + + // Bind an empty base object. Basically, we fetch the object out of + // the DbRecorder, and then construct an empty one. + rec := reflect.New(reflect.Indirect(reflect.ValueOf(d.(*DbRecorder).record)).Type()) + nv.Interface().(Recorder).Bind(d.TableName(), rec.Interface()) + + s := nv.Interface().(Recorder) + s.Init(d.DB(), d.Driver()) + dest := s.FieldReferences(true) + rows.Scan(dest...) + buf = append(buf, s) + } + + return buf, rows.Err() +} + +// Implements the Recorder interface, and stores data in a DB. +type DbRecorder struct { + builder *squirrel.StatementBuilderType + db squirrel.DBProxyBeginner + table string + fields []*field + key []*field + record Record + flavor string +} + +func (d *DbRecorder) Interface() interface{} { + return d.record +} + +// New creates a new DbRecorder. +// +// (The squirrel.DBProxy interface defines the functions normal for a database connection +// or a prepared statement cache.) +func New(db squirrel.DBProxyBeginner, flavor string) *DbRecorder { + d := new(DbRecorder) + d.Init(db, flavor) + return d +} + +// Init initializes a DbRecorder +func (d *DbRecorder) Init(db squirrel.DBProxyBeginner, flavor string) { + b := squirrel.StatementBuilder.RunWith(db) + if flavor == "postgres" { + b = b.PlaceholderFormat(squirrel.Dollar) + } + + d.builder = &b + d.db = db + d.flavor = flavor +} + +// TableName returns the table name of this recorder. +func (s *DbRecorder) TableName() string { + return s.table +} + +// DB returns the database (DBProxyBeginner) for this recorder. +func (s *DbRecorder) DB() squirrel.DBProxyBeginner { + return s.db +} + +// Builder returns the statement builder for this recorder. +func (s *DbRecorder) Builder() *squirrel.StatementBuilderType { + return s.builder +} + +// Driver returns the string name of the driver. +func (s *DbRecorder) Driver() string { + return s.flavor +} + +// Bind binds a DbRecorder to a Record. +// +// This takes a given structable.Record and binds it to the recorder. That means +// that the recorder will track all changes to the Record. +// +// The table name tells the recorder which database table to link this record +// to. All storage operations will use that table. +func (s *DbRecorder) Bind(tableName string, ar Record) Recorder { + + // "To be is to be the value of a bound variable." - W. O. Quine + + // Get the table name + s.table = tableName + + // Get the fields + s.scanFields(ar) + + s.record = ar + + return Recorder(s) +} + +// Key gets the string names of the fields used as primary key. +func (s *DbRecorder) Key() []string { + key := make([]string, len(s.key)) + + for i, f := range s.key { + key[i] = f.column + } + + return key +} + +// Load selects the record from the database and loads the values into the bound Record. +// +// Load uses the table's PRIMARY KEY(s) as the sole criterion for matching a +// record. Essentially, it is akin to `SELECT * FROM table WHERE primary_key = ?`. +// +// This modifies the Record in-place. Other than the primary key fields, any +// other field will be overwritten by the value retrieved from the database. +func (s *DbRecorder) Load() error { + whereParts := s.WhereIds() + dest := s.FieldReferences(false) + + q := s.builder.Select(s.colList(false, false)...).From(s.table).Where(whereParts) + err := q.QueryRow().Scan(dest...) + + return err +} + +// LoadWhere loads an object based on a WHERE clause. +// +// This can be used to define alternate loaders: +// +// func (s *MyStructable) LoadUuid(uuid string) error { +// return s.LoadWhere("uuid = ?", uuid) +// } +// +// This functions similarly to Load, but with the notable difference that +// it loads the entire object (it does not skip keys used to do the lookup). +func (s *DbRecorder) LoadWhere(pred interface{}, args ...interface{}) error { + dest := s.FieldReferences(true) + + q := s.builder.Select(s.colList(true, true)...).From(s.table).Where(pred, args...) + err := q.QueryRow().Scan(dest...) + + return err +} + +// Exists returns `true` if and only if there is at least one record that matches the primary keys for this Record. +// +// If the primary key on the Record has no value, this will look for records with no value (or the default +// value). +func (s *DbRecorder) Exists() (bool, error) { + has := false + whereParts := s.WhereIds() + + q := s.builder.Select("COUNT(*) > 0").From(s.table).Where(whereParts) + err := q.QueryRow().Scan(&has) + + return has, err +} + +// ExistsWhere returns `true` if and only if there is at least one record that matches one (or multiple) conditions. +// +// Conditions are expressed in the form of predicates and expected values +// that together build a WHERE clause. See Squirrel's Where(pred, args) +func (s *DbRecorder) ExistsWhere(pred interface{}, args ...interface{}) (bool, error) { + has := false + + q := s.builder.Select("COUNT(*) > 0").From(s.table).Where(pred, args...) + err := q.QueryRow().Scan(&has) + + return has, err +} + +// Delete deletes the record from the underlying table. +// +// The fields on the present record will remain set, but not saved in the database. +func (s *DbRecorder) Delete() error { + wheres := s.WhereIds() + q := s.builder.Delete(s.table).Where(wheres) + _, err := q.Exec() + return err +} + +// Insert puts a new record into the database. +// +// This operation is particularly sensitive to DB differences in cases where AUTO_INCREMENT is set +// on a member of the Record. +func (s *DbRecorder) Insert() error { + switch s.flavor { + case "postgres": + return s.insertPg() + default: + return s.insertStd() + } +} + +// Insert and assume that LastInsertId() returns something. +func (s *DbRecorder) insertStd() error { + + cols, vals := s.colValLists(true, false) + + q := s.builder.Insert(s.table).Columns(cols...).Values(vals...) + + ret, err := q.Exec() + if err != nil { + return err + } + + for _, f := range s.fields { + if f.isAuto { + ar := reflect.Indirect(reflect.ValueOf(s.record)) + field := ar.FieldByName(f.name) + + id, err := ret.LastInsertId() + if err != nil { + return fmt.Errorf("Could not get last insert ID. Did you set the db flavor? %s", err) + } + + if !field.CanSet() { + return fmt.Errorf("Could not set %s to returned value", f.name) + } + field.SetInt(id) + } + } + + return err +} + +// insertPg runs a postgres-specific INSERT. Unlike the default (MySQL) driver, +// this actually refreshes ALL of the fields on the Record object. We do this +// because it is trivially easy in Postgres. +func (s *DbRecorder) insertPg() error { + cols, vals := s.colValLists(true, false) + dest := s.FieldReferences(true) + q := s.builder.Insert(s.table).Columns(cols...).Values(vals...). + Suffix("RETURNING " + strings.Join(s.colList(true, false), ",")) + + sql, vals, err := q.ToSql() + if err != nil { + return err + } + + return s.db.QueryRow(sql, vals...).Scan(dest...) +} + +// Update updates the values on an existing entry. +// +// This updates records where the Record's primary keys match the record in the +// database. Essentially, it runs `UPDATE table SET names=values WHERE id=?` +// +// If no entry is found, update will NOT create (INSERT) a new record. +func (s *DbRecorder) Update() error { + whereParts := s.WhereIds() + updates := s.updateFields() + q := s.builder.Update(s.table).SetMap(updates).Where(whereParts) + _, err := q.Exec() + return err +} + +// Columns returns the names of the columns on this table. +// +// If includeKeys is false, the columns that are marked as keys are omitted +// from the returned list. +func (s *DbRecorder) Columns(includeKeys bool) []string { + return s.colList(includeKeys, false) +} + +// colList gets a list of column names. If withKeys is false, columns that are +// designated as primary keys will not be returned in this list. +// If omitNil is true, a column represented by pointer will be omitted if this +// pointer is nil in current record +func (s *DbRecorder) colList(withKeys bool, omitNil bool) []string { + names := make([]string, 0, len(s.fields)) + + var ar reflect.Value + if omitNil { + ar = reflect.Indirect(reflect.ValueOf(s.record)) + } + + for _, field := range s.fields { + if !withKeys && field.isKey { + continue + } + if omitNil { + f := ar.FieldByName(field.name) + if f.Kind() == reflect.Ptr && f.IsNil() { + continue + } + } + names = append(names, field.column) + } + + return names +} + +// FieldReferences returns a list of references to fields on this object. +// +// If withKeys is true, fields that compose the primary key will also be +// included. Otherwise, only non-primary key fields will be included. +// +// This is used for processing SQL results: +// +// dest := s.FieldReferences(false) +// q := s.builder.Select(s.Columns(false)...).From(s.table) +// err := q.QueryRow().Scan(dest...) +func (s *DbRecorder) FieldReferences(withKeys bool) []interface{} { + refs := make([]interface{}, 0, len(s.fields)) + + ar := reflect.Indirect(reflect.ValueOf(s.record)) + for _, field := range s.fields { + if !withKeys && field.isKey { + continue + } + + fv := ar.FieldByName(field.name) + var ref reflect.Value + if fv.Kind() != reflect.Ptr { + // we want the address of field + ref = fv.Addr() + } else { + // we already have an address + ref = fv + if fv.IsNil() { + // allocate a new element of same type + fv.Set(reflect.New(fv.Type().Elem())) + } + } + refs = append(refs, ref.Interface()) + } + + return refs +} + +// colValLists returns 2 lists, the column names and values. +// If withKeys is false, columns and values of fields designated as primary keys +// will not be included in those lists. Also, if withAutos is false, the returned +// lists will not include fields designated as auto-increment. +func (s *DbRecorder) colValLists(withKeys, withAutos bool) (columns []string, values []interface{}) { + ar := reflect.Indirect(reflect.ValueOf(s.record)) + + for _, field := range s.fields { + + switch { + case !withKeys && field.isKey: + continue + case !withAutos && field.isAuto: + continue + } + + // Get the value of the field we are going to store. + f := ar.FieldByName(field.name) + var v reflect.Value + if f.Kind() == reflect.Ptr { + if f.IsNil() { + // nothing to store + continue + } + // no indirection: the field is already a reference to its value + v = f + } else { + // get the value pointed to by the field + v = reflect.Indirect(f) + } + + values = append(values, v.Interface()) + columns = append(columns, field.column) + } + + return +} + +// updateFields produces fields to go into SetMap for an update. +// This will NOT update PRIMARY_KEY fields. +func (s *DbRecorder) updateFields() map[string]interface{} { + update := map[string]interface{}{} + cols, vals := s.colValLists(false, true) + for i, col := range cols { + update[col] = vals[i] + } + return update +} + +// WhereIds gets a list of names and a list of values for all columns marked as primary +// keys. +func (s *DbRecorder) WhereIds() map[string]interface{} { + clause := make(map[string]interface{}, len(s.key)) + + ar := reflect.Indirect(reflect.ValueOf(s.record)) + + for _, f := range s.key { + clause[f.column] = ar.FieldByName(f.name).Interface() + } + + return clause +} + +// scanFields extracts the tags from all of the fields on a struct. +func (s *DbRecorder) scanFields(ar Record) { + v := reflect.Indirect(reflect.ValueOf(ar)) + t := v.Type() + count := t.NumField() + keys := make([]*field, 0, 2) + + for i := 0; i < count; i++ { + f := t.Field(i) + // Skip fields with no tag. + if len(f.Tag) == 0 { + continue + } + sqtag := f.Tag.Get("stbl") + if len(sqtag) == 0 { + continue + } + + parts := s.parseTag(f.Name, sqtag) + field := new(field) + field.name = f.Name + field.column = parts[0] + for _, part := range parts[1:] { + part = strings.TrimSpace(part) + switch part { + case "PRIMARY_KEY", "PRIMARY KEY": + field.isKey = true + keys = append(keys, field) + case "AUTO_INCREMENT", "SERIAL", "AUTO INCREMENT": + field.isAuto = true + } + } + s.fields = append(s.fields, field) + s.key = keys + } +} + +// parseTag parses the contents of a stbl tag. +func (s *DbRecorder) parseTag(fieldName, tag string) []string { + parts := strings.Split(tag, ",") + if len(parts) == 0 { + return []string{fieldName} + } + return parts +} diff --git a/vendor/github.com/Microsoft/go-winio/.gitattributes b/vendor/github.com/Microsoft/go-winio/.gitattributes new file mode 100644 index 00000000..94f480de --- /dev/null +++ b/vendor/github.com/Microsoft/go-winio/.gitattributes @@ -0,0 +1 @@ +* text=auto eol=lf \ No newline at end of file diff --git a/vendor/github.com/Microsoft/go-winio/.gitignore b/vendor/github.com/Microsoft/go-winio/.gitignore new file mode 100644 index 00000000..815e2066 --- /dev/null +++ b/vendor/github.com/Microsoft/go-winio/.gitignore @@ -0,0 +1,10 @@ +.vscode/ + +*.exe + +# testing +testdata + +# go workspaces +go.work +go.work.sum diff --git a/vendor/github.com/Microsoft/go-winio/.golangci.yml b/vendor/github.com/Microsoft/go-winio/.golangci.yml new file mode 100644 index 00000000..faedfe93 --- /dev/null +++ b/vendor/github.com/Microsoft/go-winio/.golangci.yml @@ -0,0 +1,147 @@ +linters: + enable: + # style + - containedctx # struct contains a context + - dupl # duplicate code + - errname # erorrs are named correctly + - nolintlint # "//nolint" directives are properly explained + - revive # golint replacement + - unconvert # unnecessary conversions + - wastedassign + + # bugs, performance, unused, etc ... + - contextcheck # function uses a non-inherited context + - errorlint # errors not wrapped for 1.13 + - exhaustive # check exhaustiveness of enum switch statements + - gofmt # files are gofmt'ed + - gosec # security + - nilerr # returns nil even with non-nil error + - thelper # test helpers without t.Helper() + - unparam # unused function params + +issues: + exclude-dirs: + - pkg/etw/sample + + exclude-rules: + # err is very often shadowed in nested scopes + - linters: + - govet + text: '^shadow: declaration of "err" shadows declaration' + + # ignore long lines for skip autogen directives + - linters: + - revive + text: "^line-length-limit: " + source: "^//(go:generate|sys) " + + #TODO: remove after upgrading to go1.18 + # ignore comment spacing for nolint and sys directives + - linters: + - revive + text: "^comment-spacings: no space between comment delimiter and comment text" + source: "//(cspell:|nolint:|sys |todo)" + + # not on go 1.18 yet, so no any + - linters: + - revive + text: "^use-any: since GO 1.18 'interface{}' can be replaced by 'any'" + + # allow unjustified ignores of error checks in defer statements + - linters: + - nolintlint + text: "^directive `//nolint:errcheck` should provide explanation" + source: '^\s*defer ' + + # allow unjustified ignores of error lints for io.EOF + - linters: + - nolintlint + text: "^directive `//nolint:errorlint` should provide explanation" + source: '[=|!]= io.EOF' + + +linters-settings: + exhaustive: + default-signifies-exhaustive: true + govet: + enable-all: true + disable: + # struct order is often for Win32 compat + # also, ignore pointer bytes/GC issues for now until performance becomes an issue + - fieldalignment + nolintlint: + require-explanation: true + require-specific: true + revive: + # revive is more configurable than static check, so likely the preferred alternative to static-check + # (once the perf issue is solved: https://github.com/golangci/golangci-lint/issues/2997) + enable-all-rules: + true + # https://github.com/mgechev/revive/blob/master/RULES_DESCRIPTIONS.md + rules: + # rules with required arguments + - name: argument-limit + disabled: true + - name: banned-characters + disabled: true + - name: cognitive-complexity + disabled: true + - name: cyclomatic + disabled: true + - name: file-header + disabled: true + - name: function-length + disabled: true + - name: function-result-limit + disabled: true + - name: max-public-structs + disabled: true + # geneally annoying rules + - name: add-constant # complains about any and all strings and integers + disabled: true + - name: confusing-naming # we frequently use "Foo()" and "foo()" together + disabled: true + - name: flag-parameter # excessive, and a common idiom we use + disabled: true + - name: unhandled-error # warns over common fmt.Print* and io.Close; rely on errcheck instead + disabled: true + # general config + - name: line-length-limit + arguments: + - 140 + - name: var-naming + arguments: + - [] + - - CID + - CRI + - CTRD + - DACL + - DLL + - DOS + - ETW + - FSCTL + - GCS + - GMSA + - HCS + - HV + - IO + - LCOW + - LDAP + - LPAC + - LTSC + - MMIO + - NT + - OCI + - PMEM + - PWSH + - RX + - SACl + - SID + - SMB + - TX + - VHD + - VHDX + - VMID + - VPCI + - WCOW + - WIM diff --git a/vendor/github.com/Microsoft/go-winio/CODEOWNERS b/vendor/github.com/Microsoft/go-winio/CODEOWNERS new file mode 100644 index 00000000..ae1b4942 --- /dev/null +++ b/vendor/github.com/Microsoft/go-winio/CODEOWNERS @@ -0,0 +1 @@ + * @microsoft/containerplat diff --git a/vendor/github.com/Microsoft/go-winio/LICENSE b/vendor/github.com/Microsoft/go-winio/LICENSE new file mode 100644 index 00000000..b8b569d7 --- /dev/null +++ b/vendor/github.com/Microsoft/go-winio/LICENSE @@ -0,0 +1,22 @@ +The MIT License (MIT) + +Copyright (c) 2015 Microsoft + +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. + diff --git a/vendor/github.com/Microsoft/go-winio/README.md b/vendor/github.com/Microsoft/go-winio/README.md new file mode 100644 index 00000000..7474b4f0 --- /dev/null +++ b/vendor/github.com/Microsoft/go-winio/README.md @@ -0,0 +1,89 @@ +# go-winio [![Build Status](https://github.com/microsoft/go-winio/actions/workflows/ci.yml/badge.svg)](https://github.com/microsoft/go-winio/actions/workflows/ci.yml) + +This repository contains utilities for efficiently performing Win32 IO operations in +Go. Currently, this is focused on accessing named pipes and other file handles, and +for using named pipes as a net transport. + +This code relies on IO completion ports to avoid blocking IO on system threads, allowing Go +to reuse the thread to schedule another goroutine. This limits support to Windows Vista and +newer operating systems. This is similar to the implementation of network sockets in Go's net +package. + +Please see the LICENSE file for licensing information. + +## Contributing + +This project welcomes contributions and suggestions. +Most contributions require you to agree to a Contributor License Agreement (CLA) declaring that +you have the right to, and actually do, grant us the rights to use your contribution. +For details, visit [Microsoft CLA](https://cla.microsoft.com). + +When you submit a pull request, a CLA-bot will automatically determine whether you need to +provide a CLA and decorate the PR appropriately (e.g., label, comment). +Simply follow the instructions provided by the bot. +You will only need to do this once across all repos using our CLA. + +Additionally, the pull request pipeline requires the following steps to be performed before +mergining. + +### Code Sign-Off + +We require that contributors sign their commits using [`git commit --signoff`][git-commit-s] +to certify they either authored the work themselves or otherwise have permission to use it in this project. + +A range of commits can be signed off using [`git rebase --signoff`][git-rebase-s]. + +Please see [the developer certificate](https://developercertificate.org) for more info, +as well as to make sure that you can attest to the rules listed. +Our CI uses the DCO Github app to ensure that all commits in a given PR are signed-off. + +### Linting + +Code must pass a linting stage, which uses [`golangci-lint`][lint]. +The linting settings are stored in [`.golangci.yaml`](./.golangci.yaml), and can be run +automatically with VSCode by adding the following to your workspace or folder settings: + +```json + "go.lintTool": "golangci-lint", + "go.lintOnSave": "package", +``` + +Additional editor [integrations options are also available][lint-ide]. + +Alternatively, `golangci-lint` can be [installed locally][lint-install] and run from the repo root: + +```shell +# use . or specify a path to only lint a package +# to show all lint errors, use flags "--max-issues-per-linter=0 --max-same-issues=0" +> golangci-lint run ./... +``` + +### Go Generate + +The pipeline checks that auto-generated code, via `go generate`, are up to date. + +This can be done for the entire repo: + +```shell +> go generate ./... +``` + +## Code of Conduct + +This project has adopted the [Microsoft Open Source Code of Conduct](https://opensource.microsoft.com/codeofconduct/). +For more information see the [Code of Conduct FAQ](https://opensource.microsoft.com/codeofconduct/faq/) or +contact [opencode@microsoft.com](mailto:opencode@microsoft.com) with any additional questions or comments. + +## Special Thanks + +Thanks to [natefinch][natefinch] for the inspiration for this library. +See [npipe](https://github.com/natefinch/npipe) for another named pipe implementation. + +[lint]: https://golangci-lint.run/ +[lint-ide]: https://golangci-lint.run/usage/integrations/#editor-integration +[lint-install]: https://golangci-lint.run/usage/install/#local-installation + +[git-commit-s]: https://git-scm.com/docs/git-commit#Documentation/git-commit.txt--s +[git-rebase-s]: https://git-scm.com/docs/git-rebase#Documentation/git-rebase.txt---signoff + +[natefinch]: https://github.com/natefinch diff --git a/vendor/github.com/Microsoft/go-winio/SECURITY.md b/vendor/github.com/Microsoft/go-winio/SECURITY.md new file mode 100644 index 00000000..869fdfe2 --- /dev/null +++ b/vendor/github.com/Microsoft/go-winio/SECURITY.md @@ -0,0 +1,41 @@ + + +## Security + +Microsoft takes the security of our software products and services seriously, which includes all source code repositories managed through our GitHub organizations, which include [Microsoft](https://github.com/Microsoft), [Azure](https://github.com/Azure), [DotNet](https://github.com/dotnet), [AspNet](https://github.com/aspnet), [Xamarin](https://github.com/xamarin), and [our GitHub organizations](https://opensource.microsoft.com/). + +If you believe you have found a security vulnerability in any Microsoft-owned repository that meets [Microsoft's definition of a security vulnerability](https://aka.ms/opensource/security/definition), please report it to us as described below. + +## Reporting Security Issues + +**Please do not report security vulnerabilities through public GitHub issues.** + +Instead, please report them to the Microsoft Security Response Center (MSRC) at [https://msrc.microsoft.com/create-report](https://aka.ms/opensource/security/create-report). + +If you prefer to submit without logging in, send email to [secure@microsoft.com](mailto:secure@microsoft.com). If possible, encrypt your message with our PGP key; please download it from the [Microsoft Security Response Center PGP Key page](https://aka.ms/opensource/security/pgpkey). + +You should receive a response within 24 hours. If for some reason you do not, please follow up via email to ensure we received your original message. Additional information can be found at [microsoft.com/msrc](https://aka.ms/opensource/security/msrc). + +Please include the requested information listed below (as much as you can provide) to help us better understand the nature and scope of the possible issue: + + * Type of issue (e.g. buffer overflow, SQL injection, cross-site scripting, etc.) + * Full paths of source file(s) related to the manifestation of the issue + * The location of the affected source code (tag/branch/commit or direct URL) + * Any special configuration required to reproduce the issue + * Step-by-step instructions to reproduce the issue + * Proof-of-concept or exploit code (if possible) + * Impact of the issue, including how an attacker might exploit the issue + +This information will help us triage your report more quickly. + +If you are reporting for a bug bounty, more complete reports can contribute to a higher bounty award. Please visit our [Microsoft Bug Bounty Program](https://aka.ms/opensource/security/bounty) page for more details about our active programs. + +## Preferred Languages + +We prefer all communications to be in English. + +## Policy + +Microsoft follows the principle of [Coordinated Vulnerability Disclosure](https://aka.ms/opensource/security/cvd). + + diff --git a/vendor/github.com/Microsoft/go-winio/backup.go b/vendor/github.com/Microsoft/go-winio/backup.go new file mode 100644 index 00000000..b54341da --- /dev/null +++ b/vendor/github.com/Microsoft/go-winio/backup.go @@ -0,0 +1,287 @@ +//go:build windows +// +build windows + +package winio + +import ( + "encoding/binary" + "errors" + "fmt" + "io" + "os" + "runtime" + "unicode/utf16" + + "github.com/Microsoft/go-winio/internal/fs" + "golang.org/x/sys/windows" +) + +//sys backupRead(h windows.Handle, b []byte, bytesRead *uint32, abort bool, processSecurity bool, context *uintptr) (err error) = BackupRead +//sys backupWrite(h windows.Handle, b []byte, bytesWritten *uint32, abort bool, processSecurity bool, context *uintptr) (err error) = BackupWrite + +const ( + BackupData = uint32(iota + 1) + BackupEaData + BackupSecurity + BackupAlternateData + BackupLink + BackupPropertyData + BackupObjectId //revive:disable-line:var-naming ID, not Id + BackupReparseData + BackupSparseBlock + BackupTxfsData +) + +const ( + StreamSparseAttributes = uint32(8) +) + +//nolint:revive // var-naming: ALL_CAPS +const ( + WRITE_DAC = windows.WRITE_DAC + WRITE_OWNER = windows.WRITE_OWNER + ACCESS_SYSTEM_SECURITY = windows.ACCESS_SYSTEM_SECURITY +) + +// BackupHeader represents a backup stream of a file. +type BackupHeader struct { + //revive:disable-next-line:var-naming ID, not Id + Id uint32 // The backup stream ID + Attributes uint32 // Stream attributes + Size int64 // The size of the stream in bytes + Name string // The name of the stream (for BackupAlternateData only). + Offset int64 // The offset of the stream in the file (for BackupSparseBlock only). +} + +type win32StreamID struct { + StreamID uint32 + Attributes uint32 + Size uint64 + NameSize uint32 +} + +// BackupStreamReader reads from a stream produced by the BackupRead Win32 API and produces a series +// of BackupHeader values. +type BackupStreamReader struct { + r io.Reader + bytesLeft int64 +} + +// NewBackupStreamReader produces a BackupStreamReader from any io.Reader. +func NewBackupStreamReader(r io.Reader) *BackupStreamReader { + return &BackupStreamReader{r, 0} +} + +// Next returns the next backup stream and prepares for calls to Read(). It skips the remainder of the current stream if +// it was not completely read. +func (r *BackupStreamReader) Next() (*BackupHeader, error) { + if r.bytesLeft > 0 { //nolint:nestif // todo: flatten this + if s, ok := r.r.(io.Seeker); ok { + // Make sure Seek on io.SeekCurrent sometimes succeeds + // before trying the actual seek. + if _, err := s.Seek(0, io.SeekCurrent); err == nil { + if _, err = s.Seek(r.bytesLeft, io.SeekCurrent); err != nil { + return nil, err + } + r.bytesLeft = 0 + } + } + if _, err := io.Copy(io.Discard, r); err != nil { + return nil, err + } + } + var wsi win32StreamID + if err := binary.Read(r.r, binary.LittleEndian, &wsi); err != nil { + return nil, err + } + hdr := &BackupHeader{ + Id: wsi.StreamID, + Attributes: wsi.Attributes, + Size: int64(wsi.Size), + } + if wsi.NameSize != 0 { + name := make([]uint16, int(wsi.NameSize/2)) + if err := binary.Read(r.r, binary.LittleEndian, name); err != nil { + return nil, err + } + hdr.Name = windows.UTF16ToString(name) + } + if wsi.StreamID == BackupSparseBlock { + if err := binary.Read(r.r, binary.LittleEndian, &hdr.Offset); err != nil { + return nil, err + } + hdr.Size -= 8 + } + r.bytesLeft = hdr.Size + return hdr, nil +} + +// Read reads from the current backup stream. +func (r *BackupStreamReader) Read(b []byte) (int, error) { + if r.bytesLeft == 0 { + return 0, io.EOF + } + if int64(len(b)) > r.bytesLeft { + b = b[:r.bytesLeft] + } + n, err := r.r.Read(b) + r.bytesLeft -= int64(n) + if err == io.EOF { + err = io.ErrUnexpectedEOF + } else if r.bytesLeft == 0 && err == nil { + err = io.EOF + } + return n, err +} + +// BackupStreamWriter writes a stream compatible with the BackupWrite Win32 API. +type BackupStreamWriter struct { + w io.Writer + bytesLeft int64 +} + +// NewBackupStreamWriter produces a BackupStreamWriter on top of an io.Writer. +func NewBackupStreamWriter(w io.Writer) *BackupStreamWriter { + return &BackupStreamWriter{w, 0} +} + +// WriteHeader writes the next backup stream header and prepares for calls to Write(). +func (w *BackupStreamWriter) WriteHeader(hdr *BackupHeader) error { + if w.bytesLeft != 0 { + return fmt.Errorf("missing %d bytes", w.bytesLeft) + } + name := utf16.Encode([]rune(hdr.Name)) + wsi := win32StreamID{ + StreamID: hdr.Id, + Attributes: hdr.Attributes, + Size: uint64(hdr.Size), + NameSize: uint32(len(name) * 2), + } + if hdr.Id == BackupSparseBlock { + // Include space for the int64 block offset + wsi.Size += 8 + } + if err := binary.Write(w.w, binary.LittleEndian, &wsi); err != nil { + return err + } + if len(name) != 0 { + if err := binary.Write(w.w, binary.LittleEndian, name); err != nil { + return err + } + } + if hdr.Id == BackupSparseBlock { + if err := binary.Write(w.w, binary.LittleEndian, hdr.Offset); err != nil { + return err + } + } + w.bytesLeft = hdr.Size + return nil +} + +// Write writes to the current backup stream. +func (w *BackupStreamWriter) Write(b []byte) (int, error) { + if w.bytesLeft < int64(len(b)) { + return 0, fmt.Errorf("too many bytes by %d", int64(len(b))-w.bytesLeft) + } + n, err := w.w.Write(b) + w.bytesLeft -= int64(n) + return n, err +} + +// BackupFileReader provides an io.ReadCloser interface on top of the BackupRead Win32 API. +type BackupFileReader struct { + f *os.File + includeSecurity bool + ctx uintptr +} + +// NewBackupFileReader returns a new BackupFileReader from a file handle. If includeSecurity is true, +// Read will attempt to read the security descriptor of the file. +func NewBackupFileReader(f *os.File, includeSecurity bool) *BackupFileReader { + r := &BackupFileReader{f, includeSecurity, 0} + return r +} + +// Read reads a backup stream from the file by calling the Win32 API BackupRead(). +func (r *BackupFileReader) Read(b []byte) (int, error) { + var bytesRead uint32 + err := backupRead(windows.Handle(r.f.Fd()), b, &bytesRead, false, r.includeSecurity, &r.ctx) + if err != nil { + return 0, &os.PathError{Op: "BackupRead", Path: r.f.Name(), Err: err} + } + runtime.KeepAlive(r.f) + if bytesRead == 0 { + return 0, io.EOF + } + return int(bytesRead), nil +} + +// Close frees Win32 resources associated with the BackupFileReader. It does not close +// the underlying file. +func (r *BackupFileReader) Close() error { + if r.ctx != 0 { + _ = backupRead(windows.Handle(r.f.Fd()), nil, nil, true, false, &r.ctx) + runtime.KeepAlive(r.f) + r.ctx = 0 + } + return nil +} + +// BackupFileWriter provides an io.WriteCloser interface on top of the BackupWrite Win32 API. +type BackupFileWriter struct { + f *os.File + includeSecurity bool + ctx uintptr +} + +// NewBackupFileWriter returns a new BackupFileWriter from a file handle. If includeSecurity is true, +// Write() will attempt to restore the security descriptor from the stream. +func NewBackupFileWriter(f *os.File, includeSecurity bool) *BackupFileWriter { + w := &BackupFileWriter{f, includeSecurity, 0} + return w +} + +// Write restores a portion of the file using the provided backup stream. +func (w *BackupFileWriter) Write(b []byte) (int, error) { + var bytesWritten uint32 + err := backupWrite(windows.Handle(w.f.Fd()), b, &bytesWritten, false, w.includeSecurity, &w.ctx) + if err != nil { + return 0, &os.PathError{Op: "BackupWrite", Path: w.f.Name(), Err: err} + } + runtime.KeepAlive(w.f) + if int(bytesWritten) != len(b) { + return int(bytesWritten), errors.New("not all bytes could be written") + } + return len(b), nil +} + +// Close frees Win32 resources associated with the BackupFileWriter. It does not +// close the underlying file. +func (w *BackupFileWriter) Close() error { + if w.ctx != 0 { + _ = backupWrite(windows.Handle(w.f.Fd()), nil, nil, true, false, &w.ctx) + runtime.KeepAlive(w.f) + w.ctx = 0 + } + return nil +} + +// OpenForBackup opens a file or directory, potentially skipping access checks if the backup +// or restore privileges have been acquired. +// +// If the file opened was a directory, it cannot be used with Readdir(). +func OpenForBackup(path string, access uint32, share uint32, createmode uint32) (*os.File, error) { + h, err := fs.CreateFile(path, + fs.AccessMask(access), + fs.FileShareMode(share), + nil, + fs.FileCreationDisposition(createmode), + fs.FILE_FLAG_BACKUP_SEMANTICS|fs.FILE_FLAG_OPEN_REPARSE_POINT, + 0, + ) + if err != nil { + err = &os.PathError{Op: "open", Path: path, Err: err} + return nil, err + } + return os.NewFile(uintptr(h), path), nil +} diff --git a/vendor/github.com/Microsoft/go-winio/doc.go b/vendor/github.com/Microsoft/go-winio/doc.go new file mode 100644 index 00000000..1f5bfe2d --- /dev/null +++ b/vendor/github.com/Microsoft/go-winio/doc.go @@ -0,0 +1,22 @@ +// This package provides utilities for efficiently performing Win32 IO operations in Go. +// Currently, this package is provides support for genreal IO and management of +// - named pipes +// - files +// - [Hyper-V sockets] +// +// This code is similar to Go's [net] package, and uses IO completion ports to avoid +// blocking IO on system threads, allowing Go to reuse the thread to schedule other goroutines. +// +// This limits support to Windows Vista and newer operating systems. +// +// Additionally, this package provides support for: +// - creating and managing GUIDs +// - writing to [ETW] +// - opening and manageing VHDs +// - parsing [Windows Image files] +// - auto-generating Win32 API code +// +// [Hyper-V sockets]: https://docs.microsoft.com/en-us/virtualization/hyper-v-on-windows/user-guide/make-integration-service +// [ETW]: https://docs.microsoft.com/en-us/windows-hardware/drivers/devtest/event-tracing-for-windows--etw- +// [Windows Image files]: https://docs.microsoft.com/en-us/windows-hardware/manufacture/desktop/work-with-windows-images +package winio diff --git a/vendor/github.com/Microsoft/go-winio/ea.go b/vendor/github.com/Microsoft/go-winio/ea.go new file mode 100644 index 00000000..e104dbdf --- /dev/null +++ b/vendor/github.com/Microsoft/go-winio/ea.go @@ -0,0 +1,137 @@ +package winio + +import ( + "bytes" + "encoding/binary" + "errors" +) + +type fileFullEaInformation struct { + NextEntryOffset uint32 + Flags uint8 + NameLength uint8 + ValueLength uint16 +} + +var ( + fileFullEaInformationSize = binary.Size(&fileFullEaInformation{}) + + errInvalidEaBuffer = errors.New("invalid extended attribute buffer") + errEaNameTooLarge = errors.New("extended attribute name too large") + errEaValueTooLarge = errors.New("extended attribute value too large") +) + +// ExtendedAttribute represents a single Windows EA. +type ExtendedAttribute struct { + Name string + Value []byte + Flags uint8 +} + +func parseEa(b []byte) (ea ExtendedAttribute, nb []byte, err error) { + var info fileFullEaInformation + err = binary.Read(bytes.NewReader(b), binary.LittleEndian, &info) + if err != nil { + err = errInvalidEaBuffer + return ea, nb, err + } + + nameOffset := fileFullEaInformationSize + nameLen := int(info.NameLength) + valueOffset := nameOffset + int(info.NameLength) + 1 + valueLen := int(info.ValueLength) + nextOffset := int(info.NextEntryOffset) + if valueLen+valueOffset > len(b) || nextOffset < 0 || nextOffset > len(b) { + err = errInvalidEaBuffer + return ea, nb, err + } + + ea.Name = string(b[nameOffset : nameOffset+nameLen]) + ea.Value = b[valueOffset : valueOffset+valueLen] + ea.Flags = info.Flags + if info.NextEntryOffset != 0 { + nb = b[info.NextEntryOffset:] + } + return ea, nb, err +} + +// DecodeExtendedAttributes decodes a list of EAs from a FILE_FULL_EA_INFORMATION +// buffer retrieved from BackupRead, ZwQueryEaFile, etc. +func DecodeExtendedAttributes(b []byte) (eas []ExtendedAttribute, err error) { + for len(b) != 0 { + ea, nb, err := parseEa(b) + if err != nil { + return nil, err + } + + eas = append(eas, ea) + b = nb + } + return eas, err +} + +func writeEa(buf *bytes.Buffer, ea *ExtendedAttribute, last bool) error { + if int(uint8(len(ea.Name))) != len(ea.Name) { + return errEaNameTooLarge + } + if int(uint16(len(ea.Value))) != len(ea.Value) { + return errEaValueTooLarge + } + entrySize := uint32(fileFullEaInformationSize + len(ea.Name) + 1 + len(ea.Value)) + withPadding := (entrySize + 3) &^ 3 + nextOffset := uint32(0) + if !last { + nextOffset = withPadding + } + info := fileFullEaInformation{ + NextEntryOffset: nextOffset, + Flags: ea.Flags, + NameLength: uint8(len(ea.Name)), + ValueLength: uint16(len(ea.Value)), + } + + err := binary.Write(buf, binary.LittleEndian, &info) + if err != nil { + return err + } + + _, err = buf.Write([]byte(ea.Name)) + if err != nil { + return err + } + + err = buf.WriteByte(0) + if err != nil { + return err + } + + _, err = buf.Write(ea.Value) + if err != nil { + return err + } + + _, err = buf.Write([]byte{0, 0, 0}[0 : withPadding-entrySize]) + if err != nil { + return err + } + + return nil +} + +// EncodeExtendedAttributes encodes a list of EAs into a FILE_FULL_EA_INFORMATION +// buffer for use with BackupWrite, ZwSetEaFile, etc. +func EncodeExtendedAttributes(eas []ExtendedAttribute) ([]byte, error) { + var buf bytes.Buffer + for i := range eas { + last := false + if i == len(eas)-1 { + last = true + } + + err := writeEa(&buf, &eas[i], last) + if err != nil { + return nil, err + } + } + return buf.Bytes(), nil +} diff --git a/vendor/github.com/Microsoft/go-winio/file.go b/vendor/github.com/Microsoft/go-winio/file.go new file mode 100644 index 00000000..fe82a180 --- /dev/null +++ b/vendor/github.com/Microsoft/go-winio/file.go @@ -0,0 +1,320 @@ +//go:build windows +// +build windows + +package winio + +import ( + "errors" + "io" + "runtime" + "sync" + "sync/atomic" + "syscall" + "time" + + "golang.org/x/sys/windows" +) + +//sys cancelIoEx(file windows.Handle, o *windows.Overlapped) (err error) = CancelIoEx +//sys createIoCompletionPort(file windows.Handle, port windows.Handle, key uintptr, threadCount uint32) (newport windows.Handle, err error) = CreateIoCompletionPort +//sys getQueuedCompletionStatus(port windows.Handle, bytes *uint32, key *uintptr, o **ioOperation, timeout uint32) (err error) = GetQueuedCompletionStatus +//sys setFileCompletionNotificationModes(h windows.Handle, flags uint8) (err error) = SetFileCompletionNotificationModes +//sys wsaGetOverlappedResult(h windows.Handle, o *windows.Overlapped, bytes *uint32, wait bool, flags *uint32) (err error) = ws2_32.WSAGetOverlappedResult + +var ( + ErrFileClosed = errors.New("file has already been closed") + ErrTimeout = &timeoutError{} +) + +type timeoutError struct{} + +func (*timeoutError) Error() string { return "i/o timeout" } +func (*timeoutError) Timeout() bool { return true } +func (*timeoutError) Temporary() bool { return true } + +type timeoutChan chan struct{} + +var ioInitOnce sync.Once +var ioCompletionPort windows.Handle + +// ioResult contains the result of an asynchronous IO operation. +type ioResult struct { + bytes uint32 + err error +} + +// ioOperation represents an outstanding asynchronous Win32 IO. +type ioOperation struct { + o windows.Overlapped + ch chan ioResult +} + +func initIO() { + h, err := createIoCompletionPort(windows.InvalidHandle, 0, 0, 0xffffffff) + if err != nil { + panic(err) + } + ioCompletionPort = h + go ioCompletionProcessor(h) +} + +// win32File implements Reader, Writer, and Closer on a Win32 handle without blocking in a syscall. +// It takes ownership of this handle and will close it if it is garbage collected. +type win32File struct { + handle windows.Handle + wg sync.WaitGroup + wgLock sync.RWMutex + closing atomic.Bool + socket bool + readDeadline deadlineHandler + writeDeadline deadlineHandler +} + +type deadlineHandler struct { + setLock sync.Mutex + channel timeoutChan + channelLock sync.RWMutex + timer *time.Timer + timedout atomic.Bool +} + +// makeWin32File makes a new win32File from an existing file handle. +func makeWin32File(h windows.Handle) (*win32File, error) { + f := &win32File{handle: h} + ioInitOnce.Do(initIO) + _, err := createIoCompletionPort(h, ioCompletionPort, 0, 0xffffffff) + if err != nil { + return nil, err + } + err = setFileCompletionNotificationModes(h, windows.FILE_SKIP_COMPLETION_PORT_ON_SUCCESS|windows.FILE_SKIP_SET_EVENT_ON_HANDLE) + if err != nil { + return nil, err + } + f.readDeadline.channel = make(timeoutChan) + f.writeDeadline.channel = make(timeoutChan) + return f, nil +} + +// Deprecated: use NewOpenFile instead. +func MakeOpenFile(h syscall.Handle) (io.ReadWriteCloser, error) { + return NewOpenFile(windows.Handle(h)) +} + +func NewOpenFile(h windows.Handle) (io.ReadWriteCloser, error) { + // If we return the result of makeWin32File directly, it can result in an + // interface-wrapped nil, rather than a nil interface value. + f, err := makeWin32File(h) + if err != nil { + return nil, err + } + return f, nil +} + +// closeHandle closes the resources associated with a Win32 handle. +func (f *win32File) closeHandle() { + f.wgLock.Lock() + // Atomically set that we are closing, releasing the resources only once. + if !f.closing.Swap(true) { + f.wgLock.Unlock() + // cancel all IO and wait for it to complete + _ = cancelIoEx(f.handle, nil) + f.wg.Wait() + // at this point, no new IO can start + windows.Close(f.handle) + f.handle = 0 + } else { + f.wgLock.Unlock() + } +} + +// Close closes a win32File. +func (f *win32File) Close() error { + f.closeHandle() + return nil +} + +// IsClosed checks if the file has been closed. +func (f *win32File) IsClosed() bool { + return f.closing.Load() +} + +// prepareIO prepares for a new IO operation. +// The caller must call f.wg.Done() when the IO is finished, prior to Close() returning. +func (f *win32File) prepareIO() (*ioOperation, error) { + f.wgLock.RLock() + if f.closing.Load() { + f.wgLock.RUnlock() + return nil, ErrFileClosed + } + f.wg.Add(1) + f.wgLock.RUnlock() + c := &ioOperation{} + c.ch = make(chan ioResult) + return c, nil +} + +// ioCompletionProcessor processes completed async IOs forever. +func ioCompletionProcessor(h windows.Handle) { + for { + var bytes uint32 + var key uintptr + var op *ioOperation + err := getQueuedCompletionStatus(h, &bytes, &key, &op, windows.INFINITE) + if op == nil { + panic(err) + } + op.ch <- ioResult{bytes, err} + } +} + +// todo: helsaawy - create an asyncIO version that takes a context + +// asyncIO processes the return value from ReadFile or WriteFile, blocking until +// the operation has actually completed. +func (f *win32File) asyncIO(c *ioOperation, d *deadlineHandler, bytes uint32, err error) (int, error) { + if err != windows.ERROR_IO_PENDING { //nolint:errorlint // err is Errno + return int(bytes), err + } + + if f.closing.Load() { + _ = cancelIoEx(f.handle, &c.o) + } + + var timeout timeoutChan + if d != nil { + d.channelLock.Lock() + timeout = d.channel + d.channelLock.Unlock() + } + + var r ioResult + select { + case r = <-c.ch: + err = r.err + if err == windows.ERROR_OPERATION_ABORTED { //nolint:errorlint // err is Errno + if f.closing.Load() { + err = ErrFileClosed + } + } else if err != nil && f.socket { + // err is from Win32. Query the overlapped structure to get the winsock error. + var bytes, flags uint32 + err = wsaGetOverlappedResult(f.handle, &c.o, &bytes, false, &flags) + } + case <-timeout: + _ = cancelIoEx(f.handle, &c.o) + r = <-c.ch + err = r.err + if err == windows.ERROR_OPERATION_ABORTED { //nolint:errorlint // err is Errno + err = ErrTimeout + } + } + + // runtime.KeepAlive is needed, as c is passed via native + // code to ioCompletionProcessor, c must remain alive + // until the channel read is complete. + // todo: (de)allocate *ioOperation via win32 heap functions, instead of needing to KeepAlive? + runtime.KeepAlive(c) + return int(r.bytes), err +} + +// Read reads from a file handle. +func (f *win32File) Read(b []byte) (int, error) { + c, err := f.prepareIO() + if err != nil { + return 0, err + } + defer f.wg.Done() + + if f.readDeadline.timedout.Load() { + return 0, ErrTimeout + } + + var bytes uint32 + err = windows.ReadFile(f.handle, b, &bytes, &c.o) + n, err := f.asyncIO(c, &f.readDeadline, bytes, err) + runtime.KeepAlive(b) + + // Handle EOF conditions. + if err == nil && n == 0 && len(b) != 0 { + return 0, io.EOF + } else if err == windows.ERROR_BROKEN_PIPE { //nolint:errorlint // err is Errno + return 0, io.EOF + } + return n, err +} + +// Write writes to a file handle. +func (f *win32File) Write(b []byte) (int, error) { + c, err := f.prepareIO() + if err != nil { + return 0, err + } + defer f.wg.Done() + + if f.writeDeadline.timedout.Load() { + return 0, ErrTimeout + } + + var bytes uint32 + err = windows.WriteFile(f.handle, b, &bytes, &c.o) + n, err := f.asyncIO(c, &f.writeDeadline, bytes, err) + runtime.KeepAlive(b) + return n, err +} + +func (f *win32File) SetReadDeadline(deadline time.Time) error { + return f.readDeadline.set(deadline) +} + +func (f *win32File) SetWriteDeadline(deadline time.Time) error { + return f.writeDeadline.set(deadline) +} + +func (f *win32File) Flush() error { + return windows.FlushFileBuffers(f.handle) +} + +func (f *win32File) Fd() uintptr { + return uintptr(f.handle) +} + +func (d *deadlineHandler) set(deadline time.Time) error { + d.setLock.Lock() + defer d.setLock.Unlock() + + if d.timer != nil { + if !d.timer.Stop() { + <-d.channel + } + d.timer = nil + } + d.timedout.Store(false) + + select { + case <-d.channel: + d.channelLock.Lock() + d.channel = make(chan struct{}) + d.channelLock.Unlock() + default: + } + + if deadline.IsZero() { + return nil + } + + timeoutIO := func() { + d.timedout.Store(true) + close(d.channel) + } + + now := time.Now() + duration := deadline.Sub(now) + if deadline.After(now) { + // Deadline is in the future, set a timer to wait + d.timer = time.AfterFunc(duration, timeoutIO) + } else { + // Deadline is in the past. Cancel all pending IO now. + timeoutIO() + } + return nil +} diff --git a/vendor/github.com/Microsoft/go-winio/fileinfo.go b/vendor/github.com/Microsoft/go-winio/fileinfo.go new file mode 100644 index 00000000..c860eb99 --- /dev/null +++ b/vendor/github.com/Microsoft/go-winio/fileinfo.go @@ -0,0 +1,106 @@ +//go:build windows +// +build windows + +package winio + +import ( + "os" + "runtime" + "unsafe" + + "golang.org/x/sys/windows" +) + +// FileBasicInfo contains file access time and file attributes information. +type FileBasicInfo struct { + CreationTime, LastAccessTime, LastWriteTime, ChangeTime windows.Filetime + FileAttributes uint32 + _ uint32 // padding +} + +// alignedFileBasicInfo is a FileBasicInfo, but aligned to uint64 by containing +// uint64 rather than windows.Filetime. Filetime contains two uint32s. uint64 +// alignment is necessary to pass this as FILE_BASIC_INFO. +type alignedFileBasicInfo struct { + CreationTime, LastAccessTime, LastWriteTime, ChangeTime uint64 + FileAttributes uint32 + _ uint32 // padding +} + +// GetFileBasicInfo retrieves times and attributes for a file. +func GetFileBasicInfo(f *os.File) (*FileBasicInfo, error) { + bi := &alignedFileBasicInfo{} + if err := windows.GetFileInformationByHandleEx( + windows.Handle(f.Fd()), + windows.FileBasicInfo, + (*byte)(unsafe.Pointer(bi)), + uint32(unsafe.Sizeof(*bi)), + ); err != nil { + return nil, &os.PathError{Op: "GetFileInformationByHandleEx", Path: f.Name(), Err: err} + } + runtime.KeepAlive(f) + // Reinterpret the alignedFileBasicInfo as a FileBasicInfo so it matches the + // public API of this module. The data may be unnecessarily aligned. + return (*FileBasicInfo)(unsafe.Pointer(bi)), nil +} + +// SetFileBasicInfo sets times and attributes for a file. +func SetFileBasicInfo(f *os.File, bi *FileBasicInfo) error { + // Create an alignedFileBasicInfo based on a FileBasicInfo. The copy is + // suitable to pass to GetFileInformationByHandleEx. + biAligned := *(*alignedFileBasicInfo)(unsafe.Pointer(bi)) + if err := windows.SetFileInformationByHandle( + windows.Handle(f.Fd()), + windows.FileBasicInfo, + (*byte)(unsafe.Pointer(&biAligned)), + uint32(unsafe.Sizeof(biAligned)), + ); err != nil { + return &os.PathError{Op: "SetFileInformationByHandle", Path: f.Name(), Err: err} + } + runtime.KeepAlive(f) + return nil +} + +// FileStandardInfo contains extended information for the file. +// FILE_STANDARD_INFO in WinBase.h +// https://docs.microsoft.com/en-us/windows/win32/api/winbase/ns-winbase-file_standard_info +type FileStandardInfo struct { + AllocationSize, EndOfFile int64 + NumberOfLinks uint32 + DeletePending, Directory bool +} + +// GetFileStandardInfo retrieves ended information for the file. +func GetFileStandardInfo(f *os.File) (*FileStandardInfo, error) { + si := &FileStandardInfo{} + if err := windows.GetFileInformationByHandleEx(windows.Handle(f.Fd()), + windows.FileStandardInfo, + (*byte)(unsafe.Pointer(si)), + uint32(unsafe.Sizeof(*si))); err != nil { + return nil, &os.PathError{Op: "GetFileInformationByHandleEx", Path: f.Name(), Err: err} + } + runtime.KeepAlive(f) + return si, nil +} + +// FileIDInfo contains the volume serial number and file ID for a file. This pair should be +// unique on a system. +type FileIDInfo struct { + VolumeSerialNumber uint64 + FileID [16]byte +} + +// GetFileID retrieves the unique (volume, file ID) pair for a file. +func GetFileID(f *os.File) (*FileIDInfo, error) { + fileID := &FileIDInfo{} + if err := windows.GetFileInformationByHandleEx( + windows.Handle(f.Fd()), + windows.FileIdInfo, + (*byte)(unsafe.Pointer(fileID)), + uint32(unsafe.Sizeof(*fileID)), + ); err != nil { + return nil, &os.PathError{Op: "GetFileInformationByHandleEx", Path: f.Name(), Err: err} + } + runtime.KeepAlive(f) + return fileID, nil +} diff --git a/vendor/github.com/Microsoft/go-winio/hvsock.go b/vendor/github.com/Microsoft/go-winio/hvsock.go new file mode 100644 index 00000000..c4fdd9d4 --- /dev/null +++ b/vendor/github.com/Microsoft/go-winio/hvsock.go @@ -0,0 +1,582 @@ +//go:build windows +// +build windows + +package winio + +import ( + "context" + "errors" + "fmt" + "io" + "net" + "os" + "time" + "unsafe" + + "golang.org/x/sys/windows" + + "github.com/Microsoft/go-winio/internal/socket" + "github.com/Microsoft/go-winio/pkg/guid" +) + +const afHVSock = 34 // AF_HYPERV + +// Well known Service and VM IDs +// https://docs.microsoft.com/en-us/virtualization/hyper-v-on-windows/user-guide/make-integration-service#vmid-wildcards + +// HvsockGUIDWildcard is the wildcard VmId for accepting connections from all partitions. +func HvsockGUIDWildcard() guid.GUID { // 00000000-0000-0000-0000-000000000000 + return guid.GUID{} +} + +// HvsockGUIDBroadcast is the wildcard VmId for broadcasting sends to all partitions. +func HvsockGUIDBroadcast() guid.GUID { // ffffffff-ffff-ffff-ffff-ffffffffffff + return guid.GUID{ + Data1: 0xffffffff, + Data2: 0xffff, + Data3: 0xffff, + Data4: [8]uint8{0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff}, + } +} + +// HvsockGUIDLoopback is the Loopback VmId for accepting connections to the same partition as the connector. +func HvsockGUIDLoopback() guid.GUID { // e0e16197-dd56-4a10-9195-5ee7a155a838 + return guid.GUID{ + Data1: 0xe0e16197, + Data2: 0xdd56, + Data3: 0x4a10, + Data4: [8]uint8{0x91, 0x95, 0x5e, 0xe7, 0xa1, 0x55, 0xa8, 0x38}, + } +} + +// HvsockGUIDSiloHost is the address of a silo's host partition: +// - The silo host of a hosted silo is the utility VM. +// - The silo host of a silo on a physical host is the physical host. +func HvsockGUIDSiloHost() guid.GUID { // 36bd0c5c-7276-4223-88ba-7d03b654c568 + return guid.GUID{ + Data1: 0x36bd0c5c, + Data2: 0x7276, + Data3: 0x4223, + Data4: [8]byte{0x88, 0xba, 0x7d, 0x03, 0xb6, 0x54, 0xc5, 0x68}, + } +} + +// HvsockGUIDChildren is the wildcard VmId for accepting connections from the connector's child partitions. +func HvsockGUIDChildren() guid.GUID { // 90db8b89-0d35-4f79-8ce9-49ea0ac8b7cd + return guid.GUID{ + Data1: 0x90db8b89, + Data2: 0xd35, + Data3: 0x4f79, + Data4: [8]uint8{0x8c, 0xe9, 0x49, 0xea, 0xa, 0xc8, 0xb7, 0xcd}, + } +} + +// HvsockGUIDParent is the wildcard VmId for accepting connections from the connector's parent partition. +// Listening on this VmId accepts connection from: +// - Inside silos: silo host partition. +// - Inside hosted silo: host of the VM. +// - Inside VM: VM host. +// - Physical host: Not supported. +func HvsockGUIDParent() guid.GUID { // a42e7cda-d03f-480c-9cc2-a4de20abb878 + return guid.GUID{ + Data1: 0xa42e7cda, + Data2: 0xd03f, + Data3: 0x480c, + Data4: [8]uint8{0x9c, 0xc2, 0xa4, 0xde, 0x20, 0xab, 0xb8, 0x78}, + } +} + +// hvsockVsockServiceTemplate is the Service GUID used for the VSOCK protocol. +func hvsockVsockServiceTemplate() guid.GUID { // 00000000-facb-11e6-bd58-64006a7986d3 + return guid.GUID{ + Data2: 0xfacb, + Data3: 0x11e6, + Data4: [8]uint8{0xbd, 0x58, 0x64, 0x00, 0x6a, 0x79, 0x86, 0xd3}, + } +} + +// An HvsockAddr is an address for a AF_HYPERV socket. +type HvsockAddr struct { + VMID guid.GUID + ServiceID guid.GUID +} + +type rawHvsockAddr struct { + Family uint16 + _ uint16 + VMID guid.GUID + ServiceID guid.GUID +} + +var _ socket.RawSockaddr = &rawHvsockAddr{} + +// Network returns the address's network name, "hvsock". +func (*HvsockAddr) Network() string { + return "hvsock" +} + +func (addr *HvsockAddr) String() string { + return fmt.Sprintf("%s:%s", &addr.VMID, &addr.ServiceID) +} + +// VsockServiceID returns an hvsock service ID corresponding to the specified AF_VSOCK port. +func VsockServiceID(port uint32) guid.GUID { + g := hvsockVsockServiceTemplate() // make a copy + g.Data1 = port + return g +} + +func (addr *HvsockAddr) raw() rawHvsockAddr { + return rawHvsockAddr{ + Family: afHVSock, + VMID: addr.VMID, + ServiceID: addr.ServiceID, + } +} + +func (addr *HvsockAddr) fromRaw(raw *rawHvsockAddr) { + addr.VMID = raw.VMID + addr.ServiceID = raw.ServiceID +} + +// Sockaddr returns a pointer to and the size of this struct. +// +// Implements the [socket.RawSockaddr] interface, and allows use in +// [socket.Bind] and [socket.ConnectEx]. +func (r *rawHvsockAddr) Sockaddr() (unsafe.Pointer, int32, error) { + return unsafe.Pointer(r), int32(unsafe.Sizeof(rawHvsockAddr{})), nil +} + +// Sockaddr interface allows use with `sockets.Bind()` and `.ConnectEx()`. +func (r *rawHvsockAddr) FromBytes(b []byte) error { + n := int(unsafe.Sizeof(rawHvsockAddr{})) + + if len(b) < n { + return fmt.Errorf("got %d, want %d: %w", len(b), n, socket.ErrBufferSize) + } + + copy(unsafe.Slice((*byte)(unsafe.Pointer(r)), n), b[:n]) + if r.Family != afHVSock { + return fmt.Errorf("got %d, want %d: %w", r.Family, afHVSock, socket.ErrAddrFamily) + } + + return nil +} + +// HvsockListener is a socket listener for the AF_HYPERV address family. +type HvsockListener struct { + sock *win32File + addr HvsockAddr +} + +var _ net.Listener = &HvsockListener{} + +// HvsockConn is a connected socket of the AF_HYPERV address family. +type HvsockConn struct { + sock *win32File + local, remote HvsockAddr +} + +var _ net.Conn = &HvsockConn{} + +func newHVSocket() (*win32File, error) { + fd, err := windows.Socket(afHVSock, windows.SOCK_STREAM, 1) + if err != nil { + return nil, os.NewSyscallError("socket", err) + } + f, err := makeWin32File(fd) + if err != nil { + windows.Close(fd) + return nil, err + } + f.socket = true + return f, nil +} + +// ListenHvsock listens for connections on the specified hvsock address. +func ListenHvsock(addr *HvsockAddr) (_ *HvsockListener, err error) { + l := &HvsockListener{addr: *addr} + + var sock *win32File + sock, err = newHVSocket() + if err != nil { + return nil, l.opErr("listen", err) + } + defer func() { + if err != nil { + _ = sock.Close() + } + }() + + sa := addr.raw() + err = socket.Bind(sock.handle, &sa) + if err != nil { + return nil, l.opErr("listen", os.NewSyscallError("socket", err)) + } + err = windows.Listen(sock.handle, 16) + if err != nil { + return nil, l.opErr("listen", os.NewSyscallError("listen", err)) + } + return &HvsockListener{sock: sock, addr: *addr}, nil +} + +func (l *HvsockListener) opErr(op string, err error) error { + return &net.OpError{Op: op, Net: "hvsock", Addr: &l.addr, Err: err} +} + +// Addr returns the listener's network address. +func (l *HvsockListener) Addr() net.Addr { + return &l.addr +} + +// Accept waits for the next connection and returns it. +func (l *HvsockListener) Accept() (_ net.Conn, err error) { + sock, err := newHVSocket() + if err != nil { + return nil, l.opErr("accept", err) + } + defer func() { + if sock != nil { + sock.Close() + } + }() + c, err := l.sock.prepareIO() + if err != nil { + return nil, l.opErr("accept", err) + } + defer l.sock.wg.Done() + + // AcceptEx, per documentation, requires an extra 16 bytes per address. + // + // https://docs.microsoft.com/en-us/windows/win32/api/mswsock/nf-mswsock-acceptex + const addrlen = uint32(16 + unsafe.Sizeof(rawHvsockAddr{})) + var addrbuf [addrlen * 2]byte + + var bytes uint32 + err = windows.AcceptEx(l.sock.handle, sock.handle, &addrbuf[0], 0 /* rxdatalen */, addrlen, addrlen, &bytes, &c.o) + if _, err = l.sock.asyncIO(c, nil, bytes, err); err != nil { + return nil, l.opErr("accept", os.NewSyscallError("acceptex", err)) + } + + conn := &HvsockConn{ + sock: sock, + } + // The local address returned in the AcceptEx buffer is the same as the Listener socket's + // address. However, the service GUID reported by GetSockName is different from the Listeners + // socket, and is sometimes the same as the local address of the socket that dialed the + // address, with the service GUID.Data1 incremented, but othertimes is different. + // todo: does the local address matter? is the listener's address or the actual address appropriate? + conn.local.fromRaw((*rawHvsockAddr)(unsafe.Pointer(&addrbuf[0]))) + conn.remote.fromRaw((*rawHvsockAddr)(unsafe.Pointer(&addrbuf[addrlen]))) + + // initialize the accepted socket and update its properties with those of the listening socket + if err = windows.Setsockopt(sock.handle, + windows.SOL_SOCKET, windows.SO_UPDATE_ACCEPT_CONTEXT, + (*byte)(unsafe.Pointer(&l.sock.handle)), int32(unsafe.Sizeof(l.sock.handle))); err != nil { + return nil, conn.opErr("accept", os.NewSyscallError("setsockopt", err)) + } + + sock = nil + return conn, nil +} + +// Close closes the listener, causing any pending Accept calls to fail. +func (l *HvsockListener) Close() error { + return l.sock.Close() +} + +// HvsockDialer configures and dials a Hyper-V Socket (ie, [HvsockConn]). +type HvsockDialer struct { + // Deadline is the time the Dial operation must connect before erroring. + Deadline time.Time + + // Retries is the number of additional connects to try if the connection times out, is refused, + // or the host is unreachable + Retries uint + + // RetryWait is the time to wait after a connection error to retry + RetryWait time.Duration + + rt *time.Timer // redial wait timer +} + +// Dial the Hyper-V socket at addr. +// +// See [HvsockDialer.Dial] for more information. +func Dial(ctx context.Context, addr *HvsockAddr) (conn *HvsockConn, err error) { + return (&HvsockDialer{}).Dial(ctx, addr) +} + +// Dial attempts to connect to the Hyper-V socket at addr, and returns a connection if successful. +// Will attempt (HvsockDialer).Retries if dialing fails, waiting (HvsockDialer).RetryWait between +// retries. +// +// Dialing can be cancelled either by providing (HvsockDialer).Deadline, or cancelling ctx. +func (d *HvsockDialer) Dial(ctx context.Context, addr *HvsockAddr) (conn *HvsockConn, err error) { + op := "dial" + // create the conn early to use opErr() + conn = &HvsockConn{ + remote: *addr, + } + + if !d.Deadline.IsZero() { + var cancel context.CancelFunc + ctx, cancel = context.WithDeadline(ctx, d.Deadline) + defer cancel() + } + + // preemptive timeout/cancellation check + if err = ctx.Err(); err != nil { + return nil, conn.opErr(op, err) + } + + sock, err := newHVSocket() + if err != nil { + return nil, conn.opErr(op, err) + } + defer func() { + if sock != nil { + sock.Close() + } + }() + + sa := addr.raw() + err = socket.Bind(sock.handle, &sa) + if err != nil { + return nil, conn.opErr(op, os.NewSyscallError("bind", err)) + } + + c, err := sock.prepareIO() + if err != nil { + return nil, conn.opErr(op, err) + } + defer sock.wg.Done() + var bytes uint32 + for i := uint(0); i <= d.Retries; i++ { + err = socket.ConnectEx( + sock.handle, + &sa, + nil, // sendBuf + 0, // sendDataLen + &bytes, + (*windows.Overlapped)(unsafe.Pointer(&c.o))) + _, err = sock.asyncIO(c, nil, bytes, err) + if i < d.Retries && canRedial(err) { + if err = d.redialWait(ctx); err == nil { + continue + } + } + break + } + if err != nil { + return nil, conn.opErr(op, os.NewSyscallError("connectex", err)) + } + + // update the connection properties, so shutdown can be used + if err = windows.Setsockopt( + sock.handle, + windows.SOL_SOCKET, + windows.SO_UPDATE_CONNECT_CONTEXT, + nil, // optvalue + 0, // optlen + ); err != nil { + return nil, conn.opErr(op, os.NewSyscallError("setsockopt", err)) + } + + // get the local name + var sal rawHvsockAddr + err = socket.GetSockName(sock.handle, &sal) + if err != nil { + return nil, conn.opErr(op, os.NewSyscallError("getsockname", err)) + } + conn.local.fromRaw(&sal) + + // one last check for timeout, since asyncIO doesn't check the context + if err = ctx.Err(); err != nil { + return nil, conn.opErr(op, err) + } + + conn.sock = sock + sock = nil + + return conn, nil +} + +// redialWait waits before attempting to redial, resetting the timer as appropriate. +func (d *HvsockDialer) redialWait(ctx context.Context) (err error) { + if d.RetryWait == 0 { + return nil + } + + if d.rt == nil { + d.rt = time.NewTimer(d.RetryWait) + } else { + // should already be stopped and drained + d.rt.Reset(d.RetryWait) + } + + select { + case <-ctx.Done(): + case <-d.rt.C: + return nil + } + + // stop and drain the timer + if !d.rt.Stop() { + <-d.rt.C + } + return ctx.Err() +} + +// assumes error is a plain, unwrapped windows.Errno provided by direct syscall. +func canRedial(err error) bool { + //nolint:errorlint // guaranteed to be an Errno + switch err { + case windows.WSAECONNREFUSED, windows.WSAENETUNREACH, windows.WSAETIMEDOUT, + windows.ERROR_CONNECTION_REFUSED, windows.ERROR_CONNECTION_UNAVAIL: + return true + default: + return false + } +} + +func (conn *HvsockConn) opErr(op string, err error) error { + // translate from "file closed" to "socket closed" + if errors.Is(err, ErrFileClosed) { + err = socket.ErrSocketClosed + } + return &net.OpError{Op: op, Net: "hvsock", Source: &conn.local, Addr: &conn.remote, Err: err} +} + +func (conn *HvsockConn) Read(b []byte) (int, error) { + c, err := conn.sock.prepareIO() + if err != nil { + return 0, conn.opErr("read", err) + } + defer conn.sock.wg.Done() + buf := windows.WSABuf{Buf: &b[0], Len: uint32(len(b))} + var flags, bytes uint32 + err = windows.WSARecv(conn.sock.handle, &buf, 1, &bytes, &flags, &c.o, nil) + n, err := conn.sock.asyncIO(c, &conn.sock.readDeadline, bytes, err) + if err != nil { + var eno windows.Errno + if errors.As(err, &eno) { + err = os.NewSyscallError("wsarecv", eno) + } + return 0, conn.opErr("read", err) + } else if n == 0 { + err = io.EOF + } + return n, err +} + +func (conn *HvsockConn) Write(b []byte) (int, error) { + t := 0 + for len(b) != 0 { + n, err := conn.write(b) + if err != nil { + return t + n, err + } + t += n + b = b[n:] + } + return t, nil +} + +func (conn *HvsockConn) write(b []byte) (int, error) { + c, err := conn.sock.prepareIO() + if err != nil { + return 0, conn.opErr("write", err) + } + defer conn.sock.wg.Done() + buf := windows.WSABuf{Buf: &b[0], Len: uint32(len(b))} + var bytes uint32 + err = windows.WSASend(conn.sock.handle, &buf, 1, &bytes, 0, &c.o, nil) + n, err := conn.sock.asyncIO(c, &conn.sock.writeDeadline, bytes, err) + if err != nil { + var eno windows.Errno + if errors.As(err, &eno) { + err = os.NewSyscallError("wsasend", eno) + } + return 0, conn.opErr("write", err) + } + return n, err +} + +// Close closes the socket connection, failing any pending read or write calls. +func (conn *HvsockConn) Close() error { + return conn.sock.Close() +} + +func (conn *HvsockConn) IsClosed() bool { + return conn.sock.IsClosed() +} + +// shutdown disables sending or receiving on a socket. +func (conn *HvsockConn) shutdown(how int) error { + if conn.IsClosed() { + return socket.ErrSocketClosed + } + + err := windows.Shutdown(conn.sock.handle, how) + if err != nil { + // If the connection was closed, shutdowns fail with "not connected" + if errors.Is(err, windows.WSAENOTCONN) || + errors.Is(err, windows.WSAESHUTDOWN) { + err = socket.ErrSocketClosed + } + return os.NewSyscallError("shutdown", err) + } + return nil +} + +// CloseRead shuts down the read end of the socket, preventing future read operations. +func (conn *HvsockConn) CloseRead() error { + err := conn.shutdown(windows.SHUT_RD) + if err != nil { + return conn.opErr("closeread", err) + } + return nil +} + +// CloseWrite shuts down the write end of the socket, preventing future write operations and +// notifying the other endpoint that no more data will be written. +func (conn *HvsockConn) CloseWrite() error { + err := conn.shutdown(windows.SHUT_WR) + if err != nil { + return conn.opErr("closewrite", err) + } + return nil +} + +// LocalAddr returns the local address of the connection. +func (conn *HvsockConn) LocalAddr() net.Addr { + return &conn.local +} + +// RemoteAddr returns the remote address of the connection. +func (conn *HvsockConn) RemoteAddr() net.Addr { + return &conn.remote +} + +// SetDeadline implements the net.Conn SetDeadline method. +func (conn *HvsockConn) SetDeadline(t time.Time) error { + // todo: implement `SetDeadline` for `win32File` + if err := conn.SetReadDeadline(t); err != nil { + return fmt.Errorf("set read deadline: %w", err) + } + if err := conn.SetWriteDeadline(t); err != nil { + return fmt.Errorf("set write deadline: %w", err) + } + return nil +} + +// SetReadDeadline implements the net.Conn SetReadDeadline method. +func (conn *HvsockConn) SetReadDeadline(t time.Time) error { + return conn.sock.SetReadDeadline(t) +} + +// SetWriteDeadline implements the net.Conn SetWriteDeadline method. +func (conn *HvsockConn) SetWriteDeadline(t time.Time) error { + return conn.sock.SetWriteDeadline(t) +} diff --git a/vendor/github.com/Microsoft/go-winio/internal/fs/doc.go b/vendor/github.com/Microsoft/go-winio/internal/fs/doc.go new file mode 100644 index 00000000..1f653881 --- /dev/null +++ b/vendor/github.com/Microsoft/go-winio/internal/fs/doc.go @@ -0,0 +1,2 @@ +// This package contains Win32 filesystem functionality. +package fs diff --git a/vendor/github.com/Microsoft/go-winio/internal/fs/fs.go b/vendor/github.com/Microsoft/go-winio/internal/fs/fs.go new file mode 100644 index 00000000..0cd9621d --- /dev/null +++ b/vendor/github.com/Microsoft/go-winio/internal/fs/fs.go @@ -0,0 +1,262 @@ +//go:build windows + +package fs + +import ( + "golang.org/x/sys/windows" + + "github.com/Microsoft/go-winio/internal/stringbuffer" +) + +//go:generate go run github.com/Microsoft/go-winio/tools/mkwinsyscall -output zsyscall_windows.go fs.go + +// https://learn.microsoft.com/en-us/windows/win32/api/fileapi/nf-fileapi-createfilew +//sys CreateFile(name string, access AccessMask, mode FileShareMode, sa *windows.SecurityAttributes, createmode FileCreationDisposition, attrs FileFlagOrAttribute, templatefile windows.Handle) (handle windows.Handle, err error) [failretval==windows.InvalidHandle] = CreateFileW + +const NullHandle windows.Handle = 0 + +// AccessMask defines standard, specific, and generic rights. +// +// Used with CreateFile and NtCreateFile (and co.). +// +// Bitmask: +// 3 3 2 2 2 2 2 2 2 2 2 2 1 1 1 1 1 1 1 1 1 1 +// 1 0 9 8 7 6 5 4 3 2 1 0 9 8 7 6 5 4 3 2 1 0 9 8 7 6 5 4 3 2 1 0 +// +---------------+---------------+-------------------------------+ +// |G|G|G|G|Resvd|A| StandardRights| SpecificRights | +// |R|W|E|A| |S| | | +// +-+-------------+---------------+-------------------------------+ +// +// GR Generic Read +// GW Generic Write +// GE Generic Exectue +// GA Generic All +// Resvd Reserved +// AS Access Security System +// +// https://learn.microsoft.com/en-us/windows/win32/secauthz/access-mask +// +// https://learn.microsoft.com/en-us/windows/win32/secauthz/generic-access-rights +// +// https://learn.microsoft.com/en-us/windows/win32/fileio/file-access-rights-constants +type AccessMask = windows.ACCESS_MASK + +//nolint:revive // SNAKE_CASE is not idiomatic in Go, but aligned with Win32 API. +const ( + // Not actually any. + // + // For CreateFile: "query certain metadata such as file, directory, or device attributes without accessing that file or device" + // https://learn.microsoft.com/en-us/windows/win32/api/fileapi/nf-fileapi-createfilew#parameters + FILE_ANY_ACCESS AccessMask = 0 + + GENERIC_READ AccessMask = 0x8000_0000 + GENERIC_WRITE AccessMask = 0x4000_0000 + GENERIC_EXECUTE AccessMask = 0x2000_0000 + GENERIC_ALL AccessMask = 0x1000_0000 + ACCESS_SYSTEM_SECURITY AccessMask = 0x0100_0000 + + // Specific Object Access + // from ntioapi.h + + FILE_READ_DATA AccessMask = (0x0001) // file & pipe + FILE_LIST_DIRECTORY AccessMask = (0x0001) // directory + + FILE_WRITE_DATA AccessMask = (0x0002) // file & pipe + FILE_ADD_FILE AccessMask = (0x0002) // directory + + FILE_APPEND_DATA AccessMask = (0x0004) // file + FILE_ADD_SUBDIRECTORY AccessMask = (0x0004) // directory + FILE_CREATE_PIPE_INSTANCE AccessMask = (0x0004) // named pipe + + FILE_READ_EA AccessMask = (0x0008) // file & directory + FILE_READ_PROPERTIES AccessMask = FILE_READ_EA + + FILE_WRITE_EA AccessMask = (0x0010) // file & directory + FILE_WRITE_PROPERTIES AccessMask = FILE_WRITE_EA + + FILE_EXECUTE AccessMask = (0x0020) // file + FILE_TRAVERSE AccessMask = (0x0020) // directory + + FILE_DELETE_CHILD AccessMask = (0x0040) // directory + + FILE_READ_ATTRIBUTES AccessMask = (0x0080) // all + + FILE_WRITE_ATTRIBUTES AccessMask = (0x0100) // all + + FILE_ALL_ACCESS AccessMask = (STANDARD_RIGHTS_REQUIRED | SYNCHRONIZE | 0x1FF) + FILE_GENERIC_READ AccessMask = (STANDARD_RIGHTS_READ | FILE_READ_DATA | FILE_READ_ATTRIBUTES | FILE_READ_EA | SYNCHRONIZE) + FILE_GENERIC_WRITE AccessMask = (STANDARD_RIGHTS_WRITE | FILE_WRITE_DATA | FILE_WRITE_ATTRIBUTES | FILE_WRITE_EA | FILE_APPEND_DATA | SYNCHRONIZE) + FILE_GENERIC_EXECUTE AccessMask = (STANDARD_RIGHTS_EXECUTE | FILE_READ_ATTRIBUTES | FILE_EXECUTE | SYNCHRONIZE) + + SPECIFIC_RIGHTS_ALL AccessMask = 0x0000FFFF + + // Standard Access + // from ntseapi.h + + DELETE AccessMask = 0x0001_0000 + READ_CONTROL AccessMask = 0x0002_0000 + WRITE_DAC AccessMask = 0x0004_0000 + WRITE_OWNER AccessMask = 0x0008_0000 + SYNCHRONIZE AccessMask = 0x0010_0000 + + STANDARD_RIGHTS_REQUIRED AccessMask = 0x000F_0000 + + STANDARD_RIGHTS_READ AccessMask = READ_CONTROL + STANDARD_RIGHTS_WRITE AccessMask = READ_CONTROL + STANDARD_RIGHTS_EXECUTE AccessMask = READ_CONTROL + + STANDARD_RIGHTS_ALL AccessMask = 0x001F_0000 +) + +type FileShareMode uint32 + +//nolint:revive // SNAKE_CASE is not idiomatic in Go, but aligned with Win32 API. +const ( + FILE_SHARE_NONE FileShareMode = 0x00 + FILE_SHARE_READ FileShareMode = 0x01 + FILE_SHARE_WRITE FileShareMode = 0x02 + FILE_SHARE_DELETE FileShareMode = 0x04 + FILE_SHARE_VALID_FLAGS FileShareMode = 0x07 +) + +type FileCreationDisposition uint32 + +//nolint:revive // SNAKE_CASE is not idiomatic in Go, but aligned with Win32 API. +const ( + // from winbase.h + + CREATE_NEW FileCreationDisposition = 0x01 + CREATE_ALWAYS FileCreationDisposition = 0x02 + OPEN_EXISTING FileCreationDisposition = 0x03 + OPEN_ALWAYS FileCreationDisposition = 0x04 + TRUNCATE_EXISTING FileCreationDisposition = 0x05 +) + +// Create disposition values for NtCreate* +type NTFileCreationDisposition uint32 + +//nolint:revive // SNAKE_CASE is not idiomatic in Go, but aligned with Win32 API. +const ( + // From ntioapi.h + + FILE_SUPERSEDE NTFileCreationDisposition = 0x00 + FILE_OPEN NTFileCreationDisposition = 0x01 + FILE_CREATE NTFileCreationDisposition = 0x02 + FILE_OPEN_IF NTFileCreationDisposition = 0x03 + FILE_OVERWRITE NTFileCreationDisposition = 0x04 + FILE_OVERWRITE_IF NTFileCreationDisposition = 0x05 + FILE_MAXIMUM_DISPOSITION NTFileCreationDisposition = 0x05 +) + +// CreateFile and co. take flags or attributes together as one parameter. +// Define alias until we can use generics to allow both +// +// https://learn.microsoft.com/en-us/windows/win32/fileio/file-attribute-constants +type FileFlagOrAttribute uint32 + +//nolint:revive // SNAKE_CASE is not idiomatic in Go, but aligned with Win32 API. +const ( + // from winnt.h + + FILE_FLAG_WRITE_THROUGH FileFlagOrAttribute = 0x8000_0000 + FILE_FLAG_OVERLAPPED FileFlagOrAttribute = 0x4000_0000 + FILE_FLAG_NO_BUFFERING FileFlagOrAttribute = 0x2000_0000 + FILE_FLAG_RANDOM_ACCESS FileFlagOrAttribute = 0x1000_0000 + FILE_FLAG_SEQUENTIAL_SCAN FileFlagOrAttribute = 0x0800_0000 + FILE_FLAG_DELETE_ON_CLOSE FileFlagOrAttribute = 0x0400_0000 + FILE_FLAG_BACKUP_SEMANTICS FileFlagOrAttribute = 0x0200_0000 + FILE_FLAG_POSIX_SEMANTICS FileFlagOrAttribute = 0x0100_0000 + FILE_FLAG_OPEN_REPARSE_POINT FileFlagOrAttribute = 0x0020_0000 + FILE_FLAG_OPEN_NO_RECALL FileFlagOrAttribute = 0x0010_0000 + FILE_FLAG_FIRST_PIPE_INSTANCE FileFlagOrAttribute = 0x0008_0000 +) + +// NtCreate* functions take a dedicated CreateOptions parameter. +// +// https://learn.microsoft.com/en-us/windows/win32/api/Winternl/nf-winternl-ntcreatefile +// +// https://learn.microsoft.com/en-us/windows/win32/devnotes/nt-create-named-pipe-file +type NTCreateOptions uint32 + +//nolint:revive // SNAKE_CASE is not idiomatic in Go, but aligned with Win32 API. +const ( + // From ntioapi.h + + FILE_DIRECTORY_FILE NTCreateOptions = 0x0000_0001 + FILE_WRITE_THROUGH NTCreateOptions = 0x0000_0002 + FILE_SEQUENTIAL_ONLY NTCreateOptions = 0x0000_0004 + FILE_NO_INTERMEDIATE_BUFFERING NTCreateOptions = 0x0000_0008 + + FILE_SYNCHRONOUS_IO_ALERT NTCreateOptions = 0x0000_0010 + FILE_SYNCHRONOUS_IO_NONALERT NTCreateOptions = 0x0000_0020 + FILE_NON_DIRECTORY_FILE NTCreateOptions = 0x0000_0040 + FILE_CREATE_TREE_CONNECTION NTCreateOptions = 0x0000_0080 + + FILE_COMPLETE_IF_OPLOCKED NTCreateOptions = 0x0000_0100 + FILE_NO_EA_KNOWLEDGE NTCreateOptions = 0x0000_0200 + FILE_DISABLE_TUNNELING NTCreateOptions = 0x0000_0400 + FILE_RANDOM_ACCESS NTCreateOptions = 0x0000_0800 + + FILE_DELETE_ON_CLOSE NTCreateOptions = 0x0000_1000 + FILE_OPEN_BY_FILE_ID NTCreateOptions = 0x0000_2000 + FILE_OPEN_FOR_BACKUP_INTENT NTCreateOptions = 0x0000_4000 + FILE_NO_COMPRESSION NTCreateOptions = 0x0000_8000 +) + +type FileSQSFlag = FileFlagOrAttribute + +//nolint:revive // SNAKE_CASE is not idiomatic in Go, but aligned with Win32 API. +const ( + // from winbase.h + + SECURITY_ANONYMOUS FileSQSFlag = FileSQSFlag(SecurityAnonymous << 16) + SECURITY_IDENTIFICATION FileSQSFlag = FileSQSFlag(SecurityIdentification << 16) + SECURITY_IMPERSONATION FileSQSFlag = FileSQSFlag(SecurityImpersonation << 16) + SECURITY_DELEGATION FileSQSFlag = FileSQSFlag(SecurityDelegation << 16) + + SECURITY_SQOS_PRESENT FileSQSFlag = 0x0010_0000 + SECURITY_VALID_SQOS_FLAGS FileSQSFlag = 0x001F_0000 +) + +// GetFinalPathNameByHandle flags +// +// https://learn.microsoft.com/en-us/windows/win32/api/fileapi/nf-fileapi-getfinalpathnamebyhandlew#parameters +type GetFinalPathFlag uint32 + +//nolint:revive // SNAKE_CASE is not idiomatic in Go, but aligned with Win32 API. +const ( + GetFinalPathDefaultFlag GetFinalPathFlag = 0x0 + + FILE_NAME_NORMALIZED GetFinalPathFlag = 0x0 + FILE_NAME_OPENED GetFinalPathFlag = 0x8 + + VOLUME_NAME_DOS GetFinalPathFlag = 0x0 + VOLUME_NAME_GUID GetFinalPathFlag = 0x1 + VOLUME_NAME_NT GetFinalPathFlag = 0x2 + VOLUME_NAME_NONE GetFinalPathFlag = 0x4 +) + +// getFinalPathNameByHandle facilitates calling the Windows API GetFinalPathNameByHandle +// with the given handle and flags. It transparently takes care of creating a buffer of the +// correct size for the call. +// +// https://learn.microsoft.com/en-us/windows/win32/api/fileapi/nf-fileapi-getfinalpathnamebyhandlew +func GetFinalPathNameByHandle(h windows.Handle, flags GetFinalPathFlag) (string, error) { + b := stringbuffer.NewWString() + //TODO: can loop infinitely if Win32 keeps returning the same (or a larger) n? + for { + n, err := windows.GetFinalPathNameByHandle(h, b.Pointer(), b.Cap(), uint32(flags)) + if err != nil { + return "", err + } + // If the buffer wasn't large enough, n will be the total size needed (including null terminator). + // Resize and try again. + if n > b.Cap() { + b.ResizeTo(n) + continue + } + // If the buffer is large enough, n will be the size not including the null terminator. + // Convert to a Go string and return. + return b.String(), nil + } +} diff --git a/vendor/github.com/Microsoft/go-winio/internal/fs/security.go b/vendor/github.com/Microsoft/go-winio/internal/fs/security.go new file mode 100644 index 00000000..81760ac6 --- /dev/null +++ b/vendor/github.com/Microsoft/go-winio/internal/fs/security.go @@ -0,0 +1,12 @@ +package fs + +// https://learn.microsoft.com/en-us/windows/win32/api/winnt/ne-winnt-security_impersonation_level +type SecurityImpersonationLevel int32 // C default enums underlying type is `int`, which is Go `int32` + +// Impersonation levels +const ( + SecurityAnonymous SecurityImpersonationLevel = 0 + SecurityIdentification SecurityImpersonationLevel = 1 + SecurityImpersonation SecurityImpersonationLevel = 2 + SecurityDelegation SecurityImpersonationLevel = 3 +) diff --git a/vendor/github.com/Microsoft/go-winio/internal/fs/zsyscall_windows.go b/vendor/github.com/Microsoft/go-winio/internal/fs/zsyscall_windows.go new file mode 100644 index 00000000..a94e234c --- /dev/null +++ b/vendor/github.com/Microsoft/go-winio/internal/fs/zsyscall_windows.go @@ -0,0 +1,61 @@ +//go:build windows + +// Code generated by 'go generate' using "github.com/Microsoft/go-winio/tools/mkwinsyscall"; DO NOT EDIT. + +package fs + +import ( + "syscall" + "unsafe" + + "golang.org/x/sys/windows" +) + +var _ unsafe.Pointer + +// Do the interface allocations only once for common +// Errno values. +const ( + errnoERROR_IO_PENDING = 997 +) + +var ( + errERROR_IO_PENDING error = syscall.Errno(errnoERROR_IO_PENDING) + errERROR_EINVAL error = syscall.EINVAL +) + +// errnoErr returns common boxed Errno values, to prevent +// allocations at runtime. +func errnoErr(e syscall.Errno) error { + switch e { + case 0: + return errERROR_EINVAL + case errnoERROR_IO_PENDING: + return errERROR_IO_PENDING + } + return e +} + +var ( + modkernel32 = windows.NewLazySystemDLL("kernel32.dll") + + procCreateFileW = modkernel32.NewProc("CreateFileW") +) + +func CreateFile(name string, access AccessMask, mode FileShareMode, sa *windows.SecurityAttributes, createmode FileCreationDisposition, attrs FileFlagOrAttribute, templatefile windows.Handle) (handle windows.Handle, err error) { + var _p0 *uint16 + _p0, err = syscall.UTF16PtrFromString(name) + if err != nil { + return + } + return _CreateFile(_p0, access, mode, sa, createmode, attrs, templatefile) +} + +func _CreateFile(name *uint16, access AccessMask, mode FileShareMode, sa *windows.SecurityAttributes, createmode FileCreationDisposition, attrs FileFlagOrAttribute, templatefile windows.Handle) (handle windows.Handle, err error) { + r0, _, e1 := syscall.SyscallN(procCreateFileW.Addr(), uintptr(unsafe.Pointer(name)), uintptr(access), uintptr(mode), uintptr(unsafe.Pointer(sa)), uintptr(createmode), uintptr(attrs), uintptr(templatefile)) + handle = windows.Handle(r0) + if handle == windows.InvalidHandle { + err = errnoErr(e1) + } + return +} diff --git a/vendor/github.com/Microsoft/go-winio/internal/socket/rawaddr.go b/vendor/github.com/Microsoft/go-winio/internal/socket/rawaddr.go new file mode 100644 index 00000000..7e82f9af --- /dev/null +++ b/vendor/github.com/Microsoft/go-winio/internal/socket/rawaddr.go @@ -0,0 +1,20 @@ +package socket + +import ( + "unsafe" +) + +// RawSockaddr allows structs to be used with [Bind] and [ConnectEx]. The +// struct must meet the Win32 sockaddr requirements specified here: +// https://docs.microsoft.com/en-us/windows/win32/winsock/sockaddr-2 +// +// Specifically, the struct size must be least larger than an int16 (unsigned short) +// for the address family. +type RawSockaddr interface { + // Sockaddr returns a pointer to the RawSockaddr and its struct size, allowing + // for the RawSockaddr's data to be overwritten by syscalls (if necessary). + // + // It is the callers responsibility to validate that the values are valid; invalid + // pointers or size can cause a panic. + Sockaddr() (unsafe.Pointer, int32, error) +} diff --git a/vendor/github.com/Microsoft/go-winio/internal/socket/socket.go b/vendor/github.com/Microsoft/go-winio/internal/socket/socket.go new file mode 100644 index 00000000..88580d97 --- /dev/null +++ b/vendor/github.com/Microsoft/go-winio/internal/socket/socket.go @@ -0,0 +1,177 @@ +//go:build windows + +package socket + +import ( + "errors" + "fmt" + "net" + "sync" + "syscall" + "unsafe" + + "github.com/Microsoft/go-winio/pkg/guid" + "golang.org/x/sys/windows" +) + +//go:generate go run github.com/Microsoft/go-winio/tools/mkwinsyscall -output zsyscall_windows.go socket.go + +//sys getsockname(s windows.Handle, name unsafe.Pointer, namelen *int32) (err error) [failretval==socketError] = ws2_32.getsockname +//sys getpeername(s windows.Handle, name unsafe.Pointer, namelen *int32) (err error) [failretval==socketError] = ws2_32.getpeername +//sys bind(s windows.Handle, name unsafe.Pointer, namelen int32) (err error) [failretval==socketError] = ws2_32.bind + +const socketError = uintptr(^uint32(0)) + +var ( + // todo(helsaawy): create custom error types to store the desired vs actual size and addr family? + + ErrBufferSize = errors.New("buffer size") + ErrAddrFamily = errors.New("address family") + ErrInvalidPointer = errors.New("invalid pointer") + ErrSocketClosed = fmt.Errorf("socket closed: %w", net.ErrClosed) +) + +// todo(helsaawy): replace these with generics, ie: GetSockName[S RawSockaddr](s windows.Handle) (S, error) + +// GetSockName writes the local address of socket s to the [RawSockaddr] rsa. +// If rsa is not large enough, the [windows.WSAEFAULT] is returned. +func GetSockName(s windows.Handle, rsa RawSockaddr) error { + ptr, l, err := rsa.Sockaddr() + if err != nil { + return fmt.Errorf("could not retrieve socket pointer and size: %w", err) + } + + // although getsockname returns WSAEFAULT if the buffer is too small, it does not set + // &l to the correct size, so--apart from doubling the buffer repeatedly--there is no remedy + return getsockname(s, ptr, &l) +} + +// GetPeerName returns the remote address the socket is connected to. +// +// See [GetSockName] for more information. +func GetPeerName(s windows.Handle, rsa RawSockaddr) error { + ptr, l, err := rsa.Sockaddr() + if err != nil { + return fmt.Errorf("could not retrieve socket pointer and size: %w", err) + } + + return getpeername(s, ptr, &l) +} + +func Bind(s windows.Handle, rsa RawSockaddr) (err error) { + ptr, l, err := rsa.Sockaddr() + if err != nil { + return fmt.Errorf("could not retrieve socket pointer and size: %w", err) + } + + return bind(s, ptr, l) +} + +// "golang.org/x/sys/windows".ConnectEx and .Bind only accept internal implementations of the +// their sockaddr interface, so they cannot be used with HvsockAddr +// Replicate functionality here from +// https://cs.opensource.google/go/x/sys/+/master:windows/syscall_windows.go + +// The function pointers to `AcceptEx`, `ConnectEx` and `GetAcceptExSockaddrs` must be loaded at +// runtime via a WSAIoctl call: +// https://docs.microsoft.com/en-us/windows/win32/api/Mswsock/nc-mswsock-lpfn_connectex#remarks + +type runtimeFunc struct { + id guid.GUID + once sync.Once + addr uintptr + err error +} + +func (f *runtimeFunc) Load() error { + f.once.Do(func() { + var s windows.Handle + s, f.err = windows.Socket(windows.AF_INET, windows.SOCK_STREAM, windows.IPPROTO_TCP) + if f.err != nil { + return + } + defer windows.CloseHandle(s) //nolint:errcheck + + var n uint32 + f.err = windows.WSAIoctl(s, + windows.SIO_GET_EXTENSION_FUNCTION_POINTER, + (*byte)(unsafe.Pointer(&f.id)), + uint32(unsafe.Sizeof(f.id)), + (*byte)(unsafe.Pointer(&f.addr)), + uint32(unsafe.Sizeof(f.addr)), + &n, + nil, // overlapped + 0, // completionRoutine + ) + }) + return f.err +} + +var ( + // todo: add `AcceptEx` and `GetAcceptExSockaddrs` + WSAID_CONNECTEX = guid.GUID{ //revive:disable-line:var-naming ALL_CAPS + Data1: 0x25a207b9, + Data2: 0xddf3, + Data3: 0x4660, + Data4: [8]byte{0x8e, 0xe9, 0x76, 0xe5, 0x8c, 0x74, 0x06, 0x3e}, + } + + connectExFunc = runtimeFunc{id: WSAID_CONNECTEX} +) + +func ConnectEx( + fd windows.Handle, + rsa RawSockaddr, + sendBuf *byte, + sendDataLen uint32, + bytesSent *uint32, + overlapped *windows.Overlapped, +) error { + if err := connectExFunc.Load(); err != nil { + return fmt.Errorf("failed to load ConnectEx function pointer: %w", err) + } + ptr, n, err := rsa.Sockaddr() + if err != nil { + return err + } + return connectEx(fd, ptr, n, sendBuf, sendDataLen, bytesSent, overlapped) +} + +// BOOL LpfnConnectex( +// [in] SOCKET s, +// [in] const sockaddr *name, +// [in] int namelen, +// [in, optional] PVOID lpSendBuffer, +// [in] DWORD dwSendDataLength, +// [out] LPDWORD lpdwBytesSent, +// [in] LPOVERLAPPED lpOverlapped +// ) + +func connectEx( + s windows.Handle, + name unsafe.Pointer, + namelen int32, + sendBuf *byte, + sendDataLen uint32, + bytesSent *uint32, + overlapped *windows.Overlapped, +) (err error) { + r1, _, e1 := syscall.SyscallN(connectExFunc.addr, + uintptr(s), + uintptr(name), + uintptr(namelen), + uintptr(unsafe.Pointer(sendBuf)), + uintptr(sendDataLen), + uintptr(unsafe.Pointer(bytesSent)), + uintptr(unsafe.Pointer(overlapped)), + ) + + if r1 == 0 { + if e1 != 0 { + err = error(e1) + } else { + err = syscall.EINVAL + } + } + return err +} diff --git a/vendor/github.com/Microsoft/go-winio/internal/socket/zsyscall_windows.go b/vendor/github.com/Microsoft/go-winio/internal/socket/zsyscall_windows.go new file mode 100644 index 00000000..e1504126 --- /dev/null +++ b/vendor/github.com/Microsoft/go-winio/internal/socket/zsyscall_windows.go @@ -0,0 +1,69 @@ +//go:build windows + +// Code generated by 'go generate' using "github.com/Microsoft/go-winio/tools/mkwinsyscall"; DO NOT EDIT. + +package socket + +import ( + "syscall" + "unsafe" + + "golang.org/x/sys/windows" +) + +var _ unsafe.Pointer + +// Do the interface allocations only once for common +// Errno values. +const ( + errnoERROR_IO_PENDING = 997 +) + +var ( + errERROR_IO_PENDING error = syscall.Errno(errnoERROR_IO_PENDING) + errERROR_EINVAL error = syscall.EINVAL +) + +// errnoErr returns common boxed Errno values, to prevent +// allocations at runtime. +func errnoErr(e syscall.Errno) error { + switch e { + case 0: + return errERROR_EINVAL + case errnoERROR_IO_PENDING: + return errERROR_IO_PENDING + } + return e +} + +var ( + modws2_32 = windows.NewLazySystemDLL("ws2_32.dll") + + procbind = modws2_32.NewProc("bind") + procgetpeername = modws2_32.NewProc("getpeername") + procgetsockname = modws2_32.NewProc("getsockname") +) + +func bind(s windows.Handle, name unsafe.Pointer, namelen int32) (err error) { + r1, _, e1 := syscall.SyscallN(procbind.Addr(), uintptr(s), uintptr(name), uintptr(namelen)) + if r1 == socketError { + err = errnoErr(e1) + } + return +} + +func getpeername(s windows.Handle, name unsafe.Pointer, namelen *int32) (err error) { + r1, _, e1 := syscall.SyscallN(procgetpeername.Addr(), uintptr(s), uintptr(name), uintptr(unsafe.Pointer(namelen))) + if r1 == socketError { + err = errnoErr(e1) + } + return +} + +func getsockname(s windows.Handle, name unsafe.Pointer, namelen *int32) (err error) { + r1, _, e1 := syscall.SyscallN(procgetsockname.Addr(), uintptr(s), uintptr(name), uintptr(unsafe.Pointer(namelen))) + if r1 == socketError { + err = errnoErr(e1) + } + return +} diff --git a/vendor/github.com/Microsoft/go-winio/internal/stringbuffer/wstring.go b/vendor/github.com/Microsoft/go-winio/internal/stringbuffer/wstring.go new file mode 100644 index 00000000..42ebc019 --- /dev/null +++ b/vendor/github.com/Microsoft/go-winio/internal/stringbuffer/wstring.go @@ -0,0 +1,132 @@ +package stringbuffer + +import ( + "sync" + "unicode/utf16" +) + +// TODO: worth exporting and using in mkwinsyscall? + +// Uint16BufferSize is the buffer size in the pool, chosen somewhat arbitrarily to accommodate +// large path strings: +// MAX_PATH (260) + size of volume GUID prefix (49) + null terminator = 310. +const MinWStringCap = 310 + +// use *[]uint16 since []uint16 creates an extra allocation where the slice header +// is copied to heap and then referenced via pointer in the interface header that sync.Pool +// stores. +var pathPool = sync.Pool{ // if go1.18+ adds Pool[T], use that to store []uint16 directly + New: func() interface{} { + b := make([]uint16, MinWStringCap) + return &b + }, +} + +func newBuffer() []uint16 { return *(pathPool.Get().(*[]uint16)) } + +// freeBuffer copies the slice header data, and puts a pointer to that in the pool. +// This avoids taking a pointer to the slice header in WString, which can be set to nil. +func freeBuffer(b []uint16) { pathPool.Put(&b) } + +// WString is a wide string buffer ([]uint16) meant for storing UTF-16 encoded strings +// for interacting with Win32 APIs. +// Sizes are specified as uint32 and not int. +// +// It is not thread safe. +type WString struct { + // type-def allows casting to []uint16 directly, use struct to prevent that and allow adding fields in the future. + + // raw buffer + b []uint16 +} + +// NewWString returns a [WString] allocated from a shared pool with an +// initial capacity of at least [MinWStringCap]. +// Since the buffer may have been previously used, its contents are not guaranteed to be empty. +// +// The buffer should be freed via [WString.Free] +func NewWString() *WString { + return &WString{ + b: newBuffer(), + } +} + +func (b *WString) Free() { + if b.empty() { + return + } + freeBuffer(b.b) + b.b = nil +} + +// ResizeTo grows the buffer to at least c and returns the new capacity, freeing the +// previous buffer back into pool. +func (b *WString) ResizeTo(c uint32) uint32 { + // already sufficient (or n is 0) + if c <= b.Cap() { + return b.Cap() + } + + if c <= MinWStringCap { + c = MinWStringCap + } + // allocate at-least double buffer size, as is done in [bytes.Buffer] and other places + if c <= 2*b.Cap() { + c = 2 * b.Cap() + } + + b2 := make([]uint16, c) + if !b.empty() { + copy(b2, b.b) + freeBuffer(b.b) + } + b.b = b2 + return c +} + +// Buffer returns the underlying []uint16 buffer. +func (b *WString) Buffer() []uint16 { + if b.empty() { + return nil + } + return b.b +} + +// Pointer returns a pointer to the first uint16 in the buffer. +// If the [WString.Free] has already been called, the pointer will be nil. +func (b *WString) Pointer() *uint16 { + if b.empty() { + return nil + } + return &b.b[0] +} + +// String returns the returns the UTF-8 encoding of the UTF-16 string in the buffer. +// +// It assumes that the data is null-terminated. +func (b *WString) String() string { + // Using [windows.UTF16ToString] would require importing "golang.org/x/sys/windows" + // and would make this code Windows-only, which makes no sense. + // So copy UTF16ToString code into here. + // If other windows-specific code is added, switch to [windows.UTF16ToString] + + s := b.b + for i, v := range s { + if v == 0 { + s = s[:i] + break + } + } + return string(utf16.Decode(s)) +} + +// Cap returns the underlying buffer capacity. +func (b *WString) Cap() uint32 { + if b.empty() { + return 0 + } + return b.cap() +} + +func (b *WString) cap() uint32 { return uint32(cap(b.b)) } +func (b *WString) empty() bool { return b == nil || b.cap() == 0 } diff --git a/vendor/github.com/Microsoft/go-winio/pipe.go b/vendor/github.com/Microsoft/go-winio/pipe.go new file mode 100644 index 00000000..a2da6639 --- /dev/null +++ b/vendor/github.com/Microsoft/go-winio/pipe.go @@ -0,0 +1,586 @@ +//go:build windows +// +build windows + +package winio + +import ( + "context" + "errors" + "fmt" + "io" + "net" + "os" + "runtime" + "time" + "unsafe" + + "golang.org/x/sys/windows" + + "github.com/Microsoft/go-winio/internal/fs" +) + +//sys connectNamedPipe(pipe windows.Handle, o *windows.Overlapped) (err error) = ConnectNamedPipe +//sys createNamedPipe(name string, flags uint32, pipeMode uint32, maxInstances uint32, outSize uint32, inSize uint32, defaultTimeout uint32, sa *windows.SecurityAttributes) (handle windows.Handle, err error) [failretval==windows.InvalidHandle] = CreateNamedPipeW +//sys disconnectNamedPipe(pipe windows.Handle) (err error) = DisconnectNamedPipe +//sys getNamedPipeInfo(pipe windows.Handle, flags *uint32, outSize *uint32, inSize *uint32, maxInstances *uint32) (err error) = GetNamedPipeInfo +//sys getNamedPipeHandleState(pipe windows.Handle, state *uint32, curInstances *uint32, maxCollectionCount *uint32, collectDataTimeout *uint32, userName *uint16, maxUserNameSize uint32) (err error) = GetNamedPipeHandleStateW +//sys ntCreateNamedPipeFile(pipe *windows.Handle, access ntAccessMask, oa *objectAttributes, iosb *ioStatusBlock, share ntFileShareMode, disposition ntFileCreationDisposition, options ntFileOptions, typ uint32, readMode uint32, completionMode uint32, maxInstances uint32, inboundQuota uint32, outputQuota uint32, timeout *int64) (status ntStatus) = ntdll.NtCreateNamedPipeFile +//sys rtlNtStatusToDosError(status ntStatus) (winerr error) = ntdll.RtlNtStatusToDosErrorNoTeb +//sys rtlDosPathNameToNtPathName(name *uint16, ntName *unicodeString, filePart uintptr, reserved uintptr) (status ntStatus) = ntdll.RtlDosPathNameToNtPathName_U +//sys rtlDefaultNpAcl(dacl *uintptr) (status ntStatus) = ntdll.RtlDefaultNpAcl + +type PipeConn interface { + net.Conn + Disconnect() error + Flush() error +} + +// type aliases for mkwinsyscall code +type ( + ntAccessMask = fs.AccessMask + ntFileShareMode = fs.FileShareMode + ntFileCreationDisposition = fs.NTFileCreationDisposition + ntFileOptions = fs.NTCreateOptions +) + +type ioStatusBlock struct { + Status, Information uintptr +} + +// typedef struct _OBJECT_ATTRIBUTES { +// ULONG Length; +// HANDLE RootDirectory; +// PUNICODE_STRING ObjectName; +// ULONG Attributes; +// PVOID SecurityDescriptor; +// PVOID SecurityQualityOfService; +// } OBJECT_ATTRIBUTES; +// +// https://learn.microsoft.com/en-us/windows/win32/api/ntdef/ns-ntdef-_object_attributes +type objectAttributes struct { + Length uintptr + RootDirectory uintptr + ObjectName *unicodeString + Attributes uintptr + SecurityDescriptor *securityDescriptor + SecurityQoS uintptr +} + +type unicodeString struct { + Length uint16 + MaximumLength uint16 + Buffer uintptr +} + +// typedef struct _SECURITY_DESCRIPTOR { +// BYTE Revision; +// BYTE Sbz1; +// SECURITY_DESCRIPTOR_CONTROL Control; +// PSID Owner; +// PSID Group; +// PACL Sacl; +// PACL Dacl; +// } SECURITY_DESCRIPTOR, *PISECURITY_DESCRIPTOR; +// +// https://learn.microsoft.com/en-us/windows/win32/api/winnt/ns-winnt-security_descriptor +type securityDescriptor struct { + Revision byte + Sbz1 byte + Control uint16 + Owner uintptr + Group uintptr + Sacl uintptr //revive:disable-line:var-naming SACL, not Sacl + Dacl uintptr //revive:disable-line:var-naming DACL, not Dacl +} + +type ntStatus int32 + +func (status ntStatus) Err() error { + if status >= 0 { + return nil + } + return rtlNtStatusToDosError(status) +} + +var ( + // ErrPipeListenerClosed is returned for pipe operations on listeners that have been closed. + ErrPipeListenerClosed = net.ErrClosed + + errPipeWriteClosed = errors.New("pipe has been closed for write") +) + +type win32Pipe struct { + *win32File + path string +} + +var _ PipeConn = (*win32Pipe)(nil) + +type win32MessageBytePipe struct { + win32Pipe + writeClosed bool + readEOF bool +} + +type pipeAddress string + +func (f *win32Pipe) LocalAddr() net.Addr { + return pipeAddress(f.path) +} + +func (f *win32Pipe) RemoteAddr() net.Addr { + return pipeAddress(f.path) +} + +func (f *win32Pipe) SetDeadline(t time.Time) error { + if err := f.SetReadDeadline(t); err != nil { + return err + } + return f.SetWriteDeadline(t) +} + +func (f *win32Pipe) Disconnect() error { + return disconnectNamedPipe(f.win32File.handle) +} + +// CloseWrite closes the write side of a message pipe in byte mode. +func (f *win32MessageBytePipe) CloseWrite() error { + if f.writeClosed { + return errPipeWriteClosed + } + err := f.win32File.Flush() + if err != nil { + return err + } + _, err = f.win32File.Write(nil) + if err != nil { + return err + } + f.writeClosed = true + return nil +} + +// Write writes bytes to a message pipe in byte mode. Zero-byte writes are ignored, since +// they are used to implement CloseWrite(). +func (f *win32MessageBytePipe) Write(b []byte) (int, error) { + if f.writeClosed { + return 0, errPipeWriteClosed + } + if len(b) == 0 { + return 0, nil + } + return f.win32File.Write(b) +} + +// Read reads bytes from a message pipe in byte mode. A read of a zero-byte message on a message +// mode pipe will return io.EOF, as will all subsequent reads. +func (f *win32MessageBytePipe) Read(b []byte) (int, error) { + if f.readEOF { + return 0, io.EOF + } + n, err := f.win32File.Read(b) + if err == io.EOF { //nolint:errorlint + // If this was the result of a zero-byte read, then + // it is possible that the read was due to a zero-size + // message. Since we are simulating CloseWrite with a + // zero-byte message, ensure that all future Read() calls + // also return EOF. + f.readEOF = true + } else if err == windows.ERROR_MORE_DATA { //nolint:errorlint // err is Errno + // ERROR_MORE_DATA indicates that the pipe's read mode is message mode + // and the message still has more bytes. Treat this as a success, since + // this package presents all named pipes as byte streams. + err = nil + } + return n, err +} + +func (pipeAddress) Network() string { + return "pipe" +} + +func (s pipeAddress) String() string { + return string(s) +} + +// tryDialPipe attempts to dial the pipe at `path` until `ctx` cancellation or timeout. +func tryDialPipe(ctx context.Context, path *string, access fs.AccessMask, impLevel PipeImpLevel) (windows.Handle, error) { + for { + select { + case <-ctx.Done(): + return windows.Handle(0), ctx.Err() + default: + h, err := fs.CreateFile(*path, + access, + 0, // mode + nil, // security attributes + fs.OPEN_EXISTING, + fs.FILE_FLAG_OVERLAPPED|fs.SECURITY_SQOS_PRESENT|fs.FileSQSFlag(impLevel), + 0, // template file handle + ) + if err == nil { + return h, nil + } + if err != windows.ERROR_PIPE_BUSY { //nolint:errorlint // err is Errno + return h, &os.PathError{Err: err, Op: "open", Path: *path} + } + // Wait 10 msec and try again. This is a rather simplistic + // view, as we always try each 10 milliseconds. + time.Sleep(10 * time.Millisecond) + } + } +} + +// DialPipe connects to a named pipe by path, timing out if the connection +// takes longer than the specified duration. If timeout is nil, then we use +// a default timeout of 2 seconds. (We do not use WaitNamedPipe.) +func DialPipe(path string, timeout *time.Duration) (net.Conn, error) { + var absTimeout time.Time + if timeout != nil { + absTimeout = time.Now().Add(*timeout) + } else { + absTimeout = time.Now().Add(2 * time.Second) + } + ctx, cancel := context.WithDeadline(context.Background(), absTimeout) + defer cancel() + conn, err := DialPipeContext(ctx, path) + if errors.Is(err, context.DeadlineExceeded) { + return nil, ErrTimeout + } + return conn, err +} + +// DialPipeContext attempts to connect to a named pipe by `path` until `ctx` +// cancellation or timeout. +func DialPipeContext(ctx context.Context, path string) (net.Conn, error) { + return DialPipeAccess(ctx, path, uint32(fs.GENERIC_READ|fs.GENERIC_WRITE)) +} + +// PipeImpLevel is an enumeration of impersonation levels that may be set +// when calling DialPipeAccessImpersonation. +type PipeImpLevel uint32 + +const ( + PipeImpLevelAnonymous = PipeImpLevel(fs.SECURITY_ANONYMOUS) + PipeImpLevelIdentification = PipeImpLevel(fs.SECURITY_IDENTIFICATION) + PipeImpLevelImpersonation = PipeImpLevel(fs.SECURITY_IMPERSONATION) + PipeImpLevelDelegation = PipeImpLevel(fs.SECURITY_DELEGATION) +) + +// DialPipeAccess attempts to connect to a named pipe by `path` with `access` until `ctx` +// cancellation or timeout. +func DialPipeAccess(ctx context.Context, path string, access uint32) (net.Conn, error) { + return DialPipeAccessImpLevel(ctx, path, access, PipeImpLevelAnonymous) +} + +// DialPipeAccessImpLevel attempts to connect to a named pipe by `path` with +// `access` at `impLevel` until `ctx` cancellation or timeout. The other +// DialPipe* implementations use PipeImpLevelAnonymous. +func DialPipeAccessImpLevel(ctx context.Context, path string, access uint32, impLevel PipeImpLevel) (net.Conn, error) { + var err error + var h windows.Handle + h, err = tryDialPipe(ctx, &path, fs.AccessMask(access), impLevel) + if err != nil { + return nil, err + } + + var flags uint32 + err = getNamedPipeInfo(h, &flags, nil, nil, nil) + if err != nil { + return nil, err + } + + f, err := makeWin32File(h) + if err != nil { + windows.Close(h) + return nil, err + } + + // If the pipe is in message mode, return a message byte pipe, which + // supports CloseWrite(). + if flags&windows.PIPE_TYPE_MESSAGE != 0 { + return &win32MessageBytePipe{ + win32Pipe: win32Pipe{win32File: f, path: path}, + }, nil + } + return &win32Pipe{win32File: f, path: path}, nil +} + +type acceptResponse struct { + f *win32File + err error +} + +type win32PipeListener struct { + firstHandle windows.Handle + path string + config PipeConfig + acceptCh chan (chan acceptResponse) + closeCh chan int + doneCh chan int +} + +func makeServerPipeHandle(path string, sd []byte, c *PipeConfig, first bool) (windows.Handle, error) { + path16, err := windows.UTF16FromString(path) + if err != nil { + return 0, &os.PathError{Op: "open", Path: path, Err: err} + } + + var oa objectAttributes + oa.Length = unsafe.Sizeof(oa) + + var ntPath unicodeString + if err := rtlDosPathNameToNtPathName(&path16[0], + &ntPath, + 0, + 0, + ).Err(); err != nil { + return 0, &os.PathError{Op: "open", Path: path, Err: err} + } + defer windows.LocalFree(windows.Handle(ntPath.Buffer)) //nolint:errcheck + oa.ObjectName = &ntPath + oa.Attributes = windows.OBJ_CASE_INSENSITIVE + + // The security descriptor is only needed for the first pipe. + if first { + if sd != nil { + //todo: does `sdb` need to be allocated on the heap, or can go allocate it? + l := uint32(len(sd)) + sdb, err := windows.LocalAlloc(0, l) + if err != nil { + return 0, fmt.Errorf("LocalAlloc for security descriptor with of length %d: %w", l, err) + } + defer windows.LocalFree(windows.Handle(sdb)) //nolint:errcheck + copy((*[0xffff]byte)(unsafe.Pointer(sdb))[:], sd) + oa.SecurityDescriptor = (*securityDescriptor)(unsafe.Pointer(sdb)) + } else { + // Construct the default named pipe security descriptor. + var dacl uintptr + if err := rtlDefaultNpAcl(&dacl).Err(); err != nil { + return 0, fmt.Errorf("getting default named pipe ACL: %w", err) + } + defer windows.LocalFree(windows.Handle(dacl)) //nolint:errcheck + + sdb := &securityDescriptor{ + Revision: 1, + Control: windows.SE_DACL_PRESENT, + Dacl: dacl, + } + oa.SecurityDescriptor = sdb + } + } + + typ := uint32(windows.FILE_PIPE_REJECT_REMOTE_CLIENTS) + if c.MessageMode { + typ |= windows.FILE_PIPE_MESSAGE_TYPE + } + + disposition := fs.FILE_OPEN + access := fs.GENERIC_READ | fs.GENERIC_WRITE | fs.SYNCHRONIZE + if first { + disposition = fs.FILE_CREATE + // By not asking for read or write access, the named pipe file system + // will put this pipe into an initially disconnected state, blocking + // client connections until the next call with first == false. + access = fs.SYNCHRONIZE + } + + timeout := int64(-50 * 10000) // 50ms + + var ( + h windows.Handle + iosb ioStatusBlock + ) + err = ntCreateNamedPipeFile(&h, + access, + &oa, + &iosb, + fs.FILE_SHARE_READ|fs.FILE_SHARE_WRITE, + disposition, + 0, + typ, + 0, + 0, + 0xffffffff, + uint32(c.InputBufferSize), + uint32(c.OutputBufferSize), + &timeout).Err() + if err != nil { + return 0, &os.PathError{Op: "open", Path: path, Err: err} + } + + runtime.KeepAlive(ntPath) + return h, nil +} + +func (l *win32PipeListener) makeServerPipe() (*win32File, error) { + h, err := makeServerPipeHandle(l.path, nil, &l.config, false) + if err != nil { + return nil, err + } + f, err := makeWin32File(h) + if err != nil { + windows.Close(h) + return nil, err + } + return f, nil +} + +func (l *win32PipeListener) makeConnectedServerPipe() (*win32File, error) { + p, err := l.makeServerPipe() + if err != nil { + return nil, err + } + + // Wait for the client to connect. + ch := make(chan error) + go func(p *win32File) { + ch <- connectPipe(p) + }(p) + + select { + case err = <-ch: + if err != nil { + p.Close() + p = nil + } + case <-l.closeCh: + // Abort the connect request by closing the handle. + p.Close() + p = nil + err = <-ch + if err == nil || err == ErrFileClosed { //nolint:errorlint // err is Errno + err = ErrPipeListenerClosed + } + } + return p, err +} + +func (l *win32PipeListener) listenerRoutine() { + closed := false + for !closed { + select { + case <-l.closeCh: + closed = true + case responseCh := <-l.acceptCh: + var ( + p *win32File + err error + ) + for { + p, err = l.makeConnectedServerPipe() + // If the connection was immediately closed by the client, try + // again. + if err != windows.ERROR_NO_DATA { //nolint:errorlint // err is Errno + break + } + } + responseCh <- acceptResponse{p, err} + closed = err == ErrPipeListenerClosed //nolint:errorlint // err is Errno + } + } + windows.Close(l.firstHandle) + l.firstHandle = 0 + // Notify Close() and Accept() callers that the handle has been closed. + close(l.doneCh) +} + +// PipeConfig contain configuration for the pipe listener. +type PipeConfig struct { + // SecurityDescriptor contains a Windows security descriptor in SDDL format. + SecurityDescriptor string + + // MessageMode determines whether the pipe is in byte or message mode. In either + // case the pipe is read in byte mode by default. The only practical difference in + // this implementation is that CloseWrite() is only supported for message mode pipes; + // CloseWrite() is implemented as a zero-byte write, but zero-byte writes are only + // transferred to the reader (and returned as io.EOF in this implementation) + // when the pipe is in message mode. + MessageMode bool + + // InputBufferSize specifies the size of the input buffer, in bytes. + InputBufferSize int32 + + // OutputBufferSize specifies the size of the output buffer, in bytes. + OutputBufferSize int32 +} + +// ListenPipe creates a listener on a Windows named pipe path, e.g. \\.\pipe\mypipe. +// The pipe must not already exist. +func ListenPipe(path string, c *PipeConfig) (net.Listener, error) { + var ( + sd []byte + err error + ) + if c == nil { + c = &PipeConfig{} + } + if c.SecurityDescriptor != "" { + sd, err = SddlToSecurityDescriptor(c.SecurityDescriptor) + if err != nil { + return nil, err + } + } + h, err := makeServerPipeHandle(path, sd, c, true) + if err != nil { + return nil, err + } + l := &win32PipeListener{ + firstHandle: h, + path: path, + config: *c, + acceptCh: make(chan (chan acceptResponse)), + closeCh: make(chan int), + doneCh: make(chan int), + } + go l.listenerRoutine() + return l, nil +} + +func connectPipe(p *win32File) error { + c, err := p.prepareIO() + if err != nil { + return err + } + defer p.wg.Done() + + err = connectNamedPipe(p.handle, &c.o) + _, err = p.asyncIO(c, nil, 0, err) + if err != nil && err != windows.ERROR_PIPE_CONNECTED { //nolint:errorlint // err is Errno + return err + } + return nil +} + +func (l *win32PipeListener) Accept() (net.Conn, error) { + ch := make(chan acceptResponse) + select { + case l.acceptCh <- ch: + response := <-ch + err := response.err + if err != nil { + return nil, err + } + if l.config.MessageMode { + return &win32MessageBytePipe{ + win32Pipe: win32Pipe{win32File: response.f, path: l.path}, + }, nil + } + return &win32Pipe{win32File: response.f, path: l.path}, nil + case <-l.doneCh: + return nil, ErrPipeListenerClosed + } +} + +func (l *win32PipeListener) Close() error { + select { + case l.closeCh <- 1: + <-l.doneCh + case <-l.doneCh: + } + return nil +} + +func (l *win32PipeListener) Addr() net.Addr { + return pipeAddress(l.path) +} diff --git a/vendor/github.com/Microsoft/go-winio/pkg/guid/guid.go b/vendor/github.com/Microsoft/go-winio/pkg/guid/guid.go new file mode 100644 index 00000000..48ce4e92 --- /dev/null +++ b/vendor/github.com/Microsoft/go-winio/pkg/guid/guid.go @@ -0,0 +1,232 @@ +// Package guid provides a GUID type. The backing structure for a GUID is +// identical to that used by the golang.org/x/sys/windows GUID type. +// There are two main binary encodings used for a GUID, the big-endian encoding, +// and the Windows (mixed-endian) encoding. See here for details: +// https://en.wikipedia.org/wiki/Universally_unique_identifier#Encoding +package guid + +import ( + "crypto/rand" + "crypto/sha1" //nolint:gosec // not used for secure application + "encoding" + "encoding/binary" + "fmt" + "strconv" +) + +//go:generate go run golang.org/x/tools/cmd/stringer -type=Variant -trimprefix=Variant -linecomment + +// Variant specifies which GUID variant (or "type") of the GUID. It determines +// how the entirety of the rest of the GUID is interpreted. +type Variant uint8 + +// The variants specified by RFC 4122 section 4.1.1. +const ( + // VariantUnknown specifies a GUID variant which does not conform to one of + // the variant encodings specified in RFC 4122. + VariantUnknown Variant = iota + VariantNCS + VariantRFC4122 // RFC 4122 + VariantMicrosoft + VariantFuture +) + +// Version specifies how the bits in the GUID were generated. For instance, a +// version 4 GUID is randomly generated, and a version 5 is generated from the +// hash of an input string. +type Version uint8 + +func (v Version) String() string { + return strconv.FormatUint(uint64(v), 10) +} + +var _ = (encoding.TextMarshaler)(GUID{}) +var _ = (encoding.TextUnmarshaler)(&GUID{}) + +// NewV4 returns a new version 4 (pseudorandom) GUID, as defined by RFC 4122. +func NewV4() (GUID, error) { + var b [16]byte + if _, err := rand.Read(b[:]); err != nil { + return GUID{}, err + } + + g := FromArray(b) + g.setVersion(4) // Version 4 means randomly generated. + g.setVariant(VariantRFC4122) + + return g, nil +} + +// NewV5 returns a new version 5 (generated from a string via SHA-1 hashing) +// GUID, as defined by RFC 4122. The RFC is unclear on the encoding of the name, +// and the sample code treats it as a series of bytes, so we do the same here. +// +// Some implementations, such as those found on Windows, treat the name as a +// big-endian UTF16 stream of bytes. If that is desired, the string can be +// encoded as such before being passed to this function. +func NewV5(namespace GUID, name []byte) (GUID, error) { + b := sha1.New() //nolint:gosec // not used for secure application + namespaceBytes := namespace.ToArray() + b.Write(namespaceBytes[:]) + b.Write(name) + + a := [16]byte{} + copy(a[:], b.Sum(nil)) + + g := FromArray(a) + g.setVersion(5) // Version 5 means generated from a string. + g.setVariant(VariantRFC4122) + + return g, nil +} + +func fromArray(b [16]byte, order binary.ByteOrder) GUID { + var g GUID + g.Data1 = order.Uint32(b[0:4]) + g.Data2 = order.Uint16(b[4:6]) + g.Data3 = order.Uint16(b[6:8]) + copy(g.Data4[:], b[8:16]) + return g +} + +func (g GUID) toArray(order binary.ByteOrder) [16]byte { + b := [16]byte{} + order.PutUint32(b[0:4], g.Data1) + order.PutUint16(b[4:6], g.Data2) + order.PutUint16(b[6:8], g.Data3) + copy(b[8:16], g.Data4[:]) + return b +} + +// FromArray constructs a GUID from a big-endian encoding array of 16 bytes. +func FromArray(b [16]byte) GUID { + return fromArray(b, binary.BigEndian) +} + +// ToArray returns an array of 16 bytes representing the GUID in big-endian +// encoding. +func (g GUID) ToArray() [16]byte { + return g.toArray(binary.BigEndian) +} + +// FromWindowsArray constructs a GUID from a Windows encoding array of bytes. +func FromWindowsArray(b [16]byte) GUID { + return fromArray(b, binary.LittleEndian) +} + +// ToWindowsArray returns an array of 16 bytes representing the GUID in Windows +// encoding. +func (g GUID) ToWindowsArray() [16]byte { + return g.toArray(binary.LittleEndian) +} + +func (g GUID) String() string { + return fmt.Sprintf( + "%08x-%04x-%04x-%04x-%012x", + g.Data1, + g.Data2, + g.Data3, + g.Data4[:2], + g.Data4[2:]) +} + +// FromString parses a string containing a GUID and returns the GUID. The only +// format currently supported is the `xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx` +// format. +func FromString(s string) (GUID, error) { + if len(s) != 36 { + return GUID{}, fmt.Errorf("invalid GUID %q", s) + } + if s[8] != '-' || s[13] != '-' || s[18] != '-' || s[23] != '-' { + return GUID{}, fmt.Errorf("invalid GUID %q", s) + } + + var g GUID + + data1, err := strconv.ParseUint(s[0:8], 16, 32) + if err != nil { + return GUID{}, fmt.Errorf("invalid GUID %q", s) + } + g.Data1 = uint32(data1) + + data2, err := strconv.ParseUint(s[9:13], 16, 16) + if err != nil { + return GUID{}, fmt.Errorf("invalid GUID %q", s) + } + g.Data2 = uint16(data2) + + data3, err := strconv.ParseUint(s[14:18], 16, 16) + if err != nil { + return GUID{}, fmt.Errorf("invalid GUID %q", s) + } + g.Data3 = uint16(data3) + + for i, x := range []int{19, 21, 24, 26, 28, 30, 32, 34} { + v, err := strconv.ParseUint(s[x:x+2], 16, 8) + if err != nil { + return GUID{}, fmt.Errorf("invalid GUID %q", s) + } + g.Data4[i] = uint8(v) + } + + return g, nil +} + +func (g *GUID) setVariant(v Variant) { + d := g.Data4[0] + switch v { + case VariantNCS: + d = (d & 0x7f) + case VariantRFC4122: + d = (d & 0x3f) | 0x80 + case VariantMicrosoft: + d = (d & 0x1f) | 0xc0 + case VariantFuture: + d = (d & 0x0f) | 0xe0 + case VariantUnknown: + fallthrough + default: + panic(fmt.Sprintf("invalid variant: %d", v)) + } + g.Data4[0] = d +} + +// Variant returns the GUID variant, as defined in RFC 4122. +func (g GUID) Variant() Variant { + b := g.Data4[0] + if b&0x80 == 0 { + return VariantNCS + } else if b&0xc0 == 0x80 { + return VariantRFC4122 + } else if b&0xe0 == 0xc0 { + return VariantMicrosoft + } else if b&0xe0 == 0xe0 { + return VariantFuture + } + return VariantUnknown +} + +func (g *GUID) setVersion(v Version) { + g.Data3 = (g.Data3 & 0x0fff) | (uint16(v) << 12) +} + +// Version returns the GUID version, as defined in RFC 4122. +func (g GUID) Version() Version { + return Version((g.Data3 & 0xF000) >> 12) +} + +// MarshalText returns the textual representation of the GUID. +func (g GUID) MarshalText() ([]byte, error) { + return []byte(g.String()), nil +} + +// UnmarshalText takes the textual representation of a GUID, and unmarhals it +// into this GUID. +func (g *GUID) UnmarshalText(text []byte) error { + g2, err := FromString(string(text)) + if err != nil { + return err + } + *g = g2 + return nil +} diff --git a/vendor/github.com/Microsoft/go-winio/pkg/guid/guid_nonwindows.go b/vendor/github.com/Microsoft/go-winio/pkg/guid/guid_nonwindows.go new file mode 100644 index 00000000..805bd354 --- /dev/null +++ b/vendor/github.com/Microsoft/go-winio/pkg/guid/guid_nonwindows.go @@ -0,0 +1,16 @@ +//go:build !windows +// +build !windows + +package guid + +// GUID represents a GUID/UUID. It has the same structure as +// golang.org/x/sys/windows.GUID so that it can be used with functions expecting +// that type. It is defined as its own type as that is only available to builds +// targeted at `windows`. The representation matches that used by native Windows +// code. +type GUID struct { + Data1 uint32 + Data2 uint16 + Data3 uint16 + Data4 [8]byte +} diff --git a/vendor/github.com/Microsoft/go-winio/pkg/guid/guid_windows.go b/vendor/github.com/Microsoft/go-winio/pkg/guid/guid_windows.go new file mode 100644 index 00000000..27e45ee5 --- /dev/null +++ b/vendor/github.com/Microsoft/go-winio/pkg/guid/guid_windows.go @@ -0,0 +1,13 @@ +//go:build windows +// +build windows + +package guid + +import "golang.org/x/sys/windows" + +// GUID represents a GUID/UUID. It has the same structure as +// golang.org/x/sys/windows.GUID so that it can be used with functions expecting +// that type. It is defined as its own type so that stringification and +// marshaling can be supported. The representation matches that used by native +// Windows code. +type GUID windows.GUID diff --git a/vendor/github.com/Microsoft/go-winio/pkg/guid/variant_string.go b/vendor/github.com/Microsoft/go-winio/pkg/guid/variant_string.go new file mode 100644 index 00000000..4076d313 --- /dev/null +++ b/vendor/github.com/Microsoft/go-winio/pkg/guid/variant_string.go @@ -0,0 +1,27 @@ +// Code generated by "stringer -type=Variant -trimprefix=Variant -linecomment"; DO NOT EDIT. + +package guid + +import "strconv" + +func _() { + // An "invalid array index" compiler error signifies that the constant values have changed. + // Re-run the stringer command to generate them again. + var x [1]struct{} + _ = x[VariantUnknown-0] + _ = x[VariantNCS-1] + _ = x[VariantRFC4122-2] + _ = x[VariantMicrosoft-3] + _ = x[VariantFuture-4] +} + +const _Variant_name = "UnknownNCSRFC 4122MicrosoftFuture" + +var _Variant_index = [...]uint8{0, 7, 10, 18, 27, 33} + +func (i Variant) String() string { + if i >= Variant(len(_Variant_index)-1) { + return "Variant(" + strconv.FormatInt(int64(i), 10) + ")" + } + return _Variant_name[_Variant_index[i]:_Variant_index[i+1]] +} diff --git a/vendor/github.com/Microsoft/go-winio/privilege.go b/vendor/github.com/Microsoft/go-winio/privilege.go new file mode 100644 index 00000000..d9b90b6e --- /dev/null +++ b/vendor/github.com/Microsoft/go-winio/privilege.go @@ -0,0 +1,196 @@ +//go:build windows +// +build windows + +package winio + +import ( + "bytes" + "encoding/binary" + "fmt" + "runtime" + "sync" + "unicode/utf16" + + "golang.org/x/sys/windows" +) + +//sys adjustTokenPrivileges(token windows.Token, releaseAll bool, input *byte, outputSize uint32, output *byte, requiredSize *uint32) (success bool, err error) [true] = advapi32.AdjustTokenPrivileges +//sys impersonateSelf(level uint32) (err error) = advapi32.ImpersonateSelf +//sys revertToSelf() (err error) = advapi32.RevertToSelf +//sys openThreadToken(thread windows.Handle, accessMask uint32, openAsSelf bool, token *windows.Token) (err error) = advapi32.OpenThreadToken +//sys getCurrentThread() (h windows.Handle) = GetCurrentThread +//sys lookupPrivilegeValue(systemName string, name string, luid *uint64) (err error) = advapi32.LookupPrivilegeValueW +//sys lookupPrivilegeName(systemName string, luid *uint64, buffer *uint16, size *uint32) (err error) = advapi32.LookupPrivilegeNameW +//sys lookupPrivilegeDisplayName(systemName string, name *uint16, buffer *uint16, size *uint32, languageId *uint32) (err error) = advapi32.LookupPrivilegeDisplayNameW + +const ( + //revive:disable-next-line:var-naming ALL_CAPS + SE_PRIVILEGE_ENABLED = windows.SE_PRIVILEGE_ENABLED + + //revive:disable-next-line:var-naming ALL_CAPS + ERROR_NOT_ALL_ASSIGNED windows.Errno = windows.ERROR_NOT_ALL_ASSIGNED + + SeBackupPrivilege = "SeBackupPrivilege" + SeRestorePrivilege = "SeRestorePrivilege" + SeSecurityPrivilege = "SeSecurityPrivilege" +) + +var ( + privNames = make(map[string]uint64) + privNameMutex sync.Mutex +) + +// PrivilegeError represents an error enabling privileges. +type PrivilegeError struct { + privileges []uint64 +} + +func (e *PrivilegeError) Error() string { + s := "Could not enable privilege " + if len(e.privileges) > 1 { + s = "Could not enable privileges " + } + for i, p := range e.privileges { + if i != 0 { + s += ", " + } + s += `"` + s += getPrivilegeName(p) + s += `"` + } + return s +} + +// RunWithPrivilege enables a single privilege for a function call. +func RunWithPrivilege(name string, fn func() error) error { + return RunWithPrivileges([]string{name}, fn) +} + +// RunWithPrivileges enables privileges for a function call. +func RunWithPrivileges(names []string, fn func() error) error { + privileges, err := mapPrivileges(names) + if err != nil { + return err + } + runtime.LockOSThread() + defer runtime.UnlockOSThread() + token, err := newThreadToken() + if err != nil { + return err + } + defer releaseThreadToken(token) + err = adjustPrivileges(token, privileges, SE_PRIVILEGE_ENABLED) + if err != nil { + return err + } + return fn() +} + +func mapPrivileges(names []string) ([]uint64, error) { + privileges := make([]uint64, 0, len(names)) + privNameMutex.Lock() + defer privNameMutex.Unlock() + for _, name := range names { + p, ok := privNames[name] + if !ok { + err := lookupPrivilegeValue("", name, &p) + if err != nil { + return nil, err + } + privNames[name] = p + } + privileges = append(privileges, p) + } + return privileges, nil +} + +// EnableProcessPrivileges enables privileges globally for the process. +func EnableProcessPrivileges(names []string) error { + return enableDisableProcessPrivilege(names, SE_PRIVILEGE_ENABLED) +} + +// DisableProcessPrivileges disables privileges globally for the process. +func DisableProcessPrivileges(names []string) error { + return enableDisableProcessPrivilege(names, 0) +} + +func enableDisableProcessPrivilege(names []string, action uint32) error { + privileges, err := mapPrivileges(names) + if err != nil { + return err + } + + p := windows.CurrentProcess() + var token windows.Token + err = windows.OpenProcessToken(p, windows.TOKEN_ADJUST_PRIVILEGES|windows.TOKEN_QUERY, &token) + if err != nil { + return err + } + + defer token.Close() + return adjustPrivileges(token, privileges, action) +} + +func adjustPrivileges(token windows.Token, privileges []uint64, action uint32) error { + var b bytes.Buffer + _ = binary.Write(&b, binary.LittleEndian, uint32(len(privileges))) + for _, p := range privileges { + _ = binary.Write(&b, binary.LittleEndian, p) + _ = binary.Write(&b, binary.LittleEndian, action) + } + prevState := make([]byte, b.Len()) + reqSize := uint32(0) + success, err := adjustTokenPrivileges(token, false, &b.Bytes()[0], uint32(len(prevState)), &prevState[0], &reqSize) + if !success { + return err + } + if err == ERROR_NOT_ALL_ASSIGNED { //nolint:errorlint // err is Errno + return &PrivilegeError{privileges} + } + return nil +} + +func getPrivilegeName(luid uint64) string { + var nameBuffer [256]uint16 + bufSize := uint32(len(nameBuffer)) + err := lookupPrivilegeName("", &luid, &nameBuffer[0], &bufSize) + if err != nil { + return fmt.Sprintf("", luid) + } + + var displayNameBuffer [256]uint16 + displayBufSize := uint32(len(displayNameBuffer)) + var langID uint32 + err = lookupPrivilegeDisplayName("", &nameBuffer[0], &displayNameBuffer[0], &displayBufSize, &langID) + if err != nil { + return fmt.Sprintf("", string(utf16.Decode(nameBuffer[:bufSize]))) + } + + return string(utf16.Decode(displayNameBuffer[:displayBufSize])) +} + +func newThreadToken() (windows.Token, error) { + err := impersonateSelf(windows.SecurityImpersonation) + if err != nil { + return 0, err + } + + var token windows.Token + err = openThreadToken(getCurrentThread(), windows.TOKEN_ADJUST_PRIVILEGES|windows.TOKEN_QUERY, false, &token) + if err != nil { + rerr := revertToSelf() + if rerr != nil { + panic(rerr) + } + return 0, err + } + return token, nil +} + +func releaseThreadToken(h windows.Token) { + err := revertToSelf() + if err != nil { + panic(err) + } + h.Close() +} diff --git a/vendor/github.com/Microsoft/go-winio/reparse.go b/vendor/github.com/Microsoft/go-winio/reparse.go new file mode 100644 index 00000000..67d1a104 --- /dev/null +++ b/vendor/github.com/Microsoft/go-winio/reparse.go @@ -0,0 +1,131 @@ +//go:build windows +// +build windows + +package winio + +import ( + "bytes" + "encoding/binary" + "fmt" + "strings" + "unicode/utf16" + "unsafe" +) + +const ( + reparseTagMountPoint = 0xA0000003 + reparseTagSymlink = 0xA000000C +) + +type reparseDataBuffer struct { + ReparseTag uint32 + ReparseDataLength uint16 + Reserved uint16 + SubstituteNameOffset uint16 + SubstituteNameLength uint16 + PrintNameOffset uint16 + PrintNameLength uint16 +} + +// ReparsePoint describes a Win32 symlink or mount point. +type ReparsePoint struct { + Target string + IsMountPoint bool +} + +// UnsupportedReparsePointError is returned when trying to decode a non-symlink or +// mount point reparse point. +type UnsupportedReparsePointError struct { + Tag uint32 +} + +func (e *UnsupportedReparsePointError) Error() string { + return fmt.Sprintf("unsupported reparse point %x", e.Tag) +} + +// DecodeReparsePoint decodes a Win32 REPARSE_DATA_BUFFER structure containing either a symlink +// or a mount point. +func DecodeReparsePoint(b []byte) (*ReparsePoint, error) { + tag := binary.LittleEndian.Uint32(b[0:4]) + return DecodeReparsePointData(tag, b[8:]) +} + +func DecodeReparsePointData(tag uint32, b []byte) (*ReparsePoint, error) { + isMountPoint := false + switch tag { + case reparseTagMountPoint: + isMountPoint = true + case reparseTagSymlink: + default: + return nil, &UnsupportedReparsePointError{tag} + } + nameOffset := 8 + binary.LittleEndian.Uint16(b[4:6]) + if !isMountPoint { + nameOffset += 4 + } + nameLength := binary.LittleEndian.Uint16(b[6:8]) + name := make([]uint16, nameLength/2) + err := binary.Read(bytes.NewReader(b[nameOffset:nameOffset+nameLength]), binary.LittleEndian, &name) + if err != nil { + return nil, err + } + return &ReparsePoint{string(utf16.Decode(name)), isMountPoint}, nil +} + +func isDriveLetter(c byte) bool { + return (c >= 'a' && c <= 'z') || (c >= 'A' && c <= 'Z') +} + +// EncodeReparsePoint encodes a Win32 REPARSE_DATA_BUFFER structure describing a symlink or +// mount point. +func EncodeReparsePoint(rp *ReparsePoint) []byte { + // Generate an NT path and determine if this is a relative path. + var ntTarget string + relative := false + if strings.HasPrefix(rp.Target, `\\?\`) { + ntTarget = `\??\` + rp.Target[4:] + } else if strings.HasPrefix(rp.Target, `\\`) { + ntTarget = `\??\UNC\` + rp.Target[2:] + } else if len(rp.Target) >= 2 && isDriveLetter(rp.Target[0]) && rp.Target[1] == ':' { + ntTarget = `\??\` + rp.Target + } else { + ntTarget = rp.Target + relative = true + } + + // The paths must be NUL-terminated even though they are counted strings. + target16 := utf16.Encode([]rune(rp.Target + "\x00")) + ntTarget16 := utf16.Encode([]rune(ntTarget + "\x00")) + + size := int(unsafe.Sizeof(reparseDataBuffer{})) - 8 + size += len(ntTarget16)*2 + len(target16)*2 + + tag := uint32(reparseTagMountPoint) + if !rp.IsMountPoint { + tag = reparseTagSymlink + size += 4 // Add room for symlink flags + } + + data := reparseDataBuffer{ + ReparseTag: tag, + ReparseDataLength: uint16(size), + SubstituteNameOffset: 0, + SubstituteNameLength: uint16((len(ntTarget16) - 1) * 2), + PrintNameOffset: uint16(len(ntTarget16) * 2), + PrintNameLength: uint16((len(target16) - 1) * 2), + } + + var b bytes.Buffer + _ = binary.Write(&b, binary.LittleEndian, &data) + if !rp.IsMountPoint { + flags := uint32(0) + if relative { + flags |= 1 + } + _ = binary.Write(&b, binary.LittleEndian, flags) + } + + _ = binary.Write(&b, binary.LittleEndian, ntTarget16) + _ = binary.Write(&b, binary.LittleEndian, target16) + return b.Bytes() +} diff --git a/vendor/github.com/Microsoft/go-winio/sd.go b/vendor/github.com/Microsoft/go-winio/sd.go new file mode 100644 index 00000000..c3685e98 --- /dev/null +++ b/vendor/github.com/Microsoft/go-winio/sd.go @@ -0,0 +1,133 @@ +//go:build windows +// +build windows + +package winio + +import ( + "errors" + "fmt" + "unsafe" + + "golang.org/x/sys/windows" +) + +//sys lookupAccountName(systemName *uint16, accountName string, sid *byte, sidSize *uint32, refDomain *uint16, refDomainSize *uint32, sidNameUse *uint32) (err error) = advapi32.LookupAccountNameW +//sys lookupAccountSid(systemName *uint16, sid *byte, name *uint16, nameSize *uint32, refDomain *uint16, refDomainSize *uint32, sidNameUse *uint32) (err error) = advapi32.LookupAccountSidW +//sys convertSidToStringSid(sid *byte, str **uint16) (err error) = advapi32.ConvertSidToStringSidW +//sys convertStringSidToSid(str *uint16, sid **byte) (err error) = advapi32.ConvertStringSidToSidW + +type AccountLookupError struct { + Name string + Err error +} + +func (e *AccountLookupError) Error() string { + if e.Name == "" { + return "lookup account: empty account name specified" + } + var s string + switch { + case errors.Is(e.Err, windows.ERROR_INVALID_SID): + s = "the security ID structure is invalid" + case errors.Is(e.Err, windows.ERROR_NONE_MAPPED): + s = "not found" + default: + s = e.Err.Error() + } + return "lookup account " + e.Name + ": " + s +} + +func (e *AccountLookupError) Unwrap() error { return e.Err } + +type SddlConversionError struct { + Sddl string + Err error +} + +func (e *SddlConversionError) Error() string { + return "convert " + e.Sddl + ": " + e.Err.Error() +} + +func (e *SddlConversionError) Unwrap() error { return e.Err } + +// LookupSidByName looks up the SID of an account by name +// +//revive:disable-next-line:var-naming SID, not Sid +func LookupSidByName(name string) (sid string, err error) { + if name == "" { + return "", &AccountLookupError{name, windows.ERROR_NONE_MAPPED} + } + + var sidSize, sidNameUse, refDomainSize uint32 + err = lookupAccountName(nil, name, nil, &sidSize, nil, &refDomainSize, &sidNameUse) + if err != nil && err != windows.ERROR_INSUFFICIENT_BUFFER { //nolint:errorlint // err is Errno + return "", &AccountLookupError{name, err} + } + sidBuffer := make([]byte, sidSize) + refDomainBuffer := make([]uint16, refDomainSize) + err = lookupAccountName(nil, name, &sidBuffer[0], &sidSize, &refDomainBuffer[0], &refDomainSize, &sidNameUse) + if err != nil { + return "", &AccountLookupError{name, err} + } + var strBuffer *uint16 + err = convertSidToStringSid(&sidBuffer[0], &strBuffer) + if err != nil { + return "", &AccountLookupError{name, err} + } + sid = windows.UTF16ToString((*[0xffff]uint16)(unsafe.Pointer(strBuffer))[:]) + _, _ = windows.LocalFree(windows.Handle(unsafe.Pointer(strBuffer))) + return sid, nil +} + +// LookupNameBySid looks up the name of an account by SID +// +//revive:disable-next-line:var-naming SID, not Sid +func LookupNameBySid(sid string) (name string, err error) { + if sid == "" { + return "", &AccountLookupError{sid, windows.ERROR_NONE_MAPPED} + } + + sidBuffer, err := windows.UTF16PtrFromString(sid) + if err != nil { + return "", &AccountLookupError{sid, err} + } + + var sidPtr *byte + if err = convertStringSidToSid(sidBuffer, &sidPtr); err != nil { + return "", &AccountLookupError{sid, err} + } + defer windows.LocalFree(windows.Handle(unsafe.Pointer(sidPtr))) //nolint:errcheck + + var nameSize, refDomainSize, sidNameUse uint32 + err = lookupAccountSid(nil, sidPtr, nil, &nameSize, nil, &refDomainSize, &sidNameUse) + if err != nil && err != windows.ERROR_INSUFFICIENT_BUFFER { //nolint:errorlint // err is Errno + return "", &AccountLookupError{sid, err} + } + + nameBuffer := make([]uint16, nameSize) + refDomainBuffer := make([]uint16, refDomainSize) + err = lookupAccountSid(nil, sidPtr, &nameBuffer[0], &nameSize, &refDomainBuffer[0], &refDomainSize, &sidNameUse) + if err != nil { + return "", &AccountLookupError{sid, err} + } + + name = windows.UTF16ToString(nameBuffer) + return name, nil +} + +func SddlToSecurityDescriptor(sddl string) ([]byte, error) { + sd, err := windows.SecurityDescriptorFromString(sddl) + if err != nil { + return nil, &SddlConversionError{Sddl: sddl, Err: err} + } + b := unsafe.Slice((*byte)(unsafe.Pointer(sd)), sd.Length()) + return b, nil +} + +func SecurityDescriptorToSddl(sd []byte) (string, error) { + if l := int(unsafe.Sizeof(windows.SECURITY_DESCRIPTOR{})); len(sd) < l { + return "", fmt.Errorf("SecurityDescriptor (%d) smaller than expected (%d): %w", len(sd), l, windows.ERROR_INCORRECT_SIZE) + } + s := (*windows.SECURITY_DESCRIPTOR)(unsafe.Pointer(&sd[0])) + return s.String(), nil +} diff --git a/vendor/github.com/Microsoft/go-winio/syscall.go b/vendor/github.com/Microsoft/go-winio/syscall.go new file mode 100644 index 00000000..a6ca111b --- /dev/null +++ b/vendor/github.com/Microsoft/go-winio/syscall.go @@ -0,0 +1,5 @@ +//go:build windows + +package winio + +//go:generate go run github.com/Microsoft/go-winio/tools/mkwinsyscall -output zsyscall_windows.go ./*.go diff --git a/vendor/github.com/Microsoft/go-winio/zsyscall_windows.go b/vendor/github.com/Microsoft/go-winio/zsyscall_windows.go new file mode 100644 index 00000000..89b66eda --- /dev/null +++ b/vendor/github.com/Microsoft/go-winio/zsyscall_windows.go @@ -0,0 +1,378 @@ +//go:build windows + +// Code generated by 'go generate' using "github.com/Microsoft/go-winio/tools/mkwinsyscall"; DO NOT EDIT. + +package winio + +import ( + "syscall" + "unsafe" + + "golang.org/x/sys/windows" +) + +var _ unsafe.Pointer + +// Do the interface allocations only once for common +// Errno values. +const ( + errnoERROR_IO_PENDING = 997 +) + +var ( + errERROR_IO_PENDING error = syscall.Errno(errnoERROR_IO_PENDING) + errERROR_EINVAL error = syscall.EINVAL +) + +// errnoErr returns common boxed Errno values, to prevent +// allocations at runtime. +func errnoErr(e syscall.Errno) error { + switch e { + case 0: + return errERROR_EINVAL + case errnoERROR_IO_PENDING: + return errERROR_IO_PENDING + } + return e +} + +var ( + modadvapi32 = windows.NewLazySystemDLL("advapi32.dll") + modkernel32 = windows.NewLazySystemDLL("kernel32.dll") + modntdll = windows.NewLazySystemDLL("ntdll.dll") + modws2_32 = windows.NewLazySystemDLL("ws2_32.dll") + + procAdjustTokenPrivileges = modadvapi32.NewProc("AdjustTokenPrivileges") + procConvertSidToStringSidW = modadvapi32.NewProc("ConvertSidToStringSidW") + procConvertStringSidToSidW = modadvapi32.NewProc("ConvertStringSidToSidW") + procImpersonateSelf = modadvapi32.NewProc("ImpersonateSelf") + procLookupAccountNameW = modadvapi32.NewProc("LookupAccountNameW") + procLookupAccountSidW = modadvapi32.NewProc("LookupAccountSidW") + procLookupPrivilegeDisplayNameW = modadvapi32.NewProc("LookupPrivilegeDisplayNameW") + procLookupPrivilegeNameW = modadvapi32.NewProc("LookupPrivilegeNameW") + procLookupPrivilegeValueW = modadvapi32.NewProc("LookupPrivilegeValueW") + procOpenThreadToken = modadvapi32.NewProc("OpenThreadToken") + procRevertToSelf = modadvapi32.NewProc("RevertToSelf") + procBackupRead = modkernel32.NewProc("BackupRead") + procBackupWrite = modkernel32.NewProc("BackupWrite") + procCancelIoEx = modkernel32.NewProc("CancelIoEx") + procConnectNamedPipe = modkernel32.NewProc("ConnectNamedPipe") + procCreateIoCompletionPort = modkernel32.NewProc("CreateIoCompletionPort") + procCreateNamedPipeW = modkernel32.NewProc("CreateNamedPipeW") + procDisconnectNamedPipe = modkernel32.NewProc("DisconnectNamedPipe") + procGetCurrentThread = modkernel32.NewProc("GetCurrentThread") + procGetNamedPipeHandleStateW = modkernel32.NewProc("GetNamedPipeHandleStateW") + procGetNamedPipeInfo = modkernel32.NewProc("GetNamedPipeInfo") + procGetQueuedCompletionStatus = modkernel32.NewProc("GetQueuedCompletionStatus") + procSetFileCompletionNotificationModes = modkernel32.NewProc("SetFileCompletionNotificationModes") + procNtCreateNamedPipeFile = modntdll.NewProc("NtCreateNamedPipeFile") + procRtlDefaultNpAcl = modntdll.NewProc("RtlDefaultNpAcl") + procRtlDosPathNameToNtPathName_U = modntdll.NewProc("RtlDosPathNameToNtPathName_U") + procRtlNtStatusToDosErrorNoTeb = modntdll.NewProc("RtlNtStatusToDosErrorNoTeb") + procWSAGetOverlappedResult = modws2_32.NewProc("WSAGetOverlappedResult") +) + +func adjustTokenPrivileges(token windows.Token, releaseAll bool, input *byte, outputSize uint32, output *byte, requiredSize *uint32) (success bool, err error) { + var _p0 uint32 + if releaseAll { + _p0 = 1 + } + r0, _, e1 := syscall.SyscallN(procAdjustTokenPrivileges.Addr(), uintptr(token), uintptr(_p0), uintptr(unsafe.Pointer(input)), uintptr(outputSize), uintptr(unsafe.Pointer(output)), uintptr(unsafe.Pointer(requiredSize))) + success = r0 != 0 + if true { + err = errnoErr(e1) + } + return +} + +func convertSidToStringSid(sid *byte, str **uint16) (err error) { + r1, _, e1 := syscall.SyscallN(procConvertSidToStringSidW.Addr(), uintptr(unsafe.Pointer(sid)), uintptr(unsafe.Pointer(str))) + if r1 == 0 { + err = errnoErr(e1) + } + return +} + +func convertStringSidToSid(str *uint16, sid **byte) (err error) { + r1, _, e1 := syscall.SyscallN(procConvertStringSidToSidW.Addr(), uintptr(unsafe.Pointer(str)), uintptr(unsafe.Pointer(sid))) + if r1 == 0 { + err = errnoErr(e1) + } + return +} + +func impersonateSelf(level uint32) (err error) { + r1, _, e1 := syscall.SyscallN(procImpersonateSelf.Addr(), uintptr(level)) + if r1 == 0 { + err = errnoErr(e1) + } + return +} + +func lookupAccountName(systemName *uint16, accountName string, sid *byte, sidSize *uint32, refDomain *uint16, refDomainSize *uint32, sidNameUse *uint32) (err error) { + var _p0 *uint16 + _p0, err = syscall.UTF16PtrFromString(accountName) + if err != nil { + return + } + return _lookupAccountName(systemName, _p0, sid, sidSize, refDomain, refDomainSize, sidNameUse) +} + +func _lookupAccountName(systemName *uint16, accountName *uint16, sid *byte, sidSize *uint32, refDomain *uint16, refDomainSize *uint32, sidNameUse *uint32) (err error) { + r1, _, e1 := syscall.SyscallN(procLookupAccountNameW.Addr(), uintptr(unsafe.Pointer(systemName)), uintptr(unsafe.Pointer(accountName)), uintptr(unsafe.Pointer(sid)), uintptr(unsafe.Pointer(sidSize)), uintptr(unsafe.Pointer(refDomain)), uintptr(unsafe.Pointer(refDomainSize)), uintptr(unsafe.Pointer(sidNameUse))) + if r1 == 0 { + err = errnoErr(e1) + } + return +} + +func lookupAccountSid(systemName *uint16, sid *byte, name *uint16, nameSize *uint32, refDomain *uint16, refDomainSize *uint32, sidNameUse *uint32) (err error) { + r1, _, e1 := syscall.SyscallN(procLookupAccountSidW.Addr(), uintptr(unsafe.Pointer(systemName)), uintptr(unsafe.Pointer(sid)), uintptr(unsafe.Pointer(name)), uintptr(unsafe.Pointer(nameSize)), uintptr(unsafe.Pointer(refDomain)), uintptr(unsafe.Pointer(refDomainSize)), uintptr(unsafe.Pointer(sidNameUse))) + if r1 == 0 { + err = errnoErr(e1) + } + return +} + +func lookupPrivilegeDisplayName(systemName string, name *uint16, buffer *uint16, size *uint32, languageId *uint32) (err error) { + var _p0 *uint16 + _p0, err = syscall.UTF16PtrFromString(systemName) + if err != nil { + return + } + return _lookupPrivilegeDisplayName(_p0, name, buffer, size, languageId) +} + +func _lookupPrivilegeDisplayName(systemName *uint16, name *uint16, buffer *uint16, size *uint32, languageId *uint32) (err error) { + r1, _, e1 := syscall.SyscallN(procLookupPrivilegeDisplayNameW.Addr(), uintptr(unsafe.Pointer(systemName)), uintptr(unsafe.Pointer(name)), uintptr(unsafe.Pointer(buffer)), uintptr(unsafe.Pointer(size)), uintptr(unsafe.Pointer(languageId))) + if r1 == 0 { + err = errnoErr(e1) + } + return +} + +func lookupPrivilegeName(systemName string, luid *uint64, buffer *uint16, size *uint32) (err error) { + var _p0 *uint16 + _p0, err = syscall.UTF16PtrFromString(systemName) + if err != nil { + return + } + return _lookupPrivilegeName(_p0, luid, buffer, size) +} + +func _lookupPrivilegeName(systemName *uint16, luid *uint64, buffer *uint16, size *uint32) (err error) { + r1, _, e1 := syscall.SyscallN(procLookupPrivilegeNameW.Addr(), uintptr(unsafe.Pointer(systemName)), uintptr(unsafe.Pointer(luid)), uintptr(unsafe.Pointer(buffer)), uintptr(unsafe.Pointer(size))) + if r1 == 0 { + err = errnoErr(e1) + } + return +} + +func lookupPrivilegeValue(systemName string, name string, luid *uint64) (err error) { + var _p0 *uint16 + _p0, err = syscall.UTF16PtrFromString(systemName) + if err != nil { + return + } + var _p1 *uint16 + _p1, err = syscall.UTF16PtrFromString(name) + if err != nil { + return + } + return _lookupPrivilegeValue(_p0, _p1, luid) +} + +func _lookupPrivilegeValue(systemName *uint16, name *uint16, luid *uint64) (err error) { + r1, _, e1 := syscall.SyscallN(procLookupPrivilegeValueW.Addr(), uintptr(unsafe.Pointer(systemName)), uintptr(unsafe.Pointer(name)), uintptr(unsafe.Pointer(luid))) + if r1 == 0 { + err = errnoErr(e1) + } + return +} + +func openThreadToken(thread windows.Handle, accessMask uint32, openAsSelf bool, token *windows.Token) (err error) { + var _p0 uint32 + if openAsSelf { + _p0 = 1 + } + r1, _, e1 := syscall.SyscallN(procOpenThreadToken.Addr(), uintptr(thread), uintptr(accessMask), uintptr(_p0), uintptr(unsafe.Pointer(token))) + if r1 == 0 { + err = errnoErr(e1) + } + return +} + +func revertToSelf() (err error) { + r1, _, e1 := syscall.SyscallN(procRevertToSelf.Addr()) + if r1 == 0 { + err = errnoErr(e1) + } + return +} + +func backupRead(h windows.Handle, b []byte, bytesRead *uint32, abort bool, processSecurity bool, context *uintptr) (err error) { + var _p0 *byte + if len(b) > 0 { + _p0 = &b[0] + } + var _p1 uint32 + if abort { + _p1 = 1 + } + var _p2 uint32 + if processSecurity { + _p2 = 1 + } + r1, _, e1 := syscall.SyscallN(procBackupRead.Addr(), uintptr(h), uintptr(unsafe.Pointer(_p0)), uintptr(len(b)), uintptr(unsafe.Pointer(bytesRead)), uintptr(_p1), uintptr(_p2), uintptr(unsafe.Pointer(context))) + if r1 == 0 { + err = errnoErr(e1) + } + return +} + +func backupWrite(h windows.Handle, b []byte, bytesWritten *uint32, abort bool, processSecurity bool, context *uintptr) (err error) { + var _p0 *byte + if len(b) > 0 { + _p0 = &b[0] + } + var _p1 uint32 + if abort { + _p1 = 1 + } + var _p2 uint32 + if processSecurity { + _p2 = 1 + } + r1, _, e1 := syscall.SyscallN(procBackupWrite.Addr(), uintptr(h), uintptr(unsafe.Pointer(_p0)), uintptr(len(b)), uintptr(unsafe.Pointer(bytesWritten)), uintptr(_p1), uintptr(_p2), uintptr(unsafe.Pointer(context))) + if r1 == 0 { + err = errnoErr(e1) + } + return +} + +func cancelIoEx(file windows.Handle, o *windows.Overlapped) (err error) { + r1, _, e1 := syscall.SyscallN(procCancelIoEx.Addr(), uintptr(file), uintptr(unsafe.Pointer(o))) + if r1 == 0 { + err = errnoErr(e1) + } + return +} + +func connectNamedPipe(pipe windows.Handle, o *windows.Overlapped) (err error) { + r1, _, e1 := syscall.SyscallN(procConnectNamedPipe.Addr(), uintptr(pipe), uintptr(unsafe.Pointer(o))) + if r1 == 0 { + err = errnoErr(e1) + } + return +} + +func createIoCompletionPort(file windows.Handle, port windows.Handle, key uintptr, threadCount uint32) (newport windows.Handle, err error) { + r0, _, e1 := syscall.SyscallN(procCreateIoCompletionPort.Addr(), uintptr(file), uintptr(port), uintptr(key), uintptr(threadCount)) + newport = windows.Handle(r0) + if newport == 0 { + err = errnoErr(e1) + } + return +} + +func createNamedPipe(name string, flags uint32, pipeMode uint32, maxInstances uint32, outSize uint32, inSize uint32, defaultTimeout uint32, sa *windows.SecurityAttributes) (handle windows.Handle, err error) { + var _p0 *uint16 + _p0, err = syscall.UTF16PtrFromString(name) + if err != nil { + return + } + return _createNamedPipe(_p0, flags, pipeMode, maxInstances, outSize, inSize, defaultTimeout, sa) +} + +func _createNamedPipe(name *uint16, flags uint32, pipeMode uint32, maxInstances uint32, outSize uint32, inSize uint32, defaultTimeout uint32, sa *windows.SecurityAttributes) (handle windows.Handle, err error) { + r0, _, e1 := syscall.SyscallN(procCreateNamedPipeW.Addr(), uintptr(unsafe.Pointer(name)), uintptr(flags), uintptr(pipeMode), uintptr(maxInstances), uintptr(outSize), uintptr(inSize), uintptr(defaultTimeout), uintptr(unsafe.Pointer(sa))) + handle = windows.Handle(r0) + if handle == windows.InvalidHandle { + err = errnoErr(e1) + } + return +} + +func disconnectNamedPipe(pipe windows.Handle) (err error) { + r1, _, e1 := syscall.SyscallN(procDisconnectNamedPipe.Addr(), uintptr(pipe)) + if r1 == 0 { + err = errnoErr(e1) + } + return +} + +func getCurrentThread() (h windows.Handle) { + r0, _, _ := syscall.SyscallN(procGetCurrentThread.Addr()) + h = windows.Handle(r0) + return +} + +func getNamedPipeHandleState(pipe windows.Handle, state *uint32, curInstances *uint32, maxCollectionCount *uint32, collectDataTimeout *uint32, userName *uint16, maxUserNameSize uint32) (err error) { + r1, _, e1 := syscall.SyscallN(procGetNamedPipeHandleStateW.Addr(), uintptr(pipe), uintptr(unsafe.Pointer(state)), uintptr(unsafe.Pointer(curInstances)), uintptr(unsafe.Pointer(maxCollectionCount)), uintptr(unsafe.Pointer(collectDataTimeout)), uintptr(unsafe.Pointer(userName)), uintptr(maxUserNameSize)) + if r1 == 0 { + err = errnoErr(e1) + } + return +} + +func getNamedPipeInfo(pipe windows.Handle, flags *uint32, outSize *uint32, inSize *uint32, maxInstances *uint32) (err error) { + r1, _, e1 := syscall.SyscallN(procGetNamedPipeInfo.Addr(), uintptr(pipe), uintptr(unsafe.Pointer(flags)), uintptr(unsafe.Pointer(outSize)), uintptr(unsafe.Pointer(inSize)), uintptr(unsafe.Pointer(maxInstances))) + if r1 == 0 { + err = errnoErr(e1) + } + return +} + +func getQueuedCompletionStatus(port windows.Handle, bytes *uint32, key *uintptr, o **ioOperation, timeout uint32) (err error) { + r1, _, e1 := syscall.SyscallN(procGetQueuedCompletionStatus.Addr(), uintptr(port), uintptr(unsafe.Pointer(bytes)), uintptr(unsafe.Pointer(key)), uintptr(unsafe.Pointer(o)), uintptr(timeout)) + if r1 == 0 { + err = errnoErr(e1) + } + return +} + +func setFileCompletionNotificationModes(h windows.Handle, flags uint8) (err error) { + r1, _, e1 := syscall.SyscallN(procSetFileCompletionNotificationModes.Addr(), uintptr(h), uintptr(flags)) + if r1 == 0 { + err = errnoErr(e1) + } + return +} + +func ntCreateNamedPipeFile(pipe *windows.Handle, access ntAccessMask, oa *objectAttributes, iosb *ioStatusBlock, share ntFileShareMode, disposition ntFileCreationDisposition, options ntFileOptions, typ uint32, readMode uint32, completionMode uint32, maxInstances uint32, inboundQuota uint32, outputQuota uint32, timeout *int64) (status ntStatus) { + r0, _, _ := syscall.SyscallN(procNtCreateNamedPipeFile.Addr(), uintptr(unsafe.Pointer(pipe)), uintptr(access), uintptr(unsafe.Pointer(oa)), uintptr(unsafe.Pointer(iosb)), uintptr(share), uintptr(disposition), uintptr(options), uintptr(typ), uintptr(readMode), uintptr(completionMode), uintptr(maxInstances), uintptr(inboundQuota), uintptr(outputQuota), uintptr(unsafe.Pointer(timeout))) + status = ntStatus(r0) + return +} + +func rtlDefaultNpAcl(dacl *uintptr) (status ntStatus) { + r0, _, _ := syscall.SyscallN(procRtlDefaultNpAcl.Addr(), uintptr(unsafe.Pointer(dacl))) + status = ntStatus(r0) + return +} + +func rtlDosPathNameToNtPathName(name *uint16, ntName *unicodeString, filePart uintptr, reserved uintptr) (status ntStatus) { + r0, _, _ := syscall.SyscallN(procRtlDosPathNameToNtPathName_U.Addr(), uintptr(unsafe.Pointer(name)), uintptr(unsafe.Pointer(ntName)), uintptr(filePart), uintptr(reserved)) + status = ntStatus(r0) + return +} + +func rtlNtStatusToDosError(status ntStatus) (winerr error) { + r0, _, _ := syscall.SyscallN(procRtlNtStatusToDosErrorNoTeb.Addr(), uintptr(status)) + if r0 != 0 { + winerr = syscall.Errno(r0) + } + return +} + +func wsaGetOverlappedResult(h windows.Handle, o *windows.Overlapped, bytes *uint32, wait bool, flags *uint32) (err error) { + var _p0 uint32 + if wait { + _p0 = 1 + } + r1, _, e1 := syscall.SyscallN(procWSAGetOverlappedResult.Addr(), uintptr(h), uintptr(unsafe.Pointer(o)), uintptr(unsafe.Pointer(bytes)), uintptr(_p0), uintptr(unsafe.Pointer(flags))) + if r1 == 0 { + err = errnoErr(e1) + } + return +} diff --git a/vendor/github.com/cenkalti/backoff/v5/.gitignore b/vendor/github.com/cenkalti/backoff/v5/.gitignore new file mode 100644 index 00000000..50d95c54 --- /dev/null +++ b/vendor/github.com/cenkalti/backoff/v5/.gitignore @@ -0,0 +1,25 @@ +# Compiled Object files, Static and Dynamic libs (Shared Objects) +*.o +*.a +*.so + +# Folders +_obj +_test + +# Architecture specific extensions/prefixes +*.[568vq] +[568vq].out + +*.cgo1.go +*.cgo2.c +_cgo_defun.c +_cgo_gotypes.go +_cgo_export.* + +_testmain.go + +*.exe + +# IDEs +.idea/ diff --git a/vendor/github.com/cenkalti/backoff/v5/CHANGELOG.md b/vendor/github.com/cenkalti/backoff/v5/CHANGELOG.md new file mode 100644 index 00000000..658c3743 --- /dev/null +++ b/vendor/github.com/cenkalti/backoff/v5/CHANGELOG.md @@ -0,0 +1,29 @@ +# Changelog + +All notable changes to this project will be documented in this file. + +The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/), +and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). + +## [5.0.0] - 2024-12-19 + +### Added + +- RetryAfterError can be returned from an operation to indicate how long to wait before the next retry. + +### Changed + +- Retry function now accepts additional options for specifying max number of tries and max elapsed time. +- Retry function now accepts a context.Context. +- Operation function signature changed to return result (any type) and error. + +### Removed + +- RetryNotify* and RetryWithData functions. Only single Retry function remains. +- Optional arguments from ExponentialBackoff constructor. +- Clock and Timer interfaces. + +### Fixed + +- The original error is returned from Retry if there's a PermanentError. (#144) +- The Retry function respects the wrapped PermanentError. (#140) diff --git a/vendor/github.com/cenkalti/backoff/v5/LICENSE b/vendor/github.com/cenkalti/backoff/v5/LICENSE new file mode 100644 index 00000000..89b81799 --- /dev/null +++ b/vendor/github.com/cenkalti/backoff/v5/LICENSE @@ -0,0 +1,20 @@ +The MIT License (MIT) + +Copyright (c) 2014 Cenk Altı + +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. diff --git a/vendor/github.com/cenkalti/backoff/v5/README.md b/vendor/github.com/cenkalti/backoff/v5/README.md new file mode 100644 index 00000000..4611b1d1 --- /dev/null +++ b/vendor/github.com/cenkalti/backoff/v5/README.md @@ -0,0 +1,31 @@ +# Exponential Backoff [![GoDoc][godoc image]][godoc] + +This is a Go port of the exponential backoff algorithm from [Google's HTTP Client Library for Java][google-http-java-client]. + +[Exponential backoff][exponential backoff wiki] +is an algorithm that uses feedback to multiplicatively decrease the rate of some process, +in order to gradually find an acceptable rate. +The retries exponentially increase and stop increasing when a certain threshold is met. + +## Usage + +Import path is `github.com/cenkalti/backoff/v5`. Please note the version part at the end. + +For most cases, use `Retry` function. See [example_test.go][example] for an example. + +If you have specific needs, copy `Retry` function (from [retry.go][retry-src]) into your code and modify it as needed. + +## Contributing + +* I would like to keep this library as small as possible. +* Please don't send a PR without opening an issue and discussing it first. +* If proposed change is not a common use case, I will probably not accept it. + +[godoc]: https://pkg.go.dev/github.com/cenkalti/backoff/v5 +[godoc image]: https://godoc.org/github.com/cenkalti/backoff?status.png + +[google-http-java-client]: https://github.com/google/google-http-java-client/blob/da1aa993e90285ec18579f1553339b00e19b3ab5/google-http-client/src/main/java/com/google/api/client/util/ExponentialBackOff.java +[exponential backoff wiki]: http://en.wikipedia.org/wiki/Exponential_backoff + +[retry-src]: https://github.com/cenkalti/backoff/blob/v5/retry.go +[example]: https://github.com/cenkalti/backoff/blob/v5/example_test.go diff --git a/vendor/github.com/cenkalti/backoff/v5/backoff.go b/vendor/github.com/cenkalti/backoff/v5/backoff.go new file mode 100644 index 00000000..dd2b24ca --- /dev/null +++ b/vendor/github.com/cenkalti/backoff/v5/backoff.go @@ -0,0 +1,66 @@ +// Package backoff implements backoff algorithms for retrying operations. +// +// Use Retry function for retrying operations that may fail. +// If Retry does not meet your needs, +// copy/paste the function into your project and modify as you wish. +// +// There is also Ticker type similar to time.Ticker. +// You can use it if you need to work with channels. +// +// See Examples section below for usage examples. +package backoff + +import "time" + +// BackOff is a backoff policy for retrying an operation. +type BackOff interface { + // NextBackOff returns the duration to wait before retrying the operation, + // backoff.Stop to indicate that no more retries should be made. + // + // Example usage: + // + // duration := backoff.NextBackOff() + // if duration == backoff.Stop { + // // Do not retry operation. + // } else { + // // Sleep for duration and retry operation. + // } + // + NextBackOff() time.Duration + + // Reset to initial state. + Reset() +} + +// Stop indicates that no more retries should be made for use in NextBackOff(). +const Stop time.Duration = -1 + +// ZeroBackOff is a fixed backoff policy whose backoff time is always zero, +// meaning that the operation is retried immediately without waiting, indefinitely. +type ZeroBackOff struct{} + +func (b *ZeroBackOff) Reset() {} + +func (b *ZeroBackOff) NextBackOff() time.Duration { return 0 } + +// StopBackOff is a fixed backoff policy that always returns backoff.Stop for +// NextBackOff(), meaning that the operation should never be retried. +type StopBackOff struct{} + +func (b *StopBackOff) Reset() {} + +func (b *StopBackOff) NextBackOff() time.Duration { return Stop } + +// ConstantBackOff is a backoff policy that always returns the same backoff delay. +// This is in contrast to an exponential backoff policy, +// which returns a delay that grows longer as you call NextBackOff() over and over again. +type ConstantBackOff struct { + Interval time.Duration +} + +func (b *ConstantBackOff) Reset() {} +func (b *ConstantBackOff) NextBackOff() time.Duration { return b.Interval } + +func NewConstantBackOff(d time.Duration) *ConstantBackOff { + return &ConstantBackOff{Interval: d} +} diff --git a/vendor/github.com/cenkalti/backoff/v5/error.go b/vendor/github.com/cenkalti/backoff/v5/error.go new file mode 100644 index 00000000..beb2b38a --- /dev/null +++ b/vendor/github.com/cenkalti/backoff/v5/error.go @@ -0,0 +1,46 @@ +package backoff + +import ( + "fmt" + "time" +) + +// PermanentError signals that the operation should not be retried. +type PermanentError struct { + Err error +} + +// Permanent wraps the given err in a *PermanentError. +func Permanent(err error) error { + if err == nil { + return nil + } + return &PermanentError{ + Err: err, + } +} + +// Error returns a string representation of the Permanent error. +func (e *PermanentError) Error() string { + return e.Err.Error() +} + +// Unwrap returns the wrapped error. +func (e *PermanentError) Unwrap() error { + return e.Err +} + +// RetryAfterError signals that the operation should be retried after the given duration. +type RetryAfterError struct { + Duration time.Duration +} + +// RetryAfter returns a RetryAfter error that specifies how long to wait before retrying. +func RetryAfter(seconds int) error { + return &RetryAfterError{Duration: time.Duration(seconds) * time.Second} +} + +// Error returns a string representation of the RetryAfter error. +func (e *RetryAfterError) Error() string { + return fmt.Sprintf("retry after %s", e.Duration) +} diff --git a/vendor/github.com/cenkalti/backoff/v5/exponential.go b/vendor/github.com/cenkalti/backoff/v5/exponential.go new file mode 100644 index 00000000..79d425e8 --- /dev/null +++ b/vendor/github.com/cenkalti/backoff/v5/exponential.go @@ -0,0 +1,118 @@ +package backoff + +import ( + "math/rand/v2" + "time" +) + +/* +ExponentialBackOff is a backoff implementation that increases the backoff +period for each retry attempt using a randomization function that grows exponentially. + +NextBackOff() is calculated using the following formula: + + randomized interval = + RetryInterval * (random value in range [1 - RandomizationFactor, 1 + RandomizationFactor]) + +In other words NextBackOff() will range between the randomization factor +percentage below and above the retry interval. + +For example, given the following parameters: + + RetryInterval = 2 + RandomizationFactor = 0.5 + Multiplier = 2 + +the actual backoff period used in the next retry attempt will range between 1 and 3 seconds, +multiplied by the exponential, that is, between 2 and 6 seconds. + +Note: MaxInterval caps the RetryInterval and not the randomized interval. + +Example: Given the following default arguments, for 9 tries the sequence will be: + + Request # RetryInterval (seconds) Randomized Interval (seconds) + + 1 0.5 [0.25, 0.75] + 2 0.75 [0.375, 1.125] + 3 1.125 [0.562, 1.687] + 4 1.687 [0.8435, 2.53] + 5 2.53 [1.265, 3.795] + 6 3.795 [1.897, 5.692] + 7 5.692 [2.846, 8.538] + 8 8.538 [4.269, 12.807] + 9 12.807 [6.403, 19.210] + +Note: Implementation is not thread-safe. +*/ +type ExponentialBackOff struct { + InitialInterval time.Duration + RandomizationFactor float64 + Multiplier float64 + MaxInterval time.Duration + + currentInterval time.Duration +} + +// Default values for ExponentialBackOff. +const ( + DefaultInitialInterval = 500 * time.Millisecond + DefaultRandomizationFactor = 0.5 + DefaultMultiplier = 1.5 + DefaultMaxInterval = 60 * time.Second +) + +// NewExponentialBackOff creates an instance of ExponentialBackOff using default values. +func NewExponentialBackOff() *ExponentialBackOff { + return &ExponentialBackOff{ + InitialInterval: DefaultInitialInterval, + RandomizationFactor: DefaultRandomizationFactor, + Multiplier: DefaultMultiplier, + MaxInterval: DefaultMaxInterval, + } +} + +// Reset the interval back to the initial retry interval and restarts the timer. +// Reset must be called before using b. +func (b *ExponentialBackOff) Reset() { + b.currentInterval = b.InitialInterval +} + +// NextBackOff calculates the next backoff interval using the formula: +// +// Randomized interval = RetryInterval * (1 ± RandomizationFactor) +func (b *ExponentialBackOff) NextBackOff() time.Duration { + if b.currentInterval == 0 { + b.currentInterval = b.InitialInterval + } + + next := getRandomValueFromInterval(b.RandomizationFactor, rand.Float64(), b.currentInterval) + b.incrementCurrentInterval() + return next +} + +// Increments the current interval by multiplying it with the multiplier. +func (b *ExponentialBackOff) incrementCurrentInterval() { + // Check for overflow, if overflow is detected set the current interval to the max interval. + if float64(b.currentInterval) >= float64(b.MaxInterval)/b.Multiplier { + b.currentInterval = b.MaxInterval + } else { + b.currentInterval = time.Duration(float64(b.currentInterval) * b.Multiplier) + } +} + +// Returns a random value from the following interval: +// +// [currentInterval - randomizationFactor * currentInterval, currentInterval + randomizationFactor * currentInterval]. +func getRandomValueFromInterval(randomizationFactor, random float64, currentInterval time.Duration) time.Duration { + if randomizationFactor == 0 { + return currentInterval // make sure no randomness is used when randomizationFactor is 0. + } + var delta = randomizationFactor * float64(currentInterval) + var minInterval = float64(currentInterval) - delta + var maxInterval = float64(currentInterval) + delta + + // Get a random value from the range [minInterval, maxInterval]. + // The formula used below has a +1 because if the minInterval is 1 and the maxInterval is 3 then + // we want a 33% chance for selecting either 1, 2 or 3. + return time.Duration(minInterval + (random * (maxInterval - minInterval + 1))) +} diff --git a/vendor/github.com/cenkalti/backoff/v5/retry.go b/vendor/github.com/cenkalti/backoff/v5/retry.go new file mode 100644 index 00000000..32a7f988 --- /dev/null +++ b/vendor/github.com/cenkalti/backoff/v5/retry.go @@ -0,0 +1,139 @@ +package backoff + +import ( + "context" + "errors" + "time" +) + +// DefaultMaxElapsedTime sets a default limit for the total retry duration. +const DefaultMaxElapsedTime = 15 * time.Minute + +// Operation is a function that attempts an operation and may be retried. +type Operation[T any] func() (T, error) + +// Notify is a function called on operation error with the error and backoff duration. +type Notify func(error, time.Duration) + +// retryOptions holds configuration settings for the retry mechanism. +type retryOptions struct { + BackOff BackOff // Strategy for calculating backoff periods. + Timer timer // Timer to manage retry delays. + Notify Notify // Optional function to notify on each retry error. + MaxTries uint // Maximum number of retry attempts. + MaxElapsedTime time.Duration // Maximum total time for all retries. +} + +type RetryOption func(*retryOptions) + +// WithBackOff configures a custom backoff strategy. +func WithBackOff(b BackOff) RetryOption { + return func(args *retryOptions) { + args.BackOff = b + } +} + +// withTimer sets a custom timer for managing delays between retries. +func withTimer(t timer) RetryOption { + return func(args *retryOptions) { + args.Timer = t + } +} + +// WithNotify sets a notification function to handle retry errors. +func WithNotify(n Notify) RetryOption { + return func(args *retryOptions) { + args.Notify = n + } +} + +// WithMaxTries limits the number of all attempts. +func WithMaxTries(n uint) RetryOption { + return func(args *retryOptions) { + args.MaxTries = n + } +} + +// WithMaxElapsedTime limits the total duration for retry attempts. +func WithMaxElapsedTime(d time.Duration) RetryOption { + return func(args *retryOptions) { + args.MaxElapsedTime = d + } +} + +// Retry attempts the operation until success, a permanent error, or backoff completion. +// It ensures the operation is executed at least once. +// +// Returns the operation result or error if retries are exhausted or context is cancelled. +func Retry[T any](ctx context.Context, operation Operation[T], opts ...RetryOption) (T, error) { + // Initialize default retry options. + args := &retryOptions{ + BackOff: NewExponentialBackOff(), + Timer: &defaultTimer{}, + MaxElapsedTime: DefaultMaxElapsedTime, + } + + // Apply user-provided options to the default settings. + for _, opt := range opts { + opt(args) + } + + defer args.Timer.Stop() + + startedAt := time.Now() + args.BackOff.Reset() + for numTries := uint(1); ; numTries++ { + // Execute the operation. + res, err := operation() + if err == nil { + return res, nil + } + + // Stop retrying if maximum tries exceeded. + if args.MaxTries > 0 && numTries >= args.MaxTries { + return res, err + } + + // Handle permanent errors without retrying. + var permanent *PermanentError + if errors.As(err, &permanent) { + return res, permanent.Unwrap() + } + + // Stop retrying if context is cancelled. + if cerr := context.Cause(ctx); cerr != nil { + return res, cerr + } + + // Calculate next backoff duration. + next := args.BackOff.NextBackOff() + if next == Stop { + return res, err + } + + // Reset backoff if RetryAfterError is encountered. + var retryAfter *RetryAfterError + if errors.As(err, &retryAfter) { + next = retryAfter.Duration + args.BackOff.Reset() + } + + // Stop retrying if maximum elapsed time exceeded. + if args.MaxElapsedTime > 0 && time.Since(startedAt)+next > args.MaxElapsedTime { + return res, err + } + + // Notify on error if a notifier function is provided. + if args.Notify != nil { + args.Notify(err, next) + } + + // Wait for the next backoff period or context cancellation. + args.Timer.Start(next) + select { + case <-args.Timer.C(): + case <-ctx.Done(): + return res, context.Cause(ctx) + } + } +} diff --git a/vendor/github.com/cenkalti/backoff/v5/ticker.go b/vendor/github.com/cenkalti/backoff/v5/ticker.go new file mode 100644 index 00000000..f0d4b2ae --- /dev/null +++ b/vendor/github.com/cenkalti/backoff/v5/ticker.go @@ -0,0 +1,83 @@ +package backoff + +import ( + "sync" + "time" +) + +// Ticker holds a channel that delivers `ticks' of a clock at times reported by a BackOff. +// +// Ticks will continue to arrive when the previous operation is still running, +// so operations that take a while to fail could run in quick succession. +type Ticker struct { + C <-chan time.Time + c chan time.Time + b BackOff + timer timer + stop chan struct{} + stopOnce sync.Once +} + +// NewTicker returns a new Ticker containing a channel that will send +// the time at times specified by the BackOff argument. Ticker is +// guaranteed to tick at least once. The channel is closed when Stop +// method is called or BackOff stops. It is not safe to manipulate the +// provided backoff policy (notably calling NextBackOff or Reset) +// while the ticker is running. +func NewTicker(b BackOff) *Ticker { + c := make(chan time.Time) + t := &Ticker{ + C: c, + c: c, + b: b, + timer: &defaultTimer{}, + stop: make(chan struct{}), + } + t.b.Reset() + go t.run() + return t +} + +// Stop turns off a ticker. After Stop, no more ticks will be sent. +func (t *Ticker) Stop() { + t.stopOnce.Do(func() { close(t.stop) }) +} + +func (t *Ticker) run() { + c := t.c + defer close(c) + + // Ticker is guaranteed to tick at least once. + afterC := t.send(time.Now()) + + for { + if afterC == nil { + return + } + + select { + case tick := <-afterC: + afterC = t.send(tick) + case <-t.stop: + t.c = nil // Prevent future ticks from being sent to the channel. + return + } + } +} + +func (t *Ticker) send(tick time.Time) <-chan time.Time { + select { + case t.c <- tick: + case <-t.stop: + return nil + } + + next := t.b.NextBackOff() + if next == Stop { + t.Stop() + return nil + } + + t.timer.Start(next) + return t.timer.C() +} diff --git a/vendor/github.com/cenkalti/backoff/v5/timer.go b/vendor/github.com/cenkalti/backoff/v5/timer.go new file mode 100644 index 00000000..a8953097 --- /dev/null +++ b/vendor/github.com/cenkalti/backoff/v5/timer.go @@ -0,0 +1,35 @@ +package backoff + +import "time" + +type timer interface { + Start(duration time.Duration) + Stop() + C() <-chan time.Time +} + +// defaultTimer implements Timer interface using time.Timer +type defaultTimer struct { + timer *time.Timer +} + +// C returns the timers channel which receives the current time when the timer fires. +func (t *defaultTimer) C() <-chan time.Time { + return t.timer.C +} + +// Start starts the timer to fire after the given duration +func (t *defaultTimer) Start(duration time.Duration) { + if t.timer == nil { + t.timer = time.NewTimer(duration) + } else { + t.timer.Reset(duration) + } +} + +// Stop is called when the timer is not used anymore and resources may be freed. +func (t *defaultTimer) Stop() { + if t.timer != nil { + t.timer.Stop() + } +} diff --git a/vendor/github.com/cespare/xxhash/v2/LICENSE.txt b/vendor/github.com/cespare/xxhash/v2/LICENSE.txt new file mode 100644 index 00000000..24b53065 --- /dev/null +++ b/vendor/github.com/cespare/xxhash/v2/LICENSE.txt @@ -0,0 +1,22 @@ +Copyright (c) 2016 Caleb Spare + +MIT License + +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. diff --git a/vendor/github.com/cespare/xxhash/v2/README.md b/vendor/github.com/cespare/xxhash/v2/README.md new file mode 100644 index 00000000..33c88305 --- /dev/null +++ b/vendor/github.com/cespare/xxhash/v2/README.md @@ -0,0 +1,74 @@ +# xxhash + +[![Go Reference](https://pkg.go.dev/badge/github.com/cespare/xxhash/v2.svg)](https://pkg.go.dev/github.com/cespare/xxhash/v2) +[![Test](https://github.com/cespare/xxhash/actions/workflows/test.yml/badge.svg)](https://github.com/cespare/xxhash/actions/workflows/test.yml) + +xxhash is a Go implementation of the 64-bit [xxHash] algorithm, XXH64. This is a +high-quality hashing algorithm that is much faster than anything in the Go +standard library. + +This package provides a straightforward API: + +``` +func Sum64(b []byte) uint64 +func Sum64String(s string) uint64 +type Digest struct{ ... } + func New() *Digest +``` + +The `Digest` type implements hash.Hash64. Its key methods are: + +``` +func (*Digest) Write([]byte) (int, error) +func (*Digest) WriteString(string) (int, error) +func (*Digest) Sum64() uint64 +``` + +The package is written with optimized pure Go and also contains even faster +assembly implementations for amd64 and arm64. If desired, the `purego` build tag +opts into using the Go code even on those architectures. + +[xxHash]: http://cyan4973.github.io/xxHash/ + +## Compatibility + +This package is in a module and the latest code is in version 2 of the module. +You need a version of Go with at least "minimal module compatibility" to use +github.com/cespare/xxhash/v2: + +* 1.9.7+ for Go 1.9 +* 1.10.3+ for Go 1.10 +* Go 1.11 or later + +I recommend using the latest release of Go. + +## Benchmarks + +Here are some quick benchmarks comparing the pure-Go and assembly +implementations of Sum64. + +| input size | purego | asm | +| ---------- | --------- | --------- | +| 4 B | 1.3 GB/s | 1.2 GB/s | +| 16 B | 2.9 GB/s | 3.5 GB/s | +| 100 B | 6.9 GB/s | 8.1 GB/s | +| 4 KB | 11.7 GB/s | 16.7 GB/s | +| 10 MB | 12.0 GB/s | 17.3 GB/s | + +These numbers were generated on Ubuntu 20.04 with an Intel Xeon Platinum 8252C +CPU using the following commands under Go 1.19.2: + +``` +benchstat <(go test -tags purego -benchtime 500ms -count 15 -bench 'Sum64$') +benchstat <(go test -benchtime 500ms -count 15 -bench 'Sum64$') +``` + +## Projects using this package + +- [InfluxDB](https://github.com/influxdata/influxdb) +- [Prometheus](https://github.com/prometheus/prometheus) +- [VictoriaMetrics](https://github.com/VictoriaMetrics/VictoriaMetrics) +- [FreeCache](https://github.com/coocood/freecache) +- [FastCache](https://github.com/VictoriaMetrics/fastcache) +- [Ristretto](https://github.com/dgraph-io/ristretto) +- [Badger](https://github.com/dgraph-io/badger) diff --git a/vendor/github.com/cespare/xxhash/v2/testall.sh b/vendor/github.com/cespare/xxhash/v2/testall.sh new file mode 100644 index 00000000..94b9c443 --- /dev/null +++ b/vendor/github.com/cespare/xxhash/v2/testall.sh @@ -0,0 +1,10 @@ +#!/bin/bash +set -eu -o pipefail + +# Small convenience script for running the tests with various combinations of +# arch/tags. This assumes we're running on amd64 and have qemu available. + +go test ./... +go test -tags purego ./... +GOARCH=arm64 go test +GOARCH=arm64 go test -tags purego diff --git a/vendor/github.com/cespare/xxhash/v2/xxhash.go b/vendor/github.com/cespare/xxhash/v2/xxhash.go new file mode 100644 index 00000000..78bddf1c --- /dev/null +++ b/vendor/github.com/cespare/xxhash/v2/xxhash.go @@ -0,0 +1,243 @@ +// Package xxhash implements the 64-bit variant of xxHash (XXH64) as described +// at http://cyan4973.github.io/xxHash/. +package xxhash + +import ( + "encoding/binary" + "errors" + "math/bits" +) + +const ( + prime1 uint64 = 11400714785074694791 + prime2 uint64 = 14029467366897019727 + prime3 uint64 = 1609587929392839161 + prime4 uint64 = 9650029242287828579 + prime5 uint64 = 2870177450012600261 +) + +// Store the primes in an array as well. +// +// The consts are used when possible in Go code to avoid MOVs but we need a +// contiguous array for the assembly code. +var primes = [...]uint64{prime1, prime2, prime3, prime4, prime5} + +// Digest implements hash.Hash64. +// +// Note that a zero-valued Digest is not ready to receive writes. +// Call Reset or create a Digest using New before calling other methods. +type Digest struct { + v1 uint64 + v2 uint64 + v3 uint64 + v4 uint64 + total uint64 + mem [32]byte + n int // how much of mem is used +} + +// New creates a new Digest with a zero seed. +func New() *Digest { + return NewWithSeed(0) +} + +// NewWithSeed creates a new Digest with the given seed. +func NewWithSeed(seed uint64) *Digest { + var d Digest + d.ResetWithSeed(seed) + return &d +} + +// Reset clears the Digest's state so that it can be reused. +// It uses a seed value of zero. +func (d *Digest) Reset() { + d.ResetWithSeed(0) +} + +// ResetWithSeed clears the Digest's state so that it can be reused. +// It uses the given seed to initialize the state. +func (d *Digest) ResetWithSeed(seed uint64) { + d.v1 = seed + prime1 + prime2 + d.v2 = seed + prime2 + d.v3 = seed + d.v4 = seed - prime1 + d.total = 0 + d.n = 0 +} + +// Size always returns 8 bytes. +func (d *Digest) Size() int { return 8 } + +// BlockSize always returns 32 bytes. +func (d *Digest) BlockSize() int { return 32 } + +// Write adds more data to d. It always returns len(b), nil. +func (d *Digest) Write(b []byte) (n int, err error) { + n = len(b) + d.total += uint64(n) + + memleft := d.mem[d.n&(len(d.mem)-1):] + + if d.n+n < 32 { + // This new data doesn't even fill the current block. + copy(memleft, b) + d.n += n + return + } + + if d.n > 0 { + // Finish off the partial block. + c := copy(memleft, b) + d.v1 = round(d.v1, u64(d.mem[0:8])) + d.v2 = round(d.v2, u64(d.mem[8:16])) + d.v3 = round(d.v3, u64(d.mem[16:24])) + d.v4 = round(d.v4, u64(d.mem[24:32])) + b = b[c:] + d.n = 0 + } + + if len(b) >= 32 { + // One or more full blocks left. + nw := writeBlocks(d, b) + b = b[nw:] + } + + // Store any remaining partial block. + copy(d.mem[:], b) + d.n = len(b) + + return +} + +// Sum appends the current hash to b and returns the resulting slice. +func (d *Digest) Sum(b []byte) []byte { + s := d.Sum64() + return append( + b, + byte(s>>56), + byte(s>>48), + byte(s>>40), + byte(s>>32), + byte(s>>24), + byte(s>>16), + byte(s>>8), + byte(s), + ) +} + +// Sum64 returns the current hash. +func (d *Digest) Sum64() uint64 { + var h uint64 + + if d.total >= 32 { + v1, v2, v3, v4 := d.v1, d.v2, d.v3, d.v4 + h = rol1(v1) + rol7(v2) + rol12(v3) + rol18(v4) + h = mergeRound(h, v1) + h = mergeRound(h, v2) + h = mergeRound(h, v3) + h = mergeRound(h, v4) + } else { + h = d.v3 + prime5 + } + + h += d.total + + b := d.mem[:d.n&(len(d.mem)-1)] + for ; len(b) >= 8; b = b[8:] { + k1 := round(0, u64(b[:8])) + h ^= k1 + h = rol27(h)*prime1 + prime4 + } + if len(b) >= 4 { + h ^= uint64(u32(b[:4])) * prime1 + h = rol23(h)*prime2 + prime3 + b = b[4:] + } + for ; len(b) > 0; b = b[1:] { + h ^= uint64(b[0]) * prime5 + h = rol11(h) * prime1 + } + + h ^= h >> 33 + h *= prime2 + h ^= h >> 29 + h *= prime3 + h ^= h >> 32 + + return h +} + +const ( + magic = "xxh\x06" + marshaledSize = len(magic) + 8*5 + 32 +) + +// MarshalBinary implements the encoding.BinaryMarshaler interface. +func (d *Digest) MarshalBinary() ([]byte, error) { + b := make([]byte, 0, marshaledSize) + b = append(b, magic...) + b = appendUint64(b, d.v1) + b = appendUint64(b, d.v2) + b = appendUint64(b, d.v3) + b = appendUint64(b, d.v4) + b = appendUint64(b, d.total) + b = append(b, d.mem[:d.n]...) + b = b[:len(b)+len(d.mem)-d.n] + return b, nil +} + +// UnmarshalBinary implements the encoding.BinaryUnmarshaler interface. +func (d *Digest) UnmarshalBinary(b []byte) error { + if len(b) < len(magic) || string(b[:len(magic)]) != magic { + return errors.New("xxhash: invalid hash state identifier") + } + if len(b) != marshaledSize { + return errors.New("xxhash: invalid hash state size") + } + b = b[len(magic):] + b, d.v1 = consumeUint64(b) + b, d.v2 = consumeUint64(b) + b, d.v3 = consumeUint64(b) + b, d.v4 = consumeUint64(b) + b, d.total = consumeUint64(b) + copy(d.mem[:], b) + d.n = int(d.total % uint64(len(d.mem))) + return nil +} + +func appendUint64(b []byte, x uint64) []byte { + var a [8]byte + binary.LittleEndian.PutUint64(a[:], x) + return append(b, a[:]...) +} + +func consumeUint64(b []byte) ([]byte, uint64) { + x := u64(b) + return b[8:], x +} + +func u64(b []byte) uint64 { return binary.LittleEndian.Uint64(b) } +func u32(b []byte) uint32 { return binary.LittleEndian.Uint32(b) } + +func round(acc, input uint64) uint64 { + acc += input * prime2 + acc = rol31(acc) + acc *= prime1 + return acc +} + +func mergeRound(acc, val uint64) uint64 { + val = round(0, val) + acc ^= val + acc = acc*prime1 + prime4 + return acc +} + +func rol1(x uint64) uint64 { return bits.RotateLeft64(x, 1) } +func rol7(x uint64) uint64 { return bits.RotateLeft64(x, 7) } +func rol11(x uint64) uint64 { return bits.RotateLeft64(x, 11) } +func rol12(x uint64) uint64 { return bits.RotateLeft64(x, 12) } +func rol18(x uint64) uint64 { return bits.RotateLeft64(x, 18) } +func rol23(x uint64) uint64 { return bits.RotateLeft64(x, 23) } +func rol27(x uint64) uint64 { return bits.RotateLeft64(x, 27) } +func rol31(x uint64) uint64 { return bits.RotateLeft64(x, 31) } diff --git a/vendor/github.com/cespare/xxhash/v2/xxhash_amd64.s b/vendor/github.com/cespare/xxhash/v2/xxhash_amd64.s new file mode 100644 index 00000000..3e8b1325 --- /dev/null +++ b/vendor/github.com/cespare/xxhash/v2/xxhash_amd64.s @@ -0,0 +1,209 @@ +//go:build !appengine && gc && !purego +// +build !appengine +// +build gc +// +build !purego + +#include "textflag.h" + +// Registers: +#define h AX +#define d AX +#define p SI // pointer to advance through b +#define n DX +#define end BX // loop end +#define v1 R8 +#define v2 R9 +#define v3 R10 +#define v4 R11 +#define x R12 +#define prime1 R13 +#define prime2 R14 +#define prime4 DI + +#define round(acc, x) \ + IMULQ prime2, x \ + ADDQ x, acc \ + ROLQ $31, acc \ + IMULQ prime1, acc + +// round0 performs the operation x = round(0, x). +#define round0(x) \ + IMULQ prime2, x \ + ROLQ $31, x \ + IMULQ prime1, x + +// mergeRound applies a merge round on the two registers acc and x. +// It assumes that prime1, prime2, and prime4 have been loaded. +#define mergeRound(acc, x) \ + round0(x) \ + XORQ x, acc \ + IMULQ prime1, acc \ + ADDQ prime4, acc + +// blockLoop processes as many 32-byte blocks as possible, +// updating v1, v2, v3, and v4. It assumes that there is at least one block +// to process. +#define blockLoop() \ +loop: \ + MOVQ +0(p), x \ + round(v1, x) \ + MOVQ +8(p), x \ + round(v2, x) \ + MOVQ +16(p), x \ + round(v3, x) \ + MOVQ +24(p), x \ + round(v4, x) \ + ADDQ $32, p \ + CMPQ p, end \ + JLE loop + +// func Sum64(b []byte) uint64 +TEXT ·Sum64(SB), NOSPLIT|NOFRAME, $0-32 + // Load fixed primes. + MOVQ ·primes+0(SB), prime1 + MOVQ ·primes+8(SB), prime2 + MOVQ ·primes+24(SB), prime4 + + // Load slice. + MOVQ b_base+0(FP), p + MOVQ b_len+8(FP), n + LEAQ (p)(n*1), end + + // The first loop limit will be len(b)-32. + SUBQ $32, end + + // Check whether we have at least one block. + CMPQ n, $32 + JLT noBlocks + + // Set up initial state (v1, v2, v3, v4). + MOVQ prime1, v1 + ADDQ prime2, v1 + MOVQ prime2, v2 + XORQ v3, v3 + XORQ v4, v4 + SUBQ prime1, v4 + + blockLoop() + + MOVQ v1, h + ROLQ $1, h + MOVQ v2, x + ROLQ $7, x + ADDQ x, h + MOVQ v3, x + ROLQ $12, x + ADDQ x, h + MOVQ v4, x + ROLQ $18, x + ADDQ x, h + + mergeRound(h, v1) + mergeRound(h, v2) + mergeRound(h, v3) + mergeRound(h, v4) + + JMP afterBlocks + +noBlocks: + MOVQ ·primes+32(SB), h + +afterBlocks: + ADDQ n, h + + ADDQ $24, end + CMPQ p, end + JG try4 + +loop8: + MOVQ (p), x + ADDQ $8, p + round0(x) + XORQ x, h + ROLQ $27, h + IMULQ prime1, h + ADDQ prime4, h + + CMPQ p, end + JLE loop8 + +try4: + ADDQ $4, end + CMPQ p, end + JG try1 + + MOVL (p), x + ADDQ $4, p + IMULQ prime1, x + XORQ x, h + + ROLQ $23, h + IMULQ prime2, h + ADDQ ·primes+16(SB), h + +try1: + ADDQ $4, end + CMPQ p, end + JGE finalize + +loop1: + MOVBQZX (p), x + ADDQ $1, p + IMULQ ·primes+32(SB), x + XORQ x, h + ROLQ $11, h + IMULQ prime1, h + + CMPQ p, end + JL loop1 + +finalize: + MOVQ h, x + SHRQ $33, x + XORQ x, h + IMULQ prime2, h + MOVQ h, x + SHRQ $29, x + XORQ x, h + IMULQ ·primes+16(SB), h + MOVQ h, x + SHRQ $32, x + XORQ x, h + + MOVQ h, ret+24(FP) + RET + +// func writeBlocks(d *Digest, b []byte) int +TEXT ·writeBlocks(SB), NOSPLIT|NOFRAME, $0-40 + // Load fixed primes needed for round. + MOVQ ·primes+0(SB), prime1 + MOVQ ·primes+8(SB), prime2 + + // Load slice. + MOVQ b_base+8(FP), p + MOVQ b_len+16(FP), n + LEAQ (p)(n*1), end + SUBQ $32, end + + // Load vN from d. + MOVQ s+0(FP), d + MOVQ 0(d), v1 + MOVQ 8(d), v2 + MOVQ 16(d), v3 + MOVQ 24(d), v4 + + // We don't need to check the loop condition here; this function is + // always called with at least one block of data to process. + blockLoop() + + // Copy vN back to d. + MOVQ v1, 0(d) + MOVQ v2, 8(d) + MOVQ v3, 16(d) + MOVQ v4, 24(d) + + // The number of bytes written is p minus the old base pointer. + SUBQ b_base+8(FP), p + MOVQ p, ret+32(FP) + + RET diff --git a/vendor/github.com/cespare/xxhash/v2/xxhash_arm64.s b/vendor/github.com/cespare/xxhash/v2/xxhash_arm64.s new file mode 100644 index 00000000..7e3145a2 --- /dev/null +++ b/vendor/github.com/cespare/xxhash/v2/xxhash_arm64.s @@ -0,0 +1,183 @@ +//go:build !appengine && gc && !purego +// +build !appengine +// +build gc +// +build !purego + +#include "textflag.h" + +// Registers: +#define digest R1 +#define h R2 // return value +#define p R3 // input pointer +#define n R4 // input length +#define nblocks R5 // n / 32 +#define prime1 R7 +#define prime2 R8 +#define prime3 R9 +#define prime4 R10 +#define prime5 R11 +#define v1 R12 +#define v2 R13 +#define v3 R14 +#define v4 R15 +#define x1 R20 +#define x2 R21 +#define x3 R22 +#define x4 R23 + +#define round(acc, x) \ + MADD prime2, acc, x, acc \ + ROR $64-31, acc \ + MUL prime1, acc + +// round0 performs the operation x = round(0, x). +#define round0(x) \ + MUL prime2, x \ + ROR $64-31, x \ + MUL prime1, x + +#define mergeRound(acc, x) \ + round0(x) \ + EOR x, acc \ + MADD acc, prime4, prime1, acc + +// blockLoop processes as many 32-byte blocks as possible, +// updating v1, v2, v3, and v4. It assumes that n >= 32. +#define blockLoop() \ + LSR $5, n, nblocks \ + PCALIGN $16 \ + loop: \ + LDP.P 16(p), (x1, x2) \ + LDP.P 16(p), (x3, x4) \ + round(v1, x1) \ + round(v2, x2) \ + round(v3, x3) \ + round(v4, x4) \ + SUB $1, nblocks \ + CBNZ nblocks, loop + +// func Sum64(b []byte) uint64 +TEXT ·Sum64(SB), NOSPLIT|NOFRAME, $0-32 + LDP b_base+0(FP), (p, n) + + LDP ·primes+0(SB), (prime1, prime2) + LDP ·primes+16(SB), (prime3, prime4) + MOVD ·primes+32(SB), prime5 + + CMP $32, n + CSEL LT, prime5, ZR, h // if n < 32 { h = prime5 } else { h = 0 } + BLT afterLoop + + ADD prime1, prime2, v1 + MOVD prime2, v2 + MOVD $0, v3 + NEG prime1, v4 + + blockLoop() + + ROR $64-1, v1, x1 + ROR $64-7, v2, x2 + ADD x1, x2 + ROR $64-12, v3, x3 + ROR $64-18, v4, x4 + ADD x3, x4 + ADD x2, x4, h + + mergeRound(h, v1) + mergeRound(h, v2) + mergeRound(h, v3) + mergeRound(h, v4) + +afterLoop: + ADD n, h + + TBZ $4, n, try8 + LDP.P 16(p), (x1, x2) + + round0(x1) + + // NOTE: here and below, sequencing the EOR after the ROR (using a + // rotated register) is worth a small but measurable speedup for small + // inputs. + ROR $64-27, h + EOR x1 @> 64-27, h, h + MADD h, prime4, prime1, h + + round0(x2) + ROR $64-27, h + EOR x2 @> 64-27, h, h + MADD h, prime4, prime1, h + +try8: + TBZ $3, n, try4 + MOVD.P 8(p), x1 + + round0(x1) + ROR $64-27, h + EOR x1 @> 64-27, h, h + MADD h, prime4, prime1, h + +try4: + TBZ $2, n, try2 + MOVWU.P 4(p), x2 + + MUL prime1, x2 + ROR $64-23, h + EOR x2 @> 64-23, h, h + MADD h, prime3, prime2, h + +try2: + TBZ $1, n, try1 + MOVHU.P 2(p), x3 + AND $255, x3, x1 + LSR $8, x3, x2 + + MUL prime5, x1 + ROR $64-11, h + EOR x1 @> 64-11, h, h + MUL prime1, h + + MUL prime5, x2 + ROR $64-11, h + EOR x2 @> 64-11, h, h + MUL prime1, h + +try1: + TBZ $0, n, finalize + MOVBU (p), x4 + + MUL prime5, x4 + ROR $64-11, h + EOR x4 @> 64-11, h, h + MUL prime1, h + +finalize: + EOR h >> 33, h + MUL prime2, h + EOR h >> 29, h + MUL prime3, h + EOR h >> 32, h + + MOVD h, ret+24(FP) + RET + +// func writeBlocks(d *Digest, b []byte) int +TEXT ·writeBlocks(SB), NOSPLIT|NOFRAME, $0-40 + LDP ·primes+0(SB), (prime1, prime2) + + // Load state. Assume v[1-4] are stored contiguously. + MOVD d+0(FP), digest + LDP 0(digest), (v1, v2) + LDP 16(digest), (v3, v4) + + LDP b_base+8(FP), (p, n) + + blockLoop() + + // Store updated state. + STP (v1, v2), 0(digest) + STP (v3, v4), 16(digest) + + BIC $31, n + MOVD n, ret+32(FP) + RET diff --git a/vendor/github.com/cespare/xxhash/v2/xxhash_asm.go b/vendor/github.com/cespare/xxhash/v2/xxhash_asm.go new file mode 100644 index 00000000..78f95f25 --- /dev/null +++ b/vendor/github.com/cespare/xxhash/v2/xxhash_asm.go @@ -0,0 +1,15 @@ +//go:build (amd64 || arm64) && !appengine && gc && !purego +// +build amd64 arm64 +// +build !appengine +// +build gc +// +build !purego + +package xxhash + +// Sum64 computes the 64-bit xxHash digest of b with a zero seed. +// +//go:noescape +func Sum64(b []byte) uint64 + +//go:noescape +func writeBlocks(d *Digest, b []byte) int diff --git a/vendor/github.com/cespare/xxhash/v2/xxhash_other.go b/vendor/github.com/cespare/xxhash/v2/xxhash_other.go new file mode 100644 index 00000000..118e49e8 --- /dev/null +++ b/vendor/github.com/cespare/xxhash/v2/xxhash_other.go @@ -0,0 +1,76 @@ +//go:build (!amd64 && !arm64) || appengine || !gc || purego +// +build !amd64,!arm64 appengine !gc purego + +package xxhash + +// Sum64 computes the 64-bit xxHash digest of b with a zero seed. +func Sum64(b []byte) uint64 { + // A simpler version would be + // d := New() + // d.Write(b) + // return d.Sum64() + // but this is faster, particularly for small inputs. + + n := len(b) + var h uint64 + + if n >= 32 { + v1 := primes[0] + prime2 + v2 := prime2 + v3 := uint64(0) + v4 := -primes[0] + for len(b) >= 32 { + v1 = round(v1, u64(b[0:8:len(b)])) + v2 = round(v2, u64(b[8:16:len(b)])) + v3 = round(v3, u64(b[16:24:len(b)])) + v4 = round(v4, u64(b[24:32:len(b)])) + b = b[32:len(b):len(b)] + } + h = rol1(v1) + rol7(v2) + rol12(v3) + rol18(v4) + h = mergeRound(h, v1) + h = mergeRound(h, v2) + h = mergeRound(h, v3) + h = mergeRound(h, v4) + } else { + h = prime5 + } + + h += uint64(n) + + for ; len(b) >= 8; b = b[8:] { + k1 := round(0, u64(b[:8])) + h ^= k1 + h = rol27(h)*prime1 + prime4 + } + if len(b) >= 4 { + h ^= uint64(u32(b[:4])) * prime1 + h = rol23(h)*prime2 + prime3 + b = b[4:] + } + for ; len(b) > 0; b = b[1:] { + h ^= uint64(b[0]) * prime5 + h = rol11(h) * prime1 + } + + h ^= h >> 33 + h *= prime2 + h ^= h >> 29 + h *= prime3 + h ^= h >> 32 + + return h +} + +func writeBlocks(d *Digest, b []byte) int { + v1, v2, v3, v4 := d.v1, d.v2, d.v3, d.v4 + n := len(b) + for len(b) >= 32 { + v1 = round(v1, u64(b[0:8:len(b)])) + v2 = round(v2, u64(b[8:16:len(b)])) + v3 = round(v3, u64(b[16:24:len(b)])) + v4 = round(v4, u64(b[24:32:len(b)])) + b = b[32:len(b):len(b)] + } + d.v1, d.v2, d.v3, d.v4 = v1, v2, v3, v4 + return n - len(b) +} diff --git a/vendor/github.com/cespare/xxhash/v2/xxhash_safe.go b/vendor/github.com/cespare/xxhash/v2/xxhash_safe.go new file mode 100644 index 00000000..05f5e7df --- /dev/null +++ b/vendor/github.com/cespare/xxhash/v2/xxhash_safe.go @@ -0,0 +1,16 @@ +//go:build appengine +// +build appengine + +// This file contains the safe implementations of otherwise unsafe-using code. + +package xxhash + +// Sum64String computes the 64-bit xxHash digest of s with a zero seed. +func Sum64String(s string) uint64 { + return Sum64([]byte(s)) +} + +// WriteString adds more data to d. It always returns len(s), nil. +func (d *Digest) WriteString(s string) (n int, err error) { + return d.Write([]byte(s)) +} diff --git a/vendor/github.com/cespare/xxhash/v2/xxhash_unsafe.go b/vendor/github.com/cespare/xxhash/v2/xxhash_unsafe.go new file mode 100644 index 00000000..cf9d42ae --- /dev/null +++ b/vendor/github.com/cespare/xxhash/v2/xxhash_unsafe.go @@ -0,0 +1,58 @@ +//go:build !appengine +// +build !appengine + +// This file encapsulates usage of unsafe. +// xxhash_safe.go contains the safe implementations. + +package xxhash + +import ( + "unsafe" +) + +// In the future it's possible that compiler optimizations will make these +// XxxString functions unnecessary by realizing that calls such as +// Sum64([]byte(s)) don't need to copy s. See https://go.dev/issue/2205. +// If that happens, even if we keep these functions they can be replaced with +// the trivial safe code. + +// NOTE: The usual way of doing an unsafe string-to-[]byte conversion is: +// +// var b []byte +// bh := (*reflect.SliceHeader)(unsafe.Pointer(&b)) +// bh.Data = (*reflect.StringHeader)(unsafe.Pointer(&s)).Data +// bh.Len = len(s) +// bh.Cap = len(s) +// +// Unfortunately, as of Go 1.15.3 the inliner's cost model assigns a high enough +// weight to this sequence of expressions that any function that uses it will +// not be inlined. Instead, the functions below use a different unsafe +// conversion designed to minimize the inliner weight and allow both to be +// inlined. There is also a test (TestInlining) which verifies that these are +// inlined. +// +// See https://github.com/golang/go/issues/42739 for discussion. + +// Sum64String computes the 64-bit xxHash digest of s with a zero seed. +// It may be faster than Sum64([]byte(s)) by avoiding a copy. +func Sum64String(s string) uint64 { + b := *(*[]byte)(unsafe.Pointer(&sliceHeader{s, len(s)})) + return Sum64(b) +} + +// WriteString adds more data to d. It always returns len(s), nil. +// It may be faster than Write([]byte(s)) by avoiding a copy. +func (d *Digest) WriteString(s string) (n int, err error) { + d.Write(*(*[]byte)(unsafe.Pointer(&sliceHeader{s, len(s)}))) + // d.Write always returns len(s), nil. + // Ignoring the return output and returning these fixed values buys a + // savings of 6 in the inliner's cost model. + return len(s), nil +} + +// sliceHeader is similar to reflect.SliceHeader, but it assumes that the layout +// of the first two words is the same as the layout of a string. +type sliceHeader struct { + s string + cap int +} diff --git a/vendor/github.com/containerd/errdefs/LICENSE b/vendor/github.com/containerd/errdefs/LICENSE new file mode 100644 index 00000000..584149b6 --- /dev/null +++ b/vendor/github.com/containerd/errdefs/LICENSE @@ -0,0 +1,191 @@ + + Apache License + Version 2.0, January 2004 + https://www.apache.org/licenses/ + + TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + + 1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + + 2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + + 3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + + 4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + + 5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + + 6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + + 7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + + 8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + + 9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + + END OF TERMS AND CONDITIONS + + Copyright The containerd Authors + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. diff --git a/vendor/github.com/containerd/errdefs/README.md b/vendor/github.com/containerd/errdefs/README.md new file mode 100644 index 00000000..bd418c63 --- /dev/null +++ b/vendor/github.com/containerd/errdefs/README.md @@ -0,0 +1,13 @@ +# errdefs + +A Go package for defining and checking common containerd errors. + +## Project details + +**errdefs** is a containerd sub-project, licensed under the [Apache 2.0 license](./LICENSE). +As a containerd sub-project, you will find the: + * [Project governance](https://github.com/containerd/project/blob/main/GOVERNANCE.md), + * [Maintainers](https://github.com/containerd/project/blob/main/MAINTAINERS), + * and [Contributing guidelines](https://github.com/containerd/project/blob/main/CONTRIBUTING.md) + +information in our [`containerd/project`](https://github.com/containerd/project) repository. diff --git a/vendor/github.com/containerd/errdefs/errors.go b/vendor/github.com/containerd/errdefs/errors.go new file mode 100644 index 00000000..f654d196 --- /dev/null +++ b/vendor/github.com/containerd/errdefs/errors.go @@ -0,0 +1,443 @@ +/* + Copyright The containerd Authors. + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +// Package errdefs defines the common errors used throughout containerd +// packages. +// +// Use with fmt.Errorf to add context to an error. +// +// To detect an error class, use the IsXXX functions to tell whether an error +// is of a certain type. +package errdefs + +import ( + "context" + "errors" +) + +// Definitions of common error types used throughout containerd. All containerd +// errors returned by most packages will map into one of these errors classes. +// Packages should return errors of these types when they want to instruct a +// client to take a particular action. +// +// These errors map closely to grpc errors. +var ( + ErrUnknown = errUnknown{} + ErrInvalidArgument = errInvalidArgument{} + ErrNotFound = errNotFound{} + ErrAlreadyExists = errAlreadyExists{} + ErrPermissionDenied = errPermissionDenied{} + ErrResourceExhausted = errResourceExhausted{} + ErrFailedPrecondition = errFailedPrecondition{} + ErrConflict = errConflict{} + ErrNotModified = errNotModified{} + ErrAborted = errAborted{} + ErrOutOfRange = errOutOfRange{} + ErrNotImplemented = errNotImplemented{} + ErrInternal = errInternal{} + ErrUnavailable = errUnavailable{} + ErrDataLoss = errDataLoss{} + ErrUnauthenticated = errUnauthorized{} +) + +// cancelled maps to Moby's "ErrCancelled" +type cancelled interface { + Cancelled() +} + +// IsCanceled returns true if the error is due to `context.Canceled`. +func IsCanceled(err error) bool { + return errors.Is(err, context.Canceled) || isInterface[cancelled](err) +} + +type errUnknown struct{} + +func (errUnknown) Error() string { return "unknown" } + +func (errUnknown) Unknown() {} + +func (e errUnknown) WithMessage(msg string) error { + return customMessage{e, msg} +} + +// unknown maps to Moby's "ErrUnknown" +type unknown interface { + Unknown() +} + +// IsUnknown returns true if the error is due to an unknown error, +// unhandled condition or unexpected response. +func IsUnknown(err error) bool { + return errors.Is(err, errUnknown{}) || isInterface[unknown](err) +} + +type errInvalidArgument struct{} + +func (errInvalidArgument) Error() string { return "invalid argument" } + +func (errInvalidArgument) InvalidParameter() {} + +func (e errInvalidArgument) WithMessage(msg string) error { + return customMessage{e, msg} +} + +// invalidParameter maps to Moby's "ErrInvalidParameter" +type invalidParameter interface { + InvalidParameter() +} + +// IsInvalidArgument returns true if the error is due to an invalid argument +func IsInvalidArgument(err error) bool { + return errors.Is(err, ErrInvalidArgument) || isInterface[invalidParameter](err) +} + +// deadlineExceed maps to Moby's "ErrDeadline" +type deadlineExceeded interface { + DeadlineExceeded() +} + +// IsDeadlineExceeded returns true if the error is due to +// `context.DeadlineExceeded`. +func IsDeadlineExceeded(err error) bool { + return errors.Is(err, context.DeadlineExceeded) || isInterface[deadlineExceeded](err) +} + +type errNotFound struct{} + +func (errNotFound) Error() string { return "not found" } + +func (errNotFound) NotFound() {} + +func (e errNotFound) WithMessage(msg string) error { + return customMessage{e, msg} +} + +// notFound maps to Moby's "ErrNotFound" +type notFound interface { + NotFound() +} + +// IsNotFound returns true if the error is due to a missing object +func IsNotFound(err error) bool { + return errors.Is(err, ErrNotFound) || isInterface[notFound](err) +} + +type errAlreadyExists struct{} + +func (errAlreadyExists) Error() string { return "already exists" } + +func (errAlreadyExists) AlreadyExists() {} + +func (e errAlreadyExists) WithMessage(msg string) error { + return customMessage{e, msg} +} + +type alreadyExists interface { + AlreadyExists() +} + +// IsAlreadyExists returns true if the error is due to an already existing +// metadata item +func IsAlreadyExists(err error) bool { + return errors.Is(err, ErrAlreadyExists) || isInterface[alreadyExists](err) +} + +type errPermissionDenied struct{} + +func (errPermissionDenied) Error() string { return "permission denied" } + +func (errPermissionDenied) Forbidden() {} + +func (e errPermissionDenied) WithMessage(msg string) error { + return customMessage{e, msg} +} + +// forbidden maps to Moby's "ErrForbidden" +type forbidden interface { + Forbidden() +} + +// IsPermissionDenied returns true if the error is due to permission denied +// or forbidden (403) response +func IsPermissionDenied(err error) bool { + return errors.Is(err, ErrPermissionDenied) || isInterface[forbidden](err) +} + +type errResourceExhausted struct{} + +func (errResourceExhausted) Error() string { return "resource exhausted" } + +func (errResourceExhausted) ResourceExhausted() {} + +func (e errResourceExhausted) WithMessage(msg string) error { + return customMessage{e, msg} +} + +type resourceExhausted interface { + ResourceExhausted() +} + +// IsResourceExhausted returns true if the error is due to +// a lack of resources or too many attempts. +func IsResourceExhausted(err error) bool { + return errors.Is(err, errResourceExhausted{}) || isInterface[resourceExhausted](err) +} + +type errFailedPrecondition struct{} + +func (e errFailedPrecondition) Error() string { return "failed precondition" } + +func (errFailedPrecondition) FailedPrecondition() {} + +func (e errFailedPrecondition) WithMessage(msg string) error { + return customMessage{e, msg} +} + +type failedPrecondition interface { + FailedPrecondition() +} + +// IsFailedPrecondition returns true if an operation could not proceed due to +// the lack of a particular condition +func IsFailedPrecondition(err error) bool { + return errors.Is(err, errFailedPrecondition{}) || isInterface[failedPrecondition](err) +} + +type errConflict struct{} + +func (errConflict) Error() string { return "conflict" } + +func (errConflict) Conflict() {} + +func (e errConflict) WithMessage(msg string) error { + return customMessage{e, msg} +} + +// conflict maps to Moby's "ErrConflict" +type conflict interface { + Conflict() +} + +// IsConflict returns true if an operation could not proceed due to +// a conflict. +func IsConflict(err error) bool { + return errors.Is(err, errConflict{}) || isInterface[conflict](err) +} + +type errNotModified struct{} + +func (errNotModified) Error() string { return "not modified" } + +func (errNotModified) NotModified() {} + +func (e errNotModified) WithMessage(msg string) error { + return customMessage{e, msg} +} + +// notModified maps to Moby's "ErrNotModified" +type notModified interface { + NotModified() +} + +// IsNotModified returns true if an operation could not proceed due +// to an object not modified from a previous state. +func IsNotModified(err error) bool { + return errors.Is(err, errNotModified{}) || isInterface[notModified](err) +} + +type errAborted struct{} + +func (errAborted) Error() string { return "aborted" } + +func (errAborted) Aborted() {} + +func (e errAborted) WithMessage(msg string) error { + return customMessage{e, msg} +} + +type aborted interface { + Aborted() +} + +// IsAborted returns true if an operation was aborted. +func IsAborted(err error) bool { + return errors.Is(err, errAborted{}) || isInterface[aborted](err) +} + +type errOutOfRange struct{} + +func (errOutOfRange) Error() string { return "out of range" } + +func (errOutOfRange) OutOfRange() {} + +func (e errOutOfRange) WithMessage(msg string) error { + return customMessage{e, msg} +} + +type outOfRange interface { + OutOfRange() +} + +// IsOutOfRange returns true if an operation could not proceed due +// to data being out of the expected range. +func IsOutOfRange(err error) bool { + return errors.Is(err, errOutOfRange{}) || isInterface[outOfRange](err) +} + +type errNotImplemented struct{} + +func (errNotImplemented) Error() string { return "not implemented" } + +func (errNotImplemented) NotImplemented() {} + +func (e errNotImplemented) WithMessage(msg string) error { + return customMessage{e, msg} +} + +// notImplemented maps to Moby's "ErrNotImplemented" +type notImplemented interface { + NotImplemented() +} + +// IsNotImplemented returns true if the error is due to not being implemented +func IsNotImplemented(err error) bool { + return errors.Is(err, errNotImplemented{}) || isInterface[notImplemented](err) +} + +type errInternal struct{} + +func (errInternal) Error() string { return "internal" } + +func (errInternal) System() {} + +func (e errInternal) WithMessage(msg string) error { + return customMessage{e, msg} +} + +// system maps to Moby's "ErrSystem" +type system interface { + System() +} + +// IsInternal returns true if the error returns to an internal or system error +func IsInternal(err error) bool { + return errors.Is(err, errInternal{}) || isInterface[system](err) +} + +type errUnavailable struct{} + +func (errUnavailable) Error() string { return "unavailable" } + +func (errUnavailable) Unavailable() {} + +func (e errUnavailable) WithMessage(msg string) error { + return customMessage{e, msg} +} + +// unavailable maps to Moby's "ErrUnavailable" +type unavailable interface { + Unavailable() +} + +// IsUnavailable returns true if the error is due to a resource being unavailable +func IsUnavailable(err error) bool { + return errors.Is(err, errUnavailable{}) || isInterface[unavailable](err) +} + +type errDataLoss struct{} + +func (errDataLoss) Error() string { return "data loss" } + +func (errDataLoss) DataLoss() {} + +func (e errDataLoss) WithMessage(msg string) error { + return customMessage{e, msg} +} + +// dataLoss maps to Moby's "ErrDataLoss" +type dataLoss interface { + DataLoss() +} + +// IsDataLoss returns true if data during an operation was lost or corrupted +func IsDataLoss(err error) bool { + return errors.Is(err, errDataLoss{}) || isInterface[dataLoss](err) +} + +type errUnauthorized struct{} + +func (errUnauthorized) Error() string { return "unauthorized" } + +func (errUnauthorized) Unauthorized() {} + +func (e errUnauthorized) WithMessage(msg string) error { + return customMessage{e, msg} +} + +// unauthorized maps to Moby's "ErrUnauthorized" +type unauthorized interface { + Unauthorized() +} + +// IsUnauthorized returns true if the error indicates that the user was +// unauthenticated or unauthorized. +func IsUnauthorized(err error) bool { + return errors.Is(err, errUnauthorized{}) || isInterface[unauthorized](err) +} + +func isInterface[T any](err error) bool { + for { + switch x := err.(type) { + case T: + return true + case customMessage: + err = x.err + case interface{ Unwrap() error }: + err = x.Unwrap() + if err == nil { + return false + } + case interface{ Unwrap() []error }: + for _, err := range x.Unwrap() { + if isInterface[T](err) { + return true + } + } + return false + default: + return false + } + } +} + +// customMessage is used to provide a defined error with a custom message. +// The message is not wrapped but can be compared by the `Is(error) bool` interface. +type customMessage struct { + err error + msg string +} + +func (c customMessage) Is(err error) bool { + return c.err == err +} + +func (c customMessage) As(target any) bool { + return errors.As(c.err, target) +} + +func (c customMessage) Error() string { + return c.msg +} diff --git a/vendor/github.com/containerd/errdefs/pkg/LICENSE b/vendor/github.com/containerd/errdefs/pkg/LICENSE new file mode 100644 index 00000000..584149b6 --- /dev/null +++ b/vendor/github.com/containerd/errdefs/pkg/LICENSE @@ -0,0 +1,191 @@ + + Apache License + Version 2.0, January 2004 + https://www.apache.org/licenses/ + + TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + + 1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + + 2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + + 3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + + 4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + + 5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + + 6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + + 7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + + 8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + + 9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + + END OF TERMS AND CONDITIONS + + Copyright The containerd Authors + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. diff --git a/vendor/github.com/containerd/errdefs/pkg/errhttp/http.go b/vendor/github.com/containerd/errdefs/pkg/errhttp/http.go new file mode 100644 index 00000000..d7cd2b8c --- /dev/null +++ b/vendor/github.com/containerd/errdefs/pkg/errhttp/http.go @@ -0,0 +1,96 @@ +/* + Copyright The containerd Authors. + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +// Package errhttp provides utility functions for translating errors to +// and from a HTTP context. +// +// The functions ToHTTP and ToNative can be used to map server-side and +// client-side errors to the correct types. +package errhttp + +import ( + "errors" + "net/http" + + "github.com/containerd/errdefs" + "github.com/containerd/errdefs/pkg/internal/cause" +) + +// ToHTTP returns the best status code for the given error +func ToHTTP(err error) int { + switch { + case errdefs.IsNotFound(err): + return http.StatusNotFound + case errdefs.IsInvalidArgument(err): + return http.StatusBadRequest + case errdefs.IsConflict(err): + return http.StatusConflict + case errdefs.IsNotModified(err): + return http.StatusNotModified + case errdefs.IsFailedPrecondition(err): + return http.StatusPreconditionFailed + case errdefs.IsUnauthorized(err): + return http.StatusUnauthorized + case errdefs.IsPermissionDenied(err): + return http.StatusForbidden + case errdefs.IsResourceExhausted(err): + return http.StatusTooManyRequests + case errdefs.IsInternal(err): + return http.StatusInternalServerError + case errdefs.IsNotImplemented(err): + return http.StatusNotImplemented + case errdefs.IsUnavailable(err): + return http.StatusServiceUnavailable + case errdefs.IsUnknown(err): + var unexpected cause.ErrUnexpectedStatus + if errors.As(err, &unexpected) && unexpected.Status >= 200 && unexpected.Status < 600 { + return unexpected.Status + } + return http.StatusInternalServerError + default: + return http.StatusInternalServerError + } +} + +// ToNative returns the error best matching the HTTP status code +func ToNative(statusCode int) error { + switch statusCode { + case http.StatusNotFound: + return errdefs.ErrNotFound + case http.StatusBadRequest: + return errdefs.ErrInvalidArgument + case http.StatusConflict: + return errdefs.ErrConflict + case http.StatusPreconditionFailed: + return errdefs.ErrFailedPrecondition + case http.StatusUnauthorized: + return errdefs.ErrUnauthenticated + case http.StatusForbidden: + return errdefs.ErrPermissionDenied + case http.StatusNotModified: + return errdefs.ErrNotModified + case http.StatusTooManyRequests: + return errdefs.ErrResourceExhausted + case http.StatusInternalServerError: + return errdefs.ErrInternal + case http.StatusNotImplemented: + return errdefs.ErrNotImplemented + case http.StatusServiceUnavailable: + return errdefs.ErrUnavailable + default: + return cause.ErrUnexpectedStatus{Status: statusCode} + } +} diff --git a/vendor/github.com/containerd/errdefs/pkg/internal/cause/cause.go b/vendor/github.com/containerd/errdefs/pkg/internal/cause/cause.go new file mode 100644 index 00000000..d88756bb --- /dev/null +++ b/vendor/github.com/containerd/errdefs/pkg/internal/cause/cause.go @@ -0,0 +1,33 @@ +/* + Copyright The containerd Authors. + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +// Package cause is used to define root causes for errors +// common to errors packages like grpc and http. +package cause + +import "fmt" + +type ErrUnexpectedStatus struct { + Status int +} + +const UnexpectedStatusPrefix = "unexpected status " + +func (e ErrUnexpectedStatus) Error() string { + return fmt.Sprintf("%s%d", UnexpectedStatusPrefix, e.Status) +} + +func (ErrUnexpectedStatus) Unknown() {} diff --git a/vendor/github.com/containerd/errdefs/resolve.go b/vendor/github.com/containerd/errdefs/resolve.go new file mode 100644 index 00000000..c02d4a73 --- /dev/null +++ b/vendor/github.com/containerd/errdefs/resolve.go @@ -0,0 +1,147 @@ +/* + Copyright The containerd Authors. + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +package errdefs + +import "context" + +// Resolve returns the first error found in the error chain which matches an +// error defined in this package or context error. A raw, unwrapped error is +// returned or ErrUnknown if no matching error is found. +// +// This is useful for determining a response code based on the outermost wrapped +// error rather than the original cause. For example, a not found error deep +// in the code may be wrapped as an invalid argument. When determining status +// code from Is* functions, the depth or ordering of the error is not +// considered. +// +// The search order is depth first, a wrapped error returned from any part of +// the chain from `Unwrap() error` will be returned before any joined errors +// as returned by `Unwrap() []error`. +func Resolve(err error) error { + if err == nil { + return nil + } + err = firstError(err) + if err == nil { + err = ErrUnknown + } + return err +} + +func firstError(err error) error { + for { + switch err { + case ErrUnknown, + ErrInvalidArgument, + ErrNotFound, + ErrAlreadyExists, + ErrPermissionDenied, + ErrResourceExhausted, + ErrFailedPrecondition, + ErrConflict, + ErrNotModified, + ErrAborted, + ErrOutOfRange, + ErrNotImplemented, + ErrInternal, + ErrUnavailable, + ErrDataLoss, + ErrUnauthenticated, + context.DeadlineExceeded, + context.Canceled: + return err + } + switch e := err.(type) { + case customMessage: + err = e.err + case unknown: + return ErrUnknown + case invalidParameter: + return ErrInvalidArgument + case notFound: + return ErrNotFound + case alreadyExists: + return ErrAlreadyExists + case forbidden: + return ErrPermissionDenied + case resourceExhausted: + return ErrResourceExhausted + case failedPrecondition: + return ErrFailedPrecondition + case conflict: + return ErrConflict + case notModified: + return ErrNotModified + case aborted: + return ErrAborted + case errOutOfRange: + return ErrOutOfRange + case notImplemented: + return ErrNotImplemented + case system: + return ErrInternal + case unavailable: + return ErrUnavailable + case dataLoss: + return ErrDataLoss + case unauthorized: + return ErrUnauthenticated + case deadlineExceeded: + return context.DeadlineExceeded + case cancelled: + return context.Canceled + case interface{ Unwrap() error }: + err = e.Unwrap() + if err == nil { + return nil + } + case interface{ Unwrap() []error }: + for _, ue := range e.Unwrap() { + if fe := firstError(ue); fe != nil { + return fe + } + } + return nil + case interface{ Is(error) bool }: + for _, target := range []error{ErrUnknown, + ErrInvalidArgument, + ErrNotFound, + ErrAlreadyExists, + ErrPermissionDenied, + ErrResourceExhausted, + ErrFailedPrecondition, + ErrConflict, + ErrNotModified, + ErrAborted, + ErrOutOfRange, + ErrNotImplemented, + ErrInternal, + ErrUnavailable, + ErrDataLoss, + ErrUnauthenticated, + context.DeadlineExceeded, + context.Canceled} { + if e.Is(target) { + return target + } + } + return nil + default: + return nil + } + } +} diff --git a/vendor/github.com/distribution/reference/.gitattributes b/vendor/github.com/distribution/reference/.gitattributes new file mode 100644 index 00000000..d207b180 --- /dev/null +++ b/vendor/github.com/distribution/reference/.gitattributes @@ -0,0 +1 @@ +*.go text eol=lf diff --git a/vendor/github.com/distribution/reference/.gitignore b/vendor/github.com/distribution/reference/.gitignore new file mode 100644 index 00000000..dc07e6b0 --- /dev/null +++ b/vendor/github.com/distribution/reference/.gitignore @@ -0,0 +1,2 @@ +# Cover profiles +*.out diff --git a/vendor/github.com/distribution/reference/.golangci.yml b/vendor/github.com/distribution/reference/.golangci.yml new file mode 100644 index 00000000..793f0bb7 --- /dev/null +++ b/vendor/github.com/distribution/reference/.golangci.yml @@ -0,0 +1,18 @@ +linters: + enable: + - bodyclose + - dupword # Checks for duplicate words in the source code + - gofmt + - goimports + - ineffassign + - misspell + - revive + - staticcheck + - unconvert + - unused + - vet + disable: + - errcheck + +run: + deadline: 2m diff --git a/vendor/github.com/distribution/reference/CODE-OF-CONDUCT.md b/vendor/github.com/distribution/reference/CODE-OF-CONDUCT.md new file mode 100644 index 00000000..48f6704c --- /dev/null +++ b/vendor/github.com/distribution/reference/CODE-OF-CONDUCT.md @@ -0,0 +1,5 @@ +# Code of Conduct + +We follow the [CNCF Code of Conduct](https://github.com/cncf/foundation/blob/main/code-of-conduct.md). + +Please contact the [CNCF Code of Conduct Committee](mailto:conduct@cncf.io) in order to report violations of the Code of Conduct. diff --git a/vendor/github.com/distribution/reference/CONTRIBUTING.md b/vendor/github.com/distribution/reference/CONTRIBUTING.md new file mode 100644 index 00000000..ab219466 --- /dev/null +++ b/vendor/github.com/distribution/reference/CONTRIBUTING.md @@ -0,0 +1,114 @@ +# Contributing to the reference library + +## Community help + +If you need help, please ask in the [#distribution](https://cloud-native.slack.com/archives/C01GVR8SY4R) channel on CNCF community slack. +[Click here for an invite to the CNCF community slack](https://slack.cncf.io/) + +## Reporting security issues + +The maintainers take security seriously. If you discover a security +issue, please bring it to their attention right away! + +Please **DO NOT** file a public issue, instead send your report privately to +[cncf-distribution-security@lists.cncf.io](mailto:cncf-distribution-security@lists.cncf.io). + +## Reporting an issue properly + +By following these simple rules you will get better and faster feedback on your issue. + + - search the bugtracker for an already reported issue + +### If you found an issue that describes your problem: + + - please read other user comments first, and confirm this is the same issue: a given error condition might be indicative of different problems - you may also find a workaround in the comments + - please refrain from adding "same thing here" or "+1" comments + - you don't need to comment on an issue to get notified of updates: just hit the "subscribe" button + - comment if you have some new, technical and relevant information to add to the case + - __DO NOT__ comment on closed issues or merged PRs. If you think you have a related problem, open up a new issue and reference the PR or issue. + +### If you have not found an existing issue that describes your problem: + + 1. create a new issue, with a succinct title that describes your issue: + - bad title: "It doesn't work with my docker" + - good title: "Private registry push fail: 400 error with E_INVALID_DIGEST" + 2. copy the output of (or similar for other container tools): + - `docker version` + - `docker info` + - `docker exec registry --version` + 3. copy the command line you used to launch your Registry + 4. restart your docker daemon in debug mode (add `-D` to the daemon launch arguments) + 5. reproduce your problem and get your docker daemon logs showing the error + 6. if relevant, copy your registry logs that show the error + 7. provide any relevant detail about your specific Registry configuration (e.g., storage backend used) + 8. indicate if you are using an enterprise proxy, Nginx, or anything else between you and your Registry + +## Contributing Code + +Contributions should be made via pull requests. Pull requests will be reviewed +by one or more maintainers or reviewers and merged when acceptable. + +You should follow the basic GitHub workflow: + + 1. Use your own [fork](https://help.github.com/en/articles/about-forks) + 2. Create your [change](https://github.com/containerd/project/blob/master/CONTRIBUTING.md#successful-changes) + 3. Test your code + 4. [Commit](https://github.com/containerd/project/blob/master/CONTRIBUTING.md#commit-messages) your work, always [sign your commits](https://github.com/containerd/project/blob/master/CONTRIBUTING.md#commit-messages) + 5. Push your change to your fork and create a [Pull Request](https://help.github.com/en/github/collaborating-with-issues-and-pull-requests/creating-a-pull-request-from-a-fork) + +Refer to [containerd's contribution guide](https://github.com/containerd/project/blob/master/CONTRIBUTING.md#successful-changes) +for tips on creating a successful contribution. + +## Sign your work + +The sign-off is a simple line at the end of the explanation for the patch. Your +signature certifies that you wrote the patch or otherwise have the right to pass +it on as an open-source patch. The rules are pretty simple: if you can certify +the below (from [developercertificate.org](http://developercertificate.org/)): + +``` +Developer Certificate of Origin +Version 1.1 + +Copyright (C) 2004, 2006 The Linux Foundation and its contributors. +660 York Street, Suite 102, +San Francisco, CA 94110 USA + +Everyone is permitted to copy and distribute verbatim copies of this +license document, but changing it is not allowed. + +Developer's Certificate of Origin 1.1 + +By making a contribution to this project, I certify that: + +(a) The contribution was created in whole or in part by me and I + have the right to submit it under the open source license + indicated in the file; or + +(b) The contribution is based upon previous work that, to the best + of my knowledge, is covered under an appropriate open source + license and I have the right under that license to submit that + work with modifications, whether created in whole or in part + by me, under the same open source license (unless I am + permitted to submit under a different license), as indicated + in the file; or + +(c) The contribution was provided directly to me by some other + person who certified (a), (b) or (c) and I have not modified + it. + +(d) I understand and agree that this project and the contribution + are public and that a record of the contribution (including all + personal information I submit with it, including my sign-off) is + maintained indefinitely and may be redistributed consistent with + this project or the open source license(s) involved. +``` + +Then you just add a line to every git commit message: + + Signed-off-by: Joe Smith + +Use your real name (sorry, no pseudonyms or anonymous contributions.) + +If you set your `user.name` and `user.email` git configs, you can sign your +commit automatically with `git commit -s`. diff --git a/vendor/github.com/distribution/reference/GOVERNANCE.md b/vendor/github.com/distribution/reference/GOVERNANCE.md new file mode 100644 index 00000000..200045b0 --- /dev/null +++ b/vendor/github.com/distribution/reference/GOVERNANCE.md @@ -0,0 +1,144 @@ +# distribution/reference Project Governance + +Distribution [Code of Conduct](./CODE-OF-CONDUCT.md) can be found here. + +For specific guidance on practical contribution steps please +see our [CONTRIBUTING.md](./CONTRIBUTING.md) guide. + +## Maintainership + +There are different types of maintainers, with different responsibilities, but +all maintainers have 3 things in common: + +1) They share responsibility in the project's success. +2) They have made a long-term, recurring time investment to improve the project. +3) They spend that time doing whatever needs to be done, not necessarily what +is the most interesting or fun. + +Maintainers are often under-appreciated, because their work is harder to appreciate. +It's easy to appreciate a really cool and technically advanced feature. It's harder +to appreciate the absence of bugs, the slow but steady improvement in stability, +or the reliability of a release process. But those things distinguish a good +project from a great one. + +## Reviewers + +A reviewer is a core role within the project. +They share in reviewing issues and pull requests and their LGTM counts towards the +required LGTM count to merge a code change into the project. + +Reviewers are part of the organization but do not have write access. +Becoming a reviewer is a core aspect in the journey to becoming a maintainer. + +## Adding maintainers + +Maintainers are first and foremost contributors that have shown they are +committed to the long term success of a project. Contributors wanting to become +maintainers are expected to be deeply involved in contributing code, pull +request review, and triage of issues in the project for more than three months. + +Just contributing does not make you a maintainer, it is about building trust +with the current maintainers of the project and being a person that they can +depend on and trust to make decisions in the best interest of the project. + +Periodically, the existing maintainers curate a list of contributors that have +shown regular activity on the project over the prior months. From this list, +maintainer candidates are selected and proposed in a pull request or a +maintainers communication channel. + +After a candidate has been announced to the maintainers, the existing +maintainers are given five business days to discuss the candidate, raise +objections and cast their vote. Votes may take place on the communication +channel or via pull request comment. Candidates must be approved by at least 66% +of the current maintainers by adding their vote on the mailing list. The +reviewer role has the same process but only requires 33% of current maintainers. +Only maintainers of the repository that the candidate is proposed for are +allowed to vote. + +If a candidate is approved, a maintainer will contact the candidate to invite +the candidate to open a pull request that adds the contributor to the +MAINTAINERS file. The voting process may take place inside a pull request if a +maintainer has already discussed the candidacy with the candidate and a +maintainer is willing to be a sponsor by opening the pull request. The candidate +becomes a maintainer once the pull request is merged. + +## Stepping down policy + +Life priorities, interests, and passions can change. If you're a maintainer but +feel you must remove yourself from the list, inform other maintainers that you +intend to step down, and if possible, help find someone to pick up your work. +At the very least, ensure your work can be continued where you left off. + +After you've informed other maintainers, create a pull request to remove +yourself from the MAINTAINERS file. + +## Removal of inactive maintainers + +Similar to the procedure for adding new maintainers, existing maintainers can +be removed from the list if they do not show significant activity on the +project. Periodically, the maintainers review the list of maintainers and their +activity over the last three months. + +If a maintainer has shown insufficient activity over this period, a neutral +person will contact the maintainer to ask if they want to continue being +a maintainer. If the maintainer decides to step down as a maintainer, they +open a pull request to be removed from the MAINTAINERS file. + +If the maintainer wants to remain a maintainer, but is unable to perform the +required duties they can be removed with a vote of at least 66% of the current +maintainers. In this case, maintainers should first propose the change to +maintainers via the maintainers communication channel, then open a pull request +for voting. The voting period is five business days. The voting pull request +should not come as a surpise to any maintainer and any discussion related to +performance must not be discussed on the pull request. + +## How are decisions made? + +Docker distribution is an open-source project with an open design philosophy. +This means that the repository is the source of truth for EVERY aspect of the +project, including its philosophy, design, road map, and APIs. *If it's part of +the project, it's in the repo. If it's in the repo, it's part of the project.* + +As a result, all decisions can be expressed as changes to the repository. An +implementation change is a change to the source code. An API change is a change +to the API specification. A philosophy change is a change to the philosophy +manifesto, and so on. + +All decisions affecting distribution, big and small, follow the same 3 steps: + +* Step 1: Open a pull request. Anyone can do this. + +* Step 2: Discuss the pull request. Anyone can do this. + +* Step 3: Merge or refuse the pull request. Who does this depends on the nature +of the pull request and which areas of the project it affects. + +## Helping contributors with the DCO + +The [DCO or `Sign your work`](./CONTRIBUTING.md#sign-your-work) +requirement is not intended as a roadblock or speed bump. + +Some contributors are not as familiar with `git`, or have used a web +based editor, and thus asking them to `git commit --amend -s` is not the best +way forward. + +In this case, maintainers can update the commits based on clause (c) of the DCO. +The most trivial way for a contributor to allow the maintainer to do this, is to +add a DCO signature in a pull requests's comment, or a maintainer can simply +note that the change is sufficiently trivial that it does not substantially +change the existing contribution - i.e., a spelling change. + +When you add someone's DCO, please also add your own to keep a log. + +## I'm a maintainer. Should I make pull requests too? + +Yes. Nobody should ever push to master directly. All changes should be +made through a pull request. + +## Conflict Resolution + +If you have a technical dispute that you feel has reached an impasse with a +subset of the community, any contributor may open an issue, specifically +calling for a resolution vote of the current core maintainers to resolve the +dispute. The same voting quorums required (2/3) for adding and removing +maintainers will apply to conflict resolution. diff --git a/vendor/github.com/distribution/reference/LICENSE b/vendor/github.com/distribution/reference/LICENSE new file mode 100644 index 00000000..e06d2081 --- /dev/null +++ b/vendor/github.com/distribution/reference/LICENSE @@ -0,0 +1,202 @@ +Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + + TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + + 1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + + 2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + + 3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + + 4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + + 5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + + 6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + + 7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + + 8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + + 9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + + END OF TERMS AND CONDITIONS + + APPENDIX: How to apply the Apache License to your work. + + To apply the Apache License to your work, attach the following + boilerplate notice, with the fields enclosed by brackets "{}" + replaced with your own identifying information. (Don't include + the brackets!) The text should be enclosed in the appropriate + comment syntax for the file format. We also recommend that a + file or class name and description of purpose be included on the + same "printed page" as the copyright notice for easier + identification within third-party archives. + + Copyright {yyyy} {name of copyright owner} + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. + diff --git a/vendor/github.com/distribution/reference/MAINTAINERS b/vendor/github.com/distribution/reference/MAINTAINERS new file mode 100644 index 00000000..9e0a60c8 --- /dev/null +++ b/vendor/github.com/distribution/reference/MAINTAINERS @@ -0,0 +1,26 @@ +# Distribution project maintainers & reviewers +# +# See GOVERNANCE.md for maintainer versus reviewer roles +# +# MAINTAINERS (cncf-distribution-maintainers@lists.cncf.io) +# GitHub ID, Name, Email address +"chrispat","Chris Patterson","chrispat@github.com" +"clarkbw","Bryan Clark","clarkbw@github.com" +"corhere","Cory Snider","csnider@mirantis.com" +"deleteriousEffect","Hayley Swimelar","hswimelar@gitlab.com" +"heww","He Weiwei","hweiwei@vmware.com" +"joaodrp","João Pereira","jpereira@gitlab.com" +"justincormack","Justin Cormack","justin.cormack@docker.com" +"squizzi","Kyle Squizzato","ksquizzato@mirantis.com" +"milosgajdos","Milos Gajdos","milosthegajdos@gmail.com" +"sargun","Sargun Dhillon","sargun@sargun.me" +"wy65701436","Wang Yan","wangyan@vmware.com" +"stevelasker","Steve Lasker","steve.lasker@microsoft.com" +# +# REVIEWERS +# GitHub ID, Name, Email address +"dmcgowan","Derek McGowan","derek@mcgstyle.net" +"stevvooe","Stephen Day","stevvooe@gmail.com" +"thajeztah","Sebastiaan van Stijn","github@gone.nl" +"DavidSpek", "David van der Spek", "vanderspek.david@gmail.com" +"Jamstah", "James Hewitt", "james.hewitt@gmail.com" diff --git a/vendor/github.com/distribution/reference/Makefile b/vendor/github.com/distribution/reference/Makefile new file mode 100644 index 00000000..c78576b7 --- /dev/null +++ b/vendor/github.com/distribution/reference/Makefile @@ -0,0 +1,25 @@ +# Project packages. +PACKAGES=$(shell go list ./...) + +# Flags passed to `go test` +BUILDFLAGS ?= +TESTFLAGS ?= + +.PHONY: all build test coverage +.DEFAULT: all + +all: build + +build: ## no binaries to build, so just check compilation suceeds + go build ${BUILDFLAGS} ./... + +test: ## run tests + go test ${TESTFLAGS} ./... + +coverage: ## generate coverprofiles from the unit tests + rm -f coverage.txt + go test ${TESTFLAGS} -cover -coverprofile=cover.out ./... + +.PHONY: help +help: + @awk 'BEGIN {FS = ":.*##"; printf "\nUsage:\n make \033[36m\033[0m\n"} /^[a-zA-Z_\/%-]+:.*?##/ { printf " \033[36m%-27s\033[0m %s\n", $$1, $$2 } /^##@/ { printf "\n\033[1m%s\033[0m\n", substr($$0, 5) } ' $(MAKEFILE_LIST) diff --git a/vendor/github.com/distribution/reference/README.md b/vendor/github.com/distribution/reference/README.md new file mode 100644 index 00000000..172a02e0 --- /dev/null +++ b/vendor/github.com/distribution/reference/README.md @@ -0,0 +1,30 @@ +# Distribution reference + +Go library to handle references to container images. + + + +[![Build Status](https://github.com/distribution/reference/actions/workflows/test.yml/badge.svg?branch=main&event=push)](https://github.com/distribution/reference/actions?query=workflow%3ACI) +[![GoDoc](https://img.shields.io/badge/go.dev-reference-007d9c?logo=go&logoColor=white&style=flat-square)](https://pkg.go.dev/github.com/distribution/reference) +[![License: Apache-2.0](https://img.shields.io/badge/License-Apache--2.0-blue.svg)](LICENSE) +[![codecov](https://codecov.io/gh/distribution/reference/branch/main/graph/badge.svg)](https://codecov.io/gh/distribution/reference) +[![FOSSA Status](https://app.fossa.com/api/projects/custom%2B162%2Fgithub.com%2Fdistribution%2Freference.svg?type=shield)](https://app.fossa.com/projects/custom%2B162%2Fgithub.com%2Fdistribution%2Freference?ref=badge_shield) + +This repository contains a library for handling references to container images held in container registries. Please see [godoc](https://pkg.go.dev/github.com/distribution/reference) for details. + +## Contribution + +Please see [CONTRIBUTING.md](CONTRIBUTING.md) for details on how to contribute +issues, fixes, and patches to this project. + +## Communication + +For async communication and long running discussions please use issues and pull requests on the github repo. +This will be the best place to discuss design and implementation. + +For sync communication we have a #distribution channel in the [CNCF Slack](https://slack.cncf.io/) +that everyone is welcome to join and chat about development. + +## Licenses + +The distribution codebase is released under the [Apache 2.0 license](LICENSE). diff --git a/vendor/github.com/distribution/reference/SECURITY.md b/vendor/github.com/distribution/reference/SECURITY.md new file mode 100644 index 00000000..aaf983c0 --- /dev/null +++ b/vendor/github.com/distribution/reference/SECURITY.md @@ -0,0 +1,7 @@ +# Security Policy + +## Reporting a Vulnerability + +The maintainers take security seriously. If you discover a security issue, please bring it to their attention right away! + +Please DO NOT file a public issue, instead send your report privately to cncf-distribution-security@lists.cncf.io. diff --git a/vendor/github.com/distribution/reference/distribution-logo.svg b/vendor/github.com/distribution/reference/distribution-logo.svg new file mode 100644 index 00000000..cc9f4073 --- /dev/null +++ b/vendor/github.com/distribution/reference/distribution-logo.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/vendor/github.com/distribution/reference/helpers.go b/vendor/github.com/distribution/reference/helpers.go new file mode 100644 index 00000000..d10c7ef8 --- /dev/null +++ b/vendor/github.com/distribution/reference/helpers.go @@ -0,0 +1,42 @@ +package reference + +import "path" + +// IsNameOnly returns true if reference only contains a repo name. +func IsNameOnly(ref Named) bool { + if _, ok := ref.(NamedTagged); ok { + return false + } + if _, ok := ref.(Canonical); ok { + return false + } + return true +} + +// FamiliarName returns the familiar name string +// for the given named, familiarizing if needed. +func FamiliarName(ref Named) string { + if nn, ok := ref.(normalizedNamed); ok { + return nn.Familiar().Name() + } + return ref.Name() +} + +// FamiliarString returns the familiar string representation +// for the given reference, familiarizing if needed. +func FamiliarString(ref Reference) string { + if nn, ok := ref.(normalizedNamed); ok { + return nn.Familiar().String() + } + return ref.String() +} + +// FamiliarMatch reports whether ref matches the specified pattern. +// See [path.Match] for supported patterns. +func FamiliarMatch(pattern string, ref Reference) (bool, error) { + matched, err := path.Match(pattern, FamiliarString(ref)) + if namedRef, isNamed := ref.(Named); isNamed && !matched { + matched, _ = path.Match(pattern, FamiliarName(namedRef)) + } + return matched, err +} diff --git a/vendor/github.com/distribution/reference/normalize.go b/vendor/github.com/distribution/reference/normalize.go new file mode 100644 index 00000000..f4128314 --- /dev/null +++ b/vendor/github.com/distribution/reference/normalize.go @@ -0,0 +1,255 @@ +package reference + +import ( + "fmt" + "strings" + + "github.com/opencontainers/go-digest" +) + +const ( + // legacyDefaultDomain is the legacy domain for Docker Hub (which was + // originally named "the Docker Index"). This domain is still used for + // authentication and image search, which were part of the "v1" Docker + // registry specification. + // + // This domain will continue to be supported, but there are plans to consolidate + // legacy domains to new "canonical" domains. Once those domains are decided + // on, we must update the normalization functions, but preserve compatibility + // with existing installs, clients, and user configuration. + legacyDefaultDomain = "index.docker.io" + + // defaultDomain is the default domain used for images on Docker Hub. + // It is used to normalize "familiar" names to canonical names, for example, + // to convert "ubuntu" to "docker.io/library/ubuntu:latest". + // + // Note that actual domain of Docker Hub's registry is registry-1.docker.io. + // This domain will continue to be supported, but there are plans to consolidate + // legacy domains to new "canonical" domains. Once those domains are decided + // on, we must update the normalization functions, but preserve compatibility + // with existing installs, clients, and user configuration. + defaultDomain = "docker.io" + + // officialRepoPrefix is the namespace used for official images on Docker Hub. + // It is used to normalize "familiar" names to canonical names, for example, + // to convert "ubuntu" to "docker.io/library/ubuntu:latest". + officialRepoPrefix = "library/" + + // defaultTag is the default tag if no tag is provided. + defaultTag = "latest" +) + +// normalizedNamed represents a name which has been +// normalized and has a familiar form. A familiar name +// is what is used in Docker UI. An example normalized +// name is "docker.io/library/ubuntu" and corresponding +// familiar name of "ubuntu". +type normalizedNamed interface { + Named + Familiar() Named +} + +// ParseNormalizedNamed parses a string into a named reference +// transforming a familiar name from Docker UI to a fully +// qualified reference. If the value may be an identifier +// use ParseAnyReference. +func ParseNormalizedNamed(s string) (Named, error) { + if ok := anchoredIdentifierRegexp.MatchString(s); ok { + return nil, fmt.Errorf("invalid repository name (%s), cannot specify 64-byte hexadecimal strings", s) + } + domain, remainder := splitDockerDomain(s) + var remote string + if tagSep := strings.IndexRune(remainder, ':'); tagSep > -1 { + remote = remainder[:tagSep] + } else { + remote = remainder + } + if strings.ToLower(remote) != remote { + return nil, fmt.Errorf("invalid reference format: repository name (%s) must be lowercase", remote) + } + + ref, err := Parse(domain + "/" + remainder) + if err != nil { + return nil, err + } + named, isNamed := ref.(Named) + if !isNamed { + return nil, fmt.Errorf("reference %s has no name", ref.String()) + } + return named, nil +} + +// namedTaggedDigested is a reference that has both a tag and a digest. +type namedTaggedDigested interface { + NamedTagged + Digested +} + +// ParseDockerRef normalizes the image reference following the docker convention, +// which allows for references to contain both a tag and a digest. It returns a +// reference that is either tagged or digested. For references containing both +// a tag and a digest, it returns a digested reference. For example, the following +// reference: +// +// docker.io/library/busybox:latest@sha256:7cc4b5aefd1d0cadf8d97d4350462ba51c694ebca145b08d7d41b41acc8db5aa +// +// Is returned as a digested reference (with the ":latest" tag removed): +// +// docker.io/library/busybox@sha256:7cc4b5aefd1d0cadf8d97d4350462ba51c694ebca145b08d7d41b41acc8db5aa +// +// References that are already "tagged" or "digested" are returned unmodified: +// +// // Already a digested reference +// docker.io/library/busybox@sha256:7cc4b5aefd1d0cadf8d97d4350462ba51c694ebca145b08d7d41b41acc8db5aa +// +// // Already a named reference +// docker.io/library/busybox:latest +func ParseDockerRef(ref string) (Named, error) { + named, err := ParseNormalizedNamed(ref) + if err != nil { + return nil, err + } + if canonical, ok := named.(namedTaggedDigested); ok { + // The reference is both tagged and digested; only return digested. + newNamed, err := WithName(canonical.Name()) + if err != nil { + return nil, err + } + return WithDigest(newNamed, canonical.Digest()) + } + return TagNameOnly(named), nil +} + +// splitDockerDomain splits a repository name to domain and remote-name. +// If no valid domain is found, the default domain is used. Repository name +// needs to be already validated before. +func splitDockerDomain(name string) (domain, remoteName string) { + maybeDomain, maybeRemoteName, ok := strings.Cut(name, "/") + if !ok { + // Fast-path for single element ("familiar" names), such as "ubuntu" + // or "ubuntu:latest". Familiar names must be handled separately, to + // prevent them from being handled as "hostname:port". + // + // Canonicalize them as "docker.io/library/name[:tag]" + + // FIXME(thaJeztah): account for bare "localhost" or "example.com" names, which SHOULD be considered a domain. + return defaultDomain, officialRepoPrefix + name + } + + switch { + case maybeDomain == localhost: + // localhost is a reserved namespace and always considered a domain. + domain, remoteName = maybeDomain, maybeRemoteName + case maybeDomain == legacyDefaultDomain: + // canonicalize the Docker Hub and legacy "Docker Index" domains. + domain, remoteName = defaultDomain, maybeRemoteName + case strings.ContainsAny(maybeDomain, ".:"): + // Likely a domain or IP-address: + // + // - contains a "." (e.g., "example.com" or "127.0.0.1") + // - contains a ":" (e.g., "example:5000", "::1", or "[::1]:5000") + domain, remoteName = maybeDomain, maybeRemoteName + case strings.ToLower(maybeDomain) != maybeDomain: + // Uppercase namespaces are not allowed, so if the first element + // is not lowercase, we assume it to be a domain-name. + domain, remoteName = maybeDomain, maybeRemoteName + default: + // None of the above: it's not a domain, so use the default, and + // use the name input the remote-name. + domain, remoteName = defaultDomain, name + } + + if domain == defaultDomain && !strings.ContainsRune(remoteName, '/') { + // Canonicalize "familiar" names, but only on Docker Hub, not + // on other domains: + // + // "docker.io/ubuntu[:tag]" => "docker.io/library/ubuntu[:tag]" + remoteName = officialRepoPrefix + remoteName + } + + return domain, remoteName +} + +// familiarizeName returns a shortened version of the name familiar +// to the Docker UI. Familiar names have the default domain +// "docker.io" and "library/" repository prefix removed. +// For example, "docker.io/library/redis" will have the familiar +// name "redis" and "docker.io/dmcgowan/myapp" will be "dmcgowan/myapp". +// Returns a familiarized named only reference. +func familiarizeName(named namedRepository) repository { + repo := repository{ + domain: named.Domain(), + path: named.Path(), + } + + if repo.domain == defaultDomain { + repo.domain = "" + // Handle official repositories which have the pattern "library/" + if strings.HasPrefix(repo.path, officialRepoPrefix) { + // TODO(thaJeztah): this check may be too strict, as it assumes the + // "library/" namespace does not have nested namespaces. While this + // is true (currently), technically it would be possible for Docker + // Hub to use those (e.g. "library/distros/ubuntu:latest"). + // See https://github.com/distribution/distribution/pull/3769#issuecomment-1302031785. + if remainder := strings.TrimPrefix(repo.path, officialRepoPrefix); !strings.ContainsRune(remainder, '/') { + repo.path = remainder + } + } + } + return repo +} + +func (r reference) Familiar() Named { + return reference{ + namedRepository: familiarizeName(r.namedRepository), + tag: r.tag, + digest: r.digest, + } +} + +func (r repository) Familiar() Named { + return familiarizeName(r) +} + +func (t taggedReference) Familiar() Named { + return taggedReference{ + namedRepository: familiarizeName(t.namedRepository), + tag: t.tag, + } +} + +func (c canonicalReference) Familiar() Named { + return canonicalReference{ + namedRepository: familiarizeName(c.namedRepository), + digest: c.digest, + } +} + +// TagNameOnly adds the default tag "latest" to a reference if it only has +// a repo name. +func TagNameOnly(ref Named) Named { + if IsNameOnly(ref) { + namedTagged, err := WithTag(ref, defaultTag) + if err != nil { + // Default tag must be valid, to create a NamedTagged + // type with non-validated input the WithTag function + // should be used instead + panic(err) + } + return namedTagged + } + return ref +} + +// ParseAnyReference parses a reference string as a possible identifier, +// full digest, or familiar name. +func ParseAnyReference(ref string) (Reference, error) { + if ok := anchoredIdentifierRegexp.MatchString(ref); ok { + return digestReference("sha256:" + ref), nil + } + if dgst, err := digest.Parse(ref); err == nil { + return digestReference(dgst), nil + } + + return ParseNormalizedNamed(ref) +} diff --git a/vendor/github.com/distribution/reference/reference.go b/vendor/github.com/distribution/reference/reference.go new file mode 100644 index 00000000..900398bd --- /dev/null +++ b/vendor/github.com/distribution/reference/reference.go @@ -0,0 +1,432 @@ +// Package reference provides a general type to represent any way of referencing images within the registry. +// Its main purpose is to abstract tags and digests (content-addressable hash). +// +// Grammar +// +// reference := name [ ":" tag ] [ "@" digest ] +// name := [domain '/'] remote-name +// domain := host [':' port-number] +// host := domain-name | IPv4address | \[ IPv6address \] ; rfc3986 appendix-A +// domain-name := domain-component ['.' domain-component]* +// domain-component := /([a-zA-Z0-9]|[a-zA-Z0-9][a-zA-Z0-9-]*[a-zA-Z0-9])/ +// port-number := /[0-9]+/ +// path-component := alpha-numeric [separator alpha-numeric]* +// path (or "remote-name") := path-component ['/' path-component]* +// alpha-numeric := /[a-z0-9]+/ +// separator := /[_.]|__|[-]*/ +// +// tag := /[\w][\w.-]{0,127}/ +// +// digest := digest-algorithm ":" digest-hex +// digest-algorithm := digest-algorithm-component [ digest-algorithm-separator digest-algorithm-component ]* +// digest-algorithm-separator := /[+.-_]/ +// digest-algorithm-component := /[A-Za-z][A-Za-z0-9]*/ +// digest-hex := /[0-9a-fA-F]{32,}/ ; At least 128 bit digest value +// +// identifier := /[a-f0-9]{64}/ +package reference + +import ( + "errors" + "fmt" + "strings" + + "github.com/opencontainers/go-digest" +) + +const ( + // RepositoryNameTotalLengthMax is the maximum total number of characters in a repository name. + RepositoryNameTotalLengthMax = 255 + + // NameTotalLengthMax is the maximum total number of characters in a repository name. + // + // Deprecated: use [RepositoryNameTotalLengthMax] instead. + NameTotalLengthMax = RepositoryNameTotalLengthMax +) + +var ( + // ErrReferenceInvalidFormat represents an error while trying to parse a string as a reference. + ErrReferenceInvalidFormat = errors.New("invalid reference format") + + // ErrTagInvalidFormat represents an error while trying to parse a string as a tag. + ErrTagInvalidFormat = errors.New("invalid tag format") + + // ErrDigestInvalidFormat represents an error while trying to parse a string as a tag. + ErrDigestInvalidFormat = errors.New("invalid digest format") + + // ErrNameContainsUppercase is returned for invalid repository names that contain uppercase characters. + ErrNameContainsUppercase = errors.New("repository name must be lowercase") + + // ErrNameEmpty is returned for empty, invalid repository names. + ErrNameEmpty = errors.New("repository name must have at least one component") + + // ErrNameTooLong is returned when a repository name is longer than RepositoryNameTotalLengthMax. + ErrNameTooLong = fmt.Errorf("repository name must not be more than %v characters", RepositoryNameTotalLengthMax) + + // ErrNameNotCanonical is returned when a name is not canonical. + ErrNameNotCanonical = errors.New("repository name must be canonical") +) + +// Reference is an opaque object reference identifier that may include +// modifiers such as a hostname, name, tag, and digest. +type Reference interface { + // String returns the full reference + String() string +} + +// Field provides a wrapper type for resolving correct reference types when +// working with encoding. +type Field struct { + reference Reference +} + +// AsField wraps a reference in a Field for encoding. +func AsField(reference Reference) Field { + return Field{reference} +} + +// Reference unwraps the reference type from the field to +// return the Reference object. This object should be +// of the appropriate type to further check for different +// reference types. +func (f Field) Reference() Reference { + return f.reference +} + +// MarshalText serializes the field to byte text which +// is the string of the reference. +func (f Field) MarshalText() (p []byte, err error) { + return []byte(f.reference.String()), nil +} + +// UnmarshalText parses text bytes by invoking the +// reference parser to ensure the appropriately +// typed reference object is wrapped by field. +func (f *Field) UnmarshalText(p []byte) error { + r, err := Parse(string(p)) + if err != nil { + return err + } + + f.reference = r + return nil +} + +// Named is an object with a full name +type Named interface { + Reference + Name() string +} + +// Tagged is an object which has a tag +type Tagged interface { + Reference + Tag() string +} + +// NamedTagged is an object including a name and tag. +type NamedTagged interface { + Named + Tag() string +} + +// Digested is an object which has a digest +// in which it can be referenced by +type Digested interface { + Reference + Digest() digest.Digest +} + +// Canonical reference is an object with a fully unique +// name including a name with domain and digest +type Canonical interface { + Named + Digest() digest.Digest +} + +// namedRepository is a reference to a repository with a name. +// A namedRepository has both domain and path components. +type namedRepository interface { + Named + Domain() string + Path() string +} + +// Domain returns the domain part of the [Named] reference. +func Domain(named Named) string { + if r, ok := named.(namedRepository); ok { + return r.Domain() + } + domain, _ := splitDomain(named.Name()) + return domain +} + +// Path returns the name without the domain part of the [Named] reference. +func Path(named Named) (name string) { + if r, ok := named.(namedRepository); ok { + return r.Path() + } + _, path := splitDomain(named.Name()) + return path +} + +// splitDomain splits a named reference into a hostname and path string. +// If no valid hostname is found, the hostname is empty and the full value +// is returned as name +func splitDomain(name string) (string, string) { + match := anchoredNameRegexp.FindStringSubmatch(name) + if len(match) != 3 { + return "", name + } + return match[1], match[2] +} + +// Parse parses s and returns a syntactically valid Reference. +// If an error was encountered it is returned, along with a nil Reference. +func Parse(s string) (Reference, error) { + matches := ReferenceRegexp.FindStringSubmatch(s) + if matches == nil { + if s == "" { + return nil, ErrNameEmpty + } + if ReferenceRegexp.FindStringSubmatch(strings.ToLower(s)) != nil { + return nil, ErrNameContainsUppercase + } + return nil, ErrReferenceInvalidFormat + } + + var repo repository + + nameMatch := anchoredNameRegexp.FindStringSubmatch(matches[1]) + if len(nameMatch) == 3 { + repo.domain = nameMatch[1] + repo.path = nameMatch[2] + } else { + repo.domain = "" + repo.path = matches[1] + } + + if len(repo.path) > RepositoryNameTotalLengthMax { + return nil, ErrNameTooLong + } + + ref := reference{ + namedRepository: repo, + tag: matches[2], + } + if matches[3] != "" { + var err error + ref.digest, err = digest.Parse(matches[3]) + if err != nil { + return nil, err + } + } + + r := getBestReferenceType(ref) + if r == nil { + return nil, ErrNameEmpty + } + + return r, nil +} + +// ParseNamed parses s and returns a syntactically valid reference implementing +// the Named interface. The reference must have a name and be in the canonical +// form, otherwise an error is returned. +// If an error was encountered it is returned, along with a nil Reference. +func ParseNamed(s string) (Named, error) { + named, err := ParseNormalizedNamed(s) + if err != nil { + return nil, err + } + if named.String() != s { + return nil, ErrNameNotCanonical + } + return named, nil +} + +// WithName returns a named object representing the given string. If the input +// is invalid ErrReferenceInvalidFormat will be returned. +func WithName(name string) (Named, error) { + match := anchoredNameRegexp.FindStringSubmatch(name) + if match == nil || len(match) != 3 { + return nil, ErrReferenceInvalidFormat + } + + if len(match[2]) > RepositoryNameTotalLengthMax { + return nil, ErrNameTooLong + } + + return repository{ + domain: match[1], + path: match[2], + }, nil +} + +// WithTag combines the name from "name" and the tag from "tag" to form a +// reference incorporating both the name and the tag. +func WithTag(name Named, tag string) (NamedTagged, error) { + if !anchoredTagRegexp.MatchString(tag) { + return nil, ErrTagInvalidFormat + } + var repo repository + if r, ok := name.(namedRepository); ok { + repo.domain = r.Domain() + repo.path = r.Path() + } else { + repo.path = name.Name() + } + if canonical, ok := name.(Canonical); ok { + return reference{ + namedRepository: repo, + tag: tag, + digest: canonical.Digest(), + }, nil + } + return taggedReference{ + namedRepository: repo, + tag: tag, + }, nil +} + +// WithDigest combines the name from "name" and the digest from "digest" to form +// a reference incorporating both the name and the digest. +func WithDigest(name Named, digest digest.Digest) (Canonical, error) { + if !anchoredDigestRegexp.MatchString(digest.String()) { + return nil, ErrDigestInvalidFormat + } + var repo repository + if r, ok := name.(namedRepository); ok { + repo.domain = r.Domain() + repo.path = r.Path() + } else { + repo.path = name.Name() + } + if tagged, ok := name.(Tagged); ok { + return reference{ + namedRepository: repo, + tag: tagged.Tag(), + digest: digest, + }, nil + } + return canonicalReference{ + namedRepository: repo, + digest: digest, + }, nil +} + +// TrimNamed removes any tag or digest from the named reference. +func TrimNamed(ref Named) Named { + repo := repository{} + if r, ok := ref.(namedRepository); ok { + repo.domain, repo.path = r.Domain(), r.Path() + } else { + repo.domain, repo.path = splitDomain(ref.Name()) + } + return repo +} + +func getBestReferenceType(ref reference) Reference { + if ref.Name() == "" { + // Allow digest only references + if ref.digest != "" { + return digestReference(ref.digest) + } + return nil + } + if ref.tag == "" { + if ref.digest != "" { + return canonicalReference{ + namedRepository: ref.namedRepository, + digest: ref.digest, + } + } + return ref.namedRepository + } + if ref.digest == "" { + return taggedReference{ + namedRepository: ref.namedRepository, + tag: ref.tag, + } + } + + return ref +} + +type reference struct { + namedRepository + tag string + digest digest.Digest +} + +func (r reference) String() string { + return r.Name() + ":" + r.tag + "@" + r.digest.String() +} + +func (r reference) Tag() string { + return r.tag +} + +func (r reference) Digest() digest.Digest { + return r.digest +} + +type repository struct { + domain string + path string +} + +func (r repository) String() string { + return r.Name() +} + +func (r repository) Name() string { + if r.domain == "" { + return r.path + } + return r.domain + "/" + r.path +} + +func (r repository) Domain() string { + return r.domain +} + +func (r repository) Path() string { + return r.path +} + +type digestReference digest.Digest + +func (d digestReference) String() string { + return digest.Digest(d).String() +} + +func (d digestReference) Digest() digest.Digest { + return digest.Digest(d) +} + +type taggedReference struct { + namedRepository + tag string +} + +func (t taggedReference) String() string { + return t.Name() + ":" + t.tag +} + +func (t taggedReference) Tag() string { + return t.tag +} + +type canonicalReference struct { + namedRepository + digest digest.Digest +} + +func (c canonicalReference) String() string { + return c.Name() + "@" + c.digest.String() +} + +func (c canonicalReference) Digest() digest.Digest { + return c.digest +} diff --git a/vendor/github.com/distribution/reference/regexp.go b/vendor/github.com/distribution/reference/regexp.go new file mode 100644 index 00000000..65bc49d7 --- /dev/null +++ b/vendor/github.com/distribution/reference/regexp.go @@ -0,0 +1,163 @@ +package reference + +import ( + "regexp" + "strings" +) + +// DigestRegexp matches well-formed digests, including algorithm (e.g. "sha256:"). +var DigestRegexp = regexp.MustCompile(digestPat) + +// DomainRegexp matches hostname or IP-addresses, optionally including a port +// number. It defines the structure of potential domain components that may be +// part of image names. This is purposely a subset of what is allowed by DNS to +// ensure backwards compatibility with Docker image names. It may be a subset of +// DNS domain name, an IPv4 address in decimal format, or an IPv6 address between +// square brackets (excluding zone identifiers as defined by [RFC 6874] or special +// addresses such as IPv4-Mapped). +// +// [RFC 6874]: https://www.rfc-editor.org/rfc/rfc6874. +var DomainRegexp = regexp.MustCompile(domainAndPort) + +// IdentifierRegexp is the format for string identifier used as a +// content addressable identifier using sha256. These identifiers +// are like digests without the algorithm, since sha256 is used. +var IdentifierRegexp = regexp.MustCompile(identifier) + +// NameRegexp is the format for the name component of references, including +// an optional domain and port, but without tag or digest suffix. +var NameRegexp = regexp.MustCompile(namePat) + +// ReferenceRegexp is the full supported format of a reference. The regexp +// is anchored and has capturing groups for name, tag, and digest +// components. +var ReferenceRegexp = regexp.MustCompile(referencePat) + +// TagRegexp matches valid tag names. From [docker/docker:graph/tags.go]. +// +// [docker/docker:graph/tags.go]: https://github.com/moby/moby/blob/v1.6.0/graph/tags.go#L26-L28 +var TagRegexp = regexp.MustCompile(tag) + +const ( + // alphanumeric defines the alphanumeric atom, typically a + // component of names. This only allows lower case characters and digits. + alphanumeric = `[a-z0-9]+` + + // separator defines the separators allowed to be embedded in name + // components. This allows one period, one or two underscore and multiple + // dashes. Repeated dashes and underscores are intentionally treated + // differently. In order to support valid hostnames as name components, + // supporting repeated dash was added. Additionally double underscore is + // now allowed as a separator to loosen the restriction for previously + // supported names. + separator = `(?:[._]|__|[-]+)` + + // localhost is treated as a special value for domain-name. Any other + // domain-name without a "." or a ":port" are considered a path component. + localhost = `localhost` + + // domainNameComponent restricts the registry domain component of a + // repository name to start with a component as defined by DomainRegexp. + domainNameComponent = `(?:[a-zA-Z0-9]|[a-zA-Z0-9][a-zA-Z0-9-]*[a-zA-Z0-9])` + + // optionalPort matches an optional port-number including the port separator + // (e.g. ":80"). + optionalPort = `(?::[0-9]+)?` + + // tag matches valid tag names. From docker/docker:graph/tags.go. + tag = `[\w][\w.-]{0,127}` + + // digestPat matches well-formed digests, including algorithm (e.g. "sha256:"). + // + // TODO(thaJeztah): this should follow the same rules as https://pkg.go.dev/github.com/opencontainers/go-digest@v1.0.0#DigestRegexp + // so that go-digest defines the canonical format. Note that the go-digest is + // more relaxed: + // - it allows multiple algorithms (e.g. "sha256+b64:") to allow + // future expansion of supported algorithms. + // - it allows the "" value to use urlsafe base64 encoding as defined + // in [rfc4648, section 5]. + // + // [rfc4648, section 5]: https://www.rfc-editor.org/rfc/rfc4648#section-5. + digestPat = `[A-Za-z][A-Za-z0-9]*(?:[-_+.][A-Za-z][A-Za-z0-9]*)*[:][[:xdigit:]]{32,}` + + // identifier is the format for a content addressable identifier using sha256. + // These identifiers are like digests without the algorithm, since sha256 is used. + identifier = `([a-f0-9]{64})` + + // ipv6address are enclosed between square brackets and may be represented + // in many ways, see rfc5952. Only IPv6 in compressed or uncompressed format + // are allowed, IPv6 zone identifiers (rfc6874) or Special addresses such as + // IPv4-Mapped are deliberately excluded. + ipv6address = `\[(?:[a-fA-F0-9:]+)\]` +) + +var ( + // domainName defines the structure of potential domain components + // that may be part of image names. This is purposely a subset of what is + // allowed by DNS to ensure backwards compatibility with Docker image + // names. This includes IPv4 addresses on decimal format. + domainName = domainNameComponent + anyTimes(`\.`+domainNameComponent) + + // host defines the structure of potential domains based on the URI + // Host subcomponent on rfc3986. It may be a subset of DNS domain name, + // or an IPv4 address in decimal format, or an IPv6 address between square + // brackets (excluding zone identifiers as defined by rfc6874 or special + // addresses such as IPv4-Mapped). + host = `(?:` + domainName + `|` + ipv6address + `)` + + // allowed by the URI Host subcomponent on rfc3986 to ensure backwards + // compatibility with Docker image names. + domainAndPort = host + optionalPort + + // anchoredTagRegexp matches valid tag names, anchored at the start and + // end of the matched string. + anchoredTagRegexp = regexp.MustCompile(anchored(tag)) + + // anchoredDigestRegexp matches valid digests, anchored at the start and + // end of the matched string. + anchoredDigestRegexp = regexp.MustCompile(anchored(digestPat)) + + // pathComponent restricts path-components to start with an alphanumeric + // character, with following parts able to be separated by a separator + // (one period, one or two underscore and multiple dashes). + pathComponent = alphanumeric + anyTimes(separator+alphanumeric) + + // remoteName matches the remote-name of a repository. It consists of one + // or more forward slash (/) delimited path-components: + // + // pathComponent[[/pathComponent] ...] // e.g., "library/ubuntu" + remoteName = pathComponent + anyTimes(`/`+pathComponent) + namePat = optional(domainAndPort+`/`) + remoteName + + // anchoredNameRegexp is used to parse a name value, capturing the + // domain and trailing components. + anchoredNameRegexp = regexp.MustCompile(anchored(optional(capture(domainAndPort), `/`), capture(remoteName))) + + referencePat = anchored(capture(namePat), optional(`:`, capture(tag)), optional(`@`, capture(digestPat))) + + // anchoredIdentifierRegexp is used to check or match an + // identifier value, anchored at start and end of string. + anchoredIdentifierRegexp = regexp.MustCompile(anchored(identifier)) +) + +// optional wraps the expression in a non-capturing group and makes the +// production optional. +func optional(res ...string) string { + return `(?:` + strings.Join(res, "") + `)?` +} + +// anyTimes wraps the expression in a non-capturing group that can occur +// any number of times. +func anyTimes(res ...string) string { + return `(?:` + strings.Join(res, "") + `)*` +} + +// capture wraps the expression in a capturing group. +func capture(res ...string) string { + return `(` + strings.Join(res, "") + `)` +} + +// anchored anchors the regular expression by adding start and end delimiters. +func anchored(res ...string) string { + return `^` + strings.Join(res, "") + `$` +} diff --git a/vendor/github.com/distribution/reference/sort.go b/vendor/github.com/distribution/reference/sort.go new file mode 100644 index 00000000..416c37b0 --- /dev/null +++ b/vendor/github.com/distribution/reference/sort.go @@ -0,0 +1,75 @@ +/* + Copyright The containerd Authors. + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +package reference + +import ( + "sort" +) + +// Sort sorts string references preferring higher information references. +// +// The precedence is as follows: +// +// 1. [Named] + [Tagged] + [Digested] (e.g., "docker.io/library/busybox:latest@sha256:") +// 2. [Named] + [Tagged] (e.g., "docker.io/library/busybox:latest") +// 3. [Named] + [Digested] (e.g., "docker.io/library/busybo@sha256:") +// 4. [Named] (e.g., "docker.io/library/busybox") +// 5. [Digested] (e.g., "docker.io@sha256:") +// 6. Parse error +func Sort(references []string) []string { + var prefs []Reference + var bad []string + + for _, ref := range references { + pref, err := ParseAnyReference(ref) + if err != nil { + bad = append(bad, ref) + } else { + prefs = append(prefs, pref) + } + } + sort.Slice(prefs, func(a, b int) bool { + ar := refRank(prefs[a]) + br := refRank(prefs[b]) + if ar == br { + return prefs[a].String() < prefs[b].String() + } + return ar < br + }) + sort.Strings(bad) + var refs []string + for _, pref := range prefs { + refs = append(refs, pref.String()) + } + return append(refs, bad...) +} + +func refRank(ref Reference) uint8 { + if _, ok := ref.(Named); ok { + if _, ok = ref.(Tagged); ok { + if _, ok = ref.(Digested); ok { + return 1 + } + return 2 + } + if _, ok = ref.(Digested); ok { + return 3 + } + return 4 + } + return 5 +} diff --git a/vendor/github.com/docker/go-connections/LICENSE b/vendor/github.com/docker/go-connections/LICENSE new file mode 100644 index 00000000..b55b37bc --- /dev/null +++ b/vendor/github.com/docker/go-connections/LICENSE @@ -0,0 +1,191 @@ + + Apache License + Version 2.0, January 2004 + https://www.apache.org/licenses/ + + TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + + 1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + + 2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + + 3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + + 4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + + 5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + + 6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + + 7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + + 8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + + 9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + + END OF TERMS AND CONDITIONS + + Copyright 2015 Docker, Inc. + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. diff --git a/vendor/github.com/docker/go-connections/sockets/inmem_socket.go b/vendor/github.com/docker/go-connections/sockets/inmem_socket.go new file mode 100644 index 00000000..99846ffd --- /dev/null +++ b/vendor/github.com/docker/go-connections/sockets/inmem_socket.go @@ -0,0 +1,81 @@ +package sockets + +import ( + "errors" + "net" + "sync" +) + +var errClosed = errors.New("use of closed network connection") + +// InmemSocket implements net.Listener using in-memory only connections. +type InmemSocket struct { + chConn chan net.Conn + chClose chan struct{} + addr string + mu sync.Mutex +} + +// dummyAddr is used to satisfy net.Addr for the in-mem socket +// it is just stored as a string and returns the string for all calls +type dummyAddr string + +// NewInmemSocket creates an in-memory only net.Listener +// The addr argument can be any string, but is used to satisfy the `Addr()` part +// of the net.Listener interface +func NewInmemSocket(addr string, bufSize int) *InmemSocket { + return &InmemSocket{ + chConn: make(chan net.Conn, bufSize), + chClose: make(chan struct{}), + addr: addr, + } +} + +// Addr returns the socket's addr string to satisfy net.Listener +func (s *InmemSocket) Addr() net.Addr { + return dummyAddr(s.addr) +} + +// Accept implements the Accept method in the Listener interface; it waits for the next call and returns a generic Conn. +func (s *InmemSocket) Accept() (net.Conn, error) { + select { + case conn := <-s.chConn: + return conn, nil + case <-s.chClose: + return nil, errClosed + } +} + +// Close closes the listener. It will be unavailable for use once closed. +func (s *InmemSocket) Close() error { + s.mu.Lock() + defer s.mu.Unlock() + select { + case <-s.chClose: + default: + close(s.chClose) + } + return nil +} + +// Dial is used to establish a connection with the in-mem server +func (s *InmemSocket) Dial(network, addr string) (net.Conn, error) { + srvConn, clientConn := net.Pipe() + select { + case s.chConn <- srvConn: + case <-s.chClose: + return nil, errClosed + } + + return clientConn, nil +} + +// Network returns the addr string, satisfies net.Addr +func (a dummyAddr) Network() string { + return string(a) +} + +// String returns the string form +func (a dummyAddr) String() string { + return string(a) +} diff --git a/vendor/github.com/docker/go-connections/sockets/proxy.go b/vendor/github.com/docker/go-connections/sockets/proxy.go new file mode 100644 index 00000000..f04980e4 --- /dev/null +++ b/vendor/github.com/docker/go-connections/sockets/proxy.go @@ -0,0 +1,31 @@ +package sockets + +import ( + "net" + "os" + "strings" +) + +// GetProxyEnv allows access to the uppercase and the lowercase forms of +// proxy-related variables. See the Go specification for details on these +// variables. https://golang.org/pkg/net/http/ +// +// Deprecated: this function was used as helper for [DialerFromEnvironment] and is no longer used. It will be removed in the next release. +func GetProxyEnv(key string) string { + proxyValue := os.Getenv(strings.ToUpper(key)) + if proxyValue == "" { + return os.Getenv(strings.ToLower(key)) + } + return proxyValue +} + +// DialerFromEnvironment was previously used to configure a net.Dialer to route +// connections through a SOCKS proxy. +// +// Deprecated: SOCKS proxies are now supported by configuring only +// http.Transport.Proxy, and no longer require changing http.Transport.Dial. +// Therefore, only [sockets.ConfigureTransport] needs to be called, and any +// [sockets.DialerFromEnvironment] calls can be dropped. +func DialerFromEnvironment(direct *net.Dialer) (*net.Dialer, error) { + return direct, nil +} diff --git a/vendor/github.com/docker/go-connections/sockets/sockets.go b/vendor/github.com/docker/go-connections/sockets/sockets.go new file mode 100644 index 00000000..61172978 --- /dev/null +++ b/vendor/github.com/docker/go-connections/sockets/sockets.go @@ -0,0 +1,66 @@ +// Package sockets provides helper functions to create and configure Unix or TCP sockets. +package sockets + +import ( + "context" + "errors" + "fmt" + "net" + "net/http" + "syscall" + "time" +) + +const ( + defaultTimeout = 10 * time.Second + maxUnixSocketPathSize = len(syscall.RawSockaddrUnix{}.Path) +) + +// ErrProtocolNotAvailable is returned when a given transport protocol is not provided by the operating system. +var ErrProtocolNotAvailable = errors.New("protocol not available") + +// ConfigureTransport configures the specified [http.Transport] according to the specified proto +// and addr. +// +// If the proto is unix (using a unix socket to communicate) or npipe the compression is disabled. +// For other protos, compression is enabled. If you want to manually enable/disable compression, +// make sure you do it _after_ any subsequent calls to ConfigureTransport is made against the same +// [http.Transport]. +func ConfigureTransport(tr *http.Transport, proto, addr string) error { + switch proto { + case "unix": + return configureUnixTransport(tr, proto, addr) + case "npipe": + return configureNpipeTransport(tr, proto, addr) + default: + tr.Proxy = http.ProxyFromEnvironment + tr.DisableCompression = false + tr.DialContext = (&net.Dialer{ + Timeout: defaultTimeout, + }).DialContext + } + return nil +} + +// DialPipe connects to a Windows named pipe. It is not supported on +// non-Windows platforms. +// +// Deprecated: use [github.com/Microsoft/go-winio.DialPipe] or [github.com/Microsoft/go-winio.DialPipeContext]. +func DialPipe(addr string, timeout time.Duration) (net.Conn, error) { + return dialPipe(addr, timeout) +} + +func configureUnixTransport(tr *http.Transport, proto, addr string) error { + if len(addr) > maxUnixSocketPathSize { + return fmt.Errorf("unix socket path %q is too long", addr) + } + // No need for compression in local communications. + tr.DisableCompression = true + dialer := &net.Dialer{ + Timeout: defaultTimeout, + } + tr.DialContext = func(ctx context.Context, _, _ string) (net.Conn, error) { + return dialer.DialContext(ctx, proto, addr) + } + return nil +} diff --git a/vendor/github.com/docker/go-connections/sockets/sockets_unix.go b/vendor/github.com/docker/go-connections/sockets/sockets_unix.go new file mode 100644 index 00000000..913d2f00 --- /dev/null +++ b/vendor/github.com/docker/go-connections/sockets/sockets_unix.go @@ -0,0 +1,18 @@ +//go:build !windows + +package sockets + +import ( + "net" + "net/http" + "syscall" + "time" +) + +func configureNpipeTransport(tr *http.Transport, proto, addr string) error { + return ErrProtocolNotAvailable +} + +func dialPipe(_ string, _ time.Duration) (net.Conn, error) { + return nil, syscall.EAFNOSUPPORT +} diff --git a/vendor/github.com/docker/go-connections/sockets/sockets_windows.go b/vendor/github.com/docker/go-connections/sockets/sockets_windows.go new file mode 100644 index 00000000..6d6beb38 --- /dev/null +++ b/vendor/github.com/docker/go-connections/sockets/sockets_windows.go @@ -0,0 +1,23 @@ +package sockets + +import ( + "context" + "net" + "net/http" + "time" + + "github.com/Microsoft/go-winio" +) + +func configureNpipeTransport(tr *http.Transport, proto, addr string) error { + // No need for compression in local communications. + tr.DisableCompression = true + tr.DialContext = func(ctx context.Context, _, _ string) (net.Conn, error) { + return winio.DialPipeContext(ctx, addr) + } + return nil +} + +func dialPipe(addr string, timeout time.Duration) (net.Conn, error) { + return winio.DialPipe(addr, &timeout) +} diff --git a/vendor/github.com/docker/go-connections/sockets/tcp_socket.go b/vendor/github.com/docker/go-connections/sockets/tcp_socket.go new file mode 100644 index 00000000..53cbb6c7 --- /dev/null +++ b/vendor/github.com/docker/go-connections/sockets/tcp_socket.go @@ -0,0 +1,22 @@ +// Package sockets provides helper functions to create and configure Unix or TCP sockets. +package sockets + +import ( + "crypto/tls" + "net" +) + +// NewTCPSocket creates a TCP socket listener with the specified address and +// the specified tls configuration. If TLSConfig is set, will encapsulate the +// TCP listener inside a TLS one. +func NewTCPSocket(addr string, tlsConfig *tls.Config) (net.Listener, error) { + l, err := net.Listen("tcp", addr) + if err != nil { + return nil, err + } + if tlsConfig != nil { + tlsConfig.NextProtos = []string{"http/1.1"} + l = tls.NewListener(l, tlsConfig) + } + return l, nil +} diff --git a/vendor/github.com/docker/go-connections/sockets/unix_socket.go b/vendor/github.com/docker/go-connections/sockets/unix_socket.go new file mode 100644 index 00000000..e736f71d --- /dev/null +++ b/vendor/github.com/docker/go-connections/sockets/unix_socket.go @@ -0,0 +1,84 @@ +/* +Package sockets is a simple unix domain socket wrapper. + +# Usage + +For example: + + import( + "fmt" + "net" + "os" + "github.com/docker/go-connections/sockets" + ) + + func main() { + l, err := sockets.NewUnixSocketWithOpts("/path/to/sockets", + sockets.WithChown(0,0),sockets.WithChmod(0660)) + if err != nil { + panic(err) + } + echoStr := "hello" + + go func() { + for { + conn, err := l.Accept() + if err != nil { + return + } + conn.Write([]byte(echoStr)) + conn.Close() + } + }() + + conn, err := net.Dial("unix", path) + if err != nil { + t.Fatal(err) + } + + buf := make([]byte, 5) + if _, err := conn.Read(buf); err != nil { + panic(err) + } else if string(buf) != echoStr { + panic(fmt.Errorf("msg may lost")) + } + } +*/ +package sockets + +import ( + "net" + "os" + "syscall" +) + +// SockOption sets up socket file's creating option +type SockOption func(string) error + +// NewUnixSocketWithOpts creates a unix socket with the specified options. +// By default, socket permissions are 0000 (i.e.: no access for anyone); pass +// WithChmod() and WithChown() to set the desired ownership and permissions. +// +// This function temporarily changes the system's "umask" to 0777 to work around +// a race condition between creating the socket and setting its permissions. While +// this should only be for a short duration, it may affect other processes that +// create files/directories during that period. +func NewUnixSocketWithOpts(path string, opts ...SockOption) (net.Listener, error) { + if err := syscall.Unlink(path); err != nil && !os.IsNotExist(err) { + return nil, err + } + + l, err := listenUnix(path) + if err != nil { + return nil, err + } + + for _, op := range opts { + if err := op(path); err != nil { + _ = l.Close() + return nil, err + } + } + + return l, nil +} diff --git a/vendor/github.com/docker/go-connections/sockets/unix_socket_unix.go b/vendor/github.com/docker/go-connections/sockets/unix_socket_unix.go new file mode 100644 index 00000000..a41a7165 --- /dev/null +++ b/vendor/github.com/docker/go-connections/sockets/unix_socket_unix.go @@ -0,0 +1,54 @@ +//go:build !windows + +package sockets + +import ( + "net" + "os" + "syscall" +) + +// WithChown modifies the socket file's uid and gid +func WithChown(uid, gid int) SockOption { + return func(path string) error { + if err := os.Chown(path, uid, gid); err != nil { + return err + } + return nil + } +} + +// WithChmod modifies socket file's access mode. +func WithChmod(mask os.FileMode) SockOption { + return func(path string) error { + if err := os.Chmod(path, mask); err != nil { + return err + } + return nil + } +} + +// NewUnixSocket creates a unix socket with the specified path and group. +func NewUnixSocket(path string, gid int) (net.Listener, error) { + return NewUnixSocketWithOpts(path, WithChown(0, gid), WithChmod(0o660)) +} + +func listenUnix(path string) (net.Listener, error) { + // net.Listen does not allow for permissions to be set. As a result, when + // specifying custom permissions ("WithChmod()"), there is a short time + // between creating the socket and applying the permissions, during which + // the socket permissions are Less restrictive than desired. + // + // To work around this limitation of net.Listen(), we temporarily set the + // umask to 0777, which forces the socket to be created with 000 permissions + // (i.e.: no access for anyone). After that, WithChmod() must be used to set + // the desired permissions. + // + // We don't use "defer" here, to reset the umask to its original value as soon + // as possible. Ideally we'd be able to detect if WithChmod() was passed as + // an option, and skip changing umask if default permissions are used. + origUmask := syscall.Umask(0o777) + l, err := net.Listen("unix", path) + syscall.Umask(origUmask) + return l, err +} diff --git a/vendor/github.com/docker/go-connections/sockets/unix_socket_windows.go b/vendor/github.com/docker/go-connections/sockets/unix_socket_windows.go new file mode 100644 index 00000000..5ec29e05 --- /dev/null +++ b/vendor/github.com/docker/go-connections/sockets/unix_socket_windows.go @@ -0,0 +1,7 @@ +package sockets + +import "net" + +func listenUnix(path string) (net.Listener, error) { + return net.Listen("unix", path) +} diff --git a/vendor/github.com/docker/go-connections/tlsconfig/certpool.go b/vendor/github.com/docker/go-connections/tlsconfig/certpool.go new file mode 100644 index 00000000..f84c624b --- /dev/null +++ b/vendor/github.com/docker/go-connections/tlsconfig/certpool.go @@ -0,0 +1,16 @@ +package tlsconfig + +import ( + "crypto/x509" + "runtime" +) + +// SystemCertPool returns a copy of the system cert pool, +// returns an error if failed to load or empty pool on windows. +func SystemCertPool() (*x509.CertPool, error) { + certpool, err := x509.SystemCertPool() + if err != nil && runtime.GOOS == "windows" { + return x509.NewCertPool(), nil + } + return certpool, err +} diff --git a/vendor/github.com/docker/go-connections/tlsconfig/config.go b/vendor/github.com/docker/go-connections/tlsconfig/config.go new file mode 100644 index 00000000..8b0264f6 --- /dev/null +++ b/vendor/github.com/docker/go-connections/tlsconfig/config.go @@ -0,0 +1,245 @@ +// Package tlsconfig provides primitives to retrieve secure-enough TLS configurations for both clients and servers. +// +// As a reminder from https://golang.org/pkg/crypto/tls/#Config: +// +// A Config structure is used to configure a TLS client or server. After one has been passed to a TLS function it must not be modified. +// A Config may be reused; the tls package will also not modify it. +package tlsconfig + +import ( + "crypto/tls" + "crypto/x509" + "encoding/pem" + "errors" + "fmt" + "os" +) + +// Options represents the information needed to create client and server TLS configurations. +type Options struct { + CAFile string + + // If either CertFile or KeyFile is empty, Client() will not load them + // preventing the client from authenticating to the server. + // However, Server() requires them and will error out if they are empty. + CertFile string + KeyFile string + + // client-only option + InsecureSkipVerify bool + // server-only option + ClientAuth tls.ClientAuthType + // If ExclusiveRootPools is set, then if a CA file is provided, the root pool used for TLS + // creds will include exclusively the roots in that CA file. If no CA file is provided, + // the system pool will be used. + ExclusiveRootPools bool + MinVersion uint16 +} + +// DefaultServerAcceptedCiphers should be uses by code which already has a crypto/tls +// options struct but wants to use a commonly accepted set of TLS cipher suites, with +// known weak algorithms removed. +var DefaultServerAcceptedCiphers = defaultCipherSuites + +// defaultCipherSuites is shared by both client and server as the default set. +var defaultCipherSuites = []uint16{ + tls.TLS_ECDHE_ECDSA_WITH_AES_256_GCM_SHA384, + tls.TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384, + tls.TLS_ECDHE_ECDSA_WITH_AES_128_GCM_SHA256, + tls.TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256, +} + +// ServerDefault returns a secure-enough TLS configuration for the server TLS configuration. +func ServerDefault(ops ...func(*tls.Config)) *tls.Config { + return defaultConfig(ops...) +} + +// ClientDefault returns a secure-enough TLS configuration for the client TLS configuration. +func ClientDefault(ops ...func(*tls.Config)) *tls.Config { + return defaultConfig(ops...) +} + +// defaultConfig is the default config used by both client and server TLS configuration. +func defaultConfig(ops ...func(*tls.Config)) *tls.Config { + tlsConfig := &tls.Config{ + // Avoid fallback by default to SSL protocols < TLS1.2 + MinVersion: tls.VersionTLS12, + CipherSuites: defaultCipherSuites, + } + + for _, op := range ops { + op(tlsConfig) + } + + return tlsConfig +} + +// certPool returns an X.509 certificate pool from `caFile`, the certificate file. +func certPool(caFile string, exclusivePool bool) (*x509.CertPool, error) { + // If we should verify the server, we need to load a trusted ca + var ( + pool *x509.CertPool + err error + ) + if exclusivePool { + pool = x509.NewCertPool() + } else { + pool, err = SystemCertPool() + if err != nil { + return nil, fmt.Errorf("failed to read system certificates: %v", err) + } + } + pemData, err := os.ReadFile(caFile) + if err != nil { + return nil, fmt.Errorf("could not read CA certificate %q: %v", caFile, err) + } + if !pool.AppendCertsFromPEM(pemData) { + return nil, fmt.Errorf("failed to append certificates from PEM file: %q", caFile) + } + return pool, nil +} + +// allTLSVersions lists all the TLS versions and is used by the code that validates +// a uint16 value as a TLS version. +var allTLSVersions = map[uint16]struct{}{ + tls.VersionTLS10: {}, + tls.VersionTLS11: {}, + tls.VersionTLS12: {}, + tls.VersionTLS13: {}, +} + +// isValidMinVersion checks that the input value is a valid tls minimum version +func isValidMinVersion(version uint16) bool { + _, ok := allTLSVersions[version] + return ok +} + +// adjustMinVersion sets the MinVersion on `config`, the input configuration. +// It assumes the current MinVersion on the `config` is the lowest allowed. +func adjustMinVersion(options Options, config *tls.Config) error { + if options.MinVersion > 0 { + if !isValidMinVersion(options.MinVersion) { + return fmt.Errorf("invalid minimum TLS version: %x", options.MinVersion) + } + if options.MinVersion < config.MinVersion { + return fmt.Errorf("requested minimum TLS version is too low. Should be at-least: %x", config.MinVersion) + } + config.MinVersion = options.MinVersion + } + + return nil +} + +// errEncryptedKeyDeprecated is produced when we encounter an encrypted +// (password-protected) key. From https://go-review.googlesource.com/c/go/+/264159; +// +// > Legacy PEM encryption as specified in RFC 1423 is insecure by design. Since +// > it does not authenticate the ciphertext, it is vulnerable to padding oracle +// > attacks that can let an attacker recover the plaintext +// > +// > It's unfortunate that we don't implement PKCS#8 encryption so we can't +// > recommend an alternative but PEM encryption is so broken that it's worth +// > deprecating outright. +// +// Also see https://docs.docker.com/go/deprecated/ +var errEncryptedKeyDeprecated = errors.New("private key is encrypted; encrypted private keys are obsolete, and not supported") + +// getPrivateKey returns the private key in 'keyBytes', in PEM-encoded format. +// It returns an error if the file could not be decoded or was protected by +// a passphrase. +func getPrivateKey(keyBytes []byte) ([]byte, error) { + // this section makes some small changes to code from notary/tuf/utils/x509.go + pemBlock, _ := pem.Decode(keyBytes) + if pemBlock == nil { + return nil, fmt.Errorf("no valid private key found") + } + + if x509.IsEncryptedPEMBlock(pemBlock) { //nolint:staticcheck // Ignore SA1019 (IsEncryptedPEMBlock is deprecated) + return nil, errEncryptedKeyDeprecated + } + + return keyBytes, nil +} + +// getCert returns a Certificate from the CertFile and KeyFile in 'options', +// if the key is encrypted, the Passphrase in 'options' will be used to +// decrypt it. +func getCert(options Options) ([]tls.Certificate, error) { + if options.CertFile == "" && options.KeyFile == "" { + return nil, nil + } + + cert, err := os.ReadFile(options.CertFile) + if err != nil { + return nil, err + } + + prKeyBytes, err := os.ReadFile(options.KeyFile) + if err != nil { + return nil, err + } + + prKeyBytes, err = getPrivateKey(prKeyBytes) + if err != nil { + return nil, err + } + + tlsCert, err := tls.X509KeyPair(cert, prKeyBytes) + if err != nil { + return nil, err + } + + return []tls.Certificate{tlsCert}, nil +} + +// Client returns a TLS configuration meant to be used by a client. +func Client(options Options) (*tls.Config, error) { + tlsConfig := defaultConfig() + tlsConfig.InsecureSkipVerify = options.InsecureSkipVerify + if !options.InsecureSkipVerify && options.CAFile != "" { + CAs, err := certPool(options.CAFile, options.ExclusiveRootPools) + if err != nil { + return nil, err + } + tlsConfig.RootCAs = CAs + } + + tlsCerts, err := getCert(options) + if err != nil { + return nil, fmt.Errorf("could not load X509 key pair: %w", err) + } + tlsConfig.Certificates = tlsCerts + + if err := adjustMinVersion(options, tlsConfig); err != nil { + return nil, err + } + + return tlsConfig, nil +} + +// Server returns a TLS configuration meant to be used by a server. +func Server(options Options) (*tls.Config, error) { + tlsConfig := defaultConfig() + tlsConfig.ClientAuth = options.ClientAuth + tlsCert, err := tls.LoadX509KeyPair(options.CertFile, options.KeyFile) + if err != nil { + if os.IsNotExist(err) { + return nil, fmt.Errorf("could not load X509 key pair (cert: %q, key: %q): %v", options.CertFile, options.KeyFile, err) + } + return nil, fmt.Errorf("error reading X509 key pair - make sure the key is not encrypted (cert: %q, key: %q): %v", options.CertFile, options.KeyFile, err) + } + tlsConfig.Certificates = []tls.Certificate{tlsCert} + if options.ClientAuth >= tls.VerifyClientCertIfGiven && options.CAFile != "" { + CAs, err := certPool(options.CAFile, options.ExclusiveRootPools) + if err != nil { + return nil, err + } + tlsConfig.ClientCAs = CAs + } + + if err := adjustMinVersion(options, tlsConfig); err != nil { + return nil, err + } + + return tlsConfig, nil +} diff --git a/vendor/github.com/docker/go-units/CONTRIBUTING.md b/vendor/github.com/docker/go-units/CONTRIBUTING.md new file mode 100644 index 00000000..9ea86d78 --- /dev/null +++ b/vendor/github.com/docker/go-units/CONTRIBUTING.md @@ -0,0 +1,67 @@ +# Contributing to go-units + +Want to hack on go-units? Awesome! Here are instructions to get you started. + +go-units is a part of the [Docker](https://www.docker.com) project, and follows +the same rules and principles. If you're already familiar with the way +Docker does things, you'll feel right at home. + +Otherwise, go read Docker's +[contributions guidelines](https://github.com/docker/docker/blob/master/CONTRIBUTING.md), +[issue triaging](https://github.com/docker/docker/blob/master/project/ISSUE-TRIAGE.md), +[review process](https://github.com/docker/docker/blob/master/project/REVIEWING.md) and +[branches and tags](https://github.com/docker/docker/blob/master/project/BRANCHES-AND-TAGS.md). + +### Sign your work + +The sign-off is a simple line at the end of the explanation for the patch. Your +signature certifies that you wrote the patch or otherwise have the right to pass +it on as an open-source patch. The rules are pretty simple: if you can certify +the below (from [developercertificate.org](http://developercertificate.org/)): + +``` +Developer Certificate of Origin +Version 1.1 + +Copyright (C) 2004, 2006 The Linux Foundation and its contributors. +660 York Street, Suite 102, +San Francisco, CA 94110 USA + +Everyone is permitted to copy and distribute verbatim copies of this +license document, but changing it is not allowed. + +Developer's Certificate of Origin 1.1 + +By making a contribution to this project, I certify that: + +(a) The contribution was created in whole or in part by me and I + have the right to submit it under the open source license + indicated in the file; or + +(b) The contribution is based upon previous work that, to the best + of my knowledge, is covered under an appropriate open source + license and I have the right under that license to submit that + work with modifications, whether created in whole or in part + by me, under the same open source license (unless I am + permitted to submit under a different license), as indicated + in the file; or + +(c) The contribution was provided directly to me by some other + person who certified (a), (b) or (c) and I have not modified + it. + +(d) I understand and agree that this project and the contribution + are public and that a record of the contribution (including all + personal information I submit with it, including my sign-off) is + maintained indefinitely and may be redistributed consistent with + this project or the open source license(s) involved. +``` + +Then you just add a line to every git commit message: + + Signed-off-by: Joe Smith + +Use your real name (sorry, no pseudonyms or anonymous contributions.) + +If you set your `user.name` and `user.email` git configs, you can sign your +commit automatically with `git commit -s`. diff --git a/vendor/github.com/docker/go-units/LICENSE b/vendor/github.com/docker/go-units/LICENSE new file mode 100644 index 00000000..b55b37bc --- /dev/null +++ b/vendor/github.com/docker/go-units/LICENSE @@ -0,0 +1,191 @@ + + Apache License + Version 2.0, January 2004 + https://www.apache.org/licenses/ + + TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + + 1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + + 2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + + 3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + + 4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + + 5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + + 6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + + 7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + + 8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + + 9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + + END OF TERMS AND CONDITIONS + + Copyright 2015 Docker, Inc. + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. diff --git a/vendor/github.com/docker/go-units/MAINTAINERS b/vendor/github.com/docker/go-units/MAINTAINERS new file mode 100644 index 00000000..4aac7c74 --- /dev/null +++ b/vendor/github.com/docker/go-units/MAINTAINERS @@ -0,0 +1,46 @@ +# go-units maintainers file +# +# This file describes who runs the docker/go-units project and how. +# This is a living document - if you see something out of date or missing, speak up! +# +# It is structured to be consumable by both humans and programs. +# To extract its contents programmatically, use any TOML-compliant parser. +# +# This file is compiled into the MAINTAINERS file in docker/opensource. +# +[Org] + [Org."Core maintainers"] + people = [ + "akihirosuda", + "dnephin", + "thajeztah", + "vdemeester", + ] + +[people] + +# A reference list of all people associated with the project. +# All other sections should refer to people by their canonical key +# in the people section. + + # ADD YOURSELF HERE IN ALPHABETICAL ORDER + + [people.akihirosuda] + Name = "Akihiro Suda" + Email = "akihiro.suda.cz@hco.ntt.co.jp" + GitHub = "AkihiroSuda" + + [people.dnephin] + Name = "Daniel Nephin" + Email = "dnephin@gmail.com" + GitHub = "dnephin" + + [people.thajeztah] + Name = "Sebastiaan van Stijn" + Email = "github@gone.nl" + GitHub = "thaJeztah" + + [people.vdemeester] + Name = "Vincent Demeester" + Email = "vincent@sbr.pm" + GitHub = "vdemeester" \ No newline at end of file diff --git a/vendor/github.com/docker/go-units/README.md b/vendor/github.com/docker/go-units/README.md new file mode 100644 index 00000000..4f70a4e1 --- /dev/null +++ b/vendor/github.com/docker/go-units/README.md @@ -0,0 +1,16 @@ +[![GoDoc](https://godoc.org/github.com/docker/go-units?status.svg)](https://godoc.org/github.com/docker/go-units) + +# Introduction + +go-units is a library to transform human friendly measurements into machine friendly values. + +## Usage + +See the [docs in godoc](https://godoc.org/github.com/docker/go-units) for examples and documentation. + +## Copyright and license + +Copyright © 2015 Docker, Inc. + +go-units is licensed under the Apache License, Version 2.0. +See [LICENSE](LICENSE) for the full text of the license. diff --git a/vendor/github.com/docker/go-units/circle.yml b/vendor/github.com/docker/go-units/circle.yml new file mode 100644 index 00000000..af9d6055 --- /dev/null +++ b/vendor/github.com/docker/go-units/circle.yml @@ -0,0 +1,11 @@ +dependencies: + post: + # install golint + - go get golang.org/x/lint/golint + +test: + pre: + # run analysis before tests + - go vet ./... + - test -z "$(golint ./... | tee /dev/stderr)" + - test -z "$(gofmt -s -l . | tee /dev/stderr)" diff --git a/vendor/github.com/docker/go-units/duration.go b/vendor/github.com/docker/go-units/duration.go new file mode 100644 index 00000000..48dd8744 --- /dev/null +++ b/vendor/github.com/docker/go-units/duration.go @@ -0,0 +1,35 @@ +// Package units provides helper function to parse and print size and time units +// in human-readable format. +package units + +import ( + "fmt" + "time" +) + +// HumanDuration returns a human-readable approximation of a duration +// (eg. "About a minute", "4 hours ago", etc.). +func HumanDuration(d time.Duration) string { + if seconds := int(d.Seconds()); seconds < 1 { + return "Less than a second" + } else if seconds == 1 { + return "1 second" + } else if seconds < 60 { + return fmt.Sprintf("%d seconds", seconds) + } else if minutes := int(d.Minutes()); minutes == 1 { + return "About a minute" + } else if minutes < 60 { + return fmt.Sprintf("%d minutes", minutes) + } else if hours := int(d.Hours() + 0.5); hours == 1 { + return "About an hour" + } else if hours < 48 { + return fmt.Sprintf("%d hours", hours) + } else if hours < 24*7*2 { + return fmt.Sprintf("%d days", hours/24) + } else if hours < 24*30*2 { + return fmt.Sprintf("%d weeks", hours/24/7) + } else if hours < 24*365*2 { + return fmt.Sprintf("%d months", hours/24/30) + } + return fmt.Sprintf("%d years", int(d.Hours())/24/365) +} diff --git a/vendor/github.com/docker/go-units/size.go b/vendor/github.com/docker/go-units/size.go new file mode 100644 index 00000000..c245a895 --- /dev/null +++ b/vendor/github.com/docker/go-units/size.go @@ -0,0 +1,154 @@ +package units + +import ( + "fmt" + "strconv" + "strings" +) + +// See: http://en.wikipedia.org/wiki/Binary_prefix +const ( + // Decimal + + KB = 1000 + MB = 1000 * KB + GB = 1000 * MB + TB = 1000 * GB + PB = 1000 * TB + + // Binary + + KiB = 1024 + MiB = 1024 * KiB + GiB = 1024 * MiB + TiB = 1024 * GiB + PiB = 1024 * TiB +) + +type unitMap map[byte]int64 + +var ( + decimalMap = unitMap{'k': KB, 'm': MB, 'g': GB, 't': TB, 'p': PB} + binaryMap = unitMap{'k': KiB, 'm': MiB, 'g': GiB, 't': TiB, 'p': PiB} +) + +var ( + decimapAbbrs = []string{"B", "kB", "MB", "GB", "TB", "PB", "EB", "ZB", "YB"} + binaryAbbrs = []string{"B", "KiB", "MiB", "GiB", "TiB", "PiB", "EiB", "ZiB", "YiB"} +) + +func getSizeAndUnit(size float64, base float64, _map []string) (float64, string) { + i := 0 + unitsLimit := len(_map) - 1 + for size >= base && i < unitsLimit { + size = size / base + i++ + } + return size, _map[i] +} + +// CustomSize returns a human-readable approximation of a size +// using custom format. +func CustomSize(format string, size float64, base float64, _map []string) string { + size, unit := getSizeAndUnit(size, base, _map) + return fmt.Sprintf(format, size, unit) +} + +// HumanSizeWithPrecision allows the size to be in any precision, +// instead of 4 digit precision used in units.HumanSize. +func HumanSizeWithPrecision(size float64, precision int) string { + size, unit := getSizeAndUnit(size, 1000.0, decimapAbbrs) + return fmt.Sprintf("%.*g%s", precision, size, unit) +} + +// HumanSize returns a human-readable approximation of a size +// capped at 4 valid numbers (eg. "2.746 MB", "796 KB"). +func HumanSize(size float64) string { + return HumanSizeWithPrecision(size, 4) +} + +// BytesSize returns a human-readable size in bytes, kibibytes, +// mebibytes, gibibytes, or tebibytes (eg. "44kiB", "17MiB"). +func BytesSize(size float64) string { + return CustomSize("%.4g%s", size, 1024.0, binaryAbbrs) +} + +// FromHumanSize returns an integer from a human-readable specification of a +// size using SI standard (eg. "44kB", "17MB"). +func FromHumanSize(size string) (int64, error) { + return parseSize(size, decimalMap) +} + +// RAMInBytes parses a human-readable string representing an amount of RAM +// in bytes, kibibytes, mebibytes, gibibytes, or tebibytes and +// returns the number of bytes, or -1 if the string is unparseable. +// Units are case-insensitive, and the 'b' suffix is optional. +func RAMInBytes(size string) (int64, error) { + return parseSize(size, binaryMap) +} + +// Parses the human-readable size string into the amount it represents. +func parseSize(sizeStr string, uMap unitMap) (int64, error) { + // TODO: rewrite to use strings.Cut if there's a space + // once Go < 1.18 is deprecated. + sep := strings.LastIndexAny(sizeStr, "01234567890. ") + if sep == -1 { + // There should be at least a digit. + return -1, fmt.Errorf("invalid size: '%s'", sizeStr) + } + var num, sfx string + if sizeStr[sep] != ' ' { + num = sizeStr[:sep+1] + sfx = sizeStr[sep+1:] + } else { + // Omit the space separator. + num = sizeStr[:sep] + sfx = sizeStr[sep+1:] + } + + size, err := strconv.ParseFloat(num, 64) + if err != nil { + return -1, err + } + // Backward compatibility: reject negative sizes. + if size < 0 { + return -1, fmt.Errorf("invalid size: '%s'", sizeStr) + } + + if len(sfx) == 0 { + return int64(size), nil + } + + // Process the suffix. + + if len(sfx) > 3 { // Too long. + goto badSuffix + } + sfx = strings.ToLower(sfx) + // Trivial case: b suffix. + if sfx[0] == 'b' { + if len(sfx) > 1 { // no extra characters allowed after b. + goto badSuffix + } + return int64(size), nil + } + // A suffix from the map. + if mul, ok := uMap[sfx[0]]; ok { + size *= float64(mul) + } else { + goto badSuffix + } + + // The suffix may have extra "b" or "ib" (e.g. KiB or MB). + switch { + case len(sfx) == 2 && sfx[1] != 'b': + goto badSuffix + case len(sfx) == 3 && sfx[1:] != "ib": + goto badSuffix + } + + return int64(size), nil + +badSuffix: + return -1, fmt.Errorf("invalid suffix: '%s'", sfx) +} diff --git a/vendor/github.com/docker/go-units/ulimit.go b/vendor/github.com/docker/go-units/ulimit.go new file mode 100644 index 00000000..fca0400c --- /dev/null +++ b/vendor/github.com/docker/go-units/ulimit.go @@ -0,0 +1,123 @@ +package units + +import ( + "fmt" + "strconv" + "strings" +) + +// Ulimit is a human friendly version of Rlimit. +type Ulimit struct { + Name string + Hard int64 + Soft int64 +} + +// Rlimit specifies the resource limits, such as max open files. +type Rlimit struct { + Type int `json:"type,omitempty"` + Hard uint64 `json:"hard,omitempty"` + Soft uint64 `json:"soft,omitempty"` +} + +const ( + // magic numbers for making the syscall + // some of these are defined in the syscall package, but not all. + // Also since Windows client doesn't get access to the syscall package, need to + // define these here + rlimitAs = 9 + rlimitCore = 4 + rlimitCPU = 0 + rlimitData = 2 + rlimitFsize = 1 + rlimitLocks = 10 + rlimitMemlock = 8 + rlimitMsgqueue = 12 + rlimitNice = 13 + rlimitNofile = 7 + rlimitNproc = 6 + rlimitRss = 5 + rlimitRtprio = 14 + rlimitRttime = 15 + rlimitSigpending = 11 + rlimitStack = 3 +) + +var ulimitNameMapping = map[string]int{ + //"as": rlimitAs, // Disabled since this doesn't seem usable with the way Docker inits a container. + "core": rlimitCore, + "cpu": rlimitCPU, + "data": rlimitData, + "fsize": rlimitFsize, + "locks": rlimitLocks, + "memlock": rlimitMemlock, + "msgqueue": rlimitMsgqueue, + "nice": rlimitNice, + "nofile": rlimitNofile, + "nproc": rlimitNproc, + "rss": rlimitRss, + "rtprio": rlimitRtprio, + "rttime": rlimitRttime, + "sigpending": rlimitSigpending, + "stack": rlimitStack, +} + +// ParseUlimit parses and returns a Ulimit from the specified string. +func ParseUlimit(val string) (*Ulimit, error) { + parts := strings.SplitN(val, "=", 2) + if len(parts) != 2 { + return nil, fmt.Errorf("invalid ulimit argument: %s", val) + } + + if _, exists := ulimitNameMapping[parts[0]]; !exists { + return nil, fmt.Errorf("invalid ulimit type: %s", parts[0]) + } + + var ( + soft int64 + hard = &soft // default to soft in case no hard was set + temp int64 + err error + ) + switch limitVals := strings.Split(parts[1], ":"); len(limitVals) { + case 2: + temp, err = strconv.ParseInt(limitVals[1], 10, 64) + if err != nil { + return nil, err + } + hard = &temp + fallthrough + case 1: + soft, err = strconv.ParseInt(limitVals[0], 10, 64) + if err != nil { + return nil, err + } + default: + return nil, fmt.Errorf("too many limit value arguments - %s, can only have up to two, `soft[:hard]`", parts[1]) + } + + if *hard != -1 { + if soft == -1 { + return nil, fmt.Errorf("ulimit soft limit must be less than or equal to hard limit: soft: -1 (unlimited), hard: %d", *hard) + } + if soft > *hard { + return nil, fmt.Errorf("ulimit soft limit must be less than or equal to hard limit: %d > %d", soft, *hard) + } + } + + return &Ulimit{Name: parts[0], Soft: soft, Hard: *hard}, nil +} + +// GetRlimit returns the RLimit corresponding to Ulimit. +func (u *Ulimit) GetRlimit() (*Rlimit, error) { + t, exists := ulimitNameMapping[u.Name] + if !exists { + return nil, fmt.Errorf("invalid ulimit name %s", u.Name) + } + + return &Rlimit{Type: t, Soft: uint64(u.Soft), Hard: uint64(u.Hard)}, nil +} + +func (u *Ulimit) String() string { + return fmt.Sprintf("%s=%d:%d", u.Name, u.Soft, u.Hard) +} diff --git a/vendor/github.com/felixge/httpsnoop/.gitignore b/vendor/github.com/felixge/httpsnoop/.gitignore new file mode 100644 index 00000000..e69de29b diff --git a/vendor/github.com/felixge/httpsnoop/LICENSE.txt b/vendor/github.com/felixge/httpsnoop/LICENSE.txt new file mode 100644 index 00000000..e028b46a --- /dev/null +++ b/vendor/github.com/felixge/httpsnoop/LICENSE.txt @@ -0,0 +1,19 @@ +Copyright (c) 2016 Felix Geisendörfer (felix@debuggable.com) + + 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. diff --git a/vendor/github.com/felixge/httpsnoop/Makefile b/vendor/github.com/felixge/httpsnoop/Makefile new file mode 100644 index 00000000..4e12afdd --- /dev/null +++ b/vendor/github.com/felixge/httpsnoop/Makefile @@ -0,0 +1,10 @@ +.PHONY: ci generate clean + +ci: clean generate + go test -race -v ./... + +generate: + go generate . + +clean: + rm -rf *_generated*.go diff --git a/vendor/github.com/felixge/httpsnoop/README.md b/vendor/github.com/felixge/httpsnoop/README.md new file mode 100644 index 00000000..cf6b42f3 --- /dev/null +++ b/vendor/github.com/felixge/httpsnoop/README.md @@ -0,0 +1,95 @@ +# httpsnoop + +Package httpsnoop provides an easy way to capture http related metrics (i.e. +response time, bytes written, and http status code) from your application's +http.Handlers. + +Doing this requires non-trivial wrapping of the http.ResponseWriter interface, +which is also exposed for users interested in a more low-level API. + +[![Go Reference](https://pkg.go.dev/badge/github.com/felixge/httpsnoop.svg)](https://pkg.go.dev/github.com/felixge/httpsnoop) +[![Build Status](https://github.com/felixge/httpsnoop/actions/workflows/main.yaml/badge.svg)](https://github.com/felixge/httpsnoop/actions/workflows/main.yaml) + +## Usage Example + +```go +// myH is your app's http handler, perhaps a http.ServeMux or similar. +var myH http.Handler +// wrappedH wraps myH in order to log every request. +wrappedH := http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { + m := httpsnoop.CaptureMetrics(myH, w, r) + log.Printf( + "%s %s (code=%d dt=%s written=%d)", + r.Method, + r.URL, + m.Code, + m.Duration, + m.Written, + ) +}) +http.ListenAndServe(":8080", wrappedH) +``` + +## Why this package exists + +Instrumenting an application's http.Handler is surprisingly difficult. + +However if you google for e.g. "capture ResponseWriter status code" you'll find +lots of advise and code examples that suggest it to be a fairly trivial +undertaking. Unfortunately everything I've seen so far has a high chance of +breaking your application. + +The main problem is that a `http.ResponseWriter` often implements additional +interfaces such as `http.Flusher`, `http.CloseNotifier`, `http.Hijacker`, `http.Pusher`, and +`io.ReaderFrom`. So the naive approach of just wrapping `http.ResponseWriter` +in your own struct that also implements the `http.ResponseWriter` interface +will hide the additional interfaces mentioned above. This has a high change of +introducing subtle bugs into any non-trivial application. + +Another approach I've seen people take is to return a struct that implements +all of the interfaces above. However, that's also problematic, because it's +difficult to fake some of these interfaces behaviors when the underlying +`http.ResponseWriter` doesn't have an implementation. It's also dangerous, +because an application may choose to operate differently, merely because it +detects the presence of these additional interfaces. + +This package solves this problem by checking which additional interfaces a +`http.ResponseWriter` implements, returning a wrapped version implementing the +exact same set of interfaces. + +Additionally this package properly handles edge cases such as `WriteHeader` not +being called, or called more than once, as well as concurrent calls to +`http.ResponseWriter` methods, and even calls happening after the wrapped +`ServeHTTP` has already returned. + +Unfortunately this package is not perfect either. It's possible that it is +still missing some interfaces provided by the go core (let me know if you find +one), and it won't work for applications adding their own interfaces into the +mix. You can however use `httpsnoop.Unwrap(w)` to access the underlying +`http.ResponseWriter` and type-assert the result to its other interfaces. + +However, hopefully the explanation above has sufficiently scared you of rolling +your own solution to this problem. httpsnoop may still break your application, +but at least it tries to avoid it as much as possible. + +Anyway, the real problem here is that smuggling additional interfaces inside +`http.ResponseWriter` is a problematic design choice, but it probably goes as +deep as the Go language specification itself. But that's okay, I still prefer +Go over the alternatives ;). + +## Performance + +``` +BenchmarkBaseline-8 20000 94912 ns/op +BenchmarkCaptureMetrics-8 20000 95461 ns/op +``` + +As you can see, using `CaptureMetrics` on a vanilla http.Handler introduces an +overhead of ~500 ns per http request on my machine. However, the margin of +error appears to be larger than that, therefor it should be reasonable to +assume that the overhead introduced by `CaptureMetrics` is absolutely +negligible. + +## License + +MIT diff --git a/vendor/github.com/felixge/httpsnoop/capture_metrics.go b/vendor/github.com/felixge/httpsnoop/capture_metrics.go new file mode 100644 index 00000000..bec7b71b --- /dev/null +++ b/vendor/github.com/felixge/httpsnoop/capture_metrics.go @@ -0,0 +1,86 @@ +package httpsnoop + +import ( + "io" + "net/http" + "time" +) + +// Metrics holds metrics captured from CaptureMetrics. +type Metrics struct { + // Code is the first http response code passed to the WriteHeader func of + // the ResponseWriter. If no such call is made, a default code of 200 is + // assumed instead. + Code int + // Duration is the time it took to execute the handler. + Duration time.Duration + // Written is the number of bytes successfully written by the Write or + // ReadFrom function of the ResponseWriter. ResponseWriters may also write + // data to their underlaying connection directly (e.g. headers), but those + // are not tracked. Therefor the number of Written bytes will usually match + // the size of the response body. + Written int64 +} + +// CaptureMetrics wraps the given hnd, executes it with the given w and r, and +// returns the metrics it captured from it. +func CaptureMetrics(hnd http.Handler, w http.ResponseWriter, r *http.Request) Metrics { + return CaptureMetricsFn(w, func(ww http.ResponseWriter) { + hnd.ServeHTTP(ww, r) + }) +} + +// CaptureMetricsFn wraps w and calls fn with the wrapped w and returns the +// resulting metrics. This is very similar to CaptureMetrics (which is just +// sugar on top of this func), but is a more usable interface if your +// application doesn't use the Go http.Handler interface. +func CaptureMetricsFn(w http.ResponseWriter, fn func(http.ResponseWriter)) Metrics { + m := Metrics{Code: http.StatusOK} + m.CaptureMetrics(w, fn) + return m +} + +// CaptureMetrics wraps w and calls fn with the wrapped w and updates +// Metrics m with the resulting metrics. This is similar to CaptureMetricsFn, +// but allows one to customize starting Metrics object. +func (m *Metrics) CaptureMetrics(w http.ResponseWriter, fn func(http.ResponseWriter)) { + var ( + start = time.Now() + headerWritten bool + hooks = Hooks{ + WriteHeader: func(next WriteHeaderFunc) WriteHeaderFunc { + return func(code int) { + next(code) + + if !(code >= 100 && code <= 199) && !headerWritten { + m.Code = code + headerWritten = true + } + } + }, + + Write: func(next WriteFunc) WriteFunc { + return func(p []byte) (int, error) { + n, err := next(p) + + m.Written += int64(n) + headerWritten = true + return n, err + } + }, + + ReadFrom: func(next ReadFromFunc) ReadFromFunc { + return func(src io.Reader) (int64, error) { + n, err := next(src) + + headerWritten = true + m.Written += n + return n, err + } + }, + } + ) + + fn(Wrap(w, hooks)) + m.Duration += time.Since(start) +} diff --git a/vendor/github.com/felixge/httpsnoop/docs.go b/vendor/github.com/felixge/httpsnoop/docs.go new file mode 100644 index 00000000..203c35b3 --- /dev/null +++ b/vendor/github.com/felixge/httpsnoop/docs.go @@ -0,0 +1,10 @@ +// Package httpsnoop provides an easy way to capture http related metrics (i.e. +// response time, bytes written, and http status code) from your application's +// http.Handlers. +// +// Doing this requires non-trivial wrapping of the http.ResponseWriter +// interface, which is also exposed for users interested in a more low-level +// API. +package httpsnoop + +//go:generate go run codegen/main.go diff --git a/vendor/github.com/felixge/httpsnoop/wrap_generated_gteq_1.8.go b/vendor/github.com/felixge/httpsnoop/wrap_generated_gteq_1.8.go new file mode 100644 index 00000000..101cedde --- /dev/null +++ b/vendor/github.com/felixge/httpsnoop/wrap_generated_gteq_1.8.go @@ -0,0 +1,436 @@ +// +build go1.8 +// Code generated by "httpsnoop/codegen"; DO NOT EDIT. + +package httpsnoop + +import ( + "bufio" + "io" + "net" + "net/http" +) + +// HeaderFunc is part of the http.ResponseWriter interface. +type HeaderFunc func() http.Header + +// WriteHeaderFunc is part of the http.ResponseWriter interface. +type WriteHeaderFunc func(code int) + +// WriteFunc is part of the http.ResponseWriter interface. +type WriteFunc func(b []byte) (int, error) + +// FlushFunc is part of the http.Flusher interface. +type FlushFunc func() + +// CloseNotifyFunc is part of the http.CloseNotifier interface. +type CloseNotifyFunc func() <-chan bool + +// HijackFunc is part of the http.Hijacker interface. +type HijackFunc func() (net.Conn, *bufio.ReadWriter, error) + +// ReadFromFunc is part of the io.ReaderFrom interface. +type ReadFromFunc func(src io.Reader) (int64, error) + +// PushFunc is part of the http.Pusher interface. +type PushFunc func(target string, opts *http.PushOptions) error + +// Hooks defines a set of method interceptors for methods included in +// http.ResponseWriter as well as some others. You can think of them as +// middleware for the function calls they target. See Wrap for more details. +type Hooks struct { + Header func(HeaderFunc) HeaderFunc + WriteHeader func(WriteHeaderFunc) WriteHeaderFunc + Write func(WriteFunc) WriteFunc + Flush func(FlushFunc) FlushFunc + CloseNotify func(CloseNotifyFunc) CloseNotifyFunc + Hijack func(HijackFunc) HijackFunc + ReadFrom func(ReadFromFunc) ReadFromFunc + Push func(PushFunc) PushFunc +} + +// Wrap returns a wrapped version of w that provides the exact same interface +// as w. Specifically if w implements any combination of: +// +// - http.Flusher +// - http.CloseNotifier +// - http.Hijacker +// - io.ReaderFrom +// - http.Pusher +// +// The wrapped version will implement the exact same combination. If no hooks +// are set, the wrapped version also behaves exactly as w. Hooks targeting +// methods not supported by w are ignored. Any other hooks will intercept the +// method they target and may modify the call's arguments and/or return values. +// The CaptureMetrics implementation serves as a working example for how the +// hooks can be used. +func Wrap(w http.ResponseWriter, hooks Hooks) http.ResponseWriter { + rw := &rw{w: w, h: hooks} + _, i0 := w.(http.Flusher) + _, i1 := w.(http.CloseNotifier) + _, i2 := w.(http.Hijacker) + _, i3 := w.(io.ReaderFrom) + _, i4 := w.(http.Pusher) + switch { + // combination 1/32 + case !i0 && !i1 && !i2 && !i3 && !i4: + return struct { + Unwrapper + http.ResponseWriter + }{rw, rw} + // combination 2/32 + case !i0 && !i1 && !i2 && !i3 && i4: + return struct { + Unwrapper + http.ResponseWriter + http.Pusher + }{rw, rw, rw} + // combination 3/32 + case !i0 && !i1 && !i2 && i3 && !i4: + return struct { + Unwrapper + http.ResponseWriter + io.ReaderFrom + }{rw, rw, rw} + // combination 4/32 + case !i0 && !i1 && !i2 && i3 && i4: + return struct { + Unwrapper + http.ResponseWriter + io.ReaderFrom + http.Pusher + }{rw, rw, rw, rw} + // combination 5/32 + case !i0 && !i1 && i2 && !i3 && !i4: + return struct { + Unwrapper + http.ResponseWriter + http.Hijacker + }{rw, rw, rw} + // combination 6/32 + case !i0 && !i1 && i2 && !i3 && i4: + return struct { + Unwrapper + http.ResponseWriter + http.Hijacker + http.Pusher + }{rw, rw, rw, rw} + // combination 7/32 + case !i0 && !i1 && i2 && i3 && !i4: + return struct { + Unwrapper + http.ResponseWriter + http.Hijacker + io.ReaderFrom + }{rw, rw, rw, rw} + // combination 8/32 + case !i0 && !i1 && i2 && i3 && i4: + return struct { + Unwrapper + http.ResponseWriter + http.Hijacker + io.ReaderFrom + http.Pusher + }{rw, rw, rw, rw, rw} + // combination 9/32 + case !i0 && i1 && !i2 && !i3 && !i4: + return struct { + Unwrapper + http.ResponseWriter + http.CloseNotifier + }{rw, rw, rw} + // combination 10/32 + case !i0 && i1 && !i2 && !i3 && i4: + return struct { + Unwrapper + http.ResponseWriter + http.CloseNotifier + http.Pusher + }{rw, rw, rw, rw} + // combination 11/32 + case !i0 && i1 && !i2 && i3 && !i4: + return struct { + Unwrapper + http.ResponseWriter + http.CloseNotifier + io.ReaderFrom + }{rw, rw, rw, rw} + // combination 12/32 + case !i0 && i1 && !i2 && i3 && i4: + return struct { + Unwrapper + http.ResponseWriter + http.CloseNotifier + io.ReaderFrom + http.Pusher + }{rw, rw, rw, rw, rw} + // combination 13/32 + case !i0 && i1 && i2 && !i3 && !i4: + return struct { + Unwrapper + http.ResponseWriter + http.CloseNotifier + http.Hijacker + }{rw, rw, rw, rw} + // combination 14/32 + case !i0 && i1 && i2 && !i3 && i4: + return struct { + Unwrapper + http.ResponseWriter + http.CloseNotifier + http.Hijacker + http.Pusher + }{rw, rw, rw, rw, rw} + // combination 15/32 + case !i0 && i1 && i2 && i3 && !i4: + return struct { + Unwrapper + http.ResponseWriter + http.CloseNotifier + http.Hijacker + io.ReaderFrom + }{rw, rw, rw, rw, rw} + // combination 16/32 + case !i0 && i1 && i2 && i3 && i4: + return struct { + Unwrapper + http.ResponseWriter + http.CloseNotifier + http.Hijacker + io.ReaderFrom + http.Pusher + }{rw, rw, rw, rw, rw, rw} + // combination 17/32 + case i0 && !i1 && !i2 && !i3 && !i4: + return struct { + Unwrapper + http.ResponseWriter + http.Flusher + }{rw, rw, rw} + // combination 18/32 + case i0 && !i1 && !i2 && !i3 && i4: + return struct { + Unwrapper + http.ResponseWriter + http.Flusher + http.Pusher + }{rw, rw, rw, rw} + // combination 19/32 + case i0 && !i1 && !i2 && i3 && !i4: + return struct { + Unwrapper + http.ResponseWriter + http.Flusher + io.ReaderFrom + }{rw, rw, rw, rw} + // combination 20/32 + case i0 && !i1 && !i2 && i3 && i4: + return struct { + Unwrapper + http.ResponseWriter + http.Flusher + io.ReaderFrom + http.Pusher + }{rw, rw, rw, rw, rw} + // combination 21/32 + case i0 && !i1 && i2 && !i3 && !i4: + return struct { + Unwrapper + http.ResponseWriter + http.Flusher + http.Hijacker + }{rw, rw, rw, rw} + // combination 22/32 + case i0 && !i1 && i2 && !i3 && i4: + return struct { + Unwrapper + http.ResponseWriter + http.Flusher + http.Hijacker + http.Pusher + }{rw, rw, rw, rw, rw} + // combination 23/32 + case i0 && !i1 && i2 && i3 && !i4: + return struct { + Unwrapper + http.ResponseWriter + http.Flusher + http.Hijacker + io.ReaderFrom + }{rw, rw, rw, rw, rw} + // combination 24/32 + case i0 && !i1 && i2 && i3 && i4: + return struct { + Unwrapper + http.ResponseWriter + http.Flusher + http.Hijacker + io.ReaderFrom + http.Pusher + }{rw, rw, rw, rw, rw, rw} + // combination 25/32 + case i0 && i1 && !i2 && !i3 && !i4: + return struct { + Unwrapper + http.ResponseWriter + http.Flusher + http.CloseNotifier + }{rw, rw, rw, rw} + // combination 26/32 + case i0 && i1 && !i2 && !i3 && i4: + return struct { + Unwrapper + http.ResponseWriter + http.Flusher + http.CloseNotifier + http.Pusher + }{rw, rw, rw, rw, rw} + // combination 27/32 + case i0 && i1 && !i2 && i3 && !i4: + return struct { + Unwrapper + http.ResponseWriter + http.Flusher + http.CloseNotifier + io.ReaderFrom + }{rw, rw, rw, rw, rw} + // combination 28/32 + case i0 && i1 && !i2 && i3 && i4: + return struct { + Unwrapper + http.ResponseWriter + http.Flusher + http.CloseNotifier + io.ReaderFrom + http.Pusher + }{rw, rw, rw, rw, rw, rw} + // combination 29/32 + case i0 && i1 && i2 && !i3 && !i4: + return struct { + Unwrapper + http.ResponseWriter + http.Flusher + http.CloseNotifier + http.Hijacker + }{rw, rw, rw, rw, rw} + // combination 30/32 + case i0 && i1 && i2 && !i3 && i4: + return struct { + Unwrapper + http.ResponseWriter + http.Flusher + http.CloseNotifier + http.Hijacker + http.Pusher + }{rw, rw, rw, rw, rw, rw} + // combination 31/32 + case i0 && i1 && i2 && i3 && !i4: + return struct { + Unwrapper + http.ResponseWriter + http.Flusher + http.CloseNotifier + http.Hijacker + io.ReaderFrom + }{rw, rw, rw, rw, rw, rw} + // combination 32/32 + case i0 && i1 && i2 && i3 && i4: + return struct { + Unwrapper + http.ResponseWriter + http.Flusher + http.CloseNotifier + http.Hijacker + io.ReaderFrom + http.Pusher + }{rw, rw, rw, rw, rw, rw, rw} + } + panic("unreachable") +} + +type rw struct { + w http.ResponseWriter + h Hooks +} + +func (w *rw) Unwrap() http.ResponseWriter { + return w.w +} + +func (w *rw) Header() http.Header { + f := w.w.(http.ResponseWriter).Header + if w.h.Header != nil { + f = w.h.Header(f) + } + return f() +} + +func (w *rw) WriteHeader(code int) { + f := w.w.(http.ResponseWriter).WriteHeader + if w.h.WriteHeader != nil { + f = w.h.WriteHeader(f) + } + f(code) +} + +func (w *rw) Write(b []byte) (int, error) { + f := w.w.(http.ResponseWriter).Write + if w.h.Write != nil { + f = w.h.Write(f) + } + return f(b) +} + +func (w *rw) Flush() { + f := w.w.(http.Flusher).Flush + if w.h.Flush != nil { + f = w.h.Flush(f) + } + f() +} + +func (w *rw) CloseNotify() <-chan bool { + f := w.w.(http.CloseNotifier).CloseNotify + if w.h.CloseNotify != nil { + f = w.h.CloseNotify(f) + } + return f() +} + +func (w *rw) Hijack() (net.Conn, *bufio.ReadWriter, error) { + f := w.w.(http.Hijacker).Hijack + if w.h.Hijack != nil { + f = w.h.Hijack(f) + } + return f() +} + +func (w *rw) ReadFrom(src io.Reader) (int64, error) { + f := w.w.(io.ReaderFrom).ReadFrom + if w.h.ReadFrom != nil { + f = w.h.ReadFrom(f) + } + return f(src) +} + +func (w *rw) Push(target string, opts *http.PushOptions) error { + f := w.w.(http.Pusher).Push + if w.h.Push != nil { + f = w.h.Push(f) + } + return f(target, opts) +} + +type Unwrapper interface { + Unwrap() http.ResponseWriter +} + +// Unwrap returns the underlying http.ResponseWriter from within zero or more +// layers of httpsnoop wrappers. +func Unwrap(w http.ResponseWriter) http.ResponseWriter { + if rw, ok := w.(Unwrapper); ok { + // recurse until rw.Unwrap() returns a non-Unwrapper + return Unwrap(rw.Unwrap()) + } else { + return w + } +} diff --git a/vendor/github.com/felixge/httpsnoop/wrap_generated_lt_1.8.go b/vendor/github.com/felixge/httpsnoop/wrap_generated_lt_1.8.go new file mode 100644 index 00000000..e0951df1 --- /dev/null +++ b/vendor/github.com/felixge/httpsnoop/wrap_generated_lt_1.8.go @@ -0,0 +1,278 @@ +// +build !go1.8 +// Code generated by "httpsnoop/codegen"; DO NOT EDIT. + +package httpsnoop + +import ( + "bufio" + "io" + "net" + "net/http" +) + +// HeaderFunc is part of the http.ResponseWriter interface. +type HeaderFunc func() http.Header + +// WriteHeaderFunc is part of the http.ResponseWriter interface. +type WriteHeaderFunc func(code int) + +// WriteFunc is part of the http.ResponseWriter interface. +type WriteFunc func(b []byte) (int, error) + +// FlushFunc is part of the http.Flusher interface. +type FlushFunc func() + +// CloseNotifyFunc is part of the http.CloseNotifier interface. +type CloseNotifyFunc func() <-chan bool + +// HijackFunc is part of the http.Hijacker interface. +type HijackFunc func() (net.Conn, *bufio.ReadWriter, error) + +// ReadFromFunc is part of the io.ReaderFrom interface. +type ReadFromFunc func(src io.Reader) (int64, error) + +// Hooks defines a set of method interceptors for methods included in +// http.ResponseWriter as well as some others. You can think of them as +// middleware for the function calls they target. See Wrap for more details. +type Hooks struct { + Header func(HeaderFunc) HeaderFunc + WriteHeader func(WriteHeaderFunc) WriteHeaderFunc + Write func(WriteFunc) WriteFunc + Flush func(FlushFunc) FlushFunc + CloseNotify func(CloseNotifyFunc) CloseNotifyFunc + Hijack func(HijackFunc) HijackFunc + ReadFrom func(ReadFromFunc) ReadFromFunc +} + +// Wrap returns a wrapped version of w that provides the exact same interface +// as w. Specifically if w implements any combination of: +// +// - http.Flusher +// - http.CloseNotifier +// - http.Hijacker +// - io.ReaderFrom +// +// The wrapped version will implement the exact same combination. If no hooks +// are set, the wrapped version also behaves exactly as w. Hooks targeting +// methods not supported by w are ignored. Any other hooks will intercept the +// method they target and may modify the call's arguments and/or return values. +// The CaptureMetrics implementation serves as a working example for how the +// hooks can be used. +func Wrap(w http.ResponseWriter, hooks Hooks) http.ResponseWriter { + rw := &rw{w: w, h: hooks} + _, i0 := w.(http.Flusher) + _, i1 := w.(http.CloseNotifier) + _, i2 := w.(http.Hijacker) + _, i3 := w.(io.ReaderFrom) + switch { + // combination 1/16 + case !i0 && !i1 && !i2 && !i3: + return struct { + Unwrapper + http.ResponseWriter + }{rw, rw} + // combination 2/16 + case !i0 && !i1 && !i2 && i3: + return struct { + Unwrapper + http.ResponseWriter + io.ReaderFrom + }{rw, rw, rw} + // combination 3/16 + case !i0 && !i1 && i2 && !i3: + return struct { + Unwrapper + http.ResponseWriter + http.Hijacker + }{rw, rw, rw} + // combination 4/16 + case !i0 && !i1 && i2 && i3: + return struct { + Unwrapper + http.ResponseWriter + http.Hijacker + io.ReaderFrom + }{rw, rw, rw, rw} + // combination 5/16 + case !i0 && i1 && !i2 && !i3: + return struct { + Unwrapper + http.ResponseWriter + http.CloseNotifier + }{rw, rw, rw} + // combination 6/16 + case !i0 && i1 && !i2 && i3: + return struct { + Unwrapper + http.ResponseWriter + http.CloseNotifier + io.ReaderFrom + }{rw, rw, rw, rw} + // combination 7/16 + case !i0 && i1 && i2 && !i3: + return struct { + Unwrapper + http.ResponseWriter + http.CloseNotifier + http.Hijacker + }{rw, rw, rw, rw} + // combination 8/16 + case !i0 && i1 && i2 && i3: + return struct { + Unwrapper + http.ResponseWriter + http.CloseNotifier + http.Hijacker + io.ReaderFrom + }{rw, rw, rw, rw, rw} + // combination 9/16 + case i0 && !i1 && !i2 && !i3: + return struct { + Unwrapper + http.ResponseWriter + http.Flusher + }{rw, rw, rw} + // combination 10/16 + case i0 && !i1 && !i2 && i3: + return struct { + Unwrapper + http.ResponseWriter + http.Flusher + io.ReaderFrom + }{rw, rw, rw, rw} + // combination 11/16 + case i0 && !i1 && i2 && !i3: + return struct { + Unwrapper + http.ResponseWriter + http.Flusher + http.Hijacker + }{rw, rw, rw, rw} + // combination 12/16 + case i0 && !i1 && i2 && i3: + return struct { + Unwrapper + http.ResponseWriter + http.Flusher + http.Hijacker + io.ReaderFrom + }{rw, rw, rw, rw, rw} + // combination 13/16 + case i0 && i1 && !i2 && !i3: + return struct { + Unwrapper + http.ResponseWriter + http.Flusher + http.CloseNotifier + }{rw, rw, rw, rw} + // combination 14/16 + case i0 && i1 && !i2 && i3: + return struct { + Unwrapper + http.ResponseWriter + http.Flusher + http.CloseNotifier + io.ReaderFrom + }{rw, rw, rw, rw, rw} + // combination 15/16 + case i0 && i1 && i2 && !i3: + return struct { + Unwrapper + http.ResponseWriter + http.Flusher + http.CloseNotifier + http.Hijacker + }{rw, rw, rw, rw, rw} + // combination 16/16 + case i0 && i1 && i2 && i3: + return struct { + Unwrapper + http.ResponseWriter + http.Flusher + http.CloseNotifier + http.Hijacker + io.ReaderFrom + }{rw, rw, rw, rw, rw, rw} + } + panic("unreachable") +} + +type rw struct { + w http.ResponseWriter + h Hooks +} + +func (w *rw) Unwrap() http.ResponseWriter { + return w.w +} + +func (w *rw) Header() http.Header { + f := w.w.(http.ResponseWriter).Header + if w.h.Header != nil { + f = w.h.Header(f) + } + return f() +} + +func (w *rw) WriteHeader(code int) { + f := w.w.(http.ResponseWriter).WriteHeader + if w.h.WriteHeader != nil { + f = w.h.WriteHeader(f) + } + f(code) +} + +func (w *rw) Write(b []byte) (int, error) { + f := w.w.(http.ResponseWriter).Write + if w.h.Write != nil { + f = w.h.Write(f) + } + return f(b) +} + +func (w *rw) Flush() { + f := w.w.(http.Flusher).Flush + if w.h.Flush != nil { + f = w.h.Flush(f) + } + f() +} + +func (w *rw) CloseNotify() <-chan bool { + f := w.w.(http.CloseNotifier).CloseNotify + if w.h.CloseNotify != nil { + f = w.h.CloseNotify(f) + } + return f() +} + +func (w *rw) Hijack() (net.Conn, *bufio.ReadWriter, error) { + f := w.w.(http.Hijacker).Hijack + if w.h.Hijack != nil { + f = w.h.Hijack(f) + } + return f() +} + +func (w *rw) ReadFrom(src io.Reader) (int64, error) { + f := w.w.(io.ReaderFrom).ReadFrom + if w.h.ReadFrom != nil { + f = w.h.ReadFrom(f) + } + return f(src) +} + +type Unwrapper interface { + Unwrap() http.ResponseWriter +} + +// Unwrap returns the underlying http.ResponseWriter from within zero or more +// layers of httpsnoop wrappers. +func Unwrap(w http.ResponseWriter) http.ResponseWriter { + if rw, ok := w.(Unwrapper); ok { + // recurse until rw.Unwrap() returns a non-Unwrapper + return Unwrap(rw.Unwrap()) + } else { + return w + } +} diff --git a/vendor/github.com/go-logr/logr/.golangci.yaml b/vendor/github.com/go-logr/logr/.golangci.yaml new file mode 100644 index 00000000..0ed62c1a --- /dev/null +++ b/vendor/github.com/go-logr/logr/.golangci.yaml @@ -0,0 +1,28 @@ +version: "2" + +run: + timeout: 1m + tests: true + +linters: + default: none + enable: # please keep this alphabetized + - asasalint + - asciicheck + - copyloopvar + - dupl + - errcheck + - forcetypeassert + - goconst + - gocritic + - govet + - ineffassign + - misspell + - musttag + - revive + - staticcheck + - unused + +issues: + max-issues-per-linter: 0 + max-same-issues: 10 diff --git a/vendor/github.com/go-logr/logr/CHANGELOG.md b/vendor/github.com/go-logr/logr/CHANGELOG.md new file mode 100644 index 00000000..c3569600 --- /dev/null +++ b/vendor/github.com/go-logr/logr/CHANGELOG.md @@ -0,0 +1,6 @@ +# CHANGELOG + +## v1.0.0-rc1 + +This is the first logged release. Major changes (including breaking changes) +have occurred since earlier tags. diff --git a/vendor/github.com/go-logr/logr/CONTRIBUTING.md b/vendor/github.com/go-logr/logr/CONTRIBUTING.md new file mode 100644 index 00000000..5d37e294 --- /dev/null +++ b/vendor/github.com/go-logr/logr/CONTRIBUTING.md @@ -0,0 +1,17 @@ +# Contributing + +Logr is open to pull-requests, provided they fit within the intended scope of +the project. Specifically, this library aims to be VERY small and minimalist, +with no external dependencies. + +## Compatibility + +This project intends to follow [semantic versioning](http://semver.org) and +is very strict about compatibility. Any proposed changes MUST follow those +rules. + +## Performance + +As a logging library, logr must be as light-weight as possible. Any proposed +code change must include results of running the [benchmark](./benchmark) +before and after the change. diff --git a/vendor/github.com/go-logr/logr/LICENSE b/vendor/github.com/go-logr/logr/LICENSE new file mode 100644 index 00000000..8dada3ed --- /dev/null +++ b/vendor/github.com/go-logr/logr/LICENSE @@ -0,0 +1,201 @@ + Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + + TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + + 1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + + 2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + + 3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + + 4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + + 5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + + 6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + + 7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + + 8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + + 9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + + END OF TERMS AND CONDITIONS + + APPENDIX: How to apply the Apache License to your work. + + To apply the Apache License to your work, attach the following + boilerplate notice, with the fields enclosed by brackets "{}" + replaced with your own identifying information. (Don't include + the brackets!) The text should be enclosed in the appropriate + comment syntax for the file format. We also recommend that a + file or class name and description of purpose be included on the + same "printed page" as the copyright notice for easier + identification within third-party archives. + + Copyright {yyyy} {name of copyright owner} + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. diff --git a/vendor/github.com/go-logr/logr/README.md b/vendor/github.com/go-logr/logr/README.md new file mode 100644 index 00000000..7c7f0c69 --- /dev/null +++ b/vendor/github.com/go-logr/logr/README.md @@ -0,0 +1,407 @@ +# A minimal logging API for Go + +[![Go Reference](https://pkg.go.dev/badge/github.com/go-logr/logr.svg)](https://pkg.go.dev/github.com/go-logr/logr) +[![Go Report Card](https://goreportcard.com/badge/github.com/go-logr/logr)](https://goreportcard.com/report/github.com/go-logr/logr) +[![OpenSSF Scorecard](https://api.securityscorecards.dev/projects/github.com/go-logr/logr/badge)](https://securityscorecards.dev/viewer/?platform=github.com&org=go-logr&repo=logr) + +logr offers an(other) opinion on how Go programs and libraries can do logging +without becoming coupled to a particular logging implementation. This is not +an implementation of logging - it is an API. In fact it is two APIs with two +different sets of users. + +The `Logger` type is intended for application and library authors. It provides +a relatively small API which can be used everywhere you want to emit logs. It +defers the actual act of writing logs (to files, to stdout, or whatever) to the +`LogSink` interface. + +The `LogSink` interface is intended for logging library implementers. It is a +pure interface which can be implemented by logging frameworks to provide the actual logging +functionality. + +This decoupling allows application and library developers to write code in +terms of `logr.Logger` (which has very low dependency fan-out) while the +implementation of logging is managed "up stack" (e.g. in or near `main()`.) +Application developers can then switch out implementations as necessary. + +Many people assert that libraries should not be logging, and as such efforts +like this are pointless. Those people are welcome to convince the authors of +the tens-of-thousands of libraries that *DO* write logs that they are all +wrong. In the meantime, logr takes a more practical approach. + +## Typical usage + +Somewhere, early in an application's life, it will make a decision about which +logging library (implementation) it actually wants to use. Something like: + +``` + func main() { + // ... other setup code ... + + // Create the "root" logger. We have chosen the "logimpl" implementation, + // which takes some initial parameters and returns a logr.Logger. + logger := logimpl.New(param1, param2) + + // ... other setup code ... +``` + +Most apps will call into other libraries, create structures to govern the flow, +etc. The `logr.Logger` object can be passed to these other libraries, stored +in structs, or even used as a package-global variable, if needed. For example: + +``` + app := createTheAppObject(logger) + app.Run() +``` + +Outside of this early setup, no other packages need to know about the choice of +implementation. They write logs in terms of the `logr.Logger` that they +received: + +``` + type appObject struct { + // ... other fields ... + logger logr.Logger + // ... other fields ... + } + + func (app *appObject) Run() { + app.logger.Info("starting up", "timestamp", time.Now()) + + // ... app code ... +``` + +## Background + +If the Go standard library had defined an interface for logging, this project +probably would not be needed. Alas, here we are. + +When the Go developers started developing such an interface with +[slog](https://github.com/golang/go/issues/56345), they adopted some of the +logr design but also left out some parts and changed others: + +| Feature | logr | slog | +|---------|------|------| +| High-level API | `Logger` (passed by value) | `Logger` (passed by [pointer](https://github.com/golang/go/issues/59126)) | +| Low-level API | `LogSink` | `Handler` | +| Stack unwinding | done by `LogSink` | done by `Logger` | +| Skipping helper functions | `WithCallDepth`, `WithCallStackHelper` | [not supported by Logger](https://github.com/golang/go/issues/59145) | +| Generating a value for logging on demand | `Marshaler` | `LogValuer` | +| Log levels | >= 0, higher meaning "less important" | positive and negative, with 0 for "info" and higher meaning "more important" | +| Error log entries | always logged, don't have a verbosity level | normal log entries with level >= `LevelError` | +| Passing logger via context | `NewContext`, `FromContext` | no API | +| Adding a name to a logger | `WithName` | no API | +| Modify verbosity of log entries in a call chain | `V` | no API | +| Grouping of key/value pairs | not supported | `WithGroup`, `GroupValue` | +| Pass context for extracting additional values | no API | API variants like `InfoCtx` | + +The high-level slog API is explicitly meant to be one of many different APIs +that can be layered on top of a shared `slog.Handler`. logr is one such +alternative API, with [interoperability](#slog-interoperability) provided by +some conversion functions. + +### Inspiration + +Before you consider this package, please read [this blog post by the +inimitable Dave Cheney][warning-makes-no-sense]. We really appreciate what +he has to say, and it largely aligns with our own experiences. + +### Differences from Dave's ideas + +The main differences are: + +1. Dave basically proposes doing away with the notion of a logging API in favor +of `fmt.Printf()`. We disagree, especially when you consider things like output +locations, timestamps, file and line decorations, and structured logging. This +package restricts the logging API to just 2 types of logs: info and error. + +Info logs are things you want to tell the user which are not errors. Error +logs are, well, errors. If your code receives an `error` from a subordinate +function call and is logging that `error` *and not returning it*, use error +logs. + +2. Verbosity-levels on info logs. This gives developers a chance to indicate +arbitrary grades of importance for info logs, without assigning names with +semantic meaning such as "warning", "trace", and "debug." Superficially this +may feel very similar, but the primary difference is the lack of semantics. +Because verbosity is a numerical value, it's safe to assume that an app running +with higher verbosity means more (and less important) logs will be generated. + +## Implementations (non-exhaustive) + +There are implementations for the following logging libraries: + +- **a function** (can bridge to non-structured libraries): [funcr](https://github.com/go-logr/logr/tree/master/funcr) +- **a testing.T** (for use in Go tests, with JSON-like output): [testr](https://github.com/go-logr/logr/tree/master/testr) +- **github.com/google/glog**: [glogr](https://github.com/go-logr/glogr) +- **k8s.io/klog** (for Kubernetes): [klogr](https://git.k8s.io/klog/klogr) +- **a testing.T** (with klog-like text output): [ktesting](https://git.k8s.io/klog/ktesting) +- **go.uber.org/zap**: [zapr](https://github.com/go-logr/zapr) +- **log** (the Go standard library logger): [stdr](https://github.com/go-logr/stdr) +- **github.com/sirupsen/logrus**: [logrusr](https://github.com/bombsimon/logrusr) +- **github.com/wojas/genericr**: [genericr](https://github.com/wojas/genericr) (makes it easy to implement your own backend) +- **logfmt** (Heroku style [logging](https://www.brandur.org/logfmt)): [logfmtr](https://github.com/iand/logfmtr) +- **github.com/rs/zerolog**: [zerologr](https://github.com/go-logr/zerologr) +- **github.com/go-kit/log**: [gokitlogr](https://github.com/tonglil/gokitlogr) (also compatible with github.com/go-kit/kit/log since v0.12.0) +- **bytes.Buffer** (writing to a buffer): [bufrlogr](https://github.com/tonglil/buflogr) (useful for ensuring values were logged, like during testing) + +## slog interoperability + +Interoperability goes both ways, using the `logr.Logger` API with a `slog.Handler` +and using the `slog.Logger` API with a `logr.LogSink`. `FromSlogHandler` and +`ToSlogHandler` convert between a `logr.Logger` and a `slog.Handler`. +As usual, `slog.New` can be used to wrap such a `slog.Handler` in the high-level +slog API. + +### Using a `logr.LogSink` as backend for slog + +Ideally, a logr sink implementation should support both logr and slog by +implementing both the normal logr interface(s) and `SlogSink`. Because +of a conflict in the parameters of the common `Enabled` method, it is [not +possible to implement both slog.Handler and logr.Sink in the same +type](https://github.com/golang/go/issues/59110). + +If both are supported, log calls can go from the high-level APIs to the backend +without the need to convert parameters. `FromSlogHandler` and `ToSlogHandler` can +convert back and forth without adding additional wrappers, with one exception: +when `Logger.V` was used to adjust the verbosity for a `slog.Handler`, then +`ToSlogHandler` has to use a wrapper which adjusts the verbosity for future +log calls. + +Such an implementation should also support values that implement specific +interfaces from both packages for logging (`logr.Marshaler`, `slog.LogValuer`, +`slog.GroupValue`). logr does not convert those. + +Not supporting slog has several drawbacks: +- Recording source code locations works correctly if the handler gets called + through `slog.Logger`, but may be wrong in other cases. That's because a + `logr.Sink` does its own stack unwinding instead of using the program counter + provided by the high-level API. +- slog levels <= 0 can be mapped to logr levels by negating the level without a + loss of information. But all slog levels > 0 (e.g. `slog.LevelWarning` as + used by `slog.Logger.Warn`) must be mapped to 0 before calling the sink + because logr does not support "more important than info" levels. +- The slog group concept is supported by prefixing each key in a key/value + pair with the group names, separated by a dot. For structured output like + JSON it would be better to group the key/value pairs inside an object. +- Special slog values and interfaces don't work as expected. +- The overhead is likely to be higher. + +These drawbacks are severe enough that applications using a mixture of slog and +logr should switch to a different backend. + +### Using a `slog.Handler` as backend for logr + +Using a plain `slog.Handler` without support for logr works better than the +other direction: +- All logr verbosity levels can be mapped 1:1 to their corresponding slog level + by negating them. +- Stack unwinding is done by the `SlogSink` and the resulting program + counter is passed to the `slog.Handler`. +- Names added via `Logger.WithName` are gathered and recorded in an additional + attribute with `logger` as key and the names separated by slash as value. +- `Logger.Error` is turned into a log record with `slog.LevelError` as level + and an additional attribute with `err` as key, if an error was provided. + +The main drawback is that `logr.Marshaler` will not be supported. Types should +ideally support both `logr.Marshaler` and `slog.Valuer`. If compatibility +with logr implementations without slog support is not important, then +`slog.Valuer` is sufficient. + +### Context support for slog + +Storing a logger in a `context.Context` is not supported by +slog. `NewContextWithSlogLogger` and `FromContextAsSlogLogger` can be +used to fill this gap. They store and retrieve a `slog.Logger` pointer +under the same context key that is also used by `NewContext` and +`FromContext` for `logr.Logger` value. + +When `NewContextWithSlogLogger` is followed by `FromContext`, the latter will +automatically convert the `slog.Logger` to a +`logr.Logger`. `FromContextAsSlogLogger` does the same for the other direction. + +With this approach, binaries which use either slog or logr are as efficient as +possible with no unnecessary allocations. This is also why the API stores a +`slog.Logger` pointer: when storing a `slog.Handler`, creating a `slog.Logger` +on retrieval would need to allocate one. + +The downside is that switching back and forth needs more allocations. Because +logr is the API that is already in use by different packages, in particular +Kubernetes, the recommendation is to use the `logr.Logger` API in code which +uses contextual logging. + +An alternative to adding values to a logger and storing that logger in the +context is to store the values in the context and to configure a logging +backend to extract those values when emitting log entries. This only works when +log calls are passed the context, which is not supported by the logr API. + +With the slog API, it is possible, but not +required. https://github.com/veqryn/slog-context is a package for slog which +provides additional support code for this approach. It also contains wrappers +for the context functions in logr, so developers who prefer to not use the logr +APIs directly can use those instead and the resulting code will still be +interoperable with logr. + +## FAQ + +### Conceptual + +#### Why structured logging? + +- **Structured logs are more easily queryable**: Since you've got + key-value pairs, it's much easier to query your structured logs for + particular values by filtering on the contents of a particular key -- + think searching request logs for error codes, Kubernetes reconcilers for + the name and namespace of the reconciled object, etc. + +- **Structured logging makes it easier to have cross-referenceable logs**: + Similarly to searchability, if you maintain conventions around your + keys, it becomes easy to gather all log lines related to a particular + concept. + +- **Structured logs allow better dimensions of filtering**: if you have + structure to your logs, you've got more precise control over how much + information is logged -- you might choose in a particular configuration + to log certain keys but not others, only log lines where a certain key + matches a certain value, etc., instead of just having v-levels and names + to key off of. + +- **Structured logs better represent structured data**: sometimes, the + data that you want to log is inherently structured (think tuple-link + objects.) Structured logs allow you to preserve that structure when + outputting. + +#### Why V-levels? + +**V-levels give operators an easy way to control the chattiness of log +operations**. V-levels provide a way for a given package to distinguish +the relative importance or verbosity of a given log message. Then, if +a particular logger or package is logging too many messages, the user +of the package can simply change the v-levels for that library. + +#### Why not named levels, like Info/Warning/Error? + +Read [Dave Cheney's post][warning-makes-no-sense]. Then read [Differences +from Dave's ideas](#differences-from-daves-ideas). + +#### Why not allow format strings, too? + +**Format strings negate many of the benefits of structured logs**: + +- They're not easily searchable without resorting to fuzzy searching, + regular expressions, etc. + +- They don't store structured data well, since contents are flattened into + a string. + +- They're not cross-referenceable. + +- They don't compress easily, since the message is not constant. + +(Unless you turn positional parameters into key-value pairs with numerical +keys, at which point you've gotten key-value logging with meaningless +keys.) + +### Practical + +#### Why key-value pairs, and not a map? + +Key-value pairs are *much* easier to optimize, especially around +allocations. Zap (a structured logger that inspired logr's interface) has +[performance measurements](https://github.com/uber-go/zap#performance) +that show this quite nicely. + +While the interface ends up being a little less obvious, you get +potentially better performance, plus avoid making users type +`map[string]string{}` every time they want to log. + +#### What if my V-levels differ between libraries? + +That's fine. Control your V-levels on a per-logger basis, and use the +`WithName` method to pass different loggers to different libraries. + +Generally, you should take care to ensure that you have relatively +consistent V-levels within a given logger, however, as this makes deciding +on what verbosity of logs to request easier. + +#### But I really want to use a format string! + +That's not actually a question. Assuming your question is "how do +I convert my mental model of logging with format strings to logging with +constant messages": + +1. Figure out what the error actually is, as you'd write in a TL;DR style, + and use that as a message. + +2. For every place you'd write a format specifier, look to the word before + it, and add that as a key value pair. + +For instance, consider the following examples (all taken from spots in the +Kubernetes codebase): + +- `klog.V(4).Infof("Client is returning errors: code %v, error %v", + responseCode, err)` becomes `logger.Error(err, "client returned an + error", "code", responseCode)` + +- `klog.V(4).Infof("Got a Retry-After %ds response for attempt %d to %v", + seconds, retries, url)` becomes `logger.V(4).Info("got a retry-after + response when requesting url", "attempt", retries, "after + seconds", seconds, "url", url)` + +If you *really* must use a format string, use it in a key's value, and +call `fmt.Sprintf` yourself. For instance: `log.Printf("unable to +reflect over type %T")` becomes `logger.Info("unable to reflect over +type", "type", fmt.Sprintf("%T"))`. In general though, the cases where +this is necessary should be few and far between. + +#### How do I choose my V-levels? + +This is basically the only hard constraint: increase V-levels to denote +more verbose or more debug-y logs. + +Otherwise, you can start out with `0` as "you always want to see this", +`1` as "common logging that you might *possibly* want to turn off", and +`10` as "I would like to performance-test your log collection stack." + +Then gradually choose levels in between as you need them, working your way +down from 10 (for debug and trace style logs) and up from 1 (for chattier +info-type logs). For reference, slog pre-defines -4 for debug logs +(corresponds to 4 in logr), which matches what is +[recommended for Kubernetes](https://github.com/kubernetes/community/blob/master/contributors/devel/sig-instrumentation/logging.md#what-method-to-use). + +#### How do I choose my keys? + +Keys are fairly flexible, and can hold more or less any string +value. For best compatibility with implementations and consistency +with existing code in other projects, there are a few conventions you +should consider. + +- Make your keys human-readable. +- Constant keys are generally a good idea. +- Be consistent across your codebase. +- Keys should naturally match parts of the message string. +- Use lower case for simple keys and + [lowerCamelCase](https://en.wiktionary.org/wiki/lowerCamelCase) for + more complex ones. Kubernetes is one example of a project that has + [adopted that + convention](https://github.com/kubernetes/community/blob/HEAD/contributors/devel/sig-instrumentation/migration-to-structured-logging.md#name-arguments). + +While key names are mostly unrestricted (and spaces are acceptable), +it's generally a good idea to stick to printable ascii characters, or at +least match the general character set of your log lines. + +#### Why should keys be constant values? + +The point of structured logging is to make later log processing easier. Your +keys are, effectively, the schema of each log message. If you use different +keys across instances of the same log line, you will make your structured logs +much harder to use. `Sprintf()` is for values, not for keys! + +#### Why is this not a pure interface? + +The Logger type is implemented as a struct in order to allow the Go compiler to +optimize things like high-V `Info` logs that are not triggered. Not all of +these implementations are implemented yet, but this structure was suggested as +a way to ensure they *can* be implemented. All of the real work is behind the +`LogSink` interface. + +[warning-makes-no-sense]: http://dave.cheney.net/2015/11/05/lets-talk-about-logging diff --git a/vendor/github.com/go-logr/logr/SECURITY.md b/vendor/github.com/go-logr/logr/SECURITY.md new file mode 100644 index 00000000..1ca756fc --- /dev/null +++ b/vendor/github.com/go-logr/logr/SECURITY.md @@ -0,0 +1,18 @@ +# Security Policy + +If you have discovered a security vulnerability in this project, please report it +privately. **Do not disclose it as a public issue.** This gives us time to work with you +to fix the issue before public exposure, reducing the chance that the exploit will be +used before a patch is released. + +You may submit the report in the following ways: + +- send an email to go-logr-security@googlegroups.com +- send us a [private vulnerability report](https://github.com/go-logr/logr/security/advisories/new) + +Please provide the following information in your report: + +- A description of the vulnerability and its impact +- How to reproduce the issue + +We ask that you give us 90 days to work on a fix before public exposure. diff --git a/vendor/github.com/go-logr/logr/context.go b/vendor/github.com/go-logr/logr/context.go new file mode 100644 index 00000000..de8bcc3a --- /dev/null +++ b/vendor/github.com/go-logr/logr/context.go @@ -0,0 +1,33 @@ +/* +Copyright 2023 The logr Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +package logr + +// contextKey is how we find Loggers in a context.Context. With Go < 1.21, +// the value is always a Logger value. With Go >= 1.21, the value can be a +// Logger value or a slog.Logger pointer. +type contextKey struct{} + +// notFoundError exists to carry an IsNotFound method. +type notFoundError struct{} + +func (notFoundError) Error() string { + return "no logr.Logger was present" +} + +func (notFoundError) IsNotFound() bool { + return true +} diff --git a/vendor/github.com/go-logr/logr/context_noslog.go b/vendor/github.com/go-logr/logr/context_noslog.go new file mode 100644 index 00000000..f012f9a1 --- /dev/null +++ b/vendor/github.com/go-logr/logr/context_noslog.go @@ -0,0 +1,49 @@ +//go:build !go1.21 +// +build !go1.21 + +/* +Copyright 2019 The logr Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +package logr + +import ( + "context" +) + +// FromContext returns a Logger from ctx or an error if no Logger is found. +func FromContext(ctx context.Context) (Logger, error) { + if v, ok := ctx.Value(contextKey{}).(Logger); ok { + return v, nil + } + + return Logger{}, notFoundError{} +} + +// FromContextOrDiscard returns a Logger from ctx. If no Logger is found, this +// returns a Logger that discards all log messages. +func FromContextOrDiscard(ctx context.Context) Logger { + if v, ok := ctx.Value(contextKey{}).(Logger); ok { + return v + } + + return Discard() +} + +// NewContext returns a new Context, derived from ctx, which carries the +// provided Logger. +func NewContext(ctx context.Context, logger Logger) context.Context { + return context.WithValue(ctx, contextKey{}, logger) +} diff --git a/vendor/github.com/go-logr/logr/context_slog.go b/vendor/github.com/go-logr/logr/context_slog.go new file mode 100644 index 00000000..065ef0b8 --- /dev/null +++ b/vendor/github.com/go-logr/logr/context_slog.go @@ -0,0 +1,83 @@ +//go:build go1.21 +// +build go1.21 + +/* +Copyright 2019 The logr Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +package logr + +import ( + "context" + "fmt" + "log/slog" +) + +// FromContext returns a Logger from ctx or an error if no Logger is found. +func FromContext(ctx context.Context) (Logger, error) { + v := ctx.Value(contextKey{}) + if v == nil { + return Logger{}, notFoundError{} + } + + switch v := v.(type) { + case Logger: + return v, nil + case *slog.Logger: + return FromSlogHandler(v.Handler()), nil + default: + // Not reached. + panic(fmt.Sprintf("unexpected value type for logr context key: %T", v)) + } +} + +// FromContextAsSlogLogger returns a slog.Logger from ctx or nil if no such Logger is found. +func FromContextAsSlogLogger(ctx context.Context) *slog.Logger { + v := ctx.Value(contextKey{}) + if v == nil { + return nil + } + + switch v := v.(type) { + case Logger: + return slog.New(ToSlogHandler(v)) + case *slog.Logger: + return v + default: + // Not reached. + panic(fmt.Sprintf("unexpected value type for logr context key: %T", v)) + } +} + +// FromContextOrDiscard returns a Logger from ctx. If no Logger is found, this +// returns a Logger that discards all log messages. +func FromContextOrDiscard(ctx context.Context) Logger { + if logger, err := FromContext(ctx); err == nil { + return logger + } + return Discard() +} + +// NewContext returns a new Context, derived from ctx, which carries the +// provided Logger. +func NewContext(ctx context.Context, logger Logger) context.Context { + return context.WithValue(ctx, contextKey{}, logger) +} + +// NewContextWithSlogLogger returns a new Context, derived from ctx, which carries the +// provided slog.Logger. +func NewContextWithSlogLogger(ctx context.Context, logger *slog.Logger) context.Context { + return context.WithValue(ctx, contextKey{}, logger) +} diff --git a/vendor/github.com/go-logr/logr/discard.go b/vendor/github.com/go-logr/logr/discard.go new file mode 100644 index 00000000..99fe8be9 --- /dev/null +++ b/vendor/github.com/go-logr/logr/discard.go @@ -0,0 +1,24 @@ +/* +Copyright 2020 The logr Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +package logr + +// Discard returns a Logger that discards all messages logged to it. It can be +// used whenever the caller is not interested in the logs. Logger instances +// produced by this function always compare as equal. +func Discard() Logger { + return New(nil) +} diff --git a/vendor/github.com/go-logr/logr/funcr/funcr.go b/vendor/github.com/go-logr/logr/funcr/funcr.go new file mode 100644 index 00000000..b22c57d7 --- /dev/null +++ b/vendor/github.com/go-logr/logr/funcr/funcr.go @@ -0,0 +1,914 @@ +/* +Copyright 2021 The logr Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Package funcr implements formatting of structured log messages and +// optionally captures the call site and timestamp. +// +// The simplest way to use it is via its implementation of a +// github.com/go-logr/logr.LogSink with output through an arbitrary +// "write" function. See New and NewJSON for details. +// +// # Custom LogSinks +// +// For users who need more control, a funcr.Formatter can be embedded inside +// your own custom LogSink implementation. This is useful when the LogSink +// needs to implement additional methods, for example. +// +// # Formatting +// +// This will respect logr.Marshaler, fmt.Stringer, and error interfaces for +// values which are being logged. When rendering a struct, funcr will use Go's +// standard JSON tags (all except "string"). +package funcr + +import ( + "bytes" + "encoding" + "encoding/json" + "fmt" + "path/filepath" + "reflect" + "runtime" + "strconv" + "strings" + "time" + + "github.com/go-logr/logr" +) + +// New returns a logr.Logger which is implemented by an arbitrary function. +func New(fn func(prefix, args string), opts Options) logr.Logger { + return logr.New(newSink(fn, NewFormatter(opts))) +} + +// NewJSON returns a logr.Logger which is implemented by an arbitrary function +// and produces JSON output. +func NewJSON(fn func(obj string), opts Options) logr.Logger { + fnWrapper := func(_, obj string) { + fn(obj) + } + return logr.New(newSink(fnWrapper, NewFormatterJSON(opts))) +} + +// Underlier exposes access to the underlying logging function. Since +// callers only have a logr.Logger, they have to know which +// implementation is in use, so this interface is less of an +// abstraction and more of a way to test type conversion. +type Underlier interface { + GetUnderlying() func(prefix, args string) +} + +func newSink(fn func(prefix, args string), formatter Formatter) logr.LogSink { + l := &fnlogger{ + Formatter: formatter, + write: fn, + } + // For skipping fnlogger.Info and fnlogger.Error. + l.AddCallDepth(1) // via Formatter + return l +} + +// Options carries parameters which influence the way logs are generated. +type Options struct { + // LogCaller tells funcr to add a "caller" key to some or all log lines. + // This has some overhead, so some users might not want it. + LogCaller MessageClass + + // LogCallerFunc tells funcr to also log the calling function name. This + // has no effect if caller logging is not enabled (see Options.LogCaller). + LogCallerFunc bool + + // LogTimestamp tells funcr to add a "ts" key to log lines. This has some + // overhead, so some users might not want it. + LogTimestamp bool + + // TimestampFormat tells funcr how to render timestamps when LogTimestamp + // is enabled. If not specified, a default format will be used. For more + // details, see docs for Go's time.Layout. + TimestampFormat string + + // LogInfoLevel tells funcr what key to use to log the info level. + // If not specified, the info level will be logged as "level". + // If this is set to "", the info level will not be logged at all. + LogInfoLevel *string + + // Verbosity tells funcr which V logs to produce. Higher values enable + // more logs. Info logs at or below this level will be written, while logs + // above this level will be discarded. + Verbosity int + + // RenderBuiltinsHook allows users to mutate the list of key-value pairs + // while a log line is being rendered. The kvList argument follows logr + // conventions - each pair of slice elements is comprised of a string key + // and an arbitrary value (verified and sanitized before calling this + // hook). The value returned must follow the same conventions. This hook + // can be used to audit or modify logged data. For example, you might want + // to prefix all of funcr's built-in keys with some string. This hook is + // only called for built-in (provided by funcr itself) key-value pairs. + // Equivalent hooks are offered for key-value pairs saved via + // logr.Logger.WithValues or Formatter.AddValues (see RenderValuesHook) and + // for user-provided pairs (see RenderArgsHook). + RenderBuiltinsHook func(kvList []any) []any + + // RenderValuesHook is the same as RenderBuiltinsHook, except that it is + // only called for key-value pairs saved via logr.Logger.WithValues. See + // RenderBuiltinsHook for more details. + RenderValuesHook func(kvList []any) []any + + // RenderArgsHook is the same as RenderBuiltinsHook, except that it is only + // called for key-value pairs passed directly to Info and Error. See + // RenderBuiltinsHook for more details. + RenderArgsHook func(kvList []any) []any + + // MaxLogDepth tells funcr how many levels of nested fields (e.g. a struct + // that contains a struct, etc.) it may log. Every time it finds a struct, + // slice, array, or map the depth is increased by one. When the maximum is + // reached, the value will be converted to a string indicating that the max + // depth has been exceeded. If this field is not specified, a default + // value will be used. + MaxLogDepth int +} + +// MessageClass indicates which category or categories of messages to consider. +type MessageClass int + +const ( + // None ignores all message classes. + None MessageClass = iota + // All considers all message classes. + All + // Info only considers info messages. + Info + // Error only considers error messages. + Error +) + +// fnlogger inherits some of its LogSink implementation from Formatter +// and just needs to add some glue code. +type fnlogger struct { + Formatter + write func(prefix, args string) +} + +func (l fnlogger) WithName(name string) logr.LogSink { + l.AddName(name) // via Formatter + return &l +} + +func (l fnlogger) WithValues(kvList ...any) logr.LogSink { + l.AddValues(kvList) // via Formatter + return &l +} + +func (l fnlogger) WithCallDepth(depth int) logr.LogSink { + l.AddCallDepth(depth) // via Formatter + return &l +} + +func (l fnlogger) Info(level int, msg string, kvList ...any) { + prefix, args := l.FormatInfo(level, msg, kvList) + l.write(prefix, args) +} + +func (l fnlogger) Error(err error, msg string, kvList ...any) { + prefix, args := l.FormatError(err, msg, kvList) + l.write(prefix, args) +} + +func (l fnlogger) GetUnderlying() func(prefix, args string) { + return l.write +} + +// Assert conformance to the interfaces. +var _ logr.LogSink = &fnlogger{} +var _ logr.CallDepthLogSink = &fnlogger{} +var _ Underlier = &fnlogger{} + +// NewFormatter constructs a Formatter which emits a JSON-like key=value format. +func NewFormatter(opts Options) Formatter { + return newFormatter(opts, outputKeyValue) +} + +// NewFormatterJSON constructs a Formatter which emits strict JSON. +func NewFormatterJSON(opts Options) Formatter { + return newFormatter(opts, outputJSON) +} + +// Defaults for Options. +const defaultTimestampFormat = "2006-01-02 15:04:05.000000" +const defaultMaxLogDepth = 16 + +func newFormatter(opts Options, outfmt outputFormat) Formatter { + if opts.TimestampFormat == "" { + opts.TimestampFormat = defaultTimestampFormat + } + if opts.MaxLogDepth == 0 { + opts.MaxLogDepth = defaultMaxLogDepth + } + if opts.LogInfoLevel == nil { + opts.LogInfoLevel = new(string) + *opts.LogInfoLevel = "level" + } + f := Formatter{ + outputFormat: outfmt, + prefix: "", + values: nil, + depth: 0, + opts: &opts, + } + return f +} + +// Formatter is an opaque struct which can be embedded in a LogSink +// implementation. It should be constructed with NewFormatter. Some of +// its methods directly implement logr.LogSink. +type Formatter struct { + outputFormat outputFormat + prefix string + values []any + valuesStr string + depth int + opts *Options + groupName string // for slog groups + groups []groupDef +} + +// outputFormat indicates which outputFormat to use. +type outputFormat int + +const ( + // outputKeyValue emits a JSON-like key=value format, but not strict JSON. + outputKeyValue outputFormat = iota + // outputJSON emits strict JSON. + outputJSON +) + +// groupDef represents a saved group. The values may be empty, but we don't +// know if we need to render the group until the final record is rendered. +type groupDef struct { + name string + values string +} + +// PseudoStruct is a list of key-value pairs that gets logged as a struct. +type PseudoStruct []any + +// render produces a log line, ready to use. +func (f Formatter) render(builtins, args []any) string { + // Empirically bytes.Buffer is faster than strings.Builder for this. + buf := bytes.NewBuffer(make([]byte, 0, 1024)) + + if f.outputFormat == outputJSON { + buf.WriteByte('{') // for the whole record + } + + // Render builtins + vals := builtins + if hook := f.opts.RenderBuiltinsHook; hook != nil { + vals = hook(f.sanitize(vals)) + } + f.flatten(buf, vals, false) // keys are ours, no need to escape + continuing := len(builtins) > 0 + + // Turn the inner-most group into a string + argsStr := func() string { + buf := bytes.NewBuffer(make([]byte, 0, 1024)) + + vals = args + if hook := f.opts.RenderArgsHook; hook != nil { + vals = hook(f.sanitize(vals)) + } + f.flatten(buf, vals, true) // escape user-provided keys + + return buf.String() + }() + + // Render the stack of groups from the inside out. + bodyStr := f.renderGroup(f.groupName, f.valuesStr, argsStr) + for i := len(f.groups) - 1; i >= 0; i-- { + grp := &f.groups[i] + if grp.values == "" && bodyStr == "" { + // no contents, so we must elide the whole group + continue + } + bodyStr = f.renderGroup(grp.name, grp.values, bodyStr) + } + + if bodyStr != "" { + if continuing { + buf.WriteByte(f.comma()) + } + buf.WriteString(bodyStr) + } + + if f.outputFormat == outputJSON { + buf.WriteByte('}') // for the whole record + } + + return buf.String() +} + +// renderGroup returns a string representation of the named group with rendered +// values and args. If the name is empty, this will return the values and args, +// joined. If the name is not empty, this will return a single key-value pair, +// where the value is a grouping of the values and args. If the values and +// args are both empty, this will return an empty string, even if the name was +// specified. +func (f Formatter) renderGroup(name string, values string, args string) string { + buf := bytes.NewBuffer(make([]byte, 0, 1024)) + + needClosingBrace := false + if name != "" && (values != "" || args != "") { + buf.WriteString(f.quoted(name, true)) // escape user-provided keys + buf.WriteByte(f.colon()) + buf.WriteByte('{') + needClosingBrace = true + } + + continuing := false + if values != "" { + buf.WriteString(values) + continuing = true + } + + if args != "" { + if continuing { + buf.WriteByte(f.comma()) + } + buf.WriteString(args) + } + + if needClosingBrace { + buf.WriteByte('}') + } + + return buf.String() +} + +// flatten renders a list of key-value pairs into a buffer. If escapeKeys is +// true, the keys are assumed to have non-JSON-compatible characters in them +// and must be evaluated for escapes. +// +// This function returns a potentially modified version of kvList, which +// ensures that there is a value for every key (adding a value if needed) and +// that each key is a string (substituting a key if needed). +func (f Formatter) flatten(buf *bytes.Buffer, kvList []any, escapeKeys bool) []any { + // This logic overlaps with sanitize() but saves one type-cast per key, + // which can be measurable. + if len(kvList)%2 != 0 { + kvList = append(kvList, noValue) + } + copied := false + for i := 0; i < len(kvList); i += 2 { + k, ok := kvList[i].(string) + if !ok { + if !copied { + newList := make([]any, len(kvList)) + copy(newList, kvList) + kvList = newList + copied = true + } + k = f.nonStringKey(kvList[i]) + kvList[i] = k + } + v := kvList[i+1] + + if i > 0 { + if f.outputFormat == outputJSON { + buf.WriteByte(f.comma()) + } else { + // In theory the format could be something we don't understand. In + // practice, we control it, so it won't be. + buf.WriteByte(' ') + } + } + + buf.WriteString(f.quoted(k, escapeKeys)) + buf.WriteByte(f.colon()) + buf.WriteString(f.pretty(v)) + } + return kvList +} + +func (f Formatter) quoted(str string, escape bool) string { + if escape { + return prettyString(str) + } + // this is faster + return `"` + str + `"` +} + +func (f Formatter) comma() byte { + if f.outputFormat == outputJSON { + return ',' + } + return ' ' +} + +func (f Formatter) colon() byte { + if f.outputFormat == outputJSON { + return ':' + } + return '=' +} + +func (f Formatter) pretty(value any) string { + return f.prettyWithFlags(value, 0, 0) +} + +const ( + flagRawStruct = 0x1 // do not print braces on structs +) + +// TODO: This is not fast. Most of the overhead goes here. +func (f Formatter) prettyWithFlags(value any, flags uint32, depth int) string { + if depth > f.opts.MaxLogDepth { + return `""` + } + + // Handle types that take full control of logging. + if v, ok := value.(logr.Marshaler); ok { + // Replace the value with what the type wants to get logged. + // That then gets handled below via reflection. + value = invokeMarshaler(v) + } + + // Handle types that want to format themselves. + switch v := value.(type) { + case fmt.Stringer: + value = invokeStringer(v) + case error: + value = invokeError(v) + } + + // Handling the most common types without reflect is a small perf win. + switch v := value.(type) { + case bool: + return strconv.FormatBool(v) + case string: + return prettyString(v) + case int: + return strconv.FormatInt(int64(v), 10) + case int8: + return strconv.FormatInt(int64(v), 10) + case int16: + return strconv.FormatInt(int64(v), 10) + case int32: + return strconv.FormatInt(int64(v), 10) + case int64: + return strconv.FormatInt(int64(v), 10) + case uint: + return strconv.FormatUint(uint64(v), 10) + case uint8: + return strconv.FormatUint(uint64(v), 10) + case uint16: + return strconv.FormatUint(uint64(v), 10) + case uint32: + return strconv.FormatUint(uint64(v), 10) + case uint64: + return strconv.FormatUint(v, 10) + case uintptr: + return strconv.FormatUint(uint64(v), 10) + case float32: + return strconv.FormatFloat(float64(v), 'f', -1, 32) + case float64: + return strconv.FormatFloat(v, 'f', -1, 64) + case complex64: + return `"` + strconv.FormatComplex(complex128(v), 'f', -1, 64) + `"` + case complex128: + return `"` + strconv.FormatComplex(v, 'f', -1, 128) + `"` + case PseudoStruct: + buf := bytes.NewBuffer(make([]byte, 0, 1024)) + v = f.sanitize(v) + if flags&flagRawStruct == 0 { + buf.WriteByte('{') + } + for i := 0; i < len(v); i += 2 { + if i > 0 { + buf.WriteByte(f.comma()) + } + k, _ := v[i].(string) // sanitize() above means no need to check success + // arbitrary keys might need escaping + buf.WriteString(prettyString(k)) + buf.WriteByte(f.colon()) + buf.WriteString(f.prettyWithFlags(v[i+1], 0, depth+1)) + } + if flags&flagRawStruct == 0 { + buf.WriteByte('}') + } + return buf.String() + } + + buf := bytes.NewBuffer(make([]byte, 0, 256)) + t := reflect.TypeOf(value) + if t == nil { + return "null" + } + v := reflect.ValueOf(value) + switch t.Kind() { + case reflect.Bool: + return strconv.FormatBool(v.Bool()) + case reflect.String: + return prettyString(v.String()) + case reflect.Int, reflect.Int8, reflect.Int16, reflect.Int32, reflect.Int64: + return strconv.FormatInt(int64(v.Int()), 10) + case reflect.Uint, reflect.Uint8, reflect.Uint16, reflect.Uint32, reflect.Uint64, reflect.Uintptr: + return strconv.FormatUint(uint64(v.Uint()), 10) + case reflect.Float32: + return strconv.FormatFloat(float64(v.Float()), 'f', -1, 32) + case reflect.Float64: + return strconv.FormatFloat(v.Float(), 'f', -1, 64) + case reflect.Complex64: + return `"` + strconv.FormatComplex(complex128(v.Complex()), 'f', -1, 64) + `"` + case reflect.Complex128: + return `"` + strconv.FormatComplex(v.Complex(), 'f', -1, 128) + `"` + case reflect.Struct: + if flags&flagRawStruct == 0 { + buf.WriteByte('{') + } + printComma := false // testing i>0 is not enough because of JSON omitted fields + for i := 0; i < t.NumField(); i++ { + fld := t.Field(i) + if fld.PkgPath != "" { + // reflect says this field is only defined for non-exported fields. + continue + } + if !v.Field(i).CanInterface() { + // reflect isn't clear exactly what this means, but we can't use it. + continue + } + name := "" + omitempty := false + if tag, found := fld.Tag.Lookup("json"); found { + if tag == "-" { + continue + } + if comma := strings.Index(tag, ","); comma != -1 { + if n := tag[:comma]; n != "" { + name = n + } + rest := tag[comma:] + if strings.Contains(rest, ",omitempty,") || strings.HasSuffix(rest, ",omitempty") { + omitempty = true + } + } else { + name = tag + } + } + if omitempty && isEmpty(v.Field(i)) { + continue + } + if printComma { + buf.WriteByte(f.comma()) + } + printComma = true // if we got here, we are rendering a field + if fld.Anonymous && fld.Type.Kind() == reflect.Struct && name == "" { + buf.WriteString(f.prettyWithFlags(v.Field(i).Interface(), flags|flagRawStruct, depth+1)) + continue + } + if name == "" { + name = fld.Name + } + // field names can't contain characters which need escaping + buf.WriteString(f.quoted(name, false)) + buf.WriteByte(f.colon()) + buf.WriteString(f.prettyWithFlags(v.Field(i).Interface(), 0, depth+1)) + } + if flags&flagRawStruct == 0 { + buf.WriteByte('}') + } + return buf.String() + case reflect.Slice, reflect.Array: + // If this is outputing as JSON make sure this isn't really a json.RawMessage. + // If so just emit "as-is" and don't pretty it as that will just print + // it as [X,Y,Z,...] which isn't terribly useful vs the string form you really want. + if f.outputFormat == outputJSON { + if rm, ok := value.(json.RawMessage); ok { + // If it's empty make sure we emit an empty value as the array style would below. + if len(rm) > 0 { + buf.Write(rm) + } else { + buf.WriteString("null") + } + return buf.String() + } + } + buf.WriteByte('[') + for i := 0; i < v.Len(); i++ { + if i > 0 { + buf.WriteByte(f.comma()) + } + e := v.Index(i) + buf.WriteString(f.prettyWithFlags(e.Interface(), 0, depth+1)) + } + buf.WriteByte(']') + return buf.String() + case reflect.Map: + buf.WriteByte('{') + // This does not sort the map keys, for best perf. + it := v.MapRange() + i := 0 + for it.Next() { + if i > 0 { + buf.WriteByte(f.comma()) + } + // If a map key supports TextMarshaler, use it. + keystr := "" + if m, ok := it.Key().Interface().(encoding.TextMarshaler); ok { + txt, err := m.MarshalText() + if err != nil { + keystr = fmt.Sprintf("", err.Error()) + } else { + keystr = string(txt) + } + keystr = prettyString(keystr) + } else { + // prettyWithFlags will produce already-escaped values + keystr = f.prettyWithFlags(it.Key().Interface(), 0, depth+1) + if t.Key().Kind() != reflect.String { + // JSON only does string keys. Unlike Go's standard JSON, we'll + // convert just about anything to a string. + keystr = prettyString(keystr) + } + } + buf.WriteString(keystr) + buf.WriteByte(f.colon()) + buf.WriteString(f.prettyWithFlags(it.Value().Interface(), 0, depth+1)) + i++ + } + buf.WriteByte('}') + return buf.String() + case reflect.Ptr, reflect.Interface: + if v.IsNil() { + return "null" + } + return f.prettyWithFlags(v.Elem().Interface(), 0, depth) + } + return fmt.Sprintf(`""`, t.Kind().String()) +} + +func prettyString(s string) string { + // Avoid escaping (which does allocations) if we can. + if needsEscape(s) { + return strconv.Quote(s) + } + b := bytes.NewBuffer(make([]byte, 0, 1024)) + b.WriteByte('"') + b.WriteString(s) + b.WriteByte('"') + return b.String() +} + +// needsEscape determines whether the input string needs to be escaped or not, +// without doing any allocations. +func needsEscape(s string) bool { + for _, r := range s { + if !strconv.IsPrint(r) || r == '\\' || r == '"' { + return true + } + } + return false +} + +func isEmpty(v reflect.Value) bool { + switch v.Kind() { + case reflect.Array, reflect.Map, reflect.Slice, reflect.String: + return v.Len() == 0 + case reflect.Bool: + return !v.Bool() + case reflect.Int, reflect.Int8, reflect.Int16, reflect.Int32, reflect.Int64: + return v.Int() == 0 + case reflect.Uint, reflect.Uint8, reflect.Uint16, reflect.Uint32, reflect.Uint64, reflect.Uintptr: + return v.Uint() == 0 + case reflect.Float32, reflect.Float64: + return v.Float() == 0 + case reflect.Complex64, reflect.Complex128: + return v.Complex() == 0 + case reflect.Interface, reflect.Ptr: + return v.IsNil() + } + return false +} + +func invokeMarshaler(m logr.Marshaler) (ret any) { + defer func() { + if r := recover(); r != nil { + ret = fmt.Sprintf("", r) + } + }() + return m.MarshalLog() +} + +func invokeStringer(s fmt.Stringer) (ret string) { + defer func() { + if r := recover(); r != nil { + ret = fmt.Sprintf("", r) + } + }() + return s.String() +} + +func invokeError(e error) (ret string) { + defer func() { + if r := recover(); r != nil { + ret = fmt.Sprintf("", r) + } + }() + return e.Error() +} + +// Caller represents the original call site for a log line, after considering +// logr.Logger.WithCallDepth and logr.Logger.WithCallStackHelper. The File and +// Line fields will always be provided, while the Func field is optional. +// Users can set the render hook fields in Options to examine logged key-value +// pairs, one of which will be {"caller", Caller} if the Options.LogCaller +// field is enabled for the given MessageClass. +type Caller struct { + // File is the basename of the file for this call site. + File string `json:"file"` + // Line is the line number in the file for this call site. + Line int `json:"line"` + // Func is the function name for this call site, or empty if + // Options.LogCallerFunc is not enabled. + Func string `json:"function,omitempty"` +} + +func (f Formatter) caller() Caller { + // +1 for this frame, +1 for Info/Error. + pc, file, line, ok := runtime.Caller(f.depth + 2) + if !ok { + return Caller{"", 0, ""} + } + fn := "" + if f.opts.LogCallerFunc { + if fp := runtime.FuncForPC(pc); fp != nil { + fn = fp.Name() + } + } + + return Caller{filepath.Base(file), line, fn} +} + +const noValue = "" + +func (f Formatter) nonStringKey(v any) string { + return fmt.Sprintf("", f.snippet(v)) +} + +// snippet produces a short snippet string of an arbitrary value. +func (f Formatter) snippet(v any) string { + const snipLen = 16 + + snip := f.pretty(v) + if len(snip) > snipLen { + snip = snip[:snipLen] + } + return snip +} + +// sanitize ensures that a list of key-value pairs has a value for every key +// (adding a value if needed) and that each key is a string (substituting a key +// if needed). +func (f Formatter) sanitize(kvList []any) []any { + if len(kvList)%2 != 0 { + kvList = append(kvList, noValue) + } + for i := 0; i < len(kvList); i += 2 { + _, ok := kvList[i].(string) + if !ok { + kvList[i] = f.nonStringKey(kvList[i]) + } + } + return kvList +} + +// startGroup opens a new group scope (basically a sub-struct), which locks all +// the current saved values and starts them anew. This is needed to satisfy +// slog. +func (f *Formatter) startGroup(name string) { + // Unnamed groups are just inlined. + if name == "" { + return + } + + n := len(f.groups) + f.groups = append(f.groups[:n:n], groupDef{f.groupName, f.valuesStr}) + + // Start collecting new values. + f.groupName = name + f.valuesStr = "" + f.values = nil +} + +// Init configures this Formatter from runtime info, such as the call depth +// imposed by logr itself. +// Note that this receiver is a pointer, so depth can be saved. +func (f *Formatter) Init(info logr.RuntimeInfo) { + f.depth += info.CallDepth +} + +// Enabled checks whether an info message at the given level should be logged. +func (f Formatter) Enabled(level int) bool { + return level <= f.opts.Verbosity +} + +// GetDepth returns the current depth of this Formatter. This is useful for +// implementations which do their own caller attribution. +func (f Formatter) GetDepth() int { + return f.depth +} + +// FormatInfo renders an Info log message into strings. The prefix will be +// empty when no names were set (via AddNames), or when the output is +// configured for JSON. +func (f Formatter) FormatInfo(level int, msg string, kvList []any) (prefix, argsStr string) { + args := make([]any, 0, 64) // using a constant here impacts perf + prefix = f.prefix + if f.outputFormat == outputJSON { + args = append(args, "logger", prefix) + prefix = "" + } + if f.opts.LogTimestamp { + args = append(args, "ts", time.Now().Format(f.opts.TimestampFormat)) + } + if policy := f.opts.LogCaller; policy == All || policy == Info { + args = append(args, "caller", f.caller()) + } + if key := *f.opts.LogInfoLevel; key != "" { + args = append(args, key, level) + } + args = append(args, "msg", msg) + return prefix, f.render(args, kvList) +} + +// FormatError renders an Error log message into strings. The prefix will be +// empty when no names were set (via AddNames), or when the output is +// configured for JSON. +func (f Formatter) FormatError(err error, msg string, kvList []any) (prefix, argsStr string) { + args := make([]any, 0, 64) // using a constant here impacts perf + prefix = f.prefix + if f.outputFormat == outputJSON { + args = append(args, "logger", prefix) + prefix = "" + } + if f.opts.LogTimestamp { + args = append(args, "ts", time.Now().Format(f.opts.TimestampFormat)) + } + if policy := f.opts.LogCaller; policy == All || policy == Error { + args = append(args, "caller", f.caller()) + } + args = append(args, "msg", msg) + var loggableErr any + if err != nil { + loggableErr = err.Error() + } + args = append(args, "error", loggableErr) + return prefix, f.render(args, kvList) +} + +// AddName appends the specified name. funcr uses '/' characters to separate +// name elements. Callers should not pass '/' in the provided name string, but +// this library does not actually enforce that. +func (f *Formatter) AddName(name string) { + if len(f.prefix) > 0 { + f.prefix += "/" + } + f.prefix += name +} + +// AddValues adds key-value pairs to the set of saved values to be logged with +// each log line. +func (f *Formatter) AddValues(kvList []any) { + // Three slice args forces a copy. + n := len(f.values) + f.values = append(f.values[:n:n], kvList...) + + vals := f.values + if hook := f.opts.RenderValuesHook; hook != nil { + vals = hook(f.sanitize(vals)) + } + + // Pre-render values, so we don't have to do it on each Info/Error call. + buf := bytes.NewBuffer(make([]byte, 0, 1024)) + f.flatten(buf, vals, true) // escape user-provided keys + f.valuesStr = buf.String() +} + +// AddCallDepth increases the number of stack-frames to skip when attributing +// the log line to a file and line. +func (f *Formatter) AddCallDepth(depth int) { + f.depth += depth +} diff --git a/vendor/github.com/go-logr/logr/funcr/slogsink.go b/vendor/github.com/go-logr/logr/funcr/slogsink.go new file mode 100644 index 00000000..7bd84761 --- /dev/null +++ b/vendor/github.com/go-logr/logr/funcr/slogsink.go @@ -0,0 +1,105 @@ +//go:build go1.21 +// +build go1.21 + +/* +Copyright 2023 The logr Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +package funcr + +import ( + "context" + "log/slog" + + "github.com/go-logr/logr" +) + +var _ logr.SlogSink = &fnlogger{} + +const extraSlogSinkDepth = 3 // 2 for slog, 1 for SlogSink + +func (l fnlogger) Handle(_ context.Context, record slog.Record) error { + kvList := make([]any, 0, 2*record.NumAttrs()) + record.Attrs(func(attr slog.Attr) bool { + kvList = attrToKVs(attr, kvList) + return true + }) + + if record.Level >= slog.LevelError { + l.WithCallDepth(extraSlogSinkDepth).Error(nil, record.Message, kvList...) + } else { + level := l.levelFromSlog(record.Level) + l.WithCallDepth(extraSlogSinkDepth).Info(level, record.Message, kvList...) + } + return nil +} + +func (l fnlogger) WithAttrs(attrs []slog.Attr) logr.SlogSink { + kvList := make([]any, 0, 2*len(attrs)) + for _, attr := range attrs { + kvList = attrToKVs(attr, kvList) + } + l.AddValues(kvList) + return &l +} + +func (l fnlogger) WithGroup(name string) logr.SlogSink { + l.startGroup(name) + return &l +} + +// attrToKVs appends a slog.Attr to a logr-style kvList. It handle slog Groups +// and other details of slog. +func attrToKVs(attr slog.Attr, kvList []any) []any { + attrVal := attr.Value.Resolve() + if attrVal.Kind() == slog.KindGroup { + groupVal := attrVal.Group() + grpKVs := make([]any, 0, 2*len(groupVal)) + for _, attr := range groupVal { + grpKVs = attrToKVs(attr, grpKVs) + } + if attr.Key == "" { + // slog says we have to inline these + kvList = append(kvList, grpKVs...) + } else { + kvList = append(kvList, attr.Key, PseudoStruct(grpKVs)) + } + } else if attr.Key != "" { + kvList = append(kvList, attr.Key, attrVal.Any()) + } + + return kvList +} + +// levelFromSlog adjusts the level by the logger's verbosity and negates it. +// It ensures that the result is >= 0. This is necessary because the result is +// passed to a LogSink and that API did not historically document whether +// levels could be negative or what that meant. +// +// Some example usage: +// +// logrV0 := getMyLogger() +// logrV2 := logrV0.V(2) +// slogV2 := slog.New(logr.ToSlogHandler(logrV2)) +// slogV2.Debug("msg") // =~ logrV2.V(4) =~ logrV0.V(6) +// slogV2.Info("msg") // =~ logrV2.V(0) =~ logrV0.V(2) +// slogv2.Warn("msg") // =~ logrV2.V(-4) =~ logrV0.V(0) +func (l fnlogger) levelFromSlog(level slog.Level) int { + result := -level + if result < 0 { + result = 0 // because LogSink doesn't expect negative V levels + } + return int(result) +} diff --git a/vendor/github.com/go-logr/logr/logr.go b/vendor/github.com/go-logr/logr/logr.go new file mode 100644 index 00000000..b4428e10 --- /dev/null +++ b/vendor/github.com/go-logr/logr/logr.go @@ -0,0 +1,520 @@ +/* +Copyright 2019 The logr Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// This design derives from Dave Cheney's blog: +// http://dave.cheney.net/2015/11/05/lets-talk-about-logging + +// Package logr defines a general-purpose logging API and abstract interfaces +// to back that API. Packages in the Go ecosystem can depend on this package, +// while callers can implement logging with whatever backend is appropriate. +// +// # Usage +// +// Logging is done using a Logger instance. Logger is a concrete type with +// methods, which defers the actual logging to a LogSink interface. The main +// methods of Logger are Info() and Error(). Arguments to Info() and Error() +// are key/value pairs rather than printf-style formatted strings, emphasizing +// "structured logging". +// +// With Go's standard log package, we might write: +// +// log.Printf("setting target value %s", targetValue) +// +// With logr's structured logging, we'd write: +// +// logger.Info("setting target", "value", targetValue) +// +// Errors are much the same. Instead of: +// +// log.Printf("failed to open the pod bay door for user %s: %v", user, err) +// +// We'd write: +// +// logger.Error(err, "failed to open the pod bay door", "user", user) +// +// Info() and Error() are very similar, but they are separate methods so that +// LogSink implementations can choose to do things like attach additional +// information (such as stack traces) on calls to Error(). Error() messages are +// always logged, regardless of the current verbosity. If there is no error +// instance available, passing nil is valid. +// +// # Verbosity +// +// Often we want to log information only when the application in "verbose +// mode". To write log lines that are more verbose, Logger has a V() method. +// The higher the V-level of a log line, the less critical it is considered. +// Log-lines with V-levels that are not enabled (as per the LogSink) will not +// be written. Level V(0) is the default, and logger.V(0).Info() has the same +// meaning as logger.Info(). Negative V-levels have the same meaning as V(0). +// Error messages do not have a verbosity level and are always logged. +// +// Where we might have written: +// +// if flVerbose >= 2 { +// log.Printf("an unusual thing happened") +// } +// +// We can write: +// +// logger.V(2).Info("an unusual thing happened") +// +// # Logger Names +// +// Logger instances can have name strings so that all messages logged through +// that instance have additional context. For example, you might want to add +// a subsystem name: +// +// logger.WithName("compactor").Info("started", "time", time.Now()) +// +// The WithName() method returns a new Logger, which can be passed to +// constructors or other functions for further use. Repeated use of WithName() +// will accumulate name "segments". These name segments will be joined in some +// way by the LogSink implementation. It is strongly recommended that name +// segments contain simple identifiers (letters, digits, and hyphen), and do +// not contain characters that could muddle the log output or confuse the +// joining operation (e.g. whitespace, commas, periods, slashes, brackets, +// quotes, etc). +// +// # Saved Values +// +// Logger instances can store any number of key/value pairs, which will be +// logged alongside all messages logged through that instance. For example, +// you might want to create a Logger instance per managed object: +// +// With the standard log package, we might write: +// +// log.Printf("decided to set field foo to value %q for object %s/%s", +// targetValue, object.Namespace, object.Name) +// +// With logr we'd write: +// +// // Elsewhere: set up the logger to log the object name. +// obj.logger = mainLogger.WithValues( +// "name", obj.name, "namespace", obj.namespace) +// +// // later on... +// obj.logger.Info("setting foo", "value", targetValue) +// +// # Best Practices +// +// Logger has very few hard rules, with the goal that LogSink implementations +// might have a lot of freedom to differentiate. There are, however, some +// things to consider. +// +// The log message consists of a constant message attached to the log line. +// This should generally be a simple description of what's occurring, and should +// never be a format string. Variable information can then be attached using +// named values. +// +// Keys are arbitrary strings, but should generally be constant values. Values +// may be any Go value, but how the value is formatted is determined by the +// LogSink implementation. +// +// Logger instances are meant to be passed around by value. Code that receives +// such a value can call its methods without having to check whether the +// instance is ready for use. +// +// The zero logger (= Logger{}) is identical to Discard() and discards all log +// entries. Code that receives a Logger by value can simply call it, the methods +// will never crash. For cases where passing a logger is optional, a pointer to Logger +// should be used. +// +// # Key Naming Conventions +// +// Keys are not strictly required to conform to any specification or regex, but +// it is recommended that they: +// - be human-readable and meaningful (not auto-generated or simple ordinals) +// - be constant (not dependent on input data) +// - contain only printable characters +// - not contain whitespace or punctuation +// - use lower case for simple keys and lowerCamelCase for more complex ones +// +// These guidelines help ensure that log data is processed properly regardless +// of the log implementation. For example, log implementations will try to +// output JSON data or will store data for later database (e.g. SQL) queries. +// +// While users are generally free to use key names of their choice, it's +// generally best to avoid using the following keys, as they're frequently used +// by implementations: +// - "caller": the calling information (file/line) of a particular log line +// - "error": the underlying error value in the `Error` method +// - "level": the log level +// - "logger": the name of the associated logger +// - "msg": the log message +// - "stacktrace": the stack trace associated with a particular log line or +// error (often from the `Error` message) +// - "ts": the timestamp for a log line +// +// Implementations are encouraged to make use of these keys to represent the +// above concepts, when necessary (for example, in a pure-JSON output form, it +// would be necessary to represent at least message and timestamp as ordinary +// named values). +// +// # Break Glass +// +// Implementations may choose to give callers access to the underlying +// logging implementation. The recommended pattern for this is: +// +// // Underlier exposes access to the underlying logging implementation. +// // Since callers only have a logr.Logger, they have to know which +// // implementation is in use, so this interface is less of an abstraction +// // and more of way to test type conversion. +// type Underlier interface { +// GetUnderlying() +// } +// +// Logger grants access to the sink to enable type assertions like this: +// +// func DoSomethingWithImpl(log logr.Logger) { +// if underlier, ok := log.GetSink().(impl.Underlier); ok { +// implLogger := underlier.GetUnderlying() +// ... +// } +// } +// +// Custom `With*` functions can be implemented by copying the complete +// Logger struct and replacing the sink in the copy: +// +// // WithFooBar changes the foobar parameter in the log sink and returns a +// // new logger with that modified sink. It does nothing for loggers where +// // the sink doesn't support that parameter. +// func WithFoobar(log logr.Logger, foobar int) logr.Logger { +// if foobarLogSink, ok := log.GetSink().(FoobarSink); ok { +// log = log.WithSink(foobarLogSink.WithFooBar(foobar)) +// } +// return log +// } +// +// Don't use New to construct a new Logger with a LogSink retrieved from an +// existing Logger. Source code attribution might not work correctly and +// unexported fields in Logger get lost. +// +// Beware that the same LogSink instance may be shared by different logger +// instances. Calling functions that modify the LogSink will affect all of +// those. +package logr + +// New returns a new Logger instance. This is primarily used by libraries +// implementing LogSink, rather than end users. Passing a nil sink will create +// a Logger which discards all log lines. +func New(sink LogSink) Logger { + logger := Logger{} + logger.setSink(sink) + if sink != nil { + sink.Init(runtimeInfo) + } + return logger +} + +// setSink stores the sink and updates any related fields. It mutates the +// logger and thus is only safe to use for loggers that are not currently being +// used concurrently. +func (l *Logger) setSink(sink LogSink) { + l.sink = sink +} + +// GetSink returns the stored sink. +func (l Logger) GetSink() LogSink { + return l.sink +} + +// WithSink returns a copy of the logger with the new sink. +func (l Logger) WithSink(sink LogSink) Logger { + l.setSink(sink) + return l +} + +// Logger is an interface to an abstract logging implementation. This is a +// concrete type for performance reasons, but all the real work is passed on to +// a LogSink. Implementations of LogSink should provide their own constructors +// that return Logger, not LogSink. +// +// The underlying sink can be accessed through GetSink and be modified through +// WithSink. This enables the implementation of custom extensions (see "Break +// Glass" in the package documentation). Normally the sink should be used only +// indirectly. +type Logger struct { + sink LogSink + level int +} + +// Enabled tests whether this Logger is enabled. For example, commandline +// flags might be used to set the logging verbosity and disable some info logs. +func (l Logger) Enabled() bool { + // Some implementations of LogSink look at the caller in Enabled (e.g. + // different verbosity levels per package or file), but we only pass one + // CallDepth in (via Init). This means that all calls from Logger to the + // LogSink's Enabled, Info, and Error methods must have the same number of + // frames. In other words, Logger methods can't call other Logger methods + // which call these LogSink methods unless we do it the same in all paths. + return l.sink != nil && l.sink.Enabled(l.level) +} + +// Info logs a non-error message with the given key/value pairs as context. +// +// The msg argument should be used to add some constant description to the log +// line. The key/value pairs can then be used to add additional variable +// information. The key/value pairs must alternate string keys and arbitrary +// values. +func (l Logger) Info(msg string, keysAndValues ...any) { + if l.sink == nil { + return + } + if l.sink.Enabled(l.level) { // see comment in Enabled + if withHelper, ok := l.sink.(CallStackHelperLogSink); ok { + withHelper.GetCallStackHelper()() + } + l.sink.Info(l.level, msg, keysAndValues...) + } +} + +// Error logs an error, with the given message and key/value pairs as context. +// It functions similarly to Info, but may have unique behavior, and should be +// preferred for logging errors (see the package documentations for more +// information). The log message will always be emitted, regardless of +// verbosity level. +// +// The msg argument should be used to add context to any underlying error, +// while the err argument should be used to attach the actual error that +// triggered this log line, if present. The err parameter is optional +// and nil may be passed instead of an error instance. +func (l Logger) Error(err error, msg string, keysAndValues ...any) { + if l.sink == nil { + return + } + if withHelper, ok := l.sink.(CallStackHelperLogSink); ok { + withHelper.GetCallStackHelper()() + } + l.sink.Error(err, msg, keysAndValues...) +} + +// V returns a new Logger instance for a specific verbosity level, relative to +// this Logger. In other words, V-levels are additive. A higher verbosity +// level means a log message is less important. Negative V-levels are treated +// as 0. +func (l Logger) V(level int) Logger { + if l.sink == nil { + return l + } + if level < 0 { + level = 0 + } + l.level += level + return l +} + +// GetV returns the verbosity level of the logger. If the logger's LogSink is +// nil as in the Discard logger, this will always return 0. +func (l Logger) GetV() int { + // 0 if l.sink nil because of the if check in V above. + return l.level +} + +// WithValues returns a new Logger instance with additional key/value pairs. +// See Info for documentation on how key/value pairs work. +func (l Logger) WithValues(keysAndValues ...any) Logger { + if l.sink == nil { + return l + } + l.setSink(l.sink.WithValues(keysAndValues...)) + return l +} + +// WithName returns a new Logger instance with the specified name element added +// to the Logger's name. Successive calls with WithName append additional +// suffixes to the Logger's name. It's strongly recommended that name segments +// contain only letters, digits, and hyphens (see the package documentation for +// more information). +func (l Logger) WithName(name string) Logger { + if l.sink == nil { + return l + } + l.setSink(l.sink.WithName(name)) + return l +} + +// WithCallDepth returns a Logger instance that offsets the call stack by the +// specified number of frames when logging call site information, if possible. +// This is useful for users who have helper functions between the "real" call +// site and the actual calls to Logger methods. If depth is 0 the attribution +// should be to the direct caller of this function. If depth is 1 the +// attribution should skip 1 call frame, and so on. Successive calls to this +// are additive. +// +// If the underlying log implementation supports a WithCallDepth(int) method, +// it will be called and the result returned. If the implementation does not +// support CallDepthLogSink, the original Logger will be returned. +// +// To skip one level, WithCallStackHelper() should be used instead of +// WithCallDepth(1) because it works with implementions that support the +// CallDepthLogSink and/or CallStackHelperLogSink interfaces. +func (l Logger) WithCallDepth(depth int) Logger { + if l.sink == nil { + return l + } + if withCallDepth, ok := l.sink.(CallDepthLogSink); ok { + l.setSink(withCallDepth.WithCallDepth(depth)) + } + return l +} + +// WithCallStackHelper returns a new Logger instance that skips the direct +// caller when logging call site information, if possible. This is useful for +// users who have helper functions between the "real" call site and the actual +// calls to Logger methods and want to support loggers which depend on marking +// each individual helper function, like loggers based on testing.T. +// +// In addition to using that new logger instance, callers also must call the +// returned function. +// +// If the underlying log implementation supports a WithCallDepth(int) method, +// WithCallDepth(1) will be called to produce a new logger. If it supports a +// WithCallStackHelper() method, that will be also called. If the +// implementation does not support either of these, the original Logger will be +// returned. +func (l Logger) WithCallStackHelper() (func(), Logger) { + if l.sink == nil { + return func() {}, l + } + var helper func() + if withCallDepth, ok := l.sink.(CallDepthLogSink); ok { + l.setSink(withCallDepth.WithCallDepth(1)) + } + if withHelper, ok := l.sink.(CallStackHelperLogSink); ok { + helper = withHelper.GetCallStackHelper() + } else { + helper = func() {} + } + return helper, l +} + +// IsZero returns true if this logger is an uninitialized zero value +func (l Logger) IsZero() bool { + return l.sink == nil +} + +// RuntimeInfo holds information that the logr "core" library knows which +// LogSinks might want to know. +type RuntimeInfo struct { + // CallDepth is the number of call frames the logr library adds between the + // end-user and the LogSink. LogSink implementations which choose to print + // the original logging site (e.g. file & line) should climb this many + // additional frames to find it. + CallDepth int +} + +// runtimeInfo is a static global. It must not be changed at run time. +var runtimeInfo = RuntimeInfo{ + CallDepth: 1, +} + +// LogSink represents a logging implementation. End-users will generally not +// interact with this type. +type LogSink interface { + // Init receives optional information about the logr library for LogSink + // implementations that need it. + Init(info RuntimeInfo) + + // Enabled tests whether this LogSink is enabled at the specified V-level. + // For example, commandline flags might be used to set the logging + // verbosity and disable some info logs. + Enabled(level int) bool + + // Info logs a non-error message with the given key/value pairs as context. + // The level argument is provided for optional logging. This method will + // only be called when Enabled(level) is true. See Logger.Info for more + // details. + Info(level int, msg string, keysAndValues ...any) + + // Error logs an error, with the given message and key/value pairs as + // context. See Logger.Error for more details. + Error(err error, msg string, keysAndValues ...any) + + // WithValues returns a new LogSink with additional key/value pairs. See + // Logger.WithValues for more details. + WithValues(keysAndValues ...any) LogSink + + // WithName returns a new LogSink with the specified name appended. See + // Logger.WithName for more details. + WithName(name string) LogSink +} + +// CallDepthLogSink represents a LogSink that knows how to climb the call stack +// to identify the original call site and can offset the depth by a specified +// number of frames. This is useful for users who have helper functions +// between the "real" call site and the actual calls to Logger methods. +// Implementations that log information about the call site (such as file, +// function, or line) would otherwise log information about the intermediate +// helper functions. +// +// This is an optional interface and implementations are not required to +// support it. +type CallDepthLogSink interface { + // WithCallDepth returns a LogSink that will offset the call + // stack by the specified number of frames when logging call + // site information. + // + // If depth is 0, the LogSink should skip exactly the number + // of call frames defined in RuntimeInfo.CallDepth when Info + // or Error are called, i.e. the attribution should be to the + // direct caller of Logger.Info or Logger.Error. + // + // If depth is 1 the attribution should skip 1 call frame, and so on. + // Successive calls to this are additive. + WithCallDepth(depth int) LogSink +} + +// CallStackHelperLogSink represents a LogSink that knows how to climb +// the call stack to identify the original call site and can skip +// intermediate helper functions if they mark themselves as +// helper. Go's testing package uses that approach. +// +// This is useful for users who have helper functions between the +// "real" call site and the actual calls to Logger methods. +// Implementations that log information about the call site (such as +// file, function, or line) would otherwise log information about the +// intermediate helper functions. +// +// This is an optional interface and implementations are not required +// to support it. Implementations that choose to support this must not +// simply implement it as WithCallDepth(1), because +// Logger.WithCallStackHelper will call both methods if they are +// present. This should only be implemented for LogSinks that actually +// need it, as with testing.T. +type CallStackHelperLogSink interface { + // GetCallStackHelper returns a function that must be called + // to mark the direct caller as helper function when logging + // call site information. + GetCallStackHelper() func() +} + +// Marshaler is an optional interface that logged values may choose to +// implement. Loggers with structured output, such as JSON, should +// log the object return by the MarshalLog method instead of the +// original value. +type Marshaler interface { + // MarshalLog can be used to: + // - ensure that structs are not logged as strings when the original + // value has a String method: return a different type without a + // String method + // - select which fields of a complex type should get logged: + // return a simpler struct with fewer fields + // - log unexported fields: return a different struct + // with exported fields + // + // It may return any value of any type. + MarshalLog() any +} diff --git a/vendor/github.com/go-logr/logr/sloghandler.go b/vendor/github.com/go-logr/logr/sloghandler.go new file mode 100644 index 00000000..82d1ba49 --- /dev/null +++ b/vendor/github.com/go-logr/logr/sloghandler.go @@ -0,0 +1,192 @@ +//go:build go1.21 +// +build go1.21 + +/* +Copyright 2023 The logr Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +package logr + +import ( + "context" + "log/slog" +) + +type slogHandler struct { + // May be nil, in which case all logs get discarded. + sink LogSink + // Non-nil if sink is non-nil and implements SlogSink. + slogSink SlogSink + + // groupPrefix collects values from WithGroup calls. It gets added as + // prefix to value keys when handling a log record. + groupPrefix string + + // levelBias can be set when constructing the handler to influence the + // slog.Level of log records. A positive levelBias reduces the + // slog.Level value. slog has no API to influence this value after the + // handler got created, so it can only be set indirectly through + // Logger.V. + levelBias slog.Level +} + +var _ slog.Handler = &slogHandler{} + +// groupSeparator is used to concatenate WithGroup names and attribute keys. +const groupSeparator = "." + +// GetLevel is used for black box unit testing. +func (l *slogHandler) GetLevel() slog.Level { + return l.levelBias +} + +func (l *slogHandler) Enabled(_ context.Context, level slog.Level) bool { + return l.sink != nil && (level >= slog.LevelError || l.sink.Enabled(l.levelFromSlog(level))) +} + +func (l *slogHandler) Handle(ctx context.Context, record slog.Record) error { + if l.slogSink != nil { + // Only adjust verbosity level of log entries < slog.LevelError. + if record.Level < slog.LevelError { + record.Level -= l.levelBias + } + return l.slogSink.Handle(ctx, record) + } + + // No need to check for nil sink here because Handle will only be called + // when Enabled returned true. + + kvList := make([]any, 0, 2*record.NumAttrs()) + record.Attrs(func(attr slog.Attr) bool { + kvList = attrToKVs(attr, l.groupPrefix, kvList) + return true + }) + if record.Level >= slog.LevelError { + l.sinkWithCallDepth().Error(nil, record.Message, kvList...) + } else { + level := l.levelFromSlog(record.Level) + l.sinkWithCallDepth().Info(level, record.Message, kvList...) + } + return nil +} + +// sinkWithCallDepth adjusts the stack unwinding so that when Error or Info +// are called by Handle, code in slog gets skipped. +// +// This offset currently (Go 1.21.0) works for calls through +// slog.New(ToSlogHandler(...)). There's no guarantee that the call +// chain won't change. Wrapping the handler will also break unwinding. It's +// still better than not adjusting at all.... +// +// This cannot be done when constructing the handler because FromSlogHandler needs +// access to the original sink without this adjustment. A second copy would +// work, but then WithAttrs would have to be called for both of them. +func (l *slogHandler) sinkWithCallDepth() LogSink { + if sink, ok := l.sink.(CallDepthLogSink); ok { + return sink.WithCallDepth(2) + } + return l.sink +} + +func (l *slogHandler) WithAttrs(attrs []slog.Attr) slog.Handler { + if l.sink == nil || len(attrs) == 0 { + return l + } + + clone := *l + if l.slogSink != nil { + clone.slogSink = l.slogSink.WithAttrs(attrs) + clone.sink = clone.slogSink + } else { + kvList := make([]any, 0, 2*len(attrs)) + for _, attr := range attrs { + kvList = attrToKVs(attr, l.groupPrefix, kvList) + } + clone.sink = l.sink.WithValues(kvList...) + } + return &clone +} + +func (l *slogHandler) WithGroup(name string) slog.Handler { + if l.sink == nil { + return l + } + if name == "" { + // slog says to inline empty groups + return l + } + clone := *l + if l.slogSink != nil { + clone.slogSink = l.slogSink.WithGroup(name) + clone.sink = clone.slogSink + } else { + clone.groupPrefix = addPrefix(clone.groupPrefix, name) + } + return &clone +} + +// attrToKVs appends a slog.Attr to a logr-style kvList. It handle slog Groups +// and other details of slog. +func attrToKVs(attr slog.Attr, groupPrefix string, kvList []any) []any { + attrVal := attr.Value.Resolve() + if attrVal.Kind() == slog.KindGroup { + groupVal := attrVal.Group() + grpKVs := make([]any, 0, 2*len(groupVal)) + prefix := groupPrefix + if attr.Key != "" { + prefix = addPrefix(groupPrefix, attr.Key) + } + for _, attr := range groupVal { + grpKVs = attrToKVs(attr, prefix, grpKVs) + } + kvList = append(kvList, grpKVs...) + } else if attr.Key != "" { + kvList = append(kvList, addPrefix(groupPrefix, attr.Key), attrVal.Any()) + } + + return kvList +} + +func addPrefix(prefix, name string) string { + if prefix == "" { + return name + } + if name == "" { + return prefix + } + return prefix + groupSeparator + name +} + +// levelFromSlog adjusts the level by the logger's verbosity and negates it. +// It ensures that the result is >= 0. This is necessary because the result is +// passed to a LogSink and that API did not historically document whether +// levels could be negative or what that meant. +// +// Some example usage: +// +// logrV0 := getMyLogger() +// logrV2 := logrV0.V(2) +// slogV2 := slog.New(logr.ToSlogHandler(logrV2)) +// slogV2.Debug("msg") // =~ logrV2.V(4) =~ logrV0.V(6) +// slogV2.Info("msg") // =~ logrV2.V(0) =~ logrV0.V(2) +// slogv2.Warn("msg") // =~ logrV2.V(-4) =~ logrV0.V(0) +func (l *slogHandler) levelFromSlog(level slog.Level) int { + result := -level + result += l.levelBias // in case the original Logger had a V level + if result < 0 { + result = 0 // because LogSink doesn't expect negative V levels + } + return int(result) +} diff --git a/vendor/github.com/go-logr/logr/slogr.go b/vendor/github.com/go-logr/logr/slogr.go new file mode 100644 index 00000000..28a83d02 --- /dev/null +++ b/vendor/github.com/go-logr/logr/slogr.go @@ -0,0 +1,100 @@ +//go:build go1.21 +// +build go1.21 + +/* +Copyright 2023 The logr Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +package logr + +import ( + "context" + "log/slog" +) + +// FromSlogHandler returns a Logger which writes to the slog.Handler. +// +// The logr verbosity level is mapped to slog levels such that V(0) becomes +// slog.LevelInfo and V(4) becomes slog.LevelDebug. +func FromSlogHandler(handler slog.Handler) Logger { + if handler, ok := handler.(*slogHandler); ok { + if handler.sink == nil { + return Discard() + } + return New(handler.sink).V(int(handler.levelBias)) + } + return New(&slogSink{handler: handler}) +} + +// ToSlogHandler returns a slog.Handler which writes to the same sink as the Logger. +// +// The returned logger writes all records with level >= slog.LevelError as +// error log entries with LogSink.Error, regardless of the verbosity level of +// the Logger: +// +// logger := +// slog.New(ToSlogHandler(logger.V(10))).Error(...) -> logSink.Error(...) +// +// The level of all other records gets reduced by the verbosity +// level of the Logger and the result is negated. If it happens +// to be negative, then it gets replaced by zero because a LogSink +// is not expected to handled negative levels: +// +// slog.New(ToSlogHandler(logger)).Debug(...) -> logger.GetSink().Info(level=4, ...) +// slog.New(ToSlogHandler(logger)).Warning(...) -> logger.GetSink().Info(level=0, ...) +// slog.New(ToSlogHandler(logger)).Info(...) -> logger.GetSink().Info(level=0, ...) +// slog.New(ToSlogHandler(logger.V(4))).Info(...) -> logger.GetSink().Info(level=4, ...) +func ToSlogHandler(logger Logger) slog.Handler { + if sink, ok := logger.GetSink().(*slogSink); ok && logger.GetV() == 0 { + return sink.handler + } + + handler := &slogHandler{sink: logger.GetSink(), levelBias: slog.Level(logger.GetV())} + if slogSink, ok := handler.sink.(SlogSink); ok { + handler.slogSink = slogSink + } + return handler +} + +// SlogSink is an optional interface that a LogSink can implement to support +// logging through the slog.Logger or slog.Handler APIs better. It then should +// also support special slog values like slog.Group. When used as a +// slog.Handler, the advantages are: +// +// - stack unwinding gets avoided in favor of logging the pre-recorded PC, +// as intended by slog +// - proper grouping of key/value pairs via WithGroup +// - verbosity levels > slog.LevelInfo can be recorded +// - less overhead +// +// Both APIs (Logger and slog.Logger/Handler) then are supported equally +// well. Developers can pick whatever API suits them better and/or mix +// packages which use either API in the same binary with a common logging +// implementation. +// +// This interface is necessary because the type implementing the LogSink +// interface cannot also implement the slog.Handler interface due to the +// different prototype of the common Enabled method. +// +// An implementation could support both interfaces in two different types, but then +// additional interfaces would be needed to convert between those types in FromSlogHandler +// and ToSlogHandler. +type SlogSink interface { + LogSink + + Handle(ctx context.Context, record slog.Record) error + WithAttrs(attrs []slog.Attr) SlogSink + WithGroup(name string) SlogSink +} diff --git a/vendor/github.com/go-logr/logr/slogsink.go b/vendor/github.com/go-logr/logr/slogsink.go new file mode 100644 index 00000000..4060fcbc --- /dev/null +++ b/vendor/github.com/go-logr/logr/slogsink.go @@ -0,0 +1,120 @@ +//go:build go1.21 +// +build go1.21 + +/* +Copyright 2023 The logr Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +package logr + +import ( + "context" + "log/slog" + "runtime" + "time" +) + +var ( + _ LogSink = &slogSink{} + _ CallDepthLogSink = &slogSink{} + _ Underlier = &slogSink{} +) + +// Underlier is implemented by the LogSink returned by NewFromLogHandler. +type Underlier interface { + // GetUnderlying returns the Handler used by the LogSink. + GetUnderlying() slog.Handler +} + +const ( + // nameKey is used to log the `WithName` values as an additional attribute. + nameKey = "logger" + + // errKey is used to log the error parameter of Error as an additional attribute. + errKey = "err" +) + +type slogSink struct { + callDepth int + name string + handler slog.Handler +} + +func (l *slogSink) Init(info RuntimeInfo) { + l.callDepth = info.CallDepth +} + +func (l *slogSink) GetUnderlying() slog.Handler { + return l.handler +} + +func (l *slogSink) WithCallDepth(depth int) LogSink { + newLogger := *l + newLogger.callDepth += depth + return &newLogger +} + +func (l *slogSink) Enabled(level int) bool { + return l.handler.Enabled(context.Background(), slog.Level(-level)) +} + +func (l *slogSink) Info(level int, msg string, kvList ...interface{}) { + l.log(nil, msg, slog.Level(-level), kvList...) +} + +func (l *slogSink) Error(err error, msg string, kvList ...interface{}) { + l.log(err, msg, slog.LevelError, kvList...) +} + +func (l *slogSink) log(err error, msg string, level slog.Level, kvList ...interface{}) { + var pcs [1]uintptr + // skip runtime.Callers, this function, Info/Error, and all helper functions above that. + runtime.Callers(3+l.callDepth, pcs[:]) + + record := slog.NewRecord(time.Now(), level, msg, pcs[0]) + if l.name != "" { + record.AddAttrs(slog.String(nameKey, l.name)) + } + if err != nil { + record.AddAttrs(slog.Any(errKey, err)) + } + record.Add(kvList...) + _ = l.handler.Handle(context.Background(), record) +} + +func (l slogSink) WithName(name string) LogSink { + if l.name != "" { + l.name += "/" + } + l.name += name + return &l +} + +func (l slogSink) WithValues(kvList ...interface{}) LogSink { + l.handler = l.handler.WithAttrs(kvListToAttrs(kvList...)) + return &l +} + +func kvListToAttrs(kvList ...interface{}) []slog.Attr { + // We don't need the record itself, only its Add method. + record := slog.NewRecord(time.Time{}, 0, "", 0) + record.Add(kvList...) + attrs := make([]slog.Attr, 0, record.NumAttrs()) + record.Attrs(func(attr slog.Attr) bool { + attrs = append(attrs, attr) + return true + }) + return attrs +} diff --git a/vendor/github.com/go-logr/stdr/LICENSE b/vendor/github.com/go-logr/stdr/LICENSE new file mode 100644 index 00000000..261eeb9e --- /dev/null +++ b/vendor/github.com/go-logr/stdr/LICENSE @@ -0,0 +1,201 @@ + Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + + TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + + 1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + + 2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + + 3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + + 4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + + 5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + + 6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + + 7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + + 8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + + 9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + + END OF TERMS AND CONDITIONS + + APPENDIX: How to apply the Apache License to your work. + + To apply the Apache License to your work, attach the following + boilerplate notice, with the fields enclosed by brackets "[]" + replaced with your own identifying information. (Don't include + the brackets!) The text should be enclosed in the appropriate + comment syntax for the file format. We also recommend that a + file or class name and description of purpose be included on the + same "printed page" as the copyright notice for easier + identification within third-party archives. + + Copyright [yyyy] [name of copyright owner] + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. diff --git a/vendor/github.com/go-logr/stdr/README.md b/vendor/github.com/go-logr/stdr/README.md new file mode 100644 index 00000000..51586678 --- /dev/null +++ b/vendor/github.com/go-logr/stdr/README.md @@ -0,0 +1,6 @@ +# Minimal Go logging using logr and Go's standard library + +[![Go Reference](https://pkg.go.dev/badge/github.com/go-logr/stdr.svg)](https://pkg.go.dev/github.com/go-logr/stdr) + +This package implements the [logr interface](https://github.com/go-logr/logr) +in terms of Go's standard log package(https://pkg.go.dev/log). diff --git a/vendor/github.com/go-logr/stdr/stdr.go b/vendor/github.com/go-logr/stdr/stdr.go new file mode 100644 index 00000000..93a8aab5 --- /dev/null +++ b/vendor/github.com/go-logr/stdr/stdr.go @@ -0,0 +1,170 @@ +/* +Copyright 2019 The logr Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Package stdr implements github.com/go-logr/logr.Logger in terms of +// Go's standard log package. +package stdr + +import ( + "log" + "os" + + "github.com/go-logr/logr" + "github.com/go-logr/logr/funcr" +) + +// The global verbosity level. See SetVerbosity(). +var globalVerbosity int + +// SetVerbosity sets the global level against which all info logs will be +// compared. If this is greater than or equal to the "V" of the logger, the +// message will be logged. A higher value here means more logs will be written. +// The previous verbosity value is returned. This is not concurrent-safe - +// callers must be sure to call it from only one goroutine. +func SetVerbosity(v int) int { + old := globalVerbosity + globalVerbosity = v + return old +} + +// New returns a logr.Logger which is implemented by Go's standard log package, +// or something like it. If std is nil, this will use a default logger +// instead. +// +// Example: stdr.New(log.New(os.Stderr, "", log.LstdFlags|log.Lshortfile))) +func New(std StdLogger) logr.Logger { + return NewWithOptions(std, Options{}) +} + +// NewWithOptions returns a logr.Logger which is implemented by Go's standard +// log package, or something like it. See New for details. +func NewWithOptions(std StdLogger, opts Options) logr.Logger { + if std == nil { + // Go's log.Default() is only available in 1.16 and higher. + std = log.New(os.Stderr, "", log.LstdFlags) + } + + if opts.Depth < 0 { + opts.Depth = 0 + } + + fopts := funcr.Options{ + LogCaller: funcr.MessageClass(opts.LogCaller), + } + + sl := &logger{ + Formatter: funcr.NewFormatter(fopts), + std: std, + } + + // For skipping our own logger.Info/Error. + sl.Formatter.AddCallDepth(1 + opts.Depth) + + return logr.New(sl) +} + +// Options carries parameters which influence the way logs are generated. +type Options struct { + // Depth biases the assumed number of call frames to the "true" caller. + // This is useful when the calling code calls a function which then calls + // stdr (e.g. a logging shim to another API). Values less than zero will + // be treated as zero. + Depth int + + // LogCaller tells stdr to add a "caller" key to some or all log lines. + // Go's log package has options to log this natively, too. + LogCaller MessageClass + + // TODO: add an option to log the date/time +} + +// MessageClass indicates which category or categories of messages to consider. +type MessageClass int + +const ( + // None ignores all message classes. + None MessageClass = iota + // All considers all message classes. + All + // Info only considers info messages. + Info + // Error only considers error messages. + Error +) + +// StdLogger is the subset of the Go stdlib log.Logger API that is needed for +// this adapter. +type StdLogger interface { + // Output is the same as log.Output and log.Logger.Output. + Output(calldepth int, logline string) error +} + +type logger struct { + funcr.Formatter + std StdLogger +} + +var _ logr.LogSink = &logger{} +var _ logr.CallDepthLogSink = &logger{} + +func (l logger) Enabled(level int) bool { + return globalVerbosity >= level +} + +func (l logger) Info(level int, msg string, kvList ...interface{}) { + prefix, args := l.FormatInfo(level, msg, kvList) + if prefix != "" { + args = prefix + ": " + args + } + _ = l.std.Output(l.Formatter.GetDepth()+1, args) +} + +func (l logger) Error(err error, msg string, kvList ...interface{}) { + prefix, args := l.FormatError(err, msg, kvList) + if prefix != "" { + args = prefix + ": " + args + } + _ = l.std.Output(l.Formatter.GetDepth()+1, args) +} + +func (l logger) WithName(name string) logr.LogSink { + l.Formatter.AddName(name) + return &l +} + +func (l logger) WithValues(kvList ...interface{}) logr.LogSink { + l.Formatter.AddValues(kvList) + return &l +} + +func (l logger) WithCallDepth(depth int) logr.LogSink { + l.Formatter.AddCallDepth(depth) + return &l +} + +// Underlier exposes access to the underlying logging implementation. Since +// callers only have a logr.Logger, they have to know which implementation is +// in use, so this interface is less of an abstraction and more of way to test +// type conversion. +type Underlier interface { + GetUnderlying() StdLogger +} + +// GetUnderlying returns the StdLogger underneath this logger. Since StdLogger +// is itself an interface, the result may or may not be a Go log.Logger. +func (l logger) GetUnderlying() StdLogger { + return l.std +} diff --git a/vendor/github.com/lann/builder/.gitignore b/vendor/github.com/lann/builder/.gitignore new file mode 100644 index 00000000..f54eb28f --- /dev/null +++ b/vendor/github.com/lann/builder/.gitignore @@ -0,0 +1,2 @@ +*~ +\#*# diff --git a/vendor/github.com/lann/builder/.travis.yml b/vendor/github.com/lann/builder/.travis.yml new file mode 100644 index 00000000..c8860f69 --- /dev/null +++ b/vendor/github.com/lann/builder/.travis.yml @@ -0,0 +1,7 @@ +language: go + +go: + - '1.8' + - '1.9' + - '1.10' + - tip diff --git a/vendor/github.com/lann/builder/LICENSE b/vendor/github.com/lann/builder/LICENSE new file mode 100644 index 00000000..a109e805 --- /dev/null +++ b/vendor/github.com/lann/builder/LICENSE @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) 2014-2015 Lann Martin + +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. diff --git a/vendor/github.com/lann/builder/README.md b/vendor/github.com/lann/builder/README.md new file mode 100644 index 00000000..3b18550b --- /dev/null +++ b/vendor/github.com/lann/builder/README.md @@ -0,0 +1,68 @@ +# Builder - fluent immutable builders for Go + +[![GoDoc](https://godoc.org/github.com/lann/builder?status.png)](https://godoc.org/github.com/lann/builder) +[![Build Status](https://travis-ci.org/lann/builder.png?branch=master)](https://travis-ci.org/lann/builder) + +Builder was originally written for +[Squirrel](https://github.com/lann/squirrel), a fluent SQL generator. It +is probably the best example of Builder in action. + +Builder helps you write **fluent** DSLs for your libraries with method chaining: + +```go +resp := ReqBuilder. + Url("http://golang.org"). + Header("User-Agent", "Builder"). + Get() +``` + +Builder uses **immutable** persistent data structures +([these](https://github.com/mndrix/ps), specifically) +so that each step in your method chain can be reused: + +```go +build := WordBuilder.AddLetters("Build") +builder := build.AddLetters("er") +building := build.AddLetters("ing") +``` + +Builder makes it easy to **build** structs using the **builder** pattern +(*surprise!*): + +```go +import "github.com/lann/builder" + +type Muppet struct { + Name string + Friends []string +} + +type muppetBuilder builder.Builder + +func (b muppetBuilder) Name(name string) muppetBuilder { + return builder.Set(b, "Name", name).(muppetBuilder) +} + +func (b muppetBuilder) AddFriend(friend string) muppetBuilder { + return builder.Append(b, "Friends", friend).(muppetBuilder) +} + +func (b muppetBuilder) Build() Muppet { + return builder.GetStruct(b).(Muppet) +} + +var MuppetBuilder = builder.Register(muppetBuilder{}, Muppet{}).(muppetBuilder) +``` +```go +MuppetBuilder. + Name("Beaker"). + AddFriend("Dr. Honeydew"). + Build() + +=> Muppet{Name:"Beaker", Friends:[]string{"Dr. Honeydew"}} +``` + +## License + +Builder is released under the +[MIT License](http://www.opensource.org/licenses/MIT). diff --git a/vendor/github.com/lann/builder/builder.go b/vendor/github.com/lann/builder/builder.go new file mode 100644 index 00000000..ff621406 --- /dev/null +++ b/vendor/github.com/lann/builder/builder.go @@ -0,0 +1,225 @@ +// Package builder provides a method for writing fluent immutable builders. +package builder + +import ( + "github.com/lann/ps" + "go/ast" + "reflect" +) + +// Builder stores a set of named values. +// +// New types can be declared with underlying type Builder and used with the +// functions in this package. See example. +// +// Instances of Builder should be treated as immutable. It is up to the +// implementor to ensure mutable values set on a Builder are not mutated while +// the Builder is in use. +type Builder struct { + builderMap ps.Map +} + +var ( + EmptyBuilder = Builder{ps.NewMap()} + emptyBuilderValue = reflect.ValueOf(EmptyBuilder) +) + +func getBuilderMap(builder interface{}) ps.Map { + b := convert(builder, Builder{}).(Builder) + + if b.builderMap == nil { + return ps.NewMap() + } + + return b.builderMap +} + +// Set returns a copy of the given builder with a new value set for the given +// name. +// +// Set (and all other functions taking a builder in this package) will panic if +// the given builder's underlying type is not Builder. +func Set(builder interface{}, name string, v interface{}) interface{} { + b := Builder{getBuilderMap(builder).Set(name, v)} + return convert(b, builder) +} + +// Delete returns a copy of the given builder with the given named value unset. +func Delete(builder interface{}, name string) interface{} { + b := Builder{getBuilderMap(builder).Delete(name)} + return convert(b, builder) +} + +// Append returns a copy of the given builder with new value(s) appended to the +// named list. If the value was previously unset or set with Set (even to a e.g. +// slice values), the new value(s) will be appended to an empty list. +func Append(builder interface{}, name string, vs ...interface{}) interface{} { + return Extend(builder, name, vs) +} + +// Extend behaves like Append, except it takes a single slice or array value +// which will be concatenated to the named list. +// +// Unlike a variadic call to Append - which requires a []interface{} value - +// Extend accepts slices or arrays of any type. +// +// Extend will panic if the given value is not a slice, array, or nil. +func Extend(builder interface{}, name string, vs interface{}) interface{} { + if vs == nil { + return builder + } + + maybeList, ok := getBuilderMap(builder).Lookup(name) + + var list ps.List + if ok { + list, ok = maybeList.(ps.List) + } + if !ok { + list = ps.NewList() + } + + forEach(vs, func(v interface{}) { + list = list.Cons(v) + }) + + return Set(builder, name, list) +} + +func listToSlice(list ps.List, arrayType reflect.Type) reflect.Value { + size := list.Size() + slice := reflect.MakeSlice(arrayType, size, size) + for i := size - 1; i >= 0; i-- { + val := reflect.ValueOf(list.Head()) + slice.Index(i).Set(val) + list = list.Tail() + } + return slice +} + +var anyArrayType = reflect.TypeOf([]interface{}{}) + +// Get retrieves a single named value from the given builder. +// If the value has not been set, it returns (nil, false). Otherwise, it will +// return (value, true). +// +// If the named value was last set with Append or Extend, the returned value +// will be a slice. If the given Builder has been registered with Register or +// RegisterType and the given name is an exported field of the registered +// struct, the returned slice will have the same type as that field. Otherwise +// the slice will have type []interface{}. It will panic if the given name is a +// registered struct's exported field and the value set on the Builder is not +// assignable to the field. +func Get(builder interface{}, name string) (interface{}, bool) { + val, ok := getBuilderMap(builder).Lookup(name) + if !ok { + return nil, false + } + + list, isList := val.(ps.List) + if isList { + arrayType := anyArrayType + + if ast.IsExported(name) { + structType := getBuilderStructType(reflect.TypeOf(builder)) + if structType != nil { + field, ok := (*structType).FieldByName(name) + if ok { + arrayType = field.Type + } + } + } + + val = listToSlice(list, arrayType).Interface() + } + + return val, true +} + +// GetMap returns a map[string]interface{} of the values set in the given +// builder. +// +// See notes on Get regarding returned slices. +func GetMap(builder interface{}) map[string]interface{} { + m := getBuilderMap(builder) + structType := getBuilderStructType(reflect.TypeOf(builder)) + + ret := make(map[string]interface{}, m.Size()) + + m.ForEach(func(name string, val ps.Any) { + list, isList := val.(ps.List) + if isList { + arrayType := anyArrayType + + if structType != nil { + field, ok := (*structType).FieldByName(name) + if ok { + arrayType = field.Type + } + } + + val = listToSlice(list, arrayType).Interface() + } + + ret[name] = val + }) + + return ret +} + +// GetStruct builds a new struct from the given registered builder. +// It will return nil if the given builder's type has not been registered with +// Register or RegisterValue. +// +// All values set on the builder with names that start with an uppercase letter +// (i.e. which would be exported if they were identifiers) are assigned to the +// corresponding exported fields of the struct. +// +// GetStruct will panic if any of these "exported" values are not assignable to +// their corresponding struct fields. +func GetStruct(builder interface{}) interface{} { + structVal := newBuilderStruct(reflect.TypeOf(builder)) + if structVal == nil { + return nil + } + return scanStruct(builder, structVal) +} + +// GetStructLike builds a new struct from the given builder with the same type +// as the given struct. +// +// All values set on the builder with names that start with an uppercase letter +// (i.e. which would be exported if they were identifiers) are assigned to the +// corresponding exported fields of the struct. +// +// ScanStruct will panic if any of these "exported" values are not assignable to +// their corresponding struct fields. +func GetStructLike(builder interface{}, strct interface{}) interface{} { + structVal := reflect.New(reflect.TypeOf(strct)).Elem() + return scanStruct(builder, &structVal) +} + +func scanStruct(builder interface{}, structVal *reflect.Value) interface{} { + getBuilderMap(builder).ForEach(func(name string, val ps.Any) { + if ast.IsExported(name) { + field := structVal.FieldByName(name) + + var value reflect.Value + switch v := val.(type) { + case nil: + switch field.Kind() { + case reflect.Chan, reflect.Func, reflect.Interface, reflect.Map, reflect.Ptr, reflect.Slice: + value = reflect.Zero(field.Type()) + } + // nil is not valid for this Type; Set will panic + case ps.List: + value = listToSlice(v, field.Type()) + default: + value = reflect.ValueOf(val) + } + field.Set(value) + } + }) + + return structVal.Interface() +} diff --git a/vendor/github.com/lann/builder/reflect.go b/vendor/github.com/lann/builder/reflect.go new file mode 100644 index 00000000..3b236e79 --- /dev/null +++ b/vendor/github.com/lann/builder/reflect.go @@ -0,0 +1,24 @@ +package builder + +import "reflect" + +func convert(from interface{}, to interface{}) interface{} { + return reflect. + ValueOf(from). + Convert(reflect.TypeOf(to)). + Interface() +} + +func forEach(s interface{}, f func(interface{})) { + val := reflect.ValueOf(s) + + kind := val.Kind() + if kind != reflect.Slice && kind != reflect.Array { + panic(&reflect.ValueError{Method: "builder.forEach", Kind: kind}) + } + + l := val.Len() + for i := 0; i < l; i++ { + f(val.Index(i).Interface()) + } +} diff --git a/vendor/github.com/lann/builder/registry.go b/vendor/github.com/lann/builder/registry.go new file mode 100644 index 00000000..61284541 --- /dev/null +++ b/vendor/github.com/lann/builder/registry.go @@ -0,0 +1,59 @@ +package builder + +import ( + "reflect" + "sync" +) + +var ( + registry = make(map[reflect.Type]reflect.Type) + registryMux sync.RWMutex +) + +// RegisterType maps the given builderType to a structType. +// This mapping affects the type of slices returned by Get and is required for +// GetStruct to work. +// +// Returns a Value containing an empty instance of the registered builderType. +// +// RegisterType will panic if builderType's underlying type is not Builder or +// if structType's Kind is not Struct. +func RegisterType(builderType reflect.Type, structType reflect.Type) *reflect.Value { + registryMux.Lock() + defer registryMux.Unlock() + structType.NumField() // Panic if structType is not a struct + registry[builderType] = structType + emptyValue := emptyBuilderValue.Convert(builderType) + return &emptyValue +} + +// Register wraps RegisterType, taking instances instead of Types. +// +// Returns an empty instance of the registered builder type which can be used +// as the initial value for builder expressions. See example. +func Register(builderProto, structProto interface{}) interface{} { + empty := RegisterType( + reflect.TypeOf(builderProto), + reflect.TypeOf(structProto), + ).Interface() + return empty +} + +func getBuilderStructType(builderType reflect.Type) *reflect.Type { + registryMux.RLock() + defer registryMux.RUnlock() + structType, ok := registry[builderType] + if !ok { + return nil + } + return &structType +} + +func newBuilderStruct(builderType reflect.Type) *reflect.Value { + structType := getBuilderStructType(builderType) + if structType == nil { + return nil + } + newStruct := reflect.New(*structType).Elem() + return &newStruct +} diff --git a/vendor/github.com/lann/ps/LICENSE b/vendor/github.com/lann/ps/LICENSE new file mode 100644 index 00000000..69f9ae8d --- /dev/null +++ b/vendor/github.com/lann/ps/LICENSE @@ -0,0 +1,7 @@ +Copyright (c) 2013 Michael Hendricks + +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. diff --git a/vendor/github.com/lann/ps/README.md b/vendor/github.com/lann/ps/README.md new file mode 100644 index 00000000..325a5b35 --- /dev/null +++ b/vendor/github.com/lann/ps/README.md @@ -0,0 +1,10 @@ +**This is a stable fork of https://github.com/mndrix/ps; it will not introduce breaking changes.** + +ps +== + +Persistent data structures for Go. See the [full package documentation](http://godoc.org/github.com/lann/ps) + +Install with + + go get github.com/lann/ps diff --git a/vendor/github.com/lann/ps/list.go b/vendor/github.com/lann/ps/list.go new file mode 100644 index 00000000..48a1ceba --- /dev/null +++ b/vendor/github.com/lann/ps/list.go @@ -0,0 +1,93 @@ +package ps + +// List is a persistent list of possibly heterogenous values. +type List interface { + // IsNil returns true if the list is empty + IsNil() bool + + // Cons returns a new list with val as the head + Cons(val Any) List + + // Head returns the first element of the list; + // panics if the list is empty + Head() Any + + // Tail returns a list with all elements except the head; + // panics if the list is empty + Tail() List + + // Size returns the list's length. This takes O(1) time. + Size() int + + // ForEach executes a callback for each value in the list. + ForEach(f func(Any)) + + // Reverse returns a list whose elements are in the opposite order as + // the original list. + Reverse() List +} + +// Immutable (i.e. persistent) list +type list struct { + depth int // the number of nodes after, and including, this one + value Any + tail *list +} + +// An empty list shared by all lists +var nilList = &list{} + +// NewList returns a new, empty list. The result is a singly linked +// list implementation. All lists share an empty tail, so allocating +// empty lists is efficient in time and memory. +func NewList() List { + return nilList +} + +func (self *list) IsNil() bool { + return self == nilList +} + +func (self *list) Size() int { + return self.depth +} + +func (tail *list) Cons(val Any) List { + var xs list + xs.depth = tail.depth + 1 + xs.value = val + xs.tail = tail + return &xs +} + +func (self *list) Head() Any { + if self.IsNil() { + panic("Called Head() on an empty list") + } + + return self.value +} + +func (self *list) Tail() List { + if self.IsNil() { + panic("Called Tail() on an empty list") + } + + return self.tail +} + +// ForEach executes a callback for each value in the list +func (self *list) ForEach(f func(Any)) { + if self.IsNil() { + return + } + f(self.Head()) + self.Tail().ForEach(f) +} + +// Reverse returns a list with elements in opposite order as this list +func (self *list) Reverse() List { + reversed := NewList() + self.ForEach(func(v Any) { reversed = reversed.Cons(v) }) + return reversed +} diff --git a/vendor/github.com/lann/ps/map.go b/vendor/github.com/lann/ps/map.go new file mode 100644 index 00000000..192daec8 --- /dev/null +++ b/vendor/github.com/lann/ps/map.go @@ -0,0 +1,311 @@ +// Fully persistent data structures. A persistent data structure is a data +// structure that always preserves the previous version of itself when +// it is modified. Such data structures are effectively immutable, +// as their operations do not update the structure in-place, but instead +// always yield a new structure. +// +// Persistent +// data structures typically share structure among themselves. This allows +// operations to avoid copying the entire data structure. +package ps + +import ( + "bytes" + "fmt" +) + +// Any is a shorthand for Go's verbose interface{} type. +type Any interface{} + +// A Map associates unique keys (type string) with values (type Any). +type Map interface { + // IsNil returns true if the Map is empty + IsNil() bool + + // Set returns a new map in which key and value are associated. + // If the key didn't exist before, it's created; otherwise, the + // associated value is changed. + // This operation is O(log N) in the number of keys. + Set(key string, value Any) Map + + // Delete returns a new map with the association for key, if any, removed. + // This operation is O(log N) in the number of keys. + Delete(key string) Map + + // Lookup returns the value associated with a key, if any. If the key + // exists, the second return value is true; otherwise, false. + // This operation is O(log N) in the number of keys. + Lookup(key string) (Any, bool) + + // Size returns the number of key value pairs in the map. + // This takes O(1) time. + Size() int + + // ForEach executes a callback on each key value pair in the map. + ForEach(f func(key string, val Any)) + + // Keys returns a slice with all keys in this map. + // This operation is O(N) in the number of keys. + Keys() []string + + String() string +} + +// Immutable (i.e. persistent) associative array +const childCount = 8 +const shiftSize = 3 + +type tree struct { + count int + hash uint64 // hash of the key (used for tree balancing) + key string + value Any + children [childCount]*tree +} + +var nilMap = &tree{} + +// Recursively set nilMap's subtrees to point at itself. +// This eliminates all nil pointers in the map structure. +// All map nodes are created by cloning this structure so +// they avoid the problem too. +func init() { + for i := range nilMap.children { + nilMap.children[i] = nilMap + } +} + +// NewMap allocates a new, persistent map from strings to values of +// any type. +// This is currently implemented as a path-copying binary tree. +func NewMap() Map { + return nilMap +} + +func (self *tree) IsNil() bool { + return self == nilMap +} + +// clone returns an exact duplicate of a tree node +func (self *tree) clone() *tree { + var m tree + m = *self + return &m +} + +// constants for FNV-1a hash algorithm +const ( + offset64 uint64 = 14695981039346656037 + prime64 uint64 = 1099511628211 +) + +// hashKey returns a hash code for a given string +func hashKey(key string) uint64 { + hash := offset64 + for _, codepoint := range key { + hash ^= uint64(codepoint) + hash *= prime64 + } + return hash +} + +// Set returns a new map similar to this one but with key and value +// associated. If the key didn't exist, it's created; otherwise, the +// associated value is changed. +func (self *tree) Set(key string, value Any) Map { + hash := hashKey(key) + return setLowLevel(self, hash, hash, key, value) +} + +func setLowLevel(self *tree, partialHash, hash uint64, key string, value Any) *tree { + if self.IsNil() { // an empty tree is easy + m := self.clone() + m.count = 1 + m.hash = hash + m.key = key + m.value = value + return m + } + + if hash != self.hash { + m := self.clone() + i := partialHash % childCount + m.children[i] = setLowLevel(self.children[i], partialHash>>shiftSize, hash, key, value) + recalculateCount(m) + return m + } + + // replacing a key's previous value + m := self.clone() + m.value = value + return m +} + +// modifies a map by recalculating its key count based on the counts +// of its subtrees +func recalculateCount(m *tree) { + count := 0 + for _, t := range m.children { + count += t.Size() + } + m.count = count + 1 // add one to count ourself +} + +func (m *tree) Delete(key string) Map { + hash := hashKey(key) + newMap, _ := deleteLowLevel(m, hash, hash) + return newMap +} + +func deleteLowLevel(self *tree, partialHash, hash uint64) (*tree, bool) { + // empty trees are easy + if self.IsNil() { + return self, false + } + + if hash != self.hash { + i := partialHash % childCount + child, found := deleteLowLevel(self.children[i], partialHash>>shiftSize, hash) + if !found { + return self, false + } + newMap := self.clone() + newMap.children[i] = child + recalculateCount(newMap) + return newMap, true // ? this wasn't in the original code + } + + // we must delete our own node + if self.isLeaf() { // we have no children + return nilMap, true + } + /* + if self.subtreeCount() == 1 { // only one subtree + for _, t := range self.children { + if t != nilMap { + return t, true + } + } + panic("Tree with 1 subtree actually had no subtrees") + } + */ + + // find a node to replace us + i := -1 + size := -1 + for j, t := range self.children { + if t.Size() > size { + i = j + size = t.Size() + } + } + + // make chosen leaf smaller + replacement, child := self.children[i].deleteLeftmost() + newMap := replacement.clone() + for j := range self.children { + if j == i { + newMap.children[j] = child + } else { + newMap.children[j] = self.children[j] + } + } + recalculateCount(newMap) + return newMap, true +} + +// delete the leftmost node in a tree returning the node that +// was deleted and the tree left over after its deletion +func (m *tree) deleteLeftmost() (*tree, *tree) { + if m.isLeaf() { + return m, nilMap + } + + for i, t := range m.children { + if t != nilMap { + deleted, child := t.deleteLeftmost() + newMap := m.clone() + newMap.children[i] = child + recalculateCount(newMap) + return deleted, newMap + } + } + panic("Tree isn't a leaf but also had no children. How does that happen?") +} + +// isLeaf returns true if this is a leaf node +func (m *tree) isLeaf() bool { + return m.Size() == 1 +} + +// returns the number of child subtrees we have +func (m *tree) subtreeCount() int { + count := 0 + for _, t := range m.children { + if t != nilMap { + count++ + } + } + return count +} + +func (m *tree) Lookup(key string) (Any, bool) { + hash := hashKey(key) + return lookupLowLevel(m, hash, hash) +} + +func lookupLowLevel(self *tree, partialHash, hash uint64) (Any, bool) { + if self.IsNil() { // an empty tree is easy + return nil, false + } + + if hash != self.hash { + i := partialHash % childCount + return lookupLowLevel(self.children[i], partialHash>>shiftSize, hash) + } + + // we found it + return self.value, true +} + +func (m *tree) Size() int { + return m.count +} + +func (m *tree) ForEach(f func(key string, val Any)) { + if m.IsNil() { + return + } + + // ourself + f(m.key, m.value) + + // children + for _, t := range m.children { + if t != nilMap { + t.ForEach(f) + } + } +} + +func (m *tree) Keys() []string { + keys := make([]string, m.Size()) + i := 0 + m.ForEach(func(k string, v Any) { + keys[i] = k + i++ + }) + return keys +} + +// make it easier to display maps for debugging +func (m *tree) String() string { + keys := m.Keys() + buf := bytes.NewBufferString("{") + for _, key := range keys { + val, _ := m.Lookup(key) + fmt.Fprintf(buf, "%s: %s, ", key, val) + } + fmt.Fprintf(buf, "}\n") + return buf.String() +} diff --git a/vendor/github.com/lann/ps/profile.sh b/vendor/github.com/lann/ps/profile.sh new file mode 100644 index 00000000..f03df05a --- /dev/null +++ b/vendor/github.com/lann/ps/profile.sh @@ -0,0 +1,3 @@ +#!/bin/sh +go test -c +./ps.test -test.run=none -test.bench=$2 -test.$1profile=$1.profile diff --git a/vendor/github.com/lib/pq/CHANGELOG.md b/vendor/github.com/lib/pq/CHANGELOG.md index 2fce02d2..f0c46a96 100644 --- a/vendor/github.com/lib/pq/CHANGELOG.md +++ b/vendor/github.com/lib/pq/CHANGELOG.md @@ -1,4 +1,109 @@ -v1.11.2 (2025-02-10) +unreleased +---------- + + +v1.12.3 (2026-04-03) +-------------------- +- Send datestyle startup parameter, improving compatbility with database engines + that use a different default datestyle such as EnterpriseDB ([#1312]). + +[#1312]: https://github.com/lib/pq/pull/1312 + +v1.12.2 (2026-04-02) +-------------------- + +- Treat io.ErrUnexpectedEOF as driver.ErrBadConn so database/sql discards the + connection. Since v1.12.0 this could result in permanently broken connections, + especially with CockroachDB which frequently sends partial messages ([#1299]). + +[#1299]: https://github.com/lib/pq/pull/1299 + +v1.12.1 (2026-03-30) +-------------------- + +- Look for pgpass file in ~/.pgpass instead of ~/.postgresql/pgpass ([#1300]). + +- Don't clear password if directly set on pq.Config ([#1302]). + +[#1300]: https://github.com/lib/pq/pull/1300 +[#1302]: https://github.com/lib/pq/pull/1302 + +v1.12.0 (2026-03-18) +-------------------- + +- The next release may change the default sslmode from `require` to `prefer`. + See [#1271] for details. + +- `CopyIn()` and `CopyInToSchema()` have been marked as deprecated. These are + simple query builders and not needed for `COPY [..] FROM STDIN` support (which + is *not* deprecated). ([#1279]) + + // Old + tx.Prepare(CopyIn("temp", "num", "text", "blob", "nothing")) + + // Replacement + tx.Prepare(`copy temp (num, text, blob, nothing) from stdin`) + +### Features + +- Support protocol 3.2, and the `min_protocol_version` and + `max_protocol_version` DSN parameters ([#1258]). + +- Support `sslmode=prefer` and `sslmode=allow` ([#1270]). + +- Support `ssl_min_protocol_version` and `ssl_max_protocol_version` ([#1277]). + +- Support connection service file to load connection details ([#1285]). + +- Support `sslrootcert=system` and use `~/.postgresql/root.crt` as the default + value of sslrootcert ([#1280], [#1281]). + +- Add a new `pqerror` package with PostgreSQL error codes ([#1275]). + + For example, to test if an error is a UNIQUE constraint violation: + + if pqErr, ok := errors.AsType[*pq.Error](err); ok && pqErr.Code == pqerror.UniqueViolation { + log.Fatalf("email %q already exsts", email) + } + + To make this a bit more convenient, it also adds a `pq.As()` function: + + pqErr := pq.As(err, pqerror.UniqueViolation) + if pqErr != nil { + log.Fatalf("email %q already exsts", email) + } + +### Fixes + +- Fix SSL key permission check to allow modes stricter than 0600/0640#1265 ([#1265]). + +- Fix Hstore to work with binary parameters ([#1278]). + +- Clearer error when starting a new query while pq is still processing another + query ([#1272]). + +- Send intermediate CAs with client certificates, so they can be signed by an + intermediate CA ([#1267]). + +- Use `time.UTC` for UTC aliases such as `Etc/UTC` ([#1282]). + +[#1258]: https://github.com/lib/pq/pull/1258 +[#1265]: https://github.com/lib/pq/pull/1265 +[#1267]: https://github.com/lib/pq/pull/1267 +[#1270]: https://github.com/lib/pq/pull/1270 +[#1271]: https://github.com/lib/pq/pull/1271 +[#1272]: https://github.com/lib/pq/pull/1272 +[#1275]: https://github.com/lib/pq/pull/1275 +[#1277]: https://github.com/lib/pq/pull/1277 +[#1278]: https://github.com/lib/pq/pull/1278 +[#1279]: https://github.com/lib/pq/pull/1279 +[#1280]: https://github.com/lib/pq/pull/1280 +[#1281]: https://github.com/lib/pq/pull/1281 +[#1282]: https://github.com/lib/pq/pull/1282 +[#1283]: https://github.com/lib/pq/pull/1283 +[#1285]: https://github.com/lib/pq/pull/1285 + +v1.11.2 (2026-02-10) -------------------- This fixes two regressions: @@ -12,7 +117,7 @@ This fixes two regressions: [#1260]: https://github.com/lib/pq/pull/1260 [#1261]: https://github.com/lib/pq/pull/1261 -v1.11.1 (2025-01-29) +v1.11.1 (2026-01-29) -------------------- This fixes two regressions present in the v1.11.0 release: @@ -24,7 +129,7 @@ This fixes two regressions present in the v1.11.0 release: [#1252]: https://github.com/lib/pq/pull/1252 [#1253]: https://github.com/lib/pq/pull/1253 -v1.11.0 (2025-01-28) +v1.11.0 (2026-01-28) -------------------- This version of pq requires Go 1.21 or newer. @@ -108,6 +213,8 @@ newer. Previously PostgreSQL 8.4 and newer were supported. - Handle ErrorResponse in readReadyForQuery and return proper error ([#1136]). +- Detect COPY even if the query starts with whitespace or comments ([#1198]). + - CopyIn() and CopyInSchema() now work if the list of columns is empty, in which case it will copy all columns ([#1239]). @@ -133,6 +240,7 @@ newer. Previously PostgreSQL 8.4 and newer were supported. [#1180]: https://github.com/lib/pq/pull/1180 [#1184]: https://github.com/lib/pq/pull/1184 [#1188]: https://github.com/lib/pq/pull/1188 +[#1198]: https://github.com/lib/pq/pull/1198 [#1211]: https://github.com/lib/pq/pull/1211 [#1212]: https://github.com/lib/pq/pull/1212 [#1214]: https://github.com/lib/pq/pull/1214 diff --git a/vendor/github.com/lib/pq/README.md b/vendor/github.com/lib/pq/README.md index 7abcf724..159b8672 100644 --- a/vendor/github.com/lib/pq/README.md +++ b/vendor/github.com/lib/pq/README.md @@ -1,33 +1,252 @@ pq is a Go PostgreSQL driver for database/sql. All [maintained versions of PostgreSQL] are supported. Older versions may work, -but this is not tested. +but this is not tested. [API docs]. -API docs: https://pkg.go.dev/github.com/lib/pq +[maintained versions of PostgreSQL]: https://www.postgresql.org/support/versioning +[API docs]: https://pkg.go.dev/github.com/lib/pq -Install with: +Connecting +---------- +Use the `postgres` driver name in the `sql.Open()` call: - go get github.com/lib/pq@latest +```go +package main -[maintained versions of PostgreSQL]: https://www.postgresql.org/support/versioning +import ( + "database/sql" + "log" + + _ "github.com/lib/pq" // To register the driver. +) + +func main() { + // Or as URL: postgresql://localhost/pqgo + db, err := sql.Open("postgres", "host=localhost dbname=pqgo") + if err != nil { + log.Fatal(err) + } + defer db.Close() + + // db.Open() only creates a connection pool, and doesn't actually establish + // a connection. To ensure the connection works you need to do *something* + // with a connection. + err = db.Ping() + if err != nil { + log.Fatal(err) + } +} +``` + +You can also use the `pq.Config` struct: + +```go +cfg := pq.Config{ + Host: "localhost", + Port: 5432, + User: "pqgo", +} +// Or: create a new Config from the defaults, environment, and DSN. +// cfg, err := pq.NewConfig("host=postgres dbname=pqgo") +// if err != nil { +// log.Fatal(err) +// } + +c, err := pq.NewConnectorConfig(cfg) +if err != nil { + log.Fatal(err) +} + +// Create connection pool. +db := sql.OpenDB(c) +defer db.Close() + +// Make sure it works. +err = db.Ping() +if err != nil { + log.Fatal(err) +} +``` + +The DSN is identical to PostgreSQL's libpq; most parameters are supported and +should behave identical. Both key=value and postgres:// URL-style connection +strings are supported. See the doc comments on the [Config struct] for the full +list and documentation. + +The most notable difference is that you can use any [run-time parameter] such as +`search_path` or `work_mem` in the connection string. This is different from +libpq, which uses the `options` parameter for this (which also works in pq). + +For example: + + sql.Open("postgres", "dbname=pqgo work_mem=100kB search_path=xyz") + +The libpq way (which also works in pq) is to use `options='-c k=v'` like so: + + sql.Open("postgres", "dbname=pqgo options='-c work_mem=100kB -c search_path=xyz'") + +[Config struct]: https://pkg.go.dev/github.com/lib/pq#Config +[run-time parameter]: http://www.postgresql.org/docs/current/static/runtime-config.html + +Errors +------ +Errors from PostgreSQL are returned as [pq.Error]; [pq.As] can be used to +convert an error to `pq.Error`: + +```go +pqErr := pq.As(err, pqerror.UniqueViolation) +if pqErr != nil { + return fmt.Errorf("email %q already exsts", email) +} +``` + +the Error() string contains the error message and code: + + pq: duplicate key value violates unique constraint "users_lower_idx" (23505) + +The ErrorWithDetail() string also contains the DETAIL and CONTEXT fields, if +present. For example for the above error this helpfully contains the duplicate +value: + + ERROR: duplicate key value violates unique constraint "users_lower_idx" (23505) + DETAIL: Key (lower(email))=(a@example.com) already exists. + +Or for an invalid syntax error like this: + + pq: invalid input syntax for type json (22P02) + +It contains the context where this error occurred: + + ERROR: invalid input syntax for type json (22P02) + DETAIL: Token "asd" is invalid. + CONTEXT: line 5, column 8: + + 3 | 'def', + 4 | 123, + 5 | 'foo', 'asd'::jsonb + ^ + +[pq.Error]: https://pkg.go.dev/github.com/lib/pq#Error +[pq.As]: https://pkg.go.dev/github.com/lib/pq#As + +PostgreSQL features +------------------- + +### Authentication +pq supports PASSWORD, MD5, and SCRAM-SHA256 authentication out of the box. If +you need GSS/Kerberos authentication you'll need to import the `auth/kerberos` +module: package: + + import "github.com/lib/pq/auth/kerberos" + + func init() { + pq.RegisterGSSProvider(func() (pq.Gss, error) { return kerberos.NewGSS() }) + } + +This is in a separate module so that users who don't need Kerberos (i.e. most +users) don't have to add unnecessary dependencies. + +Reading a [password file] (pgpass) is also supported. + +[password file]: http://www.postgresql.org/docs/current/static/libpq-pgpass.html + +### Bulk imports with `COPY [..] FROM STDIN` +You can perform bulk imports by preparing a `COPY [..] FROM STDIN` statement +inside a transaction. The returned `sql.Stmt` can then be repeatedly executed to +copy data. After all data has been processed you should call Exec() once with no +arguments to flush all buffered data. + +[Further documentation][copy-doc] and [example][copy-ex]. + +[copy-doc]: https://pkg.go.dev/github.com/lib/pq#hdr-Bulk_imports +[copy-ex]: https://pkg.go.dev/github.com/lib/pq#example-package-CopyFromStdin + +### NOTICE errors +PostgreSQL has "NOTICE" errors for informational messages. For example from the +psql CLI: + + pqgo=# drop table if exists doesnotexist; + NOTICE: table "doesnotexist" does not exist, skipping + DROP TABLE + +These errors are not returned because they're not really errors but, well, +notices. + +You can register a callback for these notices with [ConnectorWithNoticeHandler] + +[ConnectorWithNoticeHandler]: https://pkg.go.dev/github.com/lib/pq#ConnectorWithNoticeHandler + +### Using `LISTEN`/`NOTIFY` +With [pq.Listener] notifications are send on a channel. For example: + +```go +l := pq.NewListener("dbname=pqgo", time.Second, time.Minute, nil) +defer l.Close() + +err := l.Listen("coconut") +if err != nil { + log.Fatal(err) +} + +for { + n := <-l.Notify: + if n == nil { + fmt.Println("nil notify: closing Listener") + return + } + fmt.Printf("notification on %q with data %q\n", n.Channel, n.Extra) +} +``` + +And you'll get a notification for every `notify coconut`. + +See the API docs for a more complete example. + +[pq.Listener]: https://pkg.go.dev/github.com/lib/pq#Listener + + +Caveats +------- +### LastInsertId +sql.Result.LastInsertId() is not supported, because the PostgreSQL protocol does +not have this facility. Use `insert [..] returning [cols]` instead: + + db.QueryRow(`insert into tbl [..] returning id_col`).Scan(..) + // Or multiple rows: + db.Query(`insert into tbl (row1), (row2) returning id_col`) + +This will also work in SQLite and MariaDB with the same syntax. MS-SQL and +Oracle have a similar facility (with a different syntax). + +### timestamps +For timestamps with a timezone (`timestamptz`/`timestamp with time zone`), pq +uses the timezone configured in the server, as libpq. You can change this with +`timestamp=[..]` in the connection string. It's generally recommended to use +UTC. + +For timestamps without a timezone (`timestamp`/`timestamp without time zone`), +pq always uses `time.FixedZone("", 0)` as the timezone; the timestamp parameter +has no effect here. This is intentionally not equal to time.UTC, as it's not a +UTC time: it's a time without a timezone. Go's time package does not really +support this concept, so this is the best we can do This will print `+0000` +twice (e.g. `2026-03-15 17:45:47 +0000 +0000`; having a clearer name would have +been better, but is not compatible change). See [this comment][ts] for some +options on how to deal with this. + +Also see the examples for [timestamptz] and [timestamp] + +[ts]: https://github.com/lib/pq/issues/329#issuecomment-4025733506 +[timestamptz]: https://pkg.go.dev/github.com/lib/pq#example-package-TimestampWithTimezone +[timestamp]: https://pkg.go.dev/github.com/lib/pq#example-package-TimestampWithoutTimezone + +### bytea with copy +All `[]byte` parameters are encoded as `bytea` when using `copy [..] from +stdin`, which may result in errors for e.g. `jsonb` columns. The solution is to +use a string instead of []byte. See #1023 -Features --------- -* SSL -* Handles bad connections for `database/sql` -* Scan `time.Time` correctly (i.e. `timestamp[tz]`, `time[tz]`, `date`) -* Scan binary blobs correctly (i.e. `bytea`) -* Package for `hstore` support -* COPY FROM support -* pq.ParseURL for converting urls to connection strings for sql.Open. -* Many libpq compatible environment variables -* Unix socket support -* Notifications: `LISTEN`/`NOTIFY` -* pgpass support -* GSS (Kerberos) auth - -Running Tests -------------- +Development +----------- +### Running tests Tests need to be run against a PostgreSQL database; you can use Docker compose to start one: @@ -36,12 +255,12 @@ to start one: This starts the latest PostgreSQL; use `docker compose up -d pg«v»` to start a different version. -In addition, your `/etc/hosts` currently needs an entry: +In addition, your `/etc/hosts` needs an entry: 127.0.0.1 postgres postgres-invalid Or you can use any other PostgreSQL instance; see -`testdata/init/docker-entrypoint-initdb.d` for the required setup. You can use +`testdata/postgres/docker-entrypoint-initdb.d` for the required setup. You can use the standard `PG*` environment variables to control the connection details; it uses the following defaults: @@ -66,6 +285,7 @@ and pgpool with: docker compose up -d pgpool pg18 PGPORT=7432 go test ./... +### Protocol debug output You can use PQGO_DEBUG=1 to make the driver print the communication with PostgreSQL to stderr; this works anywhere (test or applications) and can be useful to debug protocol problems. diff --git a/vendor/github.com/lib/pq/array.go b/vendor/github.com/lib/pq/array.go index 910f335e..4a532868 100644 --- a/vendor/github.com/lib/pq/array.go +++ b/vendor/github.com/lib/pq/array.go @@ -388,7 +388,7 @@ FoundType: func (a GenericArray) Scan(src any) error { dpv := reflect.ValueOf(a.A) switch { - case dpv.Kind() != reflect.Ptr: + case dpv.Kind() != reflect.Pointer: return fmt.Errorf("pq: destination %T is not a pointer to array or slice", a.A) case dpv.IsNil(): return fmt.Errorf("pq: destination %T is nil", a.A) @@ -486,7 +486,7 @@ func (a GenericArray) Value() (driver.Value, error) { } case reflect.Array: default: - return nil, fmt.Errorf("pq: Unable to convert %T to array", a.A) + return nil, fmt.Errorf("pq: unable to convert %T to array", a.A) } if n := rv.Len(); n > 0 { @@ -732,7 +732,7 @@ func appendArrayElement(b []byte, rv reflect.Value) ([]byte, string, error) { var del = "," var err error - var iv any = rv.Interface() + var iv = rv.Interface() if ad, ok := iv.(ArrayDelimiter); ok { del = ad.ArrayDelimiter() diff --git a/vendor/github.com/lib/pq/as.go b/vendor/github.com/lib/pq/as.go new file mode 100644 index 00000000..1ea0ee5b --- /dev/null +++ b/vendor/github.com/lib/pq/as.go @@ -0,0 +1,26 @@ +//go:build !go1.26 + +package pq + +import ( + "errors" + "slices" +) + +// As asserts that the given error is [pq.Error] and returns it, returning nil +// if it's not a pq.Error. +// +// It will return nil if the pq.Error is not one of the given error codes. If no +// codes are given it will always return the Error. +// +// This is safe to call with a nil error. +func As(err error, codes ...ErrorCode) *Error { + if err == nil { // Not strictly needed, but prevents alloc for nil errors. + return nil + } + pqErr := new(Error) + if errors.As(err, &pqErr) && (len(codes) == 0 || slices.Contains(codes, pqErr.Code)) { + return pqErr + } + return nil +} diff --git a/vendor/github.com/lib/pq/as_go126.go b/vendor/github.com/lib/pq/as_go126.go new file mode 100644 index 00000000..18ffbc37 --- /dev/null +++ b/vendor/github.com/lib/pq/as_go126.go @@ -0,0 +1,23 @@ +//go:build go1.26 + +package pq + +import ( + "errors" + "github.com/lib/pq/pqerror" + "slices" +) + +// As asserts that the given error is [pq.Error] and returns it, returning nil +// if it's not a pq.Error. +// +// It will return nil if the pq.Error is not one of the given error codes. If no +// codes are given it will always return the Error. +// +// This is safe to call with a nil error. +func As(err error, codes ...pqerror.Code) *Error { + if pqErr, ok := errors.AsType[*Error](err); ok && (len(codes) == 0 || slices.Contains(codes, pqErr.Code)) { + return pqErr + } + return nil +} diff --git a/vendor/github.com/lib/pq/compose.yaml b/vendor/github.com/lib/pq/compose.yaml index 1027d4de..0092b7e3 100644 --- a/vendor/github.com/lib/pq/compose.yaml +++ b/vendor/github.com/lib/pq/compose.yaml @@ -3,10 +3,10 @@ name: 'pqgo' services: pgbouncer: profiles: ['pgbouncer'] - image: 'cleanstart/pgbouncer:1.24' + image: 'cleanstart/pgbouncer:latest' ports: ['127.0.0.1:6432:6432'] command: ['/init/pgbouncer.ini'] - volumes: ['./testdata/init:/init'] + volumes: ['./testdata/pgbouncer:/init', './testdata/ssl:/ssl'] environment: 'PGBOUNCER_DATABASE': 'pqgo' @@ -14,63 +14,75 @@ services: profiles: ['pgpool'] image: 'pgpool/pgpool:4.4.3' ports: ['127.0.0.1:7432:7432'] - volumes: ['./testdata/init:/init'] - entrypoint: '/init/entry-pgpool.sh' + volumes: ['./testdata/pgpool:/init', './testdata/ssl:/ssl'] + entrypoint: '/init/entry.sh' environment: 'PGPOOL_PARAMS_PORT': '7432' 'PGPOOL_PARAMS_BACKEND_HOSTNAME0': 'pg18' + cockroach: + profiles: ['cockroach'] + image: 'cockroachdb/cockroach:latest-v26.1' + ports: ['127.0.0.1:26257:26257'] + volumes: ['./testdata/cockroach:/docker-entrypoint-initdb.d', './testdata/ssl:/ssl'] + command: ['start-single-node', '--accept-sql-without-tls', '--certs-dir=/ssl2'] + healthcheck: {test: ['CMD-SHELL', '/cockroach/cockroach node status --insecure --user=pqgo'], start_period: '30s', start_interval: '1s'} + pg18: - image: 'postgres:18' - ports: ['127.0.0.1:5432:5432'] - entrypoint: '/init/entry.sh' - volumes: ['./testdata/init:/init'] - shm_size: '128mb' + image: 'postgres:18' + ports: ['127.0.0.1:5432:5432'] + entrypoint: '/init/entry.sh' + volumes: ['./testdata/postgres:/init', './testdata/ssl:/ssl'] + shm_size: '128mb' + healthcheck: {test: ['CMD-SHELL', 'pg_isready -U pqgo -d pqgo'], start_period: '30s', start_interval: '1s'} environment: 'POSTGRES_DATABASE': 'pqgo' 'POSTGRES_USER': 'pqgo' 'POSTGRES_PASSWORD': 'unused' pg17: - profiles: ['pg17'] - image: 'postgres:17' - ports: ['127.0.0.1:5432:5432'] - entrypoint: '/init/entry.sh' - volumes: ['./testdata/init:/init'] - shm_size: '128mb' - user: 'root' + profiles: ['pg17'] + image: 'postgres:17' + ports: ['127.0.0.1:5432:5432'] + entrypoint: '/init/entry.sh' + volumes: ['./testdata/postgres:/init', './testdata/ssl:/ssl'] + shm_size: '128mb' + healthcheck: {test: ['CMD-SHELL', 'pg_isready -U pqgo -d pqgo'], start_period: '30s', start_interval: '1s'} environment: 'POSTGRES_DATABASE': 'pqgo' 'POSTGRES_USER': 'pqgo' 'POSTGRES_PASSWORD': 'unused' pg16: - profiles: ['pg16'] - image: 'postgres:16' - ports: ['127.0.0.1:5432:5432'] - entrypoint: '/init/entry.sh' - volumes: ['./testdata/init:/init'] - shm_size: '128mb' + profiles: ['pg16'] + image: 'postgres:16' + ports: ['127.0.0.1:5432:5432'] + entrypoint: '/init/entry.sh' + volumes: ['./testdata/postgres:/init', './testdata/ssl:/ssl'] + shm_size: '128mb' + healthcheck: {test: ['CMD-SHELL', 'pg_isready -U pqgo -d pqgo'], start_period: '30s', start_interval: '1s'} environment: 'POSTGRES_DATABASE': 'pqgo' 'POSTGRES_USER': 'pqgo' 'POSTGRES_PASSWORD': 'unused' pg15: - profiles: ['pg15'] - image: 'postgres:15' - ports: ['127.0.0.1:5432:5432'] - entrypoint: '/init/entry.sh' - volumes: ['./testdata/init:/init'] - shm_size: '128mb' + profiles: ['pg15'] + image: 'postgres:15' + ports: ['127.0.0.1:5432:5432'] + entrypoint: '/init/entry.sh' + volumes: ['./testdata/postgres:/init', './testdata/ssl:/ssl'] + shm_size: '128mb' + healthcheck: {test: ['CMD-SHELL', 'pg_isready -U pqgo -d pqgo'], start_period: '30s', start_interval: '1s'} environment: 'POSTGRES_DATABASE': 'pqgo' 'POSTGRES_USER': 'pqgo' 'POSTGRES_PASSWORD': 'unused' pg14: - profiles: ['pg14'] - image: 'postgres:14' - ports: ['127.0.0.1:5432:5432'] - entrypoint: '/init/entry.sh' - volumes: ['./testdata/init:/init'] - shm_size: '128mb' + profiles: ['pg14'] + image: 'postgres:14' + ports: ['127.0.0.1:5432:5432'] + entrypoint: '/init/entry.sh' + volumes: ['./testdata/postgres:/init', './testdata/ssl:/ssl'] + shm_size: '128mb' + healthcheck: {test: ['CMD-SHELL', 'pg_isready -U pqgo -d pqgo'], start_period: '30s', start_interval: '1s'} environment: 'POSTGRES_DATABASE': 'pqgo' 'POSTGRES_USER': 'pqgo' diff --git a/vendor/github.com/lib/pq/conn.go b/vendor/github.com/lib/pq/conn.go index 9e69b473..688329cd 100644 --- a/vendor/github.com/lib/pq/conn.go +++ b/vendor/github.com/lib/pq/conn.go @@ -18,6 +18,7 @@ import ( "strconv" "strings" "sync" + "sync/atomic" "time" "github.com/lib/pq/internal/pgpass" @@ -37,6 +38,7 @@ var ( ErrSSLKeyUnknownOwnership = pqutil.ErrSSLKeyUnknownOwnership ErrSSLKeyHasWorldPermissions = pqutil.ErrSSLKeyHasWorldPermissions + errQueryInProgress = errors.New("pq: there is already a query being processed on this connection") errUnexpectedReady = errors.New("unexpected ReadyForQuery") errNoRowsAffected = errors.New("no RowsAffected available after the empty statement") errNoLastInsertID = errors.New("no LastInsertId available after the empty statement") @@ -169,16 +171,17 @@ type conn struct { saveMessageType proto.ResponseCode saveMessageBuffer []byte - // If an error is set, this connection is bad and all public-facing + // If an error is set this connection is bad and all public-facing // functions should return the appropriate error by calling get() // (ErrBadConn) or getForNext(). err syncErr - processID, secretKey int // Cancellation key data for use with CancelRequest messages. - inCopy bool // If true this connection is in the middle of a COPY - noticeHandler func(*Error) // If not nil, notices will be synchronously sent here - notificationHandler func(*Notification) // If not nil, notifications will be synchronously sent here - gss GSS // GSSAPI context + secretKey []byte // Cancellation key for CancelRequest messages. + pid int // Cancellation PID. + inProgress atomic.Bool // This connection is in the middle of a processing a request. + noticeHandler func(*Error) // If not nil, notices will be synchronously sent here + notificationHandler func(*Notification) // If not nil, notifications will be synchronously sent here + gss GSS // GSSAPI context } type syncErr struct { @@ -242,13 +245,13 @@ func DialOpen(d Dialer, dsn string) (_ driver.Conn, err error) { func (c *Connector) open(ctx context.Context) (*conn, error) { tsa := c.cfg.TargetSessionAttrs -restart: +restartAll: var ( errs []error app = func(err error, cfg Config) bool { if err != nil { if debugProto { - fmt.Println("CONNECT (error)", err) + fmt.Fprintln(os.Stderr, "CONNECT (error)", err) } errs = append(errs, fmt.Errorf("connecting to %s:%d: %w", cfg.Host, cfg.Port, err)) } @@ -256,13 +259,16 @@ restart: } ) for _, cfg := range c.cfg.hosts() { + mode := cfg.SSLMode + restartHost: if debugProto { - fmt.Println("CONNECT ", cfg.string()) + fmt.Fprintln(os.Stderr, "CONNECT ", cfg.string()) } + cfg.SSLMode = mode cn := &conn{cfg: cfg, dialer: c.dialer} cn.cfg.Password = pgpass.PasswordFromPgpass(cn.cfg.Passfile, cn.cfg.User, cn.cfg.Password, - cn.cfg.Host, strconv.Itoa(int(cn.cfg.Port)), cn.cfg.Database, cn.cfg.isset("password")) + cn.cfg.Host, strconv.Itoa(int(cn.cfg.Port)), cn.cfg.Database) var err error cn.c, err = dial(ctx, c.dialer, cn.cfg) @@ -270,7 +276,11 @@ restart: continue } - err = cn.ssl(cn.cfg) + err = cn.ssl(cn.cfg, mode) + if err != nil && mode == SSLModePrefer { + mode = SSLModeDisable + goto restartHost + } if app(err, cfg) { if cn.c != nil { _ = cn.c.Close() @@ -280,6 +290,10 @@ restart: cn.buf = bufio.NewReader(cn.c) err = cn.startup(cn.cfg) + if err != nil && mode == SSLModeAllow { + mode = SSLModeRequire + goto restartHost + } if app(err, cfg) { _ = cn.c.Close() continue @@ -307,7 +321,7 @@ restart: // ran out of hosts so none are on standby. Clear the setting and try again. if c.cfg.TargetSessionAttrs == TargetSessionAttrsPreferStandby { tsa = TargetSessionAttrsAny - goto restart + goto restartAll } if len(c.cfg.Multi) == 0 { @@ -567,8 +581,8 @@ func (cn *conn) gname() string { func (cn *conn) simpleExec(q string) (res driver.Result, commandTag string, resErr error) { if debugProto { - fmt.Fprintf(os.Stderr, " START conn.simpleExec\n") - defer fmt.Fprintf(os.Stderr, " END conn.simpleExec\n") + fmt.Fprintln(os.Stderr, " START conn.simpleExec") + defer fmt.Fprintln(os.Stderr, " END conn.simpleExec") } b := cn.writeBuf(proto.Query) @@ -610,8 +624,8 @@ func (cn *conn) simpleExec(q string) (res driver.Result, commandTag string, resE func (cn *conn) simpleQuery(q string) (*rows, error) { if debugProto { - fmt.Fprintf(os.Stderr, " START conn.simpleQuery\n") - defer fmt.Fprintf(os.Stderr, " END conn.simpleQuery\n") + fmt.Fprintln(os.Stderr, " START conn.simpleQuery") + defer fmt.Fprintln(os.Stderr, " END conn.simpleQuery") } b := cn.writeBuf(proto.Query) @@ -739,8 +753,8 @@ func decideColumnFormats(colTyps []fieldDesc, forceText bool) (colFmts []format, func (cn *conn) prepareTo(q, stmtName string) (*stmt, error) { if debugProto { - fmt.Fprintf(os.Stderr, " START conn.prepareTo\n") - defer fmt.Fprintf(os.Stderr, " END conn.prepareTo\n") + fmt.Fprintln(os.Stderr, " START conn.prepareTo") + defer fmt.Fprintln(os.Stderr, " END conn.prepareTo") } st := &stmt{cn: cn, name: stmtName} @@ -788,7 +802,7 @@ func (cn *conn) Prepare(q string) (driver.Stmt, error) { if pqsql.StartsWithCopy(q) { s, err := cn.prepareCopyIn(q) if err == nil { - cn.inCopy = true + cn.inProgress.Store(true) } return s, cn.handleError(err, q) } @@ -820,6 +834,14 @@ func toNamedValue(v []driver.Value) []driver.NamedValue { // CheckNamedValue implements [driver.NamedValueChecker]. func (cn *conn) CheckNamedValue(nv *driver.NamedValue) error { + if cn.cfg.BinaryParameters { + if bin, ok := nv.Value.(interface{ BinaryValue() ([]byte, error) }); ok { + var err error + nv.Value, err = bin.BinaryValue() + return err + } + } + // Ignore Valuer, for backward compatibility with pq.Array(). if _, ok := nv.Value.(driver.Valuer); ok { return driver.ErrSkip @@ -830,7 +852,7 @@ func (cn *conn) CheckNamedValue(nv *driver.NamedValue) error { return driver.ErrSkip } t := v.Type() - for t.Kind() == reflect.Ptr { + for t.Kind() == reflect.Pointer { t, v = t.Elem(), v.Elem() } @@ -864,14 +886,14 @@ func (cn *conn) Query(query string, args []driver.Value) (driver.Rows, error) { func (cn *conn) query(query string, args []driver.NamedValue) (*rows, error) { if debugProto { - fmt.Fprintf(os.Stderr, " START conn.query\n") - defer fmt.Fprintf(os.Stderr, " END conn.query\n") + fmt.Fprintln(os.Stderr, " START conn.query") + defer fmt.Fprintln(os.Stderr, " END conn.query") } if err := cn.err.get(); err != nil { return nil, err } - if cn.inCopy { - return nil, errCopyInProgress + if !cn.inProgress.CompareAndSwap(false, true) { + return nil, errQueryInProgress } // Check to see if we can use the "simpleQuery" interface, which is @@ -925,6 +947,9 @@ func (cn *conn) Exec(query string, args []driver.Value) (driver.Result, error) { if err := cn.err.get(); err != nil { return nil, err } + if !cn.inProgress.CompareAndSwap(false, true) { + return nil, errQueryInProgress + } // Check to see if we can use the "simpleExec" interface, which is *much* // faster than going through prepare/exec @@ -998,10 +1023,7 @@ func (cn *conn) send(m *writeBuf) error { func (cn *conn) sendStartupPacket(m *writeBuf) error { if debugProto { w := m.wrap() - fmt.Fprintf(os.Stderr, "CLIENT → %-20s %5d %q\n", - "Startup", - int(binary.BigEndian.Uint32(w[1:5]))-4, - w[5:]) + fmt.Fprintf(os.Stderr, "CLIENT → %-20s %5d %q\n", "Startup", int(binary.BigEndian.Uint32(w[1:5]))-4, w[5:]) } _, err := cn.c.Write((m.wrap())[1:]) return err @@ -1011,8 +1033,7 @@ func (cn *conn) sendStartupPacket(m *writeBuf) error { // should have no payload. This method does not use the scratch buffer. func (cn *conn) sendSimpleMessage(typ proto.RequestCode) error { if debugProto { - fmt.Fprintf(os.Stderr, "CLIENT → %-20s %5d %q\n", - proto.RequestCode(typ), 0, []byte{}) + fmt.Fprintf(os.Stderr, "CLIENT → %-20s %5d %q\n", typ, 0, []byte{}) } _, err := cn.c.Write([]byte{byte(typ), '\x00', '\x00', '\x00', '\x04'}) return err @@ -1055,6 +1076,10 @@ func (cn *conn) recvMessage(r *readBuf) (proto.ResponseCode, error) { t := proto.ResponseCode(x[0]) n := int(binary.BigEndian.Uint32(x[1:])) - 4 + if proto.ResponseCode(t) == proto.ReadyForQuery { + cn.inProgress.Store(false) + } + // When PostgreSQL cannot start a backend (e.g., an external process limit), // it sends plain text like "Ecould not fork new process [..]", which // doesn't use the standard encoding for the Error message. @@ -1149,19 +1174,19 @@ func (cn *conn) recv1() (proto.ResponseCode, *readBuf, error) { return t, r, nil } -func (cn *conn) ssl(cfg Config) error { - upgrade, err := ssl(cfg) +// Don't refer to Config.SSLMode here, as the mode in arguments may be different +// in case of sslmode=allow or prefer. +func (cn *conn) ssl(cfg Config, mode SSLMode) error { + upgrade, err := ssl(cfg, mode) if err != nil { return err } - if upgrade == nil { - // Nothing to do - return nil + return nil // Nothing to do } // Only negotiate the ssl handshake if requested (which is the default). - // sllnegotiation=direct is supported by pg17 and above. + // sslnegotiation=direct is supported by pg17 and above. if cfg.SSLNegotiation != SSLNegotiationDirect { w := cn.writeBuf(0) w.int32(proto.NegotiateSSLCode) @@ -1186,7 +1211,10 @@ func (cn *conn) ssl(cfg Config) error { func (cn *conn) startup(cfg Config) error { w := cn.writeBuf(0) - w.int32(proto.ProtocolVersion30) + // Send maximum protocol version in startup; if the server doesn't support + // this version it responds with NegotiateProtocolVersion and the maximum + // version it supports (and will use). + w.int32(cfg.MaxProtocolVersion.proto()) if cfg.User != "" { w.string("user") @@ -1209,6 +1237,10 @@ func (cn *conn) startup(cfg Config) error { w.string("client_encoding") w.string(cfg.ClientEncoding) } + if cfg.Datestyle != "" { + w.string("datestyle") + w.string(cfg.Datestyle) + } for k, v := range cfg.Runtime { w.string(k) w.string(v) @@ -1226,7 +1258,12 @@ func (cn *conn) startup(cfg Config) error { } switch t { case proto.BackendKeyData: - cn.processBackendKeyData(r) + cn.pid = r.int32() + if len(*r) > 256 { + return fmt.Errorf("pq: cancellation key longer than 256 bytes: %d bytes", len(*r)) + } + cn.secretKey = make([]byte, len(*r)) + copy(cn.secretKey, *r) case proto.ParameterStatus: cn.processParameterStatus(r) case proto.AuthenticationRequest: @@ -1234,6 +1271,12 @@ func (cn *conn) startup(cfg Config) error { if err != nil { return err } + case proto.NegotiateProtocolVersion: + newestMinor := r.int32() + serverVersion := proto.ProtocolVersion30&0xFFFF0000 | newestMinor + if serverVersion < cfg.MinProtocolVersion.proto() { + return fmt.Errorf("pq: protocol version mismatch: min_protocol_version=%s; server supports up to 3.%d", cfg.MinProtocolVersion, newestMinor) + } case proto.ReadyForQuery: cn.processReadyForQuery(r) return nil @@ -1276,13 +1319,13 @@ func (cn *conn) auth(r *readBuf, cfg Config) error { } var token []byte - if cfg.isset("krbspn") { - // Use the supplied SPN if provided.. + if cfg.KrbSpn != "" { + // Use the supplied SPN if provided. token, err = cli.GetInitTokenFromSpn(cfg.KrbSpn) } else { - // Allow the kerberos service name to be overridden + // Allow the kerberos service name to be overridden. service := "postgres" - if cfg.isset("krbsrvname") { + if cfg.KrbSrvname != "" { service = cfg.KrbSrvname } token, err = cli.GetInitToken(cfg.Host, service) @@ -1443,7 +1486,7 @@ func md5s(s string) string { func (cn *conn) sendBinaryParameters(b *writeBuf, args []driver.NamedValue) error { // Do one pass over the parameters to see if we're going to send any of them - // over in binary. If we are, create a paramFormats array at the same time. + // over in binary. If we are, create a paramFormats array at the same time. var paramFormats []int for i, x := range args { _, ok := x.Value.([]byte) @@ -1522,10 +1565,15 @@ func (cn *conn) processParameterStatus(r *readBuf) { cn.parameterStatus.serverVersion = major1*10000 + major2*100 } case "TimeZone": - var err error - cn.parameterStatus.currentLocation, err = time.LoadLocation(r.string()) - if err != nil { - cn.parameterStatus.currentLocation = nil + switch tz := r.string(); tz { + case "UTC", "Etc/UTC", "Etc/Universal", "Etc/Zulu", "Etc/UCT": + cn.parameterStatus.currentLocation = time.UTC + default: + var err error + cn.parameterStatus.currentLocation, err = time.LoadLocation(tz) + if err != nil { + cn.parameterStatus.currentLocation = nil + } } // Use sql.NullBool so we can distinguish between false and not sent. If // it's not sent we use a query to get the value – I don't know when these @@ -1566,11 +1614,6 @@ func (cn *conn) readReadyForQuery() error { } } -func (cn *conn) processBackendKeyData(r *readBuf) { - cn.processID = r.int32() - cn.secretKey = r.int32() -} - func (cn *conn) readParseResponse() error { t, r, err := cn.recv1() if err != nil { diff --git a/vendor/github.com/lib/pq/conn_go18.go b/vendor/github.com/lib/pq/conn_go18.go index 23a10aee..16de38eb 100644 --- a/vendor/github.com/lib/pq/conn_go18.go +++ b/vendor/github.com/lib/pq/conn_go18.go @@ -86,7 +86,7 @@ func (cn *conn) Ping(ctx context.Context) error { } rows, err := cn.simpleQuery(";") if err != nil { - return driver.ErrBadConn // https://golang.org/pkg/database/sql/driver/#Pinger + return driver.ErrBadConn } _ = rows.Close() return nil @@ -144,15 +144,15 @@ func (cn *conn) cancel(ctx context.Context) error { defer func() { _ = c.Close() }() cn2 := conn{c: c} - err = cn2.ssl(cfg) + err = cn2.ssl(cfg, cfg.SSLMode) if err != nil { return err } w := cn2.writeBuf(0) w.int32(proto.CancelRequestCode) - w.int32(cn.processID) - w.int32(cn.secretKey) + w.int32(cn.pid) + w.bytes(cn.secretKey) if err := cn2.sendStartupPacket(w); err != nil { return err } diff --git a/vendor/github.com/lib/pq/connector.go b/vendor/github.com/lib/pq/connector.go index 1827fdbd..a2a8fb28 100644 --- a/vendor/github.com/lib/pq/connector.go +++ b/vendor/github.com/lib/pq/connector.go @@ -2,6 +2,7 @@ package pq import ( "context" + "crypto/tls" "database/sql/driver" "fmt" "math/rand" @@ -18,7 +19,9 @@ import ( "time" "unicode" + "github.com/lib/pq/internal/pgservice" "github.com/lib/pq/internal/pqutil" + "github.com/lib/pq/internal/proto" ) type ( @@ -33,26 +36,48 @@ type ( // LoadBalanceHosts is a load_balance_hosts setting. LoadBalanceHosts string + + // ProtocolVersion is a min_protocol_version or max_protocol_version + // setting. + ProtocolVersion string + + // SSLProtocolVersion is a ssl_min_protocol_version or + // ssl_max_protocol_version setting. + SSLProtocolVersion string ) // Values for [SSLMode] that pq supports. const ( - // disable: No SSL + // No SSL SSLModeDisable = SSLMode("disable") - // require: require SSL, but skip verification. + // First try a non-SSL connection and if that fails try an SSL connection. + SSLModeAllow = SSLMode("allow") + + // First try an SSL connection and if that fails try a non-SSL connection. + SSLModePrefer = SSLMode("prefer") + + // Require SSL, but skip verification. This is the default. SSLModeRequire = SSLMode("require") - // verify-ca: require SSL and verify that the certificate was signed by a - // trusted CA. + // Require SSL and verify that the certificate was signed by a trusted CA. SSLModeVerifyCA = SSLMode("verify-ca") - // verify-full: require SSK and verify that the certificate was signed by a - // trusted CA and the server host name matches the one in the certificate. + // Require SSL and verify that the certificate was signed by a trusted CA + // and the server host name matches the one in the certificate. SSLModeVerifyFull = SSLMode("verify-full") ) -var sslModes = []SSLMode{SSLModeDisable, SSLModeRequire, SSLModeVerifyFull, SSLModeVerifyCA} +var sslModes = []SSLMode{SSLModeDisable, SSLModeAllow, SSLModePrefer, SSLModeRequire, + SSLModeVerifyFull, SSLModeVerifyCA} + +func (s SSLMode) useSSL() bool { + switch s { + case SSLModePrefer, SSLModeRequire, SSLModeVerifyCA, SSLModeVerifyFull: + return true + } + return false +} // Values for [SSLNegotiation] that pq supports. const ( @@ -110,6 +135,49 @@ const ( var loadBalanceHosts = []LoadBalanceHosts{LoadBalanceHostsDisable, LoadBalanceHostsRandom} +// Values for [ProtocolVersion] that pq supports. +const ( + // ProtocolVersion30 is the default protocol version, supported in + // PostgreSQL 3.0 and newer. + ProtocolVersion30 = ProtocolVersion("3.0") + + // ProtocolVersion32 uses a longer secret key length for query cancellation, + // supported in PostgreSQL 18 and newer. + ProtocolVersion32 = ProtocolVersion("3.2") + + // ProtocolVersionLatest is the latest protocol version that pq supports + // (which may not be supported by the server). + ProtocolVersionLatest = ProtocolVersion("latest") +) + +var protocolVersions = []ProtocolVersion{ProtocolVersion30, ProtocolVersion32, ProtocolVersionLatest} + +// Values for [SSLProtocolVersion] that pq supports. +const ( + SSLProtocolVersionTLS10 = SSLProtocolVersion("TLSv1.0") + SSLProtocolVersionTLS11 = SSLProtocolVersion("TLSv1.1") + SSLProtocolVersionTLS12 = SSLProtocolVersion("TLSv1.2") + SSLProtocolVersionTLS13 = SSLProtocolVersion("TLSv1.3") +) + +var sslProtocolVersions = []SSLProtocolVersion{SSLProtocolVersionTLS10, SSLProtocolVersionTLS11, + SSLProtocolVersionTLS12, SSLProtocolVersionTLS13} + +func (s SSLProtocolVersion) tlsconf() uint16 { + switch s { + case SSLProtocolVersionTLS10: + return tls.VersionTLS10 + case SSLProtocolVersionTLS11: + return tls.VersionTLS11 + case SSLProtocolVersionTLS12: + return tls.VersionTLS12 + case SSLProtocolVersionTLS13: + return tls.VersionTLS13 + default: + return 0 + } +} + // Connector represents a fixed configuration for the pq driver with a given // dsn. Connector satisfies the [database/sql/driver.Connector] interface and // can be used to create any number of DB Conn's via [sql.OpenDB]. @@ -148,6 +216,15 @@ func (c *Connector) Dialer(dialer Dialer) { c.dialer = dialer } // Driver returns the underlying driver of this Connector. func (c *Connector) Driver() driver.Driver { return &Driver{} } +func (p ProtocolVersion) proto() int { + switch p { + default: + return proto.ProtocolVersion30 + case ProtocolVersion32, ProtocolVersionLatest: + return proto.ProtocolVersion32 + } +} + // Config holds options pq supports when connecting to PostgreSQL. // // The postgres struct tag is used for the value from the DSN (e.g. @@ -234,19 +311,44 @@ type Config struct { // When set to "direct" it will use SSL without negotiation (PostgreSQL ≥17 only). SSLNegotiation SSLNegotiation `postgres:"sslnegotiation" env:"PGSSLNEGOTIATION"` - // Cert file location. The file must contain PEM encoded data. + // Path to client SSL certificate. The file must contain PEM encoded data. + // + // Defaults to ~/.postgresql/postgresql.crt SSLCert string `postgres:"sslcert" env:"PGSSLCERT"` - // Key file location. The file must contain PEM encoded data. + // Path to secret key for sslcert. The file must contain PEM encoded data. + // + // Defaults to ~/.postgresql/postgresql.key SSLKey string `postgres:"sslkey" env:"PGSSLKEY"` - // The location of the root certificate file. The file must contain PEM encoded data. + // Path to root certificate. The file must contain PEM encoded data. + // + // The special value "system" can be used to load the system's root + // certificates ([x509.SystemCertPool]). This will change the default + // sslmode to verify-full and issue an error if a lower setting is used – as + // anyone can register a valid certificate hostname verification becomes + // essential. + // + // Defaults to ~/.postgresql/root.crt. SSLRootCert string `postgres:"sslrootcert" env:"PGSSLROOTCERT"` // By default SNI is on, any value which is not starting with "1" disables // SNI. SSLSNI bool `postgres:"sslsni" env:"PGSSLSNI"` + // Minimum SSL/TLS protocol version to allow for the connection. + // + // The default is determined by [tls.Config.MinVersion], which is TLSv1.2 at + // the time of writing. + SSLMinProtocolVersion SSLProtocolVersion `postgres:"ssl_min_protocol_version" env:"SSLPGMINPROTOCOLVERSION"` + + // Maximum SSL/TLS protocol version to allow for the connection. If not set, + // this parameter is ignored and the connection will use the maximum bound + // defined by the backend, if set. Setting the maximum protocol version is + // mainly useful for testing or if some component has issues working with a + // newer protocol. + SSLMaxProtocolVersion SSLProtocolVersion `postgres:"ssl_max_protocol_version" env:"SSLPGMAXPROTOCOLVERSION"` + // Interpert sslcert and sslkey as PEM encoded data, rather than a path to a // PEM file. This is a pq extension, not supported in libpq. SSLInline bool `postgres:"sslinline" env:"-"` @@ -303,6 +405,31 @@ type Config struct { // to the same server. LoadBalanceHosts LoadBalanceHosts `postgres:"load_balance_hosts" env:"PGLOADBALANCEHOSTS"` + // Minimum acceptable PostgreSQL protocol version. If the server does not + // support at least this version, the connection will fail. Defaults to + // "3.0". + MinProtocolVersion ProtocolVersion `postgres:"min_protocol_version" env:"PGMINPROTOCOLVERSION"` + + // Maximum PostgreSQL protocol version to request from the server. Defaults to "3.0". + MaxProtocolVersion ProtocolVersion `postgres:"max_protocol_version" env:"PGMAXPROTOCOLVERSION"` + + // Load connection parameters from the service file at ~/.pg_service.conf + // (which can be configured with PGSERVICEFILE). + // + // The service file is a INI-like file to configure connection parameters: + // + // [servicename] + // # Comment + // dbname=foo + // + // Unlike libpq, this does not look at the system-wide service file, as the + // location of this is a compile-time value that is not easy for pq to + // retrieve. + Service string `postgres:"service" env:"PGSERVICE"` + + // Path to connection service file. Defaults to ~/.pg_service.conf. + ServiceFile string `postgres:"-" env:"PGSERVICEFILE"` + // Runtime parameters: any unrecognized parameter in the DSN will be added // to this and sent to PostgreSQL during startup. Runtime map[string]string `postgres:"-" env:"-"` @@ -331,14 +458,16 @@ type ConfigMultihost struct { Port uint16 } -// NewConfig creates a new [Config] from the current environment and given DSN. +// NewConfig creates a new [Config] from the defaults, environment, service +// file, and DSN, in that order. That is: a service overrides any value from the +// environment, which in turn gets overridden by the same parameter in the +// connection string. // -// A subset of the connection parameters supported by PostgreSQL are supported -// by pq; see the [Config] struct fields for supported parameters. pq also lets -// you specify any [run-time parameter] (such as search_path or work_mem) -// directly in the connection string. This is different from libpq, which does -// not allow run-time parameters in the connection string, instead requiring you -// to supply them in the options parameter. +// Most connection parameters supported by PostgreSQL are supported; see the +// [Config] struct for supported parameters. pq also lets you specify any +// [run-time parameter] such as search_path or work_mem in the connection +// string. This is different from libpq, which uses the "options" parameter for +// this (which also works in pq). // // # key=value connection strings // @@ -377,8 +506,8 @@ type ConfigMultihost struct { // support are set. Environment variables have a lower precedence than // explicitly provided connection parameters. // -// [run-time parameter]: http://www.postgresql.org/docs/current/static/runtime-config.html // [PostgreSQL environment variables]: http://www.postgresql.org/docs/current/static/libpq-envars.html +// [run-time parameter]: http://www.postgresql.org/docs/current/static/runtime-config.html func NewConfig(dsn string) (Config, error) { return newConfig(dsn, os.Environ()) } @@ -413,13 +542,22 @@ func (cfg Config) hosts() []Config { } func newConfig(dsn string, env []string) (Config, error) { - cfg := Config{Host: "localhost", Port: 5432, SSLSNI: true} + cfg := Config{ + Host: "localhost", + Port: 5432, + SSLSNI: true, + MinProtocolVersion: "3.0", + MaxProtocolVersion: "3.0", + } if err := cfg.fromEnv(env); err != nil { return Config{}, err } if err := cfg.fromDSN(dsn); err != nil { return Config{}, err } + if err := cfg.fromService(); err != nil { + return Config{}, err + } // Need to have exactly the same number of host and hostaddr, or only specify one. if cfg.isset("host") && cfg.Host != "" && cfg.Hostaddr != (netip.Addr{}) && len(cfg.multiHost) != len(cfg.multiHostaddr) { @@ -487,6 +625,29 @@ func newConfig(dsn string, env []string) (Config, error) { cfg.SSLMode = SSLModeDisable } + if cfg.MinProtocolVersion > cfg.MaxProtocolVersion { + return Config{}, fmt.Errorf("pq: min_protocol_version %q cannot be greater than max_protocol_version %q", + cfg.MinProtocolVersion, cfg.MaxProtocolVersion) + } + if cfg.SSLNegotiation == SSLNegotiationDirect { + switch cfg.SSLMode { + case SSLModeDisable, SSLModeAllow, SSLModePrefer: + return Config{}, fmt.Errorf( + `pq: weak sslmode %q may not be used with sslnegotiation=direct (use "require", "verify-ca", or "verify-full")`, + cfg.SSLMode) + } + } + if cfg.SSLRootCert == "system" { + if !cfg.isset("sslmode") { + cfg.SSLMode = SSLModeVerifyFull + } + if cfg.SSLMode != SSLModeVerifyFull { + return Config{}, fmt.Errorf( + `pq: weak sslmode %q may not be used with sslrootcert=system (use "verify-full")`, + cfg.SSLMode) + } + } + return cfg, nil } @@ -511,10 +672,10 @@ func (cfg *Config) fromEnv(env []string) error { continue } switch k { - case "PGREQUIREAUTH", "PGCHANNELBINDING", "PGSERVICE", "PGSERVICEFILE", "PGREALM", - "PGSSLCERTMODE", "PGSSLCOMPRESSION", "PGREQUIRESSL", "PGSSLCRL", "PGREQUIREPEER", - "PGSYSCONFDIR", "PGLOCALEDIR", "PGSSLCRLDIR", "PGSSLMINPROTOCOLVERSION", "PGSSLMAXPROTOCOLVERSION", - "PGGSSENCMODE", "PGGSSDELEGATION", "PGMINPROTOCOLVERSION", "PGMAXPROTOCOLVERSION", "PGGSSLIB": + case "PGREQUIRESSL", "PGSSLCOMPRESSION", // Deprecated. + "PGREALM", "PGGSSENCMODE", "PGGSSDELEGATION", "PGGSSLIB", // krb stuff + "PGREQUIREAUTH", "PGCHANNELBINDING", + "PGSSLCERTMODE", "PGSSLCRL", "PGSSLCRLDIR", "PGREQUIREPEER": return fmt.Errorf("pq: environment variable $%s is not supported", k) case "PGKRBSRVNAME": if newGss == nil { @@ -523,10 +684,10 @@ func (cfg *Config) fromEnv(env []string) error { } e[k] = v } - return cfg.setFromTag(e, "env") + return cfg.setFromTag(e, "env", false) } -// parseOpts parses the options from name and adds them to the values. +// fromDSN parses the options from name and adds them to the values. // // The parsing code is based on conninfo_parse from libpq's fe-connect.c func (cfg *Config) fromDSN(dsn string) error { @@ -585,7 +746,7 @@ func (cfg *Config) fromDSN(dsn string) error { // The current character should be = if r != '=' || !ok { - return fmt.Errorf(`missing "=" after %q in connection info string"`, string(keyRunes)) + return fmt.Errorf(`missing "=" after %q in connection info string`, string(keyRunes)) } // Skip any whitespace after the = @@ -629,10 +790,28 @@ func (cfg *Config) fromDSN(dsn string) error { opt[string(keyRunes)] = string(valRunes) } - return cfg.setFromTag(opt, "postgres") + return cfg.setFromTag(opt, "postgres", false) } -func (cfg *Config) setFromTag(o map[string]string, tag string) error { +func (cfg *Config) fromService() error { + if cfg.Service == "" { + return nil + } + + if !cfg.isset("PGSERVICEFILE") { + if home := pqutil.Home(false); home != "" { + cfg.ServiceFile = filepath.Join(home, ".pg_service.conf") + } + } + + opts, err := pgservice.FindService(cfg.ServiceFile, cfg.Service) + if err != nil { + return fmt.Errorf("pq: %w", err) + } + return cfg.setFromTag(opts, "postgres", true) +} + +func (cfg *Config) setFromTag(o map[string]string, tag string, service bool) error { f := "pq: wrong value for %q: " if tag == "env" { f = "pq: wrong value for $%s: " @@ -643,17 +822,21 @@ func (cfg *Config) setFromTag(o map[string]string, tag string) error { ) for i := 0; i < types.NumField(); i++ { var ( - rt = types.Field(i) - rv = values.Field(i) - k = rt.Tag.Get(tag) - connectTimeout = (tag == "postgres" && k == "connect_timeout") || (tag == "env" && k == "PGCONNECT_TIMEOUT") - host = (tag == "postgres" && k == "host") || (tag == "env" && k == "PGHOST") - hostaddr = (tag == "postgres" && k == "hostaddr") || (tag == "env" && k == "PGHOSTADDR") - port = (tag == "postgres" && k == "port") || (tag == "env" && k == "PGPORT") - sslmode = (tag == "postgres" && k == "sslmode") || (tag == "env" && k == "PGSSLMODE") - sslnegotiation = (tag == "postgres" && k == "sslnegotiation") || (tag == "env" && k == "PGSSLNEGOTIATION") - targetsessionattrs = (tag == "postgres" && k == "target_session_attrs") || (tag == "env" && k == "PGTARGETSESSIONATTRS") - loadbalancehosts = (tag == "postgres" && k == "load_balance_hosts") || (tag == "env" && k == "PGLOADBALANCEHOSTS") + rt = types.Field(i) + rv = values.Field(i) + k = rt.Tag.Get(tag) + connectTimeout = (tag == "postgres" && k == "connect_timeout") || (tag == "env" && k == "PGCONNECT_TIMEOUT") + host = (tag == "postgres" && k == "host") || (tag == "env" && k == "PGHOST") + hostaddr = (tag == "postgres" && k == "hostaddr") || (tag == "env" && k == "PGHOSTADDR") + port = (tag == "postgres" && k == "port") || (tag == "env" && k == "PGPORT") + sslmode = (tag == "postgres" && k == "sslmode") || (tag == "env" && k == "PGSSLMODE") + sslnegotiation = (tag == "postgres" && k == "sslnegotiation") || (tag == "env" && k == "PGSSLNEGOTIATION") + targetsessionattrs = (tag == "postgres" && k == "target_session_attrs") || (tag == "env" && k == "PGTARGETSESSIONATTRS") + loadbalancehosts = (tag == "postgres" && k == "load_balance_hosts") || (tag == "env" && k == "PGLOADBALANCEHOSTS") + minprotocolversion = (tag == "postgres" && k == "min_protocol_version") || (tag == "env" && k == "PGMINPROTOCOLVERSION") + maxprotocolversion = (tag == "postgres" && k == "max_protocol_version") || (tag == "env" && k == "PGMAXPROTOCOLVERSION") + sslminprotocolversion = (tag == "postgres" && k == "ssl_min_protocol_version") || (tag == "env" && k == "SSLPGMINPROTOCOLVERSION") + sslmaxprotocolversion = (tag == "postgres" && k == "ssl_max_protocol_version") || (tag == "env" && k == "SSLPGMAXPROTOCOLVERSION") ) if k == "" || k == "-" { continue @@ -662,7 +845,11 @@ func (cfg *Config) setFromTag(o map[string]string, tag string) error { v, ok := o[k] delete(o, k) if ok { - if t, ok := rt.Tag.Lookup("postgres"); ok && t != "" && t != "-" { + t, ok := rt.Tag.Lookup("postgres") + if !ok || t == "" || t == "-" { // For PGSERVICEFILE, which can only be from env + t, ok = rt.Tag.Lookup("env") + } + if ok && t != "" && t != "-" { cfg.set = append(cfg.set, t) } switch rt.Type.Kind() { @@ -706,6 +893,12 @@ func (cfg *Config) setFromTag(o map[string]string, tag string) error { if loadbalancehosts && !slices.Contains(loadBalanceHosts, LoadBalanceHosts(v)) { return fmt.Errorf(f+`%q is not supported; supported values are %s`, k, v, pqutil.Join(loadBalanceHosts)) } + if (minprotocolversion || maxprotocolversion) && !slices.Contains(protocolVersions, ProtocolVersion(v)) { + return fmt.Errorf(f+`%q is not supported; supported values are %s`, k, v, pqutil.Join(protocolVersions)) + } + if (sslminprotocolversion || sslmaxprotocolversion) && !slices.Contains(sslProtocolVersions, SSLProtocolVersion(v)) { + return fmt.Errorf(f+`%q is not supported; supported values are %s`, k, v, pqutil.Join(sslProtocolVersions)) + } if host { vv := strings.Split(v, ",") v = vv[0] @@ -756,8 +949,18 @@ func (cfg *Config) setFromTag(o map[string]string, tag string) error { } } + if service && len(o) > 0 { + // TODO(go1.23): use maps.Keys once we require Go 1.23. + var key string + for k := range o { + key = k + break + } + return fmt.Errorf("pq: unknown setting %q in service file for service %q", key, cfg.Service) + } + // Set run-time; we delete map keys as they're set in the struct. - if tag == "postgres" { + if !service && tag == "postgres" { // Make sure database= sets dbname=, as that previously worked (kind of // by accident). // TODO(v2): remove @@ -771,6 +974,8 @@ func (cfg *Config) setFromTag(o map[string]string, tag string) error { return nil } +// Should generally only be used from newConfig(), as it will never be set if +// people go outside that. func (cfg Config) isset(name string) bool { return slices.Contains(cfg.set, name) } @@ -833,11 +1038,14 @@ func (cfg Config) string() string { switch k { case "datestyle", "client_encoding": continue - case "host", "port", "user", "sslsni": + case "host", "port", "user", "sslsni", "min_protocol_version", "max_protocol_version": if !cfg.isset(k) { continue } } + if k == "application_name" && m[k] == "pqgo" { + continue + } if k == "host" && len(cfg.multiHost) > 0 { m[k] += "," + strings.Join(cfg.multiHost, ",") } diff --git a/vendor/github.com/lib/pq/copy.go b/vendor/github.com/lib/pq/copy.go index c72f6ceb..a7c73e01 100644 --- a/vendor/github.com/lib/pq/copy.go +++ b/vendor/github.com/lib/pq/copy.go @@ -1,12 +1,12 @@ package pq import ( - "bytes" "context" "database/sql/driver" "encoding/binary" "errors" "fmt" + "os" "sync" "github.com/lib/pq/internal/proto" @@ -17,65 +17,26 @@ var ( errBinaryCopyNotSupported = errors.New("pq: only text format supported for COPY") errCopyToNotSupported = errors.New("pq: COPY TO is not supported") errCopyNotSupportedOutsideTxn = errors.New("pq: COPY is only allowed inside a transaction") - errCopyInProgress = errors.New("pq: COPY in progress") ) -// CopyIn creates a COPY FROM statement which can be prepared with Tx.Prepare(). -// The target table should be visible in search_path. -// -// It copies all columns if the list of columns is empty. -func CopyIn(table string, columns ...string) string { - b := bytes.NewBufferString("COPY ") - BufferQuoteIdentifier(table, b) - makeStmt(b, columns...) - return b.String() -} - -// CopyInSchema creates a COPY FROM statement which can be prepared with -// Tx.Prepare(). -func CopyInSchema(schema, table string, columns ...string) string { - b := bytes.NewBufferString("COPY ") - BufferQuoteIdentifier(schema, b) - b.WriteRune('.') - BufferQuoteIdentifier(table, b) - makeStmt(b, columns...) - return b.String() -} - -func makeStmt(b *bytes.Buffer, columns ...string) { - if len(columns) == 0 { - b.WriteString(" FROM STDIN") - return - } - b.WriteString(" (") - for i, col := range columns { - if i != 0 { - b.WriteString(", ") - } - BufferQuoteIdentifier(col, b) - } - b.WriteString(") FROM STDIN") -} - type copyin struct { cn *conn buffer []byte rowData chan []byte done chan bool - - closed bool - - mu struct { + closed bool + mu struct { sync.Mutex err error driver.Result } } -const ciBufferSize = 64 * 1024 - -// flush buffer before the buffer is filled up and needs reallocation -const ciBufferFlushSize = 63 * 1024 +const ( + ciBufferSize = 64 * 1024 + // flush buffer before the buffer is filled up and needs reallocation + ciBufferFlushSize = 63 * 1024 +) func (cn *conn) prepareCopyIn(q string) (_ driver.Stmt, resErr error) { if !cn.isInTransaction() { @@ -161,9 +122,10 @@ func (ci *copyin) flush(buf []byte) error { if len(buf)-1 > proto.MaxUint32 { return errors.New("pq: too many columns") } - // set message length (without message identifier) - binary.BigEndian.PutUint32(buf[1:], uint32(len(buf)-1)) - + if debugProto { + fmt.Fprintf(os.Stderr, "CLIENT → %-20s %5d %q\n", proto.RequestCode(buf[0]), len(buf)-5, buf[5:]) + } + binary.BigEndian.PutUint32(buf[1:], uint32(len(buf)-1)) // Set message length (without message identifier). _, err := ci.cn.c.Write(buf) return err } @@ -368,7 +330,7 @@ func (ci *copyin) Close() error { } <-ci.done - ci.cn.inCopy = false + ci.cn.inProgress.Store(false) if err := ci.err(); err != nil { return err diff --git a/vendor/github.com/lib/pq/deprecated.go b/vendor/github.com/lib/pq/deprecated.go index 0def49de..d43934a0 100644 --- a/vendor/github.com/lib/pq/deprecated.go +++ b/vendor/github.com/lib/pq/deprecated.go @@ -1,5 +1,27 @@ package pq +import ( + "bytes" + "database/sql" + + "github.com/lib/pq/pqerror" +) + +// [pq.Error.Severity] values. +// +// Deprecated: use pqerror.Severity[..] values. +// +//go:fix inline +const ( + Efatal = pqerror.SeverityFatal + Epanic = pqerror.SeverityPanic + Ewarning = pqerror.SeverityWarning + Enotice = pqerror.SeverityNotice + Edebug = pqerror.SeverityDebug + Einfo = pqerror.SeverityInfo + Elog = pqerror.SeverityLog +) + // PGError is an interface used by previous versions of pq. // // Deprecated: use the Error type. This is never used. @@ -57,3 +79,55 @@ func (e *Error) Get(k byte) (v string) { // Deprecated: directly passing an URL to sql.Open("postgres", "postgres://...") // now works, and calling this manually is no longer required. func ParseURL(url string) (string, error) { return convertURL(url) } + +// NullTime represents a [time.Time] that may be null. +// +// Deprecated: this is an alias for [sql.NullTime]. +// +//go:fix inline +type NullTime = sql.NullTime + +// CopyIn creates a COPY FROM statement which can be prepared with Tx.Prepare(). +// The target table should be visible in search_path. +// +// It copies all columns if the list of columns is empty. +// +// Deprecated: there is no need to use this query builder, you can use: +// +// tx.Prepare("copy tbl (col1, col2) from stdin") +func CopyIn(table string, columns ...string) string { + b := bytes.NewBufferString("COPY ") + BufferQuoteIdentifier(table, b) + makeStmt(b, columns...) + return b.String() +} + +// CopyInSchema creates a COPY FROM statement which can be prepared with +// Tx.Prepare(). +// +// Deprecated: there is no need to use this query builder, you can use: +// +// tx.Prepare("copy schema.tbl (col1, col2) from stdin") +func CopyInSchema(schema, table string, columns ...string) string { + b := bytes.NewBufferString("COPY ") + BufferQuoteIdentifier(schema, b) + b.WriteRune('.') + BufferQuoteIdentifier(table, b) + makeStmt(b, columns...) + return b.String() +} + +func makeStmt(b *bytes.Buffer, columns ...string) { + if len(columns) == 0 { + b.WriteString(" FROM STDIN") + return + } + b.WriteString(" (") + for i, col := range columns { + if i != 0 { + b.WriteString(", ") + } + BufferQuoteIdentifier(col, b) + } + b.WriteString(") FROM STDIN") +} diff --git a/vendor/github.com/lib/pq/doc.go b/vendor/github.com/lib/pq/doc.go index 10394073..9d9d78e4 100644 --- a/vendor/github.com/lib/pq/doc.go +++ b/vendor/github.com/lib/pq/doc.go @@ -78,17 +78,18 @@ pq may return errors of type [*pq.Error] which contain error details: # Bulk imports -You can perform bulk imports by preparing a statement returned by [CopyIn] (or -[CopyInSchema]) in an explicit transaction ([sql.Tx]). The returned statement -handle can then be repeatedly "executed" to copy data into the target table. -After all data has been processed you should call Exec() once with no arguments -to flush all buffered data. Any call to Exec() might return an error which -should be handled appropriately, but because of the internal buffering an error -returned by Exec() might not be related to the data passed in the call that -failed. - -CopyIn uses COPY FROM internally. It is not possible to COPY outside of an -explicit transaction in pq. +You can perform bulk imports by preparing a "COPY [..] FROM STDIN" statement in +a transaction ([sql.Tx]). The returned [sql.Stmt] handle can then be repeatedly +"executed" to copy data into the target table. After all data has been processed +you should call Exec() once with no arguments to flush all buffered data. Any +call to Exec() might return an error which should be handled appropriately, but +because of the internal buffering an error returned by Exec() might not be +related to the data passed in the call that failed. + +It is not possible to COPY outside of an explicit transaction in pq. + +Use nil for NULL, or explicitly add WITH NULL 'SOME STRING' (the default of \N +doesn't work). # Notifications @@ -116,8 +117,6 @@ The channel name in both Listen and Unlisten is case sensitive, and can contain any characters legal in an [identifier]. Note that the channel name will be truncated to 63 bytes by the PostgreSQL server. -You can find a complete, working example of Listener usage at [cmd/pqlisten]. - # Kerberos Support If you need support for Kerberos authentication, add the following to your main @@ -132,7 +131,6 @@ package: This package is in a separate module so that users who don't need Kerberos don't have to add unnecessary dependencies. -[cmd/pqlisten]: https://github.com/lib/pq/tree/master/cmd/pqlisten [identifier]: http://www.postgresql.org/docs/current/static/sql-syntax-lexical.html#SQL-SYNTAX-IDENTIFIERS [NOTIFY]: http://www.postgresql.org/docs/current/static/sql-notify.html */ diff --git a/vendor/github.com/lib/pq/encode.go b/vendor/github.com/lib/pq/encode.go index e43fc93d..f9b65051 100644 --- a/vendor/github.com/lib/pq/encode.go +++ b/vendor/github.com/lib/pq/encode.go @@ -2,23 +2,18 @@ package pq import ( "bytes" - "database/sql" "encoding/binary" "encoding/hex" "errors" "fmt" - "math" - "regexp" "strconv" "strings" - "sync" "time" + "github.com/lib/pq/internal/pqtime" "github.com/lib/pq/oid" ) -var time2400Regex = regexp.MustCompile(`^(24:00(?::00(?:\.0+)?)?)(?:[Z+-].*)?$`) - func binaryEncode(x any) ([]byte, error) { switch v := x.(type) { case []byte: @@ -78,11 +73,7 @@ func binaryDecode(s []byte, typ oid.Oid) (any, error) { case oid.T_int2: return int64(int16(binary.BigEndian.Uint16(s))), nil case oid.T_uuid: - b, err := decodeUUIDBinary(s) - if err != nil { - err = errors.New("pq: " + err.Error()) - } - return b, err + return decodeUUIDBinary(s) default: return nil, fmt.Errorf("pq: don't know how to decode binary parameter of type %d", uint32(typ)) } @@ -102,7 +93,6 @@ func decodeUUIDBinary(src []byte) ([]byte, error) { hex.Encode(dst[14:], src[6:8]) hex.Encode(dst[19:], src[8:10]) hex.Encode(dst[24:], src[10:16]) - return dst, nil } @@ -121,9 +111,9 @@ func textDecode(ps *parameterStatus, s []byte, typ oid.Oid) (any, error) { case oid.T_timestamp, oid.T_date: return parseTS(nil, string(s)) case oid.T_time: - return parseTime("15:04:05", typ, s) + return parseTime(typ, s) case oid.T_timetz: - return parseTime("15:04:05-07", typ, s) + return parseTime(typ, s) case oid.T_bool: return s[0] == 't', nil case oid.T_int8, oid.T_int4, oid.T_int2: @@ -163,7 +153,7 @@ func appendEncodedText(buf []byte, x any) ([]byte, error) { case time.Time: return append(buf, formatTS(v)...), nil case nil: - return append(buf, "\\N"...), nil + return append(buf, `\N`...), nil default: return nil, fmt.Errorf("pq: encode: unknown type for %T", v) } @@ -172,11 +162,10 @@ func appendEncodedText(buf []byte, x any) ([]byte, error) { func appendEscapedText(buf []byte, text string) []byte { escapeNeeded := false startPos := 0 - var c byte // check if we need to escape for i := 0; i < len(text); i++ { - c = text[i] + c := text[i] if c == '\\' || c == '\n' || c == '\r' || c == '\t' { escapeNeeded = true startPos = i @@ -190,8 +179,7 @@ func appendEscapedText(buf []byte, text string) []byte { // copy till first char to escape, iterate the rest result := append(buf, text[:startPos]...) for i := startPos; i < len(text); i++ { - c = text[i] - switch c { + switch c := text[i]; c { case '\\': result = append(result, '\\', '\\') case '\n': @@ -207,34 +195,42 @@ func appendEscapedText(buf []byte, text string) []byte { return result } -func parseTime(f string, typ oid.Oid, s []byte) (time.Time, error) { +func parseTime(typ oid.Oid, s []byte) (time.Time, error) { str := string(s) - // Check for a minute and second offset in the timezone. - if typ == oid.T_timestamptz || typ == oid.T_timetz { - for i := 3; i <= 6; i += 3 { - if str[len(str)-i] == ':' { - f += ":00" - continue - } - break + f := "15:04:05" + if typ == oid.T_timetz { + f = "15:04:05-07" + // PostgreSQL just sends the hour if the minute and second is 0: + // 22:04:59+00 + // 22:04:59+08 + // 22:04:59+08:30 + // 22:04:59+08:30:40 + // 23:00:00.112321+02:12:13 + // So add those to the format string. + c := strings.Count(str, ":") + if c > 3 { + f = "15:04:05-07:00:00" + } else if c > 2 { + f = "15:04:05-07:00" } } - // Special case for 24:00 time. - // Unfortunately, golang does not parse 24:00 as a proper time. - // In this case, we want to try "round to the next day", to differentiate. - // As such, we find if the 24:00 time matches at the beginning; if so, - // we default it back to 00:00 but add a day later. + // Go doesn't parse 24:00, so manually set that to midnight on Jan 2. 24:00 + // is never with subseconds but may have a timezone: + // 24:00:00 + // 24:00:00+08 + // 24:00:00-08:01:01 var is2400Time bool - switch typ { - case oid.T_timetz, oid.T_time: - if matches := time2400Regex.FindStringSubmatch(str); matches != nil { - // Concatenate timezone information at the back. - str = "00:00:00" + str[len(matches[1]):] - is2400Time = true + if strings.HasPrefix(str, "24:00:00") { + is2400Time = true + if len(str) > 8 { + str = "00:00:00" + str[8:] + } else { + str = "00:00:00" } } + t, err := time.Parse(f, str) if err != nil { return time.Time{}, errors.New("pq: " + err.Error()) @@ -242,88 +238,21 @@ func parseTime(f string, typ oid.Oid, s []byte) (time.Time, error) { if is2400Time { t = t.Add(24 * time.Hour) } + // TODO(v2): it uses UTC, which it shouldn't. But I'm afraid changing it now + // will break people's code. + //if typ == oid.T_time { + // // Don't use UTC but time.FixedZone("", 0) + // t = t.In(globalLocationCache.getLocation(0)) + //} return t, nil } -var errInvalidTimestamp = errors.New("invalid timestamp") - -type timestampParser struct { - err error -} - -func (p *timestampParser) expect(str string, char byte, pos int) { - if p.err != nil { - return - } - if pos+1 > len(str) { - p.err = errInvalidTimestamp - return - } - if c := str[pos]; c != char && p.err == nil { - p.err = fmt.Errorf("expected '%v' at position %v; got '%v'", char, pos, c) - } -} - -func (p *timestampParser) mustAtoi(str string, begin int, end int) int { - if p.err != nil { - return 0 - } - if begin < 0 || end < 0 || begin > end || end > len(str) { - p.err = errInvalidTimestamp - return 0 - } - result, err := strconv.Atoi(str[begin:end]) - if err != nil { - if p.err == nil { - p.err = fmt.Errorf("expected number; got '%v'", str) - } - return 0 - } - return result -} - -// The location cache caches the time zones typically used by the client. -type locationCache struct { - cache map[int]*time.Location - lock sync.Mutex -} - -// All connections share the same list of timezones. Benchmarking shows that -// about 5% speed could be gained by putting the cache in the connection and -// losing the mutex, at the cost of a small amount of memory and a somewhat -// significant increase in code complexity. -var globalLocationCache = newLocationCache() - -func newLocationCache() *locationCache { - return &locationCache{cache: make(map[int]*time.Location)} -} - -// Returns the cached timezone for the specified offset, creating and caching -// it if necessary. -func (c *locationCache) getLocation(offset int) *time.Location { - c.lock.Lock() - defer c.lock.Unlock() - - location, ok := c.cache[offset] - if !ok { - location = time.FixedZone("", offset) - c.cache[offset] = location - } - - return location -} - var ( infinityTSEnabled = false infinityTSNegative time.Time infinityTSPositive time.Time ) -const ( - infinityTSEnabledAlready = "pq: infinity timestamp enabled already" - infinityTSNegativeMustBeSmaller = "pq: infinity timestamp: negative value must be smaller (before) than positive" -) - // EnableInfinityTs controls the handling of Postgres' "-infinity" and // "infinity" "timestamp"s. // @@ -346,10 +275,10 @@ const ( // panic. func EnableInfinityTs(negative time.Time, positive time.Time) { if infinityTSEnabled { - panic(infinityTSEnabledAlready) + panic("pq: infinity timestamp already enabled") } if !negative.Before(positive) { - panic(infinityTSNegativeMustBeSmaller) + panic("pq: infinity timestamp: negative value must be smaller (before) than positive") } infinityTSEnabled = true infinityTSNegative = negative @@ -361,10 +290,10 @@ func disableInfinityTS() { infinityTSEnabled = false } -// This is a time function specific to the Postgres default DateStyle -// setting ("ISO, MDY"), the only one we currently support. This -// accounts for the discrepancies between the parsing available with -// time.Parse and the Postgres date formatting quirks. +// This is a time function specific to the Postgres default DateStyle setting +// ("ISO, MDY"), the only one we currently support. This accounts for the +// discrepancies between the parsing available with time.Parse and the Postgres +// date formatting quirks. func parseTS(currentLocation *time.Location, str string) (any, error) { switch str { case "-infinity": @@ -387,115 +316,10 @@ func parseTS(currentLocation *time.Location, str string) (any, error) { // ParseTimestamp parses Postgres' text format. It returns a time.Time in // currentLocation iff that time's offset agrees with the offset sent from the -// Postgres server. Otherwise, ParseTimestamp returns a time.Time with the -// fixed offset offset provided by the Postgres server. +// Postgres server. Otherwise, ParseTimestamp returns a time.Time with the fixed +// offset offset provided by the Postgres server. func ParseTimestamp(currentLocation *time.Location, str string) (time.Time, error) { - p := timestampParser{} - - monSep := strings.IndexRune(str, '-') - // this is Gregorian year, not ISO Year - // In Gregorian system, the year 1 BC is followed by AD 1 - year := p.mustAtoi(str, 0, monSep) - daySep := monSep + 3 - month := p.mustAtoi(str, monSep+1, daySep) - p.expect(str, '-', daySep) - timeSep := daySep + 3 - day := p.mustAtoi(str, daySep+1, timeSep) - - minLen := monSep + len("01-01") + 1 - - isBC := strings.HasSuffix(str, " BC") - if isBC { - minLen += 3 - } - - var hour, minute, second int - if len(str) > minLen { - p.expect(str, ' ', timeSep) - minSep := timeSep + 3 - p.expect(str, ':', minSep) - hour = p.mustAtoi(str, timeSep+1, minSep) - secSep := minSep + 3 - p.expect(str, ':', secSep) - minute = p.mustAtoi(str, minSep+1, secSep) - secEnd := secSep + 3 - second = p.mustAtoi(str, secSep+1, secEnd) - } - remainderIdx := monSep + len("01-01 00:00:00") + 1 - // Three optional (but ordered) sections follow: the - // fractional seconds, the time zone offset, and the BC - // designation. We set them up here and adjust the other - // offsets if the preceding sections exist. - - nanoSec := 0 - tzOff := 0 - - if remainderIdx < len(str) && str[remainderIdx] == '.' { - fracStart := remainderIdx + 1 - fracOff := strings.IndexAny(str[fracStart:], "-+Z ") - if fracOff < 0 { - fracOff = len(str) - fracStart - } - fracSec := p.mustAtoi(str, fracStart, fracStart+fracOff) - nanoSec = fracSec * (1000000000 / int(math.Pow(10, float64(fracOff)))) - - remainderIdx += fracOff + 1 - } - if tzStart := remainderIdx; tzStart < len(str) && (str[tzStart] == '-' || str[tzStart] == '+') { - // time zone separator is always '-' or '+' or 'Z' (UTC is +00) - var tzSign int - switch c := str[tzStart]; c { - case '-': - tzSign = -1 - case '+': - tzSign = +1 - default: - return time.Time{}, fmt.Errorf("expected '-' or '+' at position %v; got %v", tzStart, c) - } - tzHours := p.mustAtoi(str, tzStart+1, tzStart+3) - remainderIdx += 3 - var tzMin, tzSec int - if remainderIdx < len(str) && str[remainderIdx] == ':' { - tzMin = p.mustAtoi(str, remainderIdx+1, remainderIdx+3) - remainderIdx += 3 - } - if remainderIdx < len(str) && str[remainderIdx] == ':' { - tzSec = p.mustAtoi(str, remainderIdx+1, remainderIdx+3) - remainderIdx += 3 - } - tzOff = tzSign * ((tzHours * 60 * 60) + (tzMin * 60) + tzSec) - } else if tzStart < len(str) && str[tzStart] == 'Z' { - // time zone Z separator indicates UTC is +00 - remainderIdx += 1 - } - - var isoYear int - - if isBC { - isoYear = 1 - year - remainderIdx += 3 - } else { - isoYear = year - } - if remainderIdx < len(str) { - return time.Time{}, fmt.Errorf("expected end of input, got %v", str[remainderIdx:]) - } - t := time.Date(isoYear, time.Month(month), day, - hour, minute, second, nanoSec, - globalLocationCache.getLocation(tzOff)) - - if currentLocation != nil { - // Set the location of the returned Time based on the session's - // TimeZone value, but only if the local time zone database agrees with - // the remote database on the offset. - lt := t.In(currentLocation) - _, newOff := lt.Zone() - if newOff == tzOff { - t = lt - } - } - - return t, p.err + return pqtime.Parse(currentLocation, str) } // formatTS formats t into a format postgres understands. @@ -515,84 +339,55 @@ func formatTS(t time.Time) []byte { // FormatTimestamp formats t into Postgres' text format for timestamps. func FormatTimestamp(t time.Time) []byte { - // Need to send dates before 0001 A.D. with " BC" suffix, instead of the - // minus sign preferred by Go. - // Beware, "0000" in ISO is "1 BC", "-0001" is "2 BC" and so on - bc := false - if t.Year() <= 0 { - // flip year sign, and add 1, e.g: "0" will be "1", and "-10" will be "11" - t = t.AddDate((-t.Year())*2+1, 0, 0) - bc = true - } - b := []byte(t.Format("2006-01-02 15:04:05.999999999Z07:00")) - - _, offset := t.Zone() - offset %= 60 - if offset != 0 { - // RFC3339Nano already printed the minus sign - if offset < 0 { - offset = -offset - } - - b = append(b, ':') - if offset < 10 { - b = append(b, '0') - } - b = strconv.AppendInt(b, int64(offset), 10) - } - - if bc { - b = append(b, " BC"...) - } - return b + return pqtime.Format(t) } // Parse a bytea value received from the server. Both "hex" and the legacy // "escape" format are supported. func parseBytea(s []byte) (result []byte, err error) { + // Hex format. if len(s) >= 2 && bytes.Equal(s[:2], []byte("\\x")) { - // bytea_output = hex s = s[2:] // trim off leading "\\x" result = make([]byte, hex.DecodedLen(len(s))) _, err := hex.Decode(result, s) if err != nil { return nil, err } - } else { - // bytea_output = escape - for len(s) > 0 { - if s[0] == '\\' { - // escaped '\\' - if len(s) >= 2 && s[1] == '\\' { - result = append(result, '\\') - s = s[2:] - continue - } + return result, nil + } + + // Escape format. + for len(s) > 0 { + if s[0] == '\\' { + // escaped '\\' + if len(s) >= 2 && s[1] == '\\' { + result = append(result, '\\') + s = s[2:] + continue + } - // '\\' followed by an octal number - if len(s) < 4 { - return nil, fmt.Errorf("invalid bytea sequence %v", s) - } - r, err := strconv.ParseUint(string(s[1:4]), 8, 8) - if err != nil { - return nil, fmt.Errorf("could not parse bytea value: %w", err) - } - result = append(result, byte(r)) - s = s[4:] - } else { - // We hit an unescaped, raw byte. Try to read in as many as - // possible in one go. - i := bytes.IndexByte(s, '\\') - if i == -1 { - result = append(result, s...) - break - } - result = append(result, s[:i]...) - s = s[i:] + // '\\' followed by an octal number + if len(s) < 4 { + return nil, fmt.Errorf("invalid bytea sequence %v", s) } + r, err := strconv.ParseUint(string(s[1:4]), 8, 8) + if err != nil { + return nil, fmt.Errorf("could not parse bytea value: %w", err) + } + result = append(result, byte(r)) + s = s[4:] + } else { + // We hit an unescaped, raw byte. Try to read in as many as + // possible in one go. + i := bytes.IndexByte(s, '\\') + if i == -1 { + result = append(result, s...) + break + } + result = append(result, s[:i]...) + s = s[i:] } } - return result, nil } @@ -603,10 +398,3 @@ func encodeBytea(v []byte) (result []byte) { hex.Encode(result[2:], v) return result } - -// NullTime represents a [time.Time] that may be null. -// NullTime implements the [sql.Scanner] interface so -// it can be used as a scan destination, similar to [sql.NullString]. -// -// Deprecated: this is an alias for [sql.NullTime]. -type NullTime = sql.NullTime diff --git a/vendor/github.com/lib/pq/error.go b/vendor/github.com/lib/pq/error.go index 234d39e2..7d061875 100644 --- a/vendor/github.com/lib/pq/error.go +++ b/vendor/github.com/lib/pq/error.go @@ -9,22 +9,13 @@ import ( "strconv" "strings" "unicode/utf8" -) -// [pq.Error.Severity] values. -const ( - Efatal = "FATAL" - Epanic = "PANIC" - Ewarning = "WARNING" - Enotice = "NOTICE" - Edebug = "DEBUG" - Einfo = "INFO" - Elog = "LOG" + "github.com/lib/pq/pqerror" ) -// Error represents an error communicating with the server. +// Error returned by the PostgreSQL server. // -// The [Error] method only returns the error message and error code: +// The [Error] method returns the error message and error code: // // pq: invalid input syntax for type json (22P02) // @@ -39,15 +30,13 @@ const ( // 4 | 123, // 5 | 'foo', 'asd'::jsonb // ^ -// -// See http://www.postgresql.org/docs/current/static/protocol-error-fields.html for details of the fields type Error struct { // [Efatal], [Epanic], [Ewarning], [Enotice], [Edebug], [Einfo], or [Elog]. // Always present. Severity string // SQLSTATE code. Always present. - Code ErrorCode + Code pqerror.Code // Primary human-readable error message. This should be accurate but terse // (typically one line). Always present. @@ -119,316 +108,21 @@ type Error struct { query string } -// ErrorCode is a five-character error code. -type ErrorCode string - -// Name returns a more human friendly rendering of the error code, namely the -// "condition name". -// -// See http://www.postgresql.org/docs/9.3/static/errcodes-appendix.html for -// details. -func (ec ErrorCode) Name() string { - return errorCodeNames[ec] -} - -// ErrorClass is only the class part of an error code. -type ErrorClass string - -// Name returns the condition name of an error class. It is equivalent to the -// condition name of the "standard" error code (i.e. the one having the last -// three characters "000"). -func (ec ErrorClass) Name() string { - return errorCodeNames[ErrorCode(ec+"000")] -} - -// Class returns the error class, e.g. "28". -// -// See http://www.postgresql.org/docs/9.3/static/errcodes-appendix.html for -// details. -func (ec ErrorCode) Class() ErrorClass { - return ErrorClass(ec[0:2]) -} - -// errorCodeNames is a mapping between the five-character error codes and the -// human readable "condition names". It is derived from the list at -// http://www.postgresql.org/docs/9.3/static/errcodes-appendix.html -var errorCodeNames = map[ErrorCode]string{ - // Class 00 - Successful Completion - "00000": "successful_completion", - // Class 01 - Warning - "01000": "warning", - "0100C": "dynamic_result_sets_returned", - "01008": "implicit_zero_bit_padding", - "01003": "null_value_eliminated_in_set_function", - "01007": "privilege_not_granted", - "01006": "privilege_not_revoked", - "01004": "string_data_right_truncation", - "01P01": "deprecated_feature", - // Class 02 - No Data (this is also a warning class per the SQL standard) - "02000": "no_data", - "02001": "no_additional_dynamic_result_sets_returned", - // Class 03 - SQL Statement Not Yet Complete - "03000": "sql_statement_not_yet_complete", - // Class 08 - Connection Exception - "08000": "connection_exception", - "08003": "connection_does_not_exist", - "08006": "connection_failure", - "08001": "sqlclient_unable_to_establish_sqlconnection", - "08004": "sqlserver_rejected_establishment_of_sqlconnection", - "08007": "transaction_resolution_unknown", - "08P01": "protocol_violation", - // Class 09 - Triggered Action Exception - "09000": "triggered_action_exception", - // Class 0A - Feature Not Supported - "0A000": "feature_not_supported", - // Class 0B - Invalid Transaction Initiation - "0B000": "invalid_transaction_initiation", - // Class 0F - Locator Exception - "0F000": "locator_exception", - "0F001": "invalid_locator_specification", - // Class 0L - Invalid Grantor - "0L000": "invalid_grantor", - "0LP01": "invalid_grant_operation", - // Class 0P - Invalid Role Specification - "0P000": "invalid_role_specification", - // Class 0Z - Diagnostics Exception - "0Z000": "diagnostics_exception", - "0Z002": "stacked_diagnostics_accessed_without_active_handler", - // Class 20 - Case Not Found - "20000": "case_not_found", - // Class 21 - Cardinality Violation - "21000": "cardinality_violation", - // Class 22 - Data Exception - "22000": "data_exception", - "2202E": "array_subscript_error", - "22021": "character_not_in_repertoire", - "22008": "datetime_field_overflow", - "22012": "division_by_zero", - "22005": "error_in_assignment", - "2200B": "escape_character_conflict", - "22022": "indicator_overflow", - "22015": "interval_field_overflow", - "2201E": "invalid_argument_for_logarithm", - "22014": "invalid_argument_for_ntile_function", - "22016": "invalid_argument_for_nth_value_function", - "2201F": "invalid_argument_for_power_function", - "2201G": "invalid_argument_for_width_bucket_function", - "22018": "invalid_character_value_for_cast", - "22007": "invalid_datetime_format", - "22019": "invalid_escape_character", - "2200D": "invalid_escape_octet", - "22025": "invalid_escape_sequence", - "22P06": "nonstandard_use_of_escape_character", - "22010": "invalid_indicator_parameter_value", - "22023": "invalid_parameter_value", - "2201B": "invalid_regular_expression", - "2201W": "invalid_row_count_in_limit_clause", - "2201X": "invalid_row_count_in_result_offset_clause", - "22009": "invalid_time_zone_displacement_value", - "2200C": "invalid_use_of_escape_character", - "2200G": "most_specific_type_mismatch", - "22004": "null_value_not_allowed", - "22002": "null_value_no_indicator_parameter", - "22003": "numeric_value_out_of_range", - "2200H": "sequence_generator_limit_exceeded", - "22026": "string_data_length_mismatch", - "22001": "string_data_right_truncation", - "22011": "substring_error", - "22027": "trim_error", - "22024": "unterminated_c_string", - "2200F": "zero_length_character_string", - "22P01": "floating_point_exception", - "22P02": "invalid_text_representation", - "22P03": "invalid_binary_representation", - "22P04": "bad_copy_file_format", - "22P05": "untranslatable_character", - "2200L": "not_an_xml_document", - "2200M": "invalid_xml_document", - "2200N": "invalid_xml_content", - "2200S": "invalid_xml_comment", - "2200T": "invalid_xml_processing_instruction", - // Class 23 - Integrity Constraint Violation - "23000": "integrity_constraint_violation", - "23001": "restrict_violation", - "23502": "not_null_violation", - "23503": "foreign_key_violation", - "23505": "unique_violation", - "23514": "check_violation", - "23P01": "exclusion_violation", - // Class 24 - Invalid Cursor State - "24000": "invalid_cursor_state", - // Class 25 - Invalid Transaction State - "25000": "invalid_transaction_state", - "25001": "active_sql_transaction", - "25002": "branch_transaction_already_active", - "25008": "held_cursor_requires_same_isolation_level", - "25003": "inappropriate_access_mode_for_branch_transaction", - "25004": "inappropriate_isolation_level_for_branch_transaction", - "25005": "no_active_sql_transaction_for_branch_transaction", - "25006": "read_only_sql_transaction", - "25007": "schema_and_data_statement_mixing_not_supported", - "25P01": "no_active_sql_transaction", - "25P02": "in_failed_sql_transaction", - // Class 26 - Invalid SQL Statement Name - "26000": "invalid_sql_statement_name", - // Class 27 - Triggered Data Change Violation - "27000": "triggered_data_change_violation", - // Class 28 - Invalid Authorization Specification - "28000": "invalid_authorization_specification", - "28P01": "invalid_password", - // Class 2B - Dependent Privilege Descriptors Still Exist - "2B000": "dependent_privilege_descriptors_still_exist", - "2BP01": "dependent_objects_still_exist", - // Class 2D - Invalid Transaction Termination - "2D000": "invalid_transaction_termination", - // Class 2F - SQL Routine Exception - "2F000": "sql_routine_exception", - "2F005": "function_executed_no_return_statement", - "2F002": "modifying_sql_data_not_permitted", - "2F003": "prohibited_sql_statement_attempted", - "2F004": "reading_sql_data_not_permitted", - // Class 34 - Invalid Cursor Name - "34000": "invalid_cursor_name", - // Class 38 - External Routine Exception - "38000": "external_routine_exception", - "38001": "containing_sql_not_permitted", - "38002": "modifying_sql_data_not_permitted", - "38003": "prohibited_sql_statement_attempted", - "38004": "reading_sql_data_not_permitted", - // Class 39 - External Routine Invocation Exception - "39000": "external_routine_invocation_exception", - "39001": "invalid_sqlstate_returned", - "39004": "null_value_not_allowed", - "39P01": "trigger_protocol_violated", - "39P02": "srf_protocol_violated", - // Class 3B - Savepoint Exception - "3B000": "savepoint_exception", - "3B001": "invalid_savepoint_specification", - // Class 3D - Invalid Catalog Name - "3D000": "invalid_catalog_name", - // Class 3F - Invalid Schema Name - "3F000": "invalid_schema_name", - // Class 40 - Transaction Rollback - "40000": "transaction_rollback", - "40002": "transaction_integrity_constraint_violation", - "40001": "serialization_failure", - "40003": "statement_completion_unknown", - "40P01": "deadlock_detected", - // Class 42 - Syntax Error or Access Rule Violation - "42000": "syntax_error_or_access_rule_violation", - "42601": "syntax_error", - "42501": "insufficient_privilege", - "42846": "cannot_coerce", - "42803": "grouping_error", - "42P20": "windowing_error", - "42P19": "invalid_recursion", - "42830": "invalid_foreign_key", - "42602": "invalid_name", - "42622": "name_too_long", - "42939": "reserved_name", - "42804": "datatype_mismatch", - "42P18": "indeterminate_datatype", - "42P21": "collation_mismatch", - "42P22": "indeterminate_collation", - "42809": "wrong_object_type", - "42703": "undefined_column", - "42883": "undefined_function", - "42P01": "undefined_table", - "42P02": "undefined_parameter", - "42704": "undefined_object", - "42701": "duplicate_column", - "42P03": "duplicate_cursor", - "42P04": "duplicate_database", - "42723": "duplicate_function", - "42P05": "duplicate_prepared_statement", - "42P06": "duplicate_schema", - "42P07": "duplicate_table", - "42712": "duplicate_alias", - "42710": "duplicate_object", - "42702": "ambiguous_column", - "42725": "ambiguous_function", - "42P08": "ambiguous_parameter", - "42P09": "ambiguous_alias", - "42P10": "invalid_column_reference", - "42611": "invalid_column_definition", - "42P11": "invalid_cursor_definition", - "42P12": "invalid_database_definition", - "42P13": "invalid_function_definition", - "42P14": "invalid_prepared_statement_definition", - "42P15": "invalid_schema_definition", - "42P16": "invalid_table_definition", - "42P17": "invalid_object_definition", - // Class 44 - WITH CHECK OPTION Violation - "44000": "with_check_option_violation", - // Class 53 - Insufficient Resources - "53000": "insufficient_resources", - "53100": "disk_full", - "53200": "out_of_memory", - "53300": "too_many_connections", - "53400": "configuration_limit_exceeded", - // Class 54 - Program Limit Exceeded - "54000": "program_limit_exceeded", - "54001": "statement_too_complex", - "54011": "too_many_columns", - "54023": "too_many_arguments", - // Class 55 - Object Not In Prerequisite State - "55000": "object_not_in_prerequisite_state", - "55006": "object_in_use", - "55P02": "cant_change_runtime_param", - "55P03": "lock_not_available", - // Class 57 - Operator Intervention - "57000": "operator_intervention", - "57014": "query_canceled", - "57P01": "admin_shutdown", - "57P02": "crash_shutdown", - "57P03": "cannot_connect_now", - "57P04": "database_dropped", - // Class 58 - System Error (errors external to PostgreSQL itself) - "58000": "system_error", - "58030": "io_error", - "58P01": "undefined_file", - "58P02": "duplicate_file", - // Class F0 - Configuration File Error - "F0000": "config_file_error", - "F0001": "lock_file_exists", - // Class HV - Foreign Data Wrapper Error (SQL/MED) - "HV000": "fdw_error", - "HV005": "fdw_column_name_not_found", - "HV002": "fdw_dynamic_parameter_value_needed", - "HV010": "fdw_function_sequence_error", - "HV021": "fdw_inconsistent_descriptor_information", - "HV024": "fdw_invalid_attribute_value", - "HV007": "fdw_invalid_column_name", - "HV008": "fdw_invalid_column_number", - "HV004": "fdw_invalid_data_type", - "HV006": "fdw_invalid_data_type_descriptors", - "HV091": "fdw_invalid_descriptor_field_identifier", - "HV00B": "fdw_invalid_handle", - "HV00C": "fdw_invalid_option_index", - "HV00D": "fdw_invalid_option_name", - "HV090": "fdw_invalid_string_length_or_buffer_length", - "HV00A": "fdw_invalid_string_format", - "HV009": "fdw_invalid_use_of_null_pointer", - "HV014": "fdw_too_many_handles", - "HV001": "fdw_out_of_memory", - "HV00P": "fdw_no_schemas", - "HV00J": "fdw_option_name_not_found", - "HV00K": "fdw_reply_handle", - "HV00Q": "fdw_schema_not_found", - "HV00R": "fdw_table_not_found", - "HV00L": "fdw_unable_to_create_execution", - "HV00M": "fdw_unable_to_create_reply", - "HV00N": "fdw_unable_to_establish_connection", - // Class P0 - PL/pgSQL Error - "P0000": "plpgsql_error", - "P0001": "raise_exception", - "P0002": "no_data_found", - "P0003": "too_many_rows", - // Class XX - Internal Error - "XX000": "internal_error", - "XX001": "data_corrupted", - "XX002": "index_corrupted", -} +type ( + // ErrorCode is a five-character error code. + // + // Deprecated: use pqerror.Code + // + //go:fix inline + ErrorCode = pqerror.Code + + // ErrorClass is only the class part of an error code. + // + // Deprecated: use pqerror.Class + // + //go:fix inline + ErrorClass = pqerror.Class +) func parseError(r *readBuf, q string) *Error { err := &Error{query: q} @@ -438,7 +132,7 @@ func parseError(r *readBuf, q string) *Error { case 'S': err.Severity = msg case 'C': - err.Code = ErrorCode(msg) + err.Code = pqerror.Code(msg) case 'M': err.Message = msg case 'D': @@ -475,14 +169,10 @@ func parseError(r *readBuf, q string) *Error { } // Fatal returns true if the Error Severity is fatal. -func (e *Error) Fatal() bool { - return e.Severity == Efatal -} +func (e *Error) Fatal() bool { return e.Severity == pqerror.SeverityFatal } // SQLState returns the SQLState of the error. -func (e *Error) SQLState() string { - return string(e.Code) -} +func (e *Error) SQLState() string { return string(e.Code) } func (e *Error) Error() string { msg := e.Message @@ -564,10 +254,7 @@ func posToLine(pos int, lines []string) (line, col int) { line++ ll := utf8.RuneCountInString(lines[i]) + 1 // +1 for the removed newline if read+ll >= pos { - col = pos - read - if col < 1 { // Should never happen, but just in case. - col = 1 - } + col = max(pos-read, 1) // Should be lower than 1, but just in case. break } read += ll @@ -620,7 +307,7 @@ func (cn *conn) handleError(reported error, query ...string) error { reported = driver.ErrBadConn } case error: - if err == io.EOF || err.Error() == "remote error: handshake failure" { + if err == io.EOF || err == io.ErrUnexpectedEOF || err.Error() == "remote error: handshake failure" { reported = driver.ErrBadConn } default: diff --git a/vendor/github.com/lib/pq/internal/pgpass/pgpass.go b/vendor/github.com/lib/pq/internal/pgpass/pgpass.go index 002631da..4da35385 100644 --- a/vendor/github.com/lib/pq/internal/pgpass/pgpass.go +++ b/vendor/github.com/lib/pq/internal/pgpass/pgpass.go @@ -9,9 +9,8 @@ import ( "github.com/lib/pq/internal/pqutil" ) -func PasswordFromPgpass(passfile, user, password, host, port, dbname string, passwordSet bool) string { - // Do not process .pgpass if a password was supplied. - if passwordSet { +func PasswordFromPgpass(passfile, user, password, host, port, dbname string) string { + if password != "" { // Do not process .pgpass if a password was supplied. return password } diff --git a/vendor/github.com/lib/pq/internal/pgservice/pgservice.go b/vendor/github.com/lib/pq/internal/pgservice/pgservice.go new file mode 100644 index 00000000..9842648c --- /dev/null +++ b/vendor/github.com/lib/pq/internal/pgservice/pgservice.go @@ -0,0 +1,70 @@ +package pgservice + +import ( + "bufio" + "fmt" + "os" + "strings" + + "github.com/lib/pq/internal/pqutil" +) + +func FindService(path string, service string) (map[string]string, error) { + fp, err := os.Open(path) + if err != nil { + if pqutil.ErrNotExists(err) { + // libpq just returns "definition of service not found" if the + // default file doesn't exist, but IMO that's confusing. + return nil, fmt.Errorf("service file %q not found", path) + } + return nil, err + } + defer fp.Close() + + var ( + scan = bufio.NewScanner(fp) + i int + ) + for scan.Scan() { + i++ + line := strings.TrimSpace(scan.Text()) + if line == "" || line[0] == '#' { + continue + } + + // [service] header that we want. + if line[0] == '[' && line[len(line)-1] == ']' && strings.TrimSpace(line[1:len(line)-1]) == service { + opts := make(map[string]string) + for scan.Scan() { + i++ + line := strings.TrimSpace(scan.Text()) + if line == "" || line[0] == '#' { + continue + } + // Next header: our work here is done. + if line[0] == '[' && line[len(line)-1] == ']' { + return opts, nil + } + + k, v, ok := strings.Cut(line, "=") + if !ok { + return nil, fmt.Errorf("line %d: missing '=' in %q", i, line) + } + k, v = strings.TrimSpace(k), strings.TrimSpace(v) + if k == "" { + return nil, fmt.Errorf("line %d: no value before '=' in %q", i, line) + } + opts[k] = v + } + if scan.Err() != nil { + return nil, scan.Err() + } + return opts, nil + } + } + if scan.Err() != nil { + return nil, scan.Err() + } + + return nil, fmt.Errorf("definition of service %q not found", service) +} diff --git a/vendor/github.com/lib/pq/internal/pqtime/loc.go b/vendor/github.com/lib/pq/internal/pqtime/loc.go new file mode 100644 index 00000000..d23dd5b0 --- /dev/null +++ b/vendor/github.com/lib/pq/internal/pqtime/loc.go @@ -0,0 +1,37 @@ +package pqtime + +import ( + "sync" + "time" +) + +// The location cache caches the time zones typically used by the client. +type locationCache struct { + cache map[int]*time.Location + lock sync.Mutex +} + +// All connections share the same list of timezones. Benchmarking shows that +// about 5% speed could be gained by putting the cache in the connection and +// losing the mutex, at the cost of a small amount of memory and a somewhat +// significant increase in code complexity. +var globalLocationCache = &locationCache{cache: make(map[int]*time.Location)} + +func Reset() { + globalLocationCache = &locationCache{cache: make(map[int]*time.Location)} +} + +// Returns the cached timezone for the specified offset, creating and caching +// it if necessary. +func (c *locationCache) getLocation(offset int) *time.Location { + c.lock.Lock() + defer c.lock.Unlock() + l, ok := c.cache[offset] + if !ok { + // TODO(v2): for offset=0 it should use some descriptive text like + // "without time zone". + l = time.FixedZone("", offset) + c.cache[offset] = l + } + return l +} diff --git a/vendor/github.com/lib/pq/internal/pqtime/pqtime.go b/vendor/github.com/lib/pq/internal/pqtime/pqtime.go new file mode 100644 index 00000000..28008e86 --- /dev/null +++ b/vendor/github.com/lib/pq/internal/pqtime/pqtime.go @@ -0,0 +1,190 @@ +package pqtime + +import ( + "errors" + "fmt" + "math" + "strconv" + "strings" + "time" +) + +var errInvalidTimestamp = errors.New("invalid timestamp") + +type timestampParser struct { + err error +} + +func (p *timestampParser) expect(str string, char byte, pos int) { + if p.err != nil { + return + } + if pos+1 > len(str) { + p.err = errInvalidTimestamp + return + } + if c := str[pos]; c != char && p.err == nil { + p.err = fmt.Errorf("expected '%v' at position %v; got '%v'", char, pos, c) + } +} + +func (p *timestampParser) mustAtoi(str string, begin int, end int) int { + if p.err != nil { + return 0 + } + if begin < 0 || end < 0 || begin > end || end > len(str) { + p.err = errInvalidTimestamp + return 0 + } + result, err := strconv.Atoi(str[begin:end]) + if err != nil { + if p.err == nil { + p.err = fmt.Errorf("expected number; got '%v'", str) + } + return 0 + } + return result +} + +func Parse(currentLocation *time.Location, str string) (time.Time, error) { + p := timestampParser{} + + monSep := strings.IndexRune(str, '-') + // this is Gregorian year, not ISO Year + // In Gregorian system, the year 1 BC is followed by AD 1 + year := p.mustAtoi(str, 0, monSep) + daySep := monSep + 3 + month := p.mustAtoi(str, monSep+1, daySep) + p.expect(str, '-', daySep) + timeSep := daySep + 3 + day := p.mustAtoi(str, daySep+1, timeSep) + + minLen := monSep + len("01-01") + 1 + + isBC := strings.HasSuffix(str, " BC") + if isBC { + minLen += 3 + } + + var hour, minute, second int + if len(str) > minLen { + p.expect(str, ' ', timeSep) + minSep := timeSep + 3 + p.expect(str, ':', minSep) + hour = p.mustAtoi(str, timeSep+1, minSep) + secSep := minSep + 3 + p.expect(str, ':', secSep) + minute = p.mustAtoi(str, minSep+1, secSep) + secEnd := secSep + 3 + second = p.mustAtoi(str, secSep+1, secEnd) + } + remainderIdx := monSep + len("01-01 00:00:00") + 1 + // Three optional (but ordered) sections follow: the + // fractional seconds, the time zone offset, and the BC + // designation. We set them up here and adjust the other + // offsets if the preceding sections exist. + + nanoSec := 0 + tzOff := 0 + + if remainderIdx < len(str) && str[remainderIdx] == '.' { + fracStart := remainderIdx + 1 + fracOff := strings.IndexAny(str[fracStart:], "-+Z ") + if fracOff < 0 { + fracOff = len(str) - fracStart + } + fracSec := p.mustAtoi(str, fracStart, fracStart+fracOff) + nanoSec = fracSec * (1000000000 / int(math.Pow(10, float64(fracOff)))) + + remainderIdx += fracOff + 1 + } + if tzStart := remainderIdx; tzStart < len(str) && (str[tzStart] == '-' || str[tzStart] == '+') { + // time zone separator is always '-' or '+' or 'Z' (UTC is +00) + var tzSign int + switch c := str[tzStart]; c { + case '-': + tzSign = -1 + case '+': + tzSign = +1 + default: + return time.Time{}, fmt.Errorf("expected '-' or '+' at position %v; got %v", tzStart, c) + } + tzHours := p.mustAtoi(str, tzStart+1, tzStart+3) + remainderIdx += 3 + var tzMin, tzSec int + if remainderIdx < len(str) && str[remainderIdx] == ':' { + tzMin = p.mustAtoi(str, remainderIdx+1, remainderIdx+3) + remainderIdx += 3 + } + if remainderIdx < len(str) && str[remainderIdx] == ':' { + tzSec = p.mustAtoi(str, remainderIdx+1, remainderIdx+3) + remainderIdx += 3 + } + tzOff = tzSign * ((tzHours * 60 * 60) + (tzMin * 60) + tzSec) + } else if tzStart < len(str) && str[tzStart] == 'Z' { + // time zone Z separator indicates UTC is +00 + remainderIdx += 1 + } + + var isoYear int + + if isBC { + isoYear = 1 - year + remainderIdx += 3 + } else { + isoYear = year + } + if remainderIdx < len(str) { + return time.Time{}, fmt.Errorf("expected end of input, got %v", str[remainderIdx:]) + } + t := time.Date(isoYear, time.Month(month), day, + hour, minute, second, nanoSec, + globalLocationCache.getLocation(tzOff)) + + if currentLocation != nil { + // Set the location of the returned Time based on the session's + // TimeZone value, but only if the local time zone database agrees with + // the remote database on the offset. + lt := t.In(currentLocation) + _, newOff := lt.Zone() + if newOff == tzOff { + t = lt + } + } + + return t, p.err +} + +// Format into Postgres' text format for timestamps. +func Format(t time.Time) []byte { + // Need to send dates before 0001 A.D. with " BC" suffix, instead of the + // minus sign preferred by Go. + // Beware, "0000" in ISO is "1 BC", "-0001" is "2 BC" and so on + bc := false + if t.Year() <= 0 { + // flip year sign, and add 1, e.g: "0" will be "1", and "-10" will be "11" + t = t.AddDate((-t.Year())*2+1, 0, 0) + bc = true + } + b := []byte(t.Format("2006-01-02 15:04:05.999999999Z07:00")) + + _, offset := t.Zone() + offset %= 60 + if offset != 0 { + // RFC3339Nano already printed the minus sign + if offset < 0 { + offset = -offset + } + + b = append(b, ':') + if offset < 10 { + b = append(b, '0') + } + b = strconv.AppendInt(b, int64(offset), 10) + } + + if bc { + b = append(b, " BC"...) + } + return b +} diff --git a/vendor/github.com/lib/pq/internal/pqutil/path.go b/vendor/github.com/lib/pq/internal/pqutil/path.go index e6827a96..dd0d5af0 100644 --- a/vendor/github.com/lib/pq/internal/pqutil/path.go +++ b/vendor/github.com/lib/pq/internal/pqutil/path.go @@ -1,18 +1,25 @@ package pqutil import ( + "errors" "fmt" + "io" "os" "os/user" "path/filepath" "runtime" + "syscall" ) -// Home gets the user's home directory. Matches pqGetHomeDirectory() from -// PostgreSQL +// Home gets the PostgreSQL configuration dir in the user's home directory: +// %APPDATA%/postgresql on Windows, and $HOME/.postgresql/postgresql.crt +// everywhere else. // +// Returns an empy string if no home directory was found. +// +// Matches pqGetHomeDirectory() from PostgreSQL. // https://github.com/postgres/postgres/blob/2b117bb/src/interfaces/libpq/fe-connect.c#L8214 -func Home() string { +func Home(subdir bool) string { if runtime.GOOS == "windows" { // pq uses SHGetFolderPath(), which is deprecated but x/sys/windows has // KnownFolderPath(). We don't really want to pull that in though, so @@ -33,15 +40,34 @@ func Home() string { } home = u.HomeDir } + // libpq reads some files from ~/ and some from ~/.postgresql – on Windows + // it always uses %APPDATA%/postgresql. + if subdir { + home = filepath.Join(home, ".postgresql") + } return home } +// ErrNotExists reports if err is a "path doesn't exist" type error. +// +// fs.ErrNotExist is not enough, as "/dev/null/somefile" will return ENOTDIR +// instead of ENOENT. +func ErrNotExists(err error) bool { + perr := new(os.PathError) + if errors.As(err, &perr) && (perr.Err == syscall.ENOENT || perr.Err == syscall.ENOTDIR) { + return true + } + return false +} + +var WarnFD io.Writer = os.Stderr + // Pgpass gets the filepath to the pgpass file to use, returning "" if a pgpass // file shouldn't be used. func Pgpass(passfile string) string { // Get passfile from the options. if passfile == "" { - home := Home() + home := Home(false) if home == "" { return "" } @@ -55,7 +81,7 @@ func Pgpass(passfile string) string { return "" } if fi.Mode().Perm()&(0x77) != 0 { - fmt.Fprintf(os.Stderr, + fmt.Fprintf(WarnFD, "WARNING: password file %q has group or world access; permissions should be u=rw (0600) or less\n", passfile) return "" diff --git a/vendor/github.com/lib/pq/internal/pqutil/perm.go b/vendor/github.com/lib/pq/internal/pqutil/perm.go index fdfa94a0..05fb9a6a 100644 --- a/vendor/github.com/lib/pq/internal/pqutil/perm.go +++ b/vendor/github.com/lib/pq/internal/pqutil/perm.go @@ -29,15 +29,15 @@ func SSLKeyPermissions(sslkey string) error { return err } - return checkPermissions(fi) + return CheckPermissions(fi) } -func checkPermissions(fi os.FileInfo) error { +func CheckPermissions(fi os.FileInfo) error { // The maximum permissions that a private key file owned by a regular user // is allowed to have. This translates to u=rw. Regardless of if we're - // running as root or not, 0600 is acceptable, so we return if we match the - // regular user permission mask. - if fi.Mode().Perm()&os.FileMode(0777)^0600 == 0 { + // running as root or not, 0600 is acceptable, so we return if no bits + // beyond the regular user permission mask are set. + if fi.Mode().Perm()&^os.FileMode(0o600) == 0 { return nil } @@ -54,7 +54,7 @@ func checkPermissions(fi os.FileInfo) error { if sys.Uid == 0 { // The maximum permissions that a private key file owned by root is // allowed to have. This translates to u=rw,g=r. - if fi.Mode().Perm()&os.FileMode(0777)^0640 != 0 { + if fi.Mode().Perm()&^os.FileMode(0o640) != 0 { return ErrSSLKeyHasWorldPermissions } return nil diff --git a/vendor/github.com/lib/pq/internal/proto/proto.go b/vendor/github.com/lib/pq/internal/proto/proto.go index 318d180a..e8b4bc59 100644 --- a/vendor/github.com/lib/pq/internal/proto/proto.go +++ b/vendor/github.com/lib/pq/internal/proto/proto.go @@ -10,7 +10,7 @@ import ( // Constants from pqcomm.h const ( ProtocolVersion30 = (3 << 16) | 0 //lint:ignore SA4016 x - ProtocolVersion32 = (3 << 16) | 2 // PostgreSQL ≥18; not yet supported. + ProtocolVersion32 = (3 << 16) | 2 // PostgreSQL ≥18. CancelRequestCode = (1234 << 16) | 5678 NegotiateSSLCode = (1234 << 16) | 5679 NegotiateGSSCode = (1234 << 16) | 5680 diff --git a/vendor/github.com/lib/pq/notice.go b/vendor/github.com/lib/pq/notice.go index 61b90f81..7b9ff392 100644 --- a/vendor/github.com/lib/pq/notice.go +++ b/vendor/github.com/lib/pq/notice.go @@ -7,7 +7,7 @@ import ( // NoticeHandler returns the notice handler on the given connection, if any. A // runtime panic occurs if c is not a pq connection. This is rarely used -// directly, use ConnectorNoticeHandler and ConnectorWithNoticeHandler instead. +// directly, use [ConnectorNoticeHandler] and [ConnectorWithNoticeHandler] instead. func NoticeHandler(c driver.Conn) func(*Error) { return c.(*conn).noticeHandler } @@ -15,7 +15,7 @@ func NoticeHandler(c driver.Conn) func(*Error) { // SetNoticeHandler sets the given notice handler on the given connection. A // runtime panic occurs if c is not a pq connection. A nil handler may be used // to unset it. This is rarely used directly, use ConnectorNoticeHandler and -// ConnectorWithNoticeHandler instead. +// [ConnectorWithNoticeHandler] instead. // // Note: Notice handlers are executed synchronously by pq meaning commands // won't continue to be processed until the handler returns. @@ -41,7 +41,7 @@ func (n *NoticeHandlerConnector) Connect(ctx context.Context) (driver.Conn, erro } // ConnectorNoticeHandler returns the currently set notice handler, if any. If -// the given connector is not a result of ConnectorWithNoticeHandler, nil is +// the given connector is not a result of [ConnectorWithNoticeHandler], nil is // returned. func ConnectorNoticeHandler(c driver.Connector) func(*Error) { if c, ok := c.(*NoticeHandlerConnector); ok { diff --git a/vendor/github.com/lib/pq/notify.go b/vendor/github.com/lib/pq/notify.go index 920f0486..4f4c4227 100644 --- a/vendor/github.com/lib/pq/notify.go +++ b/vendor/github.com/lib/pq/notify.go @@ -15,19 +15,15 @@ import ( // Notification represents a single notification from the database. type Notification struct { - // Process ID (PID) of the notifying postgres backend. - BePid int - // Name of the channel the notification was sent on. - Channel string - // Payload, or the empty string if unspecified. - Extra string + BePid int // Process ID (PID) of the notifying postgres backend. + Channel string // Name of the channel the notification was sent on. + Extra string // Payload, or the empty string if unspecified. } func recvNotification(r *readBuf) *Notification { bePid := r.int32() channel := r.string() extra := r.string() - return &Notification{bePid, channel, extra} } @@ -41,8 +37,8 @@ func SetNotificationHandler(c driver.Conn, handler func(*Notification)) { c.(*conn).notificationHandler = handler } -// NotificationHandlerConnector wraps a regular connector and sets a notification handler -// on it. +// NotificationHandlerConnector wraps a regular connector and sets a +// notification handler on it. type NotificationHandlerConnector struct { driver.Connector notificationHandler func(*Notification) @@ -58,9 +54,9 @@ func (n *NotificationHandlerConnector) Connect(ctx context.Context) (driver.Conn return c, err } -// ConnectorNotificationHandler returns the currently set notification handler, if any. If -// the given connector is not a result of ConnectorWithNotificationHandler, nil is -// returned. +// ConnectorNotificationHandler returns the currently set notification handler, +// if any. If the given connector is not a result of +// [ConnectorWithNotificationHandler], nil is returned. func ConnectorNotificationHandler(c driver.Connector) func(*Notification) { if c, ok := c.(*NotificationHandlerConnector); ok { return c.notificationHandler @@ -68,11 +64,11 @@ func ConnectorNotificationHandler(c driver.Connector) func(*Notification) { return nil } -// ConnectorWithNotificationHandler creates or sets the given handler for the given -// connector. If the given connector is a result of calling this function +// ConnectorWithNotificationHandler creates or sets the given handler for the +// given connector. If the given connector is a result of calling this function // previously, it is simply set on the given connector and returned. Otherwise, -// this returns a new connector wrapping the given one and setting the notification -// handler. A nil notification handler may be used to unset it. +// this returns a new connector wrapping the given one and setting the +// notification handler. A nil notification handler may be used to unset it. // // The returned connector is intended to be used with database/sql.OpenDB. // @@ -99,8 +95,8 @@ type message struct { var errListenerConnClosed = errors.New("pq: ListenerConn has been closed") -// ListenerConn is a low-level interface for waiting for notifications. You -// should use Listener instead. +// ListenerConn is a low-level interface for waiting for notifications. You +// should use [Listener] instead. type ListenerConn struct { connectionLock sync.Mutex // guards cn and err senderLock sync.Mutex // the sending goroutine will be holding this lock @@ -130,7 +126,6 @@ func newDialListenerConn(d Dialer, name string, c chan<- *Notification) (*Listen } go l.listenerConnMain() - return l, nil } @@ -158,7 +153,7 @@ func (l *ListenerConn) releaseSenderLock() { l.senderLock.Unlock() } -// setState advances the protocol state to newState. Returns false if moving +// setState advances the protocol state to newState. Returns false if moving // to that state from the current state is not allowed. func (l *ListenerConn) setState(newState int32) bool { var expectedState int32 @@ -179,7 +174,7 @@ func (l *ListenerConn) setState(newState int32) bool { // Main logic is here: receive messages from the postgres backend, forward // notifications and query replies and keep the internal state in sync with the -// protocol state. Returns when the connection has been lost, is about to go +// protocol state. Returns when the connection has been lost, is about to go // away or should be discarded because we couldn't agree on the state with the // server backend. func (l *ListenerConn) listenerConnLoop() (err error) { @@ -236,20 +231,20 @@ func (l *ListenerConn) listenerConnLoop() (err error) { } // This is the main routine for the goroutine receiving on the database -// connection. Most of the main logic is in listenerConnLoop. +// connection. Most of the main logic is in listenerConnLoop. func (l *ListenerConn) listenerConnMain() { err := l.listenerConnLoop() // listenerConnLoop terminated; we're done, but we still have to clean up. // Make sure nobody tries to start any new queries by making sure the err - // pointer is set. It is important that we do not overwrite its value; a - // connection could be closed by either this goroutine or one sending on - // the connection -- whoever closes the connection is assumed to have the - // more meaningful error message (as the other one will probably get + // pointer is set. It is important that we do not overwrite its value; a + // connection could be closed by either this goroutine or one sending on the + // connection – whoever closes the connection is assumed to have the more + // meaningful error message (as the other one will probably get // net.errClosed), so that goroutine sets the error we expose while the - // other error is discarded. If the connection is lost while two - // goroutines are operating on the socket, it probably doesn't matter which - // error we expose so we don't try to do anything more complex. + // other error is discarded. If the connection is lost while two goroutines + // are operating on the socket, it probably doesn't matter which error we + // expose so we don't try to do anything more complex. l.connectionLock.Lock() if l.err == nil { l.err = err @@ -295,9 +290,9 @@ func (l *ListenerConn) Ping() error { return nil } -// Attempt to send a query on the connection. Returns an error if sending the -// query failed, and the caller should initiate closure of this connection. -// The caller must be holding senderLock (see acquireSenderLock and +// Attempt to send a query on the connection. Returns an error if sending the +// query failed, and the caller should initiate closure of this connection. The +// caller must be holding senderLock (see acquireSenderLock and // releaseSenderLock). func (l *ListenerConn) sendSimpleQuery(q string) (err error) { // Must set connection state before sending the query @@ -317,11 +312,11 @@ func (l *ListenerConn) sendSimpleQuery(q string) (err error) { // ExecSimpleQuery executes a "simple query" (i.e. one with no bindable // parameters) on the connection. The possible return values are: -// 1. "executed" is true; the query was executed to completion on the -// database server. If the query failed, err will be set to the error -// returned by the database, otherwise err will be nil. +// 1. "executed" is true; the query was executed to completion on the database +// server. If the query failed, err will be set to the error returned by the +// database, otherwise err will be nil. // 2. If "executed" is false, the query could not be executed on the remote -// server. err will be non-nil. +// server. err will be non-nil. // // After a call to ExecSimpleQuery has returned an executed=false value, the // connection has either been closed or will be closed shortly thereafter, and @@ -352,7 +347,7 @@ func (l *ListenerConn) ExecSimpleQuery(q string) (executed bool, err error) { m, ok := <-l.replyChan if !ok { // We lost the connection to server, don't bother waiting for a - // a response. err should have been set already. + // a response. err should have been set already. l.connectionLock.Lock() err := l.err l.connectionLock.Unlock() @@ -412,27 +407,25 @@ var ErrChannelNotOpen = errors.New("pq: channel is not open") type ListenerEventType int const ( - // ListenerEventConnected is emitted only when the database connection - // has been initially initialized. The err argument of the callback - // will always be nil. + // ListenerEventConnected is emitted only when the database connection has + // been initially initialized. The err argument of the callback will always + // be nil. ListenerEventConnected ListenerEventType = iota - // ListenerEventDisconnected is emitted after a database connection has - // been lost, either because of an error or because Close has been - // called. The err argument will be set to the reason the database - // connection was lost. + // ListenerEventDisconnected is emitted after a database connection has been + // lost, either because of an error or because Close has been called. The + // err argument will be set to the reason the database connection was lost. ListenerEventDisconnected - // ListenerEventReconnected is emitted after a database connection has - // been re-established after connection loss. The err argument of the - // callback will always be nil. After this event has been emitted, a - // nil pq.Notification is sent on the Listener.Notify channel. + // ListenerEventReconnected is emitted after a database connection has been + // re-established after connection loss. The err argument of the callback + // will always be nil. After this event has been emitted, a nil + // pq.Notification is sent on the Listener.Notify channel. ListenerEventReconnected - // ListenerEventConnectionAttemptFailed is emitted after a connection - // to the database was attempted, but failed. The err argument will be - // set to an error describing why the connection attempt did not - // succeed. + // ListenerEventConnectionAttemptFailed is emitted after a connection to the + // database was attempted, but failed. The err argument will be set to an + // error describing why the connection attempt did not succeed. ListenerEventConnectionAttemptFailed ) @@ -440,17 +433,26 @@ const ( // constants' documentation. type EventCallbackType func(event ListenerEventType, err error) +func (l ListenerEventType) String() string { + return map[ListenerEventType]string{ + ListenerEventConnected: "connected", + ListenerEventDisconnected: "disconnected", + ListenerEventReconnected: "reconnected", + ListenerEventConnectionAttemptFailed: "connectionAttemptFailed", + }[l] +} + // Listener provides an interface for listening to notifications from a -// PostgreSQL database. For general usage information, see section +// PostgreSQL database. For general usage information, see section // "Notifications". // // Listener can safely be used from concurrently running goroutines. type Listener struct { - // Channel for receiving notifications from the database. In some cases a - // nil value will be sent. See section "Notifications" above. + // Channel for receiving notifications from the database. In some cases a + // nil value will be sent. See section "Notifications" above. Notify chan *Notification - name string + dsn string minReconnectInterval time.Duration maxReconnectInterval time.Duration dialer Dialer @@ -469,98 +471,85 @@ type Listener struct { // name should be set to a connection string to be used to establish the // database connection (see section "Connection String Parameters" above). // -// minReconnectInterval controls the duration to wait before trying to -// re-establish the database connection after connection loss. After each -// consecutive failure this interval is doubled, until maxReconnectInterval is -// reached. Successfully completing the connection establishment procedure -// resets the interval back to minReconnectInterval. +// minReconnect controls the duration to wait before trying to re-establish the +// database connection after connection loss. After each consecutive failure +// this interval is doubled, until maxReconnect is reached. Successfully +// completing the connection establishment procedure resets the interval back to +// minReconnect. // -// The last parameter eventCallback can be set to a function which will be -// called by the Listener when the state of the underlying database connection -// changes. This callback will be called by the goroutine which dispatches the -// notifications over the Notify channel, so you should try to avoid doing -// potentially time-consuming operations from the callback. -func NewListener(name string, - minReconnectInterval time.Duration, - maxReconnectInterval time.Duration, - eventCallback EventCallbackType) *Listener { - return NewDialListener(defaultDialer{}, name, minReconnectInterval, maxReconnectInterval, eventCallback) +// The last parameter cb can be set to a function which will be called by the +// Listener when the state of the underlying database connection changes. This +// callback will be called by the goroutine which dispatches the notifications +// over the Notify channel, so you should try to avoid doing potentially +// time-consuming operations from the callback. +func NewListener(dsn string, minReconnect, maxReconnect time.Duration, cb EventCallbackType) *Listener { + return NewDialListener(defaultDialer{}, dsn, minReconnect, maxReconnect, cb) } // NewDialListener is like NewListener but it takes a Dialer. -func NewDialListener(d Dialer, - name string, - minReconnectInterval time.Duration, - maxReconnectInterval time.Duration, - eventCallback EventCallbackType) *Listener { - +func NewDialListener(d Dialer, dsn string, minReconnect, maxReconnect time.Duration, cb EventCallbackType) *Listener { l := &Listener{ - name: name, - minReconnectInterval: minReconnectInterval, - maxReconnectInterval: maxReconnectInterval, + dsn: dsn, + minReconnectInterval: minReconnect, + maxReconnectInterval: maxReconnect, dialer: d, - eventCallback: eventCallback, - - channels: make(map[string]struct{}), - - Notify: make(chan *Notification, 32), + eventCallback: cb, + channels: make(map[string]struct{}), + Notify: make(chan *Notification, 32), } l.reconnectCond = sync.NewCond(&l.lock) - go l.listenerMain() - return l } -// NotificationChannel returns the notification channel for this listener. -// This is the same channel as Notify, and will not be recreated during the -// life time of the Listener. +// NotificationChannel returns the notification channel for this listener. This +// is the same channel as Notify, and will not be recreated during the life time +// of the Listener. func (l *Listener) NotificationChannel() <-chan *Notification { return l.Notify } -// Listen starts listening for notifications on a channel. Calls to this +// Listen starts listening for notifications on a channel. Calls to this // function will block until an acknowledgement has been received from the -// server. Note that Listener automatically re-establishes the connection -// after connection loss, so this function may block indefinitely if the -// connection can not be re-established. +// server. Note that Listener automatically re-establishes the connection after +// connection loss, so this function may block indefinitely if the connection +// can not be re-established. // // Listen will only fail in three conditions: -// 1. The channel is already open. The returned error will be -// ErrChannelAlreadyOpen. +// 1. The channel is already open. The returned error will be +// [ErrChannelAlreadyOpen]. // 2. The query was executed on the remote server, but PostgreSQL returned an -// error message in response to the query. The returned error will be a -// pq.Error containing the information the server supplied. +// error message in response to the query. The returned error will be a +// [pq.Error] containing the information the server supplied. // 3. Close is called on the Listener before the request could be completed. // // The channel name is case-sensitive. func (l *Listener) Listen(channel string) error { l.lock.Lock() defer l.lock.Unlock() - if l.isClosed { return net.ErrClosed } // The server allows you to issue a LISTEN on a channel which is already // open, but it seems useful to be able to detect this case to spot for - // mistakes in application logic. If the application genuinely does't - // care, it can check the exported error and ignore it. + // mistakes in application logic. If the application genuinely does't care, + // it can check the exported error and ignore it. _, exists := l.channels[channel] if exists { return ErrChannelAlreadyOpen } if l.cn != nil { - // If gotResponse is true but error is set, the query was executed on - // the remote server, but resulted in an error. This should be - // relatively rare, so it's fine if we just pass the error to our - // caller. However, if gotResponse is false, we could not complete the - // query on the remote server and our underlying connection is about - // to go away, so we only add relname to l.channels, and wait for - // resync() to take care of the rest. - gotResponse, err := l.cn.Listen(channel) - if gotResponse && err != nil { + // If resp is true but error is set then the query was executed on the + // remote server but resulted in an error. This should be relatively + // rare, so it's fine if we just pass the error to our caller. + // If resp is false then we could not complete the query on the remote + // server and our underlying connection is about to go away, so we only + // add relname to l.channels, and wait for resync() to take care of the + // rest. + resp, err := l.cn.Listen(channel) + if resp && err != nil { return err } } @@ -577,9 +566,9 @@ func (l *Listener) Listen(channel string) error { return nil } -// Unlisten removes a channel from the Listener's channel list. Returns +// Unlisten removes a channel from the Listener's channel list. Returns // ErrChannelNotOpen if the Listener is not listening on the specified channel. -// Returns immediately with no error if there is no connection. Note that you +// Returns immediately with no error if there is no connection. Note that you // might still get notifications for this channel even after Unlisten has // returned. // @@ -600,11 +589,11 @@ func (l *Listener) Unlisten(channel string) error { } if l.cn != nil { - // Similarly to Listen (see comment in that function), the caller - // should only be bothered with an error if it came from the backend as - // a response to our query. - gotResponse, err := l.cn.Unlisten(channel) - if gotResponse && err != nil { + // Similarly to Listen (see comment there), the caller should only be + // bothered with an error if it came from the backend as a response to + // our query. + resp, err := l.cn.Unlisten(channel) + if resp && err != nil { return err } } @@ -614,8 +603,8 @@ func (l *Listener) Unlisten(channel string) error { return nil } -// UnlistenAll removes all channels from the Listener's channel list. Returns -// immediately with no error if there is no connection. Note that you might +// UnlistenAll removes all channels from the Listener's channel list. Returns +// immediately with no error if there is no connection. Note that you might // still get notifications for any of the deleted channels even after // UnlistenAll has returned. func (l *Listener) UnlistenAll() error { @@ -641,7 +630,7 @@ func (l *Listener) UnlistenAll() error { return nil } -// Ping the remote server to make sure it's alive. Non-nil return value means +// Ping the remote server to make sure it's alive. Non-nil return value means // that there is no active connection. func (l *Listener) Ping() error { l.lock.Lock() @@ -657,8 +646,8 @@ func (l *Listener) Ping() error { return l.cn.Ping() } -// Clean up after losing the server connection. Returns l.cn.Err(), which -// should have the reason the connection was lost. +// Clean up after losing the server connection. Returns l.cn.Err(), which should +// have the reason the connection was lost. func (l *Listener) disconnectCleanup() error { l.lock.Lock() defer l.lock.Unlock() @@ -707,10 +696,10 @@ func (l *Listener) resync(cn *ListenerConn, notificationChan <-chan *Notificatio }(notificationChan) // Ignore notifications while synchronization is going on to avoid - // deadlocks. We have to send a nil notification over Notify anyway as - // we can't possibly know which notifications (if any) were lost while - // the connection was down, so there's no reason to try and process - // these messages at all. + // deadlocks. We have to send a nil notification over Notify anyway as we + // can't possibly know which notifications (if any) were lost while the + // connection was down, so there's no reason to try and process these + // messages at all. for { select { case _, ok := <-notificationChan: @@ -742,7 +731,7 @@ func (l *Listener) connect() error { notificationChan := make(chan *Notification, 32) var err error - l.cn, err = newDialListenerConn(l.dialer, l.name, notificationChan) + l.cn, err = newDialListenerConn(l.dialer, l.dsn, notificationChan) if err != nil { return err } @@ -759,8 +748,8 @@ func (l *Listener) connect() error { } // Close disconnects the Listener from the database and shuts it down. -// Subsequent calls to its methods will return an error. Close returns an -// error if the connection has already been closed. +// Subsequent calls to its methods will return an error. Close returns an error +// if the connection has already been closed. func (l *Listener) Close() error { l.lock.Lock() defer l.lock.Unlock() @@ -789,21 +778,21 @@ func (l *Listener) emitEvent(event ListenerEventType, err error) { // Main logic here: maintain a connection to the server when possible, wait // for notifications and emit events. func (l *Listener) listenerConnLoop() { - var nextReconnect time.Time - - reconnectInterval := l.minReconnectInterval + var ( + nextReconnect time.Time + reconnectInterval = l.minReconnectInterval + ) for { for { err := l.connect() if err == nil { break } - if l.closed() { return } - l.emitEvent(ListenerEventConnectionAttemptFailed, err) + l.emitEvent(ListenerEventConnectionAttemptFailed, err) time.Sleep(reconnectInterval) reconnectInterval *= 2 if reconnectInterval > l.maxReconnectInterval { @@ -823,8 +812,7 @@ func (l *Listener) listenerConnLoop() { for { notification, ok := <-l.connNotificationChan - if !ok { - // lost connection, loop again + if !ok { // lost connection, loop again break } l.Notify <- notification diff --git a/vendor/github.com/lib/pq/pqerror/codes.go b/vendor/github.com/lib/pq/pqerror/codes.go new file mode 100644 index 00000000..f5576644 --- /dev/null +++ b/vendor/github.com/lib/pq/pqerror/codes.go @@ -0,0 +1,581 @@ +// Code generated by gen.go. DO NOT EDIT. + +// Last updated for PostgreSQL 18.3 + +package pqerror + +var ( + ClassSuccessfulCompletion = Class("00") // Successful Completion + ClassWarning = Class("01") // Warning + ClassNoData = Class("02") // No Data (this is also a warning class per the SQL standard) + ClassSQLStatementNotYetComplete = Class("03") // SQL Statement Not Yet Complete + ClassConnectionException = Class("08") // Connection Exception + ClassTriggeredActionException = Class("09") // Triggered Action Exception + ClassFeatureNotSupported = Class("0A") // Feature Not Supported + ClassInvalidTransactionInitiation = Class("0B") // Invalid Transaction Initiation + ClassLocatorException = Class("0F") // Locator Exception + ClassInvalidGrantor = Class("0L") // Invalid Grantor + ClassInvalidRoleSpecification = Class("0P") // Invalid Role Specification + ClassDiagnosticsException = Class("0Z") // Diagnostics Exception + ClassCaseNotFound = Class("20") // Case Not Found + ClassCardinalityViolation = Class("21") // Cardinality Violation + ClassDataException = Class("22") // Data Exception + ClassIntegrityConstraintViolation = Class("23") // Integrity Constraint Violation + ClassInvalidCursorState = Class("24") // Invalid Cursor State + ClassInvalidTransactionState = Class("25") // Invalid Transaction State + ClassInvalidSQLStatementName = Class("26") // Invalid SQL Statement Name + ClassTriggeredDataChangeViolation = Class("27") // Triggered Data Change Violation + ClassInvalidAuthorizationSpecification = Class("28") // Invalid Authorization Specification + ClassDependentPrivilegeDescriptorsStillExist = Class("2B") // Dependent Privilege Descriptors Still Exist + ClassInvalidTransactionTermination = Class("2D") // Invalid Transaction Termination + ClassSQLRoutineException = Class("2F") // SQL Routine Exception + ClassInvalidCursorName = Class("34") // Invalid Cursor Name + ClassExternalRoutineException = Class("38") // External Routine Exception + ClassExternalRoutineInvocationException = Class("39") // External Routine Invocation Exception + ClassSavepointException = Class("3B") // Savepoint Exception + ClassInvalidCatalogName = Class("3D") // Invalid Catalog Name + ClassInvalidSchemaName = Class("3F") // Invalid Schema Name + ClassTransactionRollback = Class("40") // Transaction Rollback + ClassSyntaxErrorOrAccessRuleViolation = Class("42") // Syntax Error or Access Rule Violation + ClassWithCheckOptionViolation = Class("44") // WITH CHECK OPTION Violation + ClassInsufficientResources = Class("53") // Insufficient Resources + ClassProgramLimitExceeded = Class("54") // Program Limit Exceeded + ClassObjectNotInPrerequisiteState = Class("55") // Object Not In Prerequisite State + ClassOperatorIntervention = Class("57") // Operator Intervention + ClassSystemError = Class("58") // System Error (errors external to PostgreSQL itself) + ClassConfigFileError = Class("F0") // Configuration File Error + ClassFDWError = Class("HV") // Foreign Data Wrapper Error (SQL/MED) + ClassPLpgSQLError = Class("P0") // PL/pgSQL Error + ClassInternalError = Class("XX") // Internal Error +) + +// A list of all error codes used in PostgreSQL. +var ( + SuccessfulCompletion = Code("00000") // Class 00 - Successful Completion + Warning = Code("01000") // Class 01 - Warning + WarningDynamicResultSetsReturned = Code("0100C") + WarningImplicitZeroBitPadding = Code("01008") + WarningNullValueEliminatedInSetFunction = Code("01003") + WarningPrivilegeNotGranted = Code("01007") + WarningPrivilegeNotRevoked = Code("01006") + WarningStringDataRightTruncation = Code("01004") + WarningDeprecatedFeature = Code("01P01") + NoData = Code("02000") // Class 02 - No Data (this is also a warning class per the SQL standard) + NoAdditionalDynamicResultSetsReturned = Code("02001") + SQLStatementNotYetComplete = Code("03000") // Class 03 - SQL Statement Not Yet Complete + ConnectionException = Code("08000") // Class 08 - Connection Exception + ConnectionDoesNotExist = Code("08003") + ConnectionFailure = Code("08006") + SQLClientUnableToEstablishSQLConnection = Code("08001") + SQLServerRejectedEstablishmentOfSQLConnection = Code("08004") + TransactionResolutionUnknown = Code("08007") + ProtocolViolation = Code("08P01") + TriggeredActionException = Code("09000") // Class 09 - Triggered Action Exception + FeatureNotSupported = Code("0A000") // Class 0A - Feature Not Supported + InvalidTransactionInitiation = Code("0B000") // Class 0B - Invalid Transaction Initiation + LocatorException = Code("0F000") // Class 0F - Locator Exception + LEInvalidSpecification = Code("0F001") + InvalidGrantor = Code("0L000") // Class 0L - Invalid Grantor + InvalidGrantOperation = Code("0LP01") + InvalidRoleSpecification = Code("0P000") // Class 0P - Invalid Role Specification + DiagnosticsException = Code("0Z000") // Class 0Z - Diagnostics Exception + StackedDiagnosticsAccessedWithoutActiveHandler = Code("0Z002") + InvalidArgumentForXquery = Code("10608") + CaseNotFound = Code("20000") // Class 20 - Case Not Found + CardinalityViolation = Code("21000") // Class 21 - Cardinality Violation + DataException = Code("22000") // Class 22 - Data Exception + ArraySubscriptError = Code("2202E") + CharacterNotInRepertoire = Code("22021") + DatetimeFieldOverflow = Code("22008") + DivisionByZero = Code("22012") + ErrorInAssignment = Code("22005") + EscapeCharacterConflict = Code("2200B") + IndicatorOverflow = Code("22022") + IntervalFieldOverflow = Code("22015") + InvalidArgumentForLog = Code("2201E") + InvalidArgumentForNtile = Code("22014") + InvalidArgumentForNthValue = Code("22016") + InvalidArgumentForPowerFunction = Code("2201F") + InvalidArgumentForWidthBucketFunction = Code("2201G") + InvalidCharacterValueForCast = Code("22018") + InvalidDatetimeFormat = Code("22007") + InvalidEscapeCharacter = Code("22019") + InvalidEscapeOctet = Code("2200D") + InvalidEscapeSequence = Code("22025") + NonstandardUseOfEscapeCharacter = Code("22P06") + InvalidIndicatorParameterValue = Code("22010") + InvalidParameterValue = Code("22023") + InvalidPrecedingOrFollowingSize = Code("22013") + InvalidRegularExpression = Code("2201B") + InvalidRowCountInLimitClause = Code("2201W") + InvalidRowCountInResultOffsetClause = Code("2201X") + InvalidTablesampleArgument = Code("2202H") + InvalidTablesampleRepeat = Code("2202G") + InvalidTimeZoneDisplacementValue = Code("22009") + InvalidUseOfEscapeCharacter = Code("2200C") + MostSpecificTypeMismatch = Code("2200G") + NullValueNotAllowed = Code("22004") + NullValueNoIndicatorParameter = Code("22002") + NumericValueOutOfRange = Code("22003") + SequenceGeneratorLimitExceeded = Code("2200H") + StringDataLengthMismatch = Code("22026") + StringDataRightTruncation = Code("22001") + SubstringError = Code("22011") + TrimError = Code("22027") + UnterminatedCString = Code("22024") + ZeroLengthCharacterString = Code("2200F") + FloatingPointException = Code("22P01") + InvalidTextRepresentation = Code("22P02") + InvalidBinaryRepresentation = Code("22P03") + BadCopyFileFormat = Code("22P04") + UntranslatableCharacter = Code("22P05") + NotAnXMLDocument = Code("2200L") + InvalidXMLDocument = Code("2200M") + InvalidXMLContent = Code("2200N") + InvalidXMLComment = Code("2200S") + InvalidXMLProcessingInstruction = Code("2200T") + DuplicateJSONObjectKeyValue = Code("22030") + InvalidArgumentForSQLJSONDatetimeFunction = Code("22031") + InvalidJSONText = Code("22032") + InvalidSQLJSONSubscript = Code("22033") + MoreThanOneSQLJSONItem = Code("22034") + NoSQLJSONItem = Code("22035") + NonNumericSQLJSONItem = Code("22036") + NonUniqueKeysInAJSONObject = Code("22037") + SingletonSQLJSONItemRequired = Code("22038") + SQLJSONArrayNotFound = Code("22039") + SQLJSONMemberNotFound = Code("2203A") + SQLJSONNumberNotFound = Code("2203B") + SQLJSONObjectNotFound = Code("2203C") + TooManyJSONArrayElements = Code("2203D") + TooManyJSONObjectMembers = Code("2203E") + SQLJSONScalarRequired = Code("2203F") + SQLJSONItemCannotBeCastToTargetType = Code("2203G") + IntegrityConstraintViolation = Code("23000") // Class 23 - Integrity Constraint Violation + RestrictViolation = Code("23001") + NotNullViolation = Code("23502") + ForeignKeyViolation = Code("23503") + UniqueViolation = Code("23505") + CheckViolation = Code("23514") + ExclusionViolation = Code("23P01") + InvalidCursorState = Code("24000") // Class 24 - Invalid Cursor State + InvalidTransactionState = Code("25000") // Class 25 - Invalid Transaction State + ActiveSQLTransaction = Code("25001") + BranchTransactionAlreadyActive = Code("25002") + HeldCursorRequiresSameIsolationLevel = Code("25008") + InappropriateAccessModeForBranchTransaction = Code("25003") + InappropriateIsolationLevelForBranchTransaction = Code("25004") + NoActiveSQLTransactionForBranchTransaction = Code("25005") + ReadOnlySQLTransaction = Code("25006") + SchemaAndDataStatementMixingNotSupported = Code("25007") + NoActiveSQLTransaction = Code("25P01") + InFailedSQLTransaction = Code("25P02") + IdleInTransactionSessionTimeout = Code("25P03") + TransactionTimeout = Code("25P04") + InvalidSQLStatementName = Code("26000") // Class 26 - Invalid SQL Statement Name + TriggeredDataChangeViolation = Code("27000") // Class 27 - Triggered Data Change Violation + InvalidAuthorizationSpecification = Code("28000") // Class 28 - Invalid Authorization Specification + InvalidPassword = Code("28P01") + DependentPrivilegeDescriptorsStillExist = Code("2B000") // Class 2B - Dependent Privilege Descriptors Still Exist + DependentObjectsStillExist = Code("2BP01") + InvalidTransactionTermination = Code("2D000") // Class 2D - Invalid Transaction Termination + SQLRoutineException = Code("2F000") // Class 2F - SQL Routine Exception + SREFunctionExecutedNoReturnStatement = Code("2F005") + SREModifyingSQLDataNotPermitted = Code("2F002") + SREProhibitedSQLStatementAttempted = Code("2F003") + SREReadingSQLDataNotPermitted = Code("2F004") + InvalidCursorName = Code("34000") // Class 34 - Invalid Cursor Name + ExternalRoutineException = Code("38000") // Class 38 - External Routine Exception + EREContainingSQLNotPermitted = Code("38001") + EREModifyingSQLDataNotPermitted = Code("38002") + EREProhibitedSQLStatementAttempted = Code("38003") + EREReadingSQLDataNotPermitted = Code("38004") + ExternalRoutineInvocationException = Code("39000") // Class 39 - External Routine Invocation Exception + ERIEInvalidSQLSTATEReturned = Code("39001") + ERIENullValueNotAllowed = Code("39004") + ERIETriggerProtocolViolated = Code("39P01") + ERIESrfProtocolViolated = Code("39P02") + ERIEEventTriggerProtocolViolated = Code("39P03") + SavepointException = Code("3B000") // Class 3B - Savepoint Exception + SEInvalidSpecification = Code("3B001") + InvalidCatalogName = Code("3D000") // Class 3D - Invalid Catalog Name + InvalidSchemaName = Code("3F000") // Class 3F - Invalid Schema Name + TransactionRollback = Code("40000") // Class 40 - Transaction Rollback + TRIntegrityConstraintViolation = Code("40002") + TRSerializationFailure = Code("40001") + TRStatementCompletionUnknown = Code("40003") + TRDeadlockDetected = Code("40P01") + SyntaxErrorOrAccessRuleViolation = Code("42000") // Class 42 - Syntax Error or Access Rule Violation + SyntaxError = Code("42601") + InsufficientPrivilege = Code("42501") + CannotCoerce = Code("42846") + GroupingError = Code("42803") + WindowingError = Code("42P20") + InvalidRecursion = Code("42P19") + InvalidForeignKey = Code("42830") + InvalidName = Code("42602") + NameTooLong = Code("42622") + ReservedName = Code("42939") + DatatypeMismatch = Code("42804") + IndeterminateDatatype = Code("42P18") + CollationMismatch = Code("42P21") + IndeterminateCollation = Code("42P22") + WrongObjectType = Code("42809") + GeneratedAlways = Code("428C9") + UndefinedColumn = Code("42703") + UndefinedFunction = Code("42883") + UndefinedTable = Code("42P01") + UndefinedParameter = Code("42P02") + UndefinedObject = Code("42704") + DuplicateColumn = Code("42701") + DuplicateCursor = Code("42P03") + DuplicateDatabase = Code("42P04") + DuplicateFunction = Code("42723") + DuplicatePstatement = Code("42P05") + DuplicateSchema = Code("42P06") + DuplicateTable = Code("42P07") + DuplicateAlias = Code("42712") + DuplicateObject = Code("42710") + AmbiguousColumn = Code("42702") + AmbiguousFunction = Code("42725") + AmbiguousParameter = Code("42P08") + AmbiguousAlias = Code("42P09") + InvalidColumnReference = Code("42P10") + InvalidColumnDefinition = Code("42611") + InvalidCursorDefinition = Code("42P11") + InvalidDatabaseDefinition = Code("42P12") + InvalidFunctionDefinition = Code("42P13") + InvalidPstatementDefinition = Code("42P14") + InvalidSchemaDefinition = Code("42P15") + InvalidTableDefinition = Code("42P16") + InvalidObjectDefinition = Code("42P17") + WithCheckOptionViolation = Code("44000") // Class 44 - WITH CHECK OPTION Violation + InsufficientResources = Code("53000") // Class 53 - Insufficient Resources + DiskFull = Code("53100") + OutOfMemory = Code("53200") + TooManyConnections = Code("53300") + ConfigurationLimitExceeded = Code("53400") + ProgramLimitExceeded = Code("54000") // Class 54 - Program Limit Exceeded + StatementTooComplex = Code("54001") + TooManyColumns = Code("54011") + TooManyArguments = Code("54023") + ObjectNotInPrerequisiteState = Code("55000") // Class 55 - Object Not In Prerequisite State + ObjectInUse = Code("55006") + CantChangeRuntimeParam = Code("55P02") + LockNotAvailable = Code("55P03") + UnsafeNewEnumValueUsage = Code("55P04") + OperatorIntervention = Code("57000") // Class 57 - Operator Intervention + QueryCanceled = Code("57014") + AdminShutdown = Code("57P01") + CrashShutdown = Code("57P02") + CannotConnectNow = Code("57P03") + DatabaseDropped = Code("57P04") + IdleSessionTimeout = Code("57P05") + SystemError = Code("58000") // Class 58 - System Error (errors external to PostgreSQL itself) + IOError = Code("58030") + UndefinedFile = Code("58P01") + DuplicateFile = Code("58P02") + FileNameTooLong = Code("58P03") + ConfigFileError = Code("F0000") // Class F0 - Configuration File Error + LockFileExists = Code("F0001") + FDWError = Code("HV000") // Class HV - Foreign Data Wrapper Error (SQL/MED) + FDWColumnNameNotFound = Code("HV005") + FDWDynamicParameterValueNeeded = Code("HV002") + FDWFunctionSequenceError = Code("HV010") + FDWInconsistentDescriptorInformation = Code("HV021") + FDWInvalidAttributeValue = Code("HV024") + FDWInvalidColumnName = Code("HV007") + FDWInvalidColumnNumber = Code("HV008") + FDWInvalidDataType = Code("HV004") + FDWInvalidDataTypeDescriptors = Code("HV006") + FDWInvalidDescriptorFieldIdentifier = Code("HV091") + FDWInvalidHandle = Code("HV00B") + FDWInvalidOptionIndex = Code("HV00C") + FDWInvalidOptionName = Code("HV00D") + FDWInvalidStringLengthOrBufferLength = Code("HV090") + FDWInvalidStringFormat = Code("HV00A") + FDWInvalidUseOfNullPointer = Code("HV009") + FDWTooManyHandles = Code("HV014") + FDWOutOfMemory = Code("HV001") + FDWNoSchemas = Code("HV00P") + FDWOptionNameNotFound = Code("HV00J") + FDWReplyHandle = Code("HV00K") + FDWSchemaNotFound = Code("HV00Q") + FDWTableNotFound = Code("HV00R") + FDWUnableToCreateExecution = Code("HV00L") + FDWUnableToCreateReply = Code("HV00M") + FDWUnableToEstablishConnection = Code("HV00N") + PLpgSQLError = Code("P0000") // Class P0 - PL/pgSQL Error + RaiseException = Code("P0001") + NoDataFound = Code("P0002") + TooManyRows = Code("P0003") + AssertFailure = Code("P0004") + InternalError = Code("XX000") // Class XX - Internal Error + DataCorrupted = Code("XX001") + IndexCorrupted = Code("XX002") +) + +var errorCodeNames = map[Code]string{ + "00000": "successful_completion", + "01000": "warning", + "0100C": "dynamic_result_sets_returned", + "01008": "implicit_zero_bit_padding", + "01003": "null_value_eliminated_in_set_function", + "01007": "privilege_not_granted", + "01006": "privilege_not_revoked", + "01004": "string_data_right_truncation", + "01P01": "deprecated_feature", + "02000": "no_data", + "02001": "no_additional_dynamic_result_sets_returned", + "03000": "sql_statement_not_yet_complete", + "08000": "connection_exception", + "08003": "connection_does_not_exist", + "08006": "connection_failure", + "08001": "sqlclient_unable_to_establish_sqlconnection", + "08004": "sqlserver_rejected_establishment_of_sqlconnection", + "08007": "transaction_resolution_unknown", + "08P01": "protocol_violation", + "09000": "triggered_action_exception", + "0A000": "feature_not_supported", + "0B000": "invalid_transaction_initiation", + "0F000": "locator_exception", + "0F001": "invalid_locator_specification", + "0L000": "invalid_grantor", + "0LP01": "invalid_grant_operation", + "0P000": "invalid_role_specification", + "0Z000": "diagnostics_exception", + "0Z002": "stacked_diagnostics_accessed_without_active_handler", + "10608": "invalid_argument_for_xquery", + "20000": "case_not_found", + "21000": "cardinality_violation", + "22000": "data_exception", + "2202E": "array_subscript_error", + "22021": "character_not_in_repertoire", + "22008": "datetime_field_overflow", + "22012": "division_by_zero", + "22005": "error_in_assignment", + "2200B": "escape_character_conflict", + "22022": "indicator_overflow", + "22015": "interval_field_overflow", + "2201E": "invalid_argument_for_logarithm", + "22014": "invalid_argument_for_ntile_function", + "22016": "invalid_argument_for_nth_value_function", + "2201F": "invalid_argument_for_power_function", + "2201G": "invalid_argument_for_width_bucket_function", + "22018": "invalid_character_value_for_cast", + "22007": "invalid_datetime_format", + "22019": "invalid_escape_character", + "2200D": "invalid_escape_octet", + "22025": "invalid_escape_sequence", + "22P06": "nonstandard_use_of_escape_character", + "22010": "invalid_indicator_parameter_value", + "22023": "invalid_parameter_value", + "22013": "invalid_preceding_or_following_size", + "2201B": "invalid_regular_expression", + "2201W": "invalid_row_count_in_limit_clause", + "2201X": "invalid_row_count_in_result_offset_clause", + "2202H": "invalid_tablesample_argument", + "2202G": "invalid_tablesample_repeat", + "22009": "invalid_time_zone_displacement_value", + "2200C": "invalid_use_of_escape_character", + "2200G": "most_specific_type_mismatch", + "22004": "null_value_not_allowed", + "22002": "null_value_no_indicator_parameter", + "22003": "numeric_value_out_of_range", + "2200H": "sequence_generator_limit_exceeded", + "22026": "string_data_length_mismatch", + "22001": "string_data_right_truncation", + "22011": "substring_error", + "22027": "trim_error", + "22024": "unterminated_c_string", + "2200F": "zero_length_character_string", + "22P01": "floating_point_exception", + "22P02": "invalid_text_representation", + "22P03": "invalid_binary_representation", + "22P04": "bad_copy_file_format", + "22P05": "untranslatable_character", + "2200L": "not_an_xml_document", + "2200M": "invalid_xml_document", + "2200N": "invalid_xml_content", + "2200S": "invalid_xml_comment", + "2200T": "invalid_xml_processing_instruction", + "22030": "duplicate_json_object_key_value", + "22031": "invalid_argument_for_sql_json_datetime_function", + "22032": "invalid_json_text", + "22033": "invalid_sql_json_subscript", + "22034": "more_than_one_sql_json_item", + "22035": "no_sql_json_item", + "22036": "non_numeric_sql_json_item", + "22037": "non_unique_keys_in_a_json_object", + "22038": "singleton_sql_json_item_required", + "22039": "sql_json_array_not_found", + "2203A": "sql_json_member_not_found", + "2203B": "sql_json_number_not_found", + "2203C": "sql_json_object_not_found", + "2203D": "too_many_json_array_elements", + "2203E": "too_many_json_object_members", + "2203F": "sql_json_scalar_required", + "2203G": "sql_json_item_cannot_be_cast_to_target_type", + "23000": "integrity_constraint_violation", + "23001": "restrict_violation", + "23502": "not_null_violation", + "23503": "foreign_key_violation", + "23505": "unique_violation", + "23514": "check_violation", + "23P01": "exclusion_violation", + "24000": "invalid_cursor_state", + "25000": "invalid_transaction_state", + "25001": "active_sql_transaction", + "25002": "branch_transaction_already_active", + "25008": "held_cursor_requires_same_isolation_level", + "25003": "inappropriate_access_mode_for_branch_transaction", + "25004": "inappropriate_isolation_level_for_branch_transaction", + "25005": "no_active_sql_transaction_for_branch_transaction", + "25006": "read_only_sql_transaction", + "25007": "schema_and_data_statement_mixing_not_supported", + "25P01": "no_active_sql_transaction", + "25P02": "in_failed_sql_transaction", + "25P03": "idle_in_transaction_session_timeout", + "25P04": "transaction_timeout", + "26000": "invalid_sql_statement_name", + "27000": "triggered_data_change_violation", + "28000": "invalid_authorization_specification", + "28P01": "invalid_password", + "2B000": "dependent_privilege_descriptors_still_exist", + "2BP01": "dependent_objects_still_exist", + "2D000": "invalid_transaction_termination", + "2F000": "sql_routine_exception", + "2F005": "function_executed_no_return_statement", + "2F002": "modifying_sql_data_not_permitted", + "2F003": "prohibited_sql_statement_attempted", + "2F004": "reading_sql_data_not_permitted", + "34000": "invalid_cursor_name", + "38000": "external_routine_exception", + "38001": "containing_sql_not_permitted", + "38002": "modifying_sql_data_not_permitted", + "38003": "prohibited_sql_statement_attempted", + "38004": "reading_sql_data_not_permitted", + "39000": "external_routine_invocation_exception", + "39001": "invalid_sqlstate_returned", + "39004": "null_value_not_allowed", + "39P01": "trigger_protocol_violated", + "39P02": "srf_protocol_violated", + "39P03": "event_trigger_protocol_violated", + "3B000": "savepoint_exception", + "3B001": "invalid_savepoint_specification", + "3D000": "invalid_catalog_name", + "3F000": "invalid_schema_name", + "40000": "transaction_rollback", + "40002": "transaction_integrity_constraint_violation", + "40001": "serialization_failure", + "40003": "statement_completion_unknown", + "40P01": "deadlock_detected", + "42000": "syntax_error_or_access_rule_violation", + "42601": "syntax_error", + "42501": "insufficient_privilege", + "42846": "cannot_coerce", + "42803": "grouping_error", + "42P20": "windowing_error", + "42P19": "invalid_recursion", + "42830": "invalid_foreign_key", + "42602": "invalid_name", + "42622": "name_too_long", + "42939": "reserved_name", + "42804": "datatype_mismatch", + "42P18": "indeterminate_datatype", + "42P21": "collation_mismatch", + "42P22": "indeterminate_collation", + "42809": "wrong_object_type", + "428C9": "generated_always", + "42703": "undefined_column", + "42883": "undefined_function", + "42P01": "undefined_table", + "42P02": "undefined_parameter", + "42704": "undefined_object", + "42701": "duplicate_column", + "42P03": "duplicate_cursor", + "42P04": "duplicate_database", + "42723": "duplicate_function", + "42P05": "duplicate_prepared_statement", + "42P06": "duplicate_schema", + "42P07": "duplicate_table", + "42712": "duplicate_alias", + "42710": "duplicate_object", + "42702": "ambiguous_column", + "42725": "ambiguous_function", + "42P08": "ambiguous_parameter", + "42P09": "ambiguous_alias", + "42P10": "invalid_column_reference", + "42611": "invalid_column_definition", + "42P11": "invalid_cursor_definition", + "42P12": "invalid_database_definition", + "42P13": "invalid_function_definition", + "42P14": "invalid_prepared_statement_definition", + "42P15": "invalid_schema_definition", + "42P16": "invalid_table_definition", + "42P17": "invalid_object_definition", + "44000": "with_check_option_violation", + "53000": "insufficient_resources", + "53100": "disk_full", + "53200": "out_of_memory", + "53300": "too_many_connections", + "53400": "configuration_limit_exceeded", + "54000": "program_limit_exceeded", + "54001": "statement_too_complex", + "54011": "too_many_columns", + "54023": "too_many_arguments", + "55000": "object_not_in_prerequisite_state", + "55006": "object_in_use", + "55P02": "cant_change_runtime_param", + "55P03": "lock_not_available", + "55P04": "unsafe_new_enum_value_usage", + "57000": "operator_intervention", + "57014": "query_canceled", + "57P01": "admin_shutdown", + "57P02": "crash_shutdown", + "57P03": "cannot_connect_now", + "57P04": "database_dropped", + "57P05": "idle_session_timeout", + "58000": "system_error", + "58030": "io_error", + "58P01": "undefined_file", + "58P02": "duplicate_file", + "58P03": "file_name_too_long", + "F0000": "config_file_error", + "F0001": "lock_file_exists", + "HV000": "fdw_error", + "HV005": "fdw_column_name_not_found", + "HV002": "fdw_dynamic_parameter_value_needed", + "HV010": "fdw_function_sequence_error", + "HV021": "fdw_inconsistent_descriptor_information", + "HV024": "fdw_invalid_attribute_value", + "HV007": "fdw_invalid_column_name", + "HV008": "fdw_invalid_column_number", + "HV004": "fdw_invalid_data_type", + "HV006": "fdw_invalid_data_type_descriptors", + "HV091": "fdw_invalid_descriptor_field_identifier", + "HV00B": "fdw_invalid_handle", + "HV00C": "fdw_invalid_option_index", + "HV00D": "fdw_invalid_option_name", + "HV090": "fdw_invalid_string_length_or_buffer_length", + "HV00A": "fdw_invalid_string_format", + "HV009": "fdw_invalid_use_of_null_pointer", + "HV014": "fdw_too_many_handles", + "HV001": "fdw_out_of_memory", + "HV00P": "fdw_no_schemas", + "HV00J": "fdw_option_name_not_found", + "HV00K": "fdw_reply_handle", + "HV00Q": "fdw_schema_not_found", + "HV00R": "fdw_table_not_found", + "HV00L": "fdw_unable_to_create_execution", + "HV00M": "fdw_unable_to_create_reply", + "HV00N": "fdw_unable_to_establish_connection", + "P0000": "plpgsql_error", + "P0001": "raise_exception", + "P0002": "no_data_found", + "P0003": "too_many_rows", + "P0004": "assert_failure", + "XX000": "internal_error", + "XX001": "data_corrupted", + "XX002": "index_corrupted", +} diff --git a/vendor/github.com/lib/pq/pqerror/pqerror.go b/vendor/github.com/lib/pq/pqerror/pqerror.go new file mode 100644 index 00000000..29e49e99 --- /dev/null +++ b/vendor/github.com/lib/pq/pqerror/pqerror.go @@ -0,0 +1,35 @@ +//go:generate go run gen.go + +// Package pqerror contains PostgreSQL error codes for use with pq.Error. +package pqerror + +// Code is a five-character error code. +type Code string + +// Name returns a more human friendly rendering of the error code, namely the +// "condition name". +func (ec Code) Name() string { return errorCodeNames[ec] } + +// Class returns the error class, e.g. "28". +func (ec Code) Class() Class { return Class(ec[:2]) } + +// Class is only the class part of an error code. +type Class string + +// Name returns the condition name of an error class. It is equivalent to the +// condition name of the "standard" error code (i.e. the one having the last +// three characters "000"). +func (ec Class) Name() string { return errorCodeNames[Code(ec+"000")] } + +// TODO(v2): use "type Severity string" for the below. + +// Error severity values. +const ( + SeverityFatal = "FATAL" + SeverityPanic = "PANIC" + SeverityWarning = "WARNING" + SeverityNotice = "NOTICE" + SeverityDebug = "DEBUG" + SeverityInfo = "INFO" + SeverityLog = "LOG" +) diff --git a/vendor/github.com/lib/pq/ssl.go b/vendor/github.com/lib/pq/ssl.go index 3aea110e..b9357854 100644 --- a/vendor/github.com/lib/pq/ssl.go +++ b/vendor/github.com/lib/pq/ssl.go @@ -1,17 +1,18 @@ package pq import ( + "bytes" "crypto/tls" "crypto/x509" + "encoding/pem" "errors" "fmt" "net" "os" "path/filepath" - "runtime" + "slices" "strings" "sync" - "syscall" "github.com/lib/pq/internal/pqutil" ) @@ -59,76 +60,91 @@ func getTLSConfigClone(key string) *tls.Config { // ssl generates a function to upgrade a net.Conn based on the "sslmode" and // related settings. The function is nil when no upgrade should take place. -func ssl(cfg Config) (func(net.Conn) (net.Conn, error), error) { +// +// Don't refer to Config.SSLMode here, as the mode in arguments may be different +// in case of sslmode=allow or prefer. +func ssl(cfg Config, mode SSLMode) (func(net.Conn) (net.Conn, error), error) { var ( + home = pqutil.Home(true) + // Don't set defaults here, because tlsConf may be overwritten if a + // custom one was registered. Set it after the sslmode switch. + tlsConf = &tls.Config{} + // Only verify the CA signing but not the hostname. verifyCaOnly = false - tlsConf = &tls.Config{} - mode = cfg.SSLMode ) + if mode.useSSL() && !cfg.SSLInline && cfg.SSLRootCert == "" && home != "" { + f := filepath.Join(home, "root.crt") + if _, err := os.Stat(f); err == nil { + cfg.SSLRootCert = f + } + } switch { - // "require" is the default. - case mode == "" || mode == SSLModeRequire: - // We must skip TLS's own verification since it requires full - // verification since Go 1.3. + case mode == SSLModeDisable || mode == SSLModeAllow: + return nil, nil + + case mode == "" || mode == SSLModeRequire || mode == SSLModePrefer: + // Skip TLS's own verification since it requires full verification. tlsConf.InsecureSkipVerify = true // From http://www.postgresql.org/docs/current/static/libpq-ssl.html: // - // Note: For backwards compatibility with earlier versions of - // PostgreSQL, if a root CA file exists, the behavior of - // sslmode=require will be the same as that of verify-ca, meaning the - // server certificate is validated against the CA. Relying on this - // behavior is discouraged, and applications that need certificate - // validation should always use verify-ca or verify-full. + // For backwards compatibility with earlier versions of PostgreSQL, if a + // root CA file exists, the behavior of sslmode=require will be the same + // as that of verify-ca, meaning the server certificate is validated + // against the CA. Relying on this behavior is discouraged, and + // applications that need certificate validation should always use + // verify-ca or verify-full. if cfg.SSLRootCert != "" { - if _, err := os.Stat(cfg.SSLRootCert); err == nil { + if cfg.SSLInline { + verifyCaOnly = true + } else if _, err := os.Stat(cfg.SSLRootCert); err == nil { verifyCaOnly = true - } else { + } else if cfg.SSLRootCert != "system" { cfg.SSLRootCert = "" } } case mode == SSLModeVerifyCA: - // We must skip TLS's own verification since it requires full - // verification since Go 1.3. + // Skip TLS's own verification since it requires full verification. tlsConf.InsecureSkipVerify = true verifyCaOnly = true case mode == SSLModeVerifyFull: tlsConf.ServerName = cfg.Host - case mode == SSLModeDisable: - return nil, nil case strings.HasPrefix(string(mode), "pqgo-"): tlsConf = getTLSConfigClone(string(mode[5:])) if tlsConf == nil { return nil, fmt.Errorf(`pq: unknown custom sslmode %q`, mode) } default: - return nil, fmt.Errorf( - `pq: unsupported sslmode %q; only "require" (default), "verify-full", "verify-ca", and "disable" supported`, - mode) + panic("unreachable") } - // Set Server Name Indication (SNI), if enabled by connection parameters. + tlsConf.MinVersion = cfg.SSLMinProtocolVersion.tlsconf() + tlsConf.MaxVersion = cfg.SSLMaxProtocolVersion.tlsconf() + + // RFC 6066 asks to not set SNI if the host is a literal IP address (IPv4 or + // IPv6). This check is coded already crypto.tls.hostnameInSNI, so just + // always set ServerName here and let crypto/tls do the filtering. if cfg.SSLSNI { - // RFC 6066 asks to not set SNI if the host is a literal IP address (IPv4 - // or IPv6). This check is coded already crypto.tls.hostnameInSNI, so - // just always set ServerName here and let crypto/tls do the filtering. tlsConf.ServerName = cfg.Host } - err := sslClientCertificates(tlsConf, cfg) + err := sslClientCertificates(tlsConf, cfg, home) if err != nil { return nil, err } - err = sslCertificateAuthority(tlsConf, cfg) + rootPem, err := sslCertificateAuthority(tlsConf, cfg) if err != nil { return nil, err } + sslAppendIntermediates(tlsConf, cfg, rootPem) // Accept renegotiation requests initiated by the backend. // - // Renegotiation was deprecated then removed from PostgreSQL 9.5, but - // the default configuration of older versions has it enabled. Redshift - // also initiates renegotiations and cannot be reconfigured. + // Renegotiation was deprecated then removed from PostgreSQL 9.5, but the + // default configuration of older versions has it enabled. Redshift also + // initiates renegotiations and cannot be reconfigured. + // + // TODO: I think this can be removed? tlsConf.Renegotiation = tls.RenegotiateFreelyAsClient return func(conn net.Conn) (net.Conn, error) { @@ -157,94 +173,140 @@ func ssl(cfg Config) (func(net.Conn) (net.Conn, error), error) { // "sslkey" settings, or if they aren't set, from the .postgresql directory // in the user's home directory. The configured files must exist and have // the correct permissions. -func sslClientCertificates(tlsConf *tls.Config, cfg Config) error { +func sslClientCertificates(tlsConf *tls.Config, cfg Config, home string) error { if cfg.SSLInline { cert, err := tls.X509KeyPair([]byte(cfg.SSLCert), []byte(cfg.SSLKey)) if err != nil { return err } - tlsConf.Certificates = []tls.Certificate{cert} + // Use GetClientCertificate instead of the Certificates field. When + // Certificates is set, Go's TLS client only sends the cert if the + // server's CertificateRequest includes a CA that issued it. When the + // client cert was signed by an intermediate CA but the server only + // advertises the root CA, Go skips sending the cert entirely. + // GetClientCertificate bypasses this filtering. + tlsConf.GetClientCertificate = func(*tls.CertificateRequestInfo) (*tls.Certificate, error) { + return &cert, nil + } return nil } - home := pqutil.Home() - - // In libpq, the client certificate is only loaded if the setting is not blank. - // - // https://github.com/postgres/postgres/blob/REL9_6_2/src/interfaces/libpq/fe-secure-openssl.c#L1036-L1037 - sslcert := cfg.SSLCert - if len(sslcert) == 0 && home != "" { - if runtime.GOOS == "windows" { - sslcert = filepath.Join(sslcert, "postgresql.crt") - } else { - sslcert = filepath.Join(home, ".postgresql/postgresql.crt") - } + // Only load client certificate and key if the setting is not blank, like libpq. + if cfg.SSLCert == "" && home != "" { + cfg.SSLCert = filepath.Join(home, "postgresql.crt") } - // https://github.com/postgres/postgres/blob/REL9_6_2/src/interfaces/libpq/fe-secure-openssl.c#L1045 - if len(sslcert) == 0 { + if cfg.SSLCert == "" { return nil } - // https://github.com/postgres/postgres/blob/REL9_6_2/src/interfaces/libpq/fe-secure-openssl.c#L1050:L1054 - _, err := os.Stat(sslcert) + _, err := os.Stat(cfg.SSLCert) if err != nil { - perr := new(os.PathError) - if errors.As(err, &perr) && (perr.Err == syscall.ENOENT || perr.Err == syscall.ENOTDIR) { + if pqutil.ErrNotExists(err) { return nil } return err } // In libpq, the ssl key is only loaded if the setting is not blank. - // - // https://github.com/postgres/postgres/blob/REL9_6_2/src/interfaces/libpq/fe-secure-openssl.c#L1123-L1222 - sslkey := cfg.SSLKey - if len(sslkey) == 0 && home != "" { - if runtime.GOOS == "windows" { - sslkey = filepath.Join(home, "postgresql.key") - } else { - sslkey = filepath.Join(home, ".postgresql/postgresql.key") - } + if cfg.SSLKey == "" && home != "" { + cfg.SSLKey = filepath.Join(home, "postgresql.key") } - - if len(sslkey) > 0 { - err := pqutil.SSLKeyPermissions(sslkey) + if cfg.SSLKey != "" { + err := pqutil.SSLKeyPermissions(cfg.SSLKey) if err != nil { return err } } - cert, err := tls.LoadX509KeyPair(sslcert, sslkey) + cert, err := tls.LoadX509KeyPair(cfg.SSLCert, cfg.SSLKey) if err != nil { return err } - tlsConf.Certificates = []tls.Certificate{cert} + // Using GetClientCertificate instead of Certificates per comment above. + tlsConf.GetClientCertificate = func(*tls.CertificateRequestInfo) (*tls.Certificate, error) { + return &cert, nil + } return nil } +var testSystemRoots *x509.CertPool + // sslCertificateAuthority adds the RootCA specified in the "sslrootcert" setting. -func sslCertificateAuthority(tlsConf *tls.Config, cfg Config) error { - // In libpq, the root certificate is only loaded if the setting is not blank. - // - // https://github.com/postgres/postgres/blob/REL9_6_2/src/interfaces/libpq/fe-secure-openssl.c#L950-L951 - if sslrootcert := cfg.SSLRootCert; len(sslrootcert) > 0 { - tlsConf.RootCAs = x509.NewCertPool() - - var cert []byte - if cfg.SSLInline { - cert = []byte(sslrootcert) - } else { - var err error - cert, err = os.ReadFile(sslrootcert) - if err != nil { - return err - } +func sslCertificateAuthority(tlsConf *tls.Config, cfg Config) ([]byte, error) { + // Only load root certificate if not blank, like libpq. + if cfg.SSLRootCert == "" { + return nil, nil + } + + if cfg.SSLRootCert == "system" { + // No work to do as system CAs are used by default if RootCAs is nil. + tlsConf.RootCAs = testSystemRoots + return nil, nil + } + + tlsConf.RootCAs = x509.NewCertPool() + + var cert []byte + if cfg.SSLInline { + cert = []byte(cfg.SSLRootCert) + } else { + var err error + cert, err = os.ReadFile(cfg.SSLRootCert) + if err != nil { + return nil, err } + } + + if !tlsConf.RootCAs.AppendCertsFromPEM(cert) { + return nil, errors.New("pq: couldn't parse pem from sslrootcert") + } + return cert, nil +} + +// sslAppendIntermediates appends intermediate CA certificates from sslrootcert +// to the client certificate chain. This is needed so the server can verify the +// client cert when it was signed by an intermediate CA — without this, the TLS +// handshake only sends the leaf client cert. +func sslAppendIntermediates(tlsConf *tls.Config, cfg Config, rootPem []byte) { + if cfg.SSLRootCert == "" || tlsConf.GetClientCertificate == nil || len(rootPem) == 0 { + return + } - if !tlsConf.RootCAs.AppendCertsFromPEM(cert) { - return errors.New("pq: couldn't parse pem in sslrootcert") + var ( + pemData = slices.Clone(rootPem) + intermediates [][]byte + ) + for { + var block *pem.Block + block, pemData = pem.Decode(pemData) + if block == nil { + break + } + if block.Type != "CERTIFICATE" { + continue + } + cert, err := x509.ParseCertificate(block.Bytes) + if err != nil { + continue + } + // Skip self-signed root CAs; only append intermediates. + if cert.IsCA && !bytes.Equal(cert.RawIssuer, cert.RawSubject) { + intermediates = append(intermediates, block.Bytes) } } + if len(intermediates) == 0 { + return + } - return nil + // Wrap the existing GetClientCertificate to append intermediate certs to + // the certificate chain returned during the TLS handshake. + origGetCert := tlsConf.GetClientCertificate + tlsConf.GetClientCertificate = func(info *tls.CertificateRequestInfo) (*tls.Certificate, error) { + cert, err := origGetCert(info) + if err != nil { + return cert, err + } + cert.Certificate = append(cert.Certificate, intermediates...) + return cert, nil + } } diff --git a/vendor/github.com/mattn/go-sqlite3/sqlite3-binding.c b/vendor/github.com/mattn/go-sqlite3/sqlite3-binding.c index 41a0c9ef..4c27973b 100644 --- a/vendor/github.com/mattn/go-sqlite3/sqlite3-binding.c +++ b/vendor/github.com/mattn/go-sqlite3/sqlite3-binding.c @@ -1,7 +1,7 @@ #ifndef USE_LIBSQLITE3 /****************************************************************************** ** This file is an amalgamation of many separate C source files from SQLite -** version 3.51.2. By combining all the individual C code files into this +** version 3.51.3. By combining all the individual C code files into this ** single large file, the entire code can be compiled as a single translation ** unit. This allows many compilers to do optimizations that would not be ** possible if the files were compiled separately. Performance improvements @@ -19,7 +19,7 @@ ** separate file. This file contains only code for the core SQLite library. ** ** The content in this amalgamation comes from Fossil check-in -** b270f8339eb13b504d0b2ba154ebca966b7d with changes in files: +** 737ae4a34738ffa0c3ff7f9bb18df914dd1c with changes in files: ** ** */ @@ -468,12 +468,12 @@ extern "C" { ** [sqlite3_libversion_number()], [sqlite3_sourceid()], ** [sqlite_version()] and [sqlite_source_id()]. */ -#define SQLITE_VERSION "3.51.2" -#define SQLITE_VERSION_NUMBER 3051002 -#define SQLITE_SOURCE_ID "2026-01-09 17:27:48 b270f8339eb13b504d0b2ba154ebca966b7dde08e40c3ed7d559749818cb2075" +#define SQLITE_VERSION "3.51.3" +#define SQLITE_VERSION_NUMBER 3051003 +#define SQLITE_SOURCE_ID "2026-03-13 10:38:09 737ae4a34738ffa0c3ff7f9bb18df914dd1cad163f28fd6b6e114a344fe6d618" #define SQLITE_SCM_BRANCH "branch-3.51" -#define SQLITE_SCM_TAGS "release version-3.51.2" -#define SQLITE_SCM_DATETIME "2026-01-09T17:27:48.405Z" +#define SQLITE_SCM_TAGS "release version-3.51.3" +#define SQLITE_SCM_DATETIME "2026-03-13T10:38:09.694Z" /* ** CAPI3REF: Run-Time Library Version Numbers @@ -14335,6 +14335,27 @@ struct fts5_api { #endif #define SQLITE_MIN_LENGTH 30 /* Minimum value for the length limit */ +/* +** Maximum size of any single memory allocation. +** +** This is not a limit on the total amount of memory used. This is +** a limit on the size parameter to sqlite3_malloc() and sqlite3_realloc(). +** +** The upper bound is slightly less than 2GiB: 0x7ffffeff == 2,147,483,391 +** This provides a 256-byte safety margin for defense against 32-bit +** signed integer overflow bugs when computing memory allocation sizes. +** Paranoid applications might want to reduce the maximum allocation size +** further for an even larger safety margin. 0x3fffffff or 0x0fffffff +** or even smaller would be reasonable upper bounds on the size of a memory +** allocations for most applications. +*/ +#ifndef SQLITE_MAX_ALLOCATION_SIZE +# define SQLITE_MAX_ALLOCATION_SIZE 2147483391 +#endif +#if SQLITE_MAX_ALLOCATION_SIZE>2147483391 +# error Maximum size for SQLITE_MAX_ALLOCATION_SIZE is 2147483391 +#endif + /* ** This is the maximum number of ** @@ -21665,6 +21686,7 @@ SQLITE_PRIVATE Select *sqlite3SelectNew(Parse*,ExprList*,SrcList*,Expr*,ExprList Expr*,ExprList*,u32,Expr*); SQLITE_PRIVATE void sqlite3SelectDelete(sqlite3*, Select*); SQLITE_PRIVATE void sqlite3SelectDeleteGeneric(sqlite3*,void*); +SQLITE_PRIVATE void sqlite3SelectCheckOnClauses(Parse *pParse, Select *pSelect); SQLITE_PRIVATE Table *sqlite3SrcListLookup(Parse*, SrcList*); SQLITE_PRIVATE int sqlite3IsReadOnly(Parse*, Table*, Trigger*); SQLITE_PRIVATE void sqlite3OpenTable(Parse*, int iCur, int iDb, Table*, int); @@ -31311,27 +31333,6 @@ static void mallocWithAlarm(int n, void **pp){ *pp = p; } -/* -** Maximum size of any single memory allocation. -** -** This is not a limit on the total amount of memory used. This is -** a limit on the size parameter to sqlite3_malloc() and sqlite3_realloc(). -** -** The upper bound is slightly less than 2GiB: 0x7ffffeff == 2,147,483,391 -** This provides a 256-byte safety margin for defense against 32-bit -** signed integer overflow bugs when computing memory allocation sizes. -** Paranoid applications might want to reduce the maximum allocation size -** further for an even larger safety margin. 0x3fffffff or 0x0fffffff -** or even smaller would be reasonable upper bounds on the size of a memory -** allocations for most applications. -*/ -#ifndef SQLITE_MAX_ALLOCATION_SIZE -# define SQLITE_MAX_ALLOCATION_SIZE 2147483391 -#endif -#if SQLITE_MAX_ALLOCATION_SIZE>2147483391 -# error Maximum size for SQLITE_MAX_ALLOCATION_SIZE is 2147483391 -#endif - /* ** Allocate memory. This routine is like sqlite3_malloc() except that it ** assumes the memory subsystem has already been initialized. @@ -31555,8 +31556,7 @@ SQLITE_PRIVATE void *sqlite3Realloc(void *pOld, u64 nBytes){ sqlite3_free(pOld); /* IMP: R-26507-47431 */ return 0; } - if( nBytes>=0x7fffff00 ){ - /* The 0x7ffff00 limit term is explained in comments on sqlite3Malloc() */ + if( nBytes>SQLITE_MAX_ALLOCATION_SIZE ){ return 0; } nOld = sqlite3MallocSize(pOld); @@ -69011,68 +69011,82 @@ static int walCheckpoint( && (rc = walBusyLock(pWal,xBusy,pBusyArg,WAL_READ_LOCK(0),1))==SQLITE_OK ){ u32 nBackfill = pInfo->nBackfill; - pInfo->nBackfillAttempted = mxSafeFrame; SEH_INJECT_FAULT; - - /* Sync the WAL to disk */ - rc = sqlite3OsSync(pWal->pWalFd, CKPT_SYNC_FLAGS(sync_flags)); - - /* If the database may grow as a result of this checkpoint, hint - ** about the eventual size of the db file to the VFS layer. - */ - if( rc==SQLITE_OK ){ - i64 nReq = ((i64)mxPage * szPage); - i64 nSize; /* Current size of database file */ - sqlite3OsFileControl(pWal->pDbFd, SQLITE_FCNTL_CKPT_START, 0); - rc = sqlite3OsFileSize(pWal->pDbFd, &nSize); - if( rc==SQLITE_OK && nSizehdr.mxFrame*szPage)pDbFd, SQLITE_FCNTL_SIZE_HINT,&nReq); + WalIndexHdr *pLive = (WalIndexHdr*)walIndexHdr(pWal); + + /* Now that read-lock slot 0 is locked, check that the wal has not been + ** wrapped since the header was read for this checkpoint. If it was, then + ** there was no work to do anyway. In this case the + ** (pInfo->nBackfillhdr.mxFrame) test above only passed because + ** pInfo->nBackfill had already been set to 0 by the writer that wrapped + ** the wal file. It would also be dangerous to proceed, as there may be + ** fewer than pWal->hdr.mxFrame valid frames in the wal file. */ + int bChg = memcmp(pLive->aSalt, pWal->hdr.aSalt, sizeof(pWal->hdr.aSalt)); + if( 0==bChg ){ + pInfo->nBackfillAttempted = mxSafeFrame; SEH_INJECT_FAULT; + + /* Sync the WAL to disk */ + rc = sqlite3OsSync(pWal->pWalFd, CKPT_SYNC_FLAGS(sync_flags)); + + /* If the database may grow as a result of this checkpoint, hint + ** about the eventual size of the db file to the VFS layer. + */ + if( rc==SQLITE_OK ){ + i64 nReq = ((i64)mxPage * szPage); + i64 nSize; /* Current size of database file */ + sqlite3OsFileControl(pWal->pDbFd, SQLITE_FCNTL_CKPT_START, 0); + rc = sqlite3OsFileSize(pWal->pDbFd, &nSize); + if( rc==SQLITE_OK && nSizehdr.mxFrame*szPage)pDbFd, SQLITE_FCNTL_SIZE_HINT, &nReq); + } } - } - - } - /* Iterate through the contents of the WAL, copying data to the db file */ - while( rc==SQLITE_OK && 0==walIteratorNext(pIter, &iDbpage, &iFrame) ){ - i64 iOffset; - assert( walFramePgno(pWal, iFrame)==iDbpage ); - SEH_INJECT_FAULT; - if( AtomicLoad(&db->u1.isInterrupted) ){ - rc = db->mallocFailed ? SQLITE_NOMEM_BKPT : SQLITE_INTERRUPT; - break; } - if( iFrame<=nBackfill || iFrame>mxSafeFrame || iDbpage>mxPage ){ - continue; - } - iOffset = walFrameOffset(iFrame, szPage) + WAL_FRAME_HDRSIZE; - /* testcase( IS_BIG_INT(iOffset) ); // requires a 4GiB WAL file */ - rc = sqlite3OsRead(pWal->pWalFd, zBuf, szPage, iOffset); - if( rc!=SQLITE_OK ) break; - iOffset = (iDbpage-1)*(i64)szPage; - testcase( IS_BIG_INT(iOffset) ); - rc = sqlite3OsWrite(pWal->pDbFd, zBuf, szPage, iOffset); - if( rc!=SQLITE_OK ) break; - } - sqlite3OsFileControl(pWal->pDbFd, SQLITE_FCNTL_CKPT_DONE, 0); - /* If work was actually accomplished... */ - if( rc==SQLITE_OK ){ - if( mxSafeFrame==walIndexHdr(pWal)->mxFrame ){ - i64 szDb = pWal->hdr.nPage*(i64)szPage; - testcase( IS_BIG_INT(szDb) ); - rc = sqlite3OsTruncate(pWal->pDbFd, szDb); - if( rc==SQLITE_OK ){ - rc = sqlite3OsSync(pWal->pDbFd, CKPT_SYNC_FLAGS(sync_flags)); + /* Iterate through the contents of the WAL, copying data to the + ** db file */ + while( rc==SQLITE_OK && 0==walIteratorNext(pIter, &iDbpage, &iFrame) ){ + i64 iOffset; + assert( walFramePgno(pWal, iFrame)==iDbpage ); + SEH_INJECT_FAULT; + if( AtomicLoad(&db->u1.isInterrupted) ){ + rc = db->mallocFailed ? SQLITE_NOMEM_BKPT : SQLITE_INTERRUPT; + break; } + if( iFrame<=nBackfill || iFrame>mxSafeFrame || iDbpage>mxPage ){ + continue; + } + iOffset = walFrameOffset(iFrame, szPage) + WAL_FRAME_HDRSIZE; + /* testcase( IS_BIG_INT(iOffset) ); // requires a 4GiB WAL file */ + rc = sqlite3OsRead(pWal->pWalFd, zBuf, szPage, iOffset); + if( rc!=SQLITE_OK ) break; + iOffset = (iDbpage-1)*(i64)szPage; + testcase( IS_BIG_INT(iOffset) ); + rc = sqlite3OsWrite(pWal->pDbFd, zBuf, szPage, iOffset); + if( rc!=SQLITE_OK ) break; } + sqlite3OsFileControl(pWal->pDbFd, SQLITE_FCNTL_CKPT_DONE, 0); + + /* If work was actually accomplished... */ if( rc==SQLITE_OK ){ - AtomicStore(&pInfo->nBackfill, mxSafeFrame); SEH_INJECT_FAULT; + if( mxSafeFrame==walIndexHdr(pWal)->mxFrame ){ + i64 szDb = pWal->hdr.nPage*(i64)szPage; + testcase( IS_BIG_INT(szDb) ); + rc = sqlite3OsTruncate(pWal->pDbFd, szDb); + if( rc==SQLITE_OK ){ + rc = sqlite3OsSync(pWal->pDbFd, CKPT_SYNC_FLAGS(sync_flags)); + } + } + if( rc==SQLITE_OK ){ + AtomicStore(&pInfo->nBackfill, mxSafeFrame); SEH_INJECT_FAULT; + } } } @@ -71122,6 +71136,7 @@ SQLITE_PRIVATE int sqlite3WalCheckpoint( /* Copy data from the log to the database file. */ if( rc==SQLITE_OK ){ + sqlite3FaultSim(660); if( pWal->hdr.mxFrame && walPagesize(pWal)!=nBuf ){ rc = SQLITE_CORRUPT_BKPT; }else if( eMode2!=SQLITE_CHECKPOINT_NOOP ){ @@ -77557,7 +77572,7 @@ static int accessPayload( getCellInfo(pCur); aPayload = pCur->info.pPayload; - assert( offset+amt <= pCur->info.nPayload ); + assert( (u64)offset+(u64)amt <= (u64)pCur->info.nPayload ); assert( aPayload > pPage->aData ); if( (uptr)(aPayload - pPage->aData) > (pBt->usableSize - pCur->info.nLocal) ){ @@ -86031,7 +86046,12 @@ SQLITE_PRIVATE int sqlite3VdbeMemFromBtree( ){ int rc; pMem->flags = MEM_Null; - if( sqlite3BtreeMaxRecordSize(pCur)=SQLITE_MAX_ALLOCATION_SIZE ){ + return SQLITE_NOMEM_BKPT; + } + if( (u64)amt + (u64)offset > (u64)sqlite3BtreeMaxRecordSize(pCur) ){ return SQLITE_CORRUPT_BKPT; } if( SQLITE_OK==(rc = sqlite3VdbeMemClearAndResize(pMem, amt+1)) ){ @@ -93444,7 +93464,7 @@ static int valueFromValueList( Mem sMem; /* Raw content of current row */ memset(&sMem, 0, sizeof(sMem)); sz = sqlite3BtreePayloadSize(pRhs->pCsr); - rc = sqlite3VdbeMemFromBtreeZeroOffset(pRhs->pCsr,(int)sz,&sMem); + rc = sqlite3VdbeMemFromBtreeZeroOffset(pRhs->pCsr,sz,&sMem); if( rc==SQLITE_OK ){ u8 *zBuf = (u8*)sMem.z; u32 iSerial; @@ -111186,6 +111206,14 @@ static int resolveSelectStep(Walker *pWalker, Select *p){ return WRC_Abort; } + /* If the SELECT statement contains ON clauses that were moved into + ** the WHERE clause, go through and verify that none of the terms + ** in the ON clauses reference tables to the right of the ON clause. */ + if( (p->selFlags & SF_OnToWhere) ){ + sqlite3SelectCheckOnClauses(pParse, p); + if( pParse->nErr ) return WRC_Abort; + } + /* Advance to the next term of the compound */ p = p->pPrior; @@ -154357,7 +154385,7 @@ static int selectCheckOnClausesSelect(Walker *pWalker, Select *pSelect){ ** Check all ON clauses in pSelect to verify that they do not reference ** columns to the right. */ -static void selectCheckOnClauses(Parse *pParse, Select *pSelect){ +SQLITE_PRIVATE void sqlite3SelectCheckOnClauses(Parse *pParse, Select *pSelect){ Walker w; CheckOnCtx sCtx; assert( pSelect->selFlags & SF_OnToWhere ); @@ -154500,18 +154528,6 @@ SQLITE_PRIVATE int sqlite3Select( } #endif - /* If the SELECT statement contains ON clauses that were moved into - ** the WHERE clause, go through and verify that none of the terms - ** in the ON clauses reference tables to the right of the ON clause. - ** Do this now, after name resolution, but before query flattening - */ - if( p->selFlags & SF_OnToWhere ){ - selectCheckOnClauses(pParse, p); - if( pParse->nErr ){ - goto select_end; - } - } - /* If the SF_UFSrcCheck flag is set, then this function is being called ** as part of populating the temp table for an UPDATE...FROM statement. ** In this case, it is an error if the target object (pSrc->a[0]) name @@ -164678,6 +164694,15 @@ SQLITE_PRIVATE SQLITE_NOINLINE void sqlite3WhereRightJoinLoop( sqlite3ExprDup(pParse->db, pTerm->pExpr, 0)); } } + if( pLevel->iIdxCur ){ + /* pSubWhere may contain expressions that read from an index on the + ** table on the RHS of the right join. All such expressions first test + ** if the index is pointing at a NULL row, and if so, read from the + ** table cursor instead. So ensure that the index cursor really is + ** pointing at a NULL row here, so that no values are read from it during + ** the scan of the RHS of the RIGHT join below. */ + sqlite3VdbeAddOp1(v, OP_NullRow, pLevel->iIdxCur); + } pFrom = &uSrc.sSrc; pFrom->nSrc = 1; pFrom->nAlloc = 1; @@ -224164,7 +224189,7 @@ static int rbuDeltaApply( /* ERROR: copy exceeds output file size */ return -1; } - if( (int)(ofst+cnt) > lenSrc ){ + if( (u64)ofst+(u64)cnt > (u64)lenSrc ){ /* ERROR: copy extends past end of input */ return -1; } @@ -252451,7 +252476,7 @@ static void fts5DoSecureDelete( int iSegid = pSeg->pSeg->iSegid; u8 *aPg = pSeg->pLeaf->p; int nPg = pSeg->pLeaf->nn; - int iPgIdx = pSeg->pLeaf->szLeaf; + int iPgIdx = pSeg->pLeaf->szLeaf; /* Offset of page footer */ u64 iDelta = 0; int iNextOff = 0; @@ -252530,7 +252555,7 @@ static void fts5DoSecureDelete( iSOP += fts5GetVarint32(&aPg[iSOP], nPos); } assert_nc( iSOP==pSeg->iLeafOffset ); - iNextOff = pSeg->iLeafOffset + pSeg->nPos; + iNextOff = iSOP + pSeg->nPos; } } @@ -260349,7 +260374,7 @@ static void fts5SourceIdFunc( ){ assert( nArg==0 ); UNUSED_PARAM2(nArg, apUnused); - sqlite3_result_text(pCtx, "fts5: 2026-01-09 17:27:48 b270f8339eb13b504d0b2ba154ebca966b7dde08e40c3ed7d559749818cb2075", -1, SQLITE_TRANSIENT); + sqlite3_result_text(pCtx, "fts5: 2026-03-13 10:38:09 737ae4a34738ffa0c3ff7f9bb18df914dd1cad163f28fd6b6e114a344fe6d618", -1, SQLITE_TRANSIENT); } /* diff --git a/vendor/github.com/mattn/go-sqlite3/sqlite3-binding.h b/vendor/github.com/mattn/go-sqlite3/sqlite3-binding.h index 78ef0b7a..6871f8d6 100644 --- a/vendor/github.com/mattn/go-sqlite3/sqlite3-binding.h +++ b/vendor/github.com/mattn/go-sqlite3/sqlite3-binding.h @@ -147,12 +147,12 @@ extern "C" { ** [sqlite3_libversion_number()], [sqlite3_sourceid()], ** [sqlite_version()] and [sqlite_source_id()]. */ -#define SQLITE_VERSION "3.51.2" -#define SQLITE_VERSION_NUMBER 3051002 -#define SQLITE_SOURCE_ID "2026-01-09 17:27:48 b270f8339eb13b504d0b2ba154ebca966b7dde08e40c3ed7d559749818cb2075" +#define SQLITE_VERSION "3.51.3" +#define SQLITE_VERSION_NUMBER 3051003 +#define SQLITE_SOURCE_ID "2026-03-13 10:38:09 737ae4a34738ffa0c3ff7f9bb18df914dd1cad163f28fd6b6e114a344fe6d618" #define SQLITE_SCM_BRANCH "branch-3.51" -#define SQLITE_SCM_TAGS "release version-3.51.2" -#define SQLITE_SCM_DATETIME "2026-01-09T17:27:48.405Z" +#define SQLITE_SCM_TAGS "release version-3.51.3" +#define SQLITE_SCM_DATETIME "2026-03-13T10:38:09.694Z" /* ** CAPI3REF: Run-Time Library Version Numbers diff --git a/vendor/github.com/mattn/go-sqlite3/sqlite3.go b/vendor/github.com/mattn/go-sqlite3/sqlite3.go index a967cab0..1a5433c7 100644 --- a/vendor/github.com/mattn/go-sqlite3/sqlite3.go +++ b/vendor/github.com/mattn/go-sqlite3/sqlite3.go @@ -78,6 +78,42 @@ _sqlite3_bind_blob(sqlite3_stmt *stmt, int n, void *p, int np) { return sqlite3_bind_blob(stmt, n, p, np, SQLITE_TRANSIENT); } +typedef struct { + int typ; + sqlite3_int64 i64; + double f64; + const void *ptr; + int n; +} sqlite3_go_col; + +static void +_sqlite3_column_values(sqlite3_stmt *stmt, int ncol, sqlite3_go_col *cols) { + for (int i = 0; i < ncol; i++) { + sqlite3_go_col *col = &cols[i]; + col->typ = sqlite3_column_type(stmt, i); + col->ptr = 0; + col->n = 0; + switch (col->typ) { + case SQLITE_INTEGER: + col->i64 = sqlite3_column_int64(stmt, i); + break; + case SQLITE_FLOAT: + col->f64 = sqlite3_column_double(stmt, i); + break; + case SQLITE_BLOB: + col->ptr = sqlite3_column_blob(stmt, i); + col->n = sqlite3_column_bytes(stmt, i); + break; + case SQLITE_TEXT: + col->ptr = sqlite3_column_text(stmt, i); + col->n = sqlite3_column_bytes(stmt, i); + break; + default: + break; + } + } +} + #include #include @@ -90,10 +126,57 @@ _sqlite3_exec(sqlite3* db, const char* pcmd, long long* rowid, long long* change return rv; } +// Combined reset + clear_bindings in a single C call to reduce CGO crossings. +static int +_sqlite3_reset_clear(sqlite3_stmt* stmt) +{ + int rv = sqlite3_reset(stmt); + sqlite3_clear_bindings(stmt); + return rv; +} + #ifdef SQLITE_ENABLE_UNLOCK_NOTIFY extern int _sqlite3_step_blocking(sqlite3_stmt *stmt); extern int _sqlite3_step_row_blocking(sqlite3_stmt* stmt, long long* rowid, long long* changes); extern int _sqlite3_prepare_v2_blocking(sqlite3 *db, const char *zSql, int nBytes, sqlite3_stmt **ppStmt, const char **pzTail); +#endif + +// Combined prepare+step+finalize for simple exec without parameters. +// Reduces CGO crossings from ~6 to 1 for the common no-args exec case. +static int +_sqlite3_exec_no_args(sqlite3* db, const char* zSql, int nBytes, long long* rowid, long long* changes, const char** pzTail) +{ + sqlite3_stmt *stmt = 0; + const char *tail = 0; +#ifdef SQLITE_ENABLE_UNLOCK_NOTIFY + int rv = _sqlite3_prepare_v2_blocking(db, zSql, nBytes, &stmt, &tail); +#else + int rv = sqlite3_prepare_v2(db, zSql, nBytes, &stmt, &tail); +#endif + if (rv != SQLITE_OK) { + *pzTail = 0; + return rv; + } + if (stmt == 0) { + // Empty statement + *rowid = 0; + *changes = 0; + *pzTail = tail; + return SQLITE_OK; + } +#ifdef SQLITE_ENABLE_UNLOCK_NOTIFY + rv = _sqlite3_step_row_blocking(stmt, rowid, changes); +#else + rv = sqlite3_step(stmt); + *rowid = (long long) sqlite3_last_insert_rowid(db); + *changes = (long long) sqlite3_changes(db); +#endif + sqlite3_finalize(stmt); + *pzTail = tail; + return rv; +} + +#ifdef SQLITE_ENABLE_UNLOCK_NOTIFY static int _sqlite3_step_internal(sqlite3_stmt *stmt) @@ -210,6 +293,7 @@ import ( "errors" "fmt" "io" + "math" "net/url" "reflect" "runtime" @@ -361,12 +445,15 @@ type SQLiteDriver struct { // SQLiteConn implements driver.Conn. type SQLiteConn struct { - mu sync.Mutex - db *C.sqlite3 - loc *time.Location - txlock string - funcs []*functionInfo - aggregators []*aggInfo + mu sync.Mutex + db *C.sqlite3 + loc *time.Location + txlock string + funcs []*functionInfo + aggregators []*aggInfo + stmtCache map[string][]*SQLiteStmt + stmtCacheSize int + stmtCacheCount int } // SQLiteTx implements driver.Tx. @@ -376,12 +463,14 @@ type SQLiteTx struct { // SQLiteStmt implements driver.Stmt. type SQLiteStmt struct { - mu sync.Mutex - c *SQLiteConn - s *C.sqlite3_stmt - t string - closed bool - cls bool // True if the statement was created by SQLiteConn.Query + mu sync.Mutex + c *SQLiteConn + s *C.sqlite3_stmt + t string + closed bool + cls bool // True if the statement was created by SQLiteConn.Query + namedParams map[string][3]int + cacheKey string } // SQLiteResult implements sql.Result. @@ -397,6 +486,7 @@ type SQLiteRows struct { cls bool // True if we need to close the parent statement in Close cols []string decltype []string + colvals *C.sqlite3_go_col ctx context.Context // no better alternative to pass context into Next() method closemu sync.Mutex } @@ -847,45 +937,29 @@ func lastError(db *C.sqlite3) error { // Exec implements Execer. func (c *SQLiteConn) Exec(query string, args []driver.Value) (driver.Result, error) { - list := make([]driver.NamedValue, len(args)) - for i, v := range args { - list[i] = driver.NamedValue{ - Ordinal: i + 1, - Value: v, - } - } - return c.exec(context.Background(), query, list) + return c.exec(context.Background(), query, valueToNamedValue(args)) } func (c *SQLiteConn) exec(ctx context.Context, query string, args []driver.NamedValue) (driver.Result, error) { + // Fast path: no args, no context cancellation → single CGO call per statement + if len(args) == 0 && ctx.Done() == nil { + return c.execNoArgs(query) + } + start := 0 for { - s, err := c.prepare(ctx, query) + s, err := c.prepareWithCache(ctx, query) if err != nil { return nil, err } var res driver.Result if s.(*SQLiteStmt).s != nil { - stmtArgs := make([]driver.NamedValue, 0, len(args)) na := s.NumInput() if len(args)-start < na { s.Close() return nil, fmt.Errorf("not enough args to execute query: want %d got %d", na, len(args)) } - // consume the number of arguments used in the current - // statement and append all named arguments not - // contained therein - if len(args[start:start+na]) > 0 { - stmtArgs = append(stmtArgs, args[start:start+na]...) - for i := range args { - if (i < start || i >= na) && args[i].Name != "" { - stmtArgs = append(stmtArgs, args[i]) - } - } - for i := range stmtArgs { - stmtArgs[i].Ordinal = i + 1 - } - } + stmtArgs := stmtArgs(args, start, na) res, err = s.(*SQLiteStmt).exec(ctx, stmtArgs) if err != nil && err != driver.ErrSkip { s.Close() @@ -906,23 +980,40 @@ func (c *SQLiteConn) exec(ctx context.Context, query string, args []driver.Named } } -// Query implements Queryer. -func (c *SQLiteConn) Query(query string, args []driver.Value) (driver.Rows, error) { - list := make([]driver.NamedValue, len(args)) - for i, v := range args { - list[i] = driver.NamedValue{ - Ordinal: i + 1, - Value: v, +// execNoArgs executes a query with no parameters in a single CGO call per statement. +func (c *SQLiteConn) execNoArgs(query string) (driver.Result, error) { + var res *SQLiteResult + for len(query) > 0 { + var rowid, changes C.longlong + var tail *C.char + pquery := C.CString(query) + rv := C._sqlite3_exec_no_args(c.db, pquery, C.int(len(query)), &rowid, &changes, &tail) + if tail != nil && *tail != '\000' { + query = strings.TrimSpace(C.GoString(tail)) + } else { + query = "" + } + C.free(unsafe.Pointer(pquery)) + if rv != C.SQLITE_ROW && rv != C.SQLITE_OK && rv != C.SQLITE_DONE { + return nil, c.lastError() } + res = &SQLiteResult{id: int64(rowid), changes: int64(changes)} + } + if res == nil { + res = &SQLiteResult{0, 0} } - return c.query(context.Background(), query, list) + return res, nil +} + +// Query implements Queryer. +func (c *SQLiteConn) Query(query string, args []driver.Value) (driver.Rows, error) { + return c.query(context.Background(), query, valueToNamedValue(args)) } func (c *SQLiteConn) query(ctx context.Context, query string, args []driver.NamedValue) (driver.Rows, error) { start := 0 for { - stmtArgs := make([]driver.NamedValue, 0, len(args)) - s, err := c.prepare(ctx, query) + s, err := c.prepareWithCache(ctx, query) if err != nil { return nil, err } @@ -932,18 +1023,7 @@ func (c *SQLiteConn) query(ctx context.Context, query string, args []driver.Name s.Close() return nil, fmt.Errorf("not enough args to execute query: want %d got %d", na, len(args)-start) } - // consume the number of arguments used in the current - // statement and append all named arguments not contained - // therein - stmtArgs = append(stmtArgs, args[start:start+na]...) - for i := range args { - if (i < start || i >= na) && args[i].Name != "" { - stmtArgs = append(stmtArgs, args[i]) - } - } - for i := range stmtArgs { - stmtArgs[i].Ordinal = i + 1 - } + stmtArgs := stmtArgs(args, start, na) rows, err := s.(*SQLiteStmt).query(ctx, stmtArgs) if err != nil && err != driver.ErrSkip { s.Close() @@ -1109,6 +1189,7 @@ func (d *SQLiteDriver) Open(dsn string) (driver.Conn, error) { writableSchema := -1 vfsName := "" var cacheSize *int64 + stmtCacheSize := 0 pos := strings.IndexRune(dsn, '?') if pos >= 1 { @@ -1444,6 +1525,20 @@ func (d *SQLiteDriver) Open(dsn string) (driver.Conn, error) { cacheSize = &iv } + // _stmt_cache_size sets the maximum number of prepared statements + // cached per connection. Note that sql.DB is a connection pool, so + // each connection maintains its own independent cache. + if val := params.Get("_stmt_cache_size"); val != "" { + iv, err := strconv.Atoi(val) + if err != nil { + return nil, fmt.Errorf("Invalid _stmt_cache_size: %v: %v", val, err) + } + if iv < 0 { + return nil, fmt.Errorf("Invalid _stmt_cache_size: %v, expecting non-negative integer", val) + } + stmtCacheSize = iv + } + if val := params.Get("vfs"); val != "" { vfsName = val } @@ -1516,7 +1611,10 @@ func (d *SQLiteDriver) Open(dsn string) (driver.Conn, error) { // // Create connection to SQLite - conn := &SQLiteConn{db: db, loc: loc, txlock: txlock} + conn := &SQLiteConn{db: db, loc: loc, txlock: txlock, stmtCacheSize: stmtCacheSize} + if stmtCacheSize > 0 { + conn.stmtCache = make(map[string][]*SQLiteStmt) + } // Password Cipher has to be registered before authentication if len(authCrypt) > 0 { @@ -1783,15 +1881,19 @@ func (d *SQLiteDriver) Open(dsn string) (driver.Conn, error) { // Close the connection. func (c *SQLiteConn) Close() error { + c.mu.Lock() + defer c.mu.Unlock() + if c.db == nil { + return nil + } + runtime.SetFinalizer(c, nil) + c.closeCachedStmtsLocked() rv := C.sqlite3_close_v2(c.db) if rv != C.SQLITE_OK { - return c.lastError() + return lastError(c.db) } deleteHandles(c) - c.mu.Lock() c.db = nil - c.mu.Unlock() - runtime.SetFinalizer(c, nil) return nil } @@ -1804,6 +1906,70 @@ func (c *SQLiteConn) dbConnOpen() bool { return c.db != nil } +func (c *SQLiteConn) takeCachedStmt(query string) *SQLiteStmt { + if c == nil || query == "" || c.stmtCacheSize <= 0 { + return nil + } + + c.mu.Lock() + defer c.mu.Unlock() + + if c.db == nil { + return nil + } + stmts := c.stmtCache[query] + if len(stmts) == 0 { + return nil + } + s := stmts[len(stmts)-1] + if len(stmts) == 1 { + delete(c.stmtCache, query) + } else { + c.stmtCache[query] = stmts[:len(stmts)-1] + } + c.stmtCacheCount-- + s.closed = false + s.cls = false + s.t = "" + return s +} + +func (c *SQLiteConn) putCachedStmt(s *SQLiteStmt) bool { + if c == nil || s == nil || s.s == nil || s.cacheKey == "" { + return false + } + + c.mu.Lock() + defer c.mu.Unlock() + + if c.db == nil || c.stmtCacheCount >= c.stmtCacheSize { + return false + } + rv := C._sqlite3_reset_clear(s.s) + if rv != C.SQLITE_ROW && rv != C.SQLITE_OK && rv != C.SQLITE_DONE { + return false + } + c.stmtCache[s.cacheKey] = append(c.stmtCache[s.cacheKey], s) + c.stmtCacheCount++ + return true +} + +func (c *SQLiteConn) closeCachedStmtsLocked() { + for key, stmts := range c.stmtCache { + for _, s := range stmts { + if s == nil || s.s == nil { + continue + } + runtime.SetFinalizer(s, nil) + C.sqlite3_finalize(s.s) + s.s = nil + s.c = nil + } + delete(c.stmtCache, key) + } + c.stmtCacheCount = 0 +} + // Prepare the query string. Return a new statement. func (c *SQLiteConn) Prepare(query string) (driver.Stmt, error) { return c.prepare(context.Background(), query) @@ -1814,7 +1980,7 @@ func (c *SQLiteConn) prepare(ctx context.Context, query string) (driver.Stmt, er defer C.free(unsafe.Pointer(pquery)) var s *C.sqlite3_stmt var tail *C.char - rv := C._sqlite3_prepare_v2_internal(c.db, pquery, C.int(-1), &s, &tail) + rv := C._sqlite3_prepare_v2_internal(c.db, pquery, C.int(len(query)), &s, &tail) if rv != C.SQLITE_OK { return nil, c.lastError() } @@ -1827,6 +1993,21 @@ func (c *SQLiteConn) prepare(ctx context.Context, query string) (driver.Stmt, er return ss, nil } +func (c *SQLiteConn) prepareWithCache(ctx context.Context, query string) (driver.Stmt, error) { + if stmt := c.takeCachedStmt(query); stmt != nil { + return stmt, nil + } + stmt, err := c.prepare(ctx, query) + if err != nil { + return nil, err + } + ss := stmt.(*SQLiteStmt) + if ss.t == "" { + ss.cacheKey = query + } + return ss, nil +} + // Run-Time Limit Categories. // See: http://www.sqlite.org/c3ref/c_limit_attached.html const ( @@ -1932,16 +2113,25 @@ func (s *SQLiteStmt) Close() error { return nil } s.closed = true - if !s.c.dbConnOpen() { + runtime.SetFinalizer(s, nil) + conn := s.c + stmt := s.s + if stmt == nil { + s.c = nil + return nil + } + if !conn.dbConnOpen() { return errors.New("sqlite statement with already closed database connection") } - rv := C.sqlite3_finalize(s.s) + if s.cacheKey != "" && conn.putCachedStmt(s) { + return nil + } s.s = nil + s.c = nil + rv := C.sqlite3_finalize(stmt) if rv != C.SQLITE_OK { - return s.c.lastError() + return conn.lastError() } - s.c = nil - runtime.SetFinalizer(s, nil) return nil } @@ -1952,66 +2142,141 @@ func (s *SQLiteStmt) NumInput() int { var placeHolder = []byte{0} +func bindText(s *C.sqlite3_stmt, n C.int, v string) C.int { + if len(v) == 0 { + return C._sqlite3_bind_text(s, n, (*C.char)(unsafe.Pointer(&placeHolder[0])), C.int(0)) + } + return C._sqlite3_bind_text(s, n, (*C.char)(unsafe.Pointer(unsafe.StringData(v))), C.int(len(v))) +} + +func bindValue(s *C.sqlite3_stmt, n C.int, value driver.Value) C.int { + switch v := value.(type) { + case nil: + return C.sqlite3_bind_null(s, n) + case string: + return bindText(s, n, v) + case int64: + return C.sqlite3_bind_int64(s, n, C.sqlite3_int64(v)) + case bool: + if v { + return C.sqlite3_bind_int(s, n, 1) + } + return C.sqlite3_bind_int(s, n, 0) + case float64: + return C.sqlite3_bind_double(s, n, C.double(v)) + case []byte: + if v == nil { + return C.sqlite3_bind_null(s, n) + } + ln := len(v) + if ln == 0 { + v = placeHolder + } + return C._sqlite3_bind_blob(s, n, unsafe.Pointer(&v[0]), C.int(ln)) + case time.Time: + var buf [64]byte + b := v.AppendFormat(buf[:0], SQLiteTimestampFormats[0]) + if len(b) == 0 { + return C._sqlite3_bind_text(s, n, (*C.char)(unsafe.Pointer(&placeHolder[0])), C.int(0)) + } + return C._sqlite3_bind_text(s, n, (*C.char)(unsafe.Pointer(&b[0])), C.int(len(b))) + default: + return C.SQLITE_MISUSE + } +} + +func (s *SQLiteStmt) bindNamedIndices(name string) [3]int { + if s.namedParams == nil { + s.namedParams = make(map[string][3]int) + } else if indices, ok := s.namedParams[name]; ok { + return indices + } + + // Build ":name\0" once and rewrite prefix byte to avoid 3 C.CString allocs. + buf := make([]byte, 1+len(name)+1) // prefix + name + null terminator + copy(buf[1:], name) + buf[len(buf)-1] = 0 + cname := (*C.char)(unsafe.Pointer(&buf[0])) + + var indices [3]int + prefixes := [3]byte{':', '@', '$'} + for i, p := range prefixes { + buf[0] = p + indices[i] = int(C.sqlite3_bind_parameter_index(s.s, cname)) + } + s.namedParams[name] = indices + return indices +} + +func stmtArgs(args []driver.NamedValue, start, na int) []driver.NamedValue { + if na == 0 { + return nil + } + + end := start + na + hasNamedOutside := false + for i := range args { + if args[i].Name != "" && (i < start || i >= end) { + hasNamedOutside = true + break + } + } + if start == 0 && !hasNamedOutside { + return args[start:end] + } + + stmtArgs := make([]driver.NamedValue, 0, len(args)) + stmtArgs = append(stmtArgs, args[start:end]...) + for i := range args { + if args[i].Name != "" && (i < start || i >= end) { + stmtArgs = append(stmtArgs, args[i]) + } + } + for i := range stmtArgs { + stmtArgs[i].Ordinal = i + 1 + } + return stmtArgs +} + func (s *SQLiteStmt) bind(args []driver.NamedValue) error { - rv := C.sqlite3_reset(s.s) + rv := C._sqlite3_reset_clear(s.s) if rv != C.SQLITE_ROW && rv != C.SQLITE_OK && rv != C.SQLITE_DONE { return s.c.lastError() } - bindIndices := make([][3]int, len(args)) - prefixes := []string{":", "@", "$"} - for i, v := range args { - bindIndices[i][0] = args[i].Ordinal - if v.Name != "" { - for j := range prefixes { - cname := C.CString(prefixes[j] + v.Name) - bindIndices[i][j] = int(C.sqlite3_bind_parameter_index(s.s, cname)) - C.free(unsafe.Pointer(cname)) + hasNamed := false + for i := range args { + if args[i].Name != "" { + hasNamed = true + break + } + } + + if !hasNamed { + for _, arg := range args { + n := C.int(arg.Ordinal) + rv = bindValue(s.s, n, arg.Value) + if rv != C.SQLITE_OK { + return s.c.lastError() } - args[i].Ordinal = bindIndices[i][0] } + return nil } - for i, arg := range args { - for j := range bindIndices[i] { - if bindIndices[i][j] == 0 { - continue + for _, arg := range args { + if arg.Name == "" { + rv = bindValue(s.s, C.int(arg.Ordinal), arg.Value) + if rv != C.SQLITE_OK { + return s.c.lastError() } - n := C.int(bindIndices[i][j]) - switch v := arg.Value.(type) { - case nil: - rv = C.sqlite3_bind_null(s.s, n) - case string: - if len(v) == 0 { - rv = C._sqlite3_bind_text(s.s, n, (*C.char)(unsafe.Pointer(&placeHolder[0])), C.int(0)) - } else { - b := []byte(v) - rv = C._sqlite3_bind_text(s.s, n, (*C.char)(unsafe.Pointer(&b[0])), C.int(len(b))) - } - case int64: - rv = C.sqlite3_bind_int64(s.s, n, C.sqlite3_int64(v)) - case bool: - if v { - rv = C.sqlite3_bind_int(s.s, n, 1) - } else { - rv = C.sqlite3_bind_int(s.s, n, 0) - } - case float64: - rv = C.sqlite3_bind_double(s.s, n, C.double(v)) - case []byte: - if v == nil { - rv = C.sqlite3_bind_null(s.s, n) - } else { - ln := len(v) - if ln == 0 { - v = placeHolder - } - rv = C._sqlite3_bind_blob(s.s, n, unsafe.Pointer(&v[0]), C.int(ln)) - } - case time.Time: - b := []byte(v.Format(SQLiteTimestampFormats[0])) - rv = C._sqlite3_bind_text(s.s, n, (*C.char)(unsafe.Pointer(&b[0])), C.int(len(b))) + continue + } + indices := s.bindNamedIndices(arg.Name) + for _, idx := range indices { + if idx == 0 { + continue } + rv = bindValue(s.s, C.int(idx), arg.Value) if rv != C.SQLITE_OK { return s.c.lastError() } @@ -2022,14 +2287,7 @@ func (s *SQLiteStmt) bind(args []driver.NamedValue) error { // Query the statement with arguments. Return records. func (s *SQLiteStmt) Query(args []driver.Value) (driver.Rows, error) { - list := make([]driver.NamedValue, len(args)) - for i, v := range args { - list[i] = driver.NamedValue{ - Ordinal: i + 1, - Value: v, - } - } - return s.query(context.Background(), list) + return s.query(context.Background(), valueToNamedValue(args)) } func (s *SQLiteStmt) query(ctx context.Context, args []driver.NamedValue) (driver.Rows, error) { @@ -2043,8 +2301,15 @@ func (s *SQLiteStmt) query(ctx context.Context, args []driver.NamedValue) (drive cls: s.cls, cols: nil, decltype: nil, + colvals: nil, ctx: ctx, } + if rows.nc > 0 { + rows.colvals = (*C.sqlite3_go_col)(C.malloc(C.size_t(rows.nc) * C.size_t(unsafe.Sizeof(C.sqlite3_go_col{})))) + if rows.colvals == nil { + return nil, errors.New("sqlite3: failed to allocate row buffer") + } + } return rows, nil } @@ -2061,6 +2326,10 @@ func (r *SQLiteResult) RowsAffected() (int64, error) { // Exec execute the statement with arguments. Return result object. func (s *SQLiteStmt) Exec(args []driver.Value) (driver.Result, error) { + return s.exec(context.Background(), valueToNamedValue(args)) +} + +func valueToNamedValue(args []driver.Value) []driver.NamedValue { list := make([]driver.NamedValue, len(args)) for i, v := range args { list[i] = driver.NamedValue{ @@ -2068,7 +2337,7 @@ func (s *SQLiteStmt) Exec(args []driver.Value) (driver.Result, error) { Value: v, } } - return s.exec(context.Background(), list) + return list } func isInterruptErr(err error) bool { @@ -2085,38 +2354,35 @@ func (s *SQLiteStmt) exec(ctx context.Context, args []driver.NamedValue) (driver return s.execSync(args) } - type result struct { - r driver.Result - err error - } - resultCh := make(chan result) - defer close(resultCh) + sema := make(chan struct{}) + var r driver.Result + var err error go func() { - r, err := s.execSync(args) - resultCh <- result{r, err} + r, err = s.execSync(args) + close(sema) }() - var rv result select { - case rv = <-resultCh: + case <-sema: + return r, err case <-ctx.Done(): select { - case rv = <-resultCh: // no need to interrupt, operation completed in db + case <-sema: // no need to interrupt, operation completed in db + return r, err default: // this is still racy and can be no-op if executed between sqlite3_* calls in execSync. C.sqlite3_interrupt(s.c.db) - rv = <-resultCh // wait for goroutine completed - if isInterruptErr(rv.err) { + <-sema // wait for goroutine completed + if isInterruptErr(err) { return nil, ctx.Err() } + return r, err } } - return rv.r, rv.err } func (s *SQLiteStmt) execSync(args []driver.NamedValue) (driver.Result, error) { if err := s.bind(args); err != nil { - C.sqlite3_reset(s.s) - C.sqlite3_clear_bindings(s.s) + C._sqlite3_reset_clear(s.s) return nil, err } @@ -2124,8 +2390,7 @@ func (s *SQLiteStmt) execSync(args []driver.NamedValue) (driver.Result, error) { rv := C._sqlite3_step_row_internal(s.s, &rowid, &changes) if rv != C.SQLITE_ROW && rv != C.SQLITE_OK && rv != C.SQLITE_DONE { err := s.c.lastError() - C.sqlite3_reset(s.s) - C.sqlite3_clear_bindings(s.s) + C._sqlite3_reset_clear(s.s) return nil, err } @@ -2145,9 +2410,17 @@ func (rc *SQLiteRows) Close() error { defer rc.closemu.Unlock() s := rc.s if s == nil { + if rc.colvals != nil { + C.free(unsafe.Pointer(rc.colvals)) + rc.colvals = nil + } return nil } rc.s = nil // remove reference to SQLiteStmt + if rc.colvals != nil { + C.free(unsafe.Pointer(rc.colvals)) + rc.colvals = nil + } s.mu.Lock() if s.closed { s.mu.Unlock() @@ -2172,7 +2445,7 @@ func (rc *SQLiteRows) Columns() []string { defer rc.s.mu.Unlock() if rc.s.s != nil && int(rc.nc) != len(rc.cols) { rc.cols = make([]string, rc.nc) - for i := 0; i < int(rc.nc); i++ { + for i := range rc.cols { rc.cols[i] = C.GoString(C.sqlite3_column_name(rc.s.s, C.int(i))) } } @@ -2182,7 +2455,7 @@ func (rc *SQLiteRows) Columns() []string { func (rc *SQLiteRows) declTypes() []string { if rc.s.s != nil && rc.decltype == nil { rc.decltype = make([]string, rc.nc) - for i := 0; i < int(rc.nc); i++ { + for i := range rc.decltype { rc.decltype[i] = strings.ToLower(C.GoString(C.sqlite3_column_decltype(rc.s.s, C.int(i)))) } } @@ -2208,21 +2481,22 @@ func (rc *SQLiteRows) Next(dest []driver.Value) error { if rc.ctx.Done() == nil { return rc.nextSyncLocked(dest) } - resultCh := make(chan error) - defer close(resultCh) + sema := make(chan struct{}) + var err error go func() { - resultCh <- rc.nextSyncLocked(dest) + err = rc.nextSyncLocked(dest) + close(sema) }() select { - case err := <-resultCh: + case <-sema: return err case <-rc.ctx.Done(): select { - case <-resultCh: // no need to interrupt + case <-sema: // no need to interrupt default: // this is still racy and can be no-op if executed between sqlite3_* calls in nextSyncLocked. C.sqlite3_interrupt(rc.s.c.db) - <-resultCh // ensure goroutine completed + <-sema // ensure goroutine completed } return rc.ctx.Err() } @@ -2243,12 +2517,20 @@ func (rc *SQLiteRows) nextSyncLocked(dest []driver.Value) error { } rc.declTypes() + if len(dest) == 0 { + return nil + } + C._sqlite3_column_values(rc.s.s, C.int(len(dest)), rc.colvals) + colvals := (*[(math.MaxInt32 - 1) / unsafe.Sizeof(C.sqlite3_go_col{})]C.sqlite3_go_col)(unsafe.Pointer(rc.colvals))[:len(dest):len(dest)] + decltype := rc.decltype + _ = decltype[len(dest)-1] for i := range dest { - switch C.sqlite3_column_type(rc.s.s, C.int(i)) { + col := &colvals[i] + switch col.typ { case C.SQLITE_INTEGER: - val := int64(C.sqlite3_column_int64(rc.s.s, C.int(i))) - switch rc.decltype[i] { + val := int64(col.i64) + switch decltype[i] { case columnTimestamp, columnDatetime, columnDate: var t time.Time // Assume a millisecond unix timestamp if it's 13 digits -- too @@ -2270,14 +2552,14 @@ func (rc *SQLiteRows) nextSyncLocked(dest []driver.Value) error { dest[i] = val } case C.SQLITE_FLOAT: - dest[i] = float64(C.sqlite3_column_double(rc.s.s, C.int(i))) + dest[i] = float64(col.f64) case C.SQLITE_BLOB: - p := C.sqlite3_column_blob(rc.s.s, C.int(i)) + p := col.ptr if p == nil { dest[i] = []byte{} continue } - n := C.sqlite3_column_bytes(rc.s.s, C.int(i)) + n := col.n dest[i] = C.GoBytes(p, n) case C.SQLITE_NULL: dest[i] = nil @@ -2285,10 +2567,10 @@ func (rc *SQLiteRows) nextSyncLocked(dest []driver.Value) error { var err error var timeVal time.Time - n := int(C.sqlite3_column_bytes(rc.s.s, C.int(i))) - s := C.GoStringN((*C.char)(unsafe.Pointer(C.sqlite3_column_text(rc.s.s, C.int(i)))), C.int(n)) + n := int(col.n) + s := C.GoStringN((*C.char)(unsafe.Pointer(col.ptr)), C.int(n)) - switch rc.decltype[i] { + switch decltype[i] { case columnTimestamp, columnDatetime, columnDate: var t time.Time s = strings.TrimSuffix(s, "Z") diff --git a/vendor/github.com/mattn/go-sqlite3/sqlite3_opt_serialize.go b/vendor/github.com/mattn/go-sqlite3/sqlite3_opt_serialize.go index 2d7fc0d7..51dd9c8f 100644 --- a/vendor/github.com/mattn/go-sqlite3/sqlite3_opt_serialize.go +++ b/vendor/github.com/mattn/go-sqlite3/sqlite3_opt_serialize.go @@ -17,7 +17,6 @@ import "C" import ( "fmt" "math" - "reflect" "unsafe" ) @@ -43,14 +42,8 @@ func (c *SQLiteConn) Serialize(schema string) ([]byte, error) { return nil, fmt.Errorf("serialized database is too large (%d bytes)", sz) } - cBuf := *(*[]byte)(unsafe.Pointer(&reflect.SliceHeader{ - Data: uintptr(unsafe.Pointer(ptr)), - Len: int(sz), - Cap: int(sz), - })) - res := make([]byte, int(sz)) - copy(res, cBuf) + copy(res, unsafe.Slice((*byte)(unsafe.Pointer(ptr)), int(sz))) return res, nil } @@ -67,12 +60,7 @@ func (c *SQLiteConn) Deserialize(b []byte, schema string) error { defer C.free(unsafe.Pointer(zSchema)) tmpBuf := (*C.uchar)(C.sqlite3_malloc64(C.sqlite3_uint64(len(b)))) - cBuf := *(*[]byte)(unsafe.Pointer(&reflect.SliceHeader{ - Data: uintptr(unsafe.Pointer(tmpBuf)), - Len: len(b), - Cap: len(b), - })) - copy(cBuf, b) + copy(unsafe.Slice((*byte)(unsafe.Pointer(tmpBuf)), len(b)), b) rc := C.sqlite3_deserialize(c.db, zSchema, tmpBuf, C.sqlite3_int64(len(b)), C.sqlite3_int64(len(b)), C.SQLITE_DESERIALIZE_FREEONCLOSE) diff --git a/vendor/github.com/mattn/go-sqlite3/sqlite3_opt_vtable.go b/vendor/github.com/mattn/go-sqlite3/sqlite3_opt_vtable.go index 9b164b3e..9761bf35 100644 --- a/vendor/github.com/mattn/go-sqlite3/sqlite3_opt_vtable.go +++ b/vendor/github.com/mattn/go-sqlite3/sqlite3_opt_vtable.go @@ -301,10 +301,18 @@ const ( OpLT = 16 OpGE = 32 OpMATCH = 64 - OpLIKE = 65 /* 3.10.0 and later only */ - OpGLOB = 66 /* 3.10.0 and later only */ - OpREGEXP = 67 /* 3.10.0 and later only */ - OpScanUnique = 1 /* Scan visits at most 1 row */ + OpLIKE = 65 /* 3.10.0 and later only */ + OpGLOB = 66 /* 3.10.0 and later only */ + OpREGEXP = 67 /* 3.10.0 and later only */ + OpNE = 68 /* 3.21.0 and later only */ + OpISNOT = 69 /* 3.21.0 and later */ + OpISNOTNULL = 70 /* 3.21.0 and later */ + OpISNULL = 71 /* 3.21.0 and later */ + OpIS = 72 /* 3.21.0 and later */ + OpLIMIT = 73 /* 3.38.0 and later */ + OpOFFSET = 74 /* 3.38.0 and later */ + OpFUNCTION = 150 /* 3.25.0 and later */ + OpScanUnique = 1 /* Scan visits at most 1 row */ ) // InfoConstraint give information of constraint. diff --git a/vendor/github.com/mattn/go-sqlite3/sqlite3_go18.go b/vendor/github.com/mattn/go-sqlite3/sqlite3_sql.go similarity index 97% rename from vendor/github.com/mattn/go-sqlite3/sqlite3_go18.go rename to vendor/github.com/mattn/go-sqlite3/sqlite3_sql.go index 34cad08e..47c522f4 100644 --- a/vendor/github.com/mattn/go-sqlite3/sqlite3_go18.go +++ b/vendor/github.com/mattn/go-sqlite3/sqlite3_sql.go @@ -3,15 +3,14 @@ // Use of this source code is governed by an MIT-style // license that can be found in the LICENSE file. -//go:build cgo && go1.8 -// +build cgo,go1.8 +//go:build cgo +// +build cgo package sqlite3 import ( - "database/sql/driver" - "context" + "database/sql/driver" ) // Ping implement Pinger. diff --git a/vendor/github.com/moby/docker-image-spec/LICENSE b/vendor/github.com/moby/docker-image-spec/LICENSE new file mode 100644 index 00000000..261eeb9e --- /dev/null +++ b/vendor/github.com/moby/docker-image-spec/LICENSE @@ -0,0 +1,201 @@ + Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + + TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + + 1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + + 2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + + 3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + + 4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + + 5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + + 6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + + 7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + + 8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + + 9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + + END OF TERMS AND CONDITIONS + + APPENDIX: How to apply the Apache License to your work. + + To apply the Apache License to your work, attach the following + boilerplate notice, with the fields enclosed by brackets "[]" + replaced with your own identifying information. (Don't include + the brackets!) The text should be enclosed in the appropriate + comment syntax for the file format. We also recommend that a + file or class name and description of purpose be included on the + same "printed page" as the copyright notice for easier + identification within third-party archives. + + Copyright [yyyy] [name of copyright owner] + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. diff --git a/vendor/github.com/moby/docker-image-spec/specs-go/v1/image.go b/vendor/github.com/moby/docker-image-spec/specs-go/v1/image.go new file mode 100644 index 00000000..16726176 --- /dev/null +++ b/vendor/github.com/moby/docker-image-spec/specs-go/v1/image.go @@ -0,0 +1,54 @@ +package v1 + +import ( + "time" + + ocispec "github.com/opencontainers/image-spec/specs-go/v1" +) + +const DockerOCIImageMediaType = "application/vnd.docker.container.image.v1+json" + +// DockerOCIImage is a ocispec.Image extended with Docker specific Config. +type DockerOCIImage struct { + ocispec.Image + + // Shadow ocispec.Image.Config + Config DockerOCIImageConfig `json:"config,omitempty"` +} + +// DockerOCIImageConfig is a ocispec.ImageConfig extended with Docker specific fields. +type DockerOCIImageConfig struct { + ocispec.ImageConfig + + DockerOCIImageConfigExt +} + +// DockerOCIImageConfigExt contains Docker-specific fields in DockerImageConfig. +type DockerOCIImageConfigExt struct { + Healthcheck *HealthcheckConfig `json:",omitempty"` // Healthcheck describes how to check the container is healthy + + OnBuild []string `json:",omitempty"` // ONBUILD metadata that were defined on the image Dockerfile + Shell []string `json:",omitempty"` // Shell for shell-form of RUN, CMD, ENTRYPOINT +} + +// HealthcheckConfig holds configuration settings for the HEALTHCHECK feature. +type HealthcheckConfig struct { + // Test is the test to perform to check that the container is healthy. + // An empty slice means to inherit the default. + // The options are: + // {} : inherit healthcheck + // {"NONE"} : disable healthcheck + // {"CMD", args...} : exec arguments directly + // {"CMD-SHELL", command} : run command with system's default shell + Test []string `json:",omitempty"` + + // Zero means to inherit. Durations are expressed as integer nanoseconds. + Interval time.Duration `json:",omitempty"` // Interval is the time to wait between checks. + Timeout time.Duration `json:",omitempty"` // Timeout is the time to wait before considering the check to have hung. + StartPeriod time.Duration `json:",omitempty"` // The start period for the container to initialize before the retries starts to count down. + StartInterval time.Duration `json:",omitempty"` // The interval to attempt healthchecks at during the start period + + // Retries is the number of consecutive failures needed to consider a container as unhealthy. + // Zero means inherit. + Retries int `json:",omitempty"` +} diff --git a/vendor/github.com/moby/moby/api/LICENSE b/vendor/github.com/moby/moby/api/LICENSE new file mode 100644 index 00000000..d6456956 --- /dev/null +++ b/vendor/github.com/moby/moby/api/LICENSE @@ -0,0 +1,202 @@ + + Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + + TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + + 1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + + 2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + + 3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + + 4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + + 5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + + 6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + + 7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + + 8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + + 9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + + END OF TERMS AND CONDITIONS + + APPENDIX: How to apply the Apache License to your work. + + To apply the Apache License to your work, attach the following + boilerplate notice, with the fields enclosed by brackets "[]" + replaced with your own identifying information. (Don't include + the brackets!) The text should be enclosed in the appropriate + comment syntax for the file format. We also recommend that a + file or class name and description of purpose be included on the + same "printed page" as the copyright notice for easier + identification within third-party archives. + + Copyright [yyyy] [name of copyright owner] + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. diff --git a/vendor/github.com/moby/moby/api/pkg/stdcopy/stdcopy.go b/vendor/github.com/moby/moby/api/pkg/stdcopy/stdcopy.go new file mode 100644 index 00000000..948c6b67 --- /dev/null +++ b/vendor/github.com/moby/moby/api/pkg/stdcopy/stdcopy.go @@ -0,0 +1,146 @@ +package stdcopy + +import ( + "encoding/binary" + "errors" + "fmt" + "io" +) + +// StdType is the type of standard stream +// a writer can multiplex to. +type StdType byte + +const ( + Stdin StdType = 0 // Stdin represents standard input stream. It is present for completeness and should NOT be used. When reading the stream with [StdCopy] it is output on [Stdout]. + Stdout StdType = 1 // Stdout represents standard output stream. + Stderr StdType = 2 // Stderr represents standard error steam. + Systemerr StdType = 3 // Systemerr represents errors originating from the system. When reading the stream with [StdCopy] it is returned as an error. +) + +const ( + stdWriterPrefixLen = 8 + stdWriterFdIndex = 0 + stdWriterSizeIndex = 4 + + startingBufLen = 32*1024 + stdWriterPrefixLen + 1 +) + +// StdCopy is a modified version of [io.Copy] to de-multiplex messages +// from "multiplexedSource" and copy them to destination streams +// "destOut" and "destErr". +// +// StdCopy demultiplexes "multiplexedSource", assuming that it contains +// two streams, previously multiplexed using a writer created with +// [NewStdWriter]. +// +// As it reads from "multiplexedSource", StdCopy writes [Stdout] messages +// to "destOut", and [Stderr] message to "destErr]. For backward-compatibility, +// [Stdin] messages are output to "destOut". The [Systemerr] stream provides +// errors produced by the daemon. It is returned as an error, and terminates +// processing the stream. +// +// StdCopy it reads until it hits [io.EOF] on "multiplexedSource", after +// which it returns a nil error. In other words: any error returned indicates +// a real underlying error, which may be when an unknown [StdType] stream +// is received. +// +// The "written" return holds the total number of bytes written to "destOut" +// and "destErr" combined. +func StdCopy(destOut, destErr io.Writer, multiplexedSource io.Reader) (written int64, _ error) { + var ( + buf = make([]byte, startingBufLen) + bufLen = len(buf) + nr, nw int + err error + out io.Writer + frameSize int + ) + + for { + // Make sure we have at least a full header + for nr < stdWriterPrefixLen { + var nr2 int + nr2, err = multiplexedSource.Read(buf[nr:]) + nr += nr2 + if errors.Is(err, io.EOF) { + if nr < stdWriterPrefixLen { + return written, nil + } + break + } + if err != nil { + return 0, err + } + } + + // Check the first byte to know where to write + stream := StdType(buf[stdWriterFdIndex]) + switch stream { + case Stdin: + fallthrough + case Stdout: + // Write on stdout + out = destOut + case Stderr: + // Write on stderr + out = destErr + case Systemerr: + // If we're on Systemerr, we won't write anywhere. + // NB: if this code changes later, make sure you don't try to write + // to outstream if Systemerr is the stream + out = nil + default: + return 0, fmt.Errorf("unrecognized stream: %d", stream) + } + + // Retrieve the size of the frame + frameSize = int(binary.BigEndian.Uint32(buf[stdWriterSizeIndex : stdWriterSizeIndex+4])) + + // Check if the buffer is big enough to read the frame. + // Extend it if necessary. + if frameSize+stdWriterPrefixLen > bufLen { + buf = append(buf, make([]byte, frameSize+stdWriterPrefixLen-bufLen+1)...) + bufLen = len(buf) + } + + // While the amount of bytes read is less than the size of the frame + header, we keep reading + for nr < frameSize+stdWriterPrefixLen { + var nr2 int + nr2, err = multiplexedSource.Read(buf[nr:]) + nr += nr2 + if errors.Is(err, io.EOF) { + if nr < frameSize+stdWriterPrefixLen { + return written, nil + } + break + } + if err != nil { + return 0, err + } + } + + // we might have an error from the source mixed up in our multiplexed + // stream. if we do, return it. + if stream == Systemerr { + return written, fmt.Errorf("error from daemon in stream: %s", string(buf[stdWriterPrefixLen:frameSize+stdWriterPrefixLen])) + } + + // Write the retrieved frame (without header) + nw, err = out.Write(buf[stdWriterPrefixLen : frameSize+stdWriterPrefixLen]) + if err != nil { + return 0, err + } + + // If the frame has not been fully written: error + if nw != frameSize { + return 0, io.ErrShortWrite + } + written += int64(nw) + + // Move the rest of the buffer to the beginning + copy(buf, buf[frameSize+stdWriterPrefixLen:]) + // Move the index + nr -= frameSize + stdWriterPrefixLen + } +} diff --git a/vendor/github.com/moby/moby/api/types/blkiodev/blkio.go b/vendor/github.com/moby/moby/api/types/blkiodev/blkio.go new file mode 100644 index 00000000..931ae10a --- /dev/null +++ b/vendor/github.com/moby/moby/api/types/blkiodev/blkio.go @@ -0,0 +1,23 @@ +package blkiodev + +import "fmt" + +// WeightDevice is a structure that holds device:weight pair +type WeightDevice struct { + Path string + Weight uint16 +} + +func (w *WeightDevice) String() string { + return fmt.Sprintf("%s:%d", w.Path, w.Weight) +} + +// ThrottleDevice is a structure that holds device:rate_per_second pair +type ThrottleDevice struct { + Path string + Rate uint64 +} + +func (t *ThrottleDevice) String() string { + return fmt.Sprintf("%s:%d", t.Path, t.Rate) +} diff --git a/vendor/github.com/moby/moby/api/types/build/build.go b/vendor/github.com/moby/moby/api/types/build/build.go new file mode 100644 index 00000000..db983977 --- /dev/null +++ b/vendor/github.com/moby/moby/api/types/build/build.go @@ -0,0 +1,16 @@ +package build + +// BuilderVersion sets the version of underlying builder to use +type BuilderVersion string + +const ( + // BuilderV1 is the first generation builder in docker daemon + BuilderV1 BuilderVersion = "1" + // BuilderBuildKit is builder based on moby/buildkit project + BuilderBuildKit BuilderVersion = "2" +) + +// Result contains the image id of a successful build. +type Result struct { + ID string +} diff --git a/vendor/github.com/moby/moby/api/types/build/cache.go b/vendor/github.com/moby/moby/api/types/build/cache.go new file mode 100644 index 00000000..39dd23a5 --- /dev/null +++ b/vendor/github.com/moby/moby/api/types/build/cache.go @@ -0,0 +1,35 @@ +package build + +import ( + "time" +) + +// CacheRecord contains information about a build cache record. +type CacheRecord struct { + // ID is the unique ID of the build cache record. + ID string + // Parents is the list of parent build cache record IDs. + Parents []string `json:" Parents,omitempty"` + // Type is the cache record type. + Type string + // Description is a description of the build-step that produced the build cache. + Description string + // InUse indicates if the build cache is in use. + InUse bool + // Shared indicates if the build cache is shared. + Shared bool + // Size is the amount of disk space used by the build cache (in bytes). + Size int64 + // CreatedAt is the date and time at which the build cache was created. + CreatedAt time.Time + // LastUsedAt is the date and time at which the build cache was last used. + LastUsedAt *time.Time + UsageCount int +} + +// CachePruneReport contains the response for Engine API: +// POST "/build/prune" +type CachePruneReport struct { + CachesDeleted []string + SpaceReclaimed uint64 +} diff --git a/vendor/github.com/moby/moby/api/types/build/disk_usage.go b/vendor/github.com/moby/moby/api/types/build/disk_usage.go new file mode 100644 index 00000000..3613797d --- /dev/null +++ b/vendor/github.com/moby/moby/api/types/build/disk_usage.go @@ -0,0 +1,36 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package build + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +// DiskUsage represents system data usage for build cache resources. +// +// swagger:model DiskUsage +type DiskUsage struct { + + // Count of active build cache records. + // + // Example: 1 + ActiveCount int64 `json:"ActiveCount,omitempty"` + + // List of build cache records. + // + Items []CacheRecord `json:"Items,omitempty"` + + // Disk space that can be reclaimed by removing inactive build cache records. + // + // Example: 12345678 + Reclaimable int64 `json:"Reclaimable,omitempty"` + + // Count of all build cache records. + // + // Example: 4 + TotalCount int64 `json:"TotalCount,omitempty"` + + // Disk space in use by build cache records. + // + // Example: 98765432 + TotalSize int64 `json:"TotalSize,omitempty"` +} diff --git a/vendor/github.com/moby/moby/api/types/checkpoint/create_request.go b/vendor/github.com/moby/moby/api/types/checkpoint/create_request.go new file mode 100644 index 00000000..c363783f --- /dev/null +++ b/vendor/github.com/moby/moby/api/types/checkpoint/create_request.go @@ -0,0 +1,8 @@ +package checkpoint + +// CreateRequest holds parameters to create a checkpoint from a container. +type CreateRequest struct { + CheckpointID string + CheckpointDir string + Exit bool +} diff --git a/vendor/github.com/moby/moby/api/types/checkpoint/list.go b/vendor/github.com/moby/moby/api/types/checkpoint/list.go new file mode 100644 index 00000000..94a9c0a4 --- /dev/null +++ b/vendor/github.com/moby/moby/api/types/checkpoint/list.go @@ -0,0 +1,7 @@ +package checkpoint + +// Summary represents the details of a checkpoint when listing endpoints. +type Summary struct { + // Name is the name of the checkpoint. + Name string +} diff --git a/vendor/github.com/moby/moby/api/types/common/error_response.go b/vendor/github.com/moby/moby/api/types/common/error_response.go new file mode 100644 index 00000000..b49d3eea --- /dev/null +++ b/vendor/github.com/moby/moby/api/types/common/error_response.go @@ -0,0 +1,17 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package common + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +// ErrorResponse Represents an error. +// Example: {"message":"Something went wrong."} +// +// swagger:model ErrorResponse +type ErrorResponse struct { + + // The error message. + // Required: true + Message string `json:"message"` +} diff --git a/vendor/github.com/moby/moby/api/types/common/error_response_ext.go b/vendor/github.com/moby/moby/api/types/common/error_response_ext.go new file mode 100644 index 00000000..c92dfe4b --- /dev/null +++ b/vendor/github.com/moby/moby/api/types/common/error_response_ext.go @@ -0,0 +1,6 @@ +package common + +// Error returns the error message +func (e ErrorResponse) Error() string { + return e.Message +} diff --git a/vendor/github.com/moby/moby/api/types/common/id_response.go b/vendor/github.com/moby/moby/api/types/common/id_response.go new file mode 100644 index 00000000..7dfe4bf1 --- /dev/null +++ b/vendor/github.com/moby/moby/api/types/common/id_response.go @@ -0,0 +1,16 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package common + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +// IDResponse Response to an API call that returns just an Id +// +// swagger:model IDResponse +type IDResponse struct { + + // The id of the newly created object. + // Required: true + ID string `json:"Id"` +} diff --git a/vendor/github.com/moby/moby/api/types/container/change_type.go b/vendor/github.com/moby/moby/api/types/container/change_type.go new file mode 100644 index 00000000..52fc9923 --- /dev/null +++ b/vendor/github.com/moby/moby/api/types/container/change_type.go @@ -0,0 +1,17 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package container + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +// ChangeType Kind of change +// +// Can be one of: +// +// - `0`: Modified ("C") +// - `1`: Added ("A") +// - `2`: Deleted ("D") +// +// swagger:model ChangeType +type ChangeType uint8 diff --git a/vendor/github.com/moby/moby/api/types/container/change_types.go b/vendor/github.com/moby/moby/api/types/container/change_types.go new file mode 100644 index 00000000..3a3a8386 --- /dev/null +++ b/vendor/github.com/moby/moby/api/types/container/change_types.go @@ -0,0 +1,23 @@ +package container + +const ( + // ChangeModify represents the modify operation. + ChangeModify ChangeType = 0 + // ChangeAdd represents the add operation. + ChangeAdd ChangeType = 1 + // ChangeDelete represents the delete operation. + ChangeDelete ChangeType = 2 +) + +func (ct ChangeType) String() string { + switch ct { + case ChangeModify: + return "C" + case ChangeAdd: + return "A" + case ChangeDelete: + return "D" + default: + return "" + } +} diff --git a/vendor/github.com/moby/moby/api/types/container/commit.go b/vendor/github.com/moby/moby/api/types/container/commit.go new file mode 100644 index 00000000..c5aab26f --- /dev/null +++ b/vendor/github.com/moby/moby/api/types/container/commit.go @@ -0,0 +1,7 @@ +package container + +import "github.com/moby/moby/api/types/common" + +// CommitResponse response for the commit API call, containing the ID of the +// image that was produced. +type CommitResponse = common.IDResponse diff --git a/vendor/github.com/moby/moby/api/types/container/config.go b/vendor/github.com/moby/moby/api/types/container/config.go new file mode 100644 index 00000000..78fa9f91 --- /dev/null +++ b/vendor/github.com/moby/moby/api/types/container/config.go @@ -0,0 +1,50 @@ +package container + +import ( + "time" + + dockerspec "github.com/moby/docker-image-spec/specs-go/v1" + "github.com/moby/moby/api/types/network" +) + +// MinimumDuration puts a minimum on user configured duration. +// This is to prevent API error on time unit. For example, API may +// set 3 as healthcheck interval with intention of 3 seconds, but +// Docker interprets it as 3 nanoseconds. +const MinimumDuration = 1 * time.Millisecond + +// HealthConfig holds configuration settings for the HEALTHCHECK feature. +type HealthConfig = dockerspec.HealthcheckConfig + +// Config contains the configuration data about a container. +// It should hold only portable information about the container. +// Here, "portable" means "independent from the host we are running on". +// Non-portable information *should* appear in HostConfig. +// All fields added to this struct must be marked `omitempty` to keep getting +// predictable hashes from the old `v1Compatibility` configuration. +type Config struct { + Hostname string // Hostname + Domainname string // Domainname + User string // User that will run the command(s) inside the container, also support user:group + AttachStdin bool // Attach the standard input, makes possible user interaction + AttachStdout bool // Attach the standard output + AttachStderr bool // Attach the standard error + ExposedPorts network.PortSet `json:",omitempty"` // List of exposed ports + Tty bool // Attach standard streams to a tty, including stdin if it is not closed. + OpenStdin bool // Open stdin + StdinOnce bool // If true, close stdin after the 1 attached client disconnects. + Env []string // List of environment variable to set in the container + Cmd []string // Command to run when starting the container + Healthcheck *HealthConfig `json:",omitempty"` // Healthcheck describes how to check the container is healthy + ArgsEscaped bool `json:",omitempty"` // True if command is already escaped (meaning treat as a command line) (Windows specific). + Image string // Name of the image as it was passed by the operator (e.g. could be symbolic) + Volumes map[string]struct{} // List of volumes (mounts) used for the container + WorkingDir string // Current directory (PWD) in the command will be launched + Entrypoint []string // Entrypoint to run when starting the container + NetworkDisabled bool `json:",omitempty"` // Is network disabled + OnBuild []string `json:",omitempty"` // ONBUILD metadata that were defined on the image Dockerfile + Labels map[string]string // List of labels set to this container + StopSignal string `json:",omitempty"` // Signal to stop a container + StopTimeout *int `json:",omitempty"` // Timeout (in seconds) to stop a container + Shell []string `json:",omitempty"` // Shell for shell-form of RUN, CMD, ENTRYPOINT +} diff --git a/vendor/github.com/moby/moby/api/types/container/container.go b/vendor/github.com/moby/moby/api/types/container/container.go new file mode 100644 index 00000000..bffb3de8 --- /dev/null +++ b/vendor/github.com/moby/moby/api/types/container/container.go @@ -0,0 +1,151 @@ +package container + +import ( + "os" + "time" + + "github.com/moby/moby/api/types/mount" + "github.com/moby/moby/api/types/storage" + ocispec "github.com/opencontainers/image-spec/specs-go/v1" +) + +// PruneReport contains the response for Engine API: +// POST "/containers/prune" +type PruneReport struct { + ContainersDeleted []string + SpaceReclaimed uint64 +} + +// PathStat is used to encode the header from +// GET "/containers/{name:.*}/archive" +// "Name" is the file or directory name. +type PathStat struct { + Name string `json:"name"` + Size int64 `json:"size"` + Mode os.FileMode `json:"mode"` + Mtime time.Time `json:"mtime"` + LinkTarget string `json:"linkTarget"` +} + +// MountPoint represents a mount point configuration inside the container. +// This is used for reporting the mountpoints in use by a container. +type MountPoint struct { + // Type is the type of mount, see [mount.Type] definitions for details. + Type mount.Type `json:",omitempty"` + + // Name is the name reference to the underlying data defined by `Source` + // e.g., the volume name. + Name string `json:",omitempty"` + + // Source is the source location of the mount. + // + // For volumes, this contains the storage location of the volume (within + // `/var/lib/docker/volumes/`). For bind-mounts, and `npipe`, this contains + // the source (host) part of the bind-mount. For `tmpfs` mount points, this + // field is empty. + Source string + + // Destination is the path relative to the container root (`/`) where the + // Source is mounted inside the container. + Destination string + + // Driver is the volume driver used to create the volume (if it is a volume). + Driver string `json:",omitempty"` + + // Mode is a comma separated list of options supplied by the user when + // creating the bind/volume mount. + // + // The default is platform-specific (`"z"` on Linux, empty on Windows). + Mode string + + // RW indicates whether the mount is mounted writable (read-write). + RW bool + + // Propagation describes how mounts are propagated from the host into the + // mount point, and vice-versa. Refer to the Linux kernel documentation + // for details: + // https://www.kernel.org/doc/Documentation/filesystems/sharedsubtree.txt + // + // This field is not used on Windows. + Propagation mount.Propagation +} + +// State stores container's running state +// it's part of ContainerJSONBase and returned by "inspect" command +type State struct { + Status ContainerState // String representation of the container state. Can be one of "created", "running", "paused", "restarting", "removing", "exited", or "dead" + Running bool + Paused bool + Restarting bool + OOMKilled bool + Dead bool + Pid int + ExitCode int + Error string + StartedAt string + FinishedAt string + Health *Health `json:",omitempty"` +} + +// Summary contains response of Engine API: +// GET "/containers/json" +type Summary struct { + ID string `json:"Id"` + Names []string + Image string + ImageID string + ImageManifestDescriptor *ocispec.Descriptor `json:"ImageManifestDescriptor,omitempty"` + Command string + Created int64 + Ports []PortSummary + SizeRw int64 `json:",omitempty"` + SizeRootFs int64 `json:",omitempty"` + Labels map[string]string + State ContainerState + Status string + HostConfig struct { + NetworkMode string `json:",omitempty"` + Annotations map[string]string `json:",omitempty"` + } + Health *HealthSummary `json:",omitempty"` + NetworkSettings *NetworkSettingsSummary + Mounts []MountPoint +} + +// InspectResponse is the response for the GET "/containers/{name:.*}/json" +// endpoint. +type InspectResponse struct { + ID string `json:"Id"` + Created string + Path string + Args []string + State *State + Image string + ResolvConfPath string + HostnamePath string + HostsPath string + LogPath string + Name string + RestartCount int + Driver string + Platform string + MountLabel string + ProcessLabel string + AppArmorProfile string + ExecIDs []string + HostConfig *HostConfig + + // GraphDriver contains information about the container's graph driver. + GraphDriver *storage.DriverData `json:"GraphDriver,omitempty"` + + // Storage contains information about the storage used for the container's filesystem. + Storage *storage.Storage `json:"Storage,omitempty"` + + SizeRw *int64 `json:",omitempty"` + SizeRootFs *int64 `json:",omitempty"` + Mounts []MountPoint + Config *Config + NetworkSettings *NetworkSettings + // ImageManifestDescriptor is the descriptor of a platform-specific manifest of the image used to create the container. + ImageManifestDescriptor *ocispec.Descriptor `json:"ImageManifestDescriptor,omitempty"` +} diff --git a/vendor/github.com/moby/moby/api/types/container/create_request.go b/vendor/github.com/moby/moby/api/types/container/create_request.go new file mode 100644 index 00000000..decb208a --- /dev/null +++ b/vendor/github.com/moby/moby/api/types/container/create_request.go @@ -0,0 +1,13 @@ +package container + +import "github.com/moby/moby/api/types/network" + +// CreateRequest is the request message sent to the server for container +// create calls. It is a config wrapper that holds the container [Config] +// (portable) and the corresponding [HostConfig] (non-portable) and +// [network.NetworkingConfig]. +type CreateRequest struct { + *Config + HostConfig *HostConfig `json:"HostConfig,omitempty"` + NetworkingConfig *network.NetworkingConfig `json:"NetworkingConfig,omitempty"` +} diff --git a/vendor/github.com/moby/moby/api/types/container/create_response.go b/vendor/github.com/moby/moby/api/types/container/create_response.go new file mode 100644 index 00000000..39d761aa --- /dev/null +++ b/vendor/github.com/moby/moby/api/types/container/create_response.go @@ -0,0 +1,24 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package container + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +// CreateResponse ContainerCreateResponse +// +// # OK response to ContainerCreate operation +// +// swagger:model CreateResponse +type CreateResponse struct { + + // The ID of the created container + // Example: ede54ee1afda366ab42f824e8a5ffd195155d853ceaec74a927f249ea270c743 + // Required: true + ID string `json:"Id"` + + // Warnings encountered when creating the container + // Example: [] + // Required: true + Warnings []string `json:"Warnings"` +} diff --git a/vendor/github.com/moby/moby/api/types/container/disk_usage.go b/vendor/github.com/moby/moby/api/types/container/disk_usage.go new file mode 100644 index 00000000..c36721d3 --- /dev/null +++ b/vendor/github.com/moby/moby/api/types/container/disk_usage.go @@ -0,0 +1,36 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package container + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +// DiskUsage represents system data usage information for container resources. +// +// swagger:model DiskUsage +type DiskUsage struct { + + // Count of active containers. + // + // Example: 1 + ActiveCount int64 `json:"ActiveCount,omitempty"` + + // List of container summaries. + // + Items []Summary `json:"Items,omitempty"` + + // Disk space that can be reclaimed by removing inactive containers. + // + // Example: 12345678 + Reclaimable int64 `json:"Reclaimable,omitempty"` + + // Count of all containers. + // + // Example: 4 + TotalCount int64 `json:"TotalCount,omitempty"` + + // Disk space in use by containers. + // + // Example: 98765432 + TotalSize int64 `json:"TotalSize,omitempty"` +} diff --git a/vendor/github.com/moby/moby/api/types/container/errors.go b/vendor/github.com/moby/moby/api/types/container/errors.go new file mode 100644 index 00000000..32c97803 --- /dev/null +++ b/vendor/github.com/moby/moby/api/types/container/errors.go @@ -0,0 +1,9 @@ +package container + +type errInvalidParameter struct{ error } + +func (e *errInvalidParameter) InvalidParameter() {} + +func (e *errInvalidParameter) Unwrap() error { + return e.error +} diff --git a/vendor/github.com/moby/moby/api/types/container/exec.go b/vendor/github.com/moby/moby/api/types/container/exec.go new file mode 100644 index 00000000..6895926a --- /dev/null +++ b/vendor/github.com/moby/moby/api/types/container/exec.go @@ -0,0 +1,35 @@ +package container + +import "github.com/moby/moby/api/types/common" + +// ExecCreateResponse is the response for a successful exec-create request. +// It holds the ID of the exec that was created. +// +// TODO(thaJeztah): make this a distinct type. +type ExecCreateResponse = common.IDResponse + +// ExecInspectResponse is the API response for the "GET /exec/{id}/json" +// endpoint and holds information about and exec. +type ExecInspectResponse struct { + ID string `json:"ID"` + Running bool `json:"Running"` + ExitCode *int `json:"ExitCode"` + ProcessConfig *ExecProcessConfig + OpenStdin bool `json:"OpenStdin"` + OpenStderr bool `json:"OpenStderr"` + OpenStdout bool `json:"OpenStdout"` + CanRemove bool `json:"CanRemove"` + ContainerID string `json:"ContainerID"` + DetachKeys []byte `json:"DetachKeys"` + Pid int `json:"Pid"` +} + +// ExecProcessConfig holds information about the exec process +// running on the host. +type ExecProcessConfig struct { + Tty bool `json:"tty"` + Entrypoint string `json:"entrypoint"` + Arguments []string `json:"arguments"` + Privileged *bool `json:"privileged,omitempty"` + User string `json:"user,omitempty"` +} diff --git a/vendor/github.com/moby/moby/api/types/container/exec_create_request.go b/vendor/github.com/moby/moby/api/types/container/exec_create_request.go new file mode 100644 index 00000000..dd7437cd --- /dev/null +++ b/vendor/github.com/moby/moby/api/types/container/exec_create_request.go @@ -0,0 +1,17 @@ +package container + +// ExecCreateRequest is a small subset of the Config struct that holds the configuration +// for the exec feature of docker. +type ExecCreateRequest struct { + User string // User that will run the command + Privileged bool // Is the container in privileged mode + Tty bool // Attach standard streams to a tty. + ConsoleSize *[2]uint `json:",omitempty"` // Initial console size [height, width] + AttachStdin bool // Attach the standard input, makes possible user interaction + AttachStderr bool // Attach the standard error + AttachStdout bool // Attach the standard output + DetachKeys string // Escape keys for detach + Env []string // Environment variables + WorkingDir string // Working directory + Cmd []string // Execution commands and args +} diff --git a/vendor/github.com/moby/moby/api/types/container/exec_start_request.go b/vendor/github.com/moby/moby/api/types/container/exec_start_request.go new file mode 100644 index 00000000..4c2ba0a7 --- /dev/null +++ b/vendor/github.com/moby/moby/api/types/container/exec_start_request.go @@ -0,0 +1,12 @@ +package container + +// ExecStartRequest is a temp struct used by execStart +// Config fields is part of ExecConfig in runconfig package +type ExecStartRequest struct { + // ExecStart will first check if it's detached + Detach bool + // Check if there's a tty + Tty bool + // Terminal size [height, width], unused if Tty == false + ConsoleSize *[2]uint `json:",omitempty"` +} diff --git a/vendor/github.com/moby/moby/api/types/container/filesystem_change.go b/vendor/github.com/moby/moby/api/types/container/filesystem_change.go new file mode 100644 index 00000000..b9ec83e5 --- /dev/null +++ b/vendor/github.com/moby/moby/api/types/container/filesystem_change.go @@ -0,0 +1,21 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package container + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +// FilesystemChange Change in the container's filesystem. +// +// swagger:model FilesystemChange +type FilesystemChange struct { + + // kind + // Required: true + Kind ChangeType `json:"Kind"` + + // Path to file or directory that has changed. + // + // Required: true + Path string `json:"Path"` +} diff --git a/vendor/github.com/moby/moby/api/types/container/health.go b/vendor/github.com/moby/moby/api/types/container/health.go new file mode 100644 index 00000000..1a1ba84b --- /dev/null +++ b/vendor/github.com/moby/moby/api/types/container/health.go @@ -0,0 +1,57 @@ +package container + +import ( + "fmt" + "strings" + "time" +) + +// HealthStatus is a string representation of the container's health. +type HealthStatus string + +// Health states +const ( + NoHealthcheck HealthStatus = "none" // Indicates there is no healthcheck + Starting HealthStatus = "starting" // Starting indicates that the container is not yet ready + Healthy HealthStatus = "healthy" // Healthy indicates that the container is running correctly + Unhealthy HealthStatus = "unhealthy" // Unhealthy indicates that the container has a problem +) + +// Health stores information about the container's healthcheck results +type Health struct { + Status HealthStatus // Status is one of [Starting], [Healthy] or [Unhealthy]. + FailingStreak int // FailingStreak is the number of consecutive failures + Log []*HealthcheckResult // Log contains the last few results (oldest first) +} + +// HealthSummary stores a summary of the container's healthcheck results. +type HealthSummary struct { + Status HealthStatus // Status is one of [NoHealthcheck], [Starting], [Healthy] or [Unhealthy]. + FailingStreak int // FailingStreak is the number of consecutive failures +} + +// HealthcheckResult stores information about a single run of a healthcheck probe +type HealthcheckResult struct { + Start time.Time // Start is the time this check started + End time.Time // End is the time this check ended + ExitCode int // ExitCode meanings: 0=healthy, 1=unhealthy, 2=reserved (considered unhealthy), else=error running probe + Output string // Output from last check +} + +var validHealths = []string{ + string(NoHealthcheck), + string(Starting), + string(Healthy), + string(Unhealthy), +} + +// ValidateHealthStatus checks if the provided string is a valid +// container [HealthStatus]. +func ValidateHealthStatus(s HealthStatus) error { + switch s { + case NoHealthcheck, Starting, Healthy, Unhealthy: + return nil + default: + return errInvalidParameter{error: fmt.Errorf("invalid value for health (%s): must be one of %s", s, strings.Join(validHealths, ", "))} + } +} diff --git a/vendor/github.com/moby/moby/api/types/container/hostconfig.go b/vendor/github.com/moby/moby/api/types/container/hostconfig.go new file mode 100644 index 00000000..0f889c65 --- /dev/null +++ b/vendor/github.com/moby/moby/api/types/container/hostconfig.go @@ -0,0 +1,495 @@ +package container + +import ( + "errors" + "fmt" + "net/netip" + "strings" + + "github.com/docker/go-units" + "github.com/moby/moby/api/types/blkiodev" + "github.com/moby/moby/api/types/mount" + "github.com/moby/moby/api/types/network" +) + +// CgroupnsMode represents the cgroup namespace mode of the container +type CgroupnsMode string + +// cgroup namespace modes for containers +const ( + CgroupnsModeEmpty CgroupnsMode = "" + CgroupnsModePrivate CgroupnsMode = "private" + CgroupnsModeHost CgroupnsMode = "host" +) + +// IsPrivate indicates whether the container uses its own private cgroup namespace +func (c CgroupnsMode) IsPrivate() bool { + return c == CgroupnsModePrivate +} + +// IsHost indicates whether the container shares the host's cgroup namespace +func (c CgroupnsMode) IsHost() bool { + return c == CgroupnsModeHost +} + +// IsEmpty indicates whether the container cgroup namespace mode is unset +func (c CgroupnsMode) IsEmpty() bool { + return c == CgroupnsModeEmpty +} + +// Valid indicates whether the cgroup namespace mode is valid +func (c CgroupnsMode) Valid() bool { + return c.IsEmpty() || c.IsPrivate() || c.IsHost() +} + +// Isolation represents the isolation technology of a container. The supported +// values are platform specific +type Isolation string + +// Isolation modes for containers +const ( + IsolationEmpty Isolation = "" // IsolationEmpty is unspecified (same behavior as default) + IsolationDefault Isolation = "default" // IsolationDefault is the default isolation mode on current daemon + IsolationProcess Isolation = "process" // IsolationProcess is process isolation mode + IsolationHyperV Isolation = "hyperv" // IsolationHyperV is HyperV isolation mode +) + +// IsDefault indicates the default isolation technology of a container. On Linux this +// is the native driver. On Windows, this is a Windows Server Container. +func (i Isolation) IsDefault() bool { + // TODO consider making isolation-mode strict (case-sensitive) + v := Isolation(strings.ToLower(string(i))) + return v == IsolationDefault || v == IsolationEmpty +} + +// IsHyperV indicates the use of a Hyper-V partition for isolation +func (i Isolation) IsHyperV() bool { + // TODO consider making isolation-mode strict (case-sensitive) + return Isolation(strings.ToLower(string(i))) == IsolationHyperV +} + +// IsProcess indicates the use of process isolation +func (i Isolation) IsProcess() bool { + // TODO consider making isolation-mode strict (case-sensitive) + return Isolation(strings.ToLower(string(i))) == IsolationProcess +} + +// IpcMode represents the container ipc stack. +type IpcMode string + +// IpcMode constants +const ( + IPCModeNone IpcMode = "none" + IPCModeHost IpcMode = "host" + IPCModeContainer IpcMode = "container" + IPCModePrivate IpcMode = "private" + IPCModeShareable IpcMode = "shareable" +) + +// IsPrivate indicates whether the container uses its own private ipc namespace which can not be shared. +func (n IpcMode) IsPrivate() bool { + return n == IPCModePrivate +} + +// IsHost indicates whether the container shares the host's ipc namespace. +func (n IpcMode) IsHost() bool { + return n == IPCModeHost +} + +// IsShareable indicates whether the container's ipc namespace can be shared with another container. +func (n IpcMode) IsShareable() bool { + return n == IPCModeShareable +} + +// IsContainer indicates whether the container uses another container's ipc namespace. +func (n IpcMode) IsContainer() bool { + _, ok := containerID(string(n)) + return ok +} + +// IsNone indicates whether container IpcMode is set to "none". +func (n IpcMode) IsNone() bool { + return n == IPCModeNone +} + +// IsEmpty indicates whether container IpcMode is empty +func (n IpcMode) IsEmpty() bool { + return n == "" +} + +// Valid indicates whether the ipc mode is valid. +func (n IpcMode) Valid() bool { + // TODO(thaJeztah): align with PidMode, and consider container-mode without a container name/ID to be invalid. + return n.IsEmpty() || n.IsNone() || n.IsPrivate() || n.IsHost() || n.IsShareable() || n.IsContainer() +} + +// Container returns the name of the container ipc stack is going to be used. +func (n IpcMode) Container() (idOrName string) { + idOrName, _ = containerID(string(n)) + return idOrName +} + +// NetworkMode represents the container network stack. +type NetworkMode string + +// IsNone indicates whether container isn't using a network stack. +func (n NetworkMode) IsNone() bool { + return n == network.NetworkNone +} + +// IsDefault indicates whether container uses the default network stack. +func (n NetworkMode) IsDefault() bool { + return n == network.NetworkDefault +} + +// IsPrivate indicates whether container uses its private network stack. +func (n NetworkMode) IsPrivate() bool { + return !n.IsHost() && !n.IsContainer() +} + +// IsContainer indicates whether container uses a container network stack. +func (n NetworkMode) IsContainer() bool { + _, ok := containerID(string(n)) + return ok +} + +// ConnectedContainer is the id of the container which network this container is connected to. +func (n NetworkMode) ConnectedContainer() (idOrName string) { + idOrName, _ = containerID(string(n)) + return idOrName +} + +// UserDefined indicates user-created network +func (n NetworkMode) UserDefined() string { + if n.IsUserDefined() { + return string(n) + } + return "" +} + +// UsernsMode represents userns mode in the container. +type UsernsMode string + +// IsHost indicates whether the container uses the host's userns. +func (n UsernsMode) IsHost() bool { + return n == "host" +} + +// IsPrivate indicates whether the container uses the a private userns. +func (n UsernsMode) IsPrivate() bool { + return !n.IsHost() +} + +// Valid indicates whether the userns is valid. +func (n UsernsMode) Valid() bool { + return n == "" || n.IsHost() +} + +// CgroupSpec represents the cgroup to use for the container. +type CgroupSpec string + +// IsContainer indicates whether the container is using another container cgroup +func (c CgroupSpec) IsContainer() bool { + _, ok := containerID(string(c)) + return ok +} + +// Valid indicates whether the cgroup spec is valid. +func (c CgroupSpec) Valid() bool { + // TODO(thaJeztah): align with PidMode, and consider container-mode without a container name/ID to be invalid. + return c == "" || c.IsContainer() +} + +// Container returns the ID or name of the container whose cgroup will be used. +func (c CgroupSpec) Container() (idOrName string) { + idOrName, _ = containerID(string(c)) + return idOrName +} + +// UTSMode represents the UTS namespace of the container. +type UTSMode string + +// IsPrivate indicates whether the container uses its private UTS namespace. +func (n UTSMode) IsPrivate() bool { + return !n.IsHost() +} + +// IsHost indicates whether the container uses the host's UTS namespace. +func (n UTSMode) IsHost() bool { + return n == "host" +} + +// Valid indicates whether the UTS namespace is valid. +func (n UTSMode) Valid() bool { + return n == "" || n.IsHost() +} + +// PidMode represents the pid namespace of the container. +type PidMode string + +// IsPrivate indicates whether the container uses its own new pid namespace. +func (n PidMode) IsPrivate() bool { + return !n.IsHost() && !n.IsContainer() +} + +// IsHost indicates whether the container uses the host's pid namespace. +func (n PidMode) IsHost() bool { + return n == "host" +} + +// IsContainer indicates whether the container uses a container's pid namespace. +func (n PidMode) IsContainer() bool { + _, ok := containerID(string(n)) + return ok +} + +// Valid indicates whether the pid namespace is valid. +func (n PidMode) Valid() bool { + return n == "" || n.IsHost() || validContainer(string(n)) +} + +// Container returns the name of the container whose pid namespace is going to be used. +func (n PidMode) Container() (idOrName string) { + idOrName, _ = containerID(string(n)) + return idOrName +} + +// DeviceRequest represents a request for devices from a device driver. +// Used by GPU device drivers. +type DeviceRequest struct { + Driver string // Name of device driver + Count int // Number of devices to request (-1 = All) + DeviceIDs []string // List of device IDs as recognizable by the device driver + Capabilities [][]string // An OR list of AND lists of device capabilities (e.g. "gpu") + Options map[string]string // Options to pass onto the device driver +} + +// DeviceMapping represents the device mapping between the host and the container. +type DeviceMapping struct { + PathOnHost string + PathInContainer string + CgroupPermissions string +} + +// RestartPolicy represents the restart policies of the container. +type RestartPolicy struct { + Name RestartPolicyMode + MaximumRetryCount int +} + +type RestartPolicyMode string + +const ( + RestartPolicyDisabled RestartPolicyMode = "no" + RestartPolicyAlways RestartPolicyMode = "always" + RestartPolicyOnFailure RestartPolicyMode = "on-failure" + RestartPolicyUnlessStopped RestartPolicyMode = "unless-stopped" +) + +// IsNone indicates whether the container has the "no" restart policy. +// This means the container will not automatically restart when exiting. +func (rp *RestartPolicy) IsNone() bool { + return rp.Name == RestartPolicyDisabled || rp.Name == "" +} + +// IsAlways indicates whether the container has the "always" restart policy. +// This means the container will automatically restart regardless of the exit status. +func (rp *RestartPolicy) IsAlways() bool { + return rp.Name == RestartPolicyAlways +} + +// IsOnFailure indicates whether the container has the "on-failure" restart policy. +// This means the container will automatically restart of exiting with a non-zero exit status. +func (rp *RestartPolicy) IsOnFailure() bool { + return rp.Name == RestartPolicyOnFailure +} + +// IsUnlessStopped indicates whether the container has the +// "unless-stopped" restart policy. This means the container will +// automatically restart unless user has put it to stopped state. +func (rp *RestartPolicy) IsUnlessStopped() bool { + return rp.Name == RestartPolicyUnlessStopped +} + +// IsSame compares two RestartPolicy to see if they are the same +func (rp *RestartPolicy) IsSame(tp *RestartPolicy) bool { + return rp.Name == tp.Name && rp.MaximumRetryCount == tp.MaximumRetryCount +} + +// ValidateRestartPolicy validates the given RestartPolicy. +func ValidateRestartPolicy(policy RestartPolicy) error { + switch policy.Name { + case RestartPolicyAlways, RestartPolicyUnlessStopped, RestartPolicyDisabled: + if policy.MaximumRetryCount != 0 { + msg := "invalid restart policy: maximum retry count can only be used with 'on-failure'" + if policy.MaximumRetryCount < 0 { + msg += " and cannot be negative" + } + return &errInvalidParameter{errors.New(msg)} + } + return nil + case RestartPolicyOnFailure: + if policy.MaximumRetryCount < 0 { + return &errInvalidParameter{errors.New("invalid restart policy: maximum retry count cannot be negative")} + } + return nil + case "": + // Versions before v25.0.0 created an empty restart-policy "name" as + // default. Allow an empty name with "any" MaximumRetryCount for + // backward-compatibility. + return nil + default: + return &errInvalidParameter{fmt.Errorf("invalid restart policy: unknown policy '%s'; use one of '%s', '%s', '%s', or '%s'", policy.Name, RestartPolicyDisabled, RestartPolicyAlways, RestartPolicyOnFailure, RestartPolicyUnlessStopped)} + } +} + +// LogMode is a type to define the available modes for logging +// These modes affect how logs are handled when log messages start piling up. +type LogMode string + +// Available logging modes +const ( + LogModeUnset LogMode = "" + LogModeBlocking LogMode = "blocking" + LogModeNonBlock LogMode = "non-blocking" +) + +// LogConfig represents the logging configuration of the container. +type LogConfig struct { + Type string + Config map[string]string +} + +// Ulimit is an alias for [units.Ulimit], which may be moving to a different +// location or become a local type. This alias is to help transitioning. +// +// Users are recommended to use this alias instead of using [units.Ulimit] directly. +type Ulimit = units.Ulimit + +// Resources contains container's resources (cgroups config, ulimits...) +type Resources struct { + // Applicable to all platforms + CPUShares int64 `json:"CpuShares"` // CPU shares (relative weight vs. other containers) + Memory int64 // Memory limit (in bytes) + NanoCPUs int64 `json:"NanoCpus"` // CPU quota in units of 10-9 CPUs. + + // Applicable to UNIX platforms + CgroupParent string // Parent cgroup. + BlkioWeight uint16 // Block IO weight (relative weight vs. other containers) + BlkioWeightDevice []*blkiodev.WeightDevice + BlkioDeviceReadBps []*blkiodev.ThrottleDevice + BlkioDeviceWriteBps []*blkiodev.ThrottleDevice + BlkioDeviceReadIOps []*blkiodev.ThrottleDevice + BlkioDeviceWriteIOps []*blkiodev.ThrottleDevice + CPUPeriod int64 `json:"CpuPeriod"` // CPU CFS (Completely Fair Scheduler) period + CPUQuota int64 `json:"CpuQuota"` // CPU CFS (Completely Fair Scheduler) quota + CPURealtimePeriod int64 `json:"CpuRealtimePeriod"` // CPU real-time period + CPURealtimeRuntime int64 `json:"CpuRealtimeRuntime"` // CPU real-time runtime + CpusetCpus string // CpusetCpus 0-2, 0,1 + CpusetMems string // CpusetMems 0-2, 0,1 + Devices []DeviceMapping // List of devices to map inside the container + DeviceCgroupRules []string // List of rule to be added to the device cgroup + DeviceRequests []DeviceRequest // List of device requests for device drivers + MemoryReservation int64 // Memory soft limit (in bytes) + MemorySwap int64 // Total memory usage (memory + swap); set `-1` to enable unlimited swap + MemorySwappiness *int64 // Tuning container memory swappiness behaviour + OomKillDisable *bool // Whether to disable OOM Killer or not + PidsLimit *int64 // Setting PIDs limit for a container; Set `0` or `-1` for unlimited, or `null` to not change. + Ulimits []*Ulimit // List of ulimits to be set in the container + + // Applicable to Windows + CPUCount int64 `json:"CpuCount"` // CPU count + CPUPercent int64 `json:"CpuPercent"` // CPU percent + IOMaximumIOps uint64 // Maximum IOps for the container system drive + IOMaximumBandwidth uint64 // Maximum IO in bytes per second for the container system drive +} + +// UpdateConfig holds the mutable attributes of a Container. +// Those attributes can be updated at runtime. +type UpdateConfig struct { + // Contains container's resources (cgroups, ulimits) + Resources + RestartPolicy RestartPolicy +} + +// HostConfig the non-portable Config structure of a container. +// Here, "non-portable" means "dependent of the host we are running on". +// Portable information *should* appear in Config. +type HostConfig struct { + // Applicable to all platforms + Binds []string // List of volume bindings for this container + ContainerIDFile string // File (path) where the containerId is written + LogConfig LogConfig // Configuration of the logs for this container + NetworkMode NetworkMode // Network mode to use for the container + PortBindings network.PortMap // Port mapping between the exposed port (container) and the host + RestartPolicy RestartPolicy // Restart policy to be used for the container + AutoRemove bool // Automatically remove container when it exits + VolumeDriver string // Name of the volume driver used to mount volumes + VolumesFrom []string // List of volumes to take from other container + ConsoleSize [2]uint // Initial console size (height,width) + Annotations map[string]string `json:",omitempty"` // Arbitrary non-identifying metadata attached to container and provided to the runtime + + // Applicable to UNIX platforms + CapAdd []string // List of kernel capabilities to add to the container + CapDrop []string // List of kernel capabilities to remove from the container + CgroupnsMode CgroupnsMode // Cgroup namespace mode to use for the container + DNS []netip.Addr `json:"Dns"` // List of DNS server to lookup + DNSOptions []string `json:"DnsOptions"` // List of DNSOption to look for + DNSSearch []string `json:"DnsSearch"` // List of DNSSearch to look for + ExtraHosts []string // List of extra hosts + GroupAdd []string // List of additional groups that the container process will run as + IpcMode IpcMode // IPC namespace to use for the container + Cgroup CgroupSpec // Cgroup to use for the container + Links []string // List of links (in the name:alias form) + OomScoreAdj int // Container preference for OOM-killing + PidMode PidMode // PID namespace to use for the container + Privileged bool // Is the container in privileged mode + PublishAllPorts bool // Should docker publish all exposed port for the container + ReadonlyRootfs bool // Is the container root filesystem in read-only + SecurityOpt []string // List of string values to customize labels for MLS systems, such as SELinux. + StorageOpt map[string]string `json:",omitempty"` // Storage driver options per container. + Tmpfs map[string]string `json:",omitempty"` // List of tmpfs (mounts) used for the container + UTSMode UTSMode // UTS namespace to use for the container + UsernsMode UsernsMode // The user namespace to use for the container + ShmSize int64 // Total shm memory usage + Sysctls map[string]string `json:",omitempty"` // List of Namespaced sysctls used for the container + Runtime string `json:",omitempty"` // Runtime to use with this container + + // Applicable to Windows + Isolation Isolation // Isolation technology of the container (e.g. default, hyperv) + + // Contains container's resources (cgroups, ulimits) + Resources + + // Mounts specs used by the container + Mounts []mount.Mount `json:",omitempty"` + + // MaskedPaths is the list of paths to be masked inside the container (this overrides the default set of paths) + MaskedPaths []string + + // ReadonlyPaths is the list of paths to be set as read-only inside the container (this overrides the default set of paths) + ReadonlyPaths []string + + // Run a custom init inside the container, if null, use the daemon's configured settings + Init *bool `json:",omitempty"` +} + +// containerID splits "container:" values. It returns the container +// ID or name, and whether an ID/name was found. It returns an empty string and +// a "false" if the value does not have a "container:" prefix. Further validation +// of the returned, including checking if the value is empty, should be handled +// by the caller. +func containerID(val string) (idOrName string, ok bool) { + k, v, hasSep := strings.Cut(val, ":") + if !hasSep || k != "container" { + return "", false + } + return v, true +} + +// validContainer checks if the given value is a "container:" mode with +// a non-empty name/ID. +func validContainer(val string) bool { + id, ok := containerID(val) + return ok && id != "" +} diff --git a/vendor/github.com/moby/moby/api/types/container/hostconfig_unix.go b/vendor/github.com/moby/moby/api/types/container/hostconfig_unix.go new file mode 100644 index 00000000..326a5da7 --- /dev/null +++ b/vendor/github.com/moby/moby/api/types/container/hostconfig_unix.go @@ -0,0 +1,45 @@ +//go:build !windows + +package container + +import "github.com/moby/moby/api/types/network" + +// IsValid indicates if an isolation technology is valid +func (i Isolation) IsValid() bool { + return i.IsDefault() +} + +// IsBridge indicates whether container uses the bridge network stack +func (n NetworkMode) IsBridge() bool { + return n == network.NetworkBridge +} + +// IsHost indicates whether container uses the host network stack. +func (n NetworkMode) IsHost() bool { + return n == network.NetworkHost +} + +// IsUserDefined indicates user-created network +func (n NetworkMode) IsUserDefined() bool { + return !n.IsDefault() && !n.IsBridge() && !n.IsHost() && !n.IsNone() && !n.IsContainer() +} + +// NetworkName returns the name of the network stack. +func (n NetworkMode) NetworkName() string { + switch { + case n.IsDefault(): + return network.NetworkDefault + case n.IsBridge(): + return network.NetworkBridge + case n.IsHost(): + return network.NetworkHost + case n.IsNone(): + return network.NetworkNone + case n.IsContainer(): + return "container" + case n.IsUserDefined(): + return n.UserDefined() + default: + return "" + } +} diff --git a/vendor/github.com/moby/moby/api/types/container/hostconfig_windows.go b/vendor/github.com/moby/moby/api/types/container/hostconfig_windows.go new file mode 100644 index 00000000..977a3760 --- /dev/null +++ b/vendor/github.com/moby/moby/api/types/container/hostconfig_windows.go @@ -0,0 +1,47 @@ +package container + +import "github.com/moby/moby/api/types/network" + +// IsValid indicates if an isolation technology is valid +func (i Isolation) IsValid() bool { + return i.IsDefault() || i.IsHyperV() || i.IsProcess() +} + +// IsBridge indicates whether container uses the bridge network stack +// in windows it is given the name NAT +func (n NetworkMode) IsBridge() bool { + return n == network.NetworkNat +} + +// IsHost indicates whether container uses the host network stack. +// returns false as this is not supported by windows +func (n NetworkMode) IsHost() bool { + return false +} + +// IsUserDefined indicates user-created network +func (n NetworkMode) IsUserDefined() bool { + return !n.IsDefault() && !n.IsNone() && !n.IsBridge() && !n.IsContainer() +} + +// NetworkName returns the name of the network stack. +func (n NetworkMode) NetworkName() string { + switch { + case n.IsDefault(): + return network.NetworkDefault + case n.IsBridge(): + return network.NetworkNat + case n.IsHost(): + // Windows currently doesn't support host network-mode, so + // this would currently never happen.. + return network.NetworkHost + case n.IsNone(): + return network.NetworkNone + case n.IsContainer(): + return "container" + case n.IsUserDefined(): + return n.UserDefined() + default: + return "" + } +} diff --git a/vendor/github.com/moby/moby/api/types/container/network_settings.go b/vendor/github.com/moby/moby/api/types/container/network_settings.go new file mode 100644 index 00000000..c51c0839 --- /dev/null +++ b/vendor/github.com/moby/moby/api/types/container/network_settings.go @@ -0,0 +1,22 @@ +package container + +import ( + "github.com/moby/moby/api/types/network" +) + +// NetworkSettings exposes the network settings in the api +type NetworkSettings struct { + SandboxID string // SandboxID uniquely represents a container's network stack + SandboxKey string // SandboxKey identifies the sandbox + + // Ports is a collection of [network.PortBinding] indexed by [network.Port] + Ports network.PortMap + + Networks map[string]*network.EndpointSettings +} + +// NetworkSettingsSummary provides a summary of container's networks +// in /containers/json +type NetworkSettingsSummary struct { + Networks map[string]*network.EndpointSettings +} diff --git a/vendor/github.com/moby/moby/api/types/container/port_summary.go b/vendor/github.com/moby/moby/api/types/container/port_summary.go new file mode 100644 index 00000000..68148eec --- /dev/null +++ b/vendor/github.com/moby/moby/api/types/container/port_summary.go @@ -0,0 +1,33 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package container + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "net/netip" +) + +// PortSummary Describes a port-mapping between the container and the host. +// +// Example: {"PrivatePort":8080,"PublicPort":80,"Type":"tcp"} +// +// swagger:model PortSummary +type PortSummary struct { + + // Host IP address that the container's port is mapped to + IP netip.Addr `json:"IP,omitempty"` + + // Port on the container + // Required: true + PrivatePort uint16 `json:"PrivatePort"` + + // Port exposed on the host + PublicPort uint16 `json:"PublicPort,omitempty"` + + // type + // Required: true + // Enum: ["tcp","udp","sctp"] + Type string `json:"Type"` +} diff --git a/vendor/github.com/moby/moby/api/types/container/state.go b/vendor/github.com/moby/moby/api/types/container/state.go new file mode 100644 index 00000000..47c6d124 --- /dev/null +++ b/vendor/github.com/moby/moby/api/types/container/state.go @@ -0,0 +1,40 @@ +package container + +import ( + "fmt" + "strings" +) + +// ContainerState is a string representation of the container's current state. +type ContainerState string + +const ( + StateCreated ContainerState = "created" // StateCreated indicates the container is created, but not (yet) started. + StateRunning ContainerState = "running" // StateRunning indicates that the container is running. + StatePaused ContainerState = "paused" // StatePaused indicates that the container's current state is paused. + StateRestarting ContainerState = "restarting" // StateRestarting indicates that the container is currently restarting. + StateRemoving ContainerState = "removing" // StateRemoving indicates that the container is being removed. + StateExited ContainerState = "exited" // StateExited indicates that the container exited. + StateDead ContainerState = "dead" // StateDead indicates that the container failed to be deleted. Containers in this state are attempted to be cleaned up when the daemon restarts. +) + +var validStates = []string{ + string(StateCreated), + string(StateRunning), + string(StatePaused), + string(StateRestarting), + string(StateRemoving), + string(StateExited), + string(StateDead), +} + +// ValidateContainerState checks if the provided string is a valid +// container [ContainerState]. +func ValidateContainerState(s ContainerState) error { + switch s { + case StateCreated, StateRunning, StatePaused, StateRestarting, StateRemoving, StateExited, StateDead: + return nil + default: + return errInvalidParameter{error: fmt.Errorf("invalid value for state (%s): must be one of %s", s, strings.Join(validStates, ", "))} + } +} diff --git a/vendor/github.com/moby/moby/api/types/container/stats.go b/vendor/github.com/moby/moby/api/types/container/stats.go new file mode 100644 index 00000000..6a34f6ab --- /dev/null +++ b/vendor/github.com/moby/moby/api/types/container/stats.go @@ -0,0 +1,224 @@ +package container + +import "time" + +// ThrottlingData stores CPU throttling stats of one running container. +// Not used on Windows. +type ThrottlingData struct { + // Number of periods with throttling active + Periods uint64 `json:"periods"` + // Number of periods when the container hits its throttling limit. + ThrottledPeriods uint64 `json:"throttled_periods"` + // Aggregate time the container was throttled for in nanoseconds. + ThrottledTime uint64 `json:"throttled_time"` +} + +// CPUUsage stores All CPU stats aggregated since container inception. +type CPUUsage struct { + // Total CPU time consumed. + // Units: nanoseconds (Linux) + // Units: 100's of nanoseconds (Windows) + TotalUsage uint64 `json:"total_usage"` + + // Total CPU time consumed per core (Linux). Not used on Windows. + // Units: nanoseconds. + PercpuUsage []uint64 `json:"percpu_usage,omitempty"` + + // Time spent by tasks of the cgroup in kernel mode (Linux). + // Time spent by all container processes in kernel mode (Windows). + // Units: nanoseconds (Linux). + // Units: 100's of nanoseconds (Windows). Not populated for Hyper-V Containers. + UsageInKernelmode uint64 `json:"usage_in_kernelmode"` + + // Time spent by tasks of the cgroup in user mode (Linux). + // Time spent by all container processes in user mode (Windows). + // Units: nanoseconds (Linux). + // Units: 100's of nanoseconds (Windows). Not populated for Hyper-V Containers + UsageInUsermode uint64 `json:"usage_in_usermode"` +} + +// CPUStats aggregates and wraps all CPU related info of container +type CPUStats struct { + // CPU Usage. Linux and Windows. + CPUUsage CPUUsage `json:"cpu_usage"` + + // System Usage. Linux only. + SystemUsage uint64 `json:"system_cpu_usage,omitempty"` + + // Online CPUs. Linux only. + OnlineCPUs uint32 `json:"online_cpus,omitempty"` + + // Throttling Data. Linux only. + ThrottlingData ThrottlingData `json:"throttling_data,omitempty"` +} + +// MemoryStats aggregates all memory stats since container inception on Linux. +// Windows returns stats for commit and private working set only. +type MemoryStats struct { + // Linux Memory Stats + + // current res_counter usage for memory + Usage uint64 `json:"usage,omitempty"` + // maximum usage ever recorded. + MaxUsage uint64 `json:"max_usage,omitempty"` + // TODO(vishh): Export these as stronger types. + // all the stats exported via memory.stat. + Stats map[string]uint64 `json:"stats,omitempty"` + // number of times memory usage hits limits. + Failcnt uint64 `json:"failcnt,omitempty"` + Limit uint64 `json:"limit,omitempty"` + + // Windows Memory Stats + // See https://technet.microsoft.com/en-us/magazine/ff382715.aspx + + // committed bytes + Commit uint64 `json:"commitbytes,omitempty"` + // peak committed bytes + CommitPeak uint64 `json:"commitpeakbytes,omitempty"` + // private working set + PrivateWorkingSet uint64 `json:"privateworkingset,omitempty"` +} + +// BlkioStatEntry is one small entity to store a piece of Blkio stats +// Not used on Windows. +type BlkioStatEntry struct { + Major uint64 `json:"major"` + Minor uint64 `json:"minor"` + Op string `json:"op"` + Value uint64 `json:"value"` +} + +// BlkioStats stores All IO service stats for data read and write. +// This is a Linux specific structure as the differences between expressing +// block I/O on Windows and Linux are sufficiently significant to make +// little sense attempting to morph into a combined structure. +type BlkioStats struct { + // number of bytes transferred to and from the block device + IoServiceBytesRecursive []BlkioStatEntry `json:"io_service_bytes_recursive"` + IoServicedRecursive []BlkioStatEntry `json:"io_serviced_recursive"` + IoQueuedRecursive []BlkioStatEntry `json:"io_queue_recursive"` + IoServiceTimeRecursive []BlkioStatEntry `json:"io_service_time_recursive"` + IoWaitTimeRecursive []BlkioStatEntry `json:"io_wait_time_recursive"` + IoMergedRecursive []BlkioStatEntry `json:"io_merged_recursive"` + IoTimeRecursive []BlkioStatEntry `json:"io_time_recursive"` + SectorsRecursive []BlkioStatEntry `json:"sectors_recursive"` +} + +// StorageStats is the disk I/O stats for read/write on Windows. +type StorageStats struct { + ReadCountNormalized uint64 `json:"read_count_normalized,omitempty"` + ReadSizeBytes uint64 `json:"read_size_bytes,omitempty"` + WriteCountNormalized uint64 `json:"write_count_normalized,omitempty"` + WriteSizeBytes uint64 `json:"write_size_bytes,omitempty"` +} + +// NetworkStats aggregates the network stats of one container +type NetworkStats struct { + // Bytes received. Windows and Linux. + RxBytes uint64 `json:"rx_bytes"` + // Packets received. Windows and Linux. + RxPackets uint64 `json:"rx_packets"` + // Received errors. Not used on Windows. Note that we don't `omitempty` this + // field as it is expected in the >=v1.21 API stats structure. + RxErrors uint64 `json:"rx_errors"` + // Incoming packets dropped. Windows and Linux. + RxDropped uint64 `json:"rx_dropped"` + // Bytes sent. Windows and Linux. + TxBytes uint64 `json:"tx_bytes"` + // Packets sent. Windows and Linux. + TxPackets uint64 `json:"tx_packets"` + // Sent errors. Not used on Windows. Note that we don't `omitempty` this + // field as it is expected in the >=v1.21 API stats structure. + TxErrors uint64 `json:"tx_errors"` + // Outgoing packets dropped. Windows and Linux. + TxDropped uint64 `json:"tx_dropped"` + // Endpoint ID. Not used on Linux. + EndpointID string `json:"endpoint_id,omitempty"` + // Instance ID. Not used on Linux. + InstanceID string `json:"instance_id,omitempty"` +} + +// PidsStats contains the stats of a container's pids +type PidsStats struct { + // Current is the number of pids in the cgroup + Current uint64 `json:"current,omitempty"` + // Limit is the hard limit on the number of pids in the cgroup. + // A "Limit" of 0 means that there is no limit. + Limit uint64 `json:"limit,omitempty"` +} + +// StatsResponse aggregates all types of stats of one container. +type StatsResponse struct { + // ID is the ID of the container for which the stats were collected. + ID string `json:"id,omitempty"` + + // Name is the name of the container for which the stats were collected. + Name string `json:"name,omitempty"` + + // OSType is the OS of the container ("linux" or "windows") to allow + // platform-specific handling of stats. + OSType string `json:"os_type,omitempty"` + + // Read is the date and time at which this sample was collected. + Read time.Time `json:"read"` + + // CPUStats contains CPU related info of the container. + CPUStats CPUStats `json:"cpu_stats,omitempty"` + + // MemoryStats aggregates all memory stats since container inception on Linux. + // Windows returns stats for commit and private working set only. + MemoryStats MemoryStats `json:"memory_stats,omitempty"` + + // Networks contains Nntwork statistics for the container per interface. + // + // This field is omitted if the container has no networking enabled. + Networks map[string]NetworkStats `json:"networks,omitempty"` + + // ------------------------------------------------------------------------- + // Linux-specific stats, not populated on Windows. + // ------------------------------------------------------------------------- + + // PidsStats contains Linux-specific stats of a container's process-IDs (PIDs). + // + // This field is Linux-specific and omitted for Windows containers. + PidsStats PidsStats `json:"pids_stats,omitempty"` + + // BlkioStats stores all IO service stats for data read and write. + // + // This type is Linux-specific and holds many fields that are specific + // to cgroups v1. + // + // On a cgroup v2 host, all fields other than "io_service_bytes_recursive" + // are omitted or "null". + // + // This type is only populated on Linux and omitted for Windows containers. + BlkioStats BlkioStats `json:"blkio_stats,omitempty"` + + // ------------------------------------------------------------------------- + // Windows-specific stats, not populated on Linux. + // ------------------------------------------------------------------------- + + // NumProcs is the number of processors on the system. + // + // This field is Windows-specific and always zero for Linux containers. + NumProcs uint32 `json:"num_procs"` + + // StorageStats is the disk I/O stats for read/write on Windows. + // + // This type is Windows-specific and omitted for Linux containers. + StorageStats StorageStats `json:"storage_stats,omitempty"` + + // ------------------------------------------------------------------------- + // PreRead and PreCPUStats contain the previous sample of stats for + // the container, and can be used to perform delta-calculation. + // ------------------------------------------------------------------------- + + // PreRead is the date and time at which this first sample was collected. + // This field is not propagated if the "one-shot" option is set. If the + // "one-shot" option is set, this field may be omitted, empty, or set + // to a default date (`0001-01-01T00:00:00Z`). + PreRead time.Time `json:"preread"` + + // PreCPUStats contains the CPUStats of the previous sample. + PreCPUStats CPUStats `json:"precpu_stats,omitempty"` +} diff --git a/vendor/github.com/moby/moby/api/types/container/top_response.go b/vendor/github.com/moby/moby/api/types/container/top_response.go new file mode 100644 index 00000000..96660361 --- /dev/null +++ b/vendor/github.com/moby/moby/api/types/container/top_response.go @@ -0,0 +1,23 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package container + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +// TopResponse ContainerTopResponse +// +// Container "top" response. +// +// swagger:model TopResponse +type TopResponse struct { + + // Each process running in the container, where each process + // is an array of values corresponding to the titles. + // Example: {"Processes":[["root","13642","882","0","17:03","pts/0","00:00:00","/bin/bash"],["root","13735","13642","0","17:06","pts/0","00:00:00","sleep 10"]]} + Processes [][]string `json:"Processes"` + + // The ps column titles + // Example: {"Titles":["UID","PID","PPID","C","STIME","TTY","TIME","CMD"]} + Titles []string `json:"Titles"` +} diff --git a/vendor/github.com/moby/moby/api/types/container/update_response.go b/vendor/github.com/moby/moby/api/types/container/update_response.go new file mode 100644 index 00000000..2f7263b1 --- /dev/null +++ b/vendor/github.com/moby/moby/api/types/container/update_response.go @@ -0,0 +1,18 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package container + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +// UpdateResponse ContainerUpdateResponse +// +// Response for a successful container-update. +// +// swagger:model UpdateResponse +type UpdateResponse struct { + + // Warnings encountered when updating the container. + // Example: ["Published ports are discarded when using host network mode"] + Warnings []string `json:"Warnings"` +} diff --git a/vendor/github.com/moby/moby/api/types/container/wait_exit_error.go b/vendor/github.com/moby/moby/api/types/container/wait_exit_error.go new file mode 100644 index 00000000..96a7770c --- /dev/null +++ b/vendor/github.com/moby/moby/api/types/container/wait_exit_error.go @@ -0,0 +1,15 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package container + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +// WaitExitError container waiting error, if any +// +// swagger:model WaitExitError +type WaitExitError struct { + + // Details of an error + Message string `json:"Message,omitempty"` +} diff --git a/vendor/github.com/moby/moby/api/types/container/wait_response.go b/vendor/github.com/moby/moby/api/types/container/wait_response.go new file mode 100644 index 00000000..68d3c387 --- /dev/null +++ b/vendor/github.com/moby/moby/api/types/container/wait_response.go @@ -0,0 +1,21 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package container + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +// WaitResponse ContainerWaitResponse +// +// # OK response to ContainerWait operation +// +// swagger:model WaitResponse +type WaitResponse struct { + + // error + Error *WaitExitError `json:"Error,omitempty"` + + // Exit code of the container + // Required: true + StatusCode int64 `json:"StatusCode"` +} diff --git a/vendor/github.com/moby/moby/api/types/container/waitcondition.go b/vendor/github.com/moby/moby/api/types/container/waitcondition.go new file mode 100644 index 00000000..64820fe3 --- /dev/null +++ b/vendor/github.com/moby/moby/api/types/container/waitcondition.go @@ -0,0 +1,22 @@ +package container + +// WaitCondition is a type used to specify a container state for which +// to wait. +type WaitCondition string + +// Possible WaitCondition Values. +// +// WaitConditionNotRunning (default) is used to wait for any of the non-running +// states: "created", "exited", "dead", "removing", or "removed". +// +// WaitConditionNextExit is used to wait for the next time the state changes +// to a non-running state. If the state is currently "created" or "exited", +// this would cause Wait() to block until either the container runs and exits +// or is removed. +// +// WaitConditionRemoved is used to wait for the container to be removed. +const ( + WaitConditionNotRunning WaitCondition = "not-running" + WaitConditionNextExit WaitCondition = "next-exit" + WaitConditionRemoved WaitCondition = "removed" +) diff --git a/vendor/github.com/moby/moby/api/types/events/events.go b/vendor/github.com/moby/moby/api/types/events/events.go new file mode 100644 index 00000000..b8393add --- /dev/null +++ b/vendor/github.com/moby/moby/api/types/events/events.go @@ -0,0 +1,121 @@ +package events + +// Type is used for event-types. +type Type string + +// List of known event types. +const ( + BuilderEventType Type = "builder" // BuilderEventType is the event type that the builder generates. + ConfigEventType Type = "config" // ConfigEventType is the event type that configs generate. + ContainerEventType Type = "container" // ContainerEventType is the event type that containers generate. + DaemonEventType Type = "daemon" // DaemonEventType is the event type that daemon generate. + ImageEventType Type = "image" // ImageEventType is the event type that images generate. + NetworkEventType Type = "network" // NetworkEventType is the event type that networks generate. + NodeEventType Type = "node" // NodeEventType is the event type that nodes generate. + PluginEventType Type = "plugin" // PluginEventType is the event type that plugins generate. + SecretEventType Type = "secret" // SecretEventType is the event type that secrets generate. + ServiceEventType Type = "service" // ServiceEventType is the event type that services generate. + VolumeEventType Type = "volume" // VolumeEventType is the event type that volumes generate. +) + +// Action is used for event-actions. +type Action string + +const ( + ActionCreate Action = "create" + ActionStart Action = "start" + ActionRestart Action = "restart" + ActionStop Action = "stop" + ActionCheckpoint Action = "checkpoint" + ActionPause Action = "pause" + ActionUnPause Action = "unpause" + ActionAttach Action = "attach" + ActionDetach Action = "detach" + ActionResize Action = "resize" + ActionUpdate Action = "update" + ActionRename Action = "rename" + ActionKill Action = "kill" + ActionDie Action = "die" + ActionOOM Action = "oom" + ActionDestroy Action = "destroy" + ActionRemove Action = "remove" + ActionCommit Action = "commit" + ActionTop Action = "top" + ActionCopy Action = "copy" + ActionArchivePath Action = "archive-path" + ActionExtractToDir Action = "extract-to-dir" + ActionExport Action = "export" + ActionImport Action = "import" + ActionSave Action = "save" + ActionLoad Action = "load" + ActionTag Action = "tag" + ActionUnTag Action = "untag" + ActionPush Action = "push" + ActionPull Action = "pull" + ActionPrune Action = "prune" + ActionDelete Action = "delete" + ActionEnable Action = "enable" + ActionDisable Action = "disable" + ActionConnect Action = "connect" + ActionDisconnect Action = "disconnect" + ActionReload Action = "reload" + ActionMount Action = "mount" + ActionUnmount Action = "unmount" + + // ActionExecCreate is the prefix used for exec_create events. These + // event-actions are commonly followed by a colon and space (": "), + // and the command that's defined for the exec, for example: + // + // exec_create: /bin/sh -c 'echo hello' + // + // This is far from ideal; it's a compromise to allow filtering and + // to preserve backward-compatibility. + ActionExecCreate Action = "exec_create" + // ActionExecStart is the prefix used for exec_create events. These + // event-actions are commonly followed by a colon and space (": "), + // and the command that's defined for the exec, for example: + // + // exec_start: /bin/sh -c 'echo hello' + // + // This is far from ideal; it's a compromise to allow filtering and + // to preserve backward-compatibility. + ActionExecStart Action = "exec_start" + ActionExecDie Action = "exec_die" + ActionExecDetach Action = "exec_detach" + + // ActionHealthStatus is the prefix to use for health_status events. + // + // Health-status events can either have a pre-defined status, in which + // case the "health_status" action is followed by a colon, or can be + // "free-form", in which case they're followed by the output of the + // health-check output. + // + // This is far form ideal, and a compromise to allow filtering, and + // to preserve backward-compatibility. + ActionHealthStatus Action = "health_status" + ActionHealthStatusRunning Action = "health_status: running" + ActionHealthStatusHealthy Action = "health_status: healthy" + ActionHealthStatusUnhealthy Action = "health_status: unhealthy" +) + +// Actor describes something that generates events, +// like a container, or a network, or a volume. +// It has a defined name and a set of attributes. +// The container attributes are its labels, other actors +// can generate these attributes from other properties. +type Actor struct { + ID string + Attributes map[string]string +} + +// Message represents the information an event contains +type Message struct { + Type Type + Action Action + Actor Actor + // Engine events are local scope. Cluster events are swarm scope. + Scope string `json:"scope,omitempty"` + + Time int64 `json:"time,omitempty"` + TimeNano int64 `json:"timeNano,omitempty"` +} diff --git a/vendor/github.com/moby/moby/api/types/image/build_identity.go b/vendor/github.com/moby/moby/api/types/image/build_identity.go new file mode 100644 index 00000000..1e827dc4 --- /dev/null +++ b/vendor/github.com/moby/moby/api/types/image/build_identity.go @@ -0,0 +1,15 @@ +package image + +import ( + "time" +) + +// BuildIdentity contains build reference information if image was created via build. +type BuildIdentity struct { + // Ref is the identifier for the build request. This reference can be used to + // look up the build details in BuildKit history API. + Ref string `json:"Ref,omitempty"` + + // CreatedAt is the time when the build ran. + CreatedAt time.Time `json:"CreatedAt,omitempty"` +} diff --git a/vendor/github.com/moby/moby/api/types/image/delete_response.go b/vendor/github.com/moby/moby/api/types/image/delete_response.go new file mode 100644 index 00000000..b19119a3 --- /dev/null +++ b/vendor/github.com/moby/moby/api/types/image/delete_response.go @@ -0,0 +1,18 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package image + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +// DeleteResponse delete response +// +// swagger:model DeleteResponse +type DeleteResponse struct { + + // The image ID of an image that was deleted + Deleted string `json:"Deleted,omitempty"` + + // The image ID of an image that was untagged + Untagged string `json:"Untagged,omitempty"` +} diff --git a/vendor/github.com/moby/moby/api/types/image/disk_usage.go b/vendor/github.com/moby/moby/api/types/image/disk_usage.go new file mode 100644 index 00000000..7297813c --- /dev/null +++ b/vendor/github.com/moby/moby/api/types/image/disk_usage.go @@ -0,0 +1,36 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package image + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +// DiskUsage represents system data usage for image resources. +// +// swagger:model DiskUsage +type DiskUsage struct { + + // Count of active images. + // + // Example: 1 + ActiveCount int64 `json:"ActiveCount,omitempty"` + + // List of image summaries. + // + Items []Summary `json:"Items,omitempty"` + + // Disk space that can be reclaimed by removing unused images. + // + // Example: 12345678 + Reclaimable int64 `json:"Reclaimable,omitempty"` + + // Count of all images. + // + // Example: 4 + TotalCount int64 `json:"TotalCount,omitempty"` + + // Disk space in use by images. + // + // Example: 98765432 + TotalSize int64 `json:"TotalSize,omitempty"` +} diff --git a/vendor/github.com/moby/moby/api/types/image/history_response_item.go b/vendor/github.com/moby/moby/api/types/image/history_response_item.go new file mode 100644 index 00000000..3de3181a --- /dev/null +++ b/vendor/github.com/moby/moby/api/types/image/history_response_item.go @@ -0,0 +1,38 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package image + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +// HistoryResponseItem HistoryResponseItem +// +// individual image layer information in response to ImageHistory operation +// +// swagger:model HistoryResponseItem +type HistoryResponseItem struct { + + // comment + // Required: true + Comment string `json:"Comment"` + + // created + // Required: true + Created int64 `json:"Created"` + + // created by + // Required: true + CreatedBy string `json:"CreatedBy"` + + // Id + // Required: true + ID string `json:"Id"` + + // size + // Required: true + Size int64 `json:"Size"` + + // tags + // Required: true + Tags []string `json:"Tags"` +} diff --git a/vendor/github.com/moby/moby/api/types/image/identity.go b/vendor/github.com/moby/moby/api/types/image/identity.go new file mode 100644 index 00000000..3e030456 --- /dev/null +++ b/vendor/github.com/moby/moby/api/types/image/identity.go @@ -0,0 +1,15 @@ +package image + +// Identity holds information about the identity and origin of the image. +// This is trusted information verified by the daemon and cannot be modified +// by tagging an image to a different name. +type Identity struct { + // Signature contains the properties of verified signatures for the image. + Signature []SignatureIdentity `json:"Signature,omitzero"` + // Pull contains remote location information if image was created via pull. + // If image was pulled via mirror, this contains the original repository location. + // After successful push this images also contains the pushed repository location. + Pull []PullIdentity `json:"Pull,omitzero"` + // Build contains build reference information if image was created via build. + Build []BuildIdentity `json:"Build,omitzero"` +} diff --git a/vendor/github.com/moby/moby/api/types/image/image.go b/vendor/github.com/moby/moby/api/types/image/image.go new file mode 100644 index 00000000..1c8990ae --- /dev/null +++ b/vendor/github.com/moby/moby/api/types/image/image.go @@ -0,0 +1,18 @@ +package image + +import ( + "time" +) + +// Metadata contains engine-local data about the image. +type Metadata struct { + // LastTagTime is the date and time at which the image was last tagged. + LastTagTime time.Time `json:",omitempty"` +} + +// PruneReport contains the response for Engine API: +// POST "/images/prune" +type PruneReport struct { + ImagesDeleted []DeleteResponse + SpaceReclaimed uint64 +} diff --git a/vendor/github.com/moby/moby/api/types/image/image_inspect.go b/vendor/github.com/moby/moby/api/types/image/image_inspect.go new file mode 100644 index 00000000..df09c951 --- /dev/null +++ b/vendor/github.com/moby/moby/api/types/image/image_inspect.go @@ -0,0 +1,137 @@ +package image + +import ( + dockerspec "github.com/moby/docker-image-spec/specs-go/v1" + "github.com/moby/moby/api/types/storage" + ocispec "github.com/opencontainers/image-spec/specs-go/v1" +) + +// RootFS returns Image's RootFS description including the layer IDs. +type RootFS struct { + Type string `json:",omitempty"` + Layers []string `json:",omitempty"` +} + +// InspectResponse contains response of Engine API: +// GET "/images/{name:.*}/json" +type InspectResponse struct { + // ID is the content-addressable ID of an image. + // + // This identifier is a content-addressable digest calculated from the + // image's configuration (which includes the digests of layers used by + // the image). + // + // Note that this digest differs from the `RepoDigests` below, which + // holds digests of image manifests that reference the image. + ID string `json:"Id"` + + // RepoTags is a list of image names/tags in the local image cache that + // reference this image. + // + // Multiple image tags can refer to the same image, and this list may be + // empty if no tags reference the image, in which case the image is + // "untagged", in which case it can still be referenced by its ID. + RepoTags []string + + // RepoDigests is a list of content-addressable digests of locally available + // image manifests that the image is referenced from. Multiple manifests can + // refer to the same image. + // + // These digests are usually only available if the image was either pulled + // from a registry, or if the image was pushed to a registry, which is when + // the manifest is generated and its digest calculated. + RepoDigests []string + + // Comment is an optional message that can be set when committing or + // importing the image. This field is omitted if not set. + Comment string `json:",omitempty"` + + // Created is the date and time at which the image was created, formatted in + // RFC 3339 nano-seconds (time.RFC3339Nano). + // + // This information is only available if present in the image, + // and omitted otherwise. + Created string `json:",omitempty"` + + // Author is the name of the author that was specified when committing the + // image, or as specified through MAINTAINER (deprecated) in the Dockerfile. + // This field is omitted if not set. + Author string `json:",omitempty"` + Config *dockerspec.DockerOCIImageConfig + + // Architecture is the hardware CPU architecture that the image runs on. + Architecture string + + // Variant is the CPU architecture variant (presently ARM-only). + Variant string `json:",omitempty"` + + // OS is the Operating System the image is built to run on. + Os string + + // OsVersion is the version of the Operating System the image is built to + // run on (especially for Windows). + OsVersion string `json:",omitempty"` + + // Size is the total size of the image including all layers it is composed of. + Size int64 + + // GraphDriver holds information about the storage driver used to store the + // container's and image's filesystem. + GraphDriver *storage.DriverData `json:"GraphDriver,omitempty"` + + // RootFS contains information about the image's RootFS, including the + // layer IDs. + RootFS RootFS + + // Metadata of the image in the local cache. + // + // This information is local to the daemon, and not part of the image itself. + Metadata Metadata + + // Descriptor is the OCI descriptor of the image target. + // It's only set if the daemon provides a multi-platform image store. + // + // WARNING: This is experimental and may change at any time without any backward + // compatibility. + Descriptor *ocispec.Descriptor `json:"Descriptor,omitempty"` + + // Manifests is a list of image manifests available in this image. It + // provides a more detailed view of the platform-specific image manifests or + // other image-attached data like build attestations. + // + // Only available if the daemon provides a multi-platform image store, the client + // requests manifests AND does not request a specific platform. + // + // WARNING: This is experimental and may change at any time without any backward + // compatibility. + Manifests []ManifestSummary `json:"Manifests,omitempty"` + + // Identity holds information about the identity and origin of the image. + // This is trusted information verified by the daemon and cannot be modified + // by tagging an image to a different name. + Identity *Identity `json:"Identity,omitempty"` +} + +// SignatureTimestampType is the type of timestamp used in the signature. +type SignatureTimestampType string + +const ( + SignatureTimestampTlog SignatureTimestampType = "Tlog" + SignatureTimestampAuthority SignatureTimestampType = "TimestampAuthority" +) + +// SignatureType is the type of signature format. +type SignatureType string + +const ( + SignatureTypeBundleV03 SignatureType = "bundle-v0.3" + SignatureTypeSimpleSigningV1 SignatureType = "simplesigning-v1" +) + +// KnownSignerIdentity is an identifier for a special signer identity that is known to the implementation. +type KnownSignerIdentity string + +const ( + // KnownSignerDHI is the known identity for Docker Hardened Images. + KnownSignerDHI KnownSignerIdentity = "DHI" +) diff --git a/vendor/github.com/moby/moby/api/types/image/manifest.go b/vendor/github.com/moby/moby/api/types/image/manifest.go new file mode 100644 index 00000000..bcd00a07 --- /dev/null +++ b/vendor/github.com/moby/moby/api/types/image/manifest.go @@ -0,0 +1,104 @@ +package image + +import ( + "github.com/opencontainers/go-digest" + ocispec "github.com/opencontainers/image-spec/specs-go/v1" +) + +type ManifestKind string + +const ( + ManifestKindImage ManifestKind = "image" + ManifestKindAttestation ManifestKind = "attestation" + ManifestKindUnknown ManifestKind = "unknown" +) + +type ManifestSummary struct { + // ID is the content-addressable ID of an image and is the same as the + // digest of the image manifest. + // + // Required: true + ID string `json:"ID"` + + // Descriptor is the OCI descriptor of the image. + // + // Required: true + Descriptor ocispec.Descriptor `json:"Descriptor"` + + // Indicates whether all the child content (image config, layers) is + // fully available locally + // + // Required: true + Available bool `json:"Available"` + + // Size is the size information of the content related to this manifest. + // Note: These sizes only take the locally available content into account. + // + // Required: true + Size struct { + // Content is the size (in bytes) of all the locally present + // content in the content store (e.g. image config, layers) + // referenced by this manifest and its children. + // This only includes blobs in the content store. + Content int64 `json:"Content"` + + // Total is the total size (in bytes) of all the locally present + // data (both distributable and non-distributable) that's related to + // this manifest and its children. + // This equal to the sum of [Content] size AND all the sizes in the + // [Size] struct present in the Kind-specific data struct. + // For example, for an image kind (Kind == ManifestKindImage), + // this would include the size of the image content and unpacked + // image snapshots ([Size.Content] + [ImageData.Size.Unpacked]). + Total int64 `json:"Total"` + } `json:"Size"` + + // Kind is the kind of the image manifest. + // + // Required: true + Kind ManifestKind `json:"Kind"` + + // Fields below are specific to the kind of the image manifest. + + // Present only if Kind == ManifestKindImage. + ImageData *ImageProperties `json:"ImageData,omitempty"` + + // Present only if Kind == ManifestKindAttestation. + AttestationData *AttestationProperties `json:"AttestationData,omitempty"` +} + +type ImageProperties struct { + // Platform is the OCI platform object describing the platform of the image. + // + // Required: true + Platform ocispec.Platform `json:"Platform"` + + // Identity holds information about the identity and origin of the image. + // For image list responses, this can duplicate Build/Pull fields across + // image manifests, because those parts of identity are image-level metadata. + Identity *Identity `json:"Identity,omitempty"` + + Size struct { + // Unpacked is the size (in bytes) of the locally unpacked + // (uncompressed) image content that's directly usable by the containers + // running this image. + // It's independent of the distributable content - e.g. + // the image might still have an unpacked data that's still used by + // some container even when the distributable/compressed content is + // already gone. + // + // Required: true + Unpacked int64 `json:"Unpacked"` + } + + // Containers is an array containing the IDs of the containers that are + // using this image. + // + // Required: true + Containers []string `json:"Containers"` +} + +type AttestationProperties struct { + // For is the digest of the image manifest that this attestation is for. + For digest.Digest `json:"For"` +} diff --git a/vendor/github.com/moby/moby/api/types/image/pull_identity.go b/vendor/github.com/moby/moby/api/types/image/pull_identity.go new file mode 100644 index 00000000..711492b5 --- /dev/null +++ b/vendor/github.com/moby/moby/api/types/image/pull_identity.go @@ -0,0 +1,8 @@ +package image + +// PullIdentity contains remote location information if image was created via pull. +// If image was pulled via mirror, this contains the original repository location. +type PullIdentity struct { + // Repository is the remote repository location the image was pulled from. + Repository string `json:"Repository,omitempty"` +} diff --git a/vendor/github.com/moby/moby/api/types/image/signature_identity.go b/vendor/github.com/moby/moby/api/types/image/signature_identity.go new file mode 100644 index 00000000..243c2997 --- /dev/null +++ b/vendor/github.com/moby/moby/api/types/image/signature_identity.go @@ -0,0 +1,26 @@ +package image + +// SignatureIdentity contains the properties of verified signatures for the image. +type SignatureIdentity struct { + // Name is a textual description summarizing the type of signature. + Name string `json:"Name,omitempty"` + // Timestamps contains a list of verified signed timestamps for the signature. + Timestamps []SignatureTimestamp `json:"Timestamps,omitzero"` + // KnownSigner is an identifier for a special signer identity that is known to the implementation. + KnownSigner KnownSignerIdentity `json:"KnownSigner,omitempty"` + // DockerReference is the Docker image reference associated with the signature. + // This is an optional field only present in older hashedrecord signatures. + DockerReference string `json:"DockerReference,omitempty"` + // Signer contains information about the signer certificate used to sign the image. + Signer *SignerIdentity `json:"Signer,omitempty"` + // SignatureType is the type of signature format. E.g. "bundle-v0.3" or "hashedrecord". + SignatureType SignatureType `json:"SignatureType,omitempty"` + + // Error contains error information if signature verification failed. + // Other fields will be empty in this case. + Error string `json:"Error,omitempty"` + // Warnings contains any warnings that occurred during signature verification. + // For example, if there was no internet connectivity and cached trust roots were used. + // Warning does not indicate a failed verification but may point to configuration issues. + Warnings []string `json:"Warnings,omitzero"` +} diff --git a/vendor/github.com/moby/moby/api/types/image/signature_timestamp.go b/vendor/github.com/moby/moby/api/types/image/signature_timestamp.go new file mode 100644 index 00000000..a975ef0e --- /dev/null +++ b/vendor/github.com/moby/moby/api/types/image/signature_timestamp.go @@ -0,0 +1,12 @@ +package image + +import ( + "time" +) + +// SignatureTimestamp contains information about a verified signed timestamp for an image signature. +type SignatureTimestamp struct { + Type SignatureTimestampType `json:"Type"` + URI string `json:"URI"` + Timestamp time.Time `json:"Timestamp"` +} diff --git a/vendor/github.com/moby/moby/api/types/image/signer_identity.go b/vendor/github.com/moby/moby/api/types/image/signer_identity.go new file mode 100644 index 00000000..87419e14 --- /dev/null +++ b/vendor/github.com/moby/moby/api/types/image/signer_identity.go @@ -0,0 +1,57 @@ +package image + +// SignerIdentity contains information about the signer certificate used to sign the image. +// This is [certificate.Summary] with deprecated fields removed and keys in Moby uppercase style. +// +// [certificate.Summary]: https://pkg.go.dev/github.com/sigstore/sigstore-go/pkg/fulcio/certificate#Summary +type SignerIdentity struct { + CertificateIssuer string `json:"CertificateIssuer"` + SubjectAlternativeName string `json:"SubjectAlternativeName"` + // The OIDC issuer. Should match `iss` claim of ID token or, in the case of + // a federated login like Dex it should match the issuer URL of the + // upstream issuer. The issuer is not set the extensions are invalid and + // will fail to render. + Issuer string `json:"Issuer,omitempty"` // OID 1.3.6.1.4.1.57264.1.8 and 1.3.6.1.4.1.57264.1.1 (Deprecated) + + // Reference to specific build instructions that are responsible for signing. + BuildSignerURI string `json:"BuildSignerURI,omitempty"` // 1.3.6.1.4.1.57264.1.9 + + // Immutable reference to the specific version of the build instructions that is responsible for signing. + BuildSignerDigest string `json:"BuildSignerDigest,omitempty"` // 1.3.6.1.4.1.57264.1.10 + + // Specifies whether the build took place in platform-hosted cloud infrastructure or customer/self-hosted infrastructure. + RunnerEnvironment string `json:"RunnerEnvironment,omitempty"` // 1.3.6.1.4.1.57264.1.11 + + // Source repository URL that the build was based on. + SourceRepositoryURI string `json:"SourceRepositoryURI,omitempty"` // 1.3.6.1.4.1.57264.1.12 + + // Immutable reference to a specific version of the source code that the build was based upon. + SourceRepositoryDigest string `json:"SourceRepositoryDigest,omitempty"` // 1.3.6.1.4.1.57264.1.13 + + // Source Repository Ref that the build run was based upon. + SourceRepositoryRef string `json:"SourceRepositoryRef,omitempty"` // 1.3.6.1.4.1.57264.1.14 + + // Immutable identifier for the source repository the workflow was based upon. + SourceRepositoryIdentifier string `json:"SourceRepositoryIdentifier,omitempty"` // 1.3.6.1.4.1.57264.1.15 + + // Source repository owner URL of the owner of the source repository that the build was based on. + SourceRepositoryOwnerURI string `json:"SourceRepositoryOwnerURI,omitempty"` // 1.3.6.1.4.1.57264.1.16 + + // Immutable identifier for the owner of the source repository that the workflow was based upon. + SourceRepositoryOwnerIdentifier string `json:"SourceRepositoryOwnerIdentifier,omitempty"` // 1.3.6.1.4.1.57264.1.17 + + // Build Config URL to the top-level/initiating build instructions. + BuildConfigURI string `json:"BuildConfigURI,omitempty"` // 1.3.6.1.4.1.57264.1.18 + + // Immutable reference to the specific version of the top-level/initiating build instructions. + BuildConfigDigest string `json:"BuildConfigDigest,omitempty"` // 1.3.6.1.4.1.57264.1.19 + + // Event or action that initiated the build. + BuildTrigger string `json:"BuildTrigger,omitempty"` // 1.3.6.1.4.1.57264.1.20 + + // Run Invocation URL to uniquely identify the build execution. + RunInvocationURI string `json:"RunInvocationURI,omitempty"` // 1.3.6.1.4.1.57264.1.21 + + // Source repository visibility at the time of signing the certificate. + SourceRepositoryVisibilityAtSigning string `json:"SourceRepositoryVisibilityAtSigning,omitempty"` // 1.3.6.1.4.1.57264.1.22 +} diff --git a/vendor/github.com/moby/moby/api/types/image/summary.go b/vendor/github.com/moby/moby/api/types/image/summary.go new file mode 100644 index 00000000..3d4dd165 --- /dev/null +++ b/vendor/github.com/moby/moby/api/types/image/summary.go @@ -0,0 +1,95 @@ +package image + +import ocispec "github.com/opencontainers/image-spec/specs-go/v1" + +type Summary struct { + // Number of containers using this image. Includes both stopped and running + // containers. + // + // This size is not calculated by default, and depends on which API endpoint + // is used. `-1` indicates that the value has not been set / calculated. + // + // Required: true + Containers int64 `json:"Containers"` + + // Date and time at which the image was created as a Unix timestamp + // (number of seconds since EPOCH). + // + // Required: true + Created int64 `json:"Created"` + + // ID is the content-addressable ID of an image. + // + // This identifier is a content-addressable digest calculated from the + // image's configuration (which includes the digests of layers used by + // the image). + // + // Note that this digest differs from the `RepoDigests` below, which + // holds digests of image manifests that reference the image. + // + // Required: true + ID string `json:"Id"` + + // User-defined key/value metadata. + // Required: true + Labels map[string]string `json:"Labels"` + + // ID of the parent image. + // + // Depending on how the image was created, this field may be empty and + // is only set for images that were built/created locally. This field + // is empty if the image was pulled from an image registry. + // + // Required: true + ParentID string `json:"ParentId"` + + // Descriptor is the OCI descriptor of the image target. + // It's only set if the daemon provides a multi-platform image store. + // + // WARNING: This is experimental and may change at any time without any backward + // compatibility. + Descriptor *ocispec.Descriptor `json:"Descriptor,omitempty"` + + // Manifests is a list of image manifests available in this image. It + // provides a more detailed view of the platform-specific image manifests or + // other image-attached data like build attestations. + // + // WARNING: This is experimental and may change at any time without any backward + // compatibility. + Manifests []ManifestSummary `json:"Manifests,omitempty"` + + // List of content-addressable digests of locally available image manifests + // that the image is referenced from. Multiple manifests can refer to the + // same image. + // + // These digests are usually only available if the image was either pulled + // from a registry, or if the image was pushed to a registry, which is when + // the manifest is generated and its digest calculated. + // + // Required: true + RepoDigests []string `json:"RepoDigests"` + + // List of image names/tags in the local image cache that reference this + // image. + // + // Multiple image tags can refer to the same image, and this list may be + // empty if no tags reference the image, in which case the image is + // "untagged", in which case it can still be referenced by its ID. + // + // Required: true + RepoTags []string `json:"RepoTags"` + + // Total size of image layers that are shared between this image and other + // images. + // + // This size is not calculated by default. `-1` indicates that the value + // has not been set / calculated. + // + // Required: true + SharedSize int64 `json:"SharedSize"` + + // Total size of the image including all layers it is composed of. + // + // Required: true + Size int64 `json:"Size"` +} diff --git a/vendor/github.com/moby/moby/api/types/jsonstream/json_error.go b/vendor/github.com/moby/moby/api/types/jsonstream/json_error.go new file mode 100644 index 00000000..0dcc9337 --- /dev/null +++ b/vendor/github.com/moby/moby/api/types/jsonstream/json_error.go @@ -0,0 +1,15 @@ +package jsonstream + +// Error wraps a concrete Code and Message, Code is +// an integer error code, Message is the error message. +type Error struct { + Code int `json:"code,omitempty"` + Message string `json:"message,omitempty"` +} + +func (e *Error) Error() string { + if e == nil { + return "" + } + return e.Message +} diff --git a/vendor/github.com/moby/moby/api/types/jsonstream/message.go b/vendor/github.com/moby/moby/api/types/jsonstream/message.go new file mode 100644 index 00000000..6b74bd93 --- /dev/null +++ b/vendor/github.com/moby/moby/api/types/jsonstream/message.go @@ -0,0 +1,15 @@ +package jsonstream + +import "encoding/json" + +// Message defines a message struct. It describes +// the created time, where it from, status, ID of the +// message. +type Message struct { + Stream string `json:"stream,omitempty"` + Status string `json:"status,omitempty"` + Progress *Progress `json:"progressDetail,omitempty"` + ID string `json:"id,omitempty"` + Error *Error `json:"errorDetail,omitempty"` + Aux *json.RawMessage `json:"aux,omitempty"` // Aux contains out-of-band data, such as digests for push signing and image id after building. +} diff --git a/vendor/github.com/moby/moby/api/types/jsonstream/progress.go b/vendor/github.com/moby/moby/api/types/jsonstream/progress.go new file mode 100644 index 00000000..5c38b3b5 --- /dev/null +++ b/vendor/github.com/moby/moby/api/types/jsonstream/progress.go @@ -0,0 +1,10 @@ +package jsonstream + +// Progress describes a progress message in a JSON stream. +type Progress struct { + Current int64 `json:"current,omitempty"` // Current is the current status and value of the progress made towards Total. + Total int64 `json:"total,omitempty"` // Total is the end value describing when we made 100% progress for an operation. + Start int64 `json:"start,omitempty"` // Start is the initial value for the operation. + HideCounts bool `json:"hidecounts,omitempty"` // HideCounts. if true, hides the progress count indicator (xB/yB). + Units string `json:"units,omitempty"` // Units is the unit to print for progress. It defaults to "bytes" if empty. +} diff --git a/vendor/github.com/moby/moby/api/types/mount/mount.go b/vendor/github.com/moby/moby/api/types/mount/mount.go new file mode 100644 index 00000000..090d436c --- /dev/null +++ b/vendor/github.com/moby/moby/api/types/mount/mount.go @@ -0,0 +1,157 @@ +package mount + +import ( + "os" +) + +// Type represents the type of a mount. +type Type string + +// Type constants +const ( + // TypeBind is the type for mounting host dir + TypeBind Type = "bind" + // TypeVolume is the type for remote storage volumes + TypeVolume Type = "volume" + // TypeTmpfs is the type for mounting tmpfs + TypeTmpfs Type = "tmpfs" + // TypeNamedPipe is the type for mounting Windows named pipes + TypeNamedPipe Type = "npipe" + // TypeCluster is the type for Swarm Cluster Volumes. + TypeCluster Type = "cluster" + // TypeImage is the type for mounting another image's filesystem + TypeImage Type = "image" +) + +// Mount represents a mount (volume). +type Mount struct { + Type Type `json:",omitempty"` + // Source specifies the name of the mount. Depending on mount type, this + // may be a volume name or a host path, or even ignored. + // Source is not supported for tmpfs (must be an empty value) + Source string `json:",omitempty"` + Target string `json:",omitempty"` + ReadOnly bool `json:",omitempty"` // attempts recursive read-only if possible + Consistency Consistency `json:",omitempty"` + + BindOptions *BindOptions `json:",omitempty"` + VolumeOptions *VolumeOptions `json:",omitempty"` + ImageOptions *ImageOptions `json:",omitempty"` + TmpfsOptions *TmpfsOptions `json:",omitempty"` + ClusterOptions *ClusterOptions `json:",omitempty"` +} + +// Propagation represents the propagation of a mount. +type Propagation string + +const ( + // PropagationRPrivate RPRIVATE + PropagationRPrivate Propagation = "rprivate" + // PropagationPrivate PRIVATE + PropagationPrivate Propagation = "private" + // PropagationRShared RSHARED + PropagationRShared Propagation = "rshared" + // PropagationShared SHARED + PropagationShared Propagation = "shared" + // PropagationRSlave RSLAVE + PropagationRSlave Propagation = "rslave" + // PropagationSlave SLAVE + PropagationSlave Propagation = "slave" +) + +// Propagations is the list of all valid mount propagations +var Propagations = []Propagation{ + PropagationRPrivate, + PropagationPrivate, + PropagationRShared, + PropagationShared, + PropagationRSlave, + PropagationSlave, +} + +// Consistency represents the consistency requirements of a mount. +type Consistency string + +const ( + // ConsistencyFull guarantees bind mount-like consistency + ConsistencyFull Consistency = "consistent" + // ConsistencyCached mounts can cache read data and FS structure + ConsistencyCached Consistency = "cached" + // ConsistencyDelegated mounts can cache read and written data and structure + ConsistencyDelegated Consistency = "delegated" + // ConsistencyDefault provides "consistent" behavior unless overridden + ConsistencyDefault Consistency = "default" +) + +// BindOptions defines options specific to mounts of type "bind". +type BindOptions struct { + Propagation Propagation `json:",omitempty"` + NonRecursive bool `json:",omitempty"` + CreateMountpoint bool `json:",omitempty"` + // ReadOnlyNonRecursive makes the mount non-recursively read-only, but still leaves the mount recursive + // (unless NonRecursive is set to true in conjunction). + ReadOnlyNonRecursive bool `json:",omitempty"` + // ReadOnlyForceRecursive raises an error if the mount cannot be made recursively read-only. + ReadOnlyForceRecursive bool `json:",omitempty"` +} + +// VolumeOptions represents the options for a mount of type volume. +type VolumeOptions struct { + NoCopy bool `json:",omitempty"` + Labels map[string]string `json:",omitempty"` + Subpath string `json:",omitempty"` + DriverConfig *Driver `json:",omitempty"` +} + +type ImageOptions struct { + Subpath string `json:",omitempty"` +} + +// Driver represents a volume driver. +type Driver struct { + Name string `json:",omitempty"` + Options map[string]string `json:",omitempty"` +} + +// TmpfsOptions defines options specific to mounts of type "tmpfs". +type TmpfsOptions struct { + // Size sets the size of the tmpfs, in bytes. + // + // This will be converted to an operating system specific value + // depending on the host. For example, on linux, it will be converted to + // use a 'k', 'm' or 'g' syntax. BSD, though not widely supported with + // docker, uses a straight byte value. + // + // Percentages are not supported. + SizeBytes int64 `json:",omitempty"` + // Mode of the tmpfs upon creation + Mode os.FileMode `json:",omitempty"` + // Options to be passed to the tmpfs mount. An array of arrays. Flag + // options should be provided as 1-length arrays. Other types should be + // provided as 2-length arrays, where the first item is the key and the + // second the value. + Options [][]string `json:",omitempty"` + // TODO(stevvooe): There are several more tmpfs flags, specified in the + // daemon, that are accepted. Only the most basic are added for now. + // + // From https://github.com/moby/sys/blob/mount/v0.1.1/mount/flags.go#L47-L56 + // + // var validFlags = map[string]bool{ + // "": true, + // "size": true, X + // "mode": true, X + // "uid": true, + // "gid": true, + // "nr_inodes": true, + // "nr_blocks": true, + // "mpol": true, + // } + // + // Some of these may be straightforward to add, but others, such as + // uid/gid have implications in a clustered system. +} + +// ClusterOptions specifies options for a Cluster volume. +type ClusterOptions struct { + // intentionally empty +} diff --git a/vendor/github.com/moby/moby/api/types/network/config_reference.go b/vendor/github.com/moby/moby/api/types/network/config_reference.go new file mode 100644 index 00000000..1158afe6 --- /dev/null +++ b/vendor/github.com/moby/moby/api/types/network/config_reference.go @@ -0,0 +1,20 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package network + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +// ConfigReference The config-only network source to provide the configuration for +// this network. +// +// swagger:model ConfigReference +type ConfigReference struct { + + // The name of the config-only network that provides the network's + // configuration. The specified network must be an existing config-only + // network. Only network names are allowed, not network IDs. + // + // Example: config_only_network_01 + Network string `json:"Network"` +} diff --git a/vendor/github.com/moby/moby/api/types/network/connect_request.go b/vendor/github.com/moby/moby/api/types/network/connect_request.go new file mode 100644 index 00000000..2ff14d36 --- /dev/null +++ b/vendor/github.com/moby/moby/api/types/network/connect_request.go @@ -0,0 +1,20 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package network + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +// ConnectRequest NetworkConnectRequest represents the data to be used to connect a container to a network. +// +// swagger:model ConnectRequest +type ConnectRequest struct { + + // The ID or name of the container to connect to the network. + // Example: 3613f73ba0e4 + // Required: true + Container string `json:"Container"` + + // endpoint config + EndpointConfig *EndpointSettings `json:"EndpointConfig,omitempty"` +} diff --git a/vendor/github.com/moby/moby/api/types/network/create_response.go b/vendor/github.com/moby/moby/api/types/network/create_response.go new file mode 100644 index 00000000..19970599 --- /dev/null +++ b/vendor/github.com/moby/moby/api/types/network/create_response.go @@ -0,0 +1,23 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package network + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +// CreateResponse NetworkCreateResponse +// +// # OK response to NetworkCreate operation +// +// swagger:model CreateResponse +type CreateResponse struct { + + // The ID of the created network. + // Example: b5c4fc71e8022147cd25de22b22173de4e3b170134117172eb595cb91b4e7e5d + // Required: true + ID string `json:"Id"` + + // Warnings encountered when creating the container + // Required: true + Warning string `json:"Warning"` +} diff --git a/vendor/github.com/moby/moby/api/types/network/disconnect_request.go b/vendor/github.com/moby/moby/api/types/network/disconnect_request.go new file mode 100644 index 00000000..7b1f521e --- /dev/null +++ b/vendor/github.com/moby/moby/api/types/network/disconnect_request.go @@ -0,0 +1,21 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package network + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +// DisconnectRequest NetworkDisconnectRequest represents the data to be used to disconnect a container from a network. +// +// swagger:model DisconnectRequest +type DisconnectRequest struct { + + // The ID or name of the container to disconnect from the network. + // Example: 3613f73ba0e4 + // Required: true + Container string `json:"Container"` + + // Force the container to disconnect from the network. + // Example: false + Force bool `json:"Force"` +} diff --git a/vendor/github.com/moby/moby/api/types/network/endpoint.go b/vendor/github.com/moby/moby/api/types/network/endpoint.go new file mode 100644 index 00000000..c4c1766c --- /dev/null +++ b/vendor/github.com/moby/moby/api/types/network/endpoint.go @@ -0,0 +1,74 @@ +package network + +import ( + "maps" + "net/netip" + "slices" +) + +// EndpointSettings stores the network endpoint details +type EndpointSettings struct { + // Configuration data + IPAMConfig *EndpointIPAMConfig + Links []string + Aliases []string // Aliases holds the list of extra, user-specified DNS names for this endpoint. + DriverOpts map[string]string + + // GwPriority determines which endpoint will provide the default gateway + // for the container. The endpoint with the highest priority will be used. + // If multiple endpoints have the same priority, they are lexicographically + // sorted based on their network name, and the one that sorts first is picked. + GwPriority int + + // Operational data + + NetworkID string + EndpointID string + Gateway netip.Addr + IPAddress netip.Addr + + // MacAddress may be used to specify a MAC address when the container is created. + // Once the container is running, it becomes operational data (it may contain a + // generated address). + MacAddress HardwareAddr + IPPrefixLen int + IPv6Gateway netip.Addr + GlobalIPv6Address netip.Addr + GlobalIPv6PrefixLen int + // DNSNames holds all the (non fully qualified) DNS names associated to this + // endpoint. The first entry is used to generate PTR records. + DNSNames []string +} + +// Copy makes a deep copy of `EndpointSettings` +func (es *EndpointSettings) Copy() *EndpointSettings { + if es == nil { + return nil + } + + epCopy := *es + epCopy.IPAMConfig = es.IPAMConfig.Copy() + epCopy.Links = slices.Clone(es.Links) + epCopy.Aliases = slices.Clone(es.Aliases) + epCopy.DNSNames = slices.Clone(es.DNSNames) + epCopy.DriverOpts = maps.Clone(es.DriverOpts) + + return &epCopy +} + +// EndpointIPAMConfig represents IPAM configurations for the endpoint +type EndpointIPAMConfig struct { + IPv4Address netip.Addr `json:"IPv4Address,omitzero"` + IPv6Address netip.Addr `json:"IPv6Address,omitzero"` + LinkLocalIPs []netip.Addr `json:"LinkLocalIPs,omitempty"` +} + +// Copy makes a copy of the endpoint ipam config +func (cfg *EndpointIPAMConfig) Copy() *EndpointIPAMConfig { + if cfg == nil { + return nil + } + cfgCopy := *cfg + cfgCopy.LinkLocalIPs = slices.Clone(cfg.LinkLocalIPs) + return &cfgCopy +} diff --git a/vendor/github.com/moby/moby/api/types/network/endpoint_resource.go b/vendor/github.com/moby/moby/api/types/network/endpoint_resource.go new file mode 100644 index 00000000..bf493ad5 --- /dev/null +++ b/vendor/github.com/moby/moby/api/types/network/endpoint_resource.go @@ -0,0 +1,35 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package network + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "net/netip" +) + +// EndpointResource contains network resources allocated and used for a container in a network. +// +// swagger:model EndpointResource +type EndpointResource struct { + + // name + // Example: container_1 + Name string `json:"Name"` + + // endpoint ID + // Example: 628cadb8bcb92de107b2a1e516cbffe463e321f548feb37697cce00ad694f21a + EndpointID string `json:"EndpointID"` + + // mac address + // Example: 02:42:ac:13:00:02 + MacAddress HardwareAddr `json:"MacAddress"` + + // IPv4 address + // Example: 172.19.0.2/16 + IPv4Address netip.Prefix `json:"IPv4Address"` + + // IPv6 address + IPv6Address netip.Prefix `json:"IPv6Address"` +} diff --git a/vendor/github.com/moby/moby/api/types/network/hwaddr.go b/vendor/github.com/moby/moby/api/types/network/hwaddr.go new file mode 100644 index 00000000..b2a4dfb1 --- /dev/null +++ b/vendor/github.com/moby/moby/api/types/network/hwaddr.go @@ -0,0 +1,39 @@ +package network + +import ( + "encoding" + "fmt" + "net" +) + +// A HardwareAddr represents a physical hardware address. +// It implements [encoding.TextMarshaler] and [encoding.TextUnmarshaler] +// in the absence of go.dev/issue/29678. +type HardwareAddr net.HardwareAddr + +var ( + _ encoding.TextMarshaler = (HardwareAddr)(nil) + _ encoding.TextUnmarshaler = (*HardwareAddr)(nil) + _ fmt.Stringer = (HardwareAddr)(nil) +) + +func (m *HardwareAddr) UnmarshalText(text []byte) error { + if len(text) == 0 { + *m = nil + return nil + } + hw, err := net.ParseMAC(string(text)) + if err != nil { + return err + } + *m = HardwareAddr(hw) + return nil +} + +func (m HardwareAddr) MarshalText() ([]byte, error) { + return []byte(net.HardwareAddr(m).String()), nil +} + +func (m HardwareAddr) String() string { + return net.HardwareAddr(m).String() +} diff --git a/vendor/github.com/moby/moby/api/types/network/inspect.go b/vendor/github.com/moby/moby/api/types/network/inspect.go new file mode 100644 index 00000000..cded5e60 --- /dev/null +++ b/vendor/github.com/moby/moby/api/types/network/inspect.go @@ -0,0 +1,27 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package network + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +// Inspect The body of the "get network" http response message. +// +// swagger:model Inspect +type Inspect struct { + Network + + // Contains endpoints attached to the network. + // + // Example: {"19a4d5d687db25203351ed79d478946f861258f018fe384f229f2efa4b23513c":{"EndpointID":"628cadb8bcb92de107b2a1e516cbffe463e321f548feb37697cce00ad694f21a","IPv4Address":"172.19.0.2/16","IPv6Address":"","MacAddress":"02:42:ac:13:00:02","Name":"test"}} + Containers map[string]EndpointResource `json:"Containers"` + + // List of services using the network. This field is only present for + // swarm scope networks, and omitted for local scope networks. + // + Services map[string]ServiceInfo `json:"Services,omitempty"` + + // provides runtime information about the network such as the number of allocated IPs. + // + Status *Status `json:"Status,omitempty"` +} diff --git a/vendor/github.com/moby/moby/api/types/network/ipam.go b/vendor/github.com/moby/moby/api/types/network/ipam.go new file mode 100644 index 00000000..3fb357fc --- /dev/null +++ b/vendor/github.com/moby/moby/api/types/network/ipam.go @@ -0,0 +1,22 @@ +package network + +import ( + "net/netip" +) + +// IPAM represents IP Address Management +type IPAM struct { + Driver string + Options map[string]string // Per network IPAM driver options + Config []IPAMConfig +} + +// IPAMConfig represents IPAM configurations +type IPAMConfig struct { + Subnet netip.Prefix `json:"Subnet,omitzero"` + IPRange netip.Prefix `json:"IPRange,omitzero"` + Gateway netip.Addr `json:"Gateway,omitzero"` + AuxAddress map[string]netip.Addr `json:"AuxiliaryAddresses,omitempty"` +} + +type SubnetStatuses = map[netip.Prefix]SubnetStatus diff --git a/vendor/github.com/moby/moby/api/types/network/ipam_status.go b/vendor/github.com/moby/moby/api/types/network/ipam_status.go new file mode 100644 index 00000000..7eb4e848 --- /dev/null +++ b/vendor/github.com/moby/moby/api/types/network/ipam_status.go @@ -0,0 +1,16 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package network + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +// IPAMStatus IPAM status +// +// swagger:model IPAMStatus +type IPAMStatus struct { + + // subnets + // Example: {"172.16.0.0/16":{"DynamicIPsAvailable":65533,"IPsInUse":3},"2001:db8:abcd:0012::0/96":{"DynamicIPsAvailable":4294967291,"IPsInUse":5}} + Subnets SubnetStatuses `json:"Subnets,omitempty"` +} diff --git a/vendor/github.com/moby/moby/api/types/network/network.go b/vendor/github.com/moby/moby/api/types/network/network.go new file mode 100644 index 00000000..a7d9c0f6 --- /dev/null +++ b/vendor/github.com/moby/moby/api/types/network/network.go @@ -0,0 +1,100 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package network + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + timeext "time" +) + +// Network network +// +// swagger:model Network +type Network struct { + + // Name of the network. + // + // Example: my_network + Name string `json:"Name"` + + // ID that uniquely identifies a network on a single machine. + // + // Example: 7d86d31b1478e7cca9ebed7e73aa0fdeec46c5ca29497431d3007d2d9e15ed99 + ID string `json:"Id"` + + // Date and time at which the network was created in + // [RFC 3339](https://www.ietf.org/rfc/rfc3339.txt) format with nano-seconds. + // + // Example: 2016-10-19T04:33:30.360899459Z + Created timeext.Time `json:"Created"` + + // The level at which the network exists (e.g. `swarm` for cluster-wide + // or `local` for machine level) + // + // Example: local + Scope string `json:"Scope"` + + // The name of the driver used to create the network (e.g. `bridge`, + // `overlay`). + // + // Example: overlay + Driver string `json:"Driver"` + + // Whether the network was created with IPv4 enabled. + // + // Example: true + EnableIPv4 bool `json:"EnableIPv4"` + + // Whether the network was created with IPv6 enabled. + // + // Example: false + EnableIPv6 bool `json:"EnableIPv6"` + + // The network's IP Address Management. + // + IPAM IPAM `json:"IPAM"` + + // Whether the network is created to only allow internal networking + // connectivity. + // + // Example: false + Internal bool `json:"Internal"` + + // Whether a global / swarm scope network is manually attachable by regular + // containers from workers in swarm mode. + // + // Example: false + Attachable bool `json:"Attachable"` + + // Whether the network is providing the routing-mesh for the swarm cluster. + // + // Example: false + Ingress bool `json:"Ingress"` + + // config from + ConfigFrom ConfigReference `json:"ConfigFrom"` + + // Whether the network is a config-only network. Config-only networks are + // placeholder networks for network configurations to be used by other + // networks. Config-only networks cannot be used directly to run containers + // or services. + // + ConfigOnly bool `json:"ConfigOnly"` + + // Network-specific options uses when creating the network. + // + // Example: {"com.docker.network.bridge.default_bridge":"true","com.docker.network.bridge.enable_icc":"true","com.docker.network.bridge.enable_ip_masquerade":"true","com.docker.network.bridge.host_binding_ipv4":"0.0.0.0","com.docker.network.bridge.name":"docker0","com.docker.network.driver.mtu":"1500"} + Options map[string]string `json:"Options"` + + // Metadata specific to the network being created. + // + // Example: {"com.example.some-label":"some-value","com.example.some-other-label":"some-other-value"} + Labels map[string]string `json:"Labels"` + + // List of peer nodes for an overlay network. This field is only present + // for overlay networks, and omitted for other network types. + // + Peers []PeerInfo `json:"Peers,omitempty"` +} diff --git a/vendor/github.com/moby/moby/api/types/network/network_types.go b/vendor/github.com/moby/moby/api/types/network/network_types.go new file mode 100644 index 00000000..5401f55f --- /dev/null +++ b/vendor/github.com/moby/moby/api/types/network/network_types.go @@ -0,0 +1,43 @@ +package network + +const ( + // NetworkDefault is a platform-independent alias to choose the platform-specific default network stack. + NetworkDefault = "default" + // NetworkHost is the name of the predefined network used when the NetworkMode host is selected (only available on Linux) + NetworkHost = "host" + // NetworkNone is the name of the predefined network used when the NetworkMode none is selected (available on both Linux and Windows) + NetworkNone = "none" + // NetworkBridge is the name of the default network on Linux + NetworkBridge = "bridge" + // NetworkNat is the name of the default network on Windows + NetworkNat = "nat" +) + +// CreateRequest is the request message sent to the server for network create call. +type CreateRequest struct { + Name string // Name is the requested name of the network. + Driver string // Driver is the driver-name used to create the network (e.g. `bridge`, `overlay`) + Scope string // Scope describes the level at which the network exists (e.g. `swarm` for cluster-wide or `local` for machine level). + EnableIPv4 *bool `json:",omitempty"` // EnableIPv4 represents whether to enable IPv4. + EnableIPv6 *bool `json:",omitempty"` // EnableIPv6 represents whether to enable IPv6. + IPAM *IPAM // IPAM is the network's IP Address Management. + Internal bool // Internal represents if the network is used internal only. + Attachable bool // Attachable represents if the global scope is manually attachable by regular containers from workers in swarm mode. + Ingress bool // Ingress indicates the network is providing the routing-mesh for the swarm cluster. + ConfigOnly bool // ConfigOnly creates a config-only network. Config-only networks are place-holder networks for network configurations to be used by other networks. ConfigOnly networks cannot be used directly to run containers or services. + ConfigFrom *ConfigReference // ConfigFrom specifies the source which will provide the configuration for this network. The specified network must be a config-only network; see [CreateOptions.ConfigOnly]. + Options map[string]string // Options specifies the network-specific options to use for when creating the network. + Labels map[string]string // Labels holds metadata specific to the network being created. +} + +// NetworkingConfig represents the container's networking configuration for each of its interfaces +// Carries the networking configs specified in the `docker run` and `docker network connect` commands +type NetworkingConfig struct { + EndpointsConfig map[string]*EndpointSettings // Endpoint configs for each connecting network +} + +// PruneReport contains the response for Engine API: +// POST "/networks/prune" +type PruneReport struct { + NetworksDeleted []string +} diff --git a/vendor/github.com/moby/moby/api/types/network/peer_info.go b/vendor/github.com/moby/moby/api/types/network/peer_info.go new file mode 100644 index 00000000..dc88ec16 --- /dev/null +++ b/vendor/github.com/moby/moby/api/types/network/peer_info.go @@ -0,0 +1,24 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package network + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "net/netip" +) + +// PeerInfo represents one peer of an overlay network. +// +// swagger:model PeerInfo +type PeerInfo struct { + + // ID of the peer-node in the Swarm cluster. + // Example: 6869d7c1732b + Name string `json:"Name"` + + // IP-address of the peer-node in the Swarm cluster. + // Example: 10.133.77.91 + IP netip.Addr `json:"IP"` +} diff --git a/vendor/github.com/moby/moby/api/types/network/port.go b/vendor/github.com/moby/moby/api/types/network/port.go new file mode 100644 index 00000000..d12d55ab --- /dev/null +++ b/vendor/github.com/moby/moby/api/types/network/port.go @@ -0,0 +1,372 @@ +package network + +import ( + "errors" + "fmt" + "iter" + "net/netip" + "strconv" + "strings" + "unique" +) + +// IPProtocol represents a network protocol for a port. +type IPProtocol string + +const ( + TCP IPProtocol = "tcp" + UDP IPProtocol = "udp" + SCTP IPProtocol = "sctp" +) + +// Sentinel port proto value for zero Port and PortRange values. +var protoZero unique.Handle[IPProtocol] + +// Port is a type representing a single port number and protocol in the format "/[]". +// +// The zero port value, i.e. Port{}, is invalid; use [ParsePort] to create a valid Port value. +type Port struct { + num uint16 + proto unique.Handle[IPProtocol] +} + +// ParsePort parses s as a [Port]. +// +// It normalizes the provided protocol such that "80/tcp", "80/TCP", and "80/tCp" are equivalent. +// If a port number is provided, but no protocol, the default ("tcp") protocol is returned. +func ParsePort(s string) (Port, error) { + if s == "" { + return Port{}, errors.New("invalid port: value is empty") + } + + port, proto, _ := strings.Cut(s, "/") + + portNum, err := parsePortNumber(port) + if err != nil { + return Port{}, fmt.Errorf("invalid port '%s': %w", port, err) + } + + normalizedPortProto := normalizePortProto(proto) + return Port{num: portNum, proto: normalizedPortProto}, nil +} + +// MustParsePort calls [ParsePort](s) and panics on error. +// +// It is intended for use in tests with hard-coded strings. +func MustParsePort(s string) Port { + p, err := ParsePort(s) + if err != nil { + panic(err) + } + return p +} + +// PortFrom returns a [Port] with the given number and protocol. +// +// If no protocol is specified (i.e. proto == ""), then PortFrom returns Port{}, false. +func PortFrom(num uint16, proto IPProtocol) (p Port, ok bool) { + if proto == "" { + return Port{}, false + } + normalized := normalizePortProto(string(proto)) + return Port{num: num, proto: normalized}, true +} + +// Num returns p's port number. +func (p Port) Num() uint16 { + return p.num +} + +// Port returns p's port number as a string. +// +// It returns an empty string for zero-values. +func (p Port) Port() string { + if p.proto == protoZero { + return "" + } + return strconv.Itoa(int(p.num)) +} + +// Proto returns p's network protocol. +func (p Port) Proto() IPProtocol { + if p.proto == protoZero { + return "" + } + return p.proto.Value() +} + +// IsZero reports whether p is the zero value. +func (p Port) IsZero() bool { + return p.proto == protoZero +} + +// IsValid reports whether p is an initialized valid port (not the zero value). +func (p Port) IsValid() bool { + return p.proto != protoZero +} + +// String returns a string representation of the port in the format "/". +// If the port is the zero value, it returns "invalid port", and users should +// check [PortRange.IsValid] or [PortRange.IsZero] before using this method. +func (p Port) String() string { + switch p.proto { + case protoZero: + return "invalid port" + default: + return string(p.AppendTo(nil)) + } +} + +// AppendText implements [encoding.TextAppender] interface. +// It is the same as [Port.AppendTo] but returns an error to satisfy the interface. +func (p Port) AppendText(b []byte) ([]byte, error) { + return p.AppendTo(b), nil +} + +// AppendTo appends a text encoding of p to b and returns the extended buffer. +func (p Port) AppendTo(b []byte) []byte { + if p.IsZero() { + return b + } + return fmt.Appendf(b, "%d/%s", p.num, p.proto.Value()) +} + +// MarshalText implements [encoding.TextMarshaler] interface. +func (p Port) MarshalText() ([]byte, error) { + return p.AppendText(nil) +} + +// UnmarshalText implements [encoding.TextUnmarshaler] interface. +func (p *Port) UnmarshalText(text []byte) error { + if len(text) == 0 { + *p = Port{} + return nil + } + + port, err := ParsePort(string(text)) + if err != nil { + return err + } + + *p = port + return nil +} + +// Range returns a [PortRange] representing the single port. +func (p Port) Range() PortRange { + return PortRange{start: p.num, end: p.num, proto: p.proto} +} + +// PortSet is a collection of structs indexed by [Port]. +type PortSet = map[Port]struct{} + +// PortBinding represents a binding between a Host IP address and a Host Port. +type PortBinding struct { + // HostIP is the host IP Address + HostIP netip.Addr `json:"HostIp"` + // HostPort is the host port number + HostPort string `json:"HostPort"` +} + +// PortMap is a collection of [PortBinding] indexed by [Port]. +type PortMap = map[Port][]PortBinding + +// PortRange represents a range of port numbers and a protocol in the format "8000-9000/tcp". +// +// The zero port range value, i.e. PortRange{}, is invalid; use [ParsePortRange] to create a valid PortRange value. +type PortRange struct { + start uint16 + end uint16 + proto unique.Handle[IPProtocol] +} + +// ParsePortRange parses s as a [PortRange]. +// +// It normalizes the provided protocol such that "80-90/tcp", "80-90/TCP", and "80-90/tCp" are equivalent. +// If a port number range is provided, but no protocol, the default ("tcp") protocol is returned. +func ParsePortRange(s string) (PortRange, error) { + if s == "" { + return PortRange{}, errors.New("invalid port range: value is empty") + } + + portRange, proto, _ := strings.Cut(s, "/") + + start, end, ok := strings.Cut(portRange, "-") + startVal, err := parsePortNumber(start) + if err != nil { + return PortRange{}, fmt.Errorf("invalid start port '%s': %w", start, err) + } + + portProto := normalizePortProto(proto) + + if !ok || start == end { + return PortRange{start: startVal, end: startVal, proto: portProto}, nil + } + + endVal, err := parsePortNumber(end) + if err != nil { + return PortRange{}, fmt.Errorf("invalid end port '%s': %w", end, err) + } + if endVal < startVal { + return PortRange{}, errors.New("invalid port range: " + s) + } + return PortRange{start: startVal, end: endVal, proto: portProto}, nil +} + +// MustParsePortRange calls [ParsePortRange](s) and panics on error. +// It is intended for use in tests with hard-coded strings. +func MustParsePortRange(s string) PortRange { + pr, err := ParsePortRange(s) + if err != nil { + panic(err) + } + return pr +} + +// PortRangeFrom returns a [PortRange] with the given start and end port numbers and protocol. +// +// If end < start or no protocol is specified (i.e. proto == ""), then PortRangeFrom returns PortRange{}, false. +func PortRangeFrom(start, end uint16, proto IPProtocol) (pr PortRange, ok bool) { + if end < start || proto == "" { + return PortRange{}, false + } + normalized := normalizePortProto(string(proto)) + return PortRange{start: start, end: end, proto: normalized}, true +} + +// Start returns pr's start port number. +func (pr PortRange) Start() uint16 { + return pr.start +} + +// End returns pr's end port number. +func (pr PortRange) End() uint16 { + return pr.end +} + +// Proto returns pr's network protocol. +func (pr PortRange) Proto() IPProtocol { + if pr.proto == protoZero { + return "" + } + return pr.proto.Value() +} + +// IsZero reports whether pr is the zero value. +func (pr PortRange) IsZero() bool { + return pr.proto == protoZero +} + +// IsValid reports whether pr is an initialized valid port range (not the zero value). +func (pr PortRange) IsValid() bool { + return pr.proto != protoZero +} + +// String returns a string representation of the port range in the format +// "-/" or "/" (if start == end). +// +// If the port range is the zero value, it returns "invalid port range", +// and users should check [PortRange.IsValid] or [PortRange.IsZero] before +// using this method. +func (pr PortRange) String() string { + switch pr.proto { + case protoZero: + return "invalid port range" + default: + return string(pr.AppendTo(nil)) + } +} + +// AppendText implements [encoding.TextAppender] interface. +// It is the same as [PortRange.AppendTo] but returns an error to satisfy the interface. +func (pr PortRange) AppendText(b []byte) ([]byte, error) { + return pr.AppendTo(b), nil +} + +// AppendTo appends a text encoding of pr to b and returns the extended buffer. +func (pr PortRange) AppendTo(b []byte) []byte { + if pr.IsZero() { + return b + } + if pr.start == pr.end { + return fmt.Appendf(b, "%d/%s", pr.start, pr.proto.Value()) + } + return fmt.Appendf(b, "%d-%d/%s", pr.start, pr.end, pr.proto.Value()) +} + +// MarshalText implements [encoding.TextMarshaler] interface. +func (pr PortRange) MarshalText() ([]byte, error) { + return pr.AppendText(nil) +} + +// UnmarshalText implements [encoding.TextUnmarshaler] interface. +func (pr *PortRange) UnmarshalText(text []byte) error { + if len(text) == 0 { + *pr = PortRange{} + return nil + } + + portRange, err := ParsePortRange(string(text)) + if err != nil { + return err + } + *pr = portRange + return nil +} + +// Range returns pr. +func (pr PortRange) Range() PortRange { + return pr +} + +// All returns an iterator over all the individual ports in the range. +// +// For example: +// +// for port := range pr.All() { +// // ... +// } +func (pr PortRange) All() iter.Seq[Port] { + return func(yield func(Port) bool) { + // Do not skip zero values here, because a zero-value means + // "map the port to an ephemeral host port". + // + // For example, "--port 80" is shorthand for "--port 0:80" + // ("--port :80"). + for i := uint32(pr.Start()); i <= uint32(pr.End()); i++ { + if !yield(Port{num: uint16(i), proto: pr.proto}) { + return + } + } + } +} + +// parsePortNumber parses rawPort into an int, unwrapping strconv errors +// and returning a single "out of range" error for any value outside 0–65535. +func parsePortNumber(rawPort string) (uint16, error) { + if rawPort == "" { + return 0, errors.New("value is empty") + } + port, err := strconv.ParseUint(rawPort, 10, 16) + if err != nil { + var numErr *strconv.NumError + if errors.As(err, &numErr) { + err = numErr.Err + } + return 0, err + } + + return uint16(port), nil +} + +// normalizePortProto normalizes the protocol string such that "tcp", "TCP", and "tCp" are equivalent. +// If proto is not specified, it defaults to "tcp". +func normalizePortProto(proto string) unique.Handle[IPProtocol] { + if proto == "" { + return unique.Make(TCP) + } + + proto = strings.ToLower(proto) + + return unique.Make(IPProtocol(proto)) +} diff --git a/vendor/github.com/moby/moby/api/types/network/service_info.go b/vendor/github.com/moby/moby/api/types/network/service_info.go new file mode 100644 index 00000000..fdd92f16 --- /dev/null +++ b/vendor/github.com/moby/moby/api/types/network/service_info.go @@ -0,0 +1,28 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package network + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "net/netip" +) + +// ServiceInfo represents service parameters with the list of service's tasks +// +// swagger:model ServiceInfo +type ServiceInfo struct { + + // v IP + VIP netip.Addr `json:"VIP"` + + // ports + Ports []string `json:"Ports"` + + // local l b index + LocalLBIndex int `json:"LocalLBIndex"` + + // tasks + Tasks []Task `json:"Tasks"` +} diff --git a/vendor/github.com/moby/moby/api/types/network/status.go b/vendor/github.com/moby/moby/api/types/network/status.go new file mode 100644 index 00000000..94f4b4b2 --- /dev/null +++ b/vendor/github.com/moby/moby/api/types/network/status.go @@ -0,0 +1,15 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package network + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +// Status provides runtime information about the network such as the number of allocated IPs. +// +// swagger:model Status +type Status struct { + + // IPAM + IPAM IPAMStatus `json:"IPAM"` +} diff --git a/vendor/github.com/moby/moby/api/types/network/subnet_status.go b/vendor/github.com/moby/moby/api/types/network/subnet_status.go new file mode 100644 index 00000000..dd62429f --- /dev/null +++ b/vendor/github.com/moby/moby/api/types/network/subnet_status.go @@ -0,0 +1,20 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package network + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +// SubnetStatus subnet status +// +// swagger:model SubnetStatus +type SubnetStatus struct { + + // Number of IP addresses in the subnet that are in use or reserved and are therefore unavailable for allocation, saturating at 264 - 1. + // + IPsInUse uint64 `json:"IPsInUse"` + + // Number of IP addresses within the network's IPRange for the subnet that are available for allocation, saturating at 264 - 1. + // + DynamicIPsAvailable uint64 `json:"DynamicIPsAvailable"` +} diff --git a/vendor/github.com/moby/moby/api/types/network/summary.go b/vendor/github.com/moby/moby/api/types/network/summary.go new file mode 100644 index 00000000..3f50ce22 --- /dev/null +++ b/vendor/github.com/moby/moby/api/types/network/summary.go @@ -0,0 +1,13 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package network + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +// Summary Network list response item +// +// swagger:model Summary +type Summary struct { + Network +} diff --git a/vendor/github.com/moby/moby/api/types/network/task.go b/vendor/github.com/moby/moby/api/types/network/task.go new file mode 100644 index 00000000..a547523a --- /dev/null +++ b/vendor/github.com/moby/moby/api/types/network/task.go @@ -0,0 +1,28 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package network + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "net/netip" +) + +// Task carries the information about one backend task +// +// swagger:model Task +type Task struct { + + // name + Name string `json:"Name"` + + // endpoint ID + EndpointID string `json:"EndpointID"` + + // endpoint IP + EndpointIP netip.Addr `json:"EndpointIP"` + + // info + Info map[string]string `json:"Info"` +} diff --git a/vendor/github.com/moby/moby/api/types/plugin/.gitignore b/vendor/github.com/moby/moby/api/types/plugin/.gitignore new file mode 100644 index 00000000..5cea8434 --- /dev/null +++ b/vendor/github.com/moby/moby/api/types/plugin/.gitignore @@ -0,0 +1 @@ +testdata/rapid/** diff --git a/vendor/github.com/moby/moby/api/types/plugin/capability.go b/vendor/github.com/moby/moby/api/types/plugin/capability.go new file mode 100644 index 00000000..d53f77a1 --- /dev/null +++ b/vendor/github.com/moby/moby/api/types/plugin/capability.go @@ -0,0 +1,55 @@ +package plugin + +import ( + "bytes" + "encoding" + "fmt" + "strings" +) + +type CapabilityID struct { + Capability string + Prefix string + Version string +} + +var ( + _ fmt.Stringer = CapabilityID{} + _ encoding.TextUnmarshaler = (*CapabilityID)(nil) + _ encoding.TextMarshaler = CapabilityID{} +) + +// String implements [fmt.Stringer] for CapabilityID +func (t CapabilityID) String() string { + return fmt.Sprintf("%s.%s/%s", t.Prefix, t.Capability, t.Version) +} + +// UnmarshalText implements [encoding.TextUnmarshaler] for CapabilityID +func (t *CapabilityID) UnmarshalText(p []byte) error { + fqcap, version, _ := bytes.Cut(p, []byte{'/'}) + idx := bytes.LastIndexByte(fqcap, '.') + if idx < 0 { + t.Prefix = "" + t.Capability = string(fqcap) + } else { + t.Prefix = string(fqcap[:idx]) + t.Capability = string(fqcap[idx+1:]) + } + t.Version = string(version) + return nil +} + +// MarshalText implements [encoding.TextMarshaler] for CapabilityID +func (t CapabilityID) MarshalText() ([]byte, error) { + // Assert that the value can be round-tripped successfully. + if strings.Contains(t.Capability, ".") { + return nil, fmt.Errorf("capability %q cannot contain a dot", t.Capability) + } + if strings.Contains(t.Prefix, "/") { + return nil, fmt.Errorf("prefix %q cannot contain a slash", t.Prefix) + } + if strings.Contains(t.Capability, "/") { + return nil, fmt.Errorf("capability %q cannot contain a slash", t.Capability) + } + return []byte(t.String()), nil +} diff --git a/vendor/github.com/moby/moby/api/types/plugin/device.go b/vendor/github.com/moby/moby/api/types/plugin/device.go new file mode 100644 index 00000000..ae961770 --- /dev/null +++ b/vendor/github.com/moby/moby/api/types/plugin/device.go @@ -0,0 +1,29 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package plugin + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +// Device device +// +// swagger:model Device +type Device struct { + + // description + // Required: true + Description string `json:"Description"` + + // name + // Required: true + Name string `json:"Name"` + + // path + // Example: /dev/fuse + // Required: true + Path *string `json:"Path"` + + // settable + // Required: true + Settable []string `json:"Settable"` +} diff --git a/vendor/github.com/moby/moby/api/types/plugin/env.go b/vendor/github.com/moby/moby/api/types/plugin/env.go new file mode 100644 index 00000000..dcbe0b76 --- /dev/null +++ b/vendor/github.com/moby/moby/api/types/plugin/env.go @@ -0,0 +1,28 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package plugin + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +// Env env +// +// swagger:model Env +type Env struct { + + // description + // Required: true + Description string `json:"Description"` + + // name + // Required: true + Name string `json:"Name"` + + // settable + // Required: true + Settable []string `json:"Settable"` + + // value + // Required: true + Value *string `json:"Value"` +} diff --git a/vendor/github.com/moby/moby/api/types/plugin/mount.go b/vendor/github.com/moby/moby/api/types/plugin/mount.go new file mode 100644 index 00000000..7970306c --- /dev/null +++ b/vendor/github.com/moby/moby/api/types/plugin/mount.go @@ -0,0 +1,46 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package plugin + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +// Mount mount +// +// swagger:model Mount +type Mount struct { + + // description + // Example: This is a mount that's used by the plugin. + // Required: true + Description string `json:"Description"` + + // destination + // Example: /mnt/state + // Required: true + Destination string `json:"Destination"` + + // name + // Example: some-mount + // Required: true + Name string `json:"Name"` + + // options + // Example: ["rbind","rw"] + // Required: true + Options []string `json:"Options"` + + // settable + // Required: true + Settable []string `json:"Settable"` + + // source + // Example: /var/lib/docker/plugins/ + // Required: true + Source *string `json:"Source"` + + // type + // Example: bind + // Required: true + Type string `json:"Type"` +} diff --git a/vendor/github.com/moby/moby/api/types/plugin/plugin.go b/vendor/github.com/moby/moby/api/types/plugin/plugin.go new file mode 100644 index 00000000..3305170d --- /dev/null +++ b/vendor/github.com/moby/moby/api/types/plugin/plugin.go @@ -0,0 +1,237 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package plugin + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +// Plugin A plugin for the Engine API +// +// swagger:model Plugin +type Plugin struct { + + // config + // Required: true + Config Config `json:"Config"` + + // True if the plugin is running. False if the plugin is not running, only installed. + // Example: true + // Required: true + Enabled bool `json:"Enabled"` + + // Id + // Example: 5724e2c8652da337ab2eedd19fc6fc0ec908e4bd907c7421bf6a8dfc70c4c078 + ID string `json:"Id,omitempty"` + + // name + // Example: tiborvass/sample-volume-plugin + // Required: true + Name string `json:"Name"` + + // plugin remote reference used to push/pull the plugin + // Example: localhost:5000/tiborvass/sample-volume-plugin:latest + PluginReference string `json:"PluginReference,omitempty"` + + // settings + // Required: true + Settings Settings `json:"Settings"` +} + +// Config The config of a plugin. +// +// swagger:model Config +type Config struct { + + // args + // Required: true + Args Args `json:"Args"` + + // description + // Example: A sample volume plugin for Docker + // Required: true + Description string `json:"Description"` + + // documentation + // Example: https://docs.docker.com/engine/extend/plugins/ + // Required: true + Documentation string `json:"Documentation"` + + // entrypoint + // Example: ["/usr/bin/sample-volume-plugin","/data"] + // Required: true + Entrypoint []string `json:"Entrypoint"` + + // env + // Example: [{"Description":"If set, prints debug messages","Name":"DEBUG","Settable":null,"Value":"0"}] + // Required: true + Env []Env `json:"Env"` + + // interface + // Required: true + Interface Interface `json:"Interface"` + + // ipc host + // Example: false + // Required: true + IpcHost bool `json:"IpcHost"` + + // linux + // Required: true + Linux LinuxConfig `json:"Linux"` + + // mounts + // Required: true + Mounts []Mount `json:"Mounts"` + + // network + // Required: true + Network NetworkConfig `json:"Network"` + + // pid host + // Example: false + // Required: true + PidHost bool `json:"PidHost"` + + // propagated mount + // Example: /mnt/volumes + // Required: true + PropagatedMount string `json:"PropagatedMount"` + + // user + User User `json:"User,omitempty"` + + // work dir + // Example: /bin/ + // Required: true + WorkDir string `json:"WorkDir"` + + // rootfs + Rootfs *RootFS `json:"rootfs,omitempty"` +} + +// Args args +// +// swagger:model Args +type Args struct { + + // description + // Example: command line arguments + // Required: true + Description string `json:"Description"` + + // name + // Example: args + // Required: true + Name string `json:"Name"` + + // settable + // Required: true + Settable []string `json:"Settable"` + + // value + // Required: true + Value []string `json:"Value"` +} + +// Interface The interface between Docker and the plugin +// +// swagger:model Interface +type Interface struct { + + // Protocol to use for clients connecting to the plugin. + // Example: some.protocol/v1.0 + // Enum: ["","moby.plugins.http/v1"] + ProtocolScheme string `json:"ProtocolScheme,omitempty"` + + // socket + // Example: plugins.sock + // Required: true + Socket string `json:"Socket"` + + // types + // Example: ["docker.volumedriver/1.0"] + // Required: true + Types []CapabilityID `json:"Types"` +} + +// LinuxConfig linux config +// +// swagger:model LinuxConfig +type LinuxConfig struct { + + // allow all devices + // Example: false + // Required: true + AllowAllDevices bool `json:"AllowAllDevices"` + + // capabilities + // Example: ["CAP_SYS_ADMIN","CAP_SYSLOG"] + // Required: true + Capabilities []string `json:"Capabilities"` + + // devices + // Required: true + Devices []Device `json:"Devices"` +} + +// NetworkConfig network config +// +// swagger:model NetworkConfig +type NetworkConfig struct { + + // type + // Example: host + // Required: true + Type string `json:"Type"` +} + +// RootFS root f s +// +// swagger:model RootFS +type RootFS struct { + + // diff ids + // Example: ["sha256:675532206fbf3030b8458f88d6e26d4eb1577688a25efec97154c94e8b6b4887","sha256:e216a057b1cb1efc11f8a268f37ef62083e70b1b38323ba252e25ac88904a7e8"] + DiffIds []string `json:"diff_ids"` + + // type + // Example: layers + Type string `json:"type,omitempty"` +} + +// User user +// +// swagger:model User +type User struct { + + // g ID + // Example: 1000 + GID uint32 `json:"GID,omitempty"` + + // UID + // Example: 1000 + UID uint32 `json:"UID,omitempty"` +} + +// Settings user-configurable settings for the plugin. +// +// swagger:model Settings +type Settings struct { + + // args + // Required: true + Args []string `json:"Args"` + + // devices + // Required: true + Devices []Device `json:"Devices"` + + // env + // Example: ["DEBUG=0"] + // Required: true + Env []string `json:"Env"` + + // mounts + // Required: true + Mounts []Mount `json:"Mounts"` +} diff --git a/vendor/github.com/moby/moby/api/types/plugin/plugin_responses.go b/vendor/github.com/moby/moby/api/types/plugin/plugin_responses.go new file mode 100644 index 00000000..91b327eb --- /dev/null +++ b/vendor/github.com/moby/moby/api/types/plugin/plugin_responses.go @@ -0,0 +1,33 @@ +package plugin + +import ( + "sort" +) + +// ListResponse contains the response for the Engine API +type ListResponse []Plugin + +// Privilege describes a permission the user has to accept +// upon installing a plugin. +type Privilege struct { + Name string + Description string + Value []string +} + +// Privileges is a list of Privilege +type Privileges []Privilege + +func (s Privileges) Len() int { + return len(s) +} + +func (s Privileges) Less(i, j int) bool { + return s[i].Name < s[j].Name +} + +func (s Privileges) Swap(i, j int) { + sort.Strings(s[i].Value) + sort.Strings(s[j].Value) + s[i], s[j] = s[j], s[i] +} diff --git a/vendor/github.com/moby/moby/api/types/registry/auth_response.go b/vendor/github.com/moby/moby/api/types/registry/auth_response.go new file mode 100644 index 00000000..94c2e1bb --- /dev/null +++ b/vendor/github.com/moby/moby/api/types/registry/auth_response.go @@ -0,0 +1,21 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package registry + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +// AuthResponse An identity token was generated successfully. +// +// swagger:model AuthResponse +type AuthResponse struct { + + // An opaque token used to authenticate a user after a successful login + // Example: 9cbaf023786cd7... + IdentityToken string `json:"IdentityToken,omitempty"` + + // The status of the authentication + // Example: Login Succeeded + // Required: true + Status string `json:"Status"` +} diff --git a/vendor/github.com/moby/moby/api/types/registry/authconfig.go b/vendor/github.com/moby/moby/api/types/registry/authconfig.go new file mode 100644 index 00000000..b612feeb --- /dev/null +++ b/vendor/github.com/moby/moby/api/types/registry/authconfig.go @@ -0,0 +1,35 @@ +package registry + +import "context" + +// AuthHeader is the name of the header used to send encoded registry +// authorization credentials for registry operations (push/pull). +const AuthHeader = "X-Registry-Auth" + +// RequestAuthConfig is a function interface that clients can supply +// to retry operations after getting an authorization error. +// +// The function must return the [AuthHeader] value ([AuthConfig]), encoded +// in base64url format ([RFC4648, section 5]), which can be decoded by +// [DecodeAuthConfig]. +// +// It must return an error if the privilege request fails. +// +// [RFC4648, section 5]: https://tools.ietf.org/html/rfc4648#section-5 +type RequestAuthConfig func(context.Context) (string, error) + +// AuthConfig contains authorization information for connecting to a Registry. +type AuthConfig struct { + Username string `json:"username,omitempty"` + Password string `json:"password,omitempty"` + Auth string `json:"auth,omitempty"` + + ServerAddress string `json:"serveraddress,omitempty"` + + // IdentityToken is used to authenticate the user and get + // an access token for the registry. + IdentityToken string `json:"identitytoken,omitempty"` + + // RegistryToken is a bearer token to be sent to a registry + RegistryToken string `json:"registrytoken,omitempty"` +} diff --git a/vendor/github.com/moby/moby/api/types/registry/registry.go b/vendor/github.com/moby/moby/api/types/registry/registry.go new file mode 100644 index 00000000..7361228d --- /dev/null +++ b/vendor/github.com/moby/moby/api/types/registry/registry.go @@ -0,0 +1,67 @@ +package registry + +import ( + "net/netip" + + ocispec "github.com/opencontainers/image-spec/specs-go/v1" +) + +// ServiceConfig stores daemon registry services configuration. +type ServiceConfig struct { + InsecureRegistryCIDRs []netip.Prefix `json:"InsecureRegistryCIDRs"` + IndexConfigs map[string]*IndexInfo `json:"IndexConfigs"` + Mirrors []string +} + +// IndexInfo contains information about a registry +// +// RepositoryInfo Examples: +// +// { +// "Index" : { +// "Name" : "docker.io", +// "Mirrors" : ["https://registry-2.docker.io/v1/", "https://registry-3.docker.io/v1/"], +// "Secure" : true, +// "Official" : true, +// }, +// "RemoteName" : "library/debian", +// "LocalName" : "debian", +// "CanonicalName" : "docker.io/debian" +// "Official" : true, +// } +// +// { +// "Index" : { +// "Name" : "127.0.0.1:5000", +// "Mirrors" : [], +// "Secure" : false, +// "Official" : false, +// }, +// "RemoteName" : "user/repo", +// "LocalName" : "127.0.0.1:5000/user/repo", +// "CanonicalName" : "127.0.0.1:5000/user/repo", +// "Official" : false, +// } +type IndexInfo struct { + // Name is the name of the registry, such as "docker.io" + Name string + // Mirrors is a list of mirrors, expressed as URIs + Mirrors []string + // Secure is set to false if the registry is part of the list of + // insecure registries. Insecure registries accept HTTP and/or accept + // HTTPS with certificates from unknown CAs. + Secure bool + // Official indicates whether this is an official registry + Official bool +} + +// DistributionInspect describes the result obtained from contacting the +// registry to retrieve image metadata +type DistributionInspect struct { + // Descriptor contains information about the manifest, including + // the content addressable digest + Descriptor ocispec.Descriptor + // Platforms contains the list of platforms supported by the image, + // obtained by parsing the manifest + Platforms []ocispec.Platform +} diff --git a/vendor/github.com/moby/moby/api/types/registry/search.go b/vendor/github.com/moby/moby/api/types/registry/search.go new file mode 100644 index 00000000..bd79462f --- /dev/null +++ b/vendor/github.com/moby/moby/api/types/registry/search.go @@ -0,0 +1,27 @@ +package registry + +// SearchResult describes a search result returned from a registry +type SearchResult struct { + // StarCount indicates the number of stars this repository has + StarCount int `json:"star_count"` + // IsOfficial is true if the result is from an official repository. + IsOfficial bool `json:"is_official"` + // Name is the name of the repository + Name string `json:"name"` + // IsAutomated indicates whether the result is automated. + // + // Deprecated: the "is_automated" field is deprecated and will always be "false". + IsAutomated bool `json:"is_automated"` + // Description is a textual description of the repository + Description string `json:"description"` +} + +// SearchResults lists a collection search results returned from a registry +type SearchResults struct { + // Query contains the query string that generated the search results + Query string `json:"query"` + // NumResults indicates the number of results the query returned + NumResults int `json:"num_results"` + // Results is a slice containing the actual results for the search + Results []SearchResult `json:"results"` +} diff --git a/vendor/github.com/moby/moby/api/types/storage/driver_data.go b/vendor/github.com/moby/moby/api/types/storage/driver_data.go new file mode 100644 index 00000000..65d5b4c2 --- /dev/null +++ b/vendor/github.com/moby/moby/api/types/storage/driver_data.go @@ -0,0 +1,27 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package storage + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +// DriverData Information about the storage driver used to store the container's and +// image's filesystem. +// +// swagger:model DriverData +type DriverData struct { + + // Low-level storage metadata, provided as key/value pairs. + // + // This information is driver-specific, and depends on the storage-driver + // in use, and should be used for informational purposes only. + // + // Example: {"MergedDir":"/var/lib/docker/overlay2/ef749362d13333e65fc95c572eb525abbe0052e16e086cb64bc3b98ae9aa6d74/merged","UpperDir":"/var/lib/docker/overlay2/ef749362d13333e65fc95c572eb525abbe0052e16e086cb64bc3b98ae9aa6d74/diff","WorkDir":"/var/lib/docker/overlay2/ef749362d13333e65fc95c572eb525abbe0052e16e086cb64bc3b98ae9aa6d74/work"} + // Required: true + Data map[string]string `json:"Data"` + + // Name of the storage driver. + // Example: overlay2 + // Required: true + Name string `json:"Name"` +} diff --git a/vendor/github.com/moby/moby/api/types/storage/root_f_s_storage.go b/vendor/github.com/moby/moby/api/types/storage/root_f_s_storage.go new file mode 100644 index 00000000..d82f2b6b --- /dev/null +++ b/vendor/github.com/moby/moby/api/types/storage/root_f_s_storage.go @@ -0,0 +1,16 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package storage + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +// RootFSStorage Information about the storage used for the container's root filesystem. +// +// swagger:model RootFSStorage +type RootFSStorage struct { + + // Information about the snapshot used for the container's root filesystem. + // + Snapshot *RootFSStorageSnapshot `json:"Snapshot,omitempty"` +} diff --git a/vendor/github.com/moby/moby/api/types/storage/root_f_s_storage_snapshot.go b/vendor/github.com/moby/moby/api/types/storage/root_f_s_storage_snapshot.go new file mode 100644 index 00000000..dd2b82d2 --- /dev/null +++ b/vendor/github.com/moby/moby/api/types/storage/root_f_s_storage_snapshot.go @@ -0,0 +1,15 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package storage + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +// RootFSStorageSnapshot Information about a snapshot backend of the container's root filesystem. +// +// swagger:model RootFSStorageSnapshot +type RootFSStorageSnapshot struct { + + // Name of the snapshotter. + Name string `json:"Name,omitempty"` +} diff --git a/vendor/github.com/moby/moby/api/types/storage/storage.go b/vendor/github.com/moby/moby/api/types/storage/storage.go new file mode 100644 index 00000000..77843db9 --- /dev/null +++ b/vendor/github.com/moby/moby/api/types/storage/storage.go @@ -0,0 +1,16 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package storage + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +// Storage Information about the storage used by the container. +// +// swagger:model Storage +type Storage struct { + + // Information about the storage used for the container's root filesystem. + // + RootFS *RootFSStorage `json:"RootFS,omitempty"` +} diff --git a/vendor/github.com/moby/moby/api/types/swarm/common.go b/vendor/github.com/moby/moby/api/types/swarm/common.go new file mode 100644 index 00000000..b42812e0 --- /dev/null +++ b/vendor/github.com/moby/moby/api/types/swarm/common.go @@ -0,0 +1,48 @@ +package swarm + +import ( + "strconv" + "time" +) + +// Version represents the internal object version. +type Version struct { + Index uint64 `json:",omitempty"` +} + +// String implements fmt.Stringer interface. +func (v Version) String() string { + return strconv.FormatUint(v.Index, 10) +} + +// Meta is a base object inherited by most of the other once. +type Meta struct { + Version Version `json:",omitempty"` + CreatedAt time.Time `json:",omitempty"` + UpdatedAt time.Time `json:",omitempty"` +} + +// Annotations represents how to describe an object. +type Annotations struct { + Name string `json:",omitempty"` + Labels map[string]string `json:"Labels"` +} + +// Driver represents a driver (network, logging, secrets backend). +type Driver struct { + Name string `json:",omitempty"` + Options map[string]string `json:",omitempty"` +} + +// TLSInfo represents the TLS information about what CA certificate is trusted, +// and who the issuer for a TLS certificate is +type TLSInfo struct { + // TrustRoot is the trusted CA root certificate in PEM format + TrustRoot string `json:",omitempty"` + + // CertIssuer is the raw subject bytes of the issuer + CertIssuerSubject []byte `json:",omitempty"` + + // CertIssuerPublicKey is the raw public key bytes of the issuer + CertIssuerPublicKey []byte `json:",omitempty"` +} diff --git a/vendor/github.com/moby/moby/api/types/swarm/config.go b/vendor/github.com/moby/moby/api/types/swarm/config.go new file mode 100644 index 00000000..b029f2af --- /dev/null +++ b/vendor/github.com/moby/moby/api/types/swarm/config.go @@ -0,0 +1,55 @@ +package swarm + +import ( + "os" +) + +// Config represents a config. +type Config struct { + ID string + Meta + Spec ConfigSpec +} + +// ConfigSpec represents a config specification from a config in swarm +type ConfigSpec struct { + Annotations + + // Data is the data to store as a config. + // + // The maximum allowed size is 1000KB, as defined in [MaxConfigSize]. + // + // [MaxConfigSize]: https://pkg.go.dev/github.com/moby/swarmkit/v2@v2.0.0-20250103191802-8c1959736554/manager/controlapi#MaxConfigSize + Data []byte `json:",omitempty"` + + // Templating controls whether and how to evaluate the config payload as + // a template. If it is not set, no templating is used. + Templating *Driver `json:",omitempty"` +} + +// ConfigReferenceFileTarget is a file target in a config reference +type ConfigReferenceFileTarget struct { + Name string + UID string + GID string + Mode os.FileMode +} + +// ConfigReferenceRuntimeTarget is a target for a config specifying that it +// isn't mounted into the container but instead has some other purpose. +type ConfigReferenceRuntimeTarget struct{} + +// ConfigReference is a reference to a config in swarm +type ConfigReference struct { + File *ConfigReferenceFileTarget `json:",omitempty"` + Runtime *ConfigReferenceRuntimeTarget `json:",omitempty"` + ConfigID string + ConfigName string +} + +// ConfigCreateResponse contains the information returned to a client +// on the creation of a new config. +type ConfigCreateResponse struct { + // ID is the id of the created config. + ID string +} diff --git a/vendor/github.com/moby/moby/api/types/swarm/container.go b/vendor/github.com/moby/moby/api/types/swarm/container.go new file mode 100644 index 00000000..268565ec --- /dev/null +++ b/vendor/github.com/moby/moby/api/types/swarm/container.go @@ -0,0 +1,120 @@ +package swarm + +import ( + "net/netip" + "time" + + "github.com/moby/moby/api/types/container" + "github.com/moby/moby/api/types/mount" +) + +// DNSConfig specifies DNS related configurations in resolver configuration file (resolv.conf) +// Detailed documentation is available in: +// http://man7.org/linux/man-pages/man5/resolv.conf.5.html +// `nameserver`, `search`, `options` have been supported. +// TODO: `domain` is not supported yet. +type DNSConfig struct { + // Nameservers specifies the IP addresses of the name servers + Nameservers []netip.Addr `json:",omitempty"` + // Search specifies the search list for host-name lookup + Search []string `json:",omitempty"` + // Options allows certain internal resolver variables to be modified + Options []string `json:",omitempty"` +} + +// SELinuxContext contains the SELinux labels of the container. +type SELinuxContext struct { + Disable bool + + User string + Role string + Type string + Level string +} + +// SeccompMode is the type used for the enumeration of possible seccomp modes +// in SeccompOpts +type SeccompMode string + +const ( + SeccompModeDefault SeccompMode = "default" + SeccompModeUnconfined SeccompMode = "unconfined" + SeccompModeCustom SeccompMode = "custom" +) + +// SeccompOpts defines the options for configuring seccomp on a swarm-managed +// container. +type SeccompOpts struct { + // Mode is the SeccompMode used for the container. + Mode SeccompMode `json:",omitempty"` + // Profile is the custom seccomp profile as a json object to be used with + // the container. Mode should be set to SeccompModeCustom when using a + // custom profile in this manner. + Profile []byte `json:",omitempty"` +} + +// AppArmorMode is type used for the enumeration of possible AppArmor modes in +// AppArmorOpts +type AppArmorMode string + +const ( + AppArmorModeDefault AppArmorMode = "default" + AppArmorModeDisabled AppArmorMode = "disabled" +) + +// AppArmorOpts defines the options for configuring AppArmor on a swarm-managed +// container. Currently, custom AppArmor profiles are not supported. +type AppArmorOpts struct { + Mode AppArmorMode `json:",omitempty"` +} + +// CredentialSpec for managed service account (Windows only) +type CredentialSpec struct { + Config string + File string + Registry string +} + +// Privileges defines the security options for the container. +type Privileges struct { + CredentialSpec *CredentialSpec + SELinuxContext *SELinuxContext + Seccomp *SeccompOpts `json:",omitempty"` + AppArmor *AppArmorOpts `json:",omitempty"` + NoNewPrivileges bool +} + +// ContainerSpec represents the spec of a container. +type ContainerSpec struct { + Image string `json:",omitempty"` + Labels map[string]string `json:",omitempty"` + Command []string `json:",omitempty"` + Args []string `json:",omitempty"` + Hostname string `json:",omitempty"` + Env []string `json:",omitempty"` + Dir string `json:",omitempty"` + User string `json:",omitempty"` + Groups []string `json:",omitempty"` + Privileges *Privileges `json:",omitempty"` + Init *bool `json:",omitempty"` + StopSignal string `json:",omitempty"` + TTY bool `json:",omitempty"` + OpenStdin bool `json:",omitempty"` + ReadOnly bool `json:",omitempty"` + Mounts []mount.Mount `json:",omitempty"` + StopGracePeriod *time.Duration `json:",omitempty"` + Healthcheck *container.HealthConfig `json:",omitempty"` + // The format of extra hosts on swarmkit is specified in: + // http://man7.org/linux/man-pages/man5/hosts.5.html + // IP_address canonical_hostname [aliases...] + Hosts []string `json:",omitempty"` + DNSConfig *DNSConfig `json:",omitempty"` + Secrets []*SecretReference `json:",omitempty"` + Configs []*ConfigReference `json:",omitempty"` + Isolation container.Isolation `json:",omitempty"` + Sysctls map[string]string `json:",omitempty"` + CapabilityAdd []string `json:",omitempty"` + CapabilityDrop []string `json:",omitempty"` + Ulimits []*container.Ulimit `json:",omitempty"` + OomScoreAdj int64 `json:",omitempty"` +} diff --git a/vendor/github.com/moby/moby/api/types/swarm/network.go b/vendor/github.com/moby/moby/api/types/swarm/network.go new file mode 100644 index 00000000..b32c308f --- /dev/null +++ b/vendor/github.com/moby/moby/api/types/swarm/network.go @@ -0,0 +1,139 @@ +package swarm + +import ( + "cmp" + "net/netip" + + "github.com/moby/moby/api/types/network" +) + +// Endpoint represents an endpoint. +type Endpoint struct { + Spec EndpointSpec `json:",omitempty"` + Ports []PortConfig `json:",omitempty"` + VirtualIPs []EndpointVirtualIP `json:",omitempty"` +} + +// EndpointSpec represents the spec of an endpoint. +type EndpointSpec struct { + Mode ResolutionMode `json:",omitempty"` + Ports []PortConfig `json:",omitempty"` +} + +// ResolutionMode represents a resolution mode. +type ResolutionMode string + +const ( + // ResolutionModeVIP VIP + ResolutionModeVIP ResolutionMode = "vip" + // ResolutionModeDNSRR DNSRR + ResolutionModeDNSRR ResolutionMode = "dnsrr" +) + +// PortConfig represents the config of a port. +type PortConfig struct { + Name string `json:",omitempty"` + Protocol network.IPProtocol `json:",omitempty"` + // TargetPort is the port inside the container + TargetPort uint32 `json:",omitempty"` + // PublishedPort is the port on the swarm hosts + PublishedPort uint32 `json:",omitempty"` + // PublishMode is the mode in which port is published + PublishMode PortConfigPublishMode `json:",omitempty"` +} + +// Compare returns the lexical ordering of p and other, and can be used +// with [slices.SortFunc]. +// +// The comparison is performed in the following priority order: +// 1. PublishedPort (host port) +// 2. TargetPort (container port) +// 3. Protocol +// 4. PublishMode +func (p PortConfig) Compare(other PortConfig) int { + if n := cmp.Compare(p.PublishedPort, other.PublishedPort); n != 0 { + return n + } + if n := cmp.Compare(p.TargetPort, other.TargetPort); n != 0 { + return n + } + if n := cmp.Compare(p.Protocol, other.Protocol); n != 0 { + return n + } + return cmp.Compare(p.PublishMode, other.PublishMode) +} + +// PortConfigPublishMode represents the mode in which the port is to +// be published. +type PortConfigPublishMode string + +const ( + // PortConfigPublishModeIngress is used for ports published + // for ingress load balancing using routing mesh. + PortConfigPublishModeIngress PortConfigPublishMode = "ingress" + // PortConfigPublishModeHost is used for ports published + // for direct host level access on the host where the task is running. + PortConfigPublishModeHost PortConfigPublishMode = "host" +) + +// EndpointVirtualIP represents the virtual ip of a port. +type EndpointVirtualIP struct { + NetworkID string `json:",omitempty"` + + // Addr is the virtual ip address. + // This field accepts CIDR notation, for example `10.0.0.1/24`, to maintain backwards + // compatibility, but only the IP address is used. + Addr netip.Prefix `json:"Addr,omitzero"` +} + +// Network represents a network. +type Network struct { + ID string + Meta + Spec NetworkSpec `json:",omitempty"` + DriverState Driver `json:",omitempty"` + IPAMOptions *IPAMOptions `json:",omitempty"` +} + +// NetworkSpec represents the spec of a network. +type NetworkSpec struct { + Annotations + DriverConfiguration *Driver `json:",omitempty"` + IPv6Enabled bool `json:",omitempty"` + Internal bool `json:",omitempty"` + Attachable bool `json:",omitempty"` + Ingress bool `json:",omitempty"` + IPAMOptions *IPAMOptions `json:",omitempty"` + ConfigFrom *network.ConfigReference `json:",omitempty"` + Scope string `json:",omitempty"` +} + +// NetworkAttachmentConfig represents the configuration of a network attachment. +type NetworkAttachmentConfig struct { + Target string `json:",omitempty"` + Aliases []string `json:",omitempty"` + DriverOpts map[string]string `json:",omitempty"` +} + +// NetworkAttachment represents a network attachment. +type NetworkAttachment struct { + Network Network `json:",omitempty"` + + // Addresses contains the IP addresses associated with the endpoint in the network. + // This field accepts CIDR notation, for example `10.0.0.1/24`, to maintain backwards + // compatibility, but only the IP address is used. + Addresses []netip.Prefix `json:",omitempty"` +} + +// IPAMOptions represents ipam options. +type IPAMOptions struct { + Driver Driver `json:",omitempty"` + Configs []IPAMConfig `json:",omitempty"` +} + +// IPAMConfig represents ipam configuration. +type IPAMConfig struct { + Subnet netip.Prefix `json:"Subnet,omitzero"` + Range netip.Prefix `json:"Range,omitzero"` + Gateway netip.Addr `json:"Gateway,omitzero"` +} diff --git a/vendor/github.com/moby/moby/api/types/swarm/node.go b/vendor/github.com/moby/moby/api/types/swarm/node.go new file mode 100644 index 00000000..9523799b --- /dev/null +++ b/vendor/github.com/moby/moby/api/types/swarm/node.go @@ -0,0 +1,139 @@ +package swarm + +// Node represents a node. +type Node struct { + ID string + Meta + // Spec defines the desired state of the node as specified by the user. + // The system will honor this and will *never* modify it. + Spec NodeSpec `json:",omitempty"` + // Description encapsulates the properties of the Node as reported by the + // agent. + Description NodeDescription `json:",omitempty"` + // Status provides the current status of the node, as seen by the manager. + Status NodeStatus `json:",omitempty"` + // ManagerStatus provides the current status of the node's manager + // component, if the node is a manager. + ManagerStatus *ManagerStatus `json:",omitempty"` +} + +// NodeSpec represents the spec of a node. +type NodeSpec struct { + Annotations + Role NodeRole `json:",omitempty"` + Availability NodeAvailability `json:",omitempty"` +} + +// NodeRole represents the role of a node. +type NodeRole string + +const ( + // NodeRoleWorker WORKER + NodeRoleWorker NodeRole = "worker" + // NodeRoleManager MANAGER + NodeRoleManager NodeRole = "manager" +) + +// NodeAvailability represents the availability of a node. +type NodeAvailability string + +const ( + // NodeAvailabilityActive ACTIVE + NodeAvailabilityActive NodeAvailability = "active" + // NodeAvailabilityPause PAUSE + NodeAvailabilityPause NodeAvailability = "pause" + // NodeAvailabilityDrain DRAIN + NodeAvailabilityDrain NodeAvailability = "drain" +) + +// NodeDescription represents the description of a node. +type NodeDescription struct { + Hostname string `json:",omitempty"` + Platform Platform `json:",omitempty"` + Resources Resources `json:",omitempty"` + Engine EngineDescription `json:",omitempty"` + TLSInfo TLSInfo `json:",omitempty"` + CSIInfo []NodeCSIInfo `json:",omitempty"` +} + +// Platform represents the platform (Arch/OS). +type Platform struct { + Architecture string `json:",omitempty"` + OS string `json:",omitempty"` +} + +// EngineDescription represents the description of an engine. +type EngineDescription struct { + EngineVersion string `json:",omitempty"` + Labels map[string]string `json:",omitempty"` + Plugins []PluginDescription `json:",omitempty"` +} + +// NodeCSIInfo represents information about a CSI plugin available on the node +type NodeCSIInfo struct { + // PluginName is the name of the CSI plugin. + PluginName string `json:",omitempty"` + // NodeID is the ID of the node as reported by the CSI plugin. This is + // different from the swarm node ID. + NodeID string `json:",omitempty"` + // MaxVolumesPerNode is the maximum number of volumes that may be published + // to this node + MaxVolumesPerNode int64 `json:",omitempty"` + // AccessibleTopology indicates the location of this node in the CSI + // plugin's topology + AccessibleTopology *Topology `json:",omitempty"` +} + +// PluginDescription represents the description of an engine plugin. +type PluginDescription struct { + Type string `json:",omitempty"` + Name string `json:",omitempty"` +} + +// NodeStatus represents the status of a node. +type NodeStatus struct { + State NodeState `json:",omitempty"` + Message string `json:",omitempty"` + Addr string `json:",omitempty"` +} + +// Reachability represents the reachability of a node. +type Reachability string + +const ( + // ReachabilityUnknown UNKNOWN + ReachabilityUnknown Reachability = "unknown" + // ReachabilityUnreachable UNREACHABLE + ReachabilityUnreachable Reachability = "unreachable" + // ReachabilityReachable REACHABLE + ReachabilityReachable Reachability = "reachable" +) + +// ManagerStatus represents the status of a manager. +type ManagerStatus struct { + Leader bool `json:",omitempty"` + Reachability Reachability `json:",omitempty"` + Addr string `json:",omitempty"` +} + +// NodeState represents the state of a node. +type NodeState string + +const ( + // NodeStateUnknown UNKNOWN + NodeStateUnknown NodeState = "unknown" + // NodeStateDown DOWN + NodeStateDown NodeState = "down" + // NodeStateReady READY + NodeStateReady NodeState = "ready" + // NodeStateDisconnected DISCONNECTED + NodeStateDisconnected NodeState = "disconnected" +) + +// Topology defines the CSI topology of this node. This type is a duplicate of +// [github.com/moby/moby/api/types/volume.Topology]. Because the type definition +// is so simple and to avoid complicated structure or circular imports, we just +// duplicate it here. See that type for full documentation +type Topology struct { + Segments map[string]string `json:",omitempty"` +} diff --git a/vendor/github.com/moby/moby/api/types/swarm/runtime.go b/vendor/github.com/moby/moby/api/types/swarm/runtime.go new file mode 100644 index 00000000..23ea712c --- /dev/null +++ b/vendor/github.com/moby/moby/api/types/swarm/runtime.go @@ -0,0 +1,45 @@ +package swarm + +// RuntimeType is the type of runtime used for the TaskSpec +type RuntimeType string + +// RuntimeURL is the proto type url +type RuntimeURL string + +const ( + // RuntimeContainer is the container based runtime + RuntimeContainer RuntimeType = "container" + // RuntimePlugin is the plugin based runtime + RuntimePlugin RuntimeType = "plugin" + // RuntimeNetworkAttachment is the network attachment runtime + RuntimeNetworkAttachment RuntimeType = "attachment" + + // RuntimeURLContainer is the proto url for the container type + RuntimeURLContainer RuntimeURL = "types.docker.com/RuntimeContainer" + // RuntimeURLPlugin is the proto url for the plugin type + RuntimeURLPlugin RuntimeURL = "types.docker.com/RuntimePlugin" +) + +// NetworkAttachmentSpec represents the runtime spec type for network +// attachment tasks +type NetworkAttachmentSpec struct { + ContainerID string +} + +// RuntimeSpec defines the base payload which clients can specify for creating +// a service with the plugin runtime. +type RuntimeSpec struct { + Name string `json:"name,omitempty"` + Remote string `json:"remote,omitempty"` + Privileges []*RuntimePrivilege `json:"privileges,omitempty"` + Disabled bool `json:"disabled,omitempty"` + Env []string `json:"env,omitempty"` +} + +// RuntimePrivilege describes a permission the user has to accept +// upon installing a plugin. +type RuntimePrivilege struct { + Name string `json:"name,omitempty"` + Description string `json:"description,omitempty"` + Value []string `json:"value,omitempty"` +} diff --git a/vendor/github.com/moby/moby/api/types/swarm/secret.go b/vendor/github.com/moby/moby/api/types/swarm/secret.go new file mode 100644 index 00000000..0e27ed9b --- /dev/null +++ b/vendor/github.com/moby/moby/api/types/swarm/secret.go @@ -0,0 +1,59 @@ +package swarm + +import ( + "os" +) + +// Secret represents a secret. +type Secret struct { + ID string + Meta + Spec SecretSpec +} + +// SecretSpec represents a secret specification from a secret in swarm +type SecretSpec struct { + Annotations + + // Data is the data to store as a secret. It must be empty if a + // [Driver] is used, in which case the data is loaded from an external + // secret store. The maximum allowed size is 500KB, as defined in + // [MaxSecretSize]. + // + // This field is only used to create the secret, and is not returned + // by other endpoints. + // + // [MaxSecretSize]: https://pkg.go.dev/github.com/moby/swarmkit/v2@v2.0.0/api/validation#MaxSecretSize + Data []byte `json:",omitempty"` + + // Driver is the name of the secrets driver used to fetch the secret's + // value from an external secret store. If not set, the default built-in + // store is used. + Driver *Driver `json:",omitempty"` + + // Templating controls whether and how to evaluate the secret payload as + // a template. If it is not set, no templating is used. + Templating *Driver `json:",omitempty"` +} + +// SecretReferenceFileTarget is a file target in a secret reference +type SecretReferenceFileTarget struct { + Name string + UID string + GID string + Mode os.FileMode +} + +// SecretReference is a reference to a secret in swarm +type SecretReference struct { + File *SecretReferenceFileTarget + SecretID string + SecretName string +} + +// SecretCreateResponse contains the information returned to a client +// on the creation of a new secret. +type SecretCreateResponse struct { + // ID is the id of the created secret. + ID string +} diff --git a/vendor/github.com/moby/moby/api/types/swarm/service.go b/vendor/github.com/moby/moby/api/types/swarm/service.go new file mode 100644 index 00000000..0b678dea --- /dev/null +++ b/vendor/github.com/moby/moby/api/types/swarm/service.go @@ -0,0 +1,218 @@ +package swarm + +import ( + "time" +) + +// Service represents a service. +type Service struct { + ID string + Meta + Spec ServiceSpec `json:",omitempty"` + PreviousSpec *ServiceSpec `json:",omitempty"` + Endpoint Endpoint `json:",omitempty"` + UpdateStatus *UpdateStatus `json:",omitempty"` + + // ServiceStatus is an optional, extra field indicating the number of + // desired and running tasks. It is provided primarily as a shortcut to + // calculating these values client-side, which otherwise would require + // listing all tasks for a service, an operation that could be + // computation and network expensive. + ServiceStatus *ServiceStatus `json:",omitempty"` + + // JobStatus is the status of a Service which is in one of ReplicatedJob or + // GlobalJob modes. It is absent on Replicated and Global services. + JobStatus *JobStatus `json:",omitempty"` +} + +// ServiceSpec represents the spec of a service. +type ServiceSpec struct { + Annotations + + // TaskTemplate defines how the service should construct new tasks when + // orchestrating this service. + TaskTemplate TaskSpec `json:",omitempty"` + Mode ServiceMode `json:",omitempty"` + UpdateConfig *UpdateConfig `json:",omitempty"` + RollbackConfig *UpdateConfig `json:",omitempty"` + EndpointSpec *EndpointSpec `json:",omitempty"` +} + +// ServiceMode represents the mode of a service. +type ServiceMode struct { + Replicated *ReplicatedService `json:",omitempty"` + Global *GlobalService `json:",omitempty"` + ReplicatedJob *ReplicatedJob `json:",omitempty"` + GlobalJob *GlobalJob `json:",omitempty"` +} + +// UpdateState is the state of a service update. +type UpdateState string + +const ( + // UpdateStateUpdating is the updating state. + UpdateStateUpdating UpdateState = "updating" + // UpdateStatePaused is the paused state. + UpdateStatePaused UpdateState = "paused" + // UpdateStateCompleted is the completed state. + UpdateStateCompleted UpdateState = "completed" + // UpdateStateRollbackStarted is the state with a rollback in progress. + UpdateStateRollbackStarted UpdateState = "rollback_started" + // UpdateStateRollbackPaused is the state with a rollback in progress. + UpdateStateRollbackPaused UpdateState = "rollback_paused" + // UpdateStateRollbackCompleted is the state with a rollback in progress. + UpdateStateRollbackCompleted UpdateState = "rollback_completed" +) + +// UpdateStatus reports the status of a service update. +type UpdateStatus struct { + State UpdateState `json:",omitempty"` + StartedAt *time.Time `json:",omitempty"` + CompletedAt *time.Time `json:",omitempty"` + Message string `json:",omitempty"` +} + +// ReplicatedService is a kind of ServiceMode. +type ReplicatedService struct { + Replicas *uint64 `json:",omitempty"` +} + +// GlobalService is a kind of ServiceMode. +type GlobalService struct{} + +// ReplicatedJob is the a type of Service which executes a defined Tasks +// in parallel until the specified number of Tasks have succeeded. +type ReplicatedJob struct { + // MaxConcurrent indicates the maximum number of Tasks that should be + // executing simultaneously for this job at any given time. There may be + // fewer Tasks that MaxConcurrent executing simultaneously; for example, if + // there are fewer than MaxConcurrent tasks needed to reach + // TotalCompletions. + // + // If this field is empty, it will default to a max concurrency of 1. + MaxConcurrent *uint64 `json:",omitempty"` + + // TotalCompletions is the total number of Tasks desired to run to + // completion. + // + // If this field is empty, the value of MaxConcurrent will be used. + TotalCompletions *uint64 `json:",omitempty"` +} + +// GlobalJob is the type of a Service which executes a Task on every Node +// matching the Service's placement constraints. These tasks run to completion +// and then exit. +// +// This type is deliberately empty. +type GlobalJob struct{} + +// FailureAction is the action to perform when updating a service fails. +type FailureAction string + +const ( + // UpdateFailureActionPause PAUSE + UpdateFailureActionPause FailureAction = "pause" + // UpdateFailureActionContinue CONTINUE + UpdateFailureActionContinue FailureAction = "continue" + // UpdateFailureActionRollback ROLLBACK + UpdateFailureActionRollback FailureAction = "rollback" +) + +// UpdateOrder is the order of operations when rolling out or rolling back +// an updated tasks for a service. +type UpdateOrder string + +const ( + // UpdateOrderStopFirst STOP_FIRST + UpdateOrderStopFirst UpdateOrder = "stop-first" + // UpdateOrderStartFirst START_FIRST + UpdateOrderStartFirst UpdateOrder = "start-first" +) + +// UpdateConfig represents the update configuration. +type UpdateConfig struct { + // Maximum number of tasks to be updated in one iteration. + // 0 means unlimited parallelism. + Parallelism uint64 + + // Amount of time between updates. + Delay time.Duration `json:",omitempty"` + + // FailureAction is the action to take when an update failures. + FailureAction FailureAction `json:",omitempty"` + + // Monitor indicates how long to monitor a task for failure after it is + // created. If the task fails by ending up in one of the states + // REJECTED, COMPLETED, or FAILED, within Monitor from its creation, + // this counts as a failure. If it fails after Monitor, it does not + // count as a failure. If Monitor is unspecified, a default value will + // be used. + Monitor time.Duration `json:",omitempty"` + + // MaxFailureRatio is the fraction of tasks that may fail during + // an update before the failure action is invoked. Any task created by + // the current update which ends up in one of the states REJECTED, + // COMPLETED or FAILED within Monitor from its creation counts as a + // failure. The number of failures is divided by the number of tasks + // being updated, and if this fraction is greater than + // MaxFailureRatio, the failure action is invoked. + // + // If the failure action is CONTINUE, there is no effect. + // If the failure action is PAUSE, no more tasks will be updated until + // another update is started. + MaxFailureRatio float32 + + // Order indicates the order of operations when rolling out an updated + // task. Either the old task is shut down before the new task is + // started, or the new task is started before the old task is shut down. + Order UpdateOrder +} + +// ServiceStatus represents the number of running tasks in a service and the +// number of tasks desired to be running. +type ServiceStatus struct { + // RunningTasks is the number of tasks for the service actually in the + // Running state + RunningTasks uint64 + + // DesiredTasks is the number of tasks desired to be running by the + // service. For replicated services, this is the replica count. For global + // services, this is computed by taking the number of tasks with desired + // state of not-Shutdown. + DesiredTasks uint64 + + // CompletedTasks is the number of tasks in the state Completed, if this + // service is in ReplicatedJob or GlobalJob mode. This field must be + // cross-referenced with the service type, because the default value of 0 + // may mean that a service is not in a job mode, or it may mean that the + // job has yet to complete any tasks. + CompletedTasks uint64 +} + +// JobStatus is the status of a job-type service. +type JobStatus struct { + // JobIteration is a value increased each time a Job is executed, + // successfully or otherwise. "Executed", in this case, means the job as a + // whole has been started, not that an individual Task has been launched. A + // job is "Executed" when its ServiceSpec is updated. JobIteration can be + // used to disambiguate Tasks belonging to different executions of a job. + // + // Though JobIteration will increase with each subsequent execution, it may + // not necessarily increase by 1, and so JobIteration should not be used to + // keep track of the number of times a job has been executed. + JobIteration Version + + // LastExecution is the time that the job was last executed, as observed by + // Swarm manager. + LastExecution time.Time `json:",omitempty"` +} + +// RegistryAuthSource defines options for the "registryAuthFrom" query parameter +// on service update. +type RegistryAuthSource string + +// Values for RegistryAuthFrom in ServiceUpdateOptions +const ( + RegistryAuthFromSpec RegistryAuthSource = "spec" + RegistryAuthFromPreviousSpec RegistryAuthSource = "previous-spec" +) diff --git a/vendor/github.com/moby/moby/api/types/swarm/service_create_response.go b/vendor/github.com/moby/moby/api/types/swarm/service_create_response.go new file mode 100644 index 00000000..ebbc097d --- /dev/null +++ b/vendor/github.com/moby/moby/api/types/swarm/service_create_response.go @@ -0,0 +1,24 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package swarm + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +// ServiceCreateResponse contains the information returned to a client on the +// creation of a new service. +// +// swagger:model ServiceCreateResponse +type ServiceCreateResponse struct { + + // The ID of the created service. + // Example: ak7w3gjqoa3kuz8xcpnyy0pvl + ID string `json:"ID,omitempty"` + + // Optional warning message. + // + // FIXME(thaJeztah): this should have "omitempty" in the generated type. + // + // Example: ["unable to pin image doesnotexist:latest to digest: image library/doesnotexist:latest not found"] + Warnings []string `json:"Warnings"` +} diff --git a/vendor/github.com/moby/moby/api/types/swarm/service_update_response.go b/vendor/github.com/moby/moby/api/types/swarm/service_update_response.go new file mode 100644 index 00000000..b7649096 --- /dev/null +++ b/vendor/github.com/moby/moby/api/types/swarm/service_update_response.go @@ -0,0 +1,16 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package swarm + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +// ServiceUpdateResponse service update response +// Example: {"Warnings":["unable to pin image doesnotexist:latest to digest: image library/doesnotexist:latest not found"]} +// +// swagger:model ServiceUpdateResponse +type ServiceUpdateResponse struct { + + // Optional warning messages + Warnings []string `json:"Warnings"` +} diff --git a/vendor/github.com/moby/moby/api/types/swarm/swarm.go b/vendor/github.com/moby/moby/api/types/swarm/swarm.go new file mode 100644 index 00000000..84218503 --- /dev/null +++ b/vendor/github.com/moby/moby/api/types/swarm/swarm.go @@ -0,0 +1,228 @@ +package swarm + +import ( + "net/netip" + "time" +) + +// ClusterInfo represents info about the cluster for outputting in "info" +// it contains the same information as "Swarm", but without the JoinTokens +type ClusterInfo struct { + ID string + Meta + Spec Spec + TLSInfo TLSInfo + RootRotationInProgress bool + DefaultAddrPool []netip.Prefix + SubnetSize uint32 + DataPathPort uint32 +} + +// Swarm represents a swarm. +type Swarm struct { + ClusterInfo + JoinTokens JoinTokens +} + +// JoinTokens contains the tokens workers and managers need to join the swarm. +type JoinTokens struct { + // Worker is the join token workers may use to join the swarm. + Worker string + // Manager is the join token managers may use to join the swarm. + Manager string +} + +// Spec represents the spec of a swarm. +type Spec struct { + Annotations + + Orchestration OrchestrationConfig `json:",omitempty"` + Raft RaftConfig `json:",omitempty"` + Dispatcher DispatcherConfig `json:",omitempty"` + CAConfig CAConfig `json:",omitempty"` + TaskDefaults TaskDefaults `json:",omitempty"` + EncryptionConfig EncryptionConfig `json:",omitempty"` +} + +// OrchestrationConfig represents orchestration configuration. +type OrchestrationConfig struct { + // TaskHistoryRetentionLimit is the number of historic tasks to keep per instance or + // node. If negative, never remove completed or failed tasks. + TaskHistoryRetentionLimit *int64 `json:",omitempty"` +} + +// TaskDefaults parameterizes cluster-level task creation with default values. +type TaskDefaults struct { + // LogDriver selects the log driver to use for tasks created in the + // orchestrator if unspecified by a service. + // + // Updating this value will only have an affect on new tasks. Old tasks + // will continue use their previously configured log driver until + // recreated. + LogDriver *Driver `json:",omitempty"` +} + +// EncryptionConfig controls at-rest encryption of data and keys. +type EncryptionConfig struct { + // AutoLockManagers specifies whether or not managers TLS keys and raft data + // should be encrypted at rest in such a way that they must be unlocked + // before the manager node starts up again. + AutoLockManagers bool +} + +// RaftConfig represents raft configuration. +type RaftConfig struct { + // SnapshotInterval is the number of log entries between snapshots. + SnapshotInterval uint64 `json:",omitempty"` + + // KeepOldSnapshots is the number of snapshots to keep beyond the + // current snapshot. + KeepOldSnapshots *uint64 `json:",omitempty"` + + // LogEntriesForSlowFollowers is the number of log entries to keep + // around to sync up slow followers after a snapshot is created. + LogEntriesForSlowFollowers uint64 `json:",omitempty"` + + // ElectionTick is the number of ticks that a follower will wait for a message + // from the leader before becoming a candidate and starting an election. + // ElectionTick must be greater than HeartbeatTick. + // + // A tick currently defaults to one second, so these translate directly to + // seconds currently, but this is NOT guaranteed. + ElectionTick int + + // HeartbeatTick is the number of ticks between heartbeats. Every + // HeartbeatTick ticks, the leader will send a heartbeat to the + // followers. + // + // A tick currently defaults to one second, so these translate directly to + // seconds currently, but this is NOT guaranteed. + HeartbeatTick int +} + +// DispatcherConfig represents dispatcher configuration. +type DispatcherConfig struct { + // HeartbeatPeriod defines how often agent should send heartbeats to + // dispatcher. + HeartbeatPeriod time.Duration `json:",omitempty"` +} + +// CAConfig represents CA configuration. +type CAConfig struct { + // NodeCertExpiry is the duration certificates should be issued for + NodeCertExpiry time.Duration `json:",omitempty"` + + // ExternalCAs is a list of CAs to which a manager node will make + // certificate signing requests for node certificates. + ExternalCAs []*ExternalCA `json:",omitempty"` + + // SigningCACert and SigningCAKey specify the desired signing root CA and + // root CA key for the swarm. When inspecting the cluster, the key will + // be redacted. + SigningCACert string `json:",omitempty"` + SigningCAKey string `json:",omitempty"` + + // If this value changes, and there is no specified signing cert and key, + // then the swarm is forced to generate a new root certificate and key. + ForceRotate uint64 `json:",omitempty"` +} + +// ExternalCAProtocol represents type of external CA. +type ExternalCAProtocol string + +// ExternalCAProtocolCFSSL CFSSL +const ExternalCAProtocolCFSSL ExternalCAProtocol = "cfssl" + +// ExternalCA defines external CA to be used by the cluster. +type ExternalCA struct { + // Protocol is the protocol used by this external CA. + Protocol ExternalCAProtocol + + // URL is the URL where the external CA can be reached. + URL string + + // Options is a set of additional key/value pairs whose interpretation + // depends on the specified CA type. + Options map[string]string `json:",omitempty"` + + // CACert specifies which root CA is used by this external CA. This certificate must + // be in PEM format. + CACert string +} + +// InitRequest is the request used to init a swarm. +type InitRequest struct { + ListenAddr string + AdvertiseAddr string + DataPathAddr string + DataPathPort uint32 + ForceNewCluster bool + Spec Spec + AutoLockManagers bool + Availability NodeAvailability + DefaultAddrPool []netip.Prefix + SubnetSize uint32 +} + +// JoinRequest is the request used to join a swarm. +type JoinRequest struct { + ListenAddr string + AdvertiseAddr string + DataPathAddr string + RemoteAddrs []string + JoinToken string // accept by secret + Availability NodeAvailability +} + +// UnlockRequest is the request used to unlock a swarm. +type UnlockRequest struct { + // UnlockKey is the unlock key in ASCII-armored format. + UnlockKey string +} + +// LocalNodeState represents the state of the local node. +type LocalNodeState string + +const ( + // LocalNodeStateInactive INACTIVE + LocalNodeStateInactive LocalNodeState = "inactive" + // LocalNodeStatePending PENDING + LocalNodeStatePending LocalNodeState = "pending" + // LocalNodeStateActive ACTIVE + LocalNodeStateActive LocalNodeState = "active" + // LocalNodeStateError ERROR + LocalNodeStateError LocalNodeState = "error" + // LocalNodeStateLocked LOCKED + LocalNodeStateLocked LocalNodeState = "locked" +) + +// Info represents generic information about swarm. +type Info struct { + NodeID string + NodeAddr string + + LocalNodeState LocalNodeState + ControlAvailable bool + Error string + + RemoteManagers []Peer + Nodes int `json:",omitempty"` + Managers int `json:",omitempty"` + + Cluster *ClusterInfo `json:",omitempty"` + + Warnings []string `json:",omitempty"` +} + +// Peer represents a peer. +type Peer struct { + NodeID string + Addr string +} + +// UnlockKeyResponse contains the response for Engine API: +// GET /swarm/unlockkey +type UnlockKeyResponse struct { + // UnlockKey is the unlock key in ASCII-armored format. + UnlockKey string +} diff --git a/vendor/github.com/moby/moby/api/types/swarm/task.go b/vendor/github.com/moby/moby/api/types/swarm/task.go new file mode 100644 index 00000000..e2633037 --- /dev/null +++ b/vendor/github.com/moby/moby/api/types/swarm/task.go @@ -0,0 +1,234 @@ +package swarm + +import ( + "time" +) + +// TaskState represents the state of a task. +type TaskState string + +const ( + // TaskStateNew NEW + TaskStateNew TaskState = "new" + // TaskStateAllocated ALLOCATED + TaskStateAllocated TaskState = "allocated" + // TaskStatePending PENDING + TaskStatePending TaskState = "pending" + // TaskStateAssigned ASSIGNED + TaskStateAssigned TaskState = "assigned" + // TaskStateAccepted ACCEPTED + TaskStateAccepted TaskState = "accepted" + // TaskStatePreparing PREPARING + TaskStatePreparing TaskState = "preparing" + // TaskStateReady READY + TaskStateReady TaskState = "ready" + // TaskStateStarting STARTING + TaskStateStarting TaskState = "starting" + // TaskStateRunning RUNNING + TaskStateRunning TaskState = "running" + // TaskStateComplete COMPLETE + TaskStateComplete TaskState = "complete" + // TaskStateShutdown SHUTDOWN + TaskStateShutdown TaskState = "shutdown" + // TaskStateFailed FAILED + TaskStateFailed TaskState = "failed" + // TaskStateRejected REJECTED + TaskStateRejected TaskState = "rejected" + // TaskStateRemove REMOVE + TaskStateRemove TaskState = "remove" + // TaskStateOrphaned ORPHANED + TaskStateOrphaned TaskState = "orphaned" +) + +// Task represents a task. +type Task struct { + ID string + Meta + Annotations + + Spec TaskSpec `json:",omitempty"` + ServiceID string `json:",omitempty"` + Slot int `json:",omitempty"` + NodeID string `json:",omitempty"` + Status TaskStatus `json:",omitempty"` + DesiredState TaskState `json:",omitempty"` + NetworksAttachments []NetworkAttachment `json:",omitempty"` + GenericResources []GenericResource `json:",omitempty"` + + // JobIteration is the JobIteration of the Service that this Task was + // spawned from, if the Service is a ReplicatedJob or GlobalJob. This is + // used to determine which Tasks belong to which run of the job. This field + // is absent if the Service mode is Replicated or Global. + JobIteration *Version `json:",omitempty"` + + // Volumes is the list of VolumeAttachments for this task. It specifies + // which particular volumes are to be used by this particular task, and + // fulfilling what mounts in the spec. + Volumes []VolumeAttachment +} + +// TaskSpec represents the spec of a task. +type TaskSpec struct { + // ContainerSpec, NetworkAttachmentSpec, and PluginSpec are mutually exclusive. + // PluginSpec is only used when the `Runtime` field is set to `plugin` + // NetworkAttachmentSpec is used if the `Runtime` field is set to + // `attachment`. + ContainerSpec *ContainerSpec `json:",omitempty"` + PluginSpec *RuntimeSpec `json:",omitempty"` + NetworkAttachmentSpec *NetworkAttachmentSpec `json:",omitempty"` + + Resources *ResourceRequirements `json:",omitempty"` + RestartPolicy *RestartPolicy `json:",omitempty"` + Placement *Placement `json:",omitempty"` + Networks []NetworkAttachmentConfig `json:",omitempty"` + + // LogDriver specifies the LogDriver to use for tasks created from this + // spec. If not present, the one on cluster default on swarm.Spec will be + // used, finally falling back to the engine default if not specified. + LogDriver *Driver `json:",omitempty"` + + // ForceUpdate is a counter that triggers an update even if no relevant + // parameters have been changed. + ForceUpdate uint64 + + Runtime RuntimeType `json:",omitempty"` +} + +// Resources represents resources (CPU/Memory) which can be advertised by a +// node and requested to be reserved for a task. +type Resources struct { + NanoCPUs int64 `json:",omitempty"` + MemoryBytes int64 `json:",omitempty"` + GenericResources []GenericResource `json:",omitempty"` +} + +// Limit describes limits on resources which can be requested by a task. +type Limit struct { + NanoCPUs int64 `json:",omitempty"` + MemoryBytes int64 `json:",omitempty"` + Pids int64 `json:",omitempty"` +} + +// GenericResource represents a "user-defined" resource which can +// be either an integer (e.g: SSD=3) or a string (e.g: SSD=sda1) +type GenericResource struct { + NamedResourceSpec *NamedGenericResource `json:",omitempty"` + DiscreteResourceSpec *DiscreteGenericResource `json:",omitempty"` +} + +// NamedGenericResource represents a "user-defined" resource which is defined +// as a string. +// "Kind" is used to describe the Kind of a resource (e.g: "GPU", "FPGA", "SSD", ...) +// Value is used to identify the resource (GPU="UUID-1", FPGA="/dev/sdb5", ...) +type NamedGenericResource struct { + Kind string `json:",omitempty"` + Value string `json:",omitempty"` +} + +// DiscreteGenericResource represents a "user-defined" resource which is defined +// as an integer +// "Kind" is used to describe the Kind of a resource (e.g: "GPU", "FPGA", "SSD", ...) +// Value is used to count the resource (SSD=5, HDD=3, ...) +type DiscreteGenericResource struct { + Kind string `json:",omitempty"` + Value int64 `json:",omitempty"` +} + +// ResourceRequirements represents resources requirements. +type ResourceRequirements struct { + Limits *Limit `json:",omitempty"` + Reservations *Resources `json:",omitempty"` + + // Amount of swap in bytes - can only be used together with a memory limit + // -1 means unlimited + // a null pointer keeps the default behaviour of granting twice the memory + // amount in swap + SwapBytes *int64 `json:"SwapBytes,omitzero"` + + // Tune container memory swappiness (0 to 100) - if not specified, defaults + // to the container OS's default - generally 60, or the value predefined in + // the image; set to -1 to unset a previously set value + MemorySwappiness *int64 `json:"MemorySwappiness,omitzero"` +} + +// Placement represents orchestration parameters. +type Placement struct { + Constraints []string `json:",omitempty"` + Preferences []PlacementPreference `json:",omitempty"` + MaxReplicas uint64 `json:",omitempty"` + + // Platforms stores all the platforms that the image can run on. + // This field is used in the platform filter for scheduling. If empty, + // then the platform filter is off, meaning there are no scheduling restrictions. + Platforms []Platform `json:",omitempty"` +} + +// PlacementPreference provides a way to make the scheduler aware of factors +// such as topology. +type PlacementPreference struct { + Spread *SpreadOver +} + +// SpreadOver is a scheduling preference that instructs the scheduler to spread +// tasks evenly over groups of nodes identified by labels. +type SpreadOver struct { + // label descriptor, such as engine.labels.az + SpreadDescriptor string +} + +// RestartPolicy represents the restart policy. +type RestartPolicy struct { + Condition RestartPolicyCondition `json:",omitempty"` + Delay *time.Duration `json:",omitempty"` + MaxAttempts *uint64 `json:",omitempty"` + Window *time.Duration `json:",omitempty"` +} + +// RestartPolicyCondition represents when to restart. +type RestartPolicyCondition string + +const ( + // RestartPolicyConditionNone NONE + RestartPolicyConditionNone RestartPolicyCondition = "none" + // RestartPolicyConditionOnFailure ON_FAILURE + RestartPolicyConditionOnFailure RestartPolicyCondition = "on-failure" + // RestartPolicyConditionAny ANY + RestartPolicyConditionAny RestartPolicyCondition = "any" +) + +// TaskStatus represents the status of a task. +type TaskStatus struct { + Timestamp time.Time `json:",omitempty"` + State TaskState `json:",omitempty"` + Message string `json:",omitempty"` + Err string `json:",omitempty"` + ContainerStatus *ContainerStatus `json:",omitempty"` + PortStatus PortStatus `json:",omitempty"` +} + +// ContainerStatus represents the status of a container. +type ContainerStatus struct { + ContainerID string + PID int + ExitCode int +} + +// PortStatus represents the port status of a task's host ports whose +// service has published host ports +type PortStatus struct { + Ports []PortConfig `json:",omitempty"` +} + +// VolumeAttachment contains the associating a Volume to a Task. +type VolumeAttachment struct { + // ID is the Swarmkit ID of the Volume. This is not the CSI VolumeId. + ID string `json:",omitempty"` + + // Source, together with Target, indicates the Mount, as specified in the + // ContainerSpec, that this volume fulfills. + Source string `json:",omitempty"` + + // Target, together with Source, indicates the Mount, as specified + // in the ContainerSpec, that this volume fulfills. + Target string `json:",omitempty"` +} diff --git a/vendor/github.com/moby/moby/api/types/system/disk_usage.go b/vendor/github.com/moby/moby/api/types/system/disk_usage.go new file mode 100644 index 00000000..33230aed --- /dev/null +++ b/vendor/github.com/moby/moby/api/types/system/disk_usage.go @@ -0,0 +1,31 @@ +package system + +import ( + "github.com/moby/moby/api/types/build" + "github.com/moby/moby/api/types/container" + "github.com/moby/moby/api/types/image" + "github.com/moby/moby/api/types/volume" +) + +// DiskUsageObject represents an object type used for disk usage query filtering. +type DiskUsageObject string + +const ( + // ContainerObject represents a container DiskUsageObject. + ContainerObject DiskUsageObject = "container" + // ImageObject represents an image DiskUsageObject. + ImageObject DiskUsageObject = "image" + // VolumeObject represents a volume DiskUsageObject. + VolumeObject DiskUsageObject = "volume" + // BuildCacheObject represents a build-cache DiskUsageObject. + BuildCacheObject DiskUsageObject = "build-cache" +) + +// DiskUsage contains response of Engine API: +// GET "/system/df" +type DiskUsage struct { + ImageUsage *image.DiskUsage `json:"ImageUsage,omitempty"` + ContainerUsage *container.DiskUsage `json:"ContainerUsage,omitempty"` + VolumeUsage *volume.DiskUsage `json:"VolumeUsage,omitempty"` + BuildCacheUsage *build.DiskUsage `json:"BuildCacheUsage,omitempty"` +} diff --git a/vendor/github.com/moby/moby/api/types/system/info.go b/vendor/github.com/moby/moby/api/types/system/info.go new file mode 100644 index 00000000..20df949e --- /dev/null +++ b/vendor/github.com/moby/moby/api/types/system/info.go @@ -0,0 +1,171 @@ +package system + +import ( + "net/netip" + + "github.com/moby/moby/api/types/container" + "github.com/moby/moby/api/types/registry" + "github.com/moby/moby/api/types/swarm" +) + +// Info contains response of Engine API: +// GET "/info" +type Info struct { + ID string + Containers int + ContainersRunning int + ContainersPaused int + ContainersStopped int + Images int + Driver string + DriverStatus [][2]string + SystemStatus [][2]string `json:",omitempty"` // SystemStatus is only propagated by the Swarm standalone API + Plugins PluginsInfo + MemoryLimit bool + SwapLimit bool + CPUCfsPeriod bool `json:"CpuCfsPeriod"` + CPUCfsQuota bool `json:"CpuCfsQuota"` + CPUShares bool + CPUSet bool + PidsLimit bool + IPv4Forwarding bool + Debug bool + NFd int + OomKillDisable bool + NGoroutines int + SystemTime string + LoggingDriver string + CgroupDriver string + CgroupVersion string `json:",omitempty"` + NEventsListener int + KernelVersion string + OperatingSystem string + OSVersion string + OSType string + Architecture string + IndexServerAddress string + RegistryConfig *registry.ServiceConfig + NCPU int + MemTotal int64 + GenericResources []swarm.GenericResource + DockerRootDir string + HTTPProxy string `json:"HttpProxy"` + HTTPSProxy string `json:"HttpsProxy"` + NoProxy string + Name string + Labels []string + ExperimentalBuild bool + ServerVersion string + Runtimes map[string]RuntimeWithStatus + DefaultRuntime string + Swarm swarm.Info + // LiveRestoreEnabled determines whether containers should be kept + // running when the daemon is shutdown or upon daemon start if + // running containers are detected + LiveRestoreEnabled bool + Isolation container.Isolation + InitBinary string + ContainerdCommit Commit + RuncCommit Commit + InitCommit Commit + SecurityOptions []string + ProductLicense string `json:",omitempty"` + DefaultAddressPools []NetworkAddressPool `json:",omitempty"` + FirewallBackend *FirewallInfo `json:"FirewallBackend,omitempty"` + CDISpecDirs []string + DiscoveredDevices []DeviceInfo `json:",omitempty"` + NRI *NRIInfo `json:",omitempty"` + + Containerd *ContainerdInfo `json:",omitempty"` + + // Warnings contains a slice of warnings that occurred while collecting + // system information. These warnings are intended to be informational + // messages for the user, and are not intended to be parsed / used for + // other purposes, as they do not have a fixed format. + Warnings []string +} + +// ContainerdInfo holds information about the containerd instance used by the daemon. +type ContainerdInfo struct { + // Address is the path to the containerd socket. + Address string `json:",omitempty"` + // Namespaces is the containerd namespaces used by the daemon. + Namespaces ContainerdNamespaces +} + +// ContainerdNamespaces reflects the containerd namespaces used by the daemon. +// +// These namespaces can be configured in the daemon configuration, and are +// considered to be used exclusively by the daemon, +// +// As these namespaces are considered to be exclusively accessed +// by the daemon, it is not recommended to change these values, +// or to change them to a value that is used by other systems, +// such as cri-containerd. +type ContainerdNamespaces struct { + // Containers holds the default containerd namespace used for + // containers managed by the daemon. + // + // The default namespace for containers is "moby", but will be + // suffixed with the `.` of the remapped `root` if + // user-namespaces are enabled and the containerd image-store + // is used. + Containers string + + // Plugins holds the default containerd namespace used for + // plugins managed by the daemon. + // + // The default namespace for plugins is "moby", but will be + // suffixed with the `.` of the remapped `root` if + // user-namespaces are enabled and the containerd image-store + // is used. + Plugins string +} + +// PluginsInfo is a temp struct holding Plugins name +// registered with docker daemon. It is used by [Info] struct +type PluginsInfo struct { + // List of Volume plugins registered + Volume []string + // List of Network plugins registered + Network []string + // List of Authorization plugins registered + Authorization []string + // List of Log plugins registered + Log []string +} + +// Commit holds the Git-commit (SHA1) that a binary was built from, as reported +// in the version-string of external tools, such as containerd, or runC. +type Commit struct { + // ID is the actual commit ID or version of external tool. + ID string +} + +// NetworkAddressPool is a temp struct used by [Info] struct. +type NetworkAddressPool struct { + Base netip.Prefix + Size int +} + +// FirewallInfo describes the firewall backend. +type FirewallInfo struct { + // Driver is the name of the firewall backend driver. + Driver string `json:"Driver"` + // Info is a list of label/value pairs, containing information related to the firewall. + Info [][2]string `json:"Info,omitempty"` +} + +// DeviceInfo represents a discoverable device from a device driver. +type DeviceInfo struct { + // Source indicates the origin device driver. + Source string `json:"Source"` + // ID is the unique identifier for the device. + // Example: CDI FQDN like "vendor.com/gpu=0", or other driver-specific device ID + ID string `json:"ID"` +} + +// NRIInfo describes the NRI configuration. +type NRIInfo struct { + Info [][2]string `json:"Info,omitempty"` +} diff --git a/vendor/github.com/moby/moby/api/types/system/runtime.go b/vendor/github.com/moby/moby/api/types/system/runtime.go new file mode 100644 index 00000000..33cad367 --- /dev/null +++ b/vendor/github.com/moby/moby/api/types/system/runtime.go @@ -0,0 +1,20 @@ +package system + +// Runtime describes an OCI runtime +type Runtime struct { + // "Legacy" runtime configuration for runc-compatible runtimes. + + Path string `json:"path,omitempty"` + Args []string `json:"runtimeArgs,omitempty"` + + // Shimv2 runtime configuration. Mutually exclusive with the legacy config above. + + Type string `json:"runtimeType,omitempty"` + Options map[string]any `json:"options,omitempty"` +} + +// RuntimeWithStatus extends [Runtime] to hold [RuntimeStatus]. +type RuntimeWithStatus struct { + Runtime + Status map[string]string `json:"status,omitempty"` +} diff --git a/vendor/github.com/moby/moby/api/types/system/version_response.go b/vendor/github.com/moby/moby/api/types/system/version_response.go new file mode 100644 index 00000000..61cd1b6e --- /dev/null +++ b/vendor/github.com/moby/moby/api/types/system/version_response.go @@ -0,0 +1,58 @@ +package system + +// VersionResponse contains information about the Docker server host. +// GET "/version" +type VersionResponse struct { + // Platform is the platform (product name) the server is running on. + Platform PlatformInfo `json:",omitempty"` + + // Version is the version of the daemon. + Version string + + // APIVersion is the highest API version supported by the server. + APIVersion string `json:"ApiVersion"` + + // MinAPIVersion is the minimum API version the server supports. + MinAPIVersion string `json:"MinAPIVersion,omitempty"` + + // Os is the operating system the server runs on. + Os string + + // Arch is the hardware architecture the server runs on. + Arch string + + // Components contains version information for the components making + // up the server. Information in this field is for informational + // purposes, and not part of the API contract. + Components []ComponentVersion `json:",omitempty"` + + // The following fields are deprecated, they relate to the Engine component and are kept for backwards compatibility + + GitCommit string `json:",omitempty"` + GoVersion string `json:",omitempty"` + KernelVersion string `json:",omitempty"` + Experimental bool `json:",omitempty"` + BuildTime string `json:",omitempty"` +} + +// PlatformInfo holds information about the platform (product name) the +// server is running on. +type PlatformInfo struct { + // Name is the name of the platform (for example, "Docker Engine - Community", + // or "Docker Desktop 4.49.0 (208003)") + Name string +} + +// ComponentVersion describes the version information for a specific component. +type ComponentVersion struct { + Name string + Version string + + // Details contains Key/value pairs of strings with additional information + // about the component. These values are intended for informational purposes + // only, and their content is not defined, and not part of the API + // specification. + // + // These messages can be printed by the client as information to the user. + Details map[string]string `json:",omitempty"` +} diff --git a/vendor/github.com/moby/moby/api/types/types.go b/vendor/github.com/moby/moby/api/types/types.go new file mode 100644 index 00000000..5da64796 --- /dev/null +++ b/vendor/github.com/moby/moby/api/types/types.go @@ -0,0 +1,33 @@ +package types + +// MediaType represents an HTTP media type (MIME type) used in API +// Content-Type and Accept headers. +// +// In addition to standard media types (for example, "application/json"), +// this package defines vendor-specific vendor media types for streaming +// endpoints, such as raw TTY streams and multiplexed stdout/stderr streams. +type MediaType = string + +const ( + // MediaTypeRawStream is a vendor-specific media type for raw TTY streams. + MediaTypeRawStream MediaType = "application/vnd.docker.raw-stream" + + // MediaTypeMultiplexedStream is a vendor-specific media type for streams + // where stdin, stdout, and stderr are multiplexed into a single byte stream. + // + // Use stdcopy.StdCopy (https://pkg.go.dev/github.com/moby/moby/api/pkg/stdcopy) + // to demultiplex the stream. + MediaTypeMultiplexedStream MediaType = "application/vnd.docker.multiplexed-stream" + + // MediaTypeJSON is the media type for JSON objects. + MediaTypeJSON MediaType = "application/json" + + // MediaTypeNDJSON is the media type for newline-delimited JSON streams (https://github.com/ndjson/ndjson-spec). + MediaTypeNDJSON MediaType = "application/x-ndjson" + + // MediaTypeJSONLines is the media type for JSON Lines streams (https://jsonlines.org/). + MediaTypeJSONLines MediaType = "application/jsonl" + + // MediaTypeJSONSequence is the media type for JSON text sequences (RFC 7464). + MediaTypeJSONSequence MediaType = "application/json-seq" +) diff --git a/vendor/github.com/moby/moby/api/types/volume/cluster_volume.go b/vendor/github.com/moby/moby/api/types/volume/cluster_volume.go new file mode 100644 index 00000000..07b75d12 --- /dev/null +++ b/vendor/github.com/moby/moby/api/types/volume/cluster_volume.go @@ -0,0 +1,420 @@ +package volume + +import ( + "github.com/moby/moby/api/types/swarm" +) + +// ClusterVolume contains options and information specific to, and only present +// on, Swarm CSI cluster volumes. +type ClusterVolume struct { + // ID is the Swarm ID of the volume. Because cluster volumes are Swarm + // objects, they have an ID, unlike non-cluster volumes, which only have a + // Name. This ID can be used to refer to the cluster volume. + ID string + + // Meta is the swarm metadata about this volume. + swarm.Meta + + // Spec is the cluster-specific options from which this volume is derived. + Spec ClusterVolumeSpec + + // PublishStatus contains the status of the volume as it pertains to its + // publishing on Nodes. + PublishStatus []*PublishStatus `json:",omitempty"` + + // Info is information about the global status of the volume. + Info *Info `json:",omitempty"` +} + +// ClusterVolumeSpec contains the spec used to create this volume. +type ClusterVolumeSpec struct { + // Group defines the volume group of this volume. Volumes belonging to the + // same group can be referred to by group name when creating Services. + // Referring to a volume by group instructs swarm to treat volumes in that + // group interchangeably for the purpose of scheduling. Volumes with an + // empty string for a group technically all belong to the same, emptystring + // group. + Group string `json:",omitempty"` + + // AccessMode defines how the volume is used by tasks. + AccessMode *AccessMode `json:",omitempty"` + + // AccessibilityRequirements specifies where in the cluster a volume must + // be accessible from. + // + // This field must be empty if the plugin does not support + // VOLUME_ACCESSIBILITY_CONSTRAINTS capabilities. If it is present but the + // plugin does not support it, volume will not be created. + // + // If AccessibilityRequirements is empty, but the plugin does support + // VOLUME_ACCESSIBILITY_CONSTRAINTS, then Swarmkit will assume the entire + // cluster is a valid target for the volume. + AccessibilityRequirements *TopologyRequirement `json:",omitempty"` + + // CapacityRange defines the desired capacity that the volume should be + // created with. If nil, the plugin will decide the capacity. + CapacityRange *CapacityRange `json:",omitempty"` + + // Secrets defines Swarm Secrets that are passed to the CSI storage plugin + // when operating on this volume. + Secrets []Secret `json:",omitempty"` + + // Availability is the Volume's desired availability. Analogous to Node + // Availability, this allows the user to take volumes offline in order to + // update or delete them. + Availability Availability `json:",omitempty"` +} + +// Availability specifies the availability of the volume. +type Availability string + +const ( + // AvailabilityActive indicates that the volume is active and fully + // schedulable on the cluster. + AvailabilityActive Availability = "active" + + // AvailabilityPause indicates that no new workloads should use the + // volume, but existing workloads can continue to use it. + AvailabilityPause Availability = "pause" + + // AvailabilityDrain indicates that all workloads using this volume + // should be rescheduled, and the volume unpublished from all nodes. + AvailabilityDrain Availability = "drain" +) + +// AccessMode defines the access mode of a volume. +type AccessMode struct { + // Scope defines the set of nodes this volume can be used on at one time. + Scope Scope `json:",omitempty"` + + // Sharing defines the number and way that different tasks can use this + // volume at one time. + Sharing SharingMode `json:",omitempty"` + + // MountVolume defines options for using this volume as a Mount-type + // volume. + // + // Either BlockVolume or MountVolume, but not both, must be present. + MountVolume *TypeMount `json:",omitempty"` + + // BlockVolume defines options for using this volume as a Block-type + // volume. + // + // Either BlockVolume or MountVolume, but not both, must be present. + BlockVolume *TypeBlock `json:",omitempty"` +} + +// Scope defines the Scope of a Cluster Volume. This is how many nodes a +// Volume can be accessed simultaneously on. +type Scope string + +const ( + // ScopeSingleNode indicates the volume can be used on one node at a + // time. + ScopeSingleNode Scope = "single" + + // ScopeMultiNode indicates the volume can be used on many nodes at + // the same time. + ScopeMultiNode Scope = "multi" +) + +// SharingMode defines the Sharing of a Cluster Volume. This is how Tasks using a +// Volume at the same time can use it. +type SharingMode string + +const ( + // SharingNone indicates that only one Task may use the Volume at a + // time. + SharingNone SharingMode = "none" + + // SharingReadOnly indicates that the Volume may be shared by any + // number of Tasks, but they must be read-only. + SharingReadOnly SharingMode = "readonly" + + // SharingOneWriter indicates that the Volume may be shared by any + // number of Tasks, but all after the first must be read-only. + SharingOneWriter SharingMode = "onewriter" + + // SharingAll means that the Volume may be shared by any number of + // Tasks, as readers or writers. + SharingAll SharingMode = "all" +) + +// TypeBlock defines options for using a volume as a block-type volume. +// +// Intentionally empty. +type TypeBlock struct{} + +// TypeMount contains options for using a volume as a Mount-type +// volume. +type TypeMount struct { + // FsType specifies the filesystem type for the mount volume. Optional. + FsType string `json:",omitempty"` + + // MountFlags defines flags to pass when mounting the volume. Optional. + MountFlags []string `json:",omitempty"` +} + +// TopologyRequirement expresses the user's requirements for a volume's +// accessible topology. +type TopologyRequirement struct { + // Requisite specifies a list of Topologies, at least one of which the + // volume must be accessible from. + // + // Taken verbatim from the CSI Spec: + // + // Specifies the list of topologies the provisioned volume MUST be + // accessible from. + // This field is OPTIONAL. If TopologyRequirement is specified either + // requisite or preferred or both MUST be specified. + // + // If requisite is specified, the provisioned volume MUST be + // accessible from at least one of the requisite topologies. + // + // Given + // x = number of topologies provisioned volume is accessible from + // n = number of requisite topologies + // The CO MUST ensure n >= 1. The SP MUST ensure x >= 1 + // If x==n, then the SP MUST make the provisioned volume available to + // all topologies from the list of requisite topologies. If it is + // unable to do so, the SP MUST fail the CreateVolume call. + // For example, if a volume should be accessible from a single zone, + // and requisite = + // {"region": "R1", "zone": "Z2"} + // then the provisioned volume MUST be accessible from the "region" + // "R1" and the "zone" "Z2". + // Similarly, if a volume should be accessible from two zones, and + // requisite = + // {"region": "R1", "zone": "Z2"}, + // {"region": "R1", "zone": "Z3"} + // then the provisioned volume MUST be accessible from the "region" + // "R1" and both "zone" "Z2" and "zone" "Z3". + // + // If xn, then the SP MUST make the provisioned volume available from + // all topologies from the list of requisite topologies and MAY choose + // the remaining x-n unique topologies from the list of all possible + // topologies. If it is unable to do so, the SP MUST fail the + // CreateVolume call. + // For example, if a volume should be accessible from two zones, and + // requisite = + // {"region": "R1", "zone": "Z2"} + // then the provisioned volume MUST be accessible from the "region" + // "R1" and the "zone" "Z2" and the SP may select the second zone + // independently, e.g. "R1/Z4". + Requisite []Topology `json:",omitempty"` + + // Preferred is a list of Topologies that the volume should attempt to be + // provisioned in. + // + // Taken from the CSI spec: + // + // Specifies the list of topologies the CO would prefer the volume to + // be provisioned in. + // + // This field is OPTIONAL. If TopologyRequirement is specified either + // requisite or preferred or both MUST be specified. + // + // An SP MUST attempt to make the provisioned volume available using + // the preferred topologies in order from first to last. + // + // If requisite is specified, all topologies in preferred list MUST + // also be present in the list of requisite topologies. + // + // If the SP is unable to make the provisioned volume available + // from any of the preferred topologies, the SP MAY choose a topology + // from the list of requisite topologies. + // If the list of requisite topologies is not specified, then the SP + // MAY choose from the list of all possible topologies. + // If the list of requisite topologies is specified and the SP is + // unable to make the provisioned volume available from any of the + // requisite topologies it MUST fail the CreateVolume call. + // + // Example 1: + // Given a volume should be accessible from a single zone, and + // requisite = + // {"region": "R1", "zone": "Z2"}, + // {"region": "R1", "zone": "Z3"} + // preferred = + // {"region": "R1", "zone": "Z3"} + // then the SP SHOULD first attempt to make the provisioned volume + // available from "zone" "Z3" in the "region" "R1" and fall back to + // "zone" "Z2" in the "region" "R1" if that is not possible. + // + // Example 2: + // Given a volume should be accessible from a single zone, and + // requisite = + // {"region": "R1", "zone": "Z2"}, + // {"region": "R1", "zone": "Z3"}, + // {"region": "R1", "zone": "Z4"}, + // {"region": "R1", "zone": "Z5"} + // preferred = + // {"region": "R1", "zone": "Z4"}, + // {"region": "R1", "zone": "Z2"} + // then the SP SHOULD first attempt to make the provisioned volume + // accessible from "zone" "Z4" in the "region" "R1" and fall back to + // "zone" "Z2" in the "region" "R1" if that is not possible. If that + // is not possible, the SP may choose between either the "zone" + // "Z3" or "Z5" in the "region" "R1". + // + // Example 3: + // Given a volume should be accessible from TWO zones (because an + // opaque parameter in CreateVolumeRequest, for example, specifies + // the volume is accessible from two zones, aka synchronously + // replicated), and + // requisite = + // {"region": "R1", "zone": "Z2"}, + // {"region": "R1", "zone": "Z3"}, + // {"region": "R1", "zone": "Z4"}, + // {"region": "R1", "zone": "Z5"} + // preferred = + // {"region": "R1", "zone": "Z5"}, + // {"region": "R1", "zone": "Z3"} + // then the SP SHOULD first attempt to make the provisioned volume + // accessible from the combination of the two "zones" "Z5" and "Z3" in + // the "region" "R1". If that's not possible, it should fall back to + // a combination of "Z5" and other possibilities from the list of + // requisite. If that's not possible, it should fall back to a + // combination of "Z3" and other possibilities from the list of + // requisite. If that's not possible, it should fall back to a + // combination of other possibilities from the list of requisite. + Preferred []Topology `json:",omitempty"` +} + +// Topology is a map of topological domains to topological segments. +// +// This description is taken verbatim from the CSI Spec: +// +// A topological domain is a sub-division of a cluster, like "region", +// "zone", "rack", etc. +// A topological segment is a specific instance of a topological domain, +// like "zone3", "rack3", etc. +// For example {"com.company/zone": "Z1", "com.company/rack": "R3"} +// Valid keys have two segments: an OPTIONAL prefix and name, separated +// by a slash (/), for example: "com.company.example/zone". +// The key name segment is REQUIRED. The prefix is OPTIONAL. +// The key name MUST be 63 characters or less, begin and end with an +// alphanumeric character ([a-z0-9A-Z]), and contain only dashes (-), +// underscores (_), dots (.), or alphanumerics in between, for example +// "zone". +// The key prefix MUST be 63 characters or less, begin and end with a +// lower-case alphanumeric character ([a-z0-9]), contain only +// dashes (-), dots (.), or lower-case alphanumerics in between, and +// follow domain name notation format +// (https://tools.ietf.org/html/rfc1035#section-2.3.1). +// The key prefix SHOULD include the plugin's host company name and/or +// the plugin name, to minimize the possibility of collisions with keys +// from other plugins. +// If a key prefix is specified, it MUST be identical across all +// topology keys returned by the SP (across all RPCs). +// Keys MUST be case-insensitive. Meaning the keys "Zone" and "zone" +// MUST not both exist. +// Each value (topological segment) MUST contain 1 or more strings. +// Each string MUST be 63 characters or less and begin and end with an +// alphanumeric character with '-', '_', '.', or alphanumerics in +// between. +type Topology struct { + Segments map[string]string `json:",omitempty"` +} + +// CapacityRange describes the minimum and maximum capacity a volume should be +// created with +type CapacityRange struct { + // RequiredBytes specifies that a volume must be at least this big. The + // value of 0 indicates an unspecified minimum. + RequiredBytes int64 + + // LimitBytes specifies that a volume must not be bigger than this. The + // value of 0 indicates an unspecified maximum + LimitBytes int64 +} + +// Secret represents a Swarm Secret value that must be passed to the CSI +// storage plugin when operating on this Volume. It represents one key-value +// pair of possibly many. +type Secret struct { + // Key is the name of the key of the key-value pair passed to the plugin. + Key string + + // Secret is the swarm Secret object from which to read data. This can be a + // Secret name or ID. The Secret data is retrieved by Swarm and used as the + // value of the key-value pair passed to the plugin. + Secret string +} + +// PublishState represents the state of a Volume as it pertains to its +// use on a particular Node. +type PublishState string + +const ( + // StatePending indicates that the volume should be published on + // this node, but the call to ControllerPublishVolume has not been + // successfully completed yet and the result recorded by swarmkit. + StatePending PublishState = "pending-publish" + + // StatePublished means the volume is published successfully to the node. + StatePublished PublishState = "published" + + // StatePendingNodeUnpublish indicates that the Volume should be + // unpublished on the Node, and we're waiting for confirmation that it has + // done so. After the Node has confirmed that the Volume has been + // unpublished, the state will move to StatePendingUnpublish. + StatePendingNodeUnpublish PublishState = "pending-node-unpublish" + + // StatePendingUnpublish means the volume is still published to the node + // by the controller, awaiting the operation to unpublish it. + StatePendingUnpublish PublishState = "pending-controller-unpublish" +) + +// PublishStatus represents the status of the volume as published to an +// individual node +type PublishStatus struct { + // NodeID is the ID of the swarm node this Volume is published to. + NodeID string `json:",omitempty"` + + // State is the publish state of the volume. + State PublishState `json:",omitempty"` + + // PublishContext is the PublishContext returned by the CSI plugin when + // a volume is published. + PublishContext map[string]string `json:",omitempty"` +} + +// Info contains information about the Volume as a whole as provided by +// the CSI storage plugin. +type Info struct { + // CapacityBytes is the capacity of the volume in bytes. A value of 0 + // indicates that the capacity is unknown. + CapacityBytes int64 `json:",omitempty"` + + // VolumeContext is the context originating from the CSI storage plugin + // when the Volume is created. + VolumeContext map[string]string `json:",omitempty"` + + // VolumeID is the ID of the Volume as seen by the CSI storage plugin. This + // is distinct from the Volume's Swarm ID, which is the ID used by all of + // the Docker Engine to refer to the Volume. If this field is blank, then + // the Volume has not been successfully created yet. + VolumeID string `json:",omitempty"` + + // AccessibleTopology is the topology this volume is actually accessible + // from. + AccessibleTopology []Topology `json:",omitempty"` +} diff --git a/vendor/github.com/moby/moby/api/types/volume/create_request.go b/vendor/github.com/moby/moby/api/types/volume/create_request.go new file mode 100644 index 00000000..3217df82 --- /dev/null +++ b/vendor/github.com/moby/moby/api/types/volume/create_request.go @@ -0,0 +1,36 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package volume + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +// CreateRequest VolumeConfig +// +// # Volume configuration +// +// swagger:model CreateRequest +type CreateRequest struct { + + // cluster volume spec + ClusterVolumeSpec *ClusterVolumeSpec `json:"ClusterVolumeSpec,omitempty"` + + // Name of the volume driver to use. + // Example: custom + Driver string `json:"Driver,omitempty"` + + // A mapping of driver options and values. These options are + // passed directly to the driver and are driver specific. + // + // Example: {"device":"tmpfs","o":"size=100m,uid=1000","type":"tmpfs"} + DriverOpts map[string]string `json:"DriverOpts,omitempty"` + + // User-defined key/value metadata. + // Example: {"com.example.some-label":"some-value","com.example.some-other-label":"some-other-value"} + Labels map[string]string `json:"Labels,omitempty"` + + // The new volume's name. If not specified, Docker generates a name. + // + // Example: tardis + Name string `json:"Name,omitempty"` +} diff --git a/vendor/github.com/moby/moby/api/types/volume/disk_usage.go b/vendor/github.com/moby/moby/api/types/volume/disk_usage.go new file mode 100644 index 00000000..e2afbac6 --- /dev/null +++ b/vendor/github.com/moby/moby/api/types/volume/disk_usage.go @@ -0,0 +1,36 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package volume + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +// DiskUsage represents system data usage for volume resources. +// +// swagger:model DiskUsage +type DiskUsage struct { + + // Count of active volumes. + // + // Example: 1 + ActiveCount int64 `json:"ActiveCount,omitempty"` + + // List of volumes. + // + Items []Volume `json:"Items,omitempty"` + + // Disk space that can be reclaimed by removing inactive volumes. + // + // Example: 12345678 + Reclaimable int64 `json:"Reclaimable,omitempty"` + + // Count of all volumes. + // + // Example: 4 + TotalCount int64 `json:"TotalCount,omitempty"` + + // Disk space in use by volumes. + // + // Example: 98765432 + TotalSize int64 `json:"TotalSize,omitempty"` +} diff --git a/vendor/github.com/moby/moby/api/types/volume/list_response.go b/vendor/github.com/moby/moby/api/types/volume/list_response.go new file mode 100644 index 00000000..f257762f --- /dev/null +++ b/vendor/github.com/moby/moby/api/types/volume/list_response.go @@ -0,0 +1,22 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package volume + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +// ListResponse VolumeListResponse +// +// # Volume list response +// +// swagger:model ListResponse +type ListResponse struct { + + // List of volumes + Volumes []Volume `json:"Volumes"` + + // Warnings that occurred when fetching the list of volumes. + // + // Example: [] + Warnings []string `json:"Warnings"` +} diff --git a/vendor/github.com/moby/moby/api/types/volume/prune_report.go b/vendor/github.com/moby/moby/api/types/volume/prune_report.go new file mode 100644 index 00000000..7f501d01 --- /dev/null +++ b/vendor/github.com/moby/moby/api/types/volume/prune_report.go @@ -0,0 +1,8 @@ +package volume + +// PruneReport contains the response for Engine API: +// POST "/volumes/prune" +type PruneReport struct { + VolumesDeleted []string + SpaceReclaimed uint64 +} diff --git a/vendor/github.com/moby/moby/api/types/volume/volume.go b/vendor/github.com/moby/moby/api/types/volume/volume.go new file mode 100644 index 00000000..524ebfb8 --- /dev/null +++ b/vendor/github.com/moby/moby/api/types/volume/volume.go @@ -0,0 +1,87 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package volume + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +// Volume volume +// +// swagger:model Volume +type Volume struct { + + // cluster volume + ClusterVolume *ClusterVolume `json:"ClusterVolume,omitempty"` + + // Date/Time the volume was created. + // Example: 2016-06-07T20:31:11.853781916Z + CreatedAt string `json:"CreatedAt,omitempty"` + + // Name of the volume driver used by the volume. + // Example: custom + // Required: true + Driver string `json:"Driver"` + + // User-defined key/value metadata. + // Example: {"com.example.some-label":"some-value","com.example.some-other-label":"some-other-value"} + // Required: true + Labels map[string]string `json:"Labels"` + + // Mount path of the volume on the host. + // Example: /var/lib/docker/volumes/tardis + // Required: true + Mountpoint string `json:"Mountpoint"` + + // Name of the volume. + // Example: tardis + // Required: true + Name string `json:"Name"` + + // The driver specific options used when creating the volume. + // + // Example: {"device":"tmpfs","o":"size=100m,uid=1000","type":"tmpfs"} + // Required: true + Options map[string]string `json:"Options"` + + // The level at which the volume exists. Either `global` for cluster-wide, + // or `local` for machine level. + // + // Example: local + // Required: true + // Enum: ["local","global"] + Scope string `json:"Scope"` + + // Low-level details about the volume, provided by the volume driver. + // Details are returned as a map with key/value pairs: + // `{"key":"value","key2":"value2"}`. + // + // The `Status` field is optional, and is omitted if the volume driver + // does not support this feature. + // + // Example: {"hello":"world"} + Status map[string]any `json:"Status,omitempty"` + + // usage data + UsageData *UsageData `json:"UsageData,omitempty"` +} + +// UsageData Usage details about the volume. This information is used by the +// `GET /system/df` endpoint, and omitted in other endpoints. +// +// swagger:model UsageData +type UsageData struct { + + // The number of containers referencing this volume. This field + // is set to `-1` if the reference-count is not available. + // + // Required: true + RefCount int64 `json:"RefCount"` + + // Amount of disk space used by the volume (in bytes). This information + // is only available for volumes created with the `"local"` volume + // driver. For volumes created with other volume drivers, this field + // is set to `-1` ("not available") + // + // Required: true + Size int64 `json:"Size"` +} diff --git a/vendor/github.com/moby/moby/client/LICENSE b/vendor/github.com/moby/moby/client/LICENSE new file mode 100644 index 00000000..d6456956 --- /dev/null +++ b/vendor/github.com/moby/moby/client/LICENSE @@ -0,0 +1,202 @@ + + Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + + TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + + 1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + + 2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + + 3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + + 4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + + 5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + + 6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + + 7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + + 8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + + 9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + + END OF TERMS AND CONDITIONS + + APPENDIX: How to apply the Apache License to your work. + + To apply the Apache License to your work, attach the following + boilerplate notice, with the fields enclosed by brackets "[]" + replaced with your own identifying information. (Don't include + the brackets!) The text should be enclosed in the appropriate + comment syntax for the file format. We also recommend that a + file or class name and description of purpose be included on the + same "printed page" as the copyright notice for easier + identification within third-party archives. + + Copyright [yyyy] [name of copyright owner] + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. diff --git a/vendor/github.com/moby/moby/client/README.md b/vendor/github.com/moby/moby/client/README.md new file mode 100644 index 00000000..aed3e641 --- /dev/null +++ b/vendor/github.com/moby/moby/client/README.md @@ -0,0 +1,57 @@ +# Go client for the Docker Engine API + +[![PkgGoDev](https://pkg.go.dev/badge/github.com/moby/moby/client)](https://pkg.go.dev/github.com/moby/moby/client) +![GitHub License](https://img.shields.io/github/license/moby/moby) +[![Go Report Card](https://goreportcard.com/badge/github.com/moby/moby/client)](https://goreportcard.com/report/github.com/moby/moby/client) +[![OpenSSF Scorecard](https://api.scorecard.dev/projects/github.com/moby/moby/badge)](https://scorecard.dev/viewer/?uri=github.com/moby/moby) +[![OpenSSF Best Practices](https://www.bestpractices.dev/projects/10989/badge)](https://www.bestpractices.dev/projects/10989) + +The `docker` command uses this package to communicate with the daemon. It can +also be used by your own Go applications to do anything the command-line +interface does; running containers, pulling or pushing images, etc. + +For example, to list all containers (the equivalent of `docker ps --all`): + +```go +package main + +import ( + "context" + "fmt" + + "github.com/moby/moby/client" +) + +func main() { + // Create a new client with "client.FromEnv" (configuring the client + // from commonly used environment variables such as DOCKER_HOST and + // DOCKER_API_VERSION) and set a custom User-Agent. + // + // API-version negotiation is enabled by default to allow downgrading + // the API version when connecting with an older daemon version. + apiClient, err := client.New( + client.FromEnv, + client.WithUserAgent("my-application/1.0.0"), + ) + if err != nil { + panic(err) + } + defer apiClient.Close() + + // List all containers (both stopped and running). + result, err := apiClient.ContainerList(context.Background(), client.ContainerListOptions{ + All: true, + }) + if err != nil { + panic(err) + } + + // Print each container's ID, status and the image it was created from. + fmt.Printf("%s %-22s %s\n", "ID", "STATUS", "IMAGE") + for _, ctr := range result.Items { + fmt.Printf("%s %-22s %s\n", ctr.ID, ctr.Status, ctr.Image) + } +} +``` + +Full documentation is available on [pkg.go.dev](https://pkg.go.dev/github.com/moby/moby/client). diff --git a/vendor/github.com/moby/moby/client/auth.go b/vendor/github.com/moby/moby/client/auth.go new file mode 100644 index 00000000..8baf39d2 --- /dev/null +++ b/vendor/github.com/moby/moby/client/auth.go @@ -0,0 +1,14 @@ +package client + +import ( + "context" + + "github.com/moby/moby/api/types/registry" +) + +// staticAuth creates a privilegeFn from the given registryAuth. +func staticAuth(registryAuth string) registry.RequestAuthConfig { + return func(ctx context.Context) (string, error) { + return registryAuth, nil + } +} diff --git a/vendor/github.com/moby/moby/client/build_cancel.go b/vendor/github.com/moby/moby/client/build_cancel.go new file mode 100644 index 00000000..a31dced9 --- /dev/null +++ b/vendor/github.com/moby/moby/client/build_cancel.go @@ -0,0 +1,23 @@ +package client + +import ( + "context" + "net/url" +) + +// BuildCancelOptions holds options for [Client.BuildCancel]. +type BuildCancelOptions struct{} + +// BuildCancelResult holds the result of [Client.BuildCancel]. +type BuildCancelResult struct{} + +// BuildCancel requests the daemon to cancel the ongoing build request +// with the given id. +func (cli *Client) BuildCancel(ctx context.Context, id string, _ BuildCancelOptions) (BuildCancelResult, error) { + query := url.Values{} + query.Set("id", id) + + resp, err := cli.post(ctx, "/build/cancel", query, nil, nil) + defer ensureReaderClosed(resp) + return BuildCancelResult{}, err +} diff --git a/vendor/github.com/moby/moby/client/build_prune.go b/vendor/github.com/moby/moby/client/build_prune.go new file mode 100644 index 00000000..a22e9685 --- /dev/null +++ b/vendor/github.com/moby/moby/client/build_prune.go @@ -0,0 +1,67 @@ +package client + +import ( + "context" + "encoding/json" + "fmt" + "net/url" + "strconv" + + "github.com/moby/moby/api/types/build" + "github.com/moby/moby/client/pkg/versions" +) + +// BuildCachePruneOptions hold parameters to prune the build cache. +type BuildCachePruneOptions struct { + All bool + ReservedSpace int64 + MaxUsedSpace int64 + MinFreeSpace int64 + Filters Filters +} + +// BuildCachePruneResult holds the result from the BuildCachePrune method. +type BuildCachePruneResult struct { + Report build.CachePruneReport +} + +// BuildCachePrune requests the daemon to delete unused cache data. +func (cli *Client) BuildCachePrune(ctx context.Context, opts BuildCachePruneOptions) (BuildCachePruneResult, error) { + var out BuildCachePruneResult + query := url.Values{} + if opts.All { + query.Set("all", "1") + } + + if opts.ReservedSpace != 0 { + // Prior to API v1.48, 'keep-storage' was used to set the reserved space for the build cache. + // TODO(austinvazquez): remove once API v1.47 is no longer supported. See https://github.com/moby/moby/issues/50902 + if versions.LessThanOrEqualTo(cli.version, "1.47") { + query.Set("keep-storage", strconv.Itoa(int(opts.ReservedSpace))) + } else { + query.Set("reserved-space", strconv.Itoa(int(opts.ReservedSpace))) + } + } + if opts.MaxUsedSpace != 0 { + query.Set("max-used-space", strconv.Itoa(int(opts.MaxUsedSpace))) + } + if opts.MinFreeSpace != 0 { + query.Set("min-free-space", strconv.Itoa(int(opts.MinFreeSpace))) + } + opts.Filters.updateURLValues(query) + + resp, err := cli.post(ctx, "/build/prune", query, nil, nil) + defer ensureReaderClosed(resp) + + if err != nil { + return BuildCachePruneResult{}, err + } + + report := build.CachePruneReport{} + if err := json.NewDecoder(resp.Body).Decode(&report); err != nil { + return BuildCachePruneResult{}, fmt.Errorf("error retrieving disk usage: %w", err) + } + + out.Report = report + return out, nil +} diff --git a/vendor/github.com/moby/moby/client/checkpoint_create.go b/vendor/github.com/moby/moby/client/checkpoint_create.go new file mode 100644 index 00000000..b3ba5459 --- /dev/null +++ b/vendor/github.com/moby/moby/client/checkpoint_create.go @@ -0,0 +1,36 @@ +package client + +import ( + "context" + + "github.com/moby/moby/api/types/checkpoint" +) + +// CheckpointCreateOptions holds parameters to create a checkpoint from a container. +type CheckpointCreateOptions struct { + CheckpointID string + CheckpointDir string + Exit bool +} + +// CheckpointCreateResult holds the result from [client.CheckpointCreate]. +type CheckpointCreateResult struct { + // Add future fields here +} + +// CheckpointCreate creates a checkpoint from the given container. +func (cli *Client) CheckpointCreate(ctx context.Context, containerID string, options CheckpointCreateOptions) (CheckpointCreateResult, error) { + containerID, err := trimID("container", containerID) + if err != nil { + return CheckpointCreateResult{}, err + } + requestBody := checkpoint.CreateRequest{ + CheckpointID: options.CheckpointID, + CheckpointDir: options.CheckpointDir, + Exit: options.Exit, + } + + resp, err := cli.post(ctx, "/containers/"+containerID+"/checkpoints", nil, requestBody, nil) + defer ensureReaderClosed(resp) + return CheckpointCreateResult{}, err +} diff --git a/vendor/github.com/moby/moby/client/checkpoint_list.go b/vendor/github.com/moby/moby/client/checkpoint_list.go new file mode 100644 index 00000000..5815f836 --- /dev/null +++ b/vendor/github.com/moby/moby/client/checkpoint_list.go @@ -0,0 +1,38 @@ +package client + +import ( + "context" + "encoding/json" + "net/url" + + "github.com/moby/moby/api/types/checkpoint" +) + +// CheckpointListOptions holds parameters to list checkpoints for a container. +type CheckpointListOptions struct { + CheckpointDir string +} + +// CheckpointListResult holds the result from the CheckpointList method. +type CheckpointListResult struct { + Items []checkpoint.Summary +} + +// CheckpointList returns the checkpoints of the given container in the docker host. +func (cli *Client) CheckpointList(ctx context.Context, container string, options CheckpointListOptions) (CheckpointListResult, error) { + var out CheckpointListResult + + query := url.Values{} + if options.CheckpointDir != "" { + query.Set("dir", options.CheckpointDir) + } + + resp, err := cli.get(ctx, "/containers/"+container+"/checkpoints", query, nil) + defer ensureReaderClosed(resp) + if err != nil { + return out, err + } + + err = json.NewDecoder(resp.Body).Decode(&out.Items) + return out, err +} diff --git a/vendor/github.com/moby/moby/client/checkpoint_remove.go b/vendor/github.com/moby/moby/client/checkpoint_remove.go new file mode 100644 index 00000000..8042c508 --- /dev/null +++ b/vendor/github.com/moby/moby/client/checkpoint_remove.go @@ -0,0 +1,34 @@ +package client + +import ( + "context" + "net/url" +) + +// CheckpointRemoveOptions holds parameters to delete a checkpoint from a container. +type CheckpointRemoveOptions struct { + CheckpointID string + CheckpointDir string +} + +// CheckpointRemoveResult represents the result of [Client.CheckpointRemove]. +type CheckpointRemoveResult struct { + // No fields currently; placeholder for future use. +} + +// CheckpointRemove deletes the checkpoint with the given name from the given container. +func (cli *Client) CheckpointRemove(ctx context.Context, containerID string, options CheckpointRemoveOptions) (CheckpointRemoveResult, error) { + containerID, err := trimID("container", containerID) + if err != nil { + return CheckpointRemoveResult{}, err + } + + query := url.Values{} + if options.CheckpointDir != "" { + query.Set("dir", options.CheckpointDir) + } + + resp, err := cli.delete(ctx, "/containers/"+containerID+"/checkpoints/"+options.CheckpointID, query, nil) + defer ensureReaderClosed(resp) + return CheckpointRemoveResult{}, err +} diff --git a/vendor/github.com/moby/moby/client/client.go b/vendor/github.com/moby/moby/client/client.go new file mode 100644 index 00000000..89ba88ee --- /dev/null +++ b/vendor/github.com/moby/moby/client/client.go @@ -0,0 +1,455 @@ +/* +Package client is a Go client for the Docker Engine API. + +For more information about the Engine API, see the documentation: +https://docs.docker.com/reference/api/engine/ + +# Usage + +You use the library by constructing a client object using [New] +and calling methods on it. The client can be configured from environment +variables by passing the [FromEnv] option. Other options can be configured +manually by passing any of the available [Opt] options. + +For example, to list running containers (the equivalent of "docker ps"): + + package main + + import ( + "context" + "fmt" + "log" + + "github.com/moby/moby/client" + ) + + func main() { + // Create a new client that handles common environment variables + // for configuration (DOCKER_HOST, DOCKER_API_VERSION), and does + // API-version negotiation to allow downgrading the API version + // when connecting with an older daemon version. + apiClient, err := client.New(client.FromEnv) + if err != nil { + log.Fatal(err) + } + + // List all containers (both stopped and running). + result, err := apiClient.ContainerList(context.Background(), client.ContainerListOptions{ + All: true, + }) + if err != nil { + log.Fatal(err) + } + + // Print each container's ID, status and the image it was created from. + fmt.Printf("%s %-22s %s\n", "ID", "STATUS", "IMAGE") + for _, ctr := range result.Items { + fmt.Printf("%s %-22s %s\n", ctr.ID, ctr.Status, ctr.Image) + } + } +*/ +package client + +import ( + "context" + "crypto/tls" + "errors" + "fmt" + "net" + "net/http" + "net/url" + "path" + "runtime" + "slices" + "strings" + "sync" + "sync/atomic" + "time" + + cerrdefs "github.com/containerd/errdefs" + "github.com/docker/go-connections/sockets" + "github.com/moby/moby/client/internal/mod" + "github.com/moby/moby/client/pkg/versions" + "go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp" +) + +// DummyHost is a hostname used for local communication. +// +// It acts as a valid formatted hostname for local connections (such as "unix://" +// or "npipe://") which do not require a hostname. It should never be resolved, +// but uses the special-purpose ".localhost" TLD (as defined in [RFC 2606, Section 2] +// and [RFC 6761, Section 6.3]). +// +// [RFC 7230, Section 5.4] defines that an empty header must be used for such +// cases: +// +// If the authority component is missing or undefined for the target URI, +// then a client MUST send a Host header field with an empty field-value. +// +// However, [Go stdlib] enforces the semantics of HTTP(S) over TCP, does not +// allow an empty header to be used, and requires req.URL.Scheme to be either +// "http" or "https". +// +// For further details, refer to: +// +// - https://github.com/docker/engine-api/issues/189 +// - https://github.com/golang/go/issues/13624 +// - https://github.com/golang/go/issues/61076 +// - https://github.com/moby/moby/issues/45935 +// +// [RFC 2606, Section 2]: https://www.rfc-editor.org/rfc/rfc2606.html#section-2 +// [RFC 6761, Section 6.3]: https://www.rfc-editor.org/rfc/rfc6761#section-6.3 +// [RFC 7230, Section 5.4]: https://datatracker.ietf.org/doc/html/rfc7230#section-5.4 +// [Go stdlib]: https://github.com/golang/go/blob/6244b1946bc2101b01955468f1be502dbadd6807/src/net/http/transport.go#L558-L569 +const DummyHost = "api.moby.localhost" + +// MaxAPIVersion is the highest REST API version supported by the client. +// If API-version negotiation is enabled, the client may downgrade its API version. +// Similarly, the [WithAPIVersion] and [WithAPIVersionFromEnv] options allow +// overriding the version and disable API-version negotiation. +// +// This version may be lower than the version of the api library module used. +const MaxAPIVersion = "1.54" + +// MinAPIVersion is the minimum API version supported by the client. API versions +// below this version are not considered when performing API-version negotiation. +const MinAPIVersion = "1.40" + +// defaultUserAgent returns the default User-Agent to use if none is set. +// It defaults to "moby-client/ os/arch" +var defaultUserAgent = sync.OnceValue(userAgent) + +// Ensure that Client always implements APIClient. +var _ APIClient = &Client{} + +// Client is the API client that performs all operations +// against a docker server. +type Client struct { + clientConfig + + // negotiated indicates that API version negotiation took place + negotiated atomic.Bool + + // negotiateLock is used to single-flight the version negotiation process + negotiateLock sync.Mutex + + // When the client transport is an *http.Transport (default) we need to do some extra things (like closing idle connections). + // Store the original transport as the http.Client transport will be wrapped with tracing libs. + baseTransport *http.Transport +} + +// ErrRedirect is the error returned by checkRedirect when the request is non-GET. +var ErrRedirect = errors.New("unexpected redirect in response") + +// CheckRedirect specifies the policy for dealing with redirect responses. It +// can be set on [http.Client.CheckRedirect] to prevent HTTP redirects for +// non-GET requests. It returns an [ErrRedirect] for non-GET request, otherwise +// returns a [http.ErrUseLastResponse], which is special-cased by http.Client +// to use the last response. +// +// Go 1.8 changed behavior for HTTP redirects (specifically 301, 307, and 308) +// in the client. The client (and by extension API client) can be made to send +// a request like "POST /containers//start" where what would normally be in the +// name section of the URL is empty. This triggers an HTTP 301 from the daemon. +// +// In go 1.8 this 301 is converted to a GET request, and ends up getting +// a 404 from the daemon. This behavior change manifests in the client in that +// before, the 301 was not followed and the client did not generate an error, +// but now results in a message like "Error response from daemon: page not found". +func CheckRedirect(_ *http.Request, via []*http.Request) error { + if via[0].Method == http.MethodGet { + return http.ErrUseLastResponse + } + return ErrRedirect +} + +// NewClientWithOpts initializes a new API client. +// +// Deprecated: use [New]. This function will be removed in the next release. +// +//go:fix inline +func NewClientWithOpts(ops ...Opt) (*Client, error) { + return New(ops...) +} + +// New initializes a new API client with a default HTTPClient, and +// default API host and version. It also initializes the custom HTTP headers to +// add to each request. +// +// It takes an optional list of [Opt] functional arguments, which are applied in +// the order they're provided, which allows modifying the defaults when creating +// the client. For example, the following initializes a client that configures +// itself with values from environment variables ([FromEnv]). +// +// By default, the client automatically negotiates the API version to use when +// making requests. API version negotiation is performed on the first request; +// subsequent requests do not re-negotiate. Use [WithAPIVersion] or +// [WithAPIVersionFromEnv] to configure the client with a fixed API version +// and disable API version negotiation. +// +// cli, err := client.New(client.FromEnv) +func New(ops ...Opt) (*Client, error) { + hostURL, err := ParseHostURL(DefaultDockerHost) + if err != nil { + return nil, err + } + + client, err := defaultHTTPClient(hostURL) + if err != nil { + return nil, err + } + c := &Client{ + clientConfig: clientConfig{ + host: DefaultDockerHost, + version: MaxAPIVersion, + client: client, + proto: hostURL.Scheme, + addr: hostURL.Host, + traceOpts: []otelhttp.Option{ + otelhttp.WithSpanNameFormatter(func(_ string, req *http.Request) string { + return req.Method + " " + req.URL.Path + }), + }, + }, + } + cfg := &c.clientConfig + + for _, op := range ops { + if op == nil { + continue + } + if err := op(cfg); err != nil { + return nil, err + } + } + + if cfg.envAPIVersion != "" { + c.setAPIVersion(cfg.envAPIVersion) + } else if cfg.manualAPIVersion != "" { + c.setAPIVersion(cfg.manualAPIVersion) + } + + if tr, ok := c.client.Transport.(*http.Transport); ok { + // Store the base transport before we wrap it in tracing libs below + // This is used, as an example, to close idle connections when the client is closed + c.baseTransport = tr + } + + if c.scheme == "" { + // TODO(stevvooe): This isn't really the right way to write clients in Go. + // `NewClient` should probably only take an `*http.Client` and work from there. + // Unfortunately, the model of having a host-ish/url-thingy as the connection + // string has us confusing protocol and transport layers. We continue doing + // this to avoid breaking existing clients but this should be addressed. + if c.tlsConfig() != nil { + c.scheme = "https" + } else { + c.scheme = "http" + } + } + + c.client.Transport = otelhttp.NewTransport(c.client.Transport, c.traceOpts...) + + if len(cfg.responseHooks) > 0 { + c.client.Transport = &responseHookTransport{ + base: c.client.Transport, + hooks: slices.Clone(cfg.responseHooks), + } + } + + return c, nil +} + +func (cli *Client) tlsConfig() *tls.Config { + if cli.baseTransport == nil { + return nil + } + return cli.baseTransport.TLSClientConfig +} + +func defaultHTTPClient(hostURL *url.URL) (*http.Client, error) { + transport := &http.Transport{} + // Necessary to prevent long-lived processes using the + // client from leaking connections due to idle connections + // not being released. + // TODO: see if we can also address this from the server side, + // or in go-connections. + // see: https://github.com/moby/moby/issues/45539 + transport.MaxIdleConns = 6 + transport.IdleConnTimeout = 30 * time.Second + err := sockets.ConfigureTransport(transport, hostURL.Scheme, hostURL.Host) + if err != nil { + return nil, err + } + return &http.Client{ + Transport: transport, + CheckRedirect: CheckRedirect, + }, nil +} + +// Close the transport used by the client +func (cli *Client) Close() error { + if cli.baseTransport != nil { + cli.baseTransport.CloseIdleConnections() + return nil + } + return nil +} + +// checkVersion manually triggers API version negotiation (if configured). +// This allows for version-dependent code to use the same version as will +// be negotiated when making the actual requests, and for which cases +// we cannot do the negotiation lazily. +func (cli *Client) checkVersion(ctx context.Context) error { + if cli.negotiated.Load() { + return nil + } + _, err := cli.Ping(ctx, PingOptions{ + NegotiateAPIVersion: true, + }) + return err +} + +// getAPIPath returns the versioned request path to call the API. +// It appends the query parameters to the path if they are not empty. +func (cli *Client) getAPIPath(ctx context.Context, p string, query url.Values) string { + var apiPath string + _ = cli.checkVersion(ctx) + if cli.version != "" { + apiPath = path.Join(cli.basePath, "/v"+strings.TrimPrefix(cli.version, "v"), p) + } else { + apiPath = path.Join(cli.basePath, p) + } + return (&url.URL{Path: apiPath, RawQuery: query.Encode()}).String() +} + +// ClientVersion returns the API version used by this client. +func (cli *Client) ClientVersion() string { + return cli.version +} + +// negotiateAPIVersion updates the version to match the API version from +// the ping response. +// +// It returns an error if version is invalid, or lower than the minimum +// supported API version in which case the client's API version is not +// updated, and negotiation is not marked as completed. +func (cli *Client) negotiateAPIVersion(pingVersion string) error { + var err error + pingVersion, err = parseAPIVersion(pingVersion) + if err != nil { + return err + } + + if versions.LessThan(pingVersion, MinAPIVersion) { + return cerrdefs.ErrInvalidArgument.WithMessage(fmt.Sprintf("API version %s is not supported by this client: the minimum supported API version is %s", pingVersion, MinAPIVersion)) + } + + // if the client is not initialized with a version, start with the latest supported version + negotiatedVersion := cli.version + if negotiatedVersion == "" { + negotiatedVersion = MaxAPIVersion + } + + // if server version is lower than the client version, downgrade + if versions.LessThan(pingVersion, negotiatedVersion) { + negotiatedVersion = pingVersion + } + + // Store the results, so that automatic API version negotiation (if enabled) + // won't be performed on the next request. + cli.setAPIVersion(negotiatedVersion) + return nil +} + +// setAPIVersion sets the client's API version and marks API version negotiation +// as completed, so that automatic API version negotiation (if enabled) won't +// be performed on the next request. +func (cli *Client) setAPIVersion(version string) { + cli.version = version + cli.negotiated.Store(true) +} + +// DaemonHost returns the host address used by the client +func (cli *Client) DaemonHost() string { + return cli.host +} + +// ParseHostURL parses a url string, validates the string is a host url, and +// returns the parsed URL +func ParseHostURL(host string) (*url.URL, error) { + proto, addr, ok := strings.Cut(host, "://") + if !ok || addr == "" { + return nil, fmt.Errorf("unable to parse docker host `%s`", host) + } + + var basePath string + if proto == "tcp" { + parsed, err := url.Parse("tcp://" + addr) + if err != nil { + return nil, err + } + addr = parsed.Host + basePath = parsed.Path + } + return &url.URL{ + Scheme: proto, + Host: addr, + Path: basePath, + }, nil +} + +func (cli *Client) dialerFromTransport() func(context.Context, string, string) (net.Conn, error) { + if cli.baseTransport == nil || cli.baseTransport.DialContext == nil { + return nil + } + + if cli.baseTransport.TLSClientConfig != nil { + // When using a tls config we don't use the configured dialer but instead a fallback dialer... + // Note: It seems like this should use the normal dialer and wrap the returned net.Conn in a tls.Conn + // I honestly don't know why it doesn't do that, but it doesn't and such a change is entirely unrelated to the change in this commit. + return nil + } + return cli.baseTransport.DialContext +} + +// Dialer returns a dialer for a raw stream connection, with an HTTP/1.1 header, +// that can be used for proxying the daemon connection. It is used by +// ["docker dial-stdio"]. +// +// ["docker dial-stdio"]: https://github.com/docker/cli/pull/1014 +func (cli *Client) Dialer() func(context.Context) (net.Conn, error) { + return cli.dialer() +} + +func (cli *Client) dialer() func(context.Context) (net.Conn, error) { + return func(ctx context.Context) (net.Conn, error) { + if dialFn := cli.dialerFromTransport(); dialFn != nil { + return dialFn(ctx, cli.proto, cli.addr) + } + switch cli.proto { + case "unix": + return net.Dial(cli.proto, cli.addr) + case "npipe": + ctx, cancel := context.WithTimeout(ctx, 32*time.Second) + defer cancel() + return dialPipeContext(ctx, cli.addr) + default: + if tlsConfig := cli.tlsConfig(); tlsConfig != nil { + return tls.Dial(cli.proto, cli.addr, tlsConfig) + } + return net.Dial(cli.proto, cli.addr) + } + } +} + +func userAgent() string { + const defaultVersion = "v0.0.0+unknown" + const moduleName = "github.com/moby/moby/client" + + version := defaultVersion + if v := mod.Version(moduleName); v != "" { + version = v + } + return "moby-client/" + version + " " + runtime.GOOS + "/" + runtime.GOARCH +} diff --git a/vendor/github.com/moby/moby/client/client_interfaces.go b/vendor/github.com/moby/moby/client/client_interfaces.go new file mode 100644 index 00000000..4bbd45a6 --- /dev/null +++ b/vendor/github.com/moby/moby/client/client_interfaces.go @@ -0,0 +1,242 @@ +package client + +import ( + "context" + "io" + "net" +) + +// APIClient is an interface that clients that talk with a docker server must implement. +type APIClient interface { + stableAPIClient + CheckpointAPIClient // CheckpointAPIClient is still experimental. +} + +type stableAPIClient interface { + ConfigAPIClient + ContainerAPIClient + DistributionAPIClient + RegistrySearchClient + ExecAPIClient + ImageBuildAPIClient + ImageAPIClient + NetworkAPIClient + PluginAPIClient + SystemAPIClient + VolumeAPIClient + ClientVersion() string + DaemonHost() string + ServerVersion(ctx context.Context, options ServerVersionOptions) (ServerVersionResult, error) + HijackDialer + Dialer() func(context.Context) (net.Conn, error) + Close() error + SwarmManagementAPIClient +} + +// SwarmManagementAPIClient defines all methods for managing Swarm-specific +// objects. +type SwarmManagementAPIClient interface { + SwarmAPIClient + NodeAPIClient + ServiceAPIClient + TaskAPIClient + SecretAPIClient + ConfigAPIClient +} + +// HijackDialer defines methods for a hijack dialer. +type HijackDialer interface { + DialHijack(ctx context.Context, url, proto string, meta map[string][]string) (net.Conn, error) +} + +// CheckpointAPIClient defines API client methods for the checkpoints. +// +// Experimental: checkpoint and restore is still an experimental feature, +// and only available if the daemon is running with experimental features +// enabled. +type CheckpointAPIClient interface { + CheckpointCreate(ctx context.Context, container string, options CheckpointCreateOptions) (CheckpointCreateResult, error) + CheckpointRemove(ctx context.Context, container string, options CheckpointRemoveOptions) (CheckpointRemoveResult, error) + CheckpointList(ctx context.Context, container string, options CheckpointListOptions) (CheckpointListResult, error) +} + +// ContainerAPIClient defines API client methods for the containers +type ContainerAPIClient interface { + ContainerCreate(ctx context.Context, options ContainerCreateOptions) (ContainerCreateResult, error) + ContainerInspect(ctx context.Context, container string, options ContainerInspectOptions) (ContainerInspectResult, error) + ContainerList(ctx context.Context, options ContainerListOptions) (ContainerListResult, error) + ContainerUpdate(ctx context.Context, container string, updateConfig ContainerUpdateOptions) (ContainerUpdateResult, error) + ContainerRemove(ctx context.Context, container string, options ContainerRemoveOptions) (ContainerRemoveResult, error) + ContainerPrune(ctx context.Context, opts ContainerPruneOptions) (ContainerPruneResult, error) + + ContainerLogs(ctx context.Context, container string, options ContainerLogsOptions) (ContainerLogsResult, error) + + ContainerStart(ctx context.Context, container string, options ContainerStartOptions) (ContainerStartResult, error) + ContainerStop(ctx context.Context, container string, options ContainerStopOptions) (ContainerStopResult, error) + ContainerRestart(ctx context.Context, container string, options ContainerRestartOptions) (ContainerRestartResult, error) + ContainerPause(ctx context.Context, container string, options ContainerPauseOptions) (ContainerPauseResult, error) + ContainerUnpause(ctx context.Context, container string, options ContainerUnpauseOptions) (ContainerUnpauseResult, error) + ContainerWait(ctx context.Context, container string, options ContainerWaitOptions) ContainerWaitResult + ContainerKill(ctx context.Context, container string, options ContainerKillOptions) (ContainerKillResult, error) + + ContainerRename(ctx context.Context, container string, options ContainerRenameOptions) (ContainerRenameResult, error) + ContainerResize(ctx context.Context, container string, options ContainerResizeOptions) (ContainerResizeResult, error) + ContainerAttach(ctx context.Context, container string, options ContainerAttachOptions) (ContainerAttachResult, error) + ContainerCommit(ctx context.Context, container string, options ContainerCommitOptions) (ContainerCommitResult, error) + ContainerDiff(ctx context.Context, container string, options ContainerDiffOptions) (ContainerDiffResult, error) + ContainerExport(ctx context.Context, container string, options ContainerExportOptions) (ContainerExportResult, error) + + ContainerStats(ctx context.Context, container string, options ContainerStatsOptions) (ContainerStatsResult, error) + ContainerTop(ctx context.Context, container string, options ContainerTopOptions) (ContainerTopResult, error) + + ContainerStatPath(ctx context.Context, container string, options ContainerStatPathOptions) (ContainerStatPathResult, error) + CopyFromContainer(ctx context.Context, container string, options CopyFromContainerOptions) (CopyFromContainerResult, error) + CopyToContainer(ctx context.Context, container string, options CopyToContainerOptions) (CopyToContainerResult, error) +} + +type ExecAPIClient interface { + ExecCreate(ctx context.Context, container string, options ExecCreateOptions) (ExecCreateResult, error) + ExecInspect(ctx context.Context, execID string, options ExecInspectOptions) (ExecInspectResult, error) + ExecResize(ctx context.Context, execID string, options ExecResizeOptions) (ExecResizeResult, error) + + ExecStart(ctx context.Context, execID string, options ExecStartOptions) (ExecStartResult, error) + ExecAttach(ctx context.Context, execID string, options ExecAttachOptions) (ExecAttachResult, error) +} + +// DistributionAPIClient defines API client methods for the registry +type DistributionAPIClient interface { + DistributionInspect(ctx context.Context, image string, options DistributionInspectOptions) (DistributionInspectResult, error) +} + +type RegistrySearchClient interface { + ImageSearch(ctx context.Context, term string, options ImageSearchOptions) (ImageSearchResult, error) +} + +// ImageBuildAPIClient defines API client methods for building images +// using the REST API. +type ImageBuildAPIClient interface { + ImageBuild(ctx context.Context, context io.Reader, options ImageBuildOptions) (ImageBuildResult, error) + BuildCachePrune(ctx context.Context, opts BuildCachePruneOptions) (BuildCachePruneResult, error) + BuildCancel(ctx context.Context, id string, opts BuildCancelOptions) (BuildCancelResult, error) +} + +// ImageAPIClient defines API client methods for the images +type ImageAPIClient interface { + ImageImport(ctx context.Context, source ImageImportSource, ref string, options ImageImportOptions) (ImageImportResult, error) + + ImageList(ctx context.Context, options ImageListOptions) (ImageListResult, error) + ImagePull(ctx context.Context, ref string, options ImagePullOptions) (ImagePullResponse, error) + ImagePush(ctx context.Context, ref string, options ImagePushOptions) (ImagePushResponse, error) + ImageRemove(ctx context.Context, image string, options ImageRemoveOptions) (ImageRemoveResult, error) + ImageTag(ctx context.Context, options ImageTagOptions) (ImageTagResult, error) + ImagePrune(ctx context.Context, opts ImagePruneOptions) (ImagePruneResult, error) + + ImageInspect(ctx context.Context, image string, _ ...ImageInspectOption) (ImageInspectResult, error) + ImageHistory(ctx context.Context, image string, _ ...ImageHistoryOption) (ImageHistoryResult, error) + + ImageLoad(ctx context.Context, input io.Reader, _ ...ImageLoadOption) (ImageLoadResult, error) + ImageSave(ctx context.Context, images []string, _ ...ImageSaveOption) (ImageSaveResult, error) +} + +// NetworkAPIClient defines API client methods for the networks +type NetworkAPIClient interface { + NetworkCreate(ctx context.Context, name string, options NetworkCreateOptions) (NetworkCreateResult, error) + NetworkInspect(ctx context.Context, network string, options NetworkInspectOptions) (NetworkInspectResult, error) + NetworkList(ctx context.Context, options NetworkListOptions) (NetworkListResult, error) + NetworkRemove(ctx context.Context, network string, options NetworkRemoveOptions) (NetworkRemoveResult, error) + NetworkPrune(ctx context.Context, opts NetworkPruneOptions) (NetworkPruneResult, error) + + NetworkConnect(ctx context.Context, network string, options NetworkConnectOptions) (NetworkConnectResult, error) + NetworkDisconnect(ctx context.Context, network string, options NetworkDisconnectOptions) (NetworkDisconnectResult, error) +} + +// NodeAPIClient defines API client methods for the nodes +type NodeAPIClient interface { + NodeInspect(ctx context.Context, nodeID string, options NodeInspectOptions) (NodeInspectResult, error) + NodeList(ctx context.Context, options NodeListOptions) (NodeListResult, error) + NodeUpdate(ctx context.Context, nodeID string, options NodeUpdateOptions) (NodeUpdateResult, error) + NodeRemove(ctx context.Context, nodeID string, options NodeRemoveOptions) (NodeRemoveResult, error) +} + +// PluginAPIClient defines API client methods for the plugins +type PluginAPIClient interface { + PluginCreate(ctx context.Context, createContext io.Reader, options PluginCreateOptions) (PluginCreateResult, error) + PluginInstall(ctx context.Context, name string, options PluginInstallOptions) (PluginInstallResult, error) + PluginInspect(ctx context.Context, name string, options PluginInspectOptions) (PluginInspectResult, error) + PluginList(ctx context.Context, options PluginListOptions) (PluginListResult, error) + PluginRemove(ctx context.Context, name string, options PluginRemoveOptions) (PluginRemoveResult, error) + + PluginEnable(ctx context.Context, name string, options PluginEnableOptions) (PluginEnableResult, error) + PluginDisable(ctx context.Context, name string, options PluginDisableOptions) (PluginDisableResult, error) + PluginUpgrade(ctx context.Context, name string, options PluginUpgradeOptions) (PluginUpgradeResult, error) + PluginPush(ctx context.Context, name string, options PluginPushOptions) (PluginPushResult, error) + PluginSet(ctx context.Context, name string, options PluginSetOptions) (PluginSetResult, error) +} + +// ServiceAPIClient defines API client methods for the services +type ServiceAPIClient interface { + ServiceCreate(ctx context.Context, options ServiceCreateOptions) (ServiceCreateResult, error) + ServiceInspect(ctx context.Context, serviceID string, options ServiceInspectOptions) (ServiceInspectResult, error) + ServiceList(ctx context.Context, options ServiceListOptions) (ServiceListResult, error) + ServiceUpdate(ctx context.Context, serviceID string, options ServiceUpdateOptions) (ServiceUpdateResult, error) + ServiceRemove(ctx context.Context, serviceID string, options ServiceRemoveOptions) (ServiceRemoveResult, error) + + ServiceLogs(ctx context.Context, serviceID string, options ServiceLogsOptions) (ServiceLogsResult, error) +} + +// TaskAPIClient defines API client methods to manage swarm tasks. +type TaskAPIClient interface { + TaskInspect(ctx context.Context, taskID string, options TaskInspectOptions) (TaskInspectResult, error) + TaskList(ctx context.Context, options TaskListOptions) (TaskListResult, error) + + TaskLogs(ctx context.Context, taskID string, options TaskLogsOptions) (TaskLogsResult, error) +} + +// SwarmAPIClient defines API client methods for the swarm +type SwarmAPIClient interface { + SwarmInit(ctx context.Context, options SwarmInitOptions) (SwarmInitResult, error) + SwarmJoin(ctx context.Context, options SwarmJoinOptions) (SwarmJoinResult, error) + SwarmInspect(ctx context.Context, options SwarmInspectOptions) (SwarmInspectResult, error) + SwarmUpdate(ctx context.Context, options SwarmUpdateOptions) (SwarmUpdateResult, error) + SwarmLeave(ctx context.Context, options SwarmLeaveOptions) (SwarmLeaveResult, error) + + SwarmGetUnlockKey(ctx context.Context) (SwarmGetUnlockKeyResult, error) + SwarmUnlock(ctx context.Context, options SwarmUnlockOptions) (SwarmUnlockResult, error) +} + +// SystemAPIClient defines API client methods for the system +type SystemAPIClient interface { + Events(ctx context.Context, options EventsListOptions) EventsResult + Info(ctx context.Context, options InfoOptions) (SystemInfoResult, error) + RegistryLogin(ctx context.Context, auth RegistryLoginOptions) (RegistryLoginResult, error) + DiskUsage(ctx context.Context, options DiskUsageOptions) (DiskUsageResult, error) + Ping(ctx context.Context, options PingOptions) (PingResult, error) +} + +// VolumeAPIClient defines API client methods for the volumes +type VolumeAPIClient interface { + VolumeCreate(ctx context.Context, options VolumeCreateOptions) (VolumeCreateResult, error) + VolumeInspect(ctx context.Context, volumeID string, options VolumeInspectOptions) (VolumeInspectResult, error) + VolumeList(ctx context.Context, options VolumeListOptions) (VolumeListResult, error) + VolumeUpdate(ctx context.Context, volumeID string, options VolumeUpdateOptions) (VolumeUpdateResult, error) + VolumeRemove(ctx context.Context, volumeID string, options VolumeRemoveOptions) (VolumeRemoveResult, error) + VolumePrune(ctx context.Context, options VolumePruneOptions) (VolumePruneResult, error) +} + +// SecretAPIClient defines API client methods for secrets +type SecretAPIClient interface { + SecretCreate(ctx context.Context, options SecretCreateOptions) (SecretCreateResult, error) + SecretInspect(ctx context.Context, id string, options SecretInspectOptions) (SecretInspectResult, error) + SecretList(ctx context.Context, options SecretListOptions) (SecretListResult, error) + SecretUpdate(ctx context.Context, id string, options SecretUpdateOptions) (SecretUpdateResult, error) + SecretRemove(ctx context.Context, id string, options SecretRemoveOptions) (SecretRemoveResult, error) +} + +// ConfigAPIClient defines API client methods for configs +type ConfigAPIClient interface { + ConfigCreate(ctx context.Context, options ConfigCreateOptions) (ConfigCreateResult, error) + ConfigInspect(ctx context.Context, id string, options ConfigInspectOptions) (ConfigInspectResult, error) + ConfigList(ctx context.Context, options ConfigListOptions) (ConfigListResult, error) + ConfigUpdate(ctx context.Context, id string, options ConfigUpdateOptions) (ConfigUpdateResult, error) + ConfigRemove(ctx context.Context, id string, options ConfigRemoveOptions) (ConfigRemoveResult, error) +} diff --git a/vendor/github.com/moby/moby/client/client_options.go b/vendor/github.com/moby/moby/client/client_options.go new file mode 100644 index 00000000..39925572 --- /dev/null +++ b/vendor/github.com/moby/moby/client/client_options.go @@ -0,0 +1,427 @@ +package client + +import ( + "context" + "crypto/tls" + "errors" + "fmt" + "net" + "net/http" + "os" + "path/filepath" + "strings" + "time" + + cerrdefs "github.com/containerd/errdefs" + "github.com/docker/go-connections/sockets" + "github.com/docker/go-connections/tlsconfig" + "go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp" + "go.opentelemetry.io/otel/trace" +) + +type clientConfig struct { + // scheme sets the scheme for the client + scheme string + // host holds the server address to connect to + host string + // proto holds the client protocol i.e. unix. + proto string + // addr holds the client address. + addr string + // basePath holds the path to prepend to the requests. + basePath string + // client used to send and receive http requests. + client *http.Client + // version of the server to talk to. + version string + // userAgent is the User-Agent header to use for HTTP requests. It takes + // precedence over User-Agent headers set in customHTTPHeaders, and other + // header variables. When set to an empty string, the User-Agent header + // is removed, and no header is sent. + userAgent *string + // custom HTTP headers configured by users. + customHTTPHeaders map[string]string + + // manualAPIVersion contains the API version set by users. This field + // will only be non-empty if a valid-formed version was set through + // [WithAPIVersion]. + // + // If both manualAPIVersion and envAPIVersion are set, manualAPIVersion + // takes precedence. Either field disables API-version negotiation. + manualAPIVersion string + + // envAPIVersion contains the API version set by users. This field + // will only be non-empty if a valid-formed version was set through + // [WithAPIVersionFromEnv]. + // + // If both manualAPIVersion and envAPIVersion are set, manualAPIVersion + // takes precedence. Either field disables API-version negotiation. + envAPIVersion string + + // responseHooks is a list of custom response hooks to call on responses. + responseHooks []ResponseHook + + // traceOpts is a list of options to configure the tracing span. + traceOpts []otelhttp.Option +} + +// ResponseHook is called for each HTTP response returned by the daemon. +// Hooks are invoked in the order they were added. +// +// Hooks must not read or close resp.Body. +type ResponseHook func(*http.Response) + +// Opt is a configuration option to initialize a [Client]. +type Opt func(*clientConfig) error + +// FromEnv configures the client with values from environment variables. It +// is the equivalent of using the [WithTLSClientConfigFromEnv], [WithHostFromEnv], +// and [WithAPIVersionFromEnv] options. +// +// FromEnv uses the following environment variables: +// +// - DOCKER_HOST ([EnvOverrideHost]) to set the URL to the docker server. +// - DOCKER_API_VERSION ([EnvOverrideAPIVersion]) to set the version of the +// API to use, leave empty for latest. +// - DOCKER_CERT_PATH ([EnvOverrideCertPath]) to specify the directory from +// which to load the TLS certificates ("ca.pem", "cert.pem", "key.pem'). +// - DOCKER_TLS_VERIFY ([EnvTLSVerify]) to enable or disable TLS verification +// (off by default). +func FromEnv(c *clientConfig) error { + ops := []Opt{ + WithTLSClientConfigFromEnv(), + WithHostFromEnv(), + WithAPIVersionFromEnv(), + } + for _, op := range ops { + if err := op(c); err != nil { + return err + } + } + return nil +} + +// WithDialContext applies the dialer to the client transport. This can be +// used to set the Timeout and KeepAlive settings of the client. It returns +// an error if the client does not have a [http.Transport] configured. +func WithDialContext(dialContext func(ctx context.Context, network, addr string) (net.Conn, error)) Opt { + return func(c *clientConfig) error { + if transport, ok := c.client.Transport.(*http.Transport); ok { + transport.DialContext = dialContext + return nil + } + return fmt.Errorf("cannot apply dialer to transport: %T", c.client.Transport) + } +} + +// WithHost overrides the client host with the specified one. +func WithHost(host string) Opt { + return func(c *clientConfig) error { + hostURL, err := ParseHostURL(host) + if err != nil { + return err + } + c.host = host + c.proto = hostURL.Scheme + c.addr = hostURL.Host + c.basePath = hostURL.Path + if transport, ok := c.client.Transport.(*http.Transport); ok { + return sockets.ConfigureTransport(transport, c.proto, c.addr) + } + // For test transports, we skip transport configuration but still + // set the host fields so that the client can use them for headers + if _, ok := c.client.Transport.(testRoundTripper); ok { + return nil + } + return fmt.Errorf("cannot apply host to transport: %T", c.client.Transport) + } +} + +// testRoundTripper allows us to inject a mock-transport for testing. We define it +// here so we can detect the tlsconfig and return nil for only this type. +type testRoundTripper func(*http.Request) (*http.Response, error) + +func (tf testRoundTripper) RoundTrip(req *http.Request) (*http.Response, error) { + return tf(req) +} + +// WithHostFromEnv overrides the client host with the host specified in the +// DOCKER_HOST ([EnvOverrideHost]) environment variable. If DOCKER_HOST is not set, +// or set to an empty value, the host is not modified. +func WithHostFromEnv() Opt { + return func(c *clientConfig) error { + if host := os.Getenv(EnvOverrideHost); host != "" { + return WithHost(host)(c) + } + return nil + } +} + +// WithHTTPClient overrides the client's HTTP client with the specified one. +func WithHTTPClient(client *http.Client) Opt { + return func(c *clientConfig) error { + if client != nil { + // Make a clone of client so modifications do not affect + // the caller's client. Clone here instead of in New() + // as other options (WithHost) also mutate c.client. + // Cloned clients share the same CookieJar as the + // original. + hc := *client + if ht, ok := hc.Transport.(*http.Transport); ok { + hc.Transport = ht.Clone() + } + c.client = &hc + } + return nil + } +} + +// WithTimeout configures the time limit for requests made by the HTTP client. +func WithTimeout(timeout time.Duration) Opt { + return func(c *clientConfig) error { + c.client.Timeout = timeout + return nil + } +} + +// WithUserAgent configures the User-Agent header to use for HTTP requests. +// It overrides any User-Agent set in headers. When set to an empty string, +// the User-Agent header is removed, and no header is sent. +func WithUserAgent(ua string) Opt { + return func(c *clientConfig) error { + c.userAgent = &ua + return nil + } +} + +// WithHTTPHeaders appends custom HTTP headers to the client's default headers. +// It does not allow overriding built-in headers (such as "User-Agent"). +// Also see [WithUserAgent]. +// +// It replaces any existing custom headers. Keys are case-insensitive and +// canonicalized using [http.CanonicalHeaderKey]. If multiple entries map +// to the same canonical key, a [cerrdefs.ErrInvalidArgument] is returned. +func WithHTTPHeaders(headers map[string]string) Opt { + return func(c *clientConfig) error { + c.customHTTPHeaders = make(map[string]string) + for k, v := range headers { + k = http.CanonicalHeaderKey(k) + _, ok := c.customHTTPHeaders[k] + if ok { + return cerrdefs.ErrInvalidArgument.WithMessage(fmt.Sprintf("duplicate custom HTTP header (%s)", k)) + } + c.customHTTPHeaders[k] = v + } + return nil + } +} + +// WithScheme overrides the client scheme with the specified one. +func WithScheme(scheme string) Opt { + return func(c *clientConfig) error { + c.scheme = scheme + return nil + } +} + +// WithTLSClientConfig configures the client's existing HTTP transport to use TLS. +// The minimum TLS version is TLS 1.2. +// +// If caFile is non-empty, it specifies the CA certificate file to use for +// server verification, and replaces the system root pool for that verification. +// If certFile is empty, the system root pool is used. +// +// If either certFile or keyFile is set, both must point to readable files +// containing a valid client certificate and unencrypted private key, or this +// option returns an error. +// +// If both certPath and keyPath are empty, no client certificate is configured. +// The connection will use TLS without client authentication (i.e., not mTLS). +func WithTLSClientConfig(caFile, certFile, keyFile string) Opt { + return func(c *clientConfig) error { + transport, ok := c.client.Transport.(*http.Transport) + if !ok { + return fmt.Errorf("cannot configure TLS: unsupported HTTP transport %T", c.client.Transport) + } + config, err := tlsconfig.Client(tlsconfig.Options{ + CAFile: caFile, + CertFile: certFile, + KeyFile: keyFile, + ExclusiveRootPools: true, + MinVersion: tls.VersionTLS12, + }) + if err != nil { + return fmt.Errorf("configure TLS: %w", err) + } + transport.TLSClientConfig = config + return nil + } +} + +// WithTLSClientConfigFromEnv configures the client for TLS using the +// DOCKER_CERT_PATH ([EnvOverrideCertPath]) and DOCKER_TLS_VERIFY +// ([EnvTLSVerify]) environment variables. The minimum TLS version is TLS 1.2. +// +// If DOCKER_CERT_PATH is unset or empty, this option leaves the client +// unchanged. +// +// When DOCKER_CERT_PATH is set, the following files are loaded from that +// directory: +// +// - "ca.pem" as the CA certificate +// - "cert.pem" as the client certificate +// - "key.pem" as the client private key +// +// These files must exist, be readable, and contain valid TLS material, or this +// option returns an error. A client certificate is always loaded from "cert.pem" +// and "key.pem" (mTLS is expected). +// +// If DOCKER_TLS_VERIFY is set to a non-empty value, server certificate +// verification is enabled. In that case, "ca.pem" is added to the system root +// pool used for verification. +// +// If DOCKER_TLS_VERIFY is unset or empty, server certificate verification is +// disabled. +func WithTLSClientConfigFromEnv() Opt { + return func(c *clientConfig) error { + dockerCertPath := os.Getenv(EnvOverrideCertPath) + if dockerCertPath == "" { + return nil + } + tlsConfig, err := tlsconfig.Client(tlsconfig.Options{ + CAFile: filepath.Join(dockerCertPath, "ca.pem"), + CertFile: filepath.Join(dockerCertPath, "cert.pem"), + KeyFile: filepath.Join(dockerCertPath, "key.pem"), + InsecureSkipVerify: os.Getenv(EnvTLSVerify) == "", + MinVersion: tls.VersionTLS12, + }) + if err != nil { + return fmt.Errorf("configure TLS from %q: %w", EnvOverrideCertPath+"="+dockerCertPath, err) + } + + // FIXME(thaJeztah): unlike WithTLSClientConfig, this option replaces the client's http.Client and transport; consider updating just the transport. + c.client = &http.Client{ + Transport: &http.Transport{TLSClientConfig: tlsConfig}, + CheckRedirect: CheckRedirect, + } + return nil + } +} + +// WithAPIVersion overrides the client's API version with the specified one, +// and disables API version negotiation. If an empty version is provided, +// this option is ignored to allow version negotiation. The given version +// should be formatted "." (for example, "1.52"). It returns +// an error if the given value not in the correct format. +// +// WithAPIVersion does not validate if the client supports the given version, +// and callers should verify if the version lower than the maximum supported +// version as defined by [MaxAPIVersion]. +// +// [WithAPIVersionFromEnv] takes precedence if [WithAPIVersion] and +// [WithAPIVersionFromEnv] are both set. +func WithAPIVersion(version string) Opt { + return func(c *clientConfig) error { + version = strings.TrimSpace(version) + if val := strings.TrimPrefix(version, "v"); val != "" { + ver, err := parseAPIVersion(val) + if err != nil { + return fmt.Errorf("invalid API version (%s): %w", version, err) + } + c.manualAPIVersion = ver + } + return nil + } +} + +// WithVersion overrides the client version with the specified one. +// +// Deprecated: use [WithAPIVersion] instead. +// +//go:fix inline +func WithVersion(version string) Opt { + return WithAPIVersion(version) +} + +// WithAPIVersionFromEnv overrides the client version with the version specified in +// the DOCKER_API_VERSION ([EnvOverrideAPIVersion]) environment variable. +// If DOCKER_API_VERSION is not set, or set to an empty value, the version +// is not modified. +// +// WithAPIVersion does not validate if the client supports the given version, +// and callers should verify if the version lower than the maximum supported +// version as defined by [MaxAPIVersion]. +// +// [WithAPIVersionFromEnv] takes precedence if [WithAPIVersion] and +// [WithAPIVersionFromEnv] are both set. +func WithAPIVersionFromEnv() Opt { + return func(c *clientConfig) error { + version := strings.TrimSpace(os.Getenv(EnvOverrideAPIVersion)) + if val := strings.TrimPrefix(version, "v"); val != "" { + ver, err := parseAPIVersion(val) + if err != nil { + return fmt.Errorf("invalid API version (%s): %w", version, err) + } + c.envAPIVersion = ver + } + return nil + } +} + +// WithVersionFromEnv overrides the client version with the version specified in +// the DOCKER_API_VERSION ([EnvOverrideAPIVersion]) environment variable. +// +// Deprecated: use [WithAPIVersionFromEnv] instead. +// +//go:fix inline +func WithVersionFromEnv() Opt { + return WithAPIVersionFromEnv() +} + +// WithAPIVersionNegotiation enables automatic API version negotiation for the client. +// With this option enabled, the client automatically negotiates the API version +// to use when making requests. API version negotiation is performed on the first +// request; subsequent requests do not re-negotiate. +// +// Deprecated: API-version negotiation is now enabled by default and this options +// is now a no-op. +// +// Use [WithAPIVersion] or [WithAPIVersionFromEnv] to set a fixed API version +// instead of using automatic negotiation. +func WithAPIVersionNegotiation() Opt { + return func(c *clientConfig) error { + return nil + } +} + +// WithTraceProvider sets the trace provider for the client. +// If this is not set then the global trace provider is used. +func WithTraceProvider(provider trace.TracerProvider) Opt { + return func(c *clientConfig) error { + c.traceOpts = append(c.traceOpts, otelhttp.WithTracerProvider(provider)) + return nil + } +} + +// WithTraceOptions sets tracing span options for the client. +func WithTraceOptions(opts ...otelhttp.Option) Opt { + return func(c *clientConfig) error { + c.traceOpts = append(c.traceOpts, opts...) + return nil + } +} + +// WithResponseHook adds a ResponseHook to the client. ResponseHooks are called +// for each HTTP response returned by the daemon. Hooks are invoked in the order +// they were added. +// +// Hooks must not read or close resp.Body. +func WithResponseHook(h ResponseHook) Opt { + return func(c *clientConfig) error { + if h == nil { + return errors.New("invalid response hook: hook is nil") + } + c.responseHooks = append(c.responseHooks, h) + return nil + } +} diff --git a/vendor/github.com/moby/moby/client/client_responsehook.go b/vendor/github.com/moby/moby/client/client_responsehook.go new file mode 100644 index 00000000..7c93f111 --- /dev/null +++ b/vendor/github.com/moby/moby/client/client_responsehook.go @@ -0,0 +1,23 @@ +package client + +import ( + "net/http" +) + +type responseHookTransport struct { + base http.RoundTripper + hooks []ResponseHook +} + +func (t *responseHookTransport) RoundTrip(req *http.Request) (*http.Response, error) { + resp, err := t.base.RoundTrip(req) + if err != nil { + return resp, err + } + + for _, h := range t.hooks { + h(resp) + } + + return resp, nil +} diff --git a/vendor/github.com/moby/moby/client/client_unix.go b/vendor/github.com/moby/moby/client/client_unix.go new file mode 100644 index 00000000..1fb9fbfb --- /dev/null +++ b/vendor/github.com/moby/moby/client/client_unix.go @@ -0,0 +1,18 @@ +//go:build !windows + +package client + +import ( + "context" + "net" + "syscall" +) + +// DefaultDockerHost defines OS-specific default host if the DOCKER_HOST +// (EnvOverrideHost) environment variable is unset or empty. +const DefaultDockerHost = "unix:///var/run/docker.sock" + +// dialPipeContext connects to a Windows named pipe. It is not supported on non-Windows. +func dialPipeContext(_ context.Context, _ string) (net.Conn, error) { + return nil, syscall.EAFNOSUPPORT +} diff --git a/vendor/github.com/moby/moby/client/client_windows.go b/vendor/github.com/moby/moby/client/client_windows.go new file mode 100644 index 00000000..b471c061 --- /dev/null +++ b/vendor/github.com/moby/moby/client/client_windows.go @@ -0,0 +1,17 @@ +package client + +import ( + "context" + "net" + + "github.com/Microsoft/go-winio" +) + +// DefaultDockerHost defines OS-specific default host if the DOCKER_HOST +// (EnvOverrideHost) environment variable is unset or empty. +const DefaultDockerHost = "npipe:////./pipe/docker_engine" + +// dialPipeContext connects to a Windows named pipe. It is not supported on non-Windows. +func dialPipeContext(ctx context.Context, addr string) (net.Conn, error) { + return winio.DialPipeContext(ctx, addr) +} diff --git a/vendor/github.com/moby/moby/client/config_create.go b/vendor/github.com/moby/moby/client/config_create.go new file mode 100644 index 00000000..874e2c94 --- /dev/null +++ b/vendor/github.com/moby/moby/client/config_create.go @@ -0,0 +1,34 @@ +package client + +import ( + "context" + "encoding/json" + + "github.com/moby/moby/api/types/swarm" +) + +// ConfigCreateOptions holds options for creating a config. +type ConfigCreateOptions struct { + Spec swarm.ConfigSpec +} + +// ConfigCreateResult holds the result from the ConfigCreate method. +type ConfigCreateResult struct { + ID string +} + +// ConfigCreate creates a new config. +func (cli *Client) ConfigCreate(ctx context.Context, options ConfigCreateOptions) (ConfigCreateResult, error) { + resp, err := cli.post(ctx, "/configs/create", nil, options.Spec, nil) + defer ensureReaderClosed(resp) + if err != nil { + return ConfigCreateResult{}, err + } + + var out swarm.ConfigCreateResponse + err = json.NewDecoder(resp.Body).Decode(&out) + if err != nil { + return ConfigCreateResult{}, err + } + return ConfigCreateResult{ID: out.ID}, nil +} diff --git a/vendor/github.com/moby/moby/client/config_inspect.go b/vendor/github.com/moby/moby/client/config_inspect.go new file mode 100644 index 00000000..0bf0ff79 --- /dev/null +++ b/vendor/github.com/moby/moby/client/config_inspect.go @@ -0,0 +1,35 @@ +package client + +import ( + "context" + "encoding/json" + + "github.com/moby/moby/api/types/swarm" +) + +// ConfigInspectOptions holds options for inspecting a config. +type ConfigInspectOptions struct { + // Add future optional parameters here +} + +// ConfigInspectResult holds the result from the ConfigInspect method. +type ConfigInspectResult struct { + Config swarm.Config + Raw json.RawMessage +} + +// ConfigInspect returns the config information with raw data +func (cli *Client) ConfigInspect(ctx context.Context, id string, options ConfigInspectOptions) (ConfigInspectResult, error) { + id, err := trimID("config", id) + if err != nil { + return ConfigInspectResult{}, err + } + resp, err := cli.get(ctx, "/configs/"+id, nil, nil) + if err != nil { + return ConfigInspectResult{}, err + } + + var out ConfigInspectResult + out.Raw, err = decodeWithRaw(resp, &out.Config) + return out, err +} diff --git a/vendor/github.com/moby/moby/client/config_list.go b/vendor/github.com/moby/moby/client/config_list.go new file mode 100644 index 00000000..ee5e7fee --- /dev/null +++ b/vendor/github.com/moby/moby/client/config_list.go @@ -0,0 +1,38 @@ +package client + +import ( + "context" + "encoding/json" + "net/url" + + "github.com/moby/moby/api/types/swarm" +) + +// ConfigListOptions holds parameters to list configs +type ConfigListOptions struct { + Filters Filters +} + +// ConfigListResult holds the result from the [client.ConfigList] method. +type ConfigListResult struct { + Items []swarm.Config +} + +// ConfigList returns the list of configs. +func (cli *Client) ConfigList(ctx context.Context, options ConfigListOptions) (ConfigListResult, error) { + query := url.Values{} + options.Filters.updateURLValues(query) + + resp, err := cli.get(ctx, "/configs", query, nil) + defer ensureReaderClosed(resp) + if err != nil { + return ConfigListResult{}, err + } + + var out ConfigListResult + err = json.NewDecoder(resp.Body).Decode(&out.Items) + if err != nil { + return ConfigListResult{}, err + } + return out, nil +} diff --git a/vendor/github.com/moby/moby/client/config_remove.go b/vendor/github.com/moby/moby/client/config_remove.go new file mode 100644 index 00000000..5cde5e14 --- /dev/null +++ b/vendor/github.com/moby/moby/client/config_remove.go @@ -0,0 +1,27 @@ +package client + +import "context" + +// ConfigRemoveOptions holds options for [Client.ConfigRemove]. +type ConfigRemoveOptions struct { + // Add future optional parameters here +} + +// ConfigRemoveResult holds the result of [Client.ConfigRemove]. +type ConfigRemoveResult struct { + // Add future fields here +} + +// ConfigRemove removes a config. +func (cli *Client) ConfigRemove(ctx context.Context, id string, options ConfigRemoveOptions) (ConfigRemoveResult, error) { + id, err := trimID("config", id) + if err != nil { + return ConfigRemoveResult{}, err + } + resp, err := cli.delete(ctx, "/configs/"+id, nil, nil) + defer ensureReaderClosed(resp) + if err != nil { + return ConfigRemoveResult{}, err + } + return ConfigRemoveResult{}, nil +} diff --git a/vendor/github.com/moby/moby/client/config_update.go b/vendor/github.com/moby/moby/client/config_update.go new file mode 100644 index 00000000..31bdd795 --- /dev/null +++ b/vendor/github.com/moby/moby/client/config_update.go @@ -0,0 +1,33 @@ +package client + +import ( + "context" + "net/url" + + "github.com/moby/moby/api/types/swarm" +) + +// ConfigUpdateOptions holds options for updating a config. +type ConfigUpdateOptions struct { + Version swarm.Version + Spec swarm.ConfigSpec +} + +// ConfigUpdateResult holds the result of [Client.ConfigUpdate]. +type ConfigUpdateResult struct{} + +// ConfigUpdate attempts to update a config +func (cli *Client) ConfigUpdate(ctx context.Context, id string, options ConfigUpdateOptions) (ConfigUpdateResult, error) { + id, err := trimID("config", id) + if err != nil { + return ConfigUpdateResult{}, err + } + query := url.Values{} + query.Set("version", options.Version.String()) + resp, err := cli.post(ctx, "/configs/"+id+"/update", query, options.Spec, nil) + defer ensureReaderClosed(resp) + if err != nil { + return ConfigUpdateResult{}, err + } + return ConfigUpdateResult{}, nil +} diff --git a/vendor/github.com/moby/moby/client/container_attach.go b/vendor/github.com/moby/moby/client/container_attach.go new file mode 100644 index 00000000..ce84122d --- /dev/null +++ b/vendor/github.com/moby/moby/client/container_attach.go @@ -0,0 +1,86 @@ +package client + +import ( + "context" + "net/http" + "net/url" +) + +// ContainerAttachOptions holds parameters to attach to a container. +type ContainerAttachOptions struct { + Stream bool + Stdin bool + Stdout bool + Stderr bool + DetachKeys string + Logs bool +} + +// ContainerAttachResult is the result from attaching to a container. +type ContainerAttachResult struct { + HijackedResponse +} + +// ContainerAttach attaches a connection to a container in the server. +// It returns a [HijackedResponse] with the hijacked connection +// and a reader to get output. It's up to the caller to close +// the hijacked connection by calling [HijackedResponse.Close]. +// +// The stream format on the response uses one of two formats: +// +// - If the container is using a TTY, there is only a single stream (stdout) +// and data is copied directly from the container output stream, no extra +// multiplexing or headers. +// - If the container is *not* using a TTY, streams for stdout and stderr are +// multiplexed. +// +// The format of the multiplexed stream is defined in the [stdcopy] package, +// and as follows: +// +// [8]byte{STREAM_TYPE, 0, 0, 0, SIZE1, SIZE2, SIZE3, SIZE4}[]byte{OUTPUT} +// +// STREAM_TYPE can be 1 for [Stdout] and 2 for [Stderr]. Refer to [stdcopy.StdType] +// for details. SIZE1, SIZE2, SIZE3, and SIZE4 are four bytes of uint32 encoded +// as big endian, this is the size of OUTPUT. You can use [stdcopy.StdCopy] +// to demultiplex this stream. +// +// [stdcopy]: https://pkg.go.dev/github.com/moby/moby/api/pkg/stdcopy +// [stdcopy.StdCopy]: https://pkg.go.dev/github.com/moby/moby/api/pkg/stdcopy#StdCopy +// [stdcopy.StdType]: https://pkg.go.dev/github.com/moby/moby/api/pkg/stdcopy#StdType +// [Stdout]: https://pkg.go.dev/github.com/moby/moby/api/pkg/stdcopy#Stdout +// [Stderr]: https://pkg.go.dev/github.com/moby/moby/api/pkg/stdcopy#Stderr +func (cli *Client) ContainerAttach(ctx context.Context, containerID string, options ContainerAttachOptions) (ContainerAttachResult, error) { + containerID, err := trimID("container", containerID) + if err != nil { + return ContainerAttachResult{}, err + } + + query := url.Values{} + if options.Stream { + query.Set("stream", "1") + } + if options.Stdin { + query.Set("stdin", "1") + } + if options.Stdout { + query.Set("stdout", "1") + } + if options.Stderr { + query.Set("stderr", "1") + } + if options.DetachKeys != "" { + query.Set("detachKeys", options.DetachKeys) + } + if options.Logs { + query.Set("logs", "1") + } + + hijacked, err := cli.postHijacked(ctx, "/containers/"+containerID+"/attach", query, nil, http.Header{ + "Content-Type": {"text/plain"}, + }) + if err != nil { + return ContainerAttachResult{}, err + } + + return ContainerAttachResult{HijackedResponse: hijacked}, nil +} diff --git a/vendor/github.com/moby/moby/client/container_commit.go b/vendor/github.com/moby/moby/client/container_commit.go new file mode 100644 index 00000000..79da44a5 --- /dev/null +++ b/vendor/github.com/moby/moby/client/container_commit.go @@ -0,0 +1,75 @@ +package client + +import ( + "context" + "encoding/json" + "errors" + "net/url" + + "github.com/distribution/reference" + "github.com/moby/moby/api/types/container" +) + +// ContainerCommitOptions holds parameters to commit changes into a container. +type ContainerCommitOptions struct { + Reference string + Comment string + Author string + Changes []string + NoPause bool // NoPause disables pausing the container during commit. + Config *container.Config +} + +// ContainerCommitResult is the result from committing a container. +type ContainerCommitResult struct { + ID string +} + +// ContainerCommit applies changes to a container and creates a new tagged image. +func (cli *Client) ContainerCommit(ctx context.Context, containerID string, options ContainerCommitOptions) (ContainerCommitResult, error) { + containerID, err := trimID("container", containerID) + if err != nil { + return ContainerCommitResult{}, err + } + + var repository, tag string + if options.Reference != "" { + ref, err := reference.ParseNormalizedNamed(options.Reference) + if err != nil { + return ContainerCommitResult{}, err + } + + if _, ok := ref.(reference.Digested); ok { + return ContainerCommitResult{}, errors.New("refusing to create a tag with a digest reference") + } + ref = reference.TagNameOnly(ref) + + if tagged, ok := ref.(reference.Tagged); ok { + tag = tagged.Tag() + } + repository = ref.Name() + } + + query := url.Values{} + query.Set("container", containerID) + query.Set("repo", repository) + query.Set("tag", tag) + query.Set("comment", options.Comment) + query.Set("author", options.Author) + for _, change := range options.Changes { + query.Add("changes", change) + } + if options.NoPause { + query.Set("pause", "0") + } + + var response container.CommitResponse + resp, err := cli.post(ctx, "/commit", query, options.Config, nil) + defer ensureReaderClosed(resp) + if err != nil { + return ContainerCommitResult{}, err + } + + err = json.NewDecoder(resp.Body).Decode(&response) + return ContainerCommitResult{ID: response.ID}, err +} diff --git a/vendor/github.com/moby/moby/client/container_copy.go b/vendor/github.com/moby/moby/client/container_copy.go new file mode 100644 index 00000000..b37d1765 --- /dev/null +++ b/vendor/github.com/moby/moby/client/container_copy.go @@ -0,0 +1,142 @@ +package client + +import ( + "context" + "encoding/base64" + "encoding/json" + "fmt" + "io" + "net/http" + "net/url" + "path/filepath" + "strings" + + "github.com/moby/moby/api/types/container" +) + +// ContainerStatPathOptions holds options for [Client.ContainerStatPath]. +type ContainerStatPathOptions struct { + Path string +} + +// ContainerStatPathResult holds the result of [Client.ContainerStatPath]. +type ContainerStatPathResult struct { + Stat container.PathStat +} + +// ContainerStatPath returns stat information about a path inside the container filesystem. +func (cli *Client) ContainerStatPath(ctx context.Context, containerID string, options ContainerStatPathOptions) (ContainerStatPathResult, error) { + containerID, err := trimID("container", containerID) + if err != nil { + return ContainerStatPathResult{}, err + } + + query := url.Values{} + query.Set("path", filepath.ToSlash(options.Path)) // Normalize the paths used in the API. + + resp, err := cli.head(ctx, "/containers/"+containerID+"/archive", query, nil) + defer ensureReaderClosed(resp) + if err != nil { + return ContainerStatPathResult{}, err + } + stat, err := getContainerPathStatFromHeader(resp.Header) + if err != nil { + return ContainerStatPathResult{}, err + } + return ContainerStatPathResult{Stat: stat}, nil +} + +// CopyToContainerOptions holds information +// about files to copy into a container +type CopyToContainerOptions struct { + DestinationPath string + Content io.Reader + AllowOverwriteDirWithFile bool + CopyUIDGID bool +} + +// CopyToContainerResult holds the result of [Client.CopyToContainer]. +type CopyToContainerResult struct{} + +// CopyToContainer copies content into the container filesystem. +// Note that `content` must be a Reader for a TAR archive +func (cli *Client) CopyToContainer(ctx context.Context, containerID string, options CopyToContainerOptions) (CopyToContainerResult, error) { + containerID, err := trimID("container", containerID) + if err != nil { + return CopyToContainerResult{}, err + } + + query := url.Values{} + query.Set("path", filepath.ToSlash(options.DestinationPath)) // Normalize the paths used in the API. + // Do not allow for an existing directory to be overwritten by a non-directory and vice versa. + if !options.AllowOverwriteDirWithFile { + query.Set("noOverwriteDirNonDir", "true") + } + + if options.CopyUIDGID { + query.Set("copyUIDGID", "true") + } + + response, err := cli.putRaw(ctx, "/containers/"+containerID+"/archive", query, options.Content, nil) + defer ensureReaderClosed(response) + if err != nil { + return CopyToContainerResult{}, err + } + + return CopyToContainerResult{}, nil +} + +// CopyFromContainerOptions holds options for [Client.CopyFromContainer]. +type CopyFromContainerOptions struct { + SourcePath string +} + +// CopyFromContainerResult holds the result of [Client.CopyFromContainer]. +type CopyFromContainerResult struct { + Content io.ReadCloser + Stat container.PathStat +} + +// CopyFromContainer gets the content from the container and returns it as a Reader +// for a TAR archive to manipulate it in the host. It's up to the caller to close the reader. +func (cli *Client) CopyFromContainer(ctx context.Context, containerID string, options CopyFromContainerOptions) (CopyFromContainerResult, error) { + containerID, err := trimID("container", containerID) + if err != nil { + return CopyFromContainerResult{}, err + } + + query := make(url.Values, 1) + query.Set("path", filepath.ToSlash(options.SourcePath)) // Normalize the paths used in the API. + + resp, err := cli.get(ctx, "/containers/"+containerID+"/archive", query, nil) + if err != nil { + return CopyFromContainerResult{}, err + } + + // In order to get the copy behavior right, we need to know information + // about both the source and the destination. The response headers include + // stat info about the source that we can use in deciding exactly how to + // copy it locally. Along with the stat info about the local destination, + // we have everything we need to handle the multiple possibilities there + // can be when copying a file/dir from one location to another file/dir. + stat, err := getContainerPathStatFromHeader(resp.Header) + if err != nil { + ensureReaderClosed(resp) + return CopyFromContainerResult{Stat: stat}, fmt.Errorf("unable to get resource stat from response: %s", err) + } + return CopyFromContainerResult{Content: resp.Body, Stat: stat}, nil +} + +func getContainerPathStatFromHeader(header http.Header) (container.PathStat, error) { + var stat container.PathStat + + encodedStat := header.Get("X-Docker-Container-Path-Stat") + statDecoder := base64.NewDecoder(base64.StdEncoding, strings.NewReader(encodedStat)) + + err := json.NewDecoder(statDecoder).Decode(&stat) + if err != nil { + err = fmt.Errorf("unable to decode container path stat header: %s", err) + } + + return stat, err +} diff --git a/vendor/github.com/moby/moby/client/container_create.go b/vendor/github.com/moby/moby/client/container_create.go new file mode 100644 index 00000000..d941a372 --- /dev/null +++ b/vendor/github.com/moby/moby/client/container_create.go @@ -0,0 +1,125 @@ +package client + +import ( + "context" + "encoding/json" + "net/url" + "path" + "sort" + "strings" + + cerrdefs "github.com/containerd/errdefs" + "github.com/moby/moby/api/types/container" + ocispec "github.com/opencontainers/image-spec/specs-go/v1" +) + +// ContainerCreate creates a new container based on the given configuration. +// It can be associated with a name, but it's not mandatory. +func (cli *Client) ContainerCreate(ctx context.Context, options ContainerCreateOptions) (ContainerCreateResult, error) { + cfg := options.Config + + if cfg == nil { + cfg = &container.Config{} + } + + if options.Image != "" { + if cfg.Image != "" { + return ContainerCreateResult{}, cerrdefs.ErrInvalidArgument.WithMessage("either Image or config.Image should be set") + } + newCfg := *cfg + newCfg.Image = options.Image + cfg = &newCfg + } + + if cfg.Image == "" { + return ContainerCreateResult{}, cerrdefs.ErrInvalidArgument.WithMessage("config.Image or Image is required") + } + + var response container.CreateResponse + + if options.HostConfig != nil { + options.HostConfig.CapAdd = normalizeCapabilities(options.HostConfig.CapAdd) + options.HostConfig.CapDrop = normalizeCapabilities(options.HostConfig.CapDrop) + } + + query := url.Values{} + if options.Platform != nil { + if p := formatPlatform(*options.Platform); p != "unknown" { + query.Set("platform", p) + } + } + + if options.Name != "" { + query.Set("name", options.Name) + } + + body := container.CreateRequest{ + Config: cfg, + HostConfig: options.HostConfig, + NetworkingConfig: options.NetworkingConfig, + } + + resp, err := cli.post(ctx, "/containers/create", query, body, nil) + defer ensureReaderClosed(resp) + if err != nil { + return ContainerCreateResult{}, err + } + + err = json.NewDecoder(resp.Body).Decode(&response) + return ContainerCreateResult{ID: response.ID, Warnings: response.Warnings}, err +} + +// formatPlatform returns a formatted string representing platform (e.g., "linux/arm/v7"). +// +// It is a fork of [platforms.Format], and does not yet support "os.version", +// as [platforms.FormatAll] does. +// +// [platforms.Format]: https://github.com/containerd/platforms/blob/v1.0.0-rc.1/platforms.go#L309-L316 +// [platforms.FormatAll]: https://github.com/containerd/platforms/blob/v1.0.0-rc.1/platforms.go#L318-L330 +func formatPlatform(platform ocispec.Platform) string { + if platform.OS == "" { + return "unknown" + } + return path.Join(platform.OS, platform.Architecture, platform.Variant) +} + +// allCapabilities is a magic value for "all capabilities" +const allCapabilities = "ALL" + +// normalizeCapabilities normalizes capabilities to their canonical form, +// removes duplicates, and sorts the results. +// +// It is similar to [caps.NormalizeLegacyCapabilities], +// but performs no validation based on supported capabilities. +// +// [caps.NormalizeLegacyCapabilities]: https://github.com/moby/moby/blob/v28.3.2/oci/caps/utils.go#L56 +func normalizeCapabilities(caps []string) []string { + var normalized []string + + unique := make(map[string]struct{}) + for _, c := range caps { + c = normalizeCap(c) + if _, ok := unique[c]; ok { + continue + } + unique[c] = struct{}{} + normalized = append(normalized, c) + } + + sort.Strings(normalized) + return normalized +} + +// normalizeCap normalizes a capability to its canonical format by upper-casing +// and adding a "CAP_" prefix (if not yet present). It also accepts the "ALL" +// magic-value. +func normalizeCap(capability string) string { + capability = strings.ToUpper(capability) + if capability == allCapabilities { + return capability + } + if !strings.HasPrefix(capability, "CAP_") { + capability = "CAP_" + capability + } + return capability +} diff --git a/vendor/github.com/moby/moby/client/container_create_opts.go b/vendor/github.com/moby/moby/client/container_create_opts.go new file mode 100644 index 00000000..8580e20d --- /dev/null +++ b/vendor/github.com/moby/moby/client/container_create_opts.go @@ -0,0 +1,25 @@ +package client + +import ( + "github.com/moby/moby/api/types/container" + "github.com/moby/moby/api/types/network" + ocispec "github.com/opencontainers/image-spec/specs-go/v1" +) + +// ContainerCreateOptions holds parameters to create a container. +type ContainerCreateOptions struct { + Config *container.Config + HostConfig *container.HostConfig + NetworkingConfig *network.NetworkingConfig + Platform *ocispec.Platform + Name string + + // Image is a shortcut for Config.Image - only one of Image or Config.Image should be set. + Image string +} + +// ContainerCreateResult is the result from creating a container. +type ContainerCreateResult struct { + ID string + Warnings []string +} diff --git a/vendor/github.com/moby/moby/client/container_diff.go b/vendor/github.com/moby/moby/client/container_diff.go new file mode 100644 index 00000000..ec904337 --- /dev/null +++ b/vendor/github.com/moby/moby/client/container_diff.go @@ -0,0 +1,30 @@ +package client + +import ( + "context" + "encoding/json" + "net/url" + + "github.com/moby/moby/api/types/container" +) + +// ContainerDiff shows differences in a container filesystem since it was started. +func (cli *Client) ContainerDiff(ctx context.Context, containerID string, options ContainerDiffOptions) (ContainerDiffResult, error) { + containerID, err := trimID("container", containerID) + if err != nil { + return ContainerDiffResult{}, err + } + + resp, err := cli.get(ctx, "/containers/"+containerID+"/changes", url.Values{}, nil) + defer ensureReaderClosed(resp) + if err != nil { + return ContainerDiffResult{}, err + } + + var changes []container.FilesystemChange + err = json.NewDecoder(resp.Body).Decode(&changes) + if err != nil { + return ContainerDiffResult{}, err + } + return ContainerDiffResult{Changes: changes}, err +} diff --git a/vendor/github.com/moby/moby/client/container_diff_opts.go b/vendor/github.com/moby/moby/client/container_diff_opts.go new file mode 100644 index 00000000..5e3c37ab --- /dev/null +++ b/vendor/github.com/moby/moby/client/container_diff_opts.go @@ -0,0 +1,13 @@ +package client + +import "github.com/moby/moby/api/types/container" + +// ContainerDiffOptions holds parameters to show differences in a container filesystem. +type ContainerDiffOptions struct { + // Currently no options, but this allows for future extensibility +} + +// ContainerDiffResult is the result from showing differences in a container filesystem. +type ContainerDiffResult struct { + Changes []container.FilesystemChange +} diff --git a/vendor/github.com/moby/moby/client/container_exec.go b/vendor/github.com/moby/moby/client/container_exec.go new file mode 100644 index 00000000..30ed00ea --- /dev/null +++ b/vendor/github.com/moby/moby/client/container_exec.go @@ -0,0 +1,203 @@ +package client + +import ( + "context" + "encoding/json" + "net/http" + + cerrdefs "github.com/containerd/errdefs" + "github.com/moby/moby/api/types/container" +) + +// ExecCreateOptions is a small subset of the Config struct that holds the configuration +// for the exec feature of docker. +type ExecCreateOptions struct { + User string // User that will run the command + Privileged bool // Is the container in privileged mode + TTY bool // Attach standard streams to a tty. + ConsoleSize ConsoleSize // Initial terminal size [height, width], unused if TTY == false + AttachStdin bool // Attach the standard input, makes possible user interaction + AttachStderr bool // Attach the standard error + AttachStdout bool // Attach the standard output + DetachKeys string // Escape keys for detach + Env []string // Environment variables + WorkingDir string // Working directory + Cmd []string // Execution commands and args +} + +// ExecCreateResult holds the result of creating a container exec. +type ExecCreateResult struct { + ID string +} + +// ExecCreate creates a new exec configuration to run an exec process. +func (cli *Client) ExecCreate(ctx context.Context, containerID string, options ExecCreateOptions) (ExecCreateResult, error) { + containerID, err := trimID("container", containerID) + if err != nil { + return ExecCreateResult{}, err + } + + consoleSize, err := getConsoleSize(options.TTY, options.ConsoleSize) + if err != nil { + return ExecCreateResult{}, err + } + + req := container.ExecCreateRequest{ + User: options.User, + Privileged: options.Privileged, + Tty: options.TTY, + ConsoleSize: consoleSize, + AttachStdin: options.AttachStdin, + AttachStderr: options.AttachStderr, + AttachStdout: options.AttachStdout, + DetachKeys: options.DetachKeys, + Env: options.Env, + WorkingDir: options.WorkingDir, + Cmd: options.Cmd, + } + + resp, err := cli.post(ctx, "/containers/"+containerID+"/exec", nil, req, nil) + defer ensureReaderClosed(resp) + if err != nil { + return ExecCreateResult{}, err + } + + var response container.ExecCreateResponse + err = json.NewDecoder(resp.Body).Decode(&response) + return ExecCreateResult{ID: response.ID}, err +} + +type ConsoleSize struct { + Height, Width uint +} + +// ExecStartOptions holds options for starting a container exec. +type ExecStartOptions struct { + // ExecStart will first check if it's detached + Detach bool + // Check if there's a tty + TTY bool + // Terminal size [height, width], unused if TTY == false + ConsoleSize ConsoleSize +} + +// ExecStartResult holds the result of starting a container exec. +type ExecStartResult struct{} + +// ExecStart starts an exec process already created in the docker host. +func (cli *Client) ExecStart(ctx context.Context, execID string, options ExecStartOptions) (ExecStartResult, error) { + consoleSize, err := getConsoleSize(options.TTY, options.ConsoleSize) + if err != nil { + return ExecStartResult{}, err + } + + req := container.ExecStartRequest{ + Detach: options.Detach, + Tty: options.TTY, + ConsoleSize: consoleSize, + } + resp, err := cli.post(ctx, "/exec/"+execID+"/start", nil, req, nil) + defer ensureReaderClosed(resp) + return ExecStartResult{}, err +} + +// ExecAttachOptions holds options for attaching to a container exec. +type ExecAttachOptions struct { + // Check if there's a tty + TTY bool + // Terminal size [height, width], unused if TTY == false + ConsoleSize ConsoleSize `json:",omitzero"` +} + +// ExecAttachResult holds the result of attaching to a container exec. +type ExecAttachResult struct { + HijackedResponse +} + +// ExecAttach attaches a connection to an exec process in the server. +// +// It returns a [HijackedResponse] with the hijacked connection +// and a reader to get output. It's up to the caller to close +// the hijacked connection by calling [HijackedResponse.Close]. +// +// The stream format on the response uses one of two formats: +// +// - If the container is using a TTY, there is only a single stream (stdout) +// and data is copied directly from the container output stream, no extra +// multiplexing or headers. +// - If the container is *not* using a TTY, streams for stdout and stderr are +// multiplexed. +// +// You can use [stdcopy.StdCopy] to demultiplex this stream. Refer to +// [Client.ContainerAttach] for details about the multiplexed stream. +// +// [stdcopy.StdCopy]: https://pkg.go.dev/github.com/moby/moby/api/pkg/stdcopy#StdCopy +func (cli *Client) ExecAttach(ctx context.Context, execID string, options ExecAttachOptions) (ExecAttachResult, error) { + consoleSize, err := getConsoleSize(options.TTY, options.ConsoleSize) + if err != nil { + return ExecAttachResult{}, err + } + req := container.ExecStartRequest{ + Detach: false, + Tty: options.TTY, + ConsoleSize: consoleSize, + } + response, err := cli.postHijacked(ctx, "/exec/"+execID+"/start", nil, req, http.Header{ + "Content-Type": {"application/json"}, + }) + return ExecAttachResult{HijackedResponse: response}, err +} + +func getConsoleSize(hasTTY bool, consoleSize ConsoleSize) (*[2]uint, error) { + if consoleSize.Height != 0 || consoleSize.Width != 0 { + if !hasTTY { + return nil, cerrdefs.ErrInvalidArgument.WithMessage("console size is only supported when TTY is enabled") + } + return &[2]uint{consoleSize.Height, consoleSize.Width}, nil + } + return nil, nil +} + +// ExecInspectOptions holds options for inspecting a container exec. +type ExecInspectOptions struct{} + +// ExecInspectResult holds the result of inspecting a container exec. +// +// It provides a subset of the information included in [container.ExecInspectResponse]. +// +// TODO(thaJeztah): include all fields of [container.ExecInspectResponse] ? +type ExecInspectResult struct { + ID string + ContainerID string + Running bool + ExitCode int + PID int +} + +// ExecInspect returns information about a specific exec process on the docker host. +func (cli *Client) ExecInspect(ctx context.Context, execID string, options ExecInspectOptions) (ExecInspectResult, error) { + resp, err := cli.get(ctx, "/exec/"+execID+"/json", nil, nil) + defer ensureReaderClosed(resp) + if err != nil { + return ExecInspectResult{}, err + } + + var response container.ExecInspectResponse + err = json.NewDecoder(resp.Body).Decode(&response) + if err != nil { + return ExecInspectResult{}, err + } + + var ec int + if response.ExitCode != nil { + ec = *response.ExitCode + } + + return ExecInspectResult{ + ID: response.ID, + ContainerID: response.ContainerID, + Running: response.Running, + ExitCode: ec, + PID: response.Pid, + }, nil +} diff --git a/vendor/github.com/moby/moby/client/container_export.go b/vendor/github.com/moby/moby/client/container_export.go new file mode 100644 index 00000000..2d33efb7 --- /dev/null +++ b/vendor/github.com/moby/moby/client/container_export.go @@ -0,0 +1,47 @@ +package client + +import ( + "context" + "io" + "net/url" +) + +// ContainerExportOptions specifies options for container export operations. +type ContainerExportOptions struct { + // Currently no options are defined for ContainerExport +} + +// ContainerExportResult represents the result of a container export operation. +type ContainerExportResult interface { + io.ReadCloser +} + +// ContainerExport retrieves the raw contents of a container +// and returns them as an [io.ReadCloser]. It's up to the caller +// to close the stream. +// +// The underlying [io.ReadCloser] is automatically closed if the context is canceled, +func (cli *Client) ContainerExport(ctx context.Context, containerID string, options ContainerExportOptions) (ContainerExportResult, error) { + containerID, err := trimID("container", containerID) + if err != nil { + return nil, err + } + + resp, err := cli.get(ctx, "/containers/"+containerID+"/export", url.Values{}, nil) + if err != nil { + return nil, err + } + + return &containerExportResult{ + ReadCloser: newCancelReadCloser(ctx, resp.Body), + }, nil +} + +type containerExportResult struct { + io.ReadCloser +} + +var ( + _ io.ReadCloser = (*containerExportResult)(nil) + _ ContainerExportResult = (*containerExportResult)(nil) +) diff --git a/vendor/github.com/moby/moby/client/container_inspect.go b/vendor/github.com/moby/moby/client/container_inspect.go new file mode 100644 index 00000000..4f12c465 --- /dev/null +++ b/vendor/github.com/moby/moby/client/container_inspect.go @@ -0,0 +1,47 @@ +package client + +import ( + "context" + "encoding/json" + "net/url" + + "github.com/moby/moby/api/types/container" +) + +// ContainerInspectOptions holds options for inspecting a container using +// the [Client.ConfigInspect] method. +type ContainerInspectOptions struct { + // Size controls whether the container's filesystem size should be calculated. + // When set, the [container.InspectResponse.SizeRw] and [container.InspectResponse.SizeRootFs] + // fields in [ContainerInspectResult.Container] are populated with the result. + // + // Calculating the size can be a costly operation, and should not be used + // unless needed. + Size bool +} + +// ContainerInspectResult holds the result from the [Client.ConfigInspect] method. +type ContainerInspectResult struct { + Container container.InspectResponse + Raw json.RawMessage +} + +// ContainerInspect returns the container information. +func (cli *Client) ContainerInspect(ctx context.Context, containerID string, options ContainerInspectOptions) (ContainerInspectResult, error) { + containerID, err := trimID("container", containerID) + if err != nil { + return ContainerInspectResult{}, err + } + + query := url.Values{} + if options.Size { + query.Set("size", "1") + } + resp, err := cli.get(ctx, "/containers/"+containerID+"/json", query, nil) + if err != nil { + return ContainerInspectResult{}, err + } + var out ContainerInspectResult + out.Raw, err = decodeWithRaw(resp, &out.Container) + return out, err +} diff --git a/vendor/github.com/moby/moby/client/container_kill.go b/vendor/github.com/moby/moby/client/container_kill.go new file mode 100644 index 00000000..ae7a4ebd --- /dev/null +++ b/vendor/github.com/moby/moby/client/container_kill.go @@ -0,0 +1,39 @@ +package client + +import ( + "context" + "net/url" +) + +// ContainerKillOptions holds options for [Client.ContainerKill]. +type ContainerKillOptions struct { + // Signal (optional) is the signal to send to the container to (gracefully) + // stop it before forcibly terminating the container with SIGKILL after a + // timeout. If no value is set, the default (SIGKILL) is used. + Signal string `json:",omitempty"` +} + +// ContainerKillResult holds the result of [Client.ContainerKill], +type ContainerKillResult struct { + // Add future fields here. +} + +// ContainerKill terminates the container process but does not remove the container from the docker host. +func (cli *Client) ContainerKill(ctx context.Context, containerID string, options ContainerKillOptions) (ContainerKillResult, error) { + containerID, err := trimID("container", containerID) + if err != nil { + return ContainerKillResult{}, err + } + + query := url.Values{} + if options.Signal != "" { + query.Set("signal", options.Signal) + } + + resp, err := cli.post(ctx, "/containers/"+containerID+"/kill", query, nil, nil) + defer ensureReaderClosed(resp) + if err != nil { + return ContainerKillResult{}, err + } + return ContainerKillResult{}, nil +} diff --git a/vendor/github.com/moby/moby/client/container_list.go b/vendor/github.com/moby/moby/client/container_list.go new file mode 100644 index 00000000..d9334c54 --- /dev/null +++ b/vendor/github.com/moby/moby/client/container_list.go @@ -0,0 +1,66 @@ +package client + +import ( + "context" + "encoding/json" + "net/url" + "strconv" + + "github.com/moby/moby/api/types/container" +) + +// ContainerListOptions holds parameters to list containers with. +type ContainerListOptions struct { + Size bool + All bool + Limit int + Filters Filters + + // Latest is non-functional and should not be used. Use Limit: 1 instead. + // + // Deprecated: the Latest option is non-functional and should not be used. Use Limit: 1 instead. + Latest bool + + // Since is no longer supported. Use the "since" filter instead. + // + // Deprecated: the Since option is no longer supported since docker 1.12 (API 1.24). Use the "since" filter instead. + Since string + + // Before is no longer supported. Use the "since" filter instead. + // + // Deprecated: the Before option is no longer supported since docker 1.12 (API 1.24). Use the "before" filter instead. + Before string +} + +type ContainerListResult struct { + Items []container.Summary +} + +// ContainerList returns the list of containers in the docker host. +func (cli *Client) ContainerList(ctx context.Context, options ContainerListOptions) (ContainerListResult, error) { + query := url.Values{} + + if options.All { + query.Set("all", "1") + } + + if options.Limit > 0 { + query.Set("limit", strconv.Itoa(options.Limit)) + } + + if options.Size { + query.Set("size", "1") + } + + options.Filters.updateURLValues(query) + + resp, err := cli.get(ctx, "/containers/json", query, nil) + defer ensureReaderClosed(resp) + if err != nil { + return ContainerListResult{}, err + } + + var containers []container.Summary + err = json.NewDecoder(resp.Body).Decode(&containers) + return ContainerListResult{Items: containers}, err +} diff --git a/vendor/github.com/moby/moby/client/container_logs.go b/vendor/github.com/moby/moby/client/container_logs.go new file mode 100644 index 00000000..b26a3568 --- /dev/null +++ b/vendor/github.com/moby/moby/client/container_logs.go @@ -0,0 +1,134 @@ +package client + +import ( + "context" + "fmt" + "io" + "net/url" + "time" + + "github.com/moby/moby/client/internal/timestamp" +) + +// ContainerLogsOptions holds parameters to filter logs with. +type ContainerLogsOptions struct { + ShowStdout bool + ShowStderr bool + Since string + Until string + Timestamps bool + Follow bool + Tail string + Details bool +} + +// ContainerLogsResult is the result of a container logs operation. +type ContainerLogsResult interface { + io.ReadCloser +} + +// ContainerLogs returns the logs generated by a container in an [io.ReadCloser]. +// It's up to the caller to close the stream. +// +// The underlying [io.ReadCloser] is automatically closed if the context is canceled, +// +// The stream format on the response uses one of two formats: +// +// - If the container is using a TTY, there is only a single stream (stdout) +// and data is copied directly from the container output stream, no extra +// multiplexing or headers. +// - If the container is *not* using a TTY, streams for stdout and stderr are +// multiplexed. +// +// The format of the multiplexed stream is defined in the [stdcopy] package, +// and as follows: +// +// [8]byte{STREAM_TYPE, 0, 0, 0, SIZE1, SIZE2, SIZE3, SIZE4}[]byte{OUTPUT} +// +// STREAM_TYPE can be 1 for [Stdout] and 2 for [Stderr]. Refer to [stdcopy.StdType] +// for details. SIZE1, SIZE2, SIZE3, and SIZE4 are four bytes of uint32 encoded +// as big endian, this is the size of OUTPUT. You can use [stdcopy.StdCopy] +// to demultiplex this stream. +// +// [stdcopy]: https://pkg.go.dev/github.com/moby/moby/api/pkg/stdcopy +// [stdcopy.StdCopy]: https://pkg.go.dev/github.com/moby/moby/api/pkg/stdcopy#StdCopy +// [stdcopy.StdType]: https://pkg.go.dev/github.com/moby/moby/api/pkg/stdcopy#StdType +// [Stdout]: https://pkg.go.dev/github.com/moby/moby/api/pkg/stdcopy#Stdout +// [Stderr]: https://pkg.go.dev/github.com/moby/moby/api/pkg/stdcopy#Stderr +func (cli *Client) ContainerLogs(ctx context.Context, containerID string, options ContainerLogsOptions) (ContainerLogsResult, error) { + containerID, err := trimID("container", containerID) + if err != nil { + return nil, err + } + + query := url.Values{} + if options.ShowStdout { + query.Set("stdout", "1") + } + + if options.ShowStderr { + query.Set("stderr", "1") + } + + if options.Since != "" { + ts, err := timestamp.GetTimestamp(options.Since, time.Now()) + if err != nil { + return nil, fmt.Errorf(`invalid value for "since": %w`, err) + } + query.Set("since", ts) + } + + if options.Until != "" { + ts, err := timestamp.GetTimestamp(options.Until, time.Now()) + if err != nil { + return nil, fmt.Errorf(`invalid value for "until": %w`, err) + } + query.Set("until", ts) + } + + if options.Timestamps { + query.Set("timestamps", "1") + } + + if options.Details { + query.Set("details", "1") + } + + if options.Follow { + query.Set("follow", "1") + } + + switch options.Tail { + case "", "all": + // don't send option; default is to show all logs. + // + // The default on the daemon-side is to show all logs; account for + // some special values. The CLI may set a magic "all" value that's + // used as default. + // + // Given that the default is to show all logs, we can ignore these + // values, and don't send "tail". + // + // see https://github.com/moby/moby/blob/0df791cb72b568eeadba2267fe9a5040d12b0487/daemon/logs.go#L75-L78 + // see https://github.com/moby/moby/blob/4d20b6fe56dfb2b06f4a5dd1f32913215a9c317b/daemon/cluster/services.go#L425-L449 + default: + query.Set("tail", options.Tail) + } + + resp, err := cli.get(ctx, "/containers/"+containerID+"/logs", query, nil) + if err != nil { + return nil, err + } + return &containerLogsResult{ + ReadCloser: newCancelReadCloser(ctx, resp.Body), + }, nil +} + +type containerLogsResult struct { + io.ReadCloser +} + +var ( + _ io.ReadCloser = (*containerLogsResult)(nil) + _ ContainerLogsResult = (*containerLogsResult)(nil) +) diff --git a/vendor/github.com/moby/moby/client/container_pause.go b/vendor/github.com/moby/moby/client/container_pause.go new file mode 100644 index 00000000..07669c89 --- /dev/null +++ b/vendor/github.com/moby/moby/client/container_pause.go @@ -0,0 +1,28 @@ +package client + +import "context" + +// ContainerPauseOptions holds options for [Client.ContainerPause]. +type ContainerPauseOptions struct { + // Add future optional parameters here. +} + +// ContainerPauseResult holds the result of [Client.ContainerPause], +type ContainerPauseResult struct { + // Add future fields here. +} + +// ContainerPause pauses the main process of a given container without terminating it. +func (cli *Client) ContainerPause(ctx context.Context, containerID string, options ContainerPauseOptions) (ContainerPauseResult, error) { + containerID, err := trimID("container", containerID) + if err != nil { + return ContainerPauseResult{}, err + } + + resp, err := cli.post(ctx, "/containers/"+containerID+"/pause", nil, nil, nil) + defer ensureReaderClosed(resp) + if err != nil { + return ContainerPauseResult{}, err + } + return ContainerPauseResult{}, nil +} diff --git a/vendor/github.com/moby/moby/client/container_prune.go b/vendor/github.com/moby/moby/client/container_prune.go new file mode 100644 index 00000000..f826f8b6 --- /dev/null +++ b/vendor/github.com/moby/moby/client/container_prune.go @@ -0,0 +1,39 @@ +package client + +import ( + "context" + "encoding/json" + "fmt" + "net/url" + + "github.com/moby/moby/api/types/container" +) + +// ContainerPruneOptions holds parameters to prune containers. +type ContainerPruneOptions struct { + Filters Filters +} + +// ContainerPruneResult holds the result from the [Client.ContainerPrune] method. +type ContainerPruneResult struct { + Report container.PruneReport +} + +// ContainerPrune requests the daemon to delete unused data +func (cli *Client) ContainerPrune(ctx context.Context, opts ContainerPruneOptions) (ContainerPruneResult, error) { + query := url.Values{} + opts.Filters.updateURLValues(query) + + resp, err := cli.post(ctx, "/containers/prune", query, nil, nil) + defer ensureReaderClosed(resp) + if err != nil { + return ContainerPruneResult{}, err + } + + var report container.PruneReport + if err := json.NewDecoder(resp.Body).Decode(&report); err != nil { + return ContainerPruneResult{}, fmt.Errorf("Error retrieving disk usage: %v", err) + } + + return ContainerPruneResult{Report: report}, nil +} diff --git a/vendor/github.com/moby/moby/client/container_remove.go b/vendor/github.com/moby/moby/client/container_remove.go new file mode 100644 index 00000000..0fbfa05f --- /dev/null +++ b/vendor/github.com/moby/moby/client/container_remove.go @@ -0,0 +1,45 @@ +package client + +import ( + "context" + "net/url" +) + +// ContainerRemoveOptions holds parameters to remove containers. +type ContainerRemoveOptions struct { + RemoveVolumes bool + RemoveLinks bool + Force bool +} + +// ContainerRemoveResult holds the result of [Client.ContainerRemove], +type ContainerRemoveResult struct { + // Add future fields here. +} + +// ContainerRemove kills and removes a container from the docker host. +func (cli *Client) ContainerRemove(ctx context.Context, containerID string, options ContainerRemoveOptions) (ContainerRemoveResult, error) { + containerID, err := trimID("container", containerID) + if err != nil { + return ContainerRemoveResult{}, err + } + + query := url.Values{} + if options.RemoveVolumes { + query.Set("v", "1") + } + if options.RemoveLinks { + query.Set("link", "1") + } + + if options.Force { + query.Set("force", "1") + } + + resp, err := cli.delete(ctx, "/containers/"+containerID, query, nil) + defer ensureReaderClosed(resp) + if err != nil { + return ContainerRemoveResult{}, err + } + return ContainerRemoveResult{}, nil +} diff --git a/vendor/github.com/moby/moby/client/container_rename.go b/vendor/github.com/moby/moby/client/container_rename.go new file mode 100644 index 00000000..4fd28a49 --- /dev/null +++ b/vendor/github.com/moby/moby/client/container_rename.go @@ -0,0 +1,39 @@ +package client + +import ( + "context" + "net/url" + "strings" + + cerrdefs "github.com/containerd/errdefs" +) + +// ContainerRenameOptions represents the options for renaming a container. +type ContainerRenameOptions struct { + NewName string +} + +// ContainerRenameResult represents the result of a container rename operation. +type ContainerRenameResult struct { + // This struct can be expanded in the future if needed +} + +// ContainerRename changes the name of a given container. +func (cli *Client) ContainerRename(ctx context.Context, containerID string, options ContainerRenameOptions) (ContainerRenameResult, error) { + containerID, err := trimID("container", containerID) + if err != nil { + return ContainerRenameResult{}, err + } + options.NewName = strings.TrimSpace(options.NewName) + if options.NewName == "" || strings.TrimPrefix(options.NewName, "/") == "" { + // daemons before v29.0 did not handle the canonical name ("/") well + // let's be nice and validate it here before sending + return ContainerRenameResult{}, cerrdefs.ErrInvalidArgument.WithMessage("new name cannot be blank") + } + + query := url.Values{} + query.Set("name", options.NewName) + resp, err := cli.post(ctx, "/containers/"+containerID+"/rename", query, nil, nil) + defer ensureReaderClosed(resp) + return ContainerRenameResult{}, err +} diff --git a/vendor/github.com/moby/moby/client/container_resize.go b/vendor/github.com/moby/moby/client/container_resize.go new file mode 100644 index 00000000..8ce26fb5 --- /dev/null +++ b/vendor/github.com/moby/moby/client/container_resize.go @@ -0,0 +1,64 @@ +package client + +import ( + "context" + "net/url" + "strconv" +) + +// ContainerResizeOptions holds parameters to resize a TTY. +// It can be used to resize container TTYs and +// exec process TTYs too. +type ContainerResizeOptions struct { + Height uint + Width uint +} + +// ContainerResizeResult holds the result of [Client.ContainerResize], +type ContainerResizeResult struct { + // Add future fields here. +} + +// ContainerResize changes the size of the pseudo-TTY for a container. +func (cli *Client) ContainerResize(ctx context.Context, containerID string, options ContainerResizeOptions) (ContainerResizeResult, error) { + containerID, err := trimID("container", containerID) + if err != nil { + return ContainerResizeResult{}, err + } + // FIXME(thaJeztah): the API / backend accepts uint32, but container.ResizeOptions uses uint. + query := url.Values{} + query.Set("h", strconv.FormatUint(uint64(options.Height), 10)) + query.Set("w", strconv.FormatUint(uint64(options.Width), 10)) + + resp, err := cli.post(ctx, "/containers/"+containerID+"/resize", query, nil, nil) + defer ensureReaderClosed(resp) + if err != nil { + return ContainerResizeResult{}, err + } + return ContainerResizeResult{}, nil +} + +// ExecResizeOptions holds options for resizing a container exec TTY. +type ExecResizeOptions ContainerResizeOptions + +// ExecResizeResult holds the result of resizing a container exec TTY. +type ExecResizeResult struct{} + +// ExecResize changes the size of the tty for an exec process running inside a container. +func (cli *Client) ExecResize(ctx context.Context, execID string, options ExecResizeOptions) (ExecResizeResult, error) { + execID, err := trimID("exec", execID) + if err != nil { + return ExecResizeResult{}, err + } + // FIXME(thaJeztah): the API / backend accepts uint32, but container.ResizeOptions uses uint. + query := url.Values{} + query.Set("h", strconv.FormatUint(uint64(options.Height), 10)) + query.Set("w", strconv.FormatUint(uint64(options.Width), 10)) + + resp, err := cli.post(ctx, "/exec/"+execID+"/resize", query, nil, nil) + defer ensureReaderClosed(resp) + if err != nil { + return ExecResizeResult{}, err + } + return ExecResizeResult{}, nil +} diff --git a/vendor/github.com/moby/moby/client/container_restart.go b/vendor/github.com/moby/moby/client/container_restart.go new file mode 100644 index 00000000..e883f758 --- /dev/null +++ b/vendor/github.com/moby/moby/client/container_restart.go @@ -0,0 +1,54 @@ +package client + +import ( + "context" + "net/url" + "strconv" +) + +// ContainerRestartOptions holds options for [Client.ContainerRestart]. +type ContainerRestartOptions struct { + // Signal (optional) is the signal to send to the container to (gracefully) + // stop it before forcibly terminating the container with SIGKILL after the + // timeout expires. If no value is set, the default (SIGTERM) is used. + Signal string `json:",omitempty"` + + // Timeout (optional) is the timeout (in seconds) to wait for the container + // to stop gracefully before forcibly terminating it with SIGKILL. + // + // - Use nil to use the default timeout (10 seconds). + // - Use '-1' to wait indefinitely. + // - Use '0' to not wait for the container to exit gracefully, and + // immediately proceeds to forcibly terminating the container. + // - Other positive values are used as timeout (in seconds). + Timeout *int `json:",omitempty"` +} + +// ContainerRestartResult holds the result of [Client.ContainerRestart], +type ContainerRestartResult struct { + // Add future fields here. +} + +// ContainerRestart stops, and starts a container again. +// It makes the daemon wait for the container to be up again for +// a specific amount of time, given the timeout. +func (cli *Client) ContainerRestart(ctx context.Context, containerID string, options ContainerRestartOptions) (ContainerRestartResult, error) { + containerID, err := trimID("container", containerID) + if err != nil { + return ContainerRestartResult{}, err + } + + query := url.Values{} + if options.Timeout != nil { + query.Set("t", strconv.Itoa(*options.Timeout)) + } + if options.Signal != "" { + query.Set("signal", options.Signal) + } + resp, err := cli.post(ctx, "/containers/"+containerID+"/restart", query, nil, nil) + defer ensureReaderClosed(resp) + if err != nil { + return ContainerRestartResult{}, err + } + return ContainerRestartResult{}, nil +} diff --git a/vendor/github.com/moby/moby/client/container_start.go b/vendor/github.com/moby/moby/client/container_start.go new file mode 100644 index 00000000..dfb821d1 --- /dev/null +++ b/vendor/github.com/moby/moby/client/container_start.go @@ -0,0 +1,40 @@ +package client + +import ( + "context" + "net/url" +) + +// ContainerStartOptions holds options for [Client.ContainerStart]. +type ContainerStartOptions struct { + CheckpointID string + CheckpointDir string +} + +// ContainerStartResult holds the result of [Client.ContainerStart], +type ContainerStartResult struct { + // Add future fields here. +} + +// ContainerStart sends a request to the docker daemon to start a container. +func (cli *Client) ContainerStart(ctx context.Context, containerID string, options ContainerStartOptions) (ContainerStartResult, error) { + containerID, err := trimID("container", containerID) + if err != nil { + return ContainerStartResult{}, err + } + + query := url.Values{} + if options.CheckpointID != "" { + query.Set("checkpoint", options.CheckpointID) + } + if options.CheckpointDir != "" { + query.Set("checkpoint-dir", options.CheckpointDir) + } + + resp, err := cli.post(ctx, "/containers/"+containerID+"/start", query, nil, nil) + defer ensureReaderClosed(resp) + if err != nil { + return ContainerStartResult{}, err + } + return ContainerStartResult{}, nil +} diff --git a/vendor/github.com/moby/moby/client/container_stats.go b/vendor/github.com/moby/moby/client/container_stats.go new file mode 100644 index 00000000..277769db --- /dev/null +++ b/vendor/github.com/moby/moby/client/container_stats.go @@ -0,0 +1,75 @@ +package client + +import ( + "context" + "io" + "net/url" +) + +// ContainerStatsOptions holds parameters to retrieve container statistics +// using the [Client.ContainerStats] method. +type ContainerStatsOptions struct { + // Stream enables streaming [container.StatsResponse] results instead + // of collecting a single sample. If enabled, the client remains attached + // until the [ContainerStatsResult.Body] is closed or the context is + // cancelled. + Stream bool + + // IncludePreviousSample asks the daemon to collect a prior sample to populate the + // [container.StatsResponse.PreRead] and [container.StatsResponse.PreCPUStats] + // fields. + // + // It set, the daemon collects two samples at a one-second interval before + // returning the result. The first sample populates the PreCPUStats (“previous + // CPU”) field, allowing delta calculations for CPU usage. If false, only + // a single sample is taken and returned immediately, leaving PreRead and + // PreCPUStats empty. + // + // This option has no effect if Stream is enabled. If Stream is enabled, + // [container.StatsResponse.PreCPUStats] is never populated for the first + // record. + IncludePreviousSample bool +} + +// ContainerStatsResult holds the result from [Client.ContainerStats]. +// +// It wraps an [io.ReadCloser] that provides one or more [container.StatsResponse] +// objects for a container, as produced by the "GET /containers/{id}/stats" endpoint. +// If streaming is disabled, the stream contains a single record. +type ContainerStatsResult struct { + Body io.ReadCloser +} + +// ContainerStats retrieves live resource usage statistics for the specified +// container. The caller must close the [io.ReadCloser] in the returned result +// to release associated resources. +// +// The underlying [io.ReadCloser] is automatically closed if the context is canceled, +func (cli *Client) ContainerStats(ctx context.Context, containerID string, options ContainerStatsOptions) (ContainerStatsResult, error) { + containerID, err := trimID("container", containerID) + if err != nil { + return ContainerStatsResult{}, err + } + + query := url.Values{} + if options.Stream { + query.Set("stream", "true") + } else { + // Note: daemons before v29.0 return an error if both set: "cannot have stream=true and one-shot=true" + // + // TODO(thaJeztah): consider making "stream=false" the default for the API as well, or using Accept Header to switch. + query.Set("stream", "false") + if !options.IncludePreviousSample { + query.Set("one-shot", "true") + } + } + + resp, err := cli.get(ctx, "/containers/"+containerID+"/stats", query, nil) + if err != nil { + return ContainerStatsResult{}, err + } + + return ContainerStatsResult{ + Body: newCancelReadCloser(ctx, resp.Body), + }, nil +} diff --git a/vendor/github.com/moby/moby/client/container_stop.go b/vendor/github.com/moby/moby/client/container_stop.go new file mode 100644 index 00000000..d4d47d8f --- /dev/null +++ b/vendor/github.com/moby/moby/client/container_stop.go @@ -0,0 +1,58 @@ +package client + +import ( + "context" + "net/url" + "strconv" +) + +// ContainerStopOptions holds the options for [Client.ContainerStop]. +type ContainerStopOptions struct { + // Signal (optional) is the signal to send to the container to (gracefully) + // stop it before forcibly terminating the container with SIGKILL after the + // timeout expires. If no value is set, the default (SIGTERM) is used. + Signal string `json:",omitempty"` + + // Timeout (optional) is the timeout (in seconds) to wait for the container + // to stop gracefully before forcibly terminating it with SIGKILL. + // + // - Use nil to use the default timeout (10 seconds). + // - Use '-1' to wait indefinitely. + // - Use '0' to not wait for the container to exit gracefully, and + // immediately proceeds to forcibly terminating the container. + // - Other positive values are used as timeout (in seconds). + Timeout *int `json:",omitempty"` +} + +// ContainerStopResult holds the result of [Client.ContainerStop], +type ContainerStopResult struct { + // Add future fields here. +} + +// ContainerStop stops a container. In case the container fails to stop +// gracefully within a time frame specified by the timeout argument, +// it is forcefully terminated (killed). +// +// If the timeout is nil, the container's StopTimeout value is used, if set, +// otherwise the engine default. A negative timeout value can be specified, +// meaning no timeout, i.e. no forceful termination is performed. +func (cli *Client) ContainerStop(ctx context.Context, containerID string, options ContainerStopOptions) (ContainerStopResult, error) { + containerID, err := trimID("container", containerID) + if err != nil { + return ContainerStopResult{}, err + } + + query := url.Values{} + if options.Timeout != nil { + query.Set("t", strconv.Itoa(*options.Timeout)) + } + if options.Signal != "" { + query.Set("signal", options.Signal) + } + resp, err := cli.post(ctx, "/containers/"+containerID+"/stop", query, nil, nil) + defer ensureReaderClosed(resp) + if err != nil { + return ContainerStopResult{}, err + } + return ContainerStopResult{}, nil +} diff --git a/vendor/github.com/moby/moby/client/container_top.go b/vendor/github.com/moby/moby/client/container_top.go new file mode 100644 index 00000000..dc0af8ae --- /dev/null +++ b/vendor/github.com/moby/moby/client/container_top.go @@ -0,0 +1,44 @@ +package client + +import ( + "context" + "encoding/json" + "net/url" + "strings" + + "github.com/moby/moby/api/types/container" +) + +// ContainerTopOptions defines options for container top operations. +type ContainerTopOptions struct { + Arguments []string +} + +// ContainerTopResult represents the result of a ContainerTop operation. +type ContainerTopResult struct { + Processes [][]string + Titles []string +} + +// ContainerTop shows process information from within a container. +func (cli *Client) ContainerTop(ctx context.Context, containerID string, options ContainerTopOptions) (ContainerTopResult, error) { + containerID, err := trimID("container", containerID) + if err != nil { + return ContainerTopResult{}, err + } + + query := url.Values{} + if len(options.Arguments) > 0 { + query.Set("ps_args", strings.Join(options.Arguments, " ")) + } + + resp, err := cli.get(ctx, "/containers/"+containerID+"/top", query, nil) + defer ensureReaderClosed(resp) + if err != nil { + return ContainerTopResult{}, err + } + + var response container.TopResponse + err = json.NewDecoder(resp.Body).Decode(&response) + return ContainerTopResult{Processes: response.Processes, Titles: response.Titles}, err +} diff --git a/vendor/github.com/moby/moby/client/container_unpause.go b/vendor/github.com/moby/moby/client/container_unpause.go new file mode 100644 index 00000000..627d60c9 --- /dev/null +++ b/vendor/github.com/moby/moby/client/container_unpause.go @@ -0,0 +1,28 @@ +package client + +import "context" + +// ContainerUnpauseOptions holds options for [Client.ContainerUnpause]. +type ContainerUnpauseOptions struct { + // Add future optional parameters here. +} + +// ContainerUnpauseResult holds the result of [Client.ContainerUnpause], +type ContainerUnpauseResult struct { + // Add future fields here. +} + +// ContainerUnpause resumes the process execution within a container. +func (cli *Client) ContainerUnpause(ctx context.Context, containerID string, options ContainerUnpauseOptions) (ContainerUnpauseResult, error) { + containerID, err := trimID("container", containerID) + if err != nil { + return ContainerUnpauseResult{}, err + } + + resp, err := cli.post(ctx, "/containers/"+containerID+"/unpause", nil, nil, nil) + defer ensureReaderClosed(resp) + if err != nil { + return ContainerUnpauseResult{}, err + } + return ContainerUnpauseResult{}, nil +} diff --git a/vendor/github.com/moby/moby/client/container_update.go b/vendor/github.com/moby/moby/client/container_update.go new file mode 100644 index 00000000..a1d4d249 --- /dev/null +++ b/vendor/github.com/moby/moby/client/container_update.go @@ -0,0 +1,46 @@ +package client + +import ( + "context" + "encoding/json" + + "github.com/moby/moby/api/types/container" +) + +// ContainerUpdateOptions holds options for [Client.ContainerUpdate]. +type ContainerUpdateOptions struct { + Resources *container.Resources + RestartPolicy *container.RestartPolicy +} + +// ContainerUpdateResult is the result from updating a container. +type ContainerUpdateResult struct { + // Warnings encountered when updating the container. + Warnings []string +} + +// ContainerUpdate updates the resources of a container. +func (cli *Client) ContainerUpdate(ctx context.Context, containerID string, options ContainerUpdateOptions) (ContainerUpdateResult, error) { + containerID, err := trimID("container", containerID) + if err != nil { + return ContainerUpdateResult{}, err + } + + updateConfig := container.UpdateConfig{} + if options.Resources != nil { + updateConfig.Resources = *options.Resources + } + if options.RestartPolicy != nil { + updateConfig.RestartPolicy = *options.RestartPolicy + } + + resp, err := cli.post(ctx, "/containers/"+containerID+"/update", nil, updateConfig, nil) + defer ensureReaderClosed(resp) + if err != nil { + return ContainerUpdateResult{}, err + } + + var response container.UpdateResponse + err = json.NewDecoder(resp.Body).Decode(&response) + return ContainerUpdateResult{Warnings: response.Warnings}, err +} diff --git a/vendor/github.com/moby/moby/client/container_wait.go b/vendor/github.com/moby/moby/client/container_wait.go new file mode 100644 index 00000000..6f71ed05 --- /dev/null +++ b/vendor/github.com/moby/moby/client/container_wait.go @@ -0,0 +1,92 @@ +package client + +import ( + "bytes" + "context" + "encoding/json" + "errors" + "io" + "net/url" + + "github.com/moby/moby/api/types/container" +) + +const containerWaitErrorMsgLimit = 2 * 1024 /* Max: 2KiB */ + +// ContainerWaitOptions holds options for [Client.ContainerWait]. +type ContainerWaitOptions struct { + Condition container.WaitCondition +} + +// ContainerWaitResult defines the result from the [Client.ContainerWait] method. +type ContainerWaitResult struct { + Result <-chan container.WaitResponse + Error <-chan error +} + +// ContainerWait waits until the specified container is in a certain state +// indicated by the given condition, either; +// +// - "not-running" ([container.WaitConditionNotRunning]) (default) +// - "next-exit" ([container.WaitConditionNextExit]) +// - "removed" ([container.WaitConditionRemoved]) +// +// ContainerWait blocks until the request has been acknowledged by the server +// (with a response header), then returns two channels on which the caller can +// wait for the exit status of the container or an error if there was a problem +// either beginning the wait request or in getting the response. This allows the +// caller to synchronize ContainerWait with other calls, such as specifying a +// "next-exit" condition ([container.WaitConditionNextExit]) before issuing a +// [Client.ContainerStart] request. +func (cli *Client) ContainerWait(ctx context.Context, containerID string, options ContainerWaitOptions) ContainerWaitResult { + resultC := make(chan container.WaitResponse) + errC := make(chan error, 1) + + containerID, err := trimID("container", containerID) + if err != nil { + errC <- err + return ContainerWaitResult{Result: resultC, Error: errC} + } + + query := url.Values{} + if options.Condition != "" { + query.Set("condition", string(options.Condition)) + } + + resp, err := cli.post(ctx, "/containers/"+containerID+"/wait", query, nil, nil) + if err != nil { + defer ensureReaderClosed(resp) + errC <- err + return ContainerWaitResult{Result: resultC, Error: errC} + } + + go func() { + defer ensureReaderClosed(resp) + + responseText := bytes.NewBuffer(nil) + stream := io.TeeReader(resp.Body, responseText) + + var res container.WaitResponse + if err := json.NewDecoder(stream).Decode(&res); err != nil { + // NOTE(nicks): The /wait API does not work well with HTTP proxies. + // At any time, the proxy could cut off the response stream. + // + // But because the HTTP status has already been written, the proxy's + // only option is to write a plaintext error message. + // + // If there's a JSON parsing error, read the real error message + // off the body and send it to the client. + if errors.As(err, new(*json.SyntaxError)) { + _, _ = io.ReadAll(io.LimitReader(stream, containerWaitErrorMsgLimit)) + errC <- errors.New(responseText.String()) + } else { + errC <- err + } + return + } + + resultC <- res + }() + + return ContainerWaitResult{Result: resultC, Error: errC} +} diff --git a/vendor/github.com/moby/moby/client/distribution_inspect.go b/vendor/github.com/moby/moby/client/distribution_inspect.go new file mode 100644 index 00000000..ffbf869d --- /dev/null +++ b/vendor/github.com/moby/moby/client/distribution_inspect.go @@ -0,0 +1,45 @@ +package client + +import ( + "context" + "encoding/json" + "net/http" + "net/url" + + "github.com/moby/moby/api/types/registry" +) + +// DistributionInspectResult holds the result of the DistributionInspect operation. +type DistributionInspectResult struct { + registry.DistributionInspect +} + +// DistributionInspectOptions holds options for the DistributionInspect operation. +type DistributionInspectOptions struct { + EncodedRegistryAuth string +} + +// DistributionInspect returns the image digest with the full manifest. +func (cli *Client) DistributionInspect(ctx context.Context, imageRef string, options DistributionInspectOptions) (DistributionInspectResult, error) { + if imageRef == "" { + return DistributionInspectResult{}, objectNotFoundError{object: "distribution", id: imageRef} + } + + var headers http.Header + if options.EncodedRegistryAuth != "" { + headers = http.Header{ + registry.AuthHeader: {options.EncodedRegistryAuth}, + } + } + + // Contact the registry to retrieve digest and platform information + resp, err := cli.get(ctx, "/distribution/"+imageRef+"/json", url.Values{}, headers) + defer ensureReaderClosed(resp) + if err != nil { + return DistributionInspectResult{}, err + } + + var distributionInspect registry.DistributionInspect + err = json.NewDecoder(resp.Body).Decode(&distributionInspect) + return DistributionInspectResult{DistributionInspect: distributionInspect}, err +} diff --git a/vendor/github.com/moby/moby/client/envvars.go b/vendor/github.com/moby/moby/client/envvars.go new file mode 100644 index 00000000..a02295d1 --- /dev/null +++ b/vendor/github.com/moby/moby/client/envvars.go @@ -0,0 +1,95 @@ +package client + +const ( + // EnvOverrideHost is the name of the environment variable that can be used + // to override the default host to connect to (DefaultDockerHost). + // + // This env-var is read by [FromEnv] and [WithHostFromEnv] and when set to a + // non-empty value, takes precedence over the default host (which is platform + // specific), or any host already set. + EnvOverrideHost = "DOCKER_HOST" + + // EnvOverrideAPIVersion is the name of the environment variable that can + // be used to override the API version to use. Value must be + // formatted as MAJOR.MINOR, for example, "1.19". + // + // This env-var is read by [FromEnv] and [WithAPIVersionFromEnv] and when set to a + // non-empty value, takes precedence over API version negotiation. + // + // This environment variable should be used for debugging purposes only, as + // it can set the client to use an incompatible (or invalid) API version. + EnvOverrideAPIVersion = "DOCKER_API_VERSION" + + // EnvOverrideCertPath is the name of the environment variable that can be + // used to specify the directory from which to load the TLS certificates + // (ca.pem, cert.pem, key.pem) from. These certificates are used to configure + // the [Client] for a TCP connection protected by TLS client authentication. + // + // TLS certificate verification is enabled by default if the Client is configured + // to use a TLS connection. Refer to [EnvTLSVerify] below to learn how to + // disable verification for testing purposes. + // + // WARNING: Access to the remote API is equivalent to root access to the + // host where the daemon runs. Do not expose the API without protection, + // and only if needed. Make sure you are familiar with the ["daemon attack surface"]. + // + // For local access to the API, it is recommended to connect with the daemon + // using the default local socket connection (on Linux), or the named pipe + // (on Windows). + // + // If you need to access the API of a remote daemon, consider using an SSH + // (ssh://) connection, which is easier to set up, and requires no additional + // configuration if the host is accessible using ssh. + // + // If you cannot use the alternatives above, and you must expose the API over + // a TCP connection. Refer to [Protect the Docker daemon socket] + // to learn how to configure the daemon and client to use a TCP connection + // with TLS client authentication. Make sure you know the differences between + // a regular TLS connection and a TLS connection protected by TLS client + // authentication, and verify that the API cannot be accessed by other clients. + // + // ["daemon attack surface"]: https://docs.docker.com/go/attack-surface/ + // [Protect the Docker daemon socket]: https://docs.docker.com/engine/security/protect-access/ + EnvOverrideCertPath = "DOCKER_CERT_PATH" + + // EnvTLSVerify is the name of the environment variable that can be used to + // enable or disable TLS certificate verification. When set to a non-empty + // value, TLS certificate verification is enabled, and the client is configured + // to use a TLS connection, using certificates from the default directories + // (within `~/.docker`); refer to EnvOverrideCertPath above for additional + // details. + // + // WARNING: Access to the remote API is equivalent to root access to the + // host where the daemon runs. Do not expose the API without protection, + // and only if needed. Make sure you are familiar with the ["daemon attack surface"]. + // + // Before setting up your client and daemon to use a TCP connection with TLS + // client authentication, consider using one of the alternatives mentioned + // in [EnvOverrideCertPath]. + // + // Disabling TLS certificate verification (for testing purposes) + // + // TLS certificate verification is enabled by default if the Client is configured + // to use a TLS connection, and it is highly recommended to keep verification + // enabled to prevent machine-in-the-middle attacks. Refer to [Protect the Docker daemon socket] + // in the documentation and pages linked from that page to learn how to + // configure the daemon and client to use a TCP connection with TLS client + // authentication enabled. + // + // Set the "DOCKER_TLS_VERIFY" environment to an empty string ("") to + // disable TLS certificate verification. Disabling verification is insecure, + // so should only be done for testing purposes. + // + // From the[crypto/tls.Config] documentation: + // + // InsecureSkipVerify controls whether a client verifies the server's + // certificate chain and host name. If InsecureSkipVerify is true, crypto/tls + // accepts any certificate presented by the server and any host name in that + // certificate. In this mode, TLS is susceptible to machine-in-the-middle + // attacks unless custom verification is used. This should be used only for + // testing or in combination with VerifyConnection or VerifyPeerCertificate. + // + // ["daemon attack surface"]: https://docs.docker.com/go/attack-surface/ + // [Protect the Docker daemon socket]: https://docs.docker.com/engine/security/protect-access/ + EnvTLSVerify = "DOCKER_TLS_VERIFY" +) diff --git a/vendor/github.com/moby/moby/client/errors.go b/vendor/github.com/moby/moby/client/errors.go new file mode 100644 index 00000000..9fbfa766 --- /dev/null +++ b/vendor/github.com/moby/moby/client/errors.go @@ -0,0 +1,114 @@ +package client + +import ( + "context" + "errors" + "fmt" + "net/http" + + cerrdefs "github.com/containerd/errdefs" + "github.com/containerd/errdefs/pkg/errhttp" + "github.com/moby/moby/client/pkg/versions" +) + +// errConnectionFailed implements an error returned when connection failed. +type errConnectionFailed struct { + error +} + +// Error returns a string representation of an errConnectionFailed +func (e errConnectionFailed) Error() string { + return e.error.Error() +} + +func (e errConnectionFailed) Unwrap() error { + return e.error +} + +// IsErrConnectionFailed returns true if the error is caused by connection failed. +func IsErrConnectionFailed(err error) bool { + return errors.As(err, &errConnectionFailed{}) +} + +// connectionFailed returns an error with host in the error message when connection +// to docker daemon failed. +func connectionFailed(host string) error { + var err error + if host == "" { + err = errors.New("Cannot connect to the Docker daemon. Is the docker daemon running on this host?") + } else { + err = fmt.Errorf("Cannot connect to the Docker daemon at %s. Is the docker daemon running?", host) + } + return errConnectionFailed{error: err} +} + +type objectNotFoundError struct { + object string + id string +} + +func (e objectNotFoundError) NotFound() {} + +func (e objectNotFoundError) Error() string { + return fmt.Sprintf("Error: No such %s: %s", e.object, e.id) +} + +// requiresVersion returns an error if the APIVersion required is less than the +// current supported version. +// +// It performs API-version negotiation if the Client is configured with this +// option, otherwise it assumes the latest API version is used. +func (cli *Client) requiresVersion(ctx context.Context, apiRequired, feature string) error { + // Make sure we negotiated (if the client is configured to do so), + // as code below contains API-version specific handling of options. + // + // Normally, version-negotiation (if enabled) would not happen until + // the API request is made. + if err := cli.checkVersion(ctx); err != nil { + return err + } + if cli.version != "" && versions.LessThan(cli.version, apiRequired) { + return fmt.Errorf("%q requires API version %s, but the Docker daemon API version is %s", feature, apiRequired, cli.version) + } + return nil +} + +type httpError struct { + err error + errdef error +} + +func (e *httpError) Error() string { + return e.err.Error() +} + +func (e *httpError) Unwrap() error { + return e.err +} + +func (e *httpError) Is(target error) bool { + return errors.Is(e.errdef, target) +} + +// httpErrorFromStatusCode creates an errdef error, based on the provided HTTP status-code +func httpErrorFromStatusCode(err error, statusCode int) error { + if err == nil { + return nil + } + base := errhttp.ToNative(statusCode) + if base != nil { + return &httpError{err: err, errdef: base} + } + + switch { + case statusCode >= http.StatusOK && statusCode < http.StatusBadRequest: + // it's a client error + return err + case statusCode >= http.StatusBadRequest && statusCode < http.StatusInternalServerError: + return &httpError{err: err, errdef: cerrdefs.ErrInvalidArgument} + case statusCode >= http.StatusInternalServerError && statusCode < 600: + return &httpError{err: err, errdef: cerrdefs.ErrInternal} + default: + return &httpError{err: err, errdef: cerrdefs.ErrUnknown} + } +} diff --git a/vendor/github.com/moby/moby/client/filters.go b/vendor/github.com/moby/moby/client/filters.go new file mode 100644 index 00000000..3669ae0d --- /dev/null +++ b/vendor/github.com/moby/moby/client/filters.go @@ -0,0 +1,58 @@ +package client + +import ( + "encoding/json" + "maps" + "net/url" +) + +// Filters describes a predicate for an API request. +// +// Each entry in the map is a filter term. +// Each term is evaluated against the set of values. +// A filter term is satisfied if any one of the values in the set is a match. +// An item matches the filters when all terms are satisfied. +// +// Like all other map types in Go, the zero value is empty and read-only. +type Filters map[string]map[string]bool + +// Add appends values to the value-set of term. +// +// The receiver f is returned for chaining. +// +// f := make(Filters).Add("name", "foo", "bar").Add("status", "exited") +func (f Filters) Add(term string, values ...string) Filters { + if _, ok := f[term]; !ok { + f[term] = make(map[string]bool) + } + for _, v := range values { + f[term][v] = true + } + return f +} + +// Clone returns a deep copy of f. +func (f Filters) Clone() Filters { + out := make(Filters, len(f)) + for term, values := range f { + inner := make(map[string]bool, len(values)) + maps.Copy(inner, values) + out[term] = inner + } + return out +} + +// updateURLValues sets the "filters" key in values to the marshalled value of +// f, replacing any existing values. When f is empty, any existing "filters" key +// is removed. +func (f Filters) updateURLValues(values url.Values) { + if len(f) > 0 { + b, err := json.Marshal(f) + if err != nil { + panic(err) // Marshaling builtin types should never fail + } + values.Set("filters", string(b)) + } else { + values.Del("filters") + } +} diff --git a/vendor/github.com/moby/moby/client/hijack.go b/vendor/github.com/moby/moby/client/hijack.go new file mode 100644 index 00000000..31c44e59 --- /dev/null +++ b/vendor/github.com/moby/moby/client/hijack.go @@ -0,0 +1,172 @@ +package client + +import ( + "bufio" + "context" + "fmt" + "net" + "net/http" + "net/url" + "time" + + "go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp" +) + +// postHijacked sends a POST request and hijacks the connection. +func (cli *Client) postHijacked(ctx context.Context, path string, query url.Values, body any, headers map[string][]string) (HijackedResponse, error) { + jsonBody, err := jsonEncode(body) + if err != nil { + return HijackedResponse{}, err + } + req, err := cli.buildRequest(ctx, http.MethodPost, cli.getAPIPath(ctx, path, query), jsonBody, headers) + if err != nil { + return HijackedResponse{}, err + } + conn, mediaType, err := setupHijackConn(cli.dialer(), req, "tcp") + if err != nil { + return HijackedResponse{}, err + } + + return NewHijackedResponse(conn, mediaType), nil +} + +// DialHijack returns a hijacked connection with negotiated protocol proto. +func (cli *Client) DialHijack(ctx context.Context, url, proto string, meta map[string][]string) (net.Conn, error) { + req, err := http.NewRequestWithContext(ctx, http.MethodPost, url, http.NoBody) + if err != nil { + return nil, err + } + req = cli.addHeaders(req, meta) + + conn, _, err := setupHijackConn(cli.Dialer(), req, proto) + return conn, err +} + +func setupHijackConn(dialer func(context.Context) (net.Conn, error), req *http.Request, proto string) (_ net.Conn, _ string, retErr error) { + ctx := req.Context() + req.Header.Set("Connection", "Upgrade") + req.Header.Set("Upgrade", proto) + + conn, err := dialer(ctx) + if err != nil { + return nil, "", fmt.Errorf("cannot connect to the Docker daemon. Is 'docker daemon' running on this host?: %w", err) + } + defer func() { + if retErr != nil { + _ = conn.Close() + } + }() + + // When we set up a TCP connection for hijack, there could be long periods + // of inactivity (a long running command with no output) that in certain + // network setups may cause ECONNTIMEOUT, leaving the client in an unknown + // state. Setting TCP KeepAlive on the socket connection prohibits + // ECONNTIMEOUT unless the socket connection truly is broken + if tcpConn, ok := conn.(*net.TCPConn); ok { + _ = tcpConn.SetKeepAlive(true) + _ = tcpConn.SetKeepAlivePeriod(30 * time.Second) + } + + hc := &hijackedConn{conn, bufio.NewReader(conn)} + + // Server hijacks the connection, error 'connection closed' expected + resp, err := otelhttp.NewTransport(hc).RoundTrip(req) + if err != nil { + return nil, "", err + } + if resp.StatusCode != http.StatusSwitchingProtocols { + _ = resp.Body.Close() + return nil, "", fmt.Errorf("unable to upgrade to %s, received %d", proto, resp.StatusCode) + } + + if hc.r.Buffered() > 0 { + // If there is buffered content, wrap the connection. We return an + // object that implements CloseWrite if the underlying connection + // implements it. + if _, ok := hc.Conn.(CloseWriter); ok { + conn = &hijackedConnCloseWriter{hc} + } else { + conn = hc + } + } else { + hc.r.Reset(nil) + } + + return conn, resp.Header.Get("Content-Type"), nil +} + +// hijackedConn wraps a net.Conn and is returned by setupHijackConn in the case +// that a) there was already buffered data in the http layer when Hijack() was +// called, and b) the underlying net.Conn does *not* implement CloseWrite(). +// hijackedConn does not implement CloseWrite() either. +type hijackedConn struct { + net.Conn + r *bufio.Reader +} + +func (c *hijackedConn) RoundTrip(req *http.Request) (*http.Response, error) { + if err := req.Write(c.Conn); err != nil { + return nil, err + } + return http.ReadResponse(c.r, req) +} + +func (c *hijackedConn) Read(b []byte) (int, error) { + return c.r.Read(b) +} + +// hijackedConnCloseWriter is a hijackedConn which additionally implements +// CloseWrite(). It is returned by setupHijackConn in the case that a) there +// was already buffered data in the http layer when Hijack() was called, and b) +// the underlying net.Conn *does* implement CloseWrite(). +type hijackedConnCloseWriter struct { + *hijackedConn +} + +var _ CloseWriter = &hijackedConnCloseWriter{} + +func (c *hijackedConnCloseWriter) CloseWrite() error { + conn := c.Conn.(CloseWriter) + return conn.CloseWrite() +} + +// NewHijackedResponse initializes a [HijackedResponse] type. +func NewHijackedResponse(conn net.Conn, mediaType string) HijackedResponse { + return HijackedResponse{Conn: conn, Reader: bufio.NewReader(conn), mediaType: mediaType} +} + +// HijackedResponse holds connection information for a hijacked request. +type HijackedResponse struct { + mediaType string + Conn net.Conn + Reader *bufio.Reader +} + +// Close closes the hijacked connection and reader. +func (h *HijackedResponse) Close() { + h.Conn.Close() +} + +// MediaType let client know if HijackedResponse hold a raw or multiplexed stream. +// returns false if HTTP Content-Type is not relevant, and the container must be +// inspected. +func (h *HijackedResponse) MediaType() (string, bool) { + if h.mediaType == "" { + return "", false + } + return h.mediaType, true +} + +// CloseWriter is an interface that implements structs +// that close input streams to prevent from writing. +type CloseWriter interface { + CloseWrite() error +} + +// CloseWrite closes a readWriter for writing. +func (h *HijackedResponse) CloseWrite() error { + if conn, ok := h.Conn.(CloseWriter); ok { + return conn.CloseWrite() + } + return nil +} diff --git a/vendor/github.com/moby/moby/client/image_build.go b/vendor/github.com/moby/moby/client/image_build.go new file mode 100644 index 00000000..67ac204a --- /dev/null +++ b/vendor/github.com/moby/moby/client/image_build.go @@ -0,0 +1,179 @@ +package client + +import ( + "context" + "encoding/base64" + "encoding/json" + "io" + "net/http" + "net/url" + "strconv" + + cerrdefs "github.com/containerd/errdefs" + "github.com/moby/moby/api/types/container" + "github.com/moby/moby/api/types/network" +) + +// ImageBuild sends a request to the daemon to build images. +// The Body in the response implements an [io.ReadCloser] and it's up to the caller to +// close it. +func (cli *Client) ImageBuild(ctx context.Context, buildContext io.Reader, options ImageBuildOptions) (ImageBuildResult, error) { + query, err := cli.imageBuildOptionsToQuery(ctx, options) + if err != nil { + return ImageBuildResult{}, err + } + + buf, err := json.Marshal(options.AuthConfigs) // #nosec G117 -- ignore "Marshaled struct field "Password" (JSON key "password") matches secret pattern" + if err != nil { + return ImageBuildResult{}, err + } + + headers := http.Header{} + headers.Add("X-Registry-Config", base64.URLEncoding.EncodeToString(buf)) + headers.Set("Content-Type", "application/x-tar") + + resp, err := cli.postRaw(ctx, "/build", query, buildContext, headers) + if err != nil { + return ImageBuildResult{}, err + } + + return ImageBuildResult{ + Body: resp.Body, + }, nil +} + +func (cli *Client) imageBuildOptionsToQuery(_ context.Context, options ImageBuildOptions) (url.Values, error) { + query := url.Values{} + if len(options.Tags) > 0 { + query["t"] = options.Tags + } + if len(options.SecurityOpt) > 0 { + query["securityopt"] = options.SecurityOpt + } + if len(options.ExtraHosts) > 0 { + query["extrahosts"] = options.ExtraHosts + } + if options.SuppressOutput { + query.Set("q", "1") + } + if options.RemoteContext != "" { + query.Set("remote", options.RemoteContext) + } + if options.NoCache { + query.Set("nocache", "1") + } + if !options.Remove { + // only send value when opting out because the daemon's default is + // to remove intermediate containers after a successful build, + // + // TODO(thaJeztah): deprecate "Remove" option, and provide a "NoRemove" or "Keep" option instead. + query.Set("rm", "0") + } + + if options.ForceRemove { + query.Set("forcerm", "1") + } + + if options.PullParent { + query.Set("pull", "1") + } + + if options.Squash { + // TODO(thaJeztah): squash is experimental, and deprecated when using BuildKit? + query.Set("squash", "1") + } + + if !container.Isolation.IsDefault(options.Isolation) { + query.Set("isolation", string(options.Isolation)) + } + + if options.CPUSetCPUs != "" { + query.Set("cpusetcpus", options.CPUSetCPUs) + } + if options.NetworkMode != "" && options.NetworkMode != network.NetworkDefault { + query.Set("networkmode", options.NetworkMode) + } + if options.CPUSetMems != "" { + query.Set("cpusetmems", options.CPUSetMems) + } + if options.CPUShares != 0 { + query.Set("cpushares", strconv.FormatInt(options.CPUShares, 10)) + } + if options.CPUQuota != 0 { + query.Set("cpuquota", strconv.FormatInt(options.CPUQuota, 10)) + } + if options.CPUPeriod != 0 { + query.Set("cpuperiod", strconv.FormatInt(options.CPUPeriod, 10)) + } + if options.Memory != 0 { + query.Set("memory", strconv.FormatInt(options.Memory, 10)) + } + if options.MemorySwap != 0 { + query.Set("memswap", strconv.FormatInt(options.MemorySwap, 10)) + } + if options.CgroupParent != "" { + query.Set("cgroupparent", options.CgroupParent) + } + if options.ShmSize != 0 { + query.Set("shmsize", strconv.FormatInt(options.ShmSize, 10)) + } + if options.Dockerfile != "" { + query.Set("dockerfile", options.Dockerfile) + } + if options.Target != "" { + query.Set("target", options.Target) + } + if len(options.Ulimits) != 0 { + ulimitsJSON, err := json.Marshal(options.Ulimits) + if err != nil { + return query, err + } + query.Set("ulimits", string(ulimitsJSON)) + } + if len(options.BuildArgs) != 0 { + buildArgsJSON, err := json.Marshal(options.BuildArgs) + if err != nil { + return query, err + } + query.Set("buildargs", string(buildArgsJSON)) + } + if len(options.Labels) != 0 { + labelsJSON, err := json.Marshal(options.Labels) + if err != nil { + return query, err + } + query.Set("labels", string(labelsJSON)) + } + if len(options.CacheFrom) != 0 { + cacheFromJSON, err := json.Marshal(options.CacheFrom) + if err != nil { + return query, err + } + query.Set("cachefrom", string(cacheFromJSON)) + } + if options.SessionID != "" { + query.Set("session", options.SessionID) + } + if len(options.Platforms) > 0 { + if len(options.Platforms) > 1 { + // TODO(thaJeztah): update API spec and add equivalent check on the daemon. We need this still for older daemons, which would ignore it. + return query, cerrdefs.ErrInvalidArgument.WithMessage("specifying multiple platforms is not yet supported") + } + query.Set("platform", formatPlatform(options.Platforms[0])) + } + if options.BuildID != "" { + query.Set("buildid", options.BuildID) + } + if options.Version != "" { + query.Set("version", string(options.Version)) + } + + if options.Outputs != nil { + outputsJSON, err := json.Marshal(options.Outputs) + if err != nil { + return query, err + } + query.Set("outputs", string(outputsJSON)) + } + return query, nil +} diff --git a/vendor/github.com/moby/moby/client/image_build_opts.go b/vendor/github.com/moby/moby/client/image_build_opts.go new file mode 100644 index 00000000..f65ad0f2 --- /dev/null +++ b/vendor/github.com/moby/moby/client/image_build_opts.go @@ -0,0 +1,79 @@ +package client + +import ( + "io" + + "github.com/moby/moby/api/types/build" + "github.com/moby/moby/api/types/container" + "github.com/moby/moby/api/types/registry" + ocispec "github.com/opencontainers/image-spec/specs-go/v1" +) + +// ImageBuildOptions holds the information +// necessary to build images. +type ImageBuildOptions struct { + Tags []string + SuppressOutput bool + RemoteContext string + NoCache bool + Remove bool + ForceRemove bool + PullParent bool + Isolation container.Isolation + CPUSetCPUs string + CPUSetMems string + CPUShares int64 + CPUQuota int64 + CPUPeriod int64 + Memory int64 + MemorySwap int64 + CgroupParent string + NetworkMode string + ShmSize int64 + Dockerfile string + Ulimits []*container.Ulimit + // BuildArgs needs to be a *string instead of just a string so that + // we can tell the difference between "" (empty string) and no value + // at all (nil). See the parsing of buildArgs in + // api/server/router/build/build_routes.go for even more info. + BuildArgs map[string]*string + AuthConfigs map[string]registry.AuthConfig + Context io.Reader + Labels map[string]string + // squash the resulting image's layers to the parent + // preserves the original image and creates a new one from the parent with all + // the changes applied to a single layer + Squash bool + // CacheFrom specifies images that are used for matching cache. Images + // specified here do not need to have a valid parent chain to match cache. + CacheFrom []string + SecurityOpt []string + ExtraHosts []string // List of extra hosts + Target string + SessionID string + // Platforms selects the platforms to build the image for. Multiple platforms + // can be provided if the daemon supports multi-platform builds. + Platforms []ocispec.Platform + // Version specifies the version of the underlying builder to use + Version build.BuilderVersion + // BuildID is an optional identifier that can be passed together with the + // build request. The same identifier can be used to gracefully cancel the + // build with the cancel request. + BuildID string + // Outputs defines configurations for exporting build results. Only supported + // in BuildKit mode + Outputs []ImageBuildOutput +} + +// ImageBuildOutput defines configuration for exporting a build result +type ImageBuildOutput struct { + Type string + Attrs map[string]string +} + +// ImageBuildResult holds information +// returned by a server after building +// an image. +type ImageBuildResult struct { + Body io.ReadCloser +} diff --git a/vendor/github.com/moby/moby/client/image_history.go b/vendor/github.com/moby/moby/client/image_history.go new file mode 100644 index 00000000..8618f155 --- /dev/null +++ b/vendor/github.com/moby/moby/client/image_history.go @@ -0,0 +1,55 @@ +package client + +import ( + "context" + "encoding/json" + "fmt" + "net/url" + + ocispec "github.com/opencontainers/image-spec/specs-go/v1" +) + +// ImageHistoryWithPlatform sets the platform for the image history operation. +func ImageHistoryWithPlatform(platform ocispec.Platform) ImageHistoryOption { + return imageHistoryOptionFunc(func(opt *imageHistoryOpts) error { + if opt.apiOptions.Platform != nil { + return fmt.Errorf("platform already set to %s", *opt.apiOptions.Platform) + } + opt.apiOptions.Platform = &platform + return nil + }) +} + +// ImageHistory returns the changes in an image in history format. +func (cli *Client) ImageHistory(ctx context.Context, imageID string, historyOpts ...ImageHistoryOption) (ImageHistoryResult, error) { + query := url.Values{} + + var opts imageHistoryOpts + for _, o := range historyOpts { + if err := o.Apply(&opts); err != nil { + return ImageHistoryResult{}, err + } + } + + if opts.apiOptions.Platform != nil { + if err := cli.requiresVersion(ctx, "1.48", "platform"); err != nil { + return ImageHistoryResult{}, err + } + + p, err := encodePlatform(opts.apiOptions.Platform) + if err != nil { + return ImageHistoryResult{}, err + } + query.Set("platform", p) + } + + resp, err := cli.get(ctx, "/images/"+imageID+"/history", query, nil) + defer ensureReaderClosed(resp) + if err != nil { + return ImageHistoryResult{}, err + } + + var history ImageHistoryResult + err = json.NewDecoder(resp.Body).Decode(&history.Items) + return history, err +} diff --git a/vendor/github.com/moby/moby/client/image_history_opts.go b/vendor/github.com/moby/moby/client/image_history_opts.go new file mode 100644 index 00000000..7fc57afd --- /dev/null +++ b/vendor/github.com/moby/moby/client/image_history_opts.go @@ -0,0 +1,29 @@ +package client + +import ( + "github.com/moby/moby/api/types/image" + ocispec "github.com/opencontainers/image-spec/specs-go/v1" +) + +// ImageHistoryOption is a type representing functional options for the image history operation. +type ImageHistoryOption interface { + Apply(*imageHistoryOpts) error +} +type imageHistoryOptionFunc func(opt *imageHistoryOpts) error + +func (f imageHistoryOptionFunc) Apply(o *imageHistoryOpts) error { + return f(o) +} + +type imageHistoryOpts struct { + apiOptions imageHistoryOptions +} + +type imageHistoryOptions struct { + // Platform from the manifest list to use for history. + Platform *ocispec.Platform +} + +type ImageHistoryResult struct { + Items []image.HistoryResponseItem +} diff --git a/vendor/github.com/moby/moby/client/image_import.go b/vendor/github.com/moby/moby/client/image_import.go new file mode 100644 index 00000000..6c9f2286 --- /dev/null +++ b/vendor/github.com/moby/moby/client/image_import.go @@ -0,0 +1,66 @@ +package client + +import ( + "context" + "io" + "net/url" + + "github.com/distribution/reference" +) + +// ImageImportResult holds the response body returned by the daemon for image import. +type ImageImportResult interface { + io.ReadCloser +} + +// ImageImport creates a new image based on the source options. It returns the +// JSON content in the [ImageImportResult]. +// +// The underlying [io.ReadCloser] is automatically closed if the context is canceled, +func (cli *Client) ImageImport(ctx context.Context, source ImageImportSource, ref string, options ImageImportOptions) (ImageImportResult, error) { + if ref != "" { + // Check if the given image name can be resolved + if _, err := reference.ParseNormalizedNamed(ref); err != nil { + return nil, err + } + } + + query := url.Values{} + if source.SourceName != "" { + query.Set("fromSrc", source.SourceName) + } + if ref != "" { + query.Set("repo", ref) + } + if options.Tag != "" { + query.Set("tag", options.Tag) + } + if options.Message != "" { + query.Set("message", options.Message) + } + if p := formatPlatform(options.Platform); p != "unknown" { + // TODO(thaJeztah): would we ever support multiple platforms here? (would require multiple rootfs tars as well?) + query.Set("platform", p) + } + for _, change := range options.Changes { + query.Add("changes", change) + } + + resp, err := cli.postRaw(ctx, "/images/create", query, source.Source, nil) + if err != nil { + return nil, err + } + return &imageImportResult{ + ReadCloser: newCancelReadCloser(ctx, resp.Body), + }, nil +} + +// ImageImportResult holds the response body returned by the daemon for image import. +type imageImportResult struct { + io.ReadCloser +} + +var ( + _ io.ReadCloser = (*imageImportResult)(nil) + _ ImageImportResult = (*imageImportResult)(nil) +) diff --git a/vendor/github.com/moby/moby/client/image_import_opts.go b/vendor/github.com/moby/moby/client/image_import_opts.go new file mode 100644 index 00000000..c70473bd --- /dev/null +++ b/vendor/github.com/moby/moby/client/image_import_opts.go @@ -0,0 +1,21 @@ +package client + +import ( + "io" + + ocispec "github.com/opencontainers/image-spec/specs-go/v1" +) + +// ImageImportSource holds source information for ImageImport +type ImageImportSource struct { + Source io.Reader // Source is the data to send to the server to create this image from. You must set SourceName to "-" to leverage this. + SourceName string // SourceName is the name of the image to pull. Set to "-" to leverage the Source attribute. +} + +// ImageImportOptions holds information to import images from the client host. +type ImageImportOptions struct { + Tag string // Tag is the name to tag this image with. This attribute is deprecated. + Message string // Message is the message to tag the image with + Changes []string // Changes are the raw changes to apply to this image + Platform ocispec.Platform // Platform is the target platform of the image +} diff --git a/vendor/github.com/moby/moby/client/image_inspect.go b/vendor/github.com/moby/moby/client/image_inspect.go new file mode 100644 index 00000000..635931fd --- /dev/null +++ b/vendor/github.com/moby/moby/client/image_inspect.go @@ -0,0 +1,62 @@ +package client + +import ( + "bytes" + "context" + "encoding/json" + "fmt" + "io" + "net/url" +) + +// ImageInspect returns the image information. +func (cli *Client) ImageInspect(ctx context.Context, imageID string, inspectOpts ...ImageInspectOption) (ImageInspectResult, error) { + if imageID == "" { + return ImageInspectResult{}, objectNotFoundError{object: "image", id: imageID} + } + + var opts imageInspectOpts + for _, opt := range inspectOpts { + if err := opt.Apply(&opts); err != nil { + return ImageInspectResult{}, fmt.Errorf("error applying image inspect option: %w", err) + } + } + + query := url.Values{} + if opts.apiOptions.Manifests { + if err := cli.requiresVersion(ctx, "1.48", "manifests"); err != nil { + return ImageInspectResult{}, err + } + query.Set("manifests", "1") + } + + if opts.apiOptions.Platform != nil { + if err := cli.requiresVersion(ctx, "1.49", "platform"); err != nil { + return ImageInspectResult{}, err + } + platform, err := encodePlatform(opts.apiOptions.Platform) + if err != nil { + return ImageInspectResult{}, err + } + query.Set("platform", platform) + } + + resp, err := cli.get(ctx, "/images/"+imageID+"/json", query, nil) + defer ensureReaderClosed(resp) + if err != nil { + return ImageInspectResult{}, err + } + + buf := opts.raw + if buf == nil { + buf = &bytes.Buffer{} + } + + if _, err := io.Copy(buf, resp.Body); err != nil { + return ImageInspectResult{}, err + } + + var response ImageInspectResult + err = json.Unmarshal(buf.Bytes(), &response) + return response, err +} diff --git a/vendor/github.com/moby/moby/client/image_inspect_opts.go b/vendor/github.com/moby/moby/client/image_inspect_opts.go new file mode 100644 index 00000000..266c1fe8 --- /dev/null +++ b/vendor/github.com/moby/moby/client/image_inspect_opts.go @@ -0,0 +1,69 @@ +package client + +import ( + "bytes" + + "github.com/moby/moby/api/types/image" + ocispec "github.com/opencontainers/image-spec/specs-go/v1" +) + +// ImageInspectOption is a type representing functional options for the image inspect operation. +type ImageInspectOption interface { + Apply(*imageInspectOpts) error +} +type imageInspectOptionFunc func(opt *imageInspectOpts) error + +func (f imageInspectOptionFunc) Apply(o *imageInspectOpts) error { + return f(o) +} + +// ImageInspectWithRawResponse instructs the client to additionally store the +// raw inspect response in the provided buffer. +func ImageInspectWithRawResponse(raw *bytes.Buffer) ImageInspectOption { + return imageInspectOptionFunc(func(opts *imageInspectOpts) error { + opts.raw = raw + return nil + }) +} + +// ImageInspectWithManifests sets manifests API option for the image inspect operation. +// This option is only available for API version 1.48 and up. +// With this option set, the image inspect operation response includes +// the [image.InspectResponse.Manifests] field if the server is multi-platform +// capable. +func ImageInspectWithManifests(manifests bool) ImageInspectOption { + return imageInspectOptionFunc(func(clientOpts *imageInspectOpts) error { + clientOpts.apiOptions.Manifests = manifests + return nil + }) +} + +// ImageInspectWithPlatform sets platform API option for the image inspect operation. +// This option is only available for API version 1.49 and up. +// With this option set, the image inspect operation returns information for the +// specified platform variant of the multi-platform image. +func ImageInspectWithPlatform(platform *ocispec.Platform) ImageInspectOption { + return imageInspectOptionFunc(func(clientOpts *imageInspectOpts) error { + clientOpts.apiOptions.Platform = platform + return nil + }) +} + +type imageInspectOpts struct { + raw *bytes.Buffer + apiOptions imageInspectOptions +} + +type imageInspectOptions struct { + // Manifests returns the image manifests. + Manifests bool + + // Platform selects the specific platform of a multi-platform image to inspect. + // + // This option is only available for API version 1.49 and up. + Platform *ocispec.Platform +} + +type ImageInspectResult struct { + image.InspectResponse +} diff --git a/vendor/github.com/moby/moby/client/image_list.go b/vendor/github.com/moby/moby/client/image_list.go new file mode 100644 index 00000000..8570709a --- /dev/null +++ b/vendor/github.com/moby/moby/client/image_list.go @@ -0,0 +1,61 @@ +package client + +import ( + "context" + "encoding/json" + "net/url" + + "github.com/moby/moby/api/types/image" + "github.com/moby/moby/client/pkg/versions" +) + +// ImageList returns a list of images in the docker host. +// +// Experimental: Set the [image.ListOptions.Manifest] option +// to include [image.Summary.Manifests] with information about image manifests. +// This is experimental and might change in the future without any backward +// compatibility. +func (cli *Client) ImageList(ctx context.Context, options ImageListOptions) (ImageListResult, error) { + var images []image.Summary + + query := url.Values{} + + options.Filters.updateURLValues(query) + if options.All { + query.Set("all", "1") + } + if options.SharedSize { + query.Set("shared-size", "1") + } + if options.Manifests { + // Make sure we negotiated (if the client is configured to do so), + // as code below contains API-version specific handling of options. + // + // Normally, version-negotiation (if enabled) would not happen until + // the API request is made. + if err := cli.checkVersion(ctx); err != nil { + return ImageListResult{}, err + } + + if versions.GreaterThanOrEqualTo(cli.version, "1.47") { + query.Set("manifests", "1") + } + } + if options.Identity { + if err := cli.requiresVersion(ctx, "1.54", "identity"); err != nil { + return ImageListResult{}, err + } + // Identity data in image list is scoped to manifests. + query.Set("manifests", "1") + query.Set("identity", "1") + } + + resp, err := cli.get(ctx, "/images/json", query, nil) + defer ensureReaderClosed(resp) + if err != nil { + return ImageListResult{}, err + } + + err = json.NewDecoder(resp.Body).Decode(&images) + return ImageListResult{Items: images}, err +} diff --git a/vendor/github.com/moby/moby/client/image_list_opts.go b/vendor/github.com/moby/moby/client/image_list_opts.go new file mode 100644 index 00000000..297ab960 --- /dev/null +++ b/vendor/github.com/moby/moby/client/image_list_opts.go @@ -0,0 +1,27 @@ +package client + +import "github.com/moby/moby/api/types/image" + +// ImageListOptions holds parameters to list images with. +type ImageListOptions struct { + // All controls whether all images in the graph are filtered, or just + // the heads. + All bool + + // Filters is a JSON-encoded set of filter arguments. + Filters Filters + + // SharedSize indicates whether the shared size of images should be computed. + SharedSize bool + + // Manifests indicates whether the image manifests should be returned. + Manifests bool + + // Identity indicates whether image identity information should be returned. + Identity bool +} + +// ImageListResult holds the result from ImageList. +type ImageListResult struct { + Items []image.Summary +} diff --git a/vendor/github.com/moby/moby/client/image_load.go b/vendor/github.com/moby/moby/client/image_load.go new file mode 100644 index 00000000..ec5fcae6 --- /dev/null +++ b/vendor/github.com/moby/moby/client/image_load.go @@ -0,0 +1,64 @@ +package client + +import ( + "context" + "io" + "net/http" + "net/url" +) + +// ImageLoadResult returns information to the client about a load process. +// It implements [io.ReadCloser] and must be closed to avoid a resource leak. +type ImageLoadResult interface { + io.ReadCloser +} + +// ImageLoad loads an image in the docker host from the client host. It's up +// to the caller to close the [ImageLoadResult] returned by this function. +// +// The underlying [io.ReadCloser] is automatically closed if the context is canceled, +func (cli *Client) ImageLoad(ctx context.Context, input io.Reader, loadOpts ...ImageLoadOption) (ImageLoadResult, error) { + var opts imageLoadOpts + for _, opt := range loadOpts { + if err := opt.Apply(&opts); err != nil { + return nil, err + } + } + + query := url.Values{} + query.Set("quiet", "0") + if opts.apiOptions.Quiet { + query.Set("quiet", "1") + } + if len(opts.apiOptions.Platforms) > 0 { + if err := cli.requiresVersion(ctx, "1.48", "platform"); err != nil { + return nil, err + } + + p, err := encodePlatforms(opts.apiOptions.Platforms...) + if err != nil { + return nil, err + } + query["platform"] = p + } + + resp, err := cli.postRaw(ctx, "/images/load", query, input, http.Header{ + "Content-Type": {"application/x-tar"}, + }) + if err != nil { + return nil, err + } + return &imageLoadResult{ + ReadCloser: newCancelReadCloser(ctx, resp.Body), + }, nil +} + +// imageLoadResult returns information to the client about a load process. +type imageLoadResult struct { + io.ReadCloser +} + +var ( + _ io.ReadCloser = (*imageLoadResult)(nil) + _ ImageLoadResult = (*imageLoadResult)(nil) +) diff --git a/vendor/github.com/moby/moby/client/image_load_opts.go b/vendor/github.com/moby/moby/client/image_load_opts.go new file mode 100644 index 00000000..aeb4fcf8 --- /dev/null +++ b/vendor/github.com/moby/moby/client/image_load_opts.go @@ -0,0 +1,53 @@ +package client + +import ( + "fmt" + + ocispec "github.com/opencontainers/image-spec/specs-go/v1" +) + +// ImageLoadOption is a type representing functional options for the image load operation. +type ImageLoadOption interface { + Apply(*imageLoadOpts) error +} +type imageLoadOptionFunc func(opt *imageLoadOpts) error + +func (f imageLoadOptionFunc) Apply(o *imageLoadOpts) error { + return f(o) +} + +type imageLoadOpts struct { + apiOptions imageLoadOptions +} + +type imageLoadOptions struct { + // Quiet suppresses progress output + Quiet bool + + // Platforms selects the platforms to load if the image is a + // multi-platform image and has multiple variants. + Platforms []ocispec.Platform +} + +// ImageLoadWithQuiet sets the quiet option for the image load operation. +func ImageLoadWithQuiet(quiet bool) ImageLoadOption { + return imageLoadOptionFunc(func(opt *imageLoadOpts) error { + opt.apiOptions.Quiet = quiet + return nil + }) +} + +// ImageLoadWithPlatforms sets the platforms to be loaded from the image. +// +// Platform is an optional parameter that specifies the platform to load from +// the provided multi-platform image. Passing a platform only has an effect +// if the input image is a multi-platform image. +func ImageLoadWithPlatforms(platforms ...ocispec.Platform) ImageLoadOption { + return imageLoadOptionFunc(func(opt *imageLoadOpts) error { + if opt.apiOptions.Platforms != nil { + return fmt.Errorf("platforms already set to %v", opt.apiOptions.Platforms) + } + opt.apiOptions.Platforms = platforms + return nil + }) +} diff --git a/vendor/github.com/moby/moby/client/image_prune.go b/vendor/github.com/moby/moby/client/image_prune.go new file mode 100644 index 00000000..7f3a25b8 --- /dev/null +++ b/vendor/github.com/moby/moby/client/image_prune.go @@ -0,0 +1,39 @@ +package client + +import ( + "context" + "encoding/json" + "fmt" + "net/url" + + "github.com/moby/moby/api/types/image" +) + +// ImagePruneOptions holds parameters to prune images. +type ImagePruneOptions struct { + Filters Filters +} + +// ImagePruneResult holds the result from the [Client.ImagePrune] method. +type ImagePruneResult struct { + Report image.PruneReport +} + +// ImagePrune requests the daemon to delete unused data +func (cli *Client) ImagePrune(ctx context.Context, opts ImagePruneOptions) (ImagePruneResult, error) { + query := url.Values{} + opts.Filters.updateURLValues(query) + + resp, err := cli.post(ctx, "/images/prune", query, nil, nil) + defer ensureReaderClosed(resp) + if err != nil { + return ImagePruneResult{}, err + } + + var report image.PruneReport + if err := json.NewDecoder(resp.Body).Decode(&report); err != nil { + return ImagePruneResult{}, fmt.Errorf("Error retrieving disk usage: %v", err) + } + + return ImagePruneResult{Report: report}, nil +} diff --git a/vendor/github.com/moby/moby/client/image_pull.go b/vendor/github.com/moby/moby/client/image_pull.go new file mode 100644 index 00000000..11c0afa4 --- /dev/null +++ b/vendor/github.com/moby/moby/client/image_pull.go @@ -0,0 +1,93 @@ +package client + +import ( + "context" + "io" + "iter" + "net/http" + "net/url" + + cerrdefs "github.com/containerd/errdefs" + "github.com/distribution/reference" + "github.com/moby/moby/api/types/jsonstream" + "github.com/moby/moby/api/types/registry" + "github.com/moby/moby/client/internal" +) + +type ImagePullResponse interface { + io.ReadCloser + JSONMessages(ctx context.Context) iter.Seq2[jsonstream.Message, error] + Wait(ctx context.Context) error +} + +// ImagePull requests the docker host to pull an image from a remote registry. +// It executes the privileged function if the operation is unauthorized +// and it tries one more time. +// Callers can: +// - use [ImagePullResponse.Wait] to wait for pull to complete +// - use [ImagePullResponse.JSONMessages] to monitor pull progress as a sequence +// of JSONMessages, [ImagePullResponse.Close] does not need to be called in this case. +// - use the [io.Reader] interface and call [ImagePullResponse.Close] after processing. +func (cli *Client) ImagePull(ctx context.Context, refStr string, options ImagePullOptions) (ImagePullResponse, error) { + // FIXME(vdemeester): there is currently used in a few way in docker/docker + // - if not in trusted content, ref is used to pass the whole reference, and tag is empty + // - if in trusted content, ref is used to pass the reference name, and tag for the digest + // + // ref; https://github.com/docker-archive-public/docker.engine-api/pull/162 + + ref, err := reference.ParseNormalizedNamed(refStr) + if err != nil { + return nil, err + } + + query := url.Values{} + query.Set("fromImage", ref.Name()) + if !options.All { + query.Set("tag", getAPITagFromNamedRef(ref)) + } + if len(options.Platforms) > 0 { + if len(options.Platforms) > 1 { + // TODO(thaJeztah): update API spec and add equivalent check on the daemon. We need this still for older daemons, which would ignore it. + return nil, cerrdefs.ErrInvalidArgument.WithMessage("specifying multiple platforms is not yet supported") + } + query.Set("platform", formatPlatform(options.Platforms[0])) + } + resp, err := cli.tryImageCreate(ctx, query, staticAuth(options.RegistryAuth)) + if cerrdefs.IsUnauthorized(err) && options.PrivilegeFunc != nil { + resp, err = cli.tryImageCreate(ctx, query, options.PrivilegeFunc) + } + if err != nil { + return nil, err + } + + return internal.NewJSONMessageStream(resp.Body), nil +} + +// getAPITagFromNamedRef returns a tag from the specified reference. +// This function is necessary as long as the docker "server" api expects +// digests to be sent as tags and makes a distinction between the name +// and tag/digest part of a reference. +func getAPITagFromNamedRef(ref reference.Named) string { + if digested, ok := ref.(reference.Digested); ok { + return digested.Digest().String() + } + ref = reference.TagNameOnly(ref) + if tagged, ok := ref.(reference.Tagged); ok { + return tagged.Tag() + } + return "" +} + +func (cli *Client) tryImageCreate(ctx context.Context, query url.Values, resolveAuth registry.RequestAuthConfig) (*http.Response, error) { + hdr := http.Header{} + if resolveAuth != nil { + registryAuth, err := resolveAuth(ctx) + if err != nil { + return nil, err + } + if registryAuth != "" { + hdr.Set(registry.AuthHeader, registryAuth) + } + } + return cli.post(ctx, "/images/create", query, nil, hdr) +} diff --git a/vendor/github.com/moby/moby/client/image_pull_opts.go b/vendor/github.com/moby/moby/client/image_pull_opts.go new file mode 100644 index 00000000..1b78185d --- /dev/null +++ b/vendor/github.com/moby/moby/client/image_pull_opts.go @@ -0,0 +1,25 @@ +package client + +import ( + "context" + + ocispec "github.com/opencontainers/image-spec/specs-go/v1" +) + +// ImagePullOptions holds information to pull images. +type ImagePullOptions struct { + All bool + RegistryAuth string // RegistryAuth is the base64 encoded credentials for the registry + + // PrivilegeFunc is a function that clients can supply to retry operations + // after getting an authorization error. This function returns the registry + // authentication header value in base64 encoded format, or an error if the + // privilege request fails. + // + // For details, refer to [github.com/moby/moby/api/types/registry.RequestAuthConfig]. + PrivilegeFunc func(context.Context) (string, error) + + // Platforms selects the platforms to pull. Multiple platforms can be + // specified if the image ia a multi-platform image. + Platforms []ocispec.Platform +} diff --git a/vendor/github.com/moby/moby/client/image_push.go b/vendor/github.com/moby/moby/client/image_push.go new file mode 100644 index 00000000..5dd8bc14 --- /dev/null +++ b/vendor/github.com/moby/moby/client/image_push.go @@ -0,0 +1,98 @@ +package client + +import ( + "context" + "encoding/json" + "errors" + "fmt" + "io" + "iter" + "net/http" + "net/url" + + cerrdefs "github.com/containerd/errdefs" + "github.com/distribution/reference" + "github.com/moby/moby/api/types/jsonstream" + "github.com/moby/moby/api/types/registry" + "github.com/moby/moby/client/internal" +) + +type ImagePushResponse interface { + io.ReadCloser + JSONMessages(ctx context.Context) iter.Seq2[jsonstream.Message, error] + Wait(ctx context.Context) error +} + +// ImagePush requests the docker host to push an image to a remote registry. +// It executes the privileged function if the operation is unauthorized +// and it tries one more time. +// Callers can +// - use [ImagePushResponse.Wait] to wait for push to complete +// - use [ImagePushResponse.JSONMessages] to monitor pull progress as a sequence +// of JSONMessages, [ImagePushResponse.Close] does not need to be called in this case. +// - use the [io.Reader] interface and call [ImagePushResponse.Close] after processing. +func (cli *Client) ImagePush(ctx context.Context, image string, options ImagePushOptions) (ImagePushResponse, error) { + ref, err := reference.ParseNormalizedNamed(image) + if err != nil { + return nil, err + } + + if _, ok := ref.(reference.Digested); ok { + return nil, errors.New("cannot push a digest reference") + } + + query := url.Values{} + if !options.All { + ref = reference.TagNameOnly(ref) + if tagged, ok := ref.(reference.Tagged); ok { + query.Set("tag", tagged.Tag()) + } + } + + if options.Platform != nil { + if err := cli.requiresVersion(ctx, "1.46", "platform"); err != nil { + return nil, err + } + + p := *options.Platform + pJson, err := json.Marshal(p) + if err != nil { + return nil, fmt.Errorf("invalid platform: %v", err) + } + + query.Set("platform", string(pJson)) + } + + resp, err := cli.tryImagePush(ctx, ref.Name(), query, staticAuth(options.RegistryAuth)) + if cerrdefs.IsUnauthorized(err) && options.PrivilegeFunc != nil { + resp, err = cli.tryImagePush(ctx, ref.Name(), query, options.PrivilegeFunc) + } + if err != nil { + return nil, err + } + return internal.NewJSONMessageStream(resp.Body), nil +} + +func (cli *Client) tryImagePush(ctx context.Context, imageID string, query url.Values, resolveAuth registry.RequestAuthConfig) (*http.Response, error) { + hdr := http.Header{} + if resolveAuth != nil { + registryAuth, err := resolveAuth(ctx) + if err != nil { + return nil, err + } + if registryAuth != "" { + hdr.Set(registry.AuthHeader, registryAuth) + } + } + + // Always send a body (which may be an empty JSON document ("{}")) to prevent + // EOF errors on older daemons which had faulty fallback code for handling + // authentication in the body when no auth-header was set, resulting in; + // + // Error response from daemon: bad parameters and missing X-Registry-Auth: invalid X-Registry-Auth header: EOF + // + // We use [http.NoBody], which gets marshaled to an empty JSON document. + // + // see: https://github.com/moby/moby/commit/ea29dffaa541289591aa44fa85d2a596ce860e16 + return cli.post(ctx, "/images/"+imageID+"/push", query, http.NoBody, hdr) +} diff --git a/vendor/github.com/moby/moby/client/image_push_opts.go b/vendor/github.com/moby/moby/client/image_push_opts.go new file mode 100644 index 00000000..591c6b60 --- /dev/null +++ b/vendor/github.com/moby/moby/client/image_push_opts.go @@ -0,0 +1,26 @@ +package client + +import ( + "context" + + ocispec "github.com/opencontainers/image-spec/specs-go/v1" +) + +// ImagePushOptions holds information to push images. +type ImagePushOptions struct { + All bool + RegistryAuth string // RegistryAuth is the base64 encoded credentials for the registry + + // PrivilegeFunc is a function that clients can supply to retry operations + // after getting an authorization error. This function returns the registry + // authentication header value in base64 encoded format, or an error if the + // privilege request fails. + // + // For details, refer to [github.com/moby/moby/api/types/registry.RequestAuthConfig]. + PrivilegeFunc func(context.Context) (string, error) + + // Platform is an optional field that selects a specific platform to push + // when the image is a multi-platform image. + // Using this will only push a single platform-specific manifest. + Platform *ocispec.Platform `json:",omitempty"` +} diff --git a/vendor/github.com/moby/moby/client/image_remove.go b/vendor/github.com/moby/moby/client/image_remove.go new file mode 100644 index 00000000..095b4f04 --- /dev/null +++ b/vendor/github.com/moby/moby/client/image_remove.go @@ -0,0 +1,39 @@ +package client + +import ( + "context" + "encoding/json" + "net/url" + + "github.com/moby/moby/api/types/image" +) + +// ImageRemove removes an image from the docker host. +func (cli *Client) ImageRemove(ctx context.Context, imageID string, options ImageRemoveOptions) (ImageRemoveResult, error) { + query := url.Values{} + + if options.Force { + query.Set("force", "1") + } + if !options.PruneChildren { + query.Set("noprune", "1") + } + + if len(options.Platforms) > 0 { + p, err := encodePlatforms(options.Platforms...) + if err != nil { + return ImageRemoveResult{}, err + } + query["platforms"] = p + } + + resp, err := cli.delete(ctx, "/images/"+imageID, query, nil) + defer ensureReaderClosed(resp) + if err != nil { + return ImageRemoveResult{}, err + } + + var dels []image.DeleteResponse + err = json.NewDecoder(resp.Body).Decode(&dels) + return ImageRemoveResult{Items: dels}, err +} diff --git a/vendor/github.com/moby/moby/client/image_remove_opts.go b/vendor/github.com/moby/moby/client/image_remove_opts.go new file mode 100644 index 00000000..3b5d8a77 --- /dev/null +++ b/vendor/github.com/moby/moby/client/image_remove_opts.go @@ -0,0 +1,18 @@ +package client + +import ( + "github.com/moby/moby/api/types/image" + ocispec "github.com/opencontainers/image-spec/specs-go/v1" +) + +// ImageRemoveOptions holds parameters to remove images. +type ImageRemoveOptions struct { + Platforms []ocispec.Platform + Force bool + PruneChildren bool +} + +// ImageRemoveResult holds the delete responses returned by the daemon. +type ImageRemoveResult struct { + Items []image.DeleteResponse +} diff --git a/vendor/github.com/moby/moby/client/image_save.go b/vendor/github.com/moby/moby/client/image_save.go new file mode 100644 index 00000000..508f88b7 --- /dev/null +++ b/vendor/github.com/moby/moby/client/image_save.go @@ -0,0 +1,59 @@ +package client + +import ( + "context" + "io" + "net/url" +) + +type ImageSaveResult interface { + io.ReadCloser +} + +// ImageSave retrieves one or more images from the docker host as an +// [ImageSaveResult]. Callers should close the reader, but the underlying +// [io.ReadCloser] is automatically closed if the context is canceled, +// +// Platforms is an optional parameter that specifies the platforms to save +// from the image. Passing a platform only has an effect if the input image +// is a multi-platform image. +func (cli *Client) ImageSave(ctx context.Context, imageIDs []string, saveOpts ...ImageSaveOption) (ImageSaveResult, error) { + var opts imageSaveOpts + for _, opt := range saveOpts { + if err := opt.Apply(&opts); err != nil { + return nil, err + } + } + + query := url.Values{ + "names": imageIDs, + } + + if len(opts.apiOptions.Platforms) > 0 { + if err := cli.requiresVersion(ctx, "1.48", "platform"); err != nil { + return nil, err + } + p, err := encodePlatforms(opts.apiOptions.Platforms...) + if err != nil { + return nil, err + } + query["platform"] = p + } + + resp, err := cli.get(ctx, "/images/get", query, nil) + if err != nil { + return nil, err + } + return &imageSaveResult{ + ReadCloser: newCancelReadCloser(ctx, resp.Body), + }, nil +} + +type imageSaveResult struct { + io.ReadCloser +} + +var ( + _ io.ReadCloser = (*imageSaveResult)(nil) + _ ImageSaveResult = (*imageSaveResult)(nil) +) diff --git a/vendor/github.com/moby/moby/client/image_save_opts.go b/vendor/github.com/moby/moby/client/image_save_opts.go new file mode 100644 index 00000000..9c0b3b74 --- /dev/null +++ b/vendor/github.com/moby/moby/client/image_save_opts.go @@ -0,0 +1,41 @@ +package client + +import ( + "fmt" + + ocispec "github.com/opencontainers/image-spec/specs-go/v1" +) + +type ImageSaveOption interface { + Apply(*imageSaveOpts) error +} + +type imageSaveOptionFunc func(opt *imageSaveOpts) error + +func (f imageSaveOptionFunc) Apply(o *imageSaveOpts) error { + return f(o) +} + +// ImageSaveWithPlatforms sets the platforms to be saved from the image. It +// produces an error if platforms are already set. This option only has an +// effect if the input image is a multi-platform image. +func ImageSaveWithPlatforms(platforms ...ocispec.Platform) ImageSaveOption { + // TODO(thaJeztah): verify the GoDoc; do we produce an error for a single-platform image without the given platform? + return imageSaveOptionFunc(func(opt *imageSaveOpts) error { + if opt.apiOptions.Platforms != nil { + return fmt.Errorf("platforms already set to %v", opt.apiOptions.Platforms) + } + opt.apiOptions.Platforms = platforms + return nil + }) +} + +type imageSaveOpts struct { + apiOptions imageSaveOptions +} + +type imageSaveOptions struct { + // Platforms selects the platforms to save if the image is a + // multi-platform image and has multiple variants. + Platforms []ocispec.Platform +} diff --git a/vendor/github.com/moby/moby/client/image_search.go b/vendor/github.com/moby/moby/client/image_search.go new file mode 100644 index 00000000..6e280906 --- /dev/null +++ b/vendor/github.com/moby/moby/client/image_search.go @@ -0,0 +1,47 @@ +package client + +import ( + "context" + "encoding/json" + "net/http" + "net/url" + "strconv" + + cerrdefs "github.com/containerd/errdefs" + "github.com/moby/moby/api/types/registry" +) + +// ImageSearch makes the docker host search by a term in a remote registry. +// The list of results is not sorted in any fashion. +func (cli *Client) ImageSearch(ctx context.Context, term string, options ImageSearchOptions) (ImageSearchResult, error) { + var results []registry.SearchResult + query := url.Values{} + query.Set("term", term) + if options.Limit > 0 { + query.Set("limit", strconv.Itoa(options.Limit)) + } + + options.Filters.updateURLValues(query) + + resp, err := cli.tryImageSearch(ctx, query, options.RegistryAuth) + defer ensureReaderClosed(resp) + if cerrdefs.IsUnauthorized(err) && options.PrivilegeFunc != nil { + newAuthHeader, privilegeErr := options.PrivilegeFunc(ctx) + if privilegeErr != nil { + return ImageSearchResult{}, privilegeErr + } + resp, err = cli.tryImageSearch(ctx, query, newAuthHeader) + } + if err != nil { + return ImageSearchResult{}, err + } + + err = json.NewDecoder(resp.Body).Decode(&results) + return ImageSearchResult{Items: results}, err +} + +func (cli *Client) tryImageSearch(ctx context.Context, query url.Values, registryAuth string) (*http.Response, error) { + return cli.get(ctx, "/images/search", query, http.Header{ + registry.AuthHeader: {registryAuth}, + }) +} diff --git a/vendor/github.com/moby/moby/client/image_search_opts.go b/vendor/github.com/moby/moby/client/image_search_opts.go new file mode 100644 index 00000000..95a7d41f --- /dev/null +++ b/vendor/github.com/moby/moby/client/image_search_opts.go @@ -0,0 +1,27 @@ +package client + +import ( + "context" + + "github.com/moby/moby/api/types/registry" +) + +// ImageSearchResult wraps results returned by ImageSearch. +type ImageSearchResult struct { + Items []registry.SearchResult +} + +// ImageSearchOptions holds parameters to search images with. +type ImageSearchOptions struct { + RegistryAuth string + + // PrivilegeFunc is a function that clients can supply to retry operations + // after getting an authorization error. This function returns the registry + // authentication header value in base64 encoded format, or an error if the + // privilege request fails. + // + // For details, refer to [github.com/moby/moby/api/types/registry.RequestAuthConfig]. + PrivilegeFunc func(context.Context) (string, error) + Filters Filters + Limit int +} diff --git a/vendor/github.com/moby/moby/client/image_tag.go b/vendor/github.com/moby/moby/client/image_tag.go new file mode 100644 index 00000000..37272914 --- /dev/null +++ b/vendor/github.com/moby/moby/client/image_tag.go @@ -0,0 +1,50 @@ +package client + +import ( + "context" + "errors" + "fmt" + "net/url" + + "github.com/distribution/reference" +) + +// ImageTagOptions holds options for [Client.ImageTag]. +type ImageTagOptions struct { + Source string + Target string +} + +// ImageTagResult holds the result of [Client.ImageTag]. +type ImageTagResult struct{} + +// ImageTag tags an image in the docker host +func (cli *Client) ImageTag(ctx context.Context, options ImageTagOptions) (ImageTagResult, error) { + source := options.Source + target := options.Target + + if _, err := reference.ParseAnyReference(source); err != nil { + return ImageTagResult{}, fmt.Errorf("error parsing reference: %q is not a valid repository/tag: %w", source, err) + } + + ref, err := reference.ParseNormalizedNamed(target) + if err != nil { + return ImageTagResult{}, fmt.Errorf("error parsing reference: %q is not a valid repository/tag: %w", target, err) + } + + if _, ok := ref.(reference.Digested); ok { + return ImageTagResult{}, errors.New("refusing to create a tag with a digest reference") + } + + ref = reference.TagNameOnly(ref) + + query := url.Values{} + query.Set("repo", ref.Name()) + if tagged, ok := ref.(reference.Tagged); ok { + query.Set("tag", tagged.Tag()) + } + + resp, err := cli.post(ctx, "/images/"+source+"/tag", query, nil, nil) + defer ensureReaderClosed(resp) + return ImageTagResult{}, err +} diff --git a/vendor/github.com/moby/moby/client/internal/json-stream.go b/vendor/github.com/moby/moby/client/internal/json-stream.go new file mode 100644 index 00000000..07d07bd7 --- /dev/null +++ b/vendor/github.com/moby/moby/client/internal/json-stream.go @@ -0,0 +1,50 @@ +package internal + +import ( + "encoding/json" + "io" + "slices" + + "github.com/moby/moby/api/types" +) + +const rs = 0x1E + +type DecoderFn func(v any) error + +// NewJSONStreamDecoder builds adequate DecoderFn to read json records formatted with specified content-type +func NewJSONStreamDecoder(r io.Reader, contentType string) DecoderFn { + switch contentType { + case types.MediaTypeJSONSequence: + return json.NewDecoder(NewRSFilterReader(r)).Decode + case types.MediaTypeJSON, types.MediaTypeNDJSON, types.MediaTypeJSONLines: + fallthrough + default: + return json.NewDecoder(r).Decode + } +} + +// RSFilterReader wraps an io.Reader and filters out ASCII RS characters +type RSFilterReader struct { + reader io.Reader + buffer []byte +} + +// NewRSFilterReader creates a new RSFilterReader that filters out RS characters +func NewRSFilterReader(r io.Reader) *RSFilterReader { + return &RSFilterReader{ + reader: r, + buffer: make([]byte, 4096), // Internal buffer for reading chunks + } +} + +// Read implements the io.Reader interface, filtering out RS characters +func (r *RSFilterReader) Read(p []byte) (n int, err error) { + if len(p) == 0 { + return 0, nil + } + + n, err = r.reader.Read(p) + filtered := slices.DeleteFunc(p[:n], func(b byte) bool { return b == rs }) + return len(filtered), err +} diff --git a/vendor/github.com/moby/moby/client/internal/jsonmessages.go b/vendor/github.com/moby/moby/client/internal/jsonmessages.go new file mode 100644 index 00000000..31262fd8 --- /dev/null +++ b/vendor/github.com/moby/moby/client/internal/jsonmessages.go @@ -0,0 +1,84 @@ +package internal + +import ( + "context" + "encoding/json" + "errors" + "io" + "iter" + "sync" + + "github.com/moby/moby/api/types/jsonstream" +) + +func NewJSONMessageStream(rc io.ReadCloser) Stream { + if rc == nil { + panic("nil io.ReadCloser") + } + return Stream{ + rc: rc, + close: sync.OnceValue(rc.Close), + } +} + +type Stream struct { + rc io.ReadCloser + close func() error +} + +// Read implements io.ReadCloser +func (r Stream) Read(p []byte) (n int, err error) { + if r.rc == nil { + return 0, io.EOF + } + return r.rc.Read(p) +} + +// Close implements io.ReadCloser +func (r Stream) Close() error { + if r.close == nil { + return nil + } + return r.close() +} + +var _ io.ReadCloser = Stream{} + +// JSONMessages decodes the response stream as a sequence of JSONMessages. +// if stream ends or context is cancelled, the underlying [io.Reader] is closed. +func (r Stream) JSONMessages(ctx context.Context) iter.Seq2[jsonstream.Message, error] { + stop := context.AfterFunc(ctx, func() { + _ = r.Close() + }) + dec := json.NewDecoder(r) + return func(yield func(jsonstream.Message, error) bool) { + defer func() { + stop() // unregister AfterFunc + r.Close() + }() + for { + var jm jsonstream.Message + err := dec.Decode(&jm) + if errors.Is(err, io.EOF) { + break + } + if ctx.Err() != nil { + yield(jm, ctx.Err()) + return + } + if !yield(jm, err) { + return + } + } + } +} + +// Wait waits for operation to complete and detects errors reported as JSONMessage +func (r Stream) Wait(ctx context.Context) error { + for _, err := range r.JSONMessages(ctx) { + if err != nil { + return err + } + } + return nil +} diff --git a/vendor/github.com/moby/moby/client/internal/mod/mod.go b/vendor/github.com/moby/moby/client/internal/mod/mod.go new file mode 100644 index 00000000..355eb953 --- /dev/null +++ b/vendor/github.com/moby/moby/client/internal/mod/mod.go @@ -0,0 +1,226 @@ +// Package mod provides a small helper to extract a module's version +// from [debug.BuildInfo] without depending on [golang.org/x/mod]. +// +// [golang.org/x/mod]: https://pkg.go.dev/golang.org/x/mod +package mod + +import ( + "fmt" + "runtime/debug" + "strconv" + "strings" + "sync" +) + +var readBuildInfo = sync.OnceValues(debug.ReadBuildInfo) + +// Version returns a best-effort version string for the given module path, +// similar to [mod.Version] in the daemon. +// +// If the module is present in [debug.BuildInfo] dependencies, its version +// is returned. Tagged versions are returned as-is (with "+incompatible" +// stripped). [Pseudo-versions] are normalized to: +// +// +[+meta...][+dirty] +// +// Where "" matches the behavior of [module.PseudoVersionBase] (i.e., +// downgrade to the previous tag for non-prerelease Pseudo-versions). +// +// If the module is replaced (for example via go.work or replace directives), +// or no usable version information is available, Version returns an empty string. +// +// The returned value is intended for display purposes (e.g., in a default +// User-Agent), not for version comparison. +// +// [mod.Version]: https://pkg.go.dev/github.com/moby/moby/v2@v2.0.0-beta.7/daemon/internal/builder-next/worker/mod#Version +// [module.PseudoVersionBase]: https://pkg.go.dev/golang.org/x/mod@v0.34.0/module#PseudoVersionBase +// [Pseudo-versions]: https://cs.opensource.google/go/x/mod/+/refs/tags/v0.34.0:module/pseudo.go;l=5-33 +func Version(name string) string { + bi, ok := readBuildInfo() + if !ok || bi == nil { + return "" + } + return moduleVersion(name, bi) +} + +func moduleVersion(name string, bi *debug.BuildInfo) (modVersion string) { + if bi == nil { + return "" + } + + // Check if we're the main module. + if v, ok := getVersion(name, &bi.Main); ok { + return v + } + + // iterate over all dependencies and find name + for _, dep := range bi.Deps { + if v, ok := getVersion(name, dep); ok { + return v + } + } + + return "" +} + +func getVersion(name string, dep *debug.Module) (string, bool) { + if dep == nil || dep.Path != name { + return "", false + } + + v := dep.Version + if dep.Replace != nil && dep.Replace.Version != "" { + v = dep.Replace.Version + } + if v == "" || v == "(devel)" { + return "", true + } + + return normalize(v), true +} + +// normalize converts a Go module version into a display-friendly form: +// +// - strips "+incompatible" unconditionally +// - if pseudo: vX.Y.Z[-pre][+rev][+meta...][+dirty] +// - if tagged: vX.Y.Z[-pre][+meta...][+dirty] +func normalize(v string) string { + base, metas, dirty := splitMetadata(v) + + out := base + if base2, rev, undoPatch, ok := splitPseudo(base); ok { + if undoPatch { + // Downgrade the patch version that was raised by pseudo-versions: + // + // (2) vX.Y.(Z+1)-0.yyyymmddhhmmss-abcdef123456 + if major, minor, patch, ok := parseSemVer(base2); ok && patch > 0 { + patch-- + base2 = fmt.Sprintf("v%d.%d.%d", major, minor, patch) + } + } + // Go pseudo rev is typically 12, but be defensive. + if len(rev) > 12 { + rev = rev[:12] + } + out = base2 + "+" + rev + } + + // Preserve other metadata (except for "+incompatible"). + for _, m := range metas { + out += m + } + if dirty { + // +dirty goes last + out += "+dirty" + } + return out +} + +func splitMetadata(v string) (base string, metas []string, dirty bool) { + base, meta, ok := strings.Cut(v, "+") + if !ok || meta == "" { + return base, nil, false + } + for m := range strings.SplitSeq(meta, "+") { + // drop incompatible, extract dirty, preserve everything else. + switch m { + case "incompatible", "": + // drop "+incompatible" and empty strings + case "dirty": + dirty = true + default: + metas = append(metas, "+"+m) + } + } + + return base, metas, dirty +} + +// splitPseudo splits a pseudo-version into base + revision, and reports whether +// it is a (Z+1) pseudo that needs patch undo. +// +// Supported (after stripping +incompatible/+dirty metadata): +// +// (1) vX.0.0-yyyymmddhhmmss-abcdef123456 +// (2) vX.Y.(Z+1)-0.yyyymmddhhmmss-abcdef123456 +// (4) vX.Y.Z-pre.0.yyyymmddhhmmss-abcdef123456 +func splitPseudo(v string) (base, rev string, undoPatch bool, ok bool) { + // Split off revision at the last '-'. + last := strings.LastIndexByte(v, '-') + if last < 0 || last+1 >= len(v) { + return "", "", false, false + } + rev = v[last+1:] + left := v[:last] + + // First try the dot-joined timestamp forms: + // ...-0. (release pseudo; undoPatch) + // ....0. (prerelease pseudo; preserve prerelease) + if dot := strings.LastIndexByte(left, '.'); dot > 0 && dot+1 < len(left) { + ts := left[dot+1:] + if isTimestamp(ts) { + prefix := left[:dot] // ends with "-0" or ".0" for forms (2)/(4) + switch { + case strings.HasSuffix(prefix, "-0"): + // (2) vX.Y.(Z+1)-0.yyyymmddhhmmss-abcdef123456 + return prefix[:len(prefix)-2], rev, true, true + case strings.HasSuffix(prefix, ".0"): + // (4) vX.Y.Z-pre.0.yyyymmddhhmmss-abcdef123456 + return prefix[:len(prefix)-2], rev, false, true + } + } + } + + // Fall back to form (1): ...-- + // + // (1) vX.0.0-yyyymmddhhmmss-abcdef123456 + if dash := strings.LastIndexByte(left, '-'); dash > 0 && dash+1 < len(left) { + ts := left[dash+1:] + if isTimestamp(ts) { + return left[:dash], rev, false, true + } + } + + return "", "", false, false +} + +// isTimestamp checks whether s is a timestamp ("yyyymmddhhmmss") +// component in a module version (vX.0.0-yyyymmddhhmmss-abcdef123456). +func isTimestamp(s string) bool { + if len(s) != 14 { + return false + } + for i := range len(s) { + c := s[i] + if c < '0' || c > '9' { + return false + } + } + return true +} + +// parseSemVer parses "vX.Y.Z" into numeric components. +// It intentionally handles only the strict three-segment core form. +func parseSemVer(v string) (major, minor, patch int, ok bool) { + if len(v) < 2 || v[0] != 'v' { + return 0, 0, 0, false + } + parts := strings.Split(v[1:], ".") + if len(parts) != 3 { + return 0, 0, 0, false + } + var err error + major, err = strconv.Atoi(parts[0]) + if err != nil { + return 0, 0, 0, false + } + minor, err = strconv.Atoi(parts[1]) + if err != nil { + return 0, 0, 0, false + } + patch, err = strconv.Atoi(parts[2]) + if err != nil { + return 0, 0, 0, false + } + return major, minor, patch, true +} diff --git a/vendor/github.com/moby/moby/client/internal/timestamp/timestamp.go b/vendor/github.com/moby/moby/client/internal/timestamp/timestamp.go new file mode 100644 index 00000000..7b175f0c --- /dev/null +++ b/vendor/github.com/moby/moby/client/internal/timestamp/timestamp.go @@ -0,0 +1,131 @@ +package timestamp + +import ( + "fmt" + "math" + "strconv" + "strings" + "time" +) + +// These are additional predefined layouts for use in Time.Format and Time.Parse +// with --since and --until parameters for `docker logs` and `docker events` +const ( + rFC3339Local = "2006-01-02T15:04:05" // RFC3339 with local timezone + rFC3339NanoLocal = "2006-01-02T15:04:05.999999999" // RFC3339Nano with local timezone + dateWithZone = "2006-01-02Z07:00" // RFC3339 with time at 00:00:00 + dateLocal = "2006-01-02" // RFC3339 with local timezone and time at 00:00:00 +) + +// GetTimestamp tries to parse given string as golang duration, +// then RFC3339 time and finally as a Unix timestamp. If +// any of these were successful, it returns a Unix timestamp +// as string otherwise returns the given value back. +// In case of duration input, the returned timestamp is computed +// as the given reference time minus the amount of the duration. +func GetTimestamp(value string, reference time.Time) (string, error) { + if d, err := time.ParseDuration(value); value != "0" && err == nil { + return strconv.FormatInt(reference.Add(-d).Unix(), 10), nil + } + + var format string + // if the string has a Z or a + or three dashes use parse otherwise use parseinlocation + parseInLocation := !strings.ContainsAny(value, "zZ+") && strings.Count(value, "-") != 3 + + if strings.Contains(value, ".") { + if parseInLocation { + format = rFC3339NanoLocal + } else { + format = time.RFC3339Nano + } + } else if strings.Contains(value, "T") { + // we want the number of colons in the T portion of the timestamp + tcolons := strings.Count(value, ":") + // if parseInLocation is off and we have a +/- zone offset (not Z) then + // there will be an extra colon in the input for the tz offset subtract that + // colon from the tcolons count + if !parseInLocation && !strings.ContainsAny(value, "zZ") && tcolons > 0 { + tcolons-- + } + if parseInLocation { + switch tcolons { + case 0: + format = "2006-01-02T15" + case 1: + format = "2006-01-02T15:04" + default: + format = rFC3339Local + } + } else { + switch tcolons { + case 0: + format = "2006-01-02T15Z07:00" + case 1: + format = "2006-01-02T15:04Z07:00" + default: + format = time.RFC3339 + } + } + } else if parseInLocation { + format = dateLocal + } else { + format = dateWithZone + } + + var t time.Time + var err error + + if parseInLocation { + t, err = time.ParseInLocation(format, value, time.FixedZone(reference.Zone())) + } else { + t, err = time.Parse(format, value) + } + + if err != nil { + // if there is a `-` then it's an RFC3339 like timestamp + if strings.Contains(value, "-") { + return "", err // was probably an RFC3339 like timestamp but the parser failed with an error + } + if _, _, err := parseTimestamp(value); err != nil { + return "", fmt.Errorf("failed to parse value as time or duration: %q", value) + } + return value, nil // unix timestamp in and out case (meaning: the value passed at the command line is already in the right format for passing to the server) + } + + return fmt.Sprintf("%d.%09d", t.Unix(), int64(t.Nanosecond())), nil +} + +// ParseTimestamps returns seconds and nanoseconds from a timestamp that has +// the format ("%d.%09d", time.Unix(), int64(time.Nanosecond())). +// If the incoming nanosecond portion is longer than 9 digits it is truncated. +// The expectation is that the seconds and nanoseconds will be used to create a +// time variable. For example: +// +// seconds, nanoseconds, _ := ParseTimestamp("1136073600.000000001",0) +// since := time.Unix(seconds, nanoseconds) +// +// returns seconds as defaultSeconds if value == "" +func ParseTimestamps(value string, defaultSeconds int64) (seconds int64, nanoseconds int64, _ error) { + if value == "" { + return defaultSeconds, 0, nil + } + return parseTimestamp(value) +} + +func parseTimestamp(value string) (seconds int64, nanoseconds int64, _ error) { + s, n, ok := strings.Cut(value, ".") + sec, err := strconv.ParseInt(s, 10, 64) + if err != nil { + return sec, 0, err + } + if !ok { + return sec, 0, nil + } + nsec, err := strconv.ParseInt(n, 10, 64) + if err != nil { + return sec, nsec, err + } + // should already be in nanoseconds but just in case convert n to nanoseconds + nsec = int64(float64(nsec) * math.Pow(float64(10), float64(9-len(n)))) + return sec, nsec, nil +} diff --git a/vendor/github.com/moby/moby/client/login.go b/vendor/github.com/moby/moby/client/login.go new file mode 100644 index 00000000..b295080a --- /dev/null +++ b/vendor/github.com/moby/moby/client/login.go @@ -0,0 +1,45 @@ +package client + +import ( + "context" + "encoding/json" + "net/url" + + "github.com/moby/moby/api/types/registry" +) + +type RegistryLoginOptions struct { + Username string + Password string + ServerAddress string + IdentityToken string + RegistryToken string +} + +// RegistryLoginResult holds the result of a RegistryLogin query. +type RegistryLoginResult struct { + Auth registry.AuthResponse +} + +// RegistryLogin authenticates the docker server with a given docker registry. +// It returns unauthorizedError when the authentication fails. +func (cli *Client) RegistryLogin(ctx context.Context, options RegistryLoginOptions) (RegistryLoginResult, error) { + auth := registry.AuthConfig{ + Username: options.Username, + Password: options.Password, + ServerAddress: options.ServerAddress, + IdentityToken: options.IdentityToken, + RegistryToken: options.RegistryToken, + } + + resp, err := cli.post(ctx, "/auth", url.Values{}, auth, nil) + defer ensureReaderClosed(resp) + + if err != nil { + return RegistryLoginResult{}, err + } + + var response registry.AuthResponse + err = json.NewDecoder(resp.Body).Decode(&response) + return RegistryLoginResult{Auth: response}, err +} diff --git a/vendor/github.com/moby/moby/client/network_connect.go b/vendor/github.com/moby/moby/client/network_connect.go new file mode 100644 index 00000000..40db955a --- /dev/null +++ b/vendor/github.com/moby/moby/client/network_connect.go @@ -0,0 +1,40 @@ +package client + +import ( + "context" + + "github.com/moby/moby/api/types/network" +) + +// NetworkConnectOptions represents the data to be used to connect a container to the +// network. +type NetworkConnectOptions struct { + Container string + EndpointConfig *network.EndpointSettings +} + +// NetworkConnectResult represents the result of a NetworkConnect operation. +type NetworkConnectResult struct { + // Currently empty; placeholder for future fields. +} + +// NetworkConnect connects a container to an existent network in the docker host. +func (cli *Client) NetworkConnect(ctx context.Context, networkID string, options NetworkConnectOptions) (NetworkConnectResult, error) { + networkID, err := trimID("network", networkID) + if err != nil { + return NetworkConnectResult{}, err + } + + containerID, err := trimID("container", options.Container) + if err != nil { + return NetworkConnectResult{}, err + } + + nc := network.ConnectRequest{ + Container: containerID, + EndpointConfig: options.EndpointConfig, + } + resp, err := cli.post(ctx, "/networks/"+networkID+"/connect", nil, nc, nil) + defer ensureReaderClosed(resp) + return NetworkConnectResult{}, err +} diff --git a/vendor/github.com/moby/moby/client/network_create.go b/vendor/github.com/moby/moby/client/network_create.go new file mode 100644 index 00000000..25ea32af --- /dev/null +++ b/vendor/github.com/moby/moby/client/network_create.go @@ -0,0 +1,69 @@ +package client + +import ( + "context" + "encoding/json" + + "github.com/moby/moby/api/types/network" +) + +// NetworkCreateOptions holds options to create a network. +type NetworkCreateOptions struct { + Driver string // Driver is the driver-name used to create the network (e.g. `bridge`, `overlay`) + Scope string // Scope describes the level at which the network exists (e.g. `swarm` for cluster-wide or `local` for machine level). + EnableIPv4 *bool // EnableIPv4 represents whether to enable IPv4. + EnableIPv6 *bool // EnableIPv6 represents whether to enable IPv6. + IPAM *network.IPAM // IPAM is the network's IP Address Management. + Internal bool // Internal represents if the network is used internal only. + Attachable bool // Attachable represents if the global scope is manually attachable by regular containers from workers in swarm mode. + Ingress bool // Ingress indicates the network is providing the routing-mesh for the swarm cluster. + ConfigOnly bool // ConfigOnly creates a config-only network. Config-only networks are place-holder networks for network configurations to be used by other networks. ConfigOnly networks cannot be used directly to run containers or services. + ConfigFrom string // ConfigFrom specifies the source which will provide the configuration for this network. The specified network must be a config-only network; see [CreateOptions.ConfigOnly]. + Options map[string]string // Options specifies the network-specific options to use for when creating the network. + Labels map[string]string // Labels holds metadata specific to the network being created. +} + +// NetworkCreateResult represents the result of a network create operation. +type NetworkCreateResult struct { + ID string + + Warning []string +} + +// NetworkCreate creates a new network in the docker host. +func (cli *Client) NetworkCreate(ctx context.Context, name string, options NetworkCreateOptions) (NetworkCreateResult, error) { + req := network.CreateRequest{ + Name: name, + Driver: options.Driver, + Scope: options.Scope, + EnableIPv4: options.EnableIPv4, + EnableIPv6: options.EnableIPv6, + IPAM: options.IPAM, + Internal: options.Internal, + Attachable: options.Attachable, + Ingress: options.Ingress, + ConfigOnly: options.ConfigOnly, + Options: options.Options, + Labels: options.Labels, + } + + if options.ConfigFrom != "" { + req.ConfigFrom = &network.ConfigReference{Network: options.ConfigFrom} + } + + resp, err := cli.post(ctx, "/networks/create", nil, req, nil) + defer ensureReaderClosed(resp) + if err != nil { + return NetworkCreateResult{}, err + } + + var response network.CreateResponse + err = json.NewDecoder(resp.Body).Decode(&response) + + var warnings []string + if response.Warning != "" { + warnings = []string{response.Warning} + } + + return NetworkCreateResult{ID: response.ID, Warning: warnings}, err +} diff --git a/vendor/github.com/moby/moby/client/network_disconnect.go b/vendor/github.com/moby/moby/client/network_disconnect.go new file mode 100644 index 00000000..64a1796b --- /dev/null +++ b/vendor/github.com/moby/moby/client/network_disconnect.go @@ -0,0 +1,40 @@ +package client + +import ( + "context" + + "github.com/moby/moby/api/types/network" +) + +// NetworkDisconnectOptions represents the data to be used to disconnect a container +// from the network. +type NetworkDisconnectOptions struct { + Container string + Force bool +} + +// NetworkDisconnectResult represents the result of a NetworkDisconnect operation. +type NetworkDisconnectResult struct { + // Currently empty; placeholder for future fields. +} + +// NetworkDisconnect disconnects a container from an existent network in the docker host. +func (cli *Client) NetworkDisconnect(ctx context.Context, networkID string, options NetworkDisconnectOptions) (NetworkDisconnectResult, error) { + networkID, err := trimID("network", networkID) + if err != nil { + return NetworkDisconnectResult{}, err + } + + containerID, err := trimID("container", options.Container) + if err != nil { + return NetworkDisconnectResult{}, err + } + + req := network.DisconnectRequest{ + Container: containerID, + Force: options.Force, + } + resp, err := cli.post(ctx, "/networks/"+networkID+"/disconnect", nil, req, nil) + defer ensureReaderClosed(resp) + return NetworkDisconnectResult{}, err +} diff --git a/vendor/github.com/moby/moby/client/network_inspect.go b/vendor/github.com/moby/moby/client/network_inspect.go new file mode 100644 index 00000000..77578052 --- /dev/null +++ b/vendor/github.com/moby/moby/client/network_inspect.go @@ -0,0 +1,39 @@ +package client + +import ( + "context" + "encoding/json" + "net/url" + + "github.com/moby/moby/api/types/network" +) + +// NetworkInspectResult contains the result of a network inspection. +type NetworkInspectResult struct { + Network network.Inspect + Raw json.RawMessage +} + +// NetworkInspect returns the information for a specific network configured in the docker host. +func (cli *Client) NetworkInspect(ctx context.Context, networkID string, options NetworkInspectOptions) (NetworkInspectResult, error) { + networkID, err := trimID("network", networkID) + if err != nil { + return NetworkInspectResult{}, err + } + query := url.Values{} + if options.Verbose { + query.Set("verbose", "true") + } + if options.Scope != "" { + query.Set("scope", options.Scope) + } + + resp, err := cli.get(ctx, "/networks/"+networkID, query, nil) + if err != nil { + return NetworkInspectResult{}, err + } + + var out NetworkInspectResult + out.Raw, err = decodeWithRaw(resp, &out.Network) + return out, err +} diff --git a/vendor/github.com/moby/moby/client/network_inspect_opts.go b/vendor/github.com/moby/moby/client/network_inspect_opts.go new file mode 100644 index 00000000..d83f113e --- /dev/null +++ b/vendor/github.com/moby/moby/client/network_inspect_opts.go @@ -0,0 +1,7 @@ +package client + +// NetworkInspectOptions holds parameters to inspect network. +type NetworkInspectOptions struct { + Scope string + Verbose bool +} diff --git a/vendor/github.com/moby/moby/client/network_list.go b/vendor/github.com/moby/moby/client/network_list.go new file mode 100644 index 00000000..d65f5609 --- /dev/null +++ b/vendor/github.com/moby/moby/client/network_list.go @@ -0,0 +1,28 @@ +package client + +import ( + "context" + "encoding/json" + "net/url" + + "github.com/moby/moby/api/types/network" +) + +// NetworkListResult holds the result from the [Client.NetworkList] method. +type NetworkListResult struct { + Items []network.Summary +} + +// NetworkList returns the list of networks configured in the docker host. +func (cli *Client) NetworkList(ctx context.Context, options NetworkListOptions) (NetworkListResult, error) { + query := url.Values{} + options.Filters.updateURLValues(query) + resp, err := cli.get(ctx, "/networks", query, nil) + defer ensureReaderClosed(resp) + if err != nil { + return NetworkListResult{}, err + } + var res NetworkListResult + err = json.NewDecoder(resp.Body).Decode(&res.Items) + return res, err +} diff --git a/vendor/github.com/moby/moby/client/network_list_opts.go b/vendor/github.com/moby/moby/client/network_list_opts.go new file mode 100644 index 00000000..0d21ab31 --- /dev/null +++ b/vendor/github.com/moby/moby/client/network_list_opts.go @@ -0,0 +1,6 @@ +package client + +// NetworkListOptions holds parameters to filter the list of networks with. +type NetworkListOptions struct { + Filters Filters +} diff --git a/vendor/github.com/moby/moby/client/network_prune.go b/vendor/github.com/moby/moby/client/network_prune.go new file mode 100644 index 00000000..55f7cac0 --- /dev/null +++ b/vendor/github.com/moby/moby/client/network_prune.go @@ -0,0 +1,39 @@ +package client + +import ( + "context" + "encoding/json" + "fmt" + "net/url" + + "github.com/moby/moby/api/types/network" +) + +// NetworkPruneOptions holds parameters to prune networks. +type NetworkPruneOptions struct { + Filters Filters +} + +// NetworkPruneResult holds the result from the [Client.NetworkPrune] method. +type NetworkPruneResult struct { + Report network.PruneReport +} + +// NetworkPrune requests the daemon to delete unused networks +func (cli *Client) NetworkPrune(ctx context.Context, opts NetworkPruneOptions) (NetworkPruneResult, error) { + query := url.Values{} + opts.Filters.updateURLValues(query) + + resp, err := cli.post(ctx, "/networks/prune", query, nil, nil) + defer ensureReaderClosed(resp) + if err != nil { + return NetworkPruneResult{}, err + } + + var report network.PruneReport + if err := json.NewDecoder(resp.Body).Decode(&report); err != nil { + return NetworkPruneResult{}, fmt.Errorf("Error retrieving network prune report: %v", err) + } + + return NetworkPruneResult{Report: report}, nil +} diff --git a/vendor/github.com/moby/moby/client/network_remove.go b/vendor/github.com/moby/moby/client/network_remove.go new file mode 100644 index 00000000..2bceb0d9 --- /dev/null +++ b/vendor/github.com/moby/moby/client/network_remove.go @@ -0,0 +1,26 @@ +package client + +import ( + "context" +) + +// NetworkRemoveOptions specifies options for removing a network. +type NetworkRemoveOptions struct { + // No options currently; placeholder for future use. +} + +// NetworkRemoveResult represents the result of a network removal operation. +type NetworkRemoveResult struct { + // No fields currently; placeholder for future use. +} + +// NetworkRemove removes an existent network from the docker host. +func (cli *Client) NetworkRemove(ctx context.Context, networkID string, options NetworkRemoveOptions) (NetworkRemoveResult, error) { + networkID, err := trimID("network", networkID) + if err != nil { + return NetworkRemoveResult{}, err + } + resp, err := cli.delete(ctx, "/networks/"+networkID, nil, nil) + defer ensureReaderClosed(resp) + return NetworkRemoveResult{}, err +} diff --git a/vendor/github.com/moby/moby/client/node_inspect.go b/vendor/github.com/moby/moby/client/node_inspect.go new file mode 100644 index 00000000..ed482152 --- /dev/null +++ b/vendor/github.com/moby/moby/client/node_inspect.go @@ -0,0 +1,42 @@ +package client + +import ( + "bytes" + "context" + "encoding/json" + "io" + + "github.com/moby/moby/api/types/swarm" +) + +// NodeInspectOptions holds parameters to inspect nodes with. +type NodeInspectOptions struct{} + +// NodeInspectResult holds the result of [Client.NodeInspect]. +type NodeInspectResult struct { + Node swarm.Node + Raw json.RawMessage +} + +// NodeInspect returns the node information. +func (cli *Client) NodeInspect(ctx context.Context, nodeID string, options NodeInspectOptions) (NodeInspectResult, error) { + nodeID, err := trimID("node", nodeID) + if err != nil { + return NodeInspectResult{}, err + } + resp, err := cli.get(ctx, "/nodes/"+nodeID, nil, nil) + defer ensureReaderClosed(resp) + if err != nil { + return NodeInspectResult{}, err + } + + body, err := io.ReadAll(resp.Body) + if err != nil { + return NodeInspectResult{}, err + } + + var response swarm.Node + rdr := bytes.NewReader(body) + err = json.NewDecoder(rdr).Decode(&response) + return NodeInspectResult{Node: response, Raw: body}, err +} diff --git a/vendor/github.com/moby/moby/client/node_list.go b/vendor/github.com/moby/moby/client/node_list.go new file mode 100644 index 00000000..aec3355e --- /dev/null +++ b/vendor/github.com/moby/moby/client/node_list.go @@ -0,0 +1,34 @@ +package client + +import ( + "context" + "encoding/json" + "net/url" + + "github.com/moby/moby/api/types/swarm" +) + +// NodeListOptions holds parameters to list nodes with. +type NodeListOptions struct { + Filters Filters +} + +// NodeListResult holds the result of [Client.NodeList]. +type NodeListResult struct { + Items []swarm.Node +} + +// NodeList returns the list of nodes. +func (cli *Client) NodeList(ctx context.Context, options NodeListOptions) (NodeListResult, error) { + query := url.Values{} + options.Filters.updateURLValues(query) + resp, err := cli.get(ctx, "/nodes", query, nil) + defer ensureReaderClosed(resp) + if err != nil { + return NodeListResult{}, err + } + + var nodes []swarm.Node + err = json.NewDecoder(resp.Body).Decode(&nodes) + return NodeListResult{Items: nodes}, err +} diff --git a/vendor/github.com/moby/moby/client/node_remove.go b/vendor/github.com/moby/moby/client/node_remove.go new file mode 100644 index 00000000..2a88cf80 --- /dev/null +++ b/vendor/github.com/moby/moby/client/node_remove.go @@ -0,0 +1,31 @@ +package client + +import ( + "context" + "net/url" +) + +// NodeRemoveOptions holds parameters to remove nodes with. +type NodeRemoveOptions struct { + Force bool +} + +// NodeRemoveResult holds the result of [Client.NodeRemove]. +type NodeRemoveResult struct{} + +// NodeRemove removes a Node. +func (cli *Client) NodeRemove(ctx context.Context, nodeID string, options NodeRemoveOptions) (NodeRemoveResult, error) { + nodeID, err := trimID("node", nodeID) + if err != nil { + return NodeRemoveResult{}, err + } + + query := url.Values{} + if options.Force { + query.Set("force", "1") + } + + resp, err := cli.delete(ctx, "/nodes/"+nodeID, query, nil) + defer ensureReaderClosed(resp) + return NodeRemoveResult{}, err +} diff --git a/vendor/github.com/moby/moby/client/node_update.go b/vendor/github.com/moby/moby/client/node_update.go new file mode 100644 index 00000000..24f87a4d --- /dev/null +++ b/vendor/github.com/moby/moby/client/node_update.go @@ -0,0 +1,31 @@ +package client + +import ( + "context" + "net/url" + + "github.com/moby/moby/api/types/swarm" +) + +// NodeUpdateOptions holds parameters to update nodes with. +type NodeUpdateOptions struct { + Version swarm.Version + Spec swarm.NodeSpec +} + +// NodeUpdateResult holds the result of [Client.NodeUpdate]. +type NodeUpdateResult struct{} + +// NodeUpdate updates a Node. +func (cli *Client) NodeUpdate(ctx context.Context, nodeID string, options NodeUpdateOptions) (NodeUpdateResult, error) { + nodeID, err := trimID("node", nodeID) + if err != nil { + return NodeUpdateResult{}, err + } + + query := url.Values{} + query.Set("version", options.Version.String()) + resp, err := cli.post(ctx, "/nodes/"+nodeID+"/update", query, options.Spec, nil) + defer ensureReaderClosed(resp) + return NodeUpdateResult{}, err +} diff --git a/vendor/github.com/moby/moby/client/ping.go b/vendor/github.com/moby/moby/client/ping.go new file mode 100644 index 00000000..d315e4b9 --- /dev/null +++ b/vendor/github.com/moby/moby/client/ping.go @@ -0,0 +1,166 @@ +package client + +import ( + "context" + "net/http" + "path" + "strings" + + "github.com/moby/moby/api/types/build" + "github.com/moby/moby/api/types/swarm" +) + +// PingOptions holds options for [client.Ping]. +type PingOptions struct { + // NegotiateAPIVersion queries the API and updates the version to match the API + // version. NegotiateAPIVersion downgrades the client's API version to match the + // APIVersion if the ping version is lower than the default version. If the API + // version reported by the server is higher than the maximum version supported + // by the client, it uses the client's maximum version. + // + // If a manual override is in place, either through the "DOCKER_API_VERSION" + // ([EnvOverrideAPIVersion]) environment variable, or if the client is initialized + // with a fixed version ([WithAPIVersion]), no negotiation is performed. + // + // If the API server's ping response does not contain an API version, or if the + // client did not get a successful ping response, it assumes it is connected with + // an old daemon that does not support API version negotiation, in which case it + // downgrades to the lowest supported API version. + NegotiateAPIVersion bool + + // ForceNegotiate forces the client to re-negotiate the API version, even if + // API-version negotiation already happened or it the client is configured + // with a fixed version (using [WithAPIVersion] or [WithAPIVersionFromEnv]). + // + // This option has no effect if NegotiateAPIVersion is not set. + ForceNegotiate bool +} + +// PingResult holds the result of a [Client.Ping] API call. +type PingResult struct { + APIVersion string + OSType string + Experimental bool + BuilderVersion build.BuilderVersion + + // SwarmStatus provides information about the current swarm status of the + // engine, obtained from the "Swarm" header in the API response. + // + // It can be a nil struct if the API version does not provide this header + // in the ping response, or if an error occurred, in which case the client + // should use other ways to get the current swarm status, such as the /swarm + // endpoint. + SwarmStatus *SwarmStatus +} + +// SwarmStatus provides information about the current swarm status and role, +// obtained from the "Swarm" header in the API response. +type SwarmStatus struct { + // NodeState represents the state of the node. + NodeState swarm.LocalNodeState + + // ControlAvailable indicates if the node is a swarm manager. + ControlAvailable bool +} + +// Ping pings the server and returns the value of the "Docker-Experimental", +// "Builder-Version", "OS-Type" & "API-Version" headers. It attempts to use +// a HEAD request on the endpoint, but falls back to GET if HEAD is not supported +// by the daemon. It ignores internal server errors returned by the API, which +// may be returned if the daemon is in an unhealthy state, but returns errors +// for other non-success status codes, failing to connect to the API, or failing +// to parse the API response. +func (cli *Client) Ping(ctx context.Context, options PingOptions) (PingResult, error) { + if !options.NegotiateAPIVersion { + // No API version negotiation needed; just return ping response. + return cli.ping(ctx) + } + if cli.negotiated.Load() && !options.ForceNegotiate { + // API version was already negotiated or manually set. + return cli.ping(ctx) + } + + // Ensure exclusive write access to version and negotiated fields + cli.negotiateLock.Lock() + defer cli.negotiateLock.Unlock() + + ping, err := cli.ping(ctx) + if err != nil { + return ping, err + } + + if cli.negotiated.Load() && !options.ForceNegotiate { + // API version was already negotiated or manually set. + // + // We check cli.negotiated again under lock, to account for race + // conditions with the check at the start of this function. + return ping, nil + } + + if ping.APIVersion == "" { + cli.setAPIVersion(MaxAPIVersion) + return ping, nil + } + + return ping, cli.negotiateAPIVersion(ping.APIVersion) +} + +func (cli *Client) ping(ctx context.Context) (PingResult, error) { + // Using cli.buildRequest() + cli.doRequest() instead of cli.sendRequest() + // because ping requests are used during API version negotiation, so we want + // to hit the non-versioned /_ping endpoint, not /v1.xx/_ping + req, err := cli.buildRequest(ctx, http.MethodHead, path.Join(cli.basePath, "/_ping"), nil, nil) + if err != nil { + return PingResult{}, err + } + resp, err := cli.doRequest(req) + defer ensureReaderClosed(resp) + if err == nil && resp.StatusCode == http.StatusOK { + // Fast-path; successfully connected using a HEAD request and + // we got a "OK" (200) status. For non-200 status-codes, we fall + // back to doing a GET request, as a HEAD request won't have a + // response-body to get error details from. + return newPingResult(resp), nil + } + // close to allow reusing connection. + ensureReaderClosed(resp) + + // HEAD failed or returned a non-OK status; fallback to GET. + req2, err := cli.buildRequest(ctx, http.MethodGet, path.Join(cli.basePath, "/_ping"), nil, nil) + if err != nil { + return PingResult{}, err + } + resp, err = cli.doRequest(req2) + defer ensureReaderClosed(resp) + if err != nil { + // Failed to connect. + return PingResult{}, err + } + + // GET request succeeded but may have returned a non-200 status. + // Return a Ping response, together with any error returned by + // the API server. + return newPingResult(resp), checkResponseErr(resp) +} + +func newPingResult(resp *http.Response) PingResult { + if resp == nil { + return PingResult{} + } + var swarmStatus *SwarmStatus + if si := resp.Header.Get("Swarm"); si != "" { + state, role, _ := strings.Cut(si, "/") + swarmStatus = &SwarmStatus{ + NodeState: swarm.LocalNodeState(state), + ControlAvailable: role == "manager", + } + } + + return PingResult{ + APIVersion: resp.Header.Get("Api-Version"), + OSType: resp.Header.Get("Ostype"), + Experimental: resp.Header.Get("Docker-Experimental") == "true", + BuilderVersion: build.BuilderVersion(resp.Header.Get("Builder-Version")), + SwarmStatus: swarmStatus, + } +} diff --git a/vendor/github.com/moby/moby/client/pkg/versions/compare.go b/vendor/github.com/moby/moby/client/pkg/versions/compare.go new file mode 100644 index 00000000..fa0ad9b5 --- /dev/null +++ b/vendor/github.com/moby/moby/client/pkg/versions/compare.go @@ -0,0 +1,62 @@ +package versions + +import ( + "strconv" + "strings" +) + +// compare compares two version strings +// returns -1 if v1 < v2, 1 if v1 > v2, 0 otherwise. +func compare(v1, v2 string) int { + if v1 == v2 { + return 0 + } + var ( + currTab = strings.Split(v1, ".") + otherTab = strings.Split(v2, ".") + ) + + maxVer := max(len(otherTab), len(currTab)) + for i := range maxVer { + var currInt, otherInt int + + if len(currTab) > i { + currInt, _ = strconv.Atoi(currTab[i]) + } + if len(otherTab) > i { + otherInt, _ = strconv.Atoi(otherTab[i]) + } + if currInt > otherInt { + return 1 + } + if otherInt > currInt { + return -1 + } + } + return 0 +} + +// LessThan checks if a version is less than another +func LessThan(v, other string) bool { + return compare(v, other) == -1 +} + +// LessThanOrEqualTo checks if a version is less than or equal to another +func LessThanOrEqualTo(v, other string) bool { + return compare(v, other) <= 0 +} + +// GreaterThan checks if a version is greater than another +func GreaterThan(v, other string) bool { + return compare(v, other) == 1 +} + +// GreaterThanOrEqualTo checks if a version is greater than or equal to another +func GreaterThanOrEqualTo(v, other string) bool { + return compare(v, other) >= 0 +} + +// Equal checks if a version is equal to another +func Equal(v, other string) bool { + return compare(v, other) == 0 +} diff --git a/vendor/github.com/moby/moby/client/plugin_create.go b/vendor/github.com/moby/moby/client/plugin_create.go new file mode 100644 index 00000000..c1a2dd5a --- /dev/null +++ b/vendor/github.com/moby/moby/client/plugin_create.go @@ -0,0 +1,31 @@ +package client + +import ( + "context" + "io" + "net/http" + "net/url" +) + +// PluginCreateOptions hold all options to plugin create. +type PluginCreateOptions struct { + RepoName string +} + +// PluginCreateResult represents the result of a plugin create operation. +type PluginCreateResult struct { + // Currently empty; can be extended in the future if needed. +} + +// PluginCreate creates a plugin +func (cli *Client) PluginCreate(ctx context.Context, createContext io.Reader, createOptions PluginCreateOptions) (PluginCreateResult, error) { + headers := http.Header(make(map[string][]string)) + headers.Set("Content-Type", "application/x-tar") + + query := url.Values{} + query.Set("name", createOptions.RepoName) + + resp, err := cli.postRaw(ctx, "/plugins/create", query, createContext, headers) + defer ensureReaderClosed(resp) + return PluginCreateResult{}, err +} diff --git a/vendor/github.com/moby/moby/client/plugin_disable.go b/vendor/github.com/moby/moby/client/plugin_disable.go new file mode 100644 index 00000000..65ab0aa0 --- /dev/null +++ b/vendor/github.com/moby/moby/client/plugin_disable.go @@ -0,0 +1,31 @@ +package client + +import ( + "context" + "net/url" +) + +// PluginDisableOptions holds parameters to disable plugins. +type PluginDisableOptions struct { + Force bool +} + +// PluginDisableResult represents the result of a plugin disable operation. +type PluginDisableResult struct { + // Currently empty; can be extended in the future if needed. +} + +// PluginDisable disables a plugin +func (cli *Client) PluginDisable(ctx context.Context, name string, options PluginDisableOptions) (PluginDisableResult, error) { + name, err := trimID("plugin", name) + if err != nil { + return PluginDisableResult{}, err + } + query := url.Values{} + if options.Force { + query.Set("force", "1") + } + resp, err := cli.post(ctx, "/plugins/"+name+"/disable", query, nil, nil) + defer ensureReaderClosed(resp) + return PluginDisableResult{}, err +} diff --git a/vendor/github.com/moby/moby/client/plugin_enable.go b/vendor/github.com/moby/moby/client/plugin_enable.go new file mode 100644 index 00000000..7c3e26b6 --- /dev/null +++ b/vendor/github.com/moby/moby/client/plugin_enable.go @@ -0,0 +1,31 @@ +package client + +import ( + "context" + "net/url" + "strconv" +) + +// PluginEnableOptions holds parameters to enable plugins. +type PluginEnableOptions struct { + Timeout int +} + +// PluginEnableResult represents the result of a plugin enable operation. +type PluginEnableResult struct { + // Currently empty; can be extended in the future if needed. +} + +// PluginEnable enables a plugin +func (cli *Client) PluginEnable(ctx context.Context, name string, options PluginEnableOptions) (PluginEnableResult, error) { + name, err := trimID("plugin", name) + if err != nil { + return PluginEnableResult{}, err + } + query := url.Values{} + query.Set("timeout", strconv.Itoa(options.Timeout)) + + resp, err := cli.post(ctx, "/plugins/"+name+"/enable", query, nil, nil) + defer ensureReaderClosed(resp) + return PluginEnableResult{}, err +} diff --git a/vendor/github.com/moby/moby/client/plugin_inspect.go b/vendor/github.com/moby/moby/client/plugin_inspect.go new file mode 100644 index 00000000..8caf06a8 --- /dev/null +++ b/vendor/github.com/moby/moby/client/plugin_inspect.go @@ -0,0 +1,35 @@ +package client + +import ( + "context" + "encoding/json" + + "github.com/moby/moby/api/types/plugin" +) + +// PluginInspectOptions holds parameters to inspect a plugin. +type PluginInspectOptions struct { + // Add future optional parameters here +} + +// PluginInspectResult holds the result from the [Client.PluginInspect] method. +type PluginInspectResult struct { + Plugin plugin.Plugin + Raw json.RawMessage +} + +// PluginInspect inspects an existing plugin +func (cli *Client) PluginInspect(ctx context.Context, name string, options PluginInspectOptions) (PluginInspectResult, error) { + name, err := trimID("plugin", name) + if err != nil { + return PluginInspectResult{}, err + } + resp, err := cli.get(ctx, "/plugins/"+name+"/json", nil, nil) + if err != nil { + return PluginInspectResult{}, err + } + + var out PluginInspectResult + out.Raw, err = decodeWithRaw(resp, &out.Plugin) + return out, err +} diff --git a/vendor/github.com/moby/moby/client/plugin_install.go b/vendor/github.com/moby/moby/client/plugin_install.go new file mode 100644 index 00000000..a589b2e1 --- /dev/null +++ b/vendor/github.com/moby/moby/client/plugin_install.go @@ -0,0 +1,175 @@ +package client + +import ( + "context" + "encoding/json" + "errors" + "fmt" + "io" + "net/http" + "net/url" + + cerrdefs "github.com/containerd/errdefs" + "github.com/distribution/reference" + "github.com/moby/moby/api/types/plugin" + "github.com/moby/moby/api/types/registry" +) + +// PluginInstallOptions holds parameters to install a plugin. +type PluginInstallOptions struct { + Disabled bool + AcceptAllPermissions bool + RegistryAuth string // RegistryAuth is the base64 encoded credentials for the registry + RemoteRef string // RemoteRef is the plugin name on the registry + + // PrivilegeFunc is a function that clients can supply to retry operations + // after getting an authorization error. This function returns the registry + // authentication header value in base64 encoded format, or an error if the + // privilege request fails. + // + // For details, refer to [github.com/moby/moby/api/types/registry.RequestAuthConfig]. + PrivilegeFunc func(context.Context) (string, error) + AcceptPermissionsFunc func(context.Context, plugin.Privileges) (bool, error) + Args []string +} + +// PluginInstallResult holds the result of a plugin install operation. +// It is an io.ReadCloser from which the caller can read installation progress or result. +type PluginInstallResult struct { + io.ReadCloser +} + +// PluginInstall installs a plugin +func (cli *Client) PluginInstall(ctx context.Context, name string, options PluginInstallOptions) (_ PluginInstallResult, retErr error) { + query := url.Values{} + if _, err := reference.ParseNormalizedNamed(options.RemoteRef); err != nil { + return PluginInstallResult{}, fmt.Errorf("invalid remote reference: %w", err) + } + query.Set("remote", options.RemoteRef) + + privileges, err := cli.checkPluginPermissions(ctx, query, &options) + if err != nil { + return PluginInstallResult{}, err + } + + // set name for plugin pull, if empty should default to remote reference + query.Set("name", name) + + resp, err := cli.tryPluginPull(ctx, query, privileges, options.RegistryAuth) + if err != nil { + return PluginInstallResult{}, err + } + + name = resp.Header.Get("Docker-Plugin-Name") + + pr, pw := io.Pipe() + go func() { // todo: the client should probably be designed more around the actual api + _, err := io.Copy(pw, resp.Body) + if err != nil { + _ = pw.CloseWithError(err) + return + } + defer func() { + if retErr != nil { + delResp, _ := cli.delete(ctx, "/plugins/"+name, nil, nil) + ensureReaderClosed(delResp) + } + }() + if len(options.Args) > 0 { + if _, err := cli.PluginSet(ctx, name, PluginSetOptions{Args: options.Args}); err != nil { + _ = pw.CloseWithError(err) + return + } + } + + if options.Disabled { + _ = pw.Close() + return + } + + _, enableErr := cli.PluginEnable(ctx, name, PluginEnableOptions{Timeout: 0}) + _ = pw.CloseWithError(enableErr) + }() + return PluginInstallResult{pr}, nil +} + +func (cli *Client) tryPluginPrivileges(ctx context.Context, query url.Values, registryAuth string) (*http.Response, error) { + return cli.get(ctx, "/plugins/privileges", query, http.Header{ + registry.AuthHeader: {registryAuth}, + }) +} + +func (cli *Client) tryPluginPull(ctx context.Context, query url.Values, privileges plugin.Privileges, registryAuth string) (*http.Response, error) { + return cli.post(ctx, "/plugins/pull", query, privileges, http.Header{ + registry.AuthHeader: {registryAuth}, + }) +} + +func (cli *Client) checkPluginPermissions(ctx context.Context, query url.Values, options pluginOptions) (plugin.Privileges, error) { + resp, err := cli.tryPluginPrivileges(ctx, query, options.getRegistryAuth()) + if cerrdefs.IsUnauthorized(err) && options.getPrivilegeFunc() != nil { + // TODO: do inspect before to check existing name before checking privileges + newAuthHeader, privilegeErr := options.getPrivilegeFunc()(ctx) + if privilegeErr != nil { + ensureReaderClosed(resp) + return nil, privilegeErr + } + options.setRegistryAuth(newAuthHeader) + resp, err = cli.tryPluginPrivileges(ctx, query, options.getRegistryAuth()) + } + if err != nil { + ensureReaderClosed(resp) + return nil, err + } + + var privileges plugin.Privileges + if err := json.NewDecoder(resp.Body).Decode(&privileges); err != nil { + ensureReaderClosed(resp) + return nil, err + } + ensureReaderClosed(resp) + + if !options.getAcceptAllPermissions() && options.getAcceptPermissionsFunc() != nil && len(privileges) > 0 { + accept, err := options.getAcceptPermissionsFunc()(ctx, privileges) + if err != nil { + return nil, err + } + if !accept { + return nil, errors.New("permission denied while installing plugin " + options.getRemoteRef()) + } + } + return privileges, nil +} + +type pluginOptions interface { + getRegistryAuth() string + setRegistryAuth(string) + getPrivilegeFunc() func(context.Context) (string, error) + getAcceptAllPermissions() bool + getAcceptPermissionsFunc() func(context.Context, plugin.Privileges) (bool, error) + getRemoteRef() string +} + +func (o *PluginInstallOptions) getRegistryAuth() string { + return o.RegistryAuth +} + +func (o *PluginInstallOptions) setRegistryAuth(auth string) { + o.RegistryAuth = auth +} + +func (o *PluginInstallOptions) getPrivilegeFunc() func(context.Context) (string, error) { + return o.PrivilegeFunc +} + +func (o *PluginInstallOptions) getAcceptAllPermissions() bool { + return o.AcceptAllPermissions +} + +func (o *PluginInstallOptions) getAcceptPermissionsFunc() func(context.Context, plugin.Privileges) (bool, error) { + return o.AcceptPermissionsFunc +} + +func (o *PluginInstallOptions) getRemoteRef() string { + return o.RemoteRef +} diff --git a/vendor/github.com/moby/moby/client/plugin_list.go b/vendor/github.com/moby/moby/client/plugin_list.go new file mode 100644 index 00000000..cbd90b40 --- /dev/null +++ b/vendor/github.com/moby/moby/client/plugin_list.go @@ -0,0 +1,35 @@ +package client + +import ( + "context" + "encoding/json" + "net/url" + + "github.com/moby/moby/api/types/plugin" +) + +// PluginListOptions holds parameters to list plugins. +type PluginListOptions struct { + Filters Filters +} + +// PluginListResult represents the result of a plugin list operation. +type PluginListResult struct { + Items []plugin.Plugin +} + +// PluginList returns the installed plugins +func (cli *Client) PluginList(ctx context.Context, options PluginListOptions) (PluginListResult, error) { + query := url.Values{} + + options.Filters.updateURLValues(query) + resp, err := cli.get(ctx, "/plugins", query, nil) + defer ensureReaderClosed(resp) + if err != nil { + return PluginListResult{}, err + } + + var plugins plugin.ListResponse + err = json.NewDecoder(resp.Body).Decode(&plugins) + return PluginListResult{Items: plugins}, err +} diff --git a/vendor/github.com/moby/moby/client/plugin_push.go b/vendor/github.com/moby/moby/client/plugin_push.go new file mode 100644 index 00000000..4ba25d13 --- /dev/null +++ b/vendor/github.com/moby/moby/client/plugin_push.go @@ -0,0 +1,34 @@ +package client + +import ( + "context" + "io" + "net/http" + + "github.com/moby/moby/api/types/registry" +) + +// PluginPushOptions holds parameters to push a plugin. +type PluginPushOptions struct { + RegistryAuth string // RegistryAuth is the base64 encoded credentials for the registry +} + +// PluginPushResult is the result of a plugin push operation +type PluginPushResult struct { + io.ReadCloser +} + +// PluginPush pushes a plugin to a registry +func (cli *Client) PluginPush(ctx context.Context, name string, options PluginPushOptions) (PluginPushResult, error) { + name, err := trimID("plugin", name) + if err != nil { + return PluginPushResult{}, err + } + resp, err := cli.post(ctx, "/plugins/"+name+"/push", nil, nil, http.Header{ + registry.AuthHeader: {options.RegistryAuth}, + }) + if err != nil { + return PluginPushResult{}, err + } + return PluginPushResult{resp.Body}, nil +} diff --git a/vendor/github.com/moby/moby/client/plugin_remove.go b/vendor/github.com/moby/moby/client/plugin_remove.go new file mode 100644 index 00000000..229f4085 --- /dev/null +++ b/vendor/github.com/moby/moby/client/plugin_remove.go @@ -0,0 +1,33 @@ +package client + +import ( + "context" + "net/url" +) + +// PluginRemoveOptions holds parameters to remove plugins. +type PluginRemoveOptions struct { + Force bool +} + +// PluginRemoveResult represents the result of a plugin removal. +type PluginRemoveResult struct { + // Currently empty; can be extended in the future if needed. +} + +// PluginRemove removes a plugin +func (cli *Client) PluginRemove(ctx context.Context, name string, options PluginRemoveOptions) (PluginRemoveResult, error) { + name, err := trimID("plugin", name) + if err != nil { + return PluginRemoveResult{}, err + } + + query := url.Values{} + if options.Force { + query.Set("force", "1") + } + + resp, err := cli.delete(ctx, "/plugins/"+name, query, nil) + defer ensureReaderClosed(resp) + return PluginRemoveResult{}, err +} diff --git a/vendor/github.com/moby/moby/client/plugin_set.go b/vendor/github.com/moby/moby/client/plugin_set.go new file mode 100644 index 00000000..c1f6bb5f --- /dev/null +++ b/vendor/github.com/moby/moby/client/plugin_set.go @@ -0,0 +1,27 @@ +package client + +import ( + "context" +) + +// PluginSetOptions defines options for modifying a plugin's settings. +type PluginSetOptions struct { + Args []string +} + +// PluginSetResult represents the result of a plugin set operation. +type PluginSetResult struct { + // Currently empty; can be extended in the future if needed. +} + +// PluginSet modifies settings for an existing plugin +func (cli *Client) PluginSet(ctx context.Context, name string, options PluginSetOptions) (PluginSetResult, error) { + name, err := trimID("plugin", name) + if err != nil { + return PluginSetResult{}, err + } + + resp, err := cli.post(ctx, "/plugins/"+name+"/set", nil, options.Args, nil) + defer ensureReaderClosed(resp) + return PluginSetResult{}, err +} diff --git a/vendor/github.com/moby/moby/client/plugin_upgrade.go b/vendor/github.com/moby/moby/client/plugin_upgrade.go new file mode 100644 index 00000000..f9df6e58 --- /dev/null +++ b/vendor/github.com/moby/moby/client/plugin_upgrade.go @@ -0,0 +1,89 @@ +package client + +import ( + "context" + "fmt" + "io" + "net/http" + "net/url" + + "github.com/distribution/reference" + "github.com/moby/moby/api/types/plugin" + "github.com/moby/moby/api/types/registry" +) + +// PluginUpgradeOptions holds parameters to upgrade a plugin. +type PluginUpgradeOptions struct { + Disabled bool + AcceptAllPermissions bool + RegistryAuth string // RegistryAuth is the base64 encoded credentials for the registry + RemoteRef string // RemoteRef is the plugin name on the registry + + // PrivilegeFunc is a function that clients can supply to retry operations + // after getting an authorization error. This function returns the registry + // authentication header value in base64 encoded format, or an error if the + // privilege request fails. + // + // For details, refer to [github.com/moby/moby/api/types/registry.RequestAuthConfig]. + PrivilegeFunc func(context.Context) (string, error) + AcceptPermissionsFunc func(context.Context, plugin.Privileges) (bool, error) + Args []string +} + +// PluginUpgradeResult holds the result of a plugin upgrade operation. +type PluginUpgradeResult io.ReadCloser + +// PluginUpgrade upgrades a plugin +func (cli *Client) PluginUpgrade(ctx context.Context, name string, options PluginUpgradeOptions) (PluginUpgradeResult, error) { + name, err := trimID("plugin", name) + if err != nil { + return nil, err + } + + query := url.Values{} + if _, err := reference.ParseNormalizedNamed(options.RemoteRef); err != nil { + return nil, fmt.Errorf("invalid remote reference: %w", err) + } + query.Set("remote", options.RemoteRef) + + privileges, err := cli.checkPluginPermissions(ctx, query, &options) + if err != nil { + return nil, err + } + + resp, err := cli.tryPluginUpgrade(ctx, query, privileges, name, options.RegistryAuth) + if err != nil { + return nil, err + } + return resp.Body, nil +} + +func (cli *Client) tryPluginUpgrade(ctx context.Context, query url.Values, privileges plugin.Privileges, name, registryAuth string) (*http.Response, error) { + return cli.post(ctx, "/plugins/"+name+"/upgrade", query, privileges, http.Header{ + registry.AuthHeader: {registryAuth}, + }) +} + +func (o *PluginUpgradeOptions) getRegistryAuth() string { + return o.RegistryAuth +} + +func (o *PluginUpgradeOptions) setRegistryAuth(auth string) { + o.RegistryAuth = auth +} + +func (o *PluginUpgradeOptions) getPrivilegeFunc() func(context.Context) (string, error) { + return o.PrivilegeFunc +} + +func (o *PluginUpgradeOptions) getAcceptAllPermissions() bool { + return o.AcceptAllPermissions +} + +func (o *PluginUpgradeOptions) getAcceptPermissionsFunc() func(context.Context, plugin.Privileges) (bool, error) { + return o.AcceptPermissionsFunc +} + +func (o *PluginUpgradeOptions) getRemoteRef() string { + return o.RemoteRef +} diff --git a/vendor/github.com/moby/moby/client/request.go b/vendor/github.com/moby/moby/client/request.go new file mode 100644 index 00000000..10ed36dc --- /dev/null +++ b/vendor/github.com/moby/moby/client/request.go @@ -0,0 +1,381 @@ +package client + +import ( + "bytes" + "context" + "encoding/json" + "errors" + "fmt" + "io" + "net" + "net/http" + "net/url" + "os" + "reflect" + "strings" + + "github.com/moby/moby/api/types/common" +) + +// head sends an http request to the docker API using the method HEAD. +func (cli *Client) head(ctx context.Context, path string, query url.Values, headers http.Header) (*http.Response, error) { + return cli.sendRequest(ctx, http.MethodHead, path, query, nil, headers) +} + +// get sends an http request to the docker API using the method GET with a specific Go context. +func (cli *Client) get(ctx context.Context, path string, query url.Values, headers http.Header) (*http.Response, error) { + return cli.sendRequest(ctx, http.MethodGet, path, query, nil, headers) +} + +// post sends an http POST request to the API. +func (cli *Client) post(ctx context.Context, path string, query url.Values, body any, headers http.Header) (*http.Response, error) { + jsonBody, headers, err := prepareJSONRequest(body, headers) + if err != nil { + return nil, err + } + return cli.sendRequest(ctx, http.MethodPost, path, query, jsonBody, headers) +} + +func (cli *Client) postRaw(ctx context.Context, path string, query url.Values, body io.Reader, headers http.Header) (*http.Response, error) { + return cli.sendRequest(ctx, http.MethodPost, path, query, body, headers) +} + +func (cli *Client) put(ctx context.Context, path string, query url.Values, body any, headers http.Header) (*http.Response, error) { + jsonBody, headers, err := prepareJSONRequest(body, headers) + if err != nil { + return nil, err + } + return cli.putRaw(ctx, path, query, jsonBody, headers) +} + +// putRaw sends an http request to the docker API using the method PUT. +func (cli *Client) putRaw(ctx context.Context, path string, query url.Values, body io.Reader, headers http.Header) (*http.Response, error) { + // PUT requests are expected to always have a body (apparently) + // so explicitly pass an empty body to sendRequest to signal that + // it should set the Content-Type header if not already present. + if body == nil { + body = http.NoBody + } + return cli.sendRequest(ctx, http.MethodPut, path, query, body, headers) +} + +// delete sends an http request to the docker API using the method DELETE. +func (cli *Client) delete(ctx context.Context, path string, query url.Values, headers http.Header) (*http.Response, error) { + return cli.sendRequest(ctx, http.MethodDelete, path, query, nil, headers) +} + +// prepareJSONRequest encodes the given body to JSON and returns it as an [io.Reader], and sets the Content-Type +// header. If body is nil, or a nil-interface, a "nil" body is returned without +// error. +func prepareJSONRequest(body any, headers http.Header) (io.Reader, http.Header, error) { + jsonBody, err := jsonEncode(body) + if err != nil { + return nil, headers, err + } + if jsonBody == nil || jsonBody == http.NoBody { + // no content-type is set on empty requests. + return jsonBody, headers, nil + } + + hdr := http.Header{} + if headers != nil { + hdr = headers.Clone() + } + + // TODO(thaJeztah): should this return an error if a different Content-Type is already set? + hdr.Set("Content-Type", "application/json") + return jsonBody, hdr, nil +} + +func (cli *Client) buildRequest(ctx context.Context, method, path string, body io.Reader, headers http.Header) (*http.Request, error) { + req, err := http.NewRequestWithContext(ctx, method, path, body) + if err != nil { + return nil, err + } + req = cli.addHeaders(req, headers) + req.URL.Scheme = cli.scheme + req.URL.Host = cli.addr + + if cli.proto == "unix" || cli.proto == "npipe" { + // Override host header for non-tcp connections. + req.Host = DummyHost + } + + return req, nil +} + +func (cli *Client) sendRequest(ctx context.Context, method, path string, query url.Values, body io.Reader, headers http.Header) (*http.Response, error) { + req, err := cli.buildRequest(ctx, method, cli.getAPIPath(ctx, path, query), body, headers) + if err != nil { + return nil, err + } + + resp, err := cli.doRequest(req) + if err != nil { + // Failed to connect or context error. + return resp, err + } + + // Successfully made a request; return the response and handle any + // API HTTP response errors. + return resp, checkResponseErr(resp) +} + +// doRequest sends an HTTP request and returns an HTTP response. It is a +// wrapper around [http.Client.Do] with extra handling to decorate errors. +// +// Otherwise, it behaves identical to [http.Client.Do]; an error is returned +// when failing to make a connection, On error, any Response can be ignored. +// A non-2xx status code doesn't cause an error. +func (cli *Client) doRequest(req *http.Request) (*http.Response, error) { + resp, err := cli.client.Do(req) // #nosec G704 -- ignore "SSRF via taint analysis"; API client intentionally sends caller-provided requests/URLs. + if err == nil { + return resp, nil + } + + if cli.scheme != "https" && strings.Contains(err.Error(), "malformed HTTP response") { + return nil, errConnectionFailed{fmt.Errorf("%w.\n* Are you trying to connect to a TLS-enabled daemon without TLS?", err)} + } + + const ( + // Go 1.25 / TLS 1.3 may produce a generic "handshake failure" + // whereas TLS 1.2 may produce a "bad certificate" TLS alert. + // See https://github.com/golang/go/issues/56371 + // + // > https://tip.golang.org/doc/go1.12#tls_1_3 + // > + // > In TLS 1.3 the client is the last one to speak in the handshake, so if + // > it causes an error to occur on the server, it will be returned on the + // > client by the first Read, not by Handshake. For example, that will be + // > the case if the server rejects the client certificate. + // + // https://github.com/golang/go/blob/go1.25.1/src/crypto/tls/alert.go#L71-L72 + alertBadCertificate = "bad certificate" // go1.24 / TLS 1.2 + alertHandshakeFailure = "handshake failure" // go1.25 / TLS 1.3 + ) + + // TODO(thaJeztah): see if we can use errors.As for a [crypto/tls.AlertError] instead of bare string matching. + if cli.scheme == "https" && (strings.Contains(err.Error(), alertHandshakeFailure) || strings.Contains(err.Error(), alertBadCertificate)) { + return nil, errConnectionFailed{fmt.Errorf("the server probably has client authentication (--tlsverify) enabled; check your TLS client certification settings: %w", err)} + } + + // Don't decorate context sentinel errors; users may be comparing to + // them directly. + if errors.Is(err, context.Canceled) || errors.Is(err, context.DeadlineExceeded) { + return nil, err + } + + if errors.Is(err, os.ErrPermission) { + // Don't include request errors (Get "http://%2Fvar%2Frun%2Fdocker.sock/v1.51/version"), + // which are irrelevant if we weren't able to connect. + return nil, errConnectionFailed{fmt.Errorf("permission denied while trying to connect to the docker API at %v", cli.host)} + } + if errors.Is(err, os.ErrNotExist) { + // Unwrap the error to remove request errors (Get "http://%2Fvar%2Frun%2Fdocker.sock/v1.51/version"), + // which are irrelevant if we weren't able to connect. + err = errors.Unwrap(err) + return nil, errConnectionFailed{fmt.Errorf("failed to connect to the docker API at %v; check if the path is correct and if the daemon is running: %w", cli.host, err)} + } + var dnsErr *net.DNSError + if errors.As(err, &dnsErr) { + return nil, errConnectionFailed{fmt.Errorf("failed to connect to the docker API at %v: %w", cli.host, dnsErr)} + } + + var nErr net.Error + if errors.As(err, &nErr) { + // FIXME(thaJeztah): any net.Error should be considered a connection error (but we should include the original error)? + if nErr.Timeout() { + return nil, connectionFailed(cli.host) + } + if strings.Contains(nErr.Error(), "connection refused") || strings.Contains(nErr.Error(), "dial unix") { + return nil, connectionFailed(cli.host) + } + } + + // Although there's not a strongly typed error for this in go-winio, + // lots of people are using the default configuration for the docker + // daemon on Windows where the daemon is listening on a named pipe + // ("//./pipe/docker_engine"), and the client must be running elevated. + // + // Give users a clue rather than the not-overly useful message such as; + // + // open //./pipe/docker_engine: The system cannot find the file specified. + // + // Note we can't string compare "The system cannot find the file specified" as + // this is localized; for example. in French the error would be; + // + // open //./pipe/docker_engine: Le fichier spécifié est introuvable. + if strings.Contains(err.Error(), `open //./pipe/docker_engine`) { + // Checks if client is running with elevated privileges + if f, elevatedErr := os.Open(`\\.\PHYSICALDRIVE0`); elevatedErr != nil { + err = fmt.Errorf("in the default daemon configuration on Windows, the docker client must be run with elevated privileges to connect: %w", err) + } else { + _ = f.Close() + err = fmt.Errorf("this error may indicate that the docker daemon is not running: %w", err) + } + } + + return nil, errConnectionFailed{fmt.Errorf("error during connect: %w", err)} +} + +func checkResponseErr(serverResp *http.Response) (retErr error) { + if serverResp == nil { + return nil + } + if serverResp.StatusCode >= http.StatusOK && serverResp.StatusCode < http.StatusBadRequest { + return nil + } + defer func() { + retErr = httpErrorFromStatusCode(retErr, serverResp.StatusCode) + }() + + var body []byte + var err error + var reqURL string + if serverResp.Request != nil { + reqURL = serverResp.Request.URL.String() + } + statusMsg := serverResp.Status + if statusMsg == "" { + statusMsg = http.StatusText(serverResp.StatusCode) + } + var reqMethod string + if serverResp.Request != nil { + reqMethod = serverResp.Request.Method + } + if serverResp.Body != nil && reqMethod != http.MethodHead { + bodyMax := 1 * 1024 * 1024 // 1 MiB + bodyR := &io.LimitedReader{ + R: serverResp.Body, + N: int64(bodyMax), + } + body, err = io.ReadAll(bodyR) + if err != nil { + return err + } + if bodyR.N == 0 { + if reqURL != "" { + return fmt.Errorf("request returned %s with a message (> %d bytes) for API route and version %s, check if the server supports the requested API version", statusMsg, bodyMax, reqURL) + } + return fmt.Errorf("request returned %s with a message (> %d bytes); check if the server supports the requested API version", statusMsg, bodyMax) + } + } + if len(body) == 0 { + if reqURL != "" { + return fmt.Errorf("request returned %s for API route and version %s, check if the server supports the requested API version", statusMsg, reqURL) + } + return fmt.Errorf("request returned %s; check if the server supports the requested API version", statusMsg) + } + + var daemonErr error + if serverResp.Header.Get("Content-Type") == "application/json" { + var errorResponse common.ErrorResponse + if err := json.Unmarshal(body, &errorResponse); err != nil { + return fmt.Errorf("error reading JSON: %w", err) + } + if errorResponse.Message == "" { + // Error-message is empty, which means that we successfully parsed the + // JSON-response (no error produced), but it didn't contain an error + // message. This could either be because the response was empty, or + // the response was valid JSON, but not with the expected schema + // ([common.ErrorResponse]). + // + // We cannot use "strict" JSON handling (json.NewDecoder with DisallowUnknownFields) + // due to the API using an open schema (we must anticipate fields + // being added to [common.ErrorResponse] in the future, and not + // reject those responses. + // + // For these cases, we construct an error with the status-code + // returned, but we could consider returning (a truncated version + // of) the actual response as-is. + // + // TODO(thaJeztah): consider adding a log.Debug to allow clients to debug the actual response when enabling debug logging. + daemonErr = fmt.Errorf(`API returned a %d (%s) but provided no error-message`, + serverResp.StatusCode, + http.StatusText(serverResp.StatusCode), + ) + } else { + daemonErr = errors.New(strings.TrimSpace(errorResponse.Message)) + } + } else { + // Fall back to returning the response as-is for situations where a + // plain text error is returned. This branch may also catch + // situations where a proxy is involved, returning an HTML response. + daemonErr = errors.New(strings.TrimSpace(string(body))) + } + return fmt.Errorf("Error response from daemon: %w", daemonErr) +} + +func (cli *Client) addHeaders(req *http.Request, headers http.Header) *http.Request { + // Add CLI Config's HTTP Headers BEFORE we set the Docker headers + // then the user can't change OUR headers + for k, v := range cli.customHTTPHeaders { + req.Header.Set(k, v) + } + + for k, v := range headers { + req.Header[http.CanonicalHeaderKey(k)] = v + } + + if cli.userAgent == nil { + // No custom User-Agent set: use the default. + if req.Header.Get("User-Agent") == "" { + req.Header.Set("User-Agent", defaultUserAgent()) + } + } else if *cli.userAgent == "" { + // User-Agent set to empty value; remove User-Agent. + req.Header.Del("User-Agent") + } else { + // Custom User-Agent set. + req.Header.Set("User-Agent", *cli.userAgent) + } + return req +} + +func jsonEncode(data any) (io.Reader, error) { + switch x := data.(type) { + case nil: + return http.NoBody, nil + case io.Reader: + // http.NoBody or other readers + return x, nil + case json.RawMessage: + if len(x) == 0 { + return http.NoBody, nil + } + return bytes.NewReader(x), nil + } + + // encoding/json encodes a nil pointer as the JSON document `null`, + // irrespective of whether the type implements json.Marshaler or encoding.TextMarshaler. + // That is almost certainly not what the caller intended as the request body. + if v := reflect.ValueOf(data); v.Kind() == reflect.Pointer && v.IsNil() { + return http.NoBody, nil + } + + b, err := json.Marshal(data) + if err != nil { + return nil, err + } + return bytes.NewReader(b), nil +} + +func ensureReaderClosed(response *http.Response) { + if response == nil || response.Body == nil { + return + } + if response.ContentLength == 0 || (response.Request != nil && response.Request.Method == http.MethodHead) { + // No need to drain head requests or zero-length responses. + _ = response.Body.Close() + return + } + // Drain up to 512 bytes and close the body to let the Transport reuse the connection + // see https://github.com/google/go-github/pull/317/files#r57536827 + // + // TODO(thaJeztah): see if this optimization is still needed, or already implemented in stdlib, + // and check if context-cancellation should handle this as well. If still needed, consider + // wrapping response.Body, or returning a "closer()" from [Client.sendRequest] and related + // methods. + _, _ = io.CopyN(io.Discard, response.Body, 512) + _ = response.Body.Close() +} diff --git a/vendor/github.com/moby/moby/client/secret_create.go b/vendor/github.com/moby/moby/client/secret_create.go new file mode 100644 index 00000000..8e59a42c --- /dev/null +++ b/vendor/github.com/moby/moby/client/secret_create.go @@ -0,0 +1,34 @@ +package client + +import ( + "context" + "encoding/json" + + "github.com/moby/moby/api/types/swarm" +) + +// SecretCreateOptions holds options for creating a secret. +type SecretCreateOptions struct { + Spec swarm.SecretSpec +} + +// SecretCreateResult holds the result from the [Client.SecretCreate] method. +type SecretCreateResult struct { + ID string +} + +// SecretCreate creates a new secret. +func (cli *Client) SecretCreate(ctx context.Context, options SecretCreateOptions) (SecretCreateResult, error) { + resp, err := cli.post(ctx, "/secrets/create", nil, options.Spec, nil) + defer ensureReaderClosed(resp) + if err != nil { + return SecretCreateResult{}, err + } + + var out swarm.ConfigCreateResponse + err = json.NewDecoder(resp.Body).Decode(&out) + if err != nil { + return SecretCreateResult{}, err + } + return SecretCreateResult{ID: out.ID}, nil +} diff --git a/vendor/github.com/moby/moby/client/secret_inspect.go b/vendor/github.com/moby/moby/client/secret_inspect.go new file mode 100644 index 00000000..fefd4cd2 --- /dev/null +++ b/vendor/github.com/moby/moby/client/secret_inspect.go @@ -0,0 +1,35 @@ +package client + +import ( + "context" + "encoding/json" + + "github.com/moby/moby/api/types/swarm" +) + +// SecretInspectOptions holds options for inspecting a secret. +type SecretInspectOptions struct { + // Add future optional parameters here +} + +// SecretInspectResult holds the result from the [Client.SecretInspect]. method. +type SecretInspectResult struct { + Secret swarm.Secret + Raw json.RawMessage +} + +// SecretInspect returns the secret information with raw data. +func (cli *Client) SecretInspect(ctx context.Context, id string, options SecretInspectOptions) (SecretInspectResult, error) { + id, err := trimID("secret", id) + if err != nil { + return SecretInspectResult{}, err + } + resp, err := cli.get(ctx, "/secrets/"+id, nil, nil) + if err != nil { + return SecretInspectResult{}, err + } + + var out SecretInspectResult + out.Raw, err = decodeWithRaw(resp, &out.Secret) + return out, err +} diff --git a/vendor/github.com/moby/moby/client/secret_list.go b/vendor/github.com/moby/moby/client/secret_list.go new file mode 100644 index 00000000..be369557 --- /dev/null +++ b/vendor/github.com/moby/moby/client/secret_list.go @@ -0,0 +1,38 @@ +package client + +import ( + "context" + "encoding/json" + "net/url" + + "github.com/moby/moby/api/types/swarm" +) + +// SecretListOptions holds parameters to list secrets +type SecretListOptions struct { + Filters Filters +} + +// SecretListResult holds the result from the [client.SecretList] method. +type SecretListResult struct { + Items []swarm.Secret +} + +// SecretList returns the list of secrets. +func (cli *Client) SecretList(ctx context.Context, options SecretListOptions) (SecretListResult, error) { + query := url.Values{} + options.Filters.updateURLValues(query) + + resp, err := cli.get(ctx, "/secrets", query, nil) + defer ensureReaderClosed(resp) + if err != nil { + return SecretListResult{}, err + } + + var out SecretListResult + err = json.NewDecoder(resp.Body).Decode(&out.Items) + if err != nil { + return SecretListResult{}, err + } + return out, nil +} diff --git a/vendor/github.com/moby/moby/client/secret_remove.go b/vendor/github.com/moby/moby/client/secret_remove.go new file mode 100644 index 00000000..42cbfec9 --- /dev/null +++ b/vendor/github.com/moby/moby/client/secret_remove.go @@ -0,0 +1,27 @@ +package client + +import "context" + +// SecretRemoveOptions holds options for [Client.SecretRemove]. +type SecretRemoveOptions struct { + // Add future optional parameters here +} + +// SecretRemoveResult holds the result of [Client.SecretRemove]. +type SecretRemoveResult struct { + // Add future fields here +} + +// SecretRemove removes a secret. +func (cli *Client) SecretRemove(ctx context.Context, id string, options SecretRemoveOptions) (SecretRemoveResult, error) { + id, err := trimID("secret", id) + if err != nil { + return SecretRemoveResult{}, err + } + resp, err := cli.delete(ctx, "/secrets/"+id, nil, nil) + defer ensureReaderClosed(resp) + if err != nil { + return SecretRemoveResult{}, err + } + return SecretRemoveResult{}, nil +} diff --git a/vendor/github.com/moby/moby/client/secret_update.go b/vendor/github.com/moby/moby/client/secret_update.go new file mode 100644 index 00000000..d50fba4d --- /dev/null +++ b/vendor/github.com/moby/moby/client/secret_update.go @@ -0,0 +1,33 @@ +package client + +import ( + "context" + "net/url" + + "github.com/moby/moby/api/types/swarm" +) + +// SecretUpdateOptions holds options for updating a secret. +type SecretUpdateOptions struct { + Version swarm.Version + Spec swarm.SecretSpec +} + +// SecretUpdateResult holds the result of [Client.SecretUpdate]. +type SecretUpdateResult struct{} + +// SecretUpdate attempts to update a secret. +func (cli *Client) SecretUpdate(ctx context.Context, id string, options SecretUpdateOptions) (SecretUpdateResult, error) { + id, err := trimID("secret", id) + if err != nil { + return SecretUpdateResult{}, err + } + query := url.Values{} + query.Set("version", options.Version.String()) + resp, err := cli.post(ctx, "/secrets/"+id+"/update", query, options.Spec, nil) + defer ensureReaderClosed(resp) + if err != nil { + return SecretUpdateResult{}, err + } + return SecretUpdateResult{}, nil +} diff --git a/vendor/github.com/moby/moby/client/service_create.go b/vendor/github.com/moby/moby/client/service_create.go new file mode 100644 index 00000000..319bca6f --- /dev/null +++ b/vendor/github.com/moby/moby/client/service_create.go @@ -0,0 +1,206 @@ +package client + +import ( + "context" + "encoding/json" + "errors" + "fmt" + "net/http" + "strings" + + "github.com/distribution/reference" + "github.com/moby/moby/api/types/registry" + "github.com/moby/moby/api/types/swarm" + "github.com/opencontainers/go-digest" +) + +// ServiceCreateOptions contains the options to use when creating a service. +type ServiceCreateOptions struct { + Spec swarm.ServiceSpec + + // EncodedRegistryAuth is the encoded registry authorization credentials to + // use when updating the service. + // + // This field follows the format of the X-Registry-Auth header. + EncodedRegistryAuth string + + // QueryRegistry indicates whether the service update requires + // contacting a registry. A registry may be contacted to retrieve + // the image digest and manifest, which in turn can be used to update + // platform or other information about the service. + QueryRegistry bool +} + +// ServiceCreateResult represents the result of creating a service. +type ServiceCreateResult struct { + // ID is the ID of the created service. + ID string + + // Warnings is a list of warnings that occurred during service creation. + Warnings []string +} + +// ServiceCreate creates a new service. +func (cli *Client) ServiceCreate(ctx context.Context, options ServiceCreateOptions) (ServiceCreateResult, error) { + // Make sure containerSpec is not nil when no runtime is set or the runtime is set to container + if options.Spec.TaskTemplate.ContainerSpec == nil && (options.Spec.TaskTemplate.Runtime == "" || options.Spec.TaskTemplate.Runtime == swarm.RuntimeContainer) { + options.Spec.TaskTemplate.ContainerSpec = &swarm.ContainerSpec{} + } + + if err := validateServiceSpec(options.Spec); err != nil { + return ServiceCreateResult{}, err + } + + // ensure that the image is tagged + var warnings []string + switch { + case options.Spec.TaskTemplate.ContainerSpec != nil: + if taggedImg := imageWithTagString(options.Spec.TaskTemplate.ContainerSpec.Image); taggedImg != "" { + options.Spec.TaskTemplate.ContainerSpec.Image = taggedImg + } + if options.QueryRegistry { + if warning := resolveContainerSpecImage(ctx, cli, &options.Spec.TaskTemplate, options.EncodedRegistryAuth); warning != "" { + warnings = append(warnings, warning) + } + } + case options.Spec.TaskTemplate.PluginSpec != nil: + if taggedImg := imageWithTagString(options.Spec.TaskTemplate.PluginSpec.Remote); taggedImg != "" { + options.Spec.TaskTemplate.PluginSpec.Remote = taggedImg + } + if options.QueryRegistry { + if warning := resolvePluginSpecRemote(ctx, cli, &options.Spec.TaskTemplate, options.EncodedRegistryAuth); warning != "" { + warnings = append(warnings, warning) + } + } + } + + headers := http.Header{} + if options.EncodedRegistryAuth != "" { + headers[registry.AuthHeader] = []string{options.EncodedRegistryAuth} + } + resp, err := cli.post(ctx, "/services/create", nil, options.Spec, headers) + defer ensureReaderClosed(resp) + if err != nil { + return ServiceCreateResult{}, err + } + + var response swarm.ServiceCreateResponse + err = json.NewDecoder(resp.Body).Decode(&response) + warnings = append(warnings, response.Warnings...) + + return ServiceCreateResult{ + ID: response.ID, + Warnings: warnings, + }, err +} + +func resolveContainerSpecImage(ctx context.Context, cli DistributionAPIClient, taskSpec *swarm.TaskSpec, encodedAuth string) string { + img, imgPlatforms, err := imageDigestAndPlatforms(ctx, cli, taskSpec.ContainerSpec.Image, encodedAuth) + if err != nil { + return digestWarning(taskSpec.ContainerSpec.Image) + } + taskSpec.ContainerSpec.Image = img + if len(imgPlatforms) > 0 { + if taskSpec.Placement == nil { + taskSpec.Placement = &swarm.Placement{} + } + taskSpec.Placement.Platforms = imgPlatforms + } + return "" +} + +func resolvePluginSpecRemote(ctx context.Context, cli DistributionAPIClient, taskSpec *swarm.TaskSpec, encodedAuth string) string { + img, imgPlatforms, err := imageDigestAndPlatforms(ctx, cli, taskSpec.PluginSpec.Remote, encodedAuth) + if err != nil { + return digestWarning(taskSpec.PluginSpec.Remote) + } + taskSpec.PluginSpec.Remote = img + if len(imgPlatforms) > 0 { + if taskSpec.Placement == nil { + taskSpec.Placement = &swarm.Placement{} + } + taskSpec.Placement.Platforms = imgPlatforms + } + return "" +} + +func imageDigestAndPlatforms(ctx context.Context, cli DistributionAPIClient, image, encodedAuth string) (string, []swarm.Platform, error) { + distributionInspect, err := cli.DistributionInspect(ctx, image, DistributionInspectOptions{ + EncodedRegistryAuth: encodedAuth, + }) + var platforms []swarm.Platform + if err != nil { + return "", nil, err + } + + imageWithDigest := imageWithDigestString(image, distributionInspect.Descriptor.Digest) + + if len(distributionInspect.Platforms) > 0 { + platforms = make([]swarm.Platform, 0, len(distributionInspect.Platforms)) + for _, p := range distributionInspect.Platforms { + // clear architecture field for arm. This is a temporary patch to address + // https://github.com/docker/swarmkit/issues/2294. The issue is that while + // image manifests report "arm" as the architecture, the node reports + // something like "armv7l" (includes the variant), which causes arm images + // to stop working with swarm mode. This patch removes the architecture + // constraint for arm images to ensure tasks get scheduled. + arch := p.Architecture + if strings.ToLower(arch) == "arm" { + arch = "" + } + platforms = append(platforms, swarm.Platform{ + Architecture: arch, + OS: p.OS, + }) + } + } + return imageWithDigest, platforms, err +} + +// imageWithDigestString takes an image string and a digest, and updates +// the image string if it didn't originally contain a digest. It returns +// image unmodified in other situations. +func imageWithDigestString(image string, dgst digest.Digest) string { + namedRef, err := reference.ParseNormalizedNamed(image) + if err == nil { + if _, hasDigest := namedRef.(reference.Digested); !hasDigest { + // ensure that image gets a default tag if none is provided + img, err := reference.WithDigest(namedRef, dgst) + if err == nil { + return reference.FamiliarString(img) + } + } + } + return image +} + +// imageWithTagString takes an image string, and returns a tagged image +// string, adding a 'latest' tag if one was not provided. It returns an +// empty string if a canonical reference was provided +func imageWithTagString(image string) string { + namedRef, err := reference.ParseNormalizedNamed(image) + if err == nil { + return reference.FamiliarString(reference.TagNameOnly(namedRef)) + } + return "" +} + +// digestWarning constructs a formatted warning string using the +// image name that could not be pinned by digest. The formatting +// is hardcoded, but could me made smarter in the future +func digestWarning(image string) string { + return fmt.Sprintf("image %s could not be accessed on a registry to record\nits digest. Each node will access %s independently,\npossibly leading to different nodes running different\nversions of the image.\n", image, image) +} + +func validateServiceSpec(s swarm.ServiceSpec) error { + if s.TaskTemplate.ContainerSpec != nil && s.TaskTemplate.PluginSpec != nil { + return errors.New("must not specify both a container spec and a plugin spec in the task template") + } + if s.TaskTemplate.PluginSpec != nil && s.TaskTemplate.Runtime != swarm.RuntimePlugin { + return errors.New("mismatched runtime with plugin spec") + } + if s.TaskTemplate.ContainerSpec != nil && (s.TaskTemplate.Runtime != "" && s.TaskTemplate.Runtime != swarm.RuntimeContainer) { + return errors.New("mismatched runtime with container spec") + } + return nil +} diff --git a/vendor/github.com/moby/moby/client/service_inspect.go b/vendor/github.com/moby/moby/client/service_inspect.go new file mode 100644 index 00000000..9bda43f8 --- /dev/null +++ b/vendor/github.com/moby/moby/client/service_inspect.go @@ -0,0 +1,40 @@ +package client + +import ( + "context" + "encoding/json" + "fmt" + "net/url" + + "github.com/moby/moby/api/types/swarm" +) + +// ServiceInspectOptions holds parameters related to the service inspect operation. +type ServiceInspectOptions struct { + InsertDefaults bool +} + +// ServiceInspectResult represents the result of a service inspect operation. +type ServiceInspectResult struct { + Service swarm.Service + Raw json.RawMessage +} + +// ServiceInspect retrieves detailed information about a specific service by its ID. +func (cli *Client) ServiceInspect(ctx context.Context, serviceID string, options ServiceInspectOptions) (ServiceInspectResult, error) { + serviceID, err := trimID("service", serviceID) + if err != nil { + return ServiceInspectResult{}, err + } + + query := url.Values{} + query.Set("insertDefaults", fmt.Sprintf("%v", options.InsertDefaults)) + resp, err := cli.get(ctx, "/services/"+serviceID, query, nil) + if err != nil { + return ServiceInspectResult{}, err + } + + var out ServiceInspectResult + out.Raw, err = decodeWithRaw(resp, &out.Service) + return out, err +} diff --git a/vendor/github.com/moby/moby/client/service_list.go b/vendor/github.com/moby/moby/client/service_list.go new file mode 100644 index 00000000..94b5204b --- /dev/null +++ b/vendor/github.com/moby/moby/client/service_list.go @@ -0,0 +1,44 @@ +package client + +import ( + "context" + "encoding/json" + "net/url" + + "github.com/moby/moby/api/types/swarm" +) + +// ServiceListOptions holds parameters to list services with. +type ServiceListOptions struct { + Filters Filters + + // Status indicates whether the server should include the service task + // count of running and desired tasks. + Status bool +} + +// ServiceListResult represents the result of a service list operation. +type ServiceListResult struct { + Items []swarm.Service +} + +// ServiceList returns the list of services. +func (cli *Client) ServiceList(ctx context.Context, options ServiceListOptions) (ServiceListResult, error) { + query := url.Values{} + + options.Filters.updateURLValues(query) + + if options.Status { + query.Set("status", "true") + } + + resp, err := cli.get(ctx, "/services", query, nil) + defer ensureReaderClosed(resp) + if err != nil { + return ServiceListResult{}, err + } + + var services []swarm.Service + err = json.NewDecoder(resp.Body).Decode(&services) + return ServiceListResult{Items: services}, err +} diff --git a/vendor/github.com/moby/moby/client/service_logs.go b/vendor/github.com/moby/moby/client/service_logs.go new file mode 100644 index 00000000..911b63cb --- /dev/null +++ b/vendor/github.com/moby/moby/client/service_logs.go @@ -0,0 +1,106 @@ +package client + +import ( + "context" + "fmt" + "io" + "net/url" + "time" + + "github.com/moby/moby/client/internal/timestamp" +) + +// ServiceLogsOptions holds parameters to filter logs with. +type ServiceLogsOptions struct { + ShowStdout bool + ShowStderr bool + Since string + Until string + Timestamps bool + Follow bool + Tail string + Details bool +} + +// ServiceLogsResult holds the result of a service logs operation. +// It implements [io.ReadCloser]. +// It's up to the caller to close the stream. +type ServiceLogsResult interface { + io.ReadCloser +} + +// ServiceLogs returns the logs generated by a service in a [ServiceLogsResult]. +// as an [io.ReadCloser]. Callers should close the stream. +// +// The underlying [io.ReadCloser] is automatically closed if the context is canceled, +func (cli *Client) ServiceLogs(ctx context.Context, serviceID string, options ServiceLogsOptions) (ServiceLogsResult, error) { + // TODO(thaJeztah): this function needs documentation about the format of the stream (similar to for container logs) + // TODO(thaJeztah): migrate CLI utilities to the client where suitable; https://github.com/docker/cli/blob/v29.0.0-rc.1/cli/command/service/logs.go#L73-L348 + + serviceID, err := trimID("service", serviceID) + if err != nil { + return nil, err + } + + query := url.Values{} + if options.ShowStdout { + query.Set("stdout", "1") + } + + if options.ShowStderr { + query.Set("stderr", "1") + } + + if options.Since != "" { + ts, err := timestamp.GetTimestamp(options.Since, time.Now()) + if err != nil { + return nil, fmt.Errorf(`invalid value for "since": %w`, err) + } + query.Set("since", ts) + } + + if options.Timestamps { + query.Set("timestamps", "1") + } + + if options.Details { + query.Set("details", "1") + } + + if options.Follow { + query.Set("follow", "1") + } + switch options.Tail { + case "", "all": + // don't send option; default is to show all logs. + // + // The default on the daemon-side is to show all logs; account for + // some special values. The CLI may set a magic "all" value that's + // used as default. + // + // Given that the default is to show all logs, we can ignore these + // values, and don't send "tail". + // + // see https://github.com/moby/moby/blob/0df791cb72b568eeadba2267fe9a5040d12b0487/daemon/logs.go#L75-L78 + // see https://github.com/moby/moby/blob/4d20b6fe56dfb2b06f4a5dd1f32913215a9c317b/daemon/cluster/services.go#L425-L449 + default: + query.Set("tail", options.Tail) + } + + resp, err := cli.get(ctx, "/services/"+serviceID+"/logs", query, nil) + if err != nil { + return nil, err + } + return &serviceLogsResult{ + ReadCloser: newCancelReadCloser(ctx, resp.Body), + }, nil +} + +type serviceLogsResult struct { + io.ReadCloser +} + +var ( + _ io.ReadCloser = (*serviceLogsResult)(nil) + _ ServiceLogsResult = (*serviceLogsResult)(nil) +) diff --git a/vendor/github.com/moby/moby/client/service_remove.go b/vendor/github.com/moby/moby/client/service_remove.go new file mode 100644 index 00000000..163689b6 --- /dev/null +++ b/vendor/github.com/moby/moby/client/service_remove.go @@ -0,0 +1,25 @@ +package client + +import "context" + +// ServiceRemoveOptions contains options for removing a service. +type ServiceRemoveOptions struct { + // No options currently; placeholder for future use +} + +// ServiceRemoveResult contains the result of removing a service. +type ServiceRemoveResult struct { + // No fields currently; placeholder for future use +} + +// ServiceRemove kills and removes a service. +func (cli *Client) ServiceRemove(ctx context.Context, serviceID string, options ServiceRemoveOptions) (ServiceRemoveResult, error) { + serviceID, err := trimID("service", serviceID) + if err != nil { + return ServiceRemoveResult{}, err + } + + resp, err := cli.delete(ctx, "/services/"+serviceID, nil, nil) + defer ensureReaderClosed(resp) + return ServiceRemoveResult{}, err +} diff --git a/vendor/github.com/moby/moby/client/service_update.go b/vendor/github.com/moby/moby/client/service_update.go new file mode 100644 index 00000000..2505fe4b --- /dev/null +++ b/vendor/github.com/moby/moby/client/service_update.go @@ -0,0 +1,114 @@ +package client + +import ( + "context" + "encoding/json" + "net/http" + "net/url" + + "github.com/moby/moby/api/types/registry" + "github.com/moby/moby/api/types/swarm" +) + +// ServiceUpdateOptions contains the options to be used for updating services. +type ServiceUpdateOptions struct { + Version swarm.Version + Spec swarm.ServiceSpec + + // EncodedRegistryAuth is the encoded registry authorization credentials to + // use when updating the service. + // + // This field follows the format of the X-Registry-Auth header. + EncodedRegistryAuth string + + // TODO(stevvooe): Consider moving the version parameter of ServiceUpdate + // into this field. While it does open API users up to racy writes, most + // users may not need that level of consistency in practice. + + // RegistryAuthFrom specifies where to find the registry authorization + // credentials if they are not given in EncodedRegistryAuth. Valid + // values are "spec" and "previous-spec". + RegistryAuthFrom swarm.RegistryAuthSource + + // Rollback indicates whether a server-side rollback should be + // performed. When this is set, the provided spec will be ignored. + // The valid values are "previous" and "none". An empty value is the + // same as "none". + Rollback string + + // QueryRegistry indicates whether the service update requires + // contacting a registry. A registry may be contacted to retrieve + // the image digest and manifest, which in turn can be used to update + // platform or other information about the service. + QueryRegistry bool +} + +// ServiceUpdateResult represents the result of a service update. +type ServiceUpdateResult struct { + // Warnings contains any warnings that occurred during the update. + Warnings []string +} + +// ServiceUpdate updates a Service. The version number is required to avoid +// conflicting writes. It must be the value as set *before* the update. +// You can find this value in the [swarm.Service.Meta] field, which can +// be found using [Client.ServiceInspectWithRaw]. +func (cli *Client) ServiceUpdate(ctx context.Context, serviceID string, options ServiceUpdateOptions) (ServiceUpdateResult, error) { + serviceID, err := trimID("service", serviceID) + if err != nil { + return ServiceUpdateResult{}, err + } + + if err := validateServiceSpec(options.Spec); err != nil { + return ServiceUpdateResult{}, err + } + + query := url.Values{} + if options.RegistryAuthFrom != "" { + query.Set("registryAuthFrom", string(options.RegistryAuthFrom)) + } + + if options.Rollback != "" { + query.Set("rollback", options.Rollback) + } + + query.Set("version", options.Version.String()) + + // ensure that the image is tagged + var warnings []string + switch { + case options.Spec.TaskTemplate.ContainerSpec != nil: + if taggedImg := imageWithTagString(options.Spec.TaskTemplate.ContainerSpec.Image); taggedImg != "" { + options.Spec.TaskTemplate.ContainerSpec.Image = taggedImg + } + if options.QueryRegistry { + if warning := resolveContainerSpecImage(ctx, cli, &options.Spec.TaskTemplate, options.EncodedRegistryAuth); warning != "" { + warnings = append(warnings, warning) + } + } + case options.Spec.TaskTemplate.PluginSpec != nil: + if taggedImg := imageWithTagString(options.Spec.TaskTemplate.PluginSpec.Remote); taggedImg != "" { + options.Spec.TaskTemplate.PluginSpec.Remote = taggedImg + } + if options.QueryRegistry { + if warning := resolvePluginSpecRemote(ctx, cli, &options.Spec.TaskTemplate, options.EncodedRegistryAuth); warning != "" { + warnings = append(warnings, warning) + } + } + } + + headers := http.Header{} + if options.EncodedRegistryAuth != "" { + headers.Set(registry.AuthHeader, options.EncodedRegistryAuth) + } + resp, err := cli.post(ctx, "/services/"+serviceID+"/update", query, options.Spec, headers) + defer ensureReaderClosed(resp) + if err != nil { + return ServiceUpdateResult{}, err + } + + var response swarm.ServiceUpdateResponse + err = json.NewDecoder(resp.Body).Decode(&response) + warnings = append(warnings, response.Warnings...) + return ServiceUpdateResult{Warnings: warnings}, err +} diff --git a/vendor/github.com/moby/moby/client/swarm_get_unlock_key.go b/vendor/github.com/moby/moby/client/swarm_get_unlock_key.go new file mode 100644 index 00000000..03ecce40 --- /dev/null +++ b/vendor/github.com/moby/moby/client/swarm_get_unlock_key.go @@ -0,0 +1,26 @@ +package client + +import ( + "context" + "encoding/json" + + "github.com/moby/moby/api/types/swarm" +) + +// SwarmGetUnlockKeyResult contains the swarm unlock key. +type SwarmGetUnlockKeyResult struct { + Key string +} + +// SwarmGetUnlockKey retrieves the swarm's unlock key. +func (cli *Client) SwarmGetUnlockKey(ctx context.Context) (SwarmGetUnlockKeyResult, error) { + resp, err := cli.get(ctx, "/swarm/unlockkey", nil, nil) + defer ensureReaderClosed(resp) + if err != nil { + return SwarmGetUnlockKeyResult{}, err + } + + var response swarm.UnlockKeyResponse + err = json.NewDecoder(resp.Body).Decode(&response) + return SwarmGetUnlockKeyResult{Key: response.UnlockKey}, err +} diff --git a/vendor/github.com/moby/moby/client/swarm_init.go b/vendor/github.com/moby/moby/client/swarm_init.go new file mode 100644 index 00000000..caad5608 --- /dev/null +++ b/vendor/github.com/moby/moby/client/swarm_init.go @@ -0,0 +1,54 @@ +package client + +import ( + "context" + "encoding/json" + "net/netip" + + "github.com/moby/moby/api/types/swarm" +) + +// SwarmInitOptions contains options for initializing a new swarm. +type SwarmInitOptions struct { + ListenAddr string + AdvertiseAddr string + DataPathAddr string + DataPathPort uint32 + ForceNewCluster bool + Spec swarm.Spec + AutoLockManagers bool + Availability swarm.NodeAvailability + DefaultAddrPool []netip.Prefix + SubnetSize uint32 +} + +// SwarmInitResult contains the result of a SwarmInit operation. +type SwarmInitResult struct { + NodeID string +} + +// SwarmInit initializes the swarm. +func (cli *Client) SwarmInit(ctx context.Context, options SwarmInitOptions) (SwarmInitResult, error) { + req := swarm.InitRequest{ + ListenAddr: options.ListenAddr, + AdvertiseAddr: options.AdvertiseAddr, + DataPathAddr: options.DataPathAddr, + DataPathPort: options.DataPathPort, + ForceNewCluster: options.ForceNewCluster, + Spec: options.Spec, + AutoLockManagers: options.AutoLockManagers, + Availability: options.Availability, + DefaultAddrPool: options.DefaultAddrPool, + SubnetSize: options.SubnetSize, + } + + resp, err := cli.post(ctx, "/swarm/init", nil, req, nil) + defer ensureReaderClosed(resp) + if err != nil { + return SwarmInitResult{}, err + } + + var nodeID string + err = json.NewDecoder(resp.Body).Decode(&nodeID) + return SwarmInitResult{NodeID: nodeID}, err +} diff --git a/vendor/github.com/moby/moby/client/swarm_inspect.go b/vendor/github.com/moby/moby/client/swarm_inspect.go new file mode 100644 index 00000000..40e1d018 --- /dev/null +++ b/vendor/github.com/moby/moby/client/swarm_inspect.go @@ -0,0 +1,31 @@ +package client + +import ( + "context" + "encoding/json" + + "github.com/moby/moby/api/types/swarm" +) + +// SwarmInspectOptions holds options for inspecting a swarm. +type SwarmInspectOptions struct { + // Add future optional parameters here +} + +// SwarmInspectResult represents the result of a SwarmInspect operation. +type SwarmInspectResult struct { + Swarm swarm.Swarm +} + +// SwarmInspect inspects the swarm. +func (cli *Client) SwarmInspect(ctx context.Context, options SwarmInspectOptions) (SwarmInspectResult, error) { + resp, err := cli.get(ctx, "/swarm", nil, nil) + defer ensureReaderClosed(resp) + if err != nil { + return SwarmInspectResult{}, err + } + + var s swarm.Swarm + err = json.NewDecoder(resp.Body).Decode(&s) + return SwarmInspectResult{Swarm: s}, err +} diff --git a/vendor/github.com/moby/moby/client/swarm_join.go b/vendor/github.com/moby/moby/client/swarm_join.go new file mode 100644 index 00000000..66a75448 --- /dev/null +++ b/vendor/github.com/moby/moby/client/swarm_join.go @@ -0,0 +1,38 @@ +package client + +import ( + "context" + + "github.com/moby/moby/api/types/swarm" +) + +// SwarmJoinOptions specifies options for joining a swarm. +type SwarmJoinOptions struct { + ListenAddr string + AdvertiseAddr string + DataPathAddr string + RemoteAddrs []string + JoinToken string // accept by secret + Availability swarm.NodeAvailability +} + +// SwarmJoinResult contains the result of joining a swarm. +type SwarmJoinResult struct { + // No fields currently; placeholder for future use +} + +// SwarmJoin joins the swarm. +func (cli *Client) SwarmJoin(ctx context.Context, options SwarmJoinOptions) (SwarmJoinResult, error) { + req := swarm.JoinRequest{ + ListenAddr: options.ListenAddr, + AdvertiseAddr: options.AdvertiseAddr, + DataPathAddr: options.DataPathAddr, + RemoteAddrs: options.RemoteAddrs, + JoinToken: options.JoinToken, + Availability: options.Availability, + } + + resp, err := cli.post(ctx, "/swarm/join", nil, req, nil) + defer ensureReaderClosed(resp) + return SwarmJoinResult{}, err +} diff --git a/vendor/github.com/moby/moby/client/swarm_leave.go b/vendor/github.com/moby/moby/client/swarm_leave.go new file mode 100644 index 00000000..a65a13de --- /dev/null +++ b/vendor/github.com/moby/moby/client/swarm_leave.go @@ -0,0 +1,25 @@ +package client + +import ( + "context" + "net/url" +) + +// SwarmLeaveOptions contains options for leaving a swarm. +type SwarmLeaveOptions struct { + Force bool +} + +// SwarmLeaveResult represents the result of a SwarmLeave operation. +type SwarmLeaveResult struct{} + +// SwarmLeave leaves the swarm. +func (cli *Client) SwarmLeave(ctx context.Context, options SwarmLeaveOptions) (SwarmLeaveResult, error) { + query := url.Values{} + if options.Force { + query.Set("force", "1") + } + resp, err := cli.post(ctx, "/swarm/leave", query, nil, nil) + defer ensureReaderClosed(resp) + return SwarmLeaveResult{}, err +} diff --git a/vendor/github.com/moby/moby/client/swarm_unlock.go b/vendor/github.com/moby/moby/client/swarm_unlock.go new file mode 100644 index 00000000..92335afb --- /dev/null +++ b/vendor/github.com/moby/moby/client/swarm_unlock.go @@ -0,0 +1,25 @@ +package client + +import ( + "context" + + "github.com/moby/moby/api/types/swarm" +) + +// SwarmUnlockOptions specifies options for unlocking a swarm. +type SwarmUnlockOptions struct { + Key string +} + +// SwarmUnlockResult represents the result of unlocking a swarm. +type SwarmUnlockResult struct{} + +// SwarmUnlock unlocks locked swarm. +func (cli *Client) SwarmUnlock(ctx context.Context, options SwarmUnlockOptions) (SwarmUnlockResult, error) { + req := &swarm.UnlockRequest{ + UnlockKey: options.Key, + } + resp, err := cli.post(ctx, "/swarm/unlock", nil, req, nil) + defer ensureReaderClosed(resp) + return SwarmUnlockResult{}, err +} diff --git a/vendor/github.com/moby/moby/client/swarm_update.go b/vendor/github.com/moby/moby/client/swarm_update.go new file mode 100644 index 00000000..81f62b2c --- /dev/null +++ b/vendor/github.com/moby/moby/client/swarm_update.go @@ -0,0 +1,33 @@ +package client + +import ( + "context" + "net/url" + "strconv" + + "github.com/moby/moby/api/types/swarm" +) + +// SwarmUpdateOptions contains options for updating a swarm. +type SwarmUpdateOptions struct { + Version swarm.Version + Spec swarm.Spec + RotateWorkerToken bool + RotateManagerToken bool + RotateManagerUnlockKey bool +} + +// SwarmUpdateResult represents the result of a SwarmUpdate operation. +type SwarmUpdateResult struct{} + +// SwarmUpdate updates the swarm. +func (cli *Client) SwarmUpdate(ctx context.Context, options SwarmUpdateOptions) (SwarmUpdateResult, error) { + query := url.Values{} + query.Set("version", options.Version.String()) + query.Set("rotateWorkerToken", strconv.FormatBool(options.RotateWorkerToken)) + query.Set("rotateManagerToken", strconv.FormatBool(options.RotateManagerToken)) + query.Set("rotateManagerUnlockKey", strconv.FormatBool(options.RotateManagerUnlockKey)) + resp, err := cli.post(ctx, "/swarm/update", query, options.Spec, nil) + defer ensureReaderClosed(resp) + return SwarmUpdateResult{}, err +} diff --git a/vendor/github.com/moby/moby/client/system_disk_usage.go b/vendor/github.com/moby/moby/client/system_disk_usage.go new file mode 100644 index 00000000..c5df1e1b --- /dev/null +++ b/vendor/github.com/moby/moby/client/system_disk_usage.go @@ -0,0 +1,327 @@ +package client + +import ( + "context" + "encoding/json" + "fmt" + "net/url" + "slices" + + "github.com/moby/moby/api/types/build" + "github.com/moby/moby/api/types/container" + "github.com/moby/moby/api/types/image" + "github.com/moby/moby/api/types/system" + "github.com/moby/moby/api/types/volume" + "github.com/moby/moby/client/pkg/versions" +) + +// DiskUsageOptions holds parameters for [Client.DiskUsage] operations. +type DiskUsageOptions struct { + // Containers controls whether container disk usage should be computed. + Containers bool + + // Images controls whether image disk usage should be computed. + Images bool + + // BuildCache controls whether build cache disk usage should be computed. + BuildCache bool + + // Volumes controls whether volume disk usage should be computed. + Volumes bool + + // Verbose enables more detailed disk usage information. + Verbose bool +} + +// DiskUsageResult is the result of [Client.DiskUsage] operations. +type DiskUsageResult struct { + // Containers holds container disk usage information. + Containers ContainersDiskUsage + + // Images holds image disk usage information. + Images ImagesDiskUsage + + // BuildCache holds build cache disk usage information. + BuildCache BuildCacheDiskUsage + + // Volumes holds volume disk usage information. + Volumes VolumesDiskUsage +} + +// ContainersDiskUsage contains disk usage information for containers. +type ContainersDiskUsage struct { + // ActiveCount is the number of active containers. + ActiveCount int64 + + // TotalCount is the total number of containers. + TotalCount int64 + + // Reclaimable is the amount of disk space that can be reclaimed. + Reclaimable int64 + + // TotalSize is the total disk space used by all containers. + TotalSize int64 + + // Items holds detailed information about each container. + Items []container.Summary +} + +// ImagesDiskUsage contains disk usage information for images. +type ImagesDiskUsage struct { + // ActiveCount is the number of active images. + ActiveCount int64 + + // TotalCount is the total number of images. + TotalCount int64 + + // Reclaimable is the amount of disk space that can be reclaimed. + Reclaimable int64 + + // TotalSize is the total disk space used by all images. + TotalSize int64 + + // Items holds detailed information about each image. + Items []image.Summary +} + +// VolumesDiskUsage contains disk usage information for volumes. +type VolumesDiskUsage struct { + // ActiveCount is the number of active volumes. + ActiveCount int64 + + // TotalCount is the total number of volumes. + TotalCount int64 + + // Reclaimable is the amount of disk space that can be reclaimed. + Reclaimable int64 + + // TotalSize is the total disk space used by all volumes. + TotalSize int64 + + // Items holds detailed information about each volume. + Items []volume.Volume +} + +// BuildCacheDiskUsage contains disk usage information for build cache. +type BuildCacheDiskUsage struct { + // ActiveCount is the number of active build cache records. + ActiveCount int64 + + // TotalCount is the total number of build cache records. + TotalCount int64 + + // Reclaimable is the amount of disk space that can be reclaimed. + Reclaimable int64 + + // TotalSize is the total disk space used by all build cache records. + TotalSize int64 + + // Items holds detailed information about each build cache record. + Items []build.CacheRecord +} + +// DiskUsage requests the current data usage from the daemon. +func (cli *Client) DiskUsage(ctx context.Context, options DiskUsageOptions) (DiskUsageResult, error) { + query := url.Values{} + + for _, t := range []struct { + flag bool + sysObj system.DiskUsageObject + }{ + {options.Containers, system.ContainerObject}, + {options.Images, system.ImageObject}, + {options.Volumes, system.VolumeObject}, + {options.BuildCache, system.BuildCacheObject}, + } { + if t.flag { + query.Add("type", string(t.sysObj)) + } + } + + if options.Verbose { + query.Set("verbose", "1") + } + + resp, err := cli.get(ctx, "/system/df", query, nil) + defer ensureReaderClosed(resp) + if err != nil { + return DiskUsageResult{}, err + } + + if versions.LessThan(cli.version, "1.52") { + // Generate result from a legacy response. + var du legacyDiskUsage + if err := json.NewDecoder(resp.Body).Decode(&du); err != nil { + return DiskUsageResult{}, fmt.Errorf("retrieving disk usage: %v", err) + } + + return diskUsageResultFromLegacyAPI(&du), nil + } + + var du system.DiskUsage + if err := json.NewDecoder(resp.Body).Decode(&du); err != nil { + return DiskUsageResult{}, fmt.Errorf("retrieving disk usage: %v", err) + } + + var r DiskUsageResult + if idu := du.ImageUsage; idu != nil { + r.Images = ImagesDiskUsage{ + ActiveCount: idu.ActiveCount, + Reclaimable: idu.Reclaimable, + TotalCount: idu.TotalCount, + TotalSize: idu.TotalSize, + } + + if options.Verbose { + r.Images.Items = slices.Clone(idu.Items) + } + } + + if cdu := du.ContainerUsage; cdu != nil { + r.Containers = ContainersDiskUsage{ + ActiveCount: cdu.ActiveCount, + Reclaimable: cdu.Reclaimable, + TotalCount: cdu.TotalCount, + TotalSize: cdu.TotalSize, + } + + if options.Verbose { + r.Containers.Items = slices.Clone(cdu.Items) + } + } + + if bdu := du.BuildCacheUsage; bdu != nil { + r.BuildCache = BuildCacheDiskUsage{ + ActiveCount: bdu.ActiveCount, + Reclaimable: bdu.Reclaimable, + TotalCount: bdu.TotalCount, + TotalSize: bdu.TotalSize, + } + + if options.Verbose { + r.BuildCache.Items = slices.Clone(bdu.Items) + } + } + + if vdu := du.VolumeUsage; vdu != nil { + r.Volumes = VolumesDiskUsage{ + ActiveCount: vdu.ActiveCount, + Reclaimable: vdu.Reclaimable, + TotalCount: vdu.TotalCount, + TotalSize: vdu.TotalSize, + } + + if options.Verbose { + r.Volumes.Items = slices.Clone(vdu.Items) + } + } + + return r, nil +} + +// legacyDiskUsage is the response as was used by API < v1.52. +type legacyDiskUsage struct { + LayersSize int64 `json:"LayersSize,omitempty"` + Images []image.Summary `json:"Images,omitzero"` + Containers []container.Summary `json:"Containers,omitzero"` + Volumes []volume.Volume `json:"Volumes,omitzero"` + BuildCache []build.CacheRecord `json:"BuildCache,omitzero"` +} + +func diskUsageResultFromLegacyAPI(du *legacyDiskUsage) DiskUsageResult { + return DiskUsageResult{ + Images: imageDiskUsageFromLegacyAPI(du), + Containers: containerDiskUsageFromLegacyAPI(du), + BuildCache: buildCacheDiskUsageFromLegacyAPI(du), + Volumes: volumeDiskUsageFromLegacyAPI(du), + } +} + +func imageDiskUsageFromLegacyAPI(du *legacyDiskUsage) ImagesDiskUsage { + idu := ImagesDiskUsage{ + TotalSize: du.LayersSize, + TotalCount: int64(len(du.Images)), + Items: du.Images, + } + + for _, i := range idu.Items { + if i.Containers > 0 { + idu.ActiveCount++ + } else if i.Size != -1 && i.SharedSize != -1 { + // Only count reclaimable size if we have size information + idu.Reclaimable += (i.Size - i.SharedSize) + } + } + + return idu +} + +func containerDiskUsageFromLegacyAPI(du *legacyDiskUsage) ContainersDiskUsage { + cdu := ContainersDiskUsage{ + TotalCount: int64(len(du.Containers)), + Items: du.Containers, + } + + var used int64 + for _, c := range cdu.Items { + cdu.TotalSize += c.SizeRw + switch c.State { + case container.StateRunning, container.StatePaused, container.StateRestarting: + cdu.ActiveCount++ + used += c.SizeRw + case container.StateCreated, container.StateRemoving, container.StateExited, container.StateDead: + // not active + } + } + + cdu.Reclaimable = cdu.TotalSize - used + return cdu +} + +func buildCacheDiskUsageFromLegacyAPI(du *legacyDiskUsage) BuildCacheDiskUsage { + bdu := BuildCacheDiskUsage{ + TotalCount: int64(len(du.BuildCache)), + Items: du.BuildCache, + } + + var used int64 + for _, b := range du.BuildCache { + if !b.Shared { + bdu.TotalSize += b.Size + } + + if b.InUse { + bdu.ActiveCount++ + if !b.Shared { + used += b.Size + } + } + } + + bdu.Reclaimable = bdu.TotalSize - used + return bdu +} + +func volumeDiskUsageFromLegacyAPI(du *legacyDiskUsage) VolumesDiskUsage { + vdu := VolumesDiskUsage{ + TotalCount: int64(len(du.Volumes)), + Items: du.Volumes, + } + + var used int64 + for _, v := range vdu.Items { + // Ignore volumes with no usage data + if v.UsageData != nil { + if v.UsageData.RefCount > 0 { + vdu.ActiveCount++ + used += v.UsageData.Size + } + if v.UsageData.Size > 0 { + vdu.TotalSize += v.UsageData.Size + } + } + } + + vdu.Reclaimable = vdu.TotalSize - used + return vdu +} diff --git a/vendor/github.com/moby/moby/client/system_events.go b/vendor/github.com/moby/moby/client/system_events.go new file mode 100644 index 00000000..b0ca71a1 --- /dev/null +++ b/vendor/github.com/moby/moby/client/system_events.go @@ -0,0 +1,115 @@ +package client + +import ( + "context" + "net/http" + "net/url" + "time" + + "github.com/moby/moby/api/types" + "github.com/moby/moby/api/types/events" + "github.com/moby/moby/client/internal" + "github.com/moby/moby/client/internal/timestamp" +) + +// EventsListOptions holds parameters to filter events with. +type EventsListOptions struct { + Since string + Until string + Filters Filters +} + +// EventsResult holds the result of an Events query. +type EventsResult struct { + Messages <-chan events.Message + Err <-chan error +} + +// Events returns a stream of events in the daemon. It's up to the caller to close the stream +// by cancelling the context. Once the stream has been completely read an [io.EOF] error is +// sent over the error channel. If an error is sent, all processing is stopped. It's up +// to the caller to reopen the stream in the event of an error by reinvoking this method. +func (cli *Client) Events(ctx context.Context, options EventsListOptions) EventsResult { + messages := make(chan events.Message) + errs := make(chan error, 1) + + started := make(chan struct{}) + go func() { + defer close(errs) + + query, err := buildEventsQueryParams(options) + if err != nil { + close(started) + errs <- err + return + } + + headers := http.Header{} + headers.Add("Accept", types.MediaTypeJSONLines) // Implicit q=1.0; in case server doesn't parse correctly. + headers.Add("Accept", types.MediaTypeNDJSON+";q=0.9") + headers.Add("Accept", types.MediaTypeJSONSequence+";q=0.5") + resp, err := cli.get(ctx, "/events", query, headers) + if err != nil { + close(started) + errs <- err + return + } + defer resp.Body.Close() + + contentType := resp.Header.Get("Content-Type") + decoder := internal.NewJSONStreamDecoder(resp.Body, contentType) + + close(started) + for { + select { + case <-ctx.Done(): + errs <- ctx.Err() + return + default: + var event events.Message + if err := decoder(&event); err != nil { + errs <- err + return + } + + select { + case messages <- event: + case <-ctx.Done(): + errs <- ctx.Err() + return + } + } + } + }() + <-started + + return EventsResult{ + Messages: messages, + Err: errs, + } +} + +func buildEventsQueryParams(options EventsListOptions) (url.Values, error) { + query := url.Values{} + ref := time.Now() + + if options.Since != "" { + ts, err := timestamp.GetTimestamp(options.Since, ref) + if err != nil { + return nil, err + } + query.Set("since", ts) + } + + if options.Until != "" { + ts, err := timestamp.GetTimestamp(options.Until, ref) + if err != nil { + return nil, err + } + query.Set("until", ts) + } + + options.Filters.updateURLValues(query) + + return query, nil +} diff --git a/vendor/github.com/moby/moby/client/system_info.go b/vendor/github.com/moby/moby/client/system_info.go new file mode 100644 index 00000000..b4241742 --- /dev/null +++ b/vendor/github.com/moby/moby/client/system_info.go @@ -0,0 +1,36 @@ +package client + +import ( + "context" + "encoding/json" + "fmt" + "net/url" + + "github.com/moby/moby/api/types/system" +) + +// InfoOptions holds options for [Client.Info]. +type InfoOptions struct { + // No options currently; placeholder for future use +} + +// SystemInfoResult holds the result of [Client.Info]. +type SystemInfoResult struct { + Info system.Info +} + +// Info returns information about the docker server. +func (cli *Client) Info(ctx context.Context, options InfoOptions) (SystemInfoResult, error) { + resp, err := cli.get(ctx, "/info", url.Values{}, nil) + defer ensureReaderClosed(resp) + if err != nil { + return SystemInfoResult{}, err + } + + var info system.Info + if err := json.NewDecoder(resp.Body).Decode(&info); err != nil { + return SystemInfoResult{}, fmt.Errorf("Error reading remote info: %v", err) + } + + return SystemInfoResult{Info: info}, nil +} diff --git a/vendor/github.com/moby/moby/client/task_inspect.go b/vendor/github.com/moby/moby/client/task_inspect.go new file mode 100644 index 00000000..96edcb09 --- /dev/null +++ b/vendor/github.com/moby/moby/client/task_inspect.go @@ -0,0 +1,36 @@ +package client + +import ( + "context" + "encoding/json" + + "github.com/moby/moby/api/types/swarm" +) + +// TaskInspectOptions contains options for inspecting a task. +type TaskInspectOptions struct { + // Currently no options are defined. +} + +// TaskInspectResult contains the result of a task inspection. +type TaskInspectResult struct { + Task swarm.Task + Raw json.RawMessage +} + +// TaskInspect returns the task information and its raw representation. +func (cli *Client) TaskInspect(ctx context.Context, taskID string, options TaskInspectOptions) (TaskInspectResult, error) { + taskID, err := trimID("task", taskID) + if err != nil { + return TaskInspectResult{}, err + } + + resp, err := cli.get(ctx, "/tasks/"+taskID, nil, nil) + if err != nil { + return TaskInspectResult{}, err + } + + var out TaskInspectResult + out.Raw, err = decodeWithRaw(resp, &out.Task) + return out, err +} diff --git a/vendor/github.com/moby/moby/client/task_list.go b/vendor/github.com/moby/moby/client/task_list.go new file mode 100644 index 00000000..5f7c41bb --- /dev/null +++ b/vendor/github.com/moby/moby/client/task_list.go @@ -0,0 +1,36 @@ +package client + +import ( + "context" + "encoding/json" + "net/url" + + "github.com/moby/moby/api/types/swarm" +) + +// TaskListOptions holds parameters to list tasks with. +type TaskListOptions struct { + Filters Filters +} + +// TaskListResult contains the result of a task list operation. +type TaskListResult struct { + Items []swarm.Task +} + +// TaskList returns the list of tasks. +func (cli *Client) TaskList(ctx context.Context, options TaskListOptions) (TaskListResult, error) { + query := url.Values{} + + options.Filters.updateURLValues(query) + + resp, err := cli.get(ctx, "/tasks", query, nil) + defer ensureReaderClosed(resp) + if err != nil { + return TaskListResult{}, err + } + + var tasks []swarm.Task + err = json.NewDecoder(resp.Body).Decode(&tasks) + return TaskListResult{Items: tasks}, err +} diff --git a/vendor/github.com/moby/moby/client/task_logs.go b/vendor/github.com/moby/moby/client/task_logs.go new file mode 100644 index 00000000..0174ad46 --- /dev/null +++ b/vendor/github.com/moby/moby/client/task_logs.go @@ -0,0 +1,84 @@ +package client + +import ( + "context" + "io" + "net/url" + "time" + + "github.com/moby/moby/client/internal/timestamp" +) + +// TaskLogsOptions holds parameters to filter logs with. +type TaskLogsOptions struct { + ShowStdout bool + ShowStderr bool + Since string + Until string + Timestamps bool + Follow bool + Tail string + Details bool +} + +// TaskLogsResult holds the result of a task logs operation. +// It implements [io.ReadCloser]. +type TaskLogsResult interface { + io.ReadCloser +} + +// TaskLogs returns the logs generated by a service in a [TaskLogsResult]. +// as an [io.ReadCloser]. Callers should close the stream. +// +// The underlying [io.ReadCloser] is automatically closed if the context is canceled, +func (cli *Client) TaskLogs(ctx context.Context, taskID string, options TaskLogsOptions) (TaskLogsResult, error) { + // TODO(thaJeztah): this function needs documentation about the format of the stream (similar to for container logs) + // TODO(thaJeztah): migrate CLI utilities to the client where suitable; https://github.com/docker/cli/blob/v29.0.0-rc.1/cli/command/service/logs.go#L73-L348 + + query := url.Values{} + if options.ShowStdout { + query.Set("stdout", "1") + } + + if options.ShowStderr { + query.Set("stderr", "1") + } + + if options.Since != "" { + ts, err := timestamp.GetTimestamp(options.Since, time.Now()) + if err != nil { + return nil, err + } + query.Set("since", ts) + } + + if options.Timestamps { + query.Set("timestamps", "1") + } + + if options.Details { + query.Set("details", "1") + } + + if options.Follow { + query.Set("follow", "1") + } + query.Set("tail", options.Tail) + + resp, err := cli.get(ctx, "/tasks/"+taskID+"/logs", query, nil) + if err != nil { + return nil, err + } + return &taskLogsResult{ + ReadCloser: newCancelReadCloser(ctx, resp.Body), + }, nil +} + +type taskLogsResult struct { + io.ReadCloser +} + +var ( + _ io.ReadCloser = (*taskLogsResult)(nil) + _ ContainerLogsResult = (*taskLogsResult)(nil) +) diff --git a/vendor/github.com/moby/moby/client/utils.go b/vendor/github.com/moby/moby/client/utils.go new file mode 100644 index 00000000..1c0d09df --- /dev/null +++ b/vendor/github.com/moby/moby/client/utils.go @@ -0,0 +1,154 @@ +package client + +import ( + "bytes" + "context" + "encoding/json" + "errors" + "fmt" + "io" + "net/http" + "strconv" + "strings" + "sync" + + cerrdefs "github.com/containerd/errdefs" + ocispec "github.com/opencontainers/image-spec/specs-go/v1" +) + +type emptyIDError string + +func (e emptyIDError) InvalidParameter() {} + +func (e emptyIDError) Error() string { + return "invalid " + string(e) + " name or ID: value is empty" +} + +// trimID trims the given object-ID / name, returning an error if it's empty. +func trimID(objType, id string) (string, error) { + id = strings.TrimSpace(id) + if id == "" { + return "", emptyIDError(objType) + } + return id, nil +} + +// parseAPIVersion checks v to be a well-formed (".") +// API version. It returns an error if the value is empty or does not +// have the correct format, but does not validate if the API version is +// within the supported range ([MinAPIVersion] <= v <= [MaxAPIVersion]). +// +// It returns version after normalizing, or an error if validation failed. +func parseAPIVersion(version string) (string, error) { + if strings.TrimPrefix(strings.TrimSpace(version), "v") == "" { + return "", cerrdefs.ErrInvalidArgument.WithMessage("value is empty") + } + major, minor, err := parseMajorMinor(version) + if err != nil { + return "", err + } + return fmt.Sprintf("%d.%d", major, minor), nil +} + +// parseMajorMinor is a helper for parseAPIVersion. +func parseMajorMinor(v string) (major, minor int, _ error) { + if strings.HasPrefix(v, "v") { + return 0, 0, cerrdefs.ErrInvalidArgument.WithMessage("must be formatted .") + } + if strings.TrimSpace(v) == "" { + return 0, 0, cerrdefs.ErrInvalidArgument.WithMessage("value is empty") + } + + majVer, minVer, ok := strings.Cut(v, ".") + if !ok { + return 0, 0, cerrdefs.ErrInvalidArgument.WithMessage("must be formatted .") + } + major, err := strconv.Atoi(majVer) + if err != nil { + return 0, 0, cerrdefs.ErrInvalidArgument.WithMessage("invalid major version: must be formatted .") + } + minor, err = strconv.Atoi(minVer) + if err != nil { + return 0, 0, cerrdefs.ErrInvalidArgument.WithMessage("invalid minor version: must be formatted .") + } + return major, minor, nil +} + +// encodePlatforms marshals the given platform(s) to JSON format, to +// be used for query-parameters for filtering / selecting platforms. +func encodePlatforms(platform ...ocispec.Platform) ([]string, error) { + if len(platform) == 0 { + return []string{}, nil + } + if len(platform) == 1 { + p, err := encodePlatform(&platform[0]) + if err != nil { + return nil, err + } + return []string{p}, nil + } + + seen := make(map[string]struct{}, len(platform)) + out := make([]string, 0, len(platform)) + for i := range platform { + p, err := encodePlatform(&platform[i]) + if err != nil { + return nil, err + } + if _, ok := seen[p]; !ok { + out = append(out, p) + seen[p] = struct{}{} + } + } + return out, nil +} + +// encodePlatform marshals the given platform to JSON format, to +// be used for query-parameters for filtering / selecting platforms. It +// is used as a helper for encodePlatforms, +func encodePlatform(platform *ocispec.Platform) (string, error) { + p, err := json.Marshal(platform) + if err != nil { + return "", fmt.Errorf("%w: invalid platform: %v", cerrdefs.ErrInvalidArgument, err) + } + return string(p), nil +} + +func decodeWithRaw[T any](resp *http.Response, out *T) (raw json.RawMessage, _ error) { + if resp == nil || resp.Body == nil { + return nil, errors.New("empty response") + } + defer ensureReaderClosed(resp) + + var buf bytes.Buffer + tr := io.TeeReader(resp.Body, &buf) + err := json.NewDecoder(tr).Decode(out) + if err != nil { + return nil, err + } + return buf.Bytes(), nil +} + +// newCancelReadCloser wraps rc so it's automatically closed when ctx is canceled. +// Close is idempotent and returns the first error from rc.Close. +func newCancelReadCloser(ctx context.Context, rc io.ReadCloser) io.ReadCloser { + crc := &cancelReadCloser{ + rc: rc, + close: sync.OnceValue(rc.Close), + } + crc.stop = context.AfterFunc(ctx, func() { _ = crc.close() }) + return crc +} + +type cancelReadCloser struct { + rc io.ReadCloser + close func() error + stop func() bool +} + +func (c *cancelReadCloser) Read(p []byte) (int, error) { return c.rc.Read(p) } + +func (c *cancelReadCloser) Close() error { + c.stop() // unregister AfterFunc + return c.close() +} diff --git a/vendor/github.com/moby/moby/client/version.go b/vendor/github.com/moby/moby/client/version.go new file mode 100644 index 00000000..7fa5a3fa --- /dev/null +++ b/vendor/github.com/moby/moby/client/version.go @@ -0,0 +1,81 @@ +package client + +import ( + "context" + "encoding/json" + + "github.com/moby/moby/api/types/system" +) + +// ServerVersionOptions specifies options for the server version request. +type ServerVersionOptions struct { + // Currently no options are supported. +} + +// ServerVersionResult contains information about the Docker server host. +type ServerVersionResult struct { + // Platform is the platform (product name) the server is running on. + Platform PlatformInfo + + // Version is the version of the daemon. + Version string + + // APIVersion is the highest API version supported by the server. + APIVersion string + + // MinAPIVersion is the minimum API version the server supports. + MinAPIVersion string + + // Os is the operating system the server runs on. + Os string + + // Arch is the hardware architecture the server runs on. + Arch string + + // Experimental indicates that the daemon runs with experimental + // features enabled. + // + // Deprecated: this field will be removed in the next version. + Experimental bool + + // Components contains version information for the components making + // up the server. Information in this field is for informational + // purposes, and not part of the API contract. + Components []system.ComponentVersion +} + +// PlatformInfo holds information about the platform (product name) the +// server is running on. +type PlatformInfo struct { + // Name is the name of the platform (for example, "Docker Engine - Community", + // or "Docker Desktop 4.49.0 (208003)") + Name string +} + +// ServerVersion returns information of the Docker server host. +func (cli *Client) ServerVersion(ctx context.Context, _ ServerVersionOptions) (ServerVersionResult, error) { + resp, err := cli.get(ctx, "/version", nil, nil) + defer ensureReaderClosed(resp) + if err != nil { + return ServerVersionResult{}, err + } + + var v system.VersionResponse + err = json.NewDecoder(resp.Body).Decode(&v) + if err != nil { + return ServerVersionResult{}, err + } + + return ServerVersionResult{ + Platform: PlatformInfo{ + Name: v.Platform.Name, + }, + Version: v.Version, + APIVersion: v.APIVersion, + MinAPIVersion: v.MinAPIVersion, + Os: v.Os, + Arch: v.Arch, + Experimental: v.Experimental, //nolint:staticcheck // ignore deprecated field. + Components: v.Components, + }, nil +} diff --git a/vendor/github.com/moby/moby/client/volume_create.go b/vendor/github.com/moby/moby/client/volume_create.go new file mode 100644 index 00000000..674e0633 --- /dev/null +++ b/vendor/github.com/moby/moby/client/volume_create.go @@ -0,0 +1,42 @@ +package client + +import ( + "context" + "encoding/json" + + "github.com/moby/moby/api/types/volume" +) + +// VolumeCreateOptions specifies the options to create a volume. +type VolumeCreateOptions struct { + Name string + Driver string + DriverOpts map[string]string + Labels map[string]string + ClusterVolumeSpec *volume.ClusterVolumeSpec +} + +// VolumeCreateResult is the result of a volume creation. +type VolumeCreateResult struct { + Volume volume.Volume +} + +// VolumeCreate creates a volume in the docker host. +func (cli *Client) VolumeCreate(ctx context.Context, options VolumeCreateOptions) (VolumeCreateResult, error) { + createRequest := volume.CreateRequest{ + Name: options.Name, + Driver: options.Driver, + DriverOpts: options.DriverOpts, + Labels: options.Labels, + ClusterVolumeSpec: options.ClusterVolumeSpec, + } + resp, err := cli.post(ctx, "/volumes/create", nil, createRequest, nil) + defer ensureReaderClosed(resp) + if err != nil { + return VolumeCreateResult{}, err + } + + var v volume.Volume + err = json.NewDecoder(resp.Body).Decode(&v) + return VolumeCreateResult{Volume: v}, err +} diff --git a/vendor/github.com/moby/moby/client/volume_inspect.go b/vendor/github.com/moby/moby/client/volume_inspect.go new file mode 100644 index 00000000..cf00236a --- /dev/null +++ b/vendor/github.com/moby/moby/client/volume_inspect.go @@ -0,0 +1,36 @@ +package client + +import ( + "context" + "encoding/json" + + "github.com/moby/moby/api/types/volume" +) + +// VolumeInspectOptions holds options for inspecting a volume. +type VolumeInspectOptions struct { + // Add future optional parameters here +} + +// VolumeInspectResult holds the result from the [Client.VolumeInspect] method. +type VolumeInspectResult struct { + Volume volume.Volume + Raw json.RawMessage +} + +// VolumeInspect returns the information about a specific volume in the docker host. +func (cli *Client) VolumeInspect(ctx context.Context, volumeID string, options VolumeInspectOptions) (VolumeInspectResult, error) { + volumeID, err := trimID("volume", volumeID) + if err != nil { + return VolumeInspectResult{}, err + } + + resp, err := cli.get(ctx, "/volumes/"+volumeID, nil, nil) + if err != nil { + return VolumeInspectResult{}, err + } + + var out VolumeInspectResult + out.Raw, err = decodeWithRaw(resp, &out.Volume) + return out, err +} diff --git a/vendor/github.com/moby/moby/client/volume_list.go b/vendor/github.com/moby/moby/client/volume_list.go new file mode 100644 index 00000000..989a0292 --- /dev/null +++ b/vendor/github.com/moby/moby/client/volume_list.go @@ -0,0 +1,46 @@ +package client + +import ( + "context" + "encoding/json" + "net/url" + + "github.com/moby/moby/api/types/volume" +) + +// VolumeListOptions holds parameters to list volumes. +type VolumeListOptions struct { + Filters Filters +} + +// VolumeListResult holds the result from the [Client.VolumeList] method. +type VolumeListResult struct { + // List of volumes. + Items []volume.Volume + + // Warnings that occurred when fetching the list of volumes. + Warnings []string +} + +// VolumeList returns the volumes configured in the docker host. +func (cli *Client) VolumeList(ctx context.Context, options VolumeListOptions) (VolumeListResult, error) { + query := url.Values{} + + options.Filters.updateURLValues(query) + resp, err := cli.get(ctx, "/volumes", query, nil) + defer ensureReaderClosed(resp) + if err != nil { + return VolumeListResult{}, err + } + + var apiResp volume.ListResponse + err = json.NewDecoder(resp.Body).Decode(&apiResp) + if err != nil { + return VolumeListResult{}, err + } + + return VolumeListResult{ + Items: apiResp.Volumes, + Warnings: apiResp.Warnings, + }, nil +} diff --git a/vendor/github.com/moby/moby/client/volume_prune.go b/vendor/github.com/moby/moby/client/volume_prune.go new file mode 100644 index 00000000..eec0f482 --- /dev/null +++ b/vendor/github.com/moby/moby/client/volume_prune.go @@ -0,0 +1,55 @@ +package client + +import ( + "context" + "encoding/json" + "fmt" + "net/url" + + cerrdefs "github.com/containerd/errdefs" + "github.com/moby/moby/api/types/volume" +) + +// VolumePruneOptions holds parameters to prune volumes. +type VolumePruneOptions struct { + // All controls whether named volumes should also be pruned. By + // default, only anonymous volumes are pruned. + All bool + + // Filters to apply when pruning. + Filters Filters +} + +// VolumePruneResult holds the result from the [Client.VolumePrune] method. +type VolumePruneResult struct { + Report volume.PruneReport +} + +// VolumePrune requests the daemon to delete unused data +func (cli *Client) VolumePrune(ctx context.Context, options VolumePruneOptions) (VolumePruneResult, error) { + if options.All { + if _, ok := options.Filters["all"]; ok { + return VolumePruneResult{}, cerrdefs.ErrInvalidArgument.WithMessage(`conflicting options: cannot specify both "all" and "all" filter`) + } + if options.Filters == nil { + options.Filters = Filters{} + } + options.Filters.Add("all", "true") + } + + query := url.Values{} + options.Filters.updateURLValues(query) + + resp, err := cli.post(ctx, "/volumes/prune", query, nil, nil) + defer ensureReaderClosed(resp) + if err != nil { + return VolumePruneResult{}, err + } + + var report volume.PruneReport + if err := json.NewDecoder(resp.Body).Decode(&report); err != nil { + return VolumePruneResult{}, fmt.Errorf("error retrieving volume prune report: %v", err) + } + + return VolumePruneResult{Report: report}, nil +} diff --git a/vendor/github.com/moby/moby/client/volume_remove.go b/vendor/github.com/moby/moby/client/volume_remove.go new file mode 100644 index 00000000..0449e08d --- /dev/null +++ b/vendor/github.com/moby/moby/client/volume_remove.go @@ -0,0 +1,36 @@ +package client + +import ( + "context" + "net/url" +) + +// VolumeRemoveOptions holds options for [Client.VolumeRemove]. +type VolumeRemoveOptions struct { + // Force the removal of the volume + Force bool +} + +// VolumeRemoveResult holds the result of [Client.VolumeRemove], +type VolumeRemoveResult struct { + // Add future fields here. +} + +// VolumeRemove removes a volume from the docker host. +func (cli *Client) VolumeRemove(ctx context.Context, volumeID string, options VolumeRemoveOptions) (VolumeRemoveResult, error) { + volumeID, err := trimID("volume", volumeID) + if err != nil { + return VolumeRemoveResult{}, err + } + + query := url.Values{} + if options.Force { + query.Set("force", "1") + } + resp, err := cli.delete(ctx, "/volumes/"+volumeID, query, nil) + defer ensureReaderClosed(resp) + if err != nil { + return VolumeRemoveResult{}, err + } + return VolumeRemoveResult{}, nil +} diff --git a/vendor/github.com/moby/moby/client/volume_update.go b/vendor/github.com/moby/moby/client/volume_update.go new file mode 100644 index 00000000..5aa2a0aa --- /dev/null +++ b/vendor/github.com/moby/moby/client/volume_update.go @@ -0,0 +1,40 @@ +package client + +import ( + "context" + "net/url" + + "github.com/moby/moby/api/types/swarm" + "github.com/moby/moby/api/types/volume" +) + +// VolumeUpdateOptions holds options for [Client.VolumeUpdate]. +type VolumeUpdateOptions struct { + Version swarm.Version + // Spec is the ClusterVolumeSpec to update the volume to. + Spec *volume.ClusterVolumeSpec `json:"Spec,omitempty"` +} + +// VolumeUpdateResult holds the result of [Client.VolumeUpdate], +type VolumeUpdateResult struct { + // Add future fields here. +} + +// VolumeUpdate updates a volume. This only works for Cluster Volumes, and +// only some fields can be updated. +func (cli *Client) VolumeUpdate(ctx context.Context, volumeID string, options VolumeUpdateOptions) (VolumeUpdateResult, error) { + volumeID, err := trimID("volume", volumeID) + if err != nil { + return VolumeUpdateResult{}, err + } + + query := url.Values{} + query.Set("version", options.Version.String()) + + resp, err := cli.put(ctx, "/volumes/"+volumeID, query, options, nil) + defer ensureReaderClosed(resp) + if err != nil { + return VolumeUpdateResult{}, err + } + return VolumeUpdateResult{}, nil +} diff --git a/vendor/github.com/opencontainers/go-digest/.mailmap b/vendor/github.com/opencontainers/go-digest/.mailmap new file mode 100644 index 00000000..eaf8b2f9 --- /dev/null +++ b/vendor/github.com/opencontainers/go-digest/.mailmap @@ -0,0 +1,4 @@ +Aaron Lehmann +Derek McGowan +Stephen J Day +Haibing Zhou diff --git a/vendor/github.com/opencontainers/go-digest/.pullapprove.yml b/vendor/github.com/opencontainers/go-digest/.pullapprove.yml new file mode 100644 index 00000000..b6165f83 --- /dev/null +++ b/vendor/github.com/opencontainers/go-digest/.pullapprove.yml @@ -0,0 +1,28 @@ +version: 2 + +requirements: + signed_off_by: + required: true + +always_pending: + title_regex: '^WIP' + explanation: 'Work in progress...' + +group_defaults: + required: 2 + approve_by_comment: + enabled: true + approve_regex: '^LGTM' + reject_regex: '^Rejected' + reset_on_push: + enabled: true + author_approval: + ignored: true + conditions: + branches: + - master + +groups: + go-digest: + teams: + - go-digest-maintainers diff --git a/vendor/github.com/opencontainers/go-digest/.travis.yml b/vendor/github.com/opencontainers/go-digest/.travis.yml new file mode 100644 index 00000000..5775f885 --- /dev/null +++ b/vendor/github.com/opencontainers/go-digest/.travis.yml @@ -0,0 +1,5 @@ +language: go +go: + - 1.12.x + - 1.13.x + - master diff --git a/vendor/github.com/opencontainers/go-digest/CONTRIBUTING.md b/vendor/github.com/opencontainers/go-digest/CONTRIBUTING.md new file mode 100644 index 00000000..e4d962ac --- /dev/null +++ b/vendor/github.com/opencontainers/go-digest/CONTRIBUTING.md @@ -0,0 +1,72 @@ +# Contributing to Docker open source projects + +Want to hack on this project? Awesome! Here are instructions to get you started. + +This project is a part of the [Docker](https://www.docker.com) project, and follows +the same rules and principles. If you're already familiar with the way +Docker does things, you'll feel right at home. + +Otherwise, go read Docker's +[contributions guidelines](https://github.com/docker/docker/blob/master/CONTRIBUTING.md), +[issue triaging](https://github.com/docker/docker/blob/master/project/ISSUE-TRIAGE.md), +[review process](https://github.com/docker/docker/blob/master/project/REVIEWING.md) and +[branches and tags](https://github.com/docker/docker/blob/master/project/BRANCHES-AND-TAGS.md). + +For an in-depth description of our contribution process, visit the +contributors guide: [Understand how to contribute](https://docs.docker.com/opensource/workflow/make-a-contribution/) + +### Sign your work + +The sign-off is a simple line at the end of the explanation for the patch. Your +signature certifies that you wrote the patch or otherwise have the right to pass +it on as an open-source patch. The rules are pretty simple: if you can certify +the below (from [developercertificate.org](http://developercertificate.org/)): + +``` +Developer Certificate of Origin +Version 1.1 + +Copyright (C) 2004, 2006 The Linux Foundation and its contributors. +1 Letterman Drive +Suite D4700 +San Francisco, CA, 94129 + +Everyone is permitted to copy and distribute verbatim copies of this +license document, but changing it is not allowed. + + +Developer's Certificate of Origin 1.1 + +By making a contribution to this project, I certify that: + +(a) The contribution was created in whole or in part by me and I + have the right to submit it under the open source license + indicated in the file; or + +(b) The contribution is based upon previous work that, to the best + of my knowledge, is covered under an appropriate open source + license and I have the right under that license to submit that + work with modifications, whether created in whole or in part + by me, under the same open source license (unless I am + permitted to submit under a different license), as indicated + in the file; or + +(c) The contribution was provided directly to me by some other + person who certified (a), (b) or (c) and I have not modified + it. + +(d) I understand and agree that this project and the contribution + are public and that a record of the contribution (including all + personal information I submit with it, including my sign-off) is + maintained indefinitely and may be redistributed consistent with + this project or the open source license(s) involved. +``` + +Then you just add a line to every git commit message: + + Signed-off-by: Joe Smith + +Use your real name (sorry, no pseudonyms or anonymous contributions.) + +If you set your `user.name` and `user.email` git configs, you can sign your +commit automatically with `git commit -s`. diff --git a/vendor/github.com/opencontainers/go-digest/LICENSE b/vendor/github.com/opencontainers/go-digest/LICENSE new file mode 100644 index 00000000..3ac8ab64 --- /dev/null +++ b/vendor/github.com/opencontainers/go-digest/LICENSE @@ -0,0 +1,192 @@ + + Apache License + Version 2.0, January 2004 + https://www.apache.org/licenses/ + + TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + + 1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + + 2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + + 3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + + 4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + + 5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + + 6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + + 7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + + 8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + + 9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + + END OF TERMS AND CONDITIONS + + Copyright 2019, 2020 OCI Contributors + Copyright 2016 Docker, Inc. + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. diff --git a/vendor/github.com/opencontainers/go-digest/LICENSE.docs b/vendor/github.com/opencontainers/go-digest/LICENSE.docs new file mode 100644 index 00000000..e26cd4fc --- /dev/null +++ b/vendor/github.com/opencontainers/go-digest/LICENSE.docs @@ -0,0 +1,425 @@ +Attribution-ShareAlike 4.0 International + +======================================================================= + +Creative Commons Corporation ("Creative Commons") is not a law firm and +does not provide legal services or legal advice. Distribution of +Creative Commons public licenses does not create a lawyer-client or +other relationship. Creative Commons makes its licenses and related +information available on an "as-is" basis. Creative Commons gives no +warranties regarding its licenses, any material licensed under their +terms and conditions, or any related information. Creative Commons +disclaims all liability for damages resulting from their use to the +fullest extent possible. + +Using Creative Commons Public Licenses + +Creative Commons public licenses provide a standard set of terms and +conditions that creators and other rights holders may use to share +original works of authorship and other material subject to copyright +and certain other rights specified in the public license below. The +following considerations are for informational purposes only, are not +exhaustive, and do not form part of our licenses. + + Considerations for licensors: Our public licenses are + intended for use by those authorized to give the public + permission to use material in ways otherwise restricted by + copyright and certain other rights. Our licenses are + irrevocable. Licensors should read and understand the terms + and conditions of the license they choose before applying it. + Licensors should also secure all rights necessary before + applying our licenses so that the public can reuse the + material as expected. Licensors should clearly mark any + material not subject to the license. This includes other CC- + licensed material, or material used under an exception or + limitation to copyright. More considerations for licensors: + wiki.creativecommons.org/Considerations_for_licensors + + Considerations for the public: By using one of our public + licenses, a licensor grants the public permission to use the + licensed material under specified terms and conditions. If + the licensor's permission is not necessary for any reason--for + example, because of any applicable exception or limitation to + copyright--then that use is not regulated by the license. Our + licenses grant only permissions under copyright and certain + other rights that a licensor has authority to grant. Use of + the licensed material may still be restricted for other + reasons, including because others have copyright or other + rights in the material. A licensor may make special requests, + such as asking that all changes be marked or described. + Although not required by our licenses, you are encouraged to + respect those requests where reasonable. More_considerations + for the public: + wiki.creativecommons.org/Considerations_for_licensees + +======================================================================= + +Creative Commons Attribution-ShareAlike 4.0 International Public +License + +By exercising the Licensed Rights (defined below), You accept and agree +to be bound by the terms and conditions of this Creative Commons +Attribution-ShareAlike 4.0 International Public License ("Public +License"). To the extent this Public License may be interpreted as a +contract, You are granted the Licensed Rights in consideration of Your +acceptance of these terms and conditions, and the Licensor grants You +such rights in consideration of benefits the Licensor receives from +making the Licensed Material available under these terms and +conditions. + + +Section 1 -- Definitions. + + a. Adapted Material means material subject to Copyright and Similar + Rights that is derived from or based upon the Licensed Material + and in which the Licensed Material is translated, altered, + arranged, transformed, or otherwise modified in a manner requiring + permission under the Copyright and Similar Rights held by the + Licensor. For purposes of this Public License, where the Licensed + Material is a musical work, performance, or sound recording, + Adapted Material is always produced where the Licensed Material is + synched in timed relation with a moving image. + + b. Adapter's License means the license You apply to Your Copyright + and Similar Rights in Your contributions to Adapted Material in + accordance with the terms and conditions of this Public License. + + c. BY-SA Compatible License means a license listed at + creativecommons.org/compatiblelicenses, approved by Creative + Commons as essentially the equivalent of this Public License. + + d. Copyright and Similar Rights means copyright and/or similar rights + closely related to copyright including, without limitation, + performance, broadcast, sound recording, and Sui Generis Database + Rights, without regard to how the rights are labeled or + categorized. For purposes of this Public License, the rights + specified in Section 2(b)(1)-(2) are not Copyright and Similar + Rights. + + e. Effective Technological Measures means those measures that, in the + absence of proper authority, may not be circumvented under laws + fulfilling obligations under Article 11 of the WIPO Copyright + Treaty adopted on December 20, 1996, and/or similar international + agreements. + + f. Exceptions and Limitations means fair use, fair dealing, and/or + any other exception or limitation to Copyright and Similar Rights + that applies to Your use of the Licensed Material. + + g. License Elements means the license attributes listed in the name + of a Creative Commons Public License. The License Elements of this + Public License are Attribution and ShareAlike. + + h. Licensed Material means the artistic or literary work, database, + or other material to which the Licensor applied this Public + License. + + i. Licensed Rights means the rights granted to You subject to the + terms and conditions of this Public License, which are limited to + all Copyright and Similar Rights that apply to Your use of the + Licensed Material and that the Licensor has authority to license. + + j. Licensor means the individual(s) or entity(ies) granting rights + under this Public License. + + k. Share means to provide material to the public by any means or + process that requires permission under the Licensed Rights, such + as reproduction, public display, public performance, distribution, + dissemination, communication, or importation, and to make material + available to the public including in ways that members of the + public may access the material from a place and at a time + individually chosen by them. + + l. Sui Generis Database Rights means rights other than copyright + resulting from Directive 96/9/EC of the European Parliament and of + the Council of 11 March 1996 on the legal protection of databases, + as amended and/or succeeded, as well as other essentially + equivalent rights anywhere in the world. + + m. You means the individual or entity exercising the Licensed Rights + under this Public License. Your has a corresponding meaning. + + +Section 2 -- Scope. + + a. License grant. + + 1. Subject to the terms and conditions of this Public License, + the Licensor hereby grants You a worldwide, royalty-free, + non-sublicensable, non-exclusive, irrevocable license to + exercise the Licensed Rights in the Licensed Material to: + + a. reproduce and Share the Licensed Material, in whole or + in part; and + + b. produce, reproduce, and Share Adapted Material. + + 2. Exceptions and Limitations. For the avoidance of doubt, where + Exceptions and Limitations apply to Your use, this Public + License does not apply, and You do not need to comply with + its terms and conditions. + + 3. Term. The term of this Public License is specified in Section + 6(a). + + 4. Media and formats; technical modifications allowed. The + Licensor authorizes You to exercise the Licensed Rights in + all media and formats whether now known or hereafter created, + and to make technical modifications necessary to do so. The + Licensor waives and/or agrees not to assert any right or + authority to forbid You from making technical modifications + necessary to exercise the Licensed Rights, including + technical modifications necessary to circumvent Effective + Technological Measures. For purposes of this Public License, + simply making modifications authorized by this Section 2(a) + (4) never produces Adapted Material. + + 5. Downstream recipients. + + a. Offer from the Licensor -- Licensed Material. Every + recipient of the Licensed Material automatically + receives an offer from the Licensor to exercise the + Licensed Rights under the terms and conditions of this + Public License. + + b. Additional offer from the Licensor -- Adapted Material. + Every recipient of Adapted Material from You + automatically receives an offer from the Licensor to + exercise the Licensed Rights in the Adapted Material + under the conditions of the Adapter's License You apply. + + c. No downstream restrictions. You may not offer or impose + any additional or different terms or conditions on, or + apply any Effective Technological Measures to, the + Licensed Material if doing so restricts exercise of the + Licensed Rights by any recipient of the Licensed + Material. + + 6. No endorsement. Nothing in this Public License constitutes or + may be construed as permission to assert or imply that You + are, or that Your use of the Licensed Material is, connected + with, or sponsored, endorsed, or granted official status by, + the Licensor or others designated to receive attribution as + provided in Section 3(a)(1)(A)(i). + + b. Other rights. + + 1. Moral rights, such as the right of integrity, are not + licensed under this Public License, nor are publicity, + privacy, and/or other similar personality rights; however, to + the extent possible, the Licensor waives and/or agrees not to + assert any such rights held by the Licensor to the limited + extent necessary to allow You to exercise the Licensed + Rights, but not otherwise. + + 2. Patent and trademark rights are not licensed under this + Public License. + + 3. To the extent possible, the Licensor waives any right to + collect royalties from You for the exercise of the Licensed + Rights, whether directly or through a collecting society + under any voluntary or waivable statutory or compulsory + licensing scheme. In all other cases the Licensor expressly + reserves any right to collect such royalties. + + +Section 3 -- License Conditions. + +Your exercise of the Licensed Rights is expressly made subject to the +following conditions. + + a. Attribution. + + 1. If You Share the Licensed Material (including in modified + form), You must: + + a. retain the following if it is supplied by the Licensor + with the Licensed Material: + + i. identification of the creator(s) of the Licensed + Material and any others designated to receive + attribution, in any reasonable manner requested by + the Licensor (including by pseudonym if + designated); + + ii. a copyright notice; + + iii. a notice that refers to this Public License; + + iv. a notice that refers to the disclaimer of + warranties; + + v. a URI or hyperlink to the Licensed Material to the + extent reasonably practicable; + + b. indicate if You modified the Licensed Material and + retain an indication of any previous modifications; and + + c. indicate the Licensed Material is licensed under this + Public License, and include the text of, or the URI or + hyperlink to, this Public License. + + 2. You may satisfy the conditions in Section 3(a)(1) in any + reasonable manner based on the medium, means, and context in + which You Share the Licensed Material. For example, it may be + reasonable to satisfy the conditions by providing a URI or + hyperlink to a resource that includes the required + information. + + 3. If requested by the Licensor, You must remove any of the + information required by Section 3(a)(1)(A) to the extent + reasonably practicable. + + b. ShareAlike. + + In addition to the conditions in Section 3(a), if You Share + Adapted Material You produce, the following conditions also apply. + + 1. The Adapter's License You apply must be a Creative Commons + license with the same License Elements, this version or + later, or a BY-SA Compatible License. + + 2. You must include the text of, or the URI or hyperlink to, the + Adapter's License You apply. You may satisfy this condition + in any reasonable manner based on the medium, means, and + context in which You Share Adapted Material. + + 3. You may not offer or impose any additional or different terms + or conditions on, or apply any Effective Technological + Measures to, Adapted Material that restrict exercise of the + rights granted under the Adapter's License You apply. + + +Section 4 -- Sui Generis Database Rights. + +Where the Licensed Rights include Sui Generis Database Rights that +apply to Your use of the Licensed Material: + + a. for the avoidance of doubt, Section 2(a)(1) grants You the right + to extract, reuse, reproduce, and Share all or a substantial + portion of the contents of the database; + + b. if You include all or a substantial portion of the database + contents in a database in which You have Sui Generis Database + Rights, then the database in which You have Sui Generis Database + Rights (but not its individual contents) is Adapted Material, + + including for purposes of Section 3(b); and + c. You must comply with the conditions in Section 3(a) if You Share + all or a substantial portion of the contents of the database. + +For the avoidance of doubt, this Section 4 supplements and does not +replace Your obligations under this Public License where the Licensed +Rights include other Copyright and Similar Rights. + + +Section 5 -- Disclaimer of Warranties and Limitation of Liability. + + a. UNLESS OTHERWISE SEPARATELY UNDERTAKEN BY THE LICENSOR, TO THE + EXTENT POSSIBLE, THE LICENSOR OFFERS THE LICENSED MATERIAL AS-IS + AND AS-AVAILABLE, AND MAKES NO REPRESENTATIONS OR WARRANTIES OF + ANY KIND CONCERNING THE LICENSED MATERIAL, WHETHER EXPRESS, + IMPLIED, STATUTORY, OR OTHER. THIS INCLUDES, WITHOUT LIMITATION, + WARRANTIES OF TITLE, MERCHANTABILITY, FITNESS FOR A PARTICULAR + PURPOSE, NON-INFRINGEMENT, ABSENCE OF LATENT OR OTHER DEFECTS, + ACCURACY, OR THE PRESENCE OR ABSENCE OF ERRORS, WHETHER OR NOT + KNOWN OR DISCOVERABLE. WHERE DISCLAIMERS OF WARRANTIES ARE NOT + ALLOWED IN FULL OR IN PART, THIS DISCLAIMER MAY NOT APPLY TO YOU. + + b. TO THE EXTENT POSSIBLE, IN NO EVENT WILL THE LICENSOR BE LIABLE + TO YOU ON ANY LEGAL THEORY (INCLUDING, WITHOUT LIMITATION, + NEGLIGENCE) OR OTHERWISE FOR ANY DIRECT, SPECIAL, INDIRECT, + INCIDENTAL, CONSEQUENTIAL, PUNITIVE, EXEMPLARY, OR OTHER LOSSES, + COSTS, EXPENSES, OR DAMAGES ARISING OUT OF THIS PUBLIC LICENSE OR + USE OF THE LICENSED MATERIAL, EVEN IF THE LICENSOR HAS BEEN + ADVISED OF THE POSSIBILITY OF SUCH LOSSES, COSTS, EXPENSES, OR + DAMAGES. WHERE A LIMITATION OF LIABILITY IS NOT ALLOWED IN FULL OR + IN PART, THIS LIMITATION MAY NOT APPLY TO YOU. + + c. The disclaimer of warranties and limitation of liability provided + above shall be interpreted in a manner that, to the extent + possible, most closely approximates an absolute disclaimer and + waiver of all liability. + + +Section 6 -- Term and Termination. + + a. This Public License applies for the term of the Copyright and + Similar Rights licensed here. However, if You fail to comply with + this Public License, then Your rights under this Public License + terminate automatically. + + b. Where Your right to use the Licensed Material has terminated under + Section 6(a), it reinstates: + + 1. automatically as of the date the violation is cured, provided + it is cured within 30 days of Your discovery of the + violation; or + + 2. upon express reinstatement by the Licensor. + + For the avoidance of doubt, this Section 6(b) does not affect any + right the Licensor may have to seek remedies for Your violations + of this Public License. + + c. For the avoidance of doubt, the Licensor may also offer the + Licensed Material under separate terms or conditions or stop + distributing the Licensed Material at any time; however, doing so + will not terminate this Public License. + + d. Sections 1, 5, 6, 7, and 8 survive termination of this Public + License. + + +Section 7 -- Other Terms and Conditions. + + a. The Licensor shall not be bound by any additional or different + terms or conditions communicated by You unless expressly agreed. + + b. Any arrangements, understandings, or agreements regarding the + Licensed Material not stated herein are separate from and + independent of the terms and conditions of this Public License. + + +Section 8 -- Interpretation. + + a. For the avoidance of doubt, this Public License does not, and + shall not be interpreted to, reduce, limit, restrict, or impose + conditions on any use of the Licensed Material that could lawfully + be made without permission under this Public License. + + b. To the extent possible, if any provision of this Public License is + deemed unenforceable, it shall be automatically reformed to the + minimum extent necessary to make it enforceable. If the provision + cannot be reformed, it shall be severed from this Public License + without affecting the enforceability of the remaining terms and + conditions. + + c. No term or condition of this Public License will be waived and no + failure to comply consented to unless expressly agreed to by the + Licensor. + + d. Nothing in this Public License constitutes or may be interpreted + as a limitation upon, or waiver of, any privileges and immunities + that apply to the Licensor or You, including from the legal + processes of any jurisdiction or authority. + + +======================================================================= + +Creative Commons is not a party to its public licenses. +Notwithstanding, Creative Commons may elect to apply one of its public +licenses to material it publishes and in those instances will be +considered the "Licensor." Except for the limited purpose of indicating +that material is shared under a Creative Commons public license or as +otherwise permitted by the Creative Commons policies published at +creativecommons.org/policies, Creative Commons does not authorize the +use of the trademark "Creative Commons" or any other trademark or logo +of Creative Commons without its prior written consent including, +without limitation, in connection with any unauthorized modifications +to any of its public licenses or any other arrangements, +understandings, or agreements concerning use of licensed material. For +the avoidance of doubt, this paragraph does not form part of the public +licenses. + +Creative Commons may be contacted at creativecommons.org. diff --git a/vendor/github.com/opencontainers/go-digest/MAINTAINERS b/vendor/github.com/opencontainers/go-digest/MAINTAINERS new file mode 100644 index 00000000..843b1b20 --- /dev/null +++ b/vendor/github.com/opencontainers/go-digest/MAINTAINERS @@ -0,0 +1,5 @@ +Derek McGowan (@dmcgowan) +Stephen Day (@stevvooe) +Vincent Batts (@vbatts) +Akihiro Suda (@AkihiroSuda) +Sebastiaan van Stijn (@thaJeztah) diff --git a/vendor/github.com/opencontainers/go-digest/README.md b/vendor/github.com/opencontainers/go-digest/README.md new file mode 100644 index 00000000..a1128720 --- /dev/null +++ b/vendor/github.com/opencontainers/go-digest/README.md @@ -0,0 +1,96 @@ +# go-digest + +[![GoDoc](https://godoc.org/github.com/opencontainers/go-digest?status.svg)](https://godoc.org/github.com/opencontainers/go-digest) [![Go Report Card](https://goreportcard.com/badge/github.com/opencontainers/go-digest)](https://goreportcard.com/report/github.com/opencontainers/go-digest) [![Build Status](https://travis-ci.org/opencontainers/go-digest.svg?branch=master)](https://travis-ci.org/opencontainers/go-digest) + +Common digest package used across the container ecosystem. + +Please see the [godoc](https://godoc.org/github.com/opencontainers/go-digest) for more information. + +# What is a digest? + +A digest is just a [hash](https://en.wikipedia.org/wiki/Hash_function). + +The most common use case for a digest is to create a content identifier for use in [Content Addressable Storage](https://en.wikipedia.org/wiki/Content-addressable_storage) systems: + +```go +id := digest.FromBytes([]byte("my content")) +``` + +In the example above, the id can be used to uniquely identify the byte slice "my content". +This allows two disparate applications to agree on a verifiable identifier without having to trust one another. + +An identifying digest can be verified, as follows: + +```go +if id != digest.FromBytes([]byte("my content")) { + return errors.New("the content has changed!") +} +``` + +A `Verifier` type can be used to handle cases where an `io.Reader` makes more sense: + +```go +rd := getContent() +verifier := id.Verifier() +io.Copy(verifier, rd) + +if !verifier.Verified() { + return errors.New("the content has changed!") +} +``` + +Using [Merkle DAGs](https://en.wikipedia.org/wiki/Merkle_tree), this can power a rich, safe, content distribution system. + +# Usage + +While the [godoc](https://godoc.org/github.com/opencontainers/go-digest) is considered the best resource, a few important items need to be called out when using this package. + +1. Make sure to import the hash implementations into your application or the package will panic. + You should have something like the following in the main (or other entrypoint) of your application: + + ```go + import ( + _ "crypto/sha256" + _ "crypto/sha512" + ) + ``` + This may seem inconvenient but it allows you replace the hash + implementations with others, such as https://github.com/stevvooe/resumable. + +2. Even though `digest.Digest` may be assemblable as a string, _always_ verify your input with `digest.Parse` or use `Digest.Validate` when accepting untrusted input. + While there are measures to avoid common problems, this will ensure you have valid digests in the rest of your application. + +3. While alternative encodings of hash values (digests) are possible (for example, base64), this package deals exclusively with hex-encoded digests. + +# Stability + +The Go API, at this stage, is considered stable, unless otherwise noted. + +As always, before using a package export, read the [godoc](https://godoc.org/github.com/opencontainers/go-digest). + +# Contributing + +This package is considered fairly complete. +It has been in production in thousands (millions?) of deployments and is fairly battle-hardened. +New additions will be met with skepticism. +If you think there is a missing feature, please file a bug clearly describing the problem and the alternatives you tried before submitting a PR. + +## Code of Conduct + +Participation in the OpenContainers community is governed by [OpenContainer's Code of Conduct][code-of-conduct]. + +## Security + +If you find an issue, please follow the [security][security] protocol to report it. + +# Copyright and license + +Copyright © 2019, 2020 OCI Contributors +Copyright © 2016 Docker, Inc. +All rights reserved, except as follows. +Code is released under the [Apache 2.0 license](LICENSE). +This `README.md` file and the [`CONTRIBUTING.md`](CONTRIBUTING.md) file are licensed under the Creative Commons Attribution 4.0 International License under the terms and conditions set forth in the file [`LICENSE.docs`](LICENSE.docs). +You may obtain a duplicate copy of the same license, titled CC BY-SA 4.0, at http://creativecommons.org/licenses/by-sa/4.0/. + +[security]: https://github.com/opencontainers/org/blob/master/security +[code-of-conduct]: https://github.com/opencontainers/org/blob/master/CODE_OF_CONDUCT.md diff --git a/vendor/github.com/opencontainers/go-digest/algorithm.go b/vendor/github.com/opencontainers/go-digest/algorithm.go new file mode 100644 index 00000000..490951dc --- /dev/null +++ b/vendor/github.com/opencontainers/go-digest/algorithm.go @@ -0,0 +1,193 @@ +// Copyright 2019, 2020 OCI Contributors +// Copyright 2017 Docker, Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package digest + +import ( + "crypto" + "fmt" + "hash" + "io" + "regexp" +) + +// Algorithm identifies and implementation of a digester by an identifier. +// Note the that this defines both the hash algorithm used and the string +// encoding. +type Algorithm string + +// supported digest types +const ( + SHA256 Algorithm = "sha256" // sha256 with hex encoding (lower case only) + SHA384 Algorithm = "sha384" // sha384 with hex encoding (lower case only) + SHA512 Algorithm = "sha512" // sha512 with hex encoding (lower case only) + + // Canonical is the primary digest algorithm used with the distribution + // project. Other digests may be used but this one is the primary storage + // digest. + Canonical = SHA256 +) + +var ( + // TODO(stevvooe): Follow the pattern of the standard crypto package for + // registration of digests. Effectively, we are a registerable set and + // common symbol access. + + // algorithms maps values to hash.Hash implementations. Other algorithms + // may be available but they cannot be calculated by the digest package. + algorithms = map[Algorithm]crypto.Hash{ + SHA256: crypto.SHA256, + SHA384: crypto.SHA384, + SHA512: crypto.SHA512, + } + + // anchoredEncodedRegexps contains anchored regular expressions for hex-encoded digests. + // Note that /A-F/ disallowed. + anchoredEncodedRegexps = map[Algorithm]*regexp.Regexp{ + SHA256: regexp.MustCompile(`^[a-f0-9]{64}$`), + SHA384: regexp.MustCompile(`^[a-f0-9]{96}$`), + SHA512: regexp.MustCompile(`^[a-f0-9]{128}$`), + } +) + +// Available returns true if the digest type is available for use. If this +// returns false, Digester and Hash will return nil. +func (a Algorithm) Available() bool { + h, ok := algorithms[a] + if !ok { + return false + } + + // check availability of the hash, as well + return h.Available() +} + +func (a Algorithm) String() string { + return string(a) +} + +// Size returns number of bytes returned by the hash. +func (a Algorithm) Size() int { + h, ok := algorithms[a] + if !ok { + return 0 + } + return h.Size() +} + +// Set implemented to allow use of Algorithm as a command line flag. +func (a *Algorithm) Set(value string) error { + if value == "" { + *a = Canonical + } else { + // just do a type conversion, support is queried with Available. + *a = Algorithm(value) + } + + if !a.Available() { + return ErrDigestUnsupported + } + + return nil +} + +// Digester returns a new digester for the specified algorithm. If the algorithm +// does not have a digester implementation, nil will be returned. This can be +// checked by calling Available before calling Digester. +func (a Algorithm) Digester() Digester { + return &digester{ + alg: a, + hash: a.Hash(), + } +} + +// Hash returns a new hash as used by the algorithm. If not available, the +// method will panic. Check Algorithm.Available() before calling. +func (a Algorithm) Hash() hash.Hash { + if !a.Available() { + // Empty algorithm string is invalid + if a == "" { + panic(fmt.Sprintf("empty digest algorithm, validate before calling Algorithm.Hash()")) + } + + // NOTE(stevvooe): A missing hash is usually a programming error that + // must be resolved at compile time. We don't import in the digest + // package to allow users to choose their hash implementation (such as + // when using stevvooe/resumable or a hardware accelerated package). + // + // Applications that may want to resolve the hash at runtime should + // call Algorithm.Available before call Algorithm.Hash(). + panic(fmt.Sprintf("%v not available (make sure it is imported)", a)) + } + + return algorithms[a].New() +} + +// Encode encodes the raw bytes of a digest, typically from a hash.Hash, into +// the encoded portion of the digest. +func (a Algorithm) Encode(d []byte) string { + // TODO(stevvooe): Currently, all algorithms use a hex encoding. When we + // add support for back registration, we can modify this accordingly. + return fmt.Sprintf("%x", d) +} + +// FromReader returns the digest of the reader using the algorithm. +func (a Algorithm) FromReader(rd io.Reader) (Digest, error) { + digester := a.Digester() + + if _, err := io.Copy(digester.Hash(), rd); err != nil { + return "", err + } + + return digester.Digest(), nil +} + +// FromBytes digests the input and returns a Digest. +func (a Algorithm) FromBytes(p []byte) Digest { + digester := a.Digester() + + if _, err := digester.Hash().Write(p); err != nil { + // Writes to a Hash should never fail. None of the existing + // hash implementations in the stdlib or hashes vendored + // here can return errors from Write. Having a panic in this + // condition instead of having FromBytes return an error value + // avoids unnecessary error handling paths in all callers. + panic("write to hash function returned error: " + err.Error()) + } + + return digester.Digest() +} + +// FromString digests the string input and returns a Digest. +func (a Algorithm) FromString(s string) Digest { + return a.FromBytes([]byte(s)) +} + +// Validate validates the encoded portion string +func (a Algorithm) Validate(encoded string) error { + r, ok := anchoredEncodedRegexps[a] + if !ok { + return ErrDigestUnsupported + } + // Digests much always be hex-encoded, ensuring that their hex portion will + // always be size*2 + if a.Size()*2 != len(encoded) { + return ErrDigestInvalidLength + } + if r.MatchString(encoded) { + return nil + } + return ErrDigestInvalidFormat +} diff --git a/vendor/github.com/opencontainers/go-digest/digest.go b/vendor/github.com/opencontainers/go-digest/digest.go new file mode 100644 index 00000000..518b5e71 --- /dev/null +++ b/vendor/github.com/opencontainers/go-digest/digest.go @@ -0,0 +1,157 @@ +// Copyright 2019, 2020 OCI Contributors +// Copyright 2017 Docker, Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package digest + +import ( + "fmt" + "hash" + "io" + "regexp" + "strings" +) + +// Digest allows simple protection of hex formatted digest strings, prefixed +// by their algorithm. Strings of type Digest have some guarantee of being in +// the correct format and it provides quick access to the components of a +// digest string. +// +// The following is an example of the contents of Digest types: +// +// sha256:7173b809ca12ec5dee4506cd86be934c4596dd234ee82c0662eac04a8c2c71dc +// +// This allows to abstract the digest behind this type and work only in those +// terms. +type Digest string + +// NewDigest returns a Digest from alg and a hash.Hash object. +func NewDigest(alg Algorithm, h hash.Hash) Digest { + return NewDigestFromBytes(alg, h.Sum(nil)) +} + +// NewDigestFromBytes returns a new digest from the byte contents of p. +// Typically, this can come from hash.Hash.Sum(...) or xxx.SumXXX(...) +// functions. This is also useful for rebuilding digests from binary +// serializations. +func NewDigestFromBytes(alg Algorithm, p []byte) Digest { + return NewDigestFromEncoded(alg, alg.Encode(p)) +} + +// NewDigestFromHex is deprecated. Please use NewDigestFromEncoded. +func NewDigestFromHex(alg, hex string) Digest { + return NewDigestFromEncoded(Algorithm(alg), hex) +} + +// NewDigestFromEncoded returns a Digest from alg and the encoded digest. +func NewDigestFromEncoded(alg Algorithm, encoded string) Digest { + return Digest(fmt.Sprintf("%s:%s", alg, encoded)) +} + +// DigestRegexp matches valid digest types. +var DigestRegexp = regexp.MustCompile(`[a-z0-9]+(?:[.+_-][a-z0-9]+)*:[a-zA-Z0-9=_-]+`) + +// DigestRegexpAnchored matches valid digest types, anchored to the start and end of the match. +var DigestRegexpAnchored = regexp.MustCompile(`^` + DigestRegexp.String() + `$`) + +var ( + // ErrDigestInvalidFormat returned when digest format invalid. + ErrDigestInvalidFormat = fmt.Errorf("invalid checksum digest format") + + // ErrDigestInvalidLength returned when digest has invalid length. + ErrDigestInvalidLength = fmt.Errorf("invalid checksum digest length") + + // ErrDigestUnsupported returned when the digest algorithm is unsupported. + ErrDigestUnsupported = fmt.Errorf("unsupported digest algorithm") +) + +// Parse parses s and returns the validated digest object. An error will +// be returned if the format is invalid. +func Parse(s string) (Digest, error) { + d := Digest(s) + return d, d.Validate() +} + +// FromReader consumes the content of rd until io.EOF, returning canonical digest. +func FromReader(rd io.Reader) (Digest, error) { + return Canonical.FromReader(rd) +} + +// FromBytes digests the input and returns a Digest. +func FromBytes(p []byte) Digest { + return Canonical.FromBytes(p) +} + +// FromString digests the input and returns a Digest. +func FromString(s string) Digest { + return Canonical.FromString(s) +} + +// Validate checks that the contents of d is a valid digest, returning an +// error if not. +func (d Digest) Validate() error { + s := string(d) + i := strings.Index(s, ":") + if i <= 0 || i+1 == len(s) { + return ErrDigestInvalidFormat + } + algorithm, encoded := Algorithm(s[:i]), s[i+1:] + if !algorithm.Available() { + if !DigestRegexpAnchored.MatchString(s) { + return ErrDigestInvalidFormat + } + return ErrDigestUnsupported + } + return algorithm.Validate(encoded) +} + +// Algorithm returns the algorithm portion of the digest. This will panic if +// the underlying digest is not in a valid format. +func (d Digest) Algorithm() Algorithm { + return Algorithm(d[:d.sepIndex()]) +} + +// Verifier returns a writer object that can be used to verify a stream of +// content against the digest. If the digest is invalid, the method will panic. +func (d Digest) Verifier() Verifier { + return hashVerifier{ + hash: d.Algorithm().Hash(), + digest: d, + } +} + +// Encoded returns the encoded portion of the digest. This will panic if the +// underlying digest is not in a valid format. +func (d Digest) Encoded() string { + return string(d[d.sepIndex()+1:]) +} + +// Hex is deprecated. Please use Digest.Encoded. +func (d Digest) Hex() string { + return d.Encoded() +} + +func (d Digest) String() string { + return string(d) +} + +func (d Digest) sepIndex() int { + i := strings.Index(string(d), ":") + + if i < 0 { + panic(fmt.Sprintf("no ':' separator in digest %q", d)) + } + + return i +} diff --git a/vendor/github.com/opencontainers/go-digest/digester.go b/vendor/github.com/opencontainers/go-digest/digester.go new file mode 100644 index 00000000..ede90775 --- /dev/null +++ b/vendor/github.com/opencontainers/go-digest/digester.go @@ -0,0 +1,40 @@ +// Copyright 2019, 2020 OCI Contributors +// Copyright 2017 Docker, Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package digest + +import "hash" + +// Digester calculates the digest of written data. Writes should go directly +// to the return value of Hash, while calling Digest will return the current +// value of the digest. +type Digester interface { + Hash() hash.Hash // provides direct access to underlying hash instance. + Digest() Digest +} + +// digester provides a simple digester definition that embeds a hasher. +type digester struct { + alg Algorithm + hash hash.Hash +} + +func (d *digester) Hash() hash.Hash { + return d.hash +} + +func (d *digester) Digest() Digest { + return NewDigest(d.alg, d.hash) +} diff --git a/vendor/github.com/opencontainers/go-digest/doc.go b/vendor/github.com/opencontainers/go-digest/doc.go new file mode 100644 index 00000000..83d3a936 --- /dev/null +++ b/vendor/github.com/opencontainers/go-digest/doc.go @@ -0,0 +1,62 @@ +// Copyright 2019, 2020 OCI Contributors +// Copyright 2017 Docker, Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +// Package digest provides a generalized type to opaquely represent message +// digests and their operations within the registry. The Digest type is +// designed to serve as a flexible identifier in a content-addressable system. +// More importantly, it provides tools and wrappers to work with +// hash.Hash-based digests with little effort. +// +// Basics +// +// The format of a digest is simply a string with two parts, dubbed the +// "algorithm" and the "digest", separated by a colon: +// +// : +// +// An example of a sha256 digest representation follows: +// +// sha256:7173b809ca12ec5dee4506cd86be934c4596dd234ee82c0662eac04a8c2c71dc +// +// The "algorithm" portion defines both the hashing algorithm used to calculate +// the digest and the encoding of the resulting digest, which defaults to "hex" +// if not otherwise specified. Currently, all supported algorithms have their +// digests encoded in hex strings. +// +// In the example above, the string "sha256" is the algorithm and the hex bytes +// are the "digest". +// +// Because the Digest type is simply a string, once a valid Digest is +// obtained, comparisons are cheap, quick and simple to express with the +// standard equality operator. +// +// Verification +// +// The main benefit of using the Digest type is simple verification against a +// given digest. The Verifier interface, modeled after the stdlib hash.Hash +// interface, provides a common write sink for digest verification. After +// writing is complete, calling the Verifier.Verified method will indicate +// whether or not the stream of bytes matches the target digest. +// +// Missing Features +// +// In addition to the above, we intend to add the following features to this +// package: +// +// 1. A Digester type that supports write sink digest calculation. +// +// 2. Suspend and resume of ongoing digest calculations to support efficient digest verification in the registry. +// +package digest diff --git a/vendor/github.com/opencontainers/go-digest/verifiers.go b/vendor/github.com/opencontainers/go-digest/verifiers.go new file mode 100644 index 00000000..afef506f --- /dev/null +++ b/vendor/github.com/opencontainers/go-digest/verifiers.go @@ -0,0 +1,46 @@ +// Copyright 2019, 2020 OCI Contributors +// Copyright 2017 Docker, Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package digest + +import ( + "hash" + "io" +) + +// Verifier presents a general verification interface to be used with message +// digests and other byte stream verifications. Users instantiate a Verifier +// from one of the various methods, write the data under test to it then check +// the result with the Verified method. +type Verifier interface { + io.Writer + + // Verified will return true if the content written to Verifier matches + // the digest. + Verified() bool +} + +type hashVerifier struct { + digest Digest + hash hash.Hash +} + +func (hv hashVerifier) Write(p []byte) (n int, err error) { + return hv.hash.Write(p) +} + +func (hv hashVerifier) Verified() bool { + return hv.digest == NewDigest(hv.digest.Algorithm(), hv.hash) +} diff --git a/vendor/github.com/opencontainers/image-spec/LICENSE b/vendor/github.com/opencontainers/image-spec/LICENSE new file mode 100644 index 00000000..9fdc20fd --- /dev/null +++ b/vendor/github.com/opencontainers/image-spec/LICENSE @@ -0,0 +1,191 @@ + + Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + + TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + + 1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + + 2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + + 3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + + 4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + + 5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + + 6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + + 7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + + 8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + + 9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + + END OF TERMS AND CONDITIONS + + Copyright 2016 The Linux Foundation. + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. diff --git a/vendor/github.com/opencontainers/image-spec/specs-go/v1/annotations.go b/vendor/github.com/opencontainers/image-spec/specs-go/v1/annotations.go new file mode 100644 index 00000000..581cf7cd --- /dev/null +++ b/vendor/github.com/opencontainers/image-spec/specs-go/v1/annotations.go @@ -0,0 +1,62 @@ +// Copyright 2016 The Linux Foundation +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package v1 + +const ( + // AnnotationCreated is the annotation key for the date and time on which the image was built (date-time string as defined by RFC 3339). + AnnotationCreated = "org.opencontainers.image.created" + + // AnnotationAuthors is the annotation key for the contact details of the people or organization responsible for the image (freeform string). + AnnotationAuthors = "org.opencontainers.image.authors" + + // AnnotationURL is the annotation key for the URL to find more information on the image. + AnnotationURL = "org.opencontainers.image.url" + + // AnnotationDocumentation is the annotation key for the URL to get documentation on the image. + AnnotationDocumentation = "org.opencontainers.image.documentation" + + // AnnotationSource is the annotation key for the URL to get source code for building the image. + AnnotationSource = "org.opencontainers.image.source" + + // AnnotationVersion is the annotation key for the version of the packaged software. + // The version MAY match a label or tag in the source code repository. + // The version MAY be Semantic versioning-compatible. + AnnotationVersion = "org.opencontainers.image.version" + + // AnnotationRevision is the annotation key for the source control revision identifier for the packaged software. + AnnotationRevision = "org.opencontainers.image.revision" + + // AnnotationVendor is the annotation key for the name of the distributing entity, organization or individual. + AnnotationVendor = "org.opencontainers.image.vendor" + + // AnnotationLicenses is the annotation key for the license(s) under which contained software is distributed as an SPDX License Expression. + AnnotationLicenses = "org.opencontainers.image.licenses" + + // AnnotationRefName is the annotation key for the name of the reference for a target. + // SHOULD only be considered valid when on descriptors on `index.json` within image layout. + AnnotationRefName = "org.opencontainers.image.ref.name" + + // AnnotationTitle is the annotation key for the human-readable title of the image. + AnnotationTitle = "org.opencontainers.image.title" + + // AnnotationDescription is the annotation key for the human-readable description of the software packaged in the image. + AnnotationDescription = "org.opencontainers.image.description" + + // AnnotationBaseImageDigest is the annotation key for the digest of the image's base image. + AnnotationBaseImageDigest = "org.opencontainers.image.base.digest" + + // AnnotationBaseImageName is the annotation key for the image reference of the image's base image. + AnnotationBaseImageName = "org.opencontainers.image.base.name" +) diff --git a/vendor/github.com/opencontainers/image-spec/specs-go/v1/config.go b/vendor/github.com/opencontainers/image-spec/specs-go/v1/config.go new file mode 100644 index 00000000..36b0aeb8 --- /dev/null +++ b/vendor/github.com/opencontainers/image-spec/specs-go/v1/config.go @@ -0,0 +1,111 @@ +// Copyright 2016 The Linux Foundation +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package v1 + +import ( + "time" + + digest "github.com/opencontainers/go-digest" +) + +// ImageConfig defines the execution parameters which should be used as a base when running a container using an image. +type ImageConfig struct { + // User defines the username or UID which the process in the container should run as. + User string `json:"User,omitempty"` + + // ExposedPorts a set of ports to expose from a container running this image. + ExposedPorts map[string]struct{} `json:"ExposedPorts,omitempty"` + + // Env is a list of environment variables to be used in a container. + Env []string `json:"Env,omitempty"` + + // Entrypoint defines a list of arguments to use as the command to execute when the container starts. + Entrypoint []string `json:"Entrypoint,omitempty"` + + // Cmd defines the default arguments to the entrypoint of the container. + Cmd []string `json:"Cmd,omitempty"` + + // Volumes is a set of directories describing where the process is likely write data specific to a container instance. + Volumes map[string]struct{} `json:"Volumes,omitempty"` + + // WorkingDir sets the current working directory of the entrypoint process in the container. + WorkingDir string `json:"WorkingDir,omitempty"` + + // Labels contains arbitrary metadata for the container. + Labels map[string]string `json:"Labels,omitempty"` + + // StopSignal contains the system call signal that will be sent to the container to exit. + StopSignal string `json:"StopSignal,omitempty"` + + // ArgsEscaped + // + // Deprecated: This field is present only for legacy compatibility with + // Docker and should not be used by new image builders. It is used by Docker + // for Windows images to indicate that the `Entrypoint` or `Cmd` or both, + // contains only a single element array, that is a pre-escaped, and combined + // into a single string `CommandLine`. If `true` the value in `Entrypoint` or + // `Cmd` should be used as-is to avoid double escaping. + // https://github.com/opencontainers/image-spec/pull/892 + ArgsEscaped bool `json:"ArgsEscaped,omitempty"` +} + +// RootFS describes a layer content addresses +type RootFS struct { + // Type is the type of the rootfs. + Type string `json:"type"` + + // DiffIDs is an array of layer content hashes (DiffIDs), in order from bottom-most to top-most. + DiffIDs []digest.Digest `json:"diff_ids"` +} + +// History describes the history of a layer. +type History struct { + // Created is the combined date and time at which the layer was created, formatted as defined by RFC 3339, section 5.6. + Created *time.Time `json:"created,omitempty"` + + // CreatedBy is the command which created the layer. + CreatedBy string `json:"created_by,omitempty"` + + // Author is the author of the build point. + Author string `json:"author,omitempty"` + + // Comment is a custom message set when creating the layer. + Comment string `json:"comment,omitempty"` + + // EmptyLayer is used to mark if the history item created a filesystem diff. + EmptyLayer bool `json:"empty_layer,omitempty"` +} + +// Image is the JSON structure which describes some basic information about the image. +// This provides the `application/vnd.oci.image.config.v1+json` mediatype when marshalled to JSON. +type Image struct { + // Created is the combined date and time at which the image was created, formatted as defined by RFC 3339, section 5.6. + Created *time.Time `json:"created,omitempty"` + + // Author defines the name and/or email address of the person or entity which created and is responsible for maintaining the image. + Author string `json:"author,omitempty"` + + // Platform describes the platform which the image in the manifest runs on. + Platform + + // Config defines the execution parameters which should be used as a base when running a container using the image. + Config ImageConfig `json:"config,omitempty"` + + // RootFS references the layer content addresses used by the image. + RootFS RootFS `json:"rootfs"` + + // History describes the history of each layer. + History []History `json:"history,omitempty"` +} diff --git a/vendor/github.com/opencontainers/image-spec/specs-go/v1/descriptor.go b/vendor/github.com/opencontainers/image-spec/specs-go/v1/descriptor.go new file mode 100644 index 00000000..1881b118 --- /dev/null +++ b/vendor/github.com/opencontainers/image-spec/specs-go/v1/descriptor.go @@ -0,0 +1,80 @@ +// Copyright 2016-2022 The Linux Foundation +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package v1 + +import digest "github.com/opencontainers/go-digest" + +// Descriptor describes the disposition of targeted content. +// This structure provides `application/vnd.oci.descriptor.v1+json` mediatype +// when marshalled to JSON. +type Descriptor struct { + // MediaType is the media type of the object this schema refers to. + MediaType string `json:"mediaType"` + + // Digest is the digest of the targeted content. + Digest digest.Digest `json:"digest"` + + // Size specifies the size in bytes of the blob. + Size int64 `json:"size"` + + // URLs specifies a list of URLs from which this object MAY be downloaded + URLs []string `json:"urls,omitempty"` + + // Annotations contains arbitrary metadata relating to the targeted content. + Annotations map[string]string `json:"annotations,omitempty"` + + // Data is an embedding of the targeted content. This is encoded as a base64 + // string when marshalled to JSON (automatically, by encoding/json). If + // present, Data can be used directly to avoid fetching the targeted content. + Data []byte `json:"data,omitempty"` + + // Platform describes the platform which the image in the manifest runs on. + // + // This should only be used when referring to a manifest. + Platform *Platform `json:"platform,omitempty"` + + // ArtifactType is the IANA media type of this artifact. + ArtifactType string `json:"artifactType,omitempty"` +} + +// Platform describes the platform which the image in the manifest runs on. +type Platform struct { + // Architecture field specifies the CPU architecture, for example + // `amd64` or `ppc64le`. + Architecture string `json:"architecture"` + + // OS specifies the operating system, for example `linux` or `windows`. + OS string `json:"os"` + + // OSVersion is an optional field specifying the operating system + // version, for example on Windows `10.0.14393.1066`. + OSVersion string `json:"os.version,omitempty"` + + // OSFeatures is an optional field specifying an array of strings, + // each listing a required OS feature (for example on Windows `win32k`). + OSFeatures []string `json:"os.features,omitempty"` + + // Variant is an optional field specifying a variant of the CPU, for + // example `v7` to specify ARMv7 when architecture is `arm`. + Variant string `json:"variant,omitempty"` +} + +// DescriptorEmptyJSON is the descriptor of a blob with content of `{}`. +var DescriptorEmptyJSON = Descriptor{ + MediaType: MediaTypeEmptyJSON, + Digest: `sha256:44136fa355b3678a1146ad16f7e8649e94fb4fc21fe77e8310c060f61caaff8a`, + Size: 2, + Data: []byte(`{}`), +} diff --git a/vendor/github.com/opencontainers/image-spec/specs-go/v1/index.go b/vendor/github.com/opencontainers/image-spec/specs-go/v1/index.go new file mode 100644 index 00000000..e2bed9d4 --- /dev/null +++ b/vendor/github.com/opencontainers/image-spec/specs-go/v1/index.go @@ -0,0 +1,38 @@ +// Copyright 2016 The Linux Foundation +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package v1 + +import "github.com/opencontainers/image-spec/specs-go" + +// Index references manifests for various platforms. +// This structure provides `application/vnd.oci.image.index.v1+json` mediatype when marshalled to JSON. +type Index struct { + specs.Versioned + + // MediaType specifies the type of this document data structure e.g. `application/vnd.oci.image.index.v1+json` + MediaType string `json:"mediaType,omitempty"` + + // ArtifactType specifies the IANA media type of artifact when the manifest is used for an artifact. + ArtifactType string `json:"artifactType,omitempty"` + + // Manifests references platform specific manifests. + Manifests []Descriptor `json:"manifests"` + + // Subject is an optional link from the image manifest to another manifest forming an association between the image manifest and the other manifest. + Subject *Descriptor `json:"subject,omitempty"` + + // Annotations contains arbitrary metadata for the image index. + Annotations map[string]string `json:"annotations,omitempty"` +} diff --git a/vendor/github.com/opencontainers/image-spec/specs-go/v1/layout.go b/vendor/github.com/opencontainers/image-spec/specs-go/v1/layout.go new file mode 100644 index 00000000..c5503cb3 --- /dev/null +++ b/vendor/github.com/opencontainers/image-spec/specs-go/v1/layout.go @@ -0,0 +1,32 @@ +// Copyright 2016 The Linux Foundation +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package v1 + +const ( + // ImageLayoutFile is the file name containing ImageLayout in an OCI Image Layout + ImageLayoutFile = "oci-layout" + // ImageLayoutVersion is the version of ImageLayout + ImageLayoutVersion = "1.0.0" + // ImageIndexFile is the file name of the entry point for references and descriptors in an OCI Image Layout + ImageIndexFile = "index.json" + // ImageBlobsDir is the directory name containing content addressable blobs in an OCI Image Layout + ImageBlobsDir = "blobs" +) + +// ImageLayout is the structure in the "oci-layout" file, found in the root +// of an OCI Image-layout directory. +type ImageLayout struct { + Version string `json:"imageLayoutVersion"` +} diff --git a/vendor/github.com/opencontainers/image-spec/specs-go/v1/manifest.go b/vendor/github.com/opencontainers/image-spec/specs-go/v1/manifest.go new file mode 100644 index 00000000..26fec52a --- /dev/null +++ b/vendor/github.com/opencontainers/image-spec/specs-go/v1/manifest.go @@ -0,0 +1,41 @@ +// Copyright 2016-2022 The Linux Foundation +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package v1 + +import "github.com/opencontainers/image-spec/specs-go" + +// Manifest provides `application/vnd.oci.image.manifest.v1+json` mediatype structure when marshalled to JSON. +type Manifest struct { + specs.Versioned + + // MediaType specifies the type of this document data structure e.g. `application/vnd.oci.image.manifest.v1+json` + MediaType string `json:"mediaType,omitempty"` + + // ArtifactType specifies the IANA media type of artifact when the manifest is used for an artifact. + ArtifactType string `json:"artifactType,omitempty"` + + // Config references a configuration object for a container, by digest. + // The referenced configuration object is a JSON blob that the runtime uses to set up the container. + Config Descriptor `json:"config"` + + // Layers is an indexed list of layers referenced by the manifest. + Layers []Descriptor `json:"layers"` + + // Subject is an optional link from the image manifest to another manifest forming an association between the image manifest and the other manifest. + Subject *Descriptor `json:"subject,omitempty"` + + // Annotations contains arbitrary metadata for the image manifest. + Annotations map[string]string `json:"annotations,omitempty"` +} diff --git a/vendor/github.com/opencontainers/image-spec/specs-go/v1/mediatype.go b/vendor/github.com/opencontainers/image-spec/specs-go/v1/mediatype.go new file mode 100644 index 00000000..ce8313e7 --- /dev/null +++ b/vendor/github.com/opencontainers/image-spec/specs-go/v1/mediatype.go @@ -0,0 +1,85 @@ +// Copyright 2016 The Linux Foundation +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package v1 + +const ( + // MediaTypeDescriptor specifies the media type for a content descriptor. + MediaTypeDescriptor = "application/vnd.oci.descriptor.v1+json" + + // MediaTypeLayoutHeader specifies the media type for the oci-layout. + MediaTypeLayoutHeader = "application/vnd.oci.layout.header.v1+json" + + // MediaTypeImageIndex specifies the media type for an image index. + MediaTypeImageIndex = "application/vnd.oci.image.index.v1+json" + + // MediaTypeImageManifest specifies the media type for an image manifest. + MediaTypeImageManifest = "application/vnd.oci.image.manifest.v1+json" + + // MediaTypeImageConfig specifies the media type for the image configuration. + MediaTypeImageConfig = "application/vnd.oci.image.config.v1+json" + + // MediaTypeEmptyJSON specifies the media type for an unused blob containing the value "{}". + MediaTypeEmptyJSON = "application/vnd.oci.empty.v1+json" +) + +const ( + // MediaTypeImageLayer is the media type used for layers referenced by the manifest. + MediaTypeImageLayer = "application/vnd.oci.image.layer.v1.tar" + + // MediaTypeImageLayerGzip is the media type used for gzipped layers + // referenced by the manifest. + MediaTypeImageLayerGzip = "application/vnd.oci.image.layer.v1.tar+gzip" + + // MediaTypeImageLayerZstd is the media type used for zstd compressed + // layers referenced by the manifest. + MediaTypeImageLayerZstd = "application/vnd.oci.image.layer.v1.tar+zstd" +) + +// Non-distributable layer media-types. +// +// Deprecated: Non-distributable layers are deprecated, and not recommended +// for future use. Implementations SHOULD NOT produce new non-distributable +// layers. +// https://github.com/opencontainers/image-spec/pull/965 +const ( + // MediaTypeImageLayerNonDistributable is the media type for layers referenced by + // the manifest but with distribution restrictions. + // + // Deprecated: Non-distributable layers are deprecated, and not recommended + // for future use. Implementations SHOULD NOT produce new non-distributable + // layers. + // https://github.com/opencontainers/image-spec/pull/965 + MediaTypeImageLayerNonDistributable = "application/vnd.oci.image.layer.nondistributable.v1.tar" + + // MediaTypeImageLayerNonDistributableGzip is the media type for + // gzipped layers referenced by the manifest but with distribution + // restrictions. + // + // Deprecated: Non-distributable layers are deprecated, and not recommended + // for future use. Implementations SHOULD NOT produce new non-distributable + // layers. + // https://github.com/opencontainers/image-spec/pull/965 + MediaTypeImageLayerNonDistributableGzip = "application/vnd.oci.image.layer.nondistributable.v1.tar+gzip" + + // MediaTypeImageLayerNonDistributableZstd is the media type for zstd + // compressed layers referenced by the manifest but with distribution + // restrictions. + // + // Deprecated: Non-distributable layers are deprecated, and not recommended + // for future use. Implementations SHOULD NOT produce new non-distributable + // layers. + // https://github.com/opencontainers/image-spec/pull/965 + MediaTypeImageLayerNonDistributableZstd = "application/vnd.oci.image.layer.nondistributable.v1.tar+zstd" +) diff --git a/vendor/github.com/opencontainers/image-spec/specs-go/version.go b/vendor/github.com/opencontainers/image-spec/specs-go/version.go new file mode 100644 index 00000000..c3897c7c --- /dev/null +++ b/vendor/github.com/opencontainers/image-spec/specs-go/version.go @@ -0,0 +1,32 @@ +// Copyright 2016 The Linux Foundation +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package specs + +import "fmt" + +const ( + // VersionMajor is for an API incompatible changes + VersionMajor = 1 + // VersionMinor is for functionality in a backwards-compatible manner + VersionMinor = 1 + // VersionPatch is for backwards-compatible bug fixes + VersionPatch = 1 + + // VersionDev indicates development branch. Releases will be empty string. + VersionDev = "" +) + +// Version is the specification version that the package types support. +var Version = fmt.Sprintf("%d.%d.%d%s", VersionMajor, VersionMinor, VersionPatch, VersionDev) diff --git a/vendor/github.com/opencontainers/image-spec/specs-go/versioned.go b/vendor/github.com/opencontainers/image-spec/specs-go/versioned.go new file mode 100644 index 00000000..58a1510f --- /dev/null +++ b/vendor/github.com/opencontainers/image-spec/specs-go/versioned.go @@ -0,0 +1,23 @@ +// Copyright 2016 The Linux Foundation +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package specs + +// Versioned provides a struct with the manifest schemaVersion and mediaType. +// Incoming content with unknown schema version can be decoded against this +// struct to check the version. +type Versioned struct { + // SchemaVersion is the image manifest schema that this image follows + SchemaVersion int `json:"schemaVersion"` +} diff --git a/vendor/github.com/ory/dockertest/v4/.gitignore b/vendor/github.com/ory/dockertest/v4/.gitignore new file mode 100644 index 00000000..8fa39fb3 --- /dev/null +++ b/vendor/github.com/ory/dockertest/v4/.gitignore @@ -0,0 +1,22 @@ +# Binaries +*.exe +*.test +*.out + +# Coverage files +coverage.out +cover.out +.cover/ + +# Editor and IDE +.idea/ +node_modules/ +*.iml + +# Build artifacts +.bin/ +vendor/ + +# Temporary files +go.list +.vscode diff --git a/vendor/github.com/ory/dockertest/v4/.golangci.yml b/vendor/github.com/ory/dockertest/v4/.golangci.yml new file mode 100644 index 00000000..6d30545a --- /dev/null +++ b/vendor/github.com/ory/dockertest/v4/.golangci.yml @@ -0,0 +1,123 @@ +version: "2" + +run: + timeout: 5m + issues-exit-code: 1 + tests: true + build-tags: [] + modules-download-mode: readonly + allow-parallel-runners: true + +linters: + default: standard + enable: + - errcheck # Check for unchecked errors + - govet # Vet examines Go source code + - ineffassign # Detect ineffectual assignments + - staticcheck # Advanced static analysis + - unused # Check for unused constants, variables, functions and types + - misspell # Check for misspelled words + - gocritic # Highly extensible linter + - revive # Fast, configurable, extensible, and beautiful linter + - gosec # Security checker + - goconst # Find repeated strings that could be constants + - unconvert # Remove unnecessary type conversions + - unparam # Report unused function parameters + - prealloc # Find slice declarations that could be pre-allocated + + exclusions: + # Exclude some linters from running on test files + rules: + - path: _test\.go + linters: + - goconst + - gosec + - errcheck + + # Ignore package comment requirements for examples + - path: examples/ + linters: + - revive + text: "package-comments" + + settings: + errcheck: + check-type-assertions: true + check-blank: true + + govet: + enable-all: true + + gocritic: + enabled-tags: + - diagnostic + - style + - performance + - experimental + - opinionated + + gosec: + excludes: + - G104 # Audit errors not checked - covered by errcheck + - G306 # Poor file permissions - often needed for temp files + + goconst: + min-len: 3 + min-occurrences: 3 + + revive: + enable-all-rules: false + rules: + - name: blank-imports + - name: context-as-argument + - name: context-keys-type + - name: dot-imports + - name: error-return + - name: error-strings + - name: error-naming + - name: exported + - name: if-return + - name: increment-decrement + - name: var-naming + - name: var-declaration + - name: package-comments + - name: range + - name: receiver-naming + - name: time-naming + - name: unexported-return + - name: indent-error-flow + - name: errorf + - name: empty-block + - name: superfluous-else + - name: unused-parameter + - name: unreachable-code + - name: redefines-builtin-id + + staticcheck: + checks: ["all"] + + unparam: + check-exported: false + +formatters: + enable: + - gofmt # Check code is formatted + - goimports # Check imports are formatted + +issues: + max-issues-per-linter: 0 + max-same-issues: 0 + new: false + fix: false + +output: + formats: + text: + path: stdout + print-linter-name: true + print-issued-lines: true + colors: true + sort-order: + - linter + - severity + - file diff --git a/vendor/github.com/ory/dockertest/v4/.prettierignore b/vendor/github.com/ory/dockertest/v4/.prettierignore new file mode 100644 index 00000000..15683604 --- /dev/null +++ b/vendor/github.com/ory/dockertest/v4/.prettierignore @@ -0,0 +1,2 @@ +.github/pull_request_template.md +CONTRIBUTING.md diff --git a/vendor/github.com/ory/dockertest/v4/.reference-ignore b/vendor/github.com/ory/dockertest/v4/.reference-ignore new file mode 100644 index 00000000..eee2a89c --- /dev/null +++ b/vendor/github.com/ory/dockertest/v4/.reference-ignore @@ -0,0 +1,3 @@ +**/node_modules +docs +CHANGELOG.md diff --git a/vendor/github.com/ory/dockertest/v4/CLAUDE.md b/vendor/github.com/ory/dockertest/v4/CLAUDE.md new file mode 100644 index 00000000..0d200af4 --- /dev/null +++ b/vendor/github.com/ory/dockertest/v4/CLAUDE.md @@ -0,0 +1,30 @@ +- Always pass `context.Context` from caller (never use `context.Background` or + `TODO`). +- Follow idiomatic Go conventions + ([Effective Go](https://go.dev/doc/effective_go)). +- Prefer simple, clean architectures versus overengineering. +- Think about how you can remove, simplify, and reduce code (not tests!). LLMs + and AI agents have a tendency to generate useless helpers that already exist + in the stdlib or other libraries. Instead, I want you to delete and simplify + code (do not delete test cases though) and not generate + useless/duplicated/existing code. Generating useless code or duplicating + already existing functionality results in contract termination. +- Implementation notes and plans and documents generated while developing belong + in `./docs/notes/`. Ensure that notes have a frontmatter with `date`, and + `reason` fields. Specifically, the current date is important and the reason + why the note was created. +- When tests fail, do not remove or disable them. A failing test - especially if + it already exists on the main branch - indicates a fault in the business + logic. Removing or disabling that test leads to immediate contract + termination. +- Determinism is key, especially in tests and conformity checks. Avoid any + sources of non-determinism such as random number generation, time-based + functions, or reliance on external systems that may introduce variability. + Non-deterministic behavior can lead to flaky tests and unpredictable + application behavior, which is unacceptable. It is also unacceptable to have + thresholds in tests (e.g. 99% match X) - tests must be deterministic and + exact. +- Do not use equality for error comparison. Always use errors.Is() or + errors.As() for error comparisons. +- In tests don't use `defer` for cleanup but `t.Cleanup`. +- DO NOT use `github.com/docker/docker` but only `github.com/moby/moby/client` diff --git a/vendor/github.com/ory/dockertest/v4/CODE_OF_CONDUCT.md b/vendor/github.com/ory/dockertest/v4/CODE_OF_CONDUCT.md new file mode 100644 index 00000000..fc7d9bc2 --- /dev/null +++ b/vendor/github.com/ory/dockertest/v4/CODE_OF_CONDUCT.md @@ -0,0 +1,145 @@ + + + +# Contributor Covenant Code of Conduct + +## Our Pledge + +We as members, contributors, and leaders pledge to make participation in our +community a harassment-free experience for everyone, regardless of age, body +size, visible or invisible disability, ethnicity, sex characteristics, gender +identity and expression, level of experience, education, socio-economic status, +nationality, personal appearance, race, caste, color, religion, or sexual +identity and orientation. + +We pledge to act and interact in ways that contribute to an open, welcoming, +diverse, inclusive, and healthy community. + +## Our Standards + +Examples of behavior that contributes to a positive environment for our +community include: + +- Demonstrating empathy and kindness toward other people +- Being respectful of differing opinions, viewpoints, and experiences +- Giving and gracefully accepting constructive feedback +- Accepting responsibility and apologizing to those affected by our mistakes, + and learning from the experience +- Focusing on what is best not just for us as individuals, but for the overall + community + +Examples of unacceptable behavior include: + +- The use of sexualized language or imagery, and sexual attention or advances of + any kind +- Trolling, insulting or derogatory comments, and personal or political attacks +- Public or private harassment +- Publishing others' private information, such as a physical or email address, + without their explicit permission +- Other conduct which could reasonably be considered inappropriate in a + professional setting + +## Open Source Community Support + +Ory Open source software is collaborative and based on contributions by +developers in the Ory community. There is no obligation from Ory to help with +individual problems. If Ory open source software is used in production in a +for-profit company or enterprise environment, we mandate a paid support contract +where Ory is obligated under their service level agreements (SLAs) to offer a +defined level of availability and responsibility. For more information about +paid support please contact us at sales@ory.com. + +## Enforcement Responsibilities + +Community leaders are responsible for clarifying and enforcing our standards of +acceptable behavior and will take appropriate and fair corrective action in +response to any behavior that they deem inappropriate, threatening, offensive, +or harmful. + +Community leaders have the right and responsibility to remove, edit, or reject +comments, commits, code, wiki edits, issues, and other contributions that are +not aligned to this Code of Conduct, and will communicate reasons for moderation +decisions when appropriate. + +## Scope + +This Code of Conduct applies within all community spaces, and also applies when +an individual is officially representing the community in public spaces. +Examples of representing our community include using an official e-mail address, +posting via an official social media account, or acting as an appointed +representative at an online or offline event. + +## Enforcement + +Instances of abusive, harassing, or otherwise unacceptable behavior may be +reported to the community leaders responsible for enforcement at +[office@ory.com](mailto:office@ory.com). All complaints will be reviewed and +investigated promptly and fairly. + +All community leaders are obligated to respect the privacy and security of the +reporter of any incident. + +## Enforcement Guidelines + +Community leaders will follow these Community Impact Guidelines in determining +the consequences for any action they deem in violation of this Code of Conduct: + +### 1. Correction + +**Community Impact**: Use of inappropriate language or other behavior deemed +unprofessional or unwelcome in the community. + +**Consequence**: A private, written warning from community leaders, providing +clarity around the nature of the violation and an explanation of why the +behavior was inappropriate. A public apology may be requested. + +### 2. Warning + +**Community Impact**: A violation through a single incident or series of +actions. + +**Consequence**: A warning with consequences for continued behavior. No +interaction with the people involved, including unsolicited interaction with +those enforcing the Code of Conduct, for a specified period of time. This +includes avoiding interactions in community spaces as well as external channels +like social media. Violating these terms may lead to a temporary or permanent +ban. + +### 3. Temporary Ban + +**Community Impact**: A serious violation of community standards, including +sustained inappropriate behavior. + +**Consequence**: A temporary ban from any sort of interaction or public +communication with the community for a specified period of time. No public or +private interaction with the people involved, including unsolicited interaction +with those enforcing the Code of Conduct, is allowed during this period. +Violating these terms may lead to a permanent ban. + +### 4. Permanent Ban + +**Community Impact**: Demonstrating a pattern of violation of community +standards, including sustained inappropriate behavior, harassment of an +individual, or aggression toward or disparagement of classes of individuals. + +**Consequence**: A permanent ban from any sort of public interaction within the +community. + +## Attribution + +This Code of Conduct is adapted from the [Contributor Covenant][homepage], +version 2.1, available at +[https://www.contributor-covenant.org/version/2/1/code_of_conduct.html][v2.1]. + +Community Impact Guidelines were inspired by [Mozilla's code of conduct +enforcement ladder][mozilla coc]. + +For answers to common questions about this code of conduct, see the FAQ at +[https://www.contributor-covenant.org/faq][faq]. Translations are available at +[https://www.contributor-covenant.org/translations][translations]. + +[homepage]: https://www.contributor-covenant.org +[v2.1]: https://www.contributor-covenant.org/version/2/1/code_of_conduct.html +[mozilla coc]: https://github.com/mozilla/diversity +[faq]: https://www.contributor-covenant.org/faq +[translations]: https://www.contributor-covenant.org/translations diff --git a/vendor/github.com/ory/dockertest/v4/CONTRIBUTING.md b/vendor/github.com/ory/dockertest/v4/CONTRIBUTING.md new file mode 100644 index 00000000..e7949241 --- /dev/null +++ b/vendor/github.com/ory/dockertest/v4/CONTRIBUTING.md @@ -0,0 +1,253 @@ + + + +# Contribute to Ory Dockertest + + + + +- [Introduction](#introduction) +- [FAQ](#faq) +- [How can I contribute?](#how-can-i-contribute) +- [Communication](#communication) +- [Contribute examples or community projects](#contribute-examples-or-community-projects) +- [Contribute code](#contribute-code) +- [Contribute documentation](#contribute-documentation) +- [Disclosing vulnerabilities](#disclosing-vulnerabilities) +- [Code style](#code-style) + - [Working with forks](#working-with-forks) +- [Conduct](#conduct) + + + +## Introduction + +_Please note_: We take Ory Dockertest's security and our users' trust very +seriously. If you believe you have found a security issue in Ory Dockertest, +please disclose it by contacting us at security@ory.com. + +There are many ways in which you can contribute. The goal of this document is to +provide a high-level overview of how you can get involved in Ory. + +As a potential contributor, your changes and ideas are welcome at any hour of +the day or night, on weekdays, weekends, and holidays. Please do not ever +hesitate to ask a question or send a pull request. + +If you are unsure, just ask or submit the issue or pull request anyways. You +won't be yelled at for giving it your best effort. The worst that can happen is +that you'll be politely asked to change something. We appreciate any sort of +contributions and don't want a wall of rules to get in the way of that. + +That said, if you want to ensure that a pull request is likely to be merged, +talk to us! You can find out our thoughts and ensure that your contribution +won't clash with Ory +Dockertest's direction. A great way to +do this is via +[Ory Dockertest Discussions](https://github.com/orgs/ory/discussions) +or the [Ory Chat](https://www.ory.com/chat). + +## FAQ + +- I am new to the community. Where can I find the + [Ory Community Code of Conduct?](https://github.com/ory/dockertest/blob/master/CODE_OF_CONDUCT.md) + +- I have a question. Where can I get + [answers to questions regarding Ory Dockertest?](#communication) + +- I would like to contribute but I am not sure how. Are there + [easy ways to contribute?](#how-can-i-contribute) + [Or good first issues?](https://github.com/search?l=&o=desc&q=label%3A%22help+wanted%22+label%3A%22good+first+issue%22+is%3Aopen+user%3Aory+user%3Aory-corp&s=updated&type=Issues) + +- I want to talk to other Ory Dockertest users. + [How can I become a part of the community?](#communication) + +- I would like to know what I am agreeing to when I contribute to Ory + Dockertest. + Does Ory have + [a Contributors License Agreement?](https://cla-assistant.io/ory/dockertest) + +- I would like updates about new versions of Ory Dockertest. + [How are new releases announced?](https://www.ory.com/l/sign-up-newsletter) + +## How can I contribute? + +If you want to start to contribute code right away, take a look at the +[list of good first issues](https://github.com/ory/dockertest/labels/good%20first%20issue). + +There are many other ways you can contribute. Here are a few things you can do +to help out: + +- **Give us a star.** It may not seem like much, but it really makes a + difference. This is something that everyone can do to help out Ory Dockertest. + Github stars help the project gain visibility and stand out. + +- **Join the community.** Sometimes helping people can be as easy as listening + to their problems and offering a different perspective. Join our Slack, have a + look at discussions in the forum and take part in community events. More info + on this in [Communication](#communication). + +- **Answer discussions.** At all times, there are several unanswered discussions + on GitHub. You can see an + [overview here](https://github.com/discussions?discussions_q=is%3Aunanswered+org%3Aory+sort%3Aupdated-desc). + If you think you know an answer or can provide some information that might + help, please share it! Bonus: You get GitHub achievements for answered + discussions. + +- **Help with open issues.** We have a lot of open issues for Ory Dockertest and + some of them may lack necessary information, some are duplicates of older + issues. You can help out by guiding people through the process of filling out + the issue template, asking for clarifying information or pointing them to + existing issues that match their description of the problem. + +- **Review documentation changes.** Most documentation just needs a review for + proper spelling and grammar. If you think a document can be improved in any + way, feel free to hit the `edit` button at the top of the page. More info on + contributing to the documentation [here](#contribute-documentation). + +- **Help with tests.** Pull requests may lack proper tests or test plans. These + are needed for the change to be implemented safely. + +## Communication + +We use [Slack](https://www.ory.com/chat). You are welcome to drop in and ask +questions, discuss bugs and feature requests, talk to other users of Ory, etc. + +Check out [Ory Dockertest Discussions](https://github.com/orgs/ory/discussions). This is a great place for +in-depth discussions and lots of code examples, logs and similar data. + +You can also join our community calls if you want to speak to the Ory team +directly or ask some questions. You can find more info and participate in +[Slack](https://www.ory.com/chat) in the #community-call channel. + +If you want to receive regular notifications about updates to Ory Dockertest, +consider joining the mailing list. We will _only_ send you vital information on +the projects that you are interested in. + +Also, [follow us on Twitter](https://twitter.com/orycorp). + +## Contribute examples or community projects + +One of the most impactful ways to contribute is by adding code examples or other +Ory-related code. You can find an overview of community code in the +[awesome-ory](https://github.com/ory/awesome-ory) repository. + +_If you would like to contribute a new example, we would love to hear from you!_ + +Please [open a pull request at awesome-ory](https://github.com/ory/awesome-ory/) +to add your example or Ory-related project to the awesome-ory README. + +## Contribute code + +Unless you are fixing a known bug, we **strongly** recommend discussing it with +the core team via a GitHub issue or [in our chat](https://www.ory.com/chat) +before getting started to ensure your work is consistent with Ory Dockertest's +roadmap and architecture. + +All contributions are made via pull requests. To make a pull request, you will +need a GitHub account; if you are unclear on this process, see GitHub's +documentation on [forking](https://help.github.com/articles/fork-a-repo) and +[pull requests](https://help.github.com/articles/using-pull-requests). Pull +requests should be targeted at the `master` branch. Before creating a pull +request, go through this checklist: + +1. Create a feature branch off of `master` so that changes do not get mixed up. +1. [Rebase](http://git-scm.com/book/en/Git-Branching-Rebasing) your local + changes against the `master` branch. +1. Run the full project test suite with the `go test -tags sqlite ./...` (or + equivalent) command and confirm that it passes. +1. Run `make format` +1. Add a descriptive prefix to commits. This ensures a uniform commit history + and helps structure the changelog. Please refer to this + [Convential Commits configuration](https://github.com/ory/dockertest/blob/master/.github/workflows/conventional_commits.yml) + for the list of accepted prefixes. You can read more about the Conventional + Commit specification + [at their site](https://www.conventionalcommits.org/en/v1.0.0/). + +If a pull request is not ready to be reviewed yet +[it should be marked as a "Draft"](https://docs.github.com/en/github/collaborating-with-pull-requests/proposing-changes-to-your-work-with-pull-requests/changing-the-stage-of-a-pull-request). + +Before your contributions can be reviewed you need to sign our +[Contributor License Agreement](https://cla-assistant.io/ory/dockertest). + +This agreement defines the terms under which your code is contributed to Ory. +More specifically it declares that you have the right to, and actually do, grant +us the rights to use your contribution. You can see the Apache 2.0 license under +which our projects are published +[here](https://github.com/ory/meta/blob/master/LICENSE). + +When pull requests fail the automated testing stages (for example unit or E2E +tests), authors are expected to update their pull requests to address the +failures until the tests pass. + +Pull requests eligible for review + +1. follow the repository's code formatting conventions; +2. include tests that prove that the change works as intended and does not add + regressions; +3. document the changes in the code and/or the project's documentation; +4. pass the CI pipeline; +5. have signed our + [Contributor License Agreement](https://cla-assistant.io/ory/dockertest); +6. include a proper git commit message following the + [Conventional Commit Specification](https://www.conventionalcommits.org/en/v1.0.0/). + +If all of these items are checked, the pull request is ready to be reviewed and +you should change the status to "Ready for review" and +[request review from a maintainer](https://docs.github.com/en/github/collaborating-with-pull-requests/proposing-changes-to-your-work-with-pull-requests/requesting-a-pull-request-review). + +Reviewers will approve the pull request once they are satisfied with the patch. + +## Contribute documentation + +Please provide documentation when changing, removing, or adding features. All +Ory Documentation resides in the +[Ory documentation repository](https://github.com/ory/docs/). For further +instructions please head over to the Ory Documentation +[README.md](https://github.com/ory/docs/blob/master/README.md). + +## Disclosing vulnerabilities + +Please disclose vulnerabilities exclusively to +[security@ory.com](mailto:security@ory.com). Do not use GitHub issues. + +## Code style + +Please run `make format` to format all source code following the Ory standard. + +### Working with forks + +```bash +# First you clone the original repository +git clone git@github.com:ory/ory/dockertest.git + +# Next you add a git remote that is your fork: +git remote add fork git@github.com:/ory/dockertest.git + +# Next you fetch the latest changes from origin for master: +git fetch origin +git checkout master +git pull --rebase + +# Next you create a new feature branch off of master: +git checkout my-feature-branch + +# Now you do your work and commit your changes: +git add -A +git commit -a -m "fix: this is the subject line" -m "This is the body line. Closes #123" + +# And the last step is pushing this to your fork +git push -u fork my-feature-branch +``` + +Now go to the project's GitHub Pull Request page and click "New pull request" + +## Conduct + +Whether you are a regular contributor or a newcomer, we care about making this +community a safe place for you and we've got your back. + +[Ory Community Code of Conduct](https://github.com/ory/dockertest/blob/master/CODE_OF_CONDUCT.md) + +We welcome discussion about creating a welcoming, safe, and productive +environment for the community. If you have any questions, feedback, or concerns +[please let us know](https://www.ory.com/chat). diff --git a/vendor/github.com/ory/dockertest/v4/LICENSE b/vendor/github.com/ory/dockertest/v4/LICENSE new file mode 100644 index 00000000..261eeb9e --- /dev/null +++ b/vendor/github.com/ory/dockertest/v4/LICENSE @@ -0,0 +1,201 @@ + Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + + TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + + 1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + + 2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + + 3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + + 4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + + 5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + + 6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + + 7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + + 8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + + 9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + + END OF TERMS AND CONDITIONS + + APPENDIX: How to apply the Apache License to your work. + + To apply the Apache License to your work, attach the following + boilerplate notice, with the fields enclosed by brackets "[]" + replaced with your own identifying information. (Don't include + the brackets!) The text should be enclosed in the appropriate + comment syntax for the file format. We also recommend that a + file or class name and description of purpose be included on the + same "printed page" as the copyright notice for easier + identification within third-party archives. + + Copyright [yyyy] [name of copyright owner] + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. diff --git a/vendor/github.com/ory/dockertest/v4/Makefile b/vendor/github.com/ory/dockertest/v4/Makefile new file mode 100644 index 00000000..257441b3 --- /dev/null +++ b/vendor/github.com/ory/dockertest/v4/Makefile @@ -0,0 +1,26 @@ +format: .bin/ory node_modules # formats the source code + .bin/ory dev headers copyright --type=open-source + gofmt -l -s -w . + npm exec -- prettier --write . + +lint: # runs golangci-lint + @echo "Linting..." + golangci-lint run --config=.golangci.yml ./... + +licenses: .bin/licenses node_modules # checks open-source licenses + .bin/licenses + +.bin/licenses: Makefile + curl https://raw.githubusercontent.com/ory/ci/master/licenses/install | sh + +.bin/ory: Makefile + curl https://raw.githubusercontent.com/ory/meta/master/install.sh | bash -s -- -b .bin ory v0.3.2 + touch .bin/ory + +node_modules: package-lock.json + npm install + touch node_modules + +test: + go vet ./... + go test -covermode=atomic -coverprofile="coverage.out" . diff --git a/vendor/github.com/ory/dockertest/v4/README.md b/vendor/github.com/ory/dockertest/v4/README.md new file mode 100644 index 00000000..109001da --- /dev/null +++ b/vendor/github.com/ory/dockertest/v4/README.md @@ -0,0 +1,551 @@ +

ORY Dockertest

+ +[![CI](https://github.com/ory/dockertest/actions/workflows/test.yml/badge.svg)](https://github.com/ory/dockertest/actions/workflows/test.yml) + +Use Docker to run your Go integration tests against third party services on +**Windows, macOS, and Linux**! + +Dockertest supports running any Docker image from Docker Hub or from a +Dockerfile. + + + + +- [Why should I use Dockertest?](#why-should-i-use-dockertest) +- [Installation](#installation) +- [Quick Start](#quick-start) +- [Migration from v3](#migration-from-v3) +- [API overview](#api-overview) + - [Pool creation](#pool-creation) + - [Running containers](#running-containers) + - [Container configuration](#container-configuration) + - [Container reuse](#container-reuse) + - [Getting connection info](#getting-connection-info) + - [Waiting for readiness](#waiting-for-readiness) + - [Executing commands](#executing-commands) + - [Container logs](#container-logs) + - [Building from Dockerfile](#building-from-dockerfile) + - [Networks](#networks) + - [Cleanup](#cleanup) + - [Error handling](#error-handling) +- [Examples](#examples) +- [Troubleshoot & FAQ](#troubleshoot--faq) + - [Out of disk space](#out-of-disk-space) +- [Running in CI](#running-in-ci) + - [GitHub Actions](#github-actions) + - [GitLab CI](#gitlab-ci) + - [Shared runners](#shared-runners) + - [Custom (group) runners](#custom-group-runners) + + + +## Why should I use Dockertest? + +When developing applications, it is often necessary to use services that talk to +a database system. Unit testing these services can be cumbersome because mocking +database/DBAL is strenuous. Making slight changes to the schema implies +rewriting at least some, if not all mocks. The same goes for API changes in the +DBAL. + +To avoid this, it is smarter to test these specific services against a real +database that is destroyed after testing. Docker is the perfect system for +running integration tests as you can spin up containers in a few seconds and +kill them when the test completes. + +The Dockertest library provides easy to use commands for spinning up Docker +containers and using them for your tests. + +> [!WARNING] +> +> Dockertest v4 is not yet finalized and may still receive breaking changes +> before the stable release. + +## Installation + +```bash +go get github.com/ory/dockertest/v4 +``` + +## Quick Start + +```go +package myapp_test + +import ( + "testing" + "time" + + dockertest "github.com/ory/dockertest/v4" +) + +func TestPostgres(t *testing.T) { + pool := dockertest.NewPoolT(t, "") + + // Container is automatically reused across test runs based on "postgres:14". + postgres := pool.RunT(t, "postgres", + dockertest.WithTag("14"), + dockertest.WithEnv([]string{ + "POSTGRES_PASSWORD=secret", + "POSTGRES_DB=testdb", + }), + ) + + hostPort := postgres.GetHostPort("5432/tcp") + // Connect to postgres://postgres:secret@hostPort/testdb + + // Wait for PostgreSQL to be ready + err := pool.Retry(t.Context(), 30*time.Second, func() error { + // try connecting... + return nil + }) + if err != nil { + t.Fatalf("Could not connect: %v", err) + } +} +``` + +## Migration from v3 + +Version 4 introduces automatic container reuse, making tests significantly +faster by reusing containers across test runs. Additionally, a lightweight +docker client is used which reduces third party dependencies significantly. + +See [UPGRADE.md](UPGRADE.md) for the complete migration guide. + +## API overview + +View the Go +[API documentation](https://pkg.go.dev/github.com/ory/dockertest/v4). + +### Pool creation + +```go +// For tests - auto-cleanup with t.Cleanup() +pool := dockertest.NewPoolT(t, "") + +// With options +pool := dockertest.NewPoolT(t, "", + dockertest.WithMaxWait(2*time.Minute), +) + +// With a custom Docker client +pool := dockertest.NewPoolT(t, "", + dockertest.WithMobyClient(myClient), +) + +// For non-test code - requires manual Close() +ctx := context.Background() +pool, err := dockertest.NewPool(ctx, "") +if err != nil { + panic(err) +} +defer pool.Close(ctx) +``` + +### Running containers + +```go +// Test helper - fails test on error +resource := pool.RunT(t, "postgres", + dockertest.WithTag("14"), + dockertest.WithEnv([]string{"POSTGRES_PASSWORD=secret"}), + dockertest.WithCmd([]string{"postgres", "-c", "log_statement=all"}), +) + +// With error handling +resource, err := pool.Run(ctx, "postgres", + dockertest.WithTag("14"), + dockertest.WithEnv([]string{"POSTGRES_PASSWORD=secret"}), +) +if err != nil { + panic(err) +} +``` + +> See [Cleanup](#cleanup) for container lifecycle management. + +### Container configuration + +Customize container settings with configuration options: + +```go +resource := pool.RunT(t, "postgres", + dockertest.WithTag("14"), + dockertest.WithUser("postgres"), + dockertest.WithWorkingDir("/var/lib/postgresql/data"), + dockertest.WithLabels(map[string]string{ + "test": "integration", + "service": "database", + }), + dockertest.WithHostname("test-db"), + dockertest.WithEnv([]string{"POSTGRES_PASSWORD=secret"}), +) +``` + +Available configuration options: + +- `WithTag(tag string)` - Set the image tag (default: `"latest"`) +- `WithEnv(env []string)` - Set environment variables +- `WithCmd(cmd []string)` - Override the default command +- `WithEntrypoint(entrypoint []string)` - Override the default entrypoint +- `WithUser(user string)` - Set the user to run commands as (supports "user" or + "user:group") +- `WithWorkingDir(dir string)` - Set the working directory +- `WithLabels(labels map[string]string)` - Add labels to the container +- `WithHostname(hostname string)` - Set the container hostname +- `WithName(name string)` - Set the container name +- `WithMounts(binds []string)` - Set bind mounts ("host:container" or + "host:container:mode") +- `WithPortBindings(bindings network.PortMap)` - Set explicit port bindings +- `WithReuseID(id string)` - Set a custom reuse key (default: + `"repository:tag"`) +- `WithoutReuse()` - Disable container reuse for this run +- `WithContainerConfig(modifier func(*container.Config))` - Modify the container + config directly +- `WithHostConfig(modifier func(*container.HostConfig))` - Modify the host + config (port bindings, volumes, restart policy, memory/CPU limits) + +For advanced container configuration, use `WithContainerConfig`: + +```go +stopTimeout := 30 +resource := pool.RunT(t, "app", + dockertest.WithContainerConfig(func(cfg *container.Config) { + cfg.StopTimeout = &stopTimeout + cfg.StopSignal = "SIGTERM" + cfg.Healthcheck = &container.HealthConfig{ + Test: []string{"CMD", "curl", "-f", "http://localhost/health"}, + Interval: 10 * time.Second, + Timeout: 5 * time.Second, + Retries: 3, + } + }), +) +``` + +For host-level configuration, use `WithHostConfig`: + +```go +resource := pool.RunT(t, "postgres", + dockertest.WithTag("14"), + dockertest.WithHostConfig(func(hc *container.HostConfig) { + hc.RestartPolicy = container.RestartPolicy{ + Name: container.RestartPolicyOnFailure, + MaximumRetryCount: 3, + } + }), +) +``` + +### Container reuse + +Containers are automatically reused based on `repository:tag`. Reuse is +reference-counted: each `Run`/`RunT` call increments the ref count, and each +`Close`/cleanup decrements it. The container is only removed from Docker when +the last reference is released. + +```go +// First test creates container +r1 := pool.RunT(t, "postgres", dockertest.WithTag("14")) + +// Second test reuses the same container +r2 := pool.RunT(t, "postgres", dockertest.WithTag("14")) + +// r1 and r2 point to the same container +``` + +Disable reuse if needed: + +```go +resource := pool.RunT(t, "postgres", + dockertest.WithTag("14"), + dockertest.WithoutReuse(), // Always create new container +) +``` + +### Getting connection info + +```go +resource := pool.RunT(t, "postgres", dockertest.WithTag("14")) + +// Get host:port (e.g., "127.0.0.1:54320") +hostPort := resource.GetHostPort("5432/tcp") + +// Get just the port (e.g., "54320") +port := resource.GetPort("5432/tcp") + +// Get just the IP (e.g., "127.0.0.1") +ip := resource.GetBoundIP("5432/tcp") + +// Get container ID +id := resource.ID() +``` + +### Waiting for readiness + +Use `pool.Retry` to wait for a container to become ready: + +```go +err := pool.Retry(t.Context(), 30*time.Second, func() error { + return db.Ping() +}) +if err != nil { + t.Fatalf("Container not ready: %v", err) +} +``` + +If timeout is 0, `pool.MaxWait` (default 60s) is used. The retry interval is +fixed at 1 second. + +For more control, use the package-level functions: + +```go +// Fixed interval retry +err := dockertest.Retry(ctx, 30*time.Second, 500*time.Millisecond, func() error { + return db.Ping() +}) + +// Exponential backoff retry +err := dockertest.RetryWithBackoff(ctx, + 30*time.Second, // timeout + 100*time.Millisecond, // initial interval + 5*time.Second, // max interval + func() error { + return db.Ping() + }, +) +``` + +### Executing commands + +Run commands inside a running container: + +```go +result, err := resource.Exec(ctx, []string{"pg_isready", "-U", "postgres"}) +if err != nil { + t.Fatal(err) +} +if result.ExitCode != 0 { + t.Fatalf("command failed: %s", result.StdErr) +} +t.Log(result.StdOut) +``` + +### Container logs + +```go +// Get all logs with stdout and stderr separated +stdout, stderr, err := resource.Logs(ctx) +if err != nil { + t.Fatal(err) +} +t.Log(stdout) +t.Log(stderr) + +// Stream logs until container exits or ctx is cancelled +var buf bytes.Buffer +err = resource.FollowLogs(ctx, &buf, io.Discard) +``` + +### Building from Dockerfile + +Build a Docker image from a Dockerfile and run it: + +```go +version := "1.0.0" +resource, err := pool.BuildAndRun(ctx, "myapp:test", + &dockertest.BuildOptions{ + ContextDir: "./testdata", + Dockerfile: "Dockerfile.test", + BuildArgs: map[string]*string{"VERSION": &version}, + }, + dockertest.WithEnv([]string{"APP_ENV=test"}), +) +if err != nil { + t.Fatal(err) +} +``` + +`BuildAndRunT` is the test helper variant: + +```go +resource := pool.BuildAndRunT(t, "myapp:test", + &dockertest.BuildOptions{ + ContextDir: "./testdata", + }, +) +``` + +### Networks + +Create Docker networks for container-to-container communication: + +```go +net := pool.CreateNetworkT(t, "my-network", nil) + +// Connect a container +err := resource.ConnectToNetwork(ctx, net) + +// Get the container's IP in the network +ip := resource.GetIPInNetwork(net) + +// Disconnect +err := resource.DisconnectFromNetwork(ctx, net) +``` + +With custom options: + +```go +net, err := pool.CreateNetwork(ctx, "my-network", &dockertest.NetworkCreateOptions{ + Driver: "bridge", + Internal: true, +}) +``` + +### Cleanup + +**`NewPoolT` + `RunT` (recommended):** Cleanup is fully automatic. `RunT` +registers cleanup via `t.Cleanup`, and the pool is closed when the test +finishes. Nothing to do. + +```go +func TestDB(t *testing.T) { + pool := dockertest.NewPoolT(t, "") + resource := pool.RunT(t, "postgres", dockertest.WithTag("14")) + // Use resource... cleanup happens automatically when t finishes. +} +``` + +**`NewPool` + `Run`:** Call `resource.Close(ctx)` to release individual +containers, or `pool.Close(ctx)` to release everything: + +```go +ctx := context.Background() +pool, err := dockertest.NewPool(ctx, "") +if err != nil { + panic(err) +} +defer pool.Close(ctx) // releases all tracked containers and networks + +resource, err := pool.Run(ctx, "postgres", dockertest.WithTag("14")) +if err != nil { + panic(err) +} +defer resource.Close(ctx) // or let pool.Close handle it +``` + +**Advanced: shared pool in `TestMain`:** Use this when you need a single pool +shared across all tests in a package: + +```go +func TestMain(m *testing.M) { + ctx := context.Background() + pool, _ := dockertest.NewPool(ctx, "") + code := m.Run() + pool.Close(ctx) + os.Exit(code) +} +``` + +### Error handling + +```go +resource, err := pool.Run(ctx, "postgres", dockertest.WithTag("14")) +if errors.Is(err, dockertest.ErrImagePullFailed) { + // Image could not be pulled +} +if errors.Is(err, dockertest.ErrContainerCreateFailed) { + // Container creation failed +} +if errors.Is(err, dockertest.ErrContainerStartFailed) { + // Container start failed +} +if errors.Is(err, dockertest.ErrClientClosed) { + // Pool or client has been closed +} +``` + +## Examples + +See the [examples directory](./examples) for complete examples. + +## Troubleshoot & FAQ + +### Out of disk space + +Try cleaning up unused containers, images, and volumes: + +```bash +docker system prune -f +``` + +## Running in CI + +### GitHub Actions + +Docker is available by default on GitHub Actions `ubuntu-latest` runners, so no +extra services are needed: + +```yaml +name: Test with Docker + +on: [push] + +jobs: + test: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + + - uses: actions/setup-go@v5 + with: + go-version: "1.24" + + - run: go test -v ./... +``` + +### GitLab CI + +#### Shared runners + +Add the Docker dind service to your job which starts in a sibling container. The +database will be available on host `docker`. Your app should be able to change +the database host through an environment variable. + +```yaml +stages: + - test +go-test: + stage: test + image: golang:1.24 + services: + - docker:dind + variables: + DOCKER_HOST: tcp://docker:2375 + DOCKER_DRIVER: overlay2 + DOCKER_TLS_CERTDIR: "" + YOUR_APP_DB_HOST: docker + script: + - go test ./... +``` + +In your `pool.Retry` callback, use `$YOUR_APP_DB_HOST` instead of localhost when +connecting to the database. + +#### Custom (group) runners + +GitLab runner can be run in docker executor mode to save compatibility with +shared runners: + +```shell +gitlab-runner register -n \ + --url https://gitlab.com/ \ + --registration-token $YOUR_TOKEN \ + --executor docker \ + --description "My Docker Runner" \ + --docker-image "docker:27" \ + --docker-privileged +``` + +The `DOCKER_TLS_CERTDIR: ""` variable in the example above tells the Docker +daemon to start on port 2375 over HTTP (TLS disabled). diff --git a/vendor/github.com/ory/dockertest/v4/SECURITY.md b/vendor/github.com/ory/dockertest/v4/SECURITY.md new file mode 100644 index 00000000..d1764fc7 --- /dev/null +++ b/vendor/github.com/ory/dockertest/v4/SECURITY.md @@ -0,0 +1,56 @@ + + + +# Ory Security Policy + +This policy outlines Ory's security commitments and practices for users across +different licensing and deployment models. + +To learn more about Ory's security service level agreements (SLAs) and +processes, please [contact us](https://www.ory.com/contact/). + +## Ory Network Users + +- **Security SLA:** Ory addresses vulnerabilities in the Ory Network according + to the following guidelines: + - Critical: Typically addressed within 14 days. + - High: Typically addressed within 30 days. + - Medium: Typically addressed within 90 days. + - Low: Typically addressed within 180 days. + - Informational: Addressed as necessary. + These timelines are targets and may vary based on specific circumstances. +- **Release Schedule:** Updates are deployed to the Ory Network as + vulnerabilities are resolved. +- **Version Support:** The Ory Network always runs the latest version, ensuring + up-to-date security fixes. + +## Ory Enterprise License Customers + +- **Security SLA:** Ory addresses vulnerabilities based on their severity: + - Critical: Typically addressed within 14 days. + - High: Typically addressed within 30 days. + - Medium: Typically addressed within 90 days. + - Low: Typically addressed within 180 days. + - Informational: Addressed as necessary. + These timelines are targets and may vary based on specific circumstances. +- **Release Schedule:** Updates are made available as vulnerabilities are + resolved. Ory works closely with enterprise customers to ensure timely updates + that align with their operational needs. +- **Version Support:** Ory may provide security support for multiple versions, + depending on the terms of the enterprise agreement. + +## Apache 2.0 License Users + +- **Security SLA:** Ory does not provide a formal SLA for security issues under + the Apache 2.0 License. +- **Release Schedule:** Releases prioritize new functionality and include fixes + for known security vulnerabilities at the time of release. While major + releases typically occur one to two times per year, Ory does not guarantee a + fixed release schedule. +- **Version Support:** Security patches are only provided for the latest release + version. + +## Reporting a Vulnerability + +For details on how to report security vulnerabilities, visit our +[security policy documentation](https://www.ory.com/docs/ecosystem/security). diff --git a/vendor/github.com/ory/dockertest/v4/UPGRADE.md b/vendor/github.com/ory/dockertest/v4/UPGRADE.md new file mode 100644 index 00000000..ee85ee06 --- /dev/null +++ b/vendor/github.com/ory/dockertest/v4/UPGRADE.md @@ -0,0 +1,492 @@ +# Migration Guide: v3 to v4 + +This guide helps you migrate from dockertest v3 to v4. + +## Why Migrate? + +- **Security**: Removes vendored client with CVE vulnerabilities +- **Performance**: Faster tests with automatic container reuse +- **Modern Go**: Context support, functional options, sentinel errors +- **Lighter**: Official Moby client vs 6000+ lines of vendored code +- **Maintainable**: No vendored dependencies to update manually + +## Key Differences + +| v3 | v4 | +| ----------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------- | +| `pool, err := dockertest.NewPool("")` | `pool := dockertest.NewPoolT(t, "")` | +| `pool.MaxWait = time.Minute` | `dockertest.WithMaxWait(time.Minute)` | +| `resource, err := pool.Run("postgres", "14", []string{"POSTGRES_PASSWORD=secret"})` | `pool.RunT(t, "postgres", dockertest.WithTag("14"), dockertest.WithEnv([]string{"POSTGRES_PASSWORD=secret"}))` | +| `defer pool.Purge(resource)` | Automatic via `NewPoolT` cleanup, or `pool.Close(ctx)` in `TestMain` | +| `pool.Retry(func() error { ... })` | `pool.Retry(ctx, timeout, func() error { ... })` | +| No context support | Context throughout | +| No container reuse | Automatic container reuse by default | +| Generic errors | Sentinel errors (`ErrImagePullFailed`) plus context errors (`context.DeadlineExceeded`) | + +## Breaking Changes + +### Container Expiration + +The `Expire` method from v3 is removed as it was not working as documented / +intended due to Docker API limitations. + +**Workarounds for container cleanup in CI:** + +- Use `pool.Close(ctx)` in `TestMain` to remove all tracked containers and + networks after tests. +- Run `docker container prune -f` as a CI post-step to remove stopped + containers. +- Use `WithLabels` to tag test containers for targeted cleanup: + ```go + resource := pool.RunT(t, "postgres", + dockertest.WithLabels(map[string]string{"ci-run": os.Getenv("CI_RUN_ID")}), + ) + ``` + Then in CI: + `docker container rm $(docker container ls -q --filter label=ci-run=$CI_RUN_ID)` + +### Import Path + +```diff +-import "github.com/ory/dockertest/v3" ++import "github.com/ory/dockertest/v4" +``` + +### Pool Creation + +v4 offers two pool creation patterns for tests. **Choose A or B per package, do +not mix them** — mixing causes double-close or resource leaks. + +**Option A: `NewPoolT` (recommended for most tests — no `TestMain` needed)** + +`NewPoolT` registers cleanup automatically via `t.Cleanup`. All tracked +containers and networks are removed when the test finishes. Self-contained: no +`TestMain` needed. + +```go +// v4 — cleanup is automatic +pool := dockertest.NewPoolT(t, "", + dockertest.WithMaxWait(2 * time.Minute), +) +``` + +**Option B: `NewPool` + `TestMain` (for shared pools — advanced)** + +Use this when you want a single pool shared across all tests in a package. You +must call `pool.Close(ctx)` explicitly. + +```go +// v4 — shared pool, manual cleanup +var pool dockertest.ClosablePool + +func TestMain(m *testing.M) { + ctx := context.Background() + var err error + pool, err = dockertest.NewPool(ctx, "", + dockertest.WithMaxWait(2 * time.Minute), + ) + if err != nil { + panic(err) + } + code := m.Run() + // Close removes all tracked containers/networks and closes the client. + // Call before os.Exit — deferred functions do not run after os.Exit. + pool.Close(ctx) + os.Exit(code) +} +``` + +**Outside tests:** Use `NewPool` with explicit cleanup. + +```go +ctx := context.Background() +pool, err := dockertest.NewPool(ctx, "") +if err != nil { + panic(err) +} +defer pool.Close(ctx) +``` + +> [!NOTE] +> +> The `endpoint` parameter must be empty. v3 accepted Docker endpoint strings +> directly; v4 reads the Docker host from environment variables (`DOCKER_HOST`, +> `DOCKER_TLS_VERIFY`, `DOCKER_CERT_PATH`). If you passed a custom endpoint in +> v3, set `DOCKER_HOST` before calling `NewPool`, or provide a pre-configured +> `*client.Client` from `github.com/moby/moby/client` via `WithMobyClient`. When +> using `WithMobyClient`, the `endpoint` parameter is ignored and the pool will +> not close the client on `pool.Close`. + +### Running Containers + +```go +// v3 +resource, err := pool.Run("postgres", "14", []string{"POSTGRES_PASSWORD=secret"}) +defer pool.Purge(resource) + +// v4 (in tests) — cleanup happens automatically via pool.Close +resource := pool.RunT(t, "postgres", + dockertest.WithTag("14"), + dockertest.WithEnv([]string{"POSTGRES_PASSWORD=secret"}), +) + +// v4 (outside tests) +resource, err := pool.Run(ctx, "postgres", + dockertest.WithTag("14"), + dockertest.WithEnv([]string{"POSTGRES_PASSWORD=secret"}), +) +defer resource.Close(ctx) +``` + +### Retry / Health Check + +The `pool.Retry` signature changed to require context and an explicit timeout. +It retries with a fixed 1-second interval. For custom intervals, use the +package-level helpers. + +```go +// v3 — uses pool.MaxWait implicitly +pool.Retry(func() error { + return db.Ping() +}) + +// v4 — explicit context and timeout (pass 0 to use pool.MaxWait) +// Retries every 1 second. +pool.Retry(ctx, 0, func() error { + return db.Ping() +}) + +// v4 — explicit timeout +pool.Retry(ctx, 30*time.Second, func() error { + return db.Ping() +}) +``` + +Package-level retry helpers with custom intervals: + +```go +// Fixed-interval retry (custom interval) +dockertest.Retry(ctx, 30*time.Second, time.Second, func() error { + return db.Ping() +}) + +// Exponential backoff retry +dockertest.RetryWithBackoff(ctx, 30*time.Second, 100*time.Millisecond, 5*time.Second, func() error { + return db.Ping() +}) +``` + +### Functional Options + +`RunWithOptions` is replaced by functional options: + +```go +// v3 +pool.RunWithOptions(&dockertest.RunOptions{ + Repository: "postgres", + Tag: "14", + Env: []string{"POSTGRES_DB=testdb"}, + Cmd: []string{"postgres", "-c", "log_statement=all"}, +}) + +// v4 +pool.RunT(t, "postgres", + dockertest.WithTag("14"), + dockertest.WithEnv([]string{"POSTGRES_DB=testdb"}), + dockertest.WithCmd([]string{"postgres", "-c", "log_statement=all"}), +) +``` + +Available options: `WithTag`, `WithEnv`, `WithCmd`, `WithEntrypoint`, +`WithUser`, `WithWorkingDir`, `WithLabels`, `WithHostname`, `WithName`, +`WithMounts`, `WithPortBindings`, `WithoutReuse`, `WithReuseID`, +`WithContainerConfig`, `WithHostConfig`. + +> [!NOTE] +> +> `WithPortBindings` takes `network.PortMap` from +> `github.com/moby/moby/api/types/network`. Similarly, `WithContainerConfig` and +> `WithHostConfig` use types from `github.com/moby/moby/api/types/container`. + +### Cleanup Pattern + +See [Pool Creation](#pool-creation) for the full `TestMain` pattern. + +### Error Handling + +Use sentinel errors with `errors.Is()`: + +```go +resource, err := pool.Run(ctx, "postgres", dockertest.WithTag("14")) +if errors.Is(err, dockertest.ErrImagePullFailed) { + // Handle image pull failure +} +if errors.Is(err, context.DeadlineExceeded) { + // Handle timeout +} +``` + +Available sentinel errors: `ErrImagePullFailed`, `ErrContainerCreateFailed`, +`ErrContainerStartFailed`, `ErrClientClosed`. + +## Migration Steps + +1. **Update dependencies:** + + ```bash + go get github.com/ory/dockertest/v4 + go mod tidy + ``` + +2. **Update imports:** + + ```bash + # macOS + find . -name "*.go" -exec sed -i '' 's|github.com/ory/dockertest/v3|github.com/ory/dockertest/v4|g' {} \; + # Linux + find . -name "*.go" -exec sed -i 's|github.com/ory/dockertest/v3|github.com/ory/dockertest/v4|g' {} \; + ``` + +3. **Convert API calls:** + + - `NewPool("")` → `NewPoolT(t, "")` (or `NewPool(ctx, "")` in `TestMain`) + - `Run()`/`RunWithOptions()` → `RunT(t, ...)` with functional options + - `pool.Purge(resource)` → automatic via `NewPoolT`, or `pool.Close(ctx)` in + `TestMain` + - `pool.Retry(fn)` → `pool.Retry(ctx, timeout, fn)` + - For non-reused containers: use `WithoutReuse()` (cleanup is automatic with + `RunT`, or call `resource.Close(ctx)` with `Run`) + - See [Breaking Changes](#breaking-changes) for full patterns. + +4. **Test:** Run `go test ./...` to verify the migration. + +## Common Patterns + +### Single Container Test + +```go +// v3 +func TestDB(t *testing.T) { + pool, _ := dockertest.NewPool("") + resource, _ := pool.Run("postgres", "14", []string{"POSTGRES_PASSWORD=secret"}) + defer pool.Purge(resource) + pool.Retry(func() error { return db.Ping() }) + _ = resource.GetPort("5432/tcp") +} + +// v4 — NewPoolT handles cleanup automatically +func TestDB(t *testing.T) { + pool := dockertest.NewPoolT(t, "") + resource := pool.RunT(t, "postgres", + dockertest.WithTag("14"), + dockertest.WithEnv([]string{"POSTGRES_PASSWORD=secret"}), + ) + pool.Retry(t.Context(), 30*time.Second, func() error { return db.Ping() }) + _ = resource.GetPort("5432/tcp") +} +``` + +### Multiple Containers + +```go +// v3 +pool, _ := dockertest.NewPool("") +db, _ := pool.Run("postgres", "14", []string{"POSTGRES_PASSWORD=secret"}) +defer pool.Purge(db) +cache, _ := pool.Run("redis", "7", nil) +defer pool.Purge(cache) + +// v4 — NewPoolT handles cleanup automatically +pool := dockertest.NewPoolT(t, "") +db := pool.RunT(t, "postgres", + dockertest.WithTag("14"), + dockertest.WithEnv([]string{"POSTGRES_PASSWORD=secret"}), +) +cache := pool.RunT(t, "redis", dockertest.WithTag("7")) +``` + +### Automatic Container Reuse + +> [!WARNING] +> +> Reuse is keyed on `repository:tag` by default. Two calls with the same +> `repo:tag` but **different** env vars, commands, or other options will +> silently return the **same** container. Use `WithReuseID` to distinguish +> containers that share an image but differ in configuration (see +> [Custom Reuse ID](#custom-reuse-id-different-configs) below). + +v4 automatically reuses containers with the same `repo:tag` across tests. Each +`NewPoolT` call creates a separate pool, but containers are still shared because +default pools use a common reuse scope: + +```go +func TestUser(t *testing.T) { + pool := dockertest.NewPoolT(t, "") + db := pool.RunT(t, "postgres", dockertest.WithTag("14")) // Creates container +} + +func TestPost(t *testing.T) { + pool := dockertest.NewPoolT(t, "") + db := pool.RunT(t, "postgres", dockertest.WithTag("14")) // Reuses same container +} +``` + +To opt out of reuse for a specific container: + +```go +resource := pool.RunT(t, "postgres", + dockertest.WithTag("14"), + dockertest.WithoutReuse(), +) +// Cleanup is automatic via RunT +``` + +### Custom Reuse ID (Different Configs) + +```go +// Same image, different configurations using custom reuse IDs +db1 := pool.RunT(t, "postgres", + dockertest.WithTag("14"), + dockertest.WithEnv([]string{"POSTGRES_DB=db1"}), + dockertest.WithReuseID("postgres-db1"), +) + +db2 := pool.RunT(t, "postgres", + dockertest.WithTag("14"), + dockertest.WithEnv([]string{"POSTGRES_DB=db2"}), + dockertest.WithReuseID("postgres-db2"), +) +``` + +### Build and Run Custom Images + +The `name` parameter is used as the image tag for the locally built image (e.g., +`"myapp:test"` tags the image as `myapp:test`). The built image is not pulled +from a registry. + +```go +resource, err := pool.BuildAndRun(ctx, "myapp:test", + &dockertest.BuildOptions{ + ContextDir: "./testdata", + Dockerfile: "Dockerfile.test", + }, + dockertest.WithEnv([]string{"APP_ENV=test"}), +) +if err != nil { + panic(err) +} +defer resource.Close(ctx) + +// Or in tests (cleanup is automatic via NewPoolT): +resource := pool.BuildAndRunT(t, "myapp:test", + &dockertest.BuildOptions{ContextDir: "./testdata"}, +) +``` + +Available `BuildOptions` fields: `ContextDir` (required), `Dockerfile` (defaults +to `"Dockerfile"`), `Tags`, `BuildArgs` (`map[string]*string`), `Labels`, +`NoCache`, `ForceRemove`. + +### Container Networks + +Networks created with `CreateNetworkT` or `CreateNetwork` are tracked by the +pool and cleaned up when `pool.Close` runs (automatic with `NewPoolT`). + +```go +// In tests: +net := pool.CreateNetworkT(t, "test-net", nil) + +db := pool.RunT(t, "postgres", dockertest.WithTag("14")) +db.ConnectToNetwork(t.Context(), net) + +ip := db.GetIPInNetwork(net) // Get container's IP on this network +db.DisconnectFromNetwork(t.Context(), net) + +// Outside tests: +net, err := pool.CreateNetwork(ctx, "test-net", nil) +if err != nil { + panic(err) +} +defer net.Close(ctx) +``` + +Available `NetworkCreateOptions` fields: `Driver` (e.g., `"bridge"`, +`"overlay"`), `Labels`, `Options` (driver-specific), `Internal`, `Attachable`, +`Ingress` (swarm mode), `EnableIPv6`. + +### Exec and Logs + +```go +result, err := resource.Exec(ctx, []string{"pg_isready"}) +// result.StdOut, result.StdErr, result.ExitCode + +stdout, stderr, err := resource.Logs(ctx) +// stdout and stderr are separated strings + +// Stream logs until container exits or ctx is cancelled: +err = resource.FollowLogs(ctx, os.Stdout, os.Stderr) +``` + +### Advanced: Container Registry + +v4 maintains a global in-memory registry for container reuse. You typically do +not need these functions directly — `Pool.Run` and `Pool.RunT` use them +automatically. They are useful for custom cleanup or inspection: + +- `Register(reuseID string, r ClosableResource) error` — stores a resource + (idempotent; keeps existing) +- `Get(reuseID string) (ClosableResource, bool)` — retrieves a resource by reuse + ID +- `GetAll() []ClosableResource` — returns all registered resources +- `ResetRegistry()` — clears the registry (does **not** stop containers) + +### Immediate Cleanup with `CloseT` + +Resources and networks have a `CloseT(t)` method that stops/removes immediately +and calls `t.Fatalf` on error. Use this when you need teardown at a specific +point rather than relying on pool-scoped cleanup: + +```go +resource, err := pool.Run(t.Context(), "postgres", dockertest.WithTag("14"), dockertest.WithoutReuse()) +if err != nil { + t.Fatal(err) +} +// ... use resource ... +resource.CloseT(t) // immediate removal +``` + +> [!NOTE] +> +> `CloseT(t)` removes the container **immediately** and calls `t.Fatalf` on +> error. `Cleanup(t)` registers removal via `t.Cleanup` so it runs when the test +> ends. Use `Cleanup(t)` for non-reused containers that should live for the +> test's duration; use `CloseT(t)` when you need teardown at a specific point. + +## Troubleshooting + +| Issue | Solution | +| -------------------------- | ----------------------------------------------------------- | +| Container not found errors | Use `pool.Close(ctx)` in TestMain instead of manual Purge() | +| Timeout errors | Increase timeout: `dockertest.WithMaxWait(5 * time.Minute)` | +| Context canceled errors | Use `t.Context()` or `context.Background()` appropriately | +| Image pull failures | Check with `errors.Is(err, dockertest.ErrImagePullFailed)` | + +## Need Help? + +- [API Documentation](https://pkg.go.dev/github.com/ory/dockertest/v4) +- [GitHub Issues](https://github.com/ory/dockertest/issues) +- [Examples Directory](examples) + +## Migration Checklist + +- [ ] Updated go.mod with v4 dependency +- [ ] Updated all imports to v4 +- [ ] Converted NewPool to NewPoolT or NewPool with context +- [ ] Converted Run to RunT or Run with context +- [ ] Updated RunWithOptions to use functional options +- [ ] Replaced pool.Purge with pool.Close(ctx) (or NewPoolT auto-cleanup) +- [ ] Updated pool.Retry(fn) to pool.Retry(ctx, timeout, fn) +- [ ] Updated error handling to use errors.Is() +- [ ] Added WithReuseID where same image has different configs +- [ ] Tested all changes +- [ ] Verified container cleanup works correctly diff --git a/vendor/github.com/ory/dockertest/v4/build.go b/vendor/github.com/ory/dockertest/v4/build.go new file mode 100644 index 00000000..9a70802c --- /dev/null +++ b/vendor/github.com/ory/dockertest/v4/build.go @@ -0,0 +1,307 @@ +// Copyright © 2026 Ory Corp +// SPDX-License-Identifier: Apache-2.0 + +package dockertest + +import ( + "archive/tar" + "cmp" + "context" + "encoding/json" + "fmt" + "io" + "os" + "path/filepath" + + "github.com/distribution/reference" + "github.com/moby/moby/api/types/jsonstream" + mobyclient "github.com/moby/moby/client" +) + +// BuildOptions configures image building from a Dockerfile. +// Use with Pool.BuildAndRun to build and run custom Docker images. +// +// Only ContextDir is required. All other fields are optional and have sensible defaults. +// +//nolint:govet // field alignment traded for readability +type BuildOptions struct { + // Dockerfile is the name of the Dockerfile within the ContextDir. + // Defaults to "Dockerfile" if empty. + Dockerfile string + + // ContextDir is the directory containing the Dockerfile and build context. + // This directory will be archived and sent to the Docker daemon. + // REQUIRED - build will fail if empty. + ContextDir string + + // Tags are the tags to apply to the built image. + // If empty, the image name from BuildAndRun will be used. + Tags []string + + // BuildArgs are build-time variables passed to the Dockerfile. + // Use pointers to distinguish between empty string and unset. + // Example: map[string]*string{"VERSION": &versionStr} + BuildArgs map[string]*string + + // Labels are metadata to apply to the built image. + // Example: map[string]string{"version": "1.0", "env": "test"} + Labels map[string]string + + // NoCache disables build cache when set to true. + // Useful for ensuring a clean build. + NoCache bool + + // ForceRemove always removes intermediate containers, even on build failure. + // Useful for keeping the build environment clean. + ForceRemove bool +} + +// BuildAndRun builds a Docker image from a Dockerfile and runs it as a container. +// +// The name parameter is used as the image tag. buildOpts.ContextDir is required. +// The built image is cleaned up on error, but not on success - it will be reused +// for subsequent runs with the same name, making repeated test runs faster. +// +// Example: +// +// resource, err := pool.BuildAndRun(ctx, "myapp:test", +// &dockertest.BuildOptions{ +// ContextDir: "./testdata", +// Dockerfile: "Dockerfile.test", +// }, +// ) +// if err != nil { +// panic(err) +// } +// defer resource.Close(ctx) +func (p *pool) BuildAndRun(ctx context.Context, name string, buildOpts *BuildOptions, runOpts ...RunOption) (ClosableResource, error) { + if buildOpts == nil { + return nil, fmt.Errorf("buildOpts cannot be nil") + } + + if buildOpts.ContextDir == "" { + return nil, fmt.Errorf("buildOpts.ContextDir cannot be empty") + } + + dockerfile := cmp.Or(buildOpts.Dockerfile, "Dockerfile") + + // Create tar archive of build context + buildContext, err := createBuildContext(buildOpts.ContextDir) + if err != nil { + return nil, fmt.Errorf("failed to create build context: %w", err) + } + defer func() { + if closeErr := buildContext.Close(); closeErr != nil && err == nil { + err = closeErr + } + }() + + // Prepare tags + tags := buildOpts.Tags + if len(tags) == 0 { + tags = []string{name} + } + + // Build image + imageBuildOpts := mobyclient.ImageBuildOptions{ + Tags: tags, + Dockerfile: dockerfile, + BuildArgs: buildOpts.BuildArgs, + NoCache: buildOpts.NoCache, + Remove: true, + ForceRemove: buildOpts.ForceRemove, + Labels: buildOpts.Labels, + } + + buildResult, err := p.client.ImageBuild(ctx, buildContext, imageBuildOpts) + if err != nil { + return nil, fmt.Errorf("image build failed: %w", err) + } + defer func() { + _ = buildResult.Body.Close() //nolint:errcheck // Best effort close in defer + }() + + // Consume build response and check for errors in the JSON stream. + // Docker embeds build errors (failed RUN, syntax errors) as {"errorDetail":...} + // messages rather than returning them from ImageBuild directly. + if buildErr := drainBuildStream(buildResult.Body); buildErr != nil { + cleanupCtx := context.WithoutCancel(ctx) + for _, tag := range tags { + _, _ = p.client.ImageRemove(cleanupCtx, tag, mobyclient.ImageRemoveOptions{Force: true}) //nolint:errcheck // Best effort cleanup + } + return nil, fmt.Errorf("image build failed: %w", buildErr) + } + + // Run the built image. + repository, tag, err := splitImageReference(tags[0]) + if err != nil { + return nil, fmt.Errorf("invalid image reference %q: %w", tags[0], err) + } + + // Add noPull option since we just built the image locally. + noPullOpt := RunOption(func(rc *runConfig) error { + rc.noPull = true + return nil + }) + allOpts := make([]RunOption, 0, len(runOpts)+2) + allOpts = append(allOpts, runOpts...) + allOpts = append(allOpts, noPullOpt, WithTag(tag)) + + resource, err := p.Run(ctx, repository, allOpts...) + if err != nil { + cleanupCtx := context.WithoutCancel(ctx) + for _, tag := range tags { + _, _ = p.client.ImageRemove(cleanupCtx, tag, mobyclient.ImageRemoveOptions{Force: true}) //nolint:errcheck // Best effort cleanup + } + return nil, err + } + + return resource, nil +} + +// BuildAndRunT is a test helper that uses t.Context() and calls t.Fatalf on error. +// The returned ManagedResource does not expose Close, CloseT, or Cleanup; +// the resource is automatically cleaned up when the test finishes. +func (p *pool) BuildAndRunT(t TestingTB, name string, buildOpts *BuildOptions, runOpts ...RunOption) Resource { + t.Helper() + + r, err := p.BuildAndRun(t.Context(), name, buildOpts, runOpts...) + if err != nil { + t.Fatalf("BuildAndRunT failed: %v", err) + } + + r.Cleanup(t) + + return r +} + +func splitImageReference(ref string) (repository, tag string, err error) { + named, err := reference.ParseNormalizedNamed(ref) + if err != nil { + return "", "", err + } + + repository = reference.FamiliarName(named) + tag = "latest" + if tagged, ok := named.(reference.Tagged); ok { + tag = tagged.Tag() + } + + return repository, tag, nil +} + +// createBuildContext creates a tar archive of the given directory for Docker build context. +func createBuildContext(contextDir string) (io.ReadCloser, error) { + info, err := os.Stat(contextDir) + if err != nil { + return nil, fmt.Errorf("build context directory: %w", err) + } + if !info.IsDir() { + return nil, fmt.Errorf("build context path %q is not a directory", contextDir) + } + + // Create a pipe for streaming the tar archive + pr, pw := io.Pipe() + + go func() { + tw := tar.NewWriter(pw) + + // Walk the context directory and add files to tar + err := filepath.WalkDir(contextDir, func(path string, d os.DirEntry, err error) error { + if err != nil { + return err + } + + // Get relative path from context directory + relPath, err := filepath.Rel(contextDir, path) + if err != nil { + return err + } + + // Skip the context directory itself + if relPath == "." { + return nil + } + + info, err := d.Info() + if err != nil { + return err + } + + // Resolve symlink target for tar header + var link string + if info.Mode()&os.ModeSymlink != 0 { + link, err = os.Readlink(path) + if err != nil { + return err + } + } + + // Skip non-regular files (devices, sockets, named pipes) + if !info.Mode().IsRegular() && !info.IsDir() && info.Mode()&os.ModeSymlink == 0 { + return nil + } + + // Create tar header + header, err := tar.FileInfoHeader(info, link) + if err != nil { + return err + } + + // Use forward slashes in tar (Docker expects this) + header.Name = filepath.ToSlash(relPath) + + // Write header + if err := tw.WriteHeader(header); err != nil { + return err + } + + // Write file content for regular files only + if info.Mode().IsRegular() { + // #nosec G304 -- path is from filepath.WalkDir of a known build context directory + file, err := os.Open(path) + if err != nil { + return err + } + + if _, err := io.Copy(tw, file); err != nil { + _ = file.Close() //nolint:errcheck // Prioritize returning the copy error + return err + } + if err := file.Close(); err != nil { + return err + } + } + + return nil + }) + + // Close tar writer to flush end-of-archive marker + if closeErr := tw.Close(); closeErr != nil && err == nil { + err = closeErr + } + + // Always signal the pipe reader: nil for EOF, non-nil for error + pw.CloseWithError(err) + }() + + return pr, nil +} + +// drainBuildStream consumes the Docker build JSON stream and returns the first +// error found. Docker embeds build errors (failed RUN commands, syntax errors) +// as {"errorDetail":...} messages in the stream rather than returning them from +// ImageBuild directly. +func drainBuildStream(r io.Reader) error { + dec := json.NewDecoder(r) + for dec.More() { + var msg jsonstream.Message + if err := dec.Decode(&msg); err != nil { + return fmt.Errorf("decoding build stream: %w", err) + } + if msg.Error != nil { + return msg.Error + } + } + return nil +} diff --git a/vendor/github.com/ory/dockertest/v4/doc.go b/vendor/github.com/ory/dockertest/v4/doc.go new file mode 100644 index 00000000..103da8e7 --- /dev/null +++ b/vendor/github.com/ory/dockertest/v4/doc.go @@ -0,0 +1,44 @@ +// Copyright © 2026 Ory Corp +// SPDX-License-Identifier: Apache-2.0 + +// Package dockertest provides Docker container orchestration for Go testing. +// +// Dockertest v4 uses the official github.com/moby/moby/client and provides +// a modern, context-aware API with automatic container reuse for fast tests. +// +// # Quick Start +// +// func TestDatabase(t *testing.T) { +// pool := dockertest.NewPoolT(t, "") +// db := pool.RunT(t, "postgres", +// dockertest.WithTag("14"), +// dockertest.WithEnv([]string{"POSTGRES_PASSWORD=secret"}), +// ) +// db.Cleanup(t) +// +// hostPort := db.GetHostPort("5432/tcp") +// connStr := fmt.Sprintf("postgres://postgres:secret@%s/postgres?sslmode=disable", hostPort) +// +// err := pool.Retry(t.Context(), 30*time.Second, func() error { +// conn, err := sql.Open("postgres", connStr) +// if err != nil { +// return err +// } +// defer conn.Close() +// return conn.Ping() +// }) +// if err != nil { +// t.Fatalf("Database not ready: %v", err) +// } +// } +// +// # Features +// +// - Container reuse: Containers are reused by default based on repository:tag for 2-3x faster tests +// - Context support: All operations accept context.Context for cancellation and timeouts +// - Test helpers: *T methods use t.Context() and t.Cleanup() for simplified test lifecycle +// - Networks: Create networks for container-to-container communication +// - Custom images: Build and run custom Docker images from Dockerfiles +// +// See https://github.com/ory/dockertest for more examples and documentation. +package dockertest diff --git a/vendor/github.com/ory/dockertest/v4/errors.go b/vendor/github.com/ory/dockertest/v4/errors.go new file mode 100644 index 00000000..2f600b1e --- /dev/null +++ b/vendor/github.com/ory/dockertest/v4/errors.go @@ -0,0 +1,19 @@ +// Copyright © 2026 Ory Corp +// SPDX-License-Identifier: Apache-2.0 + +package dockertest + +import "errors" + +// ErrImagePullFailed is returned when pulling a Docker image fails. +var ErrImagePullFailed = errors.New("image pull failed") + +// ErrContainerCreateFailed is returned when container creation fails. +var ErrContainerCreateFailed = errors.New("container creation failed") + +// ErrContainerStartFailed is returned when starting a container fails. +var ErrContainerStartFailed = errors.New("container start failed") + +// ErrClientClosed is returned when an operation is attempted on a resource +// whose pool or client has already been closed. +var ErrClientClosed = errors.New("client is closed") diff --git a/vendor/github.com/ory/dockertest/v4/internal/client/interface.go b/vendor/github.com/ory/dockertest/v4/internal/client/interface.go new file mode 100644 index 00000000..5231b266 --- /dev/null +++ b/vendor/github.com/ory/dockertest/v4/internal/client/interface.go @@ -0,0 +1,45 @@ +// Copyright © 2026 Ory Corp +// SPDX-License-Identifier: Apache-2.0 + +// Package client provides Docker client abstraction for testability. +package client + +import ( + "context" + "io" + + mobyclient "github.com/moby/moby/client" +) + +// DockerClient defines the Docker operations needed by dockertest. +// This interface abstracts github.com/moby/moby/client for testability. +type DockerClient interface { + ContainerCreate(ctx context.Context, options mobyclient.ContainerCreateOptions) (mobyclient.ContainerCreateResult, error) + ContainerStart(ctx context.Context, containerID string, options mobyclient.ContainerStartOptions) (mobyclient.ContainerStartResult, error) + ContainerStop(ctx context.Context, containerID string, options mobyclient.ContainerStopOptions) (mobyclient.ContainerStopResult, error) + ContainerInspect(ctx context.Context, containerID string, options mobyclient.ContainerInspectOptions) (mobyclient.ContainerInspectResult, error) + ContainerRemove(ctx context.Context, containerID string, options mobyclient.ContainerRemoveOptions) (mobyclient.ContainerRemoveResult, error) + ContainerList(ctx context.Context, options mobyclient.ContainerListOptions) (mobyclient.ContainerListResult, error) + ContainerLogs(ctx context.Context, containerID string, options mobyclient.ContainerLogsOptions) (mobyclient.ContainerLogsResult, error) + + ExecCreate(ctx context.Context, containerID string, options mobyclient.ExecCreateOptions) (mobyclient.ExecCreateResult, error) + ExecStart(ctx context.Context, execID string, options mobyclient.ExecStartOptions) (mobyclient.ExecStartResult, error) + ExecInspect(ctx context.Context, execID string, options mobyclient.ExecInspectOptions) (mobyclient.ExecInspectResult, error) + ExecAttach(ctx context.Context, execID string, options mobyclient.ExecAttachOptions) (mobyclient.ExecAttachResult, error) + + ImagePull(ctx context.Context, refStr string, options mobyclient.ImagePullOptions) (mobyclient.ImagePullResponse, error) + ImageInspect(ctx context.Context, imageID string, inspectOpts ...mobyclient.ImageInspectOption) (mobyclient.ImageInspectResult, error) + ImageBuild(ctx context.Context, buildContext io.Reader, options mobyclient.ImageBuildOptions) (mobyclient.ImageBuildResult, error) + ImageRemove(ctx context.Context, imageID string, options mobyclient.ImageRemoveOptions) (mobyclient.ImageRemoveResult, error) + + NetworkCreate(ctx context.Context, name string, options mobyclient.NetworkCreateOptions) (mobyclient.NetworkCreateResult, error) + NetworkInspect(ctx context.Context, networkID string, options mobyclient.NetworkInspectOptions) (mobyclient.NetworkInspectResult, error) + NetworkConnect(ctx context.Context, networkID string, options mobyclient.NetworkConnectOptions) (mobyclient.NetworkConnectResult, error) + NetworkDisconnect(ctx context.Context, networkID string, options mobyclient.NetworkDisconnectOptions) (mobyclient.NetworkDisconnectResult, error) + NetworkRemove(ctx context.Context, networkID string, options mobyclient.NetworkRemoveOptions) (mobyclient.NetworkRemoveResult, error) + NetworkList(ctx context.Context, options mobyclient.NetworkListOptions) (mobyclient.NetworkListResult, error) + + Ping(ctx context.Context, options mobyclient.PingOptions) (mobyclient.PingResult, error) + DaemonHost() string + Close() error +} diff --git a/vendor/github.com/ory/dockertest/v4/internal/client/moby.go b/vendor/github.com/ory/dockertest/v4/internal/client/moby.go new file mode 100644 index 00000000..99ea86c6 --- /dev/null +++ b/vendor/github.com/ory/dockertest/v4/internal/client/moby.go @@ -0,0 +1,27 @@ +// Copyright © 2026 Ory Corp +// SPDX-License-Identifier: Apache-2.0 + +package client + +import ( + "context" + + mobyclient "github.com/moby/moby/client" +) + +// NewMobyClient creates a new Docker client from environment variables. +// It uses DOCKER_HOST, DOCKER_API_VERSION, DOCKER_CERT_PATH, and DOCKER_TLS_VERIFY. +func NewMobyClient(ctx context.Context) (DockerClient, error) { + c, err := mobyclient.New(mobyclient.FromEnv) + if err != nil { + return nil, err + } + + // Ping to verify connection + if _, err := c.Ping(ctx, mobyclient.PingOptions{}); err != nil { + _ = c.Close() //nolint:errcheck // Prioritize returning the ping error + return nil, err + } + + return c, nil +} diff --git a/vendor/github.com/ory/dockertest/v4/network.go b/vendor/github.com/ory/dockertest/v4/network.go new file mode 100644 index 00000000..55947ab7 --- /dev/null +++ b/vendor/github.com/ory/dockertest/v4/network.go @@ -0,0 +1,196 @@ +// Copyright © 2026 Ory Corp +// SPDX-License-Identifier: Apache-2.0 + +package dockertest + +import ( + "context" + "fmt" + "hash/fnv" + "net/netip" + "strings" + + "github.com/containerd/errdefs" + mobynetwork "github.com/moby/moby/api/types/network" + mobyclient "github.com/moby/moby/client" +) + +// Network provides access to a Docker network. +// Returned by CreateNetworkT; does not expose Close or CloseT. +type Network interface { + ID() string + Inspect() mobynetwork.Inspect +} + +// ClosableNetwork extends Network with explicit lifecycle management. +// Returned by CreateNetwork; the caller is responsible for calling Close. +type ClosableNetwork interface { + Network + Close(ctx context.Context) error + CloseT(t TestingTB) +} + +// dockerNetwork represents a Docker network managed by dockertest. +type dockerNetwork struct { + pool *pool + inspect mobynetwork.Inspect +} + +// ID returns the network ID. +func (n *dockerNetwork) ID() string { + return n.inspect.ID +} + +// Inspect returns the network inspection response. +func (n *dockerNetwork) Inspect() mobynetwork.Inspect { + return n.inspect +} + +// NetworkCreateOptions holds options for creating a network. +// This is a subset of mobyclient.NetworkCreateOptions from github.com/moby/moby/client +// to provide a simpler API while allowing common customizations. +// +// All fields are optional. If not specified, Docker's defaults are used: +// - Driver defaults to "bridge" +// - Internal defaults to false (network has external access) +// - Attachable defaults to false +// - EnableIPv6 defaults to false +// +//nolint:govet // field alignment traded for readability +type NetworkCreateOptions struct { + Driver string // Network driver (e.g., "bridge", "overlay") + Labels map[string]string // User-defined metadata + Options map[string]string // Driver-specific options + Internal bool // Restrict external access to the network + Attachable bool // Enable manual container attachment + Ingress bool // Create an ingress network (swarm mode) + EnableIPv6 bool // Enable IPv6 networking +} + +// CreateNetwork creates a new Docker network with the given name and options. +// If opts is nil, default network options are used (bridge driver, external access allowed). +func (p *pool) CreateNetwork(ctx context.Context, name string, opts *NetworkCreateOptions) (ClosableNetwork, error) { + createOpts := mobyclient.NetworkCreateOptions{} + + if opts != nil { + createOpts.Driver = opts.Driver + createOpts.Internal = opts.Internal + createOpts.Attachable = opts.Attachable + createOpts.Ingress = opts.Ingress + if opts.EnableIPv6 { + enableIPv6 := true + createOpts.EnableIPv6 = &enableIPv6 + } + createOpts.Labels = opts.Labels + createOpts.Options = opts.Options + } + + createResp, err := p.client.NetworkCreate(ctx, name, createOpts) + if err != nil { + createResp, err = p.retryNetworkCreateWithCustomSubnet(ctx, name, createOpts, err) + if err != nil { + return nil, err + } + } + + inspectResp, err := p.client.NetworkInspect(ctx, createResp.ID, mobyclient.NetworkInspectOptions{}) + if err != nil { + _, _ = p.client.NetworkRemove(ctx, createResp.ID, mobyclient.NetworkRemoveOptions{}) //nolint:errcheck // Best effort cleanup + return nil, err + } + + net := &dockerNetwork{ + pool: p, + inspect: inspectResp.Network, + } + p.trackNetwork(net) + + return net, nil +} + +func (p *pool) retryNetworkCreateWithCustomSubnet( + ctx context.Context, + name string, + createOpts mobyclient.NetworkCreateOptions, + createErr error, +) (mobyclient.NetworkCreateResult, error) { + // NOTE: Error string matching is fragile and may break across Docker versions. + // Tested against Docker Engine 27.x. There is no structured error type for this. + if createOpts.IPAM != nil || !strings.Contains(createErr.Error(), "all predefined address pools have been fully subnetted") { + return mobyclient.NetworkCreateResult{}, createErr + } + + h := fnv.New64a() + h.Write([]byte(name)) + seed := int64(h.Sum64()) + for i := 0; i < 128; i++ { + thirdOctet := (int(seed>>8) + i) % 256 + secondOctet := 16 + ((int(seed>>16) + i) % 16) // 172.16.0.0/12 private range + subnet := fmt.Sprintf("172.%d.%d.0/24", secondOctet, thirdOctet) + prefix, err := netip.ParsePrefix(subnet) + if err != nil { + continue + } + + retryOpts := createOpts + retryOpts.IPAM = &mobynetwork.IPAM{ + Driver: "default", + Config: []mobynetwork.IPAMConfig{ + {Subnet: prefix}, + }, + } + + createResp, err := p.client.NetworkCreate(ctx, name, retryOpts) + if err == nil { + return createResp, nil + } + + if strings.Contains(err.Error(), "Pool overlaps with other one on this address space") || + strings.Contains(err.Error(), "all predefined address pools have been fully subnetted") { + continue + } + + return mobyclient.NetworkCreateResult{}, err + } + + return mobyclient.NetworkCreateResult{}, createErr +} + +// CreateNetworkT creates a network using t.Context() and calls t.Fatalf on error. +// The returned Network does not expose Close or CloseT; the network is +// cleaned up automatically when the pool is closed. +func (p *pool) CreateNetworkT(t TestingTB, name string, opts *NetworkCreateOptions) Network { + t.Helper() + + net, err := p.CreateNetwork(t.Context(), name, opts) + if err != nil { + t.Fatalf("CreateNetworkT failed: %v", err) + } + + return net +} + +// Close removes the network. +// Any containers still connected to the network should be disconnected first, +// or the network removal will fail. +func (n *dockerNetwork) Close(ctx context.Context) error { + if n.pool == nil || n.pool.client == nil { + return ErrClientClosed + } + + _, err := n.pool.client.NetworkRemove(ctx, n.inspect.ID, mobyclient.NetworkRemoveOptions{}) + if err != nil && !errdefs.IsNotFound(err) { + return err + } + + n.pool.untrackNetwork(n.inspect.ID) + return nil +} + +// CloseT removes the network and calls t.Fatalf on error. +func (n *dockerNetwork) CloseT(t TestingTB) { + t.Helper() + if err := n.Close(context.WithoutCancel(t.Context())); err != nil { + t.Fatalf("CloseT failed: %v", err) + } +} diff --git a/vendor/github.com/ory/dockertest/v4/options.go b/vendor/github.com/ory/dockertest/v4/options.go new file mode 100644 index 00000000..dae89221 --- /dev/null +++ b/vendor/github.com/ory/dockertest/v4/options.go @@ -0,0 +1,191 @@ +// Copyright © 2026 Ory Corp +// SPDX-License-Identifier: Apache-2.0 + +package dockertest + +import ( + "time" + + "github.com/moby/moby/api/types/container" + "github.com/moby/moby/api/types/network" + "github.com/ory/dockertest/v4/internal/client" +) + +// PoolOption is a functional option for configuring a pool. +// Use with NewPool or NewPoolT to customize pool behavior. +type PoolOption func(*pool) + +// WithMaxWait sets the maximum wait time for operations. +// The default maxWait is 60 seconds. +func WithMaxWait(d time.Duration) PoolOption { + return func(p *pool) { + p.maxWait = d + } +} + +// WithMobyClient sets a custom Docker client. +// When a custom client is provided, the pool will not close it on Close(). +func WithMobyClient(c client.DockerClient) PoolOption { + return func(p *pool) { + p.client = c + p.ownedClient = false + } +} + +// RunOption configures container creation. +// Use with Pool.Run or Pool.RunT to customize how containers are started. +type RunOption func(*runConfig) error + +// runConfig holds container configuration. +// +//nolint:govet // field alignment traded for readability +type runConfig struct { + env []string + cmd []string + entrypoint []string + binds []string + tag string + name string + reuseID string + user string + workingDir string + hostname string + labels map[string]string + portBindings network.PortMap + configModifier func(*container.Config) + hostConfigModifier func(*container.HostConfig) + noReuse bool + noPull bool // skip image pull (for locally built images) +} + +// WithTag sets the image tag. Default is "latest". +func WithTag(tag string) RunOption { + return func(rc *runConfig) error { + rc.tag = tag + return nil + } +} + +// WithEnv sets environment variables for the container. +// Each string should be in "KEY=value" format. +func WithEnv(env []string) RunOption { + return func(rc *runConfig) error { + rc.env = env + return nil + } +} + +// WithCmd sets the container command, overriding the image's default CMD. +func WithCmd(cmd []string) RunOption { + return func(rc *runConfig) error { + rc.cmd = cmd + return nil + } +} + +// WithEntrypoint sets the container entrypoint, overriding the image's default ENTRYPOINT. +func WithEntrypoint(entrypoint []string) RunOption { + return func(rc *runConfig) error { + rc.entrypoint = entrypoint + return nil + } +} + +// WithReuseID sets a custom reuse ID for container reuse. +// By default, containers are reused based on "repository:tag". +func WithReuseID(id string) RunOption { + return func(rc *runConfig) error { + rc.reuseID = id + return nil + } +} + +// WithoutReuse disables container reuse for this run. +// A new container will be created every time. +func WithoutReuse() RunOption { + return func(rc *runConfig) error { + rc.noReuse = true + return nil + } +} + +// WithUser sets the user that will run commands inside the container. +// Supports both "user" and "user:group" formats. +func WithUser(user string) RunOption { + return func(rc *runConfig) error { + rc.user = user + return nil + } +} + +// WithWorkingDir sets the working directory for commands run in the container. +func WithWorkingDir(dir string) RunOption { + return func(rc *runConfig) error { + rc.workingDir = dir + return nil + } +} + +// WithLabels sets labels on the container. +// Labels are useful for marking test containers or adding metadata. +func WithLabels(labels map[string]string) RunOption { + return func(rc *runConfig) error { + rc.labels = labels + return nil + } +} + +// WithHostname sets the container's hostname. +func WithHostname(hostname string) RunOption { + return func(rc *runConfig) error { + rc.hostname = hostname + return nil + } +} + +// WithContainerConfig allows direct modification of the container.Config. +// This is useful for advanced options not covered by other WithXxx functions. +// The modifier is applied after all other options are processed. +func WithContainerConfig(modifier func(*container.Config)) RunOption { + return func(rc *runConfig) error { + rc.configModifier = modifier + return nil + } +} + +// WithHostConfig allows direct modification of the container.HostConfig. +// Use this to set host-level options like port bindings, volume mounts, +// restart policies, memory/CPU limits, or AutoRemove. +// The modifier is applied after the default HostConfig is constructed. +func WithHostConfig(modifier func(*container.HostConfig)) RunOption { + return func(rc *runConfig) error { + rc.hostConfigModifier = modifier + return nil + } +} + +// WithName sets the container name. +func WithName(name string) RunOption { + return func(rc *runConfig) error { + rc.name = name + return nil + } +} + +// WithPortBindings sets explicit port bindings for the container. +// Use network.PortMap to specify the bindings. +func WithPortBindings(bindings network.PortMap) RunOption { + return func(rc *runConfig) error { + rc.portBindings = bindings + return nil + } +} + +// WithMounts sets bind mounts for the container. +// Each string should be in "host:container" or "host:container:mode" format. +func WithMounts(binds []string) RunOption { + return func(rc *runConfig) error { + rc.binds = binds + return nil + } +} diff --git a/vendor/github.com/ory/dockertest/v4/package-lock.json b/vendor/github.com/ory/dockertest/v4/package-lock.json new file mode 100644 index 00000000..dcdee9be --- /dev/null +++ b/vendor/github.com/ory/dockertest/v4/package-lock.json @@ -0,0 +1,1077 @@ +{ + "name": "dockertest", + "lockfileVersion": 2, + "requires": true, + "packages": { + "": { + "devDependencies": { + "license-checker": "^25.0.1", + "ory-prettier-styles": "1.3.0", + "prettier": "2.7.1" + } + }, + "node_modules/abbrev": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/abbrev/-/abbrev-1.1.1.tgz", + "integrity": "sha512-nne9/IiQ/hzIhY6pdDnbBtz7DjPTKrY00P/zvPSm5pOFkl6xuGrGnXn/VtTNNfNtAfZ9/1RtehkszU9qcTii0Q==", + "dev": true + }, + "node_modules/ansi-styles": { + "version": "3.2.1", + "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-3.2.1.tgz", + "integrity": "sha512-VT0ZI6kZRdTh8YyJw3SMbYm/u+NqfsAxEpWO0Pf9sq8/e94WxxOpPKx9FR1FlyCtOVDNOQ+8ntlqFxiRc+r5qA==", + "dev": true, + "dependencies": { + "color-convert": "^1.9.0" + }, + "engines": { + "node": ">=4" + } + }, + "node_modules/array-find-index": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/array-find-index/-/array-find-index-1.0.2.tgz", + "integrity": "sha512-M1HQyIXcBGtVywBt8WVdim+lrNaK7VHp99Qt5pSNziXznKHViIBbXWtfRTpEFpF/c4FdfxNAsCCwPp5phBYJtw==", + "dev": true, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/asap": { + "version": "2.0.6", + "resolved": "https://registry.npmjs.org/asap/-/asap-2.0.6.tgz", + "integrity": "sha512-BSHWgDSAiKs50o2Re8ppvp3seVHXSRM44cdSsT9FfNEUUZLOGWVCsiWaRPWM1Znn+mqZ1OfVZ3z3DWEzSp7hRA==", + "dev": true + }, + "node_modules/balanced-match": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-1.0.2.tgz", + "integrity": "sha512-3oSeUO0TMV67hN1AmbXsK4yaqU7tjiHlbxRDZOpH0KW9+CeX4bRAaX0Anxt0tx2MrpRpWwQaPwIlISEJhYU5Pw==", + "dev": true + }, + "node_modules/brace-expansion": { + "version": "1.1.11", + "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.11.tgz", + "integrity": "sha512-iCuPHDFgrHX7H2vEI/5xpz07zSHB00TpugqhmYtVmMO6518mCuRMoOYFldEBl0g187ufozdaHgWKcYFb61qGiA==", + "dev": true, + "dependencies": { + "balanced-match": "^1.0.0", + "concat-map": "0.0.1" + } + }, + "node_modules/chalk": { + "version": "2.4.2", + "resolved": "https://registry.npmjs.org/chalk/-/chalk-2.4.2.tgz", + "integrity": "sha512-Mti+f9lpJNcwF4tWV8/OrTTtF1gZi+f8FqlyAdouralcFWFQWF2+NgCHShjkCb+IFBLq9buZwE1xckQU4peSuQ==", + "dev": true, + "dependencies": { + "ansi-styles": "^3.2.1", + "escape-string-regexp": "^1.0.5", + "supports-color": "^5.3.0" + }, + "engines": { + "node": ">=4" + } + }, + "node_modules/color-convert": { + "version": "1.9.3", + "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-1.9.3.tgz", + "integrity": "sha512-QfAUtd+vFdAtFQcC8CCyYt1fYWxSqAiK2cSD6zDB8N3cpsEBAvRxp9zOGg6G/SHHJYAT88/az/IuDGALsNVbGg==", + "dev": true, + "dependencies": { + "color-name": "1.1.3" + } + }, + "node_modules/color-name": { + "version": "1.1.3", + "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.3.tgz", + "integrity": "sha512-72fSenhMw2HZMTVHeCA9KCmpEIbzWiQsjN+BHcBbS9vr1mtt+vJjPdksIBNUmKAW8TFUDPJK5SUU3QhE9NEXDw==", + "dev": true + }, + "node_modules/concat-map": { + "version": "0.0.1", + "resolved": "https://registry.npmjs.org/concat-map/-/concat-map-0.0.1.tgz", + "integrity": "sha512-/Srv4dswyQNBfohGpz9o6Yb3Gz3SrUDqBH5rTuhGR7ahtlbYKnVxw2bCFMRljaA7EXHaXZ8wsHdodFvbkhKmqg==", + "dev": true + }, + "node_modules/debug": { + "version": "3.2.7", + "resolved": "https://registry.npmjs.org/debug/-/debug-3.2.7.tgz", + "integrity": "sha512-CFjzYYAi4ThfiQvizrFQevTTXHtnCqWfe7x1AhgEscTz6ZbLbfoLRLPugTQyBth6f8ZERVUSyWHFD/7Wu4t1XQ==", + "dev": true, + "dependencies": { + "ms": "^2.1.1" + } + }, + "node_modules/debuglog": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/debuglog/-/debuglog-1.0.1.tgz", + "integrity": "sha512-syBZ+rnAK3EgMsH2aYEOLUW7mZSY9Gb+0wUMCFsZvcmiz+HigA0LOcq/HoQqVuGG+EKykunc7QG2bzrponfaSw==", + "dev": true, + "engines": { + "node": "*" + } + }, + "node_modules/dezalgo": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/dezalgo/-/dezalgo-1.0.4.tgz", + "integrity": "sha512-rXSP0bf+5n0Qonsb+SVVfNfIsimO4HEtmnIpPHY8Q1UCzKlQrDMfdobr8nJOOsRgWCyMRqeSBQzmWUMq7zvVig==", + "dev": true, + "dependencies": { + "asap": "^2.0.0", + "wrappy": "1" + } + }, + "node_modules/escape-string-regexp": { + "version": "1.0.5", + "resolved": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-1.0.5.tgz", + "integrity": "sha512-vbRorB5FUQWvla16U8R/qgaFIya2qGzwDrNmCZuYKrbdSUMG6I1ZCGQRefkRVhuOkIGVne7BQ35DSfo1qvJqFg==", + "dev": true, + "engines": { + "node": ">=0.8.0" + } + }, + "node_modules/fs.realpath": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/fs.realpath/-/fs.realpath-1.0.0.tgz", + "integrity": "sha512-OO0pH2lK6a0hZnAdau5ItzHPI6pUlvI7jMVnxUQRtw4owF2wk8lOSabtGDCTP4Ggrg2MbGnWO9X8K1t4+fGMDw==", + "dev": true + }, + "node_modules/function-bind": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/function-bind/-/function-bind-1.1.1.tgz", + "integrity": "sha512-yIovAzMX49sF8Yl58fSCWJ5svSLuaibPxXQJFLmBObTuCr0Mf1KiPopGM9NiFjiYBCbfaa2Fh6breQ6ANVTI0A==", + "dev": true + }, + "node_modules/glob": { + "version": "7.2.3", + "resolved": "https://registry.npmjs.org/glob/-/glob-7.2.3.tgz", + "integrity": "sha512-nFR0zLpU2YCaRxwoCJvL6UvCH2JFyFVIvwTLsIf21AuHlMskA1hhTdk+LlYJtOlYt9v6dvszD2BGRqBL+iQK9Q==", + "dev": true, + "dependencies": { + "fs.realpath": "^1.0.0", + "inflight": "^1.0.4", + "inherits": "2", + "minimatch": "^3.1.1", + "once": "^1.3.0", + "path-is-absolute": "^1.0.0" + }, + "engines": { + "node": "*" + }, + "funding": { + "url": "https://github.com/sponsors/isaacs" + } + }, + "node_modules/graceful-fs": { + "version": "4.2.10", + "resolved": "https://registry.npmjs.org/graceful-fs/-/graceful-fs-4.2.10.tgz", + "integrity": "sha512-9ByhssR2fPVsNZj478qUUbKfmL0+t5BDVyjShtyZZLiK7ZDAArFFfopyOTj0M05wE2tJPisA4iTnnXl2YoPvOA==", + "dev": true + }, + "node_modules/has": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/has/-/has-1.0.3.tgz", + "integrity": "sha512-f2dvO0VU6Oej7RkWJGrehjbzMAjFp5/VKPp5tTpWIV4JHHZK1/BxbFRtf/siA2SWTe09caDmVtYYzWEIbBS4zw==", + "dev": true, + "dependencies": { + "function-bind": "^1.1.1" + }, + "engines": { + "node": ">= 0.4.0" + } + }, + "node_modules/has-flag": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-3.0.0.tgz", + "integrity": "sha512-sKJf1+ceQBr4SMkvQnBDNDtf4TXpVhVGateu0t918bl30FnbE2m4vNLX+VWe/dpjlb+HugGYzW7uQXH98HPEYw==", + "dev": true, + "engines": { + "node": ">=4" + } + }, + "node_modules/hosted-git-info": { + "version": "2.8.9", + "resolved": "https://registry.npmjs.org/hosted-git-info/-/hosted-git-info-2.8.9.tgz", + "integrity": "sha512-mxIDAb9Lsm6DoOJ7xH+5+X4y1LU/4Hi50L9C5sIswK3JzULS4bwk1FvjdBgvYR4bzT4tuUQiC15FE2f5HbLvYw==", + "dev": true + }, + "node_modules/inflight": { + "version": "1.0.6", + "resolved": "https://registry.npmjs.org/inflight/-/inflight-1.0.6.tgz", + "integrity": "sha512-k92I/b08q4wvFscXCLvqfsHCrjrF7yiXsQuIVvVE7N82W3+aqpzuUdBbfhWcy/FZR3/4IgflMgKLOsvPDrGCJA==", + "dev": true, + "dependencies": { + "once": "^1.3.0", + "wrappy": "1" + } + }, + "node_modules/inherits": { + "version": "2.0.4", + "resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.4.tgz", + "integrity": "sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ==", + "dev": true + }, + "node_modules/is-core-module": { + "version": "2.11.0", + "resolved": "https://registry.npmjs.org/is-core-module/-/is-core-module-2.11.0.tgz", + "integrity": "sha512-RRjxlvLDkD1YJwDbroBHMb+cukurkDWNyHx7D3oNB5x9rb5ogcksMC5wHCadcXoo67gVr/+3GFySh3134zi6rw==", + "dev": true, + "dependencies": { + "has": "^1.0.3" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/json-parse-even-better-errors": { + "version": "2.3.1", + "resolved": "https://registry.npmjs.org/json-parse-even-better-errors/-/json-parse-even-better-errors-2.3.1.tgz", + "integrity": "sha512-xyFwyhro/JEof6Ghe2iz2NcXoj2sloNsWr/XsERDK/oiPCfaNhl5ONfp+jQdAZRQQ0IJWNzH9zIZF7li91kh2w==", + "dev": true + }, + "node_modules/license-checker": { + "version": "25.0.1", + "resolved": "https://registry.npmjs.org/license-checker/-/license-checker-25.0.1.tgz", + "integrity": "sha512-mET5AIwl7MR2IAKYYoVBBpV0OnkKQ1xGj2IMMeEFIs42QAkEVjRtFZGWmQ28WeU7MP779iAgOaOy93Mn44mn6g==", + "dev": true, + "dependencies": { + "chalk": "^2.4.1", + "debug": "^3.1.0", + "mkdirp": "^0.5.1", + "nopt": "^4.0.1", + "read-installed": "~4.0.3", + "semver": "^5.5.0", + "spdx-correct": "^3.0.0", + "spdx-expression-parse": "^3.0.0", + "spdx-satisfies": "^4.0.0", + "treeify": "^1.1.0" + }, + "bin": { + "license-checker": "bin/license-checker" + } + }, + "node_modules/minimatch": { + "version": "3.1.2", + "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.1.2.tgz", + "integrity": "sha512-J7p63hRiAjw1NDEww1W7i37+ByIrOWO5XQQAzZ3VOcL0PNybwpfmV/N05zFAzwQ9USyEcX6t3UO+K5aqBQOIHw==", + "dev": true, + "dependencies": { + "brace-expansion": "^1.1.7" + }, + "engines": { + "node": "*" + } + }, + "node_modules/minimist": { + "version": "1.2.7", + "resolved": "https://registry.npmjs.org/minimist/-/minimist-1.2.7.tgz", + "integrity": "sha512-bzfL1YUZsP41gmu/qjrEk0Q6i2ix/cVeAhbCbqH9u3zYutS1cLg00qhrD0M2MVdCcx4Sc0UpP2eBWo9rotpq6g==", + "dev": true, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/mkdirp": { + "version": "0.5.6", + "resolved": "https://registry.npmjs.org/mkdirp/-/mkdirp-0.5.6.tgz", + "integrity": "sha512-FP+p8RB8OWpF3YZBCrP5gtADmtXApB5AMLn+vdyA+PyxCjrCs00mjyUozssO33cwDeT3wNGdLxJ5M//YqtHAJw==", + "dev": true, + "dependencies": { + "minimist": "^1.2.6" + }, + "bin": { + "mkdirp": "bin/cmd.js" + } + }, + "node_modules/ms": { + "version": "2.1.3", + "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.3.tgz", + "integrity": "sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA==", + "dev": true + }, + "node_modules/nopt": { + "version": "4.0.3", + "resolved": "https://registry.npmjs.org/nopt/-/nopt-4.0.3.tgz", + "integrity": "sha512-CvaGwVMztSMJLOeXPrez7fyfObdZqNUK1cPAEzLHrTybIua9pMdmmPR5YwtfNftIOMv3DPUhFaxsZMNTQO20Kg==", + "dev": true, + "dependencies": { + "abbrev": "1", + "osenv": "^0.1.4" + }, + "bin": { + "nopt": "bin/nopt.js" + } + }, + "node_modules/normalize-package-data": { + "version": "2.5.0", + "resolved": "https://registry.npmjs.org/normalize-package-data/-/normalize-package-data-2.5.0.tgz", + "integrity": "sha512-/5CMN3T0R4XTj4DcGaexo+roZSdSFW/0AOOTROrjxzCG1wrWXEsGbRKevjlIL+ZDE4sZlJr5ED4YW0yqmkK+eA==", + "dev": true, + "dependencies": { + "hosted-git-info": "^2.1.4", + "resolve": "^1.10.0", + "semver": "2 || 3 || 4 || 5", + "validate-npm-package-license": "^3.0.1" + } + }, + "node_modules/npm-normalize-package-bin": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/npm-normalize-package-bin/-/npm-normalize-package-bin-1.0.1.tgz", + "integrity": "sha512-EPfafl6JL5/rU+ot6P3gRSCpPDW5VmIzX959Ob1+ySFUuuYHWHekXpwdUZcKP5C+DS4GEtdJluwBjnsNDl+fSA==", + "dev": true + }, + "node_modules/once": { + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/once/-/once-1.4.0.tgz", + "integrity": "sha512-lNaJgI+2Q5URQBkccEKHTQOPaXdUxnZZElQTZY0MFUAuaEqe1E+Nyvgdz/aIyNi6Z9MzO5dv1H8n58/GELp3+w==", + "dev": true, + "dependencies": { + "wrappy": "1" + } + }, + "node_modules/ory-prettier-styles": { + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/ory-prettier-styles/-/ory-prettier-styles-1.3.0.tgz", + "integrity": "sha512-Vfn0G6CyLaadwcCamwe1SQCf37ZQfBDgMrhRI70dE/2fbE3Q43/xu7K5c32I5FGt/EliroWty5yBjmdkj0eWug==", + "dev": true + }, + "node_modules/os-homedir": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/os-homedir/-/os-homedir-1.0.2.tgz", + "integrity": "sha512-B5JU3cabzk8c67mRRd3ECmROafjYMXbuzlwtqdM8IbS8ktlTix8aFGb2bAGKrSRIlnfKwovGUUr72JUPyOb6kQ==", + "dev": true, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/os-tmpdir": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/os-tmpdir/-/os-tmpdir-1.0.2.tgz", + "integrity": "sha512-D2FR03Vir7FIu45XBY20mTb+/ZSWB00sjU9jdQXt83gDrI4Ztz5Fs7/yy74g2N5SVQY4xY1qDr4rNddwYRVX0g==", + "dev": true, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/osenv": { + "version": "0.1.5", + "resolved": "https://registry.npmjs.org/osenv/-/osenv-0.1.5.tgz", + "integrity": "sha512-0CWcCECdMVc2Rw3U5w9ZjqX6ga6ubk1xDVKxtBQPK7wis/0F2r9T6k4ydGYhecl7YUBxBVxhL5oisPsNxAPe2g==", + "dev": true, + "dependencies": { + "os-homedir": "^1.0.0", + "os-tmpdir": "^1.0.0" + } + }, + "node_modules/path-is-absolute": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/path-is-absolute/-/path-is-absolute-1.0.1.tgz", + "integrity": "sha512-AVbw3UJ2e9bq64vSaS9Am0fje1Pa8pbGqTTsmXfaIiMpnr5DlDhfJOuLj9Sf95ZPVDAUerDfEk88MPmPe7UCQg==", + "dev": true, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/path-parse": { + "version": "1.0.7", + "resolved": "https://registry.npmjs.org/path-parse/-/path-parse-1.0.7.tgz", + "integrity": "sha512-LDJzPVEEEPR+y48z93A0Ed0yXb8pAByGWo/k5YYdYgpY2/2EsOsksJrq7lOHxryrVOn1ejG6oAp8ahvOIQD8sw==", + "dev": true + }, + "node_modules/prettier": { + "version": "2.7.1", + "resolved": "https://registry.npmjs.org/prettier/-/prettier-2.7.1.tgz", + "integrity": "sha512-ujppO+MkdPqoVINuDFDRLClm7D78qbDt0/NR+wp5FqEZOoTNAjPHWj17QRhu7geIHJfcNhRk1XVQmF8Bp3ye+g==", + "dev": true, + "bin": { + "prettier": "bin-prettier.js" + }, + "engines": { + "node": ">=10.13.0" + }, + "funding": { + "url": "https://github.com/prettier/prettier?sponsor=1" + } + }, + "node_modules/read-installed": { + "version": "4.0.3", + "resolved": "https://registry.npmjs.org/read-installed/-/read-installed-4.0.3.tgz", + "integrity": "sha512-O03wg/IYuV/VtnK2h/KXEt9VIbMUFbk3ERG0Iu4FhLZw0EP0T9znqrYDGn6ncbEsXUFaUjiVAWXHzxwt3lhRPQ==", + "dev": true, + "dependencies": { + "debuglog": "^1.0.1", + "read-package-json": "^2.0.0", + "readdir-scoped-modules": "^1.0.0", + "semver": "2 || 3 || 4 || 5", + "slide": "~1.1.3", + "util-extend": "^1.0.1" + }, + "optionalDependencies": { + "graceful-fs": "^4.1.2" + } + }, + "node_modules/read-package-json": { + "version": "2.1.2", + "resolved": "https://registry.npmjs.org/read-package-json/-/read-package-json-2.1.2.tgz", + "integrity": "sha512-D1KmuLQr6ZSJS0tW8hf3WGpRlwszJOXZ3E8Yd/DNRaM5d+1wVRZdHlpGBLAuovjr28LbWvjpWkBHMxpRGGjzNA==", + "dev": true, + "dependencies": { + "glob": "^7.1.1", + "json-parse-even-better-errors": "^2.3.0", + "normalize-package-data": "^2.0.0", + "npm-normalize-package-bin": "^1.0.0" + } + }, + "node_modules/readdir-scoped-modules": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/readdir-scoped-modules/-/readdir-scoped-modules-1.1.0.tgz", + "integrity": "sha512-asaikDeqAQg7JifRsZn1NJZXo9E+VwlyCfbkZhwyISinqk5zNS6266HS5kah6P0SaQKGF6SkNnZVHUzHFYxYDw==", + "dev": true, + "dependencies": { + "debuglog": "^1.0.1", + "dezalgo": "^1.0.0", + "graceful-fs": "^4.1.2", + "once": "^1.3.0" + } + }, + "node_modules/resolve": { + "version": "1.22.1", + "resolved": "https://registry.npmjs.org/resolve/-/resolve-1.22.1.tgz", + "integrity": "sha512-nBpuuYuY5jFsli/JIs1oldw6fOQCBioohqWZg/2hiaOybXOft4lonv85uDOKXdf8rhyK159cxU5cDcK/NKk8zw==", + "dev": true, + "dependencies": { + "is-core-module": "^2.9.0", + "path-parse": "^1.0.7", + "supports-preserve-symlinks-flag": "^1.0.0" + }, + "bin": { + "resolve": "bin/resolve" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/semver": { + "version": "5.7.1", + "resolved": "https://registry.npmjs.org/semver/-/semver-5.7.1.tgz", + "integrity": "sha512-sauaDf/PZdVgrLTNYHRtpXa1iRiKcaebiKQ1BJdpQlWH2lCvexQdX55snPFyK7QzpudqbCI0qXFfOasHdyNDGQ==", + "dev": true, + "bin": { + "semver": "bin/semver" + } + }, + "node_modules/slide": { + "version": "1.1.6", + "resolved": "https://registry.npmjs.org/slide/-/slide-1.1.6.tgz", + "integrity": "sha512-NwrtjCg+lZoqhFU8fOwl4ay2ei8PaqCBOUV3/ektPY9trO1yQ1oXEfmHAhKArUVUr/hOHvy5f6AdP17dCM0zMw==", + "dev": true, + "engines": { + "node": "*" + } + }, + "node_modules/spdx-compare": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/spdx-compare/-/spdx-compare-1.0.0.tgz", + "integrity": "sha512-C1mDZOX0hnu0ep9dfmuoi03+eOdDoz2yvK79RxbcrVEG1NO1Ph35yW102DHWKN4pk80nwCgeMmSY5L25VE4D9A==", + "dev": true, + "dependencies": { + "array-find-index": "^1.0.2", + "spdx-expression-parse": "^3.0.0", + "spdx-ranges": "^2.0.0" + } + }, + "node_modules/spdx-correct": { + "version": "3.1.1", + "resolved": "https://registry.npmjs.org/spdx-correct/-/spdx-correct-3.1.1.tgz", + "integrity": "sha512-cOYcUWwhCuHCXi49RhFRCyJEK3iPj1Ziz9DpViV3tbZOwXD49QzIN3MpOLJNxh2qwq2lJJZaKMVw9qNi4jTC0w==", + "dev": true, + "dependencies": { + "spdx-expression-parse": "^3.0.0", + "spdx-license-ids": "^3.0.0" + } + }, + "node_modules/spdx-exceptions": { + "version": "2.3.0", + "resolved": "https://registry.npmjs.org/spdx-exceptions/-/spdx-exceptions-2.3.0.tgz", + "integrity": "sha512-/tTrYOC7PPI1nUAgx34hUpqXuyJG+DTHJTnIULG4rDygi4xu/tfgmq1e1cIRwRzwZgo4NLySi+ricLkZkw4i5A==", + "dev": true + }, + "node_modules/spdx-expression-parse": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/spdx-expression-parse/-/spdx-expression-parse-3.0.1.tgz", + "integrity": "sha512-cbqHunsQWnJNE6KhVSMsMeH5H/L9EpymbzqTQ3uLwNCLZ1Q481oWaofqH7nO6V07xlXwY6PhQdQ2IedWx/ZK4Q==", + "dev": true, + "dependencies": { + "spdx-exceptions": "^2.1.0", + "spdx-license-ids": "^3.0.0" + } + }, + "node_modules/spdx-license-ids": { + "version": "3.0.12", + "resolved": "https://registry.npmjs.org/spdx-license-ids/-/spdx-license-ids-3.0.12.tgz", + "integrity": "sha512-rr+VVSXtRhO4OHbXUiAF7xW3Bo9DuuF6C5jH+q/x15j2jniycgKbxU09Hr0WqlSLUs4i4ltHGXqTe7VHclYWyA==", + "dev": true + }, + "node_modules/spdx-ranges": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/spdx-ranges/-/spdx-ranges-2.1.1.tgz", + "integrity": "sha512-mcdpQFV7UDAgLpXEE/jOMqvK4LBoO0uTQg0uvXUewmEFhpiZx5yJSZITHB8w1ZahKdhfZqP5GPEOKLyEq5p8XA==", + "dev": true + }, + "node_modules/spdx-satisfies": { + "version": "4.0.1", + "resolved": "https://registry.npmjs.org/spdx-satisfies/-/spdx-satisfies-4.0.1.tgz", + "integrity": "sha512-WVzZ/cXAzoNmjCWiEluEA3BjHp5tiUmmhn9MK+X0tBbR9sOqtC6UQwmgCNrAIZvNlMuBUYAaHYfb2oqlF9SwKA==", + "dev": true, + "dependencies": { + "spdx-compare": "^1.0.0", + "spdx-expression-parse": "^3.0.0", + "spdx-ranges": "^2.0.0" + } + }, + "node_modules/supports-color": { + "version": "5.5.0", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-5.5.0.tgz", + "integrity": "sha512-QjVjwdXIt408MIiAqCX4oUKsgU2EqAGzs2Ppkm4aQYbjm+ZEWEcW4SfFNTr4uMNZma0ey4f5lgLrkB0aX0QMow==", + "dev": true, + "dependencies": { + "has-flag": "^3.0.0" + }, + "engines": { + "node": ">=4" + } + }, + "node_modules/supports-preserve-symlinks-flag": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/supports-preserve-symlinks-flag/-/supports-preserve-symlinks-flag-1.0.0.tgz", + "integrity": "sha512-ot0WnXS9fgdkgIcePe6RHNk1WA8+muPa6cSjeR3V8K27q9BB1rTE3R1p7Hv0z1ZyAc8s6Vvv8DIyWf681MAt0w==", + "dev": true, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/treeify": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/treeify/-/treeify-1.1.0.tgz", + "integrity": "sha512-1m4RA7xVAJrSGrrXGs0L3YTwyvBs2S8PbRHaLZAkFw7JR8oIFwYtysxlBZhYIa7xSyiYJKZ3iGrrk55cGA3i9A==", + "dev": true, + "engines": { + "node": ">=0.6" + } + }, + "node_modules/util-extend": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/util-extend/-/util-extend-1.0.3.tgz", + "integrity": "sha512-mLs5zAK+ctllYBj+iAQvlDCwoxU/WDOUaJkcFudeiAX6OajC6BKXJUa9a+tbtkC11dz2Ufb7h0lyvIOVn4LADA==", + "dev": true + }, + "node_modules/validate-npm-package-license": { + "version": "3.0.4", + "resolved": "https://registry.npmjs.org/validate-npm-package-license/-/validate-npm-package-license-3.0.4.tgz", + "integrity": "sha512-DpKm2Ui/xN7/HQKCtpZxoRWBhZ9Z0kqtygG8XCgNQ8ZlDnxuQmWhj566j8fN4Cu3/JmbhsDo7fcAJq4s9h27Ew==", + "dev": true, + "dependencies": { + "spdx-correct": "^3.0.0", + "spdx-expression-parse": "^3.0.0" + } + }, + "node_modules/wrappy": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/wrappy/-/wrappy-1.0.2.tgz", + "integrity": "sha512-l4Sp/DRseor9wL6EvV2+TuQn63dMkPjZ/sp9XkghTEbV9KlPS1xUsZ3u7/IQO4wxtcFB4bgpQPRcR3QCvezPcQ==", + "dev": true + } + }, + "dependencies": { + "abbrev": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/abbrev/-/abbrev-1.1.1.tgz", + "integrity": "sha512-nne9/IiQ/hzIhY6pdDnbBtz7DjPTKrY00P/zvPSm5pOFkl6xuGrGnXn/VtTNNfNtAfZ9/1RtehkszU9qcTii0Q==", + "dev": true + }, + "ansi-styles": { + "version": "3.2.1", + "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-3.2.1.tgz", + "integrity": "sha512-VT0ZI6kZRdTh8YyJw3SMbYm/u+NqfsAxEpWO0Pf9sq8/e94WxxOpPKx9FR1FlyCtOVDNOQ+8ntlqFxiRc+r5qA==", + "dev": true, + "requires": { + "color-convert": "^1.9.0" + } + }, + "array-find-index": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/array-find-index/-/array-find-index-1.0.2.tgz", + "integrity": "sha512-M1HQyIXcBGtVywBt8WVdim+lrNaK7VHp99Qt5pSNziXznKHViIBbXWtfRTpEFpF/c4FdfxNAsCCwPp5phBYJtw==", + "dev": true + }, + "asap": { + "version": "2.0.6", + "resolved": "https://registry.npmjs.org/asap/-/asap-2.0.6.tgz", + "integrity": "sha512-BSHWgDSAiKs50o2Re8ppvp3seVHXSRM44cdSsT9FfNEUUZLOGWVCsiWaRPWM1Znn+mqZ1OfVZ3z3DWEzSp7hRA==", + "dev": true + }, + "balanced-match": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-1.0.2.tgz", + "integrity": "sha512-3oSeUO0TMV67hN1AmbXsK4yaqU7tjiHlbxRDZOpH0KW9+CeX4bRAaX0Anxt0tx2MrpRpWwQaPwIlISEJhYU5Pw==", + "dev": true + }, + "brace-expansion": { + "version": "1.1.11", + "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.11.tgz", + "integrity": "sha512-iCuPHDFgrHX7H2vEI/5xpz07zSHB00TpugqhmYtVmMO6518mCuRMoOYFldEBl0g187ufozdaHgWKcYFb61qGiA==", + "dev": true, + "requires": { + "balanced-match": "^1.0.0", + "concat-map": "0.0.1" + } + }, + "chalk": { + "version": "2.4.2", + "resolved": "https://registry.npmjs.org/chalk/-/chalk-2.4.2.tgz", + "integrity": "sha512-Mti+f9lpJNcwF4tWV8/OrTTtF1gZi+f8FqlyAdouralcFWFQWF2+NgCHShjkCb+IFBLq9buZwE1xckQU4peSuQ==", + "dev": true, + "requires": { + "ansi-styles": "^3.2.1", + "escape-string-regexp": "^1.0.5", + "supports-color": "^5.3.0" + } + }, + "color-convert": { + "version": "1.9.3", + "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-1.9.3.tgz", + "integrity": "sha512-QfAUtd+vFdAtFQcC8CCyYt1fYWxSqAiK2cSD6zDB8N3cpsEBAvRxp9zOGg6G/SHHJYAT88/az/IuDGALsNVbGg==", + "dev": true, + "requires": { + "color-name": "1.1.3" + } + }, + "color-name": { + "version": "1.1.3", + "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.3.tgz", + "integrity": "sha512-72fSenhMw2HZMTVHeCA9KCmpEIbzWiQsjN+BHcBbS9vr1mtt+vJjPdksIBNUmKAW8TFUDPJK5SUU3QhE9NEXDw==", + "dev": true + }, + "concat-map": { + "version": "0.0.1", + "resolved": "https://registry.npmjs.org/concat-map/-/concat-map-0.0.1.tgz", + "integrity": "sha512-/Srv4dswyQNBfohGpz9o6Yb3Gz3SrUDqBH5rTuhGR7ahtlbYKnVxw2bCFMRljaA7EXHaXZ8wsHdodFvbkhKmqg==", + "dev": true + }, + "debug": { + "version": "3.2.7", + "resolved": "https://registry.npmjs.org/debug/-/debug-3.2.7.tgz", + "integrity": "sha512-CFjzYYAi4ThfiQvizrFQevTTXHtnCqWfe7x1AhgEscTz6ZbLbfoLRLPugTQyBth6f8ZERVUSyWHFD/7Wu4t1XQ==", + "dev": true, + "requires": { + "ms": "^2.1.1" + } + }, + "debuglog": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/debuglog/-/debuglog-1.0.1.tgz", + "integrity": "sha512-syBZ+rnAK3EgMsH2aYEOLUW7mZSY9Gb+0wUMCFsZvcmiz+HigA0LOcq/HoQqVuGG+EKykunc7QG2bzrponfaSw==", + "dev": true + }, + "dezalgo": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/dezalgo/-/dezalgo-1.0.4.tgz", + "integrity": "sha512-rXSP0bf+5n0Qonsb+SVVfNfIsimO4HEtmnIpPHY8Q1UCzKlQrDMfdobr8nJOOsRgWCyMRqeSBQzmWUMq7zvVig==", + "dev": true, + "requires": { + "asap": "^2.0.0", + "wrappy": "1" + } + }, + "escape-string-regexp": { + "version": "1.0.5", + "resolved": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-1.0.5.tgz", + "integrity": "sha512-vbRorB5FUQWvla16U8R/qgaFIya2qGzwDrNmCZuYKrbdSUMG6I1ZCGQRefkRVhuOkIGVne7BQ35DSfo1qvJqFg==", + "dev": true + }, + "fs.realpath": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/fs.realpath/-/fs.realpath-1.0.0.tgz", + "integrity": "sha512-OO0pH2lK6a0hZnAdau5ItzHPI6pUlvI7jMVnxUQRtw4owF2wk8lOSabtGDCTP4Ggrg2MbGnWO9X8K1t4+fGMDw==", + "dev": true + }, + "function-bind": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/function-bind/-/function-bind-1.1.1.tgz", + "integrity": "sha512-yIovAzMX49sF8Yl58fSCWJ5svSLuaibPxXQJFLmBObTuCr0Mf1KiPopGM9NiFjiYBCbfaa2Fh6breQ6ANVTI0A==", + "dev": true + }, + "glob": { + "version": "7.2.3", + "resolved": "https://registry.npmjs.org/glob/-/glob-7.2.3.tgz", + "integrity": "sha512-nFR0zLpU2YCaRxwoCJvL6UvCH2JFyFVIvwTLsIf21AuHlMskA1hhTdk+LlYJtOlYt9v6dvszD2BGRqBL+iQK9Q==", + "dev": true, + "requires": { + "fs.realpath": "^1.0.0", + "inflight": "^1.0.4", + "inherits": "2", + "minimatch": "^3.1.1", + "once": "^1.3.0", + "path-is-absolute": "^1.0.0" + } + }, + "graceful-fs": { + "version": "4.2.10", + "resolved": "https://registry.npmjs.org/graceful-fs/-/graceful-fs-4.2.10.tgz", + "integrity": "sha512-9ByhssR2fPVsNZj478qUUbKfmL0+t5BDVyjShtyZZLiK7ZDAArFFfopyOTj0M05wE2tJPisA4iTnnXl2YoPvOA==", + "dev": true + }, + "has": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/has/-/has-1.0.3.tgz", + "integrity": "sha512-f2dvO0VU6Oej7RkWJGrehjbzMAjFp5/VKPp5tTpWIV4JHHZK1/BxbFRtf/siA2SWTe09caDmVtYYzWEIbBS4zw==", + "dev": true, + "requires": { + "function-bind": "^1.1.1" + } + }, + "has-flag": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-3.0.0.tgz", + "integrity": "sha512-sKJf1+ceQBr4SMkvQnBDNDtf4TXpVhVGateu0t918bl30FnbE2m4vNLX+VWe/dpjlb+HugGYzW7uQXH98HPEYw==", + "dev": true + }, + "hosted-git-info": { + "version": "2.8.9", + "resolved": "https://registry.npmjs.org/hosted-git-info/-/hosted-git-info-2.8.9.tgz", + "integrity": "sha512-mxIDAb9Lsm6DoOJ7xH+5+X4y1LU/4Hi50L9C5sIswK3JzULS4bwk1FvjdBgvYR4bzT4tuUQiC15FE2f5HbLvYw==", + "dev": true + }, + "inflight": { + "version": "1.0.6", + "resolved": "https://registry.npmjs.org/inflight/-/inflight-1.0.6.tgz", + "integrity": "sha512-k92I/b08q4wvFscXCLvqfsHCrjrF7yiXsQuIVvVE7N82W3+aqpzuUdBbfhWcy/FZR3/4IgflMgKLOsvPDrGCJA==", + "dev": true, + "requires": { + "once": "^1.3.0", + "wrappy": "1" + } + }, + "inherits": { + "version": "2.0.4", + "resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.4.tgz", + "integrity": "sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ==", + "dev": true + }, + "is-core-module": { + "version": "2.11.0", + "resolved": "https://registry.npmjs.org/is-core-module/-/is-core-module-2.11.0.tgz", + "integrity": "sha512-RRjxlvLDkD1YJwDbroBHMb+cukurkDWNyHx7D3oNB5x9rb5ogcksMC5wHCadcXoo67gVr/+3GFySh3134zi6rw==", + "dev": true, + "requires": { + "has": "^1.0.3" + } + }, + "json-parse-even-better-errors": { + "version": "2.3.1", + "resolved": "https://registry.npmjs.org/json-parse-even-better-errors/-/json-parse-even-better-errors-2.3.1.tgz", + "integrity": "sha512-xyFwyhro/JEof6Ghe2iz2NcXoj2sloNsWr/XsERDK/oiPCfaNhl5ONfp+jQdAZRQQ0IJWNzH9zIZF7li91kh2w==", + "dev": true + }, + "license-checker": { + "version": "25.0.1", + "resolved": "https://registry.npmjs.org/license-checker/-/license-checker-25.0.1.tgz", + "integrity": "sha512-mET5AIwl7MR2IAKYYoVBBpV0OnkKQ1xGj2IMMeEFIs42QAkEVjRtFZGWmQ28WeU7MP779iAgOaOy93Mn44mn6g==", + "dev": true, + "requires": { + "chalk": "^2.4.1", + "debug": "^3.1.0", + "mkdirp": "^0.5.1", + "nopt": "^4.0.1", + "read-installed": "~4.0.3", + "semver": "^5.5.0", + "spdx-correct": "^3.0.0", + "spdx-expression-parse": "^3.0.0", + "spdx-satisfies": "^4.0.0", + "treeify": "^1.1.0" + } + }, + "minimatch": { + "version": "3.1.2", + "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.1.2.tgz", + "integrity": "sha512-J7p63hRiAjw1NDEww1W7i37+ByIrOWO5XQQAzZ3VOcL0PNybwpfmV/N05zFAzwQ9USyEcX6t3UO+K5aqBQOIHw==", + "dev": true, + "requires": { + "brace-expansion": "^1.1.7" + } + }, + "minimist": { + "version": "1.2.7", + "resolved": "https://registry.npmjs.org/minimist/-/minimist-1.2.7.tgz", + "integrity": "sha512-bzfL1YUZsP41gmu/qjrEk0Q6i2ix/cVeAhbCbqH9u3zYutS1cLg00qhrD0M2MVdCcx4Sc0UpP2eBWo9rotpq6g==", + "dev": true + }, + "mkdirp": { + "version": "0.5.6", + "resolved": "https://registry.npmjs.org/mkdirp/-/mkdirp-0.5.6.tgz", + "integrity": "sha512-FP+p8RB8OWpF3YZBCrP5gtADmtXApB5AMLn+vdyA+PyxCjrCs00mjyUozssO33cwDeT3wNGdLxJ5M//YqtHAJw==", + "dev": true, + "requires": { + "minimist": "^1.2.6" + } + }, + "ms": { + "version": "2.1.3", + "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.3.tgz", + "integrity": "sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA==", + "dev": true + }, + "nopt": { + "version": "4.0.3", + "resolved": "https://registry.npmjs.org/nopt/-/nopt-4.0.3.tgz", + "integrity": "sha512-CvaGwVMztSMJLOeXPrez7fyfObdZqNUK1cPAEzLHrTybIua9pMdmmPR5YwtfNftIOMv3DPUhFaxsZMNTQO20Kg==", + "dev": true, + "requires": { + "abbrev": "1", + "osenv": "^0.1.4" + } + }, + "normalize-package-data": { + "version": "2.5.0", + "resolved": "https://registry.npmjs.org/normalize-package-data/-/normalize-package-data-2.5.0.tgz", + "integrity": "sha512-/5CMN3T0R4XTj4DcGaexo+roZSdSFW/0AOOTROrjxzCG1wrWXEsGbRKevjlIL+ZDE4sZlJr5ED4YW0yqmkK+eA==", + "dev": true, + "requires": { + "hosted-git-info": "^2.1.4", + "resolve": "^1.10.0", + "semver": "2 || 3 || 4 || 5", + "validate-npm-package-license": "^3.0.1" + } + }, + "npm-normalize-package-bin": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/npm-normalize-package-bin/-/npm-normalize-package-bin-1.0.1.tgz", + "integrity": "sha512-EPfafl6JL5/rU+ot6P3gRSCpPDW5VmIzX959Ob1+ySFUuuYHWHekXpwdUZcKP5C+DS4GEtdJluwBjnsNDl+fSA==", + "dev": true + }, + "once": { + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/once/-/once-1.4.0.tgz", + "integrity": "sha512-lNaJgI+2Q5URQBkccEKHTQOPaXdUxnZZElQTZY0MFUAuaEqe1E+Nyvgdz/aIyNi6Z9MzO5dv1H8n58/GELp3+w==", + "dev": true, + "requires": { + "wrappy": "1" + } + }, + "ory-prettier-styles": { + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/ory-prettier-styles/-/ory-prettier-styles-1.3.0.tgz", + "integrity": "sha512-Vfn0G6CyLaadwcCamwe1SQCf37ZQfBDgMrhRI70dE/2fbE3Q43/xu7K5c32I5FGt/EliroWty5yBjmdkj0eWug==", + "dev": true + }, + "os-homedir": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/os-homedir/-/os-homedir-1.0.2.tgz", + "integrity": "sha512-B5JU3cabzk8c67mRRd3ECmROafjYMXbuzlwtqdM8IbS8ktlTix8aFGb2bAGKrSRIlnfKwovGUUr72JUPyOb6kQ==", + "dev": true + }, + "os-tmpdir": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/os-tmpdir/-/os-tmpdir-1.0.2.tgz", + "integrity": "sha512-D2FR03Vir7FIu45XBY20mTb+/ZSWB00sjU9jdQXt83gDrI4Ztz5Fs7/yy74g2N5SVQY4xY1qDr4rNddwYRVX0g==", + "dev": true + }, + "osenv": { + "version": "0.1.5", + "resolved": "https://registry.npmjs.org/osenv/-/osenv-0.1.5.tgz", + "integrity": "sha512-0CWcCECdMVc2Rw3U5w9ZjqX6ga6ubk1xDVKxtBQPK7wis/0F2r9T6k4ydGYhecl7YUBxBVxhL5oisPsNxAPe2g==", + "dev": true, + "requires": { + "os-homedir": "^1.0.0", + "os-tmpdir": "^1.0.0" + } + }, + "path-is-absolute": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/path-is-absolute/-/path-is-absolute-1.0.1.tgz", + "integrity": "sha512-AVbw3UJ2e9bq64vSaS9Am0fje1Pa8pbGqTTsmXfaIiMpnr5DlDhfJOuLj9Sf95ZPVDAUerDfEk88MPmPe7UCQg==", + "dev": true + }, + "path-parse": { + "version": "1.0.7", + "resolved": "https://registry.npmjs.org/path-parse/-/path-parse-1.0.7.tgz", + "integrity": "sha512-LDJzPVEEEPR+y48z93A0Ed0yXb8pAByGWo/k5YYdYgpY2/2EsOsksJrq7lOHxryrVOn1ejG6oAp8ahvOIQD8sw==", + "dev": true + }, + "prettier": { + "version": "2.7.1", + "resolved": "https://registry.npmjs.org/prettier/-/prettier-2.7.1.tgz", + "integrity": "sha512-ujppO+MkdPqoVINuDFDRLClm7D78qbDt0/NR+wp5FqEZOoTNAjPHWj17QRhu7geIHJfcNhRk1XVQmF8Bp3ye+g==", + "dev": true + }, + "read-installed": { + "version": "4.0.3", + "resolved": "https://registry.npmjs.org/read-installed/-/read-installed-4.0.3.tgz", + "integrity": "sha512-O03wg/IYuV/VtnK2h/KXEt9VIbMUFbk3ERG0Iu4FhLZw0EP0T9znqrYDGn6ncbEsXUFaUjiVAWXHzxwt3lhRPQ==", + "dev": true, + "requires": { + "debuglog": "^1.0.1", + "graceful-fs": "^4.1.2", + "read-package-json": "^2.0.0", + "readdir-scoped-modules": "^1.0.0", + "semver": "2 || 3 || 4 || 5", + "slide": "~1.1.3", + "util-extend": "^1.0.1" + } + }, + "read-package-json": { + "version": "2.1.2", + "resolved": "https://registry.npmjs.org/read-package-json/-/read-package-json-2.1.2.tgz", + "integrity": "sha512-D1KmuLQr6ZSJS0tW8hf3WGpRlwszJOXZ3E8Yd/DNRaM5d+1wVRZdHlpGBLAuovjr28LbWvjpWkBHMxpRGGjzNA==", + "dev": true, + "requires": { + "glob": "^7.1.1", + "json-parse-even-better-errors": "^2.3.0", + "normalize-package-data": "^2.0.0", + "npm-normalize-package-bin": "^1.0.0" + } + }, + "readdir-scoped-modules": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/readdir-scoped-modules/-/readdir-scoped-modules-1.1.0.tgz", + "integrity": "sha512-asaikDeqAQg7JifRsZn1NJZXo9E+VwlyCfbkZhwyISinqk5zNS6266HS5kah6P0SaQKGF6SkNnZVHUzHFYxYDw==", + "dev": true, + "requires": { + "debuglog": "^1.0.1", + "dezalgo": "^1.0.0", + "graceful-fs": "^4.1.2", + "once": "^1.3.0" + } + }, + "resolve": { + "version": "1.22.1", + "resolved": "https://registry.npmjs.org/resolve/-/resolve-1.22.1.tgz", + "integrity": "sha512-nBpuuYuY5jFsli/JIs1oldw6fOQCBioohqWZg/2hiaOybXOft4lonv85uDOKXdf8rhyK159cxU5cDcK/NKk8zw==", + "dev": true, + "requires": { + "is-core-module": "^2.9.0", + "path-parse": "^1.0.7", + "supports-preserve-symlinks-flag": "^1.0.0" + } + }, + "semver": { + "version": "5.7.1", + "resolved": "https://registry.npmjs.org/semver/-/semver-5.7.1.tgz", + "integrity": "sha512-sauaDf/PZdVgrLTNYHRtpXa1iRiKcaebiKQ1BJdpQlWH2lCvexQdX55snPFyK7QzpudqbCI0qXFfOasHdyNDGQ==", + "dev": true + }, + "slide": { + "version": "1.1.6", + "resolved": "https://registry.npmjs.org/slide/-/slide-1.1.6.tgz", + "integrity": "sha512-NwrtjCg+lZoqhFU8fOwl4ay2ei8PaqCBOUV3/ektPY9trO1yQ1oXEfmHAhKArUVUr/hOHvy5f6AdP17dCM0zMw==", + "dev": true + }, + "spdx-compare": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/spdx-compare/-/spdx-compare-1.0.0.tgz", + "integrity": "sha512-C1mDZOX0hnu0ep9dfmuoi03+eOdDoz2yvK79RxbcrVEG1NO1Ph35yW102DHWKN4pk80nwCgeMmSY5L25VE4D9A==", + "dev": true, + "requires": { + "array-find-index": "^1.0.2", + "spdx-expression-parse": "^3.0.0", + "spdx-ranges": "^2.0.0" + } + }, + "spdx-correct": { + "version": "3.1.1", + "resolved": "https://registry.npmjs.org/spdx-correct/-/spdx-correct-3.1.1.tgz", + "integrity": "sha512-cOYcUWwhCuHCXi49RhFRCyJEK3iPj1Ziz9DpViV3tbZOwXD49QzIN3MpOLJNxh2qwq2lJJZaKMVw9qNi4jTC0w==", + "dev": true, + "requires": { + "spdx-expression-parse": "^3.0.0", + "spdx-license-ids": "^3.0.0" + } + }, + "spdx-exceptions": { + "version": "2.3.0", + "resolved": "https://registry.npmjs.org/spdx-exceptions/-/spdx-exceptions-2.3.0.tgz", + "integrity": "sha512-/tTrYOC7PPI1nUAgx34hUpqXuyJG+DTHJTnIULG4rDygi4xu/tfgmq1e1cIRwRzwZgo4NLySi+ricLkZkw4i5A==", + "dev": true + }, + "spdx-expression-parse": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/spdx-expression-parse/-/spdx-expression-parse-3.0.1.tgz", + "integrity": "sha512-cbqHunsQWnJNE6KhVSMsMeH5H/L9EpymbzqTQ3uLwNCLZ1Q481oWaofqH7nO6V07xlXwY6PhQdQ2IedWx/ZK4Q==", + "dev": true, + "requires": { + "spdx-exceptions": "^2.1.0", + "spdx-license-ids": "^3.0.0" + } + }, + "spdx-license-ids": { + "version": "3.0.12", + "resolved": "https://registry.npmjs.org/spdx-license-ids/-/spdx-license-ids-3.0.12.tgz", + "integrity": "sha512-rr+VVSXtRhO4OHbXUiAF7xW3Bo9DuuF6C5jH+q/x15j2jniycgKbxU09Hr0WqlSLUs4i4ltHGXqTe7VHclYWyA==", + "dev": true + }, + "spdx-ranges": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/spdx-ranges/-/spdx-ranges-2.1.1.tgz", + "integrity": "sha512-mcdpQFV7UDAgLpXEE/jOMqvK4LBoO0uTQg0uvXUewmEFhpiZx5yJSZITHB8w1ZahKdhfZqP5GPEOKLyEq5p8XA==", + "dev": true + }, + "spdx-satisfies": { + "version": "4.0.1", + "resolved": "https://registry.npmjs.org/spdx-satisfies/-/spdx-satisfies-4.0.1.tgz", + "integrity": "sha512-WVzZ/cXAzoNmjCWiEluEA3BjHp5tiUmmhn9MK+X0tBbR9sOqtC6UQwmgCNrAIZvNlMuBUYAaHYfb2oqlF9SwKA==", + "dev": true, + "requires": { + "spdx-compare": "^1.0.0", + "spdx-expression-parse": "^3.0.0", + "spdx-ranges": "^2.0.0" + } + }, + "supports-color": { + "version": "5.5.0", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-5.5.0.tgz", + "integrity": "sha512-QjVjwdXIt408MIiAqCX4oUKsgU2EqAGzs2Ppkm4aQYbjm+ZEWEcW4SfFNTr4uMNZma0ey4f5lgLrkB0aX0QMow==", + "dev": true, + "requires": { + "has-flag": "^3.0.0" + } + }, + "supports-preserve-symlinks-flag": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/supports-preserve-symlinks-flag/-/supports-preserve-symlinks-flag-1.0.0.tgz", + "integrity": "sha512-ot0WnXS9fgdkgIcePe6RHNk1WA8+muPa6cSjeR3V8K27q9BB1rTE3R1p7Hv0z1ZyAc8s6Vvv8DIyWf681MAt0w==", + "dev": true + }, + "treeify": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/treeify/-/treeify-1.1.0.tgz", + "integrity": "sha512-1m4RA7xVAJrSGrrXGs0L3YTwyvBs2S8PbRHaLZAkFw7JR8oIFwYtysxlBZhYIa7xSyiYJKZ3iGrrk55cGA3i9A==", + "dev": true + }, + "util-extend": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/util-extend/-/util-extend-1.0.3.tgz", + "integrity": "sha512-mLs5zAK+ctllYBj+iAQvlDCwoxU/WDOUaJkcFudeiAX6OajC6BKXJUa9a+tbtkC11dz2Ufb7h0lyvIOVn4LADA==", + "dev": true + }, + "validate-npm-package-license": { + "version": "3.0.4", + "resolved": "https://registry.npmjs.org/validate-npm-package-license/-/validate-npm-package-license-3.0.4.tgz", + "integrity": "sha512-DpKm2Ui/xN7/HQKCtpZxoRWBhZ9Z0kqtygG8XCgNQ8ZlDnxuQmWhj566j8fN4Cu3/JmbhsDo7fcAJq4s9h27Ew==", + "dev": true, + "requires": { + "spdx-correct": "^3.0.0", + "spdx-expression-parse": "^3.0.0" + } + }, + "wrappy": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/wrappy/-/wrappy-1.0.2.tgz", + "integrity": "sha512-l4Sp/DRseor9wL6EvV2+TuQn63dMkPjZ/sp9XkghTEbV9KlPS1xUsZ3u7/IQO4wxtcFB4bgpQPRcR3QCvezPcQ==", + "dev": true + } + } +} diff --git a/vendor/github.com/ory/dockertest/v4/package.json b/vendor/github.com/ory/dockertest/v4/package.json new file mode 100644 index 00000000..1a7cfdb3 --- /dev/null +++ b/vendor/github.com/ory/dockertest/v4/package.json @@ -0,0 +1,9 @@ +{ + "private": true, + "prettier": "ory-prettier-styles", + "devDependencies": { + "license-checker": "^25.0.1", + "ory-prettier-styles": "1.3.0", + "prettier": "2.7.1" + } +} diff --git a/vendor/github.com/ory/dockertest/v4/pool.go b/vendor/github.com/ory/dockertest/v4/pool.go new file mode 100644 index 00000000..35c9b0f4 --- /dev/null +++ b/vendor/github.com/ory/dockertest/v4/pool.go @@ -0,0 +1,504 @@ +// Copyright © 2026 Ory Corp +// SPDX-License-Identifier: Apache-2.0 + +package dockertest + +import ( + "context" + "fmt" + "sync" + "time" + + "github.com/containerd/errdefs" + "github.com/moby/moby/api/types/container" + mobyclient "github.com/moby/moby/client" + "github.com/ory/dockertest/v4/internal/client" +) + +// TestingTB is a subset of testing.TB for dependency injection. +// This interface allows methods to work with test helpers +// without directly depending on the testing package. +type TestingTB interface { + Helper() + Context() context.Context + Cleanup(func()) + Logf(format string, args ...any) + Fatalf(format string, args ...any) +} + +// Pool is the interface for managing Docker resources in tests. +// Returned by NewPoolT; does not expose Close or CloseT. +type Pool interface { + Run(ctx context.Context, repository string, opts ...RunOption) (ClosableResource, error) + RunT(t TestingTB, repository string, opts ...RunOption) Resource + BuildAndRun(ctx context.Context, name string, buildOpts *BuildOptions, runOpts ...RunOption) (ClosableResource, error) + BuildAndRunT(t TestingTB, name string, buildOpts *BuildOptions, runOpts ...RunOption) Resource + CreateNetwork(ctx context.Context, name string, opts *NetworkCreateOptions) (ClosableNetwork, error) + CreateNetworkT(t TestingTB, name string, opts *NetworkCreateOptions) Network + Retry(ctx context.Context, timeout time.Duration, fn func() error) error + Client() client.DockerClient +} + +// ClosablePool extends Pool with explicit lifecycle management. +// Returned by NewPool; the caller is responsible for calling Close. +type ClosablePool interface { + Pool + Close(ctx context.Context) error + CloseT(t TestingTB) +} + +// pool manages Docker resources and operations. +type pool struct { + client client.DockerClient + ownedClient bool // true if pool created the client and should close it + daemonHost string // Docker daemon endpoint; scopes the reuse registry + maxWait time.Duration + + mu sync.Mutex + resources []*resource // each entry is one reference; reused containers appear once per acquisition + networks sync.Map +} + +// NewPool creates a new pool with the given endpoint and options. +// +// The endpoint parameter must be empty. The Docker client is created from +// environment variables (DOCKER_HOST, DOCKER_TLS_VERIFY, DOCKER_CERT_PATH) or +// provided via WithMobyClient option. +// +// The default maxWait is 60 seconds. This can be customized with WithMaxWait. +// +// Example: +// +// ctx := context.Background() +// pool, err := dockertest.NewPool(ctx, "") +// if err != nil { +// panic(err) +// } +// defer pool.Close(ctx) +func NewPool(ctx context.Context, endpoint string, opts ...PoolOption) (ClosablePool, error) { + p := &pool{ + maxWait: 60 * time.Second, + ownedClient: true, + } + + for _, opt := range opts { + opt(p) + } + + if p.client == nil && endpoint != "" { + return nil, fmt.Errorf("endpoint parameter is not supported; use DOCKER_HOST environment variable or WithMobyClient option") + } + + if p.client == nil { + c, err := client.NewMobyClient(ctx) + if err != nil { + return nil, err + } + p.client = c + p.ownedClient = true + } + + p.daemonHost = p.client.DaemonHost() + + return p, nil +} + +// Client returns the underlying Docker client. +func (p *pool) Client() client.DockerClient { + return p.client +} + +func (p *pool) trackResource(r *resource) { + if r == nil || r.container.ID == "" { + return + } + p.mu.Lock() + p.resources = append(p.resources, r) + p.mu.Unlock() +} + +func (p *pool) untrackResource(containerID string) { + if containerID == "" { + return + } + p.mu.Lock() + defer p.mu.Unlock() + // Remove the first matching entry (preserves other refs to the same container). + for i, r := range p.resources { + if r.container.ID == containerID { + p.resources = append(p.resources[:i], p.resources[i+1:]...) + return + } + } +} + +func (p *pool) trackNetwork(net *dockerNetwork) { + if net == nil || net.inspect.ID == "" { + return + } + p.networks.Store(net.inspect.ID, net) +} + +func (p *pool) untrackNetwork(networkID string) { + if networkID == "" { + return + } + p.networks.Delete(networkID) +} + +func (p *pool) trackedNetworks() []*dockerNetwork { + var networks []*dockerNetwork + p.networks.Range(func(_, value any) bool { + net, ok := value.(*dockerNetwork) + if ok { + networks = append(networks, net) + } + return true + }) + return networks +} + +func (p *pool) trackedResources() []*resource { + p.mu.Lock() + snapshot := make([]*resource, len(p.resources)) + copy(snapshot, p.resources) + p.mu.Unlock() + return snapshot +} + +// NewPoolT creates a new pool using t.Context() and registers cleanup with t.Cleanup(). +// The returned Pool does not expose Close or CloseT; the pool is automatically +// cleaned up when the test finishes. +func NewPoolT(t TestingTB, endpoint string, opts ...PoolOption) Pool { + t.Helper() + + p, err := NewPool(t.Context(), endpoint, opts...) + if err != nil { + t.Fatalf("NewPool() error = %v", err) + } + + t.Cleanup(func() { + if err := p.Close(context.WithoutCancel(t.Context())); err != nil { + t.Logf("pool.Close() error: %v", err) + } + }) + + return p +} + +// Close cleans up all tracked containers and networks, then closes the pool's +// Docker client if it was created by the pool. If a custom client was provided +// via WithMobyClient, it is not closed (the caller remains responsible for +// closing it). +// +// It is safe to call Close multiple times. +func (p *pool) Close(ctx context.Context) error { + cleanupErr := p.cleanup(ctx) + if p.ownedClient && p.client != nil { + err := p.client.Close() + p.client = nil + if err != nil { + return err + } + } + return cleanupErr +} + +// CloseT cleans up all tracked containers and networks, then closes the pool's +// Docker client. It calls t.Fatalf on error. +func (p *pool) CloseT(t TestingTB) { + t.Helper() + if err := p.Close(context.WithoutCancel(t.Context())); err != nil { + t.Fatalf("Pool.CloseT failed: %v", err) + } +} + +// cleanup closes all tracked resources and networks. +// Resources are closed first (respecting ref counts), then networks. +// Errors during cleanup do not stop the process. The first error is returned. +func (p *pool) cleanup(ctx context.Context) error { + cleanupCtx, cancel := context.WithTimeout(context.WithoutCancel(ctx), 60*time.Second) + defer cancel() + + var firstErr error + + for _, r := range p.trackedResources() { + if err := r.Close(cleanupCtx); err != nil && firstErr == nil { + firstErr = err + } + } + + for _, net := range p.trackedNetworks() { + if err := net.Close(cleanupCtx); err != nil && firstErr == nil { + firstErr = err + } + p.untrackNetwork(net.inspect.ID) + } + + return firstErr +} + +// Run starts a container with the given repository and options. +// +// By default, containers are reused based on repository:tag to speed up tests. +// Reused containers are reference-counted: the Docker container is only removed +// when the last caller closes its reference. To ensure a fresh container, use +// WithoutReuse(). To control reuse with a custom key that accounts for your +// configuration, use WithReuseID(). +// +// Example: +// +// resource, err := pool.Run(ctx, "postgres", +// dockertest.WithTag("14"), +// dockertest.WithEnv([]string{"POSTGRES_PASSWORD=secret"}), +// ) +// if err != nil { +// panic(err) +// } +// defer resource.Close(ctx) +func (p *pool) Run(ctx context.Context, repository string, opts ...RunOption) (ClosableResource, error) { + cfg, err := buildRunConfig(opts) + if err != nil { + return nil, err + } + + reuseID := computeReuseID(repository, cfg) + + if existing := checkForExisting(p, reuseID); existing != nil { + p.trackResource(existing) + return existing, nil + } + + ref := fmt.Sprintf("%s:%s", repository, cfg.tag) + + if pullErr := p.pullImage(ctx, ref, cfg.noPull); pullErr != nil { + return nil, pullErr + } + + containerID, err := p.createAndStartContainer(ctx, ref, cfg) + if err != nil { + return nil, err + } + + return p.inspectAndRegister(ctx, containerID, reuseID) +} + +// buildRunConfig constructs a runConfig from options. +func buildRunConfig(opts []RunOption) (*runConfig, error) { + cfg := &runConfig{ + tag: "latest", + } + for _, opt := range opts { + if err := opt(cfg); err != nil { + return nil, err + } + } + return cfg, nil +} + +// computeReuseID determines the reuse ID for container caching. +func computeReuseID(repository string, cfg *runConfig) string { + if cfg.noReuse { + return "" + } + if cfg.reuseID != "" { + return cfg.reuseID + } + return fmt.Sprintf("%s:%s", repository, cfg.tag) +} + +// registryKey returns a registry key scoped to this pool's daemon host. +// This ensures that pools connected to different Docker daemons never +// share containers through the global registry. +func (p *pool) registryKey(reuseID string) string { + return p.daemonHost + "\x00" + reuseID +} + +// checkForExisting looks up an existing container in the registry and +// increments its reference count. The returned resource is a shallow clone +// of the canonical registry entry with the pool pointer updated to the +// caller's pool. +func checkForExisting(p *pool, reuseID string) *resource { + if reuseID == "" { + return nil + } + if existing, ok := acquire(p.registryKey(reuseID)); ok { + cloned := *existing + cloned.pool = p + return &cloned + } + return nil +} + +// pullImage pulls a Docker image unless noPull is set. +func (p *pool) pullImage(ctx context.Context, ref string, noPull bool) error { + if noPull { + return nil + } + + if _, err := p.client.ImageInspect(ctx, ref); err == nil { + return nil + } else if !errdefs.IsNotFound(err) { + return fmt.Errorf("image inspect failed for %s: %w", ref, err) + } + + pullResp, err := p.client.ImagePull(ctx, ref, mobyclient.ImagePullOptions{}) + if err != nil { + return fmt.Errorf("%w: %s: %w", ErrImagePullFailed, ref, err) + } + defer func() { + _ = pullResp.Close() //nolint:errcheck // Best effort close in defer + }() + + // Wait consumes the JSON stream and surfaces any errors embedded in it. + if err := pullResp.Wait(ctx); err != nil { + return fmt.Errorf("%w: %s: %w", ErrImagePullFailed, ref, err) + } + + return nil +} + +// createAndStartContainer creates and starts a container with the given configuration. +func (p *pool) createAndStartContainer(ctx context.Context, ref string, cfg *runConfig) (string, error) { + containerConfig := &container.Config{ + Image: ref, + Env: cfg.env, + Cmd: cfg.cmd, + User: cfg.user, + WorkingDir: cfg.workingDir, + Labels: cfg.labels, + Hostname: cfg.hostname, + } + + if len(cfg.entrypoint) > 0 { + containerConfig.Entrypoint = cfg.entrypoint + } + + // Apply config modifier last to allow overriding anything + if cfg.configModifier != nil { + cfg.configModifier(containerConfig) + } + + hostConfig := &container.HostConfig{ + PublishAllPorts: true, + } + + if len(cfg.portBindings) > 0 { + hostConfig.PortBindings = cfg.portBindings + } + + if len(cfg.binds) > 0 { + hostConfig.Binds = cfg.binds + } + + // Apply host config modifier last to allow overriding anything + if cfg.hostConfigModifier != nil { + cfg.hostConfigModifier(hostConfig) + } + + createOpts := mobyclient.ContainerCreateOptions{ + Name: cfg.name, + Config: containerConfig, + HostConfig: hostConfig, + } + + createResp, err := p.client.ContainerCreate(ctx, createOpts) + if err != nil { + return "", fmt.Errorf("%w from %s: %w", ErrContainerCreateFailed, ref, err) + } + + _, err = p.client.ContainerStart(ctx, createResp.ID, mobyclient.ContainerStartOptions{}) + if err != nil { + _, _ = p.client.ContainerRemove(ctx, createResp.ID, mobyclient.ContainerRemoveOptions{Force: true}) //nolint:errcheck // Best effort cleanup + return "", fmt.Errorf("%w: %s: %w", ErrContainerStartFailed, createResp.ID, err) + } + + return createResp.ID, nil +} + +// inspectAndRegister inspects the container and registers it in the global registry. +func (p *pool) inspectAndRegister(ctx context.Context, containerID, reuseID string) (*resource, error) { + inspectResp, err := p.inspectWithPortRetry(ctx, containerID) + if err != nil { + _, _ = p.client.ContainerRemove(ctx, containerID, mobyclient.ContainerRemoveOptions{Force: true}) //nolint:errcheck // Best effort cleanup + return nil, fmt.Errorf("container inspect failed: %w", err) + } + + r := &resource{ + pool: p, + container: inspectResp.Container, + reuseID: reuseID, + } + + if reuseID != "" { + canonical, loaded := register(p.registryKey(reuseID), r) + if loaded { + cleanupCtx := context.WithoutCancel(ctx) + _, _ = p.client.ContainerRemove(cleanupCtx, containerID, mobyclient.ContainerRemoveOptions{ + Force: true, + RemoveVolumes: true, + }) //nolint:errcheck // Best effort cleanup of duplicate container + + cloned := *canonical + cloned.pool = p + r = &cloned + } else { + r = canonical + } + } + + p.trackResource(r) + + return r, nil +} + +// inspectWithPortRetry inspects a container, retrying briefly if exposed ports +// have not yet been bound. Docker may report empty port bindings immediately +// after ContainerStart; this mirrors v3's inspectContainerWithRetries behavior. +func (p *pool) inspectWithPortRetry(ctx context.Context, containerID string) (mobyclient.ContainerInspectResult, error) { + const maxRetries = 5 + const retryDelay = 100 * time.Millisecond + + for range maxRetries { + resp, err := p.client.ContainerInspect(ctx, containerID, mobyclient.ContainerInspectOptions{}) + if err != nil { + return resp, err + } + + // If the container has no exposed ports, no need to wait for bindings. + if resp.Container.Config == nil || len(resp.Container.Config.ExposedPorts) == 0 { + return resp, nil + } + + // If port bindings are populated, we're good. + if resp.Container.NetworkSettings != nil && len(resp.Container.NetworkSettings.Ports) > 0 { + return resp, nil + } + + // Wait and retry. + select { + case <-ctx.Done(): + return resp, ctx.Err() + case <-time.After(retryDelay): + } + } + + // Return the last result even if ports aren't populated. + return p.client.ContainerInspect(ctx, containerID, mobyclient.ContainerInspectOptions{}) +} + +// RunT is a test helper that uses t.Context() and calls t.Fatalf on error. +// The returned Resource does not expose Close, CloseT, or Cleanup; +// the resource is automatically cleaned up when the test finishes. +func (p *pool) RunT(t TestingTB, repository string, opts ...RunOption) Resource { + t.Helper() + + r, err := p.Run(t.Context(), repository, opts...) + if err != nil { + t.Fatalf("RunT failed: %v", err) + } + + r.Cleanup(t) + + return r +} diff --git a/vendor/github.com/ory/dockertest/v4/registry.go b/vendor/github.com/ory/dockertest/v4/registry.go new file mode 100644 index 00000000..6e9c2f8c --- /dev/null +++ b/vendor/github.com/ory/dockertest/v4/registry.go @@ -0,0 +1,207 @@ +// Copyright © 2026 Ory Corp +// SPDX-License-Identifier: Apache-2.0 + +package dockertest + +import ( + "fmt" + "sync" + "sync/atomic" + + "github.com/moby/moby/api/types/container" +) + +// resource represents a Docker container managed by dockertest. +// It implements both Resource and ClosableResource interfaces. +type resource struct { + pool *pool + container container.InspectResponse + reuseID string +} + +// Container returns the Docker container inspection response. +func (r *resource) Container() container.InspectResponse { + return r.container +} + +// ID returns the container ID. +func (r *resource) ID() string { + return r.container.ID +} + +// NewResource creates a Resource for testing purposes. +// This is intended for unit tests that need a Resource without a Docker container. +func NewResource(c container.InspectResponse) ClosableResource { + return &resource{container: c} +} + +// registryEntry wraps a resource with an atomic reference count. +// When multiple callers share a reused container, the ref count tracks +// how many are still using it. The container is only removed from Docker +// when the last reference is released. +type registryEntry struct { + resource *resource + refs atomic.Int32 +} + +// globalRegistry is the package-level container registry using sync.Map for thread-safety. +var globalRegistry sync.Map + +// Register stores a resource with the given reuseID in the global registry. +// +// If a resource with the same reuseID already exists, the existing resource is kept +// and no error is returned. This ensures that concurrent registration attempts +// result in exactly one resource being stored. The race winner's resource becomes +// the canonical one in the registry, which is safe because both resources represent +// containers with the same configuration (same image, tag, env, etc.). +// +// The global registry enables container reuse across tests. Containers registered +// here can be retrieved with Get. +// +// Note: This function is called automatically by Pool.Run when container reuse +// is enabled. You typically don't need to call it directly. +func Register(reuseID string, r ClosableResource) error { + if reuseID == "" { + return fmt.Errorf("reuseID cannot be empty") + } + if r == nil { + return fmt.Errorf("resource cannot be nil") + } + res, ok := r.(*resource) + if !ok { + return fmt.Errorf("resource must be created by this package") + } + _, _ = register(reuseID, res) + return nil +} + +// Get retrieves a resource from the global registry by reuseID. +// Returns the resource and true if found, nil and false otherwise. +// +// The global registry stores containers for reuse. By default, containers are +// registered with a reuseID of "repository:tag". +// +// Note: This function is called automatically by Pool.Run when checking for +// existing containers. You typically don't need to call it directly. +func Get(reuseID string) (ClosableResource, bool) { + r, ok := get(reuseID) + if !ok { + return nil, false + } + return r, true +} + +// GetAll returns a slice of all resources in the global registry. +// The order of resources in the returned slice is not guaranteed. +// +// This is useful for cleanup operations that need to process all registered containers: +// +// func cleanupAll(ctx context.Context) { +// for _, resource := range dockertest.GetAll() { +// _ = resource.Close(ctx) +// } +// dockertest.ResetRegistry() +// } +func GetAll() []ClosableResource { + internal := getAll() + result := make([]ClosableResource, len(internal)) + for i, r := range internal { + result[i] = r + } + return result +} + +func register(reuseID string, r *resource) (*resource, bool) { + entry := ®istryEntry{resource: r} + entry.refs.Store(1) + actual, loaded := globalRegistry.LoadOrStore(reuseID, entry) + existing, ok := actual.(*registryEntry) + if !ok { + return r, loaded + } + if loaded { + existing.refs.Add(1) + return existing.resource, true + } + return existing.resource, false +} + +// acquire looks up an existing entry and increments its ref count. +// Returns the resource and true if found, nil and false otherwise. +func acquire(reuseID string) (*resource, bool) { + val, ok := globalRegistry.Load(reuseID) + if !ok { + return nil, false + } + entry, ok := val.(*registryEntry) + if !ok { + return nil, false + } + entry.refs.Add(1) + // Verify the entry is still in the map (not deleted and replaced between Load and Add). + if current, ok := globalRegistry.Load(reuseID); !ok || current != val { + entry.refs.Add(-1) + return nil, false + } + return entry.resource, true +} + +// release decrements the reference count for the given reuseID. +// Returns true if this was the last reference (caller should remove the container). +func release(reuseID string) bool { + val, ok := globalRegistry.Load(reuseID) + if !ok { + return true // Not found, treat as last reference + } + entry, ok := val.(*registryEntry) + if !ok { + globalRegistry.Delete(reuseID) + return true + } + if entry.refs.Add(-1) <= 0 { + globalRegistry.Delete(reuseID) + return true + } + return false +} + +func get(reuseID string) (*resource, bool) { + val, ok := globalRegistry.Load(reuseID) + if !ok { + return nil, false + } + entry, ok := val.(*registryEntry) + if !ok { + return nil, false + } + return entry.resource, true +} + +func getAll() []*resource { + var resources []*resource + + globalRegistry.Range(func(_, value any) bool { + if entry, ok := value.(*registryEntry); ok { + resources = append(resources, entry.resource) + } + return true + }) + + return resources +} + +// ResetRegistry clears all resources from the global registry. +// This does NOT stop or remove the containers themselves. +func ResetRegistry() { + // Collect all keys first to avoid modifying the map while iterating + var keys []any + globalRegistry.Range(func(key, _ any) bool { + keys = append(keys, key) + return true + }) + + // Delete all collected keys + for _, key := range keys { + globalRegistry.Delete(key) + } +} diff --git a/vendor/github.com/ory/dockertest/v4/resource.go b/vendor/github.com/ory/dockertest/v4/resource.go new file mode 100644 index 00000000..e591e177 --- /dev/null +++ b/vendor/github.com/ory/dockertest/v4/resource.go @@ -0,0 +1,321 @@ +// Copyright © 2026 Ory Corp +// SPDX-License-Identifier: Apache-2.0 + +package dockertest + +import ( + "bytes" + "context" + "fmt" + "io" + "net" + + "github.com/containerd/errdefs" + "github.com/moby/moby/api/pkg/stdcopy" + "github.com/moby/moby/api/types/container" + mobynetwork "github.com/moby/moby/api/types/network" + mobyclient "github.com/moby/moby/client" +) + +// Resource provides access to a Docker container. +// Returned by *T variants; does not expose Close, CloseT, or Cleanup. +type Resource interface { + ID() string + Container() container.InspectResponse + GetPort(portID string) string + GetBoundIP(portID string) string + GetHostPort(portID string) string + Logs(ctx context.Context) (stdout, stderr string, err error) + FollowLogs(ctx context.Context, stdout, stderr io.Writer) error + Exec(ctx context.Context, cmd []string) (ExecResult, error) + ConnectToNetwork(ctx context.Context, net Network) error + DisconnectFromNetwork(ctx context.Context, net Network) error + GetIPInNetwork(net Network) string +} + +// ClosableResource extends Resource with explicit lifecycle management. +// Returned by Run and BuildAndRun; the caller is responsible for calling Close. +type ClosableResource interface { + Resource + Close(ctx context.Context) error + CloseT(t TestingTB) + Cleanup(t TestingTB) +} + +// GetPort returns the host port bound to the given container port. +// The portID parameter should include the protocol (e.g., "5432/tcp"). +func (r *resource) GetPort(portID string) string { + if r.container.NetworkSettings == nil { + return "" + } + + port, err := mobynetwork.ParsePort(portID) + if err != nil { + return "" + } + bindings := r.container.NetworkSettings.Ports[port] + if len(bindings) == 0 { + return "" + } + + return bindings[0].HostPort +} + +// GetBoundIP returns the host IP bound to the given container port. +// The portID parameter should include the protocol (e.g., "5432/tcp"). +func (r *resource) GetBoundIP(portID string) string { + if r.container.NetworkSettings == nil { + return "" + } + + port, err := mobynetwork.ParsePort(portID) + if err != nil { + return "" + } + bindings := r.container.NetworkSettings.Ports[port] + if len(bindings) == 0 { + return "" + } + + ip := bindings[0].HostIP.String() + if ip == "" || ip == "0.0.0.0" || ip == "::" { + return "127.0.0.1" + } + + return ip +} + +// GetHostPort returns the host:port combination for the given container port. +// The portID parameter should include the protocol (e.g., "5432/tcp"). +func (r *resource) GetHostPort(portID string) string { + ip := r.GetBoundIP(portID) + port := r.GetPort(portID) + + if ip == "" || port == "" { + return "" + } + + return net.JoinHostPort(ip, port) +} + +// Close stops and removes the container. +// Anonymous volumes created by the container are also removed. +// +// For reused containers (those with a reuseID), Close only removes the Docker +// container when the last reference is released. If other callers still hold +// references, Close simply untracks the resource from this pool. +func (r *resource) Close(ctx context.Context) error { + if r.pool == nil || r.pool.client == nil { + return ErrClientClosed + } + + if r.reuseID != "" { + registryKey := r.pool.registryKey(r.reuseID) + r.reuseID = "" // prevent double-release on repeated Close calls + if !release(registryKey) { + // Other callers still hold references; just untrack from this pool. + r.pool.untrackResource(r.container.ID) + return nil + } + } + + // Stop container (ignore errors if already stopped) + _, _ = r.pool.client.ContainerStop(ctx, r.container.ID, mobyclient.ContainerStopOptions{}) //nolint:errcheck // Best effort stop + + // Remove container (tolerate already-removed containers) + _, err := r.pool.client.ContainerRemove(ctx, r.container.ID, mobyclient.ContainerRemoveOptions{ + RemoveVolumes: true, + Force: true, + }) + if err != nil && !errdefs.IsNotFound(err) { + return err + } + + r.pool.untrackResource(r.container.ID) + + return nil +} + +// CloseT stops and removes the container and calls t.Fatalf on error. +func (r *resource) CloseT(t TestingTB) { + t.Helper() + if err := r.Close(context.WithoutCancel(t.Context())); err != nil { + t.Fatalf("CloseT failed: %v", err) + } +} + +// Cleanup registers container cleanup with t.Cleanup. +// The container will be removed when the test finishes. +func (r *resource) Cleanup(t TestingTB) { + t.Helper() + t.Cleanup(func() { + if err := r.Close(context.WithoutCancel(t.Context())); err != nil { + t.Logf("Resource.Cleanup: close failed: %v", err) + } + }) +} + +func (r *resource) containerLogReader(ctx context.Context, follow bool) (io.ReadCloser, error) { + if r.pool == nil || r.pool.client == nil { + return nil, ErrClientClosed + } + reader, err := r.pool.client.ContainerLogs(ctx, r.container.ID, mobyclient.ContainerLogsOptions{ + ShowStdout: true, + ShowStderr: true, + Follow: follow, + }) + if err != nil { + return nil, fmt.Errorf("failed to get container logs: %w", err) + } + return reader, nil +} + +// Logs returns the container logs, demultiplexing stdout and stderr. +func (r *resource) Logs(ctx context.Context) (stdout, stderr string, err error) { + reader, err := r.containerLogReader(ctx, false) + if err != nil { + return "", "", err + } + defer reader.Close() + + var outBuf, errBuf bytes.Buffer + if _, err := stdcopy.StdCopy(&outBuf, &errBuf, reader); err != nil { + return "", "", fmt.Errorf("failed to read container logs: %w", err) + } + + return outBuf.String(), errBuf.String(), nil +} + +// FollowLogs streams container logs to stdout and stderr until ctx is cancelled +// or the container exits. Pass io.Discard for writers you don't need. +func (r *resource) FollowLogs(ctx context.Context, stdout, stderr io.Writer) error { + reader, err := r.containerLogReader(ctx, true) + if err != nil { + return err + } + defer reader.Close() + + if _, err := stdcopy.StdCopy(stdout, stderr, reader); err != nil { + return fmt.Errorf("failed to follow container logs: %w", err) + } + return nil +} + +// ExecResult holds the output of a command executed inside a container. +type ExecResult struct { + StdOut string + StdErr string + ExitCode int +} + +// Exec runs a command inside the container and returns the result. +func (r *resource) Exec(ctx context.Context, cmd []string) (ExecResult, error) { + if r.pool == nil || r.pool.client == nil { + return ExecResult{}, ErrClientClosed + } + + createResp, err := r.pool.client.ExecCreate(ctx, r.container.ID, mobyclient.ExecCreateOptions{ + Cmd: cmd, + AttachStdout: true, + AttachStderr: true, + }) + if err != nil { + return ExecResult{}, fmt.Errorf("exec create failed: %w", err) + } + + attachResp, err := r.pool.client.ExecAttach(ctx, createResp.ID, mobyclient.ExecAttachOptions{}) + if err != nil { + return ExecResult{}, fmt.Errorf("exec attach failed: %w", err) + } + defer attachResp.Conn.Close() + + var stdout, stderr bytes.Buffer + if _, err := stdcopy.StdCopy(&stdout, &stderr, attachResp.Reader); err != nil { + return ExecResult{}, fmt.Errorf("exec read failed: %w", err) + } + + inspectResp, err := r.pool.client.ExecInspect(ctx, createResp.ID, mobyclient.ExecInspectOptions{}) + if err != nil { + return ExecResult{}, fmt.Errorf("exec inspect failed: %w", err) + } + + return ExecResult{ + StdOut: stdout.String(), + StdErr: stderr.String(), + ExitCode: inspectResp.ExitCode, + }, nil +} + +// ConnectToNetwork connects the container to the given network. +// The resource's container field is automatically updated with the latest +// network settings after connection. +func (r *resource) ConnectToNetwork(ctx context.Context, net Network) error { + if r.pool == nil || r.pool.client == nil { + return ErrClientClosed + } + + connectOpts := mobyclient.NetworkConnectOptions{ + Container: r.container.ID, + } + + _, err := r.pool.client.NetworkConnect(ctx, net.ID(), connectOpts) + if err != nil { + return err + } + + // Refresh container inspection to get updated network settings + inspectResp, err := r.pool.client.ContainerInspect(ctx, r.container.ID, mobyclient.ContainerInspectOptions{}) + if err != nil { + return err + } + + r.container = inspectResp.Container + return nil +} + +// DisconnectFromNetwork disconnects the container from the given network. +// The resource's container field is automatically updated with the latest +// network settings after disconnection. +func (r *resource) DisconnectFromNetwork(ctx context.Context, net Network) error { + if r.pool == nil || r.pool.client == nil { + return ErrClientClosed + } + + disconnectOpts := mobyclient.NetworkDisconnectOptions{ + Container: r.container.ID, + Force: false, + } + + _, err := r.pool.client.NetworkDisconnect(ctx, net.ID(), disconnectOpts) + if err != nil { + return err + } + + // Refresh container inspection to get updated network settings + inspectResp, err := r.pool.client.ContainerInspect(ctx, r.container.ID, mobyclient.ContainerInspectOptions{}) + if err != nil { + return err + } + + r.container = inspectResp.Container + return nil +} + +// GetIPInNetwork returns the container's IP address in the given network. +// Returns empty string if the container is not connected to the network. +func (r *resource) GetIPInNetwork(net Network) string { + if r.container.NetworkSettings == nil { + return "" + } + + if r.container.NetworkSettings.Networks == nil { + return "" + } + + endpoint, ok := r.container.NetworkSettings.Networks[net.Inspect().Name] + if !ok { + return "" + } + + return endpoint.IPAddress.String() +} diff --git a/vendor/github.com/ory/dockertest/v4/retry.go b/vendor/github.com/ory/dockertest/v4/retry.go new file mode 100644 index 00000000..d9e7cc6c --- /dev/null +++ b/vendor/github.com/ory/dockertest/v4/retry.go @@ -0,0 +1,66 @@ +// Copyright © 2026 Ory Corp +// SPDX-License-Identifier: Apache-2.0 + +package dockertest + +import ( + "context" + "time" + + "github.com/cenkalti/backoff/v5" +) + +// Retry retries fn with a fixed interval until it succeeds, the context is cancelled, +// or the timeout is reached. The interval is deterministic (no jitter). +func Retry(ctx context.Context, timeout, interval time.Duration, fn func() error) error { + // Create context with timeout + ctx, cancel := context.WithTimeout(ctx, timeout) + defer cancel() + + // Configure constant backoff + b := backoff.NewConstantBackOff(interval) + + // Wrap fn to match backoff.Operation signature + operation := func() (struct{}, error) { + return struct{}{}, fn() + } + + _, err := backoff.Retry(ctx, operation, backoff.WithBackOff(b)) + return err +} + +// RetryWithBackoff retries fn with exponential backoff until it succeeds, the context +// is cancelled, or the timeout is reached. +// +// The interval starts at initialInterval and doubles after each attempt, capped at maxInterval. +// The backoff is deterministic (no jitter). +func RetryWithBackoff(ctx context.Context, timeout, initialInterval, maxInterval time.Duration, fn func() error) error { + // Create context with timeout + ctx, cancel := context.WithTimeout(ctx, timeout) + defer cancel() + + // Configure exponential backoff with no randomization (deterministic) + b := backoff.NewExponentialBackOff() + b.InitialInterval = initialInterval + b.MaxInterval = maxInterval + b.Multiplier = 2.0 + b.RandomizationFactor = 0 // No jitter, deterministic + b.Reset() + + // Wrap fn to match backoff.Operation signature + operation := func() (struct{}, error) { + return struct{}{}, fn() + } + + _, err := backoff.Retry(ctx, operation, backoff.WithBackOff(b)) + return err +} + +// Retry is a convenience method that wraps the package-level Retry function. +// If timeout is 0, pool.maxWait is used as the default. The interval is fixed at 1 second. +func (p *pool) Retry(ctx context.Context, timeout time.Duration, fn func() error) error { + if timeout == 0 { + timeout = p.maxWait + } + return Retry(ctx, timeout, 1*time.Second, fn) +} diff --git a/vendor/go.opentelemetry.io/auto/sdk/CONTRIBUTING.md b/vendor/go.opentelemetry.io/auto/sdk/CONTRIBUTING.md new file mode 100644 index 00000000..773c9b64 --- /dev/null +++ b/vendor/go.opentelemetry.io/auto/sdk/CONTRIBUTING.md @@ -0,0 +1,27 @@ +# Contributing to go.opentelemetry.io/auto/sdk + +The `go.opentelemetry.io/auto/sdk` module is a purpose built OpenTelemetry SDK. +It is designed to be: + +0. An OpenTelemetry compliant SDK +1. Instrumented by auto-instrumentation (serializable into OTLP JSON) +2. Lightweight +3. User-friendly + +These design choices are listed in the order of their importance. + +The primary design goal of this module is to be an OpenTelemetry SDK. +This means that it needs to implement the Go APIs found in `go.opentelemetry.io/otel`. + +Having met the requirement of SDK compliance, this module needs to provide code that the `go.opentelemetry.io/auto` module can instrument. +The chosen approach to meet this goal is to ensure the telemetry from the SDK is serializable into JSON encoded OTLP. +This ensures then that the serialized form is compatible with other OpenTelemetry systems, and the auto-instrumentation can use these systems to deserialize any telemetry it is sent. + +Outside of these first two goals, the intended use becomes relevant. +This package is intended to be used in the `go.opentelemetry.io/otel` global API as a default when the auto-instrumentation is running. +Because of this, this package needs to not add unnecessary dependencies to that API. +Ideally, it adds none. +It also needs to operate efficiently. + +Finally, this module is designed to be user-friendly to Go development. +It hides complexity in order to provide simpler APIs when the previous goals can all still be met. diff --git a/vendor/go.opentelemetry.io/auto/sdk/LICENSE b/vendor/go.opentelemetry.io/auto/sdk/LICENSE new file mode 100644 index 00000000..261eeb9e --- /dev/null +++ b/vendor/go.opentelemetry.io/auto/sdk/LICENSE @@ -0,0 +1,201 @@ + Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + + TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + + 1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + + 2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + + 3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + + 4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + + 5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + + 6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + + 7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + + 8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + + 9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + + END OF TERMS AND CONDITIONS + + APPENDIX: How to apply the Apache License to your work. + + To apply the Apache License to your work, attach the following + boilerplate notice, with the fields enclosed by brackets "[]" + replaced with your own identifying information. (Don't include + the brackets!) The text should be enclosed in the appropriate + comment syntax for the file format. We also recommend that a + file or class name and description of purpose be included on the + same "printed page" as the copyright notice for easier + identification within third-party archives. + + Copyright [yyyy] [name of copyright owner] + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. diff --git a/vendor/go.opentelemetry.io/auto/sdk/VERSIONING.md b/vendor/go.opentelemetry.io/auto/sdk/VERSIONING.md new file mode 100644 index 00000000..088d19a6 --- /dev/null +++ b/vendor/go.opentelemetry.io/auto/sdk/VERSIONING.md @@ -0,0 +1,15 @@ +# Versioning + +This document describes the versioning policy for this module. +This policy is designed so the following goals can be achieved. + +**Users are provided a codebase of value that is stable and secure.** + +## Policy + +* Versioning of this module will be idiomatic of a Go project using [Go modules](https://github.com/golang/go/wiki/Modules). + * [Semantic import versioning](https://github.com/golang/go/wiki/Modules#semantic-import-versioning) will be used. + * Versions will comply with [semver 2.0](https://semver.org/spec/v2.0.0.html). + * Any `v2` or higher version of this module will be included as a `/vN` at the end of the module path used in `go.mod` files and in the package import path. + +* GitHub releases will be made for all releases. diff --git a/vendor/go.opentelemetry.io/auto/sdk/doc.go b/vendor/go.opentelemetry.io/auto/sdk/doc.go new file mode 100644 index 00000000..ad73d8cb --- /dev/null +++ b/vendor/go.opentelemetry.io/auto/sdk/doc.go @@ -0,0 +1,14 @@ +// Copyright The OpenTelemetry Authors +// SPDX-License-Identifier: Apache-2.0 + +/* +Package sdk provides an auto-instrumentable OpenTelemetry SDK. + +An [go.opentelemetry.io/auto.Instrumentation] can be configured to target the +process running this SDK. In that case, all telemetry the SDK produces will be +processed and handled by that [go.opentelemetry.io/auto.Instrumentation]. + +By default, if there is no [go.opentelemetry.io/auto.Instrumentation] set to +auto-instrument the SDK, the SDK will not generate any telemetry. +*/ +package sdk diff --git a/vendor/go.opentelemetry.io/auto/sdk/internal/telemetry/attr.go b/vendor/go.opentelemetry.io/auto/sdk/internal/telemetry/attr.go new file mode 100644 index 00000000..af6ef171 --- /dev/null +++ b/vendor/go.opentelemetry.io/auto/sdk/internal/telemetry/attr.go @@ -0,0 +1,58 @@ +// Copyright The OpenTelemetry Authors +// SPDX-License-Identifier: Apache-2.0 + +package telemetry + +// Attr is a key-value pair. +type Attr struct { + Key string `json:"key,omitempty"` + Value Value `json:"value,omitempty"` +} + +// String returns an Attr for a string value. +func String(key, value string) Attr { + return Attr{key, StringValue(value)} +} + +// Int64 returns an Attr for an int64 value. +func Int64(key string, value int64) Attr { + return Attr{key, Int64Value(value)} +} + +// Int returns an Attr for an int value. +func Int(key string, value int) Attr { + return Int64(key, int64(value)) +} + +// Float64 returns an Attr for a float64 value. +func Float64(key string, value float64) Attr { + return Attr{key, Float64Value(value)} +} + +// Bool returns an Attr for a bool value. +func Bool(key string, value bool) Attr { + return Attr{key, BoolValue(value)} +} + +// Bytes returns an Attr for a []byte value. +// The passed slice must not be changed after it is passed. +func Bytes(key string, value []byte) Attr { + return Attr{key, BytesValue(value)} +} + +// Slice returns an Attr for a []Value value. +// The passed slice must not be changed after it is passed. +func Slice(key string, value ...Value) Attr { + return Attr{key, SliceValue(value...)} +} + +// Map returns an Attr for a map value. +// The passed slice must not be changed after it is passed. +func Map(key string, value ...Attr) Attr { + return Attr{key, MapValue(value...)} +} + +// Equal returns if a is equal to b. +func (a Attr) Equal(b Attr) bool { + return a.Key == b.Key && a.Value.Equal(b.Value) +} diff --git a/vendor/go.opentelemetry.io/auto/sdk/internal/telemetry/doc.go b/vendor/go.opentelemetry.io/auto/sdk/internal/telemetry/doc.go new file mode 100644 index 00000000..949e2165 --- /dev/null +++ b/vendor/go.opentelemetry.io/auto/sdk/internal/telemetry/doc.go @@ -0,0 +1,8 @@ +// Copyright The OpenTelemetry Authors +// SPDX-License-Identifier: Apache-2.0 + +/* +Package telemetry provides a lightweight representations of OpenTelemetry +telemetry that is compatible with the OTLP JSON protobuf encoding. +*/ +package telemetry diff --git a/vendor/go.opentelemetry.io/auto/sdk/internal/telemetry/id.go b/vendor/go.opentelemetry.io/auto/sdk/internal/telemetry/id.go new file mode 100644 index 00000000..2950fdb4 --- /dev/null +++ b/vendor/go.opentelemetry.io/auto/sdk/internal/telemetry/id.go @@ -0,0 +1,103 @@ +// Copyright The OpenTelemetry Authors +// SPDX-License-Identifier: Apache-2.0 + +package telemetry + +import ( + "encoding/hex" + "errors" + "fmt" +) + +const ( + traceIDSize = 16 + spanIDSize = 8 +) + +// TraceID is a custom data type that is used for all trace IDs. +type TraceID [traceIDSize]byte + +// String returns the hex string representation form of a TraceID. +func (tid TraceID) String() string { + return hex.EncodeToString(tid[:]) +} + +// IsEmpty returns false if id contains at least one non-zero byte. +func (tid TraceID) IsEmpty() bool { + return tid == [traceIDSize]byte{} +} + +// MarshalJSON converts the trace ID into a hex string enclosed in quotes. +func (tid TraceID) MarshalJSON() ([]byte, error) { + if tid.IsEmpty() { + return []byte(`""`), nil + } + return marshalJSON(tid[:]) +} + +// UnmarshalJSON inflates the trace ID from hex string, possibly enclosed in +// quotes. +func (tid *TraceID) UnmarshalJSON(data []byte) error { + *tid = [traceIDSize]byte{} + return unmarshalJSON(tid[:], data) +} + +// SpanID is a custom data type that is used for all span IDs. +type SpanID [spanIDSize]byte + +// String returns the hex string representation form of a SpanID. +func (sid SpanID) String() string { + return hex.EncodeToString(sid[:]) +} + +// IsEmpty returns true if the span ID contains at least one non-zero byte. +func (sid SpanID) IsEmpty() bool { + return sid == [spanIDSize]byte{} +} + +// MarshalJSON converts span ID into a hex string enclosed in quotes. +func (sid SpanID) MarshalJSON() ([]byte, error) { + if sid.IsEmpty() { + return []byte(`""`), nil + } + return marshalJSON(sid[:]) +} + +// UnmarshalJSON decodes span ID from hex string, possibly enclosed in quotes. +func (sid *SpanID) UnmarshalJSON(data []byte) error { + *sid = [spanIDSize]byte{} + return unmarshalJSON(sid[:], data) +} + +// marshalJSON converts id into a hex string enclosed in quotes. +func marshalJSON(id []byte) ([]byte, error) { + // Plus 2 quote chars at the start and end. + hexLen := hex.EncodedLen(len(id)) + 2 + + b := make([]byte, hexLen) + hex.Encode(b[1:hexLen-1], id) + b[0], b[hexLen-1] = '"', '"' + + return b, nil +} + +// unmarshalJSON inflates trace id from hex string, possibly enclosed in quotes. +func unmarshalJSON(dst, src []byte) error { + if l := len(src); l >= 2 && src[0] == '"' && src[l-1] == '"' { + src = src[1 : l-1] + } + nLen := len(src) + if nLen == 0 { + return nil + } + + if len(dst) != hex.DecodedLen(nLen) { + return errors.New("invalid length for ID") + } + + _, err := hex.Decode(dst, src) + if err != nil { + return fmt.Errorf("cannot unmarshal ID from string '%s': %w", string(src), err) + } + return nil +} diff --git a/vendor/go.opentelemetry.io/auto/sdk/internal/telemetry/number.go b/vendor/go.opentelemetry.io/auto/sdk/internal/telemetry/number.go new file mode 100644 index 00000000..5bb3b16c --- /dev/null +++ b/vendor/go.opentelemetry.io/auto/sdk/internal/telemetry/number.go @@ -0,0 +1,67 @@ +// Copyright The OpenTelemetry Authors +// SPDX-License-Identifier: Apache-2.0 + +package telemetry + +import ( + "encoding/json" + "strconv" +) + +// protoInt64 represents the protobuf encoding of integers which can be either +// strings or integers. +type protoInt64 int64 + +// Int64 returns the protoInt64 as an int64. +func (i *protoInt64) Int64() int64 { return int64(*i) } + +// UnmarshalJSON decodes both strings and integers. +func (i *protoInt64) UnmarshalJSON(data []byte) error { + if data[0] == '"' { + var str string + if err := json.Unmarshal(data, &str); err != nil { + return err + } + parsedInt, err := strconv.ParseInt(str, 10, 64) + if err != nil { + return err + } + *i = protoInt64(parsedInt) + } else { + var parsedInt int64 + if err := json.Unmarshal(data, &parsedInt); err != nil { + return err + } + *i = protoInt64(parsedInt) + } + return nil +} + +// protoUint64 represents the protobuf encoding of integers which can be either +// strings or integers. +type protoUint64 uint64 + +// Uint64 returns the protoUint64 as a uint64. +func (i *protoUint64) Uint64() uint64 { return uint64(*i) } + +// UnmarshalJSON decodes both strings and integers. +func (i *protoUint64) UnmarshalJSON(data []byte) error { + if data[0] == '"' { + var str string + if err := json.Unmarshal(data, &str); err != nil { + return err + } + parsedUint, err := strconv.ParseUint(str, 10, 64) + if err != nil { + return err + } + *i = protoUint64(parsedUint) + } else { + var parsedUint uint64 + if err := json.Unmarshal(data, &parsedUint); err != nil { + return err + } + *i = protoUint64(parsedUint) + } + return nil +} diff --git a/vendor/go.opentelemetry.io/auto/sdk/internal/telemetry/resource.go b/vendor/go.opentelemetry.io/auto/sdk/internal/telemetry/resource.go new file mode 100644 index 00000000..cecad8ba --- /dev/null +++ b/vendor/go.opentelemetry.io/auto/sdk/internal/telemetry/resource.go @@ -0,0 +1,66 @@ +// Copyright The OpenTelemetry Authors +// SPDX-License-Identifier: Apache-2.0 + +package telemetry + +import ( + "bytes" + "encoding/json" + "errors" + "fmt" + "io" +) + +// Resource information. +type Resource struct { + // Attrs are the set of attributes that describe the resource. Attribute + // keys MUST be unique (it is not allowed to have more than one attribute + // with the same key). + Attrs []Attr `json:"attributes,omitempty"` + // DroppedAttrs is the number of dropped attributes. If the value + // is 0, then no attributes were dropped. + DroppedAttrs uint32 `json:"droppedAttributesCount,omitempty"` +} + +// UnmarshalJSON decodes the OTLP formatted JSON contained in data into r. +func (r *Resource) UnmarshalJSON(data []byte) error { + decoder := json.NewDecoder(bytes.NewReader(data)) + + t, err := decoder.Token() + if err != nil { + return err + } + if t != json.Delim('{') { + return errors.New("invalid Resource type") + } + + for decoder.More() { + keyIface, err := decoder.Token() + if err != nil { + if errors.Is(err, io.EOF) { + // Empty. + return nil + } + return err + } + + key, ok := keyIface.(string) + if !ok { + return fmt.Errorf("invalid Resource field: %#v", keyIface) + } + + switch key { + case "attributes": + err = decoder.Decode(&r.Attrs) + case "droppedAttributesCount", "dropped_attributes_count": + err = decoder.Decode(&r.DroppedAttrs) + default: + // Skip unknown. + } + + if err != nil { + return err + } + } + return nil +} diff --git a/vendor/go.opentelemetry.io/auto/sdk/internal/telemetry/scope.go b/vendor/go.opentelemetry.io/auto/sdk/internal/telemetry/scope.go new file mode 100644 index 00000000..b6f2e28d --- /dev/null +++ b/vendor/go.opentelemetry.io/auto/sdk/internal/telemetry/scope.go @@ -0,0 +1,67 @@ +// Copyright The OpenTelemetry Authors +// SPDX-License-Identifier: Apache-2.0 + +package telemetry + +import ( + "bytes" + "encoding/json" + "errors" + "fmt" + "io" +) + +// Scope is the identifying values of the instrumentation scope. +type Scope struct { + Name string `json:"name,omitempty"` + Version string `json:"version,omitempty"` + Attrs []Attr `json:"attributes,omitempty"` + DroppedAttrs uint32 `json:"droppedAttributesCount,omitempty"` +} + +// UnmarshalJSON decodes the OTLP formatted JSON contained in data into r. +func (s *Scope) UnmarshalJSON(data []byte) error { + decoder := json.NewDecoder(bytes.NewReader(data)) + + t, err := decoder.Token() + if err != nil { + return err + } + if t != json.Delim('{') { + return errors.New("invalid Scope type") + } + + for decoder.More() { + keyIface, err := decoder.Token() + if err != nil { + if errors.Is(err, io.EOF) { + // Empty. + return nil + } + return err + } + + key, ok := keyIface.(string) + if !ok { + return fmt.Errorf("invalid Scope field: %#v", keyIface) + } + + switch key { + case "name": + err = decoder.Decode(&s.Name) + case "version": + err = decoder.Decode(&s.Version) + case "attributes": + err = decoder.Decode(&s.Attrs) + case "droppedAttributesCount", "dropped_attributes_count": + err = decoder.Decode(&s.DroppedAttrs) + default: + // Skip unknown. + } + + if err != nil { + return err + } + } + return nil +} diff --git a/vendor/go.opentelemetry.io/auto/sdk/internal/telemetry/span.go b/vendor/go.opentelemetry.io/auto/sdk/internal/telemetry/span.go new file mode 100644 index 00000000..67f80b6a --- /dev/null +++ b/vendor/go.opentelemetry.io/auto/sdk/internal/telemetry/span.go @@ -0,0 +1,472 @@ +// Copyright The OpenTelemetry Authors +// SPDX-License-Identifier: Apache-2.0 + +package telemetry + +import ( + "bytes" + "encoding/hex" + "encoding/json" + "errors" + "fmt" + "io" + "math" + "time" +) + +// A Span represents a single operation performed by a single component of the +// system. +type Span struct { + // A unique identifier for a trace. All spans from the same trace share + // the same `trace_id`. The ID is a 16-byte array. An ID with all zeroes OR + // of length other than 16 bytes is considered invalid (empty string in OTLP/JSON + // is zero-length and thus is also invalid). + // + // This field is required. + TraceID TraceID `json:"traceId,omitempty"` + // A unique identifier for a span within a trace, assigned when the span + // is created. The ID is an 8-byte array. An ID with all zeroes OR of length + // other than 8 bytes is considered invalid (empty string in OTLP/JSON + // is zero-length and thus is also invalid). + // + // This field is required. + SpanID SpanID `json:"spanId,omitempty"` + // trace_state conveys information about request position in multiple distributed tracing graphs. + // It is a trace_state in w3c-trace-context format: https://www.w3.org/TR/trace-context/#tracestate-header + // See also https://github.com/w3c/distributed-tracing for more details about this field. + TraceState string `json:"traceState,omitempty"` + // The `span_id` of this span's parent span. If this is a root span, then this + // field must be empty. The ID is an 8-byte array. + ParentSpanID SpanID `json:"parentSpanId,omitempty"` + // Flags, a bit field. + // + // Bits 0-7 (8 least significant bits) are the trace flags as defined in W3C Trace + // Context specification. To read the 8-bit W3C trace flag, use + // `flags & SPAN_FLAGS_TRACE_FLAGS_MASK`. + // + // See https://www.w3.org/TR/trace-context-2/#trace-flags for the flag definitions. + // + // Bits 8 and 9 represent the 3 states of whether a span's parent + // is remote. The states are (unknown, is not remote, is remote). + // To read whether the value is known, use `(flags & SPAN_FLAGS_CONTEXT_HAS_IS_REMOTE_MASK) != 0`. + // To read whether the span is remote, use `(flags & SPAN_FLAGS_CONTEXT_IS_REMOTE_MASK) != 0`. + // + // When creating span messages, if the message is logically forwarded from another source + // with an equivalent flags fields (i.e., usually another OTLP span message), the field SHOULD + // be copied as-is. If creating from a source that does not have an equivalent flags field + // (such as a runtime representation of an OpenTelemetry span), the high 22 bits MUST + // be set to zero. + // Readers MUST NOT assume that bits 10-31 (22 most significant bits) will be zero. + // + // [Optional]. + Flags uint32 `json:"flags,omitempty"` + // A description of the span's operation. + // + // For example, the name can be a qualified method name or a file name + // and a line number where the operation is called. A best practice is to use + // the same display name at the same call point in an application. + // This makes it easier to correlate spans in different traces. + // + // This field is semantically required to be set to non-empty string. + // Empty value is equivalent to an unknown span name. + // + // This field is required. + Name string `json:"name"` + // Distinguishes between spans generated in a particular context. For example, + // two spans with the same name may be distinguished using `CLIENT` (caller) + // and `SERVER` (callee) to identify queueing latency associated with the span. + Kind SpanKind `json:"kind,omitempty"` + // start_time_unix_nano is the start time of the span. On the client side, this is the time + // kept by the local machine where the span execution starts. On the server side, this + // is the time when the server's application handler starts running. + // Value is UNIX Epoch time in nanoseconds since 00:00:00 UTC on 1 January 1970. + // + // This field is semantically required and it is expected that end_time >= start_time. + StartTime time.Time `json:"startTimeUnixNano,omitempty"` + // end_time_unix_nano is the end time of the span. On the client side, this is the time + // kept by the local machine where the span execution ends. On the server side, this + // is the time when the server application handler stops running. + // Value is UNIX Epoch time in nanoseconds since 00:00:00 UTC on 1 January 1970. + // + // This field is semantically required and it is expected that end_time >= start_time. + EndTime time.Time `json:"endTimeUnixNano,omitempty"` + // attributes is a collection of key/value pairs. Note, global attributes + // like server name can be set using the resource API. Examples of attributes: + // + // "/http/user_agent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_14_2) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/71.0.3578.98 Safari/537.36" + // "/http/server_latency": 300 + // "example.com/myattribute": true + // "example.com/score": 10.239 + // + // The OpenTelemetry API specification further restricts the allowed value types: + // https://github.com/open-telemetry/opentelemetry-specification/blob/main/specification/common/README.md#attribute + // Attribute keys MUST be unique (it is not allowed to have more than one + // attribute with the same key). + Attrs []Attr `json:"attributes,omitempty"` + // dropped_attributes_count is the number of attributes that were discarded. Attributes + // can be discarded because their keys are too long or because there are too many + // attributes. If this value is 0, then no attributes were dropped. + DroppedAttrs uint32 `json:"droppedAttributesCount,omitempty"` + // events is a collection of Event items. + Events []*SpanEvent `json:"events,omitempty"` + // dropped_events_count is the number of dropped events. If the value is 0, then no + // events were dropped. + DroppedEvents uint32 `json:"droppedEventsCount,omitempty"` + // links is a collection of Links, which are references from this span to a span + // in the same or different trace. + Links []*SpanLink `json:"links,omitempty"` + // dropped_links_count is the number of dropped links after the maximum size was + // enforced. If this value is 0, then no links were dropped. + DroppedLinks uint32 `json:"droppedLinksCount,omitempty"` + // An optional final status for this span. Semantically when Status isn't set, it means + // span's status code is unset, i.e. assume STATUS_CODE_UNSET (code = 0). + Status *Status `json:"status,omitempty"` +} + +// MarshalJSON encodes s into OTLP formatted JSON. +func (s Span) MarshalJSON() ([]byte, error) { + startT := s.StartTime.UnixNano() + if s.StartTime.IsZero() || startT < 0 { + startT = 0 + } + + endT := s.EndTime.UnixNano() + if s.EndTime.IsZero() || endT < 0 { + endT = 0 + } + + // Override non-empty default SpanID marshal and omitempty. + var parentSpanId string + if !s.ParentSpanID.IsEmpty() { + b := make([]byte, hex.EncodedLen(spanIDSize)) + hex.Encode(b, s.ParentSpanID[:]) + parentSpanId = string(b) + } + + type Alias Span + return json.Marshal(struct { + Alias + ParentSpanID string `json:"parentSpanId,omitempty"` + StartTime uint64 `json:"startTimeUnixNano,omitempty"` + EndTime uint64 `json:"endTimeUnixNano,omitempty"` + }{ + Alias: Alias(s), + ParentSpanID: parentSpanId, + StartTime: uint64(startT), // nolint:gosec // >0 checked above. + EndTime: uint64(endT), // nolint:gosec // >0 checked above. + }) +} + +// UnmarshalJSON decodes the OTLP formatted JSON contained in data into s. +func (s *Span) UnmarshalJSON(data []byte) error { + decoder := json.NewDecoder(bytes.NewReader(data)) + + t, err := decoder.Token() + if err != nil { + return err + } + if t != json.Delim('{') { + return errors.New("invalid Span type") + } + + for decoder.More() { + keyIface, err := decoder.Token() + if err != nil { + if errors.Is(err, io.EOF) { + // Empty. + return nil + } + return err + } + + key, ok := keyIface.(string) + if !ok { + return fmt.Errorf("invalid Span field: %#v", keyIface) + } + + switch key { + case "traceId", "trace_id": + err = decoder.Decode(&s.TraceID) + case "spanId", "span_id": + err = decoder.Decode(&s.SpanID) + case "traceState", "trace_state": + err = decoder.Decode(&s.TraceState) + case "parentSpanId", "parent_span_id": + err = decoder.Decode(&s.ParentSpanID) + case "flags": + err = decoder.Decode(&s.Flags) + case "name": + err = decoder.Decode(&s.Name) + case "kind": + err = decoder.Decode(&s.Kind) + case "startTimeUnixNano", "start_time_unix_nano": + var val protoUint64 + err = decoder.Decode(&val) + v := int64(min(val.Uint64(), math.MaxInt64)) //nolint:gosec // Overflow checked. + s.StartTime = time.Unix(0, v) + case "endTimeUnixNano", "end_time_unix_nano": + var val protoUint64 + err = decoder.Decode(&val) + v := int64(min(val.Uint64(), math.MaxInt64)) //nolint:gosec // Overflow checked. + s.EndTime = time.Unix(0, v) + case "attributes": + err = decoder.Decode(&s.Attrs) + case "droppedAttributesCount", "dropped_attributes_count": + err = decoder.Decode(&s.DroppedAttrs) + case "events": + err = decoder.Decode(&s.Events) + case "droppedEventsCount", "dropped_events_count": + err = decoder.Decode(&s.DroppedEvents) + case "links": + err = decoder.Decode(&s.Links) + case "droppedLinksCount", "dropped_links_count": + err = decoder.Decode(&s.DroppedLinks) + case "status": + err = decoder.Decode(&s.Status) + default: + // Skip unknown. + } + + if err != nil { + return err + } + } + return nil +} + +// SpanFlags represents constants used to interpret the +// Span.flags field, which is protobuf 'fixed32' type and is to +// be used as bit-fields. Each non-zero value defined in this enum is +// a bit-mask. To extract the bit-field, for example, use an +// expression like: +// +// (span.flags & SPAN_FLAGS_TRACE_FLAGS_MASK) +// +// See https://www.w3.org/TR/trace-context-2/#trace-flags for the flag definitions. +// +// Note that Span flags were introduced in version 1.1 of the +// OpenTelemetry protocol. Older Span producers do not set this +// field, consequently consumers should not rely on the absence of a +// particular flag bit to indicate the presence of a particular feature. +type SpanFlags int32 + +const ( + // SpanFlagsTraceFlagsMask is a mask for trace-flags. + // + // Bits 0-7 are used for trace flags. + SpanFlagsTraceFlagsMask SpanFlags = 255 + // SpanFlagsContextHasIsRemoteMask is a mask for HAS_IS_REMOTE status. + // + // Bits 8 and 9 are used to indicate that the parent span or link span is + // remote. Bit 8 (`HAS_IS_REMOTE`) indicates whether the value is known. + SpanFlagsContextHasIsRemoteMask SpanFlags = 256 + // SpanFlagsContextIsRemoteMask is a mask for IS_REMOTE status. + // + // Bits 8 and 9 are used to indicate that the parent span or link span is + // remote. Bit 9 (`IS_REMOTE`) indicates whether the span or link is + // remote. + SpanFlagsContextIsRemoteMask SpanFlags = 512 +) + +// SpanKind is the type of span. Can be used to specify additional relationships between spans +// in addition to a parent/child relationship. +type SpanKind int32 + +const ( + // SpanKindInternal indicates that the span represents an internal + // operation within an application, as opposed to an operation happening at + // the boundaries. + SpanKindInternal SpanKind = 1 + // SpanKindServer indicates that the span covers server-side handling of an + // RPC or other remote network request. + SpanKindServer SpanKind = 2 + // SpanKindClient indicates that the span describes a request to some + // remote service. + SpanKindClient SpanKind = 3 + // SpanKindProducer indicates that the span describes a producer sending a + // message to a broker. Unlike SpanKindClient and SpanKindServer, there is + // often no direct critical path latency relationship between producer and + // consumer spans. A SpanKindProducer span ends when the message was + // accepted by the broker while the logical processing of the message might + // span a much longer time. + SpanKindProducer SpanKind = 4 + // SpanKindConsumer indicates that the span describes a consumer receiving + // a message from a broker. Like SpanKindProducer, there is often no direct + // critical path latency relationship between producer and consumer spans. + SpanKindConsumer SpanKind = 5 +) + +// SpanEvent is a time-stamped annotation of the span, consisting of user-supplied +// text description and key-value pairs. +type SpanEvent struct { + // time_unix_nano is the time the event occurred. + Time time.Time `json:"timeUnixNano,omitempty"` + // name of the event. + // This field is semantically required to be set to non-empty string. + Name string `json:"name,omitempty"` + // attributes is a collection of attribute key/value pairs on the event. + // Attribute keys MUST be unique (it is not allowed to have more than one + // attribute with the same key). + Attrs []Attr `json:"attributes,omitempty"` + // dropped_attributes_count is the number of dropped attributes. If the value is 0, + // then no attributes were dropped. + DroppedAttrs uint32 `json:"droppedAttributesCount,omitempty"` +} + +// MarshalJSON encodes e into OTLP formatted JSON. +func (e SpanEvent) MarshalJSON() ([]byte, error) { + t := e.Time.UnixNano() + if e.Time.IsZero() || t < 0 { + t = 0 + } + + type Alias SpanEvent + return json.Marshal(struct { + Alias + Time uint64 `json:"timeUnixNano,omitempty"` + }{ + Alias: Alias(e), + Time: uint64(t), //nolint:gosec // >0 checked above + }) +} + +// UnmarshalJSON decodes the OTLP formatted JSON contained in data into se. +func (se *SpanEvent) UnmarshalJSON(data []byte) error { + decoder := json.NewDecoder(bytes.NewReader(data)) + + t, err := decoder.Token() + if err != nil { + return err + } + if t != json.Delim('{') { + return errors.New("invalid SpanEvent type") + } + + for decoder.More() { + keyIface, err := decoder.Token() + if err != nil { + if errors.Is(err, io.EOF) { + // Empty. + return nil + } + return err + } + + key, ok := keyIface.(string) + if !ok { + return fmt.Errorf("invalid SpanEvent field: %#v", keyIface) + } + + switch key { + case "timeUnixNano", "time_unix_nano": + var val protoUint64 + err = decoder.Decode(&val) + v := int64(min(val.Uint64(), math.MaxInt64)) //nolint:gosec // Overflow checked. + se.Time = time.Unix(0, v) + case "name": + err = decoder.Decode(&se.Name) + case "attributes": + err = decoder.Decode(&se.Attrs) + case "droppedAttributesCount", "dropped_attributes_count": + err = decoder.Decode(&se.DroppedAttrs) + default: + // Skip unknown. + } + + if err != nil { + return err + } + } + return nil +} + +// SpanLink is a reference from the current span to another span in the same +// trace or in a different trace. For example, this can be used in batching +// operations, where a single batch handler processes multiple requests from +// different traces or when the handler receives a request from a different +// project. +type SpanLink struct { + // A unique identifier of a trace that this linked span is part of. The ID is a + // 16-byte array. + TraceID TraceID `json:"traceId,omitempty"` + // A unique identifier for the linked span. The ID is an 8-byte array. + SpanID SpanID `json:"spanId,omitempty"` + // The trace_state associated with the link. + TraceState string `json:"traceState,omitempty"` + // attributes is a collection of attribute key/value pairs on the link. + // Attribute keys MUST be unique (it is not allowed to have more than one + // attribute with the same key). + Attrs []Attr `json:"attributes,omitempty"` + // dropped_attributes_count is the number of dropped attributes. If the value is 0, + // then no attributes were dropped. + DroppedAttrs uint32 `json:"droppedAttributesCount,omitempty"` + // Flags, a bit field. + // + // Bits 0-7 (8 least significant bits) are the trace flags as defined in W3C Trace + // Context specification. To read the 8-bit W3C trace flag, use + // `flags & SPAN_FLAGS_TRACE_FLAGS_MASK`. + // + // See https://www.w3.org/TR/trace-context-2/#trace-flags for the flag definitions. + // + // Bits 8 and 9 represent the 3 states of whether the link is remote. + // The states are (unknown, is not remote, is remote). + // To read whether the value is known, use `(flags & SPAN_FLAGS_CONTEXT_HAS_IS_REMOTE_MASK) != 0`. + // To read whether the link is remote, use `(flags & SPAN_FLAGS_CONTEXT_IS_REMOTE_MASK) != 0`. + // + // Readers MUST NOT assume that bits 10-31 (22 most significant bits) will be zero. + // When creating new spans, bits 10-31 (most-significant 22-bits) MUST be zero. + // + // [Optional]. + Flags uint32 `json:"flags,omitempty"` +} + +// UnmarshalJSON decodes the OTLP formatted JSON contained in data into sl. +func (sl *SpanLink) UnmarshalJSON(data []byte) error { + decoder := json.NewDecoder(bytes.NewReader(data)) + + t, err := decoder.Token() + if err != nil { + return err + } + if t != json.Delim('{') { + return errors.New("invalid SpanLink type") + } + + for decoder.More() { + keyIface, err := decoder.Token() + if err != nil { + if errors.Is(err, io.EOF) { + // Empty. + return nil + } + return err + } + + key, ok := keyIface.(string) + if !ok { + return fmt.Errorf("invalid SpanLink field: %#v", keyIface) + } + + switch key { + case "traceId", "trace_id": + err = decoder.Decode(&sl.TraceID) + case "spanId", "span_id": + err = decoder.Decode(&sl.SpanID) + case "traceState", "trace_state": + err = decoder.Decode(&sl.TraceState) + case "attributes": + err = decoder.Decode(&sl.Attrs) + case "droppedAttributesCount", "dropped_attributes_count": + err = decoder.Decode(&sl.DroppedAttrs) + case "flags": + err = decoder.Decode(&sl.Flags) + default: + // Skip unknown. + } + + if err != nil { + return err + } + } + return nil +} diff --git a/vendor/go.opentelemetry.io/auto/sdk/internal/telemetry/status.go b/vendor/go.opentelemetry.io/auto/sdk/internal/telemetry/status.go new file mode 100644 index 00000000..a2802764 --- /dev/null +++ b/vendor/go.opentelemetry.io/auto/sdk/internal/telemetry/status.go @@ -0,0 +1,42 @@ +// Copyright The OpenTelemetry Authors +// SPDX-License-Identifier: Apache-2.0 + +package telemetry + +// StatusCode is the status of a Span. +// +// For the semantics of status codes see +// https://github.com/open-telemetry/opentelemetry-specification/blob/main/specification/trace/api.md#set-status +type StatusCode int32 + +const ( + // StatusCodeUnset is the default status. + StatusCodeUnset StatusCode = 0 + // StatusCodeOK is used when the Span has been validated by an Application + // developer or Operator to have completed successfully. + StatusCodeOK StatusCode = 1 + // StatusCodeError is used when the Span contains an error. + StatusCodeError StatusCode = 2 +) + +var statusCodeStrings = []string{ + "Unset", + "OK", + "Error", +} + +func (s StatusCode) String() string { + if s >= 0 && int(s) < len(statusCodeStrings) { + return statusCodeStrings[s] + } + return "" +} + +// The Status type defines a logical error model that is suitable for different +// programming environments, including REST APIs and RPC APIs. +type Status struct { + // A developer-facing human readable error message. + Message string `json:"message,omitempty"` + // The status code. + Code StatusCode `json:"code,omitempty"` +} diff --git a/vendor/go.opentelemetry.io/auto/sdk/internal/telemetry/traces.go b/vendor/go.opentelemetry.io/auto/sdk/internal/telemetry/traces.go new file mode 100644 index 00000000..44197b80 --- /dev/null +++ b/vendor/go.opentelemetry.io/auto/sdk/internal/telemetry/traces.go @@ -0,0 +1,189 @@ +// Copyright The OpenTelemetry Authors +// SPDX-License-Identifier: Apache-2.0 + +package telemetry + +import ( + "bytes" + "encoding/json" + "errors" + "fmt" + "io" +) + +// Traces represents the traces data that can be stored in a persistent storage, +// OR can be embedded by other protocols that transfer OTLP traces data but do +// not implement the OTLP protocol. +// +// The main difference between this message and collector protocol is that +// in this message there will not be any "control" or "metadata" specific to +// OTLP protocol. +// +// When new fields are added into this message, the OTLP request MUST be updated +// as well. +type Traces struct { + // An array of ResourceSpans. + // For data coming from a single resource this array will typically contain + // one element. Intermediary nodes that receive data from multiple origins + // typically batch the data before forwarding further and in that case this + // array will contain multiple elements. + ResourceSpans []*ResourceSpans `json:"resourceSpans,omitempty"` +} + +// UnmarshalJSON decodes the OTLP formatted JSON contained in data into td. +func (td *Traces) UnmarshalJSON(data []byte) error { + decoder := json.NewDecoder(bytes.NewReader(data)) + + t, err := decoder.Token() + if err != nil { + return err + } + if t != json.Delim('{') { + return errors.New("invalid TracesData type") + } + + for decoder.More() { + keyIface, err := decoder.Token() + if err != nil { + if errors.Is(err, io.EOF) { + // Empty. + return nil + } + return err + } + + key, ok := keyIface.(string) + if !ok { + return fmt.Errorf("invalid TracesData field: %#v", keyIface) + } + + switch key { + case "resourceSpans", "resource_spans": + err = decoder.Decode(&td.ResourceSpans) + default: + // Skip unknown. + } + + if err != nil { + return err + } + } + return nil +} + +// ResourceSpans is a collection of ScopeSpans from a Resource. +type ResourceSpans struct { + // The resource for the spans in this message. + // If this field is not set then no resource info is known. + Resource Resource `json:"resource"` + // A list of ScopeSpans that originate from a resource. + ScopeSpans []*ScopeSpans `json:"scopeSpans,omitempty"` + // This schema_url applies to the data in the "resource" field. It does not apply + // to the data in the "scope_spans" field which have their own schema_url field. + SchemaURL string `json:"schemaUrl,omitempty"` +} + +// UnmarshalJSON decodes the OTLP formatted JSON contained in data into rs. +func (rs *ResourceSpans) UnmarshalJSON(data []byte) error { + decoder := json.NewDecoder(bytes.NewReader(data)) + + t, err := decoder.Token() + if err != nil { + return err + } + if t != json.Delim('{') { + return errors.New("invalid ResourceSpans type") + } + + for decoder.More() { + keyIface, err := decoder.Token() + if err != nil { + if errors.Is(err, io.EOF) { + // Empty. + return nil + } + return err + } + + key, ok := keyIface.(string) + if !ok { + return fmt.Errorf("invalid ResourceSpans field: %#v", keyIface) + } + + switch key { + case "resource": + err = decoder.Decode(&rs.Resource) + case "scopeSpans", "scope_spans": + err = decoder.Decode(&rs.ScopeSpans) + case "schemaUrl", "schema_url": + err = decoder.Decode(&rs.SchemaURL) + default: + // Skip unknown. + } + + if err != nil { + return err + } + } + return nil +} + +// ScopeSpans is a collection of Spans produced by an InstrumentationScope. +type ScopeSpans struct { + // The instrumentation scope information for the spans in this message. + // Semantically when InstrumentationScope isn't set, it is equivalent with + // an empty instrumentation scope name (unknown). + Scope *Scope `json:"scope"` + // A list of Spans that originate from an instrumentation scope. + Spans []*Span `json:"spans,omitempty"` + // The Schema URL, if known. This is the identifier of the Schema that the span data + // is recorded in. To learn more about Schema URL see + // https://opentelemetry.io/docs/specs/otel/schemas/#schema-url + // This schema_url applies to all spans and span events in the "spans" field. + SchemaURL string `json:"schemaUrl,omitempty"` +} + +// UnmarshalJSON decodes the OTLP formatted JSON contained in data into ss. +func (ss *ScopeSpans) UnmarshalJSON(data []byte) error { + decoder := json.NewDecoder(bytes.NewReader(data)) + + t, err := decoder.Token() + if err != nil { + return err + } + if t != json.Delim('{') { + return errors.New("invalid ScopeSpans type") + } + + for decoder.More() { + keyIface, err := decoder.Token() + if err != nil { + if errors.Is(err, io.EOF) { + // Empty. + return nil + } + return err + } + + key, ok := keyIface.(string) + if !ok { + return fmt.Errorf("invalid ScopeSpans field: %#v", keyIface) + } + + switch key { + case "scope": + err = decoder.Decode(&ss.Scope) + case "spans": + err = decoder.Decode(&ss.Spans) + case "schemaUrl", "schema_url": + err = decoder.Decode(&ss.SchemaURL) + default: + // Skip unknown. + } + + if err != nil { + return err + } + } + return nil +} diff --git a/vendor/go.opentelemetry.io/auto/sdk/internal/telemetry/value.go b/vendor/go.opentelemetry.io/auto/sdk/internal/telemetry/value.go new file mode 100644 index 00000000..022768bb --- /dev/null +++ b/vendor/go.opentelemetry.io/auto/sdk/internal/telemetry/value.go @@ -0,0 +1,450 @@ +// Copyright The OpenTelemetry Authors +// SPDX-License-Identifier: Apache-2.0 + +package telemetry + +import ( + "bytes" + "cmp" + "encoding/base64" + "encoding/json" + "errors" + "fmt" + "io" + "math" + "slices" + "strconv" + "unsafe" +) + +// A Value represents a structured value. +// A zero value is valid and represents an empty value. +type Value struct { + // Ensure forward compatibility by explicitly making this not comparable. + noCmp [0]func() //nolint:unused // This is indeed used. + + // num holds the value for Int64, Float64, and Bool. It holds the length + // for String, Bytes, Slice, Map. + num uint64 + // any holds either the KindBool, KindInt64, KindFloat64, stringptr, + // bytesptr, sliceptr, or mapptr. If KindBool, KindInt64, or KindFloat64 + // then the value of Value is in num as described above. Otherwise, it + // contains the value wrapped in the appropriate type. + any any +} + +type ( + // sliceptr represents a value in Value.any for KindString Values. + stringptr *byte + // bytesptr represents a value in Value.any for KindBytes Values. + bytesptr *byte + // sliceptr represents a value in Value.any for KindSlice Values. + sliceptr *Value + // mapptr represents a value in Value.any for KindMap Values. + mapptr *Attr +) + +// ValueKind is the kind of a [Value]. +type ValueKind int + +// ValueKind values. +const ( + ValueKindEmpty ValueKind = iota + ValueKindBool + ValueKindFloat64 + ValueKindInt64 + ValueKindString + ValueKindBytes + ValueKindSlice + ValueKindMap +) + +var valueKindStrings = []string{ + "Empty", + "Bool", + "Float64", + "Int64", + "String", + "Bytes", + "Slice", + "Map", +} + +func (k ValueKind) String() string { + if k >= 0 && int(k) < len(valueKindStrings) { + return valueKindStrings[k] + } + return "" +} + +// StringValue returns a new [Value] for a string. +func StringValue(v string) Value { + return Value{ + num: uint64(len(v)), + any: stringptr(unsafe.StringData(v)), + } +} + +// IntValue returns a [Value] for an int. +func IntValue(v int) Value { return Int64Value(int64(v)) } + +// Int64Value returns a [Value] for an int64. +func Int64Value(v int64) Value { + return Value{num: uint64(v), any: ValueKindInt64} //nolint:gosec // Raw value conv. +} + +// Float64Value returns a [Value] for a float64. +func Float64Value(v float64) Value { + return Value{num: math.Float64bits(v), any: ValueKindFloat64} +} + +// BoolValue returns a [Value] for a bool. +func BoolValue(v bool) Value { //nolint:revive // Not a control flag. + var n uint64 + if v { + n = 1 + } + return Value{num: n, any: ValueKindBool} +} + +// BytesValue returns a [Value] for a byte slice. The passed slice must not be +// changed after it is passed. +func BytesValue(v []byte) Value { + return Value{ + num: uint64(len(v)), + any: bytesptr(unsafe.SliceData(v)), + } +} + +// SliceValue returns a [Value] for a slice of [Value]. The passed slice must +// not be changed after it is passed. +func SliceValue(vs ...Value) Value { + return Value{ + num: uint64(len(vs)), + any: sliceptr(unsafe.SliceData(vs)), + } +} + +// MapValue returns a new [Value] for a slice of key-value pairs. The passed +// slice must not be changed after it is passed. +func MapValue(kvs ...Attr) Value { + return Value{ + num: uint64(len(kvs)), + any: mapptr(unsafe.SliceData(kvs)), + } +} + +// AsString returns the value held by v as a string. +func (v Value) AsString() string { + if sp, ok := v.any.(stringptr); ok { + return unsafe.String(sp, v.num) + } + // TODO: error handle + return "" +} + +// asString returns the value held by v as a string. It will panic if the Value +// is not KindString. +func (v Value) asString() string { + return unsafe.String(v.any.(stringptr), v.num) +} + +// AsInt64 returns the value held by v as an int64. +func (v Value) AsInt64() int64 { + if v.Kind() != ValueKindInt64 { + // TODO: error handle + return 0 + } + return v.asInt64() +} + +// asInt64 returns the value held by v as an int64. If v is not of KindInt64, +// this will return garbage. +func (v Value) asInt64() int64 { + // Assumes v.num was a valid int64 (overflow not checked). + return int64(v.num) //nolint:gosec // Bounded. +} + +// AsBool returns the value held by v as a bool. +func (v Value) AsBool() bool { + if v.Kind() != ValueKindBool { + // TODO: error handle + return false + } + return v.asBool() +} + +// asBool returns the value held by v as a bool. If v is not of KindBool, this +// will return garbage. +func (v Value) asBool() bool { return v.num == 1 } + +// AsFloat64 returns the value held by v as a float64. +func (v Value) AsFloat64() float64 { + if v.Kind() != ValueKindFloat64 { + // TODO: error handle + return 0 + } + return v.asFloat64() +} + +// asFloat64 returns the value held by v as a float64. If v is not of +// KindFloat64, this will return garbage. +func (v Value) asFloat64() float64 { return math.Float64frombits(v.num) } + +// AsBytes returns the value held by v as a []byte. +func (v Value) AsBytes() []byte { + if sp, ok := v.any.(bytesptr); ok { + return unsafe.Slice((*byte)(sp), v.num) + } + // TODO: error handle + return nil +} + +// asBytes returns the value held by v as a []byte. It will panic if the Value +// is not KindBytes. +func (v Value) asBytes() []byte { + return unsafe.Slice((*byte)(v.any.(bytesptr)), v.num) +} + +// AsSlice returns the value held by v as a []Value. +func (v Value) AsSlice() []Value { + if sp, ok := v.any.(sliceptr); ok { + return unsafe.Slice((*Value)(sp), v.num) + } + // TODO: error handle + return nil +} + +// asSlice returns the value held by v as a []Value. It will panic if the Value +// is not KindSlice. +func (v Value) asSlice() []Value { + return unsafe.Slice((*Value)(v.any.(sliceptr)), v.num) +} + +// AsMap returns the value held by v as a []Attr. +func (v Value) AsMap() []Attr { + if sp, ok := v.any.(mapptr); ok { + return unsafe.Slice((*Attr)(sp), v.num) + } + // TODO: error handle + return nil +} + +// asMap returns the value held by v as a []Attr. It will panic if the +// Value is not KindMap. +func (v Value) asMap() []Attr { + return unsafe.Slice((*Attr)(v.any.(mapptr)), v.num) +} + +// Kind returns the Kind of v. +func (v Value) Kind() ValueKind { + switch x := v.any.(type) { + case ValueKind: + return x + case stringptr: + return ValueKindString + case bytesptr: + return ValueKindBytes + case sliceptr: + return ValueKindSlice + case mapptr: + return ValueKindMap + default: + return ValueKindEmpty + } +} + +// Empty returns if v does not hold any value. +func (v Value) Empty() bool { return v.Kind() == ValueKindEmpty } + +// Equal returns if v is equal to w. +func (v Value) Equal(w Value) bool { + k1 := v.Kind() + k2 := w.Kind() + if k1 != k2 { + return false + } + switch k1 { + case ValueKindInt64, ValueKindBool: + return v.num == w.num + case ValueKindString: + return v.asString() == w.asString() + case ValueKindFloat64: + return v.asFloat64() == w.asFloat64() + case ValueKindSlice: + return slices.EqualFunc(v.asSlice(), w.asSlice(), Value.Equal) + case ValueKindMap: + sv := sortMap(v.asMap()) + sw := sortMap(w.asMap()) + return slices.EqualFunc(sv, sw, Attr.Equal) + case ValueKindBytes: + return bytes.Equal(v.asBytes(), w.asBytes()) + case ValueKindEmpty: + return true + default: + // TODO: error handle + return false + } +} + +func sortMap(m []Attr) []Attr { + sm := make([]Attr, len(m)) + copy(sm, m) + slices.SortFunc(sm, func(a, b Attr) int { + return cmp.Compare(a.Key, b.Key) + }) + + return sm +} + +// String returns Value's value as a string, formatted like [fmt.Sprint]. +// +// The returned string is meant for debugging; +// the string representation is not stable. +func (v Value) String() string { + switch v.Kind() { + case ValueKindString: + return v.asString() + case ValueKindInt64: + // Assumes v.num was a valid int64 (overflow not checked). + return strconv.FormatInt(int64(v.num), 10) //nolint:gosec // Bounded. + case ValueKindFloat64: + return strconv.FormatFloat(v.asFloat64(), 'g', -1, 64) + case ValueKindBool: + return strconv.FormatBool(v.asBool()) + case ValueKindBytes: + return string(v.asBytes()) + case ValueKindMap: + return fmt.Sprint(v.asMap()) + case ValueKindSlice: + return fmt.Sprint(v.asSlice()) + case ValueKindEmpty: + return "" + default: + // Try to handle this as gracefully as possible. + // + // Don't panic here. The goal here is to have developers find this + // first if a slog.Kind is is not handled. It is + // preferable to have user's open issue asking why their attributes + // have a "unhandled: " prefix than say that their code is panicking. + return fmt.Sprintf("", v.Kind()) + } +} + +// MarshalJSON encodes v into OTLP formatted JSON. +func (v *Value) MarshalJSON() ([]byte, error) { + switch v.Kind() { + case ValueKindString: + return json.Marshal(struct { + Value string `json:"stringValue"` + }{v.asString()}) + case ValueKindInt64: + return json.Marshal(struct { + Value string `json:"intValue"` + }{strconv.FormatInt(int64(v.num), 10)}) //nolint:gosec // Raw value conv. + case ValueKindFloat64: + return json.Marshal(struct { + Value float64 `json:"doubleValue"` + }{v.asFloat64()}) + case ValueKindBool: + return json.Marshal(struct { + Value bool `json:"boolValue"` + }{v.asBool()}) + case ValueKindBytes: + return json.Marshal(struct { + Value []byte `json:"bytesValue"` + }{v.asBytes()}) + case ValueKindMap: + return json.Marshal(struct { + Value struct { + Values []Attr `json:"values"` + } `json:"kvlistValue"` + }{struct { + Values []Attr `json:"values"` + }{v.asMap()}}) + case ValueKindSlice: + return json.Marshal(struct { + Value struct { + Values []Value `json:"values"` + } `json:"arrayValue"` + }{struct { + Values []Value `json:"values"` + }{v.asSlice()}}) + case ValueKindEmpty: + return nil, nil + default: + return nil, fmt.Errorf("unknown Value kind: %s", v.Kind().String()) + } +} + +// UnmarshalJSON decodes the OTLP formatted JSON contained in data into v. +func (v *Value) UnmarshalJSON(data []byte) error { + decoder := json.NewDecoder(bytes.NewReader(data)) + + t, err := decoder.Token() + if err != nil { + return err + } + if t != json.Delim('{') { + return errors.New("invalid Value type") + } + + for decoder.More() { + keyIface, err := decoder.Token() + if err != nil { + if errors.Is(err, io.EOF) { + // Empty. + return nil + } + return err + } + + key, ok := keyIface.(string) + if !ok { + return fmt.Errorf("invalid Value key: %#v", keyIface) + } + + switch key { + case "stringValue", "string_value": + var val string + err = decoder.Decode(&val) + *v = StringValue(val) + case "boolValue", "bool_value": + var val bool + err = decoder.Decode(&val) + *v = BoolValue(val) + case "intValue", "int_value": + var val protoInt64 + err = decoder.Decode(&val) + *v = Int64Value(val.Int64()) + case "doubleValue", "double_value": + var val float64 + err = decoder.Decode(&val) + *v = Float64Value(val) + case "bytesValue", "bytes_value": + var val64 string + if err := decoder.Decode(&val64); err != nil { + return err + } + var val []byte + val, err = base64.StdEncoding.DecodeString(val64) + *v = BytesValue(val) + case "arrayValue", "array_value": + var val struct{ Values []Value } + err = decoder.Decode(&val) + *v = SliceValue(val.Values...) + case "kvlistValue", "kvlist_value": + var val struct{ Values []Attr } + err = decoder.Decode(&val) + *v = MapValue(val.Values...) + default: + // Skip unknown. + continue + } + // Use first valid. Ignore the rest. + return err + } + + // Only unknown fields. Return nil without unmarshaling any value. + return nil +} diff --git a/vendor/go.opentelemetry.io/auto/sdk/limit.go b/vendor/go.opentelemetry.io/auto/sdk/limit.go new file mode 100644 index 00000000..86babf1a --- /dev/null +++ b/vendor/go.opentelemetry.io/auto/sdk/limit.go @@ -0,0 +1,94 @@ +// Copyright The OpenTelemetry Authors +// SPDX-License-Identifier: Apache-2.0 + +package sdk + +import ( + "log/slog" + "os" + "strconv" +) + +// maxSpan are the span limits resolved during startup. +var maxSpan = newSpanLimits() + +type spanLimits struct { + // Attrs is the number of allowed attributes for a span. + // + // This is resolved from the environment variable value for the + // OTEL_SPAN_ATTRIBUTE_COUNT_LIMIT key if it exists. Otherwise, the + // environment variable value for OTEL_ATTRIBUTE_COUNT_LIMIT, or 128 if + // that is not set, is used. + Attrs int + // AttrValueLen is the maximum attribute value length allowed for a span. + // + // This is resolved from the environment variable value for the + // OTEL_SPAN_ATTRIBUTE_VALUE_LENGTH_LIMIT key if it exists. Otherwise, the + // environment variable value for OTEL_ATTRIBUTE_VALUE_LENGTH_LIMIT, or -1 + // if that is not set, is used. + AttrValueLen int + // Events is the number of allowed events for a span. + // + // This is resolved from the environment variable value for the + // OTEL_SPAN_EVENT_COUNT_LIMIT key, or 128 is used if that is not set. + Events int + // EventAttrs is the number of allowed attributes for a span event. + // + // The is resolved from the environment variable value for the + // OTEL_EVENT_ATTRIBUTE_COUNT_LIMIT key, or 128 is used if that is not set. + EventAttrs int + // Links is the number of allowed Links for a span. + // + // This is resolved from the environment variable value for the + // OTEL_SPAN_LINK_COUNT_LIMIT, or 128 is used if that is not set. + Links int + // LinkAttrs is the number of allowed attributes for a span link. + // + // This is resolved from the environment variable value for the + // OTEL_LINK_ATTRIBUTE_COUNT_LIMIT, or 128 is used if that is not set. + LinkAttrs int +} + +func newSpanLimits() spanLimits { + return spanLimits{ + Attrs: firstEnv( + 128, + "OTEL_SPAN_ATTRIBUTE_COUNT_LIMIT", + "OTEL_ATTRIBUTE_COUNT_LIMIT", + ), + AttrValueLen: firstEnv( + -1, // Unlimited. + "OTEL_SPAN_ATTRIBUTE_VALUE_LENGTH_LIMIT", + "OTEL_ATTRIBUTE_VALUE_LENGTH_LIMIT", + ), + Events: firstEnv(128, "OTEL_SPAN_EVENT_COUNT_LIMIT"), + EventAttrs: firstEnv(128, "OTEL_EVENT_ATTRIBUTE_COUNT_LIMIT"), + Links: firstEnv(128, "OTEL_SPAN_LINK_COUNT_LIMIT"), + LinkAttrs: firstEnv(128, "OTEL_LINK_ATTRIBUTE_COUNT_LIMIT"), + } +} + +// firstEnv returns the parsed integer value of the first matching environment +// variable from keys. The defaultVal is returned if the value is not an +// integer or no match is found. +func firstEnv(defaultVal int, keys ...string) int { + for _, key := range keys { + strV := os.Getenv(key) + if strV == "" { + continue + } + + v, err := strconv.Atoi(strV) + if err == nil { + return v + } + slog.Warn( + "invalid limit environment variable", + "error", err, + "key", key, + "value", strV, + ) + } + + return defaultVal +} diff --git a/vendor/go.opentelemetry.io/auto/sdk/span.go b/vendor/go.opentelemetry.io/auto/sdk/span.go new file mode 100644 index 00000000..815d271f --- /dev/null +++ b/vendor/go.opentelemetry.io/auto/sdk/span.go @@ -0,0 +1,447 @@ +// Copyright The OpenTelemetry Authors +// SPDX-License-Identifier: Apache-2.0 + +package sdk + +import ( + "encoding/json" + "fmt" + "math" + "reflect" + "runtime" + "strings" + "sync" + "sync/atomic" + "time" + "unicode/utf8" + + "go.opentelemetry.io/otel/attribute" + "go.opentelemetry.io/otel/codes" + semconv "go.opentelemetry.io/otel/semconv/v1.37.0" + "go.opentelemetry.io/otel/trace" + "go.opentelemetry.io/otel/trace/noop" + + "go.opentelemetry.io/auto/sdk/internal/telemetry" +) + +type span struct { + noop.Span + + spanContext trace.SpanContext + sampled atomic.Bool + + mu sync.Mutex + traces *telemetry.Traces + span *telemetry.Span +} + +func (s *span) SpanContext() trace.SpanContext { + if s == nil { + return trace.SpanContext{} + } + // s.spanContext is immutable, do not acquire lock s.mu. + return s.spanContext +} + +func (s *span) IsRecording() bool { + if s == nil { + return false + } + + return s.sampled.Load() +} + +func (s *span) SetStatus(c codes.Code, msg string) { + if s == nil || !s.sampled.Load() { + return + } + + s.mu.Lock() + defer s.mu.Unlock() + + if s.span.Status == nil { + s.span.Status = new(telemetry.Status) + } + + s.span.Status.Message = msg + + switch c { + case codes.Unset: + s.span.Status.Code = telemetry.StatusCodeUnset + case codes.Error: + s.span.Status.Code = telemetry.StatusCodeError + case codes.Ok: + s.span.Status.Code = telemetry.StatusCodeOK + } +} + +func (s *span) SetAttributes(attrs ...attribute.KeyValue) { + if s == nil || !s.sampled.Load() { + return + } + + s.mu.Lock() + defer s.mu.Unlock() + + limit := maxSpan.Attrs + if limit == 0 { + // No attributes allowed. + n := int64(len(attrs)) + if n > 0 { + s.span.DroppedAttrs += uint32( //nolint:gosec // Bounds checked. + min(n, math.MaxUint32), + ) + } + return + } + + m := make(map[string]int) + for i, a := range s.span.Attrs { + m[a.Key] = i + } + + for _, a := range attrs { + val := convAttrValue(a.Value) + if val.Empty() { + s.span.DroppedAttrs++ + continue + } + + if idx, ok := m[string(a.Key)]; ok { + s.span.Attrs[idx] = telemetry.Attr{ + Key: string(a.Key), + Value: val, + } + } else if limit < 0 || len(s.span.Attrs) < limit { + s.span.Attrs = append(s.span.Attrs, telemetry.Attr{ + Key: string(a.Key), + Value: val, + }) + m[string(a.Key)] = len(s.span.Attrs) - 1 + } else { + s.span.DroppedAttrs++ + } + } +} + +// convCappedAttrs converts up to limit attrs into a []telemetry.Attr. The +// number of dropped attributes is also returned. +func convCappedAttrs(limit int, attrs []attribute.KeyValue) ([]telemetry.Attr, uint32) { + n := len(attrs) + if limit == 0 { + var out uint32 + if n > 0 { + out = uint32(min(int64(n), math.MaxUint32)) //nolint:gosec // Bounds checked. + } + return nil, out + } + + if limit < 0 { + // Unlimited. + return convAttrs(attrs), 0 + } + + if n < 0 { + n = 0 + } + + limit = min(n, limit) + return convAttrs(attrs[:limit]), uint32(n - limit) //nolint:gosec // Bounds checked. +} + +func convAttrs(attrs []attribute.KeyValue) []telemetry.Attr { + if len(attrs) == 0 { + // Avoid allocations if not necessary. + return nil + } + + out := make([]telemetry.Attr, 0, len(attrs)) + for _, attr := range attrs { + key := string(attr.Key) + val := convAttrValue(attr.Value) + if val.Empty() { + continue + } + out = append(out, telemetry.Attr{Key: key, Value: val}) + } + return out +} + +func convAttrValue(value attribute.Value) telemetry.Value { + switch value.Type() { + case attribute.BOOL: + return telemetry.BoolValue(value.AsBool()) + case attribute.INT64: + return telemetry.Int64Value(value.AsInt64()) + case attribute.FLOAT64: + return telemetry.Float64Value(value.AsFloat64()) + case attribute.STRING: + v := truncate(maxSpan.AttrValueLen, value.AsString()) + return telemetry.StringValue(v) + case attribute.BOOLSLICE: + slice := value.AsBoolSlice() + out := make([]telemetry.Value, 0, len(slice)) + for _, v := range slice { + out = append(out, telemetry.BoolValue(v)) + } + return telemetry.SliceValue(out...) + case attribute.INT64SLICE: + slice := value.AsInt64Slice() + out := make([]telemetry.Value, 0, len(slice)) + for _, v := range slice { + out = append(out, telemetry.Int64Value(v)) + } + return telemetry.SliceValue(out...) + case attribute.FLOAT64SLICE: + slice := value.AsFloat64Slice() + out := make([]telemetry.Value, 0, len(slice)) + for _, v := range slice { + out = append(out, telemetry.Float64Value(v)) + } + return telemetry.SliceValue(out...) + case attribute.STRINGSLICE: + slice := value.AsStringSlice() + out := make([]telemetry.Value, 0, len(slice)) + for _, v := range slice { + v = truncate(maxSpan.AttrValueLen, v) + out = append(out, telemetry.StringValue(v)) + } + return telemetry.SliceValue(out...) + } + return telemetry.Value{} +} + +// truncate returns a truncated version of s such that it contains less than +// the limit number of characters. Truncation is applied by returning the limit +// number of valid characters contained in s. +// +// If limit is negative, it returns the original string. +// +// UTF-8 is supported. When truncating, all invalid characters are dropped +// before applying truncation. +// +// If s already contains less than the limit number of bytes, it is returned +// unchanged. No invalid characters are removed. +func truncate(limit int, s string) string { + // This prioritize performance in the following order based on the most + // common expected use-cases. + // + // - Short values less than the default limit (128). + // - Strings with valid encodings that exceed the limit. + // - No limit. + // - Strings with invalid encodings that exceed the limit. + if limit < 0 || len(s) <= limit { + return s + } + + // Optimistically, assume all valid UTF-8. + var b strings.Builder + count := 0 + for i, c := range s { + if c != utf8.RuneError { + count++ + if count > limit { + return s[:i] + } + continue + } + + _, size := utf8.DecodeRuneInString(s[i:]) + if size == 1 { + // Invalid encoding. + b.Grow(len(s) - 1) + _, _ = b.WriteString(s[:i]) + s = s[i:] + break + } + } + + // Fast-path, no invalid input. + if b.Cap() == 0 { + return s + } + + // Truncate while validating UTF-8. + for i := 0; i < len(s) && count < limit; { + c := s[i] + if c < utf8.RuneSelf { + // Optimization for single byte runes (common case). + _ = b.WriteByte(c) + i++ + count++ + continue + } + + _, size := utf8.DecodeRuneInString(s[i:]) + if size == 1 { + // We checked for all 1-byte runes above, this is a RuneError. + i++ + continue + } + + _, _ = b.WriteString(s[i : i+size]) + i += size + count++ + } + + return b.String() +} + +func (s *span) End(opts ...trace.SpanEndOption) { + if s == nil || !s.sampled.Swap(false) { + return + } + + // s.end exists so the lock (s.mu) is not held while s.ended is called. + s.ended(s.end(opts)) +} + +func (s *span) end(opts []trace.SpanEndOption) []byte { + s.mu.Lock() + defer s.mu.Unlock() + + cfg := trace.NewSpanEndConfig(opts...) + if t := cfg.Timestamp(); !t.IsZero() { + s.span.EndTime = cfg.Timestamp() + } else { + s.span.EndTime = time.Now() + } + + b, _ := json.Marshal(s.traces) // TODO: do not ignore this error. + return b +} + +// Expected to be implemented in eBPF. +// +//go:noinline +func (*span) ended(buf []byte) { ended(buf) } + +// ended is used for testing. +var ended = func([]byte) {} + +func (s *span) RecordError(err error, opts ...trace.EventOption) { + if s == nil || err == nil || !s.sampled.Load() { + return + } + + cfg := trace.NewEventConfig(opts...) + + attrs := cfg.Attributes() + attrs = append(attrs, + semconv.ExceptionType(typeStr(err)), + semconv.ExceptionMessage(err.Error()), + ) + if cfg.StackTrace() { + buf := make([]byte, 2048) + n := runtime.Stack(buf, false) + attrs = append(attrs, semconv.ExceptionStacktrace(string(buf[0:n]))) + } + + s.mu.Lock() + defer s.mu.Unlock() + + s.addEvent(semconv.ExceptionEventName, cfg.Timestamp(), attrs) +} + +func typeStr(i any) string { + t := reflect.TypeOf(i) + if t.PkgPath() == "" && t.Name() == "" { + // Likely a builtin type. + return t.String() + } + return fmt.Sprintf("%s.%s", t.PkgPath(), t.Name()) +} + +func (s *span) AddEvent(name string, opts ...trace.EventOption) { + if s == nil || !s.sampled.Load() { + return + } + + cfg := trace.NewEventConfig(opts...) + + s.mu.Lock() + defer s.mu.Unlock() + + s.addEvent(name, cfg.Timestamp(), cfg.Attributes()) +} + +// addEvent adds an event with name and attrs at tStamp to the span. The span +// lock (s.mu) needs to be held by the caller. +func (s *span) addEvent(name string, tStamp time.Time, attrs []attribute.KeyValue) { + limit := maxSpan.Events + + if limit == 0 { + s.span.DroppedEvents++ + return + } + + if limit > 0 && len(s.span.Events) == limit { + // Drop head while avoiding allocation of more capacity. + copy(s.span.Events[:limit-1], s.span.Events[1:]) + s.span.Events = s.span.Events[:limit-1] + s.span.DroppedEvents++ + } + + e := &telemetry.SpanEvent{Time: tStamp, Name: name} + e.Attrs, e.DroppedAttrs = convCappedAttrs(maxSpan.EventAttrs, attrs) + + s.span.Events = append(s.span.Events, e) +} + +func (s *span) AddLink(link trace.Link) { + if s == nil || !s.sampled.Load() { + return + } + + l := maxSpan.Links + + s.mu.Lock() + defer s.mu.Unlock() + + if l == 0 { + s.span.DroppedLinks++ + return + } + + if l > 0 && len(s.span.Links) == l { + // Drop head while avoiding allocation of more capacity. + copy(s.span.Links[:l-1], s.span.Links[1:]) + s.span.Links = s.span.Links[:l-1] + s.span.DroppedLinks++ + } + + s.span.Links = append(s.span.Links, convLink(link)) +} + +func convLinks(links []trace.Link) []*telemetry.SpanLink { + out := make([]*telemetry.SpanLink, 0, len(links)) + for _, link := range links { + out = append(out, convLink(link)) + } + return out +} + +func convLink(link trace.Link) *telemetry.SpanLink { + l := &telemetry.SpanLink{ + TraceID: telemetry.TraceID(link.SpanContext.TraceID()), + SpanID: telemetry.SpanID(link.SpanContext.SpanID()), + TraceState: link.SpanContext.TraceState().String(), + Flags: uint32(link.SpanContext.TraceFlags()), + } + l.Attrs, l.DroppedAttrs = convCappedAttrs(maxSpan.LinkAttrs, link.Attributes) + + return l +} + +func (s *span) SetName(name string) { + if s == nil || !s.sampled.Load() { + return + } + + s.mu.Lock() + defer s.mu.Unlock() + + s.span.Name = name +} + +func (*span) TracerProvider() trace.TracerProvider { return TracerProvider() } diff --git a/vendor/go.opentelemetry.io/auto/sdk/tracer.go b/vendor/go.opentelemetry.io/auto/sdk/tracer.go new file mode 100644 index 00000000..e09acf02 --- /dev/null +++ b/vendor/go.opentelemetry.io/auto/sdk/tracer.go @@ -0,0 +1,141 @@ +// Copyright The OpenTelemetry Authors +// SPDX-License-Identifier: Apache-2.0 + +package sdk + +import ( + "context" + "math" + "time" + + "go.opentelemetry.io/otel/trace" + "go.opentelemetry.io/otel/trace/noop" + + "go.opentelemetry.io/auto/sdk/internal/telemetry" +) + +type tracer struct { + noop.Tracer + + name, schemaURL, version string +} + +var _ trace.Tracer = tracer{} + +func (t tracer) Start( + ctx context.Context, + name string, + opts ...trace.SpanStartOption, +) (context.Context, trace.Span) { + var psc, sc trace.SpanContext + sampled := true + span := new(span) + + // Ask eBPF for sampling decision and span context info. + t.start(ctx, span, &psc, &sampled, &sc) + + span.sampled.Store(sampled) + span.spanContext = sc + + ctx = trace.ContextWithSpan(ctx, span) + + if sampled { + // Only build traces if sampled. + cfg := trace.NewSpanStartConfig(opts...) + span.traces, span.span = t.traces(name, cfg, span.spanContext, psc) + } + + return ctx, span +} + +// Expected to be implemented in eBPF. +// +//go:noinline +func (t *tracer) start( + ctx context.Context, + spanPtr *span, + psc *trace.SpanContext, + sampled *bool, + sc *trace.SpanContext, +) { + start(ctx, spanPtr, psc, sampled, sc) +} + +// start is used for testing. +var start = func(context.Context, *span, *trace.SpanContext, *bool, *trace.SpanContext) {} + +var intToUint32Bound = min(math.MaxInt, math.MaxUint32) + +func (t tracer) traces( + name string, + cfg trace.SpanConfig, + sc, psc trace.SpanContext, +) (*telemetry.Traces, *telemetry.Span) { + span := &telemetry.Span{ + TraceID: telemetry.TraceID(sc.TraceID()), + SpanID: telemetry.SpanID(sc.SpanID()), + Flags: uint32(sc.TraceFlags()), + TraceState: sc.TraceState().String(), + ParentSpanID: telemetry.SpanID(psc.SpanID()), + Name: name, + Kind: spanKind(cfg.SpanKind()), + } + + span.Attrs, span.DroppedAttrs = convCappedAttrs(maxSpan.Attrs, cfg.Attributes()) + + links := cfg.Links() + if limit := maxSpan.Links; limit == 0 { + n := len(links) + if n > 0 { + bounded := max(min(n, intToUint32Bound), 0) + span.DroppedLinks = uint32(bounded) //nolint:gosec // Bounds checked. + } + } else { + if limit > 0 { + n := max(len(links)-limit, 0) + bounded := min(n, intToUint32Bound) + span.DroppedLinks = uint32(bounded) //nolint:gosec // Bounds checked. + links = links[n:] + } + span.Links = convLinks(links) + } + + if t := cfg.Timestamp(); !t.IsZero() { + span.StartTime = cfg.Timestamp() + } else { + span.StartTime = time.Now() + } + + return &telemetry.Traces{ + ResourceSpans: []*telemetry.ResourceSpans{ + { + ScopeSpans: []*telemetry.ScopeSpans{ + { + Scope: &telemetry.Scope{ + Name: t.name, + Version: t.version, + }, + Spans: []*telemetry.Span{span}, + SchemaURL: t.schemaURL, + }, + }, + }, + }, + }, span +} + +func spanKind(kind trace.SpanKind) telemetry.SpanKind { + switch kind { + case trace.SpanKindInternal: + return telemetry.SpanKindInternal + case trace.SpanKindServer: + return telemetry.SpanKindServer + case trace.SpanKindClient: + return telemetry.SpanKindClient + case trace.SpanKindProducer: + return telemetry.SpanKindProducer + case trace.SpanKindConsumer: + return telemetry.SpanKindConsumer + } + return telemetry.SpanKind(0) // undefined. +} diff --git a/vendor/go.opentelemetry.io/auto/sdk/tracer_provider.go b/vendor/go.opentelemetry.io/auto/sdk/tracer_provider.go new file mode 100644 index 00000000..dbc477a5 --- /dev/null +++ b/vendor/go.opentelemetry.io/auto/sdk/tracer_provider.go @@ -0,0 +1,33 @@ +// Copyright The OpenTelemetry Authors +// SPDX-License-Identifier: Apache-2.0 + +package sdk + +import ( + "go.opentelemetry.io/otel/trace" + "go.opentelemetry.io/otel/trace/noop" +) + +// TracerProvider returns an auto-instrumentable [trace.TracerProvider]. +// +// If an [go.opentelemetry.io/auto.Instrumentation] is configured to instrument +// the process using the returned TracerProvider, all of the telemetry it +// produces will be processed and handled by that Instrumentation. By default, +// if no Instrumentation instruments the TracerProvider it will not generate +// any trace telemetry. +func TracerProvider() trace.TracerProvider { return tracerProviderInstance } + +var tracerProviderInstance = new(tracerProvider) + +type tracerProvider struct{ noop.TracerProvider } + +var _ trace.TracerProvider = tracerProvider{} + +func (p tracerProvider) Tracer(name string, opts ...trace.TracerOption) trace.Tracer { + cfg := trace.NewTracerConfig(opts...) + return tracer{ + name: name, + version: cfg.InstrumentationVersion(), + schemaURL: cfg.SchemaURL(), + } +} diff --git a/vendor/go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp/LICENSE b/vendor/go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp/LICENSE new file mode 100644 index 00000000..f1aee0f1 --- /dev/null +++ b/vendor/go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp/LICENSE @@ -0,0 +1,231 @@ + Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + + TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + + 1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + + 2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + + 3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + + 4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + + 5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + + 6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + + 7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + + 8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + + 9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + + END OF TERMS AND CONDITIONS + + APPENDIX: How to apply the Apache License to your work. + + To apply the Apache License to your work, attach the following + boilerplate notice, with the fields enclosed by brackets "[]" + replaced with your own identifying information. (Don't include + the brackets!) The text should be enclosed in the appropriate + comment syntax for the file format. We also recommend that a + file or class name and description of purpose be included on the + same "printed page" as the copyright notice for easier + identification within third-party archives. + + Copyright [yyyy] [name of copyright owner] + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. + +-------------------------------------------------------------------------------- + +Copyright 2009 The Go Authors. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are +met: + + * Redistributions of source code must retain the above copyright +notice, this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above +copyright notice, this list of conditions and the following disclaimer +in the documentation and/or other materials provided with the +distribution. + * Neither the name of Google LLC nor the names of its +contributors may be used to endorse or promote products derived from +this software without specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. \ No newline at end of file diff --git a/vendor/go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp/common.go b/vendor/go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp/common.go new file mode 100644 index 00000000..3ae08243 --- /dev/null +++ b/vendor/go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp/common.go @@ -0,0 +1,27 @@ +// Copyright The OpenTelemetry Authors +// SPDX-License-Identifier: Apache-2.0 + +package otelhttp // import "go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp" + +import ( + "net/http" + + "go.opentelemetry.io/otel/attribute" + "go.opentelemetry.io/otel/trace" +) + +// Attribute keys that can be added to a span. +const ( + ReadBytesKey = attribute.Key("http.read_bytes") // if anything was read from the request body, the total number of bytes read + ReadErrorKey = attribute.Key("http.read_error") // If an error occurred while reading a request, the string of the error (io.EOF is not recorded) + WroteBytesKey = attribute.Key("http.wrote_bytes") // if anything was written to the response writer, the total number of bytes written + WriteErrorKey = attribute.Key("http.write_error") // if an error occurred while writing a reply, the string of the error (io.EOF is not recorded) +) + +// Filter is a predicate used to determine whether a given http.request should +// be traced. A Filter must return true if the request should be traced. +type Filter func(*http.Request) bool + +func newTracer(tp trace.TracerProvider) trace.Tracer { + return tp.Tracer(ScopeName, trace.WithInstrumentationVersion(Version)) +} diff --git a/vendor/go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp/config.go b/vendor/go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp/config.go new file mode 100644 index 00000000..a7d4b2a8 --- /dev/null +++ b/vendor/go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp/config.go @@ -0,0 +1,204 @@ +// Copyright The OpenTelemetry Authors +// SPDX-License-Identifier: Apache-2.0 + +package otelhttp // import "go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp" + +import ( + "context" + "net/http" + "net/http/httptrace" + + "go.opentelemetry.io/otel" + "go.opentelemetry.io/otel/attribute" + "go.opentelemetry.io/otel/metric" + "go.opentelemetry.io/otel/propagation" + "go.opentelemetry.io/otel/trace" +) + +// ScopeName is the instrumentation scope name. +const ScopeName = "go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp" + +// config represents the configuration options available for the http.Handler +// and http.Transport types. +type config struct { + ServerName string + Tracer trace.Tracer + Meter metric.Meter + Propagators propagation.TextMapPropagator + SpanStartOptions []trace.SpanStartOption + PublicEndpointFn func(*http.Request) bool + ReadEvent bool + WriteEvent bool + Filters []Filter + SpanNameFormatter func(string, *http.Request) string + ClientTrace func(context.Context) *httptrace.ClientTrace + + TracerProvider trace.TracerProvider + MeterProvider metric.MeterProvider + MetricAttributesFn func(*http.Request) []attribute.KeyValue +} + +// Option interface used for setting optional config properties. +type Option interface { + apply(*config) +} + +type optionFunc func(*config) + +func (o optionFunc) apply(c *config) { + o(c) +} + +// newConfig creates a new config struct and applies opts to it. +func newConfig(opts ...Option) *config { + c := &config{ + Propagators: otel.GetTextMapPropagator(), + MeterProvider: otel.GetMeterProvider(), + } + for _, opt := range opts { + opt.apply(c) + } + + // Tracer is only initialized if manually specified. Otherwise, can be passed with the tracing context. + if c.TracerProvider != nil { + c.Tracer = newTracer(c.TracerProvider) + } + + c.Meter = c.MeterProvider.Meter( + ScopeName, + metric.WithInstrumentationVersion(Version), + ) + + return c +} + +// WithTracerProvider specifies a tracer provider to use for creating a tracer. +// If none is specified, the global provider is used. +func WithTracerProvider(provider trace.TracerProvider) Option { + return optionFunc(func(cfg *config) { + if provider != nil { + cfg.TracerProvider = provider + } + }) +} + +// WithMeterProvider specifies a meter provider to use for creating a meter. +// If none is specified, the global provider is used. +func WithMeterProvider(provider metric.MeterProvider) Option { + return optionFunc(func(cfg *config) { + if provider != nil { + cfg.MeterProvider = provider + } + }) +} + +// WithPublicEndpointFn runs with every request, and allows conditionally +// configuring the Handler to link the span with an incoming span context. If +// this option is not provided or returns false, then the association is a +// child association instead of a link. +func WithPublicEndpointFn(fn func(*http.Request) bool) Option { + return optionFunc(func(c *config) { + c.PublicEndpointFn = fn + }) +} + +// WithPropagators configures specific propagators. If this +// option isn't specified, then the global TextMapPropagator is used. +func WithPropagators(ps propagation.TextMapPropagator) Option { + return optionFunc(func(c *config) { + if ps != nil { + c.Propagators = ps + } + }) +} + +// WithSpanOptions configures an additional set of +// trace.SpanOptions, which are applied to each new span. +func WithSpanOptions(opts ...trace.SpanStartOption) Option { + return optionFunc(func(c *config) { + c.SpanStartOptions = append(c.SpanStartOptions, opts...) + }) +} + +// WithFilter adds a filter to the list of filters used by the handler. +// If any filter indicates to exclude a request then the request will not be +// traced. All filters must allow a request to be traced for a Span to be created. +// If no filters are provided then all requests are traced. +// Filters will be invoked for each processed request, it is advised to make them +// simple and fast. +func WithFilter(f Filter) Option { + return optionFunc(func(c *config) { + c.Filters = append(c.Filters, f) + }) +} + +// Event represents message event types for [WithMessageEvents]. +type Event int + +// Different types of events that can be recorded, see WithMessageEvents. +const ( + unspecifiedEvents Event = iota + ReadEvents + WriteEvents +) + +// WithMessageEvents configures the Handler to record the specified events +// (span.AddEvent) on spans. By default only summary attributes are added at the +// end of the request. +// +// Valid events are: +// - ReadEvents: Record the number of bytes read after every http.Request.Body.Read +// using the ReadBytesKey +// - WriteEvents: Record the number of bytes written after every http.ResponeWriter.Write +// using the WriteBytesKey +func WithMessageEvents(events ...Event) Option { + return optionFunc(func(c *config) { + for _, e := range events { + switch e { + case ReadEvents: + c.ReadEvent = true + case WriteEvents: + c.WriteEvent = true + } + } + }) +} + +// WithSpanNameFormatter takes a function that will be called on every +// request and the returned string will become the Span Name. +// +// When using [http.ServeMux] (or any middleware that sets the Pattern of [http.Request]), +// the span name formatter will run twice. Once when the span is created, and +// second time after the middleware, so the pattern can be used. +func WithSpanNameFormatter(f func(operation string, r *http.Request) string) Option { + return optionFunc(func(c *config) { + c.SpanNameFormatter = f + }) +} + +// WithClientTrace takes a function that returns client trace instance that will be +// applied to the requests sent through the otelhttp Transport. +func WithClientTrace(f func(context.Context) *httptrace.ClientTrace) Option { + return optionFunc(func(c *config) { + c.ClientTrace = f + }) +} + +// WithServerName returns an Option that sets the name of the (virtual) server +// handling requests. +func WithServerName(server string) Option { + return optionFunc(func(c *config) { + c.ServerName = server + }) +} + +// WithMetricAttributesFn returns an Option to set a function that maps an HTTP request to a slice of attribute.KeyValue. +// These attributes will be included in metrics for every request. +// +// Deprecated: WithMetricAttributesFn is deprecated and will be removed in a +// future release. Use [Labeler] instead. +func WithMetricAttributesFn(metricAttributesFn func(r *http.Request) []attribute.KeyValue) Option { + return optionFunc(func(c *config) { + c.MetricAttributesFn = metricAttributesFn + }) +} diff --git a/vendor/go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp/doc.go b/vendor/go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp/doc.go new file mode 100644 index 00000000..1c9aa3ff --- /dev/null +++ b/vendor/go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp/doc.go @@ -0,0 +1,6 @@ +// Copyright The OpenTelemetry Authors +// SPDX-License-Identifier: Apache-2.0 + +// Package otelhttp provides an http.Handler and functions that are intended +// to be used to add tracing by wrapping existing handlers. +package otelhttp // import "go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp" diff --git a/vendor/go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp/handler.go b/vendor/go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp/handler.go new file mode 100644 index 00000000..a269fce0 --- /dev/null +++ b/vendor/go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp/handler.go @@ -0,0 +1,217 @@ +// Copyright The OpenTelemetry Authors +// SPDX-License-Identifier: Apache-2.0 + +package otelhttp // import "go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp" + +import ( + "net/http" + "time" + + "github.com/felixge/httpsnoop" + "go.opentelemetry.io/otel" + "go.opentelemetry.io/otel/attribute" + "go.opentelemetry.io/otel/propagation" + "go.opentelemetry.io/otel/trace" + + "go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp/internal/request" + "go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp/internal/semconv" +) + +// middleware is an http middleware which wraps the next handler in a span. +type middleware struct { + operation string + server string + + tracer trace.Tracer + propagators propagation.TextMapPropagator + spanStartOptions []trace.SpanStartOption + readEvent bool + writeEvent bool + filters []Filter + spanNameFormatter func(string, *http.Request) string + publicEndpointFn func(*http.Request) bool + metricAttributesFn func(*http.Request) []attribute.KeyValue + + semconv semconv.HTTPServer +} + +func defaultHandlerFormatter(operation string, _ *http.Request) string { + return operation +} + +// NewHandler wraps the passed handler in a span named after the operation and +// enriches it with metrics. +func NewHandler(handler http.Handler, operation string, opts ...Option) http.Handler { + return NewMiddleware(operation, opts...)(handler) +} + +// NewMiddleware returns a tracing and metrics instrumentation middleware. +// The handler returned by the middleware wraps a handler +// in a span named after the operation and enriches it with metrics. +func NewMiddleware(operation string, opts ...Option) func(http.Handler) http.Handler { + h := middleware{ + operation: operation, + } + + defaultOpts := []Option{ + WithSpanOptions(trace.WithSpanKind(trace.SpanKindServer)), + WithSpanNameFormatter(defaultHandlerFormatter), + } + + c := newConfig(append(defaultOpts, opts...)...) + h.configure(c) + + return func(next http.Handler) http.Handler { + return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { + h.serveHTTP(w, r, next) + }) + } +} + +func (h *middleware) configure(c *config) { + h.tracer = c.Tracer + h.propagators = c.Propagators + h.spanStartOptions = c.SpanStartOptions + h.readEvent = c.ReadEvent + h.writeEvent = c.WriteEvent + h.filters = c.Filters + h.spanNameFormatter = c.SpanNameFormatter + h.publicEndpointFn = c.PublicEndpointFn + h.server = c.ServerName + h.semconv = semconv.NewHTTPServer(c.Meter) + h.metricAttributesFn = c.MetricAttributesFn +} + +// serveHTTP sets up tracing and calls the given next http.Handler with the span +// context injected into the request context. +func (h *middleware) serveHTTP(w http.ResponseWriter, r *http.Request, next http.Handler) { + requestStartTime := time.Now() + for _, f := range h.filters { + if !f(r) { + // Simply pass through to the handler if a filter rejects the request + next.ServeHTTP(w, r) + return + } + } + + ctx := h.propagators.Extract(r.Context(), propagation.HeaderCarrier(r.Header)) + opts := []trace.SpanStartOption{ + trace.WithAttributes(h.semconv.RequestTraceAttrs(h.server, r, semconv.RequestTraceAttrsOpts{})...), + } + + opts = append(opts, h.spanStartOptions...) + if h.publicEndpointFn != nil && h.publicEndpointFn(r.WithContext(ctx)) { + opts = append(opts, trace.WithNewRoot()) + // Linking incoming span context if any for public endpoint. + if s := trace.SpanContextFromContext(ctx); s.IsValid() && s.IsRemote() { + opts = append(opts, trace.WithLinks(trace.Link{SpanContext: s})) + } + } + + tracer := h.tracer + + if tracer == nil { + if span := trace.SpanFromContext(r.Context()); span.SpanContext().IsValid() { + tracer = newTracer(span.TracerProvider()) + } else { + tracer = newTracer(otel.GetTracerProvider()) + } + } + + if startTime := StartTimeFromContext(ctx); !startTime.IsZero() { + opts = append(opts, trace.WithTimestamp(startTime)) + requestStartTime = startTime + } + + ctx, span := tracer.Start(ctx, h.spanNameFormatter(h.operation, r), opts...) + defer span.End() + + readRecordFunc := func(int64) {} + if h.readEvent { + readRecordFunc = func(n int64) { + span.AddEvent("read", trace.WithAttributes(ReadBytesKey.Int64(n))) + } + } + + // if request body is nil or NoBody, we don't want to mutate the body as it + // will affect the identity of it in an unforeseeable way because we assert + // ReadCloser fulfills a certain interface and it is indeed nil or NoBody. + bw := request.NewBodyWrapper(r.Body, readRecordFunc) + if r.Body != nil && r.Body != http.NoBody { + r.Body = bw + } + + writeRecordFunc := func(int64) {} + if h.writeEvent { + writeRecordFunc = func(n int64) { + span.AddEvent("write", trace.WithAttributes(WroteBytesKey.Int64(n))) + } + } + + rww := request.NewRespWriterWrapper(w, writeRecordFunc) + + // Wrap w to use our ResponseWriter methods while also exposing + // other interfaces that w may implement (http.CloseNotifier, + // http.Flusher, http.Hijacker, http.Pusher, io.ReaderFrom). + + w = httpsnoop.Wrap(w, httpsnoop.Hooks{ + Header: func(httpsnoop.HeaderFunc) httpsnoop.HeaderFunc { + return rww.Header + }, + Write: func(httpsnoop.WriteFunc) httpsnoop.WriteFunc { + return rww.Write + }, + WriteHeader: func(httpsnoop.WriteHeaderFunc) httpsnoop.WriteHeaderFunc { + return rww.WriteHeader + }, + Flush: func(httpsnoop.FlushFunc) httpsnoop.FlushFunc { + return rww.Flush + }, + }) + + labeler, found := LabelerFromContext(ctx) + if !found { + ctx = ContextWithLabeler(ctx, labeler) + } + + r = r.WithContext(ctx) + next.ServeHTTP(w, r) + + if r.Pattern != "" { + span.SetName(h.spanNameFormatter(h.operation, r)) + } + + statusCode := rww.StatusCode() + bytesWritten := rww.BytesWritten() + span.SetStatus(h.semconv.Status(statusCode)) + bytesRead := bw.BytesRead() + span.SetAttributes(h.semconv.ResponseTraceAttrs(semconv.ResponseTelemetry{ + StatusCode: statusCode, + ReadBytes: bytesRead, + ReadError: bw.Error(), + WriteBytes: bytesWritten, + WriteError: rww.Error(), + })...) + + h.semconv.RecordMetrics(ctx, semconv.ServerMetricData{ + ServerName: h.server, + ResponseSize: bytesWritten, + MetricAttributes: semconv.MetricAttributes{ + Req: r, + StatusCode: statusCode, + AdditionalAttributes: append(labeler.Get(), h.metricAttributesFromRequest(r)...), + }, + MetricData: semconv.MetricData{ + RequestSize: bytesRead, + RequestDuration: time.Since(requestStartTime), + }, + }) +} + +func (h *middleware) metricAttributesFromRequest(r *http.Request) []attribute.KeyValue { + var attributeForRequest []attribute.KeyValue + if h.metricAttributesFn != nil { + attributeForRequest = h.metricAttributesFn(r) + } + return attributeForRequest +} diff --git a/vendor/go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp/internal/request/body_wrapper.go b/vendor/go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp/internal/request/body_wrapper.go new file mode 100644 index 00000000..d032aa84 --- /dev/null +++ b/vendor/go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp/internal/request/body_wrapper.go @@ -0,0 +1,80 @@ +// Code generated by gotmpl. DO NOT MODIFY. +// source: internal/shared/request/body_wrapper.go.tmpl + +// Copyright The OpenTelemetry Authors +// SPDX-License-Identifier: Apache-2.0 + +// Package request provides types and functionality to handle HTTP request +// handling. +package request // import "go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp/internal/request" + +import ( + "io" + "sync" +) + +var _ io.ReadCloser = &BodyWrapper{} + +// BodyWrapper wraps a http.Request.Body (an io.ReadCloser) to track the number +// of bytes read and the last error. +type BodyWrapper struct { + io.ReadCloser + OnRead func(n int64) // must not be nil + + mu sync.Mutex + read int64 + err error +} + +// NewBodyWrapper creates a new BodyWrapper. +// +// The onRead attribute is a callback that will be called every time the data +// is read, with the number of bytes being read. +func NewBodyWrapper(body io.ReadCloser, onRead func(int64)) *BodyWrapper { + return &BodyWrapper{ + ReadCloser: body, + OnRead: onRead, + } +} + +// Read reads the data from the io.ReadCloser, and stores the number of bytes +// read and the error. +func (w *BodyWrapper) Read(b []byte) (int, error) { + n, err := w.ReadCloser.Read(b) + n1 := int64(n) + + w.updateReadData(n1, err) + w.OnRead(n1) + return n, err +} + +func (w *BodyWrapper) updateReadData(n int64, err error) { + w.mu.Lock() + defer w.mu.Unlock() + + w.read += n + if err != nil { + w.err = err + } +} + +// Close closes the io.ReadCloser. +func (w *BodyWrapper) Close() error { + return w.ReadCloser.Close() +} + +// BytesRead returns the number of bytes read up to this point. +func (w *BodyWrapper) BytesRead() int64 { + w.mu.Lock() + defer w.mu.Unlock() + + return w.read +} + +// Error returns the last error. +func (w *BodyWrapper) Error() error { + w.mu.Lock() + defer w.mu.Unlock() + + return w.err +} diff --git a/vendor/go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp/internal/request/gen.go b/vendor/go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp/internal/request/gen.go new file mode 100644 index 00000000..9e00dd2f --- /dev/null +++ b/vendor/go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp/internal/request/gen.go @@ -0,0 +1,10 @@ +// Copyright The OpenTelemetry Authors +// SPDX-License-Identifier: Apache-2.0 + +package request // import "go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp/internal/request" + +// Generate request package: +//go:generate gotmpl --body=../../../../../../internal/shared/request/body_wrapper.go.tmpl "--data={}" --out=body_wrapper.go +//go:generate gotmpl --body=../../../../../../internal/shared/request/body_wrapper_test.go.tmpl "--data={}" --out=body_wrapper_test.go +//go:generate gotmpl --body=../../../../../../internal/shared/request/resp_writer_wrapper.go.tmpl "--data={}" --out=resp_writer_wrapper.go +//go:generate gotmpl --body=../../../../../../internal/shared/request/resp_writer_wrapper_test.go.tmpl "--data={}" --out=resp_writer_wrapper_test.go diff --git a/vendor/go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp/internal/request/resp_writer_wrapper.go b/vendor/go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp/internal/request/resp_writer_wrapper.go new file mode 100644 index 00000000..f29f9b7c --- /dev/null +++ b/vendor/go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp/internal/request/resp_writer_wrapper.go @@ -0,0 +1,129 @@ +// Code generated by gotmpl. DO NOT MODIFY. +// source: internal/shared/request/resp_writer_wrapper.go.tmpl + +// Copyright The OpenTelemetry Authors +// SPDX-License-Identifier: Apache-2.0 + +package request // import "go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp/internal/request" + +import ( + "net/http" + "sync" +) + +var _ http.ResponseWriter = &RespWriterWrapper{} + +// RespWriterWrapper wraps a http.ResponseWriter in order to track the number of +// bytes written, the last error, and to catch the first written statusCode. +// TODO: The wrapped http.ResponseWriter doesn't implement any of the optional +// types (http.Hijacker, http.Pusher, http.CloseNotifier, etc) +// that may be useful when using it in real life situations. +type RespWriterWrapper struct { + http.ResponseWriter + OnWrite func(n int64) // must not be nil + + mu sync.RWMutex + written int64 + statusCode int + err error + wroteHeader bool +} + +// NewRespWriterWrapper creates a new RespWriterWrapper. +// +// The onWrite attribute is a callback that will be called every time the data +// is written, with the number of bytes that were written. +func NewRespWriterWrapper(w http.ResponseWriter, onWrite func(int64)) *RespWriterWrapper { + return &RespWriterWrapper{ + ResponseWriter: w, + OnWrite: onWrite, + statusCode: http.StatusOK, // default status code in case the Handler doesn't write anything + } +} + +// Write writes the bytes array into the [ResponseWriter], and tracks the +// number of bytes written and last error. +func (w *RespWriterWrapper) Write(p []byte) (int, error) { + w.mu.Lock() + defer w.mu.Unlock() + + if !w.wroteHeader { + w.writeHeader(http.StatusOK) + } + + n, err := w.ResponseWriter.Write(p) + n1 := int64(n) + w.OnWrite(n1) + w.written += n1 + w.err = err + return n, err +} + +// WriteHeader persists initial statusCode for span attribution. +// All calls to WriteHeader will be propagated to the underlying ResponseWriter +// and will persist the statusCode from the first call (except for informational response status codes). +// Blocking consecutive calls to WriteHeader alters expected behavior and will +// remove warning logs from net/http where developers will notice incorrect handler implementations. +func (w *RespWriterWrapper) WriteHeader(statusCode int) { + w.mu.Lock() + defer w.mu.Unlock() + + w.writeHeader(statusCode) +} + +// writeHeader persists the status code for span attribution, and propagates +// the call to the underlying ResponseWriter. +// It does not acquire a lock, and therefore assumes that is being handled by a +// parent method. +func (w *RespWriterWrapper) writeHeader(statusCode int) { + if !w.wroteHeader { + // Ignore informational response status codes. + // Based on https://github.com/golang/go/blob/go1.24.1/src/net/http/server.go#L1216 + if statusCode >= 100 && statusCode <= 199 && statusCode != http.StatusSwitchingProtocols { + w.ResponseWriter.WriteHeader(statusCode) + return + } + + w.wroteHeader = true + w.statusCode = statusCode + } + w.ResponseWriter.WriteHeader(statusCode) +} + +// Flush implements [http.Flusher]. +func (w *RespWriterWrapper) Flush() { + w.mu.Lock() + defer w.mu.Unlock() + + if !w.wroteHeader { + w.writeHeader(http.StatusOK) + } + + if f, ok := w.ResponseWriter.(http.Flusher); ok { + f.Flush() + } +} + +// BytesWritten returns the number of bytes written. +func (w *RespWriterWrapper) BytesWritten() int64 { + w.mu.RLock() + defer w.mu.RUnlock() + + return w.written +} + +// StatusCode returns the HTTP status code that was sent. +func (w *RespWriterWrapper) StatusCode() int { + w.mu.RLock() + defer w.mu.RUnlock() + + return w.statusCode +} + +// Error returns the last error. +func (w *RespWriterWrapper) Error() error { + w.mu.RLock() + defer w.mu.RUnlock() + + return w.err +} diff --git a/vendor/go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp/internal/semconv/client.go b/vendor/go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp/internal/semconv/client.go new file mode 100644 index 00000000..1398d85c --- /dev/null +++ b/vendor/go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp/internal/semconv/client.go @@ -0,0 +1,291 @@ +// Code generated by gotmpl. DO NOT MODIFY. +// source: internal/shared/semconv/client.go.tmpl + +// Copyright The OpenTelemetry Authors +// SPDX-License-Identifier: Apache-2.0 + +// Package semconv provides OpenTelemetry semantic convention types and +// functionality. +package semconv // import "go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp/internal/semconv" + +import ( + "context" + "fmt" + "net/http" + "slices" + "strconv" + "strings" + + "go.opentelemetry.io/otel/attribute" + "go.opentelemetry.io/otel/codes" + "go.opentelemetry.io/otel/metric" + "go.opentelemetry.io/otel/semconv/v1.40.0" + "go.opentelemetry.io/otel/semconv/v1.40.0/httpconv" +) + +type HTTPClient struct { + requestBodySize httpconv.ClientRequestBodySize + requestDuration httpconv.ClientRequestDuration +} + +func NewHTTPClient(meter metric.Meter) HTTPClient { + client := HTTPClient{} + + var err error + client.requestBodySize, err = httpconv.NewClientRequestBodySize(meter) + handleErr(err) + + client.requestDuration, err = httpconv.NewClientRequestDuration( + meter, + metric.WithExplicitBucketBoundaries(0.005, 0.01, 0.025, 0.05, 0.075, 0.1, 0.25, 0.5, 0.75, 1, 2.5, 5, 7.5, 10), + ) + handleErr(err) + + return client +} + +func (n HTTPClient) Status(code int) (codes.Code, string) { + if code < 100 || code >= 600 { + return codes.Error, fmt.Sprintf("Invalid HTTP status code %d", code) + } + if code >= 400 { + return codes.Error, "" + } + return codes.Unset, "" +} + +// RequestTraceAttrs returns trace attributes for an HTTP request made by a client. +func (n HTTPClient) RequestTraceAttrs(req *http.Request) []attribute.KeyValue { + /* + below attributes are returned: + - http.request.method + - http.request.method.original + - url.full + - server.address + - server.port + - network.protocol.name + - network.protocol.version + */ + numOfAttributes := 3 // URL, server address, proto, and method. + + var urlHost string + if req.URL != nil { + urlHost = req.URL.Host + } + var requestHost string + var requestPort int + for _, hostport := range []string{urlHost, req.Header.Get("Host")} { + requestHost, requestPort = SplitHostPort(hostport) + if requestHost != "" || requestPort > 0 { + break + } + } + + eligiblePort := requiredHTTPPort(req.URL != nil && req.URL.Scheme == "https", requestPort) + if eligiblePort > 0 { + numOfAttributes++ + } + useragent := req.UserAgent() + if useragent != "" { + numOfAttributes++ + } + + protoName, protoVersion := netProtocol(req.Proto) + if protoName != "" && protoName != "http" { + numOfAttributes++ + } + if protoVersion != "" { + numOfAttributes++ + } + + method, originalMethod := n.method(req.Method) + if originalMethod != (attribute.KeyValue{}) { + numOfAttributes++ + } + + attrs := make([]attribute.KeyValue, 0, numOfAttributes) + + attrs = append(attrs, method) + if originalMethod != (attribute.KeyValue{}) { + attrs = append(attrs, originalMethod) + } + + var u string + if req.URL != nil { + // Remove any username/password info that may be in the URL. + userinfo := req.URL.User + req.URL.User = nil + u = req.URL.String() + // Restore any username/password info that was removed. + req.URL.User = userinfo + } + attrs = append(attrs, semconv.URLFull(u)) + + attrs = append(attrs, semconv.ServerAddress(requestHost)) + if eligiblePort > 0 { + attrs = append(attrs, semconv.ServerPort(eligiblePort)) + } + + if protoName != "" && protoName != "http" { + attrs = append(attrs, semconv.NetworkProtocolName(protoName)) + } + if protoVersion != "" { + attrs = append(attrs, semconv.NetworkProtocolVersion(protoVersion)) + } + + return attrs +} + +// ResponseTraceAttrs returns trace attributes for an HTTP response made by a client. +func (n HTTPClient) ResponseTraceAttrs(resp *http.Response) []attribute.KeyValue { + /* + below attributes are returned: + - http.response.status_code + - error.type + */ + var count int + if resp.StatusCode > 0 { + count++ + } + + if isErrorStatusCode(resp.StatusCode) { + count++ + } + + attrs := make([]attribute.KeyValue, 0, count) + if resp.StatusCode > 0 { + attrs = append(attrs, semconv.HTTPResponseStatusCode(resp.StatusCode)) + } + + if isErrorStatusCode(resp.StatusCode) { + errorType := strconv.Itoa(resp.StatusCode) + attrs = append(attrs, semconv.ErrorTypeKey.String(errorType)) + } + return attrs +} + +func (n HTTPClient) method(method string) (attribute.KeyValue, attribute.KeyValue) { + if method == "" { + return semconv.HTTPRequestMethodGet, attribute.KeyValue{} + } + if attr, ok := methodLookup[method]; ok { + return attr, attribute.KeyValue{} + } + + orig := semconv.HTTPRequestMethodOriginal(method) + if attr, ok := methodLookup[strings.ToUpper(method)]; ok { + return attr, orig + } + return semconv.HTTPRequestMethodGet, orig +} + +func (n HTTPClient) MetricAttributes(req *http.Request, statusCode int, additionalAttributes []attribute.KeyValue) []attribute.KeyValue { + num := len(additionalAttributes) + 2 + var h string + if req.URL != nil { + h = req.URL.Host + } + var requestHost string + var requestPort int + for _, hostport := range []string{h, req.Header.Get("Host")} { + requestHost, requestPort = SplitHostPort(hostport) + if requestHost != "" || requestPort > 0 { + break + } + } + + port := requiredHTTPPort(req.URL != nil && req.URL.Scheme == "https", requestPort) + if port > 0 { + num++ + } + + protoName, protoVersion := netProtocol(req.Proto) + if protoName != "" { + num++ + } + if protoVersion != "" { + num++ + } + + if statusCode > 0 { + num++ + } + + attributes := slices.Grow(additionalAttributes, num) + attributes = append(attributes, + semconv.HTTPRequestMethodKey.String(standardizeHTTPMethod(req.Method)), + semconv.ServerAddress(requestHost), + n.scheme(req), + ) + + if port > 0 { + attributes = append(attributes, semconv.ServerPort(port)) + } + if protoName != "" { + attributes = append(attributes, semconv.NetworkProtocolName(protoName)) + } + if protoVersion != "" { + attributes = append(attributes, semconv.NetworkProtocolVersion(protoVersion)) + } + + if statusCode > 0 { + attributes = append(attributes, semconv.HTTPResponseStatusCode(statusCode)) + } + return attributes +} + +type MetricOpts struct { + measurement metric.MeasurementOption + addOptions metric.AddOption +} + +func (o MetricOpts) MeasurementOption() metric.MeasurementOption { + return o.measurement +} + +func (o MetricOpts) AddOptions() metric.AddOption { + return o.addOptions +} + +func (n HTTPClient) MetricOptions(ma MetricAttributes) MetricOpts { + attributes := n.MetricAttributes(ma.Req, ma.StatusCode, ma.AdditionalAttributes) + set := metric.WithAttributeSet(attribute.NewSet(attributes...)) + + return MetricOpts{ + measurement: set, + addOptions: set, + } +} + +func (n HTTPClient) RecordMetrics(ctx context.Context, md MetricData, opts MetricOpts) { + recordOpts := metricRecordOptionPool.Get().(*[]metric.RecordOption) + defer func() { + *recordOpts = (*recordOpts)[:0] + metricRecordOptionPool.Put(recordOpts) + }() + *recordOpts = append(*recordOpts, opts.MeasurementOption()) + + n.requestBodySize.Inst().Record(ctx, md.RequestSize, *recordOpts...) + n.requestDuration.Inst().Record(ctx, durationToSeconds(md.RequestDuration), *recordOpts...) +} + +// TraceAttributes returns attributes for httptrace. +func (n HTTPClient) TraceAttributes(host string) []attribute.KeyValue { + return []attribute.KeyValue{ + semconv.ServerAddress(host), + } +} + +func (n HTTPClient) scheme(req *http.Request) attribute.KeyValue { + if req.URL != nil && req.URL.Scheme != "" { + return semconv.URLScheme(req.URL.Scheme) + } + if req.TLS != nil { + return semconv.URLScheme("https") + } + return semconv.URLScheme("http") +} + +func isErrorStatusCode(code int) bool { + return code >= 400 || code < 100 +} diff --git a/vendor/go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp/internal/semconv/gen.go b/vendor/go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp/internal/semconv/gen.go new file mode 100644 index 00000000..a8a0d58d --- /dev/null +++ b/vendor/go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp/internal/semconv/gen.go @@ -0,0 +1,15 @@ +// Copyright The OpenTelemetry Authors +// SPDX-License-Identifier: Apache-2.0 + +package semconv // import "go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp/internal/semconv" + +// Generate semconv package: +//go:generate gotmpl --body=../../../../../../internal/shared/semconv/bench_test.go.tmpl "--data={ \"pkg\": \"go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp\" }" --out=bench_test.go +//go:generate gotmpl --body=../../../../../../internal/shared/semconv/common_test.go.tmpl "--data={ \"pkg\": \"go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp\" }" --out=common_test.go +//go:generate gotmpl --body=../../../../../../internal/shared/semconv/server.go.tmpl "--data={ \"pkg\": \"go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp\" }" --out=server.go +//go:generate gotmpl --body=../../../../../../internal/shared/semconv/server_test.go.tmpl "--data={ \"pkg\": \"go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp\" }" --out=server_test.go +//go:generate gotmpl --body=../../../../../../internal/shared/semconv/client.go.tmpl "--data={ \"pkg\": \"go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp\" }" --out=client.go +//go:generate gotmpl --body=../../../../../../internal/shared/semconv/client_test.go.tmpl "--data={ \"pkg\": \"go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp\" }" --out=client_test.go +//go:generate gotmpl --body=../../../../../../internal/shared/semconv/httpconvtest_test.go.tmpl "--data={ \"pkg\": \"go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp\" }" --out=httpconvtest_test.go +//go:generate gotmpl --body=../../../../../../internal/shared/semconv/util.go.tmpl "--data={ \"pkg\": \"go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp\" }" --out=util.go +//go:generate gotmpl --body=../../../../../../internal/shared/semconv/util_test.go.tmpl "--data={ \"pkg\": \"go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp\" }" --out=util_test.go diff --git a/vendor/go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp/internal/semconv/server.go b/vendor/go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp/internal/semconv/server.go new file mode 100644 index 00000000..83c6ae24 --- /dev/null +++ b/vendor/go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp/internal/semconv/server.go @@ -0,0 +1,398 @@ +// Code generated by gotmpl. DO NOT MODIFY. +// source: internal/shared/semconv/server.go.tmpl + +// Copyright The OpenTelemetry Authors +// SPDX-License-Identifier: Apache-2.0 + +// Package semconv provides OpenTelemetry semantic convention types and +// functionality. +package semconv // import "go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp/internal/semconv" + +import ( + "context" + "fmt" + "net/http" + "slices" + "strings" + "sync" + "time" + + "go.opentelemetry.io/otel/attribute" + "go.opentelemetry.io/otel/codes" + "go.opentelemetry.io/otel/metric" + "go.opentelemetry.io/otel/semconv/v1.40.0" + "go.opentelemetry.io/otel/semconv/v1.40.0/httpconv" +) + +type RequestTraceAttrsOpts struct { + // If set, this is used as value for the "http.client_ip" attribute. + HTTPClientIP string +} + +type ResponseTelemetry struct { + StatusCode int + ReadBytes int64 + ReadError error + WriteBytes int64 + WriteError error +} + +type HTTPServer struct { + requestBodySizeHistogram httpconv.ServerRequestBodySize + responseBodySizeHistogram httpconv.ServerResponseBodySize + requestDurationHistogram httpconv.ServerRequestDuration +} + +func NewHTTPServer(meter metric.Meter) HTTPServer { + server := HTTPServer{} + + var err error + server.requestBodySizeHistogram, err = httpconv.NewServerRequestBodySize(meter) + handleErr(err) + + server.responseBodySizeHistogram, err = httpconv.NewServerResponseBodySize(meter) + handleErr(err) + + server.requestDurationHistogram, err = httpconv.NewServerRequestDuration( + meter, + metric.WithExplicitBucketBoundaries( + 0.005, 0.01, 0.025, 0.05, 0.075, 0.1, + 0.25, 0.5, 0.75, 1, 2.5, 5, 7.5, 10, + ), + ) + handleErr(err) + return server +} + +// Status returns a span status code and message for an HTTP status code +// value returned by a server. Status codes in the 400-499 range are not +// returned as errors. +func (n HTTPServer) Status(code int) (codes.Code, string) { + if code < 100 || code >= 600 { + return codes.Error, fmt.Sprintf("Invalid HTTP status code %d", code) + } + if code >= 500 { + return codes.Error, "" + } + return codes.Unset, "" +} + +// RequestTraceAttrs returns trace attributes for an HTTP request received by a +// server. +// +// The server must be the primary server name if it is known. For example this +// would be the ServerName directive +// (https://httpd.apache.org/docs/2.4/mod/core.html#servername) for an Apache +// server, and the server_name directive +// (http://nginx.org/en/docs/http/ngx_http_core_module.html#server_name) for an +// nginx server. More generically, the primary server name would be the host +// header value that matches the default virtual host of an HTTP server. It +// should include the host identifier and if a port is used to route to the +// server that port identifier should be included as an appropriate port +// suffix. +// +// If the primary server name is not known, server should be an empty string. +// The req Host will be used to determine the server instead. +func (n HTTPServer) RequestTraceAttrs(server string, req *http.Request, opts RequestTraceAttrsOpts) []attribute.KeyValue { + count := 3 // ServerAddress, Method, Scheme + + var host string + var p int + if server == "" { + host, p = SplitHostPort(req.Host) + } else { + // Prioritize the primary server name. + host, p = SplitHostPort(server) + if p < 0 { + _, p = SplitHostPort(req.Host) + } + } + + hostPort := requiredHTTPPort(req.TLS != nil, p) + if hostPort > 0 { + count++ + } + + method, methodOriginal := n.method(req.Method) + if methodOriginal != (attribute.KeyValue{}) { + count++ + } + + scheme := n.scheme(req.TLS != nil) + + peer, peerPort := SplitHostPort(req.RemoteAddr) + if peer != "" { + // The Go HTTP server sets RemoteAddr to "IP:port", this will not be a + // file-path that would be interpreted with a sock family. + count++ + if peerPort > 0 { + count++ + } + } + + useragent := req.UserAgent() + if useragent != "" { + count++ + } + + // For client IP, use, in order: + // 1. The value passed in the options + // 2. The value in the X-Forwarded-For header + // 3. The peer address + clientIP := opts.HTTPClientIP + if clientIP == "" { + clientIP = serverClientIP(req.Header.Get("X-Forwarded-For")) + if clientIP == "" { + clientIP = peer + } + } + if clientIP != "" { + count++ + } + + if req.URL != nil && req.URL.Path != "" { + count++ + } + + protoName, protoVersion := netProtocol(req.Proto) + if protoName != "" && protoName != "http" { + count++ + } + if protoVersion != "" { + count++ + } + + route := httpRoute(req.Pattern) + if route != "" { + count++ + } + + attrs := make([]attribute.KeyValue, 0, count) + attrs = append(attrs, + semconv.ServerAddress(host), + method, + scheme, + ) + + if hostPort > 0 { + attrs = append(attrs, semconv.ServerPort(hostPort)) + } + if methodOriginal != (attribute.KeyValue{}) { + attrs = append(attrs, methodOriginal) + } + + if peer, peerPort := SplitHostPort(req.RemoteAddr); peer != "" { + // The Go HTTP server sets RemoteAddr to "IP:port", this will not be a + // file-path that would be interpreted with a sock family. + attrs = append(attrs, semconv.NetworkPeerAddress(peer)) + if peerPort > 0 { + attrs = append(attrs, semconv.NetworkPeerPort(peerPort)) + } + } + + if useragent != "" { + attrs = append(attrs, semconv.UserAgentOriginal(useragent)) + } + + if clientIP != "" { + attrs = append(attrs, semconv.ClientAddress(clientIP)) + } + + if req.URL != nil && req.URL.Path != "" { + attrs = append(attrs, semconv.URLPath(req.URL.Path)) + } + + if protoName != "" && protoName != "http" { + attrs = append(attrs, semconv.NetworkProtocolName(protoName)) + } + if protoVersion != "" { + attrs = append(attrs, semconv.NetworkProtocolVersion(protoVersion)) + } + + if route != "" { + attrs = append(attrs, n.Route(route)) + } + + return attrs +} + +func (s HTTPServer) NetworkTransportAttr(network string) []attribute.KeyValue { + attr := semconv.NetworkTransportPipe + switch network { + case "tcp", "tcp4", "tcp6": + attr = semconv.NetworkTransportTCP + case "udp", "udp4", "udp6": + attr = semconv.NetworkTransportUDP + case "unix", "unixgram", "unixpacket": + attr = semconv.NetworkTransportUnix + } + + return []attribute.KeyValue{attr} +} + +type ServerMetricData struct { + ServerName string + ResponseSize int64 + + MetricData + MetricAttributes +} + +type MetricAttributes struct { + Req *http.Request + StatusCode int + Route string + AdditionalAttributes []attribute.KeyValue +} + +type MetricData struct { + RequestSize int64 + RequestDuration time.Duration +} + +var ( + metricRecordOptionPool = &sync.Pool{ + New: func() any { + return &[]metric.RecordOption{} + }, + } +) + +func (n HTTPServer) RecordMetrics(ctx context.Context, md ServerMetricData) { + attributes := n.MetricAttributes(md.ServerName, md.Req, md.StatusCode, md.Route, md.AdditionalAttributes) + o := metric.WithAttributeSet(attribute.NewSet(attributes...)) + recordOpts := metricRecordOptionPool.Get().(*[]metric.RecordOption) + *recordOpts = append(*recordOpts, o) + n.requestBodySizeHistogram.Inst().Record(ctx, md.RequestSize, *recordOpts...) + n.responseBodySizeHistogram.Inst().Record(ctx, md.ResponseSize, *recordOpts...) + n.requestDurationHistogram.Inst().Record(ctx, durationToSeconds(md.RequestDuration), o) + *recordOpts = (*recordOpts)[:0] + metricRecordOptionPool.Put(recordOpts) +} + +func (n HTTPServer) method(method string) (attribute.KeyValue, attribute.KeyValue) { + if method == "" { + return semconv.HTTPRequestMethodGet, attribute.KeyValue{} + } + if attr, ok := methodLookup[method]; ok { + return attr, attribute.KeyValue{} + } + + orig := semconv.HTTPRequestMethodOriginal(method) + if attr, ok := methodLookup[strings.ToUpper(method)]; ok { + return attr, orig + } + return semconv.HTTPRequestMethodGet, orig +} + +func (n HTTPServer) scheme(https bool) attribute.KeyValue { //nolint:revive // ignore linter + if https { + return semconv.URLScheme("https") + } + return semconv.URLScheme("http") +} + +// ResponseTraceAttrs returns trace attributes for telemetry from an HTTP +// response. +// +// If any of the fields in the ResponseTelemetry are not set the attribute will +// be omitted. +func (n HTTPServer) ResponseTraceAttrs(resp ResponseTelemetry) []attribute.KeyValue { + var count int + + if resp.ReadBytes > 0 { + count++ + } + if resp.WriteBytes > 0 { + count++ + } + if resp.StatusCode > 0 { + count++ + } + + attributes := make([]attribute.KeyValue, 0, count) + + if resp.ReadBytes > 0 { + attributes = append(attributes, + semconv.HTTPRequestBodySize(int(resp.ReadBytes)), + ) + } + if resp.WriteBytes > 0 { + attributes = append(attributes, + semconv.HTTPResponseBodySize(int(resp.WriteBytes)), + ) + } + if resp.StatusCode > 0 { + attributes = append(attributes, + semconv.HTTPResponseStatusCode(resp.StatusCode), + ) + } + + return attributes +} + +// Route returns the attribute for the route. +func (n HTTPServer) Route(route string) attribute.KeyValue { + return semconv.HTTPRoute(route) +} + +func (n HTTPServer) MetricAttributes(server string, req *http.Request, statusCode int, route string, additionalAttributes []attribute.KeyValue) []attribute.KeyValue { + num := len(additionalAttributes) + 3 + var host string + var p int + if server == "" { + host, p = SplitHostPort(req.Host) + } else { + // Prioritize the primary server name. + host, p = SplitHostPort(server) + if p < 0 { + _, p = SplitHostPort(req.Host) + } + } + hostPort := requiredHTTPPort(req.TLS != nil, p) + if hostPort > 0 { + num++ + } + protoName, protoVersion := netProtocol(req.Proto) + if protoName != "" { + num++ + } + if protoVersion != "" { + num++ + } + + if statusCode > 0 { + num++ + } + if route == "" && req.Pattern != "" { + route = httpRoute(req.Pattern) + } + if route != "" { + num++ + } + + attributes := slices.Grow(additionalAttributes, num) + attributes = append(attributes, + semconv.HTTPRequestMethodKey.String(standardizeHTTPMethod(req.Method)), + n.scheme(req.TLS != nil), + semconv.ServerAddress(host)) + + if hostPort > 0 { + attributes = append(attributes, semconv.ServerPort(hostPort)) + } + if protoName != "" { + attributes = append(attributes, semconv.NetworkProtocolName(protoName)) + } + if protoVersion != "" { + attributes = append(attributes, semconv.NetworkProtocolVersion(protoVersion)) + } + + if statusCode > 0 { + attributes = append(attributes, semconv.HTTPResponseStatusCode(statusCode)) + } + + if route != "" { + attributes = append(attributes, semconv.HTTPRoute(route)) + } + return attributes +} diff --git a/vendor/go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp/internal/semconv/util.go b/vendor/go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp/internal/semconv/util.go new file mode 100644 index 00000000..2eab2eca --- /dev/null +++ b/vendor/go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp/internal/semconv/util.go @@ -0,0 +1,133 @@ +// Code generated by gotmpl. DO NOT MODIFY. +// source: internal/shared/semconv/util.go.tmpl + +// Copyright The OpenTelemetry Authors +// SPDX-License-Identifier: Apache-2.0 + +package semconv // import "go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp/internal/semconv" + +import ( + "net" + "net/http" + "strconv" + "strings" + "time" + + "go.opentelemetry.io/otel" + "go.opentelemetry.io/otel/attribute" + semconvNew "go.opentelemetry.io/otel/semconv/v1.40.0" +) + +// SplitHostPort splits a network address hostport of the form "host", +// "host%zone", "[host]", "[host%zone], "host:port", "host%zone:port", +// "[host]:port", "[host%zone]:port", or ":port" into host or host%zone and +// port. +// +// An empty host is returned if it is not provided or unparsable. A negative +// port is returned if it is not provided or unparsable. +func SplitHostPort(hostport string) (host string, port int) { + port = -1 + + if strings.HasPrefix(hostport, "[") { + addrEnd := strings.LastIndexByte(hostport, ']') + if addrEnd < 0 { + // Invalid hostport. + return + } + if i := strings.LastIndexByte(hostport[addrEnd:], ':'); i < 0 { + host = hostport[1:addrEnd] + return + } + } else { + if i := strings.LastIndexByte(hostport, ':'); i < 0 { + host = hostport + return + } + } + + host, pStr, err := net.SplitHostPort(hostport) + if err != nil { + return + } + + p, err := strconv.ParseUint(pStr, 10, 16) + if err != nil { + return + } + return host, int(p) //nolint:gosec // Byte size checked 16 above. +} + +func requiredHTTPPort(https bool, port int) int { //nolint:revive // ignore linter + if https { + if port > 0 && port != 443 { + return port + } + } else { + if port > 0 && port != 80 { + return port + } + } + return -1 +} + +func serverClientIP(xForwardedFor string) string { + if idx := strings.IndexByte(xForwardedFor, ','); idx >= 0 { + xForwardedFor = xForwardedFor[:idx] + } + return xForwardedFor +} + +func httpRoute(pattern string) string { + if idx := strings.IndexByte(pattern, '/'); idx >= 0 { + return pattern[idx:] + } + return "" +} + +func netProtocol(proto string) (name string, version string) { + name, version, _ = strings.Cut(proto, "/") + switch name { + case "HTTP": + name = "http" + case "QUIC": + name = "quic" + case "SPDY": + name = "spdy" + default: + name = strings.ToLower(name) + } + return name, version +} + +var methodLookup = map[string]attribute.KeyValue{ + http.MethodConnect: semconvNew.HTTPRequestMethodConnect, + http.MethodDelete: semconvNew.HTTPRequestMethodDelete, + http.MethodGet: semconvNew.HTTPRequestMethodGet, + http.MethodHead: semconvNew.HTTPRequestMethodHead, + http.MethodOptions: semconvNew.HTTPRequestMethodOptions, + http.MethodPatch: semconvNew.HTTPRequestMethodPatch, + http.MethodPost: semconvNew.HTTPRequestMethodPost, + http.MethodPut: semconvNew.HTTPRequestMethodPut, + http.MethodTrace: semconvNew.HTTPRequestMethodTrace, +} + +func handleErr(err error) { + if err != nil { + otel.Handle(err) + } +} + +func standardizeHTTPMethod(method string) string { + method = strings.ToUpper(method) + switch method { + case http.MethodConnect, http.MethodDelete, http.MethodGet, http.MethodHead, http.MethodOptions, http.MethodPatch, http.MethodPost, http.MethodPut, http.MethodTrace: + default: + method = "_OTHER" + } + return method +} + +func durationToSeconds(d time.Duration) float64 { + // Use floating point division here for higher precision (instead of Seconds method). + return float64(d) / float64(time.Second) +} diff --git a/vendor/go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp/labeler.go b/vendor/go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp/labeler.go new file mode 100644 index 00000000..d62ce44b --- /dev/null +++ b/vendor/go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp/labeler.go @@ -0,0 +1,58 @@ +// Copyright The OpenTelemetry Authors +// SPDX-License-Identifier: Apache-2.0 + +package otelhttp // import "go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp" + +import ( + "context" + "sync" + + "go.opentelemetry.io/otel/attribute" +) + +// Labeler is used to allow instrumented HTTP handlers to add custom attributes to +// the metrics recorded by the net/http instrumentation. +type Labeler struct { + mu sync.Mutex + attributes []attribute.KeyValue +} + +// Add attributes to a Labeler. +func (l *Labeler) Add(ls ...attribute.KeyValue) { + l.mu.Lock() + defer l.mu.Unlock() + l.attributes = append(l.attributes, ls...) +} + +// Get returns a copy of the attributes added to the Labeler. +func (l *Labeler) Get() []attribute.KeyValue { + l.mu.Lock() + defer l.mu.Unlock() + ret := make([]attribute.KeyValue, len(l.attributes)) + copy(ret, l.attributes) + return ret +} + +type labelerContextKeyType int + +const labelerContextKey labelerContextKeyType = 0 + +// ContextWithLabeler returns a new context with the provided Labeler instance. +// Attributes added to the specified labeler will be injected into metrics +// emitted by the instrumentation. Only one labeller can be injected into the +// context. Injecting it multiple times will override the previous calls. +func ContextWithLabeler(parent context.Context, l *Labeler) context.Context { + return context.WithValue(parent, labelerContextKey, l) +} + +// LabelerFromContext retrieves a Labeler instance from the provided context if +// one is available. If no Labeler was found in the provided context a new, empty +// Labeler is returned and the second return value is false. In this case it is +// safe to use the Labeler but any attributes added to it will not be used. +func LabelerFromContext(ctx context.Context) (*Labeler, bool) { + l, ok := ctx.Value(labelerContextKey).(*Labeler) + if !ok { + l = &Labeler{} + } + return l, ok +} diff --git a/vendor/go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp/start_time_context.go b/vendor/go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp/start_time_context.go new file mode 100644 index 00000000..9476ef01 --- /dev/null +++ b/vendor/go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp/start_time_context.go @@ -0,0 +1,29 @@ +// Copyright The OpenTelemetry Authors +// SPDX-License-Identifier: Apache-2.0 + +package otelhttp // import "go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp" + +import ( + "context" + "time" +) + +type startTimeContextKeyType int + +const startTimeContextKey startTimeContextKeyType = 0 + +// ContextWithStartTime returns a new context with the provided start time. The +// start time will be used for metrics and traces emitted by the +// instrumentation. Only one labeller can be injected into the context. +// Injecting it multiple times will override the previous calls. +func ContextWithStartTime(parent context.Context, start time.Time) context.Context { + return context.WithValue(parent, startTimeContextKey, start) +} + +// StartTimeFromContext retrieves a time.Time from the provided context if one +// is available. If no start time was found in the provided context, a new, +// zero start time is returned and the second return value is false. +func StartTimeFromContext(ctx context.Context) time.Time { + t, _ := ctx.Value(startTimeContextKey).(time.Time) + return t +} diff --git a/vendor/go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp/transport.go b/vendor/go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp/transport.go new file mode 100644 index 00000000..d8d204d1 --- /dev/null +++ b/vendor/go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp/transport.go @@ -0,0 +1,274 @@ +// Copyright The OpenTelemetry Authors +// SPDX-License-Identifier: Apache-2.0 + +package otelhttp // import "go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp" + +import ( + "context" + "io" + "net/http" + "net/http/httptrace" + "sync/atomic" + "time" + + "go.opentelemetry.io/otel" + "go.opentelemetry.io/otel/attribute" + "go.opentelemetry.io/otel/codes" + "go.opentelemetry.io/otel/propagation" + otelsemconv "go.opentelemetry.io/otel/semconv/v1.40.0" + "go.opentelemetry.io/otel/trace" + + "go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp/internal/request" + "go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp/internal/semconv" +) + +// Transport implements the http.RoundTripper interface and wraps +// outbound HTTP(S) requests with a span and enriches it with metrics. +type Transport struct { + rt http.RoundTripper + + tracer trace.Tracer + propagators propagation.TextMapPropagator + spanStartOptions []trace.SpanStartOption + filters []Filter + spanNameFormatter func(string, *http.Request) string + clientTrace func(context.Context) *httptrace.ClientTrace + metricAttributesFn func(*http.Request) []attribute.KeyValue + + semconv semconv.HTTPClient +} + +var _ http.RoundTripper = &Transport{} + +// NewTransport wraps the provided http.RoundTripper with one that +// starts a span, injects the span context into the outbound request headers, +// and enriches it with metrics. +// +// If the provided http.RoundTripper is nil, http.DefaultTransport will be used +// as the base http.RoundTripper. +func NewTransport(base http.RoundTripper, opts ...Option) *Transport { + if base == nil { + base = http.DefaultTransport + } + + t := Transport{ + rt: base, + } + + defaultOpts := []Option{ + WithSpanOptions(trace.WithSpanKind(trace.SpanKindClient)), + WithSpanNameFormatter(defaultTransportFormatter), + } + + c := newConfig(append(defaultOpts, opts...)...) + t.applyConfig(c) + + return &t +} + +func (t *Transport) applyConfig(c *config) { + t.tracer = c.Tracer + t.propagators = c.Propagators + t.spanStartOptions = c.SpanStartOptions + t.filters = c.Filters + t.spanNameFormatter = c.SpanNameFormatter + t.clientTrace = c.ClientTrace + t.semconv = semconv.NewHTTPClient(c.Meter) + t.metricAttributesFn = c.MetricAttributesFn +} + +func defaultTransportFormatter(_ string, r *http.Request) string { + return "HTTP " + r.Method +} + +// RoundTrip creates a Span and propagates its context via the provided request's headers +// before handing the request to the configured base RoundTripper. The created span will +// end when the response body is closed or when a read from the body returns io.EOF. +func (t *Transport) RoundTrip(r *http.Request) (*http.Response, error) { + requestStartTime := time.Now() + for _, f := range t.filters { + if !f(r) { + // Simply pass through to the base RoundTripper if a filter rejects the request + return t.rt.RoundTrip(r) + } + } + + tracer := t.tracer + + if tracer == nil { + if span := trace.SpanFromContext(r.Context()); span.SpanContext().IsValid() { + tracer = newTracer(span.TracerProvider()) + } else { + tracer = newTracer(otel.GetTracerProvider()) + } + } + + ctx, span := tracer.Start(r.Context(), t.spanNameFormatter("", r), t.spanStartOptions...) + + if t.clientTrace != nil { + ctx = httptrace.WithClientTrace(ctx, t.clientTrace(ctx)) + } + + labeler, found := LabelerFromContext(ctx) + if !found { + ctx = ContextWithLabeler(ctx, labeler) + } + + r = r.Clone(ctx) // According to RoundTripper spec, we shouldn't modify the origin request. + + var lastBW *request.BodyWrapper // Records the last body wrapper. Can be nil. + maybeWrapBody := func(body io.ReadCloser) io.ReadCloser { + if body == nil || body == http.NoBody { + return body + } + bw := request.NewBodyWrapper(body, func(int64) {}) + lastBW = bw + return bw + } + r.Body = maybeWrapBody(r.Body) + if r.GetBody != nil { + originalGetBody := r.GetBody + r.GetBody = func() (io.ReadCloser, error) { + b, err := originalGetBody() + if err != nil { + lastBW = nil // The underlying transport will fail to make a retry request, hence, record no data. + return nil, err + } + return maybeWrapBody(b), nil + } + } + + span.SetAttributes(t.semconv.RequestTraceAttrs(r)...) + t.propagators.Inject(ctx, propagation.HeaderCarrier(r.Header)) + + res, err := t.rt.RoundTrip(r) + + // Record the metrics on error or no error. + statusCode := 0 + if err == nil { + statusCode = res.StatusCode + } + var requestSize int64 + if lastBW != nil { + requestSize = lastBW.BytesRead() + } + t.semconv.RecordMetrics( + ctx, + semconv.MetricData{ + RequestSize: requestSize, + RequestDuration: time.Since(requestStartTime), + }, + t.semconv.MetricOptions(semconv.MetricAttributes{ + Req: r, + StatusCode: statusCode, + AdditionalAttributes: append(labeler.Get(), t.metricAttributesFromRequest(r)...), + }), + ) + + if err != nil { + span.SetAttributes(otelsemconv.ErrorType(err)) + span.SetStatus(codes.Error, err.Error()) + span.End() + + return res, err + } + + readRecordFunc := func(int64) {} + res.Body = newWrappedBody(span, readRecordFunc, res.Body) + // traces + span.SetAttributes(t.semconv.ResponseTraceAttrs(res)...) + span.SetStatus(t.semconv.Status(res.StatusCode)) + + return res, nil +} + +func (t *Transport) metricAttributesFromRequest(r *http.Request) []attribute.KeyValue { + var attributeForRequest []attribute.KeyValue + if t.metricAttributesFn != nil { + attributeForRequest = t.metricAttributesFn(r) + } + return attributeForRequest +} + +// newWrappedBody returns a new and appropriately scoped *wrappedBody as an +// io.ReadCloser. If the passed body implements io.Writer, the returned value +// will implement io.ReadWriteCloser. +func newWrappedBody(span trace.Span, record func(n int64), body io.ReadCloser) io.ReadCloser { + // The successful protocol switch responses will have a body that + // implement an io.ReadWriteCloser. Ensure this interface type continues + // to be satisfied if that is the case. + if _, ok := body.(io.ReadWriteCloser); ok { + return &wrappedBody{span: span, record: record, body: body} + } + + // Remove the implementation of the io.ReadWriteCloser and only implement + // the io.ReadCloser. + return struct{ io.ReadCloser }{&wrappedBody{span: span, record: record, body: body}} +} + +// wrappedBody is the response body type returned by the transport +// instrumentation to complete a span. Errors encountered when using the +// response body are recorded in span tracking the response. +// +// The span tracking the response is ended when this body is closed. +// +// If the response body implements the io.Writer interface (i.e. for +// successful protocol switches), the wrapped body also will. +type wrappedBody struct { + span trace.Span + recorded atomic.Bool + record func(n int64) + body io.ReadCloser + read atomic.Int64 +} + +var _ io.ReadWriteCloser = &wrappedBody{} + +func (wb *wrappedBody) Write(p []byte) (int, error) { + // This will not panic given the guard in newWrappedBody. + n, err := wb.body.(io.Writer).Write(p) + if err != nil { + wb.span.SetAttributes(otelsemconv.ErrorType(err)) + wb.span.SetStatus(codes.Error, err.Error()) + } + return n, err +} + +func (wb *wrappedBody) Read(b []byte) (int, error) { + n, err := wb.body.Read(b) + // Record the number of bytes read + wb.read.Add(int64(n)) + + switch err { + case nil: + // nothing to do here but fall through to the return + case io.EOF: + wb.recordBytesRead() + wb.span.End() + default: + wb.span.SetAttributes(otelsemconv.ErrorType(err)) + wb.span.SetStatus(codes.Error, err.Error()) + } + return n, err +} + +// recordBytesRead is a function that ensures the number of bytes read is recorded once and only once. +func (wb *wrappedBody) recordBytesRead() { + // note: it is more performant (and equally correct) to use atomic.Bool over sync.Once here. In the event that + // two goroutines are racing to call this method, the number of bytes read will no longer increase. Using + // CompareAndSwap allows later goroutines to return quickly and not block waiting for the race winner to finish + // calling wb.record(wb.read.Load()). + if wb.recorded.CompareAndSwap(false, true) { + // Record the total number of bytes read + wb.record(wb.read.Load()) + } +} + +func (wb *wrappedBody) Close() error { + wb.recordBytesRead() + wb.span.End() + if wb.body != nil { + return wb.body.Close() + } + return nil +} diff --git a/vendor/go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp/version.go b/vendor/go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp/version.go new file mode 100644 index 00000000..835ec5aa --- /dev/null +++ b/vendor/go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp/version.go @@ -0,0 +1,7 @@ +// Copyright The OpenTelemetry Authors +// SPDX-License-Identifier: Apache-2.0 + +package otelhttp // import "go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp" + +// Version is the current release version of the otelhttp instrumentation. +const Version = "0.68.0" diff --git a/vendor/go.opentelemetry.io/otel/.clomonitor.yml b/vendor/go.opentelemetry.io/otel/.clomonitor.yml new file mode 100644 index 00000000..128d61a2 --- /dev/null +++ b/vendor/go.opentelemetry.io/otel/.clomonitor.yml @@ -0,0 +1,3 @@ +exemptions: + - check: artifacthub_badge + reason: "Artifact Hub doesn't support Go packages" diff --git a/vendor/go.opentelemetry.io/otel/.codespellignore b/vendor/go.opentelemetry.io/otel/.codespellignore new file mode 100644 index 00000000..a6d0cbcc --- /dev/null +++ b/vendor/go.opentelemetry.io/otel/.codespellignore @@ -0,0 +1,11 @@ +ot +fo +te +collison +consequentially +ans +nam +valu +thirdparty +addOpt +observ diff --git a/vendor/go.opentelemetry.io/otel/.codespellrc b/vendor/go.opentelemetry.io/otel/.codespellrc new file mode 100644 index 00000000..e2cb3ea9 --- /dev/null +++ b/vendor/go.opentelemetry.io/otel/.codespellrc @@ -0,0 +1,10 @@ +# https://github.com/codespell-project/codespell +[codespell] +builtin = clear,rare,informal +check-filenames = +check-hidden = +ignore-words = .codespellignore +interactive = 1 +skip = .git,go.mod,go.sum,go.work,go.work.sum,semconv,venv,.tools +uri-ignore-words-list = * +write = diff --git a/vendor/go.opentelemetry.io/otel/.gitattributes b/vendor/go.opentelemetry.io/otel/.gitattributes new file mode 100644 index 00000000..314766e9 --- /dev/null +++ b/vendor/go.opentelemetry.io/otel/.gitattributes @@ -0,0 +1,3 @@ +* text=auto eol=lf +*.{cmd,[cC][mM][dD]} text eol=crlf +*.{bat,[bB][aA][tT]} text eol=crlf diff --git a/vendor/go.opentelemetry.io/otel/.gitignore b/vendor/go.opentelemetry.io/otel/.gitignore new file mode 100644 index 00000000..749e8e88 --- /dev/null +++ b/vendor/go.opentelemetry.io/otel/.gitignore @@ -0,0 +1,15 @@ +.DS_Store +Thumbs.db + +.cache/ +.tools/ +venv/ +.idea/ +.vscode/ +*.iml +*.so +coverage.* +go.work +go.work.sum + +gen/ diff --git a/vendor/go.opentelemetry.io/otel/.golangci.yml b/vendor/go.opentelemetry.io/otel/.golangci.yml new file mode 100644 index 00000000..db1f5510 --- /dev/null +++ b/vendor/go.opentelemetry.io/otel/.golangci.yml @@ -0,0 +1,279 @@ +version: "2" +run: + issues-exit-code: 1 + tests: true +linters: + default: none + enable: + - asasalint + - bodyclose + - depguard + - errcheck + - errorlint + - gocritic + - godot + - gosec + - govet + - ineffassign + - misspell + - modernize + - noctx + - perfsprint + - revive + - staticcheck + - testifylint + - unconvert + - unparam + - unused + - usestdlibvars + - usetesting + settings: + depguard: + rules: + auto/sdk: + files: + - '!internal/global/trace.go' + - ~internal/global/trace_test.go + deny: + - pkg: go.opentelemetry.io/auto/sdk + desc: Do not use SDK from automatic instrumentation. + non-tests: + files: + - '!$test' + - '!**/*test/*.go' + - '!**/internal/matchers/*.go' + deny: + - pkg: testing + - pkg: github.com/stretchr/testify + - pkg: crypto/md5 + - pkg: crypto/sha1 + - pkg: crypto/**/pkix + otel-internal: + files: + - '**/sdk/*.go' + - '**/sdk/**/*.go' + - '**/exporters/*.go' + - '**/exporters/**/*.go' + - '**/schema/*.go' + - '**/schema/**/*.go' + - '**/metric/*.go' + - '**/metric/**/*.go' + - '**/bridge/*.go' + - '**/bridge/**/*.go' + - '**/trace/*.go' + - '**/trace/**/*.go' + - '**/log/*.go' + - '**/log/**/*.go' + deny: + - pkg: go.opentelemetry.io/otel/internal$ + desc: Do not use cross-module internal packages. + - pkg: go.opentelemetry.io/otel/internal/internaltest + desc: Do not use cross-module internal packages. + otlp-internal: + files: + - '!**/exporters/otlp/internal/**/*.go' + deny: + - pkg: go.opentelemetry.io/otel/exporters/otlp/internal + desc: Do not use cross-module internal packages. + otlpmetric-internal: + files: + - '!**/exporters/otlp/otlpmetric/internal/*.go' + - '!**/exporters/otlp/otlpmetric/internal/**/*.go' + deny: + - pkg: go.opentelemetry.io/otel/exporters/otlp/otlpmetric/internal + desc: Do not use cross-module internal packages. + otlptrace-internal: + files: + - '!**/exporters/otlp/otlptrace/*.go' + - '!**/exporters/otlp/otlptrace/internal/**.go' + deny: + - pkg: go.opentelemetry.io/otel/exporters/otlp/otlptrace/internal + desc: Do not use cross-module internal packages. + semconv: + list-mode: lax + files: + - "!**/semconv/**" + - "!**/exporters/zipkin/**" + deny: + - pkg: go.opentelemetry.io/otel/semconv + desc: "Use go.opentelemetry.io/otel/semconv/v1.40.0 instead. If a newer semconv version has been released, update the depguard rule." + allow: + - go.opentelemetry.io/otel/semconv/v1.40.0 + gocritic: + disabled-checks: + - appendAssign + - commentedOutCode + - dupArg + - hugeParam + - importShadow + - preferDecodeRune + - rangeValCopy + - unnamedResult + - whyNoLint + enable-all: true + godot: + exclude: + # Exclude links. + - '^ *\[[^]]+\]:' + # Exclude sentence fragments for lists. + - ^[ ]*[-•] + # Exclude sentences prefixing a list. + - :$ + misspell: + locale: US + ignore-rules: + - cancelled + modernize: + disable: + - omitzero + perfsprint: + int-conversion: true + err-error: true + errorf: true + sprintf1: true + strconcat: true + revive: + confidence: 0.01 + rules: + - name: blank-imports + - name: bool-literal-in-expr + - name: constant-logical-expr + - name: context-as-argument + arguments: + - allowTypesBefore: '*testing.T' + disabled: true + - name: context-keys-type + - name: deep-exit + - name: defer + arguments: + - - call-chain + - loop + - name: dot-imports + - name: duplicated-imports + - name: early-return + arguments: + - preserveScope + - name: empty-block + - name: empty-lines + - name: error-naming + - name: error-return + - name: error-strings + - name: errorf + - name: exported + arguments: + - sayRepetitiveInsteadOfStutters + - name: flag-parameter + - name: identical-branches + - name: if-return + - name: import-shadowing + - name: increment-decrement + - name: indent-error-flow + arguments: + - preserveScope + - name: package-comments + - name: range + - name: range-val-in-closure + - name: range-val-address + - name: redefines-builtin-id + - name: string-format + arguments: + - - panic + - /^[^\n]*$/ + - must not contain line breaks + - name: struct-tag + - name: superfluous-else + arguments: + - preserveScope + - name: time-equal + - name: unconditional-recursion + - name: unexported-return + - name: unhandled-error + arguments: + - fmt.Fprint + - fmt.Fprintf + - fmt.Fprintln + - fmt.Print + - fmt.Printf + - fmt.Println + - name: unused-parameter + - name: unused-receiver + - name: unnecessary-stmt + - name: use-any + - name: useless-break + - name: var-declaration + - name: var-naming + arguments: + - ["ID"] # AllowList + - ["Otel", "Aws", "Gcp"] # DenyList + - - skip-package-name-collision-with-go-std: true + - name: waitgroup-by-value + testifylint: + enable-all: true + disable: + - float-compare + - go-require + - require-error + usetesting: + context-background: true + context-todo: true + exclusions: + generated: lax + presets: + - common-false-positives + - legacy + - std-error-handling + rules: + - linters: + - revive + path: schema/v.*/types/.* + text: avoid meaningless package names + # TODO: Having appropriate comments for exported objects helps development, + # even for objects in internal packages. Appropriate comments for all + # exported objects should be added and this exclusion removed. + - linters: + - revive + path: .*internal/.* + text: exported (method|function|type|const) (.+) should have comment or be unexported + # Yes, they are, but it's okay in a test. + - linters: + - revive + path: _test\.go + text: exported func.*returns unexported type.*which can be annoying to use + # Example test functions should be treated like main. + - linters: + - revive + path: example.*_test\.go + text: calls to (.+) only in main[(][)] or init[(][)] functions + # It's okay to not run gosec and perfsprint in a test. + - linters: + - gosec + - perfsprint + path: _test\.go + # Ignoring gosec G404: Use of weak random number generator (math/rand instead of crypto/rand) + # as we commonly use it in tests and examples. + - linters: + - gosec + text: 'G404:' + # Ignoring gosec G402: TLS MinVersion too low + # as the https://pkg.go.dev/crypto/tls#Config handles MinVersion default well. + - linters: + - gosec + text: 'G402: TLS MinVersion too low.' +issues: + max-issues-per-linter: 0 + max-same-issues: 0 +formatters: + enable: + - gofumpt + - goimports + - golines + settings: + gofumpt: + extra-rules: true + goimports: + local-prefixes: + - go.opentelemetry.io/otel + golines: + max-len: 120 + exclusions: + generated: lax diff --git a/vendor/go.opentelemetry.io/otel/.lycheeignore b/vendor/go.opentelemetry.io/otel/.lycheeignore new file mode 100644 index 00000000..994b677d --- /dev/null +++ b/vendor/go.opentelemetry.io/otel/.lycheeignore @@ -0,0 +1,13 @@ +http://localhost +https://localhost +http://jaeger-collector +https://github.com/open-telemetry/opentelemetry-go/milestone/ +https://github.com/open-telemetry/opentelemetry-go/projects +# Weaver model URL for semantic-conventions repository. +https?:\/\/github\.com\/open-telemetry\/semantic-conventions\/archive\/refs\/tags\/[^.]+\.zip\[[^]]+] +file:///home/runner/work/opentelemetry-go/opentelemetry-go/libraries +file:///home/runner/work/opentelemetry-go/opentelemetry-go/manual +http://4.3.2.1:78/user/123 +file:///home/runner/work/opentelemetry-go/opentelemetry-go/exporters/otlp/otlptrace/otlptracegrpc/internal/observ/dns:/:4317 +# URL works, but it has blocked link checkers. +https://dl.acm.org/doi/10.1145/198429.198435 diff --git a/vendor/go.opentelemetry.io/otel/.markdownlint.yaml b/vendor/go.opentelemetry.io/otel/.markdownlint.yaml new file mode 100644 index 00000000..3202496c --- /dev/null +++ b/vendor/go.opentelemetry.io/otel/.markdownlint.yaml @@ -0,0 +1,29 @@ +# Default state for all rules +default: true + +# ul-style +MD004: false + +# hard-tabs +MD010: false + +# line-length +MD013: false + +# no-duplicate-header +MD024: + siblings_only: true + +#single-title +MD025: false + +# ol-prefix +MD029: + style: ordered + +# no-inline-html +MD033: false + +# fenced-code-language +MD040: false + diff --git a/vendor/go.opentelemetry.io/otel/CHANGELOG.md b/vendor/go.opentelemetry.io/otel/CHANGELOG.md new file mode 100644 index 00000000..20edda44 --- /dev/null +++ b/vendor/go.opentelemetry.io/otel/CHANGELOG.md @@ -0,0 +1,3739 @@ +# Changelog + +All notable changes to this project will be documented in this file. + +The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/). + +This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). + +## [Unreleased] + + + + +## [1.43.0/0.65.0/0.19.0] 2026-04-02 + +### Added + +- Add `IsRandom` and `WithRandom` on `TraceFlags`, and `IsRandom` on `SpanContext` in `go.opentelemetry.io/otel/trace` for [W3C Trace Context Level 2 Random Trace ID Flag](https://www.w3.org/TR/trace-context-2/#random-trace-id-flag) support. (#8012) +- Add service detection with `WithService` in `go.opentelemetry.io/otel/sdk/resource`. (#7642) +- Add `DefaultWithContext` and `EnvironmentWithContext` in `go.opentelemetry.io/otel/sdk/resource` to support plumbing `context.Context` through default and environment detectors. (#8051) +- Support attributes with empty value (`attribute.EMPTY`) in `go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc`. (#8038) +- Support attributes with empty value (`attribute.EMPTY`) in `go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetricgrpc`. (#8038) +- Support attributes with empty value (`attribute.EMPTY`) in `go.opentelemetry.io/otel/exporters/otlp/otlplog/otlploggrpc`. (#8038) +- Support attributes with empty value (`attribute.EMPTY`) in `go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracehttp`. (#8038) +- Support attributes with empty value (`attribute.EMPTY`) in `go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetrichttp`. (#8038) +- Support attributes with empty value (`attribute.EMPTY`) in `go.opentelemetry.io/otel/exporters/otlp/otlplog/otlploghttp`. (#8038) +- Support attributes with empty value (`attribute.EMPTY`) in `go.opentelemetry.io/otel/sdk/metric/metricdata/metricdatatest`. (#8038) +- Add support for per-series start time tracking for cumulative metrics in `go.opentelemetry.io/otel/sdk/metric`. + Set `OTEL_GO_X_PER_SERIES_START_TIMESTAMPS=true` to enable. (#8060) +- Add `WithCardinalityLimitSelector` for metric reader for configuring cardinality limits specific to the instrument kind. (#7855) + +### Changed + +- Introduce the `EMPTY` Type in `go.opentelemetry.io/otel/attribute` to reflect that an empty value is now a valid value, with `INVALID` remaining as a deprecated alias of `EMPTY`. (#8038) +- Improve slice handling in `go.opentelemetry.io/otel/attribute` to optimize short slice values with fixed-size fast paths. (#8039) +- Improve performance of span metric recording in `go.opentelemetry.io/otel/sdk/trace` by returning early if self-observability is not enabled. (#8067) +- Improve formatting of metric data diffs in `go.opentelemetry.io/otel/sdk/metric/metricdata/metricdatatest`. (#8073) + +### Deprecated + +- Deprecate `INVALID` in `go.opentelemetry.io/otel/attribute`. Use `EMPTY` instead. (#8038) + +### Fixed + +- Return spec-compliant `TraceIdRatioBased` description. This is a breaking behavioral change, but it is necessary to + make the implementation [spec-compliant](https://opentelemetry.io/docs/specs/otel/trace/sdk/#traceidratiobased). (#8027) +- Fix a race condition in `go.opentelemetry.io/otel/sdk/metric` where the lastvalue aggregation could collect the value 0 even when no zero-value measurements were recorded. (#8056) +- Limit HTTP response body to 4 MiB in `go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracehttp` to mitigate excessive memory usage caused by a misconfigured or malicious server. + Responses exceeding the limit are treated as non-retryable errors. (#8108) +- Limit HTTP response body to 4 MiB in `go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetrichttp` to mitigate excessive memory usage caused by a misconfigured or malicious server. + Responses exceeding the limit are treated as non-retryable errors. (#8108) +- Limit HTTP response body to 4 MiB in `go.opentelemetry.io/otel/exporters/otlp/otlplog/otlploghttp` to mitigate excessive memory usage caused by a misconfigured or malicious server. + Responses exceeding the limit are treated as non-retryable errors. (#8108) +- `WithHostID` detector in `go.opentelemetry.io/otel/sdk/resource` to use full path for `kenv` command on BSD. (#8113) +- Fix missing `request.GetBody` in `go.opentelemetry.io/otel/exporters/otlp/otlplog/otlploghttp` to correctly handle HTTP2 GOAWAY frame. (#8096) + +## [1.42.0/0.64.0/0.18.0/0.0.16] 2026-03-06 + +### Added + +- Add `go.opentelemetry.io/otel/semconv/v1.40.0` package. + The package contains semantic conventions from the `v1.40.0` version of the OpenTelemetry Semantic Conventions. + See the [migration documentation](./semconv/v1.40.0/MIGRATION.md) for information on how to upgrade from `go.opentelemetry.io/otel/semconv/v1.39.0`. (#7985) +- Add `Err` and `SetErr` on `Record` in `go.opentelemetry.io/otel/log` to attach an error and set record exception attributes in `go.opentelemetry.io/otel/log/sdk`. (#7924) + +### Changed + +- `TracerProvider.ForceFlush` in `go.opentelemetry.io/otel/sdk/trace` joins errors together and continues iteration through SpanProcessors as opposed to returning the first encountered error without attempting exports on subsequent SpanProcessors. (#7856) + +### Fixed + +- Fix missing `request.GetBody` in `go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetrichttp` to correctly handle HTTP2 GOAWAY frame. (#7931) +- Fix semconv v1.39.0 generated metric helpers skipping required attributes when extra attributes were empty. (#7964) +- Preserve W3C TraceFlags bitmask (including the random Trace ID flag) during trace context extraction and injection in `go.opentelemetry.io/otel/propagation`. (#7834) + +### Removed + +- Drop support for [Go 1.24]. (#7984) + +## [1.41.0/0.63.0/0.17.0/0.0.15] 2026-03-02 + +This release is the last to support [Go 1.24]. +The next release will require at least [Go 1.25]. + +### Added + +- Support testing of [Go 1.26]. (#7902) + +### Fixed + +- Update `Baggage` in `go.opentelemetry.io/otel/propagation` and `Parse` and `New` in `go.opentelemetry.io/otel/baggage` to comply with W3C Baggage specification limits. + `New` and `Parse` now return partial baggage along with an error when limits are exceeded. + Errors from baggage extraction are reported to the global error handler. (#7880) +- Return an error when the endpoint is configured as insecure and with TLS configuration in `go.opentelemetry.io/otel/exporters/otlp/otlplog/otlploghttp`. (#7914) +- Return an error when the endpoint is configured as insecure and with TLS configuration in `go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetrichttp`. (#7914) +- Return an error when the endpoint is configured as insecure and with TLS configuration in `go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracehttp`. (#7914) + +## [1.40.0/0.62.0/0.16.0] 2026-02-02 + +### Added + +- Add `AlwaysRecord` sampler in `go.opentelemetry.io/otel/sdk/trace`. (#7724) +- Add `Enabled` method to all synchronous instrument interfaces (`Float64Counter`, `Float64UpDownCounter`, `Float64Histogram`, `Float64Gauge`, `Int64Counter`, `Int64UpDownCounter`, `Int64Histogram`, `Int64Gauge`,) in `go.opentelemetry.io/otel/metric`. + This stabilizes the synchronous instrument enabled feature, allowing users to check if an instrument will process measurements before performing computationally expensive operations. (#7763) +- Add `go.opentelemetry.io/otel/semconv/v1.39.0` package. + The package contains semantic conventions from the `v1.39.0` version of the OpenTelemetry Semantic Conventions. + See the [migration documentation](./semconv/v1.39.0/MIGRATION.md) for information on how to upgrade from `go.opentelemetry.io/otel/semconv/v1.38.0.` (#7783, #7789) + +### Changed + +- Improve the concurrent performance of `HistogramReservoir` in `go.opentelemetry.io/otel/sdk/metric/exemplar` by 4x. (#7443) +- Improve the concurrent performance of `FixedSizeReservoir` in `go.opentelemetry.io/otel/sdk/metric/exemplar`. (#7447) +- Improve performance of concurrent histogram measurements in `go.opentelemetry.io/otel/sdk/metric`. (#7474) +- Improve performance of concurrent synchronous gauge measurements in `go.opentelemetry.io/otel/sdk/metric`. (#7478) +- Add experimental observability metrics in `go.opentelemetry.io/otel/exporters/stdout/stdoutmetric`. (#7492) +- `Exporter` in `go.opentelemetry.io/otel/exporters/prometheus` ignores metrics with the scope `go.opentelemetry.io/contrib/bridges/prometheus`. + This prevents scrape failures when the Prometheus exporter is misconfigured to get data from the Prometheus bridge. (#7688) +- Improve performance of concurrent exponential histogram measurements in `go.opentelemetry.io/otel/sdk/metric`. (#7702) +- The `rpc.grpc.status_code` attribute in the experimental metrics emitted from `go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc` is replaced with the `rpc.response.status_code` attribute to align with the semantic conventions. (#7854) +- The `rpc.grpc.status_code` attribute in the experimental metrics emitted from `go.opentelemetry.io/otel/exporters/otlp/otlplog/otlploggrpc` is replaced with the `rpc.response.status_code` attribute to align with the semantic conventions. (#7854) + +### Fixed + +- Fix bad log message when key-value pairs are dropped because of key duplication in `go.opentelemetry.io/otel/sdk/log`. (#7662) +- Fix `DroppedAttributes` on `Record` in `go.opentelemetry.io/otel/sdk/log` to not count the non-attribute key-value pairs dropped because of key duplication. (#7662) +- Fix `SetAttributes` on `Record` in `go.opentelemetry.io/otel/sdk/log` to not log that attributes are dropped when they are actually not dropped. (#7662) +- Fix missing `request.GetBody` in `go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracehttp` to correctly handle HTTP/2 `GOAWAY` frame. (#7794) +- `WithHostID` detector in `go.opentelemetry.io/otel/sdk/resource` to use full path for `ioreg` command on Darwin (macOS). (#7818) + +### Deprecated + +- Deprecate `go.opentelemetry.io/otel/exporters/zipkin`. + For more information, see the [OTel blog post deprecating the Zipkin exporter](https://opentelemetry.io/blog/2025/deprecating-zipkin-exporters/). (#7670) + +## [1.39.0/0.61.0/0.15.0/0.0.14] 2025-12-05 + +### Added + +- Greatly reduce the cost of recording metrics in `go.opentelemetry.io/otel/sdk/metric` using hashing for map keys. (#7175) +- Add `WithInstrumentationAttributeSet` option to `go.opentelemetry.io/otel/log`, `go.opentelemetry.io/otel/metric`, and `go.opentelemetry.io/otel/trace` packages. + This provides a concurrent-safe and performant alternative to `WithInstrumentationAttributes` by accepting a pre-constructed `attribute.Set`. (#7287) +- Add experimental observability for the Prometheus exporter in `go.opentelemetry.io/otel/exporters/prometheus`. + Check the `go.opentelemetry.io/otel/exporters/prometheus/internal/x` package documentation for more information. (#7345) +- Add experimental observability metrics in `go.opentelemetry.io/otel/exporters/otlp/otlplog/otlploggrpc`. (#7353) +- Add temporality selector functions `DeltaTemporalitySelector`, `CumulativeTemporalitySelector`, `LowMemoryTemporalitySelector` to `go.opentelemetry.io/otel/sdk/metric`. (#7434) +- Add experimental observability metrics for simple log processor in `go.opentelemetry.io/otel/sdk/log`. (#7548) +- Add experimental observability metrics in `go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc`. (#7459) +- Add experimental observability metrics in `go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracehttp`. (#7486) +- Add experimental observability metrics for simple span processor in `go.opentelemetry.io/otel/sdk/trace`. (#7374) +- Add experimental observability metrics in `go.opentelemetry.io/otel/exporters/otlp/otlplog/otlploghttp`. (#7512) +- Add experimental observability metrics for manual reader in `go.opentelemetry.io/otel/sdk/metric`. (#7524) +- Add experimental observability metrics for periodic reader in `go.opentelemetry.io/otel/sdk/metric`. (#7571) +- Support `OTEL_EXPORTER_OTLP_LOGS_INSECURE` and `OTEL_EXPORTER_OTLP_INSECURE` environmental variables in `go.opentelemetry.io/otel/exporters/otlp/otlplog/otlploghttp`. (#7608) +- Add `Enabled` method to the `Processor` interface in `go.opentelemetry.io/otel/sdk/log`. + All `Processor` implementations now include an `Enabled` method. (#7639) +- The `go.opentelemetry.io/otel/semconv/v1.38.0` package. + The package contains semantic conventions from the `v1.38.0` version of the OpenTelemetry Semantic Conventions. + See the [migration documentation](./semconv/v1.38.0/MIGRATION.md) for information on how to upgrade from `go.opentelemetry.io/otel/semconv/v1.37.0.`(#7648) + +### Changed + +- `Distinct` in `go.opentelemetry.io/otel/attribute` is no longer guaranteed to uniquely identify an attribute set. + Collisions between `Distinct` values for different Sets are possible with extremely high cardinality (billions of series per instrument), but are highly unlikely. (#7175) +- `WithInstrumentationAttributes` in `go.opentelemetry.io/otel/trace` synchronously de-duplicates the passed attributes instead of delegating it to the returned `TracerOption`. (#7266) +- `WithInstrumentationAttributes` in `go.opentelemetry.io/otel/meter` synchronously de-duplicates the passed attributes instead of delegating it to the returned `MeterOption`. (#7266) +- `WithInstrumentationAttributes` in `go.opentelemetry.io/otel/log` synchronously de-duplicates the passed attributes instead of delegating it to the returned `LoggerOption`. (#7266) +- Rename the `OTEL_GO_X_SELF_OBSERVABILITY` environment variable to `OTEL_GO_X_OBSERVABILITY` in `go.opentelemetry.io/otel/sdk/trace`, `go.opentelemetry.io/otel/sdk/log`, and `go.opentelemetry.io/otel/exporters/stdout/stdouttrace`. (#7302) +- Improve performance of histogram `Record` in `go.opentelemetry.io/otel/sdk/metric` when min and max are disabled using `NoMinMax`. (#7306) +- Improve error handling for dropped data during translation by using `prometheus.NewInvalidMetric` in `go.opentelemetry.io/otel/exporters/prometheus`. + ⚠️ **Breaking Change:** Previously, these cases were only logged and scrapes succeeded. + Now, when translation would drop data (e.g., invalid label/value), the exporter emits a `NewInvalidMetric`, and Prometheus scrapes **fail with HTTP 500** by default. + To preserve the prior behavior (scrapes succeed while errors are logged), configure your Prometheus HTTP handler with: `promhttp.HandlerOpts{ ErrorHandling: promhttp.ContinueOnError }`. (#7363) +- Replace fnv hash with xxhash in `go.opentelemetry.io/otel/attribute` for better performance. (#7371) +- The default `TranslationStrategy` in `go.opentelemetry.io/exporters/prometheus` is changed from `otlptranslator.NoUTF8EscapingWithSuffixes` to `otlptranslator.UnderscoreEscapingWithSuffixes`. (#7421) +- Improve performance of concurrent measurements in `go.opentelemetry.io/otel/sdk/metric`. (#7427) +- Include W3C TraceFlags (bits 0–7) in the OTLP `Span.Flags` field in `go.opentelemetry.io/exporters/otlp/otlptrace/otlptracehttp` and `go.opentelemetry.io/exporters/otlp/otlptrace/otlptracegrpc`. (#7438) +- The `ErrorType` function in `go.opentelemetry.io/otel/semconv/v1.37.0` now handles custom error types. + If an error implements an `ErrorType() string` method, the return value of that method will be used as the error type. (#7442) + +### Fixed + +- Fix `WithInstrumentationAttributes` options in `go.opentelemetry.io/otel/trace`, `go.opentelemetry.io/otel/metric`, and `go.opentelemetry.io/otel/log` to properly merge attributes when passed multiple times instead of replacing them. + Attributes with duplicate keys will use the last value passed. (#7300) +- The equality of `attribute.Set` when using the `Equal` method is not affected by the user overriding the empty set pointed to by `attribute.EmptySet` in `go.opentelemetry.io/otel/attribute`. (#7357) +- Return partial OTLP export errors to the caller in `go.opentelemetry.io/otel/exporters/otlp/otlplog/otlploggrpc`. (#7372) +- Return partial OTLP export errors to the caller in `go.opentelemetry.io/otel/exporters/otlp/otlplog/otlploghttp`. (#7372) +- Return partial OTLP export errors to the caller in `go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetricgrpc`. (#7372) +- Return partial OTLP export errors to the caller in `go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetrichttp`. (#7372) +- Return partial OTLP export errors to the caller in `go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc`. (#7372) +- Return partial OTLP export errors to the caller in `go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracehttp`. (#7372) +- Fix `AddAttributes`, `SetAttributes`, `SetBody` on `Record` in `go.opentelemetry.io/otel/sdk/log` to not mutate input. (#7403) +- Do not double record measurements of `RecordSet` methods in `go.opentelemetry.io/otel/semconv/v1.37.0`. (#7655) +- Do not double record measurements of `RecordSet` methods in `go.opentelemetry.io/otel/semconv/v1.36.0`. (#7656) + +### Removed + +- Drop support for [Go 1.23]. (#7274) +- Remove the `FilterProcessor` interface in `go.opentelemetry.io/otel/sdk/log`. + The `Enabled` method has been added to the `Processor` interface instead. + All `Processor` implementations must now implement the `Enabled` method. + Custom processors that do not filter records can implement `Enabled` to return `true`. (#7639) + +## [1.38.0/0.60.0/0.14.0/0.0.13] 2025-08-29 + +This release is the last to support [Go 1.23]. +The next release will require at least [Go 1.24]. + +### Added + +- Add native histogram exemplar support in `go.opentelemetry.io/otel/exporters/prometheus`. (#6772) +- Add template attribute functions to the `go.opentelmetry.io/otel/semconv/v1.34.0` package. (#6939) + - `ContainerLabel` + - `DBOperationParameter` + - `DBSystemParameter` + - `HTTPRequestHeader` + - `HTTPResponseHeader` + - `K8SCronJobAnnotation` + - `K8SCronJobLabel` + - `K8SDaemonSetAnnotation` + - `K8SDaemonSetLabel` + - `K8SDeploymentAnnotation` + - `K8SDeploymentLabel` + - `K8SJobAnnotation` + - `K8SJobLabel` + - `K8SNamespaceAnnotation` + - `K8SNamespaceLabel` + - `K8SNodeAnnotation` + - `K8SNodeLabel` + - `K8SPodAnnotation` + - `K8SPodLabel` + - `K8SReplicaSetAnnotation` + - `K8SReplicaSetLabel` + - `K8SStatefulSetAnnotation` + - `K8SStatefulSetLabel` + - `ProcessEnvironmentVariable` + - `RPCConnectRPCRequestMetadata` + - `RPCConnectRPCResponseMetadata` + - `RPCGRPCRequestMetadata` + - `RPCGRPCResponseMetadata` +- Add `ErrorType` attribute helper function to the `go.opentelmetry.io/otel/semconv/v1.34.0` package. (#6962) +- Add `WithAllowKeyDuplication` in `go.opentelemetry.io/otel/sdk/log` which can be used to disable deduplication for log records. (#6968) +- Add `WithCardinalityLimit` option to configure the cardinality limit in `go.opentelemetry.io/otel/sdk/metric`. (#6996, #7065, #7081, #7164, #7165, #7179) +- Add `Clone` method to `Record` in `go.opentelemetry.io/otel/log` that returns a copy of the record with no shared state. (#7001) +- Add experimental self-observability span and batch span processor metrics in `go.opentelemetry.io/otel/sdk/trace`. + Check the `go.opentelemetry.io/otel/sdk/trace/internal/x` package documentation for more information. (#7027, #6393, #7209) +- The `go.opentelemetry.io/otel/semconv/v1.36.0` package. + The package contains semantic conventions from the `v1.36.0` version of the OpenTelemetry Semantic Conventions. + See the [migration documentation](./semconv/v1.36.0/MIGRATION.md) for information on how to upgrade from `go.opentelemetry.io/otel/semconv/v1.34.0.`(#7032, #7041) +- Add support for configuring Prometheus name translation using `WithTranslationStrategy` option in `go.opentelemetry.io/otel/exporters/prometheus`. The current default translation strategy when UTF-8 mode is enabled is `NoUTF8EscapingWithSuffixes`, but a future release will change the default strategy to `UnderscoreEscapingWithSuffixes` for compliance with the specification. (#7111) +- Add experimental self-observability log metrics in `go.opentelemetry.io/otel/sdk/log`. + Check the `go.opentelemetry.io/otel/sdk/log/internal/x` package documentation for more information. (#7121) +- Add experimental self-observability trace exporter metrics in `go.opentelemetry.io/otel/exporters/stdout/stdouttrace`. + Check the `go.opentelemetry.io/otel/exporters/stdout/stdouttrace/internal/x` package documentation for more information. (#7133) +- Support testing of [Go 1.25]. (#7187) +- The `go.opentelemetry.io/otel/semconv/v1.37.0` package. + The package contains semantic conventions from the `v1.37.0` version of the OpenTelemetry Semantic Conventions. + See the [migration documentation](./semconv/v1.37.0/MIGRATION.md) for information on how to upgrade from `go.opentelemetry.io/otel/semconv/v1.36.0.`(#7254) + +### Changed + +- Optimize `TraceIDFromHex` and `SpanIDFromHex` in `go.opentelemetry.io/otel/sdk/trace`. (#6791) +- Change `AssertEqual` in `go.opentelemetry.io/otel/log/logtest` to accept `TestingT` in order to support benchmarks and fuzz tests. (#6908) +- Change `DefaultExemplarReservoirProviderSelector` in `go.opentelemetry.io/otel/sdk/metric` to use `runtime.GOMAXPROCS(0)` instead of `runtime.NumCPU()` for the `FixedSizeReservoirProvider` default size. (#7094) + +### Fixed + +- `SetBody` method of `Record` in `go.opentelemetry.io/otel/sdk/log` now deduplicates key-value collections (`log.Value` of `log.KindMap` from `go.opentelemetry.io/otel/log`). (#7002) +- Fix `go.opentelemetry.io/otel/exporters/prometheus` to not append a suffix if it's already present in metric name. (#7088) +- Fix the `go.opentelemetry.io/otel/exporters/stdout/stdouttrace` self-observability component type and name. (#7195) +- Fix partial export count metric in `go.opentelemetry.io/otel/exporters/stdout/stdouttrace`. (#7199) + +### Deprecated + +- Deprecate `WithoutUnits` and `WithoutCounterSuffixes` options, preferring `WithTranslationStrategy` instead. (#7111) +- Deprecate support for `OTEL_GO_X_CARDINALITY_LIMIT` environment variable in `go.opentelemetry.io/otel/sdk/metric`. Use `WithCardinalityLimit` option instead. (#7166) + +## [0.59.1] 2025-07-21 + +### Changed + +- Retract `v0.59.0` release of `go.opentelemetry.io/otel/exporters/prometheus` module which appends incorrect unit suffixes. (#7046) +- Change `go.opentelemetry.io/otel/exporters/prometheus` to no longer deduplicate suffixes when UTF8 is enabled. + It is recommended to disable unit and counter suffixes in the exporter, and manually add suffixes if you rely on the existing behavior. (#7044) + +### Fixed + +- Fix `go.opentelemetry.io/otel/exporters/prometheus` to properly handle unit suffixes when the unit is in brackets. + E.g. `{spans}`. (#7044) + +## [1.37.0/0.59.0/0.13.0] 2025-06-25 + +### Added + +- The `go.opentelemetry.io/otel/semconv/v1.33.0` package. + The package contains semantic conventions from the `v1.33.0` version of the OpenTelemetry Semantic Conventions. + See the [migration documentation](./semconv/v1.33.0/MIGRATION.md) for information on how to upgrade from `go.opentelemetry.io/otel/semconv/v1.32.0.`(#6799) +- The `go.opentelemetry.io/otel/semconv/v1.34.0` package. + The package contains semantic conventions from the `v1.34.0` version of the OpenTelemetry Semantic Conventions. (#6812) +- Add metric's schema URL as `otel_scope_schema_url` label in `go.opentelemetry.io/otel/exporters/prometheus`. (#5947) +- Add metric's scope attributes as `otel_scope_[attribute]` labels in `go.opentelemetry.io/otel/exporters/prometheus`. (#5947) +- Add `EventName` to `EnabledParameters` in `go.opentelemetry.io/otel/log`. (#6825) +- Add `EventName` to `EnabledParameters` in `go.opentelemetry.io/otel/sdk/log`. (#6825) +- Changed handling of `go.opentelemetry.io/otel/exporters/prometheus` metric renaming to add unit suffixes when it doesn't match one of the pre-defined values in the unit suffix map. (#6839) + +### Changed + +- The semantic conventions have been upgraded from `v1.26.0` to `v1.34.0` in `go.opentelemetry.io/otel/bridge/opentracing`. (#6827) +- The semantic conventions have been upgraded from `v1.26.0` to `v1.34.0` in `go.opentelemetry.io/otel/exporters/zipkin`. (#6829) +- The semantic conventions have been upgraded from `v1.26.0` to `v1.34.0` in `go.opentelemetry.io/otel/metric`. (#6832) +- The semantic conventions have been upgraded from `v1.26.0` to `v1.34.0` in `go.opentelemetry.io/otel/sdk/resource`. (#6834) +- The semantic conventions have been upgraded from `v1.26.0` to `v1.34.0` in `go.opentelemetry.io/otel/sdk/trace`. (#6835) +- The semantic conventions have been upgraded from `v1.26.0` to `v1.34.0` in `go.opentelemetry.io/otel/trace`. (#6836) +- `Record.Resource` now returns `*resource.Resource` instead of `resource.Resource` in `go.opentelemetry.io/otel/sdk/log`. (#6864) +- Retry now shows error cause for context timeout in `go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc`, `go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetricgrpc`, `go.opentelemetry.io/otel/exporters/otlp/otlplog/otlploggrpc`, `go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracehttp`, `go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetrichttp`, `go.opentelemetry.io/otel/exporters/otlp/otlplog/otlploghttp`. (#6898) + +### Fixed + +- Stop stripping trailing slashes from configured endpoint URL in `go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc`. (#6710) +- Stop stripping trailing slashes from configured endpoint URL in `go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracehttp`. (#6710) +- Stop stripping trailing slashes from configured endpoint URL in `go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetricgrpc`. (#6710) +- Stop stripping trailing slashes from configured endpoint URL in `go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetrichttp`. (#6710) +- Validate exponential histogram scale range for Prometheus compatibility in `go.opentelemetry.io/otel/exporters/prometheus`. (#6822) +- Context cancellation during metric pipeline produce does not corrupt data in `go.opentelemetry.io/otel/sdk/metric`. (#6914) + +### Removed + +- `go.opentelemetry.io/otel/exporters/prometheus` no longer exports `otel_scope_info` metric. (#6770) + +## [0.12.2] 2025-05-22 + +### Fixed + +- Retract `v0.12.0` release of `go.opentelemetry.io/otel/exporters/otlp/otlplog/otlploggrpc` module that contains invalid dependencies. (#6804) +- Retract `v0.12.0` release of `go.opentelemetry.io/otel/exporters/otlp/otlplog/otlploghttp` module that contains invalid dependencies. (#6804) +- Retract `v0.12.0` release of `go.opentelemetry.io/otel/exporters/stdout/stdoutlog` module that contains invalid dependencies. (#6804) + +## [0.12.1] 2025-05-21 + +### Fixes + +- Use the proper dependency version of `go.opentelemetry.io/otel/sdk/log/logtest` in `go.opentelemetry.io/otel/exporters/otlp/otlplog/otlploggrpc`. (#6800) +- Use the proper dependency version of `go.opentelemetry.io/otel/sdk/log/logtest` in `go.opentelemetry.io/otel/exporters/otlp/otlplog/otlploghttp`. (#6800) +- Use the proper dependency version of `go.opentelemetry.io/otel/sdk/log/logtest` in `go.opentelemetry.io/otel/exporters/stdout/stdoutlog`. (#6800) + +## [1.36.0/0.58.0/0.12.0] 2025-05-20 + +### Added + +- Add exponential histogram support in `go.opentelemetry.io/otel/exporters/prometheus`. (#6421) +- The `go.opentelemetry.io/otel/semconv/v1.31.0` package. + The package contains semantic conventions from the `v1.31.0` version of the OpenTelemetry Semantic Conventions. + See the [migration documentation](./semconv/v1.31.0/MIGRATION.md) for information on how to upgrade from `go.opentelemetry.io/otel/semconv/v1.30.0`. (#6479) +- Add `Recording`, `Scope`, and `Record` types in `go.opentelemetry.io/otel/log/logtest`. (#6507) +- Add `WithHTTPClient` option to configure the `http.Client` used by `go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracehttp`. (#6751) +- Add `WithHTTPClient` option to configure the `http.Client` used by `go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetrichttp`. (#6752) +- Add `WithHTTPClient` option to configure the `http.Client` used by `go.opentelemetry.io/otel/exporters/otlp/otlplog/otlploghttp`. (#6688) +- Add `ValuesGetter` in `go.opentelemetry.io/otel/propagation`, a `TextMapCarrier` that supports retrieving multiple values for a single key. (#5973) +- Add `Values` method to `HeaderCarrier` to implement the new `ValuesGetter` interface in `go.opentelemetry.io/otel/propagation`. (#5973) +- Update `Baggage` in `go.opentelemetry.io/otel/propagation` to retrieve multiple values for a key when the carrier implements `ValuesGetter`. (#5973) +- Add `AssertEqual` function in `go.opentelemetry.io/otel/log/logtest`. (#6662) +- The `go.opentelemetry.io/otel/semconv/v1.32.0` package. + The package contains semantic conventions from the `v1.32.0` version of the OpenTelemetry Semantic Conventions. + See the [migration documentation](./semconv/v1.32.0/MIGRATION.md) for information on how to upgrade from `go.opentelemetry.io/otel/semconv/v1.31.0`(#6782) +- Add `Transform` option in `go.opentelemetry.io/otel/log/logtest`. (#6794) +- Add `Desc` option in `go.opentelemetry.io/otel/log/logtest`. (#6796) + +### Removed + +- Drop support for [Go 1.22]. (#6381, #6418) +- Remove `Resource` field from `EnabledParameters` in `go.opentelemetry.io/otel/sdk/log`. (#6494) +- Remove `RecordFactory` type from `go.opentelemetry.io/otel/log/logtest`. (#6492) +- Remove `ScopeRecords`, `EmittedRecord`, and `RecordFactory` types from `go.opentelemetry.io/otel/log/logtest`. (#6507) +- Remove `AssertRecordEqual` function in `go.opentelemetry.io/otel/log/logtest`, use `AssertEqual` instead. (#6662) + +### Changed + +- ⚠️ Update `github.com/prometheus/client_golang` to `v1.21.1`, which changes the `NameValidationScheme` to `UTF8Validation`. + This allows metrics names to keep original delimiters (e.g. `.`), rather than replacing with underscores. + This can be reverted by setting `github.com/prometheus/common/model.NameValidationScheme` to `LegacyValidation` in `github.com/prometheus/common/model`. (#6433) +- Initialize map with `len(keys)` in `NewAllowKeysFilter` and `NewDenyKeysFilter` to avoid unnecessary allocations in `go.opentelemetry.io/otel/attribute`. (#6455) +- `go.opentelemetry.io/otel/log/logtest` is now a separate Go module. (#6465) +- `go.opentelemetry.io/otel/sdk/log/logtest` is now a separate Go module. (#6466) +- `Recorder` in `go.opentelemetry.io/otel/log/logtest` no longer separately stores records emitted by loggers with the same instrumentation scope. (#6507) +- Improve performance of `BatchProcessor` in `go.opentelemetry.io/otel/sdk/log` by not exporting when exporter cannot accept more. (#6569, #6641) + +### Deprecated + +- Deprecate support for `model.LegacyValidation` for `go.opentelemetry.io/otel/exporters/prometheus`. (#6449) + +### Fixes + +- Stop percent encoding header environment variables in `go.opentelemetry.io/otel/exporters/otlp/otlplog/otlploggrpc` and `go.opentelemetry.io/otel/exporters/otlp/otlplog/otlploghttp`. (#6392) +- Ensure the `noopSpan.tracerProvider` method is not inlined in `go.opentelemetry.io/otel/trace` so the `go.opentelemetry.io/auto` instrumentation can instrument non-recording spans. (#6456) +- Use a `sync.Pool` instead of allocating `metricdata.ResourceMetrics` in `go.opentelemetry.io/otel/exporters/prometheus`. (#6472) + +## [1.35.0/0.57.0/0.11.0] 2025-03-05 + +This release is the last to support [Go 1.22]. +The next release will require at least [Go 1.23]. + +### Added + +- Add `ValueFromAttribute` and `KeyValueFromAttribute` in `go.opentelemetry.io/otel/log`. (#6180) +- Add `EventName` and `SetEventName` to `Record` in `go.opentelemetry.io/otel/log`. (#6187) +- Add `EventName` to `RecordFactory` in `go.opentelemetry.io/otel/log/logtest`. (#6187) +- `AssertRecordEqual` in `go.opentelemetry.io/otel/log/logtest` checks `Record.EventName`. (#6187) +- Add `EventName` and `SetEventName` to `Record` in `go.opentelemetry.io/otel/sdk/log`. (#6193) +- Add `EventName` to `RecordFactory` in `go.opentelemetry.io/otel/sdk/log/logtest`. (#6193) +- Emit `Record.EventName` field in `go.opentelemetry.io/otel/exporters/otlp/otlplog/otlploggrpc`. (#6211) +- Emit `Record.EventName` field in `go.opentelemetry.io/otel/exporters/otlp/otlplog/otlploghttp`. (#6211) +- Emit `Record.EventName` field in `go.opentelemetry.io/otel/exporters/stdout/stdoutlog` (#6210) +- The `go.opentelemetry.io/otel/semconv/v1.28.0` package. + The package contains semantic conventions from the `v1.28.0` version of the OpenTelemetry Semantic Conventions. + See the [migration documentation](./semconv/v1.28.0/MIGRATION.md) for information on how to upgrade from `go.opentelemetry.io/otel/semconv/v1.27.0`(#6236) +- The `go.opentelemetry.io/otel/semconv/v1.30.0` package. + The package contains semantic conventions from the `v1.30.0` version of the OpenTelemetry Semantic Conventions. + See the [migration documentation](./semconv/v1.30.0/MIGRATION.md) for information on how to upgrade from `go.opentelemetry.io/otel/semconv/v1.28.0`(#6240) +- Document the pitfalls of using `Resource` as a comparable type. + `Resource.Equal` and `Resource.Equivalent` should be used instead. (#6272) +- Support [Go 1.24]. (#6304) +- Add `FilterProcessor` and `EnabledParameters` in `go.opentelemetry.io/otel/sdk/log`. + It replaces `go.opentelemetry.io/otel/sdk/log/internal/x.FilterProcessor`. + Compared to previous version it additionally gives the possibility to filter by resource and instrumentation scope. (#6317) + +### Changed + +- Update `github.com/prometheus/common` to `v0.62.0`, which changes the `NameValidationScheme` to `NoEscaping`. + This allows metrics names to keep original delimiters (e.g. `.`), rather than replacing with underscores. + This is controlled by the `Content-Type` header, or can be reverted by setting `NameValidationScheme` to `LegacyValidation` in `github.com/prometheus/common/model`. (#6198) + +### Fixes + +- Eliminate goroutine leak for the processor returned by `NewSimpleSpanProcessor` in `go.opentelemetry.io/otel/sdk/trace` when `Shutdown` is called and the passed `ctx` is canceled and `SpanExporter.Shutdown` has not returned. (#6368) +- Eliminate goroutine leak for the processor returned by `NewBatchSpanProcessor` in `go.opentelemetry.io/otel/sdk/trace` when `ForceFlush` is called and the passed `ctx` is canceled and `SpanExporter.Export` has not returned. (#6369) + +## [1.34.0/0.56.0/0.10.0] 2025-01-17 + +### Changed + +- Remove the notices from `Logger` to make the whole Logs API user-facing in `go.opentelemetry.io/otel/log`. (#6167) + +### Fixed + +- Relax minimum Go version to 1.22.0 in various modules. (#6073) +- The `Type` name logged for the `go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc` client is corrected from `otlphttpgrpc` to `otlptracegrpc`. (#6143) +- The `Type` name logged for the `go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlphttpgrpc` client is corrected from `otlphttphttp` to `otlptracehttp`. (#6143) + +## [1.33.0/0.55.0/0.9.0/0.0.12] 2024-12-12 + +### Added + +- Add `Reset` method to `SpanRecorder` in `go.opentelemetry.io/otel/sdk/trace/tracetest`. (#5994) +- Add `EnabledInstrument` interface in `go.opentelemetry.io/otel/sdk/metric/internal/x`. + This is an experimental interface that is implemented by synchronous instruments provided by `go.opentelemetry.io/otel/sdk/metric`. + Users can use it to avoid performing computationally expensive operations when recording measurements. + It does not fall within the scope of the OpenTelemetry Go versioning and stability [policy](./VERSIONING.md) and it may be changed in backwards incompatible ways or removed in feature releases. (#6016) + +### Changed + +- The default global API now supports full auto-instrumentation from the `go.opentelemetry.io/auto` package. + See that package for more information. (#5920) +- Propagate non-retryable error messages to client in `go.opentelemetry.io/otel/exporters/otlp/otlplog/otlploghttp`. (#5929) +- Propagate non-retryable error messages to client in `go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracehttp`. (#5929) +- Propagate non-retryable error messages to client in `go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetrichttp`. (#5929) +- Performance improvements for attribute value `AsStringSlice`, `AsFloat64Slice`, `AsInt64Slice`, `AsBoolSlice`. (#6011) +- Change `EnabledParameters` to have a `Severity` field instead of a getter and setter in `go.opentelemetry.io/otel/log`. (#6009) + +### Fixed + +- Fix inconsistent request body closing in `go.opentelemetry.io/otel/exporters/otlp/otlplog/otlploghttp`. (#5954) +- Fix inconsistent request body closing in `go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracehttp`. (#5954) +- Fix inconsistent request body closing in `go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetrichttp`. (#5954) +- Fix invalid exemplar keys in `go.opentelemetry.io/otel/exporters/prometheus`. (#5995) +- Fix attribute value truncation in `go.opentelemetry.io/otel/sdk/trace`. (#5997) +- Fix attribute value truncation in `go.opentelemetry.io/otel/sdk/log`. (#6032) + +## [1.32.0/0.54.0/0.8.0/0.0.11] 2024-11-08 + +### Added + +- Add `go.opentelemetry.io/otel/sdk/metric/exemplar.AlwaysOffFilter`, which can be used to disable exemplar recording. (#5850) +- Add `go.opentelemetry.io/otel/sdk/metric.WithExemplarFilter`, which can be used to configure the exemplar filter used by the metrics SDK. (#5850) +- Add `ExemplarReservoirProviderSelector` and `DefaultExemplarReservoirProviderSelector` to `go.opentelemetry.io/otel/sdk/metric`, which defines the exemplar reservoir to use based on the aggregation of the metric. (#5861) +- Add `ExemplarReservoirProviderSelector` to `go.opentelemetry.io/otel/sdk/metric.Stream` to allow using views to configure the exemplar reservoir to use for a metric. (#5861) +- Add `ReservoirProvider`, `HistogramReservoirProvider` and `FixedSizeReservoirProvider` to `go.opentelemetry.io/otel/sdk/metric/exemplar` to make it convenient to use providers of Reservoirs. (#5861) +- The `go.opentelemetry.io/otel/semconv/v1.27.0` package. + The package contains semantic conventions from the `v1.27.0` version of the OpenTelemetry Semantic Conventions. (#5894) +- Add `Attributes attribute.Set` field to `Scope` in `go.opentelemetry.io/otel/sdk/instrumentation`. (#5903) +- Add `Attributes attribute.Set` field to `ScopeRecords` in `go.opentelemetry.io/otel/log/logtest`. (#5927) +- `go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc` adds instrumentation scope attributes. (#5934) +- `go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracehttp` adds instrumentation scope attributes. (#5934) +- `go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetricgrpc` adds instrumentation scope attributes. (#5935) +- `go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetrichttp` adds instrumentation scope attributes. (#5935) +- `go.opentelemetry.io/otel/exporters/otlp/otlplog/otlploggrpc` adds instrumentation scope attributes. (#5933) +- `go.opentelemetry.io/otel/exporters/otlp/otlplog/otlploghttp` adds instrumentation scope attributes. (#5933) +- `go.opentelemetry.io/otel/exporters/prometheus` adds instrumentation scope attributes in `otel_scope_info` metric as labels. (#5932) + +### Changed + +- Support scope attributes and make them as identifying for `Tracer` in `go.opentelemetry.io/otel` and `go.opentelemetry.io/otel/sdk/trace`. (#5924) +- Support scope attributes and make them as identifying for `Meter` in `go.opentelemetry.io/otel` and `go.opentelemetry.io/otel/sdk/metric`. (#5926) +- Support scope attributes and make them as identifying for `Logger` in `go.opentelemetry.io/otel` and `go.opentelemetry.io/otel/sdk/log`. (#5925) +- Make schema URL and scope attributes as identifying for `Tracer` in `go.opentelemetry.io/otel/bridge/opentracing`. (#5931) +- Clear unneeded slice elements to allow GC to collect the objects in `go.opentelemetry.io/otel/sdk/metric` and `go.opentelemetry.io/otel/sdk/trace`. (#5804) + +### Fixed + +- Global MeterProvider registration unwraps global instrument Observers, the undocumented Unwrap() methods are now private. (#5881) +- `go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetricgrpc` now keeps the metadata already present in the context when `WithHeaders` is used. (#5892) +- `go.opentelemetry.io/otel/exporters/otlp/otlplog/otlploggrpc` now keeps the metadata already present in the context when `WithHeaders` is used. (#5911) +- `go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc` now keeps the metadata already present in the context when `WithHeaders` is used. (#5915) +- Fix `go.opentelemetry.io/otel/exporters/prometheus` trying to add exemplars to Gauge metrics, which is unsupported. (#5912) +- Fix `WithEndpointURL` to always use a secure connection when an https URL is passed in `go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetricgrpc`. (#5944) +- Fix `WithEndpointURL` to always use a secure connection when an https URL is passed in `go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetrichttp`. (#5944) +- Fix `WithEndpointURL` to always use a secure connection when an https URL is passed in `go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc`. (#5944) +- Fix `WithEndpointURL` to always use a secure connection when an https URL is passed in `go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracehttp`. (#5944) +- Fix incorrect metrics generated from callbacks when multiple readers are used in `go.opentelemetry.io/otel/sdk/metric`. (#5900) + +### Removed + +- Remove all examples under `go.opentelemetry.io/otel/example` as they are moved to [Contrib repository](https://github.com/open-telemetry/opentelemetry-go-contrib/tree/main/examples). (#5930) + +## [1.31.0/0.53.0/0.7.0/0.0.10] 2024-10-11 + +### Added + +- Add `go.opentelemetry.io/otel/sdk/metric/exemplar` package which includes `Exemplar`, `Filter`, `TraceBasedFilter`, `AlwaysOnFilter`, `HistogramReservoir`, `FixedSizeReservoir`, `Reservoir`, `Value` and `ValueType` types. These will be used for configuring the exemplar reservoir for the metrics sdk. (#5747, #5862) +- Add `WithExportBufferSize` option to log batch processor.(#5877) + +### Changed + +- Enable exemplars by default in `go.opentelemetry.io/otel/sdk/metric`. Exemplars can be disabled by setting `OTEL_METRICS_EXEMPLAR_FILTER=always_off` (#5778) +- `Logger.Enabled` in `go.opentelemetry.io/otel/log` now accepts a newly introduced `EnabledParameters` type instead of `Record`. (#5791) +- `FilterProcessor.Enabled` in `go.opentelemetry.io/otel/sdk/log/internal/x` now accepts `EnabledParameters` instead of `Record`. (#5791) +- The `Record` type in `go.opentelemetry.io/otel/log` is no longer comparable. (#5847) +- Performance improvements for the trace SDK `SetAttributes` method in `Span`. (#5864) +- Reduce memory allocations for the `Event` and `Link` lists in `Span`. (#5858) +- Performance improvements for the trace SDK `AddEvent`, `AddLink`, `RecordError` and `End` methods in `Span`. (#5874) + +### Deprecated + +- Deprecate all examples under `go.opentelemetry.io/otel/example` as they are moved to [Contrib repository](https://github.com/open-telemetry/opentelemetry-go-contrib/tree/main/examples). (#5854) + +### Fixed + +- The race condition for multiple `FixedSize` exemplar reservoirs identified in #5814 is resolved. (#5819) +- Fix log records duplication in case of heterogeneous resource attributes by correctly mapping each log record to it's resource and scope. (#5803) +- Fix timer channel drain to avoid hanging on Go 1.23. (#5868) +- Fix delegation for global meter providers, and panic when calling otel.SetMeterProvider. (#5827) +- Change the `reflect.TypeOf` to use a nil pointer to not allocate on the heap unless necessary. (#5827) + +## [1.30.0/0.52.0/0.6.0/0.0.9] 2024-09-09 + +### Added + +- Support `OTEL_EXPORTER_OTLP_LOGS_INSECURE` and `OTEL_EXPORTER_OTLP_INSECURE` environments in `go.opentelemetry.io/otel/exporters/otlp/otlplog/otlploggrpc`. (#5739) +- The `WithResource` option for `NewMeterProvider` now merges the provided resources with the ones from environment variables. (#5773) +- The `WithResource` option for `NewLoggerProvider` now merges the provided resources with the ones from environment variables. (#5773) +- Add UTF-8 support to `go.opentelemetry.io/otel/exporters/prometheus`. (#5755) + +### Fixed + +- Fix memory leak in the global `MeterProvider` when identical instruments are repeatedly created. (#5754) +- Fix panic on instruments creation when setting meter provider. (#5758) +- Fix an issue where `SetMeterProvider` in `go.opentelemetry.io/otel` might miss the delegation for instruments and registries. (#5780) + +### Removed + +- Drop support for [Go 1.21]. (#5736, #5740, #5800) + +## [1.29.0/0.51.0/0.5.0] 2024-08-23 + +This release is the last to support [Go 1.21]. +The next release will require at least [Go 1.22]. + +### Added + +- Add MacOS ARM64 platform to the compatibility testing suite. (#5577) +- Add `InstrumentationScope` field to `SpanStub` in `go.opentelemetry.io/otel/sdk/trace/tracetest`, as a replacement for the deprecated `InstrumentationLibrary`. (#5627) +- Make the initial release of `go.opentelemetry.io/otel/exporters/otlp/otlplog/otlploggrpc`. + This new module contains an OTLP exporter that transmits log telemetry using gRPC. + This module is unstable and breaking changes may be introduced. + See our [versioning policy](VERSIONING.md) for more information about these stability guarantees. (#5629) +- Add `Walk` function to `TraceState` in `go.opentelemetry.io/otel/trace` to iterate all the key-value pairs. (#5651) +- Bridge the trace state in `go.opentelemetry.io/otel/bridge/opencensus`. (#5651) +- Zero value of `SimpleProcessor` in `go.opentelemetry.io/otel/sdk/log` no longer panics. (#5665) +- The `FilterProcessor` interface type is added in `go.opentelemetry.io/otel/sdk/log/internal/x`. + This is an optional and experimental interface that log `Processor`s can implement to instruct the `Logger` if a `Record` will be processed or not. + It replaces the existing `Enabled` method that is removed from the `Processor` interface itself. + It does not fall within the scope of the OpenTelemetry Go versioning and stability [policy](./VERSIONING.md) and it may be changed in backwards incompatible ways or removed in feature releases. (#5692) +- Support [Go 1.23]. (#5720) + +### Changed + +- `NewMemberRaw`, `NewKeyProperty` and `NewKeyValuePropertyRaw` in `go.opentelemetry.io/otel/baggage` allow UTF-8 string in key. (#5132) +- `Processor.OnEmit` in `go.opentelemetry.io/otel/sdk/log` now accepts a pointer to `Record` instead of a value so that the record modifications done in a processor are propagated to subsequent registered processors. (#5636) +- `SimpleProcessor.Enabled` in `go.opentelemetry.io/otel/sdk/log` now returns `false` if the exporter is `nil`. (#5665) +- Update the concurrency requirements of `Exporter` in `go.opentelemetry.io/otel/sdk/log`. (#5666) +- `SimpleProcessor` in `go.opentelemetry.io/otel/sdk/log` synchronizes `OnEmit` calls. (#5666) +- The `Processor` interface in `go.opentelemetry.io/otel/sdk/log` no longer includes the `Enabled` method. + See the `FilterProcessor` interface type added in `go.opentelemetry.io/otel/sdk/log/internal/x` to continue providing this functionality. (#5692) +- The `SimpleProcessor` type in `go.opentelemetry.io/otel/sdk/log` is no longer comparable. (#5693) +- The `BatchProcessor` type in `go.opentelemetry.io/otel/sdk/log` is no longer comparable. (#5693) + +### Fixed + +- Correct comments for the priority of the `WithEndpoint` and `WithEndpointURL` options and their corresponding environment variables in `go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracehttp`. (#5584) +- Pass the underlying error rather than a generic retry-able failure in `go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetrichttp`, `go.opentelemetry.io/otel/exporters/otlp/otlplog/otlploghttp` and `go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracehttp`. (#5541) +- Correct the `Tracer`, `Meter`, and `Logger` names used in `go.opentelemetry.io/otel/example/dice`. (#5612) +- Correct the `Tracer` names used in `go.opentelemetry.io/otel/example/namedtracer`. (#5612) +- Correct the `Tracer` name used in `go.opentelemetry.io/otel/example/opencensus`. (#5612) +- Correct the `Tracer` and `Meter` names used in `go.opentelemetry.io/otel/example/otel-collector`. (#5612) +- Correct the `Tracer` names used in `go.opentelemetry.io/otel/example/passthrough`. (#5612) +- Correct the `Meter` name used in `go.opentelemetry.io/otel/example/prometheus`. (#5612) +- Correct the `Tracer` names used in `go.opentelemetry.io/otel/example/zipkin`. (#5612) +- Correct comments for the priority of the `WithEndpoint` and `WithEndpointURL` options and their corresponding environment variables in `go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetricgrpc` and `go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetrichttp`. (#5641) +- Correct comments for the priority of the `WithEndpoint` and `WithEndpointURL` options and their corresponding environment variables in `go.opentelemetry.io/otel/exporters/otlp/otlplog/otlploghttp`. (#5650) +- Stop percent encoding header environment variables in `go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc`, `go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracehttp`, `go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetricgrpc` and `go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetrichttp` (#5705) +- Remove invalid environment variable header keys in `go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc`, `go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracehttp`, `go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetricgrpc` and `go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetrichttp` (#5705) + +### Removed + +- The `Enabled` method of the `SimpleProcessor` in `go.opentelemetry.io/otel/sdk/log` is removed. (#5692) +- The `Enabled` method of the `BatchProcessor` in `go.opentelemetry.io/otel/sdk/log` is removed. (#5692) + +## [1.28.0/0.50.0/0.4.0] 2024-07-02 + +### Added + +- The `IsEmpty` method is added to the `Instrument` type in `go.opentelemetry.io/otel/sdk/metric`. + This method is used to check if an `Instrument` instance is a zero-value. (#5431) +- Store and provide the emitted `context.Context` in `ScopeRecords` of `go.opentelemetry.io/otel/sdk/log/logtest`. (#5468) +- The `go.opentelemetry.io/otel/semconv/v1.26.0` package. + The package contains semantic conventions from the `v1.26.0` version of the OpenTelemetry Semantic Conventions. (#5476) +- The `AssertRecordEqual` method to `go.opentelemetry.io/otel/log/logtest` to allow comparison of two log records in tests. (#5499) +- The `WithHeaders` option to `go.opentelemetry.io/otel/exporters/zipkin` to allow configuring custom http headers while exporting spans. (#5530) + +### Changed + +- `Tracer.Start` in `go.opentelemetry.io/otel/trace/noop` no longer allocates a span for empty span context. (#5457) +- Upgrade `go.opentelemetry.io/otel/semconv/v1.25.0` to `go.opentelemetry.io/otel/semconv/v1.26.0` in `go.opentelemetry.io/otel/example/otel-collector`. (#5490) +- Upgrade `go.opentelemetry.io/otel/semconv/v1.25.0` to `go.opentelemetry.io/otel/semconv/v1.26.0` in `go.opentelemetry.io/otel/example/zipkin`. (#5490) +- Upgrade `go.opentelemetry.io/otel/semconv/v1.25.0` to `go.opentelemetry.io/otel/semconv/v1.26.0` in `go.opentelemetry.io/otel/exporters/zipkin`. (#5490) + - The exporter no longer exports the deprecated "otel.library.name" or "otel.library.version" attributes. +- Upgrade `go.opentelemetry.io/otel/semconv/v1.25.0` to `go.opentelemetry.io/otel/semconv/v1.26.0` in `go.opentelemetry.io/otel/sdk/resource`. (#5490) +- Upgrade `go.opentelemetry.io/otel/semconv/v1.25.0` to `go.opentelemetry.io/otel/semconv/v1.26.0` in `go.opentelemetry.io/otel/sdk/trace`. (#5490) +- `SimpleProcessor.OnEmit` in `go.opentelemetry.io/otel/sdk/log` no longer allocates a slice which makes it possible to have a zero-allocation log processing using `SimpleProcessor`. (#5493) +- Use non-generic functions in the `Start` method of `"go.opentelemetry.io/otel/sdk/trace".Trace` to reduce memory allocation. (#5497) +- `service.instance.id` is populated for a `Resource` created with `"go.opentelemetry.io/otel/sdk/resource".Default` with a default value when `OTEL_GO_X_RESOURCE` is set. (#5520) +- Improve performance of metric instruments in `go.opentelemetry.io/otel/sdk/metric` by removing unnecessary calls to `time.Now`. (#5545) + +### Fixed + +- Log a warning to the OpenTelemetry internal logger when a `Record` in `go.opentelemetry.io/otel/sdk/log` drops an attribute due to a limit being reached. (#5376) +- Identify the `Tracer` returned from the global `TracerProvider` in `go.opentelemetry.io/otel/global` with its schema URL. (#5426) +- Identify the `Meter` returned from the global `MeterProvider` in `go.opentelemetry.io/otel/global` with its schema URL. (#5426) +- Log a warning to the OpenTelemetry internal logger when a `Span` in `go.opentelemetry.io/otel/sdk/trace` drops an attribute, event, or link due to a limit being reached. (#5434) +- Document instrument name requirements in `go.opentelemetry.io/otel/metric`. (#5435) +- Prevent random number generation data-race for experimental rand exemplars in `go.opentelemetry.io/otel/sdk/metric`. (#5456) +- Fix counting number of dropped attributes of `Record` in `go.opentelemetry.io/otel/sdk/log`. (#5464) +- Fix panic in baggage creation when a member contains `0x80` char in key or value. (#5494) +- Correct comments for the priority of the `WithEndpoint` and `WithEndpointURL` options and their corresponding environment variables in `go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc`. (#5508) +- Retry trace and span ID generation if it generated an invalid one in `go.opentelemetry.io/otel/sdk/trace`. (#5514) +- Fix stale timestamps reported by the last-value aggregation. (#5517) +- Indicate the `Exporter` in `go.opentelemetry.io/otel/exporters/otlp/otlplog/otlploghttp` must be created by the `New` method. (#5521) +- Improved performance in all `{Bool,Int64,Float64,String}SliceValue` functions of `go.opentelemetry.io/attributes` by reducing the number of allocations. (#5549) +- Replace invalid percent-encoded octet sequences with replacement char in `go.opentelemetry.io/otel/baggage`. (#5528) + +## [1.27.0/0.49.0/0.3.0] 2024-05-21 + +### Added + +- Add example for `go.opentelemetry.io/otel/exporters/stdout/stdoutlog`. (#5242) +- Add `RecordFactory` in `go.opentelemetry.io/otel/sdk/log/logtest` to facilitate testing exporter and processor implementations. (#5258) +- Add `RecordFactory` in `go.opentelemetry.io/otel/log/logtest` to facilitate testing bridge implementations. (#5263) +- The count of dropped records from the `BatchProcessor` in `go.opentelemetry.io/otel/sdk/log` is logged. (#5276) +- Add metrics in the `otel-collector` example. (#5283) +- Add the synchronous gauge instrument to `go.opentelemetry.io/otel/metric`. (#5304) + - An `int64` or `float64` synchronous gauge instrument can now be created from a `Meter`. + - All implementations of the API (`go.opentelemetry.io/otel/metric/noop`, `go.opentelemetry.io/otel/sdk/metric`) are updated to support this instrument. +- Add logs to `go.opentelemetry.io/otel/example/dice`. (#5349) + +### Changed + +- The `Shutdown` method of `Exporter` in `go.opentelemetry.io/otel/exporters/stdout/stdouttrace` ignores the context cancellation and always returns `nil`. (#5189) +- The `ForceFlush` and `Shutdown` methods of the exporter returned by `New` in `go.opentelemetry.io/otel/exporters/stdout/stdoutmetric` ignore the context cancellation and always return `nil`. (#5189) +- Apply the value length limits to `Record` attributes in `go.opentelemetry.io/otel/sdk/log`. (#5230) +- De-duplicate map attributes added to a `Record` in `go.opentelemetry.io/otel/sdk/log`. (#5230) +- `go.opentelemetry.io/otel/exporters/stdout/stdoutlog` won't print timestamps when `WithoutTimestamps` option is set. (#5241) +- The `go.opentelemetry.io/otel/exporters/stdout/stdoutlog` exporter won't print `AttributeValueLengthLimit` and `AttributeCountLimit` fields now, instead it prints the `DroppedAttributes` field. (#5272) +- Improved performance in the `Stringer` implementation of `go.opentelemetry.io/otel/baggage.Member` by reducing the number of allocations. (#5286) +- Set the start time for last-value aggregates in `go.opentelemetry.io/otel/sdk/metric`. (#5305) +- The `Span` in `go.opentelemetry.io/otel/sdk/trace` will record links without span context if either non-empty `TraceState` or attributes are provided. (#5315) +- Upgrade all dependencies of `go.opentelemetry.io/otel/semconv/v1.24.0` to `go.opentelemetry.io/otel/semconv/v1.25.0`. (#5374) + +### Fixed + +- Comparison of unordered maps for `go.opentelemetry.io/otel/log.KeyValue` and `go.opentelemetry.io/otel/log.Value`. (#5306) +- Fix the empty output of `go.opentelemetry.io/otel/log.Value` in `go.opentelemetry.io/otel/exporters/stdout/stdoutlog`. (#5311) +- Split the behavior of `Recorder` in `go.opentelemetry.io/otel/log/logtest` so it behaves as a `LoggerProvider` only. (#5365) +- Fix wrong package name of the error message when parsing endpoint URL in `go.opentelemetry.io/otel/exporters/otlp/otlplog/otlploghttp`. (#5371) +- Identify the `Logger` returned from the global `LoggerProvider` in `go.opentelemetry.io/otel/log/global` with its schema URL. (#5375) + +## [1.26.0/0.48.0/0.2.0-alpha] 2024-04-24 + +### Added + +- Add `Recorder` in `go.opentelemetry.io/otel/log/logtest` to facilitate testing the log bridge implementations. (#5134) +- Add span flags to OTLP spans and links exported by `go.opentelemetry.io/otel/exporters/otlp/otlptrace`. (#5194) +- Make the initial alpha release of `go.opentelemetry.io/otel/sdk/log`. + This new module contains the Go implementation of the OpenTelemetry Logs SDK. + This module is unstable and breaking changes may be introduced. + See our [versioning policy](VERSIONING.md) for more information about these stability guarantees. (#5240) +- Make the initial alpha release of `go.opentelemetry.io/otel/exporters/otlp/otlplog/otlploghttp`. + This new module contains an OTLP exporter that transmits log telemetry using HTTP. + This module is unstable and breaking changes may be introduced. + See our [versioning policy](VERSIONING.md) for more information about these stability guarantees. (#5240) +- Make the initial alpha release of `go.opentelemetry.io/otel/exporters/stdout/stdoutlog`. + This new module contains an exporter prints log records to STDOUT. + This module is unstable and breaking changes may be introduced. + See our [versioning policy](VERSIONING.md) for more information about these stability guarantees. (#5240) +- The `go.opentelemetry.io/otel/semconv/v1.25.0` package. + The package contains semantic conventions from the `v1.25.0` version of the OpenTelemetry Semantic Conventions. (#5254) + +### Changed + +- Update `go.opentelemetry.io/proto/otlp` from v1.1.0 to v1.2.0. (#5177) +- Improve performance of baggage member character validation in `go.opentelemetry.io/otel/baggage`. (#5214) +- The `otel-collector` example now uses docker compose to bring up services instead of kubernetes. (#5244) + +### Fixed + +- Slice attribute values in `go.opentelemetry.io/otel/attribute` are now emitted as their JSON representation. (#5159) + +## [1.25.0/0.47.0/0.0.8/0.1.0-alpha] 2024-04-05 + +### Added + +- Add `WithProxy` option in `go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetrichttp`. (#4906) +- Add `WithProxy` option in `go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlptracehttp`. (#4906) +- Add `AddLink` method to the `Span` interface in `go.opentelemetry.io/otel/trace`. (#5032) +- The `Enabled` method is added to the `Logger` interface in `go.opentelemetry.io/otel/log`. + This method is used to notify users if a log record will be emitted or not. (#5071) +- Add `SeverityUndefined` `const` to `go.opentelemetry.io/otel/log`. + This value represents an unset severity level. (#5072) +- Add `Empty` function in `go.opentelemetry.io/otel/log` to return a `KeyValue` for an empty value. (#5076) +- Add `go.opentelemetry.io/otel/log/global` to manage the global `LoggerProvider`. + This package is provided with the anticipation that all functionality will be migrate to `go.opentelemetry.io/otel` when `go.opentelemetry.io/otel/log` stabilizes. + At which point, users will be required to migrage their code, and this package will be deprecated then removed. (#5085) +- Add support for `Summary` metrics in the `go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetrichttp` and `go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetricgrpc` exporters. (#5100) +- Add `otel.scope.name` and `otel.scope.version` tags to spans exported by `go.opentelemetry.io/otel/exporters/zipkin`. (#5108) +- Add support for `AddLink` to `go.opentelemetry.io/otel/bridge/opencensus`. (#5116) +- Add `String` method to `Value` and `KeyValue` in `go.opentelemetry.io/otel/log`. (#5117) +- Add Exemplar support to `go.opentelemetry.io/otel/exporters/prometheus`. (#5111) +- Add metric semantic conventions to `go.opentelemetry.io/otel/semconv/v1.24.0`. Future `semconv` packages will include metric semantic conventions as well. (#4528) + +### Changed + +- `SpanFromContext` and `SpanContextFromContext` in `go.opentelemetry.io/otel/trace` no longer make a heap allocation when the passed context has no span. (#5049) +- `go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc` and `go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetricgrpc` now create a gRPC client in idle mode and with "dns" as the default resolver using [`grpc.NewClient`](https://pkg.go.dev/google.golang.org/grpc#NewClient). (#5151) + Because of that `WithDialOption` ignores [`grpc.WithBlock`](https://pkg.go.dev/google.golang.org/grpc#WithBlock), [`grpc.WithTimeout`](https://pkg.go.dev/google.golang.org/grpc#WithTimeout), and [`grpc.WithReturnConnectionError`](https://pkg.go.dev/google.golang.org/grpc#WithReturnConnectionError). + Notice that [`grpc.DialContext`](https://pkg.go.dev/google.golang.org/grpc#DialContext) which was used before is now deprecated. + +### Fixed + +- Clarify the documentation about equivalence guarantees for the `Set` and `Distinct` types in `go.opentelemetry.io/otel/attribute`. (#5027) +- Prevent default `ErrorHandler` self-delegation. (#5137) +- Update all dependencies to address [GO-2024-2687]. (#5139) + +### Removed + +- Drop support for [Go 1.20]. (#4967) + +### Deprecated + +- Deprecate `go.opentelemetry.io/otel/attribute.Sortable` type. (#4734) +- Deprecate `go.opentelemetry.io/otel/attribute.NewSetWithSortable` function. (#4734) +- Deprecate `go.opentelemetry.io/otel/attribute.NewSetWithSortableFiltered` function. (#4734) + +## [1.24.0/0.46.0/0.0.1-alpha] 2024-02-23 + +This release is the last to support [Go 1.20]. +The next release will require at least [Go 1.21]. + +### Added + +- Support [Go 1.22]. (#4890) +- Add exemplar support to `go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetricgrpc`. (#4900) +- Add exemplar support to `go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetrichttp`. (#4900) +- The `go.opentelemetry.io/otel/log` module is added. + This module includes OpenTelemetry Go's implementation of the Logs Bridge API. + This module is in an alpha state, it is subject to breaking changes. + See our [versioning policy](./VERSIONING.md) for more info. (#4961) +- Add ARM64 platform to the compatibility testing suite. (#4994) + +### Fixed + +- Fix registration of multiple callbacks when using the global meter provider from `go.opentelemetry.io/otel`. (#4945) +- Fix negative buckets in output of exponential histograms. (#4956) + +## [1.23.1] 2024-02-07 + +### Fixed + +- Register all callbacks passed during observable instrument creation instead of just the last one multiple times in `go.opentelemetry.io/otel/sdk/metric`. (#4888) + +## [1.23.0] 2024-02-06 + +This release contains the first stable, `v1`, release of the following modules: + +- `go.opentelemetry.io/otel/bridge/opencensus` +- `go.opentelemetry.io/otel/bridge/opencensus/test` +- `go.opentelemetry.io/otel/example/opencensus` +- `go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetricgrpc` +- `go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetrichttp` +- `go.opentelemetry.io/otel/exporters/stdout/stdoutmetric` + +See our [versioning policy](VERSIONING.md) for more information about these stability guarantees. + +### Added + +- Add `WithEndpointURL` option to the `exporters/otlp/otlpmetric/otlpmetricgrpc`, `exporters/otlp/otlpmetric/otlpmetrichttp`, `exporters/otlp/otlptrace/otlptracegrpc` and `exporters/otlp/otlptrace/otlptracehttp` packages. (#4808) +- Experimental exemplar exporting is added to the metric SDK. + See [metric documentation](./sdk/metric/internal/x/README.md#exemplars) for more information about this feature and how to enable it. (#4871) +- `ErrSchemaURLConflict` is added to `go.opentelemetry.io/otel/sdk/resource`. + This error is returned when a merge of two `Resource`s with different (non-empty) schema URL is attempted. (#4876) + +### Changed + +- The `Merge` and `New` functions in `go.opentelemetry.io/otel/sdk/resource` now returns a partial result if there is a schema URL merge conflict. + Instead of returning `nil` when two `Resource`s with different (non-empty) schema URLs are merged the merged `Resource`, along with the new `ErrSchemaURLConflict` error, is returned. + It is up to the user to decide if they want to use the returned `Resource` or not. + It may have desired attributes overwritten or include stale semantic conventions. (#4876) + +### Fixed + +- Fix `ContainerID` resource detection on systemd when cgroup path has a colon. (#4449) +- Fix `go.opentelemetry.io/otel/sdk/metric` to cache instruments to avoid leaking memory when the same instrument is created multiple times. (#4820) +- Fix missing `Mix` and `Max` values for `go.opentelemetry.io/otel/exporters/stdout/stdoutmetric` by introducing `MarshalText` and `MarshalJSON` for the `Extrema` type in `go.opentelemetry.io/sdk/metric/metricdata`. (#4827) + +## [1.23.0-rc.1] 2024-01-18 + +This is a release candidate for the v1.23.0 release. +That release is expected to include the `v1` release of the following modules: + +- `go.opentelemetry.io/otel/bridge/opencensus` +- `go.opentelemetry.io/otel/bridge/opencensus/test` +- `go.opentelemetry.io/otel/example/opencensus` +- `go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetricgrpc` +- `go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetrichttp` +- `go.opentelemetry.io/otel/exporters/stdout/stdoutmetric` + +See our [versioning policy](VERSIONING.md) for more information about these stability guarantees. + +## [1.22.0/0.45.0] 2024-01-17 + +### Added + +- The `go.opentelemetry.io/otel/semconv/v1.22.0` package. + The package contains semantic conventions from the `v1.22.0` version of the OpenTelemetry Semantic Conventions. (#4735) +- The `go.opentelemetry.io/otel/semconv/v1.23.0` package. + The package contains semantic conventions from the `v1.23.0` version of the OpenTelemetry Semantic Conventions. (#4746) +- The `go.opentelemetry.io/otel/semconv/v1.23.1` package. + The package contains semantic conventions from the `v1.23.1` version of the OpenTelemetry Semantic Conventions. (#4749) +- The `go.opentelemetry.io/otel/semconv/v1.24.0` package. + The package contains semantic conventions from the `v1.24.0` version of the OpenTelemetry Semantic Conventions. (#4770) +- Add `WithResourceAsConstantLabels` option to apply resource attributes for every metric emitted by the Prometheus exporter. (#4733) +- Experimental cardinality limiting is added to the metric SDK. + See [metric documentation](./sdk/metric/internal/x/README.md#cardinality-limit) for more information about this feature and how to enable it. (#4457) +- Add `NewMemberRaw` and `NewKeyValuePropertyRaw` in `go.opentelemetry.io/otel/baggage`. (#4804) + +### Changed + +- Upgrade all use of `go.opentelemetry.io/otel/semconv` to use `v1.24.0`. (#4754) +- Update transformations in `go.opentelemetry.io/otel/exporters/zipkin` to follow `v1.24.0` version of the OpenTelemetry specification. (#4754) +- Record synchronous measurements when the passed context is canceled instead of dropping in `go.opentelemetry.io/otel/sdk/metric`. + If you do not want to make a measurement when the context is cancelled, you need to handle it yourself (e.g `if ctx.Err() != nil`). (#4671) +- Improve `go.opentelemetry.io/otel/trace.TraceState`'s performance. (#4722) +- Improve `go.opentelemetry.io/otel/propagation.TraceContext`'s performance. (#4721) +- Improve `go.opentelemetry.io/otel/baggage` performance. (#4743) +- Improve performance of the `(*Set).Filter` method in `go.opentelemetry.io/otel/attribute` when the passed filter does not filter out any attributes from the set. (#4774) +- `Member.String` in `go.opentelemetry.io/otel/baggage` percent-encodes only when necessary. (#4775) +- Improve `go.opentelemetry.io/otel/trace.Span`'s performance when adding multiple attributes. (#4818) +- `Property.Value` in `go.opentelemetry.io/otel/baggage` now returns a raw string instead of a percent-encoded value. (#4804) + +### Fixed + +- Fix `Parse` in `go.opentelemetry.io/otel/baggage` to validate member value before percent-decoding. (#4755) +- Fix whitespace encoding of `Member.String` in `go.opentelemetry.io/otel/baggage`. (#4756) +- Fix observable not registered error when the asynchronous instrument has a drop aggregation in `go.opentelemetry.io/otel/sdk/metric`. (#4772) +- Fix baggage item key so that it is not canonicalized in `go.opentelemetry.io/otel/bridge/opentracing`. (#4776) +- Fix `go.opentelemetry.io/otel/bridge/opentracing` to properly handle baggage values that requires escaping during propagation. (#4804) +- Fix a bug where using multiple readers resulted in incorrect asynchronous counter values in `go.opentelemetry.io/otel/sdk/metric`. (#4742) + +## [1.21.0/0.44.0] 2023-11-16 + +### Removed + +- Remove the deprecated `go.opentelemetry.io/otel/bridge/opencensus.NewTracer`. (#4706) +- Remove the deprecated `go.opentelemetry.io/otel/exporters/otlp/otlpmetric` module. (#4707) +- Remove the deprecated `go.opentelemetry.io/otel/example/view` module. (#4708) +- Remove the deprecated `go.opentelemetry.io/otel/example/fib` module. (#4723) + +### Fixed + +- Do not parse non-protobuf responses in `go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetrichttp`. (#4719) +- Do not parse non-protobuf responses in `go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracehttp`. (#4719) + +## [1.20.0/0.43.0] 2023-11-10 + +This release brings a breaking change for custom trace API implementations. Some interfaces (`TracerProvider`, `Tracer`, `Span`) now embed the `go.opentelemetry.io/otel/trace/embedded` types. Implementers need to update their implementations based on what they want the default behavior to be. See the "API Implementations" section of the [trace API] package documentation for more information about how to accomplish this. + +### Added + +- Add `go.opentelemetry.io/otel/bridge/opencensus.InstallTraceBridge`, which installs the OpenCensus trace bridge, and replaces `opencensus.NewTracer`. (#4567) +- Add scope version to trace and metric bridges in `go.opentelemetry.io/otel/bridge/opencensus`. (#4584) +- Add the `go.opentelemetry.io/otel/trace/embedded` package to be embedded in the exported trace API interfaces. (#4620) +- Add the `go.opentelemetry.io/otel/trace/noop` package as a default no-op implementation of the trace API. (#4620) +- Add context propagation in `go.opentelemetry.io/otel/example/dice`. (#4644) +- Add view configuration to `go.opentelemetry.io/otel/example/prometheus`. (#4649) +- Add `go.opentelemetry.io/otel/metric.WithExplicitBucketBoundaries`, which allows defining default explicit bucket boundaries when creating histogram instruments. (#4603) +- Add `Version` function in `go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetricgrpc`. (#4660) +- Add `Version` function in `go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetrichttp`. (#4660) +- Add Summary, SummaryDataPoint, and QuantileValue to `go.opentelemetry.io/sdk/metric/metricdata`. (#4622) +- `go.opentelemetry.io/otel/bridge/opencensus.NewMetricProducer` now supports exemplars from OpenCensus. (#4585) +- Add support for `WithExplicitBucketBoundaries` in `go.opentelemetry.io/otel/sdk/metric`. (#4605) +- Add support for Summary metrics in `go.opentelemetry.io/otel/bridge/opencensus`. (#4668) + +### Deprecated + +- Deprecate `go.opentelemetry.io/otel/bridge/opencensus.NewTracer` in favor of `opencensus.InstallTraceBridge`. (#4567) +- Deprecate `go.opentelemetry.io/otel/example/fib` package is in favor of `go.opentelemetry.io/otel/example/dice`. (#4618) +- Deprecate `go.opentelemetry.io/otel/trace.NewNoopTracerProvider`. + Use the added `NewTracerProvider` function in `go.opentelemetry.io/otel/trace/noop` instead. (#4620) +- Deprecate `go.opentelemetry.io/otel/example/view` package in favor of `go.opentelemetry.io/otel/example/prometheus`. (#4649) +- Deprecate `go.opentelemetry.io/otel/exporters/otlp/otlpmetric`. (#4693) + +### Changed + +- `go.opentelemetry.io/otel/bridge/opencensus.NewMetricProducer` returns a `*MetricProducer` struct instead of the metric.Producer interface. (#4583) +- The `TracerProvider` in `go.opentelemetry.io/otel/trace` now embeds the `go.opentelemetry.io/otel/trace/embedded.TracerProvider` type. + This extends the `TracerProvider` interface and is is a breaking change for any existing implementation. + Implementers need to update their implementations based on what they want the default behavior of the interface to be. + See the "API Implementations" section of the `go.opentelemetry.io/otel/trace` package documentation for more information about how to accomplish this. (#4620) +- The `Tracer` in `go.opentelemetry.io/otel/trace` now embeds the `go.opentelemetry.io/otel/trace/embedded.Tracer` type. + This extends the `Tracer` interface and is is a breaking change for any existing implementation. + Implementers need to update their implementations based on what they want the default behavior of the interface to be. + See the "API Implementations" section of the `go.opentelemetry.io/otel/trace` package documentation for more information about how to accomplish this. (#4620) +- The `Span` in `go.opentelemetry.io/otel/trace` now embeds the `go.opentelemetry.io/otel/trace/embedded.Span` type. + This extends the `Span` interface and is is a breaking change for any existing implementation. + Implementers need to update their implementations based on what they want the default behavior of the interface to be. + See the "API Implementations" section of the `go.opentelemetry.io/otel/trace` package documentation for more information about how to accomplish this. (#4620) +- `go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetricgrpc` does no longer depend on `go.opentelemetry.io/otel/exporters/otlp/otlpmetric`. (#4660) +- `go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetrichttp` does no longer depend on `go.opentelemetry.io/otel/exporters/otlp/otlpmetric`. (#4660) +- Retry for `502 Bad Gateway` and `504 Gateway Timeout` HTTP statuses in `go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetrichttp`. (#4670) +- Retry for `502 Bad Gateway` and `504 Gateway Timeout` HTTP statuses in `go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracehttp`. (#4670) +- Retry for `RESOURCE_EXHAUSTED` only if RetryInfo is returned in `go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetricgrpc`. (#4669) +- Retry for `RESOURCE_EXHAUSTED` only if RetryInfo is returned in `go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc`. (#4669) +- Retry temporary HTTP request failures in `go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetrichttp`. (#4679) +- Retry temporary HTTP request failures in `go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracehttp`. (#4679) + +### Fixed + +- Fix improper parsing of characters such us `+`, `/` by `Parse` in `go.opentelemetry.io/otel/baggage` as they were rendered as a whitespace. (#4667) +- Fix improper parsing of characters such us `+`, `/` passed via `OTEL_RESOURCE_ATTRIBUTES` in `go.opentelemetry.io/otel/sdk/resource` as they were rendered as a whitespace. (#4699) +- Fix improper parsing of characters such us `+`, `/` passed via `OTEL_EXPORTER_OTLP_HEADERS` and `OTEL_EXPORTER_OTLP_METRICS_HEADERS` in `go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetricgrpc` as they were rendered as a whitespace. (#4699) +- Fix improper parsing of characters such us `+`, `/` passed via `OTEL_EXPORTER_OTLP_HEADERS` and `OTEL_EXPORTER_OTLP_METRICS_HEADERS` in `go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetrichttp` as they were rendered as a whitespace. (#4699) +- Fix improper parsing of characters such us `+`, `/` passed via `OTEL_EXPORTER_OTLP_HEADERS` and `OTEL_EXPORTER_OTLP_TRACES_HEADERS` in `go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlptracegrpc` as they were rendered as a whitespace. (#4699) +- Fix improper parsing of characters such us `+`, `/` passed via `OTEL_EXPORTER_OTLP_HEADERS` and `OTEL_EXPORTER_OTLP_TRACES_HEADERS` in `go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlptracehttp` as they were rendered as a whitespace. (#4699) +- In `go.opentelemetry.op/otel/exporters/prometheus`, the exporter no longer `Collect`s metrics after `Shutdown` is invoked. (#4648) +- Fix documentation for `WithCompressor` in `go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc`. (#4695) +- Fix documentation for `WithCompressor` in `go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetricgrpc`. (#4695) + +## [1.19.0/0.42.0/0.0.7] 2023-09-28 + +This release contains the first stable release of the OpenTelemetry Go [metric SDK]. +Our project stability guarantees now apply to the `go.opentelemetry.io/otel/sdk/metric` package. +See our [versioning policy](VERSIONING.md) for more information about these stability guarantees. + +### Added + +- Add the "Roll the dice" getting started application example in `go.opentelemetry.io/otel/example/dice`. (#4539) +- The `WithWriter` and `WithPrettyPrint` options to `go.opentelemetry.io/otel/exporters/stdout/stdoutmetric` to set a custom `io.Writer`, and allow displaying the output in human-readable JSON. (#4507) + +### Changed + +- Allow '/' characters in metric instrument names. (#4501) +- The exporter in `go.opentelemetry.io/otel/exporters/stdout/stdoutmetric` does not prettify its output by default anymore. (#4507) +- Upgrade `gopkg.io/yaml` from `v2` to `v3` in `go.opentelemetry.io/otel/schema`. (#4535) + +### Fixed + +- In `go.opentelemetry.op/otel/exporters/prometheus`, don't try to create the Prometheus metric on every `Collect` if we know the scope is invalid. (#4499) + +### Removed + +- Remove `"go.opentelemetry.io/otel/bridge/opencensus".NewMetricExporter`, which is replaced by `NewMetricProducer`. (#4566) + +## [1.19.0-rc.1/0.42.0-rc.1] 2023-09-14 + +This is a release candidate for the v1.19.0/v0.42.0 release. +That release is expected to include the `v1` release of the OpenTelemetry Go metric SDK and will provide stability guarantees of that SDK. +See our [versioning policy](VERSIONING.md) for more information about these stability guarantees. + +### Changed + +- Allow '/' characters in metric instrument names. (#4501) + +### Fixed + +- In `go.opentelemetry.op/otel/exporters/prometheus`, don't try to create the prometheus metric on every `Collect` if we know the scope is invalid. (#4499) + +## [1.18.0/0.41.0/0.0.6] 2023-09-12 + +This release drops the compatibility guarantee of [Go 1.19]. + +### Added + +- Add `WithProducer` option in `go.opentelemetry.op/otel/exporters/prometheus` to restore the ability to register producers on the prometheus exporter's manual reader. (#4473) +- Add `IgnoreValue` option in `go.opentelemetry.io/otel/sdk/metric/metricdata/metricdatatest` to allow ignoring values when comparing metrics. (#4447) + +### Changed + +- Use a `TestingT` interface instead of `*testing.T` struct in `go.opentelemetry.io/otel/sdk/metric/metricdata/metricdatatest`. (#4483) + +### Deprecated + +- The `NewMetricExporter` in `go.opentelemetry.io/otel/bridge/opencensus` was deprecated in `v0.35.0` (#3541). + The deprecation notice format for the function has been corrected to trigger Go documentation and build tooling. (#4470) + +### Removed + +- Removed the deprecated `go.opentelemetry.io/otel/exporters/jaeger` package. (#4467) +- Removed the deprecated `go.opentelemetry.io/otel/example/jaeger` package. (#4467) +- Removed the deprecated `go.opentelemetry.io/otel/sdk/metric/aggregation` package. (#4468) +- Removed the deprecated internal packages in `go.opentelemetry.io/otel/exporters/otlp` and its sub-packages. (#4469) +- Dropped guaranteed support for versions of Go less than 1.20. (#4481) + +## [1.17.0/0.40.0/0.0.5] 2023-08-28 + +### Added + +- Export the `ManualReader` struct in `go.opentelemetry.io/otel/sdk/metric`. (#4244) +- Export the `PeriodicReader` struct in `go.opentelemetry.io/otel/sdk/metric`. (#4244) +- Add support for exponential histogram aggregations. + A histogram can be configured as an exponential histogram using a view with `"go.opentelemetry.io/otel/sdk/metric".ExponentialHistogram` as the aggregation. (#4245) +- Export the `Exporter` struct in `go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetricgrpc`. (#4272) +- Export the `Exporter` struct in `go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetrichttp`. (#4272) +- The exporters in `go.opentelemetry.io/otel/exporters/otlp/otlpmetric` now support the `OTEL_EXPORTER_OTLP_METRICS_TEMPORALITY_PREFERENCE` environment variable. (#4287) +- Add `WithoutCounterSuffixes` option in `go.opentelemetry.io/otel/exporters/prometheus` to disable addition of `_total` suffixes. (#4306) +- Add info and debug logging to the metric SDK in `go.opentelemetry.io/otel/sdk/metric`. (#4315) +- The `go.opentelemetry.io/otel/semconv/v1.21.0` package. + The package contains semantic conventions from the `v1.21.0` version of the OpenTelemetry Semantic Conventions. (#4362) +- Accept 201 to 299 HTTP status as success in `go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetrichttp` and `go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracehttp`. (#4365) +- Document the `Temporality` and `Aggregation` methods of the `"go.opentelemetry.io/otel/sdk/metric".Exporter"` need to be concurrent safe. (#4381) +- Expand the set of units supported by the Prometheus exporter, and don't add unit suffixes if they are already present in `go.opentelemetry.op/otel/exporters/prometheus` (#4374) +- Move the `Aggregation` interface and its implementations from `go.opentelemetry.io/otel/sdk/metric/aggregation` to `go.opentelemetry.io/otel/sdk/metric`. (#4435) +- The exporters in `go.opentelemetry.io/otel/exporters/otlp/otlpmetric` now support the `OTEL_EXPORTER_OTLP_METRICS_DEFAULT_HISTOGRAM_AGGREGATION` environment variable. (#4437) +- Add the `NewAllowKeysFilter` and `NewDenyKeysFilter` functions to `go.opentelemetry.io/otel/attribute` to allow convenient creation of allow-keys and deny-keys filters. (#4444) +- Support Go 1.21. (#4463) + +### Changed + +- Starting from `v1.21.0` of semantic conventions, `go.opentelemetry.io/otel/semconv/{version}/httpconv` and `go.opentelemetry.io/otel/semconv/{version}/netconv` packages will no longer be published. (#4145) +- Log duplicate instrument conflict at a warning level instead of info in `go.opentelemetry.io/otel/sdk/metric`. (#4202) +- Return an error on the creation of new instruments in `go.opentelemetry.io/otel/sdk/metric` if their name doesn't pass regexp validation. (#4210) +- `NewManualReader` in `go.opentelemetry.io/otel/sdk/metric` returns `*ManualReader` instead of `Reader`. (#4244) +- `NewPeriodicReader` in `go.opentelemetry.io/otel/sdk/metric` returns `*PeriodicReader` instead of `Reader`. (#4244) +- Count the Collect time in the `PeriodicReader` timeout in `go.opentelemetry.io/otel/sdk/metric`. (#4221) +- The function `New` in `go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetricgrpc` returns `*Exporter` instead of `"go.opentelemetry.io/otel/sdk/metric".Exporter`. (#4272) +- The function `New` in `go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetrichttp` returns `*Exporter` instead of `"go.opentelemetry.io/otel/sdk/metric".Exporter`. (#4272) +- If an attribute set is omitted from an async callback, the previous value will no longer be exported in `go.opentelemetry.io/otel/sdk/metric`. (#4290) +- If an attribute set is observed multiple times in an async callback in `go.opentelemetry.io/otel/sdk/metric`, the values will be summed instead of the last observation winning. (#4289) +- Allow the explicit bucket histogram aggregation to be used for the up-down counter, observable counter, observable up-down counter, and observable gauge in the `go.opentelemetry.io/otel/sdk/metric` package. (#4332) +- Restrict `Meter`s in `go.opentelemetry.io/otel/sdk/metric` to only register and collect instruments it created. (#4333) +- `PeriodicReader.Shutdown` and `PeriodicReader.ForceFlush` in `go.opentelemetry.io/otel/sdk/metric` now apply the periodic reader's timeout to the operation if the user provided context does not contain a deadline. (#4356, #4377) +- Upgrade all use of `go.opentelemetry.io/otel/semconv` to use `v1.21.0`. (#4408) +- Increase instrument name maximum length from 63 to 255 characters in `go.opentelemetry.io/otel/sdk/metric`. (#4434) +- Add `go.opentelemetry.op/otel/sdk/metric.WithProducer` as an `Option` for `"go.opentelemetry.io/otel/sdk/metric".NewManualReader` and `"go.opentelemetry.io/otel/sdk/metric".NewPeriodicReader`. (#4346) + +### Removed + +- Remove `Reader.RegisterProducer` in `go.opentelemetry.io/otel/metric`. + Use the added `WithProducer` option instead. (#4346) +- Remove `Reader.ForceFlush` in `go.opentelemetry.io/otel/metric`. + Notice that `PeriodicReader.ForceFlush` is still available. (#4375) + +### Fixed + +- Correctly format log messages from the `go.opentelemetry.io/otel/exporters/zipkin` exporter. (#4143) +- Log an error for calls to `NewView` in `go.opentelemetry.io/otel/sdk/metric` that have empty criteria. (#4307) +- Fix `"go.opentelemetry.io/otel/sdk/resource".WithHostID()` to not set an empty `host.id`. (#4317) +- Use the instrument identifying fields to cache aggregators and determine duplicate instrument registrations in `go.opentelemetry.io/otel/sdk/metric`. (#4337) +- Detect duplicate instruments for case-insensitive names in `go.opentelemetry.io/otel/sdk/metric`. (#4338) +- The `ManualReader` will not panic if `AggregationSelector` returns `nil` in `go.opentelemetry.io/otel/sdk/metric`. (#4350) +- If a `Reader`'s `AggregationSelector` returns `nil` or `DefaultAggregation` the pipeline will use the default aggregation. (#4350) +- Log a suggested view that fixes instrument conflicts in `go.opentelemetry.io/otel/sdk/metric`. (#4349) +- Fix possible panic, deadlock and race condition in batch span processor in `go.opentelemetry.io/otel/sdk/trace`. (#4353) +- Improve context cancellation handling in batch span processor's `ForceFlush` in `go.opentelemetry.io/otel/sdk/trace`. (#4369) +- Decouple `go.opentelemetry.io/otel/exporters/otlp/otlptrace/internal` from `go.opentelemetry.io/otel/exporters/otlp/internal` using gotmpl. (#4397, #3846) +- Decouple `go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetricgrpc/internal` from `go.opentelemetry.io/otel/exporters/otlp/internal` and `go.opentelemetry.io/otel/exporters/otlp/otlpmetric/internal` using gotmpl. (#4404, #3846) +- Decouple `go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetrichttp/internal` from `go.opentelemetry.io/otel/exporters/otlp/internal` and `go.opentelemetry.io/otel/exporters/otlp/otlpmetric/internal` using gotmpl. (#4407, #3846) +- Decouple `go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc/internal` from `go.opentelemetry.io/otel/exporters/otlp/internal` and `go.opentelemetry.io/otel/exporters/otlp/otlptrace/internal` using gotmpl. (#4400, #3846) +- Decouple `go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracehttp/internal` from `go.opentelemetry.io/otel/exporters/otlp/internal` and `go.opentelemetry.io/otel/exporters/otlp/otlptrace/internal` using gotmpl. (#4401, #3846) +- Do not block the metric SDK when OTLP metric exports are blocked in `go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetricgrpc` and `go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetrichttp`. (#3925, #4395) +- Do not append `_total` if the counter already has that suffix for the Prometheus exproter in `go.opentelemetry.io/otel/exporter/prometheus`. (#4373) +- Fix resource detection data race in `go.opentelemetry.io/otel/sdk/resource`. (#4409) +- Use the first-seen instrument name during instrument name conflicts in `go.opentelemetry.io/otel/sdk/metric`. (#4428) + +### Deprecated + +- The `go.opentelemetry.io/otel/exporters/jaeger` package is deprecated. + OpenTelemetry dropped support for Jaeger exporter in July 2023. + Use `go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracehttp` + or `go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc` instead. (#4423) +- The `go.opentelemetry.io/otel/example/jaeger` package is deprecated. (#4423) +- The `go.opentelemetry.io/otel/exporters/otlp/otlpmetric/internal` package is deprecated. (#4420) +- The `go.opentelemetry.io/otel/exporters/otlp/otlpmetric/internal/oconf` package is deprecated. (#4420) +- The `go.opentelemetry.io/otel/exporters/otlp/otlpmetric/internal/otest` package is deprecated. (#4420) +- The `go.opentelemetry.io/otel/exporters/otlp/otlpmetric/internal/transform` package is deprecated. (#4420) +- The `go.opentelemetry.io/otel/exporters/otlp/internal` package is deprecated. (#4421) +- The `go.opentelemetry.io/otel/exporters/otlp/internal/envconfig` package is deprecated. (#4421) +- The `go.opentelemetry.io/otel/exporters/otlp/internal/retry` package is deprecated. (#4421) +- The `go.opentelemetry.io/otel/exporters/otlp/otlptrace/internal` package is deprecated. (#4425) +- The `go.opentelemetry.io/otel/exporters/otlp/otlptrace/internal/envconfig` package is deprecated. (#4425) +- The `go.opentelemetry.io/otel/exporters/otlp/otlptrace/internal/otlpconfig` package is deprecated. (#4425) +- The `go.opentelemetry.io/otel/exporters/otlp/otlptrace/internal/otlptracetest` package is deprecated. (#4425) +- The `go.opentelemetry.io/otel/exporters/otlp/otlptrace/internal/retry` package is deprecated. (#4425) +- The `go.opentelemetry.io/otel/sdk/metric/aggregation` package is deprecated. + Use the aggregation types added to `go.opentelemetry.io/otel/sdk/metric` instead. (#4435) + +## [1.16.0/0.39.0] 2023-05-18 + +This release contains the first stable release of the OpenTelemetry Go [metric API]. +Our project stability guarantees now apply to the `go.opentelemetry.io/otel/metric` package. +See our [versioning policy](VERSIONING.md) for more information about these stability guarantees. + +### Added + +- The `go.opentelemetry.io/otel/semconv/v1.19.0` package. + The package contains semantic conventions from the `v1.19.0` version of the OpenTelemetry specification. (#3848) +- The `go.opentelemetry.io/otel/semconv/v1.20.0` package. + The package contains semantic conventions from the `v1.20.0` version of the OpenTelemetry specification. (#4078) +- The Exponential Histogram data types in `go.opentelemetry.io/otel/sdk/metric/metricdata`. (#4165) +- OTLP metrics exporter now supports the Exponential Histogram Data Type. (#4222) +- Fix serialization of `time.Time` zero values in `go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetricgrpc` and `go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetrichttp` packages. (#4271) + +### Changed + +- Use `strings.Cut()` instead of `string.SplitN()` for better readability and memory use. (#4049) +- `MeterProvider` returns noop meters once it has been shutdown. (#4154) + +### Removed + +- The deprecated `go.opentelemetry.io/otel/metric/instrument` package is removed. + Use `go.opentelemetry.io/otel/metric` instead. (#4055) + +### Fixed + +- Fix build for BSD based systems in `go.opentelemetry.io/otel/sdk/resource`. (#4077) + +## [1.16.0-rc.1/0.39.0-rc.1] 2023-05-03 + +This is a release candidate for the v1.16.0/v0.39.0 release. +That release is expected to include the `v1` release of the OpenTelemetry Go metric API and will provide stability guarantees of that API. +See our [versioning policy](VERSIONING.md) for more information about these stability guarantees. + +### Added + +- Support global `MeterProvider` in `go.opentelemetry.io/otel`. (#4039) + - Use `Meter` for a `metric.Meter` from the global `metric.MeterProvider`. + - Use `GetMeterProivder` for a global `metric.MeterProvider`. + - Use `SetMeterProivder` to set the global `metric.MeterProvider`. + +### Changed + +- Move the `go.opentelemetry.io/otel/metric` module to the `stable-v1` module set. + This stages the metric API to be released as a stable module. (#4038) + +### Removed + +- The `go.opentelemetry.io/otel/metric/global` package is removed. + Use `go.opentelemetry.io/otel` instead. (#4039) + +## [1.15.1/0.38.1] 2023-05-02 + +### Fixed + +- Remove unused imports from `sdk/resource/host_id_bsd.go` which caused build failures. (#4040, #4041) + +## [1.15.0/0.38.0] 2023-04-27 + +### Added + +- The `go.opentelemetry.io/otel/metric/embedded` package. (#3916) +- The `Version` function to `go.opentelemetry.io/otel/sdk` to return the SDK version. (#3949) +- Add a `WithNamespace` option to `go.opentelemetry.io/otel/exporters/prometheus` to allow users to prefix metrics with a namespace. (#3970) +- The following configuration types were added to `go.opentelemetry.io/otel/metric/instrument` to be used in the configuration of measurement methods. (#3971) + - The `AddConfig` used to hold configuration for addition measurements + - `NewAddConfig` used to create a new `AddConfig` + - `AddOption` used to configure an `AddConfig` + - The `RecordConfig` used to hold configuration for recorded measurements + - `NewRecordConfig` used to create a new `RecordConfig` + - `RecordOption` used to configure a `RecordConfig` + - The `ObserveConfig` used to hold configuration for observed measurements + - `NewObserveConfig` used to create a new `ObserveConfig` + - `ObserveOption` used to configure an `ObserveConfig` +- `WithAttributeSet` and `WithAttributes` are added to `go.opentelemetry.io/otel/metric/instrument`. + They return an option used during a measurement that defines the attribute Set associated with the measurement. (#3971) +- The `Version` function to `go.opentelemetry.io/otel/exporters/otlp/otlpmetric` to return the OTLP metrics client version. (#3956) +- The `Version` function to `go.opentelemetry.io/otel/exporters/otlp/otlptrace` to return the OTLP trace client version. (#3956) + +### Changed + +- The `Extrema` in `go.opentelemetry.io/otel/sdk/metric/metricdata` is redefined with a generic argument of `[N int64 | float64]`. (#3870) +- Update all exported interfaces from `go.opentelemetry.io/otel/metric` to embed their corresponding interface from `go.opentelemetry.io/otel/metric/embedded`. + This adds an implementation requirement to set the interface default behavior for unimplemented methods. (#3916) +- Move No-Op implementation from `go.opentelemetry.io/otel/metric` into its own package `go.opentelemetry.io/otel/metric/noop`. (#3941) + - `metric.NewNoopMeterProvider` is replaced with `noop.NewMeterProvider` +- Add all the methods from `"go.opentelemetry.io/otel/trace".SpanContext` to `bridgeSpanContext` by embedding `otel.SpanContext` in `bridgeSpanContext`. (#3966) +- Wrap `UploadMetrics` error in `go.opentelemetry.io/otel/exporters/otlp/otlpmetric/` to improve error message when encountering generic grpc errors. (#3974) +- The measurement methods for all instruments in `go.opentelemetry.io/otel/metric/instrument` accept an option instead of the variadic `"go.opentelemetry.io/otel/attribute".KeyValue`. (#3971) + - The `Int64Counter.Add` method now accepts `...AddOption` + - The `Float64Counter.Add` method now accepts `...AddOption` + - The `Int64UpDownCounter.Add` method now accepts `...AddOption` + - The `Float64UpDownCounter.Add` method now accepts `...AddOption` + - The `Int64Histogram.Record` method now accepts `...RecordOption` + - The `Float64Histogram.Record` method now accepts `...RecordOption` + - The `Int64Observer.Observe` method now accepts `...ObserveOption` + - The `Float64Observer.Observe` method now accepts `...ObserveOption` +- The `Observer` methods in `go.opentelemetry.io/otel/metric` accept an option instead of the variadic `"go.opentelemetry.io/otel/attribute".KeyValue`. (#3971) + - The `Observer.ObserveInt64` method now accepts `...ObserveOption` + - The `Observer.ObserveFloat64` method now accepts `...ObserveOption` +- Move global metric back to `go.opentelemetry.io/otel/metric/global` from `go.opentelemetry.io/otel`. (#3986) + +### Fixed + +- `TracerProvider` allows calling `Tracer()` while it's shutting down. + It used to deadlock. (#3924) +- Use the SDK version for the Telemetry SDK resource detector in `go.opentelemetry.io/otel/sdk/resource`. (#3949) +- Fix a data race in `SpanProcessor` returned by `NewSimpleSpanProcessor` in `go.opentelemetry.io/otel/sdk/trace`. (#3951) +- Automatically figure out the default aggregation with `aggregation.Default`. (#3967) + +### Deprecated + +- The `go.opentelemetry.io/otel/metric/instrument` package is deprecated. + Use the equivalent types added to `go.opentelemetry.io/otel/metric` instead. (#4018) + +## [1.15.0-rc.2/0.38.0-rc.2] 2023-03-23 + +This is a release candidate for the v1.15.0/v0.38.0 release. +That release will include the `v1` release of the OpenTelemetry Go metric API and will provide stability guarantees of that API. +See our [versioning policy](VERSIONING.md) for more information about these stability guarantees. + +### Added + +- The `WithHostID` option to `go.opentelemetry.io/otel/sdk/resource`. (#3812) +- The `WithoutTimestamps` option to `go.opentelemetry.io/otel/exporters/stdout/stdoutmetric` to sets all timestamps to zero. (#3828) +- The new `Exemplar` type is added to `go.opentelemetry.io/otel/sdk/metric/metricdata`. + Both the `DataPoint` and `HistogramDataPoint` types from that package have a new field of `Exemplars` containing the sampled exemplars for their timeseries. (#3849) +- Configuration for each metric instrument in `go.opentelemetry.io/otel/sdk/metric/instrument`. (#3895) +- The internal logging introduces a warning level verbosity equal to `V(1)`. (#3900) +- Added a log message warning about usage of `SimpleSpanProcessor` in production environments. (#3854) + +### Changed + +- Optimize memory allocation when creation a new `Set` using `NewSet` or `NewSetWithFiltered` in `go.opentelemetry.io/otel/attribute`. (#3832) +- Optimize memory allocation when creation new metric instruments in `go.opentelemetry.io/otel/sdk/metric`. (#3832) +- Avoid creating new objects on all calls to `WithDeferredSetup` and `SkipContextSetup` in OpenTracing bridge. (#3833) +- The `New` and `Detect` functions from `go.opentelemetry.io/otel/sdk/resource` return errors that wrap underlying errors instead of just containing the underlying error strings. (#3844) +- Both the `Histogram` and `HistogramDataPoint` are redefined with a generic argument of `[N int64 | float64]` in `go.opentelemetry.io/otel/sdk/metric/metricdata`. (#3849) +- The metric `Export` interface from `go.opentelemetry.io/otel/sdk/metric` accepts a `*ResourceMetrics` instead of `ResourceMetrics`. (#3853) +- Rename `Asynchronous` to `Observable` in `go.opentelemetry.io/otel/metric/instrument`. (#3892) +- Rename `Int64ObserverOption` to `Int64ObservableOption` in `go.opentelemetry.io/otel/metric/instrument`. (#3895) +- Rename `Float64ObserverOption` to `Float64ObservableOption` in `go.opentelemetry.io/otel/metric/instrument`. (#3895) +- The internal logging changes the verbosity level of info to `V(4)`, the verbosity level of debug to `V(8)`. (#3900) + +### Fixed + +- `TracerProvider` consistently doesn't allow to register a `SpanProcessor` after shutdown. (#3845) + +### Removed + +- The deprecated `go.opentelemetry.io/otel/metric/global` package is removed. (#3829) +- The unneeded `Synchronous` interface in `go.opentelemetry.io/otel/metric/instrument` was removed. (#3892) +- The `Float64ObserverConfig` and `NewFloat64ObserverConfig` in `go.opentelemetry.io/otel/sdk/metric/instrument`. + Use the added `float64` instrument configuration instead. (#3895) +- The `Int64ObserverConfig` and `NewInt64ObserverConfig` in `go.opentelemetry.io/otel/sdk/metric/instrument`. + Use the added `int64` instrument configuration instead. (#3895) +- The `NewNoopMeter` function in `go.opentelemetry.io/otel/metric`, use `NewMeterProvider().Meter("")` instead. (#3893) + +## [1.15.0-rc.1/0.38.0-rc.1] 2023-03-01 + +This is a release candidate for the v1.15.0/v0.38.0 release. +That release will include the `v1` release of the OpenTelemetry Go metric API and will provide stability guarantees of that API. +See our [versioning policy](VERSIONING.md) for more information about these stability guarantees. + +This release drops the compatibility guarantee of [Go 1.18]. + +### Added + +- Support global `MeterProvider` in `go.opentelemetry.io/otel`. (#3818) + - Use `Meter` for a `metric.Meter` from the global `metric.MeterProvider`. + - Use `GetMeterProivder` for a global `metric.MeterProvider`. + - Use `SetMeterProivder` to set the global `metric.MeterProvider`. + +### Changed + +- Dropped compatibility testing for [Go 1.18]. + The project no longer guarantees support for this version of Go. (#3813) + +### Fixed + +- Handle empty environment variable as it they were not set. (#3764) +- Clarify the `httpconv` and `netconv` packages in `go.opentelemetry.io/otel/semconv/*` provide tracing semantic conventions. (#3823) +- Fix race conditions in `go.opentelemetry.io/otel/exporters/metric/prometheus` that could cause a panic. (#3899) +- Fix sending nil `scopeInfo` to metrics channel in `go.opentelemetry.io/otel/exporters/metric/prometheus` that could cause a panic in `github.com/prometheus/client_golang/prometheus`. (#3899) + +### Deprecated + +- The `go.opentelemetry.io/otel/metric/global` package is deprecated. + Use `go.opentelemetry.io/otel` instead. (#3818) + +### Removed + +- The deprecated `go.opentelemetry.io/otel/metric/unit` package is removed. (#3814) + +## [1.14.0/0.37.0/0.0.4] 2023-02-27 + +This release is the last to support [Go 1.18]. +The next release will require at least [Go 1.19]. + +### Added + +- The `event` type semantic conventions are added to `go.opentelemetry.io/otel/semconv/v1.17.0`. (#3697) +- Support [Go 1.20]. (#3693) +- The `go.opentelemetry.io/otel/semconv/v1.18.0` package. + The package contains semantic conventions from the `v1.18.0` version of the OpenTelemetry specification. (#3719) + - The following `const` renames from `go.opentelemetry.io/otel/semconv/v1.17.0` are included: + - `OtelScopeNameKey` -> `OTelScopeNameKey` + - `OtelScopeVersionKey` -> `OTelScopeVersionKey` + - `OtelLibraryNameKey` -> `OTelLibraryNameKey` + - `OtelLibraryVersionKey` -> `OTelLibraryVersionKey` + - `OtelStatusCodeKey` -> `OTelStatusCodeKey` + - `OtelStatusDescriptionKey` -> `OTelStatusDescriptionKey` + - `OtelStatusCodeOk` -> `OTelStatusCodeOk` + - `OtelStatusCodeError` -> `OTelStatusCodeError` + - The following `func` renames from `go.opentelemetry.io/otel/semconv/v1.17.0` are included: + - `OtelScopeName` -> `OTelScopeName` + - `OtelScopeVersion` -> `OTelScopeVersion` + - `OtelLibraryName` -> `OTelLibraryName` + - `OtelLibraryVersion` -> `OTelLibraryVersion` + - `OtelStatusDescription` -> `OTelStatusDescription` +- A `IsSampled` method is added to the `SpanContext` implementation in `go.opentelemetry.io/otel/bridge/opentracing` to expose the span sampled state. + See the [README](./bridge/opentracing/README.md) for more information. (#3570) +- The `WithInstrumentationAttributes` option to `go.opentelemetry.io/otel/metric`. (#3738) +- The `WithInstrumentationAttributes` option to `go.opentelemetry.io/otel/trace`. (#3739) +- The following environment variables are supported by the periodic `Reader` in `go.opentelemetry.io/otel/sdk/metric`. (#3763) + - `OTEL_METRIC_EXPORT_INTERVAL` sets the time between collections and exports. + - `OTEL_METRIC_EXPORT_TIMEOUT` sets the timeout an export is attempted. + +### Changed + +- Fall-back to `TextMapCarrier` when it's not `HttpHeader`s in `go.opentelemetry.io/otel/bridge/opentracing`. (#3679) +- The `Collect` method of the `"go.opentelemetry.io/otel/sdk/metric".Reader` interface is updated to accept the `metricdata.ResourceMetrics` value the collection will be made into. + This change is made to enable memory reuse by SDK users. (#3732) +- The `WithUnit` option in `go.opentelemetry.io/otel/sdk/metric/instrument` is updated to accept a `string` for the unit value. (#3776) + +### Fixed + +- Ensure `go.opentelemetry.io/otel` does not use generics. (#3723, #3725) +- Multi-reader `MeterProvider`s now export metrics for all readers, instead of just the first reader. (#3720, #3724) +- Remove use of deprecated `"math/rand".Seed` in `go.opentelemetry.io/otel/example/prometheus`. (#3733) +- Do not silently drop unknown schema data with `Parse` in `go.opentelemetry.io/otel/schema/v1.1`. (#3743) +- Data race issue in OTLP exporter retry mechanism. (#3755, #3756) +- Wrapping empty errors when exporting in `go.opentelemetry.io/otel/sdk/metric`. (#3698, #3772) +- Incorrect "all" and "resource" definition for schema files in `go.opentelemetry.io/otel/schema/v1.1`. (#3777) + +### Deprecated + +- The `go.opentelemetry.io/otel/metric/unit` package is deprecated. + Use the equivalent unit string instead. (#3776) + - Use `"1"` instead of `unit.Dimensionless` + - Use `"By"` instead of `unit.Bytes` + - Use `"ms"` instead of `unit.Milliseconds` + +## [1.13.0/0.36.0] 2023-02-07 + +### Added + +- Attribute `KeyValue` creations functions to `go.opentelemetry.io/otel/semconv/v1.17.0` for all non-enum semantic conventions. + These functions ensure semantic convention type correctness. (#3675) + +### Fixed + +- Removed the `http.target` attribute from being added by `ServerRequest` in the following packages. (#3687) + - `go.opentelemetry.io/otel/semconv/v1.13.0/httpconv` + - `go.opentelemetry.io/otel/semconv/v1.14.0/httpconv` + - `go.opentelemetry.io/otel/semconv/v1.15.0/httpconv` + - `go.opentelemetry.io/otel/semconv/v1.16.0/httpconv` + - `go.opentelemetry.io/otel/semconv/v1.17.0/httpconv` + +### Removed + +- The deprecated `go.opentelemetry.io/otel/metric/instrument/asyncfloat64` package is removed. (#3631) +- The deprecated `go.opentelemetry.io/otel/metric/instrument/asyncint64` package is removed. (#3631) +- The deprecated `go.opentelemetry.io/otel/metric/instrument/syncfloat64` package is removed. (#3631) +- The deprecated `go.opentelemetry.io/otel/metric/instrument/syncint64` package is removed. (#3631) + +## [1.12.0/0.35.0] 2023-01-28 + +### Added + +- The `WithInt64Callback` option to `go.opentelemetry.io/otel/metric/instrument`. + This options is used to configure `int64` Observer callbacks during their creation. (#3507) +- The `WithFloat64Callback` option to `go.opentelemetry.io/otel/metric/instrument`. + This options is used to configure `float64` Observer callbacks during their creation. (#3507) +- The `Producer` interface and `Reader.RegisterProducer(Producer)` to `go.opentelemetry.io/otel/sdk/metric`. + These additions are used to enable external metric Producers. (#3524) +- The `Callback` function type to `go.opentelemetry.io/otel/metric`. + This new named function type is registered with a `Meter`. (#3564) +- The `go.opentelemetry.io/otel/semconv/v1.13.0` package. + The package contains semantic conventions from the `v1.13.0` version of the OpenTelemetry specification. (#3499) + - The `EndUserAttributesFromHTTPRequest` function in `go.opentelemetry.io/otel/semconv/v1.12.0` is merged into `ClientRequest` and `ServerRequest` in `go.opentelemetry.io/otel/semconv/v1.13.0/httpconv`. + - The `HTTPAttributesFromHTTPStatusCode` function in `go.opentelemetry.io/otel/semconv/v1.12.0` is merged into `ClientResponse` in `go.opentelemetry.io/otel/semconv/v1.13.0/httpconv`. + - The `HTTPClientAttributesFromHTTPRequest` function in `go.opentelemetry.io/otel/semconv/v1.12.0` is replaced by `ClientRequest` in `go.opentelemetry.io/otel/semconv/v1.13.0/httpconv`. + - The `HTTPServerAttributesFromHTTPRequest` function in `go.opentelemetry.io/otel/semconv/v1.12.0` is replaced by `ServerRequest` in `go.opentelemetry.io/otel/semconv/v1.13.0/httpconv`. + - The `HTTPServerMetricAttributesFromHTTPRequest` function in `go.opentelemetry.io/otel/semconv/v1.12.0` is replaced by `ServerRequest` in `go.opentelemetry.io/otel/semconv/v1.13.0/httpconv`. + - The `NetAttributesFromHTTPRequest` function in `go.opentelemetry.io/otel/semconv/v1.12.0` is split into `Transport` in `go.opentelemetry.io/otel/semconv/v1.13.0/netconv` and `ClientRequest` or `ServerRequest` in `go.opentelemetry.io/otel/semconv/v1.13.0/httpconv`. + - The `SpanStatusFromHTTPStatusCode` function in `go.opentelemetry.io/otel/semconv/v1.12.0` is replaced by `ClientStatus` in `go.opentelemetry.io/otel/semconv/v1.13.0/httpconv`. + - The `SpanStatusFromHTTPStatusCodeAndSpanKind` function in `go.opentelemetry.io/otel/semconv/v1.12.0` is split into `ClientStatus` and `ServerStatus` in `go.opentelemetry.io/otel/semconv/v1.13.0/httpconv`. + - The `Client` function is included in `go.opentelemetry.io/otel/semconv/v1.13.0/netconv` to generate attributes for a `net.Conn`. + - The `Server` function is included in `go.opentelemetry.io/otel/semconv/v1.13.0/netconv` to generate attributes for a `net.Listener`. +- The `go.opentelemetry.io/otel/semconv/v1.14.0` package. + The package contains semantic conventions from the `v1.14.0` version of the OpenTelemetry specification. (#3566) +- The `go.opentelemetry.io/otel/semconv/v1.15.0` package. + The package contains semantic conventions from the `v1.15.0` version of the OpenTelemetry specification. (#3578) +- The `go.opentelemetry.io/otel/semconv/v1.16.0` package. + The package contains semantic conventions from the `v1.16.0` version of the OpenTelemetry specification. (#3579) +- Metric instruments to `go.opentelemetry.io/otel/metric/instrument`. + These instruments are use as replacements of the deprecated `go.opentelemetry.io/otel/metric/instrument/{asyncfloat64,asyncint64,syncfloat64,syncint64}` packages.(#3575, #3586) + - `Float64ObservableCounter` replaces the `asyncfloat64.Counter` + - `Float64ObservableUpDownCounter` replaces the `asyncfloat64.UpDownCounter` + - `Float64ObservableGauge` replaces the `asyncfloat64.Gauge` + - `Int64ObservableCounter` replaces the `asyncint64.Counter` + - `Int64ObservableUpDownCounter` replaces the `asyncint64.UpDownCounter` + - `Int64ObservableGauge` replaces the `asyncint64.Gauge` + - `Float64Counter` replaces the `syncfloat64.Counter` + - `Float64UpDownCounter` replaces the `syncfloat64.UpDownCounter` + - `Float64Histogram` replaces the `syncfloat64.Histogram` + - `Int64Counter` replaces the `syncint64.Counter` + - `Int64UpDownCounter` replaces the `syncint64.UpDownCounter` + - `Int64Histogram` replaces the `syncint64.Histogram` +- `NewTracerProvider` to `go.opentelemetry.io/otel/bridge/opentracing`. + This is used to create `WrapperTracer` instances from a `TracerProvider`. (#3116) +- The `Extrema` type to `go.opentelemetry.io/otel/sdk/metric/metricdata`. + This type is used to represent min/max values and still be able to distinguish unset and zero values. (#3487) +- The `go.opentelemetry.io/otel/semconv/v1.17.0` package. + The package contains semantic conventions from the `v1.17.0` version of the OpenTelemetry specification. (#3599) + +### Changed + +- Jaeger and Zipkin exporter use `github.com/go-logr/logr` as the logging interface, and add the `WithLogr` option. (#3497, #3500) +- Instrument configuration in `go.opentelemetry.io/otel/metric/instrument` is split into specific options and configuration based on the instrument type. (#3507) + - Use the added `Int64Option` type to configure instruments from `go.opentelemetry.io/otel/metric/instrument/syncint64`. + - Use the added `Float64Option` type to configure instruments from `go.opentelemetry.io/otel/metric/instrument/syncfloat64`. + - Use the added `Int64ObserverOption` type to configure instruments from `go.opentelemetry.io/otel/metric/instrument/asyncint64`. + - Use the added `Float64ObserverOption` type to configure instruments from `go.opentelemetry.io/otel/metric/instrument/asyncfloat64`. +- Return a `Registration` from the `RegisterCallback` method of a `Meter` in the `go.opentelemetry.io/otel/metric` package. + This `Registration` can be used to unregister callbacks. (#3522) +- Global error handler uses an atomic value instead of a mutex. (#3543) +- Add `NewMetricProducer` to `go.opentelemetry.io/otel/bridge/opencensus`, which can be used to pass OpenCensus metrics to an OpenTelemetry Reader. (#3541) +- Global logger uses an atomic value instead of a mutex. (#3545) +- The `Shutdown` method of the `"go.opentelemetry.io/otel/sdk/trace".TracerProvider` releases all computational resources when called the first time. (#3551) +- The `Sampler` returned from `TraceIDRatioBased` `go.opentelemetry.io/otel/sdk/trace` now uses the rightmost bits for sampling decisions. + This fixes random sampling when using ID generators like `xray.IDGenerator` and increasing parity with other language implementations. (#3557) +- Errors from `go.opentelemetry.io/otel/exporters/otlp/otlptrace` exporters are wrapped in errors identifying their signal name. + Existing users of the exporters attempting to identify specific errors will need to use `errors.Unwrap()` to get the underlying error. (#3516) +- Exporters from `go.opentelemetry.io/otel/exporters/otlp` will print the final retryable error message when attempts to retry time out. (#3514) +- The instrument kind names in `go.opentelemetry.io/otel/sdk/metric` are updated to match the API. (#3562) + - `InstrumentKindSyncCounter` is renamed to `InstrumentKindCounter` + - `InstrumentKindSyncUpDownCounter` is renamed to `InstrumentKindUpDownCounter` + - `InstrumentKindSyncHistogram` is renamed to `InstrumentKindHistogram` + - `InstrumentKindAsyncCounter` is renamed to `InstrumentKindObservableCounter` + - `InstrumentKindAsyncUpDownCounter` is renamed to `InstrumentKindObservableUpDownCounter` + - `InstrumentKindAsyncGauge` is renamed to `InstrumentKindObservableGauge` +- The `RegisterCallback` method of the `Meter` in `go.opentelemetry.io/otel/metric` changed. + - The named `Callback` replaces the inline function parameter. (#3564) + - `Callback` is required to return an error. (#3576) + - `Callback` accepts the added `Observer` parameter added. + This new parameter is used by `Callback` implementations to observe values for asynchronous instruments instead of calling the `Observe` method of the instrument directly. (#3584) + - The slice of `instrument.Asynchronous` is now passed as a variadic argument. (#3587) +- The exporter from `go.opentelemetry.io/otel/exporters/zipkin` is updated to use the `v1.16.0` version of semantic conventions. + This means it no longer uses the removed `net.peer.ip` or `http.host` attributes to determine the remote endpoint. + Instead it uses the `net.sock.peer` attributes. (#3581) +- The `Min` and `Max` fields of the `HistogramDataPoint` in `go.opentelemetry.io/otel/sdk/metric/metricdata` are now defined with the added `Extrema` type instead of a `*float64`. (#3487) + +### Fixed + +- Asynchronous instruments that use sum aggregators and attribute filters correctly add values from equivalent attribute sets that have been filtered. (#3439, #3549) +- The `RegisterCallback` method of the `Meter` from `go.opentelemetry.io/otel/sdk/metric` only registers a callback for instruments created by that meter. + Trying to register a callback with instruments from a different meter will result in an error being returned. (#3584) + +### Deprecated + +- The `NewMetricExporter` in `go.opentelemetry.io/otel/bridge/opencensus` is deprecated. + Use `NewMetricProducer` instead. (#3541) +- The `go.opentelemetry.io/otel/metric/instrument/asyncfloat64` package is deprecated. + Use the instruments from `go.opentelemetry.io/otel/metric/instrument` instead. (#3575) +- The `go.opentelemetry.io/otel/metric/instrument/asyncint64` package is deprecated. + Use the instruments from `go.opentelemetry.io/otel/metric/instrument` instead. (#3575) +- The `go.opentelemetry.io/otel/metric/instrument/syncfloat64` package is deprecated. + Use the instruments from `go.opentelemetry.io/otel/metric/instrument` instead. (#3575) +- The `go.opentelemetry.io/otel/metric/instrument/syncint64` package is deprecated. + Use the instruments from `go.opentelemetry.io/otel/metric/instrument` instead. (#3575) +- The `NewWrappedTracerProvider` in `go.opentelemetry.io/otel/bridge/opentracing` is now deprecated. + Use `NewTracerProvider` instead. (#3116) + +### Removed + +- The deprecated `go.opentelemetry.io/otel/sdk/metric/view` package is removed. (#3520) +- The `InstrumentProvider` from `go.opentelemetry.io/otel/sdk/metric/asyncint64` is removed. + Use the new creation methods of the `Meter` in `go.opentelemetry.io/otel/sdk/metric` instead. (#3530) + - The `Counter` method is replaced by `Meter.Int64ObservableCounter` + - The `UpDownCounter` method is replaced by `Meter.Int64ObservableUpDownCounter` + - The `Gauge` method is replaced by `Meter.Int64ObservableGauge` +- The `InstrumentProvider` from `go.opentelemetry.io/otel/sdk/metric/asyncfloat64` is removed. + Use the new creation methods of the `Meter` in `go.opentelemetry.io/otel/sdk/metric` instead. (#3530) + - The `Counter` method is replaced by `Meter.Float64ObservableCounter` + - The `UpDownCounter` method is replaced by `Meter.Float64ObservableUpDownCounter` + - The `Gauge` method is replaced by `Meter.Float64ObservableGauge` +- The `InstrumentProvider` from `go.opentelemetry.io/otel/sdk/metric/syncint64` is removed. + Use the new creation methods of the `Meter` in `go.opentelemetry.io/otel/sdk/metric` instead. (#3530) + - The `Counter` method is replaced by `Meter.Int64Counter` + - The `UpDownCounter` method is replaced by `Meter.Int64UpDownCounter` + - The `Histogram` method is replaced by `Meter.Int64Histogram` +- The `InstrumentProvider` from `go.opentelemetry.io/otel/sdk/metric/syncfloat64` is removed. + Use the new creation methods of the `Meter` in `go.opentelemetry.io/otel/sdk/metric` instead. (#3530) + - The `Counter` method is replaced by `Meter.Float64Counter` + - The `UpDownCounter` method is replaced by `Meter.Float64UpDownCounter` + - The `Histogram` method is replaced by `Meter.Float64Histogram` + +## [1.11.2/0.34.0] 2022-12-05 + +### Added + +- The `WithView` `Option` is added to the `go.opentelemetry.io/otel/sdk/metric` package. + This option is used to configure the view(s) a `MeterProvider` will use for all `Reader`s that are registered with it. (#3387) +- Add Instrumentation Scope and Version as info metric and label in Prometheus exporter. + This can be disabled using the `WithoutScopeInfo()` option added to that package.(#3273, #3357) +- OTLP exporters now recognize: (#3363) + - `OTEL_EXPORTER_OTLP_INSECURE` + - `OTEL_EXPORTER_OTLP_TRACES_INSECURE` + - `OTEL_EXPORTER_OTLP_METRICS_INSECURE` + - `OTEL_EXPORTER_OTLP_CLIENT_KEY` + - `OTEL_EXPORTER_OTLP_TRACES_CLIENT_KEY` + - `OTEL_EXPORTER_OTLP_METRICS_CLIENT_KEY` + - `OTEL_EXPORTER_OTLP_CLIENT_CERTIFICATE` + - `OTEL_EXPORTER_OTLP_TRACES_CLIENT_CERTIFICATE` + - `OTEL_EXPORTER_OTLP_METRICS_CLIENT_CERTIFICATE` +- The `View` type and related `NewView` function to create a view according to the OpenTelemetry specification are added to `go.opentelemetry.io/otel/sdk/metric`. + These additions are replacements for the `View` type and `New` function from `go.opentelemetry.io/otel/sdk/metric/view`. (#3459) +- The `Instrument` and `InstrumentKind` type are added to `go.opentelemetry.io/otel/sdk/metric`. + These additions are replacements for the `Instrument` and `InstrumentKind` types from `go.opentelemetry.io/otel/sdk/metric/view`. (#3459) +- The `Stream` type is added to `go.opentelemetry.io/otel/sdk/metric` to define a metric data stream a view will produce. (#3459) +- The `AssertHasAttributes` allows instrument authors to test that datapoints returned have appropriate attributes. (#3487) + +### Changed + +- The `"go.opentelemetry.io/otel/sdk/metric".WithReader` option no longer accepts views to associate with the `Reader`. + Instead, views are now registered directly with the `MeterProvider` via the new `WithView` option. + The views registered with the `MeterProvider` apply to all `Reader`s. (#3387) +- The `Temporality(view.InstrumentKind) metricdata.Temporality` and `Aggregation(view.InstrumentKind) aggregation.Aggregation` methods are added to the `"go.opentelemetry.io/otel/sdk/metric".Exporter` interface. (#3260) +- The `Temporality(view.InstrumentKind) metricdata.Temporality` and `Aggregation(view.InstrumentKind) aggregation.Aggregation` methods are added to the `"go.opentelemetry.io/otel/exporters/otlp/otlpmetric".Client` interface. (#3260) +- The `WithTemporalitySelector` and `WithAggregationSelector` `ReaderOption`s have been changed to `ManualReaderOption`s in the `go.opentelemetry.io/otel/sdk/metric` package. (#3260) +- The periodic reader in the `go.opentelemetry.io/otel/sdk/metric` package now uses the temporality and aggregation selectors from its configured exporter instead of accepting them as options. (#3260) + +### Fixed + +- The `go.opentelemetry.io/otel/exporters/prometheus` exporter fixes duplicated `_total` suffixes. (#3369) +- Remove comparable requirement for `Reader`s. (#3387) +- Cumulative metrics from the OpenCensus bridge (`go.opentelemetry.io/otel/bridge/opencensus`) are defined as monotonic sums, instead of non-monotonic. (#3389) +- Asynchronous counters (`Counter` and `UpDownCounter`) from the metric SDK now produce delta sums when configured with delta temporality. (#3398) +- Exported `Status` codes in the `go.opentelemetry.io/otel/exporters/zipkin` exporter are now exported as all upper case values. (#3340) +- `Aggregation`s from `go.opentelemetry.io/otel/sdk/metric` with no data are not exported. (#3394, #3436) +- Re-enabled Attribute Filters in the Metric SDK. (#3396) +- Asynchronous callbacks are only called if they are registered with at least one instrument that does not use drop aggregation. (#3408) +- Do not report empty partial-success responses in the `go.opentelemetry.io/otel/exporters/otlp` exporters. (#3438, #3432) +- Handle partial success responses in `go.opentelemetry.io/otel/exporters/otlp/otlpmetric` exporters. (#3162, #3440) +- Prevent duplicate Prometheus description, unit, and type. (#3469) +- Prevents panic when using incorrect `attribute.Value.As[Type]Slice()`. (#3489) + +### Removed + +- The `go.opentelemetry.io/otel/exporters/otlp/otlpmetric.Client` interface is removed. (#3486) +- The `go.opentelemetry.io/otel/exporters/otlp/otlpmetric.New` function is removed. Use the `otlpmetric[http|grpc].New` directly. (#3486) + +### Deprecated + +- The `go.opentelemetry.io/otel/sdk/metric/view` package is deprecated. + Use `Instrument`, `InstrumentKind`, `View`, and `NewView` in `go.opentelemetry.io/otel/sdk/metric` instead. (#3476) + +## [1.11.1/0.33.0] 2022-10-19 + +### Added + +- The Prometheus exporter in `go.opentelemetry.io/otel/exporters/prometheus` registers with a Prometheus registerer on creation. + By default, it will register with the default Prometheus registerer. + A non-default registerer can be used by passing the `WithRegisterer` option. (#3239) +- Added the `WithAggregationSelector` option to the `go.opentelemetry.io/otel/exporters/prometheus` package to change the default `AggregationSelector` used. (#3341) +- The Prometheus exporter in `go.opentelemetry.io/otel/exporters/prometheus` converts the `Resource` associated with metric exports into a `target_info` metric. (#3285) + +### Changed + +- The `"go.opentelemetry.io/otel/exporters/prometheus".New` function is updated to return an error. + It will return an error if the exporter fails to register with Prometheus. (#3239) + +### Fixed + +- The URL-encoded values from the `OTEL_RESOURCE_ATTRIBUTES` environment variable are decoded. (#2963) +- The `baggage.NewMember` function decodes the `value` parameter instead of directly using it. + This fixes the implementation to be compliant with the W3C specification. (#3226) +- Slice attributes of the `attribute` package are now comparable based on their value, not instance. (#3108 #3252) +- The `Shutdown` and `ForceFlush` methods of the `"go.opentelemetry.io/otel/sdk/trace".TraceProvider` no longer return an error when no processor is registered. (#3268) +- The Prometheus exporter in `go.opentelemetry.io/otel/exporters/prometheus` cumulatively sums histogram buckets. (#3281) +- The sum of each histogram data point is now uniquely exported by the `go.opentelemetry.io/otel/exporters/otlpmetric` exporters. (#3284, #3293) +- Recorded values for asynchronous counters (`Counter` and `UpDownCounter`) are interpreted as exact, not incremental, sum values by the metric SDK. (#3350, #3278) +- `UpDownCounters` are now correctly output as Prometheus gauges in the `go.opentelemetry.io/otel/exporters/prometheus` exporter. (#3358) +- The Prometheus exporter in `go.opentelemetry.io/otel/exporters/prometheus` no longer describes the metrics it will send to Prometheus on startup. + Instead the exporter is defined as an "unchecked" collector for Prometheus. + This fixes the `reader is not registered` warning currently emitted on startup. (#3291 #3342) +- The `go.opentelemetry.io/otel/exporters/prometheus` exporter now correctly adds `_total` suffixes to counter metrics. (#3360) +- The `go.opentelemetry.io/otel/exporters/prometheus` exporter now adds a unit suffix to metric names. + This can be disabled using the `WithoutUnits()` option added to that package. (#3352) + +## [1.11.0/0.32.3] 2022-10-12 + +### Added + +- Add default User-Agent header to OTLP exporter requests (`go.opentelemetry.io/otel/exporters/otlptrace/otlptracegrpc` and `go.opentelemetry.io/otel/exporters/otlptrace/otlptracehttp`). (#3261) + +### Changed + +- `span.SetStatus` has been updated such that calls that lower the status are now no-ops. (#3214) +- Upgrade `golang.org/x/sys/unix` from `v0.0.0-20210423185535-09eb48e85fd7` to `v0.0.0-20220919091848-fb04ddd9f9c8`. + This addresses [GO-2022-0493](https://pkg.go.dev/vuln/GO-2022-0493). (#3235) + +## [0.32.2] Metric SDK (Alpha) - 2022-10-11 + +### Added + +- Added an example of using metric views to customize instruments. (#3177) +- Add default User-Agent header to OTLP exporter requests (`go.opentelemetry.io/otel/exporters/otlpmetric/otlpmetricgrpc` and `go.opentelemetry.io/otel/exporters/otlpmetric/otlpmetrichttp`). (#3261) + +### Changed + +- Flush pending measurements with the `PeriodicReader` in the `go.opentelemetry.io/otel/sdk/metric` when `ForceFlush` or `Shutdown` are called. (#3220) +- Update histogram default bounds to match the requirements of the latest specification. (#3222) +- Encode the HTTP status code in the OpenTracing bridge (`go.opentelemetry.io/otel/bridge/opentracing`) as an integer. (#3265) + +### Fixed + +- Use default view if instrument does not match any registered view of a reader. (#3224, #3237) +- Return the same instrument every time a user makes the exact same instrument creation call. (#3229, #3251) +- Return the existing instrument when a view transforms a creation call to match an existing instrument. (#3240, #3251) +- Log a warning when a conflicting instrument (e.g. description, unit, data-type) is created instead of returning an error. (#3251) +- The OpenCensus bridge no longer sends empty batches of metrics. (#3263) + +## [0.32.1] Metric SDK (Alpha) - 2022-09-22 + +### Changed + +- The Prometheus exporter sanitizes OpenTelemetry instrument names when exporting. + Invalid characters are replaced with `_`. (#3212) + +### Added + +- The metric portion of the OpenCensus bridge (`go.opentelemetry.io/otel/bridge/opencensus`) has been reintroduced. (#3192) +- The OpenCensus bridge example (`go.opentelemetry.io/otel/example/opencensus`) has been reintroduced. (#3206) + +### Fixed + +- Updated go.mods to point to valid versions of the sdk. (#3216) +- Set the `MeterProvider` resource on all exported metric data. (#3218) + +## [0.32.0] Revised Metric SDK (Alpha) - 2022-09-18 + +### Changed + +- The metric SDK in `go.opentelemetry.io/otel/sdk/metric` is completely refactored to comply with the OpenTelemetry specification. + Please see the package documentation for how the new SDK is initialized and configured. (#3175) +- Update the minimum supported go version to go1.18. Removes support for go1.17 (#3179) + +### Removed + +- The metric portion of the OpenCensus bridge (`go.opentelemetry.io/otel/bridge/opencensus`) has been removed. + A new bridge compliant with the revised metric SDK will be added back in a future release. (#3175) +- The `go.opentelemetry.io/otel/sdk/metric/aggregator/aggregatortest` package is removed, see the new metric SDK. (#3175) +- The `go.opentelemetry.io/otel/sdk/metric/aggregator/histogram` package is removed, see the new metric SDK. (#3175) +- The `go.opentelemetry.io/otel/sdk/metric/aggregator/lastvalue` package is removed, see the new metric SDK. (#3175) +- The `go.opentelemetry.io/otel/sdk/metric/aggregator/sum` package is removed, see the new metric SDK. (#3175) +- The `go.opentelemetry.io/otel/sdk/metric/aggregator` package is removed, see the new metric SDK. (#3175) +- The `go.opentelemetry.io/otel/sdk/metric/controller/basic` package is removed, see the new metric SDK. (#3175) +- The `go.opentelemetry.io/otel/sdk/metric/controller/controllertest` package is removed, see the new metric SDK. (#3175) +- The `go.opentelemetry.io/otel/sdk/metric/controller/time` package is removed, see the new metric SDK. (#3175) +- The `go.opentelemetry.io/otel/sdk/metric/export/aggregation` package is removed, see the new metric SDK. (#3175) +- The `go.opentelemetry.io/otel/sdk/metric/export` package is removed, see the new metric SDK. (#3175) +- The `go.opentelemetry.io/otel/sdk/metric/metrictest` package is removed. + A replacement package that supports the new metric SDK will be added back in a future release. (#3175) +- The `go.opentelemetry.io/otel/sdk/metric/number` package is removed, see the new metric SDK. (#3175) +- The `go.opentelemetry.io/otel/sdk/metric/processor/basic` package is removed, see the new metric SDK. (#3175) +- The `go.opentelemetry.io/otel/sdk/metric/processor/processortest` package is removed, see the new metric SDK. (#3175) +- The `go.opentelemetry.io/otel/sdk/metric/processor/reducer` package is removed, see the new metric SDK. (#3175) +- The `go.opentelemetry.io/otel/sdk/metric/registry` package is removed, see the new metric SDK. (#3175) +- The `go.opentelemetry.io/otel/sdk/metric/sdkapi` package is removed, see the new metric SDK. (#3175) +- The `go.opentelemetry.io/otel/sdk/metric/selector/simple` package is removed, see the new metric SDK. (#3175) +- The `"go.opentelemetry.io/otel/sdk/metric".ErrUninitializedInstrument` variable was removed. (#3175) +- The `"go.opentelemetry.io/otel/sdk/metric".ErrBadInstrument` variable was removed. (#3175) +- The `"go.opentelemetry.io/otel/sdk/metric".Accumulator` type was removed, see the `MeterProvider`in the new metric SDK. (#3175) +- The `"go.opentelemetry.io/otel/sdk/metric".NewAccumulator` function was removed, see `NewMeterProvider`in the new metric SDK. (#3175) +- The deprecated `"go.opentelemetry.io/otel/sdk/metric".AtomicFieldOffsets` function was removed. (#3175) + +## [1.10.0] - 2022-09-09 + +### Added + +- Support Go 1.19. (#3077) + Include compatibility testing and document support. (#3077) +- Support the OTLP ExportTracePartialSuccess response; these are passed to the registered error handler. (#3106) +- Upgrade go.opentelemetry.io/proto/otlp from v0.18.0 to v0.19.0 (#3107) + +### Changed + +- Fix misidentification of OpenTelemetry `SpanKind` in OpenTracing bridge (`go.opentelemetry.io/otel/bridge/opentracing`). (#3096) +- Attempting to start a span with a nil `context` will no longer cause a panic. (#3110) +- All exporters will be shutdown even if one reports an error (#3091) +- Ensure valid UTF-8 when truncating over-length attribute values. (#3156) + +## [1.9.0/0.0.3] - 2022-08-01 + +### Added + +- Add support for Schema Files format 1.1.x (metric "split" transform) with the new `go.opentelemetry.io/otel/schema/v1.1` package. (#2999) +- Add the `go.opentelemetry.io/otel/semconv/v1.11.0` package. + The package contains semantic conventions from the `v1.11.0` version of the OpenTelemetry specification. (#3009) +- Add the `go.opentelemetry.io/otel/semconv/v1.12.0` package. + The package contains semantic conventions from the `v1.12.0` version of the OpenTelemetry specification. (#3010) +- Add the `http.method` attribute to HTTP server metric from all `go.opentelemetry.io/otel/semconv/*` packages. (#3018) + +### Fixed + +- Invalid warning for context setup being deferred in `go.opentelemetry.io/otel/bridge/opentracing` package. (#3029) + +## [1.8.0/0.31.0] - 2022-07-08 + +### Added + +- Add support for `opentracing.TextMap` format in the `Inject` and `Extract` methods +of the `"go.opentelemetry.io/otel/bridge/opentracing".BridgeTracer` type. (#2911) + +### Changed + +- The `crosslink` make target has been updated to use the `go.opentelemetry.io/build-tools/crosslink` package. (#2886) +- In the `go.opentelemetry.io/otel/sdk/instrumentation` package rename `Library` to `Scope` and alias `Library` as `Scope` (#2976) +- Move metric no-op implementation form `nonrecording` to `metric` package. (#2866) + +### Removed + +- Support for go1.16. Support is now only for go1.17 and go1.18 (#2917) + +### Deprecated + +- The `Library` struct in the `go.opentelemetry.io/otel/sdk/instrumentation` package is deprecated. + Use the equivalent `Scope` struct instead. (#2977) +- The `ReadOnlySpan.InstrumentationLibrary` method from the `go.opentelemetry.io/otel/sdk/trace` package is deprecated. + Use the equivalent `ReadOnlySpan.InstrumentationScope` method instead. (#2977) + +## [1.7.0/0.30.0] - 2022-04-28 + +### Added + +- Add the `go.opentelemetry.io/otel/semconv/v1.8.0` package. + The package contains semantic conventions from the `v1.8.0` version of the OpenTelemetry specification. (#2763) +- Add the `go.opentelemetry.io/otel/semconv/v1.9.0` package. + The package contains semantic conventions from the `v1.9.0` version of the OpenTelemetry specification. (#2792) +- Add the `go.opentelemetry.io/otel/semconv/v1.10.0` package. + The package contains semantic conventions from the `v1.10.0` version of the OpenTelemetry specification. (#2842) +- Added an in-memory exporter to metrictest to aid testing with a full SDK. (#2776) + +### Fixed + +- Globally delegated instruments are unwrapped before delegating asynchronous callbacks. (#2784) +- Remove import of `testing` package in non-tests builds of the `go.opentelemetry.io/otel` package. (#2786) + +### Changed + +- The `WithLabelEncoder` option from the `go.opentelemetry.io/otel/exporters/stdout/stdoutmetric` package is renamed to `WithAttributeEncoder`. (#2790) +- The `LabelFilterSelector` interface from `go.opentelemetry.io/otel/sdk/metric/processor/reducer` is renamed to `AttributeFilterSelector`. + The method included in the renamed interface also changed from `LabelFilterFor` to `AttributeFilterFor`. (#2790) +- The `Metadata.Labels` method from the `go.opentelemetry.io/otel/sdk/metric/export` package is renamed to `Metadata.Attributes`. + Consequentially, the `Record` type from the same package also has had the embedded method renamed. (#2790) + +### Deprecated + +- The `Iterator.Label` method in the `go.opentelemetry.io/otel/attribute` package is deprecated. + Use the equivalent `Iterator.Attribute` method instead. (#2790) +- The `Iterator.IndexedLabel` method in the `go.opentelemetry.io/otel/attribute` package is deprecated. + Use the equivalent `Iterator.IndexedAttribute` method instead. (#2790) +- The `MergeIterator.Label` method in the `go.opentelemetry.io/otel/attribute` package is deprecated. + Use the equivalent `MergeIterator.Attribute` method instead. (#2790) + +### Removed + +- Removed the `Batch` type from the `go.opentelemetry.io/otel/sdk/metric/metrictest` package. (#2864) +- Removed the `Measurement` type from the `go.opentelemetry.io/otel/sdk/metric/metrictest` package. (#2864) + +## [0.29.0] - 2022-04-11 + +### Added + +- The metrics global package was added back into several test files. (#2764) +- The `Meter` function is added back to the `go.opentelemetry.io/otel/metric/global` package. + This function is a convenience function equivalent to calling `global.MeterProvider().Meter(...)`. (#2750) + +### Removed + +- Removed module the `go.opentelemetry.io/otel/sdk/export/metric`. + Use the `go.opentelemetry.io/otel/sdk/metric` module instead. (#2720) + +### Changed + +- Don't panic anymore when setting a global MeterProvider to itself. (#2749) +- Upgrade `go.opentelemetry.io/proto/otlp` in `go.opentelemetry.io/otel/exporters/otlp/otlpmetric` from `v0.12.1` to `v0.15.0`. + This replaces the use of the now deprecated `InstrumentationLibrary` and `InstrumentationLibraryMetrics` types and fields in the proto library with the equivalent `InstrumentationScope` and `ScopeMetrics`. (#2748) + +## [1.6.3] - 2022-04-07 + +### Fixed + +- Allow non-comparable global `MeterProvider`, `TracerProvider`, and `TextMapPropagator` types to be set. (#2772, #2773) + +## [1.6.2] - 2022-04-06 + +### Changed + +- Don't panic anymore when setting a global TracerProvider or TextMapPropagator to itself. (#2749) +- Upgrade `go.opentelemetry.io/proto/otlp` in `go.opentelemetry.io/otel/exporters/otlp/otlptrace` from `v0.12.1` to `v0.15.0`. + This replaces the use of the now deprecated `InstrumentationLibrary` and `InstrumentationLibrarySpans` types and fields in the proto library with the equivalent `InstrumentationScope` and `ScopeSpans`. (#2748) + +## [1.6.1] - 2022-03-28 + +### Fixed + +- The `go.opentelemetry.io/otel/schema/*` packages now use the correct schema URL for their `SchemaURL` constant. + Instead of using `"https://opentelemetry.io/schemas/v"` they now use the correct URL without a `v` prefix, `"https://opentelemetry.io/schemas/"`. (#2743, #2744) + +### Security + +- Upgrade `go.opentelemetry.io/proto/otlp` from `v0.12.0` to `v0.12.1`. + This includes an indirect upgrade of `github.com/grpc-ecosystem/grpc-gateway` which resolves [a vulnerability](https://nvd.nist.gov/vuln/detail/CVE-2019-11254) from `gopkg.in/yaml.v2` in version `v2.2.3`. (#2724, #2728) + +## [1.6.0/0.28.0] - 2022-03-23 + +### ⚠️ Notice ⚠️ + +This update is a breaking change of the unstable Metrics API. +Code instrumented with the `go.opentelemetry.io/otel/metric` will need to be modified. + +### Added + +- Add metrics exponential histogram support. + New mapping functions have been made available in `sdk/metric/aggregator/exponential/mapping` for other OpenTelemetry projects to take dependencies on. (#2502) +- Add Go 1.18 to our compatibility tests. (#2679) +- Allow configuring the Sampler with the `OTEL_TRACES_SAMPLER` and `OTEL_TRACES_SAMPLER_ARG` environment variables. (#2305, #2517) +- Add the `metric/global` for obtaining and setting the global `MeterProvider`. (#2660) + +### Changed + +- The metrics API has been significantly changed to match the revised OpenTelemetry specification. + High-level changes include: + + - Synchronous and asynchronous instruments are now handled by independent `InstrumentProvider`s. + These `InstrumentProvider`s are managed with a `Meter`. + - Synchronous and asynchronous instruments are grouped into their own packages based on value types. + - Asynchronous callbacks can now be registered with a `Meter`. + + Be sure to check out the metric module documentation for more information on how to use the revised API. (#2587, #2660) + +### Fixed + +- Fallback to general attribute limits when span specific ones are not set in the environment. (#2675, #2677) + +## [1.5.0] - 2022-03-16 + +### Added + +- Log the Exporters configuration in the TracerProviders message. (#2578) +- Added support to configure the span limits with environment variables. + The following environment variables are supported. (#2606, #2637) + - `OTEL_SPAN_ATTRIBUTE_VALUE_LENGTH_LIMIT` + - `OTEL_SPAN_ATTRIBUTE_COUNT_LIMIT` + - `OTEL_SPAN_EVENT_COUNT_LIMIT` + - `OTEL_EVENT_ATTRIBUTE_COUNT_LIMIT` + - `OTEL_SPAN_LINK_COUNT_LIMIT` + - `OTEL_LINK_ATTRIBUTE_COUNT_LIMIT` + + If the provided environment variables are invalid (negative), the default values would be used. +- Rename the `gc` runtime name to `go` (#2560) +- Add resource container ID detection. (#2418) +- Add span attribute value length limit. + The new `AttributeValueLengthLimit` field is added to the `"go.opentelemetry.io/otel/sdk/trace".SpanLimits` type to configure this limit for a `TracerProvider`. + The default limit for this resource is "unlimited". (#2637) +- Add the `WithRawSpanLimits` option to `go.opentelemetry.io/otel/sdk/trace`. + This option replaces the `WithSpanLimits` option. + Zero or negative values will not be changed to the default value like `WithSpanLimits` does. + Setting a limit to zero will effectively disable the related resource it limits and setting to a negative value will mean that resource is unlimited. + Consequentially, limits should be constructed using `NewSpanLimits` and updated accordingly. (#2637) + +### Changed + +- Drop oldest tracestate `Member` when capacity is reached. (#2592) +- Add event and link drop counts to the exported data from the `oltptrace` exporter. (#2601) +- Unify path cleaning functionally in the `otlpmetric` and `otlptrace` configuration. (#2639) +- Change the debug message from the `sdk/trace.BatchSpanProcessor` to reflect the count is cumulative. (#2640) +- Introduce new internal `envconfig` package for OTLP exporters. (#2608) +- If `http.Request.Host` is empty, fall back to use `URL.Host` when populating `http.host` in the `semconv` packages. (#2661) + +### Fixed + +- Remove the OTLP trace exporter limit of SpanEvents when exporting. (#2616) +- Default to port `4318` instead of `4317` for the `otlpmetrichttp` and `otlptracehttp` client. (#2614, #2625) +- Unlimited span limits are now supported (negative values). (#2636, #2637) + +### Deprecated + +- Deprecated `"go.opentelemetry.io/otel/sdk/trace".WithSpanLimits`. + Use `WithRawSpanLimits` instead. + That option allows setting unlimited and zero limits, this option does not. + This option will be kept until the next major version incremented release. (#2637) + +## [1.4.1] - 2022-02-16 + +### Fixed + +- Fix race condition in reading the dropped spans number for the `BatchSpanProcessor`. (#2615) + +## [1.4.0] - 2022-02-11 + +### Added + +- Use `OTEL_EXPORTER_ZIPKIN_ENDPOINT` environment variable to specify zipkin collector endpoint. (#2490) +- Log the configuration of `TracerProvider`s, and `Tracer`s for debugging. + To enable use a logger with Verbosity (V level) `>=1`. (#2500) +- Added support to configure the batch span-processor with environment variables. + The following environment variables are used. (#2515) + - `OTEL_BSP_SCHEDULE_DELAY` + - `OTEL_BSP_EXPORT_TIMEOUT` + - `OTEL_BSP_MAX_QUEUE_SIZE`. + - `OTEL_BSP_MAX_EXPORT_BATCH_SIZE` + +### Changed + +- Zipkin exporter exports `Resource` attributes in the `Tags` field. (#2589) + +### Deprecated + +- Deprecate module the `go.opentelemetry.io/otel/sdk/export/metric`. + Use the `go.opentelemetry.io/otel/sdk/metric` module instead. (#2382) +- Deprecate `"go.opentelemetry.io/otel/sdk/metric".AtomicFieldOffsets`. (#2445) + +### Fixed + +- Fixed the instrument kind for noop async instruments to correctly report an implementation. (#2461) +- Fix UDP packets overflowing with Jaeger payloads. (#2489, #2512) +- Change the `otlpmetric.Client` interface's `UploadMetrics` method to accept a single `ResourceMetrics` instead of a slice of them. (#2491) +- Specify explicit buckets in Prometheus example, fixing issue where example only has `+inf` bucket. (#2419, #2493) +- W3C baggage will now decode urlescaped values. (#2529) +- Baggage members are now only validated once, when calling `NewMember` and not also when adding it to the baggage itself. (#2522) +- The order attributes are dropped from spans in the `go.opentelemetry.io/otel/sdk/trace` package when capacity is reached is fixed to be in compliance with the OpenTelemetry specification. + Instead of dropping the least-recently-used attribute, the last added attribute is dropped. + This drop order still only applies to attributes with unique keys not already contained in the span. + If an attribute is added with a key already contained in the span, that attribute is updated to the new value being added. (#2576) + +### Removed + +- Updated `go.opentelemetry.io/proto/otlp` from `v0.11.0` to `v0.12.0`. This version removes a number of deprecated methods. (#2546) + - [`Metric.GetIntGauge()`](https://pkg.go.dev/go.opentelemetry.io/proto/otlp@v0.11.0/metrics/v1#Metric.GetIntGauge) + - [`Metric.GetIntHistogram()`](https://pkg.go.dev/go.opentelemetry.io/proto/otlp@v0.11.0/metrics/v1#Metric.GetIntHistogram) + - [`Metric.GetIntSum()`](https://pkg.go.dev/go.opentelemetry.io/proto/otlp@v0.11.0/metrics/v1#Metric.GetIntSum) + +## [1.3.0] - 2021-12-10 + +### ⚠️ Notice ⚠️ + +We have updated the project minimum supported Go version to 1.16 + +### Added + +- Added an internal Logger. + This can be used by the SDK and API to provide users with feedback of the internal state. + To enable verbose logs configure the logger which will print V(1) logs. For debugging information configure to print V(5) logs. (#2343) +- Add the `WithRetry` `Option` and the `RetryConfig` type to the `go.opentelemetry.io/otel/exporter/otel/otlpmetric/otlpmetrichttp` package to specify retry behavior consistently. (#2425) +- Add `SpanStatusFromHTTPStatusCodeAndSpanKind` to all `semconv` packages to return a span status code similar to `SpanStatusFromHTTPStatusCode`, but exclude `4XX` HTTP errors as span errors if the span is of server kind. (#2296) + +### Changed + +- The `"go.opentelemetry.io/otel/exporter/otel/otlptrace/otlptracegrpc".Client` now uses the underlying gRPC `ClientConn` to handle name resolution, TCP connection establishment (with retries and backoff) and TLS handshakes, and handling errors on established connections by re-resolving the name and reconnecting. (#2329) +- The `"go.opentelemetry.io/otel/exporter/otel/otlpmetric/otlpmetricgrpc".Client` now uses the underlying gRPC `ClientConn` to handle name resolution, TCP connection establishment (with retries and backoff) and TLS handshakes, and handling errors on established connections by re-resolving the name and reconnecting. (#2425) +- The `"go.opentelemetry.io/otel/exporter/otel/otlpmetric/otlpmetricgrpc".RetrySettings` type is renamed to `RetryConfig`. (#2425) +- The `go.opentelemetry.io/otel/exporter/otel/*` gRPC exporters now default to using the host's root CA set if none are provided by the user and `WithInsecure` is not specified. (#2432) +- Change `resource.Default` to be evaluated the first time it is called, rather than on import. This allows the caller the option to update `OTEL_RESOURCE_ATTRIBUTES` first, such as with `os.Setenv`. (#2371) + +### Fixed + +- The `go.opentelemetry.io/otel/exporter/otel/*` exporters are updated to handle per-signal and universal endpoints according to the OpenTelemetry specification. + Any per-signal endpoint set via an `OTEL_EXPORTER_OTLP__ENDPOINT` environment variable is now used without modification of the path. + When `OTEL_EXPORTER_OTLP_ENDPOINT` is set, if it contains a path, that path is used as a base path which per-signal paths are appended to. (#2433) +- Basic metric controller updated to use sync.Map to avoid blocking calls (#2381) +- The `go.opentelemetry.io/otel/exporter/jaeger` correctly sets the `otel.status_code` value to be a string of `ERROR` or `OK` instead of an integer code. (#2439, #2440) + +### Deprecated + +- Deprecated the `"go.opentelemetry.io/otel/exporter/otel/otlpmetric/otlpmetrichttp".WithMaxAttempts` `Option`, use the new `WithRetry` `Option` instead. (#2425) +- Deprecated the `"go.opentelemetry.io/otel/exporter/otel/otlpmetric/otlpmetrichttp".WithBackoff` `Option`, use the new `WithRetry` `Option` instead. (#2425) + +### Removed + +- Remove the metric Processor's ability to convert cumulative to delta aggregation temporality. (#2350) +- Remove the metric Bound Instruments interface and implementations. (#2399) +- Remove the metric MinMaxSumCount kind aggregation and the corresponding OTLP export path. (#2423) +- Metric SDK removes the "exact" aggregator for histogram instruments, as it performed a non-standard aggregation for OTLP export (creating repeated Gauge points) and worked its way into a number of confusing examples. (#2348) + +## [1.2.0] - 2021-11-12 + +### Changed + +- Metric SDK `export.ExportKind`, `export.ExportKindSelector` types have been renamed to `aggregation.Temporality` and `aggregation.TemporalitySelector` respectively to keep in line with current specification and protocol along with built-in selectors (e.g., `aggregation.CumulativeTemporalitySelector`, ...). (#2274) +- The Metric `Exporter` interface now requires a `TemporalitySelector` method instead of an `ExportKindSelector`. (#2274) +- Metrics API cleanup. The `metric/sdkapi` package has been created to relocate the API-to-SDK interface: + - The following interface types simply moved from `metric` to `metric/sdkapi`: `Descriptor`, `MeterImpl`, `InstrumentImpl`, `SyncImpl`, `BoundSyncImpl`, `AsyncImpl`, `AsyncRunner`, `AsyncSingleRunner`, and `AsyncBatchRunner` + - The following struct types moved and are replaced with type aliases, since they are exposed to the user: `Observation`, `Measurement`. + - The No-op implementations of sync and async instruments are no longer exported, new functions `sdkapi.NewNoopAsyncInstrument()` and `sdkapi.NewNoopSyncInstrument()` are provided instead. (#2271) +- Update the SDK `BatchSpanProcessor` to export all queued spans when `ForceFlush` is called. (#2080, #2335) + +### Added + +- Add the `"go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetricgrpc".WithGRPCConn` option so the exporter can reuse an existing gRPC connection. (#2002) +- Added a new `schema` module to help parse Schema Files in OTEP 0152 format. (#2267) +- Added a new `MapCarrier` to the `go.opentelemetry.io/otel/propagation` package to hold propagated cross-cutting concerns as a `map[string]string` held in memory. (#2334) + +## [1.1.0] - 2021-10-27 + +### Added + +- Add the `"go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc".WithGRPCConn` option so the exporter can reuse an existing gRPC connection. (#2002) +- Add the `go.opentelemetry.io/otel/semconv/v1.7.0` package. + The package contains semantic conventions from the `v1.7.0` version of the OpenTelemetry specification. (#2320) +- Add the `go.opentelemetry.io/otel/semconv/v1.6.1` package. + The package contains semantic conventions from the `v1.6.1` version of the OpenTelemetry specification. (#2321) +- Add the `go.opentelemetry.io/otel/semconv/v1.5.0` package. + The package contains semantic conventions from the `v1.5.0` version of the OpenTelemetry specification. (#2322) + - When upgrading from the `semconv/v1.4.0` package note the following name changes: + - `K8SReplicasetUIDKey` -> `K8SReplicaSetUIDKey` + - `K8SReplicasetNameKey` -> `K8SReplicaSetNameKey` + - `K8SStatefulsetUIDKey` -> `K8SStatefulSetUIDKey` + - `k8SStatefulsetNameKey` -> `K8SStatefulSetNameKey` + - `K8SDaemonsetUIDKey` -> `K8SDaemonSetUIDKey` + - `K8SDaemonsetNameKey` -> `K8SDaemonSetNameKey` + +### Changed + +- Links added to a span will be dropped by the SDK if they contain an invalid span context (#2275). + +### Fixed + +- The `"go.opentelemetry.io/otel/semconv/v1.4.0".HTTPServerAttributesFromHTTPRequest` now correctly only sets the HTTP client IP attribute even if the connection was routed with proxies and there are multiple addresses in the `X-Forwarded-For` header. (#2282, #2284) +- The `"go.opentelemetry.io/otel/semconv/v1.4.0".NetAttributesFromHTTPRequest` function correctly handles IPv6 addresses as IP addresses and sets the correct net peer IP instead of the net peer hostname attribute. (#2283, #2285) +- The simple span processor shutdown method deterministically returns the exporter error status if it simultaneously finishes when the deadline is reached. (#2290, #2289) + +## [1.0.1] - 2021-10-01 + +### Fixed + +- json stdout exporter no longer crashes due to concurrency bug. (#2265) + +## [Metrics 0.24.0] - 2021-10-01 + +### Changed + +- NoopMeterProvider is now private and NewNoopMeterProvider must be used to obtain a noopMeterProvider. (#2237) +- The Metric SDK `Export()` function takes a new two-level reader interface for iterating over results one instrumentation library at a time. (#2197) + - The former `"go.opentelemetry.io/otel/sdk/export/metric".CheckpointSet` is renamed `Reader`. + - The new interface is named `"go.opentelemetry.io/otel/sdk/export/metric".InstrumentationLibraryReader`. + +## [1.0.0] - 2021-09-20 + +This is the first stable release for the project. +This release includes an API and SDK for the tracing signal that will comply with the stability guarantees defined by the projects [versioning policy](./VERSIONING.md). + +### Added + +- OTLP trace exporter now sets the `SchemaURL` field in the exported telemetry if the Tracer has `WithSchemaURL` option. (#2242) + +### Fixed + +- Slice-valued attributes can correctly be used as map keys. (#2223) + +### Removed + +- Removed the `"go.opentelemetry.io/otel/exporters/zipkin".WithSDKOptions` function. (#2248) +- Removed the deprecated package `go.opentelemetry.io/otel/oteltest`. (#2234) +- Removed the deprecated package `go.opentelemetry.io/otel/bridge/opencensus/utils`. (#2233) +- Removed deprecated functions, types, and methods from `go.opentelemetry.io/otel/attribute` package. + Use the typed functions and methods added to the package instead. (#2235) + - The `Key.Array` method is removed. + - The `Array` function is removed. + - The `Any` function is removed. + - The `ArrayValue` function is removed. + - The `AsArray` function is removed. + +## [1.0.0-RC3] - 2021-09-02 + +### Added + +- Added `ErrorHandlerFunc` to use a function as an `"go.opentelemetry.io/otel".ErrorHandler`. (#2149) +- Added `"go.opentelemetry.io/otel/trace".WithStackTrace` option to add a stack trace when using `span.RecordError` or when panic is handled in `span.End`. (#2163) +- Added typed slice attribute types and functionality to the `go.opentelemetry.io/otel/attribute` package to replace the existing array type and functions. (#2162) + - `BoolSlice`, `IntSlice`, `Int64Slice`, `Float64Slice`, and `StringSlice` replace the use of the `Array` function in the package. +- Added the `go.opentelemetry.io/otel/example/fib` example package. + Included is an example application that computes Fibonacci numbers. (#2203) + +### Changed + +- Metric instruments have been renamed to match the (feature-frozen) metric API specification: + - ValueRecorder becomes Histogram + - ValueObserver becomes Gauge + - SumObserver becomes CounterObserver + - UpDownSumObserver becomes UpDownCounterObserver + The API exported from this project is still considered experimental. (#2202) +- Metric SDK/API implementation type `InstrumentKind` moves into `sdkapi` sub-package. (#2091) +- The Metrics SDK export record no longer contains a Resource pointer, the SDK `"go.opentelemetry.io/otel/sdk/trace/export/metric".Exporter.Export()` function for push-based exporters now takes a single Resource argument, pull-based exporters use `"go.opentelemetry.io/otel/sdk/metric/controller/basic".Controller.Resource()`. (#2120) +- The JSON output of the `go.opentelemetry.io/otel/exporters/stdout/stdouttrace` is harmonized now such that the output is "plain" JSON objects after each other of the form `{ ... } { ... } { ... }`. Earlier the JSON objects describing a span were wrapped in a slice for each `Exporter.ExportSpans` call, like `[ { ... } ][ { ... } { ... } ]`. Outputting JSON object directly after each other is consistent with JSON loggers, and a bit easier to parse and read. (#2196) +- Update the `NewTracerConfig`, `NewSpanStartConfig`, `NewSpanEndConfig`, and `NewEventConfig` function in the `go.opentelemetry.io/otel/trace` package to return their respective configurations as structs instead of pointers to the struct. (#2212) + +### Deprecated + +- The `go.opentelemetry.io/otel/bridge/opencensus/utils` package is deprecated. + All functionality from this package now exists in the `go.opentelemetry.io/otel/bridge/opencensus` package. + The functions from that package should be used instead. (#2166) +- The `"go.opentelemetry.io/otel/attribute".Array` function and the related `ARRAY` value type is deprecated. + Use the typed `*Slice` functions and types added to the package instead. (#2162) +- The `"go.opentelemetry.io/otel/attribute".Any` function is deprecated. + Use the typed functions instead. (#2181) +- The `go.opentelemetry.io/otel/oteltest` package is deprecated. + The `"go.opentelemetry.io/otel/sdk/trace/tracetest".SpanRecorder` can be registered with the default SDK (`go.opentelemetry.io/otel/sdk/trace`) as a `SpanProcessor` and used as a replacement for this deprecated package. (#2188) + +### Removed + +- Removed metrics test package `go.opentelemetry.io/otel/sdk/export/metric/metrictest`. (#2105) + +### Fixed + +- The `fromEnv` detector no longer throws an error when `OTEL_RESOURCE_ATTRIBUTES` environment variable is not set or empty. (#2138) +- Setting the global `ErrorHandler` with `"go.opentelemetry.io/otel".SetErrorHandler` multiple times is now supported. (#2160, #2140) +- The `"go.opentelemetry.io/otel/attribute".Any` function now supports `int32` values. (#2169) +- Multiple calls to `"go.opentelemetry.io/otel/sdk/metric/controller/basic".WithResource()` are handled correctly, and when no resources are provided `"go.opentelemetry.io/otel/sdk/resource".Default()` is used. (#2120) +- The `WithoutTimestamps` option for the `go.opentelemetry.io/otel/exporters/stdout/stdouttrace` exporter causes the exporter to correctly omit timestamps. (#2195) +- Fixed typos in resources.go. (#2201) + +## [1.0.0-RC2] - 2021-07-26 + +### Added + +- Added `WithOSDescription` resource configuration option to set OS (Operating System) description resource attribute (`os.description`). (#1840) +- Added `WithOS` resource configuration option to set all OS (Operating System) resource attributes at once. (#1840) +- Added the `WithRetry` option to the `go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracehttp` package. + This option is a replacement for the removed `WithMaxAttempts` and `WithBackoff` options. (#2095) +- Added API `LinkFromContext` to return Link which encapsulates SpanContext from provided context and also encapsulates attributes. (#2115) +- Added a new `Link` type under the SDK `otel/sdk/trace` package that counts the number of attributes that were dropped for surpassing the `AttributePerLinkCountLimit` configured in the Span's `SpanLimits`. + This new type replaces the equal-named API `Link` type found in the `otel/trace` package for most usages within the SDK. + For example, instances of this type are now returned by the `Links()` function of `ReadOnlySpan`s provided in places like the `OnEnd` function of `SpanProcessor` implementations. (#2118) +- Added the `SpanRecorder` type to the `go.opentelemetry.io/otel/skd/trace/tracetest` package. + This type can be used with the default SDK as a `SpanProcessor` during testing. (#2132) + +### Changed + +- The `SpanModels` function is now exported from the `go.opentelemetry.io/otel/exporters/zipkin` package to convert OpenTelemetry spans into Zipkin model spans. (#2027) +- Rename the `"go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc".RetrySettings` to `RetryConfig`. (#2095) + +### Deprecated + +- The `TextMapCarrier` and `TextMapPropagator` from the `go.opentelemetry.io/otel/oteltest` package and their associated creation functions (`TextMapCarrier`, `NewTextMapPropagator`) are deprecated. (#2114) +- The `Harness` type from the `go.opentelemetry.io/otel/oteltest` package and its associated creation function, `NewHarness` are deprecated and will be removed in the next release. (#2123) +- The `TraceStateFromKeyValues` function from the `go.opentelemetry.io/otel/oteltest` package is deprecated. + Use the `trace.ParseTraceState` function instead. (#2122) + +### Removed + +- Removed the deprecated package `go.opentelemetry.io/otel/exporters/trace/jaeger`. (#2020) +- Removed the deprecated package `go.opentelemetry.io/otel/exporters/trace/zipkin`. (#2020) +- Removed the `"go.opentelemetry.io/otel/sdk/resource".WithBuiltinDetectors` function. + The explicit `With*` options for every built-in detector should be used instead. (#2026 #2097) +- Removed the `WithMaxAttempts` and `WithBackoff` options from the `go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracehttp` package. + The retry logic of the package has been updated to match the `otlptracegrpc` package and accordingly a `WithRetry` option is added that should be used instead. (#2095) +- Removed `DroppedAttributeCount` field from `otel/trace.Link` struct. (#2118) + +### Fixed + +- When using WithNewRoot, don't use the parent context for making sampling decisions. (#2032) +- `oteltest.Tracer` now creates a valid `SpanContext` when using `WithNewRoot`. (#2073) +- OS type detector now sets the correct `dragonflybsd` value for DragonFly BSD. (#2092) +- The OTel span status is correctly transformed into the OTLP status in the `go.opentelemetry.io/otel/exporters/otlp/otlptrace` package. + This fix will by default set the status to `Unset` if it is not explicitly set to `Ok` or `Error`. (#2099 #2102) +- The `Inject` method for the `"go.opentelemetry.io/otel/propagation".TraceContext` type no longer injects empty `tracestate` values. (#2108) +- Use `6831` as default Jaeger agent port instead of `6832`. (#2131) + +## [Experimental Metrics v0.22.0] - 2021-07-19 + +### Added + +- Adds HTTP support for OTLP metrics exporter. (#2022) + +### Removed + +- Removed the deprecated package `go.opentelemetry.io/otel/exporters/metric/prometheus`. (#2020) + +## [1.0.0-RC1] / 0.21.0 - 2021-06-18 + +With this release we are introducing a split in module versions. The tracing API and SDK are entering the `v1.0.0` Release Candidate phase with `v1.0.0-RC1` +while the experimental metrics API and SDK continue with `v0.x` releases at `v0.21.0`. Modules at major version 1 or greater will not depend on modules +with major version 0. + +### Added + +- Adds `otlpgrpc.WithRetry`option for configuring the retry policy for transient errors on the otlp/gRPC exporter. (#1832) + - The following status codes are defined as transient errors: + | gRPC Status Code | Description | + | ---------------- | ----------- | + | 1 | Cancelled | + | 4 | Deadline Exceeded | + | 8 | Resource Exhausted | + | 10 | Aborted | + | 10 | Out of Range | + | 14 | Unavailable | + | 15 | Data Loss | +- Added `Status` type to the `go.opentelemetry.io/otel/sdk/trace` package to represent the status of a span. (#1874) +- Added `SpanStub` type and its associated functions to the `go.opentelemetry.io/otel/sdk/trace/tracetest` package. + This type can be used as a testing replacement for the `SpanSnapshot` that was removed from the `go.opentelemetry.io/otel/sdk/trace` package. (#1873) +- Adds support for scheme in `OTEL_EXPORTER_OTLP_ENDPOINT` according to the spec. (#1886) +- Adds `trace.WithSchemaURL` option for configuring the tracer with a Schema URL. (#1889) +- Added an example of using OpenTelemetry Go as a trace context forwarder. (#1912) +- `ParseTraceState` is added to the `go.opentelemetry.io/otel/trace` package. + It can be used to decode a `TraceState` from a `tracestate` header string value. (#1937) +- Added `Len` method to the `TraceState` type in the `go.opentelemetry.io/otel/trace` package. + This method returns the number of list-members the `TraceState` holds. (#1937) +- Creates package `go.opentelemetry.io/otel/exporters/otlp/otlptrace` that defines a trace exporter that uses a `otlptrace.Client` to send data. + Creates package `go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc` implementing a gRPC `otlptrace.Client` and offers convenience functions, `NewExportPipeline` and `InstallNewPipeline`, to setup and install a `otlptrace.Exporter` in tracing .(#1922) +- Added `Baggage`, `Member`, and `Property` types to the `go.opentelemetry.io/otel/baggage` package along with their related functions. (#1967) +- Added `ContextWithBaggage`, `ContextWithoutBaggage`, and `FromContext` functions to the `go.opentelemetry.io/otel/baggage` package. + These functions replace the `Set`, `Value`, `ContextWithValue`, `ContextWithoutValue`, and `ContextWithEmpty` functions from that package and directly work with the new `Baggage` type. (#1967) +- The `OTEL_SERVICE_NAME` environment variable is the preferred source for `service.name`, used by the environment resource detector if a service name is present both there and in `OTEL_RESOURCE_ATTRIBUTES`. (#1969) +- Creates package `go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracehttp` implementing an HTTP `otlptrace.Client` and offers convenience functions, `NewExportPipeline` and `InstallNewPipeline`, to setup and install a `otlptrace.Exporter` in tracing. (#1963) +- Changes `go.opentelemetry.io/otel/sdk/resource.NewWithAttributes` to require a schema URL. The old function is still available as `resource.NewSchemaless`. This is a breaking change. (#1938) +- Several builtin resource detectors now correctly populate the schema URL. (#1938) +- Creates package `go.opentelemetry.io/otel/exporters/otlp/otlpmetric` that defines a metrics exporter that uses a `otlpmetric.Client` to send data. +- Creates package `go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetricgrpc` implementing a gRPC `otlpmetric.Client` and offers convenience functions, `New` and `NewUnstarted`, to create an `otlpmetric.Exporter`.(#1991) +- Added `go.opentelemetry.io/otel/exporters/stdout/stdouttrace` exporter. (#2005) +- Added `go.opentelemetry.io/otel/exporters/stdout/stdoutmetric` exporter. (#2005) +- Added a `TracerProvider()` method to the `"go.opentelemetry.io/otel/trace".Span` interface. This can be used to obtain a `TracerProvider` from a given span that utilizes the same trace processing pipeline. (#2009) + +### Changed + +- Make `NewSplitDriver` from `go.opentelemetry.io/otel/exporters/otlp` take variadic arguments instead of a `SplitConfig` item. + `NewSplitDriver` now automatically implements an internal `noopDriver` for `SplitConfig` fields that are not initialized. (#1798) +- `resource.New()` now creates a Resource without builtin detectors. Previous behavior is now achieved by using `WithBuiltinDetectors` Option. (#1810) +- Move the `Event` type from the `go.opentelemetry.io/otel` package to the `go.opentelemetry.io/otel/sdk/trace` package. (#1846) +- CI builds validate against last two versions of Go, dropping 1.14 and adding 1.16. (#1865) +- BatchSpanProcessor now report export failures when calling `ForceFlush()` method. (#1860) +- `Set.Encoded(Encoder)` no longer caches the result of an encoding. (#1855) +- Renamed `CloudZoneKey` to `CloudAvailabilityZoneKey` in Resource semantic conventions according to spec. (#1871) +- The `StatusCode` and `StatusMessage` methods of the `ReadOnlySpan` interface and the `Span` produced by the `go.opentelemetry.io/otel/sdk/trace` package have been replaced with a single `Status` method. + This method returns the status of a span using the new `Status` type. (#1874) +- Updated `ExportSpans` method of the`SpanExporter` interface type to accept `ReadOnlySpan`s instead of the removed `SpanSnapshot`. + This brings the export interface into compliance with the specification in that it now accepts an explicitly immutable type instead of just an implied one. (#1873) +- Unembed `SpanContext` in `Link`. (#1877) +- Generate Semantic conventions from the specification YAML. (#1891) +- Spans created by the global `Tracer` obtained from `go.opentelemetry.io/otel`, prior to a functioning `TracerProvider` being set, now propagate the span context from their parent if one exists. (#1901) +- The `"go.opentelemetry.io/otel".Tracer` function now accepts tracer options. (#1902) +- Move the `go.opentelemetry.io/otel/unit` package to `go.opentelemetry.io/otel/metric/unit`. (#1903) +- Changed `go.opentelemetry.io/otel/trace.TracerConfig` to conform to the [Contributing guidelines](CONTRIBUTING.md#config.) (#1921) +- Changed `go.opentelemetry.io/otel/trace.SpanConfig` to conform to the [Contributing guidelines](CONTRIBUTING.md#config). (#1921) +- Changed `span.End()` now only accepts Options that are allowed at `End()`. (#1921) +- Changed `go.opentelemetry.io/otel/metric.InstrumentConfig` to conform to the [Contributing guidelines](CONTRIBUTING.md#config). (#1921) +- Changed `go.opentelemetry.io/otel/metric.MeterConfig` to conform to the [Contributing guidelines](CONTRIBUTING.md#config). (#1921) +- Refactored option types according to the contribution style guide. (#1882) +- Move the `go.opentelemetry.io/otel/trace.TraceStateFromKeyValues` function to the `go.opentelemetry.io/otel/oteltest` package. + This function is preserved for testing purposes where it may be useful to create a `TraceState` from `attribute.KeyValue`s, but it is not intended for production use. + The new `ParseTraceState` function should be used to create a `TraceState`. (#1931) +- Updated `MarshalJSON` method of the `go.opentelemetry.io/otel/trace.TraceState` type to marshal the type into the string representation of the `TraceState`. (#1931) +- The `TraceState.Delete` method from the `go.opentelemetry.io/otel/trace` package no longer returns an error in addition to a `TraceState`. (#1931) +- Updated `Get` method of the `TraceState` type from the `go.opentelemetry.io/otel/trace` package to accept a `string` instead of an `attribute.Key` type. (#1931) +- Updated `Insert` method of the `TraceState` type from the `go.opentelemetry.io/otel/trace` package to accept a pair of `string`s instead of an `attribute.KeyValue` type. (#1931) +- Updated `Delete` method of the `TraceState` type from the `go.opentelemetry.io/otel/trace` package to accept a `string` instead of an `attribute.Key` type. (#1931) +- Renamed `NewExporter` to `New` in the `go.opentelemetry.io/otel/exporters/stdout` package. (#1985) +- Renamed `NewExporter` to `New` in the `go.opentelemetry.io/otel/exporters/metric/prometheus` package. (#1985) +- Renamed `NewExporter` to `New` in the `go.opentelemetry.io/otel/exporters/trace/jaeger` package. (#1985) +- Renamed `NewExporter` to `New` in the `go.opentelemetry.io/otel/exporters/trace/zipkin` package. (#1985) +- Renamed `NewExporter` to `New` in the `go.opentelemetry.io/otel/exporters/otlp` package. (#1985) +- Renamed `NewUnstartedExporter` to `NewUnstarted` in the `go.opentelemetry.io/otel/exporters/otlp` package. (#1985) +- The `go.opentelemetry.io/otel/semconv` package has been moved to `go.opentelemetry.io/otel/semconv/v1.4.0` to allow for multiple [telemetry schema](https://github.com/open-telemetry/oteps/blob/main/text/0152-telemetry-schemas.md) versions to be used concurrently. (#1987) +- Metrics test helpers in `go.opentelemetry.io/otel/oteltest` have been moved to `go.opentelemetry.io/otel/metric/metrictest`. (#1988) + +### Deprecated + +- The `go.opentelemetry.io/otel/exporters/metric/prometheus` is deprecated, use `go.opentelemetry.io/otel/exporters/prometheus` instead. (#1993) +- The `go.opentelemetry.io/otel/exporters/trace/jaeger` is deprecated, use `go.opentelemetry.io/otel/exporters/jaeger` instead. (#1993) +- The `go.opentelemetry.io/otel/exporters/trace/zipkin` is deprecated, use `go.opentelemetry.io/otel/exporters/zipkin` instead. (#1993) + +### Removed + +- Removed `resource.WithoutBuiltin()`. Use `resource.New()`. (#1810) +- Unexported types `resource.FromEnv`, `resource.Host`, and `resource.TelemetrySDK`, Use the corresponding `With*()` to use individually. (#1810) +- Removed the `Tracer` and `IsRecording` method from the `ReadOnlySpan` in the `go.opentelemetry.io/otel/sdk/trace`. + The `Tracer` method is not a required to be included in this interface and given the mutable nature of the tracer that is associated with a span, this method is not appropriate. + The `IsRecording` method returns if the span is recording or not. + A read-only span value does not need to know if updates to it will be recorded or not. + By definition, it cannot be updated so there is no point in communicating if an update is recorded. (#1873) +- Removed the `SpanSnapshot` type from the `go.opentelemetry.io/otel/sdk/trace` package. + The use of this type has been replaced with the use of the explicitly immutable `ReadOnlySpan` type. + When a concrete representation of a read-only span is needed for testing, the newly added `SpanStub` in the `go.opentelemetry.io/otel/sdk/trace/tracetest` package should be used. (#1873) +- Removed the `Tracer` method from the `Span` interface in the `go.opentelemetry.io/otel/trace` package. + Using the same tracer that created a span introduces the error where an instrumentation library's `Tracer` is used by other code instead of their own. + The `"go.opentelemetry.io/otel".Tracer` function or a `TracerProvider` should be used to acquire a library specific `Tracer` instead. (#1900) + - The `TracerProvider()` method on the `Span` interface may also be used to obtain a `TracerProvider` using the same trace processing pipeline. (#2009) +- The `http.url` attribute generated by `HTTPClientAttributesFromHTTPRequest` will no longer include username or password information. (#1919) +- Removed `IsEmpty` method of the `TraceState` type in the `go.opentelemetry.io/otel/trace` package in favor of using the added `TraceState.Len` method. (#1931) +- Removed `Set`, `Value`, `ContextWithValue`, `ContextWithoutValue`, and `ContextWithEmpty` functions in the `go.opentelemetry.io/otel/baggage` package. + Handling of baggage is now done using the added `Baggage` type and related context functions (`ContextWithBaggage`, `ContextWithoutBaggage`, and `FromContext`) in that package. (#1967) +- The `InstallNewPipeline` and `NewExportPipeline` creation functions in all the exporters (prometheus, otlp, stdout, jaeger, and zipkin) have been removed. + These functions were deemed premature attempts to provide convenience that did not achieve this aim. (#1985) +- The `go.opentelemetry.io/otel/exporters/otlp` exporter has been removed. Use `go.opentelemetry.io/otel/exporters/otlp/otlptrace` instead. (#1990) +- The `go.opentelemetry.io/otel/exporters/stdout` exporter has been removed. Use `go.opentelemetry.io/otel/exporters/stdout/stdouttrace` or `go.opentelemetry.io/otel/exporters/stdout/stdoutmetric` instead. (#2005) + +### Fixed + +- Only report errors from the `"go.opentelemetry.io/otel/sdk/resource".Environment` function when they are not `nil`. (#1850, #1851) +- The `Shutdown` method of the simple `SpanProcessor` in the `go.opentelemetry.io/otel/sdk/trace` package now honors the context deadline or cancellation. (#1616, #1856) +- BatchSpanProcessor now drops span batches that failed to be exported. (#1860) +- Use `http://localhost:14268/api/traces` as default Jaeger collector endpoint instead of `http://localhost:14250`. (#1898) +- Allow trailing and leading whitespace in the parsing of a `tracestate` header. (#1931) +- Add logic to determine if the channel is closed to fix Jaeger exporter test panic with close closed channel. (#1870, #1973) +- Avoid transport security when OTLP endpoint is a Unix socket. (#2001) + +### Security + +## [0.20.0] - 2021-04-23 + +### Added + +- The OTLP exporter now has two new convenience functions, `NewExportPipeline` and `InstallNewPipeline`, setup and install the exporter in tracing and metrics pipelines. (#1373) +- Adds semantic conventions for exceptions. (#1492) +- Added Jaeger Environment variables: `OTEL_EXPORTER_JAEGER_AGENT_HOST`, `OTEL_EXPORTER_JAEGER_AGENT_PORT` + These environment variables can be used to override Jaeger agent hostname and port (#1752) +- Option `ExportTimeout` was added to batch span processor. (#1755) +- `trace.TraceFlags` is now a defined type over `byte` and `WithSampled(bool) TraceFlags` and `IsSampled() bool` methods have been added to it. (#1770) +- The `Event` and `Link` struct types from the `go.opentelemetry.io/otel` package now include a `DroppedAttributeCount` field to record the number of attributes that were not recorded due to configured limits being reached. (#1771) +- The Jaeger exporter now reports dropped attributes for a Span event in the exported log. (#1771) +- Adds test to check BatchSpanProcessor ignores `OnEnd` and `ForceFlush` post `Shutdown`. (#1772) +- Extract resource attributes from the `OTEL_RESOURCE_ATTRIBUTES` environment variable and merge them with the `resource.Default` resource as well as resources provided to the `TracerProvider` and metric `Controller`. (#1785) +- Added `WithOSType` resource configuration option to set OS (Operating System) type resource attribute (`os.type`). (#1788) +- Added `WithProcess*` resource configuration options to set Process resource attributes. (#1788) + - `process.pid` + - `process.executable.name` + - `process.executable.path` + - `process.command_args` + - `process.owner` + - `process.runtime.name` + - `process.runtime.version` + - `process.runtime.description` +- Adds `k8s.node.name` and `k8s.node.uid` attribute keys to the `semconv` package. (#1789) +- Added support for configuring OTLP/HTTP and OTLP/gRPC Endpoints, TLS Certificates, Headers, Compression and Timeout via Environment Variables. (#1758, #1769 and #1811) + - `OTEL_EXPORTER_OTLP_ENDPOINT` + - `OTEL_EXPORTER_OTLP_TRACES_ENDPOINT` + - `OTEL_EXPORTER_OTLP_METRICS_ENDPOINT` + - `OTEL_EXPORTER_OTLP_HEADERS` + - `OTEL_EXPORTER_OTLP_TRACES_HEADERS` + - `OTEL_EXPORTER_OTLP_METRICS_HEADERS` + - `OTEL_EXPORTER_OTLP_COMPRESSION` + - `OTEL_EXPORTER_OTLP_TRACES_COMPRESSION` + - `OTEL_EXPORTER_OTLP_METRICS_COMPRESSION` + - `OTEL_EXPORTER_OTLP_TIMEOUT` + - `OTEL_EXPORTER_OTLP_TRACES_TIMEOUT` + - `OTEL_EXPORTER_OTLP_METRICS_TIMEOUT` + - `OTEL_EXPORTER_OTLP_CERTIFICATE` + - `OTEL_EXPORTER_OTLP_TRACES_CERTIFICATE` + - `OTEL_EXPORTER_OTLP_METRICS_CERTIFICATE` +- Adds `otlpgrpc.WithTimeout` option for configuring timeout to the otlp/gRPC exporter. (#1821) +- Adds `jaeger.WithMaxPacketSize` option for configuring maximum UDP packet size used when connecting to the Jaeger agent. (#1853) + +### Fixed + +- The `Span.IsRecording` implementation from `go.opentelemetry.io/otel/sdk/trace` always returns false when not being sampled. (#1750) +- The Jaeger exporter now correctly sets tags for the Span status code and message. + This means it uses the correct tag keys (`"otel.status_code"`, `"otel.status_description"`) and does not set the status message as a tag unless it is set on the span. (#1761) +- The Jaeger exporter now correctly records Span event's names using the `"event"` key for a tag. + Additionally, this tag is overridden, as specified in the OTel specification, if the event contains an attribute with that key. (#1768) +- Zipkin Exporter: Ensure mapping between OTel and Zipkin span data complies with the specification. (#1688) +- Fixed typo for default service name in Jaeger Exporter. (#1797) +- Fix flaky OTLP for the reconnnection of the client connection. (#1527, #1814) +- Fix Jaeger exporter dropping of span batches that exceed the UDP packet size limit. + Instead, the exporter now splits the batch into smaller sendable batches. (#1828) + +### Changed + +- Span `RecordError` now records an `exception` event to comply with the semantic convention specification. (#1492) +- Jaeger exporter was updated to use thrift v0.14.1. (#1712) +- Migrate from using internally built and maintained version of the OTLP to the one hosted at `go.opentelemetry.io/proto/otlp`. (#1713) +- Migrate from using `github.com/gogo/protobuf` to `google.golang.org/protobuf` to match `go.opentelemetry.io/proto/otlp`. (#1713) +- The storage of a local or remote Span in a `context.Context` using its SpanContext is unified to store just the current Span. + The Span's SpanContext can now self-identify as being remote or not. + This means that `"go.opentelemetry.io/otel/trace".ContextWithRemoteSpanContext` will now overwrite any existing current Span, not just existing remote Spans, and make it the current Span in a `context.Context`. (#1731) +- Improve OTLP/gRPC exporter connection errors. (#1737) +- Information about a parent span context in a `"go.opentelemetry.io/otel/export/trace".SpanSnapshot` is unified in a new `Parent` field. + The existing `ParentSpanID` and `HasRemoteParent` fields are removed in favor of this. (#1748) +- The `ParentContext` field of the `"go.opentelemetry.io/otel/sdk/trace".SamplingParameters` is updated to hold a `context.Context` containing the parent span. + This changes it to make `SamplingParameters` conform with the OpenTelemetry specification. (#1749) +- Updated Jaeger Environment Variables: `JAEGER_ENDPOINT`, `JAEGER_USER`, `JAEGER_PASSWORD` + to `OTEL_EXPORTER_JAEGER_ENDPOINT`, `OTEL_EXPORTER_JAEGER_USER`, `OTEL_EXPORTER_JAEGER_PASSWORD` in compliance with OTel specification. (#1752) +- Modify `BatchSpanProcessor.ForceFlush` to abort after timeout/cancellation. (#1757) +- The `DroppedAttributeCount` field of the `Span` in the `go.opentelemetry.io/otel` package now only represents the number of attributes dropped for the span itself. + It no longer is a conglomerate of itself, events, and link attributes that have been dropped. (#1771) +- Make `ExportSpans` in Jaeger Exporter honor context deadline. (#1773) +- Modify Zipkin Exporter default service name, use default resource's serviceName instead of empty. (#1777) +- The `go.opentelemetry.io/otel/sdk/export/trace` package is merged into the `go.opentelemetry.io/otel/sdk/trace` package. (#1778) +- The prometheus.InstallNewPipeline example is moved from comment to example test (#1796) +- The convenience functions for the stdout exporter have been updated to return the `TracerProvider` implementation and enable the shutdown of the exporter. (#1800) +- Replace the flush function returned from the Jaeger exporter's convenience creation functions (`InstallNewPipeline` and `NewExportPipeline`) with the `TracerProvider` implementation they create. + This enables the caller to shutdown and flush using the related `TracerProvider` methods. (#1822) +- Updated the Jaeger exporter to have a default endpoint, `http://localhost:14250`, for the collector. (#1824) +- Changed the function `WithCollectorEndpoint` in the Jaeger exporter to no longer accept an endpoint as an argument. + The endpoint can be passed with the `CollectorEndpointOption` using the `WithEndpoint` function or by setting the `OTEL_EXPORTER_JAEGER_ENDPOINT` environment variable value appropriately. (#1824) +- The Jaeger exporter no longer batches exported spans itself, instead it relies on the SDK's `BatchSpanProcessor` for this functionality. (#1830) +- The Jaeger exporter creation functions (`NewRawExporter`, `NewExportPipeline`, and `InstallNewPipeline`) no longer accept the removed `Option` type as a variadic argument. (#1830) + +### Removed + +- Removed Jaeger Environment variables: `JAEGER_SERVICE_NAME`, `JAEGER_DISABLED`, `JAEGER_TAGS` + These environment variables will no longer be used to override values of the Jaeger exporter (#1752) +- No longer set the links for a `Span` in `go.opentelemetry.io/otel/sdk/trace` that is configured to be a new root. + This is unspecified behavior that the OpenTelemetry community plans to standardize in the future. + To prevent backwards incompatible changes when it is specified, these links are removed. (#1726) +- Setting error status while recording error with Span from oteltest package. (#1729) +- The concept of a remote and local Span stored in a context is unified to just the current Span. + Because of this `"go.opentelemetry.io/otel/trace".RemoteSpanContextFromContext` is removed as it is no longer needed. + Instead, `"go.opentelemetry.io/otel/trace".SpanContextFromContext` can be used to return the current Span. + If needed, that Span's `SpanContext.IsRemote()` can then be used to determine if it is remote or not. (#1731) +- The `HasRemoteParent` field of the `"go.opentelemetry.io/otel/sdk/trace".SamplingParameters` is removed. + This field is redundant to the information returned from the `Remote` method of the `SpanContext` held in the `ParentContext` field. (#1749) +- The `trace.FlagsDebug` and `trace.FlagsDeferred` constants have been removed and will be localized to the B3 propagator. (#1770) +- Remove `Process` configuration, `WithProcessFromEnv` and `ProcessFromEnv`, and type from the Jaeger exporter package. + The information that could be configured in the `Process` struct should be configured in a `Resource` instead. (#1776, #1804) +- Remove the `WithDisabled` option from the Jaeger exporter. + To disable the exporter unregister it from the `TracerProvider` or use a no-operation `TracerProvider`. (#1806) +- Removed the functions `CollectorEndpointFromEnv` and `WithCollectorEndpointOptionFromEnv` from the Jaeger exporter. + These functions for retrieving specific environment variable values are redundant of other internal functions and + are not intended for end user use. (#1824) +- Removed the Jaeger exporter `WithSDKOptions` `Option`. + This option was used to set SDK options for the exporter creation convenience functions. + These functions are provided as a way to easily setup or install the exporter with what are deemed reasonable SDK settings for common use cases. + If the SDK needs to be configured differently, the `NewRawExporter` function and direct setup of the SDK with the desired settings should be used. (#1825) +- The `WithBufferMaxCount` and `WithBatchMaxCount` `Option`s from the Jaeger exporter are removed. + The exporter no longer batches exports, instead relying on the SDK's `BatchSpanProcessor` for this functionality. (#1830) +- The Jaeger exporter `Option` type is removed. + The type is no longer used by the exporter to configure anything. + All the previous configurations these options provided were duplicates of SDK configuration. + They have been removed in favor of using the SDK configuration and focuses the exporter configuration to be only about the endpoints it will send telemetry to. (#1830) + +## [0.19.0] - 2021-03-18 + +### Added + +- Added `Marshaler` config option to `otlphttp` to enable otlp over json or protobufs. (#1586) +- A `ForceFlush` method to the `"go.opentelemetry.io/otel/sdk/trace".TracerProvider` to flush all registered `SpanProcessor`s. (#1608) +- Added `WithSampler` and `WithSpanLimits` to tracer provider. (#1633, #1702) +- `"go.opentelemetry.io/otel/trace".SpanContext` now has a `remote` property, and `IsRemote()` predicate, that is true when the `SpanContext` has been extracted from remote context data. (#1701) +- A `Valid` method to the `"go.opentelemetry.io/otel/attribute".KeyValue` type. (#1703) + +### Changed + +- `trace.SpanContext` is now immutable and has no exported fields. (#1573) + - `trace.NewSpanContext()` can be used in conjunction with the `trace.SpanContextConfig` struct to initialize a new `SpanContext` where all values are known. +- Update the `ForceFlush` method signature to the `"go.opentelemetry.io/otel/sdk/trace".SpanProcessor` to accept a `context.Context` and return an error. (#1608) +- Update the `Shutdown` method to the `"go.opentelemetry.io/otel/sdk/trace".TracerProvider` return an error on shutdown failure. (#1608) +- The SimpleSpanProcessor will now shut down the enclosed `SpanExporter` and gracefully ignore subsequent calls to `OnEnd` after `Shutdown` is called. (#1612) +- `"go.opentelemetry.io/sdk/metric/controller.basic".WithPusher` is replaced with `WithExporter` to provide consistent naming across project. (#1656) +- Added non-empty string check for trace `Attribute` keys. (#1659) +- Add `description` to SpanStatus only when `StatusCode` is set to error. (#1662) +- Jaeger exporter falls back to `resource.Default`'s `service.name` if the exported Span does not have one. (#1673) +- Jaeger exporter populates Jaeger's Span Process from Resource. (#1673) +- Renamed the `LabelSet` method of `"go.opentelemetry.io/otel/sdk/resource".Resource` to `Set`. (#1692) +- Changed `WithSDK` to `WithSDKOptions` to accept variadic arguments of `TracerProviderOption` type in `go.opentelemetry.io/otel/exporters/trace/jaeger` package. (#1693) +- Changed `WithSDK` to `WithSDKOptions` to accept variadic arguments of `TracerProviderOption` type in `go.opentelemetry.io/otel/exporters/trace/zipkin` package. (#1693) + +### Removed + +- Removed `serviceName` parameter from Zipkin exporter and uses resource instead. (#1549) +- Removed `WithConfig` from tracer provider to avoid overriding configuration. (#1633) +- Removed the exported `SimpleSpanProcessor` and `BatchSpanProcessor` structs. + These are now returned as a SpanProcessor interface from their respective constructors. (#1638) +- Removed `WithRecord()` from `trace.SpanOption` when creating a span. (#1660) +- Removed setting status to `Error` while recording an error as a span event in `RecordError`. (#1663) +- Removed `jaeger.WithProcess` configuration option. (#1673) +- Removed `ApplyConfig` method from `"go.opentelemetry.io/otel/sdk/trace".TracerProvider` and the now unneeded `Config` struct. (#1693) + +### Fixed + +- Jaeger Exporter: Ensure mapping between OTEL and Jaeger span data complies with the specification. (#1626) +- `SamplingResult.TraceState` is correctly propagated to a newly created span's `SpanContext`. (#1655) +- The `otel-collector` example now correctly flushes metric events prior to shutting down the exporter. (#1678) +- Do not set span status message in `SpanStatusFromHTTPStatusCode` if it can be inferred from `http.status_code`. (#1681) +- Synchronization issues in global trace delegate implementation. (#1686) +- Reduced excess memory usage by global `TracerProvider`. (#1687) + +## [0.18.0] - 2021-03-03 + +### Added + +- Added `resource.Default()` for use with meter and tracer providers. (#1507) +- `AttributePerEventCountLimit` and `AttributePerLinkCountLimit` for `SpanLimits`. (#1535) +- Added `Keys()` method to `propagation.TextMapCarrier` and `propagation.HeaderCarrier` to adapt `http.Header` to this interface. (#1544) +- Added `code` attributes to `go.opentelemetry.io/otel/semconv` package. (#1558) +- Compatibility testing suite in the CI system for the following systems. (#1567) + | OS | Go Version | Architecture | + | ------- | ---------- | ------------ | + | Ubuntu | 1.15 | amd64 | + | Ubuntu | 1.14 | amd64 | + | Ubuntu | 1.15 | 386 | + | Ubuntu | 1.14 | 386 | + | MacOS | 1.15 | amd64 | + | MacOS | 1.14 | amd64 | + | Windows | 1.15 | amd64 | + | Windows | 1.14 | amd64 | + | Windows | 1.15 | 386 | + | Windows | 1.14 | 386 | + +### Changed + +- Replaced interface `oteltest.SpanRecorder` with its existing implementation + `StandardSpanRecorder`. (#1542) +- Default span limit values to 128. (#1535) +- Rename `MaxEventsPerSpan`, `MaxAttributesPerSpan` and `MaxLinksPerSpan` to `EventCountLimit`, `AttributeCountLimit` and `LinkCountLimit`, and move these fields into `SpanLimits`. (#1535) +- Renamed the `otel/label` package to `otel/attribute`. (#1541) +- Vendor the Jaeger exporter's dependency on Apache Thrift. (#1551) +- Parallelize the CI linting and testing. (#1567) +- Stagger timestamps in exact aggregator tests. (#1569) +- Changed all examples to use `WithBatchTimeout(5 * time.Second)` rather than `WithBatchTimeout(5)`. (#1621) +- Prevent end-users from implementing some interfaces (#1575) + + ``` + "otel/exporters/otlp/otlphttp".Option + "otel/exporters/stdout".Option + "otel/oteltest".Option + "otel/trace".TracerOption + "otel/trace".SpanOption + "otel/trace".EventOption + "otel/trace".LifeCycleOption + "otel/trace".InstrumentationOption + "otel/sdk/resource".Option + "otel/sdk/trace".ParentBasedSamplerOption + "otel/sdk/trace".ReadOnlySpan + "otel/sdk/trace".ReadWriteSpan + ``` + +### Removed + +- Removed attempt to resample spans upon changing the span name with `span.SetName()`. (#1545) +- The `test-benchmark` is no longer a dependency of the `precommit` make target. (#1567) +- Removed the `test-386` make target. + This was replaced with a full compatibility testing suite (i.e. multi OS/arch) in the CI system. (#1567) + +### Fixed + +- The sequential timing check of timestamps in the stdout exporter are now setup explicitly to be sequential (#1571). (#1572) +- Windows build of Jaeger tests now compiles with OS specific functions (#1576). (#1577) +- The sequential timing check of timestamps of go.opentelemetry.io/otel/sdk/metric/aggregator/lastvalue are now setup explicitly to be sequential (#1578). (#1579) +- Validate tracestate header keys with vendors according to the W3C TraceContext specification (#1475). (#1581) +- The OTLP exporter includes related labels for translations of a GaugeArray (#1563). (#1570) + +## [0.17.0] - 2021-02-12 + +### Changed + +- Rename project default branch from `master` to `main`. (#1505) +- Reverse order in which `Resource` attributes are merged, per change in spec. (#1501) +- Add tooling to maintain "replace" directives in go.mod files automatically. (#1528) +- Create new modules: otel/metric, otel/trace, otel/oteltest, otel/sdk/export/metric, otel/sdk/metric (#1528) +- Move metric-related public global APIs from otel to otel/metric/global. (#1528) + +## Fixed + +- Fixed otlpgrpc reconnection issue. +- The example code in the README.md of `go.opentelemetry.io/otel/exporters/otlp` is moved to a compiled example test and used the new `WithAddress` instead of `WithEndpoint`. (#1513) +- The otel-collector example now uses the default OTLP receiver port of the collector. + +## [0.16.0] - 2021-01-13 + +### Added + +- Add the `ReadOnlySpan` and `ReadWriteSpan` interfaces to provide better control for accessing span data. (#1360) +- `NewGRPCDriver` function returns a `ProtocolDriver` that maintains a single gRPC connection to the collector. (#1369) +- Added documentation about the project's versioning policy. (#1388) +- Added `NewSplitDriver` for OTLP exporter that allows sending traces and metrics to different endpoints. (#1418) +- Added codeql workflow to GitHub Actions (#1428) +- Added Gosec workflow to GitHub Actions (#1429) +- Add new HTTP driver for OTLP exporter in `exporters/otlp/otlphttp`. Currently it only supports the binary protobuf payloads. (#1420) +- Add an OpenCensus exporter bridge. (#1444) + +### Changed + +- Rename `internal/testing` to `internal/internaltest`. (#1449) +- Rename `export.SpanData` to `export.SpanSnapshot` and use it only for exporting spans. (#1360) +- Store the parent's full `SpanContext` rather than just its span ID in the `span` struct. (#1360) +- Improve span duration accuracy. (#1360) +- Migrated CI/CD from CircleCI to GitHub Actions (#1382) +- Remove duplicate checkout from GitHub Actions workflow (#1407) +- Metric `array` aggregator renamed `exact` to match its `aggregation.Kind` (#1412) +- Metric `exact` aggregator includes per-point timestamps (#1412) +- Metric stdout exporter uses MinMaxSumCount aggregator for ValueRecorder instruments (#1412) +- `NewExporter` from `exporters/otlp` now takes a `ProtocolDriver` as a parameter. (#1369) +- Many OTLP Exporter options became gRPC ProtocolDriver options. (#1369) +- Unify endpoint API that related to OTel exporter. (#1401) +- Optimize metric histogram aggregator to reuse its slice of buckets. (#1435) +- Metric aggregator Count() and histogram Bucket.Counts are consistently `uint64`. (1430) +- Histogram aggregator accepts functional options, uses default boundaries if none given. (#1434) +- `SamplingResult` now passed a `Tracestate` from the parent `SpanContext` (#1432) +- Moved gRPC driver for OTLP exporter to `exporters/otlp/otlpgrpc`. (#1420) +- The `TraceContext` propagator now correctly propagates `TraceState` through the `SpanContext`. (#1447) +- Metric Push and Pull Controller components are combined into a single "basic" Controller: + - `WithExporter()` and `Start()` to configure Push behavior + - `Start()` is optional; use `Collect()` and `ForEach()` for Pull behavior + - `Start()` and `Stop()` accept Context. (#1378) +- The `Event` type is moved from the `otel/sdk/export/trace` package to the `otel/trace` API package. (#1452) + +### Removed + +- Remove `errUninitializedSpan` as its only usage is now obsolete. (#1360) +- Remove Metric export functionality related to quantiles and summary data points: this is not specified (#1412) +- Remove DDSketch metric aggregator; our intention is to re-introduce this as an option of the histogram aggregator after [new OTLP histogram data types](https://github.com/open-telemetry/opentelemetry-proto/pull/226) are released (#1412) + +### Fixed + +- `BatchSpanProcessor.Shutdown()` will now shutdown underlying `export.SpanExporter`. (#1443) + +## [0.15.0] - 2020-12-10 + +### Added + +- The `WithIDGenerator` `TracerProviderOption` is added to the `go.opentelemetry.io/otel/trace` package to configure an `IDGenerator` for the `TracerProvider`. (#1363) + +### Changed + +- The Zipkin exporter now uses the Span status code to determine. (#1328) +- `NewExporter` and `Start` functions in `go.opentelemetry.io/otel/exporters/otlp` now receive `context.Context` as a first parameter. (#1357) +- Move the OpenCensus example into `example` directory. (#1359) +- Moved the SDK's `internal.IDGenerator` interface in to the `sdk/trace` package to enable support for externally-defined ID generators. (#1363) +- Bump `github.com/google/go-cmp` from 0.5.3 to 0.5.4 (#1374) +- Bump `github.com/golangci/golangci-lint` in `/internal/tools` (#1375) + +### Fixed + +- Metric SDK `SumObserver` and `UpDownSumObserver` instruments correctness fixes. (#1381) + +## [0.14.0] - 2020-11-19 + +### Added + +- An `EventOption` and the related `NewEventConfig` function are added to the `go.opentelemetry.io/otel` package to configure Span events. (#1254) +- A `TextMapPropagator` and associated `TextMapCarrier` are added to the `go.opentelemetry.io/otel/oteltest` package to test `TextMap` type propagators and their use. (#1259) +- `SpanContextFromContext` returns `SpanContext` from context. (#1255) +- `TraceState` has been added to `SpanContext`. (#1340) +- `DeploymentEnvironmentKey` added to `go.opentelemetry.io/otel/semconv` package. (#1323) +- Add an OpenCensus to OpenTelemetry tracing bridge. (#1305) +- Add a parent context argument to `SpanProcessor.OnStart` to follow the specification. (#1333) +- Add missing tests for `sdk/trace/attributes_map.go`. (#1337) + +### Changed + +- Move the `go.opentelemetry.io/otel/api/trace` package into `go.opentelemetry.io/otel/trace` with the following changes. (#1229) (#1307) + - `ID` has been renamed to `TraceID`. + - `IDFromHex` has been renamed to `TraceIDFromHex`. + - `EmptySpanContext` is removed. +- Move the `go.opentelemetry.io/otel/api/trace/tracetest` package into `go.opentelemetry.io/otel/oteltest`. (#1229) +- OTLP Exporter updates: + - supports OTLP v0.6.0 (#1230, #1354) + - supports configurable aggregation temporality (default: Cumulative, optional: Stateless). (#1296) +- The Sampler is now called on local child spans. (#1233) +- The `Kind` type from the `go.opentelemetry.io/otel/api/metric` package was renamed to `InstrumentKind` to more specifically describe what it is and avoid semantic ambiguity. (#1240) +- The `MetricKind` method of the `Descriptor` type in the `go.opentelemetry.io/otel/api/metric` package was renamed to `Descriptor.InstrumentKind`. + This matches the returned type and fixes misuse of the term metric. (#1240) +- Move test harness from the `go.opentelemetry.io/otel/api/apitest` package into `go.opentelemetry.io/otel/oteltest`. (#1241) +- Move the `go.opentelemetry.io/otel/api/metric/metrictest` package into `go.opentelemetry.io/oteltest` as part of #964. (#1252) +- Move the `go.opentelemetry.io/otel/api/metric` package into `go.opentelemetry.io/otel/metric` as part of #1303. (#1321) +- Move the `go.opentelemetry.io/otel/api/metric/registry` package into `go.opentelemetry.io/otel/metric/registry` as a part of #1303. (#1316) +- Move the `Number` type (together with related functions) from `go.opentelemetry.io/otel/api/metric` package into `go.opentelemetry.io/otel/metric/number` as a part of #1303. (#1316) +- The function signature of the Span `AddEvent` method in `go.opentelemetry.io/otel` is updated to no longer take an unused context and instead take a required name and a variable number of `EventOption`s. (#1254) +- The function signature of the Span `RecordError` method in `go.opentelemetry.io/otel` is updated to no longer take an unused context and instead take a required error value and a variable number of `EventOption`s. (#1254) +- Move the `go.opentelemetry.io/otel/api/global` package to `go.opentelemetry.io/otel`. (#1262) (#1330) +- Move the `Version` function from `go.opentelemetry.io/otel/sdk` to `go.opentelemetry.io/otel`. (#1330) +- Rename correlation context header from `"otcorrelations"` to `"baggage"` to match the OpenTelemetry specification. (#1267) +- Fix `Code.UnmarshalJSON` to work with valid JSON only. (#1276) +- The `resource.New()` method changes signature to support builtin attributes and functional options, including `telemetry.sdk.*` and + `host.name` semantic conventions; the former method is renamed `resource.NewWithAttributes`. (#1235) +- The Prometheus exporter now exports non-monotonic counters (i.e. `UpDownCounter`s) as gauges. (#1210) +- Correct the `Span.End` method documentation in the `otel` API to state updates are not allowed on a span after it has ended. (#1310) +- Updated span collection limits for attribute, event and link counts to 1000 (#1318) +- Renamed `semconv.HTTPUrlKey` to `semconv.HTTPURLKey`. (#1338) + +### Removed + +- The `ErrInvalidHexID`, `ErrInvalidTraceIDLength`, `ErrInvalidSpanIDLength`, `ErrInvalidSpanIDLength`, or `ErrNilSpanID` from the `go.opentelemetry.io/otel` package are unexported now. (#1243) +- The `AddEventWithTimestamp` method on the `Span` interface in `go.opentelemetry.io/otel` is removed due to its redundancy. + It is replaced by using the `AddEvent` method with a `WithTimestamp` option. (#1254) +- The `MockSpan` and `MockTracer` types are removed from `go.opentelemetry.io/otel/oteltest`. + `Tracer` and `Span` from the same module should be used in their place instead. (#1306) +- `WorkerCount` option is removed from `go.opentelemetry.io/otel/exporters/otlp`. (#1350) +- Remove the following labels types: INT32, UINT32, UINT64 and FLOAT32. (#1314) + +### Fixed + +- Rename `MergeItererator` to `MergeIterator` in the `go.opentelemetry.io/otel/label` package. (#1244) +- The `go.opentelemetry.io/otel/api/global` packages global TextMapPropagator now delegates functionality to a globally set delegate for all previously returned propagators. (#1258) +- Fix condition in `label.Any`. (#1299) +- Fix global `TracerProvider` to pass options to its configured provider. (#1329) +- Fix missing handler for `ExactKind` aggregator in OTLP metrics transformer (#1309) + +## [0.13.0] - 2020-10-08 + +### Added + +- OTLP Metric exporter supports Histogram aggregation. (#1209) +- The `Code` struct from the `go.opentelemetry.io/otel/codes` package now supports JSON marshaling and unmarshaling as well as implements the `Stringer` interface. (#1214) +- A Baggage API to implement the OpenTelemetry specification. (#1217) +- Add Shutdown method to sdk/trace/provider, shutdown processors in the order they were registered. (#1227) + +### Changed + +- Set default propagator to no-op propagator. (#1184) +- The `HTTPSupplier`, `HTTPExtractor`, `HTTPInjector`, and `HTTPPropagator` from the `go.opentelemetry.io/otel/api/propagation` package were replaced with unified `TextMapCarrier` and `TextMapPropagator` in the `go.opentelemetry.io/otel/propagation` package. (#1212) (#1325) +- The `New` function from the `go.opentelemetry.io/otel/api/propagation` package was replaced with `NewCompositeTextMapPropagator` in the `go.opentelemetry.io/otel` package. (#1212) +- The status codes of the `go.opentelemetry.io/otel/codes` package have been updated to match the latest OpenTelemetry specification. + They now are `Unset`, `Error`, and `Ok`. + They no longer track the gRPC codes. (#1214) +- The `StatusCode` field of the `SpanData` struct in the `go.opentelemetry.io/otel/sdk/export/trace` package now uses the codes package from this package instead of the gRPC project. (#1214) +- Move the `go.opentelemetry.io/otel/api/baggage` package into `go.opentelemetry.io/otel/baggage`. (#1217) (#1325) +- A `Shutdown` method of `SpanProcessor` and all its implementations receives a context and returns an error. (#1264) + +### Fixed + +- Copies of data from arrays and slices passed to `go.opentelemetry.io/otel/label.ArrayValue()` are now used in the returned `Value` instead of using the mutable data itself. (#1226) + +### Removed + +- The `ExtractHTTP` and `InjectHTTP` functions from the `go.opentelemetry.io/otel/api/propagation` package were removed. (#1212) +- The `Propagators` interface from the `go.opentelemetry.io/otel/api/propagation` package was removed to conform to the OpenTelemetry specification. + The explicit `TextMapPropagator` type can be used in its place as this is the `Propagator` type the specification defines. (#1212) +- The `SetAttribute` method of the `Span` from the `go.opentelemetry.io/otel/api/trace` package was removed given its redundancy with the `SetAttributes` method. (#1216) +- The internal implementation of Baggage storage is removed in favor of using the new Baggage API functionality. (#1217) +- Remove duplicate hostname key `HostHostNameKey` in Resource semantic conventions. (#1219) +- Nested array/slice support has been removed. (#1226) + +## [0.12.0] - 2020-09-24 + +### Added + +- A `SpanConfigure` function in `go.opentelemetry.io/otel/api/trace` to create a new `SpanConfig` from `SpanOption`s. (#1108) +- In the `go.opentelemetry.io/otel/api/trace` package, `NewTracerConfig` was added to construct new `TracerConfig`s. + This addition was made to conform with our project option conventions. (#1155) +- Instrumentation library information was added to the Zipkin exporter. (#1119) +- The `SpanProcessor` interface now has a `ForceFlush()` method. (#1166) +- More semantic conventions for k8s as resource attributes. (#1167) + +### Changed + +- Add reconnecting udp connection type to Jaeger exporter. + This change adds a new optional implementation of the udp conn interface used to detect changes to an agent's host dns record. + It then adopts the new destination address to ensure the exporter doesn't get stuck. This change was ported from jaegertracing/jaeger-client-go#520. (#1063) +- Replace `StartOption` and `EndOption` in `go.opentelemetry.io/otel/api/trace` with `SpanOption`. + This change is matched by replacing the `StartConfig` and `EndConfig` with a unified `SpanConfig`. (#1108) +- Replace the `LinkedTo` span option in `go.opentelemetry.io/otel/api/trace` with `WithLinks`. + This is be more consistent with our other option patterns, i.e. passing the item to be configured directly instead of its component parts, and provides a cleaner function signature. (#1108) +- The `go.opentelemetry.io/otel/api/trace` `TracerOption` was changed to an interface to conform to project option conventions. (#1109) +- Move the `B3` and `TraceContext` from within the `go.opentelemetry.io/otel/api/trace` package to their own `go.opentelemetry.io/otel/propagators` package. + This removal of the propagators is reflective of the OpenTelemetry specification for these propagators as well as cleans up the `go.opentelemetry.io/otel/api/trace` API. (#1118) +- Rename Jaeger tags used for instrumentation library information to reflect changes in OpenTelemetry specification. (#1119) +- Rename `ProbabilitySampler` to `TraceIDRatioBased` and change semantics to ignore parent span sampling status. (#1115) +- Move `tools` package under `internal`. (#1141) +- Move `go.opentelemetry.io/otel/api/correlation` package to `go.opentelemetry.io/otel/api/baggage`. (#1142) + The `correlation.CorrelationContext` propagator has been renamed `baggage.Baggage`. Other exported functions and types are unchanged. +- Rename `ParentOrElse` sampler to `ParentBased` and allow setting samplers depending on parent span. (#1153) +- In the `go.opentelemetry.io/otel/api/trace` package, `SpanConfigure` was renamed to `NewSpanConfig`. (#1155) +- Change `dependabot.yml` to add a `Skip Changelog` label to dependabot-sourced PRs. (#1161) +- The [configuration style guide](https://github.com/open-telemetry/opentelemetry-go/blob/master/CONTRIBUTING.md#config) has been updated to + recommend the use of `newConfig()` instead of `configure()`. (#1163) +- The `otlp.Config` type has been unexported and changed to `otlp.config`, along with its initializer. (#1163) +- Ensure exported interface types include parameter names and update the + Style Guide to reflect this styling rule. (#1172) +- Don't consider unset environment variable for resource detection to be an error. (#1170) +- Rename `go.opentelemetry.io/otel/api/metric.ConfigureInstrument` to `NewInstrumentConfig` and + `go.opentelemetry.io/otel/api/metric.ConfigureMeter` to `NewMeterConfig`. +- ValueObserver instruments use LastValue aggregator by default. (#1165) +- OTLP Metric exporter supports LastValue aggregation. (#1165) +- Move the `go.opentelemetry.io/otel/api/unit` package to `go.opentelemetry.io/otel/unit`. (#1185) +- Rename `Provider` to `MeterProvider` in the `go.opentelemetry.io/otel/api/metric` package. (#1190) +- Rename `NoopProvider` to `NoopMeterProvider` in the `go.opentelemetry.io/otel/api/metric` package. (#1190) +- Rename `NewProvider` to `NewMeterProvider` in the `go.opentelemetry.io/otel/api/metric/metrictest` package. (#1190) +- Rename `Provider` to `MeterProvider` in the `go.opentelemetry.io/otel/api/metric/registry` package. (#1190) +- Rename `NewProvider` to `NewMeterProvider` in the `go.opentelemetry.io/otel/api/metri/registryc` package. (#1190) +- Rename `Provider` to `TracerProvider` in the `go.opentelemetry.io/otel/api/trace` package. (#1190) +- Rename `NoopProvider` to `NoopTracerProvider` in the `go.opentelemetry.io/otel/api/trace` package. (#1190) +- Rename `Provider` to `TracerProvider` in the `go.opentelemetry.io/otel/api/trace/tracetest` package. (#1190) +- Rename `NewProvider` to `NewTracerProvider` in the `go.opentelemetry.io/otel/api/trace/tracetest` package. (#1190) +- Rename `WrapperProvider` to `WrapperTracerProvider` in the `go.opentelemetry.io/otel/bridge/opentracing` package. (#1190) +- Rename `NewWrapperProvider` to `NewWrapperTracerProvider` in the `go.opentelemetry.io/otel/bridge/opentracing` package. (#1190) +- Rename `Provider` method of the pull controller to `MeterProvider` in the `go.opentelemetry.io/otel/sdk/metric/controller/pull` package. (#1190) +- Rename `Provider` method of the push controller to `MeterProvider` in the `go.opentelemetry.io/otel/sdk/metric/controller/push` package. (#1190) +- Rename `ProviderOptions` to `TracerProviderConfig` in the `go.opentelemetry.io/otel/sdk/trace` package. (#1190) +- Rename `ProviderOption` to `TracerProviderOption` in the `go.opentelemetry.io/otel/sdk/trace` package. (#1190) +- Rename `Provider` to `TracerProvider` in the `go.opentelemetry.io/otel/sdk/trace` package. (#1190) +- Rename `NewProvider` to `NewTracerProvider` in the `go.opentelemetry.io/otel/sdk/trace` package. (#1190) +- Renamed `SamplingDecision` values to comply with OpenTelemetry specification change. (#1192) +- Renamed Zipkin attribute names from `ot.status_code & ot.status_description` to `otel.status_code & otel.status_description`. (#1201) +- The default SDK now invokes registered `SpanProcessor`s in the order they were registered with the `TracerProvider`. (#1195) +- Add test of spans being processed by the `SpanProcessor`s in the order they were registered. (#1203) + +### Removed + +- Remove the B3 propagator from `go.opentelemetry.io/otel/propagators`. It is now located in the + `go.opentelemetry.io/contrib/propagators/` module. (#1191) +- Remove the semantic convention for HTTP status text, `HTTPStatusTextKey` from package `go.opentelemetry.io/otel/semconv`. (#1194) + +### Fixed + +- Zipkin example no longer mentions `ParentSampler`, corrected to `ParentBased`. (#1171) +- Fix missing shutdown processor in otel-collector example. (#1186) +- Fix missing shutdown processor in basic and namedtracer examples. (#1197) + +## [0.11.0] - 2020-08-24 + +### Added + +- Support for exporting array-valued attributes via OTLP. (#992) +- `Noop` and `InMemory` `SpanBatcher` implementations to help with testing integrations. (#994) +- Support for filtering metric label sets. (#1047) +- A dimensionality-reducing metric Processor. (#1057) +- Integration tests for more OTel Collector Attribute types. (#1062) +- A new `WithSpanProcessor` `ProviderOption` is added to the `go.opentelemetry.io/otel/sdk/trace` package to create a `Provider` and automatically register the `SpanProcessor`. (#1078) + +### Changed + +- Rename `sdk/metric/processor/test` to `sdk/metric/processor/processortest`. (#1049) +- Rename `sdk/metric/controller/test` to `sdk/metric/controller/controllertest`. (#1049) +- Rename `api/testharness` to `api/apitest`. (#1049) +- Rename `api/trace/testtrace` to `api/trace/tracetest`. (#1049) +- Change Metric Processor to merge multiple observations. (#1024) +- The `go.opentelemetry.io/otel/bridge/opentracing` bridge package has been made into its own module. + This removes the package dependencies of this bridge from the rest of the OpenTelemetry based project. (#1038) +- Renamed `go.opentelemetry.io/otel/api/standard` package to `go.opentelemetry.io/otel/semconv` to avoid the ambiguous and generic name `standard` and better describe the package as containing OpenTelemetry semantic conventions. (#1016) +- The environment variable used for resource detection has been changed from `OTEL_RESOURCE_LABELS` to `OTEL_RESOURCE_ATTRIBUTES` (#1042) +- Replace `WithSyncer` with `WithBatcher` in examples. (#1044) +- Replace the `google.golang.org/grpc/codes` dependency in the API with an equivalent `go.opentelemetry.io/otel/codes` package. (#1046) +- Merge the `go.opentelemetry.io/otel/api/label` and `go.opentelemetry.io/otel/api/kv` into the new `go.opentelemetry.io/otel/label` package. (#1060) +- Unify Callback Function Naming. + Rename `*Callback` with `*Func`. (#1061) +- CI builds validate against last two versions of Go, dropping 1.13 and adding 1.15. (#1064) +- The `go.opentelemetry.io/otel/sdk/export/trace` interfaces `SpanSyncer` and `SpanBatcher` have been replaced with a specification compliant `Exporter` interface. + This interface still supports the export of `SpanData`, but only as a slice. + Implementation are also required now to return any error from `ExportSpans` if one occurs as well as implement a `Shutdown` method for exporter clean-up. (#1078) +- The `go.opentelemetry.io/otel/sdk/trace` `NewBatchSpanProcessor` function no longer returns an error. + If a `nil` exporter is passed as an argument to this function, instead of it returning an error, it now returns a `BatchSpanProcessor` that handles the export of `SpanData` by not taking any action. (#1078) +- The `go.opentelemetry.io/otel/sdk/trace` `NewProvider` function to create a `Provider` no longer returns an error, instead only a `*Provider`. + This change is related to `NewBatchSpanProcessor` not returning an error which was the only error this function would return. (#1078) + +### Removed + +- Duplicate, unused API sampler interface. (#999) + Use the [`Sampler` interface](https://github.com/open-telemetry/opentelemetry-go/blob/v0.11.0/sdk/trace/sampling.go) provided by the SDK instead. +- The `grpctrace` instrumentation was moved to the `go.opentelemetry.io/contrib` repository and out of this repository. + This move includes moving the `grpc` example to the `go.opentelemetry.io/contrib` as well. (#1027) +- The `WithSpan` method of the `Tracer` interface. + The functionality this method provided was limited compared to what a user can provide themselves. + It was removed with the understanding that if there is sufficient user need it can be added back based on actual user usage. (#1043) +- The `RegisterSpanProcessor` and `UnregisterSpanProcessor` functions. + These were holdovers from an approach prior to the TracerProvider design. They were not used anymore. (#1077) +- The `oterror` package. (#1026) +- The `othttp` and `httptrace` instrumentations were moved to `go.opentelemetry.io/contrib`. (#1032) + +### Fixed + +- The `semconv.HTTPServerMetricAttributesFromHTTPRequest()` function no longer generates the high-cardinality `http.request.content.length` label. (#1031) +- Correct instrumentation version tag in Jaeger exporter. (#1037) +- The SDK span will now set an error event if the `End` method is called during a panic (i.e. it was deferred). (#1043) +- Move internally generated protobuf code from the `go.opentelemetry.io/otel` to the OTLP exporter to reduce dependency overhead. (#1050) +- The `otel-collector` example referenced outdated collector processors. (#1006) + +## [0.10.0] - 2020-07-29 + +This release migrates the default OpenTelemetry SDK into its own Go module, decoupling the SDK from the API and reducing dependencies for instrumentation packages. + +### Added + +- The Zipkin exporter now has `NewExportPipeline` and `InstallNewPipeline` constructor functions to match the common pattern. + These function build a new exporter with default SDK options and register the exporter with the `global` package respectively. (#944) +- Add propagator option for gRPC instrumentation. (#986) +- The `testtrace` package now tracks the `trace.SpanKind` for each span. (#987) + +### Changed + +- Replace the `RegisterGlobal` `Option` in the Jaeger exporter with an `InstallNewPipeline` constructor function. + This matches the other exporter constructor patterns and will register a new exporter after building it with default configuration. (#944) +- The trace (`go.opentelemetry.io/otel/exporters/trace/stdout`) and metric (`go.opentelemetry.io/otel/exporters/metric/stdout`) `stdout` exporters are now merged into a single exporter at `go.opentelemetry.io/otel/exporters/stdout`. + This new exporter was made into its own Go module to follow the pattern of all exporters and decouple it from the `go.opentelemetry.io/otel` module. (#956, #963) +- Move the `go.opentelemetry.io/otel/exporters/test` test package to `go.opentelemetry.io/otel/sdk/export/metric/metrictest`. (#962) +- The `go.opentelemetry.io/otel/api/kv/value` package was merged into the parent `go.opentelemetry.io/otel/api/kv` package. (#968) + - `value.Bool` was replaced with `kv.BoolValue`. + - `value.Int64` was replaced with `kv.Int64Value`. + - `value.Uint64` was replaced with `kv.Uint64Value`. + - `value.Float64` was replaced with `kv.Float64Value`. + - `value.Int32` was replaced with `kv.Int32Value`. + - `value.Uint32` was replaced with `kv.Uint32Value`. + - `value.Float32` was replaced with `kv.Float32Value`. + - `value.String` was replaced with `kv.StringValue`. + - `value.Int` was replaced with `kv.IntValue`. + - `value.Uint` was replaced with `kv.UintValue`. + - `value.Array` was replaced with `kv.ArrayValue`. +- Rename `Infer` to `Any` in the `go.opentelemetry.io/otel/api/kv` package. (#972) +- Change `othttp` to use the `httpsnoop` package to wrap the `ResponseWriter` so that optional interfaces (`http.Hijacker`, `http.Flusher`, etc.) that are implemented by the original `ResponseWriter`are also implemented by the wrapped `ResponseWriter`. (#979) +- Rename `go.opentelemetry.io/otel/sdk/metric/aggregator/test` package to `go.opentelemetry.io/otel/sdk/metric/aggregator/aggregatortest`. (#980) +- Make the SDK into its own Go module called `go.opentelemetry.io/otel/sdk`. (#985) +- Changed the default trace `Sampler` from `AlwaysOn` to `ParentOrElse(AlwaysOn)`. (#989) + +### Removed + +- The `IndexedAttribute` function from the `go.opentelemetry.io/otel/api/label` package was removed in favor of `IndexedLabel` which it was synonymous with. (#970) + +### Fixed + +- Bump github.com/golangci/golangci-lint from 1.28.3 to 1.29.0 in /tools. (#953) +- Bump github.com/google/go-cmp from 0.5.0 to 0.5.1. (#957) +- Use `global.Handle` for span export errors in the OTLP exporter. (#946) +- Correct Go language formatting in the README documentation. (#961) +- Remove default SDK dependencies from the `go.opentelemetry.io/otel/api` package. (#977) +- Remove default SDK dependencies from the `go.opentelemetry.io/otel/instrumentation` package. (#983) +- Move documented examples for `go.opentelemetry.io/otel/instrumentation/grpctrace` interceptors into Go example tests. (#984) + +## [0.9.0] - 2020-07-20 + +### Added + +- A new Resource Detector interface is included to allow resources to be automatically detected and included. (#939) +- A Detector to automatically detect resources from an environment variable. (#939) +- Github action to generate protobuf Go bindings locally in `internal/opentelemetry-proto-gen`. (#938) +- OTLP .proto files from `open-telemetry/opentelemetry-proto` imported as a git submodule under `internal/opentelemetry-proto`. + References to `github.com/open-telemetry/opentelemetry-proto` changed to `go.opentelemetry.io/otel/internal/opentelemetry-proto-gen`. (#942) + +### Changed + +- Non-nil value `struct`s for key-value pairs will be marshalled using JSON rather than `Sprintf`. (#948) + +### Removed + +- Removed dependency on `github.com/open-telemetry/opentelemetry-collector`. (#943) + +## [0.8.0] - 2020-07-09 + +### Added + +- The `B3Encoding` type to represent the B3 encoding(s) the B3 propagator can inject. + A value for HTTP supported encodings (Multiple Header: `MultipleHeader`, Single Header: `SingleHeader`) are included. (#882) +- The `FlagsDeferred` trace flag to indicate if the trace sampling decision has been deferred. (#882) +- The `FlagsDebug` trace flag to indicate if the trace is a debug trace. (#882) +- Add `peer.service` semantic attribute. (#898) +- Add database-specific semantic attributes. (#899) +- Add semantic convention for `faas.coldstart` and `container.id`. (#909) +- Add http content size semantic conventions. (#905) +- Include `http.request_content_length` in HTTP request basic attributes. (#905) +- Add semantic conventions for operating system process resource attribute keys. (#919) +- The Jaeger exporter now has a `WithBatchMaxCount` option to specify the maximum number of spans sent in a batch. (#931) + +### Changed + +- Update `CONTRIBUTING.md` to ask for updates to `CHANGELOG.md` with each pull request. (#879) +- Use lowercase header names for B3 Multiple Headers. (#881) +- The B3 propagator `SingleHeader` field has been replaced with `InjectEncoding`. + This new field can be set to combinations of the `B3Encoding` bitmasks and will inject trace information in these encodings. + If no encoding is set, the propagator will default to `MultipleHeader` encoding. (#882) +- The B3 propagator now extracts from either HTTP encoding of B3 (Single Header or Multiple Header) based on what is contained in the header. + Preference is given to Single Header encoding with Multiple Header being the fallback if Single Header is not found or is invalid. + This behavior change is made to dynamically support all correctly encoded traces received instead of having to guess the expected encoding prior to receiving. (#882) +- Extend semantic conventions for RPC. (#900) +- To match constant naming conventions in the `api/standard` package, the `FaaS*` key names are appended with a suffix of `Key`. (#920) + - `"api/standard".FaaSName` -> `FaaSNameKey` + - `"api/standard".FaaSID` -> `FaaSIDKey` + - `"api/standard".FaaSVersion` -> `FaaSVersionKey` + - `"api/standard".FaaSInstance` -> `FaaSInstanceKey` + +### Removed + +- The `FlagsUnused` trace flag is removed. + The purpose of this flag was to act as the inverse of `FlagsSampled`, the inverse of `FlagsSampled` is used instead. (#882) +- The B3 header constants (`B3SingleHeader`, `B3DebugFlagHeader`, `B3TraceIDHeader`, `B3SpanIDHeader`, `B3SampledHeader`, `B3ParentSpanIDHeader`) are removed. + If B3 header keys are needed [the authoritative OpenZipkin package constants](https://pkg.go.dev/github.com/openzipkin/zipkin-go@v0.2.2/propagation/b3?tab=doc#pkg-constants) should be used instead. (#882) + +### Fixed + +- The B3 Single Header name is now correctly `b3` instead of the previous `X-B3`. (#881) +- The B3 propagator now correctly supports sampling only values (`b3: 0`, `b3: 1`, or `b3: d`) for a Single B3 Header. (#882) +- The B3 propagator now propagates the debug flag. + This removes the behavior of changing the debug flag into a set sampling bit. + Instead, this now follow the B3 specification and omits the `X-B3-Sampling` header. (#882) +- The B3 propagator now tracks "unset" sampling state (meaning "defer the decision") and does not set the `X-B3-Sampling` header when injecting. (#882) +- Bump github.com/itchyny/gojq from 0.10.3 to 0.10.4 in /tools. (#883) +- Bump github.com/opentracing/opentracing-go from v1.1.1-0.20190913142402-a7454ce5950e to v1.2.0. (#885) +- The tracing time conversion for OTLP spans is now correctly set to `UnixNano`. (#896) +- Ensure span status is not set to `Unknown` when no HTTP status code is provided as it is assumed to be `200 OK`. (#908) +- Ensure `httptrace.clientTracer` closes `http.headers` span. (#912) +- Prometheus exporter will not apply stale updates or forget inactive metrics. (#903) +- Add test for api.standard `HTTPClientAttributesFromHTTPRequest`. (#905) +- Bump github.com/golangci/golangci-lint from 1.27.0 to 1.28.1 in /tools. (#901, #913) +- Update otel-collector example to use the v0.5.0 collector. (#915) +- The `grpctrace` instrumentation uses a span name conforming to the OpenTelemetry semantic conventions (does not contain a leading slash (`/`)). (#922) +- The `grpctrace` instrumentation includes an `rpc.method` attribute now set to the gRPC method name. (#900, #922) +- The `grpctrace` instrumentation `rpc.service` attribute now contains the package name if one exists. + This is in accordance with OpenTelemetry semantic conventions. (#922) +- Correlation Context extractor will no longer insert an empty map into the returned context when no valid values are extracted. (#923) +- Bump google.golang.org/api from 0.28.0 to 0.29.0 in /exporters/trace/jaeger. (#925) +- Bump github.com/itchyny/gojq from 0.10.4 to 0.11.0 in /tools. (#926) +- Bump github.com/golangci/golangci-lint from 1.28.1 to 1.28.2 in /tools. (#930) + +## [0.7.0] - 2020-06-26 + +This release implements the v0.5.0 version of the OpenTelemetry specification. + +### Added + +- The othttp instrumentation now includes default metrics. (#861) +- This CHANGELOG file to track all changes in the project going forward. +- Support for array type attributes. (#798) +- Apply transitive dependabot go.mod dependency updates as part of a new automatic Github workflow. (#844) +- Timestamps are now passed to exporters for each export. (#835) +- Add new `Accumulation` type to metric SDK to transport telemetry from `Accumulator`s to `Processor`s. + This replaces the prior `Record` `struct` use for this purpose. (#835) +- New dependabot integration to automate package upgrades. (#814) +- `Meter` and `Tracer` implementations accept instrumentation version version as an optional argument. + This instrumentation version is passed on to exporters. (#811) (#805) (#802) +- The OTLP exporter includes the instrumentation version in telemetry it exports. (#811) +- Environment variables for Jaeger exporter are supported. (#796) +- New `aggregation.Kind` in the export metric API. (#808) +- New example that uses OTLP and the collector. (#790) +- Handle errors in the span `SetName` during span initialization. (#791) +- Default service config to enable retries for retry-able failed requests in the OTLP exporter and an option to override this default. (#777) +- New `go.opentelemetry.io/otel/api/oterror` package to uniformly support error handling and definitions for the project. (#778) +- New `global` default implementation of the `go.opentelemetry.io/otel/api/oterror.Handler` interface to be used to handle errors prior to an user defined `Handler`. + There is also functionality for the user to register their `Handler` as well as a convenience function `Handle` to handle an error with this global `Handler`(#778) +- Options to specify propagators for httptrace and grpctrace instrumentation. (#784) +- The required `application/json` header for the Zipkin exporter is included in all exports. (#774) +- Integrate HTTP semantics helpers from the contrib repository into the `api/standard` package. #769 + +### Changed + +- Rename `Integrator` to `Processor` in the metric SDK. (#863) +- Rename `AggregationSelector` to `AggregatorSelector`. (#859) +- Rename `SynchronizedCopy` to `SynchronizedMove`. (#858) +- Rename `simple` integrator to `basic` integrator. (#857) +- Merge otlp collector examples. (#841) +- Change the metric SDK to support cumulative, delta, and pass-through exporters directly. + With these changes, cumulative and delta specific exporters are able to request the correct kind of aggregation from the SDK. (#840) +- The `Aggregator.Checkpoint` API is renamed to `SynchronizedCopy` and adds an argument, a different `Aggregator` into which the copy is stored. (#812) +- The `export.Aggregator` contract is that `Update()` and `SynchronizedCopy()` are synchronized with each other. + All the aggregation interfaces (`Sum`, `LastValue`, ...) are not meant to be synchronized, as the caller is expected to synchronize aggregators at a higher level after the `Accumulator`. + Some of the `Aggregators` used unnecessary locking and that has been cleaned up. (#812) +- Use of `metric.Number` was replaced by `int64` now that we use `sync.Mutex` in the `MinMaxSumCount` and `Histogram` `Aggregators`. (#812) +- Replace `AlwaysParentSample` with `ParentSample(fallback)` to match the OpenTelemetry v0.5.0 specification. (#810) +- Rename `sdk/export/metric/aggregator` to `sdk/export/metric/aggregation`. #808 +- Send configured headers with every request in the OTLP exporter, instead of just on connection creation. (#806) +- Update error handling for any one off error handlers, replacing, instead, with the `global.Handle` function. (#791) +- Rename `plugin` directory to `instrumentation` to match the OpenTelemetry specification. (#779) +- Makes the argument order to Histogram and DDSketch `New()` consistent. (#781) + +### Removed + +- `Uint64NumberKind` and related functions from the API. (#864) +- Context arguments from `Aggregator.Checkpoint` and `Integrator.Process` as they were unused. (#803) +- `SpanID` is no longer included in parameters for sampling decision to match the OpenTelemetry specification. (#775) + +### Fixed + +- Upgrade OTLP exporter to opentelemetry-proto matching the opentelemetry-collector v0.4.0 release. (#866) +- Allow changes to `go.sum` and `go.mod` when running dependabot tidy-up. (#871) +- Bump github.com/stretchr/testify from 1.4.0 to 1.6.1. (#824) +- Bump github.com/prometheus/client_golang from 1.7.0 to 1.7.1 in /exporters/metric/prometheus. (#867) +- Bump google.golang.org/grpc from 1.29.1 to 1.30.0 in /exporters/trace/jaeger. (#853) +- Bump google.golang.org/grpc from 1.29.1 to 1.30.0 in /exporters/trace/zipkin. (#854) +- Bumps github.com/golang/protobuf from 1.3.2 to 1.4.2 (#848) +- Bump github.com/stretchr/testify from 1.4.0 to 1.6.1 in /exporters/otlp (#817) +- Bump github.com/golangci/golangci-lint from 1.25.1 to 1.27.0 in /tools (#828) +- Bump github.com/prometheus/client_golang from 1.5.0 to 1.7.0 in /exporters/metric/prometheus (#838) +- Bump github.com/stretchr/testify from 1.4.0 to 1.6.1 in /exporters/trace/jaeger (#829) +- Bump github.com/benbjohnson/clock from 1.0.0 to 1.0.3 (#815) +- Bump github.com/stretchr/testify from 1.4.0 to 1.6.1 in /exporters/trace/zipkin (#823) +- Bump github.com/itchyny/gojq from 0.10.1 to 0.10.3 in /tools (#830) +- Bump github.com/stretchr/testify from 1.4.0 to 1.6.1 in /exporters/metric/prometheus (#822) +- Bump google.golang.org/grpc from 1.27.1 to 1.29.1 in /exporters/trace/zipkin (#820) +- Bump google.golang.org/grpc from 1.27.1 to 1.29.1 in /exporters/trace/jaeger (#831) +- Bump github.com/google/go-cmp from 0.4.0 to 0.5.0 (#836) +- Bump github.com/google/go-cmp from 0.4.0 to 0.5.0 in /exporters/trace/jaeger (#837) +- Bump github.com/google/go-cmp from 0.4.0 to 0.5.0 in /exporters/otlp (#839) +- Bump google.golang.org/api from 0.20.0 to 0.28.0 in /exporters/trace/jaeger (#843) +- Set span status from HTTP status code in the othttp instrumentation. (#832) +- Fixed typo in push controller comment. (#834) +- The `Aggregator` testing has been updated and cleaned. (#812) +- `metric.Number(0)` expressions are replaced by `0` where possible. (#812) +- Fixed `global` `handler_test.go` test failure. #804 +- Fixed `BatchSpanProcessor.Shutdown` to wait until all spans are processed. (#766) +- Fixed OTLP example's accidental early close of exporter. (#807) +- Ensure zipkin exporter reads and closes response body. (#788) +- Update instrumentation to use `api/standard` keys instead of custom keys. (#782) +- Clean up tools and RELEASING documentation. (#762) + +## [0.6.0] - 2020-05-21 + +### Added + +- Support for `Resource`s in the prometheus exporter. (#757) +- New pull controller. (#751) +- New `UpDownSumObserver` instrument. (#750) +- OpenTelemetry collector demo. (#711) +- New `SumObserver` instrument. (#747) +- New `UpDownCounter` instrument. (#745) +- New timeout `Option` and configuration function `WithTimeout` to the push controller. (#742) +- New `api/standards` package to implement semantic conventions and standard key-value generation. (#731) + +### Changed + +- Rename `Register*` functions in the metric API to `New*` for all `Observer` instruments. (#761) +- Use `[]float64` for histogram boundaries, not `[]metric.Number`. (#758) +- Change OTLP example to use exporter as a trace `Syncer` instead of as an unneeded `Batcher`. (#756) +- Replace `WithResourceAttributes()` with `WithResource()` in the trace SDK. (#754) +- The prometheus exporter now uses the new pull controller. (#751) +- Rename `ScheduleDelayMillis` to `BatchTimeout` in the trace `BatchSpanProcessor`.(#752) +- Support use of synchronous instruments in asynchronous callbacks (#725) +- Move `Resource` from the `Export` method parameter into the metric export `Record`. (#739) +- Rename `Observer` instrument to `ValueObserver`. (#734) +- The push controller now has a method (`Provider()`) to return a `metric.Provider` instead of the old `Meter` method that acted as a `metric.Provider`. (#738) +- Replace `Measure` instrument by `ValueRecorder` instrument. (#732) +- Rename correlation context header from `"Correlation-Context"` to `"otcorrelations"` to match the OpenTelemetry specification. (#727) + +### Fixed + +- Ensure gRPC `ClientStream` override methods do not panic in grpctrace package. (#755) +- Disable parts of `BatchSpanProcessor` test until a fix is found. (#743) +- Fix `string` case in `kv` `Infer` function. (#746) +- Fix panic in grpctrace client interceptors. (#740) +- Refactor the `api/metrics` push controller and add `CheckpointSet` synchronization. (#737) +- Rewrite span batch process queue batching logic. (#719) +- Remove the push controller named Meter map. (#738) +- Fix Histogram aggregator initial state (fix #735). (#736) +- Ensure golang alpine image is running `golang-1.14` for examples. (#733) +- Added test for grpctrace `UnaryInterceptorClient`. (#695) +- Rearrange `api/metric` code layout. (#724) + +## [0.5.0] - 2020-05-13 + +### Added + +- Batch `Observer` callback support. (#717) +- Alias `api` types to root package of project. (#696) +- Create basic `othttp.Transport` for simple client instrumentation. (#678) +- `SetAttribute(string, interface{})` to the trace API. (#674) +- Jaeger exporter option that allows user to specify custom http client. (#671) +- `Stringer` and `Infer` methods to `key`s. (#662) + +### Changed + +- Rename `NewKey` in the `kv` package to just `Key`. (#721) +- Move `core` and `key` to `kv` package. (#720) +- Make the metric API `Meter` a `struct` so the abstract `MeterImpl` can be passed and simplify implementation. (#709) +- Rename SDK `Batcher` to `Integrator` to match draft OpenTelemetry SDK specification. (#710) +- Rename SDK `Ungrouped` integrator to `simple.Integrator` to match draft OpenTelemetry SDK specification. (#710) +- Rename SDK `SDK` `struct` to `Accumulator` to match draft OpenTelemetry SDK specification. (#710) +- Move `Number` from `core` to `api/metric` package. (#706) +- Move `SpanContext` from `core` to `trace` package. (#692) +- Change traceparent header from `Traceparent` to `traceparent` to implement the W3C specification. (#681) + +### Fixed + +- Update tooling to run generators in all submodules. (#705) +- gRPC interceptor regexp to match methods without a service name. (#683) +- Use a `const` for padding 64-bit B3 trace IDs. (#701) +- Update `mockZipkin` listen address from `:0` to `127.0.0.1:0`. (#700) +- Left-pad 64-bit B3 trace IDs with zero. (#698) +- Propagate at least the first W3C tracestate header. (#694) +- Remove internal `StateLocker` implementation. (#688) +- Increase instance size CI system uses. (#690) +- Add a `key` benchmark and use reflection in `key.Infer()`. (#679) +- Fix internal `global` test by using `global.Meter` with `RecordBatch()`. (#680) +- Reimplement histogram using mutex instead of `StateLocker`. (#669) +- Switch `MinMaxSumCount` to a mutex lock implementation instead of `StateLocker`. (#667) +- Update documentation to not include any references to `WithKeys`. (#672) +- Correct misspelling. (#668) +- Fix clobbering of the span context if extraction fails. (#656) +- Bump `golangci-lint` and work around the corrupting bug. (#666) (#670) + +## [0.4.3] - 2020-04-24 + +### Added + +- `Dockerfile` and `docker-compose.yml` to run example code. (#635) +- New `grpctrace` package that provides gRPC client and server interceptors for both unary and stream connections. (#621) +- New `api/label` package, providing common label set implementation. (#651) +- Support for JSON marshaling of `Resources`. (#654) +- `TraceID` and `SpanID` implementations for `Stringer` interface. (#642) +- `RemoteAddrKey` in the othttp plugin to include the HTTP client address in top-level spans. (#627) +- `WithSpanFormatter` option to the othttp plugin. (#617) +- Updated README to include section for compatible libraries and include reference to the contrib repository. (#612) +- The prometheus exporter now supports exporting histograms. (#601) +- A `String` method to the `Resource` to return a hashable identifier for a now unique resource. (#613) +- An `Iter` method to the `Resource` to return an array `AttributeIterator`. (#613) +- An `Equal` method to the `Resource` test the equivalence of resources. (#613) +- An iterable structure (`AttributeIterator`) for `Resource` attributes. + +### Changed + +- zipkin export's `NewExporter` now requires a `serviceName` argument to ensure this needed values is provided. (#644) +- Pass `Resources` through the metrics export pipeline. (#659) + +### Removed + +- `WithKeys` option from the metric API. (#639) + +### Fixed + +- Use the `label.Set.Equivalent` value instead of an encoding in the batcher. (#658) +- Correct typo `trace.Exporter` to `trace.SpanSyncer` in comments. (#653) +- Use type names for return values in jaeger exporter. (#648) +- Increase the visibility of the `api/key` package by updating comments and fixing usages locally. (#650) +- `Checkpoint` only after `Update`; Keep records in the `sync.Map` longer. (#647) +- Do not cache `reflect.ValueOf()` in metric Labels. (#649) +- Batch metrics exported from the OTLP exporter based on `Resource` and labels. (#626) +- Add error wrapping to the prometheus exporter. (#631) +- Update the OTLP exporter batching of traces to use a unique `string` representation of an associated `Resource` as the batching key. (#623) +- Update OTLP `SpanData` transform to only include the `ParentSpanID` if one exists. (#614) +- Update `Resource` internal representation to uniquely and reliably identify resources. (#613) +- Check return value from `CheckpointSet.ForEach` in prometheus exporter. (#622) +- Ensure spans created by httptrace client tracer reflect operation structure. (#618) +- Create a new recorder rather than reuse when multiple observations in same epoch for asynchronous instruments. #610 +- The default port the OTLP exporter uses to connect to the OpenTelemetry collector is updated to match the one the collector listens on by default. (#611) + +## [0.4.2] - 2020-03-31 + +### Fixed + +- Fix `pre_release.sh` to update version in `sdk/opentelemetry.go`. (#607) +- Fix time conversion from internal to OTLP in OTLP exporter. (#606) + +## [0.4.1] - 2020-03-31 + +### Fixed + +- Update `tag.sh` to create signed tags. (#604) + +## [0.4.0] - 2020-03-30 + +### Added + +- New API package `api/metric/registry` that exposes a `MeterImpl` wrapper for use by SDKs to generate unique instruments. (#580) +- Script to verify examples after a new release. (#579) + +### Removed + +- The dogstatsd exporter due to lack of support. + This additionally removes support for statsd. (#591) +- `LabelSet` from the metric API. + This is replaced by a `[]core.KeyValue` slice. (#595) +- `Labels` from the metric API's `Meter` interface. (#595) + +### Changed + +- The metric `export.Labels` became an interface which the SDK implements and the `export` package provides a simple, immutable implementation of this interface intended for testing purposes. (#574) +- Renamed `internal/metric.Meter` to `MeterImpl`. (#580) +- Renamed `api/global/internal.obsImpl` to `asyncImpl`. (#580) + +### Fixed + +- Corrected missing return in mock span. (#582) +- Update License header for all source files to match CNCF guidelines and include a test to ensure it is present. (#586) (#596) +- Update to v0.3.0 of the OTLP in the OTLP exporter. (#588) +- Update pre-release script to be compatible between GNU and BSD based systems. (#592) +- Add a `RecordBatch` benchmark. (#594) +- Moved span transforms of the OTLP exporter to the internal package. (#593) +- Build both go-1.13 and go-1.14 in circleci to test for all supported versions of Go. (#569) +- Removed unneeded allocation on empty labels in OLTP exporter. (#597) +- Update `BatchedSpanProcessor` to process the queue until no data but respect max batch size. (#599) +- Update project documentation godoc.org links to pkg.go.dev. (#602) + +## [0.3.0] - 2020-03-21 + +This is a first official beta release, which provides almost fully complete metrics, tracing, and context propagation functionality. +There is still a possibility of breaking changes. + +### Added + +- Add `Observer` metric instrument. (#474) +- Add global `Propagators` functionality to enable deferred initialization for propagators registered before the first Meter SDK is installed. (#494) +- Simplified export setup pipeline for the jaeger exporter to match other exporters. (#459) +- The zipkin trace exporter. (#495) +- The OTLP exporter to export metric and trace telemetry to the OpenTelemetry collector. (#497) (#544) (#545) +- Add `StatusMessage` field to the trace `Span`. (#524) +- Context propagation in OpenTracing bridge in terms of OpenTelemetry context propagation. (#525) +- The `Resource` type was added to the SDK. (#528) +- The global API now supports a `Tracer` and `Meter` function as shortcuts to getting a global `*Provider` and calling these methods directly. (#538) +- The metric API now defines a generic `MeterImpl` interface to support general purpose `Meter` construction. + Additionally, `SyncImpl` and `AsyncImpl` are added to support general purpose instrument construction. (#560) +- A metric `Kind` is added to represent the `MeasureKind`, `ObserverKind`, and `CounterKind`. (#560) +- Scripts to better automate the release process. (#576) + +### Changed + +- Default to to use `AlwaysSampler` instead of `ProbabilitySampler` to match OpenTelemetry specification. (#506) +- Renamed `AlwaysSampleSampler` to `AlwaysOnSampler` in the trace API. (#511) +- Renamed `NeverSampleSampler` to `AlwaysOffSampler` in the trace API. (#511) +- The `Status` field of the `Span` was changed to `StatusCode` to disambiguate with the added `StatusMessage`. (#524) +- Updated the trace `Sampler` interface conform to the OpenTelemetry specification. (#531) +- Rename metric API `Options` to `Config`. (#541) +- Rename metric `Counter` aggregator to be `Sum`. (#541) +- Unify metric options into `Option` from instrument specific options. (#541) +- The trace API's `TraceProvider` now support `Resource`s. (#545) +- Correct error in zipkin module name. (#548) +- The jaeger trace exporter now supports `Resource`s. (#551) +- Metric SDK now supports `Resource`s. + The `WithResource` option was added to configure a `Resource` on creation and the `Resource` method was added to the metric `Descriptor` to return the associated `Resource`. (#552) +- Replace `ErrNoLastValue` and `ErrEmptyDataSet` by `ErrNoData` in the metric SDK. (#557) +- The stdout trace exporter now supports `Resource`s. (#558) +- The metric `Descriptor` is now included at the API instead of the SDK. (#560) +- Replace `Ordered` with an iterator in `export.Labels`. (#567) + +### Removed + +- The vendor specific Stackdriver. It is now hosted on 3rd party vendor infrastructure. (#452) +- The `Unregister` method for metric observers as it is not in the OpenTelemetry specification. (#560) +- `GetDescriptor` from the metric SDK. (#575) +- The `Gauge` instrument from the metric API. (#537) + +### Fixed + +- Make histogram aggregator checkpoint consistent. (#438) +- Update README with import instructions and how to build and test. (#505) +- The default label encoding was updated to be unique. (#508) +- Use `NewRoot` in the othttp plugin for public endpoints. (#513) +- Fix data race in `BatchedSpanProcessor`. (#518) +- Skip test-386 for Mac OS 10.15.x (Catalina and upwards). #521 +- Use a variable-size array to represent ordered labels in maps. (#523) +- Update the OTLP protobuf and update changed import path. (#532) +- Use `StateLocker` implementation in `MinMaxSumCount`. (#546) +- Eliminate goroutine leak in histogram stress test. (#547) +- Update OTLP exporter with latest protobuf. (#550) +- Add filters to the othttp plugin. (#556) +- Provide an implementation of the `Header*` filters that do not depend on Go 1.14. (#565) +- Encode labels once during checkpoint. + The checkpoint function is executed in a single thread so we can do the encoding lazily before passing the encoded version of labels to the exporter. + This is a cheap and quick way to avoid encoding the labels on every collection interval. (#572) +- Run coverage over all packages in `COVERAGE_MOD_DIR`. (#573) + +## [0.2.3] - 2020-03-04 + +### Added + +- `RecordError` method on `Span`s in the trace API to Simplify adding error events to spans. (#473) +- Configurable push frequency for exporters setup pipeline. (#504) + +### Changed + +- Rename the `exporter` directory to `exporters`. + The `go.opentelemetry.io/otel/exporter/trace/jaeger` package was mistakenly released with a `v1.0.0` tag instead of `v0.1.0`. + This resulted in all subsequent releases not becoming the default latest. + A consequence of this was that all `go get`s pulled in the incompatible `v0.1.0` release of that package when pulling in more recent packages from other otel packages. + Renaming the `exporter` directory to `exporters` fixes this issue by renaming the package and therefore clearing any existing dependency tags. + Consequentially, this action also renames *all* exporter packages. (#502) + +### Removed + +- The `CorrelationContextHeader` constant in the `correlation` package is no longer exported. (#503) + +## [0.2.2] - 2020-02-27 + +### Added + +- `HTTPSupplier` interface in the propagation API to specify methods to retrieve and store a single value for a key to be associated with a carrier. (#467) +- `HTTPExtractor` interface in the propagation API to extract information from an `HTTPSupplier` into a context. (#467) +- `HTTPInjector` interface in the propagation API to inject information into an `HTTPSupplier.` (#467) +- `Config` and configuring `Option` to the propagator API. (#467) +- `Propagators` interface in the propagation API to contain the set of injectors and extractors for all supported carrier formats. (#467) +- `HTTPPropagator` interface in the propagation API to inject and extract from an `HTTPSupplier.` (#467) +- `WithInjectors` and `WithExtractors` functions to the propagator API to configure injectors and extractors to use. (#467) +- `ExtractHTTP` and `InjectHTTP` functions to apply configured HTTP extractors and injectors to a passed context. (#467) +- Histogram aggregator. (#433) +- `DefaultPropagator` function and have it return `trace.TraceContext` as the default context propagator. (#456) +- `AlwaysParentSample` sampler to the trace API. (#455) +- `WithNewRoot` option function to the trace API to specify the created span should be considered a root span. (#451) + +### Changed + +- Renamed `WithMap` to `ContextWithMap` in the correlation package. (#481) +- Renamed `FromContext` to `MapFromContext` in the correlation package. (#481) +- Move correlation context propagation to correlation package. (#479) +- Do not default to putting remote span context into links. (#480) +- `Tracer.WithSpan` updated to accept `StartOptions`. (#472) +- Renamed `MetricKind` to `Kind` to not stutter in the type usage. (#432) +- Renamed the `export` package to `metric` to match directory structure. (#432) +- Rename the `api/distributedcontext` package to `api/correlation`. (#444) +- Rename the `api/propagators` package to `api/propagation`. (#444) +- Move the propagators from the `propagators` package into the `trace` API package. (#444) +- Update `Float64Gauge`, `Int64Gauge`, `Float64Counter`, `Int64Counter`, `Float64Measure`, and `Int64Measure` metric methods to use value receivers instead of pointers. (#462) +- Moved all dependencies of tools package to a tools directory. (#466) + +### Removed + +- Binary propagators. (#467) +- NOOP propagator. (#467) + +### Fixed + +- Upgraded `github.com/golangci/golangci-lint` from `v1.21.0` to `v1.23.6` in `tools/`. (#492) +- Fix a possible nil-dereference crash (#478) +- Correct comments for `InstallNewPipeline` in the stdout exporter. (#483) +- Correct comments for `InstallNewPipeline` in the dogstatsd exporter. (#484) +- Correct comments for `InstallNewPipeline` in the prometheus exporter. (#482) +- Initialize `onError` based on `Config` in prometheus exporter. (#486) +- Correct module name in prometheus exporter README. (#475) +- Removed tracer name prefix from span names. (#430) +- Fix `aggregator_test.go` import package comment. (#431) +- Improved detail in stdout exporter. (#436) +- Fix a dependency issue (generate target should depend on stringer, not lint target) in Makefile. (#442) +- Reorders the Makefile targets within `precommit` target so we generate files and build the code before doing linting, so we can get much nicer errors about syntax errors from the compiler. (#442) +- Reword function documentation in gRPC plugin. (#446) +- Send the `span.kind` tag to Jaeger from the jaeger exporter. (#441) +- Fix `metadataSupplier` in the jaeger exporter to overwrite the header if existing instead of appending to it. (#441) +- Upgraded to Go 1.13 in CI. (#465) +- Correct opentelemetry.io URL in trace SDK documentation. (#464) +- Refactored reference counting logic in SDK determination of stale records. (#468) +- Add call to `runtime.Gosched` in instrument `acquireHandle` logic to not block the collector. (#469) + +## [0.2.1.1] - 2020-01-13 + +### Fixed + +- Use stateful batcher on Prometheus exporter fixing regression introduced in #395. (#428) + +## [0.2.1] - 2020-01-08 + +### Added + +- Global meter forwarding implementation. + This enables deferred initialization for metric instruments registered before the first Meter SDK is installed. (#392) +- Global trace forwarding implementation. + This enables deferred initialization for tracers registered before the first Trace SDK is installed. (#406) +- Standardize export pipeline creation in all exporters. (#395) +- A testing, organization, and comments for 64-bit field alignment. (#418) +- Script to tag all modules in the project. (#414) + +### Changed + +- Renamed `propagation` package to `propagators`. (#362) +- Renamed `B3Propagator` propagator to `B3`. (#362) +- Renamed `TextFormatPropagator` propagator to `TextFormat`. (#362) +- Renamed `BinaryPropagator` propagator to `Binary`. (#362) +- Renamed `BinaryFormatPropagator` propagator to `BinaryFormat`. (#362) +- Renamed `NoopTextFormatPropagator` propagator to `NoopTextFormat`. (#362) +- Renamed `TraceContextPropagator` propagator to `TraceContext`. (#362) +- Renamed `SpanOption` to `StartOption` in the trace API. (#369) +- Renamed `StartOptions` to `StartConfig` in the trace API. (#369) +- Renamed `EndOptions` to `EndConfig` in the trace API. (#369) +- `Number` now has a pointer receiver for its methods. (#375) +- Renamed `CurrentSpan` to `SpanFromContext` in the trace API. (#379) +- Renamed `SetCurrentSpan` to `ContextWithSpan` in the trace API. (#379) +- Renamed `Message` in Event to `Name` in the trace API. (#389) +- Prometheus exporter no longer aggregates metrics, instead it only exports them. (#385) +- Renamed `HandleImpl` to `BoundInstrumentImpl` in the metric API. (#400) +- Renamed `Float64CounterHandle` to `Float64CounterBoundInstrument` in the metric API. (#400) +- Renamed `Int64CounterHandle` to `Int64CounterBoundInstrument` in the metric API. (#400) +- Renamed `Float64GaugeHandle` to `Float64GaugeBoundInstrument` in the metric API. (#400) +- Renamed `Int64GaugeHandle` to `Int64GaugeBoundInstrument` in the metric API. (#400) +- Renamed `Float64MeasureHandle` to `Float64MeasureBoundInstrument` in the metric API. (#400) +- Renamed `Int64MeasureHandle` to `Int64MeasureBoundInstrument` in the metric API. (#400) +- Renamed `Release` method for bound instruments in the metric API to `Unbind`. (#400) +- Renamed `AcquireHandle` method for bound instruments in the metric API to `Bind`. (#400) +- Renamed the `File` option in the stdout exporter to `Writer`. (#404) +- Renamed all `Options` to `Config` for all metric exports where this wasn't already the case. + +### Fixed + +- Aggregator import path corrected. (#421) +- Correct links in README. (#368) +- The README was updated to match latest code changes in its examples. (#374) +- Don't capitalize error statements. (#375) +- Fix ignored errors. (#375) +- Fix ambiguous variable naming. (#375) +- Removed unnecessary type casting. (#375) +- Use named parameters. (#375) +- Updated release schedule. (#378) +- Correct http-stackdriver example module name. (#394) +- Removed the `http.request` span in `httptrace` package. (#397) +- Add comments in the metrics SDK (#399) +- Initialize checkpoint when creating ddsketch aggregator to prevent panic when merging into a empty one. (#402) (#403) +- Add documentation of compatible exporters in the README. (#405) +- Typo fix. (#408) +- Simplify span check logic in SDK tracer implementation. (#419) + +## [0.2.0] - 2019-12-03 + +### Added + +- Unary gRPC tracing example. (#351) +- Prometheus exporter. (#334) +- Dogstatsd metrics exporter. (#326) + +### Changed + +- Rename `MaxSumCount` aggregation to `MinMaxSumCount` and add the `Min` interface for this aggregation. (#352) +- Rename `GetMeter` to `Meter`. (#357) +- Rename `HTTPTraceContextPropagator` to `TraceContextPropagator`. (#355) +- Rename `HTTPB3Propagator` to `B3Propagator`. (#355) +- Rename `HTTPTraceContextPropagator` to `TraceContextPropagator`. (#355) +- Move `/global` package to `/api/global`. (#356) +- Rename `GetTracer` to `Tracer`. (#347) + +### Removed + +- `SetAttribute` from the `Span` interface in the trace API. (#361) +- `AddLink` from the `Span` interface in the trace API. (#349) +- `Link` from the `Span` interface in the trace API. (#349) + +### Fixed + +- Exclude example directories from coverage report. (#365) +- Lint make target now implements automatic fixes with `golangci-lint` before a second run to report the remaining issues. (#360) +- Drop `GO111MODULE` environment variable in Makefile as Go 1.13 is the project specified minimum version and this is environment variable is not needed for that version of Go. (#359) +- Run the race checker for all test. (#354) +- Redundant commands in the Makefile are removed. (#354) +- Split the `generate` and `lint` targets of the Makefile. (#354) +- Renames `circle-ci` target to more generic `ci` in Makefile. (#354) +- Add example Prometheus binary to gitignore. (#358) +- Support negative numbers with the `MaxSumCount`. (#335) +- Resolve race conditions in `push_test.go` identified in #339. (#340) +- Use `/usr/bin/env bash` as a shebang in scripts rather than `/bin/bash`. (#336) +- Trace benchmark now tests both `AlwaysSample` and `NeverSample`. + Previously it was testing `AlwaysSample` twice. (#325) +- Trace benchmark now uses a `[]byte` for `TraceID` to fix failing test. (#325) +- Added a trace benchmark to test variadic functions in `setAttribute` vs `setAttributes` (#325) +- The `defaultkeys` batcher was only using the encoded label set as its map key while building a checkpoint. + This allowed distinct label sets through, but any metrics sharing a label set could be overwritten or merged incorrectly. + This was corrected. (#333) + +## [0.1.2] - 2019-11-18 + +### Fixed + +- Optimized the `simplelru` map for attributes to reduce the number of allocations. (#328) +- Removed unnecessary unslicing of parameters that are already a slice. (#324) + +## [0.1.1] - 2019-11-18 + +This release contains a Metrics SDK with stdout exporter and supports basic aggregations such as counter, gauges, array, maxsumcount, and ddsketch. + +### Added + +- Metrics stdout export pipeline. (#265) +- Array aggregation for raw measure metrics. (#282) +- The core.Value now have a `MarshalJSON` method. (#281) + +### Removed + +- `WithService`, `WithResources`, and `WithComponent` methods of tracers. (#314) +- Prefix slash in `Tracer.Start()` for the Jaeger example. (#292) + +### Changed + +- Allocation in LabelSet construction to reduce GC overhead. (#318) +- `trace.WithAttributes` to append values instead of replacing (#315) +- Use a formula for tolerance in sampling tests. (#298) +- Move export types into trace and metric-specific sub-directories. (#289) +- `SpanKind` back to being based on an `int` type. (#288) + +### Fixed + +- URL to OpenTelemetry website in README. (#323) +- Name of othttp default tracer. (#321) +- `ExportSpans` for the stackdriver exporter now handles `nil` context. (#294) +- CI modules cache to correctly restore/save from/to the cache. (#316) +- Fix metric SDK race condition between `LoadOrStore` and the assignment `rec.recorder = i.meter.exporter.AggregatorFor(rec)`. (#293) +- README now reflects the new code structure introduced with these changes. (#291) +- Make the basic example work. (#279) + +## [0.1.0] - 2019-11-04 + +This is the first release of open-telemetry go library. +It contains api and sdk for trace and meter. + +### Added + +- Initial OpenTelemetry trace and metric API prototypes. +- Initial OpenTelemetry trace, metric, and export SDK packages. +- A wireframe bridge to support compatibility with OpenTracing. +- Example code for a basic, http-stackdriver, http, jaeger, and named tracer setup. +- Exporters for Jaeger, Stackdriver, and stdout. +- Propagators for binary, B3, and trace-context protocols. +- Project information and guidelines in the form of a README and CONTRIBUTING. +- Tools to build the project and a Makefile to automate the process. +- Apache-2.0 license. +- CircleCI build CI manifest files. +- CODEOWNERS file to track owners of this project. + +[Unreleased]: https://github.com/open-telemetry/opentelemetry-go/compare/v1.43.0...HEAD +[1.43.0/0.65.0/0.19.0]: https://github.com/open-telemetry/opentelemetry-go/releases/tag/v1.43.0 +[1.42.0/0.64.0/0.18.0/0.0.16]: https://github.com/open-telemetry/opentelemetry-go/releases/tag/v1.42.0 +[1.41.0/0.63.0/0.17.0/0.0.15]: https://github.com/open-telemetry/opentelemetry-go/releases/tag/v1.41.0 +[1.40.0/0.62.0/0.16.0]: https://github.com/open-telemetry/opentelemetry-go/releases/tag/v1.40.0 +[1.39.0/0.61.0/0.15.0/0.0.14]: https://github.com/open-telemetry/opentelemetry-go/releases/tag/v1.39.0 +[1.38.0/0.60.0/0.14.0/0.0.13]: https://github.com/open-telemetry/opentelemetry-go/releases/tag/v1.38.0 +[0.59.1]: https://github.com/open-telemetry/opentelemetry-go/releases/tag/exporters/prometheus/v0.59.1 +[1.37.0/0.59.0/0.13.0]: https://github.com/open-telemetry/opentelemetry-go/releases/tag/v1.37.0 +[0.12.2]: https://github.com/open-telemetry/opentelemetry-go/releases/tag/log/v0.12.2 +[0.12.1]: https://github.com/open-telemetry/opentelemetry-go/releases/tag/log/v0.12.1 +[1.36.0/0.58.0/0.12.0]: https://github.com/open-telemetry/opentelemetry-go/releases/tag/v1.36.0 +[1.35.0/0.57.0/0.11.0]: https://github.com/open-telemetry/opentelemetry-go/releases/tag/v1.35.0 +[1.34.0/0.56.0/0.10.0]: https://github.com/open-telemetry/opentelemetry-go/releases/tag/v1.34.0 +[1.33.0/0.55.0/0.9.0/0.0.12]: https://github.com/open-telemetry/opentelemetry-go/releases/tag/v1.33.0 +[1.32.0/0.54.0/0.8.0/0.0.11]: https://github.com/open-telemetry/opentelemetry-go/releases/tag/v1.32.0 +[1.31.0/0.53.0/0.7.0/0.0.10]: https://github.com/open-telemetry/opentelemetry-go/releases/tag/v1.31.0 +[1.30.0/0.52.0/0.6.0/0.0.9]: https://github.com/open-telemetry/opentelemetry-go/releases/tag/v1.30.0 +[1.29.0/0.51.0/0.5.0]: https://github.com/open-telemetry/opentelemetry-go/releases/tag/v1.29.0 +[1.28.0/0.50.0/0.4.0]: https://github.com/open-telemetry/opentelemetry-go/releases/tag/v1.28.0 +[1.27.0/0.49.0/0.3.0]: https://github.com/open-telemetry/opentelemetry-go/releases/tag/v1.27.0 +[1.26.0/0.48.0/0.2.0-alpha]: https://github.com/open-telemetry/opentelemetry-go/releases/tag/v1.26.0 +[1.25.0/0.47.0/0.0.8/0.1.0-alpha]: https://github.com/open-telemetry/opentelemetry-go/releases/tag/v1.25.0 +[1.24.0/0.46.0/0.0.1-alpha]: https://github.com/open-telemetry/opentelemetry-go/releases/tag/v1.24.0 +[1.23.1]: https://github.com/open-telemetry/opentelemetry-go/releases/tag/v1.23.1 +[1.23.0]: https://github.com/open-telemetry/opentelemetry-go/releases/tag/v1.23.0 +[1.23.0-rc.1]: https://github.com/open-telemetry/opentelemetry-go/releases/tag/v1.23.0-rc.1 +[1.22.0/0.45.0]: https://github.com/open-telemetry/opentelemetry-go/releases/tag/v1.22.0 +[1.21.0/0.44.0]: https://github.com/open-telemetry/opentelemetry-go/releases/tag/v1.21.0 +[1.20.0/0.43.0]: https://github.com/open-telemetry/opentelemetry-go/releases/tag/v1.20.0 +[1.19.0/0.42.0/0.0.7]: https://github.com/open-telemetry/opentelemetry-go/releases/tag/v1.19.0 +[1.19.0-rc.1/0.42.0-rc.1]: https://github.com/open-telemetry/opentelemetry-go/releases/tag/v1.19.0-rc.1 +[1.18.0/0.41.0/0.0.6]: https://github.com/open-telemetry/opentelemetry-go/releases/tag/v1.18.0 +[1.17.0/0.40.0/0.0.5]: https://github.com/open-telemetry/opentelemetry-go/releases/tag/v1.17.0 +[1.16.0/0.39.0]: https://github.com/open-telemetry/opentelemetry-go/releases/tag/v1.16.0 +[1.16.0-rc.1/0.39.0-rc.1]: https://github.com/open-telemetry/opentelemetry-go/releases/tag/v1.16.0-rc.1 +[1.15.1/0.38.1]: https://github.com/open-telemetry/opentelemetry-go/releases/tag/v1.15.1 +[1.15.0/0.38.0]: https://github.com/open-telemetry/opentelemetry-go/releases/tag/v1.15.0 +[1.15.0-rc.2/0.38.0-rc.2]: https://github.com/open-telemetry/opentelemetry-go/releases/tag/v1.15.0-rc.2 +[1.15.0-rc.1/0.38.0-rc.1]: https://github.com/open-telemetry/opentelemetry-go/releases/tag/v1.15.0-rc.1 +[1.14.0/0.37.0/0.0.4]: https://github.com/open-telemetry/opentelemetry-go/releases/tag/v1.14.0 +[1.13.0/0.36.0]: https://github.com/open-telemetry/opentelemetry-go/releases/tag/v1.13.0 +[1.12.0/0.35.0]: https://github.com/open-telemetry/opentelemetry-go/releases/tag/v1.12.0 +[1.11.2/0.34.0]: https://github.com/open-telemetry/opentelemetry-go/releases/tag/v1.11.2 +[1.11.1/0.33.0]: https://github.com/open-telemetry/opentelemetry-go/releases/tag/v1.11.1 +[1.11.0/0.32.3]: https://github.com/open-telemetry/opentelemetry-go/releases/tag/v1.11.0 +[0.32.2]: https://github.com/open-telemetry/opentelemetry-go/releases/tag/sdk/metric/v0.32.2 +[0.32.1]: https://github.com/open-telemetry/opentelemetry-go/releases/tag/sdk/metric/v0.32.1 +[0.32.0]: https://github.com/open-telemetry/opentelemetry-go/releases/tag/sdk/metric/v0.32.0 +[1.10.0]: https://github.com/open-telemetry/opentelemetry-go/releases/tag/v1.10.0 +[1.9.0/0.0.3]: https://github.com/open-telemetry/opentelemetry-go/releases/tag/v1.9.0 +[1.8.0/0.31.0]: https://github.com/open-telemetry/opentelemetry-go/releases/tag/v1.8.0 +[1.7.0/0.30.0]: https://github.com/open-telemetry/opentelemetry-go/releases/tag/v1.7.0 +[0.29.0]: https://github.com/open-telemetry/opentelemetry-go/releases/tag/metric/v0.29.0 +[1.6.3]: https://github.com/open-telemetry/opentelemetry-go/releases/tag/v1.6.3 +[1.6.2]: https://github.com/open-telemetry/opentelemetry-go/releases/tag/v1.6.2 +[1.6.1]: https://github.com/open-telemetry/opentelemetry-go/releases/tag/v1.6.1 +[1.6.0/0.28.0]: https://github.com/open-telemetry/opentelemetry-go/releases/tag/v1.6.0 +[1.5.0]: https://github.com/open-telemetry/opentelemetry-go/releases/tag/v1.5.0 +[1.4.1]: https://github.com/open-telemetry/opentelemetry-go/releases/tag/v1.4.1 +[1.4.0]: https://github.com/open-telemetry/opentelemetry-go/releases/tag/v1.4.0 +[1.3.0]: https://github.com/open-telemetry/opentelemetry-go/releases/tag/v1.3.0 +[1.2.0]: https://github.com/open-telemetry/opentelemetry-go/releases/tag/v1.2.0 +[1.1.0]: https://github.com/open-telemetry/opentelemetry-go/releases/tag/v1.1.0 +[1.0.1]: https://github.com/open-telemetry/opentelemetry-go/releases/tag/v1.0.1 +[Metrics 0.24.0]: https://github.com/open-telemetry/opentelemetry-go/releases/tag/metric/v0.24.0 +[1.0.0]: https://github.com/open-telemetry/opentelemetry-go/releases/tag/v1.0.0 +[1.0.0-RC3]: https://github.com/open-telemetry/opentelemetry-go/releases/tag/v1.0.0-RC3 +[1.0.0-RC2]: https://github.com/open-telemetry/opentelemetry-go/releases/tag/v1.0.0-RC2 +[Experimental Metrics v0.22.0]: https://github.com/open-telemetry/opentelemetry-go/releases/tag/metric/v0.22.0 +[1.0.0-RC1]: https://github.com/open-telemetry/opentelemetry-go/releases/tag/v1.0.0-RC1 +[0.20.0]: https://github.com/open-telemetry/opentelemetry-go/releases/tag/v0.20.0 +[0.19.0]: https://github.com/open-telemetry/opentelemetry-go/releases/tag/v0.19.0 +[0.18.0]: https://github.com/open-telemetry/opentelemetry-go/releases/tag/v0.18.0 +[0.17.0]: https://github.com/open-telemetry/opentelemetry-go/releases/tag/v0.17.0 +[0.16.0]: https://github.com/open-telemetry/opentelemetry-go/releases/tag/v0.16.0 +[0.15.0]: https://github.com/open-telemetry/opentelemetry-go/releases/tag/v0.15.0 +[0.14.0]: https://github.com/open-telemetry/opentelemetry-go/releases/tag/v0.14.0 +[0.13.0]: https://github.com/open-telemetry/opentelemetry-go/releases/tag/v0.13.0 +[0.12.0]: https://github.com/open-telemetry/opentelemetry-go/releases/tag/v0.12.0 +[0.11.0]: https://github.com/open-telemetry/opentelemetry-go/releases/tag/v0.11.0 +[0.10.0]: https://github.com/open-telemetry/opentelemetry-go/releases/tag/v0.10.0 +[0.9.0]: https://github.com/open-telemetry/opentelemetry-go/releases/tag/v0.9.0 +[0.8.0]: https://github.com/open-telemetry/opentelemetry-go/releases/tag/v0.8.0 +[0.7.0]: https://github.com/open-telemetry/opentelemetry-go/releases/tag/v0.7.0 +[0.6.0]: https://github.com/open-telemetry/opentelemetry-go/releases/tag/v0.6.0 +[0.5.0]: https://github.com/open-telemetry/opentelemetry-go/releases/tag/v0.5.0 +[0.4.3]: https://github.com/open-telemetry/opentelemetry-go/releases/tag/v0.4.3 +[0.4.2]: https://github.com/open-telemetry/opentelemetry-go/releases/tag/v0.4.2 +[0.4.1]: https://github.com/open-telemetry/opentelemetry-go/releases/tag/v0.4.1 +[0.4.0]: https://github.com/open-telemetry/opentelemetry-go/releases/tag/v0.4.0 +[0.3.0]: https://github.com/open-telemetry/opentelemetry-go/releases/tag/v0.3.0 +[0.2.3]: https://github.com/open-telemetry/opentelemetry-go/releases/tag/v0.2.3 +[0.2.2]: https://github.com/open-telemetry/opentelemetry-go/releases/tag/v0.2.2 +[0.2.1.1]: https://github.com/open-telemetry/opentelemetry-go/releases/tag/v0.2.1.1 +[0.2.1]: https://github.com/open-telemetry/opentelemetry-go/releases/tag/v0.2.1 +[0.2.0]: https://github.com/open-telemetry/opentelemetry-go/releases/tag/v0.2.0 +[0.1.2]: https://github.com/open-telemetry/opentelemetry-go/releases/tag/v0.1.2 +[0.1.1]: https://github.com/open-telemetry/opentelemetry-go/releases/tag/v0.1.1 +[0.1.0]: https://github.com/open-telemetry/opentelemetry-go/releases/tag/v0.1.0 + + + +[Go 1.26]: https://go.dev/doc/go1.26 +[Go 1.25]: https://go.dev/doc/go1.25 +[Go 1.24]: https://go.dev/doc/go1.24 +[Go 1.23]: https://go.dev/doc/go1.23 +[Go 1.22]: https://go.dev/doc/go1.22 +[Go 1.21]: https://go.dev/doc/go1.21 +[Go 1.20]: https://go.dev/doc/go1.20 +[Go 1.19]: https://go.dev/doc/go1.19 +[Go 1.18]: https://go.dev/doc/go1.18 + +[metric API]:https://pkg.go.dev/go.opentelemetry.io/otel/metric +[metric SDK]:https://pkg.go.dev/go.opentelemetry.io/otel/sdk/metric +[trace API]:https://pkg.go.dev/go.opentelemetry.io/otel/trace + +[GO-2024-2687]: https://pkg.go.dev/vuln/GO-2024-2687 diff --git a/vendor/go.opentelemetry.io/otel/CODEOWNERS b/vendor/go.opentelemetry.io/otel/CODEOWNERS new file mode 100644 index 00000000..26a03aed --- /dev/null +++ b/vendor/go.opentelemetry.io/otel/CODEOWNERS @@ -0,0 +1,17 @@ +##################################################### +# +# List of approvers for this repository +# +##################################################### +# +# Learn about membership in OpenTelemetry community: +# https://github.com/open-telemetry/community/blob/main/guides/contributor/membership.md +# +# +# Learn about CODEOWNERS file format: +# https://help.github.com/en/articles/about-code-owners +# + +* @MrAlias @XSAM @dashpole @pellared @dmathieu @flc1125 + +CODEOWNERS @MrAlias @pellared @dashpole @XSAM @dmathieu diff --git a/vendor/go.opentelemetry.io/otel/CONTRIBUTING.md b/vendor/go.opentelemetry.io/otel/CONTRIBUTING.md new file mode 100644 index 00000000..12de3607 --- /dev/null +++ b/vendor/go.opentelemetry.io/otel/CONTRIBUTING.md @@ -0,0 +1,1157 @@ +# Contributing to opentelemetry-go + +The Go special interest group (SIG) meets regularly. See the +OpenTelemetry +[community](https://github.com/open-telemetry/community#golang-sdk) +repo for information on this and other language SIGs. + +See the [public meeting +notes](https://docs.google.com/document/d/1E5e7Ld0NuU1iVvf-42tOBpu2VBBLYnh73GJuITGJTTU/edit) +for a summary description of past meetings. To request edit access, +join the meeting or get in touch on +[Slack](https://cloud-native.slack.com/archives/C01NPAXACKT). + +## Development + +You can view and edit the source code by cloning this repository: + +```sh +git clone https://github.com/open-telemetry/opentelemetry-go.git +``` + +Run `make test` to run the tests instead of `go test`. + +There are some generated files checked into the repo. To make sure +that the generated files are up-to-date, run `make` (or `make +precommit` - the `precommit` target is the default). + +The `precommit` target also fixes the formatting of the code and +checks the status of the go module files. + +Additionally, there is a `codespell` target that checks for common +typos in the code. It is not run by default, but you can run it +manually with `make codespell`. It will set up a virtual environment +in `venv` and install `codespell` there. + +If after running `make precommit` the output of `git status` contains +`nothing to commit, working tree clean` then it means that everything +is up-to-date and properly formatted. + +## Pull Requests + +### How to Send Pull Requests + +Everyone is welcome to contribute code to `opentelemetry-go` via +GitHub pull requests (PRs). + +To create a new PR, fork the project in GitHub and clone the upstream +repo: + +```sh +go get -d go.opentelemetry.io/otel +``` + +(This may print some warning about "build constraints exclude all Go +files", just ignore it.) + +This will put the project in `${GOPATH}/src/go.opentelemetry.io/otel`. +Alternatively, you can use `git` directly with: + +```sh +git clone https://github.com/open-telemetry/opentelemetry-go +``` + +(Note that `git clone` is *not* using the `go.opentelemetry.io/otel` name - +that name is a kind of a redirector to GitHub that `go get` can +understand, but `git` does not.) + +This will add the project as `opentelemetry-go` within the current directory. + +Enter the newly created directory and add your fork as a new remote: + +```sh +git remote add git@github.com:/opentelemetry-go +``` + +Check out a new branch, make modifications, run linters and tests, update +`CHANGELOG.md`, and push the branch to your fork: + +```sh +git checkout -b +# edit files +# update changelog +make precommit +git add -p +git commit +git push +``` + +Open a pull request against the main `opentelemetry-go` repo. Be sure to add the pull +request ID to the entry you added to `CHANGELOG.md`. + +Avoid rebasing and force-pushing to your branch to facilitate reviewing the pull request. +Rewriting Git history makes it difficult to keep track of iterations during code review. +All pull requests are squashed to a single commit upon merge to `main`. + +### How to Receive Comments + +* If the PR is not ready for review, please put `[WIP]` in the title, + tag it as `work-in-progress`, or mark it as + [`draft`](https://github.blog/2019-02-14-introducing-draft-pull-requests/). +* Make sure CLA is signed and CI is clear. + +### How to Get PRs Merged + +A PR is considered **ready to merge** when: + +* It has received two qualified approvals[^1]. + + This is not enforced through automation, but needs to be validated by the + maintainer merging. + * At least one of the qualified approvals needs to be from an + [Approver]/[Maintainer] affiliated with a different company than the author + of the PR. + * PRs introducing changes that have already been discussed and consensus + reached only need one qualified approval. The discussion and resolution + needs to be linked to the PR. + * Trivial changes[^2] only need one qualified approval. + +* All feedback has been addressed. + * All PR comments and suggestions are resolved. + * All GitHub Pull Request reviews with a status of "Request changes" have + been addressed. Another review by the objecting reviewer with a different + status can be submitted to clear the original review, or the review can be + dismissed by a [Maintainer] when the issues from the original review have + been addressed. + * Any comments or reviews that cannot be resolved between the PR author and + reviewers can be submitted to the community [Approver]s and [Maintainer]s + during the weekly SIG meeting. If consensus is reached among the + [Approver]s and [Maintainer]s during the SIG meeting the objections to the + PR may be dismissed or resolved or the PR closed by a [Maintainer]. + * Any substantive changes to the PR require existing Approval reviews be + cleared unless the approver explicitly states that their approval persists + across changes. This includes changes resulting from other feedback. + [Approver]s and [Maintainer]s can help in clearing reviews and they should + be consulted if there are any questions. + +* The PR branch is up to date with the base branch it is merging into. + * To ensure this does not block the PR, it should be configured to allow + maintainers to update it. + +* It has been open for review for at least one working day. This gives people + reasonable time to review. + * Trivial changes[^2] do not have to wait for one day and may be merged with + a single [Maintainer]'s approval. + +* All required GitHub workflows have succeeded. +* Urgent fix can take exception as long as it has been actively communicated + among [Maintainer]s. + +Any [Maintainer] can merge the PR once the above criteria have been met. + +[^1]: A qualified approval is a GitHub Pull Request review with "Approve" + status from an OpenTelemetry Go [Approver] or [Maintainer]. +[^2]: Trivial changes include: typo corrections, cosmetic non-substantive + changes, documentation corrections or updates, dependency updates, etc. + +## Design Choices + +As with other OpenTelemetry clients, opentelemetry-go follows the +[OpenTelemetry Specification](https://opentelemetry.io/docs/specs/otel). + +It's especially valuable to read through the [library +guidelines](https://opentelemetry.io/docs/specs/otel/library-guidelines). + +### Focus on Capabilities, Not Structure Compliance + +OpenTelemetry is an evolving specification, one where the desires and +use cases are clear, but the methods to satisfy those use cases are +not. + +As such, Contributions should provide functionality and behavior that +conforms to the specification, but the interface and structure are +flexible. + +It is preferable to have contributions follow the idioms of the +language rather than conform to specific API names or argument +patterns in the spec. + +For a deeper discussion, see +[this](https://github.com/open-telemetry/opentelemetry-specification/issues/165). + +## Tests + +Each functionality should be covered by tests. + +Performance-critical functionality should also be covered by benchmarks. + +- Pull requests adding a performance-critical functionality +should have `go test -bench` output in their description. +- Pull requests changing a performance-critical functionality +should have [`benchstat`](https://pkg.go.dev/golang.org/x/perf/cmd/benchstat) +output in their description. + +## Dependencies + +This project uses [Go Modules] for dependency management. All modules will use +`go.mod` to explicitly list all direct and indirect dependencies, ensuring a +clear dependency graph. The `go.sum` file for each module will be committed to +the repository and used to verify the integrity of downloaded modules, +preventing malicious tampering. + +This project uses automated dependency update tools (i.e. dependabot, +renovatebot) to manage updates to dependencies. This ensures that dependencies +are kept up-to-date with the latest security patches and features and are +reviewed before being merged. If you would like to propose a change to a +dependency it should be done through a pull request that updates the `go.mod` +file and includes a description of the change. + +See the [versioning and compatibility](./VERSIONING.md) policy for more details +about dependency compatibility. + +[Go Modules]: https://pkg.go.dev/cmd/go#hdr-Modules__module_versions__and_more + +### Environment Dependencies + +This project does not partition dependencies based on the environment (i.e. +`development`, `staging`, `production`). + +Only the dependencies explicitly included in the released modules have been +tested and verified to work with the released code. No other guarantee is made +about the compatibility of other dependencies. + +## Documentation + +Each (non-internal, non-test) package must be documented using +[Go Doc Comments](https://go.dev/doc/comment), +preferably in a `doc.go` file. + +Prefer using [Examples](https://pkg.go.dev/testing#hdr-Examples) +instead of putting code snippets in Go doc comments. +In some cases, you can even create [Testable Examples](https://go.dev/blog/examples). + +You can install and run a "local Go Doc site" in the following way: + + ```sh + go install golang.org/x/pkgsite/cmd/pkgsite@latest + pkgsite + ``` + +[`go.opentelemetry.io/otel/metric`](https://pkg.go.dev/go.opentelemetry.io/otel/metric) +is an example of a very well-documented package. + +### README files + +Each (non-internal, non-test, non-documentation) package must contain a +`README.md` file containing at least a title, and a `pkg.go.dev` badge. + +The README should not be a repetition of Go doc comments. + +You can verify the presence of all README files with the `make verify-readmes` +command. + +## Style Guide + +One of the primary goals of this project is that it is actually used by +developers. With this goal in mind the project strives to build +user-friendly and idiomatic Go code adhering to the Go community's best +practices. + +For a non-comprehensive but foundational overview of these best practices +the [Effective Go](https://golang.org/doc/effective_go.html) documentation +is an excellent starting place. + +We also recommend following the +[Go Code Review Comments](https://go.dev/wiki/CodeReviewComments) +that collects common comments made during reviews of Go code. + +As a convenience for developers building this project the `make precommit` +will format, lint, validate, and in some cases fix the changes you plan to +submit. This check will need to pass for your changes to be able to be +merged. + +In addition to idiomatic Go, the project has adopted certain standards for +implementations of common patterns. These standards should be followed as a +default, and if they are not followed documentation needs to be included as +to the reasons why. + +### Configuration + +When creating an instantiation function for a complex `type T struct`, it is +useful to allow variable number of options to be applied. However, the strong +type system of Go restricts the function design options. There are a few ways +to solve this problem, but we have landed on the following design. + +#### `config` + +Configuration should be held in a `struct` named `config`, or prefixed with +specific type name this Configuration applies to if there are multiple +`config` in the package. This type must contain configuration options. + +```go +// config contains configuration options for a thing. +type config struct { + // options ... +} +``` + +In general the `config` type will not need to be used externally to the +package and should be unexported. If, however, it is expected that the user +will likely want to build custom options for the configuration, the `config` +should be exported. Please, include in the documentation for the `config` +how the user can extend the configuration. + +It is important that internal `config` are not shared across package boundaries. +Meaning a `config` from one package should not be directly used by another. The +one exception is the API packages. The configs from the base API, eg. +`go.opentelemetry.io/otel/trace.TracerConfig` and +`go.opentelemetry.io/otel/metric.InstrumentConfig`, are intended to be consumed +by the SDK therefore it is expected that these are exported. + +When a config is exported we want to maintain forward and backward +compatibility, to achieve this no fields should be exported but should +instead be accessed by methods. + +Optionally, it is common to include a `newConfig` function (with the same +naming scheme). This function wraps any defaults setting and looping over +all options to create a configured `config`. + +```go +// newConfig returns an appropriately configured config. +func newConfig(options ...Option) config { + // Set default values for config. + config := config{/* […] */} + for _, option := range options { + config = option.apply(config) + } + // Perform any validation here. + return config +} +``` + +If validation of the `config` options is also performed this can return an +error as well that is expected to be handled by the instantiation function +or propagated to the user. + +Given the design goal of not having the user need to work with the `config`, +the `newConfig` function should also be unexported. + +#### `Option` + +To set the value of the options a `config` contains, a corresponding +`Option` interface type should be used. + +```go +type Option interface { + apply(config) config +} +``` + +Having `apply` unexported makes sure that it will not be used externally. +Moreover, the interface becomes sealed so the user cannot easily implement +the interface on its own. + +The `apply` method should return a modified version of the passed config. +This approach, instead of passing a pointer, is used to prevent the config from being allocated to the heap. + +The name of the interface should be prefixed in the same way the +corresponding `config` is (if at all). + +#### Options + +All user configurable options for a `config` must have a related unexported +implementation of the `Option` interface and an exported configuration +function that wraps this implementation. + +The wrapping function name should be prefixed with `With*` (or in the +special case of a boolean options `Without*`) and should have the following +function signature. + +```go +func With*(…) Option { … } +``` + +##### `bool` Options + +```go +type defaultFalseOption bool + +func (o defaultFalseOption) apply(c config) config { + c.Bool = bool(o) + return c +} + +// WithOption sets a T to have an option included. +func WithOption() Option { + return defaultFalseOption(true) +} +``` + +```go +type defaultTrueOption bool + +func (o defaultTrueOption) apply(c config) config { + c.Bool = bool(o) + return c +} + +// WithoutOption sets a T to have Bool option excluded. +func WithoutOption() Option { + return defaultTrueOption(false) +} +``` + +##### Declared Type Options + +```go +type myTypeOption struct { + MyType MyType +} + +func (o myTypeOption) apply(c config) config { + c.MyType = o.MyType + return c +} + +// WithMyType sets T to have include MyType. +func WithMyType(t MyType) Option { + return myTypeOption{t} +} +``` + +##### Functional Options + +```go +type optionFunc func(config) config + +func (fn optionFunc) apply(c config) config { + return fn(c) +} + +// WithMyType sets t as MyType. +func WithMyType(t MyType) Option { + return optionFunc(func(c config) config { + c.MyType = t + return c + }) +} +``` + +#### Instantiation + +Using this configuration pattern to configure instantiation with a `NewT` +function. + +```go +func NewT(options ...Option) T {…} +``` + +Any required parameters can be declared before the variadic `options`. + +#### Dealing with Overlap + +Sometimes there are multiple complex `struct` that share common +configuration and also have distinct configuration. To avoid repeated +portions of `config`s, a common `config` can be used with the union of +options being handled with the `Option` interface. + +For example. + +```go +// config holds options for all animals. +type config struct { + Weight float64 + Color string + MaxAltitude float64 +} + +// DogOption apply Dog specific options. +type DogOption interface { + applyDog(config) config +} + +// BirdOption apply Bird specific options. +type BirdOption interface { + applyBird(config) config +} + +// Option apply options for all animals. +type Option interface { + BirdOption + DogOption +} + +type weightOption float64 + +func (o weightOption) applyDog(c config) config { + c.Weight = float64(o) + return c +} + +func (o weightOption) applyBird(c config) config { + c.Weight = float64(o) + return c +} + +func WithWeight(w float64) Option { return weightOption(w) } + +type furColorOption string + +func (o furColorOption) applyDog(c config) config { + c.Color = string(o) + return c +} + +func WithFurColor(c string) DogOption { return furColorOption(c) } + +type maxAltitudeOption float64 + +func (o maxAltitudeOption) applyBird(c config) config { + c.MaxAltitude = float64(o) + return c +} + +func WithMaxAltitude(a float64) BirdOption { return maxAltitudeOption(a) } + +func NewDog(name string, o ...DogOption) Dog {…} +func NewBird(name string, o ...BirdOption) Bird {…} +``` + +### Interfaces + +To allow other developers to better comprehend the code, it is important +to ensure it is sufficiently documented. One simple measure that contributes +to this aim is self-documenting by naming method parameters. Therefore, +where appropriate, methods of every exported interface type should have +their parameters appropriately named. + +#### Interface Stability + +All exported stable interfaces that include the following warning in their +documentation are allowed to be extended with additional methods. + +> Warning: methods may be added to this interface in minor releases. + +These interfaces are defined by the OpenTelemetry specification and will be +updated as the specification evolves. + +Otherwise, stable interfaces MUST NOT be modified. + +#### How to Change Specification Interfaces + +When an API change must be made, we will update the SDK with the new method one +release before the API change. This will allow the SDK one version before the +API change to work seamlessly with the new API. + +If an incompatible version of the SDK is used with the new API the application +will fail to compile. + +#### How Not to Change Specification Interfaces + +We have explored using a v2 of the API to change interfaces and found that there +was no way to introduce a v2 and have it work seamlessly with the v1 of the API. +Problems happened with libraries that upgraded to v2 when an application did not, +and would not produce any telemetry. + +More detail of the approaches considered and their limitations can be found in +the [Use a V2 API to evolve interfaces](https://github.com/open-telemetry/opentelemetry-go/issues/3920) +issue. + +#### How to Change Other Interfaces + +If new functionality is needed for an interface that cannot be changed it MUST +be added by including an additional interface. That added interface can be a +simple interface for the specific functionality that you want to add or it can +be a super-set of the original interface. For example, if you wanted to a +`Close` method to the `Exporter` interface: + +```go +type Exporter interface { + Export() +} +``` + +A new interface, `Closer`, can be added: + +```go +type Closer interface { + Close() +} +``` + +Code that is passed the `Exporter` interface can now check to see if the passed +value also satisfies the new interface. E.g. + +```go +func caller(e Exporter) { + /* ... */ + if c, ok := e.(Closer); ok { + c.Close() + } + /* ... */ +} +``` + +Alternatively, a new type that is the super-set of an `Exporter` can be created. + +```go +type ClosingExporter struct { + Exporter + Close() +} +``` + +This new type can be used similar to the simple interface above in that a +passed `Exporter` type can be asserted to satisfy the `ClosingExporter` type +and the `Close` method called. + +This super-set approach can be useful if there is explicit behavior that needs +to be coupled with the original type and passed as a unified type to a new +function, but, because of this coupling, it also limits the applicability of +the added functionality. If there exist other interfaces where this +functionality should be added, each one will need their own super-set +interfaces and will duplicate the pattern. For this reason, the simple targeted +interface that defines the specific functionality should be preferred. + +See also: +[Keeping Your Modules Compatible: Working with interfaces](https://go.dev/blog/module-compatibility#working-with-interfaces). + +### Testing + +We allow using [`testify`](https://github.com/stretchr/testify) even though +it is seen as non-idiomatic according to +the [Go Test Comments](https://go.dev/wiki/TestComments#assert-libraries) page. + +The tests should never leak goroutines. + +Use the term `ConcurrentSafe` in the test name when it aims to verify the +absence of race conditions. The top-level tests with this term will be run +many times in the `test-concurrent-safe` CI job to increase the chance of +catching concurrency issues. This does not apply to subtests when this term +is not in their root name. + +### Internal packages + +The use of internal packages should be scoped to a single module. A sub-module +should never import from a parent internal package. This creates a coupling +between the two modules where a user can upgrade the parent without the child, +and if the internal package API has changed, it will fail to upgrade[^3]. + +There are two known exceptions to this rule: + +- `go.opentelemetry.io/otel/internal/global` + - This package manages global state for all of opentelemetry-go. It needs to + be a single package in order to ensure the uniqueness of the global state. +- `go.opentelemetry.io/otel/internal/baggage` + - This package provides values in a `context.Context` that need to be + recognized by `go.opentelemetry.io/otel/baggage` and + `go.opentelemetry.io/otel/bridge/opentracing` but remain private. + +If you have duplicate code in multiple modules, make that code into a Go +template stored in `go.opentelemetry.io/otel/internal/shared` and use [gotmpl] +to render the templates in the desired locations. See [#4404] for an example of +this. + +[^3]: https://github.com/open-telemetry/opentelemetry-go/issues/3548 + +### Ignoring context cancellation + +OpenTelemetry API implementations need to ignore the cancellation of the context that is +passed when recording a value (e.g. starting a span, recording a measurement, emitting a log). +Recording methods should not return an error describing the cancellation state of the context +when they complete, nor should they abort any work. + +This rule may not apply if the OpenTelemetry specification defines a timeout mechanism for +the method. In that case the context cancellation can be used for the timeout with the +restriction that this behavior is documented for the method. Otherwise, timeouts +are expected to be handled by the user calling the API, not the implementation. + +Stoppage of the telemetry pipeline is handled by calling the appropriate `Shutdown` method +of a provider. It is assumed the context passed from a user is not used for this purpose. + +Outside of the direct recording of telemetry from the API (e.g. exporting telemetry, +force flushing telemetry, shutting down a signal provider) the context cancellation +should be honored. This means all work done on behalf of the user provided context +should be canceled. + +### Observability + +OpenTelemetry Go SDK components should be instrumented to enable users observability for the health and performance of the telemetry pipeline itself. +This allows operators to understand how well their observability infrastructure is functioning and to identify potential issues before they impact their applications. + +This section outlines the best practices for building instrumentation in OpenTelemetry Go SDK components. + +#### Environment Variable Activation + +Observability features are currently experimental. +They should be disabled by default and activated through the `OTEL_GO_X_OBSERVABILITY` environment variable. +This follows the established experimental feature pattern used throughout the SDK. + +Components should check for this environment variable using a consistent pattern: + +```go +import "go.opentelemetry.io/otel/*/internal/x" + +if x.Observability.Enabled() { + // Initialize observability metrics +} +``` + +**References**: + +- [stdouttrace exporter](./exporters/stdout/stdouttrace/internal/x/x.go) +- [sdk](./sdk/internal/x/x.go) + +#### Encapsulation + +Instrumentation should be encapsulated within a dedicated `struct` (e.g. `instrumentation`). +It should not be mixed into the instrumented component. + +Prefer this: + +```go +type SDKComponent struct { + inst *instrumentation +} + +type instrumentation struct { + inflight otelconv.SDKComponentInflight + exported otelconv.SDKComponentExported +} +``` + +To this: + +```go +// ❌ Avoid this pattern. +type SDKComponent struct { + /* other SDKComponent fields... */ + + inflight otelconv.SDKComponentInflight + exported otelconv.SDKComponentExported +} +``` + +The instrumentation code should not bloat the code being instrumented. +Likely, this means its own file, or its own package if it is complex or reused. + +#### Initialization + +Instrumentation setup should be explicit, side-effect free, and local to the relevant component. +Avoid relying on global or implicit [side effects][side-effect] for initialization. + +Encapsulate setup in constructor functions, ensuring clear ownership and scope: + +```go +import ( + "errors" + + semconv "go.opentelemetry.io/otel/semconv/v1.40.0" + "go.opentelemetry.io/otel/semconv/v1.40.0/otelconv" +) + +type SDKComponent struct { + inst *instrumentation +} + +func NewSDKComponent(config Config) (*SDKComponent, error) { + inst, err := newInstrumentation() + if err != nil { + return nil, err + } + return &SDKComponent{inst: inst}, nil +} + +type instrumentation struct { + inflight otelconv.SDKComponentInflight + exported otelconv.SDKComponentExported +} + +func newInstrumentation() (*instrumentation, error) { + if !x.Observability.Enabled() { + return nil, nil + } + + meter := otel.GetMeterProvider().Meter( + "", + metric.WithInstrumentationVersion(sdk.Version()), + metric.WithSchemaURL(semconv.SchemaURL), + ) + + inst := &instrumentation{} + + var err, e error + inst.inflight, e = otelconv.NewSDKComponentInflight(meter) + err = errors.Join(err, e) + + inst.exported, e = otelconv.NewSDKComponentExported(meter) + err = errors.Join(err, e) + + return inst, err +} +``` + +```go +// ❌ Avoid this pattern. +func (c *Component) initObservability() { + // Initialize observability metrics + if !x.Observability.Enabled() { + return + } + + // Initialize observability metrics + c.inst = &instrumentation{/* ... */} +} +``` + +[side-effect]: https://en.wikipedia.org/wiki/Side_effect_(computer_science) + +#### Performance + +When observability is disabled there should be little to no overhead. + +```go +func (e *Exporter) ExportSpans(ctx context.Context, spans []trace.ReadOnlySpan) error { + if e.inst != nil { + attrs := expensiveOperation() + e.inst.recordSpanInflight(ctx, int64(len(spans)), attrs...) + } + // Export spans... +} +``` + +```go +// ❌ Avoid this pattern. +func (e *Exporter) ExportSpans(ctx context.Context, spans []trace.ReadOnlySpan) error { + attrs := expensiveOperation() + e.inst.recordSpanInflight(ctx, int64(len(spans)), attrs...) + // Export spans... +} + +func (i *instrumentation) recordSpanInflight(ctx context.Context, count int64, attrs ...attribute.KeyValue) { + if i == nil || i.inflight == nil { + return + } + i.inflight.Add(ctx, count, metric.WithAttributes(attrs...)) +} +``` + +When observability is enabled, the instrumentation code paths should be optimized to reduce allocation and computation overhead. + +##### Attribute and Option Allocation Management + +Pool attribute slices and options with [`sync.Pool`] to minimize allocations in measurement calls with dynamic attributes. + +```go +var ( + attrPool = sync.Pool{ + New: func() any { + // Pre-allocate common capacity + knownCap := 8 // Adjust based on expected usage + s := make([]attribute.KeyValue, 0, knownCap) + // Return a pointer to avoid extra allocation on Put(). + return &s + }, + } + + addOptPool = &sync.Pool{ + New: func() any { + const n = 1 // WithAttributeSet + o := make([]metric.AddOption, 0, n) + // Return a pointer to avoid extra allocation on Put(). + return &o + }, + } +) + +func (i *instrumentation) record(ctx context.Context, value int64, baseAttrs ...attribute.KeyValue) { + attrs := attrPool.Get().(*[]attribute.KeyValue) + defer func() { + *attrs = (*attrs)[:0] // Reset. + attrPool.Put(attrs) + }() + + *attrs = append(*attrs, baseAttrs...) + // Add any dynamic attributes. + *attrs = append(*attrs, semconv.OTelComponentName("exporter-1")) + + addOpt := addOptPool.Get().(*[]metric.AddOption) + defer func() { + *addOpt = (*addOpt)[:0] + addOptPool.Put(addOpt) + }() + + set := attribute.NewSet(*attrs...) + *addOpt = append(*addOpt, metric.WithAttributeSet(set)) + + i.counter.Add(ctx, value, *addOpt...) +} +``` + +Pools are most effective when there are many pooled objects of the same sufficiently large size, and the objects are repeatedly used. +This amortizes the cost of allocation and synchronization. +Ideally, the pools should be scoped to be used as widely as possible within the component to maximize this efficiency while still ensuring correctness. + +[`sync.Pool`]: https://pkg.go.dev/sync#Pool + +##### Cache common attribute sets for repeated measurements + +If a static set of attributes are used for measurements and they are known at compile time, pre-compute and cache these attributes. + +```go +type spanLiveSetKey struct { + sampled bool +} + +var spanLiveSetCache = map[spanLiveSetKey]attribute.Set{ + {true}: attribute.NewSet( + otelconv.SDKSpanLive{}.AttrSpanSamplingResult( + otelconv.SpanSamplingResultRecordAndSample, + ), + ), + {false}: attribute.NewSet( + otelconv.SDKSpanLive{}.AttrSpanSamplingResult( + otelconv.SpanSamplingResultRecordOnly, + ), + ), +} + +func spanLiveSet(sampled bool) attribute.Set { + key := spanLiveSetKey{sampled: sampled} + return spanLiveSetCache[key] +} +``` + +##### Benchmarking + +Always provide benchmarks when introducing or refactoring instrumentation. +Demonstrate the impact (allocs/op, B/op, ns/op) in enabled/disabled scenarios: + +```go +func BenchmarkExportSpans(b *testing.B) { + scenarios := []struct { + name string + obsEnabled bool + }{ + {"ObsDisabled", false}, + {"ObsEnabled", true}, + } + + for _, scenario := range scenarios { + b.Run(scenario.name, func(b *testing.B) { + b.Setenv( + "OTEL_GO_X_OBSERVABILITY", + strconv.FormatBool(scenario.obsEnabled), + ) + + exporter := NewExporter() + spans := generateTestSpans(100) + + b.ResetTimer() + b.ReportAllocs() + + for i := 0; i < b.N; i++ { + _ = exporter.ExportSpans(context.Background(), spans) + } + }) + } +} +``` + +#### Error Handling and Robustness + +Errors should be reported back to the caller if possible, and partial failures should be handled as gracefully as possible. + +```go +func newInstrumentation() (*instrumentation, error) { + if !x.Observability.Enabled() { + return nil, nil + } + + m := otel.GetMeterProvider().Meter(/* initialize meter */) + counter, err := otelconv.NewSDKComponentCounter(m) + // Use the partially initialized counter if available. + i := &instrumentation{counter: counter} + // Return any error to the caller. + return i, err +} +``` + +```go +// ❌ Avoid this pattern. +func newInstrumentation() *instrumentation { + if !x.Observability.Enabled() { + return nil, nil + } + + m := otel.GetMeterProvider().Meter(/* initialize meter */) + counter, err := otelconv.NewSDKComponentCounter(m) + if err != nil { + // ❌ Do not dump the error to the OTel Handler. Return it to the + // caller. + otel.Handle(err) + // ❌ Do not return nil if we can still use the partially initialized + // counter. + return nil + } + return &instrumentation{counter: counter} +} +``` + +If the instrumented component cannot report the error to the user, let it report the error to `otel.Handle`. + +#### Context Propagation + +Ensure observability measurements receive the correct context, especially for trace exemplars and distributed context: + +```go +func (e *Exporter) ExportSpans(ctx context.Context, spans []trace.ReadOnlySpan) error { + // Use the provided context for observability measurements + e.inst.recordSpanExportStarted(ctx, len(spans)) + + err := e.doExport(ctx, spans) + + if err != nil { + e.inst.recordSpanExportFailed(ctx, len(spans), err) + } else { + e.inst.recordSpanExportSucceeded(ctx, len(spans)) + } + + return err +} +``` + +```go +// ❌ Avoid this pattern. +func (e *Exporter) ExportSpans(ctx context.Context, spans []trace.ReadOnlySpan) error { + // ❌ Do not break the context propagation. + e.inst.recordSpanExportStarted(context.Background(), len(spans)) + + err := e.doExport(ctx, spans) + + /* ... */ + + return err +} +``` + +#### Semantic Conventions Compliance + +All observability metrics should follow the [OpenTelemetry Semantic Conventions for SDK metrics](https://github.com/open-telemetry/semantic-conventions/blob/1cf2476ae5e518225a766990a28a6d5602bd5a30/docs/otel/sdk-metrics.md). + +Use the metric semantic conventions convenience package [otelconv](./semconv/v1.40.0/otelconv/metric.go). + +##### Component Identification + +Component names and types should follow [semantic convention](https://github.com/open-telemetry/semantic-conventions/blob/1cf2476ae5e518225a766990a28a6d5602bd5a30/docs/registry/attributes/otel.md#otel-component-attributes). + +If a component is not a well-known type specified in the semantic conventions, use the package path scope type as a stable identifier. + +```go +componentType := "go.opentelemetry.io/otel/sdk/trace.Span" +``` + +```go +// ❌ Do not do this. +componentType := "trace-span" +``` + +The component name should be a stable unique identifier for the specific instance of the component. + +Use a global counter to ensure uniqueness if necessary. + +```go +// Unique 0-based ID counter for component instances. +var componentIDCounter atomic.Int64 + +// nextID returns the next unique ID for a component. +func nextID() int64 { + return componentIDCounter.Add(1) - 1 +} + +// componentName returns a unique name for the component instance. +func componentName() attribute.KeyValue { + id := nextID() + name := fmt.Sprintf("%s/%d", componentType, id) + return semconv.OTelComponentName(name) +} +``` + +The component ID will need to be resettable for deterministic testing. +If tests are in a different package than the component being tested (i.e. a `_test` package name), use a generated `counter` internal package to manage the counter. +See [stdouttrace exporter example](./exporters/stdout/stdouttrace/internal/gen.go) for reference. + +#### Testing + +Use deterministic testing with isolated state: + +```go +func TestObservability(t *testing.T) { + // Restore state after test to ensure this does not affect other tests. + prev := otel.GetMeterProvider() + t.Cleanup(func() { otel.SetMeterProvider(prev) }) + + // Isolate the meter provider for deterministic testing + reader := metric.NewManualReader() + meterProvider := metric.NewMeterProvider(metric.WithReader(reader)) + otel.SetMeterProvider(meterProvider) + + // Use t.Setenv to ensure environment variable is restored after test. + t.Setenv("OTEL_GO_X_OBSERVABILITY", "true") + + // Reset component ID counter to ensure deterministic component names. + componentIDCounter.Store(0) + + /* ... test code ... */ +} +``` + +Test order should not affect results. +Ensure that any global state (e.g. component ID counters) is reset between tests. + +## Approvers and Maintainers + +### Maintainers + +- [Damien Mathieu](https://github.com/dmathieu), Elastic ([GPG](https://keys.openpgp.org/search?q=5A126B972A81A6CE443E5E1B408B8E44F0873832)) +- [David Ashpole](https://github.com/dashpole), Google ([GPG](https://keys.openpgp.org/search?q=C0D1BDDCAAEAE573673085F176327DA4D864DC70)) +- [Robert Pająk](https://github.com/pellared), Splunk ([GPG](https://keys.openpgp.org/search?q=CDAD3A60476A3DE599AA5092E5F7C35A4DBE90C2)) +- [Sam Xie](https://github.com/XSAM), Splunk ([GPG](https://keys.openpgp.org/search?q=AEA033782371ABB18EE39188B8044925D6FEEBEA)) +- [Tyler Yahn](https://github.com/MrAlias), Splunk ([GPG](https://keys.openpgp.org/search?q=0x46B0F3E1A8B1BA5A)) + +For more information about the maintainer role, see the [community repository](https://github.com/open-telemetry/community/blob/main/guides/contributor/membership.md#maintainer). + +### Approvers + +- [Flc](https://github.com/flc1125), Independent + +For more information about the approver role, see the [community repository](https://github.com/open-telemetry/community/blob/main/guides/contributor/membership.md#approver). + +### Triagers + +- [Alex Kats](https://github.com/akats7), Capital One + +For more information about the triager role, see the [community repository](https://github.com/open-telemetry/community/blob/main/guides/contributor/membership.md#triager). + +### Emeritus + +- [Aaron Clawson](https://github.com/MadVikingGod) +- [Anthony Mirabella](https://github.com/Aneurysm9) +- [Cheng-Zhen Yang](https://github.com/scorpionknifes) +- [Chester Cheung](https://github.com/hanyuancheung) +- [Evan Torrie](https://github.com/evantorrie) +- [Gustavo Silva Paiva](https://github.com/paivagustavo) +- [Josh MacDonald](https://github.com/jmacd) +- [Liz Fong-Jones](https://github.com/lizthegrey) + +For more information about the emeritus role, see the [community repository](https://github.com/open-telemetry/community/blob/main/guides/contributor/membership.md#emeritus-maintainerapprovertriager). + +### Become an Approver or a Maintainer + +See the [community membership document in OpenTelemetry community +repo](https://github.com/open-telemetry/community/blob/main/guides/contributor/membership.md). + +[Approver]: #approvers +[Maintainer]: #maintainers +[gotmpl]: https://pkg.go.dev/go.opentelemetry.io/build-tools/gotmpl +[#4404]: https://github.com/open-telemetry/opentelemetry-go/pull/4404 diff --git a/vendor/go.opentelemetry.io/otel/LICENSE b/vendor/go.opentelemetry.io/otel/LICENSE new file mode 100644 index 00000000..f1aee0f1 --- /dev/null +++ b/vendor/go.opentelemetry.io/otel/LICENSE @@ -0,0 +1,231 @@ + Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + + TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + + 1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + + 2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + + 3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + + 4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + + 5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + + 6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + + 7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + + 8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + + 9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + + END OF TERMS AND CONDITIONS + + APPENDIX: How to apply the Apache License to your work. + + To apply the Apache License to your work, attach the following + boilerplate notice, with the fields enclosed by brackets "[]" + replaced with your own identifying information. (Don't include + the brackets!) The text should be enclosed in the appropriate + comment syntax for the file format. We also recommend that a + file or class name and description of purpose be included on the + same "printed page" as the copyright notice for easier + identification within third-party archives. + + Copyright [yyyy] [name of copyright owner] + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. + +-------------------------------------------------------------------------------- + +Copyright 2009 The Go Authors. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are +met: + + * Redistributions of source code must retain the above copyright +notice, this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above +copyright notice, this list of conditions and the following disclaimer +in the documentation and/or other materials provided with the +distribution. + * Neither the name of Google LLC nor the names of its +contributors may be used to endorse or promote products derived from +this software without specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. \ No newline at end of file diff --git a/vendor/go.opentelemetry.io/otel/Makefile b/vendor/go.opentelemetry.io/otel/Makefile new file mode 100644 index 00000000..42466f2d --- /dev/null +++ b/vendor/go.opentelemetry.io/otel/Makefile @@ -0,0 +1,330 @@ +# Copyright The OpenTelemetry Authors +# SPDX-License-Identifier: Apache-2.0 + +TOOLS_MOD_DIR := ./internal/tools + +ALL_DOCS := $(shell find . -name '*.md' -type f | sort) +ALL_GO_MOD_DIRS := $(shell find . -type f -name 'go.mod' -exec dirname {} \; | sort) +OTEL_GO_MOD_DIRS := $(filter-out $(TOOLS_MOD_DIR), $(ALL_GO_MOD_DIRS)) +ALL_COVERAGE_MOD_DIRS := $(shell find . -type f -name 'go.mod' -exec dirname {} \; | grep -E -v '^./example|^$(TOOLS_MOD_DIR)' | sort) + +GO = go +TIMEOUT = 60 + +# User to run as in docker images. +DOCKER_USER=$(shell id -u):$(shell id -g) +DEPENDENCIES_DOCKERFILE=./dependencies.Dockerfile + +.DEFAULT_GOAL := precommit + +.PHONY: precommit ci +precommit: generate toolchain-check license-check misspell go-mod-tidy golangci-lint-fix verify-readmes verify-mods test-default +ci: generate toolchain-check license-check lint vanity-import-check verify-readmes verify-mods build test-default check-clean-work-tree test-coverage + +# Tools + +TOOLS = $(CURDIR)/.tools + +$(TOOLS): + @mkdir -p $@ +$(TOOLS)/%: $(TOOLS_MOD_DIR)/go.mod | $(TOOLS) + cd $(TOOLS_MOD_DIR) && \ + $(GO) build -o $@ $(PACKAGE) + +MULTIMOD = $(TOOLS)/multimod +$(TOOLS)/multimod: PACKAGE=go.opentelemetry.io/build-tools/multimod + +CROSSLINK = $(TOOLS)/crosslink +$(TOOLS)/crosslink: PACKAGE=go.opentelemetry.io/build-tools/crosslink + +SEMCONVKIT = $(TOOLS)/semconvkit +SEMCONVKIT_FILES := $(sort $(shell find $(TOOLS_MOD_DIR)/semconvkit -type f)) +$(TOOLS)/semconvkit: PACKAGE=go.opentelemetry.io/otel/$(TOOLS_MOD_DIR)/semconvkit +$(TOOLS)/semconvkit: $(SEMCONVKIT_FILES) + +VERIFYREADMES = $(TOOLS)/verifyreadmes +VERIFYREADMES_FILES := $(sort $(shell find $(TOOLS_MOD_DIR)/verifyreadmes -type f)) +$(TOOLS)/verifyreadmes: PACKAGE=go.opentelemetry.io/otel/$(TOOLS_MOD_DIR)/verifyreadmes +$(TOOLS)/verifyreadmes: $(VERIFYREADMES_FILES) + +GOLANGCI_LINT = $(TOOLS)/golangci-lint +$(TOOLS)/golangci-lint: PACKAGE=github.com/golangci/golangci-lint/v2/cmd/golangci-lint + +MISSPELL = $(TOOLS)/misspell +$(TOOLS)/misspell: PACKAGE=github.com/client9/misspell/cmd/misspell + +GOCOVMERGE = $(TOOLS)/gocovmerge +$(TOOLS)/gocovmerge: PACKAGE=github.com/wadey/gocovmerge + +STRINGER = $(TOOLS)/stringer +$(TOOLS)/stringer: PACKAGE=golang.org/x/tools/cmd/stringer + +PORTO = $(TOOLS)/porto +$(TOOLS)/porto: PACKAGE=github.com/jcchavezs/porto/cmd/porto + +GOTMPL = $(TOOLS)/gotmpl +$(GOTMPL): PACKAGE=go.opentelemetry.io/build-tools/gotmpl + +GORELEASE = $(TOOLS)/gorelease +$(GORELEASE): PACKAGE=golang.org/x/exp/cmd/gorelease + +GOVULNCHECK = $(TOOLS)/govulncheck +$(TOOLS)/govulncheck: PACKAGE=golang.org/x/vuln/cmd/govulncheck + +.PHONY: tools +tools: $(CROSSLINK) $(GOLANGCI_LINT) $(MISSPELL) $(GOCOVMERGE) $(STRINGER) $(PORTO) $(VERIFYREADMES) $(MULTIMOD) $(SEMCONVKIT) $(GOTMPL) $(GORELEASE) + +# Virtualized python tools via docker + +# The directory where the virtual environment is created. +VENVDIR := venv + +# The directory where the python tools are installed. +PYTOOLS := $(VENVDIR)/bin + +# The pip executable in the virtual environment. +PIP := $(PYTOOLS)/pip + +# The directory in the docker image where the current directory is mounted. +WORKDIR := /workdir + +# The python image to use for the virtual environment. +PYTHONIMAGE := $(shell awk '$$4=="python" {print $$2}' $(DEPENDENCIES_DOCKERFILE)) + +# Run the python image with the current directory mounted. +DOCKERPY := docker run --rm -u $(DOCKER_USER) -v "$(CURDIR):$(WORKDIR)" -w $(WORKDIR) $(PYTHONIMAGE) + +# Create a virtual environment for Python tools. +$(PYTOOLS): +# The `--upgrade` flag is needed to ensure that the virtual environment is +# created with the latest pip version. + @$(DOCKERPY) bash -c "python3 -m venv $(VENVDIR) && $(PIP) install --upgrade --cache-dir=$(WORKDIR)/.cache/pip pip" + +# Install python packages into the virtual environment. +$(PYTOOLS)/%: $(PYTOOLS) + @$(DOCKERPY) $(PIP) install --cache-dir=$(WORKDIR)/.cache/pip -r requirements.txt + +CODESPELL = $(PYTOOLS)/codespell +$(CODESPELL): PACKAGE=codespell + +# Generate + +.PHONY: generate +generate: go-generate vanity-import-fix + +.PHONY: go-generate +go-generate: $(OTEL_GO_MOD_DIRS:%=go-generate/%) +go-generate/%: DIR=$* +go-generate/%: $(STRINGER) $(GOTMPL) + @echo "$(GO) generate $(DIR)/..." \ + && cd $(DIR) \ + && PATH="$(TOOLS):$${PATH}" $(GO) generate ./... + +.PHONY: vanity-import-fix +vanity-import-fix: $(PORTO) + @$(PORTO) --include-internal -w . + +# Generate go.work file for local development. +.PHONY: go-work +go-work: $(CROSSLINK) + $(CROSSLINK) work --root=$(shell pwd) --go=1.22.7 + +# Build + +.PHONY: build + +build: $(OTEL_GO_MOD_DIRS:%=build/%) $(OTEL_GO_MOD_DIRS:%=build-tests/%) +build/%: DIR=$* +build/%: + @echo "$(GO) build $(DIR)/..." \ + && cd $(DIR) \ + && $(GO) build ./... + +build-tests/%: DIR=$* +build-tests/%: + @echo "$(GO) build tests $(DIR)/..." \ + && cd $(DIR) \ + && $(GO) list ./... \ + | grep -v third_party \ + | xargs $(GO) test -vet=off -run xxxxxMatchNothingxxxxx >/dev/null + +# Tests + +TEST_TARGETS := test-default test-bench test-short test-verbose test-race test-concurrent-safe test-fuzz +.PHONY: $(TEST_TARGETS) test +test-default test-race: ARGS=-race +test-bench: ARGS=-run=xxxxxMatchNothingxxxxx -test.benchtime=1ms -bench=. +test-short: ARGS=-short +test-fuzz: ARGS=-fuzztime=10s -fuzz +test-verbose: ARGS=-v -race +test-concurrent-safe: ARGS=-run=ConcurrentSafe -count=100 -race +test-concurrent-safe: TIMEOUT=120 +$(TEST_TARGETS): test +test: $(OTEL_GO_MOD_DIRS:%=test/%) +test/%: DIR=$* +test/%: + @echo "$(GO) test -timeout $(TIMEOUT)s $(ARGS) $(DIR)/..." \ + && cd $(DIR) \ + && $(GO) list ./... \ + | grep -v third_party \ + | xargs $(GO) test -timeout $(TIMEOUT)s $(ARGS) + +COVERAGE_MODE = atomic +COVERAGE_PROFILE = coverage.out +.PHONY: test-coverage +test-coverage: $(GOCOVMERGE) + @set -e; \ + printf "" > coverage.txt; \ + for dir in $(ALL_COVERAGE_MOD_DIRS); do \ + echo "$(GO) test -coverpkg=go.opentelemetry.io/otel/... -covermode=$(COVERAGE_MODE) -coverprofile="$(COVERAGE_PROFILE)" $${dir}/..."; \ + (cd "$${dir}" && \ + $(GO) list ./... \ + | grep -v third_party \ + | grep -v 'semconv/v.*' \ + | xargs $(GO) test -coverpkg=./... -covermode=$(COVERAGE_MODE) -coverprofile="$(COVERAGE_PROFILE)" && \ + $(GO) tool cover -html=coverage.out -o coverage.html); \ + done; \ + $(GOCOVMERGE) $$(find . -name coverage.out) > coverage.txt + +.PHONY: benchmark +benchmark: $(OTEL_GO_MOD_DIRS:%=benchmark/%) +benchmark/%: + cd $* && $(GO) test -run='^$$' -bench=. $(ARGS) ./... + +print-sharded-benchmarks: + @echo $(OTEL_GO_MOD_DIRS) | jq -cR 'split(" ")' + +.PHONY: golangci-lint golangci-lint-fix +golangci-lint-fix: ARGS=--fix +golangci-lint-fix: golangci-lint +golangci-lint: $(OTEL_GO_MOD_DIRS:%=golangci-lint/%) +golangci-lint/%: DIR=$* +golangci-lint/%: $(GOLANGCI_LINT) + @echo 'golangci-lint $(if $(ARGS),$(ARGS) ,)$(DIR)' \ + && cd $(DIR) \ + && $(GOLANGCI_LINT) run --allow-serial-runners $(ARGS) + +.PHONY: crosslink +crosslink: $(CROSSLINK) + @echo "Updating intra-repository dependencies in all go modules" \ + && $(CROSSLINK) --root=$(shell pwd) --prune + +.PHONY: go-mod-tidy +go-mod-tidy: $(ALL_GO_MOD_DIRS:%=go-mod-tidy/%) +go-mod-tidy/%: DIR=$* +go-mod-tidy/%: crosslink + @echo "$(GO) mod tidy in $(DIR)" \ + && cd $(DIR) \ + && $(GO) mod tidy -compat=1.21 + +.PHONY: lint +lint: misspell go-mod-tidy golangci-lint + +.PHONY: vanity-import-check +vanity-import-check: $(PORTO) + @$(PORTO) --include-internal -l . || ( echo "(run: make vanity-import-fix)"; exit 1 ) + +.PHONY: misspell +misspell: $(MISSPELL) + @$(MISSPELL) -w $(ALL_DOCS) + +.PHONY: govulncheck +govulncheck: $(OTEL_GO_MOD_DIRS:%=govulncheck/%) +govulncheck/%: DIR=$* +govulncheck/%: $(GOVULNCHECK) + @echo "govulncheck ./... in $(DIR)" \ + && cd $(DIR) \ + && $(GOVULNCHECK) ./... + +.PHONY: codespell +codespell: $(CODESPELL) + @$(DOCKERPY) $(CODESPELL) + +.PHONY: toolchain-check +toolchain-check: + @toolchainRes=$$(for f in $(ALL_GO_MOD_DIRS); do \ + awk '/^toolchain/ { found=1; next } END { if (found) print FILENAME }' $$f/go.mod; \ + done); \ + if [ -n "$${toolchainRes}" ]; then \ + echo "toolchain checking failed:"; echo "$${toolchainRes}"; \ + exit 1; \ + fi + +.PHONY: license-check +license-check: + @licRes=$$(for f in $$(find . -type f \( -iname '*.go' -o -iname '*.sh' \) ! -path '**/third_party/*' ! -path './.git/*' ) ; do \ + awk '/Copyright The OpenTelemetry Authors|generated|GENERATED/ && NR<=4 { found=1; next } END { if (!found) print FILENAME }' $$f; \ + done); \ + if [ -n "$${licRes}" ]; then \ + echo "license header checking failed:"; echo "$${licRes}"; \ + exit 1; \ + fi + +.PHONY: check-clean-work-tree +check-clean-work-tree: + @if ! git diff --quiet; then \ + echo; \ + echo 'Working tree is not clean, did you forget to run "make precommit"?'; \ + echo; \ + git status; \ + exit 1; \ + fi + +# The weaver docker image to use for semconv-generate. +WEAVER_IMAGE := $(shell awk '$$4=="weaver" {print $$2}' $(DEPENDENCIES_DOCKERFILE)) + +SEMCONVPKG ?= "semconv/" +.PHONY: semconv-generate +semconv-generate: $(SEMCONVKIT) + [ "$(TAG)" ] || ( echo "TAG unset: missing opentelemetry semantic-conventions tag"; exit 1 ) + # Ensure the target directory for source code is available. + mkdir -p $(PWD)/$(SEMCONVPKG)/${TAG} + # Note: We mount a home directory for downloading/storing the semconv repository. + # Weaver will automatically clean the cache when finished, but the directories will remain. + mkdir -p ~/.weaver + docker run --rm \ + -u $(DOCKER_USER) \ + --env HOME=/tmp/weaver \ + --mount 'type=bind,source=$(PWD)/semconv/templates,target=/home/weaver/templates,readonly' \ + --mount 'type=bind,source=$(PWD)/semconv/${TAG},target=/home/weaver/target' \ + --mount 'type=bind,source=$(HOME)/.weaver,target=/tmp/weaver/.weaver' \ + $(WEAVER_IMAGE) registry generate \ + --registry=https://github.com/open-telemetry/semantic-conventions/archive/refs/tags/$(TAG).zip[model] \ + --templates=/home/weaver/templates \ + --param tag=$(TAG) \ + go \ + /home/weaver/target + $(SEMCONVKIT) -semconv "$(SEMCONVPKG)" -tag "$(TAG)" + +.PHONY: gorelease +gorelease: $(OTEL_GO_MOD_DIRS:%=gorelease/%) +gorelease/%: DIR=$* +gorelease/%:| $(GORELEASE) + @echo "gorelease in $(DIR):" \ + && cd $(DIR) \ + && $(GORELEASE) \ + || echo "" + +.PHONY: verify-mods +verify-mods: $(MULTIMOD) + $(MULTIMOD) verify + +.PHONY: prerelease +prerelease: verify-mods + @[ "${MODSET}" ] || ( echo ">> env var MODSET is not set"; exit 1 ) + $(MULTIMOD) prerelease -m ${MODSET} + +COMMIT ?= "HEAD" +.PHONY: add-tags +add-tags: verify-mods + @[ "${MODSET}" ] || ( echo ">> env var MODSET is not set"; exit 1 ) + $(MULTIMOD) tag -m ${MODSET} -c ${COMMIT} + +MARKDOWNIMAGE := $(shell awk '$$4=="markdown" {print $$2}' $(DEPENDENCIES_DOCKERFILE)) +.PHONY: lint-markdown +lint-markdown: + docker run --rm -u $(DOCKER_USER) -v "$(CURDIR):$(WORKDIR)" $(MARKDOWNIMAGE) -c $(WORKDIR)/.markdownlint.yaml $(WORKDIR)/**/*.md + +.PHONY: verify-readmes +verify-readmes: $(VERIFYREADMES) + $(VERIFYREADMES) diff --git a/vendor/go.opentelemetry.io/otel/README.md b/vendor/go.opentelemetry.io/otel/README.md new file mode 100644 index 00000000..16a72004 --- /dev/null +++ b/vendor/go.opentelemetry.io/otel/README.md @@ -0,0 +1,115 @@ +# OpenTelemetry-Go + +[![ci](https://github.com/open-telemetry/opentelemetry-go/actions/workflows/ci.yml/badge.svg?branch=main)](https://github.com/open-telemetry/opentelemetry-go/actions/workflows/ci.yml) +[![codecov.io](https://codecov.io/gh/open-telemetry/opentelemetry-go/coverage.svg?branch=main)](https://app.codecov.io/gh/open-telemetry/opentelemetry-go?branch=main) +[![PkgGoDev](https://pkg.go.dev/badge/go.opentelemetry.io/otel)](https://pkg.go.dev/go.opentelemetry.io/otel) +[![Go Report Card](https://goreportcard.com/badge/go.opentelemetry.io/otel)](https://goreportcard.com/report/go.opentelemetry.io/otel) +[![OpenSSF Scorecard](https://api.scorecard.dev/projects/github.com/open-telemetry/opentelemetry-go/badge)](https://scorecard.dev/viewer/?uri=github.com/open-telemetry/opentelemetry-go) +[![OpenSSF Best Practices](https://www.bestpractices.dev/projects/9996/badge)](https://www.bestpractices.dev/projects/9996) +[![Fuzzing Status](https://oss-fuzz-build-logs.storage.googleapis.com/badges/opentelemetry-go.svg)](https://issues.oss-fuzz.com/issues?q=project:opentelemetry-go) +[![FOSSA Status](https://app.fossa.com/api/projects/custom%2B162%2Fgithub.com%2Fopen-telemetry%2Fopentelemetry-go.svg?type=shield&issueType=license)](https://app.fossa.com/projects/custom%2B162%2Fgithub.com%2Fopen-telemetry%2Fopentelemetry-go?ref=badge_shield&issueType=license) +[![Slack](https://img.shields.io/badge/slack-@cncf/otel--go-brightgreen.svg?logo=slack)](https://cloud-native.slack.com/archives/C01NPAXACKT) + +OpenTelemetry-Go is the [Go](https://golang.org/) implementation of [OpenTelemetry](https://opentelemetry.io/). +It provides a set of APIs to directly measure performance and behavior of your software and send this data to observability platforms. + +## Project Status + +| Signal | Status | +|---------|--------------------| +| Traces | Stable | +| Metrics | Stable | +| Logs | Beta[^1] | + +Progress and status specific to this repository is tracked in our +[project boards](https://github.com/open-telemetry/opentelemetry-go/projects) +and +[milestones](https://github.com/open-telemetry/opentelemetry-go/milestones). + +Project versioning information and stability guarantees can be found in the +[versioning documentation](VERSIONING.md). + +[^1]: https://github.com/orgs/open-telemetry/projects/43 + +### Compatibility + +OpenTelemetry-Go ensures compatibility with the current supported versions of +the [Go language](https://golang.org/doc/devel/release#policy): + +> Each major Go release is supported until there are two newer major releases. +> For example, Go 1.5 was supported until the Go 1.7 release, and Go 1.6 was supported until the Go 1.8 release. + +For versions of Go that are no longer supported upstream, opentelemetry-go will +stop ensuring compatibility with these versions in the following manner: + +- A minor release of opentelemetry-go will be made to add support for the new + supported release of Go. +- The following minor release of opentelemetry-go will remove compatibility + testing for the oldest (now archived upstream) version of Go. This, and + future, releases of opentelemetry-go may include features only supported by + the currently supported versions of Go. + +Currently, this project supports the following environments. + +| OS | Go Version | Architecture | +|----------|------------|--------------| +| Ubuntu | 1.26 | amd64 | +| Ubuntu | 1.25 | amd64 | +| Ubuntu | 1.26 | 386 | +| Ubuntu | 1.25 | 386 | +| Ubuntu | 1.26 | arm64 | +| Ubuntu | 1.25 | arm64 | +| macOS | 1.26 | amd64 | +| macOS | 1.25 | amd64 | +| macOS | 1.26 | arm64 | +| macOS | 1.25 | arm64 | +| Windows | 1.26 | amd64 | +| Windows | 1.25 | amd64 | +| Windows | 1.26 | 386 | +| Windows | 1.25 | 386 | + +While this project should work for other systems, no compatibility guarantees +are made for those systems currently. + +## Getting Started + +You can find a getting started guide on [opentelemetry.io](https://opentelemetry.io/docs/languages/go/getting-started/). + +OpenTelemetry's goal is to provide a single set of APIs to capture distributed +traces and metrics from your application and send them to an observability +platform. This project allows you to do just that for applications written in +Go. There are two steps to this process: instrument your application, and +configure an exporter. + +### Instrumentation + +To start capturing distributed traces and metric events from your application +it first needs to be instrumented. The easiest way to do this is by using an +instrumentation library for your code. Be sure to check out [the officially +supported instrumentation +libraries](https://github.com/open-telemetry/opentelemetry-go-contrib/tree/main/instrumentation). + +If you need to extend the telemetry an instrumentation library provides or want +to build your own instrumentation for your application directly you will need +to use the +[Go otel](https://pkg.go.dev/go.opentelemetry.io/otel) +package. The [examples](https://github.com/open-telemetry/opentelemetry-go-contrib/tree/main/examples) +are a good way to see some practical uses of this process. + +### Export + +Now that your application is instrumented to collect telemetry, it needs an +export pipeline to send that telemetry to an observability platform. + +All officially supported exporters for the OpenTelemetry project are contained in the [exporters directory](./exporters). + +| Exporter | Logs | Metrics | Traces | +|---------------------------------------|:----:|:-------:|:------:| +| [OTLP](./exporters/otlp/) | ✓ | ✓ | ✓ | +| [Prometheus](./exporters/prometheus/) | | ✓ | | +| [stdout](./exporters/stdout/) | ✓ | ✓ | ✓ | +| [Zipkin](./exporters/zipkin/) | | | ✓ | + +## Contributing + +See the [contributing documentation](CONTRIBUTING.md). diff --git a/vendor/go.opentelemetry.io/otel/RELEASING.md b/vendor/go.opentelemetry.io/otel/RELEASING.md new file mode 100644 index 00000000..6aff7548 --- /dev/null +++ b/vendor/go.opentelemetry.io/otel/RELEASING.md @@ -0,0 +1,220 @@ +# Release Process + +## Create a `Version Release` issue + +Create a `Version Release` issue to track the release process. + +## Semantic Convention Upgrade + +### Semantic Convention Generation + +New versions of the [OpenTelemetry Semantic Conventions] mean new versions of the `semconv` package need to be generated. +The `semconv-generate` make target is used for this. + +1. Set the `TAG` environment variable to the semantic convention tag you want to generate. +2. Run the `make semconv-generate ...` target from this repository. + +For example, + +```sh +export TAG="v1.30.0" # Change to the release version you are generating. +make semconv-generate # Uses the exported TAG. +``` + +This should create a new sub-package of [`semconv`](./semconv). +Ensure things look correct before submitting a pull request to include the addition. + +The `CHANGELOG.md` should also be updated to reflect the new changes: + +```md +- The `go.opentelemetry.io/otel/semconv/` package. The package contains semantic conventions from the `` version of the OpenTelemetry Semantic Conventions. See the [migration documentation](./semconv//MIGRATION.md) for information on how to upgrade from `go.opentelemetry.io/otel/semconv/`. (#PR_NUMBER) +``` + +> **Tip:** Change to the release and prior version to match the changes + +### Update semconv imports + +Once the new semconv module has been generated, update all semconv imports throughout the codebase to reference the new version: + +```go +// Before +semconv "go.opentelemetry.io/otel/semconv/v1.37.0" +"go.opentelemetry.io/otel/semconv/v1.37.0/otelconv" + + +// After +semconv "go.opentelemetry.io/otel/semconv/v1.39.0" +"go.opentelemetry.io/otel/semconv/v1.39.0/otelconv" +``` + +Once complete, run `make` to check for any compilation or test failures. + +#### Handling attribute changes + +Some semconv releases might add new attributes or impact attributes that are currently being used. Changes could stem from a simple renaming, to more complex changes like merging attributes and property values being changed. + +One should update the code to the new attributes that supersede the impacted ones, hence sticking to the semantic conventions. However, legacy attributes might still be emitted in accordance to the `OTEL_SEMCONV_STABILITY_OPT_IN` environment variable. + +For an example on how such migration might have to be tracked and performed, see issue [#7806](https://github.com/open-telemetry/opentelemetry-go/issues/7806). + +### Go contrib linter update + +Update [.golangci.yml](https://github.com/open-telemetry/opentelemetry-go-contrib/blob/main/.golangci.yml) in [opentelemetry-go-contrib](https://github.com/open-telemetry/opentelemetry-go-contrib/) to mandate the new semconv version. + +## Breaking changes validation + +You can run `make gorelease` which runs [gorelease](https://pkg.go.dev/golang.org/x/exp/cmd/gorelease) to ensure that there are no unwanted changes made in the public API. + +You can check/report problems with `gorelease` [here](https://golang.org/issues/26420). + +## Verify changes for contrib repository + +If the changes in the main repository are going to affect the contrib repository, it is important to verify that the changes are compatible with the contrib repository. + +Follow [the steps](https://github.com/open-telemetry/opentelemetry-go-contrib/blob/main/RELEASING.md#verify-otel-changes) in the contrib repository to verify OTel changes. + +## Pre-Release + +First, decide which module sets will be released and update their versions +in `versions.yaml`. Commit this change to a new branch. + +Update go.mod for submodules to depend on the new release which will happen in the next step. + +1. Run the `prerelease` make target. It creates a branch + `prerelease__` that will contain all release changes. + + ``` + make prerelease MODSET= + ``` + +2. Verify the changes. + + ``` + git diff ...prerelease__ + ``` + + This should have changed the version for all modules to be ``. + If these changes look correct, merge them into your pre-release branch: + + ```go + git merge prerelease__ + ``` + +3. Update the [Changelog](./CHANGELOG.md). + - Make sure all relevant changes for this release are included and are written in language that non-contributors to the project can understand. + To verify this, you can look directly at the commits since the ``. + + ``` + git --no-pager log --pretty=oneline "..HEAD" + ``` + + - Move all the `Unreleased` changes into a new section following the title scheme (`[] - `). + - Make sure the new section is under the comment for released section, like ``, so it is protected from being overwritten in the future. + - Update all the appropriate links at the bottom. + +4. Push the changes to upstream and create a Pull Request on GitHub. + Be sure to include the curated changes from the [Changelog](./CHANGELOG.md) in the description. + +## Tag + +Once the Pull Request with all the version changes has been approved and merged it is time to tag the merged commit. + +***IMPORTANT***: It is critical you use the same tag that you used in the Pre-Release step! +Failure to do so will leave things in a broken state. As long as you do not +change `versions.yaml` between pre-release and this step, things should be fine. + +***IMPORTANT***: [There is currently no way to remove an incorrectly tagged version of a Go module](https://github.com/golang/go/issues/34189). +It is critical you make sure the version you push upstream is correct. +[Failure to do so will lead to minor emergencies and tough to work around](https://github.com/open-telemetry/opentelemetry-go/issues/331). + +1. For each module set that will be released, run the `add-tags` make target + using the `` of the commit on the main branch for the merged Pull Request. + + ``` + make add-tags MODSET= COMMIT= + ``` + + It should only be necessary to provide an explicit `COMMIT` value if the + current `HEAD` of your working directory is not the correct commit. + +2. Push tags to the upstream remote (not your fork: `github.com/open-telemetry/opentelemetry-go.git`). + Make sure you push all sub-modules as well. + + ``` + git push upstream + git push upstream + ... + ``` + +## Sign artifacts + +To ensure we comply with CNCF best practices, we need to sign the release artifacts. + +Download the `.tar.gz` and `.zip` archives from the [tags page](https://github.com/open-telemetry/opentelemetry-go/tags) for the new release tag. +Both archives need to be signed with your GPG key. + +You can use [this script] to verify the contents of the archives before signing them. + +To find your GPG key ID, run: + +```terminal +gpg --list-secret-keys --keyid-format=long +``` + +The key ID is the 16-character string after `sec rsa4096/` (or similar). + +Set environment variables and sign both artifacts: + +```terminal +export VERSION="" # e.g., v1.32.0 +export KEY_ID="" + +gpg --local-user $KEY_ID --armor --detach-sign opentelemetry-go-$VERSION.tar.gz +gpg --local-user $KEY_ID --armor --detach-sign opentelemetry-go-$VERSION.zip +``` + +You can verify the signatures with: + +```terminal +gpg --verify opentelemetry-go-$VERSION.tar.gz.asc opentelemetry-go-$VERSION.tar.gz +gpg --verify opentelemetry-go-$VERSION.zip.asc opentelemetry-go-$VERSION.zip +``` + +[this script]: https://github.com/MrAlias/attest-sh + +## Release + +Finally create a Release for the new `` on GitHub. +The release body should include all the release notes from the Changelog for this release. + +***IMPORTANT***: GitHub Releases are immutable once created. +You must upload the signed artifacts (`.tar.gz`, `.tar.gz.asc`, `.zip`, and `.zip.asc`) when creating the release, as they cannot be added or modified later. + +## Post-Release + +### Contrib Repository + +Once verified be sure to [make a release for the `contrib` repository](https://github.com/open-telemetry/opentelemetry-go-contrib/blob/main/RELEASING.md) that uses this release. + +### Website Documentation + +Update the [Go instrumentation documentation] in the OpenTelemetry website under [content/en/docs/languages/go]. +Importantly, bump any package versions referenced to be the latest one you just released and ensure all code examples still compile and are accurate. + +[OpenTelemetry Semantic Conventions]: https://github.com/open-telemetry/semantic-conventions +[Go instrumentation documentation]: https://opentelemetry.io/docs/languages/go/ +[content/en/docs/languages/go]: https://github.com/open-telemetry/opentelemetry.io/tree/main/content/en/docs/languages/go + +### Close the milestone + +Once a release is made, ensure all issues that were fixed and PRs that were merged as part of this release are added to the corresponding milestone. +This helps track what changes were included in each release. + +- To find issues that haven't been included in a milestone, use this [GitHub search query](https://github.com/open-telemetry/opentelemetry-go/issues?q=is%3Aissue%20no%3Amilestone%20is%3Aclosed%20sort%3Aupdated-desc%20reason%3Acompleted%20-label%3AStale%20linked%3Apr) +- To find merged PRs that haven't been included in a milestone, use this [GitHub search query](https://github.com/open-telemetry/opentelemetry-go/pulls?q=is%3Apr+no%3Amilestone+is%3Amerged). + +Once all related issues and PRs have been added to the milestone, close the milestone. + +### Close the `Version Release` issue + +Once the todo list in the `Version Release` issue is complete, close the issue. diff --git a/vendor/go.opentelemetry.io/otel/SECURITY-INSIGHTS.yml b/vendor/go.opentelemetry.io/otel/SECURITY-INSIGHTS.yml new file mode 100644 index 00000000..8041fc62 --- /dev/null +++ b/vendor/go.opentelemetry.io/otel/SECURITY-INSIGHTS.yml @@ -0,0 +1,203 @@ +header: + schema-version: "1.0.0" + expiration-date: "2026-08-04T00:00:00.000Z" + last-updated: "2025-08-04" + last-reviewed: "2025-08-04" + commit-hash: 69e81088ad40f45a0764597326722dea8f3f00a8 + project-url: https://github.com/open-telemetry/opentelemetry-go + project-release: "v1.37.0" + changelog: https://github.com/open-telemetry/opentelemetry-go/blob/69e81088ad40f45a0764597326722dea8f3f00a8/CHANGELOG.md + license: https://github.com/open-telemetry/opentelemetry-go/blob/69e81088ad40f45a0764597326722dea8f3f00a8/LICENSE + +project-lifecycle: + status: active + bug-fixes-only: false + core-maintainers: + - https://github.com/dmathieu + - https://github.com/dashpole + - https://github.com/pellared + - https://github.com/XSAM + - https://github.com/MrAlias + release-process: | + See https://github.com/open-telemetry/opentelemetry-go/blob/69e81088ad40f45a0764597326722dea8f3f00a8/RELEASING.md + +contribution-policy: + accepts-pull-requests: true + accepts-automated-pull-requests: true + automated-tools-list: + - automated-tool: dependabot + action: allowed + comment: Automated dependency updates are accepted. + - automated-tool: renovatebot + action: allowed + comment: Automated dependency updates are accepted. + - automated-tool: opentelemetrybot + action: allowed + comment: Automated OpenTelemetry actions are accepted. + contributing-policy: https://github.com/open-telemetry/opentelemetry-go/blob/69e81088ad40f45a0764597326722dea8f3f00a8/CONTRIBUTING.md + code-of-conduct: https://github.com/open-telemetry/.github/blob/ffa15f76b65ec7bcc41f6a0b277edbb74f832206/CODE_OF_CONDUCT.md + +documentation: + - https://pkg.go.dev/go.opentelemetry.io/otel + - https://opentelemetry.io/docs/instrumentation/go/ + +distribution-points: + - pkg:golang/go.opentelemetry.io/otel + - pkg:golang/go.opentelemetry.io/otel/bridge/opencensus + - pkg:golang/go.opentelemetry.io/otel/bridge/opencensus/test + - pkg:golang/go.opentelemetry.io/otel/bridge/opentracing + - pkg:golang/go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetricgrpc + - pkg:golang/go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetrichttp + - pkg:golang/go.opentelemetry.io/otel/exporters/otlp/otlptrace + - pkg:golang/go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc + - pkg:golang/go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracehttp + - pkg:golang/go.opentelemetry.io/otel/exporters/stdout/stdoutmetric + - pkg:golang/go.opentelemetry.io/otel/exporters/stdout/stdouttrace + - pkg:golang/go.opentelemetry.io/otel/exporters/zipkin + - pkg:golang/go.opentelemetry.io/otel/metric + - pkg:golang/go.opentelemetry.io/otel/sdk + - pkg:golang/go.opentelemetry.io/otel/sdk/metric + - pkg:golang/go.opentelemetry.io/otel/trace + - pkg:golang/go.opentelemetry.io/otel/exporters/prometheus + - pkg:golang/go.opentelemetry.io/otel/log + - pkg:golang/go.opentelemetry.io/otel/log/logtest + - pkg:golang/go.opentelemetry.io/otel/sdk/log + - pkg:golang/go.opentelemetry.io/otel/sdk/log/logtest + - pkg:golang/go.opentelemetry.io/otel/exporters/otlp/otlplog/otlploggrpc + - pkg:golang/go.opentelemetry.io/otel/exporters/otlp/otlplog/otlploghttp + - pkg:golang/go.opentelemetry.io/otel/exporters/stdout/stdoutlog + - pkg:golang/go.opentelemetry.io/otel/schema + +security-artifacts: + threat-model: + threat-model-created: false + comment: | + No formal threat model created yet. + self-assessment: + self-assessment-created: false + comment: | + No formal self-assessment yet. + +security-testing: + - tool-type: sca + tool-name: Dependabot + tool-version: latest + tool-url: https://github.com/dependabot + tool-rulesets: + - built-in + integration: + ad-hoc: false + ci: true + before-release: true + comment: | + Automated dependency updates. + - tool-type: sast + tool-name: golangci-lint + tool-version: latest + tool-url: https://github.com/golangci/golangci-lint + tool-rulesets: + - built-in + integration: + ad-hoc: false + ci: true + before-release: true + comment: | + Static analysis in CI. + - tool-type: fuzzing + tool-name: OSS-Fuzz + tool-version: latest + tool-url: https://github.com/google/oss-fuzz + tool-rulesets: + - default + integration: + ad-hoc: false + ci: false + before-release: false + comment: | + OpenTelemetry Go is integrated with OSS-Fuzz for continuous fuzz testing. See https://github.com/google/oss-fuzz/tree/f0f9b221190c6063a773bea606d192ebfc3d00cf/projects/opentelemetry-go for more details. + - tool-type: sast + tool-name: CodeQL + tool-version: latest + tool-url: https://github.com/github/codeql + tool-rulesets: + - default + integration: + ad-hoc: false + ci: true + before-release: true + comment: | + CodeQL static analysis is run in CI for all commits and pull requests to detect security vulnerabilities in the Go source code. See https://github.com/open-telemetry/opentelemetry-go/blob/d5b5b059849720144a03ca5c87561bfbdb940119/.github/workflows/codeql-analysis.yml for workflow details. + - tool-type: sca + tool-name: govulncheck + tool-version: latest + tool-url: https://pkg.go.dev/golang.org/x/vuln/cmd/govulncheck + tool-rulesets: + - default + integration: + ad-hoc: false + ci: true + before-release: true + comment: | + govulncheck is run in CI to detect known vulnerabilities in Go modules and code paths. See https://github.com/open-telemetry/opentelemetry-go/blob/v1.37.0/.github/workflows/ci.yml for workflow configuration. + +security-assessments: + - auditor-name: 7ASecurity + auditor-url: https://7asecurity.com + auditor-report: https://7asecurity.com/reports/pentest-report-opentelemetry.pdf + report-year: 2023 + comment: | + This independent penetration test by 7ASecurity covered OpenTelemetry repositories including opentelemetry-go. The assessment focused on codebase review, threat modeling, and vulnerability identification. See the report for details of findings and recommendations applicable to opentelemetry-go. No critical vulnerabilities were found for this repository. + +security-contacts: + - type: email + value: cncf-opentelemetry-security@lists.cncf.io + primary: true + - type: website + value: https://github.com/open-telemetry/opentelemetry-go/security/policy + primary: false + +vulnerability-reporting: + accepts-vulnerability-reports: true + email-contact: cncf-opentelemetry-security@lists.cncf.io + security-policy: https://github.com/open-telemetry/opentelemetry-go/security/policy + comment: | + Security issues should be reported via email or GitHub security policy page. + +dependencies: + third-party-packages: true + dependencies-lists: + - https://github.com/open-telemetry/opentelemetry-go/blob/v1.37.0/go.mod + - https://github.com/open-telemetry/opentelemetry-go/blob/v1.37.0/bridge/opencensus/go.mod + - https://github.com/open-telemetry/opentelemetry-go/blob/v1.37.0/bridge/opencensus/test/go.mod + - https://github.com/open-telemetry/opentelemetry-go/blob/v1.37.0/bridge/opentracing/go.mod + - https://github.com/open-telemetry/opentelemetry-go/blob/v1.37.0/exporters/otlp/otlplog/otlploggrpc/go.mod + - https://github.com/open-telemetry/opentelemetry-go/blob/v1.37.0/exporters/otlp/otlplog/otlploghttp/go.mod + - https://github.com/open-telemetry/opentelemetry-go/blob/v1.37.0/exporters/otlp/otlpmetric/otlpmetricgrpc/go.mod + - https://github.com/open-telemetry/opentelemetry-go/blob/v1.37.0/exporters/otlp/otlpmetric/otlpmetrichttp/go.mod + - https://github.com/open-telemetry/opentelemetry-go/blob/v1.37.0/exporters/otlp/otlptrace/go.mod + - https://github.com/open-telemetry/opentelemetry-go/blob/v1.37.0/exporters/otlp/otlptrace/otlptracegrpc/go.mod + - https://github.com/open-telemetry/opentelemetry-go/blob/v1.37.0/exporters/otlp/otlptrace/otlptracehttp/go.mod + - https://github.com/open-telemetry/opentelemetry-go/blob/v1.37.0/exporters/prometheus/go.mod + - https://github.com/open-telemetry/opentelemetry-go/blob/v1.37.0/exporters/stdout/stdoutlog/go.mod + - https://github.com/open-telemetry/opentelemetry-go/blob/v1.37.0/exporters/stdout/stdoutmetric/go.mod + - https://github.com/open-telemetry/opentelemetry-go/blob/v1.37.0/exporters/stdout/stdouttrace/go.mod + - https://github.com/open-telemetry/opentelemetry-go/blob/v1.37.0/exporters/zipkin/go.mod + - https://github.com/open-telemetry/opentelemetry-go/blob/v1.37.0/internal/tools/go.mod + - https://github.com/open-telemetry/opentelemetry-go/blob/v1.37.0/log/go.mod + - https://github.com/open-telemetry/opentelemetry-go/blob/v1.37.0/log/logtest/go.mod + - https://github.com/open-telemetry/opentelemetry-go/blob/v1.37.0/metric/go.mod + - https://github.com/open-telemetry/opentelemetry-go/blob/v1.37.0/schema/go.mod + - https://github.com/open-telemetry/opentelemetry-go/blob/v1.37.0/sdk/go.mod + - https://github.com/open-telemetry/opentelemetry-go/blob/v1.37.0/sdk/log/go.mod + - https://github.com/open-telemetry/opentelemetry-go/blob/v1.37.0/sdk/log/logtest/go.mod + - https://github.com/open-telemetry/opentelemetry-go/blob/v1.37.0/sdk/metric/go.mod + - https://github.com/open-telemetry/opentelemetry-go/blob/v1.37.0/trace/go.mod + - https://github.com/open-telemetry/opentelemetry-go/blob/v1.37.0/trace/internal/telemetry/test/go.mod + dependencies-lifecycle: + policy-url: https://github.com/open-telemetry/opentelemetry-go/blob/69e81088ad40f45a0764597326722dea8f3f00a8/CONTRIBUTING.md + comment: | + Dependency lifecycle managed via go.mod and renovatebot. + env-dependencies-policy: + policy-url: https://github.com/open-telemetry/opentelemetry-go/blob/69e81088ad40f45a0764597326722dea8f3f00a8/CONTRIBUTING.md + comment: | + See contributing policy for environment usage. diff --git a/vendor/go.opentelemetry.io/otel/VERSIONING.md b/vendor/go.opentelemetry.io/otel/VERSIONING.md new file mode 100644 index 00000000..b27c9e84 --- /dev/null +++ b/vendor/go.opentelemetry.io/otel/VERSIONING.md @@ -0,0 +1,224 @@ +# Versioning + +This document describes the versioning policy for this repository. This policy +is designed so the following goals can be achieved. + +**Users are provided a codebase of value that is stable and secure.** + +## Policy + +* Versioning of this project will be idiomatic of a Go project using [Go + modules](https://github.com/golang/go/wiki/Modules). + * [Semantic import + versioning](https://github.com/golang/go/wiki/Modules#semantic-import-versioning) + will be used. + * Versions will comply with [semver + 2.0](https://semver.org/spec/v2.0.0.html) with the following exceptions. + * New methods may be added to exported API interfaces. All exported + interfaces that fall within this exception will include the following + paragraph in their public documentation. + + > Warning: methods may be added to this interface in minor releases. + + * If a module is version `v2` or higher, the major version of the module + must be included as a `/vN` at the end of the module paths used in + `go.mod` files (e.g., `module go.opentelemetry.io/otel/v2`, `require + go.opentelemetry.io/otel/v2 v2.0.1`) and in the package import path + (e.g., `import "go.opentelemetry.io/otel/v2/trace"`). This includes the + paths used in `go get` commands (e.g., `go get + go.opentelemetry.io/otel/v2@v2.0.1`). Note there is both a `/v2` and a + `@v2.0.1` in that example. One way to think about it is that the module + name now includes the `/v2`, so include `/v2` whenever you are using the + module name). + * If a module is version `v0` or `v1`, do not include the major version in + either the module path or the import path. + * Modules will be used to encapsulate signals and components. + * Experimental modules still under active development will be versioned at + `v0` to imply the stability guarantee defined by + [semver](https://semver.org/spec/v2.0.0.html#spec-item-4). + + > Major version zero (0.y.z) is for initial development. Anything MAY + > change at any time. The public API SHOULD NOT be considered stable. + + * Mature modules for which we guarantee a stable public API will be versioned + with a major version greater than `v0`. + * The decision to make a module stable will be made on a case-by-case + basis by the maintainers of this project. + * Experimental modules will start their versioning at `v0.0.0` and will + increment their minor version when backwards incompatible changes are + released and increment their patch version when backwards compatible + changes are released. + * All stable modules that use the same major version number will use the + same entire version number. + * Stable modules may be released with an incremented minor or patch + version even though that module has not been changed, but rather so + that it will remain at the same version as other stable modules that + did undergo change. + * When an experimental module becomes stable a new stable module version + will be released and will include this now stable module. The new + stable module version will be an increment of the minor version number + and will be applied to all existing stable modules as well as the newly + stable module being released. +* Versioning of the associated [contrib + repository](https://github.com/open-telemetry/opentelemetry-go-contrib) of + this project will be idiomatic of a Go project using [Go + modules](https://github.com/golang/go/wiki/Modules). + * [Semantic import + versioning](https://github.com/golang/go/wiki/Modules#semantic-import-versioning) + will be used. + * Versions will comply with [semver 2.0](https://semver.org/spec/v2.0.0.html). + * If a module is version `v2` or higher, the + major version of the module must be included as a `/vN` at the end of the + module paths used in `go.mod` files (e.g., `module + go.opentelemetry.io/contrib/instrumentation/host/v2`, `require + go.opentelemetry.io/contrib/instrumentation/host/v2 v2.0.1`) and in the + package import path (e.g., `import + "go.opentelemetry.io/contrib/instrumentation/host/v2"`). This includes + the paths used in `go get` commands (e.g., `go get + go.opentelemetry.io/contrib/instrumentation/host/v2@v2.0.1`. Note there + is both a `/v2` and a `@v2.0.1` in that example. One way to think about + it is that the module name now includes the `/v2`, so include `/v2` + whenever you are using the module name). + * If a module is version `v0` or `v1`, do not include the major version + in either the module path or the import path. + * In addition to public APIs, telemetry produced by stable instrumentation + will remain stable and backwards compatible. This is to avoid breaking + alerts and dashboards. + * Modules will be used to encapsulate instrumentation, detectors, exporters, + propagators, and any other independent sets of related components. + * Experimental modules still under active development will be versioned at + `v0` to imply the stability guarantee defined by + [semver](https://semver.org/spec/v2.0.0.html#spec-item-4). + + > Major version zero (0.y.z) is for initial development. Anything MAY + > change at any time. The public API SHOULD NOT be considered stable. + + * Mature modules for which we guarantee a stable public API and telemetry will + be versioned with a major version greater than `v0`. + * Experimental modules will start their versioning at `v0.0.0` and will + increment their minor version when backwards incompatible changes are + released and increment their patch version when backwards compatible + changes are released. + * Stable contrib modules cannot depend on experimental modules from this + project. + * All stable contrib modules of the same major version with this project + will use the same entire version as this project. + * Stable modules may be released with an incremented minor or patch + version even though that module's code has not been changed. Instead + the only change that will have been included is to have updated that + modules dependency on this project's stable APIs. + * When an experimental module in contrib becomes stable a new stable + module version will be released and will include this now stable + module. The new stable module version will be an increment of the minor + version number and will be applied to all existing stable contrib + modules, this project's modules, and the newly stable module being + released. + * Contrib modules will be kept up to date with this project's releases. + * Due to the dependency contrib modules will implicitly have on this + project's modules the release of stable contrib modules to match the + released version number will be staggered after this project's release. + There is no explicit time guarantee for how long after this projects + release the contrib release will be. Effort should be made to keep them + as close in time as possible. + * No additional stable release in this project can be made until the + contrib repository has a matching stable release. + * No release can be made in the contrib repository after this project's + stable release except for a stable release of the contrib repository. +* GitHub releases will be made for all releases. +* Go modules will be made available at Go package mirrors. + +## Example Versioning Lifecycle + +To better understand the implementation of the above policy the following +example is provided. This project is simplified to include only the following +modules and their versions: + +* `otel`: `v0.14.0` +* `otel/trace`: `v0.14.0` +* `otel/metric`: `v0.14.0` +* `otel/baggage`: `v0.14.0` +* `otel/sdk/trace`: `v0.14.0` +* `otel/sdk/metric`: `v0.14.0` + +These modules have been developed to a point where the `otel/trace`, +`otel/baggage`, and `otel/sdk/trace` modules have reached a point that they +should be considered for a stable release. The `otel/metric` and +`otel/sdk/metric` are still under active development and the `otel` module +depends on both `otel/trace` and `otel/metric`. + +The `otel` package is refactored to remove its dependencies on `otel/metric` so +it can be released as stable as well. With that done the following release +candidates are made: + +* `otel`: `v1.0.0-RC1` +* `otel/trace`: `v1.0.0-RC1` +* `otel/baggage`: `v1.0.0-RC1` +* `otel/sdk/trace`: `v1.0.0-RC1` + +The `otel/metric` and `otel/sdk/metric` modules remain at `v0.14.0`. + +A few minor issues are discovered in the `otel/trace` package. These issues are +resolved with some minor, but backwards incompatible, changes and are released +as a second release candidate: + +* `otel`: `v1.0.0-RC2` +* `otel/trace`: `v1.0.0-RC2` +* `otel/baggage`: `v1.0.0-RC2` +* `otel/sdk/trace`: `v1.0.0-RC2` + +Notice that all module version numbers are incremented to adhere to our +versioning policy. + +After these release candidates have been evaluated to satisfaction, they are +released as version `v1.0.0`. + +* `otel`: `v1.0.0` +* `otel/trace`: `v1.0.0` +* `otel/baggage`: `v1.0.0` +* `otel/sdk/trace`: `v1.0.0` + +Since both the `go` utility and the Go module system support [the semantic +versioning definition of +precedence](https://semver.org/spec/v2.0.0.html#spec-item-11), this release +will correctly be interpreted as the successor to the previous release +candidates. + +Active development of this project continues. The `otel/metric` module now has +backwards incompatible changes to its API that need to be released and the +`otel/baggage` module has a minor bug fix that needs to be released. The +following release is made: + +* `otel`: `v1.0.1` +* `otel/trace`: `v1.0.1` +* `otel/metric`: `v0.15.0` +* `otel/baggage`: `v1.0.1` +* `otel/sdk/trace`: `v1.0.1` +* `otel/sdk/metric`: `v0.15.0` + +Notice that, again, all stable module versions are incremented in unison and +the `otel/sdk/metric` package, which depends on the `otel/metric` package, also +bumped its version. This bump of the `otel/sdk/metric` package makes sense +given their coupling, though it is not explicitly required by our versioning +policy. + +As we progress, the `otel/metric` and `otel/sdk/metric` packages have reached a +point where they should be evaluated for stability. The `otel` module is +reintegrated with the `otel/metric` package and the following release is made: + +* `otel`: `v1.1.0-RC1` +* `otel/trace`: `v1.1.0-RC1` +* `otel/metric`: `v1.1.0-RC1` +* `otel/baggage`: `v1.1.0-RC1` +* `otel/sdk/trace`: `v1.1.0-RC1` +* `otel/sdk/metric`: `v1.1.0-RC1` + +All the modules are evaluated and determined to a viable stable release. They +are then released as version `v1.1.0` (the minor version is incremented to +indicate the addition of new signal). + +* `otel`: `v1.1.0` +* `otel/trace`: `v1.1.0` +* `otel/metric`: `v1.1.0` +* `otel/baggage`: `v1.1.0` +* `otel/sdk/trace`: `v1.1.0` +* `otel/sdk/metric`: `v1.1.0` diff --git a/vendor/go.opentelemetry.io/otel/attribute/README.md b/vendor/go.opentelemetry.io/otel/attribute/README.md new file mode 100644 index 00000000..5b3da8f1 --- /dev/null +++ b/vendor/go.opentelemetry.io/otel/attribute/README.md @@ -0,0 +1,3 @@ +# Attribute + +[![PkgGoDev](https://pkg.go.dev/badge/go.opentelemetry.io/otel/attribute)](https://pkg.go.dev/go.opentelemetry.io/otel/attribute) diff --git a/vendor/go.opentelemetry.io/otel/attribute/doc.go b/vendor/go.opentelemetry.io/otel/attribute/doc.go new file mode 100644 index 00000000..eef51ebc --- /dev/null +++ b/vendor/go.opentelemetry.io/otel/attribute/doc.go @@ -0,0 +1,5 @@ +// Copyright The OpenTelemetry Authors +// SPDX-License-Identifier: Apache-2.0 + +// Package attribute provides key and value attributes. +package attribute // import "go.opentelemetry.io/otel/attribute" diff --git a/vendor/go.opentelemetry.io/otel/attribute/encoder.go b/vendor/go.opentelemetry.io/otel/attribute/encoder.go new file mode 100644 index 00000000..771dd69c --- /dev/null +++ b/vendor/go.opentelemetry.io/otel/attribute/encoder.go @@ -0,0 +1,135 @@ +// Copyright The OpenTelemetry Authors +// SPDX-License-Identifier: Apache-2.0 + +package attribute // import "go.opentelemetry.io/otel/attribute" + +import ( + "bytes" + "sync" + "sync/atomic" +) + +type ( + // Encoder is a mechanism for serializing an attribute set into a specific + // string representation that supports caching, to avoid repeated + // serialization. An example could be an exporter encoding the attribute + // set into a wire representation. + Encoder interface { + // Encode returns the serialized encoding of the attribute set using + // its Iterator. This result may be cached by an attribute.Set. + Encode(iterator Iterator) string + + // ID returns a value that is unique for each class of attribute + // encoder. Attribute encoders allocate these using `NewEncoderID`. + ID() EncoderID + } + + // EncoderID is used to identify distinct Encoder + // implementations, for caching encoded results. + EncoderID struct { + value uint64 + } + + // defaultAttrEncoder uses a sync.Pool of buffers to reduce the number of + // allocations used in encoding attributes. This implementation encodes a + // comma-separated list of key=value, with '/'-escaping of '=', ',', and + // '\'. + defaultAttrEncoder struct { + // pool is a pool of attribute set builders. The buffers in this pool + // grow to a size that most attribute encodings will not allocate new + // memory. + pool sync.Pool // *bytes.Buffer + } +) + +// escapeChar is used to ensure uniqueness of the attribute encoding where +// keys or values contain either '=' or ','. Since there is no parser needed +// for this encoding and its only requirement is to be unique, this choice is +// arbitrary. Users will see these in some exporters (e.g., stdout), so the +// backslash ('\') is used as a conventional choice. +const escapeChar = '\\' + +var ( + _ Encoder = &defaultAttrEncoder{} + + // encoderIDCounter is for generating IDs for other attribute encoders. + encoderIDCounter atomic.Uint64 + + defaultEncoderOnce sync.Once + defaultEncoderID = NewEncoderID() + defaultEncoderInstance *defaultAttrEncoder +) + +// NewEncoderID returns a unique attribute encoder ID. It should be called +// once per each type of attribute encoder. Preferably in init() or in var +// definition. +func NewEncoderID() EncoderID { + return EncoderID{value: encoderIDCounter.Add(1)} +} + +// DefaultEncoder returns an attribute encoder that encodes attributes in such +// a way that each escaped attribute's key is followed by an equal sign and +// then by an escaped attribute's value. All key-value pairs are separated by +// a comma. +// +// Escaping is done by prepending a backslash before either a backslash, equal +// sign or a comma. +func DefaultEncoder() Encoder { + defaultEncoderOnce.Do(func() { + defaultEncoderInstance = &defaultAttrEncoder{ + pool: sync.Pool{ + New: func() any { + return &bytes.Buffer{} + }, + }, + } + }) + return defaultEncoderInstance +} + +// Encode is a part of an implementation of the AttributeEncoder interface. +func (d *defaultAttrEncoder) Encode(iter Iterator) string { + buf := d.pool.Get().(*bytes.Buffer) + defer d.pool.Put(buf) + buf.Reset() + + for iter.Next() { + i, keyValue := iter.IndexedAttribute() + if i > 0 { + _ = buf.WriteByte(',') + } + copyAndEscape(buf, string(keyValue.Key)) + + _ = buf.WriteByte('=') + + if keyValue.Value.Type() == STRING { + copyAndEscape(buf, keyValue.Value.AsString()) + } else { + _, _ = buf.WriteString(keyValue.Value.Emit()) + } + } + return buf.String() +} + +// ID is a part of an implementation of the AttributeEncoder interface. +func (*defaultAttrEncoder) ID() EncoderID { + return defaultEncoderID +} + +// copyAndEscape escapes `=`, `,` and its own escape character (`\`), +// making the default encoding unique. +func copyAndEscape(buf *bytes.Buffer, val string) { + for _, ch := range val { + switch ch { + case '=', ',', escapeChar: + _ = buf.WriteByte(escapeChar) + } + _, _ = buf.WriteRune(ch) + } +} + +// Valid reports whether this encoder ID was allocated by +// [NewEncoderID]. Invalid encoder IDs will not be cached. +func (id EncoderID) Valid() bool { + return id.value != 0 +} diff --git a/vendor/go.opentelemetry.io/otel/attribute/filter.go b/vendor/go.opentelemetry.io/otel/attribute/filter.go new file mode 100644 index 00000000..624ebbe3 --- /dev/null +++ b/vendor/go.opentelemetry.io/otel/attribute/filter.go @@ -0,0 +1,49 @@ +// Copyright The OpenTelemetry Authors +// SPDX-License-Identifier: Apache-2.0 + +package attribute // import "go.opentelemetry.io/otel/attribute" + +// Filter supports removing certain attributes from attribute sets. When +// the filter returns true, the attribute will be kept in the filtered +// attribute set. When the filter returns false, the attribute is excluded +// from the filtered attribute set, and the attribute instead appears in +// the removed list of excluded attributes. +type Filter func(KeyValue) bool + +// NewAllowKeysFilter returns a Filter that only allows attributes with one of +// the provided keys. +// +// If keys is empty a deny-all filter is returned. +func NewAllowKeysFilter(keys ...Key) Filter { + if len(keys) == 0 { + return func(KeyValue) bool { return false } + } + + allowed := make(map[Key]struct{}, len(keys)) + for _, k := range keys { + allowed[k] = struct{}{} + } + return func(kv KeyValue) bool { + _, ok := allowed[kv.Key] + return ok + } +} + +// NewDenyKeysFilter returns a Filter that only allows attributes +// that do not have one of the provided keys. +// +// If keys is empty an allow-all filter is returned. +func NewDenyKeysFilter(keys ...Key) Filter { + if len(keys) == 0 { + return func(KeyValue) bool { return true } + } + + forbid := make(map[Key]struct{}, len(keys)) + for _, k := range keys { + forbid[k] = struct{}{} + } + return func(kv KeyValue) bool { + _, ok := forbid[kv.Key] + return !ok + } +} diff --git a/vendor/go.opentelemetry.io/otel/attribute/hash.go b/vendor/go.opentelemetry.io/otel/attribute/hash.go new file mode 100644 index 00000000..b09caaa6 --- /dev/null +++ b/vendor/go.opentelemetry.io/otel/attribute/hash.go @@ -0,0 +1,94 @@ +// Copyright The OpenTelemetry Authors +// SPDX-License-Identifier: Apache-2.0 + +package attribute // import "go.opentelemetry.io/otel/attribute" + +import ( + "fmt" + "reflect" + + "go.opentelemetry.io/otel/attribute/internal/xxhash" +) + +// Type identifiers. These identifiers are hashed before the value of the +// corresponding type. This is done to distinguish values that are hashed with +// the same value representation (e.g. `int64(1)` and `true`, []int64{0} and +// int64(0)). +// +// These are all 8 byte length strings converted to a uint64 representation. A +// uint64 is used instead of the string directly as an optimization, it avoids +// the for loop in [xxhash] which adds minor overhead. +const ( + boolID uint64 = 7953749933313450591 // "_boolean" (little endian) + int64ID uint64 = 7592915492740740150 // "64_bit_i" (little endian) + float64ID uint64 = 7376742710626956342 // "64_bit_f" (little endian) + stringID uint64 = 6874584755375207263 // "_string_" (little endian) + boolSliceID uint64 = 6875993255270243167 // "_[]bool_" (little endian) + int64SliceID uint64 = 3762322556277578591 // "_[]int64" (little endian) + float64SliceID uint64 = 7308324551835016539 // "[]double" (little endian) + stringSliceID uint64 = 7453010373645655387 // "[]string" (little endian) + emptyID uint64 = 7305809155345288421 // "__empty_" (little endian) +) + +// hashKVs returns a new xxHash64 hash of kvs. +func hashKVs(kvs []KeyValue) uint64 { + h := xxhash.New() + for _, kv := range kvs { + h = hashKV(h, kv) + } + return h.Sum64() +} + +// hashKV returns the xxHash64 hash of kv with h as the base. +func hashKV(h xxhash.Hash, kv KeyValue) xxhash.Hash { + h = h.String(string(kv.Key)) + + switch kv.Value.Type() { + case BOOL: + h = h.Uint64(boolID) + h = h.Uint64(kv.Value.numeric) + case INT64: + h = h.Uint64(int64ID) + h = h.Uint64(kv.Value.numeric) + case FLOAT64: + h = h.Uint64(float64ID) + // Assumes numeric stored with math.Float64bits. + h = h.Uint64(kv.Value.numeric) + case STRING: + h = h.Uint64(stringID) + h = h.String(kv.Value.stringly) + case BOOLSLICE: + h = h.Uint64(boolSliceID) + rv := reflect.ValueOf(kv.Value.slice) + for i := 0; i < rv.Len(); i++ { + h = h.Bool(rv.Index(i).Bool()) + } + case INT64SLICE: + h = h.Uint64(int64SliceID) + rv := reflect.ValueOf(kv.Value.slice) + for i := 0; i < rv.Len(); i++ { + h = h.Int64(rv.Index(i).Int()) + } + case FLOAT64SLICE: + h = h.Uint64(float64SliceID) + rv := reflect.ValueOf(kv.Value.slice) + for i := 0; i < rv.Len(); i++ { + h = h.Float64(rv.Index(i).Float()) + } + case STRINGSLICE: + h = h.Uint64(stringSliceID) + rv := reflect.ValueOf(kv.Value.slice) + for i := 0; i < rv.Len(); i++ { + h = h.String(rv.Index(i).String()) + } + case EMPTY: + h = h.Uint64(emptyID) + default: + // Logging is an alternative, but using the internal logger here + // causes an import cycle so it is not done. + v := kv.Value.AsInterface() + msg := fmt.Sprintf("unknown value type: %[1]v (%[1]T)", v) + panic(msg) + } + return h +} diff --git a/vendor/go.opentelemetry.io/otel/attribute/internal/attribute.go b/vendor/go.opentelemetry.io/otel/attribute/internal/attribute.go new file mode 100644 index 00000000..d9f51fa2 --- /dev/null +++ b/vendor/go.opentelemetry.io/otel/attribute/internal/attribute.go @@ -0,0 +1,75 @@ +// Copyright The OpenTelemetry Authors +// SPDX-License-Identifier: Apache-2.0 + +/* +Package attribute provide several helper functions for some commonly used +logic of processing attributes. +*/ +package attribute // import "go.opentelemetry.io/otel/attribute/internal" + +import ( + "reflect" +) + +// sliceElem is the exact set of element types stored in attribute slice values. +// Using a closed set prevents accidental instantiations for unsupported types. +type sliceElem interface { + bool | int64 | float64 | string +} + +// SliceValue converts a slice into an array with the same elements. +func SliceValue[T sliceElem](v []T) any { + // Keep only the common tiny-slice cases out of reflection. Extending this + // much further increases code size for diminishing benefit while larger + // slices still need the generic reflective path to preserve comparability. + // This matches the short lengths that show up most often in local + // benchmarks and semantic convention examples while leaving larger, less + // predictable slices on the generic reflective path. + switch len(v) { + case 0: + return [0]T{} + case 1: + return [1]T{v[0]} + case 2: + return [2]T{v[0], v[1]} + case 3: + return [3]T{v[0], v[1], v[2]} + } + + return sliceValueReflect(v) +} + +// AsSlice converts an array into a slice with the same elements. +func AsSlice[T sliceElem](v any) []T { + // Mirror the small fixed-array fast path used by SliceValue. + switch a := v.(type) { + case [0]T: + return []T{} + case [1]T: + return []T{a[0]} + case [2]T: + return []T{a[0], a[1]} + case [3]T: + return []T{a[0], a[1], a[2]} + } + + return asSliceReflect[T](v) +} + +func sliceValueReflect[T sliceElem](v []T) any { + cp := reflect.New(reflect.ArrayOf(len(v), reflect.TypeFor[T]())).Elem() + reflect.Copy(cp, reflect.ValueOf(v)) + return cp.Interface() +} + +func asSliceReflect[T sliceElem](v any) []T { + rv := reflect.ValueOf(v) + if !rv.IsValid() || rv.Kind() != reflect.Array || rv.Type().Elem() != reflect.TypeFor[T]() { + return nil + } + cpy := make([]T, rv.Len()) + if len(cpy) > 0 { + _ = reflect.Copy(reflect.ValueOf(cpy), rv) + } + return cpy +} diff --git a/vendor/go.opentelemetry.io/otel/attribute/internal/xxhash/xxhash.go b/vendor/go.opentelemetry.io/otel/attribute/internal/xxhash/xxhash.go new file mode 100644 index 00000000..113a9783 --- /dev/null +++ b/vendor/go.opentelemetry.io/otel/attribute/internal/xxhash/xxhash.go @@ -0,0 +1,64 @@ +// Copyright The OpenTelemetry Authors +// SPDX-License-Identifier: Apache-2.0 + +// Package xxhash provides a wrapper around the xxhash library for attribute hashing. +package xxhash // import "go.opentelemetry.io/otel/attribute/internal/xxhash" + +import ( + "encoding/binary" + "math" + + "github.com/cespare/xxhash/v2" +) + +// Hash wraps xxhash.Digest to provide an API friendly for hashing attribute values. +type Hash struct { + d *xxhash.Digest +} + +// New returns a new initialized xxHash64 hasher. +func New() Hash { + return Hash{d: xxhash.New()} +} + +func (h Hash) Uint64(val uint64) Hash { + var buf [8]byte + binary.LittleEndian.PutUint64(buf[:], val) + // errors from Write are always nil for xxhash + // if it returns an err then panic + _, err := h.d.Write(buf[:]) + if err != nil { + panic("xxhash write of uint64 failed: " + err.Error()) + } + return h +} + +func (h Hash) Bool(val bool) Hash { // nolint:revive // This is a hashing function. + if val { + return h.Uint64(1) + } + return h.Uint64(0) +} + +func (h Hash) Float64(val float64) Hash { + return h.Uint64(math.Float64bits(val)) +} + +func (h Hash) Int64(val int64) Hash { + return h.Uint64(uint64(val)) // nolint:gosec // Overflow doesn't matter since we are hashing. +} + +func (h Hash) String(val string) Hash { + // errors from WriteString are always nil for xxhash + // if it returns an err then panic + _, err := h.d.WriteString(val) + if err != nil { + panic("xxhash write of string failed: " + err.Error()) + } + return h +} + +// Sum64 returns the current hash value. +func (h Hash) Sum64() uint64 { + return h.d.Sum64() +} diff --git a/vendor/go.opentelemetry.io/otel/attribute/iterator.go b/vendor/go.opentelemetry.io/otel/attribute/iterator.go new file mode 100644 index 00000000..8df6249f --- /dev/null +++ b/vendor/go.opentelemetry.io/otel/attribute/iterator.go @@ -0,0 +1,151 @@ +// Copyright The OpenTelemetry Authors +// SPDX-License-Identifier: Apache-2.0 + +package attribute // import "go.opentelemetry.io/otel/attribute" + +// Iterator allows iterating over the set of attributes in order, sorted by +// key. +type Iterator struct { + storage *Set + idx int +} + +// MergeIterator supports iterating over two sets of attributes while +// eliminating duplicate values from the combined set. The first iterator +// value takes precedence. +type MergeIterator struct { + one oneIterator + two oneIterator + current KeyValue +} + +type oneIterator struct { + iter Iterator + done bool + attr KeyValue +} + +// Next moves the iterator to the next position. +// Next reports whether there are more attributes. +func (i *Iterator) Next() bool { + i.idx++ + return i.idx < i.Len() +} + +// Label returns current KeyValue. Must be called only after Next returns +// true. +// +// Deprecated: Use Attribute instead. +func (i *Iterator) Label() KeyValue { + return i.Attribute() +} + +// Attribute returns the current KeyValue of the Iterator. It must be called +// only after Next returns true. +func (i *Iterator) Attribute() KeyValue { + kv, _ := i.storage.Get(i.idx) + return kv +} + +// IndexedLabel returns current index and attribute. Must be called only +// after Next returns true. +// +// Deprecated: Use IndexedAttribute instead. +func (i *Iterator) IndexedLabel() (int, KeyValue) { + return i.idx, i.Attribute() +} + +// IndexedAttribute returns current index and attribute. Must be called only +// after Next returns true. +func (i *Iterator) IndexedAttribute() (int, KeyValue) { + return i.idx, i.Attribute() +} + +// Len returns a number of attributes in the iterated set. +func (i *Iterator) Len() int { + return i.storage.Len() +} + +// ToSlice is a convenience function that creates a slice of attributes from +// the passed iterator. The iterator is set up to start from the beginning +// before creating the slice. +func (i *Iterator) ToSlice() []KeyValue { + l := i.Len() + if l == 0 { + return nil + } + i.idx = -1 + slice := make([]KeyValue, 0, l) + for i.Next() { + slice = append(slice, i.Attribute()) + } + return slice +} + +// NewMergeIterator returns a MergeIterator for merging two attribute sets. +// Duplicates are resolved by taking the value from the first set. +func NewMergeIterator(s1, s2 *Set) MergeIterator { + mi := MergeIterator{ + one: makeOne(s1.Iter()), + two: makeOne(s2.Iter()), + } + return mi +} + +func makeOne(iter Iterator) oneIterator { + oi := oneIterator{ + iter: iter, + } + oi.advance() + return oi +} + +func (oi *oneIterator) advance() { + if oi.done = !oi.iter.Next(); !oi.done { + oi.attr = oi.iter.Attribute() + } +} + +// Next moves the iterator to the next position. +// Next reports whether there is another attribute available. +func (m *MergeIterator) Next() bool { + if m.one.done && m.two.done { + return false + } + if m.one.done { + m.current = m.two.attr + m.two.advance() + return true + } + if m.two.done { + m.current = m.one.attr + m.one.advance() + return true + } + if m.one.attr.Key == m.two.attr.Key { + m.current = m.one.attr // first iterator attribute value wins + m.one.advance() + m.two.advance() + return true + } + if m.one.attr.Key < m.two.attr.Key { + m.current = m.one.attr + m.one.advance() + return true + } + m.current = m.two.attr + m.two.advance() + return true +} + +// Label returns the current value after Next() returns true. +// +// Deprecated: Use Attribute instead. +func (m *MergeIterator) Label() KeyValue { + return m.current +} + +// Attribute returns the current value after Next() returns true. +func (m *MergeIterator) Attribute() KeyValue { + return m.current +} diff --git a/vendor/go.opentelemetry.io/otel/attribute/key.go b/vendor/go.opentelemetry.io/otel/attribute/key.go new file mode 100644 index 00000000..80a9e564 --- /dev/null +++ b/vendor/go.opentelemetry.io/otel/attribute/key.go @@ -0,0 +1,123 @@ +// Copyright The OpenTelemetry Authors +// SPDX-License-Identifier: Apache-2.0 + +package attribute // import "go.opentelemetry.io/otel/attribute" + +// Key represents the key part in key-value pairs. It's a string. The +// allowed character set in the key depends on the use of the key. +type Key string + +// Bool creates a KeyValue instance with a BOOL Value. +// +// If creating both a key and value at the same time, use the provided +// convenience function instead -- Bool(name, value). +func (k Key) Bool(v bool) KeyValue { + return KeyValue{ + Key: k, + Value: BoolValue(v), + } +} + +// BoolSlice creates a KeyValue instance with a BOOLSLICE Value. +// +// If creating both a key and value at the same time, use the provided +// convenience function instead -- BoolSlice(name, value). +func (k Key) BoolSlice(v []bool) KeyValue { + return KeyValue{ + Key: k, + Value: BoolSliceValue(v), + } +} + +// Int creates a KeyValue instance with an INT64 Value. +// +// If creating both a key and value at the same time, use the provided +// convenience function instead -- Int(name, value). +func (k Key) Int(v int) KeyValue { + return KeyValue{ + Key: k, + Value: IntValue(v), + } +} + +// IntSlice creates a KeyValue instance with an INT64SLICE Value. +// +// If creating both a key and value at the same time, use the provided +// convenience function instead -- IntSlice(name, value). +func (k Key) IntSlice(v []int) KeyValue { + return KeyValue{ + Key: k, + Value: IntSliceValue(v), + } +} + +// Int64 creates a KeyValue instance with an INT64 Value. +// +// If creating both a key and value at the same time, use the provided +// convenience function instead -- Int64(name, value). +func (k Key) Int64(v int64) KeyValue { + return KeyValue{ + Key: k, + Value: Int64Value(v), + } +} + +// Int64Slice creates a KeyValue instance with an INT64SLICE Value. +// +// If creating both a key and value at the same time, use the provided +// convenience function instead -- Int64Slice(name, value). +func (k Key) Int64Slice(v []int64) KeyValue { + return KeyValue{ + Key: k, + Value: Int64SliceValue(v), + } +} + +// Float64 creates a KeyValue instance with a FLOAT64 Value. +// +// If creating both a key and value at the same time, use the provided +// convenience function instead -- Float64(name, value). +func (k Key) Float64(v float64) KeyValue { + return KeyValue{ + Key: k, + Value: Float64Value(v), + } +} + +// Float64Slice creates a KeyValue instance with a FLOAT64SLICE Value. +// +// If creating both a key and value at the same time, use the provided +// convenience function instead -- Float64(name, value). +func (k Key) Float64Slice(v []float64) KeyValue { + return KeyValue{ + Key: k, + Value: Float64SliceValue(v), + } +} + +// String creates a KeyValue instance with a STRING Value. +// +// If creating both a key and value at the same time, use the provided +// convenience function instead -- String(name, value). +func (k Key) String(v string) KeyValue { + return KeyValue{ + Key: k, + Value: StringValue(v), + } +} + +// StringSlice creates a KeyValue instance with a STRINGSLICE Value. +// +// If creating both a key and value at the same time, use the provided +// convenience function instead -- StringSlice(name, value). +func (k Key) StringSlice(v []string) KeyValue { + return KeyValue{ + Key: k, + Value: StringSliceValue(v), + } +} + +// Defined reports whether the key is not empty. +func (k Key) Defined() bool { + return len(k) != 0 +} diff --git a/vendor/go.opentelemetry.io/otel/attribute/kv.go b/vendor/go.opentelemetry.io/otel/attribute/kv.go new file mode 100644 index 00000000..0cc36801 --- /dev/null +++ b/vendor/go.opentelemetry.io/otel/attribute/kv.go @@ -0,0 +1,75 @@ +// Copyright The OpenTelemetry Authors +// SPDX-License-Identifier: Apache-2.0 + +package attribute // import "go.opentelemetry.io/otel/attribute" + +import ( + "fmt" +) + +// KeyValue holds a key and value pair. +type KeyValue struct { + Key Key + Value Value +} + +// Valid reports whether kv is a valid OpenTelemetry attribute. +func (kv KeyValue) Valid() bool { + return kv.Key.Defined() +} + +// Bool creates a KeyValue with a BOOL Value type. +func Bool(k string, v bool) KeyValue { + return Key(k).Bool(v) +} + +// BoolSlice creates a KeyValue with a BOOLSLICE Value type. +func BoolSlice(k string, v []bool) KeyValue { + return Key(k).BoolSlice(v) +} + +// Int creates a KeyValue with an INT64 Value type. +func Int(k string, v int) KeyValue { + return Key(k).Int(v) +} + +// IntSlice creates a KeyValue with an INT64SLICE Value type. +func IntSlice(k string, v []int) KeyValue { + return Key(k).IntSlice(v) +} + +// Int64 creates a KeyValue with an INT64 Value type. +func Int64(k string, v int64) KeyValue { + return Key(k).Int64(v) +} + +// Int64Slice creates a KeyValue with an INT64SLICE Value type. +func Int64Slice(k string, v []int64) KeyValue { + return Key(k).Int64Slice(v) +} + +// Float64 creates a KeyValue with a FLOAT64 Value type. +func Float64(k string, v float64) KeyValue { + return Key(k).Float64(v) +} + +// Float64Slice creates a KeyValue with a FLOAT64SLICE Value type. +func Float64Slice(k string, v []float64) KeyValue { + return Key(k).Float64Slice(v) +} + +// String creates a KeyValue with a STRING Value type. +func String(k, v string) KeyValue { + return Key(k).String(v) +} + +// StringSlice creates a KeyValue with a STRINGSLICE Value type. +func StringSlice(k string, v []string) KeyValue { + return Key(k).StringSlice(v) +} + +// Stringer creates a new key-value pair with a passed name and a string +// value generated by the passed Stringer interface. +func Stringer(k string, v fmt.Stringer) KeyValue { + return Key(k).String(v.String()) +} diff --git a/vendor/go.opentelemetry.io/otel/attribute/rawhelpers.go b/vendor/go.opentelemetry.io/otel/attribute/rawhelpers.go new file mode 100644 index 00000000..5791c6e7 --- /dev/null +++ b/vendor/go.opentelemetry.io/otel/attribute/rawhelpers.go @@ -0,0 +1,37 @@ +// Copyright The OpenTelemetry Authors +// SPDX-License-Identifier: Apache-2.0 + +package attribute // import "go.opentelemetry.io/otel/attribute" + +import ( + "math" +) + +func boolToRaw(b bool) uint64 { // nolint:revive // b is not a control flag. + if b { + return 1 + } + return 0 +} + +func rawToBool(r uint64) bool { + return r != 0 +} + +func int64ToRaw(i int64) uint64 { + // Assumes original was a valid int64 (overflow not checked). + return uint64(i) // nolint: gosec +} + +func rawToInt64(r uint64) int64 { + // Assumes original was a valid int64 (overflow not checked). + return int64(r) // nolint: gosec +} + +func float64ToRaw(f float64) uint64 { + return math.Float64bits(f) +} + +func rawToFloat64(r uint64) float64 { + return math.Float64frombits(r) +} diff --git a/vendor/go.opentelemetry.io/otel/attribute/set.go b/vendor/go.opentelemetry.io/otel/attribute/set.go new file mode 100644 index 00000000..6572c98b --- /dev/null +++ b/vendor/go.opentelemetry.io/otel/attribute/set.go @@ -0,0 +1,436 @@ +// Copyright The OpenTelemetry Authors +// SPDX-License-Identifier: Apache-2.0 + +package attribute // import "go.opentelemetry.io/otel/attribute" + +import ( + "cmp" + "encoding/json" + "reflect" + "slices" + "sort" + + "go.opentelemetry.io/otel/attribute/internal/xxhash" +) + +type ( + // Set is the representation for a distinct attribute set. It manages an + // immutable set of attributes, with an internal cache for storing + // attribute encodings. + // + // This type will remain comparable for backwards compatibility. The + // equivalence of Sets across versions is not guaranteed to be stable. + // Prior versions may find two Sets to be equal or not when compared + // directly (i.e. ==), but subsequent versions may not. Users should use + // the Equals method to ensure stable equivalence checking. + // + // Users should also use the Distinct returned from Equivalent as a map key + // instead of a Set directly. Set has relatively poor performance when used + // as a map key compared to Distinct. + Set struct { + hash uint64 + data any + } + + // Distinct is an identifier of a Set which is very likely to be unique. + // + // Distinct should be used as a map key instead of a Set for to provide better + // performance for map operations. + Distinct struct { + hash uint64 + } + + // Sortable implements sort.Interface, used for sorting KeyValue. + // + // Deprecated: This type is no longer used. It was added as a performance + // optimization for Go < 1.21 that is no longer needed (Go < 1.21 is no + // longer supported by the module). + Sortable []KeyValue +) + +// Compile time check these types remain comparable. +var ( + _ = isComparable(Set{}) + _ = isComparable(Distinct{}) +) + +func isComparable[T comparable](t T) T { return t } + +var ( + // keyValueType is used in computeDistinctReflect. + keyValueType = reflect.TypeFor[KeyValue]() + + // emptyHash is the hash of an empty set. + emptyHash = xxhash.New().Sum64() + + // userDefinedEmptySet is an empty set. It was mistakenly exposed to users + // as something they can assign to, so it must remain addressable and + // mutable. + // + // This is kept for backwards compatibility, but should not be used in new code. + userDefinedEmptySet = &Set{ + hash: emptyHash, + data: [0]KeyValue{}, + } + + emptySet = Set{ + hash: emptyHash, + data: [0]KeyValue{}, + } +) + +// EmptySet returns a reference to a Set with no elements. +// +// This is a convenience provided for optimized calling utility. +func EmptySet() *Set { + // Continue to return the pointer to the user-defined empty set for + // backwards-compatibility. + // + // New code should not use this, instead use emptySet. + return userDefinedEmptySet +} + +// Valid reports whether this value refers to a valid Set. +func (d Distinct) Valid() bool { return d.hash != 0 } + +// reflectValue abbreviates reflect.ValueOf(d). +func (l Set) reflectValue() reflect.Value { + return reflect.ValueOf(l.data) +} + +// Len returns the number of attributes in this set. +func (l *Set) Len() int { + if l == nil || l.hash == 0 { + return 0 + } + return l.reflectValue().Len() +} + +// Get returns the KeyValue at ordered position idx in this set. +func (l *Set) Get(idx int) (KeyValue, bool) { + if l == nil || l.hash == 0 { + return KeyValue{}, false + } + value := l.reflectValue() + + if idx >= 0 && idx < value.Len() { + // Note: The Go compiler successfully avoids an allocation for + // the interface{} conversion here: + return value.Index(idx).Interface().(KeyValue), true + } + + return KeyValue{}, false +} + +// Value returns the value of a specified key in this set. +func (l *Set) Value(k Key) (Value, bool) { + if l == nil || l.hash == 0 { + return Value{}, false + } + rValue := l.reflectValue() + vlen := rValue.Len() + + idx := sort.Search(vlen, func(idx int) bool { + return rValue.Index(idx).Interface().(KeyValue).Key >= k + }) + if idx >= vlen { + return Value{}, false + } + keyValue := rValue.Index(idx).Interface().(KeyValue) + if k == keyValue.Key { + return keyValue.Value, true + } + return Value{}, false +} + +// HasValue reports whether a key is defined in this set. +func (l *Set) HasValue(k Key) bool { + if l == nil { + return false + } + _, ok := l.Value(k) + return ok +} + +// Iter returns an iterator for visiting the attributes in this set. +func (l *Set) Iter() Iterator { + return Iterator{ + storage: l, + idx: -1, + } +} + +// ToSlice returns the set of attributes belonging to this set, sorted, where +// keys appear no more than once. +func (l *Set) ToSlice() []KeyValue { + iter := l.Iter() + return iter.ToSlice() +} + +// Equivalent returns a value that may be used as a map key. Equal Distinct +// values are very likely to be equivalent attribute Sets. Distinct value of any +// attribute set with the same elements as this, where sets are made unique by +// choosing the last value in the input for any given key. +func (l *Set) Equivalent() Distinct { + if l == nil || l.hash == 0 { + return Distinct{hash: emptySet.hash} + } + return Distinct{hash: l.hash} +} + +// Equals reports whether the argument set is equivalent to this set. +func (l *Set) Equals(o *Set) bool { + if l.Equivalent() != o.Equivalent() { + return false + } + if l == nil || l.hash == 0 { + l = &emptySet + } + if o == nil || o.hash == 0 { + o = &emptySet + } + return l.data == o.data +} + +// Encoded returns the encoded form of this set, according to encoder. +func (l *Set) Encoded(encoder Encoder) string { + if l == nil || encoder == nil { + return "" + } + + return encoder.Encode(l.Iter()) +} + +// NewSet returns a new Set. See the documentation for +// NewSetWithSortableFiltered for more details. +// +// Except for empty sets, this method adds an additional allocation compared +// with calls that include a Sortable. +func NewSet(kvs ...KeyValue) Set { + s, _ := NewSetWithFiltered(kvs, nil) + return s +} + +// NewSetWithSortable returns a new Set. See the documentation for +// NewSetWithSortableFiltered for more details. +// +// This call includes a Sortable option as a memory optimization. +// +// Deprecated: Use [NewSet] instead. +func NewSetWithSortable(kvs []KeyValue, _ *Sortable) Set { + s, _ := NewSetWithFiltered(kvs, nil) + return s +} + +// NewSetWithFiltered returns a new Set. See the documentation for +// NewSetWithSortableFiltered for more details. +// +// This call includes a Filter to include/exclude attribute keys from the +// return value. Excluded keys are returned as a slice of attribute values. +func NewSetWithFiltered(kvs []KeyValue, filter Filter) (Set, []KeyValue) { + // Check for empty set. + if len(kvs) == 0 { + return emptySet, nil + } + + // Stable sort so the following de-duplication can implement + // last-value-wins semantics. + slices.SortStableFunc(kvs, func(a, b KeyValue) int { + return cmp.Compare(a.Key, b.Key) + }) + + position := len(kvs) - 1 + offset := position - 1 + + // The requirements stated above require that the stable + // result be placed in the end of the input slice, while + // overwritten values are swapped to the beginning. + // + // De-duplicate with last-value-wins semantics. Preserve + // duplicate values at the beginning of the input slice. + for ; offset >= 0; offset-- { + if kvs[offset].Key == kvs[position].Key { + continue + } + position-- + kvs[offset], kvs[position] = kvs[position], kvs[offset] + } + kvs = kvs[position:] + + if filter != nil { + if div := filteredToFront(kvs, filter); div != 0 { + return newSet(kvs[div:]), kvs[:div] + } + } + return newSet(kvs), nil +} + +// NewSetWithSortableFiltered returns a new Set. +// +// Duplicate keys are eliminated by taking the last value. This +// re-orders the input slice so that unique last-values are contiguous +// at the end of the slice. +// +// This ensures the following: +// +// - Last-value-wins semantics +// - Caller sees the reordering, but doesn't lose values +// - Repeated call preserve last-value wins. +// +// Note that methods are defined on Set, although this returns Set. Callers +// can avoid memory allocations by: +// +// - allocating a Sortable for use as a temporary in this method +// - allocating a Set for storing the return value of this constructor. +// +// The result maintains a cache of encoded attributes, by attribute.EncoderID. +// This value should not be copied after its first use. +// +// The second []KeyValue return value is a list of attributes that were +// excluded by the Filter (if non-nil). +// +// Deprecated: Use [NewSetWithFiltered] instead. +func NewSetWithSortableFiltered(kvs []KeyValue, _ *Sortable, filter Filter) (Set, []KeyValue) { + return NewSetWithFiltered(kvs, filter) +} + +// filteredToFront filters slice in-place using keep function. All KeyValues that need to +// be removed are moved to the front. All KeyValues that need to be kept are +// moved (in-order) to the back. The index for the first KeyValue to be kept is +// returned. +func filteredToFront(slice []KeyValue, keep Filter) int { + n := len(slice) + j := n + for i := n - 1; i >= 0; i-- { + if keep(slice[i]) { + j-- + slice[i], slice[j] = slice[j], slice[i] + } + } + return j +} + +// Filter returns a filtered copy of this Set. See the documentation for +// NewSetWithSortableFiltered for more details. +func (l *Set) Filter(re Filter) (Set, []KeyValue) { + if re == nil { + return *l, nil + } + + // Iterate in reverse to the first attribute that will be filtered out. + n := l.Len() + first := n - 1 + for ; first >= 0; first-- { + kv, _ := l.Get(first) + if !re(kv) { + break + } + } + + // No attributes will be dropped, return the immutable Set l and nil. + if first < 0 { + return *l, nil + } + + // Copy now that we know we need to return a modified set. + // + // Do not do this in-place on the underlying storage of *Set l. Sets are + // immutable and filtering should not change this. + slice := l.ToSlice() + + // Don't re-iterate the slice if only slice[0] is filtered. + if first == 0 { + // It is safe to assume len(slice) >= 1 given we found at least one + // attribute above that needs to be filtered out. + return newSet(slice[1:]), slice[:1] + } + + // Move the filtered slice[first] to the front (preserving order). + kv := slice[first] + copy(slice[1:first+1], slice[:first]) + slice[0] = kv + + // Do not re-evaluate re(slice[first+1:]). + div := filteredToFront(slice[1:first+1], re) + 1 + return newSet(slice[div:]), slice[:div] +} + +// newSet returns a new set based on the sorted and uniqued kvs. +func newSet(kvs []KeyValue) Set { + s := Set{ + hash: hashKVs(kvs), + data: computeDataFixed(kvs), + } + if s.data == nil { + s.data = computeDataReflect(kvs) + } + return s +} + +// computeDataFixed computes a Set data for small slices. It returns nil if the +// input is too large for this code path. +func computeDataFixed(kvs []KeyValue) any { + switch len(kvs) { + case 1: + return [1]KeyValue(kvs) + case 2: + return [2]KeyValue(kvs) + case 3: + return [3]KeyValue(kvs) + case 4: + return [4]KeyValue(kvs) + case 5: + return [5]KeyValue(kvs) + case 6: + return [6]KeyValue(kvs) + case 7: + return [7]KeyValue(kvs) + case 8: + return [8]KeyValue(kvs) + case 9: + return [9]KeyValue(kvs) + case 10: + return [10]KeyValue(kvs) + default: + return nil + } +} + +// computeDataReflect computes a Set data using reflection, works for any size +// input. +func computeDataReflect(kvs []KeyValue) any { + at := reflect.New(reflect.ArrayOf(len(kvs), keyValueType)).Elem() + for i, keyValue := range kvs { + *(at.Index(i).Addr().Interface().(*KeyValue)) = keyValue + } + return at.Interface() +} + +// MarshalJSON returns the JSON encoding of the Set. +func (l *Set) MarshalJSON() ([]byte, error) { + return json.Marshal(l.data) +} + +// MarshalLog is the marshaling function used by the logging system to represent this Set. +func (l Set) MarshalLog() any { + kvs := make(map[string]string) + for _, kv := range l.ToSlice() { + kvs[string(kv.Key)] = kv.Value.Emit() + } + return kvs +} + +// Len implements sort.Interface. +func (l *Sortable) Len() int { + return len(*l) +} + +// Swap implements sort.Interface. +func (l *Sortable) Swap(i, j int) { + (*l)[i], (*l)[j] = (*l)[j], (*l)[i] +} + +// Less implements sort.Interface. +func (l *Sortable) Less(i, j int) bool { + return (*l)[i].Key < (*l)[j].Key +} diff --git a/vendor/go.opentelemetry.io/otel/attribute/type_string.go b/vendor/go.opentelemetry.io/otel/attribute/type_string.go new file mode 100644 index 00000000..6c04448d --- /dev/null +++ b/vendor/go.opentelemetry.io/otel/attribute/type_string.go @@ -0,0 +1,32 @@ +// Code generated by "stringer -type=Type"; DO NOT EDIT. + +package attribute + +import "strconv" + +func _() { + // An "invalid array index" compiler error signifies that the constant values have changed. + // Re-run the stringer command to generate them again. + var x [1]struct{} + _ = x[EMPTY-0] + _ = x[BOOL-1] + _ = x[INT64-2] + _ = x[FLOAT64-3] + _ = x[STRING-4] + _ = x[BOOLSLICE-5] + _ = x[INT64SLICE-6] + _ = x[FLOAT64SLICE-7] + _ = x[STRINGSLICE-8] +} + +const _Type_name = "EMPTYBOOLINT64FLOAT64STRINGBOOLSLICEINT64SLICEFLOAT64SLICESTRINGSLICE" + +var _Type_index = [...]uint8{0, 5, 9, 14, 21, 27, 36, 46, 58, 69} + +func (i Type) String() string { + idx := int(i) - 0 + if i < 0 || idx >= len(_Type_index)-1 { + return "Type(" + strconv.FormatInt(int64(i), 10) + ")" + } + return _Type_name[_Type_index[idx]:_Type_index[idx+1]] +} diff --git a/vendor/go.opentelemetry.io/otel/attribute/value.go b/vendor/go.opentelemetry.io/otel/attribute/value.go new file mode 100644 index 00000000..db04b132 --- /dev/null +++ b/vendor/go.opentelemetry.io/otel/attribute/value.go @@ -0,0 +1,292 @@ +// Copyright The OpenTelemetry Authors +// SPDX-License-Identifier: Apache-2.0 + +package attribute // import "go.opentelemetry.io/otel/attribute" + +import ( + "encoding/json" + "fmt" + "strconv" + + attribute "go.opentelemetry.io/otel/attribute/internal" +) + +//go:generate stringer -type=Type + +// Type describes the type of the data Value holds. +type Type int // nolint: revive // redefines builtin Type. + +// Value represents the value part in key-value pairs. +// +// Note that the zero value is a valid empty value. +type Value struct { + vtype Type + numeric uint64 + stringly string + slice any +} + +const ( + // EMPTY is used for a Value with no value set. + EMPTY Type = iota + // BOOL is a boolean Type Value. + BOOL + // INT64 is a 64-bit signed integral Type Value. + INT64 + // FLOAT64 is a 64-bit floating point Type Value. + FLOAT64 + // STRING is a string Type Value. + STRING + // BOOLSLICE is a slice of booleans Type Value. + BOOLSLICE + // INT64SLICE is a slice of 64-bit signed integral numbers Type Value. + INT64SLICE + // FLOAT64SLICE is a slice of 64-bit floating point numbers Type Value. + FLOAT64SLICE + // STRINGSLICE is a slice of strings Type Value. + STRINGSLICE + // INVALID is used for a Value with no value set. + // + // Deprecated: Use EMPTY instead as an empty value is a valid value. + INVALID = EMPTY +) + +// BoolValue creates a BOOL Value. +func BoolValue(v bool) Value { + return Value{ + vtype: BOOL, + numeric: boolToRaw(v), + } +} + +// BoolSliceValue creates a BOOLSLICE Value. +func BoolSliceValue(v []bool) Value { + return Value{vtype: BOOLSLICE, slice: attribute.SliceValue(v)} +} + +// IntValue creates an INT64 Value. +func IntValue(v int) Value { + return Int64Value(int64(v)) +} + +// IntSliceValue creates an INT64SLICE Value. +func IntSliceValue(v []int) Value { + val := Value{vtype: INT64SLICE} + + // Avoid the common tiny-slice cases from allocating a new slice. + switch len(v) { + case 0: + val.slice = [0]int64{} + case 1: + val.slice = [1]int64{int64(v[0])} + case 2: + val.slice = [2]int64{int64(v[0]), int64(v[1])} + case 3: + val.slice = [3]int64{int64(v[0]), int64(v[1]), int64(v[2])} + default: + // Fallback to a new slice for larger slices. + cp := make([]int64, len(v)) + for i, val := range v { + cp[i] = int64(val) + } + val.slice = attribute.SliceValue(cp) + } + + return val +} + +// Int64Value creates an INT64 Value. +func Int64Value(v int64) Value { + return Value{ + vtype: INT64, + numeric: int64ToRaw(v), + } +} + +// Int64SliceValue creates an INT64SLICE Value. +func Int64SliceValue(v []int64) Value { + return Value{vtype: INT64SLICE, slice: attribute.SliceValue(v)} +} + +// Float64Value creates a FLOAT64 Value. +func Float64Value(v float64) Value { + return Value{ + vtype: FLOAT64, + numeric: float64ToRaw(v), + } +} + +// Float64SliceValue creates a FLOAT64SLICE Value. +func Float64SliceValue(v []float64) Value { + return Value{vtype: FLOAT64SLICE, slice: attribute.SliceValue(v)} +} + +// StringValue creates a STRING Value. +func StringValue(v string) Value { + return Value{ + vtype: STRING, + stringly: v, + } +} + +// StringSliceValue creates a STRINGSLICE Value. +func StringSliceValue(v []string) Value { + return Value{vtype: STRINGSLICE, slice: attribute.SliceValue(v)} +} + +// Type returns a type of the Value. +func (v Value) Type() Type { + return v.vtype +} + +// AsBool returns the bool value. Make sure that the Value's type is +// BOOL. +func (v Value) AsBool() bool { + return rawToBool(v.numeric) +} + +// AsBoolSlice returns the []bool value. Make sure that the Value's type is +// BOOLSLICE. +func (v Value) AsBoolSlice() []bool { + if v.vtype != BOOLSLICE { + return nil + } + return v.asBoolSlice() +} + +func (v Value) asBoolSlice() []bool { + return attribute.AsSlice[bool](v.slice) +} + +// AsInt64 returns the int64 value. Make sure that the Value's type is +// INT64. +func (v Value) AsInt64() int64 { + return rawToInt64(v.numeric) +} + +// AsInt64Slice returns the []int64 value. Make sure that the Value's type is +// INT64SLICE. +func (v Value) AsInt64Slice() []int64 { + if v.vtype != INT64SLICE { + return nil + } + return v.asInt64Slice() +} + +func (v Value) asInt64Slice() []int64 { + return attribute.AsSlice[int64](v.slice) +} + +// AsFloat64 returns the float64 value. Make sure that the Value's +// type is FLOAT64. +func (v Value) AsFloat64() float64 { + return rawToFloat64(v.numeric) +} + +// AsFloat64Slice returns the []float64 value. Make sure that the Value's type is +// FLOAT64SLICE. +func (v Value) AsFloat64Slice() []float64 { + if v.vtype != FLOAT64SLICE { + return nil + } + return v.asFloat64Slice() +} + +func (v Value) asFloat64Slice() []float64 { + return attribute.AsSlice[float64](v.slice) +} + +// AsString returns the string value. Make sure that the Value's type +// is STRING. +func (v Value) AsString() string { + return v.stringly +} + +// AsStringSlice returns the []string value. Make sure that the Value's type is +// STRINGSLICE. +func (v Value) AsStringSlice() []string { + if v.vtype != STRINGSLICE { + return nil + } + return v.asStringSlice() +} + +func (v Value) asStringSlice() []string { + return attribute.AsSlice[string](v.slice) +} + +type unknownValueType struct{} + +// AsInterface returns Value's data as any. +func (v Value) AsInterface() any { + switch v.Type() { + case BOOL: + return v.AsBool() + case BOOLSLICE: + return v.asBoolSlice() + case INT64: + return v.AsInt64() + case INT64SLICE: + return v.asInt64Slice() + case FLOAT64: + return v.AsFloat64() + case FLOAT64SLICE: + return v.asFloat64Slice() + case STRING: + return v.stringly + case STRINGSLICE: + return v.asStringSlice() + case EMPTY: + return nil + } + return unknownValueType{} +} + +// Emit returns a string representation of Value's data. +func (v Value) Emit() string { + switch v.Type() { + case BOOLSLICE: + return fmt.Sprint(v.asBoolSlice()) + case BOOL: + return strconv.FormatBool(v.AsBool()) + case INT64SLICE: + j, err := json.Marshal(v.asInt64Slice()) + if err != nil { + return fmt.Sprintf("invalid: %v", v.asInt64Slice()) + } + return string(j) + case INT64: + return strconv.FormatInt(v.AsInt64(), 10) + case FLOAT64SLICE: + j, err := json.Marshal(v.asFloat64Slice()) + if err != nil { + return fmt.Sprintf("invalid: %v", v.asFloat64Slice()) + } + return string(j) + case FLOAT64: + return fmt.Sprint(v.AsFloat64()) + case STRINGSLICE: + j, err := json.Marshal(v.asStringSlice()) + if err != nil { + return fmt.Sprintf("invalid: %v", v.asStringSlice()) + } + return string(j) + case STRING: + return v.stringly + case EMPTY: + return "" + default: + return "unknown" + } +} + +// MarshalJSON returns the JSON encoding of the Value. +func (v Value) MarshalJSON() ([]byte, error) { + var jsonVal struct { + Type string + Value any + } + jsonVal.Type = v.Type().String() + jsonVal.Value = v.AsInterface() + return json.Marshal(jsonVal) +} diff --git a/vendor/go.opentelemetry.io/otel/baggage/README.md b/vendor/go.opentelemetry.io/otel/baggage/README.md new file mode 100644 index 00000000..7d798435 --- /dev/null +++ b/vendor/go.opentelemetry.io/otel/baggage/README.md @@ -0,0 +1,3 @@ +# Baggage + +[![PkgGoDev](https://pkg.go.dev/badge/go.opentelemetry.io/otel/baggage)](https://pkg.go.dev/go.opentelemetry.io/otel/baggage) diff --git a/vendor/go.opentelemetry.io/otel/baggage/baggage.go b/vendor/go.opentelemetry.io/otel/baggage/baggage.go new file mode 100644 index 00000000..878ffbe4 --- /dev/null +++ b/vendor/go.opentelemetry.io/otel/baggage/baggage.go @@ -0,0 +1,1075 @@ +// Copyright The OpenTelemetry Authors +// SPDX-License-Identifier: Apache-2.0 + +package baggage // import "go.opentelemetry.io/otel/baggage" + +import ( + "errors" + "fmt" + "net/url" + "strings" + "unicode/utf8" + + "go.opentelemetry.io/otel/internal/baggage" +) + +const ( + maxMembers = 64 + maxBytesPerBaggageString = 8192 + + listDelimiter = "," + keyValueDelimiter = "=" + propertyDelimiter = ";" +) + +var ( + errInvalidKey = errors.New("invalid key") + errInvalidValue = errors.New("invalid value") + errInvalidProperty = errors.New("invalid baggage list-member property") + errInvalidMember = errors.New("invalid baggage list-member") + errMemberNumber = errors.New("too many list-members in baggage-string") + errBaggageBytes = errors.New("baggage-string too large") +) + +// Property is an additional metadata entry for a baggage list-member. +type Property struct { + key, value string + + // hasValue indicates if a zero-value value means the property does not + // have a value or if it was the zero-value. + hasValue bool +} + +// NewKeyProperty returns a new Property for key. +// +// The passed key must be valid, non-empty UTF-8 string. +// If key is invalid, an error will be returned. +// However, the specific Propagators that are used to transmit baggage entries across +// component boundaries may impose their own restrictions on Property key. +// For example, the W3C Baggage specification restricts the Property keys to strings that +// satisfy the token definition from RFC7230, Section 3.2.6. +// For maximum compatibility, alphanumeric value are strongly recommended to be used as Property key. +func NewKeyProperty(key string) (Property, error) { + if !validateBaggageName(key) { + return newInvalidProperty(), fmt.Errorf("%w: %q", errInvalidKey, key) + } + + p := Property{key: key} + return p, nil +} + +// NewKeyValueProperty returns a new Property for key with value. +// +// The passed key must be compliant with W3C Baggage specification. +// The passed value must be percent-encoded as defined in W3C Baggage specification. +// +// Notice: Consider using [NewKeyValuePropertyRaw] instead +// that does not require percent-encoding of the value. +func NewKeyValueProperty(key, value string) (Property, error) { + if !validateKey(key) { + return newInvalidProperty(), fmt.Errorf("%w: %q", errInvalidKey, key) + } + + if !validateValue(value) { + return newInvalidProperty(), fmt.Errorf("%w: %q", errInvalidValue, value) + } + decodedValue, err := url.PathUnescape(value) + if err != nil { + return newInvalidProperty(), fmt.Errorf("%w: %q", errInvalidValue, value) + } + return NewKeyValuePropertyRaw(key, decodedValue) +} + +// NewKeyValuePropertyRaw returns a new Property for key with value. +// +// The passed key must be valid, non-empty UTF-8 string. +// The passed value must be valid UTF-8 string. +// However, the specific Propagators that are used to transmit baggage entries across +// component boundaries may impose their own restrictions on Property key. +// For example, the W3C Baggage specification restricts the Property keys to strings that +// satisfy the token definition from RFC7230, Section 3.2.6. +// For maximum compatibility, alphanumeric value are strongly recommended to be used as Property key. +func NewKeyValuePropertyRaw(key, value string) (Property, error) { + if !validateBaggageName(key) { + return newInvalidProperty(), fmt.Errorf("%w: %q", errInvalidKey, key) + } + if !validateBaggageValue(value) { + return newInvalidProperty(), fmt.Errorf("%w: %q", errInvalidValue, value) + } + + p := Property{ + key: key, + value: value, + hasValue: true, + } + return p, nil +} + +func newInvalidProperty() Property { + return Property{} +} + +// parseProperty attempts to decode a Property from the passed string. It +// returns an error if the input is invalid according to the W3C Baggage +// specification. +func parseProperty(property string) (Property, error) { + if property == "" { + return newInvalidProperty(), nil + } + + p, ok := parsePropertyInternal(property) + if !ok { + return newInvalidProperty(), fmt.Errorf("%w: %q", errInvalidProperty, property) + } + + return p, nil +} + +// validate ensures p conforms to the W3C Baggage specification, returning an +// error otherwise. +func (p Property) validate() error { + errFunc := func(err error) error { + return fmt.Errorf("invalid property: %w", err) + } + + if !validateBaggageName(p.key) { + return errFunc(fmt.Errorf("%w: %q", errInvalidKey, p.key)) + } + if !p.hasValue && p.value != "" { + return errFunc(errors.New("inconsistent value")) + } + if p.hasValue && !validateBaggageValue(p.value) { + return errFunc(fmt.Errorf("%w: %q", errInvalidValue, p.value)) + } + return nil +} + +// Key returns the Property key. +func (p Property) Key() string { + return p.key +} + +// Value returns the Property value. Additionally, a boolean value is returned +// indicating if the returned value is the empty if the Property has a value +// that is empty or if the value is not set. +func (p Property) Value() (string, bool) { + return p.value, p.hasValue +} + +// String encodes Property into a header string compliant with the W3C Baggage +// specification. +// It would return empty string if the key is invalid with the W3C Baggage +// specification. This could happen for a UTF-8 key, as it may contain +// invalid characters. +func (p Property) String() string { + // W3C Baggage specification does not allow percent-encoded keys. + if !validateKey(p.key) { + return "" + } + + if p.hasValue { + return fmt.Sprintf("%s%s%v", p.key, keyValueDelimiter, valueEscape(p.value)) + } + return p.key +} + +type properties []Property + +func fromInternalProperties(iProps []baggage.Property) properties { + if len(iProps) == 0 { + return nil + } + + props := make(properties, len(iProps)) + for i, p := range iProps { + props[i] = Property{ + key: p.Key, + value: p.Value, + hasValue: p.HasValue, + } + } + return props +} + +func (p properties) asInternal() []baggage.Property { + if len(p) == 0 { + return nil + } + + iProps := make([]baggage.Property, len(p)) + for i, prop := range p { + iProps[i] = baggage.Property{ + Key: prop.key, + Value: prop.value, + HasValue: prop.hasValue, + } + } + return iProps +} + +func (p properties) Copy() properties { + if len(p) == 0 { + return nil + } + + props := make(properties, len(p)) + copy(props, p) + return props +} + +// validate ensures each Property in p conforms to the W3C Baggage +// specification, returning an error otherwise. +func (p properties) validate() error { + for _, prop := range p { + if err := prop.validate(); err != nil { + return err + } + } + return nil +} + +// String encodes properties into a header string compliant with the W3C Baggage +// specification. +func (p properties) String() string { + props := make([]string, 0, len(p)) + for _, prop := range p { + s := prop.String() + + // Ignored empty properties. + if s != "" { + props = append(props, s) + } + } + return strings.Join(props, propertyDelimiter) +} + +// Member is a list-member of a baggage-string as defined by the W3C Baggage +// specification. +type Member struct { + key, value string + properties properties + + // hasData indicates whether the created property contains data or not. + // Properties that do not contain data are invalid with no other check + // required. + hasData bool +} + +// NewMember returns a new Member from the passed arguments. +// +// The passed key must be compliant with W3C Baggage specification. +// The passed value must be percent-encoded as defined in W3C Baggage specification. +// +// Notice: Consider using [NewMemberRaw] instead +// that does not require percent-encoding of the value. +func NewMember(key, value string, props ...Property) (Member, error) { + if !validateKey(key) { + return newInvalidMember(), fmt.Errorf("%w: %q", errInvalidKey, key) + } + + if !validateValue(value) { + return newInvalidMember(), fmt.Errorf("%w: %q", errInvalidValue, value) + } + decodedValue, err := url.PathUnescape(value) + if err != nil { + return newInvalidMember(), fmt.Errorf("%w: %q", errInvalidValue, value) + } + return NewMemberRaw(key, decodedValue, props...) +} + +// NewMemberRaw returns a new Member from the passed arguments. +// +// The passed key must be valid, non-empty UTF-8 string. +// The passed value must be valid UTF-8 string. +// However, the specific Propagators that are used to transmit baggage entries across +// component boundaries may impose their own restrictions on baggage key. +// For example, the W3C Baggage specification restricts the baggage keys to strings that +// satisfy the token definition from RFC7230, Section 3.2.6. +// For maximum compatibility, alphanumeric value are strongly recommended to be used as baggage key. +func NewMemberRaw(key, value string, props ...Property) (Member, error) { + m := Member{ + key: key, + value: value, + properties: properties(props).Copy(), + hasData: true, + } + if err := m.validate(); err != nil { + return newInvalidMember(), err + } + return m, nil +} + +func newInvalidMember() Member { + return Member{} +} + +// parseMember attempts to decode a Member from the passed string. It returns +// an error if the input is invalid according to the W3C Baggage +// specification. +func parseMember(member string) (Member, error) { + var props properties + keyValue, properties, found := strings.Cut(member, propertyDelimiter) + if found { + // Parse the member properties. + for pStr := range strings.SplitSeq(properties, propertyDelimiter) { + p, err := parseProperty(pStr) + if err != nil { + return newInvalidMember(), err + } + props = append(props, p) + } + } + // Parse the member key/value pair. + + // Take into account a value can contain equal signs (=). + k, v, found := strings.Cut(keyValue, keyValueDelimiter) + if !found { + return newInvalidMember(), fmt.Errorf("%w: %q", errInvalidMember, member) + } + // "Leading and trailing whitespaces are allowed but MUST be trimmed + // when converting the header into a data structure." + key := strings.TrimSpace(k) + if !validateKey(key) { + return newInvalidMember(), fmt.Errorf("%w: %q", errInvalidKey, key) + } + + rawVal := strings.TrimSpace(v) + if !validateValue(rawVal) { + return newInvalidMember(), fmt.Errorf("%w: %q", errInvalidValue, v) + } + + // Decode a percent-encoded value. + unescapeVal, err := url.PathUnescape(rawVal) + if err != nil { + return newInvalidMember(), fmt.Errorf("%w: %w", errInvalidValue, err) + } + + value := replaceInvalidUTF8Sequences(len(rawVal), unescapeVal) + return Member{key: key, value: value, properties: props, hasData: true}, nil +} + +// replaceInvalidUTF8Sequences replaces invalid UTF-8 sequences with '�'. +func replaceInvalidUTF8Sequences(c int, unescapeVal string) string { + if utf8.ValidString(unescapeVal) { + return unescapeVal + } + // W3C baggage spec: + // https://github.com/w3c/baggage/blob/8c215efbeebd3fa4b1aceb937a747e56444f22f3/baggage/HTTP_HEADER_FORMAT.md?plain=1#L69 + + var b strings.Builder + b.Grow(c) + for i := 0; i < len(unescapeVal); { + r, size := utf8.DecodeRuneInString(unescapeVal[i:]) + if r == utf8.RuneError && size == 1 { + // Invalid UTF-8 sequence found, replace it with '�' + _, _ = b.WriteString("�") + } else { + _, _ = b.WriteRune(r) + } + i += size + } + + return b.String() +} + +// validate ensures m conforms to the W3C Baggage specification. +// A key must be an ASCII string, returning an error otherwise. +func (m Member) validate() error { + if !m.hasData { + return fmt.Errorf("%w: %q", errInvalidMember, m) + } + + if !validateBaggageName(m.key) { + return fmt.Errorf("%w: %q", errInvalidKey, m.key) + } + if !validateBaggageValue(m.value) { + return fmt.Errorf("%w: %q", errInvalidValue, m.value) + } + return m.properties.validate() +} + +// Key returns the Member key. +func (m Member) Key() string { return m.key } + +// Value returns the Member value. +func (m Member) Value() string { return m.value } + +// Properties returns a copy of the Member properties. +func (m Member) Properties() []Property { return m.properties.Copy() } + +// String encodes Member into a header string compliant with the W3C Baggage +// specification. +// It would return empty string if the key is invalid with the W3C Baggage +// specification. This could happen for a UTF-8 key, as it may contain +// invalid characters. +func (m Member) String() string { + // W3C Baggage specification does not allow percent-encoded keys. + if !validateKey(m.key) { + return "" + } + + s := m.key + keyValueDelimiter + valueEscape(m.value) + if len(m.properties) > 0 { + s += propertyDelimiter + m.properties.String() + } + return s +} + +// Baggage is a list of baggage members representing the baggage-string as +// defined by the W3C Baggage specification. +type Baggage struct { //nolint:golint + list baggage.List +} + +// New returns a new valid Baggage. It returns an error if it results in a +// Baggage exceeding limits set in that specification. +// +// If the resulting Baggage exceeds the maximum allowed members or bytes, +// members are dropped until the limits are satisfied and an error is returned +// along with the partial result. +// +// It expects all the provided members to have already been validated. +func New(members ...Member) (Baggage, error) { + if len(members) == 0 { + return Baggage{}, nil + } + + b := make(baggage.List) + for _, m := range members { + if !m.hasData { + return Baggage{}, errInvalidMember + } + // OpenTelemetry resolves duplicates by last-one-wins. + b[m.key] = baggage.Item{ + Value: m.value, + Properties: m.properties.asInternal(), + } + } + + var truncateErr error + + // Check member count after deduplication. + if len(b) > maxMembers { + truncateErr = errors.Join(truncateErr, errMemberNumber) + for k := range b { + if len(b) <= maxMembers { + break + } + delete(b, k) + } + } + + // Check byte size and drop members if necessary. + totalBytes := 0 + first := true + for k := range b { + m := Member{ + key: k, + value: b[k].Value, + properties: fromInternalProperties(b[k].Properties), + } + memberSize := len(m.String()) + if !first { + memberSize++ // comma separator + } + if totalBytes+memberSize > maxBytesPerBaggageString { + truncateErr = errors.Join(truncateErr, fmt.Errorf("%w: %d", errBaggageBytes, totalBytes+memberSize)) + delete(b, k) + continue + } + totalBytes += memberSize + first = false + } + + return Baggage{b}, truncateErr +} + +// Parse attempts to decode a baggage-string from the passed string. It +// returns an error if the input is invalid according to the W3C Baggage +// specification. +// +// If there are duplicate list-members contained in baggage, the last one +// defined (reading left-to-right) will be the only one kept. This diverges +// from the W3C Baggage specification which allows duplicate list-members, but +// conforms to the OpenTelemetry Baggage specification. +// +// If the baggage-string exceeds the maximum allowed members (64) or bytes +// (8192), members are dropped until the limits are satisfied and an error is +// returned along with the partial result. +// +// Invalid members are skipped and the error is returned along with the +// partial result containing the valid members. +func Parse(bStr string) (Baggage, error) { + if bStr == "" { + return Baggage{}, nil + } + + b := make(baggage.List) + sizes := make(map[string]int) // Track per-key byte sizes + var totalBytes int + var truncateErr error + for memberStr := range strings.SplitSeq(bStr, listDelimiter) { + // Check member count limit. + if len(b) >= maxMembers { + truncateErr = errors.Join(truncateErr, errMemberNumber) + break + } + + m, err := parseMember(memberStr) + if err != nil { + truncateErr = errors.Join(truncateErr, err) + continue // skip invalid member, keep processing + } + + // Check byte size limit. + // Account for comma separator between members. + memberBytes := len(m.String()) + _, existingKey := b[m.key] + if !existingKey && len(b) > 0 { + memberBytes++ // comma separator only for new keys + } + + // Calculate new totalBytes if we add/overwrite this key + var newTotalBytes int + if oldSize, exists := sizes[m.key]; exists { + // Overwriting existing key: subtract old size, add new size + newTotalBytes = totalBytes - oldSize + memberBytes + } else { + // New key + newTotalBytes = totalBytes + memberBytes + } + + if newTotalBytes > maxBytesPerBaggageString { + truncateErr = errors.Join(truncateErr, errBaggageBytes) + break + } + + // OpenTelemetry resolves duplicates by last-one-wins. + b[m.key] = baggage.Item{ + Value: m.value, + Properties: m.properties.asInternal(), + } + sizes[m.key] = memberBytes + totalBytes = newTotalBytes + } + + if len(b) == 0 { + return Baggage{}, truncateErr + } + return Baggage{b}, truncateErr +} + +// Member returns the baggage list-member identified by key. +// +// If there is no list-member matching the passed key the returned Member will +// be a zero-value Member. +// The returned member is not validated, as we assume the validation happened +// when it was added to the Baggage. +func (b Baggage) Member(key string) Member { + v, ok := b.list[key] + if !ok { + // We do not need to worry about distinguishing between the situation + // where a zero-valued Member is included in the Baggage because a + // zero-valued Member is invalid according to the W3C Baggage + // specification (it has an empty key). + return newInvalidMember() + } + + return Member{ + key: key, + value: v.Value, + properties: fromInternalProperties(v.Properties), + hasData: true, + } +} + +// Members returns all the baggage list-members. +// The order of the returned list-members is not significant. +// +// The returned members are not validated, as we assume the validation happened +// when they were added to the Baggage. +func (b Baggage) Members() []Member { + if len(b.list) == 0 { + return nil + } + + members := make([]Member, 0, len(b.list)) + for k, v := range b.list { + members = append(members, Member{ + key: k, + value: v.Value, + properties: fromInternalProperties(v.Properties), + hasData: true, + }) + } + return members +} + +// SetMember returns a copy of the Baggage with the member included. If the +// baggage contains a Member with the same key, the existing Member is +// replaced. +// +// If member is invalid according to the W3C Baggage specification, an error +// is returned with the original Baggage. +func (b Baggage) SetMember(member Member) (Baggage, error) { + if !member.hasData { + return b, errInvalidMember + } + + n := len(b.list) + if _, ok := b.list[member.key]; !ok { + n++ + } + list := make(baggage.List, n) + + for k, v := range b.list { + // Do not copy if we are just going to overwrite. + if k == member.key { + continue + } + list[k] = v + } + + list[member.key] = baggage.Item{ + Value: member.value, + Properties: member.properties.asInternal(), + } + + return Baggage{list: list}, nil +} + +// DeleteMember returns a copy of the Baggage with the list-member identified +// by key removed. +func (b Baggage) DeleteMember(key string) Baggage { + n := len(b.list) + if _, ok := b.list[key]; ok { + n-- + } + list := make(baggage.List, n) + + for k, v := range b.list { + if k == key { + continue + } + list[k] = v + } + + return Baggage{list: list} +} + +// Len returns the number of list-members in the Baggage. +func (b Baggage) Len() int { + return len(b.list) +} + +// String encodes Baggage into a header string compliant with the W3C Baggage +// specification. +// It would ignore members where the member key is invalid with the W3C Baggage +// specification. This could happen for a UTF-8 key, as it may contain +// invalid characters. +func (b Baggage) String() string { + members := make([]string, 0, len(b.list)) + for k, v := range b.list { + s := Member{ + key: k, + value: v.Value, + properties: fromInternalProperties(v.Properties), + }.String() + + // Ignored empty members. + if s != "" { + members = append(members, s) + } + } + return strings.Join(members, listDelimiter) +} + +// parsePropertyInternal attempts to decode a Property from the passed string. +// It follows the spec at https://www.w3.org/TR/baggage/#definition. +func parsePropertyInternal(s string) (p Property, ok bool) { + // For the entire function we will use " key = value " as an example. + // Attempting to parse the key. + // First skip spaces at the beginning "< >key = value " (they could be empty). + index := skipSpace(s, 0) + + // Parse the key: " = value ". + keyStart := index + keyEnd := index + for _, c := range s[keyStart:] { + if !validateKeyChar(c) { + break + } + keyEnd++ + } + + // If we couldn't find any valid key character, + // it means the key is either empty or invalid. + if keyStart == keyEnd { + return p, ok + } + + // Skip spaces after the key: " key< >= value ". + index = skipSpace(s, keyEnd) + + if index == len(s) { + // A key can have no value, like: " key ". + ok = true + p.key = s[keyStart:keyEnd] + return p, ok + } + + // If we have not reached the end and we can't find the '=' delimiter, + // it means the property is invalid. + if s[index] != keyValueDelimiter[0] { + return p, ok + } + + // Attempting to parse the value. + // Match: " key =< >value ". + index = skipSpace(s, index+1) + + // Match the value string: " key = ". + // A valid property can be: " key =". + // Therefore, we don't have to check if the value is empty. + valueStart := index + valueEnd := index + for _, c := range s[valueStart:] { + if !validateValueChar(c) { + break + } + valueEnd++ + } + + // Skip all trailing whitespaces: " key = value< >". + index = skipSpace(s, valueEnd) + + // If after looking for the value and skipping whitespaces + // we have not reached the end, it means the property is + // invalid, something like: " key = value value1". + if index != len(s) { + return p, ok + } + + // Decode a percent-encoded value. + rawVal := s[valueStart:valueEnd] + unescapeVal, err := url.PathUnescape(rawVal) + if err != nil { + return p, ok + } + value := replaceInvalidUTF8Sequences(len(rawVal), unescapeVal) + + ok = true + p.key = s[keyStart:keyEnd] + p.hasValue = true + + p.value = value + return p, ok +} + +func skipSpace(s string, offset int) int { + i := offset + for ; i < len(s); i++ { + c := s[i] + if c != ' ' && c != '\t' { + break + } + } + return i +} + +var safeKeyCharset = [utf8.RuneSelf]bool{ + // 0x23 to 0x27 + '#': true, + '$': true, + '%': true, + '&': true, + '\'': true, + + // 0x30 to 0x39 + '0': true, + '1': true, + '2': true, + '3': true, + '4': true, + '5': true, + '6': true, + '7': true, + '8': true, + '9': true, + + // 0x41 to 0x5a + 'A': true, + 'B': true, + 'C': true, + 'D': true, + 'E': true, + 'F': true, + 'G': true, + 'H': true, + 'I': true, + 'J': true, + 'K': true, + 'L': true, + 'M': true, + 'N': true, + 'O': true, + 'P': true, + 'Q': true, + 'R': true, + 'S': true, + 'T': true, + 'U': true, + 'V': true, + 'W': true, + 'X': true, + 'Y': true, + 'Z': true, + + // 0x5e to 0x7a + '^': true, + '_': true, + '`': true, + 'a': true, + 'b': true, + 'c': true, + 'd': true, + 'e': true, + 'f': true, + 'g': true, + 'h': true, + 'i': true, + 'j': true, + 'k': true, + 'l': true, + 'm': true, + 'n': true, + 'o': true, + 'p': true, + 'q': true, + 'r': true, + 's': true, + 't': true, + 'u': true, + 'v': true, + 'w': true, + 'x': true, + 'y': true, + 'z': true, + + // remainder + '!': true, + '*': true, + '+': true, + '-': true, + '.': true, + '|': true, + '~': true, +} + +// validateBaggageName checks if the string is a valid OpenTelemetry Baggage name. +// Baggage name is a valid, non-empty UTF-8 string. +func validateBaggageName(s string) bool { + if s == "" { + return false + } + + return utf8.ValidString(s) +} + +// validateBaggageValue checks if the string is a valid OpenTelemetry Baggage value. +// Baggage value is a valid UTF-8 strings. +// Empty string is also a valid UTF-8 string. +func validateBaggageValue(s string) bool { + return utf8.ValidString(s) +} + +// validateKey checks if the string is a valid W3C Baggage key. +func validateKey(s string) bool { + if s == "" { + return false + } + + for _, c := range s { + if !validateKeyChar(c) { + return false + } + } + + return true +} + +func validateKeyChar(c int32) bool { + return c >= 0 && c < int32(utf8.RuneSelf) && safeKeyCharset[c] +} + +// validateValue checks if the string is a valid W3C Baggage value. +func validateValue(s string) bool { + for _, c := range s { + if !validateValueChar(c) { + return false + } + } + + return true +} + +var safeValueCharset = [utf8.RuneSelf]bool{ + '!': true, // 0x21 + + // 0x23 to 0x2b + '#': true, + '$': true, + '%': true, + '&': true, + '\'': true, + '(': true, + ')': true, + '*': true, + '+': true, + + // 0x2d to 0x3a + '-': true, + '.': true, + '/': true, + '0': true, + '1': true, + '2': true, + '3': true, + '4': true, + '5': true, + '6': true, + '7': true, + '8': true, + '9': true, + ':': true, + + // 0x3c to 0x5b + '<': true, // 0x3C + '=': true, // 0x3D + '>': true, // 0x3E + '?': true, // 0x3F + '@': true, // 0x40 + 'A': true, // 0x41 + 'B': true, // 0x42 + 'C': true, // 0x43 + 'D': true, // 0x44 + 'E': true, // 0x45 + 'F': true, // 0x46 + 'G': true, // 0x47 + 'H': true, // 0x48 + 'I': true, // 0x49 + 'J': true, // 0x4A + 'K': true, // 0x4B + 'L': true, // 0x4C + 'M': true, // 0x4D + 'N': true, // 0x4E + 'O': true, // 0x4F + 'P': true, // 0x50 + 'Q': true, // 0x51 + 'R': true, // 0x52 + 'S': true, // 0x53 + 'T': true, // 0x54 + 'U': true, // 0x55 + 'V': true, // 0x56 + 'W': true, // 0x57 + 'X': true, // 0x58 + 'Y': true, // 0x59 + 'Z': true, // 0x5A + '[': true, // 0x5B + + // 0x5d to 0x7e + ']': true, // 0x5D + '^': true, // 0x5E + '_': true, // 0x5F + '`': true, // 0x60 + 'a': true, // 0x61 + 'b': true, // 0x62 + 'c': true, // 0x63 + 'd': true, // 0x64 + 'e': true, // 0x65 + 'f': true, // 0x66 + 'g': true, // 0x67 + 'h': true, // 0x68 + 'i': true, // 0x69 + 'j': true, // 0x6A + 'k': true, // 0x6B + 'l': true, // 0x6C + 'm': true, // 0x6D + 'n': true, // 0x6E + 'o': true, // 0x6F + 'p': true, // 0x70 + 'q': true, // 0x71 + 'r': true, // 0x72 + 's': true, // 0x73 + 't': true, // 0x74 + 'u': true, // 0x75 + 'v': true, // 0x76 + 'w': true, // 0x77 + 'x': true, // 0x78 + 'y': true, // 0x79 + 'z': true, // 0x7A + '{': true, // 0x7B + '|': true, // 0x7C + '}': true, // 0x7D + '~': true, // 0x7E +} + +func validateValueChar(c int32) bool { + return c >= 0 && c < int32(utf8.RuneSelf) && safeValueCharset[c] +} + +// valueEscape escapes the string so it can be safely placed inside a baggage value, +// replacing special characters with %XX sequences as needed. +// +// The implementation is based on: +// https://github.com/golang/go/blob/f6509cf5cdbb5787061b784973782933c47f1782/src/net/url/url.go#L285. +func valueEscape(s string) string { + hexCount := 0 + for i := 0; i < len(s); i++ { + c := s[i] + if shouldEscape(c) { + hexCount++ + } + } + + if hexCount == 0 { + return s + } + + var buf [64]byte + var t []byte + + required := len(s) + 2*hexCount + if required <= len(buf) { + t = buf[:required] + } else { + t = make([]byte, required) + } + + j := 0 + for i := 0; i < len(s); i++ { + c := s[i] + if shouldEscape(s[i]) { + const upperhex = "0123456789ABCDEF" + t[j] = '%' + t[j+1] = upperhex[c>>4] + t[j+2] = upperhex[c&15] + j += 3 + } else { + t[j] = c + j++ + } + } + + return string(t) +} + +// shouldEscape returns true if the specified byte should be escaped when +// appearing in a baggage value string. +func shouldEscape(c byte) bool { + if c == '%' { + // The percent character must be encoded so that percent-encoding can work. + return true + } + return !validateValueChar(int32(c)) +} diff --git a/vendor/go.opentelemetry.io/otel/baggage/context.go b/vendor/go.opentelemetry.io/otel/baggage/context.go new file mode 100644 index 00000000..a572461a --- /dev/null +++ b/vendor/go.opentelemetry.io/otel/baggage/context.go @@ -0,0 +1,28 @@ +// Copyright The OpenTelemetry Authors +// SPDX-License-Identifier: Apache-2.0 + +package baggage // import "go.opentelemetry.io/otel/baggage" + +import ( + "context" + + "go.opentelemetry.io/otel/internal/baggage" +) + +// ContextWithBaggage returns a copy of parent with baggage. +func ContextWithBaggage(parent context.Context, b Baggage) context.Context { + // Delegate so any hooks for the OpenTracing bridge are handled. + return baggage.ContextWithList(parent, b.list) +} + +// ContextWithoutBaggage returns a copy of parent with no baggage. +func ContextWithoutBaggage(parent context.Context) context.Context { + // Delegate so any hooks for the OpenTracing bridge are handled. + return baggage.ContextWithList(parent, nil) +} + +// FromContext returns the baggage contained in ctx. +func FromContext(ctx context.Context) Baggage { + // Delegate so any hooks for the OpenTracing bridge are handled. + return Baggage{list: baggage.ListFromContext(ctx)} +} diff --git a/vendor/go.opentelemetry.io/otel/baggage/doc.go b/vendor/go.opentelemetry.io/otel/baggage/doc.go new file mode 100644 index 00000000..b51d87ca --- /dev/null +++ b/vendor/go.opentelemetry.io/otel/baggage/doc.go @@ -0,0 +1,9 @@ +// Copyright The OpenTelemetry Authors +// SPDX-License-Identifier: Apache-2.0 + +/* +Package baggage provides functionality for storing and retrieving +baggage items in Go context. For propagating the baggage, see the +go.opentelemetry.io/otel/propagation package. +*/ +package baggage // import "go.opentelemetry.io/otel/baggage" diff --git a/vendor/go.opentelemetry.io/otel/codes/README.md b/vendor/go.opentelemetry.io/otel/codes/README.md new file mode 100644 index 00000000..24c52b38 --- /dev/null +++ b/vendor/go.opentelemetry.io/otel/codes/README.md @@ -0,0 +1,3 @@ +# Codes + +[![PkgGoDev](https://pkg.go.dev/badge/go.opentelemetry.io/otel/codes)](https://pkg.go.dev/go.opentelemetry.io/otel/codes) diff --git a/vendor/go.opentelemetry.io/otel/codes/codes.go b/vendor/go.opentelemetry.io/otel/codes/codes.go new file mode 100644 index 00000000..d48847ed --- /dev/null +++ b/vendor/go.opentelemetry.io/otel/codes/codes.go @@ -0,0 +1,106 @@ +// Copyright The OpenTelemetry Authors +// SPDX-License-Identifier: Apache-2.0 + +package codes // import "go.opentelemetry.io/otel/codes" + +import ( + "encoding/json" + "errors" + "fmt" + "strconv" +) + +const ( + // Unset is the default status code. + Unset Code = 0 + + // Error indicates the operation contains an error. + // + // NOTE: The error code in OTLP is 2. + // The value of this enum is only relevant to the internals + // of the Go SDK. + Error Code = 1 + + // Ok indicates operation has been validated by an Application developers + // or Operator to have completed successfully, or contain no error. + // + // NOTE: The Ok code in OTLP is 1. + // The value of this enum is only relevant to the internals + // of the Go SDK. + Ok Code = 2 + + maxCode = 3 +) + +// Code is an 32-bit representation of a status state. +type Code uint32 + +var codeToStr = map[Code]string{ + Unset: "Unset", + Error: "Error", + Ok: "Ok", +} + +var strToCode = map[string]Code{ + `"Unset"`: Unset, + `"Error"`: Error, + `"Ok"`: Ok, +} + +// String returns the Code as a string. +func (c Code) String() string { + return codeToStr[c] +} + +// UnmarshalJSON unmarshals b into the Code. +// +// This is based on the functionality in the gRPC codes package: +// https://github.com/grpc/grpc-go/blob/bb64fee312b46ebee26be43364a7a966033521b1/codes/codes.go#L218-L244 +func (c *Code) UnmarshalJSON(b []byte) error { + // From json.Unmarshaler: By convention, to approximate the behavior of + // Unmarshal itself, Unmarshalers implement UnmarshalJSON([]byte("null")) as + // a no-op. + if string(b) == "null" { + return nil + } + if c == nil { + return errors.New("nil receiver passed to UnmarshalJSON") + } + + var x any + if err := json.Unmarshal(b, &x); err != nil { + return err + } + switch x.(type) { + case string: + if jc, ok := strToCode[string(b)]; ok { + *c = jc + return nil + } + return fmt.Errorf("invalid code: %q", string(b)) + case float64: + if ci, err := strconv.ParseUint(string(b), 10, 32); err == nil { + if ci >= maxCode { + return fmt.Errorf("invalid code: %q", ci) + } + + *c = Code(ci) // nolint: gosec // Bit size of 32 check above. + return nil + } + return fmt.Errorf("invalid code: %q", string(b)) + default: + return fmt.Errorf("invalid code: %q", string(b)) + } +} + +// MarshalJSON returns c as the JSON encoding of c. +func (c *Code) MarshalJSON() ([]byte, error) { + if c == nil { + return []byte("null"), nil + } + str, ok := codeToStr[*c] + if !ok { + return nil, fmt.Errorf("invalid code: %d", *c) + } + return fmt.Appendf(nil, "%q", str), nil +} diff --git a/vendor/go.opentelemetry.io/otel/codes/doc.go b/vendor/go.opentelemetry.io/otel/codes/doc.go new file mode 100644 index 00000000..ee8db448 --- /dev/null +++ b/vendor/go.opentelemetry.io/otel/codes/doc.go @@ -0,0 +1,10 @@ +// Copyright The OpenTelemetry Authors +// SPDX-License-Identifier: Apache-2.0 + +/* +Package codes defines the canonical error codes used by OpenTelemetry. + +It conforms to [the OpenTelemetry +specification](https://github.com/open-telemetry/opentelemetry-specification/blob/v1.20.0/specification/trace/api.md#set-status). +*/ +package codes // import "go.opentelemetry.io/otel/codes" diff --git a/vendor/go.opentelemetry.io/otel/dependencies.Dockerfile b/vendor/go.opentelemetry.io/otel/dependencies.Dockerfile new file mode 100644 index 00000000..7a9b3c05 --- /dev/null +++ b/vendor/go.opentelemetry.io/otel/dependencies.Dockerfile @@ -0,0 +1,4 @@ +# This is a renovate-friendly source of Docker images. +FROM python:3.13.6-slim-bullseye@sha256:e98b521460ee75bca92175c16247bdf7275637a8faaeb2bcfa19d879ae5c4b9a AS python +FROM otel/weaver:v0.22.1@sha256:33ae522ae4b71c1c562563c1d81f46aa0f79f088a0873199143a1f11ac30e5c9 AS weaver +FROM avtodev/markdown-lint:v1@sha256:6aeedc2f49138ce7a1cd0adffc1b1c0321b841dc2102408967d9301c031949ee AS markdown diff --git a/vendor/go.opentelemetry.io/otel/doc.go b/vendor/go.opentelemetry.io/otel/doc.go new file mode 100644 index 00000000..921f8596 --- /dev/null +++ b/vendor/go.opentelemetry.io/otel/doc.go @@ -0,0 +1,25 @@ +// Copyright The OpenTelemetry Authors +// SPDX-License-Identifier: Apache-2.0 + +/* +Package otel provides global access to the OpenTelemetry API. The subpackages of +the otel package provide an implementation of the OpenTelemetry API. + +The provided API is used to instrument code and measure data about that code's +performance and operation. The measured data, by default, is not processed or +transmitted anywhere. An implementation of the OpenTelemetry SDK, like the +default SDK implementation (go.opentelemetry.io/otel/sdk), and associated +exporters are used to process and transport this data. + +To read the getting started guide, see https://opentelemetry.io/docs/languages/go/getting-started/. + +To read more about tracing, see go.opentelemetry.io/otel/trace. + +To read more about metrics, see go.opentelemetry.io/otel/metric. + +To read more about logs, see go.opentelemetry.io/otel/log. + +To read more about propagation, see go.opentelemetry.io/otel/propagation and +go.opentelemetry.io/otel/baggage. +*/ +package otel // import "go.opentelemetry.io/otel" diff --git a/vendor/go.opentelemetry.io/otel/error_handler.go b/vendor/go.opentelemetry.io/otel/error_handler.go new file mode 100644 index 00000000..67414c71 --- /dev/null +++ b/vendor/go.opentelemetry.io/otel/error_handler.go @@ -0,0 +1,27 @@ +// Copyright The OpenTelemetry Authors +// SPDX-License-Identifier: Apache-2.0 + +package otel // import "go.opentelemetry.io/otel" + +// ErrorHandler handles irremediable events. +type ErrorHandler interface { + // DO NOT CHANGE: any modification will not be backwards compatible and + // must never be done outside of a new major release. + + // Handle handles any error deemed irremediable by an OpenTelemetry + // component. + Handle(error) + // DO NOT CHANGE: any modification will not be backwards compatible and + // must never be done outside of a new major release. +} + +// ErrorHandlerFunc is a convenience adapter to allow the use of a function +// as an ErrorHandler. +type ErrorHandlerFunc func(error) + +var _ ErrorHandler = ErrorHandlerFunc(nil) + +// Handle handles the irremediable error by calling the ErrorHandlerFunc itself. +func (f ErrorHandlerFunc) Handle(err error) { + f(err) +} diff --git a/vendor/go.opentelemetry.io/otel/handler.go b/vendor/go.opentelemetry.io/otel/handler.go new file mode 100644 index 00000000..07623b67 --- /dev/null +++ b/vendor/go.opentelemetry.io/otel/handler.go @@ -0,0 +1,33 @@ +// Copyright The OpenTelemetry Authors +// SPDX-License-Identifier: Apache-2.0 + +package otel // import "go.opentelemetry.io/otel" + +import ( + "go.opentelemetry.io/otel/internal/global" +) + +// Compile-time check global.ErrDelegator implements ErrorHandler. +var _ ErrorHandler = (*global.ErrDelegator)(nil) + +// GetErrorHandler returns the global ErrorHandler instance. +// +// The default ErrorHandler instance returned will log all errors to STDERR +// until an override ErrorHandler is set with SetErrorHandler. All +// ErrorHandler returned prior to this will automatically forward errors to +// the set instance instead of logging. +// +// Subsequent calls to SetErrorHandler after the first will not forward errors +// to the new ErrorHandler for prior returned instances. +func GetErrorHandler() ErrorHandler { return global.GetErrorHandler() } + +// SetErrorHandler sets the global ErrorHandler to h. +// +// The first time this is called all ErrorHandler previously returned from +// GetErrorHandler will send errors to h instead of the default logging +// ErrorHandler. Subsequent calls will set the global ErrorHandler, but not +// delegate errors to h. +func SetErrorHandler(h ErrorHandler) { global.SetErrorHandler(h) } + +// Handle is a convenience function for GetErrorHandler().Handle(err). +func Handle(err error) { global.GetErrorHandler().Handle(err) } diff --git a/vendor/go.opentelemetry.io/otel/internal/baggage/baggage.go b/vendor/go.opentelemetry.io/otel/internal/baggage/baggage.go new file mode 100644 index 00000000..b4f85f44 --- /dev/null +++ b/vendor/go.opentelemetry.io/otel/internal/baggage/baggage.go @@ -0,0 +1,32 @@ +// Copyright The OpenTelemetry Authors +// SPDX-License-Identifier: Apache-2.0 + +/* +Package baggage provides base types and functionality to store and retrieve +baggage in Go context. This package exists because the OpenTracing bridge to +OpenTelemetry needs to synchronize state whenever baggage for a context is +modified and that context contains an OpenTracing span. If it were not for +this need this package would not need to exist and the +`go.opentelemetry.io/otel/baggage` package would be the singular place where +W3C baggage is handled. +*/ +package baggage // import "go.opentelemetry.io/otel/internal/baggage" + +// List is the collection of baggage members. The W3C allows for duplicates, +// but OpenTelemetry does not, therefore, this is represented as a map. +type List map[string]Item + +// Item is the value and metadata properties part of a list-member. +type Item struct { + Value string + Properties []Property +} + +// Property is a metadata entry for a list-member. +type Property struct { + Key, Value string + + // HasValue indicates if a zero-value value means the property does not + // have a value or if it was the zero-value. + HasValue bool +} diff --git a/vendor/go.opentelemetry.io/otel/internal/baggage/context.go b/vendor/go.opentelemetry.io/otel/internal/baggage/context.go new file mode 100644 index 00000000..3aea9c49 --- /dev/null +++ b/vendor/go.opentelemetry.io/otel/internal/baggage/context.go @@ -0,0 +1,81 @@ +// Copyright The OpenTelemetry Authors +// SPDX-License-Identifier: Apache-2.0 + +package baggage // import "go.opentelemetry.io/otel/internal/baggage" + +import "context" + +type baggageContextKeyType int + +const baggageKey baggageContextKeyType = iota + +// SetHookFunc is a callback called when storing baggage in the context. +type SetHookFunc func(context.Context, List) context.Context + +// GetHookFunc is a callback called when getting baggage from the context. +type GetHookFunc func(context.Context, List) List + +type baggageState struct { + list List + + setHook SetHookFunc + getHook GetHookFunc +} + +// ContextWithSetHook returns a copy of parent with hook configured to be +// invoked every time ContextWithBaggage is called. +// +// Passing nil SetHookFunc creates a context with no set hook to call. +func ContextWithSetHook(parent context.Context, hook SetHookFunc) context.Context { + var s baggageState + if v, ok := parent.Value(baggageKey).(baggageState); ok { + s = v + } + + s.setHook = hook + return context.WithValue(parent, baggageKey, s) +} + +// ContextWithGetHook returns a copy of parent with hook configured to be +// invoked every time FromContext is called. +// +// Passing nil GetHookFunc creates a context with no get hook to call. +func ContextWithGetHook(parent context.Context, hook GetHookFunc) context.Context { + var s baggageState + if v, ok := parent.Value(baggageKey).(baggageState); ok { + s = v + } + + s.getHook = hook + return context.WithValue(parent, baggageKey, s) +} + +// ContextWithList returns a copy of parent with baggage. Passing nil list +// returns a context without any baggage. +func ContextWithList(parent context.Context, list List) context.Context { + var s baggageState + if v, ok := parent.Value(baggageKey).(baggageState); ok { + s = v + } + + s.list = list + ctx := context.WithValue(parent, baggageKey, s) + if s.setHook != nil { + ctx = s.setHook(ctx, list) + } + + return ctx +} + +// ListFromContext returns the baggage contained in ctx. +func ListFromContext(ctx context.Context) List { + switch v := ctx.Value(baggageKey).(type) { + case baggageState: + if v.getHook != nil { + return v.getHook(ctx, v.list) + } + return v.list + default: + return nil + } +} diff --git a/vendor/go.opentelemetry.io/otel/internal/errorhandler/errorhandler.go b/vendor/go.opentelemetry.io/otel/internal/errorhandler/errorhandler.go new file mode 100644 index 00000000..3f0ab313 --- /dev/null +++ b/vendor/go.opentelemetry.io/otel/internal/errorhandler/errorhandler.go @@ -0,0 +1,96 @@ +// Copyright The OpenTelemetry Authors +// SPDX-License-Identifier: Apache-2.0 + +// Package errorhandler provides the global error handler for OpenTelemetry. +// +// This package has no OTel dependencies, allowing it to be imported by any +// package in the module without creating import cycles. +package errorhandler // import "go.opentelemetry.io/otel/internal/errorhandler" + +import ( + "errors" + "log" + "sync" + "sync/atomic" +) + +// ErrorHandler handles irremediable events. +type ErrorHandler interface { + // Handle handles any error deemed irremediable by an OpenTelemetry + // component. + Handle(error) +} + +type ErrDelegator struct { + delegate atomic.Pointer[ErrorHandler] +} + +// Compile-time check that delegator implements ErrorHandler. +var _ ErrorHandler = (*ErrDelegator)(nil) + +func (d *ErrDelegator) Handle(err error) { + if eh := d.delegate.Load(); eh != nil { + (*eh).Handle(err) + return + } + log.Print(err) +} + +// setDelegate sets the ErrorHandler delegate. +func (d *ErrDelegator) setDelegate(eh ErrorHandler) { + d.delegate.Store(&eh) +} + +type errorHandlerHolder struct { + eh ErrorHandler +} + +var ( + globalErrorHandler = defaultErrorHandler() + delegateErrorHandlerOnce sync.Once +) + +// GetErrorHandler returns the global ErrorHandler instance. +// +// The default ErrorHandler instance returned will log all errors to STDERR +// until an override ErrorHandler is set with SetErrorHandler. All +// ErrorHandler returned prior to this will automatically forward errors to +// the set instance instead of logging. +// +// Subsequent calls to SetErrorHandler after the first will not forward errors +// to the new ErrorHandler for prior returned instances. +func GetErrorHandler() ErrorHandler { + return globalErrorHandler.Load().(errorHandlerHolder).eh +} + +// SetErrorHandler sets the global ErrorHandler to h. +// +// The first time this is called all ErrorHandler previously returned from +// GetErrorHandler will send errors to h instead of the default logging +// ErrorHandler. Subsequent calls will set the global ErrorHandler, but not +// delegate errors to h. +func SetErrorHandler(h ErrorHandler) { + current := GetErrorHandler() + + if _, cOk := current.(*ErrDelegator); cOk { + if _, ehOk := h.(*ErrDelegator); ehOk && current == h { + // Do not assign to the delegate of the default ErrDelegator to be + // itself. + log.Print(errors.New("no ErrorHandler delegate configured"), " ErrorHandler remains its current value.") + return + } + } + + delegateErrorHandlerOnce.Do(func() { + if def, ok := current.(*ErrDelegator); ok { + def.setDelegate(h) + } + }) + globalErrorHandler.Store(errorHandlerHolder{eh: h}) +} + +func defaultErrorHandler() *atomic.Value { + v := &atomic.Value{} + v.Store(errorHandlerHolder{eh: &ErrDelegator{}}) + return v +} diff --git a/vendor/go.opentelemetry.io/otel/internal/global/handler.go b/vendor/go.opentelemetry.io/otel/internal/global/handler.go new file mode 100644 index 00000000..77d0425f --- /dev/null +++ b/vendor/go.opentelemetry.io/otel/internal/global/handler.go @@ -0,0 +1,17 @@ +// Copyright The OpenTelemetry Authors +// SPDX-License-Identifier: Apache-2.0 + +// Package global provides the OpenTelemetry global API. +package global // import "go.opentelemetry.io/otel/internal/global" + +import ( + "go.opentelemetry.io/otel/internal/errorhandler" +) + +// ErrorHandler is an alias for errorhandler.ErrorHandler, kept for backward +// compatibility with existing callers of internal/global. +type ErrorHandler = errorhandler.ErrorHandler + +// ErrDelegator is an alias for errorhandler.ErrDelegator, kept for backward +// compatibility with existing callers of internal/global. +type ErrDelegator = errorhandler.ErrDelegator diff --git a/vendor/go.opentelemetry.io/otel/internal/global/instruments.go b/vendor/go.opentelemetry.io/otel/internal/global/instruments.go new file mode 100644 index 00000000..55255cdd --- /dev/null +++ b/vendor/go.opentelemetry.io/otel/internal/global/instruments.go @@ -0,0 +1,468 @@ +// Copyright The OpenTelemetry Authors +// SPDX-License-Identifier: Apache-2.0 + +package global // import "go.opentelemetry.io/otel/internal/global" + +import ( + "context" + "sync/atomic" + + "go.opentelemetry.io/otel/metric" + "go.opentelemetry.io/otel/metric/embedded" +) + +// unwrapper unwraps to return the underlying instrument implementation. +type unwrapper interface { + unwrap() metric.Observable +} + +type afCounter struct { + embedded.Float64ObservableCounter + metric.Float64Observable + + name string + opts []metric.Float64ObservableCounterOption + + delegate atomic.Value // metric.Float64ObservableCounter +} + +var ( + _ unwrapper = (*afCounter)(nil) + _ metric.Float64ObservableCounter = (*afCounter)(nil) +) + +func (i *afCounter) setDelegate(m metric.Meter) { + ctr, err := m.Float64ObservableCounter(i.name, i.opts...) + if err != nil { + GetErrorHandler().Handle(err) + return + } + i.delegate.Store(ctr) +} + +func (i *afCounter) unwrap() metric.Observable { + if ctr := i.delegate.Load(); ctr != nil { + return ctr.(metric.Float64ObservableCounter) + } + return nil +} + +type afUpDownCounter struct { + embedded.Float64ObservableUpDownCounter + metric.Float64Observable + + name string + opts []metric.Float64ObservableUpDownCounterOption + + delegate atomic.Value // metric.Float64ObservableUpDownCounter +} + +var ( + _ unwrapper = (*afUpDownCounter)(nil) + _ metric.Float64ObservableUpDownCounter = (*afUpDownCounter)(nil) +) + +func (i *afUpDownCounter) setDelegate(m metric.Meter) { + ctr, err := m.Float64ObservableUpDownCounter(i.name, i.opts...) + if err != nil { + GetErrorHandler().Handle(err) + return + } + i.delegate.Store(ctr) +} + +func (i *afUpDownCounter) unwrap() metric.Observable { + if ctr := i.delegate.Load(); ctr != nil { + return ctr.(metric.Float64ObservableUpDownCounter) + } + return nil +} + +type afGauge struct { + embedded.Float64ObservableGauge + metric.Float64Observable + + name string + opts []metric.Float64ObservableGaugeOption + + delegate atomic.Value // metric.Float64ObservableGauge +} + +var ( + _ unwrapper = (*afGauge)(nil) + _ metric.Float64ObservableGauge = (*afGauge)(nil) +) + +func (i *afGauge) setDelegate(m metric.Meter) { + ctr, err := m.Float64ObservableGauge(i.name, i.opts...) + if err != nil { + GetErrorHandler().Handle(err) + return + } + i.delegate.Store(ctr) +} + +func (i *afGauge) unwrap() metric.Observable { + if ctr := i.delegate.Load(); ctr != nil { + return ctr.(metric.Float64ObservableGauge) + } + return nil +} + +type aiCounter struct { + embedded.Int64ObservableCounter + metric.Int64Observable + + name string + opts []metric.Int64ObservableCounterOption + + delegate atomic.Value // metric.Int64ObservableCounter +} + +var ( + _ unwrapper = (*aiCounter)(nil) + _ metric.Int64ObservableCounter = (*aiCounter)(nil) +) + +func (i *aiCounter) setDelegate(m metric.Meter) { + ctr, err := m.Int64ObservableCounter(i.name, i.opts...) + if err != nil { + GetErrorHandler().Handle(err) + return + } + i.delegate.Store(ctr) +} + +func (i *aiCounter) unwrap() metric.Observable { + if ctr := i.delegate.Load(); ctr != nil { + return ctr.(metric.Int64ObservableCounter) + } + return nil +} + +type aiUpDownCounter struct { + embedded.Int64ObservableUpDownCounter + metric.Int64Observable + + name string + opts []metric.Int64ObservableUpDownCounterOption + + delegate atomic.Value // metric.Int64ObservableUpDownCounter +} + +var ( + _ unwrapper = (*aiUpDownCounter)(nil) + _ metric.Int64ObservableUpDownCounter = (*aiUpDownCounter)(nil) +) + +func (i *aiUpDownCounter) setDelegate(m metric.Meter) { + ctr, err := m.Int64ObservableUpDownCounter(i.name, i.opts...) + if err != nil { + GetErrorHandler().Handle(err) + return + } + i.delegate.Store(ctr) +} + +func (i *aiUpDownCounter) unwrap() metric.Observable { + if ctr := i.delegate.Load(); ctr != nil { + return ctr.(metric.Int64ObservableUpDownCounter) + } + return nil +} + +type aiGauge struct { + embedded.Int64ObservableGauge + metric.Int64Observable + + name string + opts []metric.Int64ObservableGaugeOption + + delegate atomic.Value // metric.Int64ObservableGauge +} + +var ( + _ unwrapper = (*aiGauge)(nil) + _ metric.Int64ObservableGauge = (*aiGauge)(nil) +) + +func (i *aiGauge) setDelegate(m metric.Meter) { + ctr, err := m.Int64ObservableGauge(i.name, i.opts...) + if err != nil { + GetErrorHandler().Handle(err) + return + } + i.delegate.Store(ctr) +} + +func (i *aiGauge) unwrap() metric.Observable { + if ctr := i.delegate.Load(); ctr != nil { + return ctr.(metric.Int64ObservableGauge) + } + return nil +} + +// Sync Instruments. +type sfCounter struct { + embedded.Float64Counter + + name string + opts []metric.Float64CounterOption + + delegate atomic.Value // metric.Float64Counter +} + +var _ metric.Float64Counter = (*sfCounter)(nil) + +func (i *sfCounter) setDelegate(m metric.Meter) { + ctr, err := m.Float64Counter(i.name, i.opts...) + if err != nil { + GetErrorHandler().Handle(err) + return + } + i.delegate.Store(ctr) +} + +func (i *sfCounter) Add(ctx context.Context, incr float64, opts ...metric.AddOption) { + if ctr := i.delegate.Load(); ctr != nil { + ctr.(metric.Float64Counter).Add(ctx, incr, opts...) + } +} + +func (i *sfCounter) Enabled(ctx context.Context) bool { + if ctr := i.delegate.Load(); ctr != nil { + return ctr.(metric.Float64Counter).Enabled(ctx) + } + return false +} + +type sfUpDownCounter struct { + embedded.Float64UpDownCounter + + name string + opts []metric.Float64UpDownCounterOption + + delegate atomic.Value // metric.Float64UpDownCounter +} + +var _ metric.Float64UpDownCounter = (*sfUpDownCounter)(nil) + +func (i *sfUpDownCounter) setDelegate(m metric.Meter) { + ctr, err := m.Float64UpDownCounter(i.name, i.opts...) + if err != nil { + GetErrorHandler().Handle(err) + return + } + i.delegate.Store(ctr) +} + +func (i *sfUpDownCounter) Add(ctx context.Context, incr float64, opts ...metric.AddOption) { + if ctr := i.delegate.Load(); ctr != nil { + ctr.(metric.Float64UpDownCounter).Add(ctx, incr, opts...) + } +} + +func (i *sfUpDownCounter) Enabled(ctx context.Context) bool { + if ctr := i.delegate.Load(); ctr != nil { + return ctr.(metric.Float64UpDownCounter).Enabled(ctx) + } + return false +} + +type sfHistogram struct { + embedded.Float64Histogram + + name string + opts []metric.Float64HistogramOption + + delegate atomic.Value // metric.Float64Histogram +} + +var _ metric.Float64Histogram = (*sfHistogram)(nil) + +func (i *sfHistogram) setDelegate(m metric.Meter) { + ctr, err := m.Float64Histogram(i.name, i.opts...) + if err != nil { + GetErrorHandler().Handle(err) + return + } + i.delegate.Store(ctr) +} + +func (i *sfHistogram) Record(ctx context.Context, x float64, opts ...metric.RecordOption) { + if ctr := i.delegate.Load(); ctr != nil { + ctr.(metric.Float64Histogram).Record(ctx, x, opts...) + } +} + +func (i *sfHistogram) Enabled(ctx context.Context) bool { + if ctr := i.delegate.Load(); ctr != nil { + return ctr.(metric.Float64Histogram).Enabled(ctx) + } + return false +} + +type sfGauge struct { + embedded.Float64Gauge + + name string + opts []metric.Float64GaugeOption + + delegate atomic.Value // metric.Float64Gauge +} + +var _ metric.Float64Gauge = (*sfGauge)(nil) + +func (i *sfGauge) setDelegate(m metric.Meter) { + ctr, err := m.Float64Gauge(i.name, i.opts...) + if err != nil { + GetErrorHandler().Handle(err) + return + } + i.delegate.Store(ctr) +} + +func (i *sfGauge) Record(ctx context.Context, x float64, opts ...metric.RecordOption) { + if ctr := i.delegate.Load(); ctr != nil { + ctr.(metric.Float64Gauge).Record(ctx, x, opts...) + } +} + +func (i *sfGauge) Enabled(ctx context.Context) bool { + if ctr := i.delegate.Load(); ctr != nil { + return ctr.(metric.Float64Gauge).Enabled(ctx) + } + return false +} + +type siCounter struct { + embedded.Int64Counter + + name string + opts []metric.Int64CounterOption + + delegate atomic.Value // metric.Int64Counter +} + +var _ metric.Int64Counter = (*siCounter)(nil) + +func (i *siCounter) setDelegate(m metric.Meter) { + ctr, err := m.Int64Counter(i.name, i.opts...) + if err != nil { + GetErrorHandler().Handle(err) + return + } + i.delegate.Store(ctr) +} + +func (i *siCounter) Add(ctx context.Context, x int64, opts ...metric.AddOption) { + if ctr := i.delegate.Load(); ctr != nil { + ctr.(metric.Int64Counter).Add(ctx, x, opts...) + } +} + +func (i *siCounter) Enabled(ctx context.Context) bool { + if ctr := i.delegate.Load(); ctr != nil { + return ctr.(metric.Int64Counter).Enabled(ctx) + } + return false +} + +type siUpDownCounter struct { + embedded.Int64UpDownCounter + + name string + opts []metric.Int64UpDownCounterOption + + delegate atomic.Value // metric.Int64UpDownCounter +} + +var _ metric.Int64UpDownCounter = (*siUpDownCounter)(nil) + +func (i *siUpDownCounter) setDelegate(m metric.Meter) { + ctr, err := m.Int64UpDownCounter(i.name, i.opts...) + if err != nil { + GetErrorHandler().Handle(err) + return + } + i.delegate.Store(ctr) +} + +func (i *siUpDownCounter) Add(ctx context.Context, x int64, opts ...metric.AddOption) { + if ctr := i.delegate.Load(); ctr != nil { + ctr.(metric.Int64UpDownCounter).Add(ctx, x, opts...) + } +} + +func (i *siUpDownCounter) Enabled(ctx context.Context) bool { + if ctr := i.delegate.Load(); ctr != nil { + return ctr.(metric.Int64UpDownCounter).Enabled(ctx) + } + return false +} + +type siHistogram struct { + embedded.Int64Histogram + + name string + opts []metric.Int64HistogramOption + + delegate atomic.Value // metric.Int64Histogram +} + +var _ metric.Int64Histogram = (*siHistogram)(nil) + +func (i *siHistogram) setDelegate(m metric.Meter) { + ctr, err := m.Int64Histogram(i.name, i.opts...) + if err != nil { + GetErrorHandler().Handle(err) + return + } + i.delegate.Store(ctr) +} + +func (i *siHistogram) Record(ctx context.Context, x int64, opts ...metric.RecordOption) { + if ctr := i.delegate.Load(); ctr != nil { + ctr.(metric.Int64Histogram).Record(ctx, x, opts...) + } +} + +func (i *siHistogram) Enabled(ctx context.Context) bool { + if ctr := i.delegate.Load(); ctr != nil { + return ctr.(metric.Int64Histogram).Enabled(ctx) + } + return false +} + +type siGauge struct { + embedded.Int64Gauge + + name string + opts []metric.Int64GaugeOption + + delegate atomic.Value // metric.Int64Gauge +} + +var _ metric.Int64Gauge = (*siGauge)(nil) + +func (i *siGauge) setDelegate(m metric.Meter) { + ctr, err := m.Int64Gauge(i.name, i.opts...) + if err != nil { + GetErrorHandler().Handle(err) + return + } + i.delegate.Store(ctr) +} + +func (i *siGauge) Record(ctx context.Context, x int64, opts ...metric.RecordOption) { + if ctr := i.delegate.Load(); ctr != nil { + ctr.(metric.Int64Gauge).Record(ctx, x, opts...) + } +} + +func (i *siGauge) Enabled(ctx context.Context) bool { + if ctr := i.delegate.Load(); ctr != nil { + return ctr.(metric.Int64Gauge).Enabled(ctx) + } + return false +} diff --git a/vendor/go.opentelemetry.io/otel/internal/global/internal_logging.go b/vendor/go.opentelemetry.io/otel/internal/global/internal_logging.go new file mode 100644 index 00000000..86d7f4ba --- /dev/null +++ b/vendor/go.opentelemetry.io/otel/internal/global/internal_logging.go @@ -0,0 +1,62 @@ +// Copyright The OpenTelemetry Authors +// SPDX-License-Identifier: Apache-2.0 + +package global // import "go.opentelemetry.io/otel/internal/global" + +import ( + "log" + "os" + "sync/atomic" + + "github.com/go-logr/logr" + "github.com/go-logr/stdr" +) + +// globalLogger holds a reference to the [logr.Logger] used within +// go.opentelemetry.io/otel. +// +// The default logger uses stdr which is backed by the standard `log.Logger` +// interface. This logger will only show messages at the Error Level. +var globalLogger = func() *atomic.Pointer[logr.Logger] { + l := stdr.New(log.New(os.Stderr, "", log.LstdFlags|log.Lshortfile)) + + p := new(atomic.Pointer[logr.Logger]) + p.Store(&l) + return p +}() + +// SetLogger sets the global Logger to l. +// +// To see Warn messages use a logger with `l.V(1).Enabled() == true` +// To see Info messages use a logger with `l.V(4).Enabled() == true` +// To see Debug messages use a logger with `l.V(8).Enabled() == true`. +func SetLogger(l logr.Logger) { + globalLogger.Store(&l) +} + +// GetLogger returns the global logger. +func GetLogger() logr.Logger { + return *globalLogger.Load() +} + +// Info prints messages about the general state of the API or SDK. +// This should usually be less than 5 messages a minute. +func Info(msg string, keysAndValues ...any) { + GetLogger().V(4).Info(msg, keysAndValues...) +} + +// Error prints messages about exceptional states of the API or SDK. +func Error(err error, msg string, keysAndValues ...any) { + GetLogger().Error(err, msg, keysAndValues...) +} + +// Debug prints messages about all internal changes in the API or SDK. +func Debug(msg string, keysAndValues ...any) { + GetLogger().V(8).Info(msg, keysAndValues...) +} + +// Warn prints messages about warnings in the API or SDK. +// Not an error but is likely more important than an informational event. +func Warn(msg string, keysAndValues ...any) { + GetLogger().V(1).Info(msg, keysAndValues...) +} diff --git a/vendor/go.opentelemetry.io/otel/internal/global/meter.go b/vendor/go.opentelemetry.io/otel/internal/global/meter.go new file mode 100644 index 00000000..50043d66 --- /dev/null +++ b/vendor/go.opentelemetry.io/otel/internal/global/meter.go @@ -0,0 +1,625 @@ +// Copyright The OpenTelemetry Authors +// SPDX-License-Identifier: Apache-2.0 + +package global // import "go.opentelemetry.io/otel/internal/global" + +import ( + "container/list" + "context" + "reflect" + "sync" + + "go.opentelemetry.io/otel/metric" + "go.opentelemetry.io/otel/metric/embedded" +) + +// meterProvider is a placeholder for a configured SDK MeterProvider. +// +// All MeterProvider functionality is forwarded to a delegate once +// configured. +type meterProvider struct { + embedded.MeterProvider + + mtx sync.Mutex + meters map[il]*meter + + delegate metric.MeterProvider +} + +// setDelegate configures p to delegate all MeterProvider functionality to +// provider. +// +// All Meters provided prior to this function call are switched out to be +// Meters provided by provider. All instruments and callbacks are recreated and +// delegated. +// +// It is guaranteed by the caller that this happens only once. +func (p *meterProvider) setDelegate(provider metric.MeterProvider) { + p.mtx.Lock() + defer p.mtx.Unlock() + + p.delegate = provider + + if len(p.meters) == 0 { + return + } + + for _, meter := range p.meters { + meter.setDelegate(provider) + } + + p.meters = nil +} + +// Meter implements MeterProvider. +func (p *meterProvider) Meter(name string, opts ...metric.MeterOption) metric.Meter { + p.mtx.Lock() + defer p.mtx.Unlock() + + if p.delegate != nil { + return p.delegate.Meter(name, opts...) + } + + // At this moment it is guaranteed that no sdk is installed, save the meter in the meters map. + + c := metric.NewMeterConfig(opts...) + key := il{ + name: name, + version: c.InstrumentationVersion(), + schema: c.SchemaURL(), + attrs: c.InstrumentationAttributes(), + } + + if p.meters == nil { + p.meters = make(map[il]*meter) + } + + if val, ok := p.meters[key]; ok { + return val + } + + t := &meter{name: name, opts: opts, instruments: make(map[instID]delegatedInstrument)} + p.meters[key] = t + return t +} + +// meter is a placeholder for a metric.Meter. +// +// All Meter functionality is forwarded to a delegate once configured. +// Otherwise, all functionality is forwarded to a NoopMeter. +type meter struct { + embedded.Meter + + name string + opts []metric.MeterOption + + mtx sync.Mutex + instruments map[instID]delegatedInstrument + + registry list.List + + delegate metric.Meter +} + +type delegatedInstrument interface { + setDelegate(metric.Meter) +} + +// instID are the identifying properties of an instrument. +type instID struct { + // name is the name of the stream. + name string + // description is the description of the stream. + description string + // kind defines the functional group of the instrument. + kind reflect.Type + // unit is the unit of the stream. + unit string +} + +// setDelegate configures m to delegate all Meter functionality to Meters +// created by provider. +// +// All subsequent calls to the Meter methods will be passed to the delegate. +// +// It is guaranteed by the caller that this happens only once. +func (m *meter) setDelegate(provider metric.MeterProvider) { + m.mtx.Lock() + defer m.mtx.Unlock() + + meter := provider.Meter(m.name, m.opts...) + m.delegate = meter + + for _, inst := range m.instruments { + inst.setDelegate(meter) + } + + var n *list.Element + for e := m.registry.Front(); e != nil; e = n { + r := e.Value.(*registration) + r.setDelegate(meter) + n = e.Next() + m.registry.Remove(e) + } + + m.instruments = nil + m.registry.Init() +} + +func (m *meter) Int64Counter(name string, options ...metric.Int64CounterOption) (metric.Int64Counter, error) { + m.mtx.Lock() + defer m.mtx.Unlock() + + if m.delegate != nil { + return m.delegate.Int64Counter(name, options...) + } + + cfg := metric.NewInt64CounterConfig(options...) + id := instID{ + name: name, + kind: reflect.TypeFor[*siCounter](), + description: cfg.Description(), + unit: cfg.Unit(), + } + if f, ok := m.instruments[id]; ok { + return f.(metric.Int64Counter), nil + } + i := &siCounter{name: name, opts: options} + m.instruments[id] = i + return i, nil +} + +func (m *meter) Int64UpDownCounter( + name string, + options ...metric.Int64UpDownCounterOption, +) (metric.Int64UpDownCounter, error) { + m.mtx.Lock() + defer m.mtx.Unlock() + + if m.delegate != nil { + return m.delegate.Int64UpDownCounter(name, options...) + } + + cfg := metric.NewInt64UpDownCounterConfig(options...) + id := instID{ + name: name, + kind: reflect.TypeFor[*siUpDownCounter](), + description: cfg.Description(), + unit: cfg.Unit(), + } + if f, ok := m.instruments[id]; ok { + return f.(metric.Int64UpDownCounter), nil + } + i := &siUpDownCounter{name: name, opts: options} + m.instruments[id] = i + return i, nil +} + +func (m *meter) Int64Histogram(name string, options ...metric.Int64HistogramOption) (metric.Int64Histogram, error) { + m.mtx.Lock() + defer m.mtx.Unlock() + + if m.delegate != nil { + return m.delegate.Int64Histogram(name, options...) + } + + cfg := metric.NewInt64HistogramConfig(options...) + id := instID{ + name: name, + kind: reflect.TypeFor[*siHistogram](), + description: cfg.Description(), + unit: cfg.Unit(), + } + if f, ok := m.instruments[id]; ok { + return f.(metric.Int64Histogram), nil + } + i := &siHistogram{name: name, opts: options} + m.instruments[id] = i + return i, nil +} + +func (m *meter) Int64Gauge(name string, options ...metric.Int64GaugeOption) (metric.Int64Gauge, error) { + m.mtx.Lock() + defer m.mtx.Unlock() + + if m.delegate != nil { + return m.delegate.Int64Gauge(name, options...) + } + + cfg := metric.NewInt64GaugeConfig(options...) + id := instID{ + name: name, + kind: reflect.TypeFor[*siGauge](), + description: cfg.Description(), + unit: cfg.Unit(), + } + if f, ok := m.instruments[id]; ok { + return f.(metric.Int64Gauge), nil + } + i := &siGauge{name: name, opts: options} + m.instruments[id] = i + return i, nil +} + +func (m *meter) Int64ObservableCounter( + name string, + options ...metric.Int64ObservableCounterOption, +) (metric.Int64ObservableCounter, error) { + m.mtx.Lock() + defer m.mtx.Unlock() + + if m.delegate != nil { + return m.delegate.Int64ObservableCounter(name, options...) + } + + cfg := metric.NewInt64ObservableCounterConfig(options...) + id := instID{ + name: name, + kind: reflect.TypeFor[*aiCounter](), + description: cfg.Description(), + unit: cfg.Unit(), + } + if f, ok := m.instruments[id]; ok { + return f.(metric.Int64ObservableCounter), nil + } + i := &aiCounter{name: name, opts: options} + m.instruments[id] = i + return i, nil +} + +func (m *meter) Int64ObservableUpDownCounter( + name string, + options ...metric.Int64ObservableUpDownCounterOption, +) (metric.Int64ObservableUpDownCounter, error) { + m.mtx.Lock() + defer m.mtx.Unlock() + + if m.delegate != nil { + return m.delegate.Int64ObservableUpDownCounter(name, options...) + } + + cfg := metric.NewInt64ObservableUpDownCounterConfig(options...) + id := instID{ + name: name, + kind: reflect.TypeFor[*aiUpDownCounter](), + description: cfg.Description(), + unit: cfg.Unit(), + } + if f, ok := m.instruments[id]; ok { + return f.(metric.Int64ObservableUpDownCounter), nil + } + i := &aiUpDownCounter{name: name, opts: options} + m.instruments[id] = i + return i, nil +} + +func (m *meter) Int64ObservableGauge( + name string, + options ...metric.Int64ObservableGaugeOption, +) (metric.Int64ObservableGauge, error) { + m.mtx.Lock() + defer m.mtx.Unlock() + + if m.delegate != nil { + return m.delegate.Int64ObservableGauge(name, options...) + } + + cfg := metric.NewInt64ObservableGaugeConfig(options...) + id := instID{ + name: name, + kind: reflect.TypeFor[*aiGauge](), + description: cfg.Description(), + unit: cfg.Unit(), + } + if f, ok := m.instruments[id]; ok { + return f.(metric.Int64ObservableGauge), nil + } + i := &aiGauge{name: name, opts: options} + m.instruments[id] = i + return i, nil +} + +func (m *meter) Float64Counter(name string, options ...metric.Float64CounterOption) (metric.Float64Counter, error) { + m.mtx.Lock() + defer m.mtx.Unlock() + + if m.delegate != nil { + return m.delegate.Float64Counter(name, options...) + } + + cfg := metric.NewFloat64CounterConfig(options...) + id := instID{ + name: name, + kind: reflect.TypeFor[*sfCounter](), + description: cfg.Description(), + unit: cfg.Unit(), + } + if f, ok := m.instruments[id]; ok { + return f.(metric.Float64Counter), nil + } + i := &sfCounter{name: name, opts: options} + m.instruments[id] = i + return i, nil +} + +func (m *meter) Float64UpDownCounter( + name string, + options ...metric.Float64UpDownCounterOption, +) (metric.Float64UpDownCounter, error) { + m.mtx.Lock() + defer m.mtx.Unlock() + + if m.delegate != nil { + return m.delegate.Float64UpDownCounter(name, options...) + } + + cfg := metric.NewFloat64UpDownCounterConfig(options...) + id := instID{ + name: name, + kind: reflect.TypeFor[*sfUpDownCounter](), + description: cfg.Description(), + unit: cfg.Unit(), + } + if f, ok := m.instruments[id]; ok { + return f.(metric.Float64UpDownCounter), nil + } + i := &sfUpDownCounter{name: name, opts: options} + m.instruments[id] = i + return i, nil +} + +func (m *meter) Float64Histogram( + name string, + options ...metric.Float64HistogramOption, +) (metric.Float64Histogram, error) { + m.mtx.Lock() + defer m.mtx.Unlock() + + if m.delegate != nil { + return m.delegate.Float64Histogram(name, options...) + } + + cfg := metric.NewFloat64HistogramConfig(options...) + id := instID{ + name: name, + kind: reflect.TypeFor[*sfHistogram](), + description: cfg.Description(), + unit: cfg.Unit(), + } + if f, ok := m.instruments[id]; ok { + return f.(metric.Float64Histogram), nil + } + i := &sfHistogram{name: name, opts: options} + m.instruments[id] = i + return i, nil +} + +func (m *meter) Float64Gauge(name string, options ...metric.Float64GaugeOption) (metric.Float64Gauge, error) { + m.mtx.Lock() + defer m.mtx.Unlock() + + if m.delegate != nil { + return m.delegate.Float64Gauge(name, options...) + } + + cfg := metric.NewFloat64GaugeConfig(options...) + id := instID{ + name: name, + kind: reflect.TypeFor[*sfGauge](), + description: cfg.Description(), + unit: cfg.Unit(), + } + if f, ok := m.instruments[id]; ok { + return f.(metric.Float64Gauge), nil + } + i := &sfGauge{name: name, opts: options} + m.instruments[id] = i + return i, nil +} + +func (m *meter) Float64ObservableCounter( + name string, + options ...metric.Float64ObservableCounterOption, +) (metric.Float64ObservableCounter, error) { + m.mtx.Lock() + defer m.mtx.Unlock() + + if m.delegate != nil { + return m.delegate.Float64ObservableCounter(name, options...) + } + + cfg := metric.NewFloat64ObservableCounterConfig(options...) + id := instID{ + name: name, + kind: reflect.TypeFor[*afCounter](), + description: cfg.Description(), + unit: cfg.Unit(), + } + if f, ok := m.instruments[id]; ok { + return f.(metric.Float64ObservableCounter), nil + } + i := &afCounter{name: name, opts: options} + m.instruments[id] = i + return i, nil +} + +func (m *meter) Float64ObservableUpDownCounter( + name string, + options ...metric.Float64ObservableUpDownCounterOption, +) (metric.Float64ObservableUpDownCounter, error) { + m.mtx.Lock() + defer m.mtx.Unlock() + + if m.delegate != nil { + return m.delegate.Float64ObservableUpDownCounter(name, options...) + } + + cfg := metric.NewFloat64ObservableUpDownCounterConfig(options...) + id := instID{ + name: name, + kind: reflect.TypeFor[*afUpDownCounter](), + description: cfg.Description(), + unit: cfg.Unit(), + } + if f, ok := m.instruments[id]; ok { + return f.(metric.Float64ObservableUpDownCounter), nil + } + i := &afUpDownCounter{name: name, opts: options} + m.instruments[id] = i + return i, nil +} + +func (m *meter) Float64ObservableGauge( + name string, + options ...metric.Float64ObservableGaugeOption, +) (metric.Float64ObservableGauge, error) { + m.mtx.Lock() + defer m.mtx.Unlock() + + if m.delegate != nil { + return m.delegate.Float64ObservableGauge(name, options...) + } + + cfg := metric.NewFloat64ObservableGaugeConfig(options...) + id := instID{ + name: name, + kind: reflect.TypeFor[*afGauge](), + description: cfg.Description(), + unit: cfg.Unit(), + } + if f, ok := m.instruments[id]; ok { + return f.(metric.Float64ObservableGauge), nil + } + i := &afGauge{name: name, opts: options} + m.instruments[id] = i + return i, nil +} + +// RegisterCallback captures the function that will be called during Collect. +func (m *meter) RegisterCallback(f metric.Callback, insts ...metric.Observable) (metric.Registration, error) { + m.mtx.Lock() + defer m.mtx.Unlock() + + if m.delegate != nil { + return m.delegate.RegisterCallback(unwrapCallback(f), unwrapInstruments(insts)...) + } + + reg := ®istration{instruments: insts, function: f} + e := m.registry.PushBack(reg) + reg.unreg = func() error { + m.mtx.Lock() + _ = m.registry.Remove(e) + m.mtx.Unlock() + return nil + } + return reg, nil +} + +func unwrapInstruments(instruments []metric.Observable) []metric.Observable { + out := make([]metric.Observable, 0, len(instruments)) + + for _, inst := range instruments { + if in, ok := inst.(unwrapper); ok { + out = append(out, in.unwrap()) + } else { + out = append(out, inst) + } + } + + return out +} + +type registration struct { + embedded.Registration + + instruments []metric.Observable + function metric.Callback + + unreg func() error + unregMu sync.Mutex +} + +type unwrapObs struct { + embedded.Observer + obs metric.Observer +} + +// unwrapFloat64Observable returns an expected metric.Float64Observable after +// unwrapping the global object. +func unwrapFloat64Observable(inst metric.Float64Observable) metric.Float64Observable { + if unwrapped, ok := inst.(unwrapper); ok { + if floatObs, ok := unwrapped.unwrap().(metric.Float64Observable); ok { + // Note: if the unwrapped object does not + // unwrap as an observable for either of the + // predicates here, it means an internal bug in + // this package. We avoid logging an error in + // this case, because the SDK has to try its + // own type conversion on the object. The SDK + // will see this and be forced to respond with + // its own error. + // + // This code uses a double-nested if statement + // to avoid creating a branch that is + // impossible to cover. + inst = floatObs + } + } + return inst +} + +// unwrapInt64Observable returns an expected metric.Int64Observable after +// unwrapping the global object. +func unwrapInt64Observable(inst metric.Int64Observable) metric.Int64Observable { + if unwrapped, ok := inst.(unwrapper); ok { + if unint, ok := unwrapped.unwrap().(metric.Int64Observable); ok { + // See the comment in unwrapFloat64Observable(). + inst = unint + } + } + return inst +} + +func (uo *unwrapObs) ObserveFloat64(inst metric.Float64Observable, value float64, opts ...metric.ObserveOption) { + uo.obs.ObserveFloat64(unwrapFloat64Observable(inst), value, opts...) +} + +func (uo *unwrapObs) ObserveInt64(inst metric.Int64Observable, value int64, opts ...metric.ObserveOption) { + uo.obs.ObserveInt64(unwrapInt64Observable(inst), value, opts...) +} + +func unwrapCallback(f metric.Callback) metric.Callback { + return func(ctx context.Context, obs metric.Observer) error { + return f(ctx, &unwrapObs{obs: obs}) + } +} + +func (c *registration) setDelegate(m metric.Meter) { + c.unregMu.Lock() + defer c.unregMu.Unlock() + + if c.unreg == nil { + // Unregister already called. + return + } + + reg, err := m.RegisterCallback(unwrapCallback(c.function), unwrapInstruments(c.instruments)...) + if err != nil { + GetErrorHandler().Handle(err) + return + } + + c.unreg = reg.Unregister +} + +func (c *registration) Unregister() error { + c.unregMu.Lock() + defer c.unregMu.Unlock() + if c.unreg == nil { + // Unregister already called. + return nil + } + + var err error + err, c.unreg = c.unreg(), nil + return err +} diff --git a/vendor/go.opentelemetry.io/otel/internal/global/propagator.go b/vendor/go.opentelemetry.io/otel/internal/global/propagator.go new file mode 100644 index 00000000..38560ff9 --- /dev/null +++ b/vendor/go.opentelemetry.io/otel/internal/global/propagator.go @@ -0,0 +1,71 @@ +// Copyright The OpenTelemetry Authors +// SPDX-License-Identifier: Apache-2.0 + +package global // import "go.opentelemetry.io/otel/internal/global" + +import ( + "context" + "sync" + + "go.opentelemetry.io/otel/propagation" +) + +// textMapPropagator is a default TextMapPropagator that delegates calls to a +// registered delegate if one is set, otherwise it defaults to delegating the +// calls to a the default no-op propagation.TextMapPropagator. +type textMapPropagator struct { + mtx sync.Mutex + once sync.Once + delegate propagation.TextMapPropagator + noop propagation.TextMapPropagator +} + +// Compile-time guarantee that textMapPropagator implements the +// propagation.TextMapPropagator interface. +var _ propagation.TextMapPropagator = (*textMapPropagator)(nil) + +func newTextMapPropagator() *textMapPropagator { + return &textMapPropagator{ + noop: propagation.NewCompositeTextMapPropagator(), + } +} + +// SetDelegate sets a delegate propagation.TextMapPropagator that all calls are +// forwarded to. Delegation can only be performed once, all subsequent calls +// perform no delegation. +func (p *textMapPropagator) SetDelegate(delegate propagation.TextMapPropagator) { + if delegate == nil { + return + } + + p.mtx.Lock() + p.once.Do(func() { p.delegate = delegate }) + p.mtx.Unlock() +} + +// effectiveDelegate returns the current delegate of p if one is set, +// otherwise the default noop TextMapPropagator is returned. This method +// can be called concurrently. +func (p *textMapPropagator) effectiveDelegate() propagation.TextMapPropagator { + p.mtx.Lock() + defer p.mtx.Unlock() + if p.delegate != nil { + return p.delegate + } + return p.noop +} + +// Inject set cross-cutting concerns from the Context into the carrier. +func (p *textMapPropagator) Inject(ctx context.Context, carrier propagation.TextMapCarrier) { + p.effectiveDelegate().Inject(ctx, carrier) +} + +// Extract reads cross-cutting concerns from the carrier into a Context. +func (p *textMapPropagator) Extract(ctx context.Context, carrier propagation.TextMapCarrier) context.Context { + return p.effectiveDelegate().Extract(ctx, carrier) +} + +// Fields returns the keys whose values are set with Inject. +func (p *textMapPropagator) Fields() []string { + return p.effectiveDelegate().Fields() +} diff --git a/vendor/go.opentelemetry.io/otel/internal/global/state.go b/vendor/go.opentelemetry.io/otel/internal/global/state.go new file mode 100644 index 00000000..225c9e50 --- /dev/null +++ b/vendor/go.opentelemetry.io/otel/internal/global/state.go @@ -0,0 +1,169 @@ +// Copyright The OpenTelemetry Authors +// SPDX-License-Identifier: Apache-2.0 + +package global // import "go.opentelemetry.io/otel/internal/global" + +import ( + "errors" + "sync" + "sync/atomic" + + "go.opentelemetry.io/otel/internal/errorhandler" + "go.opentelemetry.io/otel/metric" + "go.opentelemetry.io/otel/propagation" + "go.opentelemetry.io/otel/trace" +) + +type ( + tracerProviderHolder struct { + tp trace.TracerProvider + } + + propagatorsHolder struct { + tm propagation.TextMapPropagator + } + + meterProviderHolder struct { + mp metric.MeterProvider + } +) + +var ( + globalTracer = defaultTracerValue() + globalPropagators = defaultPropagatorsValue() + globalMeterProvider = defaultMeterProvider() + + delegateTraceOnce sync.Once + delegateTextMapPropagatorOnce sync.Once + delegateMeterOnce sync.Once +) + +// GetErrorHandler returns the global ErrorHandler instance. +// +// The default ErrorHandler instance returned will log all errors to STDERR +// until an override ErrorHandler is set with SetErrorHandler. All +// ErrorHandler returned prior to this will automatically forward errors to +// the set instance instead of logging. +// +// Subsequent calls to SetErrorHandler after the first will not forward errors +// to the new ErrorHandler for prior returned instances. +func GetErrorHandler() ErrorHandler { + return errorhandler.GetErrorHandler() +} + +// SetErrorHandler sets the global ErrorHandler to h. +// +// The first time this is called all ErrorHandler previously returned from +// GetErrorHandler will send errors to h instead of the default logging +// ErrorHandler. Subsequent calls will set the global ErrorHandler, but not +// delegate errors to h. +func SetErrorHandler(h ErrorHandler) { + errorhandler.SetErrorHandler(h) +} + +// TracerProvider is the internal implementation for global.TracerProvider. +func TracerProvider() trace.TracerProvider { + return globalTracer.Load().(tracerProviderHolder).tp +} + +// SetTracerProvider is the internal implementation for global.SetTracerProvider. +func SetTracerProvider(tp trace.TracerProvider) { + current := TracerProvider() + + if _, cOk := current.(*tracerProvider); cOk { + if _, tpOk := tp.(*tracerProvider); tpOk && current == tp { + // Do not assign the default delegating TracerProvider to delegate + // to itself. + Error( + errors.New("no delegate configured in tracer provider"), + "Setting tracer provider to its current value. No delegate will be configured", + ) + return + } + } + + delegateTraceOnce.Do(func() { + if def, ok := current.(*tracerProvider); ok { + def.setDelegate(tp) + } + }) + globalTracer.Store(tracerProviderHolder{tp: tp}) +} + +// TextMapPropagator is the internal implementation for global.TextMapPropagator. +func TextMapPropagator() propagation.TextMapPropagator { + return globalPropagators.Load().(propagatorsHolder).tm +} + +// SetTextMapPropagator is the internal implementation for global.SetTextMapPropagator. +func SetTextMapPropagator(p propagation.TextMapPropagator) { + current := TextMapPropagator() + + if _, cOk := current.(*textMapPropagator); cOk { + if _, pOk := p.(*textMapPropagator); pOk && current == p { + // Do not assign the default delegating TextMapPropagator to + // delegate to itself. + Error( + errors.New("no delegate configured in text map propagator"), + "Setting text map propagator to its current value. No delegate will be configured", + ) + return + } + } + + // For the textMapPropagator already returned by TextMapPropagator + // delegate to p. + delegateTextMapPropagatorOnce.Do(func() { + if def, ok := current.(*textMapPropagator); ok { + def.SetDelegate(p) + } + }) + // Return p when subsequent calls to TextMapPropagator are made. + globalPropagators.Store(propagatorsHolder{tm: p}) +} + +// MeterProvider is the internal implementation for global.MeterProvider. +func MeterProvider() metric.MeterProvider { + return globalMeterProvider.Load().(meterProviderHolder).mp +} + +// SetMeterProvider is the internal implementation for global.SetMeterProvider. +func SetMeterProvider(mp metric.MeterProvider) { + current := MeterProvider() + if _, cOk := current.(*meterProvider); cOk { + if _, mpOk := mp.(*meterProvider); mpOk && current == mp { + // Do not assign the default delegating MeterProvider to delegate + // to itself. + Error( + errors.New("no delegate configured in meter provider"), + "Setting meter provider to its current value. No delegate will be configured", + ) + return + } + } + + delegateMeterOnce.Do(func() { + if def, ok := current.(*meterProvider); ok { + def.setDelegate(mp) + } + }) + globalMeterProvider.Store(meterProviderHolder{mp: mp}) +} + +func defaultTracerValue() *atomic.Value { + v := &atomic.Value{} + v.Store(tracerProviderHolder{tp: &tracerProvider{}}) + return v +} + +func defaultPropagatorsValue() *atomic.Value { + v := &atomic.Value{} + v.Store(propagatorsHolder{tm: newTextMapPropagator()}) + return v +} + +func defaultMeterProvider() *atomic.Value { + v := &atomic.Value{} + v.Store(meterProviderHolder{mp: &meterProvider{}}) + return v +} diff --git a/vendor/go.opentelemetry.io/otel/internal/global/trace.go b/vendor/go.opentelemetry.io/otel/internal/global/trace.go new file mode 100644 index 00000000..bf5cf311 --- /dev/null +++ b/vendor/go.opentelemetry.io/otel/internal/global/trace.go @@ -0,0 +1,232 @@ +// Copyright The OpenTelemetry Authors +// SPDX-License-Identifier: Apache-2.0 + +package global // import "go.opentelemetry.io/otel/internal/global" + +/* +This file contains the forwarding implementation of the TracerProvider used as +the default global instance. Prior to initialization of an SDK, Tracers +returned by the global TracerProvider will provide no-op functionality. This +means that all Span created prior to initialization are no-op Spans. + +Once an SDK has been initialized, all provided no-op Tracers are swapped for +Tracers provided by the SDK defined TracerProvider. However, any Span started +prior to this initialization does not change its behavior. Meaning, the Span +remains a no-op Span. + +The implementation to track and swap Tracers locks all new Tracer creation +until the swap is complete. This assumes that this operation is not +performance-critical. If that assumption is incorrect, be sure to configure an +SDK prior to any Tracer creation. +*/ + +import ( + "context" + "sync" + "sync/atomic" + + "go.opentelemetry.io/auto/sdk" + + "go.opentelemetry.io/otel/attribute" + "go.opentelemetry.io/otel/codes" + "go.opentelemetry.io/otel/trace" + "go.opentelemetry.io/otel/trace/embedded" +) + +// tracerProvider is a placeholder for a configured SDK TracerProvider. +// +// All TracerProvider functionality is forwarded to a delegate once +// configured. +type tracerProvider struct { + embedded.TracerProvider + + mtx sync.Mutex + tracers map[il]*tracer + delegate trace.TracerProvider +} + +// Compile-time guarantee that tracerProvider implements the TracerProvider +// interface. +var _ trace.TracerProvider = &tracerProvider{} + +// setDelegate configures p to delegate all TracerProvider functionality to +// provider. +// +// All Tracers provided prior to this function call are switched out to be +// Tracers provided by provider. +// +// It is guaranteed by the caller that this happens only once. +func (p *tracerProvider) setDelegate(provider trace.TracerProvider) { + p.mtx.Lock() + defer p.mtx.Unlock() + + p.delegate = provider + + if len(p.tracers) == 0 { + return + } + + for _, t := range p.tracers { + t.setDelegate(provider) + } + + p.tracers = nil +} + +// Tracer implements TracerProvider. +func (p *tracerProvider) Tracer(name string, opts ...trace.TracerOption) trace.Tracer { + p.mtx.Lock() + defer p.mtx.Unlock() + + if p.delegate != nil { + return p.delegate.Tracer(name, opts...) + } + + // At this moment it is guaranteed that no sdk is installed, save the tracer in the tracers map. + + c := trace.NewTracerConfig(opts...) + key := il{ + name: name, + version: c.InstrumentationVersion(), + schema: c.SchemaURL(), + attrs: c.InstrumentationAttributes(), + } + + if p.tracers == nil { + p.tracers = make(map[il]*tracer) + } + + if val, ok := p.tracers[key]; ok { + return val + } + + t := &tracer{name: name, opts: opts, provider: p} + p.tracers[key] = t + return t +} + +type il struct { + name string + version string + schema string + attrs attribute.Set +} + +// tracer is a placeholder for a trace.Tracer. +// +// All Tracer functionality is forwarded to a delegate once configured. +// Otherwise, all functionality is forwarded to a NoopTracer. +type tracer struct { + embedded.Tracer + + name string + opts []trace.TracerOption + provider *tracerProvider + + delegate atomic.Value +} + +// Compile-time guarantee that tracer implements the trace.Tracer interface. +var _ trace.Tracer = &tracer{} + +// setDelegate configures t to delegate all Tracer functionality to Tracers +// created by provider. +// +// All subsequent calls to the Tracer methods will be passed to the delegate. +// +// It is guaranteed by the caller that this happens only once. +func (t *tracer) setDelegate(provider trace.TracerProvider) { + t.delegate.Store(provider.Tracer(t.name, t.opts...)) +} + +// Start implements trace.Tracer by forwarding the call to t.delegate if +// set, otherwise it forwards the call to a NoopTracer. +func (t *tracer) Start(ctx context.Context, name string, opts ...trace.SpanStartOption) (context.Context, trace.Span) { + delegate := t.delegate.Load() + if delegate != nil { + return delegate.(trace.Tracer).Start(ctx, name, opts...) + } + + return t.newSpan(ctx, autoInstEnabled, name, opts) +} + +// autoInstEnabled determines if the auto-instrumentation SDK span is returned +// from the tracer when not backed by a delegate and auto-instrumentation has +// attached to this process. +// +// The auto-instrumentation is expected to overwrite this value to true when it +// attaches. By default, this will point to false and mean a tracer will return +// a nonRecordingSpan by default. +var autoInstEnabled = new(bool) + +// newSpan is called by tracer.Start so auto-instrumentation can attach an eBPF +// uprobe to this code. +// +// "noinline" pragma prevents the method from ever being inlined. +// +//go:noinline +func (t *tracer) newSpan( + ctx context.Context, + autoSpan *bool, + name string, + opts []trace.SpanStartOption, +) (context.Context, trace.Span) { + // autoInstEnabled is passed to newSpan via the autoSpan parameter. This is + // so the auto-instrumentation can define a uprobe for (*t).newSpan and be + // provided with the address of the bool autoInstEnabled points to. It + // needs to be a parameter so that pointer can be reliably determined, it + // should not be read from the global. + + if *autoSpan { + tracer := sdk.TracerProvider().Tracer(t.name, t.opts...) + return tracer.Start(ctx, name, opts...) + } + + s := nonRecordingSpan{sc: trace.SpanContextFromContext(ctx), tracer: t} + ctx = trace.ContextWithSpan(ctx, s) + return ctx, s +} + +// nonRecordingSpan is a minimal implementation of a Span that wraps a +// SpanContext. It performs no operations other than to return the wrapped +// SpanContext. +type nonRecordingSpan struct { + embedded.Span + + sc trace.SpanContext + tracer *tracer +} + +var _ trace.Span = nonRecordingSpan{} + +// SpanContext returns the wrapped SpanContext. +func (s nonRecordingSpan) SpanContext() trace.SpanContext { return s.sc } + +// IsRecording always returns false. +func (nonRecordingSpan) IsRecording() bool { return false } + +// SetStatus does nothing. +func (nonRecordingSpan) SetStatus(codes.Code, string) {} + +// SetError does nothing. +func (nonRecordingSpan) SetError(bool) {} + +// SetAttributes does nothing. +func (nonRecordingSpan) SetAttributes(...attribute.KeyValue) {} + +// End does nothing. +func (nonRecordingSpan) End(...trace.SpanEndOption) {} + +// RecordError does nothing. +func (nonRecordingSpan) RecordError(error, ...trace.EventOption) {} + +// AddEvent does nothing. +func (nonRecordingSpan) AddEvent(string, ...trace.EventOption) {} + +// AddLink does nothing. +func (nonRecordingSpan) AddLink(trace.Link) {} + +// SetName does nothing. +func (nonRecordingSpan) SetName(string) {} + +func (s nonRecordingSpan) TracerProvider() trace.TracerProvider { return s.tracer.provider } diff --git a/vendor/go.opentelemetry.io/otel/internal_logging.go b/vendor/go.opentelemetry.io/otel/internal_logging.go new file mode 100644 index 00000000..6de7f2e4 --- /dev/null +++ b/vendor/go.opentelemetry.io/otel/internal_logging.go @@ -0,0 +1,15 @@ +// Copyright The OpenTelemetry Authors +// SPDX-License-Identifier: Apache-2.0 + +package otel // import "go.opentelemetry.io/otel" + +import ( + "github.com/go-logr/logr" + + "go.opentelemetry.io/otel/internal/global" +) + +// SetLogger configures the logger used internally to opentelemetry. +func SetLogger(logger logr.Logger) { + global.SetLogger(logger) +} diff --git a/vendor/go.opentelemetry.io/otel/metric.go b/vendor/go.opentelemetry.io/otel/metric.go new file mode 100644 index 00000000..527d9aec --- /dev/null +++ b/vendor/go.opentelemetry.io/otel/metric.go @@ -0,0 +1,42 @@ +// Copyright The OpenTelemetry Authors +// SPDX-License-Identifier: Apache-2.0 + +package otel // import "go.opentelemetry.io/otel" + +import ( + "go.opentelemetry.io/otel/internal/global" + "go.opentelemetry.io/otel/metric" +) + +// Meter returns a Meter from the global MeterProvider. The name must be the +// name of the library providing instrumentation. This name may be the same as +// the instrumented code only if that code provides built-in instrumentation. +// If the name is empty, then an implementation defined default name will be +// used instead. +// +// If this is called before a global MeterProvider is registered the returned +// Meter will be a No-op implementation of a Meter. When a global MeterProvider +// is registered for the first time, the returned Meter, and all the +// instruments it has created or will create, are recreated automatically from +// the new MeterProvider. +// +// This is short for GetMeterProvider().Meter(name). +func Meter(name string, opts ...metric.MeterOption) metric.Meter { + return GetMeterProvider().Meter(name, opts...) +} + +// GetMeterProvider returns the registered global meter provider. +// +// If no global GetMeterProvider has been registered, a No-op GetMeterProvider +// implementation is returned. When a global GetMeterProvider is registered for +// the first time, the returned GetMeterProvider, and all the Meters it has +// created or will create, are recreated automatically from the new +// GetMeterProvider. +func GetMeterProvider() metric.MeterProvider { + return global.MeterProvider() +} + +// SetMeterProvider registers mp as the global MeterProvider. +func SetMeterProvider(mp metric.MeterProvider) { + global.SetMeterProvider(mp) +} diff --git a/vendor/go.opentelemetry.io/otel/metric/LICENSE b/vendor/go.opentelemetry.io/otel/metric/LICENSE new file mode 100644 index 00000000..f1aee0f1 --- /dev/null +++ b/vendor/go.opentelemetry.io/otel/metric/LICENSE @@ -0,0 +1,231 @@ + Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + + TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + + 1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + + 2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + + 3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + + 4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + + 5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + + 6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + + 7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + + 8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + + 9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + + END OF TERMS AND CONDITIONS + + APPENDIX: How to apply the Apache License to your work. + + To apply the Apache License to your work, attach the following + boilerplate notice, with the fields enclosed by brackets "[]" + replaced with your own identifying information. (Don't include + the brackets!) The text should be enclosed in the appropriate + comment syntax for the file format. We also recommend that a + file or class name and description of purpose be included on the + same "printed page" as the copyright notice for easier + identification within third-party archives. + + Copyright [yyyy] [name of copyright owner] + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. + +-------------------------------------------------------------------------------- + +Copyright 2009 The Go Authors. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are +met: + + * Redistributions of source code must retain the above copyright +notice, this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above +copyright notice, this list of conditions and the following disclaimer +in the documentation and/or other materials provided with the +distribution. + * Neither the name of Google LLC nor the names of its +contributors may be used to endorse or promote products derived from +this software without specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. \ No newline at end of file diff --git a/vendor/go.opentelemetry.io/otel/metric/README.md b/vendor/go.opentelemetry.io/otel/metric/README.md new file mode 100644 index 00000000..0cf902e0 --- /dev/null +++ b/vendor/go.opentelemetry.io/otel/metric/README.md @@ -0,0 +1,3 @@ +# Metric API + +[![PkgGoDev](https://pkg.go.dev/badge/go.opentelemetry.io/otel/metric)](https://pkg.go.dev/go.opentelemetry.io/otel/metric) diff --git a/vendor/go.opentelemetry.io/otel/metric/asyncfloat64.go b/vendor/go.opentelemetry.io/otel/metric/asyncfloat64.go new file mode 100644 index 00000000..466812d3 --- /dev/null +++ b/vendor/go.opentelemetry.io/otel/metric/asyncfloat64.go @@ -0,0 +1,273 @@ +// Copyright The OpenTelemetry Authors +// SPDX-License-Identifier: Apache-2.0 + +package metric // import "go.opentelemetry.io/otel/metric" + +import ( + "context" + + "go.opentelemetry.io/otel/metric/embedded" +) + +// Float64Observable describes a set of instruments used asynchronously to +// record float64 measurements once per collection cycle. Observations of +// these instruments are only made within a callback. +// +// Warning: Methods may be added to this interface in minor releases. +type Float64Observable interface { + Observable + + float64Observable() +} + +// Float64ObservableCounter is an instrument used to asynchronously record +// increasing float64 measurements once per collection cycle. Observations are +// only made within a callback for this instrument. The value observed is +// assumed the to be the cumulative sum of the count. +// +// Warning: Methods may be added to this interface in minor releases. See +// package documentation on API implementation for information on how to set +// default behavior for +// unimplemented methods. +type Float64ObservableCounter interface { + // Users of the interface can ignore this. This embedded type is only used + // by implementations of this interface. See the "API Implementations" + // section of the package documentation for more information. + embedded.Float64ObservableCounter + + Float64Observable +} + +// Float64ObservableCounterConfig contains options for asynchronous counter +// instruments that record float64 values. +type Float64ObservableCounterConfig struct { + description string + unit string + callbacks []Float64Callback +} + +// NewFloat64ObservableCounterConfig returns a new +// [Float64ObservableCounterConfig] with all opts applied. +func NewFloat64ObservableCounterConfig(opts ...Float64ObservableCounterOption) Float64ObservableCounterConfig { + var config Float64ObservableCounterConfig + for _, o := range opts { + config = o.applyFloat64ObservableCounter(config) + } + return config +} + +// Description returns the configured description. +func (c Float64ObservableCounterConfig) Description() string { + return c.description +} + +// Unit returns the configured unit. +func (c Float64ObservableCounterConfig) Unit() string { + return c.unit +} + +// Callbacks returns the configured callbacks. +func (c Float64ObservableCounterConfig) Callbacks() []Float64Callback { + return c.callbacks +} + +// Float64ObservableCounterOption applies options to a +// [Float64ObservableCounterConfig]. See [Float64ObservableOption] and +// [InstrumentOption] for other options that can be used as a +// Float64ObservableCounterOption. +type Float64ObservableCounterOption interface { + applyFloat64ObservableCounter(Float64ObservableCounterConfig) Float64ObservableCounterConfig +} + +// Float64ObservableUpDownCounter is an instrument used to asynchronously +// record float64 measurements once per collection cycle. Observations are only +// made within a callback for this instrument. The value observed is assumed +// the to be the cumulative sum of the count. +// +// Warning: Methods may be added to this interface in minor releases. See +// package documentation on API implementation for information on how to set +// default behavior for unimplemented methods. +type Float64ObservableUpDownCounter interface { + // Users of the interface can ignore this. This embedded type is only used + // by implementations of this interface. See the "API Implementations" + // section of the package documentation for more information. + embedded.Float64ObservableUpDownCounter + + Float64Observable +} + +// Float64ObservableUpDownCounterConfig contains options for asynchronous +// counter instruments that record float64 values. +type Float64ObservableUpDownCounterConfig struct { + description string + unit string + callbacks []Float64Callback +} + +// NewFloat64ObservableUpDownCounterConfig returns a new +// [Float64ObservableUpDownCounterConfig] with all opts applied. +func NewFloat64ObservableUpDownCounterConfig( + opts ...Float64ObservableUpDownCounterOption, +) Float64ObservableUpDownCounterConfig { + var config Float64ObservableUpDownCounterConfig + for _, o := range opts { + config = o.applyFloat64ObservableUpDownCounter(config) + } + return config +} + +// Description returns the configured description. +func (c Float64ObservableUpDownCounterConfig) Description() string { + return c.description +} + +// Unit returns the configured unit. +func (c Float64ObservableUpDownCounterConfig) Unit() string { + return c.unit +} + +// Callbacks returns the configured callbacks. +func (c Float64ObservableUpDownCounterConfig) Callbacks() []Float64Callback { + return c.callbacks +} + +// Float64ObservableUpDownCounterOption applies options to a +// [Float64ObservableUpDownCounterConfig]. See [Float64ObservableOption] and +// [InstrumentOption] for other options that can be used as a +// Float64ObservableUpDownCounterOption. +type Float64ObservableUpDownCounterOption interface { + applyFloat64ObservableUpDownCounter(Float64ObservableUpDownCounterConfig) Float64ObservableUpDownCounterConfig +} + +// Float64ObservableGauge is an instrument used to asynchronously record +// instantaneous float64 measurements once per collection cycle. Observations +// are only made within a callback for this instrument. +// +// Warning: Methods may be added to this interface in minor releases. See +// package documentation on API implementation for information on how to set +// default behavior for unimplemented methods. +type Float64ObservableGauge interface { + // Users of the interface can ignore this. This embedded type is only used + // by implementations of this interface. See the "API Implementations" + // section of the package documentation for more information. + embedded.Float64ObservableGauge + + Float64Observable +} + +// Float64ObservableGaugeConfig contains options for asynchronous counter +// instruments that record float64 values. +type Float64ObservableGaugeConfig struct { + description string + unit string + callbacks []Float64Callback +} + +// NewFloat64ObservableGaugeConfig returns a new [Float64ObservableGaugeConfig] +// with all opts applied. +func NewFloat64ObservableGaugeConfig(opts ...Float64ObservableGaugeOption) Float64ObservableGaugeConfig { + var config Float64ObservableGaugeConfig + for _, o := range opts { + config = o.applyFloat64ObservableGauge(config) + } + return config +} + +// Description returns the configured description. +func (c Float64ObservableGaugeConfig) Description() string { + return c.description +} + +// Unit returns the configured unit. +func (c Float64ObservableGaugeConfig) Unit() string { + return c.unit +} + +// Callbacks returns the configured callbacks. +func (c Float64ObservableGaugeConfig) Callbacks() []Float64Callback { + return c.callbacks +} + +// Float64ObservableGaugeOption applies options to a +// [Float64ObservableGaugeConfig]. See [Float64ObservableOption] and +// [InstrumentOption] for other options that can be used as a +// Float64ObservableGaugeOption. +type Float64ObservableGaugeOption interface { + applyFloat64ObservableGauge(Float64ObservableGaugeConfig) Float64ObservableGaugeConfig +} + +// Float64Observer is a recorder of float64 measurements. +// +// Warning: Methods may be added to this interface in minor releases. See +// package documentation on API implementation for information on how to set +// default behavior for unimplemented methods. +type Float64Observer interface { + // Users of the interface can ignore this. This embedded type is only used + // by implementations of this interface. See the "API Implementations" + // section of the package documentation for more information. + embedded.Float64Observer + + // Observe records the float64 value. + // + // Use the WithAttributeSet (or, if performance is not a concern, + // the WithAttributes) option to include measurement attributes. + // + // Implementations of this method need to be safe for a user to call + // concurrently. + Observe(value float64, options ...ObserveOption) +} + +// Float64Callback is a function registered with a Meter that makes +// observations for a Float64Observable instrument it is registered with. +// Calls to the Float64Observer record measurement values for the +// Float64Observable. +// +// The function needs to complete in a finite amount of time and the deadline +// of the passed context is expected to be honored. +// +// The function needs to make unique observations across all registered +// Float64Callbacks. Meaning, it should not report measurements with the same +// attributes as another Float64Callbacks also registered for the same +// instrument. +// +// The function needs to be reentrant and concurrent safe. +// +// Note that Go's mutexes are not reentrant, and locking a mutex takes +// an indefinite amount of time. It is therefore advised to avoid +// using mutexes inside callbacks. +type Float64Callback func(context.Context, Float64Observer) error + +// Float64ObservableOption applies options to float64 Observer instruments. +type Float64ObservableOption interface { + Float64ObservableCounterOption + Float64ObservableUpDownCounterOption + Float64ObservableGaugeOption +} + +type float64CallbackOpt struct { + cback Float64Callback +} + +func (o float64CallbackOpt) applyFloat64ObservableCounter( + cfg Float64ObservableCounterConfig, +) Float64ObservableCounterConfig { + cfg.callbacks = append(cfg.callbacks, o.cback) + return cfg +} + +func (o float64CallbackOpt) applyFloat64ObservableUpDownCounter( + cfg Float64ObservableUpDownCounterConfig, +) Float64ObservableUpDownCounterConfig { + cfg.callbacks = append(cfg.callbacks, o.cback) + return cfg +} + +func (o float64CallbackOpt) applyFloat64ObservableGauge(cfg Float64ObservableGaugeConfig) Float64ObservableGaugeConfig { + cfg.callbacks = append(cfg.callbacks, o.cback) + return cfg +} + +// WithFloat64Callback adds callback to be called for an instrument. +func WithFloat64Callback(callback Float64Callback) Float64ObservableOption { + return float64CallbackOpt{callback} +} diff --git a/vendor/go.opentelemetry.io/otel/metric/asyncint64.go b/vendor/go.opentelemetry.io/otel/metric/asyncint64.go new file mode 100644 index 00000000..66c971bd --- /dev/null +++ b/vendor/go.opentelemetry.io/otel/metric/asyncint64.go @@ -0,0 +1,269 @@ +// Copyright The OpenTelemetry Authors +// SPDX-License-Identifier: Apache-2.0 + +package metric // import "go.opentelemetry.io/otel/metric" + +import ( + "context" + + "go.opentelemetry.io/otel/metric/embedded" +) + +// Int64Observable describes a set of instruments used asynchronously to record +// int64 measurements once per collection cycle. Observations of these +// instruments are only made within a callback. +// +// Warning: Methods may be added to this interface in minor releases. +type Int64Observable interface { + Observable + + int64Observable() +} + +// Int64ObservableCounter is an instrument used to asynchronously record +// increasing int64 measurements once per collection cycle. Observations are +// only made within a callback for this instrument. The value observed is +// assumed the to be the cumulative sum of the count. +// +// Warning: Methods may be added to this interface in minor releases. See +// package documentation on API implementation for information on how to set +// default behavior for unimplemented methods. +type Int64ObservableCounter interface { + // Users of the interface can ignore this. This embedded type is only used + // by implementations of this interface. See the "API Implementations" + // section of the package documentation for more information. + embedded.Int64ObservableCounter + + Int64Observable +} + +// Int64ObservableCounterConfig contains options for asynchronous counter +// instruments that record int64 values. +type Int64ObservableCounterConfig struct { + description string + unit string + callbacks []Int64Callback +} + +// NewInt64ObservableCounterConfig returns a new [Int64ObservableCounterConfig] +// with all opts applied. +func NewInt64ObservableCounterConfig(opts ...Int64ObservableCounterOption) Int64ObservableCounterConfig { + var config Int64ObservableCounterConfig + for _, o := range opts { + config = o.applyInt64ObservableCounter(config) + } + return config +} + +// Description returns the configured description. +func (c Int64ObservableCounterConfig) Description() string { + return c.description +} + +// Unit returns the configured unit. +func (c Int64ObservableCounterConfig) Unit() string { + return c.unit +} + +// Callbacks returns the configured callbacks. +func (c Int64ObservableCounterConfig) Callbacks() []Int64Callback { + return c.callbacks +} + +// Int64ObservableCounterOption applies options to a +// [Int64ObservableCounterConfig]. See [Int64ObservableOption] and +// [InstrumentOption] for other options that can be used as an +// Int64ObservableCounterOption. +type Int64ObservableCounterOption interface { + applyInt64ObservableCounter(Int64ObservableCounterConfig) Int64ObservableCounterConfig +} + +// Int64ObservableUpDownCounter is an instrument used to asynchronously record +// int64 measurements once per collection cycle. Observations are only made +// within a callback for this instrument. The value observed is assumed the to +// be the cumulative sum of the count. +// +// Warning: Methods may be added to this interface in minor releases. See +// package documentation on API implementation for information on how to set +// default behavior for unimplemented methods. +type Int64ObservableUpDownCounter interface { + // Users of the interface can ignore this. This embedded type is only used + // by implementations of this interface. See the "API Implementations" + // section of the package documentation for more information. + embedded.Int64ObservableUpDownCounter + + Int64Observable +} + +// Int64ObservableUpDownCounterConfig contains options for asynchronous counter +// instruments that record int64 values. +type Int64ObservableUpDownCounterConfig struct { + description string + unit string + callbacks []Int64Callback +} + +// NewInt64ObservableUpDownCounterConfig returns a new +// [Int64ObservableUpDownCounterConfig] with all opts applied. +func NewInt64ObservableUpDownCounterConfig( + opts ...Int64ObservableUpDownCounterOption, +) Int64ObservableUpDownCounterConfig { + var config Int64ObservableUpDownCounterConfig + for _, o := range opts { + config = o.applyInt64ObservableUpDownCounter(config) + } + return config +} + +// Description returns the configured description. +func (c Int64ObservableUpDownCounterConfig) Description() string { + return c.description +} + +// Unit returns the configured unit. +func (c Int64ObservableUpDownCounterConfig) Unit() string { + return c.unit +} + +// Callbacks returns the configured callbacks. +func (c Int64ObservableUpDownCounterConfig) Callbacks() []Int64Callback { + return c.callbacks +} + +// Int64ObservableUpDownCounterOption applies options to a +// [Int64ObservableUpDownCounterConfig]. See [Int64ObservableOption] and +// [InstrumentOption] for other options that can be used as an +// Int64ObservableUpDownCounterOption. +type Int64ObservableUpDownCounterOption interface { + applyInt64ObservableUpDownCounter(Int64ObservableUpDownCounterConfig) Int64ObservableUpDownCounterConfig +} + +// Int64ObservableGauge is an instrument used to asynchronously record +// instantaneous int64 measurements once per collection cycle. Observations are +// only made within a callback for this instrument. +// +// Warning: Methods may be added to this interface in minor releases. See +// package documentation on API implementation for information on how to set +// default behavior for unimplemented methods. +type Int64ObservableGauge interface { + // Users of the interface can ignore this. This embedded type is only used + // by implementations of this interface. See the "API Implementations" + // section of the package documentation for more information. + embedded.Int64ObservableGauge + + Int64Observable +} + +// Int64ObservableGaugeConfig contains options for asynchronous counter +// instruments that record int64 values. +type Int64ObservableGaugeConfig struct { + description string + unit string + callbacks []Int64Callback +} + +// NewInt64ObservableGaugeConfig returns a new [Int64ObservableGaugeConfig] +// with all opts applied. +func NewInt64ObservableGaugeConfig(opts ...Int64ObservableGaugeOption) Int64ObservableGaugeConfig { + var config Int64ObservableGaugeConfig + for _, o := range opts { + config = o.applyInt64ObservableGauge(config) + } + return config +} + +// Description returns the configured description. +func (c Int64ObservableGaugeConfig) Description() string { + return c.description +} + +// Unit returns the configured unit. +func (c Int64ObservableGaugeConfig) Unit() string { + return c.unit +} + +// Callbacks returns the configured callbacks. +func (c Int64ObservableGaugeConfig) Callbacks() []Int64Callback { + return c.callbacks +} + +// Int64ObservableGaugeOption applies options to a +// [Int64ObservableGaugeConfig]. See [Int64ObservableOption] and +// [InstrumentOption] for other options that can be used as an +// Int64ObservableGaugeOption. +type Int64ObservableGaugeOption interface { + applyInt64ObservableGauge(Int64ObservableGaugeConfig) Int64ObservableGaugeConfig +} + +// Int64Observer is a recorder of int64 measurements. +// +// Warning: Methods may be added to this interface in minor releases. See +// package documentation on API implementation for information on how to set +// default behavior for unimplemented methods. +type Int64Observer interface { + // Users of the interface can ignore this. This embedded type is only used + // by implementations of this interface. See the "API Implementations" + // section of the package documentation for more information. + embedded.Int64Observer + + // Observe records the int64 value. + // + // Use the WithAttributeSet (or, if performance is not a concern, + // the WithAttributes) option to include measurement attributes. + // + // Implementations of this method need to be safe for a user to call + // concurrently. + Observe(value int64, options ...ObserveOption) +} + +// Int64Callback is a function registered with a Meter that makes observations +// for an Int64Observable instrument it is registered with. Calls to the +// Int64Observer record measurement values for the Int64Observable. +// +// The function needs to complete in a finite amount of time and the deadline +// of the passed context is expected to be honored. +// +// The function needs to make unique observations across all registered +// Int64Callbacks. Meaning, it should not report measurements with the same +// attributes as another Int64Callbacks also registered for the same +// instrument. +// +// The function needs to be reentrant and concurrent safe. +// +// Note that Go's mutexes are not reentrant, and locking a mutex takes +// an indefinite amount of time. It is therefore advised to avoid +// using mutexes inside callbacks. +type Int64Callback func(context.Context, Int64Observer) error + +// Int64ObservableOption applies options to int64 Observer instruments. +type Int64ObservableOption interface { + Int64ObservableCounterOption + Int64ObservableUpDownCounterOption + Int64ObservableGaugeOption +} + +type int64CallbackOpt struct { + cback Int64Callback +} + +func (o int64CallbackOpt) applyInt64ObservableCounter(cfg Int64ObservableCounterConfig) Int64ObservableCounterConfig { + cfg.callbacks = append(cfg.callbacks, o.cback) + return cfg +} + +func (o int64CallbackOpt) applyInt64ObservableUpDownCounter( + cfg Int64ObservableUpDownCounterConfig, +) Int64ObservableUpDownCounterConfig { + cfg.callbacks = append(cfg.callbacks, o.cback) + return cfg +} + +func (o int64CallbackOpt) applyInt64ObservableGauge(cfg Int64ObservableGaugeConfig) Int64ObservableGaugeConfig { + cfg.callbacks = append(cfg.callbacks, o.cback) + return cfg +} + +// WithInt64Callback adds callback to be called for an instrument. +func WithInt64Callback(callback Int64Callback) Int64ObservableOption { + return int64CallbackOpt{callback} +} diff --git a/vendor/go.opentelemetry.io/otel/metric/config.go b/vendor/go.opentelemetry.io/otel/metric/config.go new file mode 100644 index 00000000..e42dd6e7 --- /dev/null +++ b/vendor/go.opentelemetry.io/otel/metric/config.go @@ -0,0 +1,111 @@ +// Copyright The OpenTelemetry Authors +// SPDX-License-Identifier: Apache-2.0 + +package metric // import "go.opentelemetry.io/otel/metric" + +import ( + "slices" + + "go.opentelemetry.io/otel/attribute" +) + +// MeterConfig contains options for Meters. +type MeterConfig struct { + instrumentationVersion string + schemaURL string + attrs attribute.Set + + // Ensure forward compatibility by explicitly making this not comparable. + noCmp [0]func() //nolint: unused // This is indeed used. +} + +// InstrumentationVersion returns the version of the library providing +// instrumentation. +func (cfg MeterConfig) InstrumentationVersion() string { + return cfg.instrumentationVersion +} + +// InstrumentationAttributes returns the attributes associated with the library +// providing instrumentation. +func (cfg MeterConfig) InstrumentationAttributes() attribute.Set { + return cfg.attrs +} + +// SchemaURL is the schema_url of the library providing instrumentation. +func (cfg MeterConfig) SchemaURL() string { + return cfg.schemaURL +} + +// MeterOption is an interface for applying Meter options. +type MeterOption interface { + // applyMeter is used to set a MeterOption value of a MeterConfig. + applyMeter(MeterConfig) MeterConfig +} + +// NewMeterConfig creates a new MeterConfig and applies +// all the given options. +func NewMeterConfig(opts ...MeterOption) MeterConfig { + var config MeterConfig + for _, o := range opts { + config = o.applyMeter(config) + } + return config +} + +type meterOptionFunc func(MeterConfig) MeterConfig + +func (fn meterOptionFunc) applyMeter(cfg MeterConfig) MeterConfig { + return fn(cfg) +} + +// WithInstrumentationVersion sets the instrumentation version. +func WithInstrumentationVersion(version string) MeterOption { + return meterOptionFunc(func(config MeterConfig) MeterConfig { + config.instrumentationVersion = version + return config + }) +} + +// WithInstrumentationAttributes adds the instrumentation attributes. +// +// This is equivalent to calling [WithInstrumentationAttributeSet] with an +// [attribute.Set] created from a clone of the passed attributes. +// [WithInstrumentationAttributeSet] is recommended for more control. +// +// If multiple [WithInstrumentationAttributes] or [WithInstrumentationAttributeSet] +// options are passed, the attributes will be merged together in the order +// they are passed. Attributes with duplicate keys will use the last value passed. +func WithInstrumentationAttributes(attr ...attribute.KeyValue) MeterOption { + set := attribute.NewSet(slices.Clone(attr)...) + return WithInstrumentationAttributeSet(set) +} + +// WithInstrumentationAttributeSet adds the instrumentation attributes. +// +// If multiple [WithInstrumentationAttributes] or [WithInstrumentationAttributeSet] +// options are passed, the attributes will be merged together in the order +// they are passed. Attributes with duplicate keys will use the last value passed. +func WithInstrumentationAttributeSet(set attribute.Set) MeterOption { + if set.Len() == 0 { + return meterOptionFunc(func(config MeterConfig) MeterConfig { + return config + }) + } + + return meterOptionFunc(func(config MeterConfig) MeterConfig { + if config.attrs.Len() == 0 { + config.attrs = set + } else { + config.attrs = mergeSets(config.attrs, set) + } + return config + }) +} + +// WithSchemaURL sets the schema URL. +func WithSchemaURL(schemaURL string) MeterOption { + return meterOptionFunc(func(config MeterConfig) MeterConfig { + config.schemaURL = schemaURL + return config + }) +} diff --git a/vendor/go.opentelemetry.io/otel/metric/doc.go b/vendor/go.opentelemetry.io/otel/metric/doc.go new file mode 100644 index 00000000..f153745b --- /dev/null +++ b/vendor/go.opentelemetry.io/otel/metric/doc.go @@ -0,0 +1,177 @@ +// Copyright The OpenTelemetry Authors +// SPDX-License-Identifier: Apache-2.0 + +/* +Package metric provides the OpenTelemetry API used to measure metrics about +source code operation. + +This API is separate from its implementation so the instrumentation built from +it is reusable. See [go.opentelemetry.io/otel/sdk/metric] for the official +OpenTelemetry implementation of this API. + +All measurements made with this package are made via instruments. These +instruments are created by a [Meter] which itself is created by a +[MeterProvider]. Applications need to accept a [MeterProvider] implementation +as a starting point when instrumenting. This can be done directly, or by using +the OpenTelemetry global MeterProvider via [GetMeterProvider]. Using an +appropriately named [Meter] from the accepted [MeterProvider], instrumentation +can then be built from the [Meter]'s instruments. + +# Instruments + +Each instrument is designed to make measurements of a particular type. Broadly, +all instruments fall into two overlapping logical categories: asynchronous or +synchronous, and int64 or float64. + +All synchronous instruments ([Int64Counter], [Int64UpDownCounter], +[Int64Histogram], [Float64Counter], [Float64UpDownCounter], and +[Float64Histogram]) are used to measure the operation and performance of source +code during the source code execution. These instruments only make measurements +when the source code they instrument is run. + +All asynchronous instruments ([Int64ObservableCounter], +[Int64ObservableUpDownCounter], [Int64ObservableGauge], +[Float64ObservableCounter], [Float64ObservableUpDownCounter], and +[Float64ObservableGauge]) are used to measure metrics outside of the execution +of source code. They are said to make "observations" via a callback function +called once every measurement collection cycle. + +Each instrument is also grouped by the value type it measures. Either int64 or +float64. The value being measured will dictate which instrument in these +categories to use. + +Outside of these two broad categories, instruments are described by the +function they are designed to serve. All Counters ([Int64Counter], +[Float64Counter], [Int64ObservableCounter], and [Float64ObservableCounter]) are +designed to measure values that never decrease in value, but instead only +incrementally increase in value. UpDownCounters ([Int64UpDownCounter], +[Float64UpDownCounter], [Int64ObservableUpDownCounter], and +[Float64ObservableUpDownCounter]) on the other hand, are designed to measure +values that can increase and decrease. When more information needs to be +conveyed about all the synchronous measurements made during a collection cycle, +a Histogram ([Int64Histogram] and [Float64Histogram]) should be used. Finally, +when just the most recent measurement needs to be conveyed about an +asynchronous measurement, a Gauge ([Int64ObservableGauge] and +[Float64ObservableGauge]) should be used. + +See the [OpenTelemetry documentation] for more information about instruments +and their intended use. + +# Instrument Name + +OpenTelemetry defines an [instrument name syntax] that restricts what +instrument names are allowed. + +Instrument names should ... + + - Not be empty. + - Have an alphabetic character as their first letter. + - Have any letter after the first be an alphanumeric character, ‘_’, ‘.’, + ‘-’, or ‘/’. + - Have a maximum length of 255 letters. + +To ensure compatibility with observability platforms, all instruments created +need to conform to this syntax. Not all implementations of the API will validate +these names, it is the callers responsibility to ensure compliance. + +# Measurements + +Measurements are made by recording values and information about the values with +an instrument. How these measurements are recorded depends on the instrument. + +Measurements for synchronous instruments ([Int64Counter], [Int64UpDownCounter], +[Int64Histogram], [Float64Counter], [Float64UpDownCounter], and +[Float64Histogram]) are recorded using the instrument methods directly. All +counter instruments have an Add method that is used to measure an increment +value, and all histogram instruments have a Record method to measure a data +point. + +Asynchronous instruments ([Int64ObservableCounter], +[Int64ObservableUpDownCounter], [Int64ObservableGauge], +[Float64ObservableCounter], [Float64ObservableUpDownCounter], and +[Float64ObservableGauge]) record measurements within a callback function. The +callback is registered with the Meter which ensures the callback is called once +per collection cycle. A callback can be registered two ways: during the +instrument's creation using an option, or later using the RegisterCallback +method of the [Meter] that created the instrument. + +If the following criteria are met, an option ([WithInt64Callback] or +[WithFloat64Callback]) can be used during the asynchronous instrument's +creation to register a callback ([Int64Callback] or [Float64Callback], +respectively): + + - The measurement process is known when the instrument is created + - Only that instrument will make a measurement within the callback + - The callback never needs to be unregistered + +If the criteria are not met, use the RegisterCallback method of the [Meter] that +created the instrument to register a [Callback]. + +# API Implementations + +This package does not conform to the standard Go versioning policy, all of its +interfaces may have methods added to them without a package major version bump. +This non-standard API evolution could surprise an uninformed implementation +author. They could unknowingly build their implementation in a way that would +result in a runtime panic for their users that update to the new API. + +The API is designed to help inform an instrumentation author about this +non-standard API evolution. It requires them to choose a default behavior for +unimplemented interface methods. There are three behavior choices they can +make: + + - Compilation failure + - Panic + - Default to another implementation + +All interfaces in this API embed a corresponding interface from +[go.opentelemetry.io/otel/metric/embedded]. If an author wants the default +behavior of their implementations to be a compilation failure, signaling to +their users they need to update to the latest version of that implementation, +they need to embed the corresponding interface from +[go.opentelemetry.io/otel/metric/embedded] in their implementation. For +example, + + import "go.opentelemetry.io/otel/metric/embedded" + + type MeterProvider struct { + embedded.MeterProvider + // ... + } + +If an author wants the default behavior of their implementations to a panic, +they need to embed the API interface directly. + + import "go.opentelemetry.io/otel/metric" + + type MeterProvider struct { + metric.MeterProvider + // ... + } + +This is not a recommended behavior as it could lead to publishing packages that +contain runtime panics when users update other package that use newer versions +of [go.opentelemetry.io/otel/metric]. + +Finally, an author can embed another implementation in theirs. The embedded +implementation will be used for methods not defined by the author. For example, +an author who wants to default to silently dropping the call can use +[go.opentelemetry.io/otel/metric/noop]: + + import "go.opentelemetry.io/otel/metric/noop" + + type MeterProvider struct { + noop.MeterProvider + // ... + } + +It is strongly recommended that authors only embed +[go.opentelemetry.io/otel/metric/noop] if they choose this default behavior. +That implementation is the only one OpenTelemetry authors can guarantee will +fully implement all the API interfaces when a user updates their API. + +[instrument name syntax]: https://opentelemetry.io/docs/specs/otel/metrics/api/#instrument-name-syntax +[OpenTelemetry documentation]: https://opentelemetry.io/docs/concepts/signals/metrics/ +[GetMeterProvider]: https://pkg.go.dev/go.opentelemetry.io/otel#GetMeterProvider +*/ +package metric // import "go.opentelemetry.io/otel/metric" diff --git a/vendor/go.opentelemetry.io/otel/metric/embedded/README.md b/vendor/go.opentelemetry.io/otel/metric/embedded/README.md new file mode 100644 index 00000000..1f6e0efa --- /dev/null +++ b/vendor/go.opentelemetry.io/otel/metric/embedded/README.md @@ -0,0 +1,3 @@ +# Metric Embedded + +[![PkgGoDev](https://pkg.go.dev/badge/go.opentelemetry.io/otel/metric/embedded)](https://pkg.go.dev/go.opentelemetry.io/otel/metric/embedded) diff --git a/vendor/go.opentelemetry.io/otel/metric/embedded/embedded.go b/vendor/go.opentelemetry.io/otel/metric/embedded/embedded.go new file mode 100644 index 00000000..1a9dc680 --- /dev/null +++ b/vendor/go.opentelemetry.io/otel/metric/embedded/embedded.go @@ -0,0 +1,243 @@ +// Copyright The OpenTelemetry Authors +// SPDX-License-Identifier: Apache-2.0 + +// Package embedded provides interfaces embedded within the [OpenTelemetry +// metric API]. +// +// Implementers of the [OpenTelemetry metric API] can embed the relevant type +// from this package into their implementation directly. Doing so will result +// in a compilation error for users when the [OpenTelemetry metric API] is +// extended (which is something that can happen without a major version bump of +// the API package). +// +// [OpenTelemetry metric API]: https://pkg.go.dev/go.opentelemetry.io/otel/metric +package embedded // import "go.opentelemetry.io/otel/metric/embedded" + +// MeterProvider is embedded in +// [go.opentelemetry.io/otel/metric.MeterProvider]. +// +// Embed this interface in your implementation of the +// [go.opentelemetry.io/otel/metric.MeterProvider] if you want users to +// experience a compilation error, signaling they need to update to your latest +// implementation, when the [go.opentelemetry.io/otel/metric.MeterProvider] +// interface is extended (which is something that can happen without a major +// version bump of the API package). +type MeterProvider interface{ meterProvider() } + +// Meter is embedded in [go.opentelemetry.io/otel/metric.Meter]. +// +// Embed this interface in your implementation of the +// [go.opentelemetry.io/otel/metric.Meter] if you want users to experience a +// compilation error, signaling they need to update to your latest +// implementation, when the [go.opentelemetry.io/otel/metric.Meter] interface +// is extended (which is something that can happen without a major version bump +// of the API package). +type Meter interface{ meter() } + +// Float64Observer is embedded in +// [go.opentelemetry.io/otel/metric.Float64Observer]. +// +// Embed this interface in your implementation of the +// [go.opentelemetry.io/otel/metric.Float64Observer] if you want +// users to experience a compilation error, signaling they need to update to +// your latest implementation, when the +// [go.opentelemetry.io/otel/metric.Float64Observer] interface is +// extended (which is something that can happen without a major version bump of +// the API package). +type Float64Observer interface{ float64Observer() } + +// Int64Observer is embedded in +// [go.opentelemetry.io/otel/metric.Int64Observer]. +// +// Embed this interface in your implementation of the +// [go.opentelemetry.io/otel/metric.Int64Observer] if you want users +// to experience a compilation error, signaling they need to update to your +// latest implementation, when the +// [go.opentelemetry.io/otel/metric.Int64Observer] interface is +// extended (which is something that can happen without a major version bump of +// the API package). +type Int64Observer interface{ int64Observer() } + +// Observer is embedded in [go.opentelemetry.io/otel/metric.Observer]. +// +// Embed this interface in your implementation of the +// [go.opentelemetry.io/otel/metric.Observer] if you want users to experience a +// compilation error, signaling they need to update to your latest +// implementation, when the [go.opentelemetry.io/otel/metric.Observer] +// interface is extended (which is something that can happen without a major +// version bump of the API package). +type Observer interface{ observer() } + +// Registration is embedded in [go.opentelemetry.io/otel/metric.Registration]. +// +// Embed this interface in your implementation of the +// [go.opentelemetry.io/otel/metric.Registration] if you want users to +// experience a compilation error, signaling they need to update to your latest +// implementation, when the [go.opentelemetry.io/otel/metric.Registration] +// interface is extended (which is something that can happen without a major +// version bump of the API package). +type Registration interface{ registration() } + +// Float64Counter is embedded in +// [go.opentelemetry.io/otel/metric.Float64Counter]. +// +// Embed this interface in your implementation of the +// [go.opentelemetry.io/otel/metric.Float64Counter] if you want +// users to experience a compilation error, signaling they need to update to +// your latest implementation, when the +// [go.opentelemetry.io/otel/metric.Float64Counter] interface is +// extended (which is something that can happen without a major version bump of +// the API package). +type Float64Counter interface{ float64Counter() } + +// Float64Histogram is embedded in +// [go.opentelemetry.io/otel/metric.Float64Histogram]. +// +// Embed this interface in your implementation of the +// [go.opentelemetry.io/otel/metric.Float64Histogram] if you want +// users to experience a compilation error, signaling they need to update to +// your latest implementation, when the +// [go.opentelemetry.io/otel/metric.Float64Histogram] interface is +// extended (which is something that can happen without a major version bump of +// the API package). +type Float64Histogram interface{ float64Histogram() } + +// Float64Gauge is embedded in [go.opentelemetry.io/otel/metric.Float64Gauge]. +// +// Embed this interface in your implementation of the +// [go.opentelemetry.io/otel/metric.Float64Gauge] if you want users to +// experience a compilation error, signaling they need to update to your latest +// implementation, when the [go.opentelemetry.io/otel/metric.Float64Gauge] +// interface is extended (which is something that can happen without a major +// version bump of the API package). +type Float64Gauge interface{ float64Gauge() } + +// Float64ObservableCounter is embedded in +// [go.opentelemetry.io/otel/metric.Float64ObservableCounter]. +// +// Embed this interface in your implementation of the +// [go.opentelemetry.io/otel/metric.Float64ObservableCounter] if you +// want users to experience a compilation error, signaling they need to update +// to your latest implementation, when the +// [go.opentelemetry.io/otel/metric.Float64ObservableCounter] +// interface is extended (which is something that can happen without a major +// version bump of the API package). +type Float64ObservableCounter interface{ float64ObservableCounter() } + +// Float64ObservableGauge is embedded in +// [go.opentelemetry.io/otel/metric.Float64ObservableGauge]. +// +// Embed this interface in your implementation of the +// [go.opentelemetry.io/otel/metric.Float64ObservableGauge] if you +// want users to experience a compilation error, signaling they need to update +// to your latest implementation, when the +// [go.opentelemetry.io/otel/metric.Float64ObservableGauge] +// interface is extended (which is something that can happen without a major +// version bump of the API package). +type Float64ObservableGauge interface{ float64ObservableGauge() } + +// Float64ObservableUpDownCounter is embedded in +// [go.opentelemetry.io/otel/metric.Float64ObservableUpDownCounter]. +// +// Embed this interface in your implementation of the +// [go.opentelemetry.io/otel/metric.Float64ObservableUpDownCounter] +// if you want users to experience a compilation error, signaling they need to +// update to your latest implementation, when the +// [go.opentelemetry.io/otel/metric.Float64ObservableUpDownCounter] +// interface is extended (which is something that can happen without a major +// version bump of the API package). +type Float64ObservableUpDownCounter interface{ float64ObservableUpDownCounter() } + +// Float64UpDownCounter is embedded in +// [go.opentelemetry.io/otel/metric.Float64UpDownCounter]. +// +// Embed this interface in your implementation of the +// [go.opentelemetry.io/otel/metric.Float64UpDownCounter] if you +// want users to experience a compilation error, signaling they need to update +// to your latest implementation, when the +// [go.opentelemetry.io/otel/metric.Float64UpDownCounter] interface +// is extended (which is something that can happen without a major version bump +// of the API package). +type Float64UpDownCounter interface{ float64UpDownCounter() } + +// Int64Counter is embedded in +// [go.opentelemetry.io/otel/metric.Int64Counter]. +// +// Embed this interface in your implementation of the +// [go.opentelemetry.io/otel/metric.Int64Counter] if you want users +// to experience a compilation error, signaling they need to update to your +// latest implementation, when the +// [go.opentelemetry.io/otel/metric.Int64Counter] interface is +// extended (which is something that can happen without a major version bump of +// the API package). +type Int64Counter interface{ int64Counter() } + +// Int64Histogram is embedded in +// [go.opentelemetry.io/otel/metric.Int64Histogram]. +// +// Embed this interface in your implementation of the +// [go.opentelemetry.io/otel/metric.Int64Histogram] if you want +// users to experience a compilation error, signaling they need to update to +// your latest implementation, when the +// [go.opentelemetry.io/otel/metric.Int64Histogram] interface is +// extended (which is something that can happen without a major version bump of +// the API package). +type Int64Histogram interface{ int64Histogram() } + +// Int64Gauge is embedded in [go.opentelemetry.io/otel/metric.Int64Gauge]. +// +// Embed this interface in your implementation of the +// [go.opentelemetry.io/otel/metric.Int64Gauge] if you want users to experience +// a compilation error, signaling they need to update to your latest +// implementation, when the [go.opentelemetry.io/otel/metric.Int64Gauge] +// interface is extended (which is something that can happen without a major +// version bump of the API package). +type Int64Gauge interface{ int64Gauge() } + +// Int64ObservableCounter is embedded in +// [go.opentelemetry.io/otel/metric.Int64ObservableCounter]. +// +// Embed this interface in your implementation of the +// [go.opentelemetry.io/otel/metric.Int64ObservableCounter] if you +// want users to experience a compilation error, signaling they need to update +// to your latest implementation, when the +// [go.opentelemetry.io/otel/metric.Int64ObservableCounter] +// interface is extended (which is something that can happen without a major +// version bump of the API package). +type Int64ObservableCounter interface{ int64ObservableCounter() } + +// Int64ObservableGauge is embedded in +// [go.opentelemetry.io/otel/metric.Int64ObservableGauge]. +// +// Embed this interface in your implementation of the +// [go.opentelemetry.io/otel/metric.Int64ObservableGauge] if you +// want users to experience a compilation error, signaling they need to update +// to your latest implementation, when the +// [go.opentelemetry.io/otel/metric.Int64ObservableGauge] interface +// is extended (which is something that can happen without a major version bump +// of the API package). +type Int64ObservableGauge interface{ int64ObservableGauge() } + +// Int64ObservableUpDownCounter is embedded in +// [go.opentelemetry.io/otel/metric.Int64ObservableUpDownCounter]. +// +// Embed this interface in your implementation of the +// [go.opentelemetry.io/otel/metric.Int64ObservableUpDownCounter] if +// you want users to experience a compilation error, signaling they need to +// update to your latest implementation, when the +// [go.opentelemetry.io/otel/metric.Int64ObservableUpDownCounter] +// interface is extended (which is something that can happen without a major +// version bump of the API package). +type Int64ObservableUpDownCounter interface{ int64ObservableUpDownCounter() } + +// Int64UpDownCounter is embedded in +// [go.opentelemetry.io/otel/metric.Int64UpDownCounter]. +// +// Embed this interface in your implementation of the +// [go.opentelemetry.io/otel/metric.Int64UpDownCounter] if you want +// users to experience a compilation error, signaling they need to update to +// your latest implementation, when the +// [go.opentelemetry.io/otel/metric.Int64UpDownCounter] interface is +// extended (which is something that can happen without a major version bump of +// the API package). +type Int64UpDownCounter interface{ int64UpDownCounter() } diff --git a/vendor/go.opentelemetry.io/otel/metric/instrument.go b/vendor/go.opentelemetry.io/otel/metric/instrument.go new file mode 100644 index 00000000..9f48d5f1 --- /dev/null +++ b/vendor/go.opentelemetry.io/otel/metric/instrument.go @@ -0,0 +1,376 @@ +// Copyright The OpenTelemetry Authors +// SPDX-License-Identifier: Apache-2.0 + +package metric // import "go.opentelemetry.io/otel/metric" + +import "go.opentelemetry.io/otel/attribute" + +// Observable is used as a grouping mechanism for all instruments that are +// updated within a Callback. +type Observable interface { + observable() +} + +// InstrumentOption applies options to all instruments. +type InstrumentOption interface { + Int64CounterOption + Int64UpDownCounterOption + Int64HistogramOption + Int64GaugeOption + Int64ObservableCounterOption + Int64ObservableUpDownCounterOption + Int64ObservableGaugeOption + + Float64CounterOption + Float64UpDownCounterOption + Float64HistogramOption + Float64GaugeOption + Float64ObservableCounterOption + Float64ObservableUpDownCounterOption + Float64ObservableGaugeOption +} + +// HistogramOption applies options to histogram instruments. +type HistogramOption interface { + Int64HistogramOption + Float64HistogramOption +} + +type descOpt string + +func (o descOpt) applyFloat64Counter(c Float64CounterConfig) Float64CounterConfig { + c.description = string(o) + return c +} + +func (o descOpt) applyFloat64UpDownCounter(c Float64UpDownCounterConfig) Float64UpDownCounterConfig { + c.description = string(o) + return c +} + +func (o descOpt) applyFloat64Histogram(c Float64HistogramConfig) Float64HistogramConfig { + c.description = string(o) + return c +} + +func (o descOpt) applyFloat64Gauge(c Float64GaugeConfig) Float64GaugeConfig { + c.description = string(o) + return c +} + +func (o descOpt) applyFloat64ObservableCounter(c Float64ObservableCounterConfig) Float64ObservableCounterConfig { + c.description = string(o) + return c +} + +func (o descOpt) applyFloat64ObservableUpDownCounter( + c Float64ObservableUpDownCounterConfig, +) Float64ObservableUpDownCounterConfig { + c.description = string(o) + return c +} + +func (o descOpt) applyFloat64ObservableGauge(c Float64ObservableGaugeConfig) Float64ObservableGaugeConfig { + c.description = string(o) + return c +} + +func (o descOpt) applyInt64Counter(c Int64CounterConfig) Int64CounterConfig { + c.description = string(o) + return c +} + +func (o descOpt) applyInt64UpDownCounter(c Int64UpDownCounterConfig) Int64UpDownCounterConfig { + c.description = string(o) + return c +} + +func (o descOpt) applyInt64Histogram(c Int64HistogramConfig) Int64HistogramConfig { + c.description = string(o) + return c +} + +func (o descOpt) applyInt64Gauge(c Int64GaugeConfig) Int64GaugeConfig { + c.description = string(o) + return c +} + +func (o descOpt) applyInt64ObservableCounter(c Int64ObservableCounterConfig) Int64ObservableCounterConfig { + c.description = string(o) + return c +} + +func (o descOpt) applyInt64ObservableUpDownCounter( + c Int64ObservableUpDownCounterConfig, +) Int64ObservableUpDownCounterConfig { + c.description = string(o) + return c +} + +func (o descOpt) applyInt64ObservableGauge(c Int64ObservableGaugeConfig) Int64ObservableGaugeConfig { + c.description = string(o) + return c +} + +// WithDescription sets the instrument description. +func WithDescription(desc string) InstrumentOption { return descOpt(desc) } + +type unitOpt string + +func (o unitOpt) applyFloat64Counter(c Float64CounterConfig) Float64CounterConfig { + c.unit = string(o) + return c +} + +func (o unitOpt) applyFloat64UpDownCounter(c Float64UpDownCounterConfig) Float64UpDownCounterConfig { + c.unit = string(o) + return c +} + +func (o unitOpt) applyFloat64Histogram(c Float64HistogramConfig) Float64HistogramConfig { + c.unit = string(o) + return c +} + +func (o unitOpt) applyFloat64Gauge(c Float64GaugeConfig) Float64GaugeConfig { + c.unit = string(o) + return c +} + +func (o unitOpt) applyFloat64ObservableCounter(c Float64ObservableCounterConfig) Float64ObservableCounterConfig { + c.unit = string(o) + return c +} + +func (o unitOpt) applyFloat64ObservableUpDownCounter( + c Float64ObservableUpDownCounterConfig, +) Float64ObservableUpDownCounterConfig { + c.unit = string(o) + return c +} + +func (o unitOpt) applyFloat64ObservableGauge(c Float64ObservableGaugeConfig) Float64ObservableGaugeConfig { + c.unit = string(o) + return c +} + +func (o unitOpt) applyInt64Counter(c Int64CounterConfig) Int64CounterConfig { + c.unit = string(o) + return c +} + +func (o unitOpt) applyInt64UpDownCounter(c Int64UpDownCounterConfig) Int64UpDownCounterConfig { + c.unit = string(o) + return c +} + +func (o unitOpt) applyInt64Histogram(c Int64HistogramConfig) Int64HistogramConfig { + c.unit = string(o) + return c +} + +func (o unitOpt) applyInt64Gauge(c Int64GaugeConfig) Int64GaugeConfig { + c.unit = string(o) + return c +} + +func (o unitOpt) applyInt64ObservableCounter(c Int64ObservableCounterConfig) Int64ObservableCounterConfig { + c.unit = string(o) + return c +} + +func (o unitOpt) applyInt64ObservableUpDownCounter( + c Int64ObservableUpDownCounterConfig, +) Int64ObservableUpDownCounterConfig { + c.unit = string(o) + return c +} + +func (o unitOpt) applyInt64ObservableGauge(c Int64ObservableGaugeConfig) Int64ObservableGaugeConfig { + c.unit = string(o) + return c +} + +// WithUnit sets the instrument unit. +// +// The unit u should be defined using the appropriate [UCUM](https://ucum.org) case-sensitive code. +func WithUnit(u string) InstrumentOption { return unitOpt(u) } + +// WithExplicitBucketBoundaries sets the instrument explicit bucket boundaries. +// +// This option is considered "advisory", and may be ignored by API implementations. +func WithExplicitBucketBoundaries(bounds ...float64) HistogramOption { return bucketOpt(bounds) } + +type bucketOpt []float64 + +func (o bucketOpt) applyFloat64Histogram(c Float64HistogramConfig) Float64HistogramConfig { + c.explicitBucketBoundaries = o + return c +} + +func (o bucketOpt) applyInt64Histogram(c Int64HistogramConfig) Int64HistogramConfig { + c.explicitBucketBoundaries = o + return c +} + +// AddOption applies options to an addition measurement. See +// [MeasurementOption] for other options that can be used as an AddOption. +type AddOption interface { + applyAdd(AddConfig) AddConfig +} + +// AddConfig contains options for an addition measurement. +type AddConfig struct { + attrs attribute.Set +} + +// NewAddConfig returns a new [AddConfig] with all opts applied. +func NewAddConfig(opts []AddOption) AddConfig { + config := AddConfig{attrs: *attribute.EmptySet()} + for _, o := range opts { + config = o.applyAdd(config) + } + return config +} + +// Attributes returns the configured attribute set. +func (c AddConfig) Attributes() attribute.Set { + return c.attrs +} + +// RecordOption applies options to an addition measurement. See +// [MeasurementOption] for other options that can be used as a RecordOption. +type RecordOption interface { + applyRecord(RecordConfig) RecordConfig +} + +// RecordConfig contains options for a recorded measurement. +type RecordConfig struct { + attrs attribute.Set +} + +// NewRecordConfig returns a new [RecordConfig] with all opts applied. +func NewRecordConfig(opts []RecordOption) RecordConfig { + config := RecordConfig{attrs: *attribute.EmptySet()} + for _, o := range opts { + config = o.applyRecord(config) + } + return config +} + +// Attributes returns the configured attribute set. +func (c RecordConfig) Attributes() attribute.Set { + return c.attrs +} + +// ObserveOption applies options to an addition measurement. See +// [MeasurementOption] for other options that can be used as a ObserveOption. +type ObserveOption interface { + applyObserve(ObserveConfig) ObserveConfig +} + +// ObserveConfig contains options for an observed measurement. +type ObserveConfig struct { + attrs attribute.Set +} + +// NewObserveConfig returns a new [ObserveConfig] with all opts applied. +func NewObserveConfig(opts []ObserveOption) ObserveConfig { + config := ObserveConfig{attrs: *attribute.EmptySet()} + for _, o := range opts { + config = o.applyObserve(config) + } + return config +} + +// Attributes returns the configured attribute set. +func (c ObserveConfig) Attributes() attribute.Set { + return c.attrs +} + +// MeasurementOption applies options to all instrument measurement. +type MeasurementOption interface { + AddOption + RecordOption + ObserveOption +} + +type attrOpt struct { + set attribute.Set +} + +// mergeSets returns the union of keys between a and b. Any duplicate keys will +// use the value associated with b. +func mergeSets(a, b attribute.Set) attribute.Set { + // NewMergeIterator uses the first value for any duplicates. + iter := attribute.NewMergeIterator(&b, &a) + merged := make([]attribute.KeyValue, 0, a.Len()+b.Len()) + for iter.Next() { + merged = append(merged, iter.Attribute()) + } + return attribute.NewSet(merged...) +} + +func (o attrOpt) applyAdd(c AddConfig) AddConfig { + switch { + case o.set.Len() == 0: + case c.attrs.Len() == 0: + c.attrs = o.set + default: + c.attrs = mergeSets(c.attrs, o.set) + } + return c +} + +func (o attrOpt) applyRecord(c RecordConfig) RecordConfig { + switch { + case o.set.Len() == 0: + case c.attrs.Len() == 0: + c.attrs = o.set + default: + c.attrs = mergeSets(c.attrs, o.set) + } + return c +} + +func (o attrOpt) applyObserve(c ObserveConfig) ObserveConfig { + switch { + case o.set.Len() == 0: + case c.attrs.Len() == 0: + c.attrs = o.set + default: + c.attrs = mergeSets(c.attrs, o.set) + } + return c +} + +// WithAttributeSet sets the attribute Set associated with a measurement is +// made with. +// +// If multiple WithAttributeSet or WithAttributes options are passed the +// attributes will be merged together in the order they are passed. Attributes +// with duplicate keys will use the last value passed. +func WithAttributeSet(attributes attribute.Set) MeasurementOption { + return attrOpt{set: attributes} +} + +// WithAttributes converts attributes into an attribute Set and sets the Set to +// be associated with a measurement. This is shorthand for: +// +// cp := make([]attribute.KeyValue, len(attributes)) +// copy(cp, attributes) +// WithAttributeSet(attribute.NewSet(cp...)) +// +// [attribute.NewSet] may modify the passed attributes so this will make a copy +// of attributes before creating a set in order to ensure this function is +// concurrent safe. This makes this option function less optimized in +// comparison to [WithAttributeSet]. Therefore, [WithAttributeSet] should be +// preferred for performance sensitive code. +// +// See [WithAttributeSet] for information about how multiple WithAttributes are +// merged. +func WithAttributes(attributes ...attribute.KeyValue) MeasurementOption { + cp := make([]attribute.KeyValue, len(attributes)) + copy(cp, attributes) + return attrOpt{set: attribute.NewSet(cp...)} +} diff --git a/vendor/go.opentelemetry.io/otel/metric/meter.go b/vendor/go.opentelemetry.io/otel/metric/meter.go new file mode 100644 index 00000000..5606ec4b --- /dev/null +++ b/vendor/go.opentelemetry.io/otel/metric/meter.go @@ -0,0 +1,340 @@ +// Copyright The OpenTelemetry Authors +// SPDX-License-Identifier: Apache-2.0 + +package metric // import "go.opentelemetry.io/otel/metric" + +import ( + "context" + + "go.opentelemetry.io/otel/metric/embedded" +) + +// MeterProvider provides access to named Meter instances, for instrumenting +// an application or package. +// +// Warning: Methods may be added to this interface in minor releases. See +// package documentation on API implementation for information on how to set +// default behavior for unimplemented methods. +type MeterProvider interface { + // Users of the interface can ignore this. This embedded type is only used + // by implementations of this interface. See the "API Implementations" + // section of the package documentation for more information. + embedded.MeterProvider + + // Meter returns a new Meter with the provided name and configuration. + // + // A Meter should be scoped at most to a single package. The name needs to + // be unique so it does not collide with other names used by + // an application, nor other applications. To achieve this, the import path + // of the instrumentation package is recommended to be used as name. + // + // If the name is empty, then an implementation defined default name will + // be used instead. + // + // Implementations of this method need to be safe for a user to call + // concurrently. + Meter(name string, opts ...MeterOption) Meter +} + +// Meter provides access to instrument instances for recording metrics. +// +// Warning: Methods may be added to this interface in minor releases. See +// package documentation on API implementation for information on how to set +// default behavior for unimplemented methods. +type Meter interface { + // Users of the interface can ignore this. This embedded type is only used + // by implementations of this interface. See the "API Implementations" + // section of the package documentation for more information. + embedded.Meter + + // Int64Counter returns a new Int64Counter instrument identified by name + // and configured with options. The instrument is used to synchronously + // record increasing int64 measurements during a computational operation. + // + // The name needs to conform to the OpenTelemetry instrument name syntax. + // See the Instrument Name section of the package documentation for more + // information. + // + // Implementations of this method need to be safe for a user to call + // concurrently. + Int64Counter(name string, options ...Int64CounterOption) (Int64Counter, error) + + // Int64UpDownCounter returns a new Int64UpDownCounter instrument + // identified by name and configured with options. The instrument is used + // to synchronously record int64 measurements during a computational + // operation. + // + // The name needs to conform to the OpenTelemetry instrument name syntax. + // See the Instrument Name section of the package documentation for more + // information. + // + // Implementations of this method need to be safe for a user to call + // concurrently. + Int64UpDownCounter(name string, options ...Int64UpDownCounterOption) (Int64UpDownCounter, error) + + // Int64Histogram returns a new Int64Histogram instrument identified by + // name and configured with options. The instrument is used to + // synchronously record the distribution of int64 measurements during a + // computational operation. + // + // The name needs to conform to the OpenTelemetry instrument name syntax. + // See the Instrument Name section of the package documentation for more + // information. + // + // Implementations of this method need to be safe for a user to call + // concurrently. + Int64Histogram(name string, options ...Int64HistogramOption) (Int64Histogram, error) + + // Int64Gauge returns a new Int64Gauge instrument identified by name and + // configured with options. The instrument is used to synchronously record + // instantaneous int64 measurements during a computational operation. + // + // The name needs to conform to the OpenTelemetry instrument name syntax. + // See the Instrument Name section of the package documentation for more + // information. + // + // Implementations of this method need to be safe for a user to call + // concurrently. + Int64Gauge(name string, options ...Int64GaugeOption) (Int64Gauge, error) + + // Int64ObservableCounter returns a new Int64ObservableCounter identified + // by name and configured with options. The instrument is used to + // asynchronously record increasing int64 measurements once per a + // measurement collection cycle. + // + // Measurements for the returned instrument are made via a callback. Use + // the WithInt64Callback option to register the callback here, or use the + // RegisterCallback method of this Meter to register one later. See the + // Measurements section of the package documentation for more information. + // + // The name needs to conform to the OpenTelemetry instrument name syntax. + // See the Instrument Name section of the package documentation for more + // information. + // + // Implementations of this method need to be safe for a user to call + // concurrently. + Int64ObservableCounter(name string, options ...Int64ObservableCounterOption) (Int64ObservableCounter, error) + + // Int64ObservableUpDownCounter returns a new Int64ObservableUpDownCounter + // instrument identified by name and configured with options. The + // instrument is used to asynchronously record int64 measurements once per + // a measurement collection cycle. + // + // Measurements for the returned instrument are made via a callback. Use + // the WithInt64Callback option to register the callback here, or use the + // RegisterCallback method of this Meter to register one later. See the + // Measurements section of the package documentation for more information. + // + // The name needs to conform to the OpenTelemetry instrument name syntax. + // See the Instrument Name section of the package documentation for more + // information. + // + // Implementations of this method need to be safe for a user to call + // concurrently. + Int64ObservableUpDownCounter( + name string, + options ...Int64ObservableUpDownCounterOption, + ) (Int64ObservableUpDownCounter, error) + + // Int64ObservableGauge returns a new Int64ObservableGauge instrument + // identified by name and configured with options. The instrument is used + // to asynchronously record instantaneous int64 measurements once per a + // measurement collection cycle. + // + // Measurements for the returned instrument are made via a callback. Use + // the WithInt64Callback option to register the callback here, or use the + // RegisterCallback method of this Meter to register one later. See the + // Measurements section of the package documentation for more information. + // + // The name needs to conform to the OpenTelemetry instrument name syntax. + // See the Instrument Name section of the package documentation for more + // information. + // + // Implementations of this method need to be safe for a user to call + // concurrently. + Int64ObservableGauge(name string, options ...Int64ObservableGaugeOption) (Int64ObservableGauge, error) + + // Float64Counter returns a new Float64Counter instrument identified by + // name and configured with options. The instrument is used to + // synchronously record increasing float64 measurements during a + // computational operation. + // + // The name needs to conform to the OpenTelemetry instrument name syntax. + // See the Instrument Name section of the package documentation for more + // information. + Float64Counter(name string, options ...Float64CounterOption) (Float64Counter, error) + + // Float64UpDownCounter returns a new Float64UpDownCounter instrument + // identified by name and configured with options. The instrument is used + // to synchronously record float64 measurements during a computational + // operation. + // + // The name needs to conform to the OpenTelemetry instrument name syntax. + // See the Instrument Name section of the package documentation for more + // information. + // + // Implementations of this method need to be safe for a user to call + // concurrently. + Float64UpDownCounter(name string, options ...Float64UpDownCounterOption) (Float64UpDownCounter, error) + + // Float64Histogram returns a new Float64Histogram instrument identified by + // name and configured with options. The instrument is used to + // synchronously record the distribution of float64 measurements during a + // computational operation. + // + // The name needs to conform to the OpenTelemetry instrument name syntax. + // See the Instrument Name section of the package documentation for more + // information. + // + // Implementations of this method need to be safe for a user to call + // concurrently. + Float64Histogram(name string, options ...Float64HistogramOption) (Float64Histogram, error) + + // Float64Gauge returns a new Float64Gauge instrument identified by name and + // configured with options. The instrument is used to synchronously record + // instantaneous float64 measurements during a computational operation. + // + // The name needs to conform to the OpenTelemetry instrument name syntax. + // See the Instrument Name section of the package documentation for more + // information. + // + // Implementations of this method need to be safe for a user to call + // concurrently. + Float64Gauge(name string, options ...Float64GaugeOption) (Float64Gauge, error) + + // Float64ObservableCounter returns a new Float64ObservableCounter + // instrument identified by name and configured with options. The + // instrument is used to asynchronously record increasing float64 + // measurements once per a measurement collection cycle. + // + // Measurements for the returned instrument are made via a callback. Use + // the WithFloat64Callback option to register the callback here, or use the + // RegisterCallback method of this Meter to register one later. See the + // Measurements section of the package documentation for more information. + // + // The name needs to conform to the OpenTelemetry instrument name syntax. + // See the Instrument Name section of the package documentation for more + // information. + // + // Implementations of this method need to be safe for a user to call + // concurrently. + Float64ObservableCounter(name string, options ...Float64ObservableCounterOption) (Float64ObservableCounter, error) + + // Float64ObservableUpDownCounter returns a new + // Float64ObservableUpDownCounter instrument identified by name and + // configured with options. The instrument is used to asynchronously record + // float64 measurements once per a measurement collection cycle. + // + // Measurements for the returned instrument are made via a callback. Use + // the WithFloat64Callback option to register the callback here, or use the + // RegisterCallback method of this Meter to register one later. See the + // Measurements section of the package documentation for more information. + // + // The name needs to conform to the OpenTelemetry instrument name syntax. + // See the Instrument Name section of the package documentation for more + // information. + // + // Implementations of this method need to be safe for a user to call + // concurrently. + Float64ObservableUpDownCounter( + name string, + options ...Float64ObservableUpDownCounterOption, + ) (Float64ObservableUpDownCounter, error) + + // Float64ObservableGauge returns a new Float64ObservableGauge instrument + // identified by name and configured with options. The instrument is used + // to asynchronously record instantaneous float64 measurements once per a + // measurement collection cycle. + // + // Measurements for the returned instrument are made via a callback. Use + // the WithFloat64Callback option to register the callback here, or use the + // RegisterCallback method of this Meter to register one later. See the + // Measurements section of the package documentation for more information. + // + // The name needs to conform to the OpenTelemetry instrument name syntax. + // See the Instrument Name section of the package documentation for more + // information. + // + // Implementations of this method need to be safe for a user to call + // concurrently. + Float64ObservableGauge(name string, options ...Float64ObservableGaugeOption) (Float64ObservableGauge, error) + + // RegisterCallback registers f to be called during the collection of a + // measurement cycle. + // + // If Unregister of the returned Registration is called, f needs to be + // unregistered and not called during collection. + // + // The instruments f is registered with are the only instruments that f may + // observe values for. + // + // If no instruments are passed, f should not be registered nor called + // during collection. + // + // Implementations of this method need to be safe for a user to call + // concurrently. + // + // The function f needs to be concurrent safe. + RegisterCallback(f Callback, instruments ...Observable) (Registration, error) +} + +// Callback is a function registered with a Meter that makes observations for +// the set of instruments it is registered with. The Observer parameter is used +// to record measurement observations for these instruments. +// +// The function needs to complete in a finite amount of time and the deadline +// of the passed context is expected to be honored. +// +// The function needs to make unique observations across all registered +// Callbacks. Meaning, it should not report measurements for an instrument with +// the same attributes as another Callback will report. +// +// The function needs to be reentrant and concurrent safe. +// +// Note that Go's mutexes are not reentrant, and locking a mutex takes +// an indefinite amount of time. It is therefore advised to avoid +// using mutexes inside callbacks. +type Callback func(context.Context, Observer) error + +// Observer records measurements for multiple instruments in a Callback. +// +// Warning: Methods may be added to this interface in minor releases. See +// package documentation on API implementation for information on how to set +// default behavior for unimplemented methods. +type Observer interface { + // Users of the interface can ignore this. This embedded type is only used + // by implementations of this interface. See the "API Implementations" + // section of the package documentation for more information. + embedded.Observer + + // ObserveFloat64 records the float64 value for obsrv. + // + // Implementations of this method need to be safe for a user to call + // concurrently. + ObserveFloat64(obsrv Float64Observable, value float64, opts ...ObserveOption) + + // ObserveInt64 records the int64 value for obsrv. + // + // Implementations of this method need to be safe for a user to call + // concurrently. + ObserveInt64(obsrv Int64Observable, value int64, opts ...ObserveOption) +} + +// Registration is an token representing the unique registration of a callback +// for a set of instruments with a Meter. +// +// Warning: Methods may be added to this interface in minor releases. See +// package documentation on API implementation for information on how to set +// default behavior for unimplemented methods. +type Registration interface { + // Users of the interface can ignore this. This embedded type is only used + // by implementations of this interface. See the "API Implementations" + // section of the package documentation for more information. + embedded.Registration + + // Unregister removes the callback registration from a Meter. + // + // Implementations of this method need to be idempotent and safe for a user + // to call concurrently. + Unregister() error +} diff --git a/vendor/go.opentelemetry.io/otel/metric/noop/README.md b/vendor/go.opentelemetry.io/otel/metric/noop/README.md new file mode 100644 index 00000000..bb896943 --- /dev/null +++ b/vendor/go.opentelemetry.io/otel/metric/noop/README.md @@ -0,0 +1,3 @@ +# Metric Noop + +[![PkgGoDev](https://pkg.go.dev/badge/go.opentelemetry.io/otel/metric/noop)](https://pkg.go.dev/go.opentelemetry.io/otel/metric/noop) diff --git a/vendor/go.opentelemetry.io/otel/metric/noop/noop.go b/vendor/go.opentelemetry.io/otel/metric/noop/noop.go new file mode 100644 index 00000000..634e73ae --- /dev/null +++ b/vendor/go.opentelemetry.io/otel/metric/noop/noop.go @@ -0,0 +1,320 @@ +// Copyright The OpenTelemetry Authors +// SPDX-License-Identifier: Apache-2.0 + +// Package noop provides an implementation of the OpenTelemetry metric API that +// produces no telemetry and minimizes used computation resources. +// +// Using this package to implement the OpenTelemetry metric API will +// effectively disable OpenTelemetry. +// +// This implementation can be embedded in other implementations of the +// OpenTelemetry metric API. Doing so will mean the implementation defaults to +// no operation for methods it does not implement. +package noop // import "go.opentelemetry.io/otel/metric/noop" + +import ( + "context" + + "go.opentelemetry.io/otel/metric" + "go.opentelemetry.io/otel/metric/embedded" +) + +var ( + // Compile-time check this implements the OpenTelemetry API. + + _ metric.MeterProvider = MeterProvider{} + _ metric.Meter = Meter{} + _ metric.Observer = Observer{} + _ metric.Registration = Registration{} + _ metric.Int64Counter = Int64Counter{} + _ metric.Float64Counter = Float64Counter{} + _ metric.Int64UpDownCounter = Int64UpDownCounter{} + _ metric.Float64UpDownCounter = Float64UpDownCounter{} + _ metric.Int64Histogram = Int64Histogram{} + _ metric.Float64Histogram = Float64Histogram{} + _ metric.Int64Gauge = Int64Gauge{} + _ metric.Float64Gauge = Float64Gauge{} + _ metric.Int64ObservableCounter = Int64ObservableCounter{} + _ metric.Float64ObservableCounter = Float64ObservableCounter{} + _ metric.Int64ObservableGauge = Int64ObservableGauge{} + _ metric.Float64ObservableGauge = Float64ObservableGauge{} + _ metric.Int64ObservableUpDownCounter = Int64ObservableUpDownCounter{} + _ metric.Float64ObservableUpDownCounter = Float64ObservableUpDownCounter{} + _ metric.Int64Observer = Int64Observer{} + _ metric.Float64Observer = Float64Observer{} +) + +// MeterProvider is an OpenTelemetry No-Op MeterProvider. +type MeterProvider struct{ embedded.MeterProvider } + +// NewMeterProvider returns a MeterProvider that does not record any telemetry. +func NewMeterProvider() MeterProvider { + return MeterProvider{} +} + +// Meter returns an OpenTelemetry Meter that does not record any telemetry. +func (MeterProvider) Meter(string, ...metric.MeterOption) metric.Meter { + return Meter{} +} + +// Meter is an OpenTelemetry No-Op Meter. +type Meter struct{ embedded.Meter } + +// Int64Counter returns a Counter used to record int64 measurements that +// produces no telemetry. +func (Meter) Int64Counter(string, ...metric.Int64CounterOption) (metric.Int64Counter, error) { + return Int64Counter{}, nil +} + +// Int64UpDownCounter returns an UpDownCounter used to record int64 +// measurements that produces no telemetry. +func (Meter) Int64UpDownCounter(string, ...metric.Int64UpDownCounterOption) (metric.Int64UpDownCounter, error) { + return Int64UpDownCounter{}, nil +} + +// Int64Histogram returns a Histogram used to record int64 measurements that +// produces no telemetry. +func (Meter) Int64Histogram(string, ...metric.Int64HistogramOption) (metric.Int64Histogram, error) { + return Int64Histogram{}, nil +} + +// Int64Gauge returns a Gauge used to record int64 measurements that +// produces no telemetry. +func (Meter) Int64Gauge(string, ...metric.Int64GaugeOption) (metric.Int64Gauge, error) { + return Int64Gauge{}, nil +} + +// Int64ObservableCounter returns an ObservableCounter used to record int64 +// measurements that produces no telemetry. +func (Meter) Int64ObservableCounter( + string, + ...metric.Int64ObservableCounterOption, +) (metric.Int64ObservableCounter, error) { + return Int64ObservableCounter{}, nil +} + +// Int64ObservableUpDownCounter returns an ObservableUpDownCounter used to +// record int64 measurements that produces no telemetry. +func (Meter) Int64ObservableUpDownCounter( + string, + ...metric.Int64ObservableUpDownCounterOption, +) (metric.Int64ObservableUpDownCounter, error) { + return Int64ObservableUpDownCounter{}, nil +} + +// Int64ObservableGauge returns an ObservableGauge used to record int64 +// measurements that produces no telemetry. +func (Meter) Int64ObservableGauge(string, ...metric.Int64ObservableGaugeOption) (metric.Int64ObservableGauge, error) { + return Int64ObservableGauge{}, nil +} + +// Float64Counter returns a Counter used to record int64 measurements that +// produces no telemetry. +func (Meter) Float64Counter(string, ...metric.Float64CounterOption) (metric.Float64Counter, error) { + return Float64Counter{}, nil +} + +// Float64UpDownCounter returns an UpDownCounter used to record int64 +// measurements that produces no telemetry. +func (Meter) Float64UpDownCounter(string, ...metric.Float64UpDownCounterOption) (metric.Float64UpDownCounter, error) { + return Float64UpDownCounter{}, nil +} + +// Float64Histogram returns a Histogram used to record int64 measurements that +// produces no telemetry. +func (Meter) Float64Histogram(string, ...metric.Float64HistogramOption) (metric.Float64Histogram, error) { + return Float64Histogram{}, nil +} + +// Float64Gauge returns a Gauge used to record float64 measurements that +// produces no telemetry. +func (Meter) Float64Gauge(string, ...metric.Float64GaugeOption) (metric.Float64Gauge, error) { + return Float64Gauge{}, nil +} + +// Float64ObservableCounter returns an ObservableCounter used to record int64 +// measurements that produces no telemetry. +func (Meter) Float64ObservableCounter( + string, + ...metric.Float64ObservableCounterOption, +) (metric.Float64ObservableCounter, error) { + return Float64ObservableCounter{}, nil +} + +// Float64ObservableUpDownCounter returns an ObservableUpDownCounter used to +// record int64 measurements that produces no telemetry. +func (Meter) Float64ObservableUpDownCounter( + string, + ...metric.Float64ObservableUpDownCounterOption, +) (metric.Float64ObservableUpDownCounter, error) { + return Float64ObservableUpDownCounter{}, nil +} + +// Float64ObservableGauge returns an ObservableGauge used to record int64 +// measurements that produces no telemetry. +func (Meter) Float64ObservableGauge( + string, + ...metric.Float64ObservableGaugeOption, +) (metric.Float64ObservableGauge, error) { + return Float64ObservableGauge{}, nil +} + +// RegisterCallback performs no operation. +func (Meter) RegisterCallback(metric.Callback, ...metric.Observable) (metric.Registration, error) { + return Registration{}, nil +} + +// Observer acts as a recorder of measurements for multiple instruments in a +// Callback, it performing no operation. +type Observer struct{ embedded.Observer } + +// ObserveFloat64 performs no operation. +func (Observer) ObserveFloat64(metric.Float64Observable, float64, ...metric.ObserveOption) { +} + +// ObserveInt64 performs no operation. +func (Observer) ObserveInt64(metric.Int64Observable, int64, ...metric.ObserveOption) { +} + +// Registration is the registration of a Callback with a No-Op Meter. +type Registration struct{ embedded.Registration } + +// Unregister unregisters the Callback the Registration represents with the +// No-Op Meter. This will always return nil because the No-Op Meter performs no +// operation, including hold any record of registrations. +func (Registration) Unregister() error { return nil } + +// Int64Counter is an OpenTelemetry Counter used to record int64 measurements. +// It produces no telemetry. +type Int64Counter struct{ embedded.Int64Counter } + +// Add performs no operation. +func (Int64Counter) Add(context.Context, int64, ...metric.AddOption) {} + +// Enabled performs no operation. +func (Int64Counter) Enabled(context.Context) bool { return false } + +// Float64Counter is an OpenTelemetry Counter used to record float64 +// measurements. It produces no telemetry. +type Float64Counter struct{ embedded.Float64Counter } + +// Add performs no operation. +func (Float64Counter) Add(context.Context, float64, ...metric.AddOption) {} + +// Enabled performs no operation. +func (Float64Counter) Enabled(context.Context) bool { return false } + +// Int64UpDownCounter is an OpenTelemetry UpDownCounter used to record int64 +// measurements. It produces no telemetry. +type Int64UpDownCounter struct{ embedded.Int64UpDownCounter } + +// Add performs no operation. +func (Int64UpDownCounter) Add(context.Context, int64, ...metric.AddOption) {} + +// Enabled performs no operation. +func (Int64UpDownCounter) Enabled(context.Context) bool { return false } + +// Float64UpDownCounter is an OpenTelemetry UpDownCounter used to record +// float64 measurements. It produces no telemetry. +type Float64UpDownCounter struct{ embedded.Float64UpDownCounter } + +// Add performs no operation. +func (Float64UpDownCounter) Add(context.Context, float64, ...metric.AddOption) {} + +// Enabled performs no operation. +func (Float64UpDownCounter) Enabled(context.Context) bool { return false } + +// Int64Histogram is an OpenTelemetry Histogram used to record int64 +// measurements. It produces no telemetry. +type Int64Histogram struct{ embedded.Int64Histogram } + +// Record performs no operation. +func (Int64Histogram) Record(context.Context, int64, ...metric.RecordOption) {} + +// Enabled performs no operation. +func (Int64Histogram) Enabled(context.Context) bool { return false } + +// Float64Histogram is an OpenTelemetry Histogram used to record float64 +// measurements. It produces no telemetry. +type Float64Histogram struct{ embedded.Float64Histogram } + +// Record performs no operation. +func (Float64Histogram) Record(context.Context, float64, ...metric.RecordOption) {} + +// Enabled performs no operation. +func (Float64Histogram) Enabled(context.Context) bool { return false } + +// Int64Gauge is an OpenTelemetry Gauge used to record instantaneous int64 +// measurements. It produces no telemetry. +type Int64Gauge struct{ embedded.Int64Gauge } + +// Record performs no operation. +func (Int64Gauge) Record(context.Context, int64, ...metric.RecordOption) {} + +// Enabled performs no operation. +func (Int64Gauge) Enabled(context.Context) bool { return false } + +// Float64Gauge is an OpenTelemetry Gauge used to record instantaneous float64 +// measurements. It produces no telemetry. +type Float64Gauge struct{ embedded.Float64Gauge } + +// Record performs no operation. +func (Float64Gauge) Record(context.Context, float64, ...metric.RecordOption) {} + +// Enabled performs no operation. +func (Float64Gauge) Enabled(context.Context) bool { return false } + +// Int64ObservableCounter is an OpenTelemetry ObservableCounter used to record +// int64 measurements. It produces no telemetry. +type Int64ObservableCounter struct { + metric.Int64Observable + embedded.Int64ObservableCounter +} + +// Float64ObservableCounter is an OpenTelemetry ObservableCounter used to record +// float64 measurements. It produces no telemetry. +type Float64ObservableCounter struct { + metric.Float64Observable + embedded.Float64ObservableCounter +} + +// Int64ObservableGauge is an OpenTelemetry ObservableGauge used to record +// int64 measurements. It produces no telemetry. +type Int64ObservableGauge struct { + metric.Int64Observable + embedded.Int64ObservableGauge +} + +// Float64ObservableGauge is an OpenTelemetry ObservableGauge used to record +// float64 measurements. It produces no telemetry. +type Float64ObservableGauge struct { + metric.Float64Observable + embedded.Float64ObservableGauge +} + +// Int64ObservableUpDownCounter is an OpenTelemetry ObservableUpDownCounter +// used to record int64 measurements. It produces no telemetry. +type Int64ObservableUpDownCounter struct { + metric.Int64Observable + embedded.Int64ObservableUpDownCounter +} + +// Float64ObservableUpDownCounter is an OpenTelemetry ObservableUpDownCounter +// used to record float64 measurements. It produces no telemetry. +type Float64ObservableUpDownCounter struct { + metric.Float64Observable + embedded.Float64ObservableUpDownCounter +} + +// Int64Observer is a recorder of int64 measurements that performs no operation. +type Int64Observer struct{ embedded.Int64Observer } + +// Observe performs no operation. +func (Int64Observer) Observe(int64, ...metric.ObserveOption) {} + +// Float64Observer is a recorder of float64 measurements that performs no +// operation. +type Float64Observer struct{ embedded.Float64Observer } + +// Observe performs no operation. +func (Float64Observer) Observe(float64, ...metric.ObserveOption) {} diff --git a/vendor/go.opentelemetry.io/otel/metric/syncfloat64.go b/vendor/go.opentelemetry.io/otel/metric/syncfloat64.go new file mode 100644 index 00000000..abb3051d --- /dev/null +++ b/vendor/go.opentelemetry.io/otel/metric/syncfloat64.go @@ -0,0 +1,274 @@ +// Copyright The OpenTelemetry Authors +// SPDX-License-Identifier: Apache-2.0 + +package metric // import "go.opentelemetry.io/otel/metric" + +import ( + "context" + + "go.opentelemetry.io/otel/metric/embedded" +) + +// Float64Counter is an instrument that records increasing float64 values. +// +// Warning: Methods may be added to this interface in minor releases. See +// package documentation on API implementation for information on how to set +// default behavior for unimplemented methods. +type Float64Counter interface { + // Users of the interface can ignore this. This embedded type is only used + // by implementations of this interface. See the "API Implementations" + // section of the package documentation for more information. + embedded.Float64Counter + + // Add records a change to the counter. + // + // Use the WithAttributeSet (or, if performance is not a concern, + // the WithAttributes) option to include measurement attributes. + // + // Implementations of this method need to be safe for a user to call + // concurrently. + Add(ctx context.Context, incr float64, options ...AddOption) + + // Enabled reports whether the instrument will process measurements for the given context. + // + // This function can be used in places where measuring an instrument + // would result in computationally expensive operations. + // + // Implementations of this method need to be safe for a user to call + // concurrently. + Enabled(context.Context) bool +} + +// Float64CounterConfig contains options for synchronous counter instruments that +// record float64 values. +type Float64CounterConfig struct { + description string + unit string +} + +// NewFloat64CounterConfig returns a new [Float64CounterConfig] with all opts +// applied. +func NewFloat64CounterConfig(opts ...Float64CounterOption) Float64CounterConfig { + var config Float64CounterConfig + for _, o := range opts { + config = o.applyFloat64Counter(config) + } + return config +} + +// Description returns the configured description. +func (c Float64CounterConfig) Description() string { + return c.description +} + +// Unit returns the configured unit. +func (c Float64CounterConfig) Unit() string { + return c.unit +} + +// Float64CounterOption applies options to a [Float64CounterConfig]. See +// [InstrumentOption] for other options that can be used as a +// Float64CounterOption. +type Float64CounterOption interface { + applyFloat64Counter(Float64CounterConfig) Float64CounterConfig +} + +// Float64UpDownCounter is an instrument that records increasing or decreasing +// float64 values. +// +// Warning: Methods may be added to this interface in minor releases. See +// package documentation on API implementation for information on how to set +// default behavior for unimplemented methods. +type Float64UpDownCounter interface { + // Users of the interface can ignore this. This embedded type is only used + // by implementations of this interface. See the "API Implementations" + // section of the package documentation for more information. + embedded.Float64UpDownCounter + + // Add records a change to the counter. + // + // Use the WithAttributeSet (or, if performance is not a concern, + // the WithAttributes) option to include measurement attributes. + // + // Implementations of this method need to be safe for a user to call + // concurrently. + Add(ctx context.Context, incr float64, options ...AddOption) + + // Enabled reports whether the instrument will process measurements for the given context. + // + // This function can be used in places where measuring an instrument + // would result in computationally expensive operations. + // + // Implementations of this method need to be safe for a user to call + // concurrently. + Enabled(context.Context) bool +} + +// Float64UpDownCounterConfig contains options for synchronous counter +// instruments that record float64 values. +type Float64UpDownCounterConfig struct { + description string + unit string +} + +// NewFloat64UpDownCounterConfig returns a new [Float64UpDownCounterConfig] +// with all opts applied. +func NewFloat64UpDownCounterConfig(opts ...Float64UpDownCounterOption) Float64UpDownCounterConfig { + var config Float64UpDownCounterConfig + for _, o := range opts { + config = o.applyFloat64UpDownCounter(config) + } + return config +} + +// Description returns the configured description. +func (c Float64UpDownCounterConfig) Description() string { + return c.description +} + +// Unit returns the configured unit. +func (c Float64UpDownCounterConfig) Unit() string { + return c.unit +} + +// Float64UpDownCounterOption applies options to a +// [Float64UpDownCounterConfig]. See [InstrumentOption] for other options that +// can be used as a Float64UpDownCounterOption. +type Float64UpDownCounterOption interface { + applyFloat64UpDownCounter(Float64UpDownCounterConfig) Float64UpDownCounterConfig +} + +// Float64Histogram is an instrument that records a distribution of float64 +// values. +// +// Warning: Methods may be added to this interface in minor releases. See +// package documentation on API implementation for information on how to set +// default behavior for unimplemented methods. +type Float64Histogram interface { + // Users of the interface can ignore this. This embedded type is only used + // by implementations of this interface. See the "API Implementations" + // section of the package documentation for more information. + embedded.Float64Histogram + + // Record adds an additional value to the distribution. + // + // Use the WithAttributeSet (or, if performance is not a concern, + // the WithAttributes) option to include measurement attributes. + // + // Implementations of this method need to be safe for a user to call + // concurrently. + Record(ctx context.Context, incr float64, options ...RecordOption) + + // Enabled reports whether the instrument will process measurements for the given context. + // + // This function can be used in places where measuring an instrument + // would result in computationally expensive operations. + // + // Implementations of this method need to be safe for a user to call + // concurrently. + Enabled(context.Context) bool +} + +// Float64HistogramConfig contains options for synchronous histogram +// instruments that record float64 values. +type Float64HistogramConfig struct { + description string + unit string + explicitBucketBoundaries []float64 +} + +// NewFloat64HistogramConfig returns a new [Float64HistogramConfig] with all +// opts applied. +func NewFloat64HistogramConfig(opts ...Float64HistogramOption) Float64HistogramConfig { + var config Float64HistogramConfig + for _, o := range opts { + config = o.applyFloat64Histogram(config) + } + return config +} + +// Description returns the configured description. +func (c Float64HistogramConfig) Description() string { + return c.description +} + +// Unit returns the configured unit. +func (c Float64HistogramConfig) Unit() string { + return c.unit +} + +// ExplicitBucketBoundaries returns the configured explicit bucket boundaries. +func (c Float64HistogramConfig) ExplicitBucketBoundaries() []float64 { + return c.explicitBucketBoundaries +} + +// Float64HistogramOption applies options to a [Float64HistogramConfig]. See +// [InstrumentOption] for other options that can be used as a +// Float64HistogramOption. +type Float64HistogramOption interface { + applyFloat64Histogram(Float64HistogramConfig) Float64HistogramConfig +} + +// Float64Gauge is an instrument that records instantaneous float64 values. +// +// Warning: Methods may be added to this interface in minor releases. See +// package documentation on API implementation for information on how to set +// default behavior for unimplemented methods. +type Float64Gauge interface { + // Users of the interface can ignore this. This embedded type is only used + // by implementations of this interface. See the "API Implementations" + // section of the package documentation for more information. + embedded.Float64Gauge + + // Record records the instantaneous value. + // + // Use the WithAttributeSet (or, if performance is not a concern, + // the WithAttributes) option to include measurement attributes. + // + // Implementations of this method need to be safe for a user to call + // concurrently. + Record(ctx context.Context, value float64, options ...RecordOption) + + // Enabled reports whether the instrument will process measurements for the given context. + // + // This function can be used in places where measuring an instrument + // would result in computationally expensive operations. + // + // Implementations of this method need to be safe for a user to call + // concurrently. + Enabled(context.Context) bool +} + +// Float64GaugeConfig contains options for synchronous gauge instruments that +// record float64 values. +type Float64GaugeConfig struct { + description string + unit string +} + +// NewFloat64GaugeConfig returns a new [Float64GaugeConfig] with all opts +// applied. +func NewFloat64GaugeConfig(opts ...Float64GaugeOption) Float64GaugeConfig { + var config Float64GaugeConfig + for _, o := range opts { + config = o.applyFloat64Gauge(config) + } + return config +} + +// Description returns the configured description. +func (c Float64GaugeConfig) Description() string { + return c.description +} + +// Unit returns the configured unit. +func (c Float64GaugeConfig) Unit() string { + return c.unit +} + +// Float64GaugeOption applies options to a [Float64GaugeConfig]. See +// [InstrumentOption] for other options that can be used as a +// Float64GaugeOption. +type Float64GaugeOption interface { + applyFloat64Gauge(Float64GaugeConfig) Float64GaugeConfig +} diff --git a/vendor/go.opentelemetry.io/otel/metric/syncint64.go b/vendor/go.opentelemetry.io/otel/metric/syncint64.go new file mode 100644 index 00000000..5bbfaf03 --- /dev/null +++ b/vendor/go.opentelemetry.io/otel/metric/syncint64.go @@ -0,0 +1,274 @@ +// Copyright The OpenTelemetry Authors +// SPDX-License-Identifier: Apache-2.0 + +package metric // import "go.opentelemetry.io/otel/metric" + +import ( + "context" + + "go.opentelemetry.io/otel/metric/embedded" +) + +// Int64Counter is an instrument that records increasing int64 values. +// +// Warning: Methods may be added to this interface in minor releases. See +// package documentation on API implementation for information on how to set +// default behavior for unimplemented methods. +type Int64Counter interface { + // Users of the interface can ignore this. This embedded type is only used + // by implementations of this interface. See the "API Implementations" + // section of the package documentation for more information. + embedded.Int64Counter + + // Add records a change to the counter. + // + // Use the WithAttributeSet (or, if performance is not a concern, + // the WithAttributes) option to include measurement attributes. + // + // Implementations of this method need to be safe for a user to call + // concurrently. + Add(ctx context.Context, incr int64, options ...AddOption) + + // Enabled reports whether the instrument will process measurements for the given context. + // + // This function can be used in places where measuring an instrument + // would result in computationally expensive operations. + // + // Implementations of this method need to be safe for a user to call + // concurrently. + Enabled(context.Context) bool +} + +// Int64CounterConfig contains options for synchronous counter instruments that +// record int64 values. +type Int64CounterConfig struct { + description string + unit string +} + +// NewInt64CounterConfig returns a new [Int64CounterConfig] with all opts +// applied. +func NewInt64CounterConfig(opts ...Int64CounterOption) Int64CounterConfig { + var config Int64CounterConfig + for _, o := range opts { + config = o.applyInt64Counter(config) + } + return config +} + +// Description returns the configured description. +func (c Int64CounterConfig) Description() string { + return c.description +} + +// Unit returns the configured unit. +func (c Int64CounterConfig) Unit() string { + return c.unit +} + +// Int64CounterOption applies options to a [Int64CounterConfig]. See +// [InstrumentOption] for other options that can be used as an +// Int64CounterOption. +type Int64CounterOption interface { + applyInt64Counter(Int64CounterConfig) Int64CounterConfig +} + +// Int64UpDownCounter is an instrument that records increasing or decreasing +// int64 values. +// +// Warning: Methods may be added to this interface in minor releases. See +// package documentation on API implementation for information on how to set +// default behavior for unimplemented methods. +type Int64UpDownCounter interface { + // Users of the interface can ignore this. This embedded type is only used + // by implementations of this interface. See the "API Implementations" + // section of the package documentation for more information. + embedded.Int64UpDownCounter + + // Add records a change to the counter. + // + // Use the WithAttributeSet (or, if performance is not a concern, + // the WithAttributes) option to include measurement attributes. + // + // Implementations of this method need to be safe for a user to call + // concurrently. + Add(ctx context.Context, incr int64, options ...AddOption) + + // Enabled reports whether the instrument will process measurements for the given context. + // + // This function can be used in places where measuring an instrument + // would result in computationally expensive operations. + // + // Implementations of this method need to be safe for a user to call + // concurrently. + Enabled(context.Context) bool +} + +// Int64UpDownCounterConfig contains options for synchronous counter +// instruments that record int64 values. +type Int64UpDownCounterConfig struct { + description string + unit string +} + +// NewInt64UpDownCounterConfig returns a new [Int64UpDownCounterConfig] with +// all opts applied. +func NewInt64UpDownCounterConfig(opts ...Int64UpDownCounterOption) Int64UpDownCounterConfig { + var config Int64UpDownCounterConfig + for _, o := range opts { + config = o.applyInt64UpDownCounter(config) + } + return config +} + +// Description returns the configured description. +func (c Int64UpDownCounterConfig) Description() string { + return c.description +} + +// Unit returns the configured unit. +func (c Int64UpDownCounterConfig) Unit() string { + return c.unit +} + +// Int64UpDownCounterOption applies options to a [Int64UpDownCounterConfig]. +// See [InstrumentOption] for other options that can be used as an +// Int64UpDownCounterOption. +type Int64UpDownCounterOption interface { + applyInt64UpDownCounter(Int64UpDownCounterConfig) Int64UpDownCounterConfig +} + +// Int64Histogram is an instrument that records a distribution of int64 +// values. +// +// Warning: Methods may be added to this interface in minor releases. See +// package documentation on API implementation for information on how to set +// default behavior for unimplemented methods. +type Int64Histogram interface { + // Users of the interface can ignore this. This embedded type is only used + // by implementations of this interface. See the "API Implementations" + // section of the package documentation for more information. + embedded.Int64Histogram + + // Record adds an additional value to the distribution. + // + // Use the WithAttributeSet (or, if performance is not a concern, + // the WithAttributes) option to include measurement attributes. + // + // Implementations of this method need to be safe for a user to call + // concurrently. + Record(ctx context.Context, incr int64, options ...RecordOption) + + // Enabled reports whether the instrument will process measurements for the given context. + // + // This function can be used in places where measuring an instrument + // would result in computationally expensive operations. + // + // Implementations of this method need to be safe for a user to call + // concurrently. + Enabled(context.Context) bool +} + +// Int64HistogramConfig contains options for synchronous histogram instruments +// that record int64 values. +type Int64HistogramConfig struct { + description string + unit string + explicitBucketBoundaries []float64 +} + +// NewInt64HistogramConfig returns a new [Int64HistogramConfig] with all opts +// applied. +func NewInt64HistogramConfig(opts ...Int64HistogramOption) Int64HistogramConfig { + var config Int64HistogramConfig + for _, o := range opts { + config = o.applyInt64Histogram(config) + } + return config +} + +// Description returns the configured description. +func (c Int64HistogramConfig) Description() string { + return c.description +} + +// Unit returns the configured unit. +func (c Int64HistogramConfig) Unit() string { + return c.unit +} + +// ExplicitBucketBoundaries returns the configured explicit bucket boundaries. +func (c Int64HistogramConfig) ExplicitBucketBoundaries() []float64 { + return c.explicitBucketBoundaries +} + +// Int64HistogramOption applies options to a [Int64HistogramConfig]. See +// [InstrumentOption] for other options that can be used as an +// Int64HistogramOption. +type Int64HistogramOption interface { + applyInt64Histogram(Int64HistogramConfig) Int64HistogramConfig +} + +// Int64Gauge is an instrument that records instantaneous int64 values. +// +// Warning: Methods may be added to this interface in minor releases. See +// package documentation on API implementation for information on how to set +// default behavior for unimplemented methods. +type Int64Gauge interface { + // Users of the interface can ignore this. This embedded type is only used + // by implementations of this interface. See the "API Implementations" + // section of the package documentation for more information. + embedded.Int64Gauge + + // Record records the instantaneous value. + // + // Use the WithAttributeSet (or, if performance is not a concern, + // the WithAttributes) option to include measurement attributes. + // + // Implementations of this method need to be safe for a user to call + // concurrently. + Record(ctx context.Context, value int64, options ...RecordOption) + + // Enabled reports whether the instrument will process measurements for the given context. + // + // This function can be used in places where measuring an instrument + // would result in computationally expensive operations. + // + // Implementations of this method need to be safe for a user to call + // concurrently. + Enabled(context.Context) bool +} + +// Int64GaugeConfig contains options for synchronous gauge instruments that +// record int64 values. +type Int64GaugeConfig struct { + description string + unit string +} + +// NewInt64GaugeConfig returns a new [Int64GaugeConfig] with all opts +// applied. +func NewInt64GaugeConfig(opts ...Int64GaugeOption) Int64GaugeConfig { + var config Int64GaugeConfig + for _, o := range opts { + config = o.applyInt64Gauge(config) + } + return config +} + +// Description returns the configured description. +func (c Int64GaugeConfig) Description() string { + return c.description +} + +// Unit returns the configured unit. +func (c Int64GaugeConfig) Unit() string { + return c.unit +} + +// Int64GaugeOption applies options to a [Int64GaugeConfig]. See +// [InstrumentOption] for other options that can be used as a +// Int64GaugeOption. +type Int64GaugeOption interface { + applyInt64Gauge(Int64GaugeConfig) Int64GaugeConfig +} diff --git a/vendor/go.opentelemetry.io/otel/propagation.go b/vendor/go.opentelemetry.io/otel/propagation.go new file mode 100644 index 00000000..2fd94973 --- /dev/null +++ b/vendor/go.opentelemetry.io/otel/propagation.go @@ -0,0 +1,20 @@ +// Copyright The OpenTelemetry Authors +// SPDX-License-Identifier: Apache-2.0 + +package otel // import "go.opentelemetry.io/otel" + +import ( + "go.opentelemetry.io/otel/internal/global" + "go.opentelemetry.io/otel/propagation" +) + +// GetTextMapPropagator returns the global TextMapPropagator. If none has been +// set, a No-Op TextMapPropagator is returned. +func GetTextMapPropagator() propagation.TextMapPropagator { + return global.TextMapPropagator() +} + +// SetTextMapPropagator sets propagator as the global TextMapPropagator. +func SetTextMapPropagator(propagator propagation.TextMapPropagator) { + global.SetTextMapPropagator(propagator) +} diff --git a/vendor/go.opentelemetry.io/otel/propagation/README.md b/vendor/go.opentelemetry.io/otel/propagation/README.md new file mode 100644 index 00000000..e2959ac7 --- /dev/null +++ b/vendor/go.opentelemetry.io/otel/propagation/README.md @@ -0,0 +1,3 @@ +# Propagation + +[![PkgGoDev](https://pkg.go.dev/badge/go.opentelemetry.io/otel/propagation)](https://pkg.go.dev/go.opentelemetry.io/otel/propagation) diff --git a/vendor/go.opentelemetry.io/otel/propagation/baggage.go b/vendor/go.opentelemetry.io/otel/propagation/baggage.go new file mode 100644 index 00000000..2ecca3fe --- /dev/null +++ b/vendor/go.opentelemetry.io/otel/propagation/baggage.go @@ -0,0 +1,97 @@ +// Copyright The OpenTelemetry Authors +// SPDX-License-Identifier: Apache-2.0 + +package propagation // import "go.opentelemetry.io/otel/propagation" + +import ( + "context" + + "go.opentelemetry.io/otel/baggage" + "go.opentelemetry.io/otel/internal/errorhandler" +) + +const ( + baggageHeader = "baggage" + + // W3C Baggage specification limits. + // https://www.w3.org/TR/baggage/#limits + maxMembers = 64 +) + +// Baggage is a propagator that supports the W3C Baggage format. +// +// This propagates user-defined baggage associated with a trace. The complete +// specification is defined at https://www.w3.org/TR/baggage/. +type Baggage struct{} + +var _ TextMapPropagator = Baggage{} + +// Inject sets baggage key-values from ctx into the carrier. +func (Baggage) Inject(ctx context.Context, carrier TextMapCarrier) { + bStr := baggage.FromContext(ctx).String() + if bStr != "" { + carrier.Set(baggageHeader, bStr) + } +} + +// Extract returns a copy of parent with the baggage from the carrier added. +// If carrier implements [ValuesGetter] (e.g. [HeaderCarrier]), Values is invoked +// for multiple values extraction. Otherwise, Get is called. +func (Baggage) Extract(parent context.Context, carrier TextMapCarrier) context.Context { + if multiCarrier, ok := carrier.(ValuesGetter); ok { + return extractMultiBaggage(parent, multiCarrier) + } + return extractSingleBaggage(parent, carrier) +} + +// Fields returns the keys who's values are set with Inject. +func (Baggage) Fields() []string { + return []string{baggageHeader} +} + +func extractSingleBaggage(parent context.Context, carrier TextMapCarrier) context.Context { + bStr := carrier.Get(baggageHeader) + if bStr == "" { + return parent + } + + bag, err := baggage.Parse(bStr) + if err != nil { + errorhandler.GetErrorHandler().Handle(err) + } + if bag.Len() == 0 { + return parent + } + return baggage.ContextWithBaggage(parent, bag) +} + +func extractMultiBaggage(parent context.Context, carrier ValuesGetter) context.Context { + bVals := carrier.Values(baggageHeader) + if len(bVals) == 0 { + return parent + } + + var members []baggage.Member + for _, bStr := range bVals { + currBag, err := baggage.Parse(bStr) + if err != nil { + errorhandler.GetErrorHandler().Handle(err) + } + if currBag.Len() == 0 { + continue + } + members = append(members, currBag.Members()...) + if len(members) >= maxMembers { + break + } + } + + b, err := baggage.New(members...) + if err != nil { + errorhandler.GetErrorHandler().Handle(err) + } + if b.Len() == 0 { + return parent + } + return baggage.ContextWithBaggage(parent, b) +} diff --git a/vendor/go.opentelemetry.io/otel/propagation/doc.go b/vendor/go.opentelemetry.io/otel/propagation/doc.go new file mode 100644 index 00000000..33a3baf1 --- /dev/null +++ b/vendor/go.opentelemetry.io/otel/propagation/doc.go @@ -0,0 +1,13 @@ +// Copyright The OpenTelemetry Authors +// SPDX-License-Identifier: Apache-2.0 + +/* +Package propagation contains OpenTelemetry context propagators. + +OpenTelemetry propagators are used to extract and inject context data from and +into messages exchanged by applications. The propagator supported by this +package is the W3C Trace Context encoding +(https://www.w3.org/TR/trace-context/), and W3C Baggage +(https://www.w3.org/TR/baggage/). +*/ +package propagation // import "go.opentelemetry.io/otel/propagation" diff --git a/vendor/go.opentelemetry.io/otel/propagation/propagation.go b/vendor/go.opentelemetry.io/otel/propagation/propagation.go new file mode 100644 index 00000000..0a32c59a --- /dev/null +++ b/vendor/go.opentelemetry.io/otel/propagation/propagation.go @@ -0,0 +1,168 @@ +// Copyright The OpenTelemetry Authors +// SPDX-License-Identifier: Apache-2.0 + +package propagation // import "go.opentelemetry.io/otel/propagation" + +import ( + "context" + "net/http" +) + +// TextMapCarrier is the storage medium used by a TextMapPropagator. +// See ValuesGetter for how a TextMapCarrier can get multiple values for a key. +type TextMapCarrier interface { + // DO NOT CHANGE: any modification will not be backwards compatible and + // must never be done outside of a new major release. + + // Get returns the value associated with the passed key. + Get(key string) string + // DO NOT CHANGE: any modification will not be backwards compatible and + // must never be done outside of a new major release. + + // Set stores the key-value pair. + Set(key, value string) + // DO NOT CHANGE: any modification will not be backwards compatible and + // must never be done outside of a new major release. + + // Keys lists the keys stored in this carrier. + Keys() []string + // DO NOT CHANGE: any modification will not be backwards compatible and + // must never be done outside of a new major release. +} + +// ValuesGetter can return multiple values for a single key, +// with contrast to TextMapCarrier.Get which returns a single value. +type ValuesGetter interface { + // DO NOT CHANGE: any modification will not be backwards compatible and + // must never be done outside of a new major release. + + // Values returns all values associated with the passed key. + Values(key string) []string + // DO NOT CHANGE: any modification will not be backwards compatible and + // must never be done outside of a new major release. +} + +// MapCarrier is a TextMapCarrier that uses a map held in memory as a storage +// medium for propagated key-value pairs. +type MapCarrier map[string]string + +// Compile time check that MapCarrier implements the TextMapCarrier. +var _ TextMapCarrier = MapCarrier{} + +// Get returns the value associated with the passed key. +func (c MapCarrier) Get(key string) string { + return c[key] +} + +// Set stores the key-value pair. +func (c MapCarrier) Set(key, value string) { + c[key] = value +} + +// Keys lists the keys stored in this carrier. +func (c MapCarrier) Keys() []string { + keys := make([]string, 0, len(c)) + for k := range c { + keys = append(keys, k) + } + return keys +} + +// HeaderCarrier adapts http.Header to satisfy the TextMapCarrier and ValuesGetter interfaces. +type HeaderCarrier http.Header + +// Compile time check that HeaderCarrier implements ValuesGetter. +var _ TextMapCarrier = HeaderCarrier{} + +// Compile time check that HeaderCarrier implements TextMapCarrier. +var _ ValuesGetter = HeaderCarrier{} + +// Get returns the first value associated with the passed key. +func (hc HeaderCarrier) Get(key string) string { + return http.Header(hc).Get(key) +} + +// Values returns all values associated with the passed key. +func (hc HeaderCarrier) Values(key string) []string { + return http.Header(hc).Values(key) +} + +// Set stores the key-value pair. +func (hc HeaderCarrier) Set(key, value string) { + http.Header(hc).Set(key, value) +} + +// Keys lists the keys stored in this carrier. +func (hc HeaderCarrier) Keys() []string { + keys := make([]string, 0, len(hc)) + for k := range hc { + keys = append(keys, k) + } + return keys +} + +// TextMapPropagator propagates cross-cutting concerns as key-value text +// pairs within a carrier that travels in-band across process boundaries. +type TextMapPropagator interface { + // DO NOT CHANGE: any modification will not be backwards compatible and + // must never be done outside of a new major release. + + // Inject set cross-cutting concerns from the Context into the carrier. + Inject(ctx context.Context, carrier TextMapCarrier) + // DO NOT CHANGE: any modification will not be backwards compatible and + // must never be done outside of a new major release. + + // Extract reads cross-cutting concerns from the carrier into a Context. + // Implementations may check if the carrier implements ValuesGetter, + // to support extraction of multiple values per key. + Extract(ctx context.Context, carrier TextMapCarrier) context.Context + // DO NOT CHANGE: any modification will not be backwards compatible and + // must never be done outside of a new major release. + + // Fields returns the keys whose values are set with Inject. + Fields() []string + // DO NOT CHANGE: any modification will not be backwards compatible and + // must never be done outside of a new major release. +} + +type compositeTextMapPropagator []TextMapPropagator + +func (p compositeTextMapPropagator) Inject(ctx context.Context, carrier TextMapCarrier) { + for _, i := range p { + i.Inject(ctx, carrier) + } +} + +func (p compositeTextMapPropagator) Extract(ctx context.Context, carrier TextMapCarrier) context.Context { + for _, i := range p { + ctx = i.Extract(ctx, carrier) + } + return ctx +} + +func (p compositeTextMapPropagator) Fields() []string { + unique := make(map[string]struct{}) + for _, i := range p { + for _, k := range i.Fields() { + unique[k] = struct{}{} + } + } + + fields := make([]string, 0, len(unique)) + for k := range unique { + fields = append(fields, k) + } + return fields +} + +// NewCompositeTextMapPropagator returns a unified TextMapPropagator from the +// group of passed TextMapPropagator. This allows different cross-cutting +// concerns to be propagates in a unified manner. +// +// The returned TextMapPropagator will inject and extract cross-cutting +// concerns in the order the TextMapPropagators were provided. Additionally, +// the Fields method will return a de-duplicated slice of the keys that are +// set with the Inject method. +func NewCompositeTextMapPropagator(p ...TextMapPropagator) TextMapPropagator { + return compositeTextMapPropagator(p) +} diff --git a/vendor/go.opentelemetry.io/otel/propagation/trace_context.go b/vendor/go.opentelemetry.io/otel/propagation/trace_context.go new file mode 100644 index 00000000..11f404de --- /dev/null +++ b/vendor/go.opentelemetry.io/otel/propagation/trace_context.go @@ -0,0 +1,155 @@ +// Copyright The OpenTelemetry Authors +// SPDX-License-Identifier: Apache-2.0 + +package propagation // import "go.opentelemetry.io/otel/propagation" + +import ( + "context" + "encoding/hex" + "fmt" + "strings" + + "go.opentelemetry.io/otel/trace" +) + +const ( + supportedVersion = 0 + maxVersion = 254 + traceparentHeader = "traceparent" + tracestateHeader = "tracestate" + delimiter = "-" +) + +// TraceContext is a propagator that supports the W3C Trace Context format +// (https://www.w3.org/TR/trace-context/) +// +// This propagator will propagate the traceparent and tracestate headers to +// guarantee traces are not broken. It is up to the users of this propagator +// to choose if they want to participate in a trace by modifying the +// traceparent header and relevant parts of the tracestate header containing +// their proprietary information. +type TraceContext struct{} + +var ( + _ TextMapPropagator = TraceContext{} + versionPart = fmt.Sprintf("%.2X", supportedVersion) +) + +// Inject injects the trace context from ctx into carrier. +func (TraceContext) Inject(ctx context.Context, carrier TextMapCarrier) { + sc := trace.SpanContextFromContext(ctx) + if !sc.IsValid() { + return + } + + if ts := sc.TraceState().String(); ts != "" { + carrier.Set(tracestateHeader, ts) + } + + // Preserve only the spec-defined flags: sampled (0x01) and random (0x02). + flags := sc.TraceFlags() & (trace.FlagsSampled | trace.FlagsRandom) + + var sb strings.Builder + sb.Grow(2 + 32 + 16 + 2 + 3) + _, _ = sb.WriteString(versionPart) + traceID := sc.TraceID() + spanID := sc.SpanID() + flagByte := [1]byte{byte(flags)} + var buf [32]byte + for _, src := range [][]byte{traceID[:], spanID[:], flagByte[:]} { + _ = sb.WriteByte(delimiter[0]) + n := hex.Encode(buf[:], src) + _, _ = sb.Write(buf[:n]) + } + carrier.Set(traceparentHeader, sb.String()) +} + +// Extract reads tracecontext from the carrier into a returned Context. +// +// The returned Context will be a copy of ctx and contain the extracted +// tracecontext as the remote SpanContext. If the extracted tracecontext is +// invalid, the passed ctx will be returned directly instead. +func (tc TraceContext) Extract(ctx context.Context, carrier TextMapCarrier) context.Context { + sc := tc.extract(carrier) + if !sc.IsValid() { + return ctx + } + return trace.ContextWithRemoteSpanContext(ctx, sc) +} + +func (TraceContext) extract(carrier TextMapCarrier) trace.SpanContext { + h := carrier.Get(traceparentHeader) + if h == "" { + return trace.SpanContext{} + } + + var ver [1]byte + if !extractPart(ver[:], &h, 2) { + return trace.SpanContext{} + } + version := int(ver[0]) + if version > maxVersion { + return trace.SpanContext{} + } + + var scc trace.SpanContextConfig + if !extractPart(scc.TraceID[:], &h, 32) { + return trace.SpanContext{} + } + if !extractPart(scc.SpanID[:], &h, 16) { + return trace.SpanContext{} + } + + var opts [1]byte + if !extractPart(opts[:], &h, 2) { + return trace.SpanContext{} + } + if version == 0 && (h != "" || opts[0] > 3) { + // version 0 does not allow extra fields or reserved flag bits. + return trace.SpanContext{} + } + + scc.TraceFlags = trace.TraceFlags(opts[0]) & //nolint:gosec // slice size already checked. + (trace.FlagsSampled | trace.FlagsRandom) + + // Ignore the error returned here. Failure to parse tracestate MUST NOT + // affect the parsing of traceparent according to the W3C tracecontext + // specification. + scc.TraceState, _ = trace.ParseTraceState(carrier.Get(tracestateHeader)) + scc.Remote = true + + sc := trace.NewSpanContext(scc) + if !sc.IsValid() { + return trace.SpanContext{} + } + + return sc +} + +// upperHex detect hex is upper case Unicode characters. +func upperHex(v string) bool { + for _, c := range v { + if c >= 'A' && c <= 'F' { + return true + } + } + return false +} + +func extractPart(dst []byte, h *string, n int) bool { + part, left, _ := strings.Cut(*h, delimiter) + *h = left + // hex.Decode decodes unsupported upper-case characters, so exclude explicitly. + if len(part) != n || upperHex(part) { + return false + } + if p, err := hex.Decode(dst, []byte(part)); err != nil || p != n/2 { + return false + } + return true +} + +// Fields returns the keys who's values are set with Inject. +func (TraceContext) Fields() []string { + return []string{traceparentHeader, tracestateHeader} +} diff --git a/vendor/go.opentelemetry.io/otel/renovate.json b/vendor/go.opentelemetry.io/otel/renovate.json new file mode 100644 index 00000000..fa5acf2d --- /dev/null +++ b/vendor/go.opentelemetry.io/otel/renovate.json @@ -0,0 +1,35 @@ +{ + "$schema": "https://docs.renovatebot.com/renovate-schema.json", + "extends": [ + "config:best-practices", + "helpers:pinGitHubActionDigestsToSemver" + ], + "ignorePaths": [], + "labels": ["Skip Changelog", "dependencies"], + "postUpdateOptions" : [ + "gomodTidy" + ], + "packageRules": [ + { + "matchManagers": ["gomod"], + "matchDepTypes": ["indirect"], + "enabled": true + }, + { + "matchPackageNames": ["go.opentelemetry.io/build-tools/**"], + "groupName": "build-tools" + }, + { + "matchPackageNames": ["google.golang.org/genproto/googleapis/**"], + "groupName": "googleapis" + }, + { + "matchPackageNames": ["golang.org/x/**"], + "groupName": "golang.org/x" + }, + { + "matchPackageNames": ["go.opentelemetry.io/otel/sdk/log/logtest"], + "enabled": false + } + ] +} diff --git a/vendor/go.opentelemetry.io/otel/requirements.txt b/vendor/go.opentelemetry.io/otel/requirements.txt new file mode 100644 index 00000000..7c541dee --- /dev/null +++ b/vendor/go.opentelemetry.io/otel/requirements.txt @@ -0,0 +1 @@ +codespell==2.4.2 diff --git a/vendor/go.opentelemetry.io/otel/semconv/v1.37.0/MIGRATION.md b/vendor/go.opentelemetry.io/otel/semconv/v1.37.0/MIGRATION.md new file mode 100644 index 00000000..24805478 --- /dev/null +++ b/vendor/go.opentelemetry.io/otel/semconv/v1.37.0/MIGRATION.md @@ -0,0 +1,41 @@ + +# Migration from v1.36.0 to v1.37.0 + +The `go.opentelemetry.io/otel/semconv/v1.37.0` package should be a drop-in replacement for `go.opentelemetry.io/otel/semconv/v1.36.0` with the following exceptions. + +## Removed + +The following declarations have been removed. +Refer to the [OpenTelemetry Semantic Conventions documentation] for deprecation instructions. + +If the type is not listed in the documentation as deprecated, it has been removed in this version due to lack of applicability or use. +If you use any of these non-deprecated declarations in your Go application, please [open an issue] describing your use-case. + +- `ContainerRuntime` +- `ContainerRuntimeKey` +- `GenAIOpenAIRequestServiceTierAuto` +- `GenAIOpenAIRequestServiceTierDefault` +- `GenAIOpenAIRequestServiceTierKey` +- `GenAIOpenAIResponseServiceTier` +- `GenAIOpenAIResponseServiceTierKey` +- `GenAIOpenAIResponseSystemFingerprint` +- `GenAIOpenAIResponseSystemFingerprintKey` +- `GenAISystemAWSBedrock` +- `GenAISystemAnthropic` +- `GenAISystemAzureAIInference` +- `GenAISystemAzureAIOpenAI` +- `GenAISystemCohere` +- `GenAISystemDeepseek` +- `GenAISystemGCPGemini` +- `GenAISystemGCPGenAI` +- `GenAISystemGCPVertexAI` +- `GenAISystemGroq` +- `GenAISystemIBMWatsonxAI` +- `GenAISystemKey` +- `GenAISystemMistralAI` +- `GenAISystemOpenAI` +- `GenAISystemPerplexity` +- `GenAISystemXai` + +[OpenTelemetry Semantic Conventions documentation]: https://github.com/open-telemetry/semantic-conventions +[open an issue]: https://github.com/open-telemetry/opentelemetry-go/issues/new?template=Blank+issue diff --git a/vendor/go.opentelemetry.io/otel/semconv/v1.37.0/README.md b/vendor/go.opentelemetry.io/otel/semconv/v1.37.0/README.md new file mode 100644 index 00000000..d795247f --- /dev/null +++ b/vendor/go.opentelemetry.io/otel/semconv/v1.37.0/README.md @@ -0,0 +1,3 @@ +# Semconv v1.37.0 + +[![PkgGoDev](https://pkg.go.dev/badge/go.opentelemetry.io/otel/semconv/v1.37.0)](https://pkg.go.dev/go.opentelemetry.io/otel/semconv/v1.37.0) diff --git a/vendor/go.opentelemetry.io/otel/semconv/v1.37.0/attribute_group.go b/vendor/go.opentelemetry.io/otel/semconv/v1.37.0/attribute_group.go new file mode 100644 index 00000000..b6b27498 --- /dev/null +++ b/vendor/go.opentelemetry.io/otel/semconv/v1.37.0/attribute_group.go @@ -0,0 +1,15193 @@ +// Copyright The OpenTelemetry Authors +// SPDX-License-Identifier: Apache-2.0 + +// Code generated from semantic convention specification. DO NOT EDIT. + +package semconv // import "go.opentelemetry.io/otel/semconv/v1.37.0" + +import "go.opentelemetry.io/otel/attribute" + +// Namespace: android +const ( + // AndroidAppStateKey is the attribute Key conforming to the "android.app.state" + // semantic conventions. It represents the this attribute represents the state + // of the application. + // + // Type: Enum + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: "created" + // Note: The Android lifecycle states are defined in + // [Activity lifecycle callbacks], and from which the `OS identifiers` are + // derived. + // + // [Activity lifecycle callbacks]: https://developer.android.com/guide/components/activities/activity-lifecycle#lc + AndroidAppStateKey = attribute.Key("android.app.state") + + // AndroidOSAPILevelKey is the attribute Key conforming to the + // "android.os.api_level" semantic conventions. It represents the uniquely + // identifies the framework API revision offered by a version (`os.version`) of + // the android operating system. More information can be found in the + // [Android API levels documentation]. + // + // Type: string + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: "33", "32" + // + // [Android API levels documentation]: https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels + AndroidOSAPILevelKey = attribute.Key("android.os.api_level") +) + +// AndroidOSAPILevel returns an attribute KeyValue conforming to the +// "android.os.api_level" semantic conventions. It represents the uniquely +// identifies the framework API revision offered by a version (`os.version`) of +// the android operating system. More information can be found in the +// [Android API levels documentation]. +// +// [Android API levels documentation]: https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels +func AndroidOSAPILevel(val string) attribute.KeyValue { + return AndroidOSAPILevelKey.String(val) +} + +// Enum values for android.app.state +var ( + // Any time before Activity.onResume() or, if the app has no Activity, + // Context.startService() has been called in the app for the first time. + // + // Stability: development + AndroidAppStateCreated = AndroidAppStateKey.String("created") + // Any time after Activity.onPause() or, if the app has no Activity, + // Context.stopService() has been called when the app was in the foreground + // state. + // + // Stability: development + AndroidAppStateBackground = AndroidAppStateKey.String("background") + // Any time after Activity.onResume() or, if the app has no Activity, + // Context.startService() has been called when the app was in either the created + // or background states. + // + // Stability: development + AndroidAppStateForeground = AndroidAppStateKey.String("foreground") +) + +// Namespace: app +const ( + // AppBuildIDKey is the attribute Key conforming to the "app.build_id" semantic + // conventions. It represents the unique identifier for a particular build or + // compilation of the application. + // + // Type: string + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: "6cff0a7e-cefc-4668-96f5-1273d8b334d0", + // "9f2b833506aa6973a92fde9733e6271f", "my-app-1.0.0-code-123" + AppBuildIDKey = attribute.Key("app.build_id") + + // AppInstallationIDKey is the attribute Key conforming to the + // "app.installation.id" semantic conventions. It represents a unique identifier + // representing the installation of an application on a specific device. + // + // Type: string + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: "2ab2916d-a51f-4ac8-80ee-45ac31a28092" + // Note: Its value SHOULD persist across launches of the same application + // installation, including through application upgrades. + // It SHOULD change if the application is uninstalled or if all applications of + // the vendor are uninstalled. + // Additionally, users might be able to reset this value (e.g. by clearing + // application data). + // If an app is installed multiple times on the same device (e.g. in different + // accounts on Android), each `app.installation.id` SHOULD have a different + // value. + // If multiple OpenTelemetry SDKs are used within the same application, they + // SHOULD use the same value for `app.installation.id`. + // Hardware IDs (e.g. serial number, IMEI, MAC address) MUST NOT be used as the + // `app.installation.id`. + // + // For iOS, this value SHOULD be equal to the [vendor identifier]. + // + // For Android, examples of `app.installation.id` implementations include: + // + // - [Firebase Installation ID]. + // - A globally unique UUID which is persisted across sessions in your + // application. + // - [App set ID]. + // - [`Settings.getString(Settings.Secure.ANDROID_ID)`]. + // + // More information about Android identifier best practices can be found in the + // [Android user data IDs guide]. + // + // [vendor identifier]: https://developer.apple.com/documentation/uikit/uidevice/identifierforvendor + // [Firebase Installation ID]: https://firebase.google.com/docs/projects/manage-installations + // [App set ID]: https://developer.android.com/identity/app-set-id + // [`Settings.getString(Settings.Secure.ANDROID_ID)`]: https://developer.android.com/reference/android/provider/Settings.Secure#ANDROID_ID + // [Android user data IDs guide]: https://developer.android.com/training/articles/user-data-ids + AppInstallationIDKey = attribute.Key("app.installation.id") + + // AppJankFrameCountKey is the attribute Key conforming to the + // "app.jank.frame_count" semantic conventions. It represents a number of frame + // renders that experienced jank. + // + // Type: int + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: 9, 42 + // Note: Depending on platform limitations, the value provided MAY be + // approximation. + AppJankFrameCountKey = attribute.Key("app.jank.frame_count") + + // AppJankPeriodKey is the attribute Key conforming to the "app.jank.period" + // semantic conventions. It represents the time period, in seconds, for which + // this jank is being reported. + // + // Type: double + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: 1.0, 5.0, 10.24 + AppJankPeriodKey = attribute.Key("app.jank.period") + + // AppJankThresholdKey is the attribute Key conforming to the + // "app.jank.threshold" semantic conventions. It represents the minimum + // rendering threshold for this jank, in seconds. + // + // Type: double + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: 0.016, 0.7, 1.024 + AppJankThresholdKey = attribute.Key("app.jank.threshold") + + // AppScreenCoordinateXKey is the attribute Key conforming to the + // "app.screen.coordinate.x" semantic conventions. It represents the x + // (horizontal) coordinate of a screen coordinate, in screen pixels. + // + // Type: int + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: 0, 131 + AppScreenCoordinateXKey = attribute.Key("app.screen.coordinate.x") + + // AppScreenCoordinateYKey is the attribute Key conforming to the + // "app.screen.coordinate.y" semantic conventions. It represents the y + // (vertical) component of a screen coordinate, in screen pixels. + // + // Type: int + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: 12, 99 + AppScreenCoordinateYKey = attribute.Key("app.screen.coordinate.y") + + // AppWidgetIDKey is the attribute Key conforming to the "app.widget.id" + // semantic conventions. It represents an identifier that uniquely + // differentiates this widget from other widgets in the same application. + // + // Type: string + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: "f9bc787d-ff05-48ad-90e1-fca1d46130b3", "submit_order_1829" + // Note: A widget is an application component, typically an on-screen visual GUI + // element. + AppWidgetIDKey = attribute.Key("app.widget.id") + + // AppWidgetNameKey is the attribute Key conforming to the "app.widget.name" + // semantic conventions. It represents the name of an application widget. + // + // Type: string + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: "submit", "attack", "Clear Cart" + // Note: A widget is an application component, typically an on-screen visual GUI + // element. + AppWidgetNameKey = attribute.Key("app.widget.name") +) + +// AppBuildID returns an attribute KeyValue conforming to the "app.build_id" +// semantic conventions. It represents the unique identifier for a particular +// build or compilation of the application. +func AppBuildID(val string) attribute.KeyValue { + return AppBuildIDKey.String(val) +} + +// AppInstallationID returns an attribute KeyValue conforming to the +// "app.installation.id" semantic conventions. It represents a unique identifier +// representing the installation of an application on a specific device. +func AppInstallationID(val string) attribute.KeyValue { + return AppInstallationIDKey.String(val) +} + +// AppJankFrameCount returns an attribute KeyValue conforming to the +// "app.jank.frame_count" semantic conventions. It represents a number of frame +// renders that experienced jank. +func AppJankFrameCount(val int) attribute.KeyValue { + return AppJankFrameCountKey.Int(val) +} + +// AppJankPeriod returns an attribute KeyValue conforming to the +// "app.jank.period" semantic conventions. It represents the time period, in +// seconds, for which this jank is being reported. +func AppJankPeriod(val float64) attribute.KeyValue { + return AppJankPeriodKey.Float64(val) +} + +// AppJankThreshold returns an attribute KeyValue conforming to the +// "app.jank.threshold" semantic conventions. It represents the minimum rendering +// threshold for this jank, in seconds. +func AppJankThreshold(val float64) attribute.KeyValue { + return AppJankThresholdKey.Float64(val) +} + +// AppScreenCoordinateX returns an attribute KeyValue conforming to the +// "app.screen.coordinate.x" semantic conventions. It represents the x +// (horizontal) coordinate of a screen coordinate, in screen pixels. +func AppScreenCoordinateX(val int) attribute.KeyValue { + return AppScreenCoordinateXKey.Int(val) +} + +// AppScreenCoordinateY returns an attribute KeyValue conforming to the +// "app.screen.coordinate.y" semantic conventions. It represents the y (vertical) +// component of a screen coordinate, in screen pixels. +func AppScreenCoordinateY(val int) attribute.KeyValue { + return AppScreenCoordinateYKey.Int(val) +} + +// AppWidgetID returns an attribute KeyValue conforming to the "app.widget.id" +// semantic conventions. It represents an identifier that uniquely differentiates +// this widget from other widgets in the same application. +func AppWidgetID(val string) attribute.KeyValue { + return AppWidgetIDKey.String(val) +} + +// AppWidgetName returns an attribute KeyValue conforming to the +// "app.widget.name" semantic conventions. It represents the name of an +// application widget. +func AppWidgetName(val string) attribute.KeyValue { + return AppWidgetNameKey.String(val) +} + +// Namespace: artifact +const ( + // ArtifactAttestationFilenameKey is the attribute Key conforming to the + // "artifact.attestation.filename" semantic conventions. It represents the + // provenance filename of the built attestation which directly relates to the + // build artifact filename. This filename SHOULD accompany the artifact at + // publish time. See the [SLSA Relationship] specification for more information. + // + // Type: string + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: "golang-binary-amd64-v0.1.0.attestation", + // "docker-image-amd64-v0.1.0.intoto.json1", "release-1.tar.gz.attestation", + // "file-name-package.tar.gz.intoto.json1" + // + // [SLSA Relationship]: https://slsa.dev/spec/v1.0/distributing-provenance#relationship-between-artifacts-and-attestations + ArtifactAttestationFilenameKey = attribute.Key("artifact.attestation.filename") + + // ArtifactAttestationHashKey is the attribute Key conforming to the + // "artifact.attestation.hash" semantic conventions. It represents the full + // [hash value (see glossary)], of the built attestation. Some envelopes in the + // [software attestation space] also refer to this as the **digest**. + // + // Type: string + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: "1b31dfcd5b7f9267bf2ff47651df1cfb9147b9e4df1f335accf65b4cda498408" + // + // [hash value (see glossary)]: https://nvlpubs.nist.gov/nistpubs/FIPS/NIST.FIPS.186-5.pdf + // [software attestation space]: https://github.com/in-toto/attestation/tree/main/spec + ArtifactAttestationHashKey = attribute.Key("artifact.attestation.hash") + + // ArtifactAttestationIDKey is the attribute Key conforming to the + // "artifact.attestation.id" semantic conventions. It represents the id of the + // build [software attestation]. + // + // Type: string + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: "123" + // + // [software attestation]: https://slsa.dev/attestation-model + ArtifactAttestationIDKey = attribute.Key("artifact.attestation.id") + + // ArtifactFilenameKey is the attribute Key conforming to the + // "artifact.filename" semantic conventions. It represents the human readable + // file name of the artifact, typically generated during build and release + // processes. Often includes the package name and version in the file name. + // + // Type: string + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: "golang-binary-amd64-v0.1.0", "docker-image-amd64-v0.1.0", + // "release-1.tar.gz", "file-name-package.tar.gz" + // Note: This file name can also act as the [Package Name] + // in cases where the package ecosystem maps accordingly. + // Additionally, the artifact [can be published] + // for others, but that is not a guarantee. + // + // [Package Name]: https://slsa.dev/spec/v1.0/terminology#package-model + // [can be published]: https://slsa.dev/spec/v1.0/terminology#software-supply-chain + ArtifactFilenameKey = attribute.Key("artifact.filename") + + // ArtifactHashKey is the attribute Key conforming to the "artifact.hash" + // semantic conventions. It represents the full [hash value (see glossary)], + // often found in checksum.txt on a release of the artifact and used to verify + // package integrity. + // + // Type: string + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: "9ff4c52759e2c4ac70b7d517bc7fcdc1cda631ca0045271ddd1b192544f8a3e9" + // Note: The specific algorithm used to create the cryptographic hash value is + // not defined. In situations where an artifact has multiple + // cryptographic hashes, it is up to the implementer to choose which + // hash value to set here; this should be the most secure hash algorithm + // that is suitable for the situation and consistent with the + // corresponding attestation. The implementer can then provide the other + // hash values through an additional set of attribute extensions as they + // deem necessary. + // + // [hash value (see glossary)]: https://nvlpubs.nist.gov/nistpubs/FIPS/NIST.FIPS.186-5.pdf + ArtifactHashKey = attribute.Key("artifact.hash") + + // ArtifactPurlKey is the attribute Key conforming to the "artifact.purl" + // semantic conventions. It represents the [Package URL] of the + // [package artifact] provides a standard way to identify and locate the + // packaged artifact. + // + // Type: string + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: "pkg:github/package-url/purl-spec@1209109710924", + // "pkg:npm/foo@12.12.3" + // + // [Package URL]: https://github.com/package-url/purl-spec + // [package artifact]: https://slsa.dev/spec/v1.0/terminology#package-model + ArtifactPurlKey = attribute.Key("artifact.purl") + + // ArtifactVersionKey is the attribute Key conforming to the "artifact.version" + // semantic conventions. It represents the version of the artifact. + // + // Type: string + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: "v0.1.0", "1.2.1", "122691-build" + ArtifactVersionKey = attribute.Key("artifact.version") +) + +// ArtifactAttestationFilename returns an attribute KeyValue conforming to the +// "artifact.attestation.filename" semantic conventions. It represents the +// provenance filename of the built attestation which directly relates to the +// build artifact filename. This filename SHOULD accompany the artifact at +// publish time. See the [SLSA Relationship] specification for more information. +// +// [SLSA Relationship]: https://slsa.dev/spec/v1.0/distributing-provenance#relationship-between-artifacts-and-attestations +func ArtifactAttestationFilename(val string) attribute.KeyValue { + return ArtifactAttestationFilenameKey.String(val) +} + +// ArtifactAttestationHash returns an attribute KeyValue conforming to the +// "artifact.attestation.hash" semantic conventions. It represents the full +// [hash value (see glossary)], of the built attestation. Some envelopes in the +// [software attestation space] also refer to this as the **digest**. +// +// [hash value (see glossary)]: https://nvlpubs.nist.gov/nistpubs/FIPS/NIST.FIPS.186-5.pdf +// [software attestation space]: https://github.com/in-toto/attestation/tree/main/spec +func ArtifactAttestationHash(val string) attribute.KeyValue { + return ArtifactAttestationHashKey.String(val) +} + +// ArtifactAttestationID returns an attribute KeyValue conforming to the +// "artifact.attestation.id" semantic conventions. It represents the id of the +// build [software attestation]. +// +// [software attestation]: https://slsa.dev/attestation-model +func ArtifactAttestationID(val string) attribute.KeyValue { + return ArtifactAttestationIDKey.String(val) +} + +// ArtifactFilename returns an attribute KeyValue conforming to the +// "artifact.filename" semantic conventions. It represents the human readable +// file name of the artifact, typically generated during build and release +// processes. Often includes the package name and version in the file name. +func ArtifactFilename(val string) attribute.KeyValue { + return ArtifactFilenameKey.String(val) +} + +// ArtifactHash returns an attribute KeyValue conforming to the "artifact.hash" +// semantic conventions. It represents the full [hash value (see glossary)], +// often found in checksum.txt on a release of the artifact and used to verify +// package integrity. +// +// [hash value (see glossary)]: https://nvlpubs.nist.gov/nistpubs/FIPS/NIST.FIPS.186-5.pdf +func ArtifactHash(val string) attribute.KeyValue { + return ArtifactHashKey.String(val) +} + +// ArtifactPurl returns an attribute KeyValue conforming to the "artifact.purl" +// semantic conventions. It represents the [Package URL] of the +// [package artifact] provides a standard way to identify and locate the packaged +// artifact. +// +// [Package URL]: https://github.com/package-url/purl-spec +// [package artifact]: https://slsa.dev/spec/v1.0/terminology#package-model +func ArtifactPurl(val string) attribute.KeyValue { + return ArtifactPurlKey.String(val) +} + +// ArtifactVersion returns an attribute KeyValue conforming to the +// "artifact.version" semantic conventions. It represents the version of the +// artifact. +func ArtifactVersion(val string) attribute.KeyValue { + return ArtifactVersionKey.String(val) +} + +// Namespace: aws +const ( + // AWSBedrockGuardrailIDKey is the attribute Key conforming to the + // "aws.bedrock.guardrail.id" semantic conventions. It represents the unique + // identifier of the AWS Bedrock Guardrail. A [guardrail] helps safeguard and + // prevent unwanted behavior from model responses or user messages. + // + // Type: string + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: "sgi5gkybzqak" + // + // [guardrail]: https://docs.aws.amazon.com/bedrock/latest/userguide/guardrails.html + AWSBedrockGuardrailIDKey = attribute.Key("aws.bedrock.guardrail.id") + + // AWSBedrockKnowledgeBaseIDKey is the attribute Key conforming to the + // "aws.bedrock.knowledge_base.id" semantic conventions. It represents the + // unique identifier of the AWS Bedrock Knowledge base. A [knowledge base] is a + // bank of information that can be queried by models to generate more relevant + // responses and augment prompts. + // + // Type: string + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: "XFWUPB9PAW" + // + // [knowledge base]: https://docs.aws.amazon.com/bedrock/latest/userguide/knowledge-base.html + AWSBedrockKnowledgeBaseIDKey = attribute.Key("aws.bedrock.knowledge_base.id") + + // AWSDynamoDBAttributeDefinitionsKey is the attribute Key conforming to the + // "aws.dynamodb.attribute_definitions" semantic conventions. It represents the + // JSON-serialized value of each item in the `AttributeDefinitions` request + // field. + // + // Type: string[] + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: "{ "AttributeName": "string", "AttributeType": "string" }" + AWSDynamoDBAttributeDefinitionsKey = attribute.Key("aws.dynamodb.attribute_definitions") + + // AWSDynamoDBAttributesToGetKey is the attribute Key conforming to the + // "aws.dynamodb.attributes_to_get" semantic conventions. It represents the + // value of the `AttributesToGet` request parameter. + // + // Type: string[] + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: "lives", "id" + AWSDynamoDBAttributesToGetKey = attribute.Key("aws.dynamodb.attributes_to_get") + + // AWSDynamoDBConsistentReadKey is the attribute Key conforming to the + // "aws.dynamodb.consistent_read" semantic conventions. It represents the value + // of the `ConsistentRead` request parameter. + // + // Type: boolean + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: + AWSDynamoDBConsistentReadKey = attribute.Key("aws.dynamodb.consistent_read") + + // AWSDynamoDBConsumedCapacityKey is the attribute Key conforming to the + // "aws.dynamodb.consumed_capacity" semantic conventions. It represents the + // JSON-serialized value of each item in the `ConsumedCapacity` response field. + // + // Type: string[] + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: "{ "CapacityUnits": number, "GlobalSecondaryIndexes": { "string" : + // { "CapacityUnits": number, "ReadCapacityUnits": number, "WriteCapacityUnits": + // number } }, "LocalSecondaryIndexes": { "string" : { "CapacityUnits": number, + // "ReadCapacityUnits": number, "WriteCapacityUnits": number } }, + // "ReadCapacityUnits": number, "Table": { "CapacityUnits": number, + // "ReadCapacityUnits": number, "WriteCapacityUnits": number }, "TableName": + // "string", "WriteCapacityUnits": number }" + AWSDynamoDBConsumedCapacityKey = attribute.Key("aws.dynamodb.consumed_capacity") + + // AWSDynamoDBCountKey is the attribute Key conforming to the + // "aws.dynamodb.count" semantic conventions. It represents the value of the + // `Count` response parameter. + // + // Type: int + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: 10 + AWSDynamoDBCountKey = attribute.Key("aws.dynamodb.count") + + // AWSDynamoDBExclusiveStartTableKey is the attribute Key conforming to the + // "aws.dynamodb.exclusive_start_table" semantic conventions. It represents the + // value of the `ExclusiveStartTableName` request parameter. + // + // Type: string + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: "Users", "CatsTable" + AWSDynamoDBExclusiveStartTableKey = attribute.Key("aws.dynamodb.exclusive_start_table") + + // AWSDynamoDBGlobalSecondaryIndexUpdatesKey is the attribute Key conforming to + // the "aws.dynamodb.global_secondary_index_updates" semantic conventions. It + // represents the JSON-serialized value of each item in the + // `GlobalSecondaryIndexUpdates` request field. + // + // Type: string[] + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: "{ "Create": { "IndexName": "string", "KeySchema": [ { + // "AttributeName": "string", "KeyType": "string" } ], "Projection": { + // "NonKeyAttributes": [ "string" ], "ProjectionType": "string" }, + // "ProvisionedThroughput": { "ReadCapacityUnits": number, "WriteCapacityUnits": + // number } }" + AWSDynamoDBGlobalSecondaryIndexUpdatesKey = attribute.Key("aws.dynamodb.global_secondary_index_updates") + + // AWSDynamoDBGlobalSecondaryIndexesKey is the attribute Key conforming to the + // "aws.dynamodb.global_secondary_indexes" semantic conventions. It represents + // the JSON-serialized value of each item of the `GlobalSecondaryIndexes` + // request field. + // + // Type: string[] + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: "{ "IndexName": "string", "KeySchema": [ { "AttributeName": + // "string", "KeyType": "string" } ], "Projection": { "NonKeyAttributes": [ + // "string" ], "ProjectionType": "string" }, "ProvisionedThroughput": { + // "ReadCapacityUnits": number, "WriteCapacityUnits": number } }" + AWSDynamoDBGlobalSecondaryIndexesKey = attribute.Key("aws.dynamodb.global_secondary_indexes") + + // AWSDynamoDBIndexNameKey is the attribute Key conforming to the + // "aws.dynamodb.index_name" semantic conventions. It represents the value of + // the `IndexName` request parameter. + // + // Type: string + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: "name_to_group" + AWSDynamoDBIndexNameKey = attribute.Key("aws.dynamodb.index_name") + + // AWSDynamoDBItemCollectionMetricsKey is the attribute Key conforming to the + // "aws.dynamodb.item_collection_metrics" semantic conventions. It represents + // the JSON-serialized value of the `ItemCollectionMetrics` response field. + // + // Type: string + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: "{ "string" : [ { "ItemCollectionKey": { "string" : { "B": blob, + // "BOOL": boolean, "BS": [ blob ], "L": [ "AttributeValue" ], "M": { "string" : + // "AttributeValue" }, "N": "string", "NS": [ "string" ], "NULL": boolean, "S": + // "string", "SS": [ "string" ] } }, "SizeEstimateRangeGB": [ number ] } ] }" + AWSDynamoDBItemCollectionMetricsKey = attribute.Key("aws.dynamodb.item_collection_metrics") + + // AWSDynamoDBLimitKey is the attribute Key conforming to the + // "aws.dynamodb.limit" semantic conventions. It represents the value of the + // `Limit` request parameter. + // + // Type: int + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: 10 + AWSDynamoDBLimitKey = attribute.Key("aws.dynamodb.limit") + + // AWSDynamoDBLocalSecondaryIndexesKey is the attribute Key conforming to the + // "aws.dynamodb.local_secondary_indexes" semantic conventions. It represents + // the JSON-serialized value of each item of the `LocalSecondaryIndexes` request + // field. + // + // Type: string[] + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: "{ "IndexArn": "string", "IndexName": "string", "IndexSizeBytes": + // number, "ItemCount": number, "KeySchema": [ { "AttributeName": "string", + // "KeyType": "string" } ], "Projection": { "NonKeyAttributes": [ "string" ], + // "ProjectionType": "string" } }" + AWSDynamoDBLocalSecondaryIndexesKey = attribute.Key("aws.dynamodb.local_secondary_indexes") + + // AWSDynamoDBProjectionKey is the attribute Key conforming to the + // "aws.dynamodb.projection" semantic conventions. It represents the value of + // the `ProjectionExpression` request parameter. + // + // Type: string + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: "Title", "Title, Price, Color", "Title, Description, RelatedItems, + // ProductReviews" + AWSDynamoDBProjectionKey = attribute.Key("aws.dynamodb.projection") + + // AWSDynamoDBProvisionedReadCapacityKey is the attribute Key conforming to the + // "aws.dynamodb.provisioned_read_capacity" semantic conventions. It represents + // the value of the `ProvisionedThroughput.ReadCapacityUnits` request parameter. + // + // Type: double + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: 1.0, 2.0 + AWSDynamoDBProvisionedReadCapacityKey = attribute.Key("aws.dynamodb.provisioned_read_capacity") + + // AWSDynamoDBProvisionedWriteCapacityKey is the attribute Key conforming to the + // "aws.dynamodb.provisioned_write_capacity" semantic conventions. It represents + // the value of the `ProvisionedThroughput.WriteCapacityUnits` request + // parameter. + // + // Type: double + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: 1.0, 2.0 + AWSDynamoDBProvisionedWriteCapacityKey = attribute.Key("aws.dynamodb.provisioned_write_capacity") + + // AWSDynamoDBScanForwardKey is the attribute Key conforming to the + // "aws.dynamodb.scan_forward" semantic conventions. It represents the value of + // the `ScanIndexForward` request parameter. + // + // Type: boolean + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: + AWSDynamoDBScanForwardKey = attribute.Key("aws.dynamodb.scan_forward") + + // AWSDynamoDBScannedCountKey is the attribute Key conforming to the + // "aws.dynamodb.scanned_count" semantic conventions. It represents the value of + // the `ScannedCount` response parameter. + // + // Type: int + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: 50 + AWSDynamoDBScannedCountKey = attribute.Key("aws.dynamodb.scanned_count") + + // AWSDynamoDBSegmentKey is the attribute Key conforming to the + // "aws.dynamodb.segment" semantic conventions. It represents the value of the + // `Segment` request parameter. + // + // Type: int + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: 10 + AWSDynamoDBSegmentKey = attribute.Key("aws.dynamodb.segment") + + // AWSDynamoDBSelectKey is the attribute Key conforming to the + // "aws.dynamodb.select" semantic conventions. It represents the value of the + // `Select` request parameter. + // + // Type: string + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: "ALL_ATTRIBUTES", "COUNT" + AWSDynamoDBSelectKey = attribute.Key("aws.dynamodb.select") + + // AWSDynamoDBTableCountKey is the attribute Key conforming to the + // "aws.dynamodb.table_count" semantic conventions. It represents the number of + // items in the `TableNames` response parameter. + // + // Type: int + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: 20 + AWSDynamoDBTableCountKey = attribute.Key("aws.dynamodb.table_count") + + // AWSDynamoDBTableNamesKey is the attribute Key conforming to the + // "aws.dynamodb.table_names" semantic conventions. It represents the keys in + // the `RequestItems` object field. + // + // Type: string[] + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: "Users", "Cats" + AWSDynamoDBTableNamesKey = attribute.Key("aws.dynamodb.table_names") + + // AWSDynamoDBTotalSegmentsKey is the attribute Key conforming to the + // "aws.dynamodb.total_segments" semantic conventions. It represents the value + // of the `TotalSegments` request parameter. + // + // Type: int + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: 100 + AWSDynamoDBTotalSegmentsKey = attribute.Key("aws.dynamodb.total_segments") + + // AWSECSClusterARNKey is the attribute Key conforming to the + // "aws.ecs.cluster.arn" semantic conventions. It represents the ARN of an + // [ECS cluster]. + // + // Type: string + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: "arn:aws:ecs:us-west-2:123456789123:cluster/my-cluster" + // + // [ECS cluster]: https://docs.aws.amazon.com/AmazonECS/latest/developerguide/clusters.html + AWSECSClusterARNKey = attribute.Key("aws.ecs.cluster.arn") + + // AWSECSContainerARNKey is the attribute Key conforming to the + // "aws.ecs.container.arn" semantic conventions. It represents the Amazon + // Resource Name (ARN) of an [ECS container instance]. + // + // Type: string + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: + // "arn:aws:ecs:us-west-1:123456789123:container/32624152-9086-4f0e-acae-1a75b14fe4d9" + // + // [ECS container instance]: https://docs.aws.amazon.com/AmazonECS/latest/developerguide/ECS_instances.html + AWSECSContainerARNKey = attribute.Key("aws.ecs.container.arn") + + // AWSECSLaunchtypeKey is the attribute Key conforming to the + // "aws.ecs.launchtype" semantic conventions. It represents the [launch type] + // for an ECS task. + // + // Type: Enum + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: + // + // [launch type]: https://docs.aws.amazon.com/AmazonECS/latest/developerguide/launch_types.html + AWSECSLaunchtypeKey = attribute.Key("aws.ecs.launchtype") + + // AWSECSTaskARNKey is the attribute Key conforming to the "aws.ecs.task.arn" + // semantic conventions. It represents the ARN of a running [ECS task]. + // + // Type: string + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: + // "arn:aws:ecs:us-west-1:123456789123:task/10838bed-421f-43ef-870a-f43feacbbb5b", + // "arn:aws:ecs:us-west-1:123456789123:task/my-cluster/task-id/23ebb8ac-c18f-46c6-8bbe-d55d0e37cfbd" + // + // [ECS task]: https://docs.aws.amazon.com/AmazonECS/latest/developerguide/ecs-account-settings.html#ecs-resource-ids + AWSECSTaskARNKey = attribute.Key("aws.ecs.task.arn") + + // AWSECSTaskFamilyKey is the attribute Key conforming to the + // "aws.ecs.task.family" semantic conventions. It represents the family name of + // the [ECS task definition] used to create the ECS task. + // + // Type: string + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: "opentelemetry-family" + // + // [ECS task definition]: https://docs.aws.amazon.com/AmazonECS/latest/developerguide/task_definitions.html + AWSECSTaskFamilyKey = attribute.Key("aws.ecs.task.family") + + // AWSECSTaskIDKey is the attribute Key conforming to the "aws.ecs.task.id" + // semantic conventions. It represents the ID of a running ECS task. The ID MUST + // be extracted from `task.arn`. + // + // Type: string + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: "10838bed-421f-43ef-870a-f43feacbbb5b", + // "23ebb8ac-c18f-46c6-8bbe-d55d0e37cfbd" + AWSECSTaskIDKey = attribute.Key("aws.ecs.task.id") + + // AWSECSTaskRevisionKey is the attribute Key conforming to the + // "aws.ecs.task.revision" semantic conventions. It represents the revision for + // the task definition used to create the ECS task. + // + // Type: string + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: "8", "26" + AWSECSTaskRevisionKey = attribute.Key("aws.ecs.task.revision") + + // AWSEKSClusterARNKey is the attribute Key conforming to the + // "aws.eks.cluster.arn" semantic conventions. It represents the ARN of an EKS + // cluster. + // + // Type: string + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: "arn:aws:ecs:us-west-2:123456789123:cluster/my-cluster" + AWSEKSClusterARNKey = attribute.Key("aws.eks.cluster.arn") + + // AWSExtendedRequestIDKey is the attribute Key conforming to the + // "aws.extended_request_id" semantic conventions. It represents the AWS + // extended request ID as returned in the response header `x-amz-id-2`. + // + // Type: string + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: + // "wzHcyEWfmOGDIE5QOhTAqFDoDWP3y8IUvpNINCwL9N4TEHbUw0/gZJ+VZTmCNCWR7fezEN3eCiQ=" + AWSExtendedRequestIDKey = attribute.Key("aws.extended_request_id") + + // AWSKinesisStreamNameKey is the attribute Key conforming to the + // "aws.kinesis.stream_name" semantic conventions. It represents the name of the + // AWS Kinesis [stream] the request refers to. Corresponds to the + // `--stream-name` parameter of the Kinesis [describe-stream] operation. + // + // Type: string + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: "some-stream-name" + // + // [stream]: https://docs.aws.amazon.com/streams/latest/dev/introduction.html + // [describe-stream]: https://docs.aws.amazon.com/cli/latest/reference/kinesis/describe-stream.html + AWSKinesisStreamNameKey = attribute.Key("aws.kinesis.stream_name") + + // AWSLambdaInvokedARNKey is the attribute Key conforming to the + // "aws.lambda.invoked_arn" semantic conventions. It represents the full invoked + // ARN as provided on the `Context` passed to the function ( + // `Lambda-Runtime-Invoked-Function-Arn` header on the + // `/runtime/invocation/next` applicable). + // + // Type: string + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: "arn:aws:lambda:us-east-1:123456:function:myfunction:myalias" + // Note: This may be different from `cloud.resource_id` if an alias is involved. + AWSLambdaInvokedARNKey = attribute.Key("aws.lambda.invoked_arn") + + // AWSLambdaResourceMappingIDKey is the attribute Key conforming to the + // "aws.lambda.resource_mapping.id" semantic conventions. It represents the UUID + // of the [AWS Lambda EvenSource Mapping]. An event source is mapped to a lambda + // function. It's contents are read by Lambda and used to trigger a function. + // This isn't available in the lambda execution context or the lambda runtime + // environtment. This is going to be populated by the AWS SDK for each language + // when that UUID is present. Some of these operations are + // Create/Delete/Get/List/Update EventSourceMapping. + // + // Type: string + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: "587ad24b-03b9-4413-8202-bbd56b36e5b7" + // + // [AWS Lambda EvenSource Mapping]: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-lambda-eventsourcemapping.html + AWSLambdaResourceMappingIDKey = attribute.Key("aws.lambda.resource_mapping.id") + + // AWSLogGroupARNsKey is the attribute Key conforming to the + // "aws.log.group.arns" semantic conventions. It represents the Amazon Resource + // Name(s) (ARN) of the AWS log group(s). + // + // Type: string[] + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: "arn:aws:logs:us-west-1:123456789012:log-group:/aws/my/group:*" + // Note: See the [log group ARN format documentation]. + // + // [log group ARN format documentation]: https://docs.aws.amazon.com/AmazonCloudWatch/latest/logs/iam-access-control-overview-cwl.html#CWL_ARN_Format + AWSLogGroupARNsKey = attribute.Key("aws.log.group.arns") + + // AWSLogGroupNamesKey is the attribute Key conforming to the + // "aws.log.group.names" semantic conventions. It represents the name(s) of the + // AWS log group(s) an application is writing to. + // + // Type: string[] + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: "/aws/lambda/my-function", "opentelemetry-service" + // Note: Multiple log groups must be supported for cases like multi-container + // applications, where a single application has sidecar containers, and each + // write to their own log group. + AWSLogGroupNamesKey = attribute.Key("aws.log.group.names") + + // AWSLogStreamARNsKey is the attribute Key conforming to the + // "aws.log.stream.arns" semantic conventions. It represents the ARN(s) of the + // AWS log stream(s). + // + // Type: string[] + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: + // "arn:aws:logs:us-west-1:123456789012:log-group:/aws/my/group:log-stream:logs/main/10838bed-421f-43ef-870a-f43feacbbb5b" + // Note: See the [log stream ARN format documentation]. One log group can + // contain several log streams, so these ARNs necessarily identify both a log + // group and a log stream. + // + // [log stream ARN format documentation]: https://docs.aws.amazon.com/AmazonCloudWatch/latest/logs/iam-access-control-overview-cwl.html#CWL_ARN_Format + AWSLogStreamARNsKey = attribute.Key("aws.log.stream.arns") + + // AWSLogStreamNamesKey is the attribute Key conforming to the + // "aws.log.stream.names" semantic conventions. It represents the name(s) of the + // AWS log stream(s) an application is writing to. + // + // Type: string[] + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: "logs/main/10838bed-421f-43ef-870a-f43feacbbb5b" + AWSLogStreamNamesKey = attribute.Key("aws.log.stream.names") + + // AWSRequestIDKey is the attribute Key conforming to the "aws.request_id" + // semantic conventions. It represents the AWS request ID as returned in the + // response headers `x-amzn-requestid`, `x-amzn-request-id` or + // `x-amz-request-id`. + // + // Type: string + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: "79b9da39-b7ae-508a-a6bc-864b2829c622", "C9ER4AJX75574TDJ" + AWSRequestIDKey = attribute.Key("aws.request_id") + + // AWSS3BucketKey is the attribute Key conforming to the "aws.s3.bucket" + // semantic conventions. It represents the S3 bucket name the request refers to. + // Corresponds to the `--bucket` parameter of the [S3 API] operations. + // + // Type: string + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: "some-bucket-name" + // Note: The `bucket` attribute is applicable to all S3 operations that + // reference a bucket, i.e. that require the bucket name as a mandatory + // parameter. + // This applies to almost all S3 operations except `list-buckets`. + // + // [S3 API]: https://docs.aws.amazon.com/cli/latest/reference/s3api/index.html + AWSS3BucketKey = attribute.Key("aws.s3.bucket") + + // AWSS3CopySourceKey is the attribute Key conforming to the + // "aws.s3.copy_source" semantic conventions. It represents the source object + // (in the form `bucket`/`key`) for the copy operation. + // + // Type: string + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: "someFile.yml" + // Note: The `copy_source` attribute applies to S3 copy operations and + // corresponds to the `--copy-source` parameter + // of the [copy-object operation within the S3 API]. + // This applies in particular to the following operations: + // + // - [copy-object] + // - [upload-part-copy] + // + // + // [copy-object operation within the S3 API]: https://docs.aws.amazon.com/cli/latest/reference/s3api/copy-object.html + // [copy-object]: https://docs.aws.amazon.com/cli/latest/reference/s3api/copy-object.html + // [upload-part-copy]: https://docs.aws.amazon.com/cli/latest/reference/s3api/upload-part-copy.html + AWSS3CopySourceKey = attribute.Key("aws.s3.copy_source") + + // AWSS3DeleteKey is the attribute Key conforming to the "aws.s3.delete" + // semantic conventions. It represents the delete request container that + // specifies the objects to be deleted. + // + // Type: string + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: + // "Objects=[{Key=string,VersionId=string},{Key=string,VersionId=string}],Quiet=boolean" + // Note: The `delete` attribute is only applicable to the [delete-object] + // operation. + // The `delete` attribute corresponds to the `--delete` parameter of the + // [delete-objects operation within the S3 API]. + // + // [delete-object]: https://docs.aws.amazon.com/cli/latest/reference/s3api/delete-object.html + // [delete-objects operation within the S3 API]: https://docs.aws.amazon.com/cli/latest/reference/s3api/delete-objects.html + AWSS3DeleteKey = attribute.Key("aws.s3.delete") + + // AWSS3KeyKey is the attribute Key conforming to the "aws.s3.key" semantic + // conventions. It represents the S3 object key the request refers to. + // Corresponds to the `--key` parameter of the [S3 API] operations. + // + // Type: string + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: "someFile.yml" + // Note: The `key` attribute is applicable to all object-related S3 operations, + // i.e. that require the object key as a mandatory parameter. + // This applies in particular to the following operations: + // + // - [copy-object] + // - [delete-object] + // - [get-object] + // - [head-object] + // - [put-object] + // - [restore-object] + // - [select-object-content] + // - [abort-multipart-upload] + // - [complete-multipart-upload] + // - [create-multipart-upload] + // - [list-parts] + // - [upload-part] + // - [upload-part-copy] + // + // + // [S3 API]: https://docs.aws.amazon.com/cli/latest/reference/s3api/index.html + // [copy-object]: https://docs.aws.amazon.com/cli/latest/reference/s3api/copy-object.html + // [delete-object]: https://docs.aws.amazon.com/cli/latest/reference/s3api/delete-object.html + // [get-object]: https://docs.aws.amazon.com/cli/latest/reference/s3api/get-object.html + // [head-object]: https://docs.aws.amazon.com/cli/latest/reference/s3api/head-object.html + // [put-object]: https://docs.aws.amazon.com/cli/latest/reference/s3api/put-object.html + // [restore-object]: https://docs.aws.amazon.com/cli/latest/reference/s3api/restore-object.html + // [select-object-content]: https://docs.aws.amazon.com/cli/latest/reference/s3api/select-object-content.html + // [abort-multipart-upload]: https://docs.aws.amazon.com/cli/latest/reference/s3api/abort-multipart-upload.html + // [complete-multipart-upload]: https://docs.aws.amazon.com/cli/latest/reference/s3api/complete-multipart-upload.html + // [create-multipart-upload]: https://docs.aws.amazon.com/cli/latest/reference/s3api/create-multipart-upload.html + // [list-parts]: https://docs.aws.amazon.com/cli/latest/reference/s3api/list-parts.html + // [upload-part]: https://docs.aws.amazon.com/cli/latest/reference/s3api/upload-part.html + // [upload-part-copy]: https://docs.aws.amazon.com/cli/latest/reference/s3api/upload-part-copy.html + AWSS3KeyKey = attribute.Key("aws.s3.key") + + // AWSS3PartNumberKey is the attribute Key conforming to the + // "aws.s3.part_number" semantic conventions. It represents the part number of + // the part being uploaded in a multipart-upload operation. This is a positive + // integer between 1 and 10,000. + // + // Type: int + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: 3456 + // Note: The `part_number` attribute is only applicable to the [upload-part] + // and [upload-part-copy] operations. + // The `part_number` attribute corresponds to the `--part-number` parameter of + // the + // [upload-part operation within the S3 API]. + // + // [upload-part]: https://docs.aws.amazon.com/cli/latest/reference/s3api/upload-part.html + // [upload-part-copy]: https://docs.aws.amazon.com/cli/latest/reference/s3api/upload-part-copy.html + // [upload-part operation within the S3 API]: https://docs.aws.amazon.com/cli/latest/reference/s3api/upload-part.html + AWSS3PartNumberKey = attribute.Key("aws.s3.part_number") + + // AWSS3UploadIDKey is the attribute Key conforming to the "aws.s3.upload_id" + // semantic conventions. It represents the upload ID that identifies the + // multipart upload. + // + // Type: string + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: "dfRtDYWFbkRONycy.Yxwh66Yjlx.cph0gtNBtJ" + // Note: The `upload_id` attribute applies to S3 multipart-upload operations and + // corresponds to the `--upload-id` parameter + // of the [S3 API] multipart operations. + // This applies in particular to the following operations: + // + // - [abort-multipart-upload] + // - [complete-multipart-upload] + // - [list-parts] + // - [upload-part] + // - [upload-part-copy] + // + // + // [S3 API]: https://docs.aws.amazon.com/cli/latest/reference/s3api/index.html + // [abort-multipart-upload]: https://docs.aws.amazon.com/cli/latest/reference/s3api/abort-multipart-upload.html + // [complete-multipart-upload]: https://docs.aws.amazon.com/cli/latest/reference/s3api/complete-multipart-upload.html + // [list-parts]: https://docs.aws.amazon.com/cli/latest/reference/s3api/list-parts.html + // [upload-part]: https://docs.aws.amazon.com/cli/latest/reference/s3api/upload-part.html + // [upload-part-copy]: https://docs.aws.amazon.com/cli/latest/reference/s3api/upload-part-copy.html + AWSS3UploadIDKey = attribute.Key("aws.s3.upload_id") + + // AWSSecretsmanagerSecretARNKey is the attribute Key conforming to the + // "aws.secretsmanager.secret.arn" semantic conventions. It represents the ARN + // of the Secret stored in the Secrets Mangger. + // + // Type: string + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: + // "arn:aws:secretsmanager:us-east-1:123456789012:secret:SecretName-6RandomCharacters" + AWSSecretsmanagerSecretARNKey = attribute.Key("aws.secretsmanager.secret.arn") + + // AWSSNSTopicARNKey is the attribute Key conforming to the "aws.sns.topic.arn" + // semantic conventions. It represents the ARN of the AWS SNS Topic. An Amazon + // SNS [topic] is a logical access point that acts as a communication channel. + // + // Type: string + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: "arn:aws:sns:us-east-1:123456789012:mystack-mytopic-NZJ5JSMVGFIE" + // + // [topic]: https://docs.aws.amazon.com/sns/latest/dg/sns-create-topic.html + AWSSNSTopicARNKey = attribute.Key("aws.sns.topic.arn") + + // AWSSQSQueueURLKey is the attribute Key conforming to the "aws.sqs.queue.url" + // semantic conventions. It represents the URL of the AWS SQS Queue. It's a + // unique identifier for a queue in Amazon Simple Queue Service (SQS) and is + // used to access the queue and perform actions on it. + // + // Type: string + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: "https://sqs.us-east-1.amazonaws.com/123456789012/MyQueue" + AWSSQSQueueURLKey = attribute.Key("aws.sqs.queue.url") + + // AWSStepFunctionsActivityARNKey is the attribute Key conforming to the + // "aws.step_functions.activity.arn" semantic conventions. It represents the ARN + // of the AWS Step Functions Activity. + // + // Type: string + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: "arn:aws:states:us-east-1:123456789012:activity:get-greeting" + AWSStepFunctionsActivityARNKey = attribute.Key("aws.step_functions.activity.arn") + + // AWSStepFunctionsStateMachineARNKey is the attribute Key conforming to the + // "aws.step_functions.state_machine.arn" semantic conventions. It represents + // the ARN of the AWS Step Functions State Machine. + // + // Type: string + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: + // "arn:aws:states:us-east-1:123456789012:stateMachine:myStateMachine:1" + AWSStepFunctionsStateMachineARNKey = attribute.Key("aws.step_functions.state_machine.arn") +) + +// AWSBedrockGuardrailID returns an attribute KeyValue conforming to the +// "aws.bedrock.guardrail.id" semantic conventions. It represents the unique +// identifier of the AWS Bedrock Guardrail. A [guardrail] helps safeguard and +// prevent unwanted behavior from model responses or user messages. +// +// [guardrail]: https://docs.aws.amazon.com/bedrock/latest/userguide/guardrails.html +func AWSBedrockGuardrailID(val string) attribute.KeyValue { + return AWSBedrockGuardrailIDKey.String(val) +} + +// AWSBedrockKnowledgeBaseID returns an attribute KeyValue conforming to the +// "aws.bedrock.knowledge_base.id" semantic conventions. It represents the unique +// identifier of the AWS Bedrock Knowledge base. A [knowledge base] is a bank of +// information that can be queried by models to generate more relevant responses +// and augment prompts. +// +// [knowledge base]: https://docs.aws.amazon.com/bedrock/latest/userguide/knowledge-base.html +func AWSBedrockKnowledgeBaseID(val string) attribute.KeyValue { + return AWSBedrockKnowledgeBaseIDKey.String(val) +} + +// AWSDynamoDBAttributeDefinitions returns an attribute KeyValue conforming to +// the "aws.dynamodb.attribute_definitions" semantic conventions. It represents +// the JSON-serialized value of each item in the `AttributeDefinitions` request +// field. +func AWSDynamoDBAttributeDefinitions(val ...string) attribute.KeyValue { + return AWSDynamoDBAttributeDefinitionsKey.StringSlice(val) +} + +// AWSDynamoDBAttributesToGet returns an attribute KeyValue conforming to the +// "aws.dynamodb.attributes_to_get" semantic conventions. It represents the value +// of the `AttributesToGet` request parameter. +func AWSDynamoDBAttributesToGet(val ...string) attribute.KeyValue { + return AWSDynamoDBAttributesToGetKey.StringSlice(val) +} + +// AWSDynamoDBConsistentRead returns an attribute KeyValue conforming to the +// "aws.dynamodb.consistent_read" semantic conventions. It represents the value +// of the `ConsistentRead` request parameter. +func AWSDynamoDBConsistentRead(val bool) attribute.KeyValue { + return AWSDynamoDBConsistentReadKey.Bool(val) +} + +// AWSDynamoDBConsumedCapacity returns an attribute KeyValue conforming to the +// "aws.dynamodb.consumed_capacity" semantic conventions. It represents the +// JSON-serialized value of each item in the `ConsumedCapacity` response field. +func AWSDynamoDBConsumedCapacity(val ...string) attribute.KeyValue { + return AWSDynamoDBConsumedCapacityKey.StringSlice(val) +} + +// AWSDynamoDBCount returns an attribute KeyValue conforming to the +// "aws.dynamodb.count" semantic conventions. It represents the value of the +// `Count` response parameter. +func AWSDynamoDBCount(val int) attribute.KeyValue { + return AWSDynamoDBCountKey.Int(val) +} + +// AWSDynamoDBExclusiveStartTable returns an attribute KeyValue conforming to the +// "aws.dynamodb.exclusive_start_table" semantic conventions. It represents the +// value of the `ExclusiveStartTableName` request parameter. +func AWSDynamoDBExclusiveStartTable(val string) attribute.KeyValue { + return AWSDynamoDBExclusiveStartTableKey.String(val) +} + +// AWSDynamoDBGlobalSecondaryIndexUpdates returns an attribute KeyValue +// conforming to the "aws.dynamodb.global_secondary_index_updates" semantic +// conventions. It represents the JSON-serialized value of each item in the +// `GlobalSecondaryIndexUpdates` request field. +func AWSDynamoDBGlobalSecondaryIndexUpdates(val ...string) attribute.KeyValue { + return AWSDynamoDBGlobalSecondaryIndexUpdatesKey.StringSlice(val) +} + +// AWSDynamoDBGlobalSecondaryIndexes returns an attribute KeyValue conforming to +// the "aws.dynamodb.global_secondary_indexes" semantic conventions. It +// represents the JSON-serialized value of each item of the +// `GlobalSecondaryIndexes` request field. +func AWSDynamoDBGlobalSecondaryIndexes(val ...string) attribute.KeyValue { + return AWSDynamoDBGlobalSecondaryIndexesKey.StringSlice(val) +} + +// AWSDynamoDBIndexName returns an attribute KeyValue conforming to the +// "aws.dynamodb.index_name" semantic conventions. It represents the value of the +// `IndexName` request parameter. +func AWSDynamoDBIndexName(val string) attribute.KeyValue { + return AWSDynamoDBIndexNameKey.String(val) +} + +// AWSDynamoDBItemCollectionMetrics returns an attribute KeyValue conforming to +// the "aws.dynamodb.item_collection_metrics" semantic conventions. It represents +// the JSON-serialized value of the `ItemCollectionMetrics` response field. +func AWSDynamoDBItemCollectionMetrics(val string) attribute.KeyValue { + return AWSDynamoDBItemCollectionMetricsKey.String(val) +} + +// AWSDynamoDBLimit returns an attribute KeyValue conforming to the +// "aws.dynamodb.limit" semantic conventions. It represents the value of the +// `Limit` request parameter. +func AWSDynamoDBLimit(val int) attribute.KeyValue { + return AWSDynamoDBLimitKey.Int(val) +} + +// AWSDynamoDBLocalSecondaryIndexes returns an attribute KeyValue conforming to +// the "aws.dynamodb.local_secondary_indexes" semantic conventions. It represents +// the JSON-serialized value of each item of the `LocalSecondaryIndexes` request +// field. +func AWSDynamoDBLocalSecondaryIndexes(val ...string) attribute.KeyValue { + return AWSDynamoDBLocalSecondaryIndexesKey.StringSlice(val) +} + +// AWSDynamoDBProjection returns an attribute KeyValue conforming to the +// "aws.dynamodb.projection" semantic conventions. It represents the value of the +// `ProjectionExpression` request parameter. +func AWSDynamoDBProjection(val string) attribute.KeyValue { + return AWSDynamoDBProjectionKey.String(val) +} + +// AWSDynamoDBProvisionedReadCapacity returns an attribute KeyValue conforming to +// the "aws.dynamodb.provisioned_read_capacity" semantic conventions. It +// represents the value of the `ProvisionedThroughput.ReadCapacityUnits` request +// parameter. +func AWSDynamoDBProvisionedReadCapacity(val float64) attribute.KeyValue { + return AWSDynamoDBProvisionedReadCapacityKey.Float64(val) +} + +// AWSDynamoDBProvisionedWriteCapacity returns an attribute KeyValue conforming +// to the "aws.dynamodb.provisioned_write_capacity" semantic conventions. It +// represents the value of the `ProvisionedThroughput.WriteCapacityUnits` request +// parameter. +func AWSDynamoDBProvisionedWriteCapacity(val float64) attribute.KeyValue { + return AWSDynamoDBProvisionedWriteCapacityKey.Float64(val) +} + +// AWSDynamoDBScanForward returns an attribute KeyValue conforming to the +// "aws.dynamodb.scan_forward" semantic conventions. It represents the value of +// the `ScanIndexForward` request parameter. +func AWSDynamoDBScanForward(val bool) attribute.KeyValue { + return AWSDynamoDBScanForwardKey.Bool(val) +} + +// AWSDynamoDBScannedCount returns an attribute KeyValue conforming to the +// "aws.dynamodb.scanned_count" semantic conventions. It represents the value of +// the `ScannedCount` response parameter. +func AWSDynamoDBScannedCount(val int) attribute.KeyValue { + return AWSDynamoDBScannedCountKey.Int(val) +} + +// AWSDynamoDBSegment returns an attribute KeyValue conforming to the +// "aws.dynamodb.segment" semantic conventions. It represents the value of the +// `Segment` request parameter. +func AWSDynamoDBSegment(val int) attribute.KeyValue { + return AWSDynamoDBSegmentKey.Int(val) +} + +// AWSDynamoDBSelect returns an attribute KeyValue conforming to the +// "aws.dynamodb.select" semantic conventions. It represents the value of the +// `Select` request parameter. +func AWSDynamoDBSelect(val string) attribute.KeyValue { + return AWSDynamoDBSelectKey.String(val) +} + +// AWSDynamoDBTableCount returns an attribute KeyValue conforming to the +// "aws.dynamodb.table_count" semantic conventions. It represents the number of +// items in the `TableNames` response parameter. +func AWSDynamoDBTableCount(val int) attribute.KeyValue { + return AWSDynamoDBTableCountKey.Int(val) +} + +// AWSDynamoDBTableNames returns an attribute KeyValue conforming to the +// "aws.dynamodb.table_names" semantic conventions. It represents the keys in the +// `RequestItems` object field. +func AWSDynamoDBTableNames(val ...string) attribute.KeyValue { + return AWSDynamoDBTableNamesKey.StringSlice(val) +} + +// AWSDynamoDBTotalSegments returns an attribute KeyValue conforming to the +// "aws.dynamodb.total_segments" semantic conventions. It represents the value of +// the `TotalSegments` request parameter. +func AWSDynamoDBTotalSegments(val int) attribute.KeyValue { + return AWSDynamoDBTotalSegmentsKey.Int(val) +} + +// AWSECSClusterARN returns an attribute KeyValue conforming to the +// "aws.ecs.cluster.arn" semantic conventions. It represents the ARN of an +// [ECS cluster]. +// +// [ECS cluster]: https://docs.aws.amazon.com/AmazonECS/latest/developerguide/clusters.html +func AWSECSClusterARN(val string) attribute.KeyValue { + return AWSECSClusterARNKey.String(val) +} + +// AWSECSContainerARN returns an attribute KeyValue conforming to the +// "aws.ecs.container.arn" semantic conventions. It represents the Amazon +// Resource Name (ARN) of an [ECS container instance]. +// +// [ECS container instance]: https://docs.aws.amazon.com/AmazonECS/latest/developerguide/ECS_instances.html +func AWSECSContainerARN(val string) attribute.KeyValue { + return AWSECSContainerARNKey.String(val) +} + +// AWSECSTaskARN returns an attribute KeyValue conforming to the +// "aws.ecs.task.arn" semantic conventions. It represents the ARN of a running +// [ECS task]. +// +// [ECS task]: https://docs.aws.amazon.com/AmazonECS/latest/developerguide/ecs-account-settings.html#ecs-resource-ids +func AWSECSTaskARN(val string) attribute.KeyValue { + return AWSECSTaskARNKey.String(val) +} + +// AWSECSTaskFamily returns an attribute KeyValue conforming to the +// "aws.ecs.task.family" semantic conventions. It represents the family name of +// the [ECS task definition] used to create the ECS task. +// +// [ECS task definition]: https://docs.aws.amazon.com/AmazonECS/latest/developerguide/task_definitions.html +func AWSECSTaskFamily(val string) attribute.KeyValue { + return AWSECSTaskFamilyKey.String(val) +} + +// AWSECSTaskID returns an attribute KeyValue conforming to the "aws.ecs.task.id" +// semantic conventions. It represents the ID of a running ECS task. The ID MUST +// be extracted from `task.arn`. +func AWSECSTaskID(val string) attribute.KeyValue { + return AWSECSTaskIDKey.String(val) +} + +// AWSECSTaskRevision returns an attribute KeyValue conforming to the +// "aws.ecs.task.revision" semantic conventions. It represents the revision for +// the task definition used to create the ECS task. +func AWSECSTaskRevision(val string) attribute.KeyValue { + return AWSECSTaskRevisionKey.String(val) +} + +// AWSEKSClusterARN returns an attribute KeyValue conforming to the +// "aws.eks.cluster.arn" semantic conventions. It represents the ARN of an EKS +// cluster. +func AWSEKSClusterARN(val string) attribute.KeyValue { + return AWSEKSClusterARNKey.String(val) +} + +// AWSExtendedRequestID returns an attribute KeyValue conforming to the +// "aws.extended_request_id" semantic conventions. It represents the AWS extended +// request ID as returned in the response header `x-amz-id-2`. +func AWSExtendedRequestID(val string) attribute.KeyValue { + return AWSExtendedRequestIDKey.String(val) +} + +// AWSKinesisStreamName returns an attribute KeyValue conforming to the +// "aws.kinesis.stream_name" semantic conventions. It represents the name of the +// AWS Kinesis [stream] the request refers to. Corresponds to the `--stream-name` +// parameter of the Kinesis [describe-stream] operation. +// +// [stream]: https://docs.aws.amazon.com/streams/latest/dev/introduction.html +// [describe-stream]: https://docs.aws.amazon.com/cli/latest/reference/kinesis/describe-stream.html +func AWSKinesisStreamName(val string) attribute.KeyValue { + return AWSKinesisStreamNameKey.String(val) +} + +// AWSLambdaInvokedARN returns an attribute KeyValue conforming to the +// "aws.lambda.invoked_arn" semantic conventions. It represents the full invoked +// ARN as provided on the `Context` passed to the function ( +// `Lambda-Runtime-Invoked-Function-Arn` header on the `/runtime/invocation/next` +// applicable). +func AWSLambdaInvokedARN(val string) attribute.KeyValue { + return AWSLambdaInvokedARNKey.String(val) +} + +// AWSLambdaResourceMappingID returns an attribute KeyValue conforming to the +// "aws.lambda.resource_mapping.id" semantic conventions. It represents the UUID +// of the [AWS Lambda EvenSource Mapping]. An event source is mapped to a lambda +// function. It's contents are read by Lambda and used to trigger a function. +// This isn't available in the lambda execution context or the lambda runtime +// environtment. This is going to be populated by the AWS SDK for each language +// when that UUID is present. Some of these operations are +// Create/Delete/Get/List/Update EventSourceMapping. +// +// [AWS Lambda EvenSource Mapping]: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-lambda-eventsourcemapping.html +func AWSLambdaResourceMappingID(val string) attribute.KeyValue { + return AWSLambdaResourceMappingIDKey.String(val) +} + +// AWSLogGroupARNs returns an attribute KeyValue conforming to the +// "aws.log.group.arns" semantic conventions. It represents the Amazon Resource +// Name(s) (ARN) of the AWS log group(s). +func AWSLogGroupARNs(val ...string) attribute.KeyValue { + return AWSLogGroupARNsKey.StringSlice(val) +} + +// AWSLogGroupNames returns an attribute KeyValue conforming to the +// "aws.log.group.names" semantic conventions. It represents the name(s) of the +// AWS log group(s) an application is writing to. +func AWSLogGroupNames(val ...string) attribute.KeyValue { + return AWSLogGroupNamesKey.StringSlice(val) +} + +// AWSLogStreamARNs returns an attribute KeyValue conforming to the +// "aws.log.stream.arns" semantic conventions. It represents the ARN(s) of the +// AWS log stream(s). +func AWSLogStreamARNs(val ...string) attribute.KeyValue { + return AWSLogStreamARNsKey.StringSlice(val) +} + +// AWSLogStreamNames returns an attribute KeyValue conforming to the +// "aws.log.stream.names" semantic conventions. It represents the name(s) of the +// AWS log stream(s) an application is writing to. +func AWSLogStreamNames(val ...string) attribute.KeyValue { + return AWSLogStreamNamesKey.StringSlice(val) +} + +// AWSRequestID returns an attribute KeyValue conforming to the "aws.request_id" +// semantic conventions. It represents the AWS request ID as returned in the +// response headers `x-amzn-requestid`, `x-amzn-request-id` or `x-amz-request-id` +// . +func AWSRequestID(val string) attribute.KeyValue { + return AWSRequestIDKey.String(val) +} + +// AWSS3Bucket returns an attribute KeyValue conforming to the "aws.s3.bucket" +// semantic conventions. It represents the S3 bucket name the request refers to. +// Corresponds to the `--bucket` parameter of the [S3 API] operations. +// +// [S3 API]: https://docs.aws.amazon.com/cli/latest/reference/s3api/index.html +func AWSS3Bucket(val string) attribute.KeyValue { + return AWSS3BucketKey.String(val) +} + +// AWSS3CopySource returns an attribute KeyValue conforming to the +// "aws.s3.copy_source" semantic conventions. It represents the source object (in +// the form `bucket`/`key`) for the copy operation. +func AWSS3CopySource(val string) attribute.KeyValue { + return AWSS3CopySourceKey.String(val) +} + +// AWSS3Delete returns an attribute KeyValue conforming to the "aws.s3.delete" +// semantic conventions. It represents the delete request container that +// specifies the objects to be deleted. +func AWSS3Delete(val string) attribute.KeyValue { + return AWSS3DeleteKey.String(val) +} + +// AWSS3Key returns an attribute KeyValue conforming to the "aws.s3.key" semantic +// conventions. It represents the S3 object key the request refers to. +// Corresponds to the `--key` parameter of the [S3 API] operations. +// +// [S3 API]: https://docs.aws.amazon.com/cli/latest/reference/s3api/index.html +func AWSS3Key(val string) attribute.KeyValue { + return AWSS3KeyKey.String(val) +} + +// AWSS3PartNumber returns an attribute KeyValue conforming to the +// "aws.s3.part_number" semantic conventions. It represents the part number of +// the part being uploaded in a multipart-upload operation. This is a positive +// integer between 1 and 10,000. +func AWSS3PartNumber(val int) attribute.KeyValue { + return AWSS3PartNumberKey.Int(val) +} + +// AWSS3UploadID returns an attribute KeyValue conforming to the +// "aws.s3.upload_id" semantic conventions. It represents the upload ID that +// identifies the multipart upload. +func AWSS3UploadID(val string) attribute.KeyValue { + return AWSS3UploadIDKey.String(val) +} + +// AWSSecretsmanagerSecretARN returns an attribute KeyValue conforming to the +// "aws.secretsmanager.secret.arn" semantic conventions. It represents the ARN of +// the Secret stored in the Secrets Mangger. +func AWSSecretsmanagerSecretARN(val string) attribute.KeyValue { + return AWSSecretsmanagerSecretARNKey.String(val) +} + +// AWSSNSTopicARN returns an attribute KeyValue conforming to the +// "aws.sns.topic.arn" semantic conventions. It represents the ARN of the AWS SNS +// Topic. An Amazon SNS [topic] is a logical access point that acts as a +// communication channel. +// +// [topic]: https://docs.aws.amazon.com/sns/latest/dg/sns-create-topic.html +func AWSSNSTopicARN(val string) attribute.KeyValue { + return AWSSNSTopicARNKey.String(val) +} + +// AWSSQSQueueURL returns an attribute KeyValue conforming to the +// "aws.sqs.queue.url" semantic conventions. It represents the URL of the AWS SQS +// Queue. It's a unique identifier for a queue in Amazon Simple Queue Service +// (SQS) and is used to access the queue and perform actions on it. +func AWSSQSQueueURL(val string) attribute.KeyValue { + return AWSSQSQueueURLKey.String(val) +} + +// AWSStepFunctionsActivityARN returns an attribute KeyValue conforming to the +// "aws.step_functions.activity.arn" semantic conventions. It represents the ARN +// of the AWS Step Functions Activity. +func AWSStepFunctionsActivityARN(val string) attribute.KeyValue { + return AWSStepFunctionsActivityARNKey.String(val) +} + +// AWSStepFunctionsStateMachineARN returns an attribute KeyValue conforming to +// the "aws.step_functions.state_machine.arn" semantic conventions. It represents +// the ARN of the AWS Step Functions State Machine. +func AWSStepFunctionsStateMachineARN(val string) attribute.KeyValue { + return AWSStepFunctionsStateMachineARNKey.String(val) +} + +// Enum values for aws.ecs.launchtype +var ( + // Amazon EC2 + // Stability: development + AWSECSLaunchtypeEC2 = AWSECSLaunchtypeKey.String("ec2") + // Amazon Fargate + // Stability: development + AWSECSLaunchtypeFargate = AWSECSLaunchtypeKey.String("fargate") +) + +// Namespace: azure +const ( + // AzureClientIDKey is the attribute Key conforming to the "azure.client.id" + // semantic conventions. It represents the unique identifier of the client + // instance. + // + // Type: string + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: "3ba4827d-4422-483f-b59f-85b74211c11d", "storage-client-1" + AzureClientIDKey = attribute.Key("azure.client.id") + + // AzureCosmosDBConnectionModeKey is the attribute Key conforming to the + // "azure.cosmosdb.connection.mode" semantic conventions. It represents the + // cosmos client connection mode. + // + // Type: Enum + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: + AzureCosmosDBConnectionModeKey = attribute.Key("azure.cosmosdb.connection.mode") + + // AzureCosmosDBConsistencyLevelKey is the attribute Key conforming to the + // "azure.cosmosdb.consistency.level" semantic conventions. It represents the + // account or request [consistency level]. + // + // Type: Enum + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: "Eventual", "ConsistentPrefix", "BoundedStaleness", "Strong", + // "Session" + // + // [consistency level]: https://learn.microsoft.com/azure/cosmos-db/consistency-levels + AzureCosmosDBConsistencyLevelKey = attribute.Key("azure.cosmosdb.consistency.level") + + // AzureCosmosDBOperationContactedRegionsKey is the attribute Key conforming to + // the "azure.cosmosdb.operation.contacted_regions" semantic conventions. It + // represents the list of regions contacted during operation in the order that + // they were contacted. If there is more than one region listed, it indicates + // that the operation was performed on multiple regions i.e. cross-regional + // call. + // + // Type: string[] + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: "North Central US", "Australia East", "Australia Southeast" + // Note: Region name matches the format of `displayName` in [Azure Location API] + // + // [Azure Location API]: https://learn.microsoft.com/rest/api/subscription/subscriptions/list-locations?view=rest-subscription-2021-10-01&tabs=HTTP#location + AzureCosmosDBOperationContactedRegionsKey = attribute.Key("azure.cosmosdb.operation.contacted_regions") + + // AzureCosmosDBOperationRequestChargeKey is the attribute Key conforming to the + // "azure.cosmosdb.operation.request_charge" semantic conventions. It represents + // the number of request units consumed by the operation. + // + // Type: double + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: 46.18, 1.0 + AzureCosmosDBOperationRequestChargeKey = attribute.Key("azure.cosmosdb.operation.request_charge") + + // AzureCosmosDBRequestBodySizeKey is the attribute Key conforming to the + // "azure.cosmosdb.request.body.size" semantic conventions. It represents the + // request payload size in bytes. + // + // Type: int + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: + AzureCosmosDBRequestBodySizeKey = attribute.Key("azure.cosmosdb.request.body.size") + + // AzureCosmosDBResponseSubStatusCodeKey is the attribute Key conforming to the + // "azure.cosmosdb.response.sub_status_code" semantic conventions. It represents + // the cosmos DB sub status code. + // + // Type: int + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: 1000, 1002 + AzureCosmosDBResponseSubStatusCodeKey = attribute.Key("azure.cosmosdb.response.sub_status_code") + + // AzureResourceProviderNamespaceKey is the attribute Key conforming to the + // "azure.resource_provider.namespace" semantic conventions. It represents the + // [Azure Resource Provider Namespace] as recognized by the client. + // + // Type: string + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: "Microsoft.Storage", "Microsoft.KeyVault", "Microsoft.ServiceBus" + // + // [Azure Resource Provider Namespace]: https://learn.microsoft.com/azure/azure-resource-manager/management/azure-services-resource-providers + AzureResourceProviderNamespaceKey = attribute.Key("azure.resource_provider.namespace") + + // AzureServiceRequestIDKey is the attribute Key conforming to the + // "azure.service.request.id" semantic conventions. It represents the unique + // identifier of the service request. It's generated by the Azure service and + // returned with the response. + // + // Type: string + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: "00000000-0000-0000-0000-000000000000" + AzureServiceRequestIDKey = attribute.Key("azure.service.request.id") +) + +// AzureClientID returns an attribute KeyValue conforming to the +// "azure.client.id" semantic conventions. It represents the unique identifier of +// the client instance. +func AzureClientID(val string) attribute.KeyValue { + return AzureClientIDKey.String(val) +} + +// AzureCosmosDBOperationContactedRegions returns an attribute KeyValue +// conforming to the "azure.cosmosdb.operation.contacted_regions" semantic +// conventions. It represents the list of regions contacted during operation in +// the order that they were contacted. If there is more than one region listed, +// it indicates that the operation was performed on multiple regions i.e. +// cross-regional call. +func AzureCosmosDBOperationContactedRegions(val ...string) attribute.KeyValue { + return AzureCosmosDBOperationContactedRegionsKey.StringSlice(val) +} + +// AzureCosmosDBOperationRequestCharge returns an attribute KeyValue conforming +// to the "azure.cosmosdb.operation.request_charge" semantic conventions. It +// represents the number of request units consumed by the operation. +func AzureCosmosDBOperationRequestCharge(val float64) attribute.KeyValue { + return AzureCosmosDBOperationRequestChargeKey.Float64(val) +} + +// AzureCosmosDBRequestBodySize returns an attribute KeyValue conforming to the +// "azure.cosmosdb.request.body.size" semantic conventions. It represents the +// request payload size in bytes. +func AzureCosmosDBRequestBodySize(val int) attribute.KeyValue { + return AzureCosmosDBRequestBodySizeKey.Int(val) +} + +// AzureCosmosDBResponseSubStatusCode returns an attribute KeyValue conforming to +// the "azure.cosmosdb.response.sub_status_code" semantic conventions. It +// represents the cosmos DB sub status code. +func AzureCosmosDBResponseSubStatusCode(val int) attribute.KeyValue { + return AzureCosmosDBResponseSubStatusCodeKey.Int(val) +} + +// AzureResourceProviderNamespace returns an attribute KeyValue conforming to the +// "azure.resource_provider.namespace" semantic conventions. It represents the +// [Azure Resource Provider Namespace] as recognized by the client. +// +// [Azure Resource Provider Namespace]: https://learn.microsoft.com/azure/azure-resource-manager/management/azure-services-resource-providers +func AzureResourceProviderNamespace(val string) attribute.KeyValue { + return AzureResourceProviderNamespaceKey.String(val) +} + +// AzureServiceRequestID returns an attribute KeyValue conforming to the +// "azure.service.request.id" semantic conventions. It represents the unique +// identifier of the service request. It's generated by the Azure service and +// returned with the response. +func AzureServiceRequestID(val string) attribute.KeyValue { + return AzureServiceRequestIDKey.String(val) +} + +// Enum values for azure.cosmosdb.connection.mode +var ( + // Gateway (HTTP) connection. + // Stability: development + AzureCosmosDBConnectionModeGateway = AzureCosmosDBConnectionModeKey.String("gateway") + // Direct connection. + // Stability: development + AzureCosmosDBConnectionModeDirect = AzureCosmosDBConnectionModeKey.String("direct") +) + +// Enum values for azure.cosmosdb.consistency.level +var ( + // Strong + // Stability: development + AzureCosmosDBConsistencyLevelStrong = AzureCosmosDBConsistencyLevelKey.String("Strong") + // Bounded Staleness + // Stability: development + AzureCosmosDBConsistencyLevelBoundedStaleness = AzureCosmosDBConsistencyLevelKey.String("BoundedStaleness") + // Session + // Stability: development + AzureCosmosDBConsistencyLevelSession = AzureCosmosDBConsistencyLevelKey.String("Session") + // Eventual + // Stability: development + AzureCosmosDBConsistencyLevelEventual = AzureCosmosDBConsistencyLevelKey.String("Eventual") + // Consistent Prefix + // Stability: development + AzureCosmosDBConsistencyLevelConsistentPrefix = AzureCosmosDBConsistencyLevelKey.String("ConsistentPrefix") +) + +// Namespace: browser +const ( + // BrowserBrandsKey is the attribute Key conforming to the "browser.brands" + // semantic conventions. It represents the array of brand name and version + // separated by a space. + // + // Type: string[] + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: " Not A;Brand 99", "Chromium 99", "Chrome 99" + // Note: This value is intended to be taken from the [UA client hints API] ( + // `navigator.userAgentData.brands`). + // + // [UA client hints API]: https://wicg.github.io/ua-client-hints/#interface + BrowserBrandsKey = attribute.Key("browser.brands") + + // BrowserLanguageKey is the attribute Key conforming to the "browser.language" + // semantic conventions. It represents the preferred language of the user using + // the browser. + // + // Type: string + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: "en", "en-US", "fr", "fr-FR" + // Note: This value is intended to be taken from the Navigator API + // `navigator.language`. + BrowserLanguageKey = attribute.Key("browser.language") + + // BrowserMobileKey is the attribute Key conforming to the "browser.mobile" + // semantic conventions. It represents a boolean that is true if the browser is + // running on a mobile device. + // + // Type: boolean + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: + // Note: This value is intended to be taken from the [UA client hints API] ( + // `navigator.userAgentData.mobile`). If unavailable, this attribute SHOULD be + // left unset. + // + // [UA client hints API]: https://wicg.github.io/ua-client-hints/#interface + BrowserMobileKey = attribute.Key("browser.mobile") + + // BrowserPlatformKey is the attribute Key conforming to the "browser.platform" + // semantic conventions. It represents the platform on which the browser is + // running. + // + // Type: string + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: "Windows", "macOS", "Android" + // Note: This value is intended to be taken from the [UA client hints API] ( + // `navigator.userAgentData.platform`). If unavailable, the legacy + // `navigator.platform` API SHOULD NOT be used instead and this attribute SHOULD + // be left unset in order for the values to be consistent. + // The list of possible values is defined in the + // [W3C User-Agent Client Hints specification]. Note that some (but not all) of + // these values can overlap with values in the + // [`os.type` and `os.name` attributes]. However, for consistency, the values in + // the `browser.platform` attribute should capture the exact value that the user + // agent provides. + // + // [UA client hints API]: https://wicg.github.io/ua-client-hints/#interface + // [W3C User-Agent Client Hints specification]: https://wicg.github.io/ua-client-hints/#sec-ch-ua-platform + // [`os.type` and `os.name` attributes]: ./os.md + BrowserPlatformKey = attribute.Key("browser.platform") +) + +// BrowserBrands returns an attribute KeyValue conforming to the "browser.brands" +// semantic conventions. It represents the array of brand name and version +// separated by a space. +func BrowserBrands(val ...string) attribute.KeyValue { + return BrowserBrandsKey.StringSlice(val) +} + +// BrowserLanguage returns an attribute KeyValue conforming to the +// "browser.language" semantic conventions. It represents the preferred language +// of the user using the browser. +func BrowserLanguage(val string) attribute.KeyValue { + return BrowserLanguageKey.String(val) +} + +// BrowserMobile returns an attribute KeyValue conforming to the "browser.mobile" +// semantic conventions. It represents a boolean that is true if the browser is +// running on a mobile device. +func BrowserMobile(val bool) attribute.KeyValue { + return BrowserMobileKey.Bool(val) +} + +// BrowserPlatform returns an attribute KeyValue conforming to the +// "browser.platform" semantic conventions. It represents the platform on which +// the browser is running. +func BrowserPlatform(val string) attribute.KeyValue { + return BrowserPlatformKey.String(val) +} + +// Namespace: cassandra +const ( + // CassandraConsistencyLevelKey is the attribute Key conforming to the + // "cassandra.consistency.level" semantic conventions. It represents the + // consistency level of the query. Based on consistency values from [CQL]. + // + // Type: Enum + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: + // + // [CQL]: https://docs.datastax.com/en/cassandra-oss/3.0/cassandra/dml/dmlConfigConsistency.html + CassandraConsistencyLevelKey = attribute.Key("cassandra.consistency.level") + + // CassandraCoordinatorDCKey is the attribute Key conforming to the + // "cassandra.coordinator.dc" semantic conventions. It represents the data + // center of the coordinating node for a query. + // + // Type: string + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: us-west-2 + CassandraCoordinatorDCKey = attribute.Key("cassandra.coordinator.dc") + + // CassandraCoordinatorIDKey is the attribute Key conforming to the + // "cassandra.coordinator.id" semantic conventions. It represents the ID of the + // coordinating node for a query. + // + // Type: string + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: be13faa2-8574-4d71-926d-27f16cf8a7af + CassandraCoordinatorIDKey = attribute.Key("cassandra.coordinator.id") + + // CassandraPageSizeKey is the attribute Key conforming to the + // "cassandra.page.size" semantic conventions. It represents the fetch size used + // for paging, i.e. how many rows will be returned at once. + // + // Type: int + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: 5000 + CassandraPageSizeKey = attribute.Key("cassandra.page.size") + + // CassandraQueryIdempotentKey is the attribute Key conforming to the + // "cassandra.query.idempotent" semantic conventions. It represents the whether + // or not the query is idempotent. + // + // Type: boolean + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: + CassandraQueryIdempotentKey = attribute.Key("cassandra.query.idempotent") + + // CassandraSpeculativeExecutionCountKey is the attribute Key conforming to the + // "cassandra.speculative_execution.count" semantic conventions. It represents + // the number of times a query was speculatively executed. Not set or `0` if the + // query was not executed speculatively. + // + // Type: int + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: 0, 2 + CassandraSpeculativeExecutionCountKey = attribute.Key("cassandra.speculative_execution.count") +) + +// CassandraCoordinatorDC returns an attribute KeyValue conforming to the +// "cassandra.coordinator.dc" semantic conventions. It represents the data center +// of the coordinating node for a query. +func CassandraCoordinatorDC(val string) attribute.KeyValue { + return CassandraCoordinatorDCKey.String(val) +} + +// CassandraCoordinatorID returns an attribute KeyValue conforming to the +// "cassandra.coordinator.id" semantic conventions. It represents the ID of the +// coordinating node for a query. +func CassandraCoordinatorID(val string) attribute.KeyValue { + return CassandraCoordinatorIDKey.String(val) +} + +// CassandraPageSize returns an attribute KeyValue conforming to the +// "cassandra.page.size" semantic conventions. It represents the fetch size used +// for paging, i.e. how many rows will be returned at once. +func CassandraPageSize(val int) attribute.KeyValue { + return CassandraPageSizeKey.Int(val) +} + +// CassandraQueryIdempotent returns an attribute KeyValue conforming to the +// "cassandra.query.idempotent" semantic conventions. It represents the whether +// or not the query is idempotent. +func CassandraQueryIdempotent(val bool) attribute.KeyValue { + return CassandraQueryIdempotentKey.Bool(val) +} + +// CassandraSpeculativeExecutionCount returns an attribute KeyValue conforming to +// the "cassandra.speculative_execution.count" semantic conventions. It +// represents the number of times a query was speculatively executed. Not set or +// `0` if the query was not executed speculatively. +func CassandraSpeculativeExecutionCount(val int) attribute.KeyValue { + return CassandraSpeculativeExecutionCountKey.Int(val) +} + +// Enum values for cassandra.consistency.level +var ( + // All + // Stability: development + CassandraConsistencyLevelAll = CassandraConsistencyLevelKey.String("all") + // Each Quorum + // Stability: development + CassandraConsistencyLevelEachQuorum = CassandraConsistencyLevelKey.String("each_quorum") + // Quorum + // Stability: development + CassandraConsistencyLevelQuorum = CassandraConsistencyLevelKey.String("quorum") + // Local Quorum + // Stability: development + CassandraConsistencyLevelLocalQuorum = CassandraConsistencyLevelKey.String("local_quorum") + // One + // Stability: development + CassandraConsistencyLevelOne = CassandraConsistencyLevelKey.String("one") + // Two + // Stability: development + CassandraConsistencyLevelTwo = CassandraConsistencyLevelKey.String("two") + // Three + // Stability: development + CassandraConsistencyLevelThree = CassandraConsistencyLevelKey.String("three") + // Local One + // Stability: development + CassandraConsistencyLevelLocalOne = CassandraConsistencyLevelKey.String("local_one") + // Any + // Stability: development + CassandraConsistencyLevelAny = CassandraConsistencyLevelKey.String("any") + // Serial + // Stability: development + CassandraConsistencyLevelSerial = CassandraConsistencyLevelKey.String("serial") + // Local Serial + // Stability: development + CassandraConsistencyLevelLocalSerial = CassandraConsistencyLevelKey.String("local_serial") +) + +// Namespace: cicd +const ( + // CICDPipelineActionNameKey is the attribute Key conforming to the + // "cicd.pipeline.action.name" semantic conventions. It represents the kind of + // action a pipeline run is performing. + // + // Type: Enum + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: "BUILD", "RUN", "SYNC" + CICDPipelineActionNameKey = attribute.Key("cicd.pipeline.action.name") + + // CICDPipelineNameKey is the attribute Key conforming to the + // "cicd.pipeline.name" semantic conventions. It represents the human readable + // name of the pipeline within a CI/CD system. + // + // Type: string + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: "Build and Test", "Lint", "Deploy Go Project", + // "deploy_to_environment" + CICDPipelineNameKey = attribute.Key("cicd.pipeline.name") + + // CICDPipelineResultKey is the attribute Key conforming to the + // "cicd.pipeline.result" semantic conventions. It represents the result of a + // pipeline run. + // + // Type: Enum + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: "success", "failure", "timeout", "skipped" + CICDPipelineResultKey = attribute.Key("cicd.pipeline.result") + + // CICDPipelineRunIDKey is the attribute Key conforming to the + // "cicd.pipeline.run.id" semantic conventions. It represents the unique + // identifier of a pipeline run within a CI/CD system. + // + // Type: string + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: "120912" + CICDPipelineRunIDKey = attribute.Key("cicd.pipeline.run.id") + + // CICDPipelineRunStateKey is the attribute Key conforming to the + // "cicd.pipeline.run.state" semantic conventions. It represents the pipeline + // run goes through these states during its lifecycle. + // + // Type: Enum + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: "pending", "executing", "finalizing" + CICDPipelineRunStateKey = attribute.Key("cicd.pipeline.run.state") + + // CICDPipelineRunURLFullKey is the attribute Key conforming to the + // "cicd.pipeline.run.url.full" semantic conventions. It represents the [URL] of + // the pipeline run, providing the complete address in order to locate and + // identify the pipeline run. + // + // Type: string + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: + // "https://github.com/open-telemetry/semantic-conventions/actions/runs/9753949763?pr=1075" + // + // [URL]: https://wikipedia.org/wiki/URL + CICDPipelineRunURLFullKey = attribute.Key("cicd.pipeline.run.url.full") + + // CICDPipelineTaskNameKey is the attribute Key conforming to the + // "cicd.pipeline.task.name" semantic conventions. It represents the human + // readable name of a task within a pipeline. Task here most closely aligns with + // a [computing process] in a pipeline. Other terms for tasks include commands, + // steps, and procedures. + // + // Type: string + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: "Run GoLang Linter", "Go Build", "go-test", "deploy_binary" + // + // [computing process]: https://wikipedia.org/wiki/Pipeline_(computing) + CICDPipelineTaskNameKey = attribute.Key("cicd.pipeline.task.name") + + // CICDPipelineTaskRunIDKey is the attribute Key conforming to the + // "cicd.pipeline.task.run.id" semantic conventions. It represents the unique + // identifier of a task run within a pipeline. + // + // Type: string + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: "12097" + CICDPipelineTaskRunIDKey = attribute.Key("cicd.pipeline.task.run.id") + + // CICDPipelineTaskRunResultKey is the attribute Key conforming to the + // "cicd.pipeline.task.run.result" semantic conventions. It represents the + // result of a task run. + // + // Type: Enum + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: "success", "failure", "timeout", "skipped" + CICDPipelineTaskRunResultKey = attribute.Key("cicd.pipeline.task.run.result") + + // CICDPipelineTaskRunURLFullKey is the attribute Key conforming to the + // "cicd.pipeline.task.run.url.full" semantic conventions. It represents the + // [URL] of the pipeline task run, providing the complete address in order to + // locate and identify the pipeline task run. + // + // Type: string + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: + // "https://github.com/open-telemetry/semantic-conventions/actions/runs/9753949763/job/26920038674?pr=1075" + // + // [URL]: https://wikipedia.org/wiki/URL + CICDPipelineTaskRunURLFullKey = attribute.Key("cicd.pipeline.task.run.url.full") + + // CICDPipelineTaskTypeKey is the attribute Key conforming to the + // "cicd.pipeline.task.type" semantic conventions. It represents the type of the + // task within a pipeline. + // + // Type: Enum + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: "build", "test", "deploy" + CICDPipelineTaskTypeKey = attribute.Key("cicd.pipeline.task.type") + + // CICDSystemComponentKey is the attribute Key conforming to the + // "cicd.system.component" semantic conventions. It represents the name of a + // component of the CICD system. + // + // Type: string + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: "controller", "scheduler", "agent" + CICDSystemComponentKey = attribute.Key("cicd.system.component") + + // CICDWorkerIDKey is the attribute Key conforming to the "cicd.worker.id" + // semantic conventions. It represents the unique identifier of a worker within + // a CICD system. + // + // Type: string + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: "abc123", "10.0.1.2", "controller" + CICDWorkerIDKey = attribute.Key("cicd.worker.id") + + // CICDWorkerNameKey is the attribute Key conforming to the "cicd.worker.name" + // semantic conventions. It represents the name of a worker within a CICD + // system. + // + // Type: string + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: "agent-abc", "controller", "Ubuntu LTS" + CICDWorkerNameKey = attribute.Key("cicd.worker.name") + + // CICDWorkerStateKey is the attribute Key conforming to the "cicd.worker.state" + // semantic conventions. It represents the state of a CICD worker / agent. + // + // Type: Enum + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: "idle", "busy", "down" + CICDWorkerStateKey = attribute.Key("cicd.worker.state") + + // CICDWorkerURLFullKey is the attribute Key conforming to the + // "cicd.worker.url.full" semantic conventions. It represents the [URL] of the + // worker, providing the complete address in order to locate and identify the + // worker. + // + // Type: string + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: "https://cicd.example.org/worker/abc123" + // + // [URL]: https://wikipedia.org/wiki/URL + CICDWorkerURLFullKey = attribute.Key("cicd.worker.url.full") +) + +// CICDPipelineName returns an attribute KeyValue conforming to the +// "cicd.pipeline.name" semantic conventions. It represents the human readable +// name of the pipeline within a CI/CD system. +func CICDPipelineName(val string) attribute.KeyValue { + return CICDPipelineNameKey.String(val) +} + +// CICDPipelineRunID returns an attribute KeyValue conforming to the +// "cicd.pipeline.run.id" semantic conventions. It represents the unique +// identifier of a pipeline run within a CI/CD system. +func CICDPipelineRunID(val string) attribute.KeyValue { + return CICDPipelineRunIDKey.String(val) +} + +// CICDPipelineRunURLFull returns an attribute KeyValue conforming to the +// "cicd.pipeline.run.url.full" semantic conventions. It represents the [URL] of +// the pipeline run, providing the complete address in order to locate and +// identify the pipeline run. +// +// [URL]: https://wikipedia.org/wiki/URL +func CICDPipelineRunURLFull(val string) attribute.KeyValue { + return CICDPipelineRunURLFullKey.String(val) +} + +// CICDPipelineTaskName returns an attribute KeyValue conforming to the +// "cicd.pipeline.task.name" semantic conventions. It represents the human +// readable name of a task within a pipeline. Task here most closely aligns with +// a [computing process] in a pipeline. Other terms for tasks include commands, +// steps, and procedures. +// +// [computing process]: https://wikipedia.org/wiki/Pipeline_(computing) +func CICDPipelineTaskName(val string) attribute.KeyValue { + return CICDPipelineTaskNameKey.String(val) +} + +// CICDPipelineTaskRunID returns an attribute KeyValue conforming to the +// "cicd.pipeline.task.run.id" semantic conventions. It represents the unique +// identifier of a task run within a pipeline. +func CICDPipelineTaskRunID(val string) attribute.KeyValue { + return CICDPipelineTaskRunIDKey.String(val) +} + +// CICDPipelineTaskRunURLFull returns an attribute KeyValue conforming to the +// "cicd.pipeline.task.run.url.full" semantic conventions. It represents the +// [URL] of the pipeline task run, providing the complete address in order to +// locate and identify the pipeline task run. +// +// [URL]: https://wikipedia.org/wiki/URL +func CICDPipelineTaskRunURLFull(val string) attribute.KeyValue { + return CICDPipelineTaskRunURLFullKey.String(val) +} + +// CICDSystemComponent returns an attribute KeyValue conforming to the +// "cicd.system.component" semantic conventions. It represents the name of a +// component of the CICD system. +func CICDSystemComponent(val string) attribute.KeyValue { + return CICDSystemComponentKey.String(val) +} + +// CICDWorkerID returns an attribute KeyValue conforming to the "cicd.worker.id" +// semantic conventions. It represents the unique identifier of a worker within a +// CICD system. +func CICDWorkerID(val string) attribute.KeyValue { + return CICDWorkerIDKey.String(val) +} + +// CICDWorkerName returns an attribute KeyValue conforming to the +// "cicd.worker.name" semantic conventions. It represents the name of a worker +// within a CICD system. +func CICDWorkerName(val string) attribute.KeyValue { + return CICDWorkerNameKey.String(val) +} + +// CICDWorkerURLFull returns an attribute KeyValue conforming to the +// "cicd.worker.url.full" semantic conventions. It represents the [URL] of the +// worker, providing the complete address in order to locate and identify the +// worker. +// +// [URL]: https://wikipedia.org/wiki/URL +func CICDWorkerURLFull(val string) attribute.KeyValue { + return CICDWorkerURLFullKey.String(val) +} + +// Enum values for cicd.pipeline.action.name +var ( + // The pipeline run is executing a build. + // Stability: development + CICDPipelineActionNameBuild = CICDPipelineActionNameKey.String("BUILD") + // The pipeline run is executing. + // Stability: development + CICDPipelineActionNameRun = CICDPipelineActionNameKey.String("RUN") + // The pipeline run is executing a sync. + // Stability: development + CICDPipelineActionNameSync = CICDPipelineActionNameKey.String("SYNC") +) + +// Enum values for cicd.pipeline.result +var ( + // The pipeline run finished successfully. + // Stability: development + CICDPipelineResultSuccess = CICDPipelineResultKey.String("success") + // The pipeline run did not finish successfully, eg. due to a compile error or a + // failing test. Such failures are usually detected by non-zero exit codes of + // the tools executed in the pipeline run. + // Stability: development + CICDPipelineResultFailure = CICDPipelineResultKey.String("failure") + // The pipeline run failed due to an error in the CICD system, eg. due to the + // worker being killed. + // Stability: development + CICDPipelineResultError = CICDPipelineResultKey.String("error") + // A timeout caused the pipeline run to be interrupted. + // Stability: development + CICDPipelineResultTimeout = CICDPipelineResultKey.String("timeout") + // The pipeline run was cancelled, eg. by a user manually cancelling the + // pipeline run. + // Stability: development + CICDPipelineResultCancellation = CICDPipelineResultKey.String("cancellation") + // The pipeline run was skipped, eg. due to a precondition not being met. + // Stability: development + CICDPipelineResultSkip = CICDPipelineResultKey.String("skip") +) + +// Enum values for cicd.pipeline.run.state +var ( + // The run pending state spans from the event triggering the pipeline run until + // the execution of the run starts (eg. time spent in a queue, provisioning + // agents, creating run resources). + // + // Stability: development + CICDPipelineRunStatePending = CICDPipelineRunStateKey.String("pending") + // The executing state spans the execution of any run tasks (eg. build, test). + // Stability: development + CICDPipelineRunStateExecuting = CICDPipelineRunStateKey.String("executing") + // The finalizing state spans from when the run has finished executing (eg. + // cleanup of run resources). + // Stability: development + CICDPipelineRunStateFinalizing = CICDPipelineRunStateKey.String("finalizing") +) + +// Enum values for cicd.pipeline.task.run.result +var ( + // The task run finished successfully. + // Stability: development + CICDPipelineTaskRunResultSuccess = CICDPipelineTaskRunResultKey.String("success") + // The task run did not finish successfully, eg. due to a compile error or a + // failing test. Such failures are usually detected by non-zero exit codes of + // the tools executed in the task run. + // Stability: development + CICDPipelineTaskRunResultFailure = CICDPipelineTaskRunResultKey.String("failure") + // The task run failed due to an error in the CICD system, eg. due to the worker + // being killed. + // Stability: development + CICDPipelineTaskRunResultError = CICDPipelineTaskRunResultKey.String("error") + // A timeout caused the task run to be interrupted. + // Stability: development + CICDPipelineTaskRunResultTimeout = CICDPipelineTaskRunResultKey.String("timeout") + // The task run was cancelled, eg. by a user manually cancelling the task run. + // Stability: development + CICDPipelineTaskRunResultCancellation = CICDPipelineTaskRunResultKey.String("cancellation") + // The task run was skipped, eg. due to a precondition not being met. + // Stability: development + CICDPipelineTaskRunResultSkip = CICDPipelineTaskRunResultKey.String("skip") +) + +// Enum values for cicd.pipeline.task.type +var ( + // build + // Stability: development + CICDPipelineTaskTypeBuild = CICDPipelineTaskTypeKey.String("build") + // test + // Stability: development + CICDPipelineTaskTypeTest = CICDPipelineTaskTypeKey.String("test") + // deploy + // Stability: development + CICDPipelineTaskTypeDeploy = CICDPipelineTaskTypeKey.String("deploy") +) + +// Enum values for cicd.worker.state +var ( + // The worker is not performing work for the CICD system. It is available to the + // CICD system to perform work on (online / idle). + // Stability: development + CICDWorkerStateAvailable = CICDWorkerStateKey.String("available") + // The worker is performing work for the CICD system. + // Stability: development + CICDWorkerStateBusy = CICDWorkerStateKey.String("busy") + // The worker is not available to the CICD system (disconnected / down). + // Stability: development + CICDWorkerStateOffline = CICDWorkerStateKey.String("offline") +) + +// Namespace: client +const ( + // ClientAddressKey is the attribute Key conforming to the "client.address" + // semantic conventions. It represents the client address - domain name if + // available without reverse DNS lookup; otherwise, IP address or Unix domain + // socket name. + // + // Type: string + // RequirementLevel: Recommended + // Stability: Stable + // + // Examples: "client.example.com", "10.1.2.80", "/tmp/my.sock" + // Note: When observed from the server side, and when communicating through an + // intermediary, `client.address` SHOULD represent the client address behind any + // intermediaries, for example proxies, if it's available. + ClientAddressKey = attribute.Key("client.address") + + // ClientPortKey is the attribute Key conforming to the "client.port" semantic + // conventions. It represents the client port number. + // + // Type: int + // RequirementLevel: Recommended + // Stability: Stable + // + // Examples: 65123 + // Note: When observed from the server side, and when communicating through an + // intermediary, `client.port` SHOULD represent the client port behind any + // intermediaries, for example proxies, if it's available. + ClientPortKey = attribute.Key("client.port") +) + +// ClientAddress returns an attribute KeyValue conforming to the "client.address" +// semantic conventions. It represents the client address - domain name if +// available without reverse DNS lookup; otherwise, IP address or Unix domain +// socket name. +func ClientAddress(val string) attribute.KeyValue { + return ClientAddressKey.String(val) +} + +// ClientPort returns an attribute KeyValue conforming to the "client.port" +// semantic conventions. It represents the client port number. +func ClientPort(val int) attribute.KeyValue { + return ClientPortKey.Int(val) +} + +// Namespace: cloud +const ( + // CloudAccountIDKey is the attribute Key conforming to the "cloud.account.id" + // semantic conventions. It represents the cloud account ID the resource is + // assigned to. + // + // Type: string + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: "111111111111", "opentelemetry" + CloudAccountIDKey = attribute.Key("cloud.account.id") + + // CloudAvailabilityZoneKey is the attribute Key conforming to the + // "cloud.availability_zone" semantic conventions. It represents the cloud + // regions often have multiple, isolated locations known as zones to increase + // availability. Availability zone represents the zone where the resource is + // running. + // + // Type: string + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: "us-east-1c" + // Note: Availability zones are called "zones" on Alibaba Cloud and Google + // Cloud. + CloudAvailabilityZoneKey = attribute.Key("cloud.availability_zone") + + // CloudPlatformKey is the attribute Key conforming to the "cloud.platform" + // semantic conventions. It represents the cloud platform in use. + // + // Type: Enum + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: + // Note: The prefix of the service SHOULD match the one specified in + // `cloud.provider`. + CloudPlatformKey = attribute.Key("cloud.platform") + + // CloudProviderKey is the attribute Key conforming to the "cloud.provider" + // semantic conventions. It represents the name of the cloud provider. + // + // Type: Enum + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: + CloudProviderKey = attribute.Key("cloud.provider") + + // CloudRegionKey is the attribute Key conforming to the "cloud.region" semantic + // conventions. It represents the geographical region within a cloud provider. + // When associated with a resource, this attribute specifies the region where + // the resource operates. When calling services or APIs deployed on a cloud, + // this attribute identifies the region where the called destination is + // deployed. + // + // Type: string + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: "us-central1", "us-east-1" + // Note: Refer to your provider's docs to see the available regions, for example + // [Alibaba Cloud regions], [AWS regions], [Azure regions], + // [Google Cloud regions], or [Tencent Cloud regions]. + // + // [Alibaba Cloud regions]: https://www.alibabacloud.com/help/doc-detail/40654.htm + // [AWS regions]: https://aws.amazon.com/about-aws/global-infrastructure/regions_az/ + // [Azure regions]: https://azure.microsoft.com/global-infrastructure/geographies/ + // [Google Cloud regions]: https://cloud.google.com/about/locations + // [Tencent Cloud regions]: https://www.tencentcloud.com/document/product/213/6091 + CloudRegionKey = attribute.Key("cloud.region") + + // CloudResourceIDKey is the attribute Key conforming to the "cloud.resource_id" + // semantic conventions. It represents the cloud provider-specific native + // identifier of the monitored cloud resource (e.g. an [ARN] on AWS, a + // [fully qualified resource ID] on Azure, a [full resource name] on GCP). + // + // Type: string + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: "arn:aws:lambda:REGION:ACCOUNT_ID:function:my-function", + // "//run.googleapis.com/projects/PROJECT_ID/locations/LOCATION_ID/services/SERVICE_ID", + // "/subscriptions//resourceGroups/ + // /providers/Microsoft.Web/sites//functions/" + // Note: On some cloud providers, it may not be possible to determine the full + // ID at startup, + // so it may be necessary to set `cloud.resource_id` as a span attribute + // instead. + // + // The exact value to use for `cloud.resource_id` depends on the cloud provider. + // The following well-known definitions MUST be used if you set this attribute + // and they apply: + // + // - **AWS Lambda:** The function [ARN]. + // Take care not to use the "invoked ARN" directly but replace any + // [alias suffix] + // with the resolved function version, as the same runtime instance may be + // invocable with + // multiple different aliases. + // - **GCP:** The [URI of the resource] + // - **Azure:** The [Fully Qualified Resource ID] of the invoked function, + // *not* the function app, having the form + // + // `/subscriptions//resourceGroups//providers/Microsoft.Web/sites//functions/` + // . + // This means that a span attribute MUST be used, as an Azure function app + // can host multiple functions that would usually share + // a TracerProvider. + // + // + // [ARN]: https://docs.aws.amazon.com/general/latest/gr/aws-arns-and-namespaces.html + // [fully qualified resource ID]: https://learn.microsoft.com/rest/api/resources/resources/get-by-id + // [full resource name]: https://google.aip.dev/122#full-resource-names + // [ARN]: https://docs.aws.amazon.com/general/latest/gr/aws-arns-and-namespaces.html + // [alias suffix]: https://docs.aws.amazon.com/lambda/latest/dg/configuration-aliases.html + // [URI of the resource]: https://cloud.google.com/iam/docs/full-resource-names + // [Fully Qualified Resource ID]: https://learn.microsoft.com/rest/api/resources/resources/get-by-id + CloudResourceIDKey = attribute.Key("cloud.resource_id") +) + +// CloudAccountID returns an attribute KeyValue conforming to the +// "cloud.account.id" semantic conventions. It represents the cloud account ID +// the resource is assigned to. +func CloudAccountID(val string) attribute.KeyValue { + return CloudAccountIDKey.String(val) +} + +// CloudAvailabilityZone returns an attribute KeyValue conforming to the +// "cloud.availability_zone" semantic conventions. It represents the cloud +// regions often have multiple, isolated locations known as zones to increase +// availability. Availability zone represents the zone where the resource is +// running. +func CloudAvailabilityZone(val string) attribute.KeyValue { + return CloudAvailabilityZoneKey.String(val) +} + +// CloudRegion returns an attribute KeyValue conforming to the "cloud.region" +// semantic conventions. It represents the geographical region within a cloud +// provider. When associated with a resource, this attribute specifies the region +// where the resource operates. When calling services or APIs deployed on a +// cloud, this attribute identifies the region where the called destination is +// deployed. +func CloudRegion(val string) attribute.KeyValue { + return CloudRegionKey.String(val) +} + +// CloudResourceID returns an attribute KeyValue conforming to the +// "cloud.resource_id" semantic conventions. It represents the cloud +// provider-specific native identifier of the monitored cloud resource (e.g. an +// [ARN] on AWS, a [fully qualified resource ID] on Azure, a [full resource name] +// on GCP). +// +// [ARN]: https://docs.aws.amazon.com/general/latest/gr/aws-arns-and-namespaces.html +// [fully qualified resource ID]: https://learn.microsoft.com/rest/api/resources/resources/get-by-id +// [full resource name]: https://google.aip.dev/122#full-resource-names +func CloudResourceID(val string) attribute.KeyValue { + return CloudResourceIDKey.String(val) +} + +// Enum values for cloud.platform +var ( + // Alibaba Cloud Elastic Compute Service + // Stability: development + CloudPlatformAlibabaCloudECS = CloudPlatformKey.String("alibaba_cloud_ecs") + // Alibaba Cloud Function Compute + // Stability: development + CloudPlatformAlibabaCloudFC = CloudPlatformKey.String("alibaba_cloud_fc") + // Red Hat OpenShift on Alibaba Cloud + // Stability: development + CloudPlatformAlibabaCloudOpenShift = CloudPlatformKey.String("alibaba_cloud_openshift") + // AWS Elastic Compute Cloud + // Stability: development + CloudPlatformAWSEC2 = CloudPlatformKey.String("aws_ec2") + // AWS Elastic Container Service + // Stability: development + CloudPlatformAWSECS = CloudPlatformKey.String("aws_ecs") + // AWS Elastic Kubernetes Service + // Stability: development + CloudPlatformAWSEKS = CloudPlatformKey.String("aws_eks") + // AWS Lambda + // Stability: development + CloudPlatformAWSLambda = CloudPlatformKey.String("aws_lambda") + // AWS Elastic Beanstalk + // Stability: development + CloudPlatformAWSElasticBeanstalk = CloudPlatformKey.String("aws_elastic_beanstalk") + // AWS App Runner + // Stability: development + CloudPlatformAWSAppRunner = CloudPlatformKey.String("aws_app_runner") + // Red Hat OpenShift on AWS (ROSA) + // Stability: development + CloudPlatformAWSOpenShift = CloudPlatformKey.String("aws_openshift") + // Azure Virtual Machines + // Stability: development + CloudPlatformAzureVM = CloudPlatformKey.String("azure.vm") + // Azure Container Apps + // Stability: development + CloudPlatformAzureContainerApps = CloudPlatformKey.String("azure.container_apps") + // Azure Container Instances + // Stability: development + CloudPlatformAzureContainerInstances = CloudPlatformKey.String("azure.container_instances") + // Azure Kubernetes Service + // Stability: development + CloudPlatformAzureAKS = CloudPlatformKey.String("azure.aks") + // Azure Functions + // Stability: development + CloudPlatformAzureFunctions = CloudPlatformKey.String("azure.functions") + // Azure App Service + // Stability: development + CloudPlatformAzureAppService = CloudPlatformKey.String("azure.app_service") + // Azure Red Hat OpenShift + // Stability: development + CloudPlatformAzureOpenShift = CloudPlatformKey.String("azure.openshift") + // Google Bare Metal Solution (BMS) + // Stability: development + CloudPlatformGCPBareMetalSolution = CloudPlatformKey.String("gcp_bare_metal_solution") + // Google Cloud Compute Engine (GCE) + // Stability: development + CloudPlatformGCPComputeEngine = CloudPlatformKey.String("gcp_compute_engine") + // Google Cloud Run + // Stability: development + CloudPlatformGCPCloudRun = CloudPlatformKey.String("gcp_cloud_run") + // Google Cloud Kubernetes Engine (GKE) + // Stability: development + CloudPlatformGCPKubernetesEngine = CloudPlatformKey.String("gcp_kubernetes_engine") + // Google Cloud Functions (GCF) + // Stability: development + CloudPlatformGCPCloudFunctions = CloudPlatformKey.String("gcp_cloud_functions") + // Google Cloud App Engine (GAE) + // Stability: development + CloudPlatformGCPAppEngine = CloudPlatformKey.String("gcp_app_engine") + // Red Hat OpenShift on Google Cloud + // Stability: development + CloudPlatformGCPOpenShift = CloudPlatformKey.String("gcp_openshift") + // Red Hat OpenShift on IBM Cloud + // Stability: development + CloudPlatformIBMCloudOpenShift = CloudPlatformKey.String("ibm_cloud_openshift") + // Compute on Oracle Cloud Infrastructure (OCI) + // Stability: development + CloudPlatformOracleCloudCompute = CloudPlatformKey.String("oracle_cloud_compute") + // Kubernetes Engine (OKE) on Oracle Cloud Infrastructure (OCI) + // Stability: development + CloudPlatformOracleCloudOKE = CloudPlatformKey.String("oracle_cloud_oke") + // Tencent Cloud Cloud Virtual Machine (CVM) + // Stability: development + CloudPlatformTencentCloudCVM = CloudPlatformKey.String("tencent_cloud_cvm") + // Tencent Cloud Elastic Kubernetes Service (EKS) + // Stability: development + CloudPlatformTencentCloudEKS = CloudPlatformKey.String("tencent_cloud_eks") + // Tencent Cloud Serverless Cloud Function (SCF) + // Stability: development + CloudPlatformTencentCloudSCF = CloudPlatformKey.String("tencent_cloud_scf") +) + +// Enum values for cloud.provider +var ( + // Alibaba Cloud + // Stability: development + CloudProviderAlibabaCloud = CloudProviderKey.String("alibaba_cloud") + // Amazon Web Services + // Stability: development + CloudProviderAWS = CloudProviderKey.String("aws") + // Microsoft Azure + // Stability: development + CloudProviderAzure = CloudProviderKey.String("azure") + // Google Cloud Platform + // Stability: development + CloudProviderGCP = CloudProviderKey.String("gcp") + // Heroku Platform as a Service + // Stability: development + CloudProviderHeroku = CloudProviderKey.String("heroku") + // IBM Cloud + // Stability: development + CloudProviderIBMCloud = CloudProviderKey.String("ibm_cloud") + // Oracle Cloud Infrastructure (OCI) + // Stability: development + CloudProviderOracleCloud = CloudProviderKey.String("oracle_cloud") + // Tencent Cloud + // Stability: development + CloudProviderTencentCloud = CloudProviderKey.String("tencent_cloud") +) + +// Namespace: cloudevents +const ( + // CloudEventsEventIDKey is the attribute Key conforming to the + // "cloudevents.event_id" semantic conventions. It represents the [event_id] + // uniquely identifies the event. + // + // Type: string + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: "123e4567-e89b-12d3-a456-426614174000", "0001" + // + // [event_id]: https://github.com/cloudevents/spec/blob/v1.0.2/cloudevents/spec.md#id + CloudEventsEventIDKey = attribute.Key("cloudevents.event_id") + + // CloudEventsEventSourceKey is the attribute Key conforming to the + // "cloudevents.event_source" semantic conventions. It represents the [source] + // identifies the context in which an event happened. + // + // Type: string + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: "https://github.com/cloudevents", "/cloudevents/spec/pull/123", + // "my-service" + // + // [source]: https://github.com/cloudevents/spec/blob/v1.0.2/cloudevents/spec.md#source-1 + CloudEventsEventSourceKey = attribute.Key("cloudevents.event_source") + + // CloudEventsEventSpecVersionKey is the attribute Key conforming to the + // "cloudevents.event_spec_version" semantic conventions. It represents the + // [version of the CloudEvents specification] which the event uses. + // + // Type: string + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: 1.0 + // + // [version of the CloudEvents specification]: https://github.com/cloudevents/spec/blob/v1.0.2/cloudevents/spec.md#specversion + CloudEventsEventSpecVersionKey = attribute.Key("cloudevents.event_spec_version") + + // CloudEventsEventSubjectKey is the attribute Key conforming to the + // "cloudevents.event_subject" semantic conventions. It represents the [subject] + // of the event in the context of the event producer (identified by source). + // + // Type: string + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: mynewfile.jpg + // + // [subject]: https://github.com/cloudevents/spec/blob/v1.0.2/cloudevents/spec.md#subject + CloudEventsEventSubjectKey = attribute.Key("cloudevents.event_subject") + + // CloudEventsEventTypeKey is the attribute Key conforming to the + // "cloudevents.event_type" semantic conventions. It represents the [event_type] + // contains a value describing the type of event related to the originating + // occurrence. + // + // Type: string + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: "com.github.pull_request.opened", "com.example.object.deleted.v2" + // + // [event_type]: https://github.com/cloudevents/spec/blob/v1.0.2/cloudevents/spec.md#type + CloudEventsEventTypeKey = attribute.Key("cloudevents.event_type") +) + +// CloudEventsEventID returns an attribute KeyValue conforming to the +// "cloudevents.event_id" semantic conventions. It represents the [event_id] +// uniquely identifies the event. +// +// [event_id]: https://github.com/cloudevents/spec/blob/v1.0.2/cloudevents/spec.md#id +func CloudEventsEventID(val string) attribute.KeyValue { + return CloudEventsEventIDKey.String(val) +} + +// CloudEventsEventSource returns an attribute KeyValue conforming to the +// "cloudevents.event_source" semantic conventions. It represents the [source] +// identifies the context in which an event happened. +// +// [source]: https://github.com/cloudevents/spec/blob/v1.0.2/cloudevents/spec.md#source-1 +func CloudEventsEventSource(val string) attribute.KeyValue { + return CloudEventsEventSourceKey.String(val) +} + +// CloudEventsEventSpecVersion returns an attribute KeyValue conforming to the +// "cloudevents.event_spec_version" semantic conventions. It represents the +// [version of the CloudEvents specification] which the event uses. +// +// [version of the CloudEvents specification]: https://github.com/cloudevents/spec/blob/v1.0.2/cloudevents/spec.md#specversion +func CloudEventsEventSpecVersion(val string) attribute.KeyValue { + return CloudEventsEventSpecVersionKey.String(val) +} + +// CloudEventsEventSubject returns an attribute KeyValue conforming to the +// "cloudevents.event_subject" semantic conventions. It represents the [subject] +// of the event in the context of the event producer (identified by source). +// +// [subject]: https://github.com/cloudevents/spec/blob/v1.0.2/cloudevents/spec.md#subject +func CloudEventsEventSubject(val string) attribute.KeyValue { + return CloudEventsEventSubjectKey.String(val) +} + +// CloudEventsEventType returns an attribute KeyValue conforming to the +// "cloudevents.event_type" semantic conventions. It represents the [event_type] +// contains a value describing the type of event related to the originating +// occurrence. +// +// [event_type]: https://github.com/cloudevents/spec/blob/v1.0.2/cloudevents/spec.md#type +func CloudEventsEventType(val string) attribute.KeyValue { + return CloudEventsEventTypeKey.String(val) +} + +// Namespace: cloudfoundry +const ( + // CloudFoundryAppIDKey is the attribute Key conforming to the + // "cloudfoundry.app.id" semantic conventions. It represents the guid of the + // application. + // + // Type: string + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: "218fc5a9-a5f1-4b54-aa05-46717d0ab26d" + // Note: Application instrumentation should use the value from environment + // variable `VCAP_APPLICATION.application_id`. This is the same value as + // reported by `cf app --guid`. + CloudFoundryAppIDKey = attribute.Key("cloudfoundry.app.id") + + // CloudFoundryAppInstanceIDKey is the attribute Key conforming to the + // "cloudfoundry.app.instance.id" semantic conventions. It represents the index + // of the application instance. 0 when just one instance is active. + // + // Type: string + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: "0", "1" + // Note: CloudFoundry defines the `instance_id` in the [Loggregator v2 envelope] + // . + // It is used for logs and metrics emitted by CloudFoundry. It is + // supposed to contain the application instance index for applications + // deployed on the runtime. + // + // Application instrumentation should use the value from environment + // variable `CF_INSTANCE_INDEX`. + // + // [Loggregator v2 envelope]: https://github.com/cloudfoundry/loggregator-api#v2-envelope + CloudFoundryAppInstanceIDKey = attribute.Key("cloudfoundry.app.instance.id") + + // CloudFoundryAppNameKey is the attribute Key conforming to the + // "cloudfoundry.app.name" semantic conventions. It represents the name of the + // application. + // + // Type: string + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: "my-app-name" + // Note: Application instrumentation should use the value from environment + // variable `VCAP_APPLICATION.application_name`. This is the same value + // as reported by `cf apps`. + CloudFoundryAppNameKey = attribute.Key("cloudfoundry.app.name") + + // CloudFoundryOrgIDKey is the attribute Key conforming to the + // "cloudfoundry.org.id" semantic conventions. It represents the guid of the + // CloudFoundry org the application is running in. + // + // Type: string + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: "218fc5a9-a5f1-4b54-aa05-46717d0ab26d" + // Note: Application instrumentation should use the value from environment + // variable `VCAP_APPLICATION.org_id`. This is the same value as + // reported by `cf org --guid`. + CloudFoundryOrgIDKey = attribute.Key("cloudfoundry.org.id") + + // CloudFoundryOrgNameKey is the attribute Key conforming to the + // "cloudfoundry.org.name" semantic conventions. It represents the name of the + // CloudFoundry organization the app is running in. + // + // Type: string + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: "my-org-name" + // Note: Application instrumentation should use the value from environment + // variable `VCAP_APPLICATION.org_name`. This is the same value as + // reported by `cf orgs`. + CloudFoundryOrgNameKey = attribute.Key("cloudfoundry.org.name") + + // CloudFoundryProcessIDKey is the attribute Key conforming to the + // "cloudfoundry.process.id" semantic conventions. It represents the UID + // identifying the process. + // + // Type: string + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: "218fc5a9-a5f1-4b54-aa05-46717d0ab26d" + // Note: Application instrumentation should use the value from environment + // variable `VCAP_APPLICATION.process_id`. It is supposed to be equal to + // `VCAP_APPLICATION.app_id` for applications deployed to the runtime. + // For system components, this could be the actual PID. + CloudFoundryProcessIDKey = attribute.Key("cloudfoundry.process.id") + + // CloudFoundryProcessTypeKey is the attribute Key conforming to the + // "cloudfoundry.process.type" semantic conventions. It represents the type of + // process. + // + // Type: string + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: "web" + // Note: CloudFoundry applications can consist of multiple jobs. Usually the + // main process will be of type `web`. There can be additional background + // tasks or side-cars with different process types. + CloudFoundryProcessTypeKey = attribute.Key("cloudfoundry.process.type") + + // CloudFoundrySpaceIDKey is the attribute Key conforming to the + // "cloudfoundry.space.id" semantic conventions. It represents the guid of the + // CloudFoundry space the application is running in. + // + // Type: string + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: "218fc5a9-a5f1-4b54-aa05-46717d0ab26d" + // Note: Application instrumentation should use the value from environment + // variable `VCAP_APPLICATION.space_id`. This is the same value as + // reported by `cf space --guid`. + CloudFoundrySpaceIDKey = attribute.Key("cloudfoundry.space.id") + + // CloudFoundrySpaceNameKey is the attribute Key conforming to the + // "cloudfoundry.space.name" semantic conventions. It represents the name of the + // CloudFoundry space the application is running in. + // + // Type: string + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: "my-space-name" + // Note: Application instrumentation should use the value from environment + // variable `VCAP_APPLICATION.space_name`. This is the same value as + // reported by `cf spaces`. + CloudFoundrySpaceNameKey = attribute.Key("cloudfoundry.space.name") + + // CloudFoundrySystemIDKey is the attribute Key conforming to the + // "cloudfoundry.system.id" semantic conventions. It represents a guid or + // another name describing the event source. + // + // Type: string + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: "cf/gorouter" + // Note: CloudFoundry defines the `source_id` in the [Loggregator v2 envelope]. + // It is used for logs and metrics emitted by CloudFoundry. It is + // supposed to contain the component name, e.g. "gorouter", for + // CloudFoundry components. + // + // When system components are instrumented, values from the + // [Bosh spec] + // should be used. The `system.id` should be set to + // `spec.deployment/spec.name`. + // + // [Loggregator v2 envelope]: https://github.com/cloudfoundry/loggregator-api#v2-envelope + // [Bosh spec]: https://bosh.io/docs/jobs/#properties-spec + CloudFoundrySystemIDKey = attribute.Key("cloudfoundry.system.id") + + // CloudFoundrySystemInstanceIDKey is the attribute Key conforming to the + // "cloudfoundry.system.instance.id" semantic conventions. It represents a guid + // describing the concrete instance of the event source. + // + // Type: string + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: "218fc5a9-a5f1-4b54-aa05-46717d0ab26d" + // Note: CloudFoundry defines the `instance_id` in the [Loggregator v2 envelope] + // . + // It is used for logs and metrics emitted by CloudFoundry. It is + // supposed to contain the vm id for CloudFoundry components. + // + // When system components are instrumented, values from the + // [Bosh spec] + // should be used. The `system.instance.id` should be set to `spec.id`. + // + // [Loggregator v2 envelope]: https://github.com/cloudfoundry/loggregator-api#v2-envelope + // [Bosh spec]: https://bosh.io/docs/jobs/#properties-spec + CloudFoundrySystemInstanceIDKey = attribute.Key("cloudfoundry.system.instance.id") +) + +// CloudFoundryAppID returns an attribute KeyValue conforming to the +// "cloudfoundry.app.id" semantic conventions. It represents the guid of the +// application. +func CloudFoundryAppID(val string) attribute.KeyValue { + return CloudFoundryAppIDKey.String(val) +} + +// CloudFoundryAppInstanceID returns an attribute KeyValue conforming to the +// "cloudfoundry.app.instance.id" semantic conventions. It represents the index +// of the application instance. 0 when just one instance is active. +func CloudFoundryAppInstanceID(val string) attribute.KeyValue { + return CloudFoundryAppInstanceIDKey.String(val) +} + +// CloudFoundryAppName returns an attribute KeyValue conforming to the +// "cloudfoundry.app.name" semantic conventions. It represents the name of the +// application. +func CloudFoundryAppName(val string) attribute.KeyValue { + return CloudFoundryAppNameKey.String(val) +} + +// CloudFoundryOrgID returns an attribute KeyValue conforming to the +// "cloudfoundry.org.id" semantic conventions. It represents the guid of the +// CloudFoundry org the application is running in. +func CloudFoundryOrgID(val string) attribute.KeyValue { + return CloudFoundryOrgIDKey.String(val) +} + +// CloudFoundryOrgName returns an attribute KeyValue conforming to the +// "cloudfoundry.org.name" semantic conventions. It represents the name of the +// CloudFoundry organization the app is running in. +func CloudFoundryOrgName(val string) attribute.KeyValue { + return CloudFoundryOrgNameKey.String(val) +} + +// CloudFoundryProcessID returns an attribute KeyValue conforming to the +// "cloudfoundry.process.id" semantic conventions. It represents the UID +// identifying the process. +func CloudFoundryProcessID(val string) attribute.KeyValue { + return CloudFoundryProcessIDKey.String(val) +} + +// CloudFoundryProcessType returns an attribute KeyValue conforming to the +// "cloudfoundry.process.type" semantic conventions. It represents the type of +// process. +func CloudFoundryProcessType(val string) attribute.KeyValue { + return CloudFoundryProcessTypeKey.String(val) +} + +// CloudFoundrySpaceID returns an attribute KeyValue conforming to the +// "cloudfoundry.space.id" semantic conventions. It represents the guid of the +// CloudFoundry space the application is running in. +func CloudFoundrySpaceID(val string) attribute.KeyValue { + return CloudFoundrySpaceIDKey.String(val) +} + +// CloudFoundrySpaceName returns an attribute KeyValue conforming to the +// "cloudfoundry.space.name" semantic conventions. It represents the name of the +// CloudFoundry space the application is running in. +func CloudFoundrySpaceName(val string) attribute.KeyValue { + return CloudFoundrySpaceNameKey.String(val) +} + +// CloudFoundrySystemID returns an attribute KeyValue conforming to the +// "cloudfoundry.system.id" semantic conventions. It represents a guid or another +// name describing the event source. +func CloudFoundrySystemID(val string) attribute.KeyValue { + return CloudFoundrySystemIDKey.String(val) +} + +// CloudFoundrySystemInstanceID returns an attribute KeyValue conforming to the +// "cloudfoundry.system.instance.id" semantic conventions. It represents a guid +// describing the concrete instance of the event source. +func CloudFoundrySystemInstanceID(val string) attribute.KeyValue { + return CloudFoundrySystemInstanceIDKey.String(val) +} + +// Namespace: code +const ( + // CodeColumnNumberKey is the attribute Key conforming to the + // "code.column.number" semantic conventions. It represents the column number in + // `code.file.path` best representing the operation. It SHOULD point within the + // code unit named in `code.function.name`. This attribute MUST NOT be used on + // the Profile signal since the data is already captured in 'message Line'. This + // constraint is imposed to prevent redundancy and maintain data integrity. + // + // Type: int + // RequirementLevel: Recommended + // Stability: Stable + CodeColumnNumberKey = attribute.Key("code.column.number") + + // CodeFilePathKey is the attribute Key conforming to the "code.file.path" + // semantic conventions. It represents the source code file name that identifies + // the code unit as uniquely as possible (preferably an absolute file path). + // This attribute MUST NOT be used on the Profile signal since the data is + // already captured in 'message Function'. This constraint is imposed to prevent + // redundancy and maintain data integrity. + // + // Type: string + // RequirementLevel: Recommended + // Stability: Stable + // + // Examples: /usr/local/MyApplication/content_root/app/index.php + CodeFilePathKey = attribute.Key("code.file.path") + + // CodeFunctionNameKey is the attribute Key conforming to the + // "code.function.name" semantic conventions. It represents the method or + // function fully-qualified name without arguments. The value should fit the + // natural representation of the language runtime, which is also likely the same + // used within `code.stacktrace` attribute value. This attribute MUST NOT be + // used on the Profile signal since the data is already captured in 'message + // Function'. This constraint is imposed to prevent redundancy and maintain data + // integrity. + // + // Type: string + // RequirementLevel: Recommended + // Stability: Stable + // + // Examples: "com.example.MyHttpService.serveRequest", + // "GuzzleHttp\Client::transfer", "fopen" + // Note: Values and format depends on each language runtime, thus it is + // impossible to provide an exhaustive list of examples. + // The values are usually the same (or prefixes of) the ones found in native + // stack trace representation stored in + // `code.stacktrace` without information on arguments. + // + // Examples: + // + // - Java method: `com.example.MyHttpService.serveRequest` + // - Java anonymous class method: `com.mycompany.Main$1.myMethod` + // - Java lambda method: + // `com.mycompany.Main$$Lambda/0x0000748ae4149c00.myMethod` + // - PHP function: `GuzzleHttp\Client::transfer` + // - Go function: `github.com/my/repo/pkg.foo.func5` + // - Elixir: `OpenTelemetry.Ctx.new` + // - Erlang: `opentelemetry_ctx:new` + // - Rust: `playground::my_module::my_cool_func` + // - C function: `fopen` + CodeFunctionNameKey = attribute.Key("code.function.name") + + // CodeLineNumberKey is the attribute Key conforming to the "code.line.number" + // semantic conventions. It represents the line number in `code.file.path` best + // representing the operation. It SHOULD point within the code unit named in + // `code.function.name`. This attribute MUST NOT be used on the Profile signal + // since the data is already captured in 'message Line'. This constraint is + // imposed to prevent redundancy and maintain data integrity. + // + // Type: int + // RequirementLevel: Recommended + // Stability: Stable + CodeLineNumberKey = attribute.Key("code.line.number") + + // CodeStacktraceKey is the attribute Key conforming to the "code.stacktrace" + // semantic conventions. It represents a stacktrace as a string in the natural + // representation for the language runtime. The representation is identical to + // [`exception.stacktrace`]. This attribute MUST NOT be used on the Profile + // signal since the data is already captured in 'message Location'. This + // constraint is imposed to prevent redundancy and maintain data integrity. + // + // Type: string + // RequirementLevel: Recommended + // Stability: Stable + // + // Examples: at com.example.GenerateTrace.methodB(GenerateTrace.java:13)\n at + // com.example.GenerateTrace.methodA(GenerateTrace.java:9)\n at + // com.example.GenerateTrace.main(GenerateTrace.java:5) + // + // [`exception.stacktrace`]: /docs/exceptions/exceptions-spans.md#stacktrace-representation + CodeStacktraceKey = attribute.Key("code.stacktrace") +) + +// CodeColumnNumber returns an attribute KeyValue conforming to the +// "code.column.number" semantic conventions. It represents the column number in +// `code.file.path` best representing the operation. It SHOULD point within the +// code unit named in `code.function.name`. This attribute MUST NOT be used on +// the Profile signal since the data is already captured in 'message Line'. This +// constraint is imposed to prevent redundancy and maintain data integrity. +func CodeColumnNumber(val int) attribute.KeyValue { + return CodeColumnNumberKey.Int(val) +} + +// CodeFilePath returns an attribute KeyValue conforming to the "code.file.path" +// semantic conventions. It represents the source code file name that identifies +// the code unit as uniquely as possible (preferably an absolute file path). This +// attribute MUST NOT be used on the Profile signal since the data is already +// captured in 'message Function'. This constraint is imposed to prevent +// redundancy and maintain data integrity. +func CodeFilePath(val string) attribute.KeyValue { + return CodeFilePathKey.String(val) +} + +// CodeFunctionName returns an attribute KeyValue conforming to the +// "code.function.name" semantic conventions. It represents the method or +// function fully-qualified name without arguments. The value should fit the +// natural representation of the language runtime, which is also likely the same +// used within `code.stacktrace` attribute value. This attribute MUST NOT be used +// on the Profile signal since the data is already captured in 'message +// Function'. This constraint is imposed to prevent redundancy and maintain data +// integrity. +func CodeFunctionName(val string) attribute.KeyValue { + return CodeFunctionNameKey.String(val) +} + +// CodeLineNumber returns an attribute KeyValue conforming to the +// "code.line.number" semantic conventions. It represents the line number in +// `code.file.path` best representing the operation. It SHOULD point within the +// code unit named in `code.function.name`. This attribute MUST NOT be used on +// the Profile signal since the data is already captured in 'message Line'. This +// constraint is imposed to prevent redundancy and maintain data integrity. +func CodeLineNumber(val int) attribute.KeyValue { + return CodeLineNumberKey.Int(val) +} + +// CodeStacktrace returns an attribute KeyValue conforming to the +// "code.stacktrace" semantic conventions. It represents a stacktrace as a string +// in the natural representation for the language runtime. The representation is +// identical to [`exception.stacktrace`]. This attribute MUST NOT be used on the +// Profile signal since the data is already captured in 'message Location'. This +// constraint is imposed to prevent redundancy and maintain data integrity. +// +// [`exception.stacktrace`]: /docs/exceptions/exceptions-spans.md#stacktrace-representation +func CodeStacktrace(val string) attribute.KeyValue { + return CodeStacktraceKey.String(val) +} + +// Namespace: container +const ( + // ContainerCommandKey is the attribute Key conforming to the + // "container.command" semantic conventions. It represents the command used to + // run the container (i.e. the command name). + // + // Type: string + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: "otelcontribcol" + // Note: If using embedded credentials or sensitive data, it is recommended to + // remove them to prevent potential leakage. + ContainerCommandKey = attribute.Key("container.command") + + // ContainerCommandArgsKey is the attribute Key conforming to the + // "container.command_args" semantic conventions. It represents the all the + // command arguments (including the command/executable itself) run by the + // container. + // + // Type: string[] + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: "otelcontribcol", "--config", "config.yaml" + ContainerCommandArgsKey = attribute.Key("container.command_args") + + // ContainerCommandLineKey is the attribute Key conforming to the + // "container.command_line" semantic conventions. It represents the full command + // run by the container as a single string representing the full command. + // + // Type: string + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: "otelcontribcol --config config.yaml" + ContainerCommandLineKey = attribute.Key("container.command_line") + + // ContainerCSIPluginNameKey is the attribute Key conforming to the + // "container.csi.plugin.name" semantic conventions. It represents the name of + // the CSI ([Container Storage Interface]) plugin used by the volume. + // + // Type: string + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: "pd.csi.storage.gke.io" + // Note: This can sometimes be referred to as a "driver" in CSI implementations. + // This should represent the `name` field of the GetPluginInfo RPC. + // + // [Container Storage Interface]: https://github.com/container-storage-interface/spec + ContainerCSIPluginNameKey = attribute.Key("container.csi.plugin.name") + + // ContainerCSIVolumeIDKey is the attribute Key conforming to the + // "container.csi.volume.id" semantic conventions. It represents the unique + // volume ID returned by the CSI ([Container Storage Interface]) plugin. + // + // Type: string + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: "projects/my-gcp-project/zones/my-gcp-zone/disks/my-gcp-disk" + // Note: This can sometimes be referred to as a "volume handle" in CSI + // implementations. This should represent the `Volume.volume_id` field in CSI + // spec. + // + // [Container Storage Interface]: https://github.com/container-storage-interface/spec + ContainerCSIVolumeIDKey = attribute.Key("container.csi.volume.id") + + // ContainerIDKey is the attribute Key conforming to the "container.id" semantic + // conventions. It represents the container ID. Usually a UUID, as for example + // used to [identify Docker containers]. The UUID might be abbreviated. + // + // Type: string + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: "a3bf90e006b2" + // + // [identify Docker containers]: https://docs.docker.com/engine/containers/run/#container-identification + ContainerIDKey = attribute.Key("container.id") + + // ContainerImageIDKey is the attribute Key conforming to the + // "container.image.id" semantic conventions. It represents the runtime specific + // image identifier. Usually a hash algorithm followed by a UUID. + // + // Type: string + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: + // "sha256:19c92d0a00d1b66d897bceaa7319bee0dd38a10a851c60bcec9474aa3f01e50f" + // Note: Docker defines a sha256 of the image id; `container.image.id` + // corresponds to the `Image` field from the Docker container inspect [API] + // endpoint. + // K8s defines a link to the container registry repository with digest + // `"imageID": "registry.azurecr.io /namespace/service/dockerfile@sha256:bdeabd40c3a8a492eaf9e8e44d0ebbb84bac7ee25ac0cf8a7159d25f62555625"` + // . + // The ID is assigned by the container runtime and can vary in different + // environments. Consider using `oci.manifest.digest` if it is important to + // identify the same image in different environments/runtimes. + // + // [API]: https://docs.docker.com/engine/api/v1.43/#tag/Container/operation/ContainerInspect + ContainerImageIDKey = attribute.Key("container.image.id") + + // ContainerImageNameKey is the attribute Key conforming to the + // "container.image.name" semantic conventions. It represents the name of the + // image the container was built on. + // + // Type: string + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: "gcr.io/opentelemetry/operator" + ContainerImageNameKey = attribute.Key("container.image.name") + + // ContainerImageRepoDigestsKey is the attribute Key conforming to the + // "container.image.repo_digests" semantic conventions. It represents the repo + // digests of the container image as provided by the container runtime. + // + // Type: string[] + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: + // "example@sha256:afcc7f1ac1b49db317a7196c902e61c6c3c4607d63599ee1a82d702d249a0ccb", + // "internal.registry.example.com:5000/example@sha256:b69959407d21e8a062e0416bf13405bb2b71ed7a84dde4158ebafacfa06f5578" + // Note: [Docker] and [CRI] report those under the `RepoDigests` field. + // + // [Docker]: https://docs.docker.com/engine/api/v1.43/#tag/Image/operation/ImageInspect + // [CRI]: https://github.com/kubernetes/cri-api/blob/c75ef5b473bbe2d0a4fc92f82235efd665ea8e9f/pkg/apis/runtime/v1/api.proto#L1237-L1238 + ContainerImageRepoDigestsKey = attribute.Key("container.image.repo_digests") + + // ContainerImageTagsKey is the attribute Key conforming to the + // "container.image.tags" semantic conventions. It represents the container + // image tags. An example can be found in [Docker Image Inspect]. Should be only + // the `` section of the full name for example from + // `registry.example.com/my-org/my-image:`. + // + // Type: string[] + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: "v1.27.1", "3.5.7-0" + // + // [Docker Image Inspect]: https://docs.docker.com/engine/api/v1.43/#tag/Image/operation/ImageInspect + ContainerImageTagsKey = attribute.Key("container.image.tags") + + // ContainerNameKey is the attribute Key conforming to the "container.name" + // semantic conventions. It represents the container name used by container + // runtime. + // + // Type: string + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: "opentelemetry-autoconf" + ContainerNameKey = attribute.Key("container.name") + + // ContainerRuntimeDescriptionKey is the attribute Key conforming to the + // "container.runtime.description" semantic conventions. It represents a + // description about the runtime which could include, for example details about + // the CRI/API version being used or other customisations. + // + // Type: string + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: "docker://19.3.1 - CRI: 1.22.0" + ContainerRuntimeDescriptionKey = attribute.Key("container.runtime.description") + + // ContainerRuntimeNameKey is the attribute Key conforming to the + // "container.runtime.name" semantic conventions. It represents the container + // runtime managing this container. + // + // Type: string + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: "docker", "containerd", "rkt" + ContainerRuntimeNameKey = attribute.Key("container.runtime.name") + + // ContainerRuntimeVersionKey is the attribute Key conforming to the + // "container.runtime.version" semantic conventions. It represents the version + // of the runtime of this process, as returned by the runtime without + // modification. + // + // Type: string + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: 1.0.0 + ContainerRuntimeVersionKey = attribute.Key("container.runtime.version") +) + +// ContainerCommand returns an attribute KeyValue conforming to the +// "container.command" semantic conventions. It represents the command used to +// run the container (i.e. the command name). +func ContainerCommand(val string) attribute.KeyValue { + return ContainerCommandKey.String(val) +} + +// ContainerCommandArgs returns an attribute KeyValue conforming to the +// "container.command_args" semantic conventions. It represents the all the +// command arguments (including the command/executable itself) run by the +// container. +func ContainerCommandArgs(val ...string) attribute.KeyValue { + return ContainerCommandArgsKey.StringSlice(val) +} + +// ContainerCommandLine returns an attribute KeyValue conforming to the +// "container.command_line" semantic conventions. It represents the full command +// run by the container as a single string representing the full command. +func ContainerCommandLine(val string) attribute.KeyValue { + return ContainerCommandLineKey.String(val) +} + +// ContainerCSIPluginName returns an attribute KeyValue conforming to the +// "container.csi.plugin.name" semantic conventions. It represents the name of +// the CSI ([Container Storage Interface]) plugin used by the volume. +// +// [Container Storage Interface]: https://github.com/container-storage-interface/spec +func ContainerCSIPluginName(val string) attribute.KeyValue { + return ContainerCSIPluginNameKey.String(val) +} + +// ContainerCSIVolumeID returns an attribute KeyValue conforming to the +// "container.csi.volume.id" semantic conventions. It represents the unique +// volume ID returned by the CSI ([Container Storage Interface]) plugin. +// +// [Container Storage Interface]: https://github.com/container-storage-interface/spec +func ContainerCSIVolumeID(val string) attribute.KeyValue { + return ContainerCSIVolumeIDKey.String(val) +} + +// ContainerID returns an attribute KeyValue conforming to the "container.id" +// semantic conventions. It represents the container ID. Usually a UUID, as for +// example used to [identify Docker containers]. The UUID might be abbreviated. +// +// [identify Docker containers]: https://docs.docker.com/engine/containers/run/#container-identification +func ContainerID(val string) attribute.KeyValue { + return ContainerIDKey.String(val) +} + +// ContainerImageID returns an attribute KeyValue conforming to the +// "container.image.id" semantic conventions. It represents the runtime specific +// image identifier. Usually a hash algorithm followed by a UUID. +func ContainerImageID(val string) attribute.KeyValue { + return ContainerImageIDKey.String(val) +} + +// ContainerImageName returns an attribute KeyValue conforming to the +// "container.image.name" semantic conventions. It represents the name of the +// image the container was built on. +func ContainerImageName(val string) attribute.KeyValue { + return ContainerImageNameKey.String(val) +} + +// ContainerImageRepoDigests returns an attribute KeyValue conforming to the +// "container.image.repo_digests" semantic conventions. It represents the repo +// digests of the container image as provided by the container runtime. +func ContainerImageRepoDigests(val ...string) attribute.KeyValue { + return ContainerImageRepoDigestsKey.StringSlice(val) +} + +// ContainerImageTags returns an attribute KeyValue conforming to the +// "container.image.tags" semantic conventions. It represents the container image +// tags. An example can be found in [Docker Image Inspect]. Should be only the +// `` section of the full name for example from +// `registry.example.com/my-org/my-image:`. +// +// [Docker Image Inspect]: https://docs.docker.com/engine/api/v1.43/#tag/Image/operation/ImageInspect +func ContainerImageTags(val ...string) attribute.KeyValue { + return ContainerImageTagsKey.StringSlice(val) +} + +// ContainerLabel returns an attribute KeyValue conforming to the +// "container.label" semantic conventions. It represents the container labels, +// `` being the label name, the value being the label value. +func ContainerLabel(key string, val string) attribute.KeyValue { + return attribute.String("container.label."+key, val) +} + +// ContainerName returns an attribute KeyValue conforming to the "container.name" +// semantic conventions. It represents the container name used by container +// runtime. +func ContainerName(val string) attribute.KeyValue { + return ContainerNameKey.String(val) +} + +// ContainerRuntimeDescription returns an attribute KeyValue conforming to the +// "container.runtime.description" semantic conventions. It represents a +// description about the runtime which could include, for example details about +// the CRI/API version being used or other customisations. +func ContainerRuntimeDescription(val string) attribute.KeyValue { + return ContainerRuntimeDescriptionKey.String(val) +} + +// ContainerRuntimeName returns an attribute KeyValue conforming to the +// "container.runtime.name" semantic conventions. It represents the container +// runtime managing this container. +func ContainerRuntimeName(val string) attribute.KeyValue { + return ContainerRuntimeNameKey.String(val) +} + +// ContainerRuntimeVersion returns an attribute KeyValue conforming to the +// "container.runtime.version" semantic conventions. It represents the version of +// the runtime of this process, as returned by the runtime without modification. +func ContainerRuntimeVersion(val string) attribute.KeyValue { + return ContainerRuntimeVersionKey.String(val) +} + +// Namespace: cpu +const ( + // CPULogicalNumberKey is the attribute Key conforming to the + // "cpu.logical_number" semantic conventions. It represents the logical CPU + // number [0..n-1]. + // + // Type: int + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: 1 + CPULogicalNumberKey = attribute.Key("cpu.logical_number") + + // CPUModeKey is the attribute Key conforming to the "cpu.mode" semantic + // conventions. It represents the mode of the CPU. + // + // Type: Enum + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: "user", "system" + CPUModeKey = attribute.Key("cpu.mode") +) + +// CPULogicalNumber returns an attribute KeyValue conforming to the +// "cpu.logical_number" semantic conventions. It represents the logical CPU +// number [0..n-1]. +func CPULogicalNumber(val int) attribute.KeyValue { + return CPULogicalNumberKey.Int(val) +} + +// Enum values for cpu.mode +var ( + // User + // Stability: development + CPUModeUser = CPUModeKey.String("user") + // System + // Stability: development + CPUModeSystem = CPUModeKey.String("system") + // Nice + // Stability: development + CPUModeNice = CPUModeKey.String("nice") + // Idle + // Stability: development + CPUModeIdle = CPUModeKey.String("idle") + // IO Wait + // Stability: development + CPUModeIOWait = CPUModeKey.String("iowait") + // Interrupt + // Stability: development + CPUModeInterrupt = CPUModeKey.String("interrupt") + // Steal + // Stability: development + CPUModeSteal = CPUModeKey.String("steal") + // Kernel + // Stability: development + CPUModeKernel = CPUModeKey.String("kernel") +) + +// Namespace: db +const ( + // DBClientConnectionPoolNameKey is the attribute Key conforming to the + // "db.client.connection.pool.name" semantic conventions. It represents the name + // of the connection pool; unique within the instrumented application. In case + // the connection pool implementation doesn't provide a name, instrumentation + // SHOULD use a combination of parameters that would make the name unique, for + // example, combining attributes `server.address`, `server.port`, and + // `db.namespace`, formatted as `server.address:server.port/db.namespace`. + // Instrumentations that generate connection pool name following different + // patterns SHOULD document it. + // + // Type: string + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: "myDataSource" + DBClientConnectionPoolNameKey = attribute.Key("db.client.connection.pool.name") + + // DBClientConnectionStateKey is the attribute Key conforming to the + // "db.client.connection.state" semantic conventions. It represents the state of + // a connection in the pool. + // + // Type: Enum + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: "idle" + DBClientConnectionStateKey = attribute.Key("db.client.connection.state") + + // DBCollectionNameKey is the attribute Key conforming to the + // "db.collection.name" semantic conventions. It represents the name of a + // collection (table, container) within the database. + // + // Type: string + // RequirementLevel: Recommended + // Stability: Stable + // + // Examples: "public.users", "customers" + // Note: It is RECOMMENDED to capture the value as provided by the application + // without attempting to do any case normalization. + // + // The collection name SHOULD NOT be extracted from `db.query.text`, + // when the database system supports query text with multiple collections + // in non-batch operations. + // + // For batch operations, if the individual operations are known to have the same + // collection name then that collection name SHOULD be used. + DBCollectionNameKey = attribute.Key("db.collection.name") + + // DBNamespaceKey is the attribute Key conforming to the "db.namespace" semantic + // conventions. It represents the name of the database, fully qualified within + // the server address and port. + // + // Type: string + // RequirementLevel: Recommended + // Stability: Stable + // + // Examples: "customers", "test.users" + // Note: If a database system has multiple namespace components, they SHOULD be + // concatenated from the most general to the most specific namespace component, + // using `|` as a separator between the components. Any missing components (and + // their associated separators) SHOULD be omitted. + // Semantic conventions for individual database systems SHOULD document what + // `db.namespace` means in the context of that system. + // It is RECOMMENDED to capture the value as provided by the application without + // attempting to do any case normalization. + DBNamespaceKey = attribute.Key("db.namespace") + + // DBOperationBatchSizeKey is the attribute Key conforming to the + // "db.operation.batch.size" semantic conventions. It represents the number of + // queries included in a batch operation. + // + // Type: int + // RequirementLevel: Recommended + // Stability: Stable + // + // Examples: 2, 3, 4 + // Note: Operations are only considered batches when they contain two or more + // operations, and so `db.operation.batch.size` SHOULD never be `1`. + DBOperationBatchSizeKey = attribute.Key("db.operation.batch.size") + + // DBOperationNameKey is the attribute Key conforming to the "db.operation.name" + // semantic conventions. It represents the name of the operation or command + // being executed. + // + // Type: string + // RequirementLevel: Recommended + // Stability: Stable + // + // Examples: "findAndModify", "HMSET", "SELECT" + // Note: It is RECOMMENDED to capture the value as provided by the application + // without attempting to do any case normalization. + // + // The operation name SHOULD NOT be extracted from `db.query.text`, + // when the database system supports query text with multiple operations + // in non-batch operations. + // + // If spaces can occur in the operation name, multiple consecutive spaces + // SHOULD be normalized to a single space. + // + // For batch operations, if the individual operations are known to have the same + // operation name + // then that operation name SHOULD be used prepended by `BATCH `, + // otherwise `db.operation.name` SHOULD be `BATCH` or some other database + // system specific term if more applicable. + DBOperationNameKey = attribute.Key("db.operation.name") + + // DBQuerySummaryKey is the attribute Key conforming to the "db.query.summary" + // semantic conventions. It represents the low cardinality summary of a database + // query. + // + // Type: string + // RequirementLevel: Recommended + // Stability: Stable + // + // Examples: "SELECT wuser_table", "INSERT shipping_details SELECT orders", "get + // user by id" + // Note: The query summary describes a class of database queries and is useful + // as a grouping key, especially when analyzing telemetry for database + // calls involving complex queries. + // + // Summary may be available to the instrumentation through + // instrumentation hooks or other means. If it is not available, + // instrumentations + // that support query parsing SHOULD generate a summary following + // [Generating query summary] + // section. + // + // [Generating query summary]: /docs/database/database-spans.md#generating-a-summary-of-the-query + DBQuerySummaryKey = attribute.Key("db.query.summary") + + // DBQueryTextKey is the attribute Key conforming to the "db.query.text" + // semantic conventions. It represents the database query being executed. + // + // Type: string + // RequirementLevel: Recommended + // Stability: Stable + // + // Examples: "SELECT * FROM wuser_table where username = ?", "SET mykey ?" + // Note: For sanitization see [Sanitization of `db.query.text`]. + // For batch operations, if the individual operations are known to have the same + // query text then that query text SHOULD be used, otherwise all of the + // individual query texts SHOULD be concatenated with separator `; ` or some + // other database system specific separator if more applicable. + // Parameterized query text SHOULD NOT be sanitized. Even though parameterized + // query text can potentially have sensitive data, by using a parameterized + // query the user is giving a strong signal that any sensitive data will be + // passed as parameter values, and the benefit to observability of capturing the + // static part of the query text by default outweighs the risk. + // + // [Sanitization of `db.query.text`]: /docs/database/database-spans.md#sanitization-of-dbquerytext + DBQueryTextKey = attribute.Key("db.query.text") + + // DBResponseReturnedRowsKey is the attribute Key conforming to the + // "db.response.returned_rows" semantic conventions. It represents the number of + // rows returned by the operation. + // + // Type: int + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: 10, 30, 1000 + DBResponseReturnedRowsKey = attribute.Key("db.response.returned_rows") + + // DBResponseStatusCodeKey is the attribute Key conforming to the + // "db.response.status_code" semantic conventions. It represents the database + // response status code. + // + // Type: string + // RequirementLevel: Recommended + // Stability: Stable + // + // Examples: "102", "ORA-17002", "08P01", "404" + // Note: The status code returned by the database. Usually it represents an + // error code, but may also represent partial success, warning, or differentiate + // between various types of successful outcomes. + // Semantic conventions for individual database systems SHOULD document what + // `db.response.status_code` means in the context of that system. + DBResponseStatusCodeKey = attribute.Key("db.response.status_code") + + // DBStoredProcedureNameKey is the attribute Key conforming to the + // "db.stored_procedure.name" semantic conventions. It represents the name of a + // stored procedure within the database. + // + // Type: string + // RequirementLevel: Recommended + // Stability: Stable + // + // Examples: "GetCustomer" + // Note: It is RECOMMENDED to capture the value as provided by the application + // without attempting to do any case normalization. + // + // For batch operations, if the individual operations are known to have the same + // stored procedure name then that stored procedure name SHOULD be used. + DBStoredProcedureNameKey = attribute.Key("db.stored_procedure.name") + + // DBSystemNameKey is the attribute Key conforming to the "db.system.name" + // semantic conventions. It represents the database management system (DBMS) + // product as identified by the client instrumentation. + // + // Type: Enum + // RequirementLevel: Recommended + // Stability: Stable + // + // Examples: + // Note: The actual DBMS may differ from the one identified by the client. For + // example, when using PostgreSQL client libraries to connect to a CockroachDB, + // the `db.system.name` is set to `postgresql` based on the instrumentation's + // best knowledge. + DBSystemNameKey = attribute.Key("db.system.name") +) + +// DBClientConnectionPoolName returns an attribute KeyValue conforming to the +// "db.client.connection.pool.name" semantic conventions. It represents the name +// of the connection pool; unique within the instrumented application. In case +// the connection pool implementation doesn't provide a name, instrumentation +// SHOULD use a combination of parameters that would make the name unique, for +// example, combining attributes `server.address`, `server.port`, and +// `db.namespace`, formatted as `server.address:server.port/db.namespace`. +// Instrumentations that generate connection pool name following different +// patterns SHOULD document it. +func DBClientConnectionPoolName(val string) attribute.KeyValue { + return DBClientConnectionPoolNameKey.String(val) +} + +// DBCollectionName returns an attribute KeyValue conforming to the +// "db.collection.name" semantic conventions. It represents the name of a +// collection (table, container) within the database. +func DBCollectionName(val string) attribute.KeyValue { + return DBCollectionNameKey.String(val) +} + +// DBNamespace returns an attribute KeyValue conforming to the "db.namespace" +// semantic conventions. It represents the name of the database, fully qualified +// within the server address and port. +func DBNamespace(val string) attribute.KeyValue { + return DBNamespaceKey.String(val) +} + +// DBOperationBatchSize returns an attribute KeyValue conforming to the +// "db.operation.batch.size" semantic conventions. It represents the number of +// queries included in a batch operation. +func DBOperationBatchSize(val int) attribute.KeyValue { + return DBOperationBatchSizeKey.Int(val) +} + +// DBOperationName returns an attribute KeyValue conforming to the +// "db.operation.name" semantic conventions. It represents the name of the +// operation or command being executed. +func DBOperationName(val string) attribute.KeyValue { + return DBOperationNameKey.String(val) +} + +// DBOperationParameter returns an attribute KeyValue conforming to the +// "db.operation.parameter" semantic conventions. It represents a database +// operation parameter, with `` being the parameter name, and the attribute +// value being a string representation of the parameter value. +func DBOperationParameter(key string, val string) attribute.KeyValue { + return attribute.String("db.operation.parameter."+key, val) +} + +// DBQueryParameter returns an attribute KeyValue conforming to the +// "db.query.parameter" semantic conventions. It represents a database query +// parameter, with `` being the parameter name, and the attribute value +// being a string representation of the parameter value. +func DBQueryParameter(key string, val string) attribute.KeyValue { + return attribute.String("db.query.parameter."+key, val) +} + +// DBQuerySummary returns an attribute KeyValue conforming to the +// "db.query.summary" semantic conventions. It represents the low cardinality +// summary of a database query. +func DBQuerySummary(val string) attribute.KeyValue { + return DBQuerySummaryKey.String(val) +} + +// DBQueryText returns an attribute KeyValue conforming to the "db.query.text" +// semantic conventions. It represents the database query being executed. +func DBQueryText(val string) attribute.KeyValue { + return DBQueryTextKey.String(val) +} + +// DBResponseReturnedRows returns an attribute KeyValue conforming to the +// "db.response.returned_rows" semantic conventions. It represents the number of +// rows returned by the operation. +func DBResponseReturnedRows(val int) attribute.KeyValue { + return DBResponseReturnedRowsKey.Int(val) +} + +// DBResponseStatusCode returns an attribute KeyValue conforming to the +// "db.response.status_code" semantic conventions. It represents the database +// response status code. +func DBResponseStatusCode(val string) attribute.KeyValue { + return DBResponseStatusCodeKey.String(val) +} + +// DBStoredProcedureName returns an attribute KeyValue conforming to the +// "db.stored_procedure.name" semantic conventions. It represents the name of a +// stored procedure within the database. +func DBStoredProcedureName(val string) attribute.KeyValue { + return DBStoredProcedureNameKey.String(val) +} + +// Enum values for db.client.connection.state +var ( + // idle + // Stability: development + DBClientConnectionStateIdle = DBClientConnectionStateKey.String("idle") + // used + // Stability: development + DBClientConnectionStateUsed = DBClientConnectionStateKey.String("used") +) + +// Enum values for db.system.name +var ( + // Some other SQL database. Fallback only. + // Stability: development + DBSystemNameOtherSQL = DBSystemNameKey.String("other_sql") + // [Adabas (Adaptable Database System)] + // Stability: development + // + // [Adabas (Adaptable Database System)]: https://documentation.softwareag.com/?pf=adabas + DBSystemNameSoftwareagAdabas = DBSystemNameKey.String("softwareag.adabas") + // [Actian Ingres] + // Stability: development + // + // [Actian Ingres]: https://www.actian.com/databases/ingres/ + DBSystemNameActianIngres = DBSystemNameKey.String("actian.ingres") + // [Amazon DynamoDB] + // Stability: development + // + // [Amazon DynamoDB]: https://aws.amazon.com/pm/dynamodb/ + DBSystemNameAWSDynamoDB = DBSystemNameKey.String("aws.dynamodb") + // [Amazon Redshift] + // Stability: development + // + // [Amazon Redshift]: https://aws.amazon.com/redshift/ + DBSystemNameAWSRedshift = DBSystemNameKey.String("aws.redshift") + // [Azure Cosmos DB] + // Stability: development + // + // [Azure Cosmos DB]: https://learn.microsoft.com/azure/cosmos-db + DBSystemNameAzureCosmosDB = DBSystemNameKey.String("azure.cosmosdb") + // [InterSystems Caché] + // Stability: development + // + // [InterSystems Caché]: https://www.intersystems.com/products/cache/ + DBSystemNameIntersystemsCache = DBSystemNameKey.String("intersystems.cache") + // [Apache Cassandra] + // Stability: development + // + // [Apache Cassandra]: https://cassandra.apache.org/ + DBSystemNameCassandra = DBSystemNameKey.String("cassandra") + // [ClickHouse] + // Stability: development + // + // [ClickHouse]: https://clickhouse.com/ + DBSystemNameClickHouse = DBSystemNameKey.String("clickhouse") + // [CockroachDB] + // Stability: development + // + // [CockroachDB]: https://www.cockroachlabs.com/ + DBSystemNameCockroachDB = DBSystemNameKey.String("cockroachdb") + // [Couchbase] + // Stability: development + // + // [Couchbase]: https://www.couchbase.com/ + DBSystemNameCouchbase = DBSystemNameKey.String("couchbase") + // [Apache CouchDB] + // Stability: development + // + // [Apache CouchDB]: https://couchdb.apache.org/ + DBSystemNameCouchDB = DBSystemNameKey.String("couchdb") + // [Apache Derby] + // Stability: development + // + // [Apache Derby]: https://db.apache.org/derby/ + DBSystemNameDerby = DBSystemNameKey.String("derby") + // [Elasticsearch] + // Stability: development + // + // [Elasticsearch]: https://www.elastic.co/elasticsearch + DBSystemNameElasticsearch = DBSystemNameKey.String("elasticsearch") + // [Firebird] + // Stability: development + // + // [Firebird]: https://www.firebirdsql.org/ + DBSystemNameFirebirdSQL = DBSystemNameKey.String("firebirdsql") + // [Google Cloud Spanner] + // Stability: development + // + // [Google Cloud Spanner]: https://cloud.google.com/spanner + DBSystemNameGCPSpanner = DBSystemNameKey.String("gcp.spanner") + // [Apache Geode] + // Stability: development + // + // [Apache Geode]: https://geode.apache.org/ + DBSystemNameGeode = DBSystemNameKey.String("geode") + // [H2 Database] + // Stability: development + // + // [H2 Database]: https://h2database.com/ + DBSystemNameH2database = DBSystemNameKey.String("h2database") + // [Apache HBase] + // Stability: development + // + // [Apache HBase]: https://hbase.apache.org/ + DBSystemNameHBase = DBSystemNameKey.String("hbase") + // [Apache Hive] + // Stability: development + // + // [Apache Hive]: https://hive.apache.org/ + DBSystemNameHive = DBSystemNameKey.String("hive") + // [HyperSQL Database] + // Stability: development + // + // [HyperSQL Database]: https://hsqldb.org/ + DBSystemNameHSQLDB = DBSystemNameKey.String("hsqldb") + // [IBM Db2] + // Stability: development + // + // [IBM Db2]: https://www.ibm.com/db2 + DBSystemNameIBMDB2 = DBSystemNameKey.String("ibm.db2") + // [IBM Informix] + // Stability: development + // + // [IBM Informix]: https://www.ibm.com/products/informix + DBSystemNameIBMInformix = DBSystemNameKey.String("ibm.informix") + // [IBM Netezza] + // Stability: development + // + // [IBM Netezza]: https://www.ibm.com/products/netezza + DBSystemNameIBMNetezza = DBSystemNameKey.String("ibm.netezza") + // [InfluxDB] + // Stability: development + // + // [InfluxDB]: https://www.influxdata.com/ + DBSystemNameInfluxDB = DBSystemNameKey.String("influxdb") + // [Instant] + // Stability: development + // + // [Instant]: https://www.instantdb.com/ + DBSystemNameInstantDB = DBSystemNameKey.String("instantdb") + // [MariaDB] + // Stability: stable + // + // [MariaDB]: https://mariadb.org/ + DBSystemNameMariaDB = DBSystemNameKey.String("mariadb") + // [Memcached] + // Stability: development + // + // [Memcached]: https://memcached.org/ + DBSystemNameMemcached = DBSystemNameKey.String("memcached") + // [MongoDB] + // Stability: development + // + // [MongoDB]: https://www.mongodb.com/ + DBSystemNameMongoDB = DBSystemNameKey.String("mongodb") + // [Microsoft SQL Server] + // Stability: stable + // + // [Microsoft SQL Server]: https://www.microsoft.com/sql-server + DBSystemNameMicrosoftSQLServer = DBSystemNameKey.String("microsoft.sql_server") + // [MySQL] + // Stability: stable + // + // [MySQL]: https://www.mysql.com/ + DBSystemNameMySQL = DBSystemNameKey.String("mysql") + // [Neo4j] + // Stability: development + // + // [Neo4j]: https://neo4j.com/ + DBSystemNameNeo4j = DBSystemNameKey.String("neo4j") + // [OpenSearch] + // Stability: development + // + // [OpenSearch]: https://opensearch.org/ + DBSystemNameOpenSearch = DBSystemNameKey.String("opensearch") + // [Oracle Database] + // Stability: development + // + // [Oracle Database]: https://www.oracle.com/database/ + DBSystemNameOracleDB = DBSystemNameKey.String("oracle.db") + // [PostgreSQL] + // Stability: stable + // + // [PostgreSQL]: https://www.postgresql.org/ + DBSystemNamePostgreSQL = DBSystemNameKey.String("postgresql") + // [Redis] + // Stability: development + // + // [Redis]: https://redis.io/ + DBSystemNameRedis = DBSystemNameKey.String("redis") + // [SAP HANA] + // Stability: development + // + // [SAP HANA]: https://www.sap.com/products/technology-platform/hana/what-is-sap-hana.html + DBSystemNameSAPHANA = DBSystemNameKey.String("sap.hana") + // [SAP MaxDB] + // Stability: development + // + // [SAP MaxDB]: https://maxdb.sap.com/ + DBSystemNameSAPMaxDB = DBSystemNameKey.String("sap.maxdb") + // [SQLite] + // Stability: development + // + // [SQLite]: https://www.sqlite.org/ + DBSystemNameSQLite = DBSystemNameKey.String("sqlite") + // [Teradata] + // Stability: development + // + // [Teradata]: https://www.teradata.com/ + DBSystemNameTeradata = DBSystemNameKey.String("teradata") + // [Trino] + // Stability: development + // + // [Trino]: https://trino.io/ + DBSystemNameTrino = DBSystemNameKey.String("trino") +) + +// Namespace: deployment +const ( + // DeploymentEnvironmentNameKey is the attribute Key conforming to the + // "deployment.environment.name" semantic conventions. It represents the name of + // the [deployment environment] (aka deployment tier). + // + // Type: string + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: "staging", "production" + // Note: `deployment.environment.name` does not affect the uniqueness + // constraints defined through + // the `service.namespace`, `service.name` and `service.instance.id` resource + // attributes. + // This implies that resources carrying the following attribute combinations + // MUST be + // considered to be identifying the same service: + // + // - `service.name=frontend`, `deployment.environment.name=production` + // - `service.name=frontend`, `deployment.environment.name=staging`. + // + // + // [deployment environment]: https://wikipedia.org/wiki/Deployment_environment + DeploymentEnvironmentNameKey = attribute.Key("deployment.environment.name") + + // DeploymentIDKey is the attribute Key conforming to the "deployment.id" + // semantic conventions. It represents the id of the deployment. + // + // Type: string + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: "1208" + DeploymentIDKey = attribute.Key("deployment.id") + + // DeploymentNameKey is the attribute Key conforming to the "deployment.name" + // semantic conventions. It represents the name of the deployment. + // + // Type: string + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: "deploy my app", "deploy-frontend" + DeploymentNameKey = attribute.Key("deployment.name") + + // DeploymentStatusKey is the attribute Key conforming to the + // "deployment.status" semantic conventions. It represents the status of the + // deployment. + // + // Type: Enum + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: + DeploymentStatusKey = attribute.Key("deployment.status") +) + +// DeploymentEnvironmentName returns an attribute KeyValue conforming to the +// "deployment.environment.name" semantic conventions. It represents the name of +// the [deployment environment] (aka deployment tier). +// +// [deployment environment]: https://wikipedia.org/wiki/Deployment_environment +func DeploymentEnvironmentName(val string) attribute.KeyValue { + return DeploymentEnvironmentNameKey.String(val) +} + +// DeploymentID returns an attribute KeyValue conforming to the "deployment.id" +// semantic conventions. It represents the id of the deployment. +func DeploymentID(val string) attribute.KeyValue { + return DeploymentIDKey.String(val) +} + +// DeploymentName returns an attribute KeyValue conforming to the +// "deployment.name" semantic conventions. It represents the name of the +// deployment. +func DeploymentName(val string) attribute.KeyValue { + return DeploymentNameKey.String(val) +} + +// Enum values for deployment.status +var ( + // failed + // Stability: development + DeploymentStatusFailed = DeploymentStatusKey.String("failed") + // succeeded + // Stability: development + DeploymentStatusSucceeded = DeploymentStatusKey.String("succeeded") +) + +// Namespace: destination +const ( + // DestinationAddressKey is the attribute Key conforming to the + // "destination.address" semantic conventions. It represents the destination + // address - domain name if available without reverse DNS lookup; otherwise, IP + // address or Unix domain socket name. + // + // Type: string + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: "destination.example.com", "10.1.2.80", "/tmp/my.sock" + // Note: When observed from the source side, and when communicating through an + // intermediary, `destination.address` SHOULD represent the destination address + // behind any intermediaries, for example proxies, if it's available. + DestinationAddressKey = attribute.Key("destination.address") + + // DestinationPortKey is the attribute Key conforming to the "destination.port" + // semantic conventions. It represents the destination port number. + // + // Type: int + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: 3389, 2888 + DestinationPortKey = attribute.Key("destination.port") +) + +// DestinationAddress returns an attribute KeyValue conforming to the +// "destination.address" semantic conventions. It represents the destination +// address - domain name if available without reverse DNS lookup; otherwise, IP +// address or Unix domain socket name. +func DestinationAddress(val string) attribute.KeyValue { + return DestinationAddressKey.String(val) +} + +// DestinationPort returns an attribute KeyValue conforming to the +// "destination.port" semantic conventions. It represents the destination port +// number. +func DestinationPort(val int) attribute.KeyValue { + return DestinationPortKey.Int(val) +} + +// Namespace: device +const ( + // DeviceIDKey is the attribute Key conforming to the "device.id" semantic + // conventions. It represents a unique identifier representing the device. + // + // Type: string + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: "123456789012345", "01:23:45:67:89:AB" + // Note: Its value SHOULD be identical for all apps on a device and it SHOULD + // NOT change if an app is uninstalled and re-installed. + // However, it might be resettable by the user for all apps on a device. + // Hardware IDs (e.g. vendor-specific serial number, IMEI or MAC address) MAY be + // used as values. + // + // More information about Android identifier best practices can be found in the + // [Android user data IDs guide]. + // + // > [!WARNING]> This attribute may contain sensitive (PII) information. Caution + // > should be taken when storing personal data or anything which can identify a + // > user. GDPR and data protection laws may apply, + // > ensure you do your own due diligence.> Due to these reasons, this + // > identifier is not recommended for consumer applications and will likely + // > result in rejection from both Google Play and App Store. + // > However, it may be appropriate for specific enterprise scenarios, such as + // > kiosk devices or enterprise-managed devices, with appropriate compliance + // > clearance. + // > Any instrumentation providing this identifier MUST implement it as an + // > opt-in feature.> See [`app.installation.id`]> for a more + // > privacy-preserving alternative. + // + // [Android user data IDs guide]: https://developer.android.com/training/articles/user-data-ids + // [`app.installation.id`]: /docs/registry/attributes/app.md#app-installation-id + DeviceIDKey = attribute.Key("device.id") + + // DeviceManufacturerKey is the attribute Key conforming to the + // "device.manufacturer" semantic conventions. It represents the name of the + // device manufacturer. + // + // Type: string + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: "Apple", "Samsung" + // Note: The Android OS provides this field via [Build]. iOS apps SHOULD + // hardcode the value `Apple`. + // + // [Build]: https://developer.android.com/reference/android/os/Build#MANUFACTURER + DeviceManufacturerKey = attribute.Key("device.manufacturer") + + // DeviceModelIdentifierKey is the attribute Key conforming to the + // "device.model.identifier" semantic conventions. It represents the model + // identifier for the device. + // + // Type: string + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: "iPhone3,4", "SM-G920F" + // Note: It's recommended this value represents a machine-readable version of + // the model identifier rather than the market or consumer-friendly name of the + // device. + DeviceModelIdentifierKey = attribute.Key("device.model.identifier") + + // DeviceModelNameKey is the attribute Key conforming to the "device.model.name" + // semantic conventions. It represents the marketing name for the device model. + // + // Type: string + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: "iPhone 6s Plus", "Samsung Galaxy S6" + // Note: It's recommended this value represents a human-readable version of the + // device model rather than a machine-readable alternative. + DeviceModelNameKey = attribute.Key("device.model.name") +) + +// DeviceID returns an attribute KeyValue conforming to the "device.id" semantic +// conventions. It represents a unique identifier representing the device. +func DeviceID(val string) attribute.KeyValue { + return DeviceIDKey.String(val) +} + +// DeviceManufacturer returns an attribute KeyValue conforming to the +// "device.manufacturer" semantic conventions. It represents the name of the +// device manufacturer. +func DeviceManufacturer(val string) attribute.KeyValue { + return DeviceManufacturerKey.String(val) +} + +// DeviceModelIdentifier returns an attribute KeyValue conforming to the +// "device.model.identifier" semantic conventions. It represents the model +// identifier for the device. +func DeviceModelIdentifier(val string) attribute.KeyValue { + return DeviceModelIdentifierKey.String(val) +} + +// DeviceModelName returns an attribute KeyValue conforming to the +// "device.model.name" semantic conventions. It represents the marketing name for +// the device model. +func DeviceModelName(val string) attribute.KeyValue { + return DeviceModelNameKey.String(val) +} + +// Namespace: disk +const ( + // DiskIODirectionKey is the attribute Key conforming to the "disk.io.direction" + // semantic conventions. It represents the disk IO operation direction. + // + // Type: Enum + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: "read" + DiskIODirectionKey = attribute.Key("disk.io.direction") +) + +// Enum values for disk.io.direction +var ( + // read + // Stability: development + DiskIODirectionRead = DiskIODirectionKey.String("read") + // write + // Stability: development + DiskIODirectionWrite = DiskIODirectionKey.String("write") +) + +// Namespace: dns +const ( + // DNSAnswersKey is the attribute Key conforming to the "dns.answers" semantic + // conventions. It represents the list of IPv4 or IPv6 addresses resolved during + // DNS lookup. + // + // Type: string[] + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: "10.0.0.1", "2001:0db8:85a3:0000:0000:8a2e:0370:7334" + DNSAnswersKey = attribute.Key("dns.answers") + + // DNSQuestionNameKey is the attribute Key conforming to the "dns.question.name" + // semantic conventions. It represents the name being queried. + // + // Type: string + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: "www.example.com", "opentelemetry.io" + // Note: If the name field contains non-printable characters (below 32 or above + // 126), those characters should be represented as escaped base 10 integers + // (\DDD). Back slashes and quotes should be escaped. Tabs, carriage returns, + // and line feeds should be converted to \t, \r, and \n respectively. + DNSQuestionNameKey = attribute.Key("dns.question.name") +) + +// DNSAnswers returns an attribute KeyValue conforming to the "dns.answers" +// semantic conventions. It represents the list of IPv4 or IPv6 addresses +// resolved during DNS lookup. +func DNSAnswers(val ...string) attribute.KeyValue { + return DNSAnswersKey.StringSlice(val) +} + +// DNSQuestionName returns an attribute KeyValue conforming to the +// "dns.question.name" semantic conventions. It represents the name being +// queried. +func DNSQuestionName(val string) attribute.KeyValue { + return DNSQuestionNameKey.String(val) +} + +// Namespace: elasticsearch +const ( + // ElasticsearchNodeNameKey is the attribute Key conforming to the + // "elasticsearch.node.name" semantic conventions. It represents the represents + // the human-readable identifier of the node/instance to which a request was + // routed. + // + // Type: string + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: "instance-0000000001" + ElasticsearchNodeNameKey = attribute.Key("elasticsearch.node.name") +) + +// ElasticsearchNodeName returns an attribute KeyValue conforming to the +// "elasticsearch.node.name" semantic conventions. It represents the represents +// the human-readable identifier of the node/instance to which a request was +// routed. +func ElasticsearchNodeName(val string) attribute.KeyValue { + return ElasticsearchNodeNameKey.String(val) +} + +// Namespace: enduser +const ( + // EnduserIDKey is the attribute Key conforming to the "enduser.id" semantic + // conventions. It represents the unique identifier of an end user in the + // system. It maybe a username, email address, or other identifier. + // + // Type: string + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: "username" + // Note: Unique identifier of an end user in the system. + // + // > [!Warning] + // > This field contains sensitive (PII) information. + EnduserIDKey = attribute.Key("enduser.id") + + // EnduserPseudoIDKey is the attribute Key conforming to the "enduser.pseudo.id" + // semantic conventions. It represents the pseudonymous identifier of an end + // user. This identifier should be a random value that is not directly linked or + // associated with the end user's actual identity. + // + // Type: string + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: "QdH5CAWJgqVT4rOr0qtumf" + // Note: Pseudonymous identifier of an end user. + // + // > [!Warning] + // > This field contains sensitive (linkable PII) information. + EnduserPseudoIDKey = attribute.Key("enduser.pseudo.id") +) + +// EnduserID returns an attribute KeyValue conforming to the "enduser.id" +// semantic conventions. It represents the unique identifier of an end user in +// the system. It maybe a username, email address, or other identifier. +func EnduserID(val string) attribute.KeyValue { + return EnduserIDKey.String(val) +} + +// EnduserPseudoID returns an attribute KeyValue conforming to the +// "enduser.pseudo.id" semantic conventions. It represents the pseudonymous +// identifier of an end user. This identifier should be a random value that is +// not directly linked or associated with the end user's actual identity. +func EnduserPseudoID(val string) attribute.KeyValue { + return EnduserPseudoIDKey.String(val) +} + +// Namespace: error +const ( + // ErrorMessageKey is the attribute Key conforming to the "error.message" + // semantic conventions. It represents a message providing more detail about an + // error in human-readable form. + // + // Type: string + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: "Unexpected input type: string", "The user has exceeded their + // storage quota" + // Note: `error.message` should provide additional context and detail about an + // error. + // It is NOT RECOMMENDED to duplicate the value of `error.type` in + // `error.message`. + // It is also NOT RECOMMENDED to duplicate the value of `exception.message` in + // `error.message`. + // + // `error.message` is NOT RECOMMENDED for metrics or spans due to its unbounded + // cardinality and overlap with span status. + ErrorMessageKey = attribute.Key("error.message") + + // ErrorTypeKey is the attribute Key conforming to the "error.type" semantic + // conventions. It represents the describes a class of error the operation ended + // with. + // + // Type: Enum + // RequirementLevel: Recommended + // Stability: Stable + // + // Examples: "timeout", "java.net.UnknownHostException", + // "server_certificate_invalid", "500" + // Note: The `error.type` SHOULD be predictable, and SHOULD have low + // cardinality. + // + // When `error.type` is set to a type (e.g., an exception type), its + // canonical class name identifying the type within the artifact SHOULD be used. + // + // Instrumentations SHOULD document the list of errors they report. + // + // The cardinality of `error.type` within one instrumentation library SHOULD be + // low. + // Telemetry consumers that aggregate data from multiple instrumentation + // libraries and applications + // should be prepared for `error.type` to have high cardinality at query time + // when no + // additional filters are applied. + // + // If the operation has completed successfully, instrumentations SHOULD NOT set + // `error.type`. + // + // If a specific domain defines its own set of error identifiers (such as HTTP + // or gRPC status codes), + // it's RECOMMENDED to: + // + // - Use a domain-specific attribute + // - Set `error.type` to capture all errors, regardless of whether they are + // defined within the domain-specific set or not. + ErrorTypeKey = attribute.Key("error.type") +) + +// ErrorMessage returns an attribute KeyValue conforming to the "error.message" +// semantic conventions. It represents a message providing more detail about an +// error in human-readable form. +func ErrorMessage(val string) attribute.KeyValue { + return ErrorMessageKey.String(val) +} + +// Enum values for error.type +var ( + // A fallback error value to be used when the instrumentation doesn't define a + // custom value. + // + // Stability: stable + ErrorTypeOther = ErrorTypeKey.String("_OTHER") +) + +// Namespace: exception +const ( + // ExceptionMessageKey is the attribute Key conforming to the + // "exception.message" semantic conventions. It represents the exception + // message. + // + // Type: string + // RequirementLevel: Recommended + // Stability: Stable + // + // Examples: "Division by zero", "Can't convert 'int' object to str implicitly" + ExceptionMessageKey = attribute.Key("exception.message") + + // ExceptionStacktraceKey is the attribute Key conforming to the + // "exception.stacktrace" semantic conventions. It represents a stacktrace as a + // string in the natural representation for the language runtime. The + // representation is to be determined and documented by each language SIG. + // + // Type: string + // RequirementLevel: Recommended + // Stability: Stable + // + // Examples: Exception in thread "main" java.lang.RuntimeException: Test + // exception\n at com.example.GenerateTrace.methodB(GenerateTrace.java:13)\n at + // com.example.GenerateTrace.methodA(GenerateTrace.java:9)\n at + // com.example.GenerateTrace.main(GenerateTrace.java:5) + ExceptionStacktraceKey = attribute.Key("exception.stacktrace") + + // ExceptionTypeKey is the attribute Key conforming to the "exception.type" + // semantic conventions. It represents the type of the exception (its + // fully-qualified class name, if applicable). The dynamic type of the exception + // should be preferred over the static type in languages that support it. + // + // Type: string + // RequirementLevel: Recommended + // Stability: Stable + // + // Examples: "java.net.ConnectException", "OSError" + ExceptionTypeKey = attribute.Key("exception.type") +) + +// ExceptionMessage returns an attribute KeyValue conforming to the +// "exception.message" semantic conventions. It represents the exception message. +func ExceptionMessage(val string) attribute.KeyValue { + return ExceptionMessageKey.String(val) +} + +// ExceptionStacktrace returns an attribute KeyValue conforming to the +// "exception.stacktrace" semantic conventions. It represents a stacktrace as a +// string in the natural representation for the language runtime. The +// representation is to be determined and documented by each language SIG. +func ExceptionStacktrace(val string) attribute.KeyValue { + return ExceptionStacktraceKey.String(val) +} + +// ExceptionType returns an attribute KeyValue conforming to the "exception.type" +// semantic conventions. It represents the type of the exception (its +// fully-qualified class name, if applicable). The dynamic type of the exception +// should be preferred over the static type in languages that support it. +func ExceptionType(val string) attribute.KeyValue { + return ExceptionTypeKey.String(val) +} + +// Namespace: faas +const ( + // FaaSColdstartKey is the attribute Key conforming to the "faas.coldstart" + // semantic conventions. It represents a boolean that is true if the serverless + // function is executed for the first time (aka cold-start). + // + // Type: boolean + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: + FaaSColdstartKey = attribute.Key("faas.coldstart") + + // FaaSCronKey is the attribute Key conforming to the "faas.cron" semantic + // conventions. It represents a string containing the schedule period as + // [Cron Expression]. + // + // Type: string + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: 0/5 * * * ? * + // + // [Cron Expression]: https://docs.oracle.com/cd/E12058_01/doc/doc.1014/e12030/cron_expressions.htm + FaaSCronKey = attribute.Key("faas.cron") + + // FaaSDocumentCollectionKey is the attribute Key conforming to the + // "faas.document.collection" semantic conventions. It represents the name of + // the source on which the triggering operation was performed. For example, in + // Cloud Storage or S3 corresponds to the bucket name, and in Cosmos DB to the + // database name. + // + // Type: string + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: "myBucketName", "myDbName" + FaaSDocumentCollectionKey = attribute.Key("faas.document.collection") + + // FaaSDocumentNameKey is the attribute Key conforming to the + // "faas.document.name" semantic conventions. It represents the document + // name/table subjected to the operation. For example, in Cloud Storage or S3 is + // the name of the file, and in Cosmos DB the table name. + // + // Type: string + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: "myFile.txt", "myTableName" + FaaSDocumentNameKey = attribute.Key("faas.document.name") + + // FaaSDocumentOperationKey is the attribute Key conforming to the + // "faas.document.operation" semantic conventions. It represents the describes + // the type of the operation that was performed on the data. + // + // Type: Enum + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: + FaaSDocumentOperationKey = attribute.Key("faas.document.operation") + + // FaaSDocumentTimeKey is the attribute Key conforming to the + // "faas.document.time" semantic conventions. It represents a string containing + // the time when the data was accessed in the [ISO 8601] format expressed in + // [UTC]. + // + // Type: string + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: 2020-01-23T13:47:06Z + // + // [ISO 8601]: https://www.iso.org/iso-8601-date-and-time-format.html + // [UTC]: https://www.w3.org/TR/NOTE-datetime + FaaSDocumentTimeKey = attribute.Key("faas.document.time") + + // FaaSInstanceKey is the attribute Key conforming to the "faas.instance" + // semantic conventions. It represents the execution environment ID as a string, + // that will be potentially reused for other invocations to the same + // function/function version. + // + // Type: string + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: "2021/06/28/[$LATEST]2f399eb14537447da05ab2a2e39309de" + // Note: - **AWS Lambda:** Use the (full) log stream name. + FaaSInstanceKey = attribute.Key("faas.instance") + + // FaaSInvocationIDKey is the attribute Key conforming to the + // "faas.invocation_id" semantic conventions. It represents the invocation ID of + // the current function invocation. + // + // Type: string + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: af9d5aa4-a685-4c5f-a22b-444f80b3cc28 + FaaSInvocationIDKey = attribute.Key("faas.invocation_id") + + // FaaSInvokedNameKey is the attribute Key conforming to the "faas.invoked_name" + // semantic conventions. It represents the name of the invoked function. + // + // Type: string + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: my-function + // Note: SHOULD be equal to the `faas.name` resource attribute of the invoked + // function. + FaaSInvokedNameKey = attribute.Key("faas.invoked_name") + + // FaaSInvokedProviderKey is the attribute Key conforming to the + // "faas.invoked_provider" semantic conventions. It represents the cloud + // provider of the invoked function. + // + // Type: Enum + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: + // Note: SHOULD be equal to the `cloud.provider` resource attribute of the + // invoked function. + FaaSInvokedProviderKey = attribute.Key("faas.invoked_provider") + + // FaaSInvokedRegionKey is the attribute Key conforming to the + // "faas.invoked_region" semantic conventions. It represents the cloud region of + // the invoked function. + // + // Type: string + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: eu-central-1 + // Note: SHOULD be equal to the `cloud.region` resource attribute of the invoked + // function. + FaaSInvokedRegionKey = attribute.Key("faas.invoked_region") + + // FaaSMaxMemoryKey is the attribute Key conforming to the "faas.max_memory" + // semantic conventions. It represents the amount of memory available to the + // serverless function converted to Bytes. + // + // Type: int + // RequirementLevel: Recommended + // Stability: Development + // + // Note: It's recommended to set this attribute since e.g. too little memory can + // easily stop a Java AWS Lambda function from working correctly. On AWS Lambda, + // the environment variable `AWS_LAMBDA_FUNCTION_MEMORY_SIZE` provides this + // information (which must be multiplied by 1,048,576). + FaaSMaxMemoryKey = attribute.Key("faas.max_memory") + + // FaaSNameKey is the attribute Key conforming to the "faas.name" semantic + // conventions. It represents the name of the single function that this runtime + // instance executes. + // + // Type: string + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: "my-function", "myazurefunctionapp/some-function-name" + // Note: This is the name of the function as configured/deployed on the FaaS + // platform and is usually different from the name of the callback + // function (which may be stored in the + // [`code.namespace`/`code.function.name`] + // span attributes). + // + // For some cloud providers, the above definition is ambiguous. The following + // definition of function name MUST be used for this attribute + // (and consequently the span name) for the listed cloud providers/products: + // + // - **Azure:** The full name `/`, i.e., function app name + // followed by a forward slash followed by the function name (this form + // can also be seen in the resource JSON for the function). + // This means that a span attribute MUST be used, as an Azure function + // app can host multiple functions that would usually share + // a TracerProvider (see also the `cloud.resource_id` attribute). + // + // + // [`code.namespace`/`code.function.name`]: /docs/general/attributes.md#source-code-attributes + FaaSNameKey = attribute.Key("faas.name") + + // FaaSTimeKey is the attribute Key conforming to the "faas.time" semantic + // conventions. It represents a string containing the function invocation time + // in the [ISO 8601] format expressed in [UTC]. + // + // Type: string + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: 2020-01-23T13:47:06Z + // + // [ISO 8601]: https://www.iso.org/iso-8601-date-and-time-format.html + // [UTC]: https://www.w3.org/TR/NOTE-datetime + FaaSTimeKey = attribute.Key("faas.time") + + // FaaSTriggerKey is the attribute Key conforming to the "faas.trigger" semantic + // conventions. It represents the type of the trigger which caused this function + // invocation. + // + // Type: Enum + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: + FaaSTriggerKey = attribute.Key("faas.trigger") + + // FaaSVersionKey is the attribute Key conforming to the "faas.version" semantic + // conventions. It represents the immutable version of the function being + // executed. + // + // Type: string + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: "26", "pinkfroid-00002" + // Note: Depending on the cloud provider and platform, use: + // + // - **AWS Lambda:** The [function version] + // (an integer represented as a decimal string). + // - **Google Cloud Run (Services):** The [revision] + // (i.e., the function name plus the revision suffix). + // - **Google Cloud Functions:** The value of the + // [`K_REVISION` environment variable]. + // - **Azure Functions:** Not applicable. Do not set this attribute. + // + // + // [function version]: https://docs.aws.amazon.com/lambda/latest/dg/configuration-versions.html + // [revision]: https://cloud.google.com/run/docs/managing/revisions + // [`K_REVISION` environment variable]: https://cloud.google.com/functions/docs/env-var#runtime_environment_variables_set_automatically + FaaSVersionKey = attribute.Key("faas.version") +) + +// FaaSColdstart returns an attribute KeyValue conforming to the "faas.coldstart" +// semantic conventions. It represents a boolean that is true if the serverless +// function is executed for the first time (aka cold-start). +func FaaSColdstart(val bool) attribute.KeyValue { + return FaaSColdstartKey.Bool(val) +} + +// FaaSCron returns an attribute KeyValue conforming to the "faas.cron" semantic +// conventions. It represents a string containing the schedule period as +// [Cron Expression]. +// +// [Cron Expression]: https://docs.oracle.com/cd/E12058_01/doc/doc.1014/e12030/cron_expressions.htm +func FaaSCron(val string) attribute.KeyValue { + return FaaSCronKey.String(val) +} + +// FaaSDocumentCollection returns an attribute KeyValue conforming to the +// "faas.document.collection" semantic conventions. It represents the name of the +// source on which the triggering operation was performed. For example, in Cloud +// Storage or S3 corresponds to the bucket name, and in Cosmos DB to the database +// name. +func FaaSDocumentCollection(val string) attribute.KeyValue { + return FaaSDocumentCollectionKey.String(val) +} + +// FaaSDocumentName returns an attribute KeyValue conforming to the +// "faas.document.name" semantic conventions. It represents the document +// name/table subjected to the operation. For example, in Cloud Storage or S3 is +// the name of the file, and in Cosmos DB the table name. +func FaaSDocumentName(val string) attribute.KeyValue { + return FaaSDocumentNameKey.String(val) +} + +// FaaSDocumentTime returns an attribute KeyValue conforming to the +// "faas.document.time" semantic conventions. It represents a string containing +// the time when the data was accessed in the [ISO 8601] format expressed in +// [UTC]. +// +// [ISO 8601]: https://www.iso.org/iso-8601-date-and-time-format.html +// [UTC]: https://www.w3.org/TR/NOTE-datetime +func FaaSDocumentTime(val string) attribute.KeyValue { + return FaaSDocumentTimeKey.String(val) +} + +// FaaSInstance returns an attribute KeyValue conforming to the "faas.instance" +// semantic conventions. It represents the execution environment ID as a string, +// that will be potentially reused for other invocations to the same +// function/function version. +func FaaSInstance(val string) attribute.KeyValue { + return FaaSInstanceKey.String(val) +} + +// FaaSInvocationID returns an attribute KeyValue conforming to the +// "faas.invocation_id" semantic conventions. It represents the invocation ID of +// the current function invocation. +func FaaSInvocationID(val string) attribute.KeyValue { + return FaaSInvocationIDKey.String(val) +} + +// FaaSInvokedName returns an attribute KeyValue conforming to the +// "faas.invoked_name" semantic conventions. It represents the name of the +// invoked function. +func FaaSInvokedName(val string) attribute.KeyValue { + return FaaSInvokedNameKey.String(val) +} + +// FaaSInvokedRegion returns an attribute KeyValue conforming to the +// "faas.invoked_region" semantic conventions. It represents the cloud region of +// the invoked function. +func FaaSInvokedRegion(val string) attribute.KeyValue { + return FaaSInvokedRegionKey.String(val) +} + +// FaaSMaxMemory returns an attribute KeyValue conforming to the +// "faas.max_memory" semantic conventions. It represents the amount of memory +// available to the serverless function converted to Bytes. +func FaaSMaxMemory(val int) attribute.KeyValue { + return FaaSMaxMemoryKey.Int(val) +} + +// FaaSName returns an attribute KeyValue conforming to the "faas.name" semantic +// conventions. It represents the name of the single function that this runtime +// instance executes. +func FaaSName(val string) attribute.KeyValue { + return FaaSNameKey.String(val) +} + +// FaaSTime returns an attribute KeyValue conforming to the "faas.time" semantic +// conventions. It represents a string containing the function invocation time in +// the [ISO 8601] format expressed in [UTC]. +// +// [ISO 8601]: https://www.iso.org/iso-8601-date-and-time-format.html +// [UTC]: https://www.w3.org/TR/NOTE-datetime +func FaaSTime(val string) attribute.KeyValue { + return FaaSTimeKey.String(val) +} + +// FaaSVersion returns an attribute KeyValue conforming to the "faas.version" +// semantic conventions. It represents the immutable version of the function +// being executed. +func FaaSVersion(val string) attribute.KeyValue { + return FaaSVersionKey.String(val) +} + +// Enum values for faas.document.operation +var ( + // When a new object is created. + // Stability: development + FaaSDocumentOperationInsert = FaaSDocumentOperationKey.String("insert") + // When an object is modified. + // Stability: development + FaaSDocumentOperationEdit = FaaSDocumentOperationKey.String("edit") + // When an object is deleted. + // Stability: development + FaaSDocumentOperationDelete = FaaSDocumentOperationKey.String("delete") +) + +// Enum values for faas.invoked_provider +var ( + // Alibaba Cloud + // Stability: development + FaaSInvokedProviderAlibabaCloud = FaaSInvokedProviderKey.String("alibaba_cloud") + // Amazon Web Services + // Stability: development + FaaSInvokedProviderAWS = FaaSInvokedProviderKey.String("aws") + // Microsoft Azure + // Stability: development + FaaSInvokedProviderAzure = FaaSInvokedProviderKey.String("azure") + // Google Cloud Platform + // Stability: development + FaaSInvokedProviderGCP = FaaSInvokedProviderKey.String("gcp") + // Tencent Cloud + // Stability: development + FaaSInvokedProviderTencentCloud = FaaSInvokedProviderKey.String("tencent_cloud") +) + +// Enum values for faas.trigger +var ( + // A response to some data source operation such as a database or filesystem + // read/write + // Stability: development + FaaSTriggerDatasource = FaaSTriggerKey.String("datasource") + // To provide an answer to an inbound HTTP request + // Stability: development + FaaSTriggerHTTP = FaaSTriggerKey.String("http") + // A function is set to be executed when messages are sent to a messaging system + // Stability: development + FaaSTriggerPubSub = FaaSTriggerKey.String("pubsub") + // A function is scheduled to be executed regularly + // Stability: development + FaaSTriggerTimer = FaaSTriggerKey.String("timer") + // If none of the others apply + // Stability: development + FaaSTriggerOther = FaaSTriggerKey.String("other") +) + +// Namespace: feature_flag +const ( + // FeatureFlagContextIDKey is the attribute Key conforming to the + // "feature_flag.context.id" semantic conventions. It represents the unique + // identifier for the flag evaluation context. For example, the targeting key. + // + // Type: string + // RequirementLevel: Recommended + // Stability: Release_Candidate + // + // Examples: "5157782b-2203-4c80-a857-dbbd5e7761db" + FeatureFlagContextIDKey = attribute.Key("feature_flag.context.id") + + // FeatureFlagKeyKey is the attribute Key conforming to the "feature_flag.key" + // semantic conventions. It represents the lookup key of the feature flag. + // + // Type: string + // RequirementLevel: Recommended + // Stability: Release_Candidate + // + // Examples: "logo-color" + FeatureFlagKeyKey = attribute.Key("feature_flag.key") + + // FeatureFlagProviderNameKey is the attribute Key conforming to the + // "feature_flag.provider.name" semantic conventions. It represents the + // identifies the feature flag provider. + // + // Type: string + // RequirementLevel: Recommended + // Stability: Release_Candidate + // + // Examples: "Flag Manager" + FeatureFlagProviderNameKey = attribute.Key("feature_flag.provider.name") + + // FeatureFlagResultReasonKey is the attribute Key conforming to the + // "feature_flag.result.reason" semantic conventions. It represents the reason + // code which shows how a feature flag value was determined. + // + // Type: Enum + // RequirementLevel: Recommended + // Stability: Release_Candidate + // + // Examples: "static", "targeting_match", "error", "default" + FeatureFlagResultReasonKey = attribute.Key("feature_flag.result.reason") + + // FeatureFlagResultValueKey is the attribute Key conforming to the + // "feature_flag.result.value" semantic conventions. It represents the evaluated + // value of the feature flag. + // + // Type: any + // RequirementLevel: Recommended + // Stability: Release_Candidate + // + // Examples: "#ff0000", true, 3 + // Note: With some feature flag providers, feature flag results can be quite + // large or contain private or sensitive details. + // Because of this, `feature_flag.result.variant` is often the preferred + // attribute if it is available. + // + // It may be desirable to redact or otherwise limit the size and scope of + // `feature_flag.result.value` if possible. + // Because the evaluated flag value is unstructured and may be any type, it is + // left to the instrumentation author to determine how best to achieve this. + FeatureFlagResultValueKey = attribute.Key("feature_flag.result.value") + + // FeatureFlagResultVariantKey is the attribute Key conforming to the + // "feature_flag.result.variant" semantic conventions. It represents a semantic + // identifier for an evaluated flag value. + // + // Type: string + // RequirementLevel: Recommended + // Stability: Release_Candidate + // + // Examples: "red", "true", "on" + // Note: A semantic identifier, commonly referred to as a variant, provides a + // means + // for referring to a value without including the value itself. This can + // provide additional context for understanding the meaning behind a value. + // For example, the variant `red` maybe be used for the value `#c05543`. + FeatureFlagResultVariantKey = attribute.Key("feature_flag.result.variant") + + // FeatureFlagSetIDKey is the attribute Key conforming to the + // "feature_flag.set.id" semantic conventions. It represents the identifier of + // the [flag set] to which the feature flag belongs. + // + // Type: string + // RequirementLevel: Recommended + // Stability: Release_Candidate + // + // Examples: "proj-1", "ab98sgs", "service1/dev" + // + // [flag set]: https://openfeature.dev/specification/glossary/#flag-set + FeatureFlagSetIDKey = attribute.Key("feature_flag.set.id") + + // FeatureFlagVersionKey is the attribute Key conforming to the + // "feature_flag.version" semantic conventions. It represents the version of the + // ruleset used during the evaluation. This may be any stable value which + // uniquely identifies the ruleset. + // + // Type: string + // RequirementLevel: Recommended + // Stability: Release_Candidate + // + // Examples: "1", "01ABCDEF" + FeatureFlagVersionKey = attribute.Key("feature_flag.version") +) + +// FeatureFlagContextID returns an attribute KeyValue conforming to the +// "feature_flag.context.id" semantic conventions. It represents the unique +// identifier for the flag evaluation context. For example, the targeting key. +func FeatureFlagContextID(val string) attribute.KeyValue { + return FeatureFlagContextIDKey.String(val) +} + +// FeatureFlagKey returns an attribute KeyValue conforming to the +// "feature_flag.key" semantic conventions. It represents the lookup key of the +// feature flag. +func FeatureFlagKey(val string) attribute.KeyValue { + return FeatureFlagKeyKey.String(val) +} + +// FeatureFlagProviderName returns an attribute KeyValue conforming to the +// "feature_flag.provider.name" semantic conventions. It represents the +// identifies the feature flag provider. +func FeatureFlagProviderName(val string) attribute.KeyValue { + return FeatureFlagProviderNameKey.String(val) +} + +// FeatureFlagResultVariant returns an attribute KeyValue conforming to the +// "feature_flag.result.variant" semantic conventions. It represents a semantic +// identifier for an evaluated flag value. +func FeatureFlagResultVariant(val string) attribute.KeyValue { + return FeatureFlagResultVariantKey.String(val) +} + +// FeatureFlagSetID returns an attribute KeyValue conforming to the +// "feature_flag.set.id" semantic conventions. It represents the identifier of +// the [flag set] to which the feature flag belongs. +// +// [flag set]: https://openfeature.dev/specification/glossary/#flag-set +func FeatureFlagSetID(val string) attribute.KeyValue { + return FeatureFlagSetIDKey.String(val) +} + +// FeatureFlagVersion returns an attribute KeyValue conforming to the +// "feature_flag.version" semantic conventions. It represents the version of the +// ruleset used during the evaluation. This may be any stable value which +// uniquely identifies the ruleset. +func FeatureFlagVersion(val string) attribute.KeyValue { + return FeatureFlagVersionKey.String(val) +} + +// Enum values for feature_flag.result.reason +var ( + // The resolved value is static (no dynamic evaluation). + // Stability: release_candidate + FeatureFlagResultReasonStatic = FeatureFlagResultReasonKey.String("static") + // The resolved value fell back to a pre-configured value (no dynamic evaluation + // occurred or dynamic evaluation yielded no result). + // Stability: release_candidate + FeatureFlagResultReasonDefault = FeatureFlagResultReasonKey.String("default") + // The resolved value was the result of a dynamic evaluation, such as a rule or + // specific user-targeting. + // Stability: release_candidate + FeatureFlagResultReasonTargetingMatch = FeatureFlagResultReasonKey.String("targeting_match") + // The resolved value was the result of pseudorandom assignment. + // Stability: release_candidate + FeatureFlagResultReasonSplit = FeatureFlagResultReasonKey.String("split") + // The resolved value was retrieved from cache. + // Stability: release_candidate + FeatureFlagResultReasonCached = FeatureFlagResultReasonKey.String("cached") + // The resolved value was the result of the flag being disabled in the + // management system. + // Stability: release_candidate + FeatureFlagResultReasonDisabled = FeatureFlagResultReasonKey.String("disabled") + // The reason for the resolved value could not be determined. + // Stability: release_candidate + FeatureFlagResultReasonUnknown = FeatureFlagResultReasonKey.String("unknown") + // The resolved value is non-authoritative or possibly out of date + // Stability: release_candidate + FeatureFlagResultReasonStale = FeatureFlagResultReasonKey.String("stale") + // The resolved value was the result of an error. + // Stability: release_candidate + FeatureFlagResultReasonError = FeatureFlagResultReasonKey.String("error") +) + +// Namespace: file +const ( + // FileAccessedKey is the attribute Key conforming to the "file.accessed" + // semantic conventions. It represents the time when the file was last accessed, + // in ISO 8601 format. + // + // Type: string + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: "2021-01-01T12:00:00Z" + // Note: This attribute might not be supported by some file systems — NFS, + // FAT32, in embedded OS, etc. + FileAccessedKey = attribute.Key("file.accessed") + + // FileAttributesKey is the attribute Key conforming to the "file.attributes" + // semantic conventions. It represents the array of file attributes. + // + // Type: string[] + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: "readonly", "hidden" + // Note: Attributes names depend on the OS or file system. Here’s a + // non-exhaustive list of values expected for this attribute: `archive`, + // `compressed`, `directory`, `encrypted`, `execute`, `hidden`, `immutable`, + // `journaled`, `read`, `readonly`, `symbolic link`, `system`, `temporary`, + // `write`. + FileAttributesKey = attribute.Key("file.attributes") + + // FileChangedKey is the attribute Key conforming to the "file.changed" semantic + // conventions. It represents the time when the file attributes or metadata was + // last changed, in ISO 8601 format. + // + // Type: string + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: "2021-01-01T12:00:00Z" + // Note: `file.changed` captures the time when any of the file's properties or + // attributes (including the content) are changed, while `file.modified` + // captures the timestamp when the file content is modified. + FileChangedKey = attribute.Key("file.changed") + + // FileCreatedKey is the attribute Key conforming to the "file.created" semantic + // conventions. It represents the time when the file was created, in ISO 8601 + // format. + // + // Type: string + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: "2021-01-01T12:00:00Z" + // Note: This attribute might not be supported by some file systems — NFS, + // FAT32, in embedded OS, etc. + FileCreatedKey = attribute.Key("file.created") + + // FileDirectoryKey is the attribute Key conforming to the "file.directory" + // semantic conventions. It represents the directory where the file is located. + // It should include the drive letter, when appropriate. + // + // Type: string + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: "/home/user", "C:\Program Files\MyApp" + FileDirectoryKey = attribute.Key("file.directory") + + // FileExtensionKey is the attribute Key conforming to the "file.extension" + // semantic conventions. It represents the file extension, excluding the leading + // dot. + // + // Type: string + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: "png", "gz" + // Note: When the file name has multiple extensions (example.tar.gz), only the + // last one should be captured ("gz", not "tar.gz"). + FileExtensionKey = attribute.Key("file.extension") + + // FileForkNameKey is the attribute Key conforming to the "file.fork_name" + // semantic conventions. It represents the name of the fork. A fork is + // additional data associated with a filesystem object. + // + // Type: string + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: "Zone.Identifier" + // Note: On Linux, a resource fork is used to store additional data with a + // filesystem object. A file always has at least one fork for the data portion, + // and additional forks may exist. + // On NTFS, this is analogous to an Alternate Data Stream (ADS), and the default + // data stream for a file is just called $DATA. Zone.Identifier is commonly used + // by Windows to track contents downloaded from the Internet. An ADS is + // typically of the form: C:\path\to\filename.extension:some_fork_name, and + // some_fork_name is the value that should populate `fork_name`. + // `filename.extension` should populate `file.name`, and `extension` should + // populate `file.extension`. The full path, `file.path`, will include the fork + // name. + FileForkNameKey = attribute.Key("file.fork_name") + + // FileGroupIDKey is the attribute Key conforming to the "file.group.id" + // semantic conventions. It represents the primary Group ID (GID) of the file. + // + // Type: string + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: "1000" + FileGroupIDKey = attribute.Key("file.group.id") + + // FileGroupNameKey is the attribute Key conforming to the "file.group.name" + // semantic conventions. It represents the primary group name of the file. + // + // Type: string + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: "users" + FileGroupNameKey = attribute.Key("file.group.name") + + // FileInodeKey is the attribute Key conforming to the "file.inode" semantic + // conventions. It represents the inode representing the file in the filesystem. + // + // Type: string + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: "256383" + FileInodeKey = attribute.Key("file.inode") + + // FileModeKey is the attribute Key conforming to the "file.mode" semantic + // conventions. It represents the mode of the file in octal representation. + // + // Type: string + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: "0640" + FileModeKey = attribute.Key("file.mode") + + // FileModifiedKey is the attribute Key conforming to the "file.modified" + // semantic conventions. It represents the time when the file content was last + // modified, in ISO 8601 format. + // + // Type: string + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: "2021-01-01T12:00:00Z" + FileModifiedKey = attribute.Key("file.modified") + + // FileNameKey is the attribute Key conforming to the "file.name" semantic + // conventions. It represents the name of the file including the extension, + // without the directory. + // + // Type: string + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: "example.png" + FileNameKey = attribute.Key("file.name") + + // FileOwnerIDKey is the attribute Key conforming to the "file.owner.id" + // semantic conventions. It represents the user ID (UID) or security identifier + // (SID) of the file owner. + // + // Type: string + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: "1000" + FileOwnerIDKey = attribute.Key("file.owner.id") + + // FileOwnerNameKey is the attribute Key conforming to the "file.owner.name" + // semantic conventions. It represents the username of the file owner. + // + // Type: string + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: "root" + FileOwnerNameKey = attribute.Key("file.owner.name") + + // FilePathKey is the attribute Key conforming to the "file.path" semantic + // conventions. It represents the full path to the file, including the file + // name. It should include the drive letter, when appropriate. + // + // Type: string + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: "/home/alice/example.png", "C:\Program Files\MyApp\myapp.exe" + FilePathKey = attribute.Key("file.path") + + // FileSizeKey is the attribute Key conforming to the "file.size" semantic + // conventions. It represents the file size in bytes. + // + // Type: int + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: + FileSizeKey = attribute.Key("file.size") + + // FileSymbolicLinkTargetPathKey is the attribute Key conforming to the + // "file.symbolic_link.target_path" semantic conventions. It represents the path + // to the target of a symbolic link. + // + // Type: string + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: "/usr/bin/python3" + // Note: This attribute is only applicable to symbolic links. + FileSymbolicLinkTargetPathKey = attribute.Key("file.symbolic_link.target_path") +) + +// FileAccessed returns an attribute KeyValue conforming to the "file.accessed" +// semantic conventions. It represents the time when the file was last accessed, +// in ISO 8601 format. +func FileAccessed(val string) attribute.KeyValue { + return FileAccessedKey.String(val) +} + +// FileAttributes returns an attribute KeyValue conforming to the +// "file.attributes" semantic conventions. It represents the array of file +// attributes. +func FileAttributes(val ...string) attribute.KeyValue { + return FileAttributesKey.StringSlice(val) +} + +// FileChanged returns an attribute KeyValue conforming to the "file.changed" +// semantic conventions. It represents the time when the file attributes or +// metadata was last changed, in ISO 8601 format. +func FileChanged(val string) attribute.KeyValue { + return FileChangedKey.String(val) +} + +// FileCreated returns an attribute KeyValue conforming to the "file.created" +// semantic conventions. It represents the time when the file was created, in ISO +// 8601 format. +func FileCreated(val string) attribute.KeyValue { + return FileCreatedKey.String(val) +} + +// FileDirectory returns an attribute KeyValue conforming to the "file.directory" +// semantic conventions. It represents the directory where the file is located. +// It should include the drive letter, when appropriate. +func FileDirectory(val string) attribute.KeyValue { + return FileDirectoryKey.String(val) +} + +// FileExtension returns an attribute KeyValue conforming to the "file.extension" +// semantic conventions. It represents the file extension, excluding the leading +// dot. +func FileExtension(val string) attribute.KeyValue { + return FileExtensionKey.String(val) +} + +// FileForkName returns an attribute KeyValue conforming to the "file.fork_name" +// semantic conventions. It represents the name of the fork. A fork is additional +// data associated with a filesystem object. +func FileForkName(val string) attribute.KeyValue { + return FileForkNameKey.String(val) +} + +// FileGroupID returns an attribute KeyValue conforming to the "file.group.id" +// semantic conventions. It represents the primary Group ID (GID) of the file. +func FileGroupID(val string) attribute.KeyValue { + return FileGroupIDKey.String(val) +} + +// FileGroupName returns an attribute KeyValue conforming to the +// "file.group.name" semantic conventions. It represents the primary group name +// of the file. +func FileGroupName(val string) attribute.KeyValue { + return FileGroupNameKey.String(val) +} + +// FileInode returns an attribute KeyValue conforming to the "file.inode" +// semantic conventions. It represents the inode representing the file in the +// filesystem. +func FileInode(val string) attribute.KeyValue { + return FileInodeKey.String(val) +} + +// FileMode returns an attribute KeyValue conforming to the "file.mode" semantic +// conventions. It represents the mode of the file in octal representation. +func FileMode(val string) attribute.KeyValue { + return FileModeKey.String(val) +} + +// FileModified returns an attribute KeyValue conforming to the "file.modified" +// semantic conventions. It represents the time when the file content was last +// modified, in ISO 8601 format. +func FileModified(val string) attribute.KeyValue { + return FileModifiedKey.String(val) +} + +// FileName returns an attribute KeyValue conforming to the "file.name" semantic +// conventions. It represents the name of the file including the extension, +// without the directory. +func FileName(val string) attribute.KeyValue { + return FileNameKey.String(val) +} + +// FileOwnerID returns an attribute KeyValue conforming to the "file.owner.id" +// semantic conventions. It represents the user ID (UID) or security identifier +// (SID) of the file owner. +func FileOwnerID(val string) attribute.KeyValue { + return FileOwnerIDKey.String(val) +} + +// FileOwnerName returns an attribute KeyValue conforming to the +// "file.owner.name" semantic conventions. It represents the username of the file +// owner. +func FileOwnerName(val string) attribute.KeyValue { + return FileOwnerNameKey.String(val) +} + +// FilePath returns an attribute KeyValue conforming to the "file.path" semantic +// conventions. It represents the full path to the file, including the file name. +// It should include the drive letter, when appropriate. +func FilePath(val string) attribute.KeyValue { + return FilePathKey.String(val) +} + +// FileSize returns an attribute KeyValue conforming to the "file.size" semantic +// conventions. It represents the file size in bytes. +func FileSize(val int) attribute.KeyValue { + return FileSizeKey.Int(val) +} + +// FileSymbolicLinkTargetPath returns an attribute KeyValue conforming to the +// "file.symbolic_link.target_path" semantic conventions. It represents the path +// to the target of a symbolic link. +func FileSymbolicLinkTargetPath(val string) attribute.KeyValue { + return FileSymbolicLinkTargetPathKey.String(val) +} + +// Namespace: gcp +const ( + // GCPAppHubApplicationContainerKey is the attribute Key conforming to the + // "gcp.apphub.application.container" semantic conventions. It represents the + // container within GCP where the AppHub application is defined. + // + // Type: string + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: "projects/my-container-project" + GCPAppHubApplicationContainerKey = attribute.Key("gcp.apphub.application.container") + + // GCPAppHubApplicationIDKey is the attribute Key conforming to the + // "gcp.apphub.application.id" semantic conventions. It represents the name of + // the application as configured in AppHub. + // + // Type: string + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: "my-application" + GCPAppHubApplicationIDKey = attribute.Key("gcp.apphub.application.id") + + // GCPAppHubApplicationLocationKey is the attribute Key conforming to the + // "gcp.apphub.application.location" semantic conventions. It represents the GCP + // zone or region where the application is defined. + // + // Type: string + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: "us-central1" + GCPAppHubApplicationLocationKey = attribute.Key("gcp.apphub.application.location") + + // GCPAppHubServiceCriticalityTypeKey is the attribute Key conforming to the + // "gcp.apphub.service.criticality_type" semantic conventions. It represents the + // criticality of a service indicates its importance to the business. + // + // Type: Enum + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: + // Note: [See AppHub type enum] + // + // [See AppHub type enum]: https://cloud.google.com/app-hub/docs/reference/rest/v1/Attributes#type + GCPAppHubServiceCriticalityTypeKey = attribute.Key("gcp.apphub.service.criticality_type") + + // GCPAppHubServiceEnvironmentTypeKey is the attribute Key conforming to the + // "gcp.apphub.service.environment_type" semantic conventions. It represents the + // environment of a service is the stage of a software lifecycle. + // + // Type: Enum + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: + // Note: [See AppHub environment type] + // + // [See AppHub environment type]: https://cloud.google.com/app-hub/docs/reference/rest/v1/Attributes#type_1 + GCPAppHubServiceEnvironmentTypeKey = attribute.Key("gcp.apphub.service.environment_type") + + // GCPAppHubServiceIDKey is the attribute Key conforming to the + // "gcp.apphub.service.id" semantic conventions. It represents the name of the + // service as configured in AppHub. + // + // Type: string + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: "my-service" + GCPAppHubServiceIDKey = attribute.Key("gcp.apphub.service.id") + + // GCPAppHubWorkloadCriticalityTypeKey is the attribute Key conforming to the + // "gcp.apphub.workload.criticality_type" semantic conventions. It represents + // the criticality of a workload indicates its importance to the business. + // + // Type: Enum + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: + // Note: [See AppHub type enum] + // + // [See AppHub type enum]: https://cloud.google.com/app-hub/docs/reference/rest/v1/Attributes#type + GCPAppHubWorkloadCriticalityTypeKey = attribute.Key("gcp.apphub.workload.criticality_type") + + // GCPAppHubWorkloadEnvironmentTypeKey is the attribute Key conforming to the + // "gcp.apphub.workload.environment_type" semantic conventions. It represents + // the environment of a workload is the stage of a software lifecycle. + // + // Type: Enum + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: + // Note: [See AppHub environment type] + // + // [See AppHub environment type]: https://cloud.google.com/app-hub/docs/reference/rest/v1/Attributes#type_1 + GCPAppHubWorkloadEnvironmentTypeKey = attribute.Key("gcp.apphub.workload.environment_type") + + // GCPAppHubWorkloadIDKey is the attribute Key conforming to the + // "gcp.apphub.workload.id" semantic conventions. It represents the name of the + // workload as configured in AppHub. + // + // Type: string + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: "my-workload" + GCPAppHubWorkloadIDKey = attribute.Key("gcp.apphub.workload.id") + + // GCPClientServiceKey is the attribute Key conforming to the + // "gcp.client.service" semantic conventions. It represents the identifies the + // Google Cloud service for which the official client library is intended. + // + // Type: string + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: "appengine", "run", "firestore", "alloydb", "spanner" + // Note: Intended to be a stable identifier for Google Cloud client libraries + // that is uniform across implementation languages. The value should be derived + // from the canonical service domain for the service; for example, + // 'foo.googleapis.com' should result in a value of 'foo'. + GCPClientServiceKey = attribute.Key("gcp.client.service") + + // GCPCloudRunJobExecutionKey is the attribute Key conforming to the + // "gcp.cloud_run.job.execution" semantic conventions. It represents the name of + // the Cloud Run [execution] being run for the Job, as set by the + // [`CLOUD_RUN_EXECUTION`] environment variable. + // + // Type: string + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: "job-name-xxxx", "sample-job-mdw84" + // + // [execution]: https://cloud.google.com/run/docs/managing/job-executions + // [`CLOUD_RUN_EXECUTION`]: https://cloud.google.com/run/docs/container-contract#jobs-env-vars + GCPCloudRunJobExecutionKey = attribute.Key("gcp.cloud_run.job.execution") + + // GCPCloudRunJobTaskIndexKey is the attribute Key conforming to the + // "gcp.cloud_run.job.task_index" semantic conventions. It represents the index + // for a task within an execution as provided by the [`CLOUD_RUN_TASK_INDEX`] + // environment variable. + // + // Type: int + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: 0, 1 + // + // [`CLOUD_RUN_TASK_INDEX`]: https://cloud.google.com/run/docs/container-contract#jobs-env-vars + GCPCloudRunJobTaskIndexKey = attribute.Key("gcp.cloud_run.job.task_index") + + // GCPGCEInstanceHostnameKey is the attribute Key conforming to the + // "gcp.gce.instance.hostname" semantic conventions. It represents the hostname + // of a GCE instance. This is the full value of the default or [custom hostname] + // . + // + // Type: string + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: "my-host1234.example.com", + // "sample-vm.us-west1-b.c.my-project.internal" + // + // [custom hostname]: https://cloud.google.com/compute/docs/instances/custom-hostname-vm + GCPGCEInstanceHostnameKey = attribute.Key("gcp.gce.instance.hostname") + + // GCPGCEInstanceNameKey is the attribute Key conforming to the + // "gcp.gce.instance.name" semantic conventions. It represents the instance name + // of a GCE instance. This is the value provided by `host.name`, the visible + // name of the instance in the Cloud Console UI, and the prefix for the default + // hostname of the instance as defined by the [default internal DNS name]. + // + // Type: string + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: "instance-1", "my-vm-name" + // + // [default internal DNS name]: https://cloud.google.com/compute/docs/internal-dns#instance-fully-qualified-domain-names + GCPGCEInstanceNameKey = attribute.Key("gcp.gce.instance.name") +) + +// GCPAppHubApplicationContainer returns an attribute KeyValue conforming to the +// "gcp.apphub.application.container" semantic conventions. It represents the +// container within GCP where the AppHub application is defined. +func GCPAppHubApplicationContainer(val string) attribute.KeyValue { + return GCPAppHubApplicationContainerKey.String(val) +} + +// GCPAppHubApplicationID returns an attribute KeyValue conforming to the +// "gcp.apphub.application.id" semantic conventions. It represents the name of +// the application as configured in AppHub. +func GCPAppHubApplicationID(val string) attribute.KeyValue { + return GCPAppHubApplicationIDKey.String(val) +} + +// GCPAppHubApplicationLocation returns an attribute KeyValue conforming to the +// "gcp.apphub.application.location" semantic conventions. It represents the GCP +// zone or region where the application is defined. +func GCPAppHubApplicationLocation(val string) attribute.KeyValue { + return GCPAppHubApplicationLocationKey.String(val) +} + +// GCPAppHubServiceID returns an attribute KeyValue conforming to the +// "gcp.apphub.service.id" semantic conventions. It represents the name of the +// service as configured in AppHub. +func GCPAppHubServiceID(val string) attribute.KeyValue { + return GCPAppHubServiceIDKey.String(val) +} + +// GCPAppHubWorkloadID returns an attribute KeyValue conforming to the +// "gcp.apphub.workload.id" semantic conventions. It represents the name of the +// workload as configured in AppHub. +func GCPAppHubWorkloadID(val string) attribute.KeyValue { + return GCPAppHubWorkloadIDKey.String(val) +} + +// GCPClientService returns an attribute KeyValue conforming to the +// "gcp.client.service" semantic conventions. It represents the identifies the +// Google Cloud service for which the official client library is intended. +func GCPClientService(val string) attribute.KeyValue { + return GCPClientServiceKey.String(val) +} + +// GCPCloudRunJobExecution returns an attribute KeyValue conforming to the +// "gcp.cloud_run.job.execution" semantic conventions. It represents the name of +// the Cloud Run [execution] being run for the Job, as set by the +// [`CLOUD_RUN_EXECUTION`] environment variable. +// +// [execution]: https://cloud.google.com/run/docs/managing/job-executions +// [`CLOUD_RUN_EXECUTION`]: https://cloud.google.com/run/docs/container-contract#jobs-env-vars +func GCPCloudRunJobExecution(val string) attribute.KeyValue { + return GCPCloudRunJobExecutionKey.String(val) +} + +// GCPCloudRunJobTaskIndex returns an attribute KeyValue conforming to the +// "gcp.cloud_run.job.task_index" semantic conventions. It represents the index +// for a task within an execution as provided by the [`CLOUD_RUN_TASK_INDEX`] +// environment variable. +// +// [`CLOUD_RUN_TASK_INDEX`]: https://cloud.google.com/run/docs/container-contract#jobs-env-vars +func GCPCloudRunJobTaskIndex(val int) attribute.KeyValue { + return GCPCloudRunJobTaskIndexKey.Int(val) +} + +// GCPGCEInstanceHostname returns an attribute KeyValue conforming to the +// "gcp.gce.instance.hostname" semantic conventions. It represents the hostname +// of a GCE instance. This is the full value of the default or [custom hostname] +// . +// +// [custom hostname]: https://cloud.google.com/compute/docs/instances/custom-hostname-vm +func GCPGCEInstanceHostname(val string) attribute.KeyValue { + return GCPGCEInstanceHostnameKey.String(val) +} + +// GCPGCEInstanceName returns an attribute KeyValue conforming to the +// "gcp.gce.instance.name" semantic conventions. It represents the instance name +// of a GCE instance. This is the value provided by `host.name`, the visible name +// of the instance in the Cloud Console UI, and the prefix for the default +// hostname of the instance as defined by the [default internal DNS name]. +// +// [default internal DNS name]: https://cloud.google.com/compute/docs/internal-dns#instance-fully-qualified-domain-names +func GCPGCEInstanceName(val string) attribute.KeyValue { + return GCPGCEInstanceNameKey.String(val) +} + +// Enum values for gcp.apphub.service.criticality_type +var ( + // Mission critical service. + // Stability: development + GCPAppHubServiceCriticalityTypeMissionCritical = GCPAppHubServiceCriticalityTypeKey.String("MISSION_CRITICAL") + // High impact. + // Stability: development + GCPAppHubServiceCriticalityTypeHigh = GCPAppHubServiceCriticalityTypeKey.String("HIGH") + // Medium impact. + // Stability: development + GCPAppHubServiceCriticalityTypeMedium = GCPAppHubServiceCriticalityTypeKey.String("MEDIUM") + // Low impact. + // Stability: development + GCPAppHubServiceCriticalityTypeLow = GCPAppHubServiceCriticalityTypeKey.String("LOW") +) + +// Enum values for gcp.apphub.service.environment_type +var ( + // Production environment. + // Stability: development + GCPAppHubServiceEnvironmentTypeProduction = GCPAppHubServiceEnvironmentTypeKey.String("PRODUCTION") + // Staging environment. + // Stability: development + GCPAppHubServiceEnvironmentTypeStaging = GCPAppHubServiceEnvironmentTypeKey.String("STAGING") + // Test environment. + // Stability: development + GCPAppHubServiceEnvironmentTypeTest = GCPAppHubServiceEnvironmentTypeKey.String("TEST") + // Development environment. + // Stability: development + GCPAppHubServiceEnvironmentTypeDevelopment = GCPAppHubServiceEnvironmentTypeKey.String("DEVELOPMENT") +) + +// Enum values for gcp.apphub.workload.criticality_type +var ( + // Mission critical service. + // Stability: development + GCPAppHubWorkloadCriticalityTypeMissionCritical = GCPAppHubWorkloadCriticalityTypeKey.String("MISSION_CRITICAL") + // High impact. + // Stability: development + GCPAppHubWorkloadCriticalityTypeHigh = GCPAppHubWorkloadCriticalityTypeKey.String("HIGH") + // Medium impact. + // Stability: development + GCPAppHubWorkloadCriticalityTypeMedium = GCPAppHubWorkloadCriticalityTypeKey.String("MEDIUM") + // Low impact. + // Stability: development + GCPAppHubWorkloadCriticalityTypeLow = GCPAppHubWorkloadCriticalityTypeKey.String("LOW") +) + +// Enum values for gcp.apphub.workload.environment_type +var ( + // Production environment. + // Stability: development + GCPAppHubWorkloadEnvironmentTypeProduction = GCPAppHubWorkloadEnvironmentTypeKey.String("PRODUCTION") + // Staging environment. + // Stability: development + GCPAppHubWorkloadEnvironmentTypeStaging = GCPAppHubWorkloadEnvironmentTypeKey.String("STAGING") + // Test environment. + // Stability: development + GCPAppHubWorkloadEnvironmentTypeTest = GCPAppHubWorkloadEnvironmentTypeKey.String("TEST") + // Development environment. + // Stability: development + GCPAppHubWorkloadEnvironmentTypeDevelopment = GCPAppHubWorkloadEnvironmentTypeKey.String("DEVELOPMENT") +) + +// Namespace: gen_ai +const ( + // GenAIAgentDescriptionKey is the attribute Key conforming to the + // "gen_ai.agent.description" semantic conventions. It represents the free-form + // description of the GenAI agent provided by the application. + // + // Type: string + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: "Helps with math problems", "Generates fiction stories" + GenAIAgentDescriptionKey = attribute.Key("gen_ai.agent.description") + + // GenAIAgentIDKey is the attribute Key conforming to the "gen_ai.agent.id" + // semantic conventions. It represents the unique identifier of the GenAI agent. + // + // Type: string + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: "asst_5j66UpCpwteGg4YSxUnt7lPY" + GenAIAgentIDKey = attribute.Key("gen_ai.agent.id") + + // GenAIAgentNameKey is the attribute Key conforming to the "gen_ai.agent.name" + // semantic conventions. It represents the human-readable name of the GenAI + // agent provided by the application. + // + // Type: string + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: "Math Tutor", "Fiction Writer" + GenAIAgentNameKey = attribute.Key("gen_ai.agent.name") + + // GenAIConversationIDKey is the attribute Key conforming to the + // "gen_ai.conversation.id" semantic conventions. It represents the unique + // identifier for a conversation (session, thread), used to store and correlate + // messages within this conversation. + // + // Type: string + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: "conv_5j66UpCpwteGg4YSxUnt7lPY" + GenAIConversationIDKey = attribute.Key("gen_ai.conversation.id") + + // GenAIDataSourceIDKey is the attribute Key conforming to the + // "gen_ai.data_source.id" semantic conventions. It represents the data source + // identifier. + // + // Type: string + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: "H7STPQYOND" + // Note: Data sources are used by AI agents and RAG applications to store + // grounding data. A data source may be an external database, object store, + // document collection, website, or any other storage system used by the GenAI + // agent or application. The `gen_ai.data_source.id` SHOULD match the identifier + // used by the GenAI system rather than a name specific to the external storage, + // such as a database or object store. Semantic conventions referencing + // `gen_ai.data_source.id` MAY also leverage additional attributes, such as + // `db.*`, to further identify and describe the data source. + GenAIDataSourceIDKey = attribute.Key("gen_ai.data_source.id") + + // GenAIInputMessagesKey is the attribute Key conforming to the + // "gen_ai.input.messages" semantic conventions. It represents the chat history + // provided to the model as an input. + // + // Type: any + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: "[\n {\n "role": "user",\n "parts": [\n {\n "type": "text",\n + // "content": "Weather in Paris?"\n }\n ]\n },\n {\n "role": "assistant",\n + // "parts": [\n {\n "type": "tool_call",\n "id": + // "call_VSPygqKTWdrhaFErNvMV18Yl",\n "name": "get_weather",\n "arguments": {\n + // "location": "Paris"\n }\n }\n ]\n },\n {\n "role": "tool",\n "parts": [\n {\n + // "type": "tool_call_response",\n "id": " call_VSPygqKTWdrhaFErNvMV18Yl",\n + // "result": "rainy, 57°F"\n }\n ]\n }\n]\n" + // Note: Instrumentations MUST follow [Input messages JSON schema]. + // When the attribute is recorded on events, it MUST be recorded in structured + // form. When recorded on spans, it MAY be recorded as a JSON string if + // structured + // format is not supported and SHOULD be recorded in structured form otherwise. + // + // Messages MUST be provided in the order they were sent to the model. + // Instrumentations MAY provide a way for users to filter or truncate + // input messages. + // + // > [!Warning] + // > This attribute is likely to contain sensitive information including + // > user/PII data. + // + // See [Recording content on attributes] + // section for more details. + // + // [Input messages JSON schema]: /docs/gen-ai/gen-ai-input-messages.json + // [Recording content on attributes]: /docs/gen-ai/gen-ai-spans.md#recording-content-on-attributes + GenAIInputMessagesKey = attribute.Key("gen_ai.input.messages") + + // GenAIOperationNameKey is the attribute Key conforming to the + // "gen_ai.operation.name" semantic conventions. It represents the name of the + // operation being performed. + // + // Type: Enum + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: + // Note: If one of the predefined values applies, but specific system uses a + // different name it's RECOMMENDED to document it in the semantic conventions + // for specific GenAI system and use system-specific name in the + // instrumentation. If a different name is not documented, instrumentation + // libraries SHOULD use applicable predefined value. + GenAIOperationNameKey = attribute.Key("gen_ai.operation.name") + + // GenAIOutputMessagesKey is the attribute Key conforming to the + // "gen_ai.output.messages" semantic conventions. It represents the messages + // returned by the model where each message represents a specific model response + // (choice, candidate). + // + // Type: any + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: "[\n {\n "role": "assistant",\n "parts": [\n {\n "type": "text",\n + // "content": "The weather in Paris is currently rainy with a temperature of + // 57°F."\n }\n ],\n "finish_reason": "stop"\n }\n]\n" + // Note: Instrumentations MUST follow [Output messages JSON schema] + // + // Each message represents a single output choice/candidate generated by + // the model. Each message corresponds to exactly one generation + // (choice/candidate) and vice versa - one choice cannot be split across + // multiple messages or one message cannot contain parts from multiple choices. + // + // When the attribute is recorded on events, it MUST be recorded in structured + // form. When recorded on spans, it MAY be recorded as a JSON string if + // structured + // format is not supported and SHOULD be recorded in structured form otherwise. + // + // Instrumentations MAY provide a way for users to filter or truncate + // output messages. + // + // > [!Warning] + // > This attribute is likely to contain sensitive information including + // > user/PII data. + // + // See [Recording content on attributes] + // section for more details. + // + // [Output messages JSON schema]: /docs/gen-ai/gen-ai-output-messages.json + // [Recording content on attributes]: /docs/gen-ai/gen-ai-spans.md#recording-content-on-attributes + GenAIOutputMessagesKey = attribute.Key("gen_ai.output.messages") + + // GenAIOutputTypeKey is the attribute Key conforming to the + // "gen_ai.output.type" semantic conventions. It represents the represents the + // content type requested by the client. + // + // Type: Enum + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: + // Note: This attribute SHOULD be used when the client requests output of a + // specific type. The model may return zero or more outputs of this type. + // This attribute specifies the output modality and not the actual output + // format. For example, if an image is requested, the actual output could be a + // URL pointing to an image file. + // Additional output format details may be recorded in the future in the + // `gen_ai.output.{type}.*` attributes. + GenAIOutputTypeKey = attribute.Key("gen_ai.output.type") + + // GenAIProviderNameKey is the attribute Key conforming to the + // "gen_ai.provider.name" semantic conventions. It represents the Generative AI + // provider as identified by the client or server instrumentation. + // + // Type: Enum + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: + // Note: The attribute SHOULD be set based on the instrumentation's best + // knowledge and may differ from the actual model provider. + // + // Multiple providers, including Azure OpenAI, Gemini, and AI hosting platforms + // are accessible using the OpenAI REST API and corresponding client libraries, + // but may proxy or host models from different providers. + // + // The `gen_ai.request.model`, `gen_ai.response.model`, and `server.address` + // attributes may help identify the actual system in use. + // + // The `gen_ai.provider.name` attribute acts as a discriminator that + // identifies the GenAI telemetry format flavor specific to that provider + // within GenAI semantic conventions. + // It SHOULD be set consistently with provider-specific attributes and signals. + // For example, GenAI spans, metrics, and events related to AWS Bedrock + // should have the `gen_ai.provider.name` set to `aws.bedrock` and include + // applicable `aws.bedrock.*` attributes and are not expected to include + // `openai.*` attributes. + GenAIProviderNameKey = attribute.Key("gen_ai.provider.name") + + // GenAIRequestChoiceCountKey is the attribute Key conforming to the + // "gen_ai.request.choice.count" semantic conventions. It represents the target + // number of candidate completions to return. + // + // Type: int + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: 3 + GenAIRequestChoiceCountKey = attribute.Key("gen_ai.request.choice.count") + + // GenAIRequestEncodingFormatsKey is the attribute Key conforming to the + // "gen_ai.request.encoding_formats" semantic conventions. It represents the + // encoding formats requested in an embeddings operation, if specified. + // + // Type: string[] + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: "base64"], ["float", "binary" + // Note: In some GenAI systems the encoding formats are called embedding types. + // Also, some GenAI systems only accept a single format per request. + GenAIRequestEncodingFormatsKey = attribute.Key("gen_ai.request.encoding_formats") + + // GenAIRequestFrequencyPenaltyKey is the attribute Key conforming to the + // "gen_ai.request.frequency_penalty" semantic conventions. It represents the + // frequency penalty setting for the GenAI request. + // + // Type: double + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: 0.1 + GenAIRequestFrequencyPenaltyKey = attribute.Key("gen_ai.request.frequency_penalty") + + // GenAIRequestMaxTokensKey is the attribute Key conforming to the + // "gen_ai.request.max_tokens" semantic conventions. It represents the maximum + // number of tokens the model generates for a request. + // + // Type: int + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: 100 + GenAIRequestMaxTokensKey = attribute.Key("gen_ai.request.max_tokens") + + // GenAIRequestModelKey is the attribute Key conforming to the + // "gen_ai.request.model" semantic conventions. It represents the name of the + // GenAI model a request is being made to. + // + // Type: string + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: gpt-4 + GenAIRequestModelKey = attribute.Key("gen_ai.request.model") + + // GenAIRequestPresencePenaltyKey is the attribute Key conforming to the + // "gen_ai.request.presence_penalty" semantic conventions. It represents the + // presence penalty setting for the GenAI request. + // + // Type: double + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: 0.1 + GenAIRequestPresencePenaltyKey = attribute.Key("gen_ai.request.presence_penalty") + + // GenAIRequestSeedKey is the attribute Key conforming to the + // "gen_ai.request.seed" semantic conventions. It represents the requests with + // same seed value more likely to return same result. + // + // Type: int + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: 100 + GenAIRequestSeedKey = attribute.Key("gen_ai.request.seed") + + // GenAIRequestStopSequencesKey is the attribute Key conforming to the + // "gen_ai.request.stop_sequences" semantic conventions. It represents the list + // of sequences that the model will use to stop generating further tokens. + // + // Type: string[] + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: "forest", "lived" + GenAIRequestStopSequencesKey = attribute.Key("gen_ai.request.stop_sequences") + + // GenAIRequestTemperatureKey is the attribute Key conforming to the + // "gen_ai.request.temperature" semantic conventions. It represents the + // temperature setting for the GenAI request. + // + // Type: double + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: 0.0 + GenAIRequestTemperatureKey = attribute.Key("gen_ai.request.temperature") + + // GenAIRequestTopKKey is the attribute Key conforming to the + // "gen_ai.request.top_k" semantic conventions. It represents the top_k sampling + // setting for the GenAI request. + // + // Type: double + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: 1.0 + GenAIRequestTopKKey = attribute.Key("gen_ai.request.top_k") + + // GenAIRequestTopPKey is the attribute Key conforming to the + // "gen_ai.request.top_p" semantic conventions. It represents the top_p sampling + // setting for the GenAI request. + // + // Type: double + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: 1.0 + GenAIRequestTopPKey = attribute.Key("gen_ai.request.top_p") + + // GenAIResponseFinishReasonsKey is the attribute Key conforming to the + // "gen_ai.response.finish_reasons" semantic conventions. It represents the + // array of reasons the model stopped generating tokens, corresponding to each + // generation received. + // + // Type: string[] + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: "stop"], ["stop", "length" + GenAIResponseFinishReasonsKey = attribute.Key("gen_ai.response.finish_reasons") + + // GenAIResponseIDKey is the attribute Key conforming to the + // "gen_ai.response.id" semantic conventions. It represents the unique + // identifier for the completion. + // + // Type: string + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: "chatcmpl-123" + GenAIResponseIDKey = attribute.Key("gen_ai.response.id") + + // GenAIResponseModelKey is the attribute Key conforming to the + // "gen_ai.response.model" semantic conventions. It represents the name of the + // model that generated the response. + // + // Type: string + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: "gpt-4-0613" + GenAIResponseModelKey = attribute.Key("gen_ai.response.model") + + // GenAISystemInstructionsKey is the attribute Key conforming to the + // "gen_ai.system_instructions" semantic conventions. It represents the system + // message or instructions provided to the GenAI model separately from the chat + // history. + // + // Type: any + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: "[\n {\n "type": "text",\n "content": "You are an Agent that greet + // users, always use greetings tool to respond"\n }\n]\n", "[\n {\n "type": + // "text",\n "content": "You are a language translator."\n },\n {\n "type": + // "text",\n "content": "Your mission is to translate text in English to + // French."\n }\n]\n" + // Note: This attribute SHOULD be used when the corresponding provider or API + // allows to provide system instructions or messages separately from the + // chat history. + // + // Instructions that are part of the chat history SHOULD be recorded in + // `gen_ai.input.messages` attribute instead. + // + // Instrumentations MUST follow [System instructions JSON schema]. + // + // When recorded on spans, it MAY be recorded as a JSON string if structured + // format is not supported and SHOULD be recorded in structured form otherwise. + // + // Instrumentations MAY provide a way for users to filter or truncate + // system instructions. + // + // > [!Warning] + // > This attribute may contain sensitive information. + // + // See [Recording content on attributes] + // section for more details. + // + // [System instructions JSON schema]: /docs/gen-ai/gen-ai-system-instructions.json + // [Recording content on attributes]: /docs/gen-ai/gen-ai-spans.md#recording-content-on-attributes + GenAISystemInstructionsKey = attribute.Key("gen_ai.system_instructions") + + // GenAITokenTypeKey is the attribute Key conforming to the "gen_ai.token.type" + // semantic conventions. It represents the type of token being counted. + // + // Type: Enum + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: "input", "output" + GenAITokenTypeKey = attribute.Key("gen_ai.token.type") + + // GenAIToolCallIDKey is the attribute Key conforming to the + // "gen_ai.tool.call.id" semantic conventions. It represents the tool call + // identifier. + // + // Type: string + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: "call_mszuSIzqtI65i1wAUOE8w5H4" + GenAIToolCallIDKey = attribute.Key("gen_ai.tool.call.id") + + // GenAIToolDescriptionKey is the attribute Key conforming to the + // "gen_ai.tool.description" semantic conventions. It represents the tool + // description. + // + // Type: string + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: "Multiply two numbers" + GenAIToolDescriptionKey = attribute.Key("gen_ai.tool.description") + + // GenAIToolNameKey is the attribute Key conforming to the "gen_ai.tool.name" + // semantic conventions. It represents the name of the tool utilized by the + // agent. + // + // Type: string + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: "Flights" + GenAIToolNameKey = attribute.Key("gen_ai.tool.name") + + // GenAIToolTypeKey is the attribute Key conforming to the "gen_ai.tool.type" + // semantic conventions. It represents the type of the tool utilized by the + // agent. + // + // Type: string + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: "function", "extension", "datastore" + // Note: Extension: A tool executed on the agent-side to directly call external + // APIs, bridging the gap between the agent and real-world systems. + // Agent-side operations involve actions that are performed by the agent on the + // server or within the agent's controlled environment. + // Function: A tool executed on the client-side, where the agent generates + // parameters for a predefined function, and the client executes the logic. + // Client-side operations are actions taken on the user's end or within the + // client application. + // Datastore: A tool used by the agent to access and query structured or + // unstructured external data for retrieval-augmented tasks or knowledge + // updates. + GenAIToolTypeKey = attribute.Key("gen_ai.tool.type") + + // GenAIUsageInputTokensKey is the attribute Key conforming to the + // "gen_ai.usage.input_tokens" semantic conventions. It represents the number of + // tokens used in the GenAI input (prompt). + // + // Type: int + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: 100 + GenAIUsageInputTokensKey = attribute.Key("gen_ai.usage.input_tokens") + + // GenAIUsageOutputTokensKey is the attribute Key conforming to the + // "gen_ai.usage.output_tokens" semantic conventions. It represents the number + // of tokens used in the GenAI response (completion). + // + // Type: int + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: 180 + GenAIUsageOutputTokensKey = attribute.Key("gen_ai.usage.output_tokens") +) + +// GenAIAgentDescription returns an attribute KeyValue conforming to the +// "gen_ai.agent.description" semantic conventions. It represents the free-form +// description of the GenAI agent provided by the application. +func GenAIAgentDescription(val string) attribute.KeyValue { + return GenAIAgentDescriptionKey.String(val) +} + +// GenAIAgentID returns an attribute KeyValue conforming to the "gen_ai.agent.id" +// semantic conventions. It represents the unique identifier of the GenAI agent. +func GenAIAgentID(val string) attribute.KeyValue { + return GenAIAgentIDKey.String(val) +} + +// GenAIAgentName returns an attribute KeyValue conforming to the +// "gen_ai.agent.name" semantic conventions. It represents the human-readable +// name of the GenAI agent provided by the application. +func GenAIAgentName(val string) attribute.KeyValue { + return GenAIAgentNameKey.String(val) +} + +// GenAIConversationID returns an attribute KeyValue conforming to the +// "gen_ai.conversation.id" semantic conventions. It represents the unique +// identifier for a conversation (session, thread), used to store and correlate +// messages within this conversation. +func GenAIConversationID(val string) attribute.KeyValue { + return GenAIConversationIDKey.String(val) +} + +// GenAIDataSourceID returns an attribute KeyValue conforming to the +// "gen_ai.data_source.id" semantic conventions. It represents the data source +// identifier. +func GenAIDataSourceID(val string) attribute.KeyValue { + return GenAIDataSourceIDKey.String(val) +} + +// GenAIRequestChoiceCount returns an attribute KeyValue conforming to the +// "gen_ai.request.choice.count" semantic conventions. It represents the target +// number of candidate completions to return. +func GenAIRequestChoiceCount(val int) attribute.KeyValue { + return GenAIRequestChoiceCountKey.Int(val) +} + +// GenAIRequestEncodingFormats returns an attribute KeyValue conforming to the +// "gen_ai.request.encoding_formats" semantic conventions. It represents the +// encoding formats requested in an embeddings operation, if specified. +func GenAIRequestEncodingFormats(val ...string) attribute.KeyValue { + return GenAIRequestEncodingFormatsKey.StringSlice(val) +} + +// GenAIRequestFrequencyPenalty returns an attribute KeyValue conforming to the +// "gen_ai.request.frequency_penalty" semantic conventions. It represents the +// frequency penalty setting for the GenAI request. +func GenAIRequestFrequencyPenalty(val float64) attribute.KeyValue { + return GenAIRequestFrequencyPenaltyKey.Float64(val) +} + +// GenAIRequestMaxTokens returns an attribute KeyValue conforming to the +// "gen_ai.request.max_tokens" semantic conventions. It represents the maximum +// number of tokens the model generates for a request. +func GenAIRequestMaxTokens(val int) attribute.KeyValue { + return GenAIRequestMaxTokensKey.Int(val) +} + +// GenAIRequestModel returns an attribute KeyValue conforming to the +// "gen_ai.request.model" semantic conventions. It represents the name of the +// GenAI model a request is being made to. +func GenAIRequestModel(val string) attribute.KeyValue { + return GenAIRequestModelKey.String(val) +} + +// GenAIRequestPresencePenalty returns an attribute KeyValue conforming to the +// "gen_ai.request.presence_penalty" semantic conventions. It represents the +// presence penalty setting for the GenAI request. +func GenAIRequestPresencePenalty(val float64) attribute.KeyValue { + return GenAIRequestPresencePenaltyKey.Float64(val) +} + +// GenAIRequestSeed returns an attribute KeyValue conforming to the +// "gen_ai.request.seed" semantic conventions. It represents the requests with +// same seed value more likely to return same result. +func GenAIRequestSeed(val int) attribute.KeyValue { + return GenAIRequestSeedKey.Int(val) +} + +// GenAIRequestStopSequences returns an attribute KeyValue conforming to the +// "gen_ai.request.stop_sequences" semantic conventions. It represents the list +// of sequences that the model will use to stop generating further tokens. +func GenAIRequestStopSequences(val ...string) attribute.KeyValue { + return GenAIRequestStopSequencesKey.StringSlice(val) +} + +// GenAIRequestTemperature returns an attribute KeyValue conforming to the +// "gen_ai.request.temperature" semantic conventions. It represents the +// temperature setting for the GenAI request. +func GenAIRequestTemperature(val float64) attribute.KeyValue { + return GenAIRequestTemperatureKey.Float64(val) +} + +// GenAIRequestTopK returns an attribute KeyValue conforming to the +// "gen_ai.request.top_k" semantic conventions. It represents the top_k sampling +// setting for the GenAI request. +func GenAIRequestTopK(val float64) attribute.KeyValue { + return GenAIRequestTopKKey.Float64(val) +} + +// GenAIRequestTopP returns an attribute KeyValue conforming to the +// "gen_ai.request.top_p" semantic conventions. It represents the top_p sampling +// setting for the GenAI request. +func GenAIRequestTopP(val float64) attribute.KeyValue { + return GenAIRequestTopPKey.Float64(val) +} + +// GenAIResponseFinishReasons returns an attribute KeyValue conforming to the +// "gen_ai.response.finish_reasons" semantic conventions. It represents the array +// of reasons the model stopped generating tokens, corresponding to each +// generation received. +func GenAIResponseFinishReasons(val ...string) attribute.KeyValue { + return GenAIResponseFinishReasonsKey.StringSlice(val) +} + +// GenAIResponseID returns an attribute KeyValue conforming to the +// "gen_ai.response.id" semantic conventions. It represents the unique identifier +// for the completion. +func GenAIResponseID(val string) attribute.KeyValue { + return GenAIResponseIDKey.String(val) +} + +// GenAIResponseModel returns an attribute KeyValue conforming to the +// "gen_ai.response.model" semantic conventions. It represents the name of the +// model that generated the response. +func GenAIResponseModel(val string) attribute.KeyValue { + return GenAIResponseModelKey.String(val) +} + +// GenAIToolCallID returns an attribute KeyValue conforming to the +// "gen_ai.tool.call.id" semantic conventions. It represents the tool call +// identifier. +func GenAIToolCallID(val string) attribute.KeyValue { + return GenAIToolCallIDKey.String(val) +} + +// GenAIToolDescription returns an attribute KeyValue conforming to the +// "gen_ai.tool.description" semantic conventions. It represents the tool +// description. +func GenAIToolDescription(val string) attribute.KeyValue { + return GenAIToolDescriptionKey.String(val) +} + +// GenAIToolName returns an attribute KeyValue conforming to the +// "gen_ai.tool.name" semantic conventions. It represents the name of the tool +// utilized by the agent. +func GenAIToolName(val string) attribute.KeyValue { + return GenAIToolNameKey.String(val) +} + +// GenAIToolType returns an attribute KeyValue conforming to the +// "gen_ai.tool.type" semantic conventions. It represents the type of the tool +// utilized by the agent. +func GenAIToolType(val string) attribute.KeyValue { + return GenAIToolTypeKey.String(val) +} + +// GenAIUsageInputTokens returns an attribute KeyValue conforming to the +// "gen_ai.usage.input_tokens" semantic conventions. It represents the number of +// tokens used in the GenAI input (prompt). +func GenAIUsageInputTokens(val int) attribute.KeyValue { + return GenAIUsageInputTokensKey.Int(val) +} + +// GenAIUsageOutputTokens returns an attribute KeyValue conforming to the +// "gen_ai.usage.output_tokens" semantic conventions. It represents the number of +// tokens used in the GenAI response (completion). +func GenAIUsageOutputTokens(val int) attribute.KeyValue { + return GenAIUsageOutputTokensKey.Int(val) +} + +// Enum values for gen_ai.operation.name +var ( + // Chat completion operation such as [OpenAI Chat API] + // Stability: development + // + // [OpenAI Chat API]: https://platform.openai.com/docs/api-reference/chat + GenAIOperationNameChat = GenAIOperationNameKey.String("chat") + // Multimodal content generation operation such as [Gemini Generate Content] + // Stability: development + // + // [Gemini Generate Content]: https://ai.google.dev/api/generate-content + GenAIOperationNameGenerateContent = GenAIOperationNameKey.String("generate_content") + // Text completions operation such as [OpenAI Completions API (Legacy)] + // Stability: development + // + // [OpenAI Completions API (Legacy)]: https://platform.openai.com/docs/api-reference/completions + GenAIOperationNameTextCompletion = GenAIOperationNameKey.String("text_completion") + // Embeddings operation such as [OpenAI Create embeddings API] + // Stability: development + // + // [OpenAI Create embeddings API]: https://platform.openai.com/docs/api-reference/embeddings/create + GenAIOperationNameEmbeddings = GenAIOperationNameKey.String("embeddings") + // Create GenAI agent + // Stability: development + GenAIOperationNameCreateAgent = GenAIOperationNameKey.String("create_agent") + // Invoke GenAI agent + // Stability: development + GenAIOperationNameInvokeAgent = GenAIOperationNameKey.String("invoke_agent") + // Execute a tool + // Stability: development + GenAIOperationNameExecuteTool = GenAIOperationNameKey.String("execute_tool") +) + +// Enum values for gen_ai.output.type +var ( + // Plain text + // Stability: development + GenAIOutputTypeText = GenAIOutputTypeKey.String("text") + // JSON object with known or unknown schema + // Stability: development + GenAIOutputTypeJSON = GenAIOutputTypeKey.String("json") + // Image + // Stability: development + GenAIOutputTypeImage = GenAIOutputTypeKey.String("image") + // Speech + // Stability: development + GenAIOutputTypeSpeech = GenAIOutputTypeKey.String("speech") +) + +// Enum values for gen_ai.provider.name +var ( + // [OpenAI] + // Stability: development + // + // [OpenAI]: https://openai.com/ + GenAIProviderNameOpenAI = GenAIProviderNameKey.String("openai") + // Any Google generative AI endpoint + // Stability: development + GenAIProviderNameGCPGenAI = GenAIProviderNameKey.String("gcp.gen_ai") + // [Vertex AI] + // Stability: development + // + // [Vertex AI]: https://cloud.google.com/vertex-ai + GenAIProviderNameGCPVertexAI = GenAIProviderNameKey.String("gcp.vertex_ai") + // [Gemini] + // Stability: development + // + // [Gemini]: https://cloud.google.com/products/gemini + GenAIProviderNameGCPGemini = GenAIProviderNameKey.String("gcp.gemini") + // [Anthropic] + // Stability: development + // + // [Anthropic]: https://www.anthropic.com/ + GenAIProviderNameAnthropic = GenAIProviderNameKey.String("anthropic") + // [Cohere] + // Stability: development + // + // [Cohere]: https://cohere.com/ + GenAIProviderNameCohere = GenAIProviderNameKey.String("cohere") + // Azure AI Inference + // Stability: development + GenAIProviderNameAzureAIInference = GenAIProviderNameKey.String("azure.ai.inference") + // [Azure OpenAI] + // Stability: development + // + // [Azure OpenAI]: https://azure.microsoft.com/products/ai-services/openai-service/ + GenAIProviderNameAzureAIOpenAI = GenAIProviderNameKey.String("azure.ai.openai") + // [IBM Watsonx AI] + // Stability: development + // + // [IBM Watsonx AI]: https://www.ibm.com/products/watsonx-ai + GenAIProviderNameIBMWatsonxAI = GenAIProviderNameKey.String("ibm.watsonx.ai") + // [AWS Bedrock] + // Stability: development + // + // [AWS Bedrock]: https://aws.amazon.com/bedrock + GenAIProviderNameAWSBedrock = GenAIProviderNameKey.String("aws.bedrock") + // [Perplexity] + // Stability: development + // + // [Perplexity]: https://www.perplexity.ai/ + GenAIProviderNamePerplexity = GenAIProviderNameKey.String("perplexity") + // [xAI] + // Stability: development + // + // [xAI]: https://x.ai/ + GenAIProviderNameXAI = GenAIProviderNameKey.String("x_ai") + // [DeepSeek] + // Stability: development + // + // [DeepSeek]: https://www.deepseek.com/ + GenAIProviderNameDeepseek = GenAIProviderNameKey.String("deepseek") + // [Groq] + // Stability: development + // + // [Groq]: https://groq.com/ + GenAIProviderNameGroq = GenAIProviderNameKey.String("groq") + // [Mistral AI] + // Stability: development + // + // [Mistral AI]: https://mistral.ai/ + GenAIProviderNameMistralAI = GenAIProviderNameKey.String("mistral_ai") +) + +// Enum values for gen_ai.token.type +var ( + // Input tokens (prompt, input, etc.) + // Stability: development + GenAITokenTypeInput = GenAITokenTypeKey.String("input") + // Output tokens (completion, response, etc.) + // Stability: development + GenAITokenTypeOutput = GenAITokenTypeKey.String("output") +) + +// Namespace: geo +const ( + // GeoContinentCodeKey is the attribute Key conforming to the + // "geo.continent.code" semantic conventions. It represents the two-letter code + // representing continent’s name. + // + // Type: Enum + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: + GeoContinentCodeKey = attribute.Key("geo.continent.code") + + // GeoCountryISOCodeKey is the attribute Key conforming to the + // "geo.country.iso_code" semantic conventions. It represents the two-letter ISO + // Country Code ([ISO 3166-1 alpha2]). + // + // Type: string + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: "CA" + // + // [ISO 3166-1 alpha2]: https://wikipedia.org/wiki/ISO_3166-1#Codes + GeoCountryISOCodeKey = attribute.Key("geo.country.iso_code") + + // GeoLocalityNameKey is the attribute Key conforming to the "geo.locality.name" + // semantic conventions. It represents the locality name. Represents the name of + // a city, town, village, or similar populated place. + // + // Type: string + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: "Montreal", "Berlin" + GeoLocalityNameKey = attribute.Key("geo.locality.name") + + // GeoLocationLatKey is the attribute Key conforming to the "geo.location.lat" + // semantic conventions. It represents the latitude of the geo location in + // [WGS84]. + // + // Type: double + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: 45.505918 + // + // [WGS84]: https://wikipedia.org/wiki/World_Geodetic_System#WGS84 + GeoLocationLatKey = attribute.Key("geo.location.lat") + + // GeoLocationLonKey is the attribute Key conforming to the "geo.location.lon" + // semantic conventions. It represents the longitude of the geo location in + // [WGS84]. + // + // Type: double + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: -73.61483 + // + // [WGS84]: https://wikipedia.org/wiki/World_Geodetic_System#WGS84 + GeoLocationLonKey = attribute.Key("geo.location.lon") + + // GeoPostalCodeKey is the attribute Key conforming to the "geo.postal_code" + // semantic conventions. It represents the postal code associated with the + // location. Values appropriate for this field may also be known as a postcode + // or ZIP code and will vary widely from country to country. + // + // Type: string + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: "94040" + GeoPostalCodeKey = attribute.Key("geo.postal_code") + + // GeoRegionISOCodeKey is the attribute Key conforming to the + // "geo.region.iso_code" semantic conventions. It represents the region ISO code + // ([ISO 3166-2]). + // + // Type: string + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: "CA-QC" + // + // [ISO 3166-2]: https://wikipedia.org/wiki/ISO_3166-2 + GeoRegionISOCodeKey = attribute.Key("geo.region.iso_code") +) + +// GeoCountryISOCode returns an attribute KeyValue conforming to the +// "geo.country.iso_code" semantic conventions. It represents the two-letter ISO +// Country Code ([ISO 3166-1 alpha2]). +// +// [ISO 3166-1 alpha2]: https://wikipedia.org/wiki/ISO_3166-1#Codes +func GeoCountryISOCode(val string) attribute.KeyValue { + return GeoCountryISOCodeKey.String(val) +} + +// GeoLocalityName returns an attribute KeyValue conforming to the +// "geo.locality.name" semantic conventions. It represents the locality name. +// Represents the name of a city, town, village, or similar populated place. +func GeoLocalityName(val string) attribute.KeyValue { + return GeoLocalityNameKey.String(val) +} + +// GeoLocationLat returns an attribute KeyValue conforming to the +// "geo.location.lat" semantic conventions. It represents the latitude of the geo +// location in [WGS84]. +// +// [WGS84]: https://wikipedia.org/wiki/World_Geodetic_System#WGS84 +func GeoLocationLat(val float64) attribute.KeyValue { + return GeoLocationLatKey.Float64(val) +} + +// GeoLocationLon returns an attribute KeyValue conforming to the +// "geo.location.lon" semantic conventions. It represents the longitude of the +// geo location in [WGS84]. +// +// [WGS84]: https://wikipedia.org/wiki/World_Geodetic_System#WGS84 +func GeoLocationLon(val float64) attribute.KeyValue { + return GeoLocationLonKey.Float64(val) +} + +// GeoPostalCode returns an attribute KeyValue conforming to the +// "geo.postal_code" semantic conventions. It represents the postal code +// associated with the location. Values appropriate for this field may also be +// known as a postcode or ZIP code and will vary widely from country to country. +func GeoPostalCode(val string) attribute.KeyValue { + return GeoPostalCodeKey.String(val) +} + +// GeoRegionISOCode returns an attribute KeyValue conforming to the +// "geo.region.iso_code" semantic conventions. It represents the region ISO code +// ([ISO 3166-2]). +// +// [ISO 3166-2]: https://wikipedia.org/wiki/ISO_3166-2 +func GeoRegionISOCode(val string) attribute.KeyValue { + return GeoRegionISOCodeKey.String(val) +} + +// Enum values for geo.continent.code +var ( + // Africa + // Stability: development + GeoContinentCodeAf = GeoContinentCodeKey.String("AF") + // Antarctica + // Stability: development + GeoContinentCodeAn = GeoContinentCodeKey.String("AN") + // Asia + // Stability: development + GeoContinentCodeAs = GeoContinentCodeKey.String("AS") + // Europe + // Stability: development + GeoContinentCodeEu = GeoContinentCodeKey.String("EU") + // North America + // Stability: development + GeoContinentCodeNa = GeoContinentCodeKey.String("NA") + // Oceania + // Stability: development + GeoContinentCodeOc = GeoContinentCodeKey.String("OC") + // South America + // Stability: development + GeoContinentCodeSa = GeoContinentCodeKey.String("SA") +) + +// Namespace: go +const ( + // GoMemoryTypeKey is the attribute Key conforming to the "go.memory.type" + // semantic conventions. It represents the type of memory. + // + // Type: Enum + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: "other", "stack" + GoMemoryTypeKey = attribute.Key("go.memory.type") +) + +// Enum values for go.memory.type +var ( + // Memory allocated from the heap that is reserved for stack space, whether or + // not it is currently in-use. + // Stability: development + GoMemoryTypeStack = GoMemoryTypeKey.String("stack") + // Memory used by the Go runtime, excluding other categories of memory usage + // described in this enumeration. + // Stability: development + GoMemoryTypeOther = GoMemoryTypeKey.String("other") +) + +// Namespace: graphql +const ( + // GraphQLDocumentKey is the attribute Key conforming to the "graphql.document" + // semantic conventions. It represents the GraphQL document being executed. + // + // Type: string + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: query findBookById { bookById(id: ?) { name } } + // Note: The value may be sanitized to exclude sensitive information. + GraphQLDocumentKey = attribute.Key("graphql.document") + + // GraphQLOperationNameKey is the attribute Key conforming to the + // "graphql.operation.name" semantic conventions. It represents the name of the + // operation being executed. + // + // Type: string + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: findBookById + GraphQLOperationNameKey = attribute.Key("graphql.operation.name") + + // GraphQLOperationTypeKey is the attribute Key conforming to the + // "graphql.operation.type" semantic conventions. It represents the type of the + // operation being executed. + // + // Type: Enum + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: "query", "mutation", "subscription" + GraphQLOperationTypeKey = attribute.Key("graphql.operation.type") +) + +// GraphQLDocument returns an attribute KeyValue conforming to the +// "graphql.document" semantic conventions. It represents the GraphQL document +// being executed. +func GraphQLDocument(val string) attribute.KeyValue { + return GraphQLDocumentKey.String(val) +} + +// GraphQLOperationName returns an attribute KeyValue conforming to the +// "graphql.operation.name" semantic conventions. It represents the name of the +// operation being executed. +func GraphQLOperationName(val string) attribute.KeyValue { + return GraphQLOperationNameKey.String(val) +} + +// Enum values for graphql.operation.type +var ( + // GraphQL query + // Stability: development + GraphQLOperationTypeQuery = GraphQLOperationTypeKey.String("query") + // GraphQL mutation + // Stability: development + GraphQLOperationTypeMutation = GraphQLOperationTypeKey.String("mutation") + // GraphQL subscription + // Stability: development + GraphQLOperationTypeSubscription = GraphQLOperationTypeKey.String("subscription") +) + +// Namespace: heroku +const ( + // HerokuAppIDKey is the attribute Key conforming to the "heroku.app.id" + // semantic conventions. It represents the unique identifier for the + // application. + // + // Type: string + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: "2daa2797-e42b-4624-9322-ec3f968df4da" + HerokuAppIDKey = attribute.Key("heroku.app.id") + + // HerokuReleaseCommitKey is the attribute Key conforming to the + // "heroku.release.commit" semantic conventions. It represents the commit hash + // for the current release. + // + // Type: string + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: "e6134959463efd8966b20e75b913cafe3f5ec" + HerokuReleaseCommitKey = attribute.Key("heroku.release.commit") + + // HerokuReleaseCreationTimestampKey is the attribute Key conforming to the + // "heroku.release.creation_timestamp" semantic conventions. It represents the + // time and date the release was created. + // + // Type: string + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: "2022-10-23T18:00:42Z" + HerokuReleaseCreationTimestampKey = attribute.Key("heroku.release.creation_timestamp") +) + +// HerokuAppID returns an attribute KeyValue conforming to the "heroku.app.id" +// semantic conventions. It represents the unique identifier for the application. +func HerokuAppID(val string) attribute.KeyValue { + return HerokuAppIDKey.String(val) +} + +// HerokuReleaseCommit returns an attribute KeyValue conforming to the +// "heroku.release.commit" semantic conventions. It represents the commit hash +// for the current release. +func HerokuReleaseCommit(val string) attribute.KeyValue { + return HerokuReleaseCommitKey.String(val) +} + +// HerokuReleaseCreationTimestamp returns an attribute KeyValue conforming to the +// "heroku.release.creation_timestamp" semantic conventions. It represents the +// time and date the release was created. +func HerokuReleaseCreationTimestamp(val string) attribute.KeyValue { + return HerokuReleaseCreationTimestampKey.String(val) +} + +// Namespace: host +const ( + // HostArchKey is the attribute Key conforming to the "host.arch" semantic + // conventions. It represents the CPU architecture the host system is running + // on. + // + // Type: Enum + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: + HostArchKey = attribute.Key("host.arch") + + // HostCPUCacheL2SizeKey is the attribute Key conforming to the + // "host.cpu.cache.l2.size" semantic conventions. It represents the amount of + // level 2 memory cache available to the processor (in Bytes). + // + // Type: int + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: 12288000 + HostCPUCacheL2SizeKey = attribute.Key("host.cpu.cache.l2.size") + + // HostCPUFamilyKey is the attribute Key conforming to the "host.cpu.family" + // semantic conventions. It represents the family or generation of the CPU. + // + // Type: string + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: "6", "PA-RISC 1.1e" + HostCPUFamilyKey = attribute.Key("host.cpu.family") + + // HostCPUModelIDKey is the attribute Key conforming to the "host.cpu.model.id" + // semantic conventions. It represents the model identifier. It provides more + // granular information about the CPU, distinguishing it from other CPUs within + // the same family. + // + // Type: string + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: "6", "9000/778/B180L" + HostCPUModelIDKey = attribute.Key("host.cpu.model.id") + + // HostCPUModelNameKey is the attribute Key conforming to the + // "host.cpu.model.name" semantic conventions. It represents the model + // designation of the processor. + // + // Type: string + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: "11th Gen Intel(R) Core(TM) i7-1185G7 @ 3.00GHz" + HostCPUModelNameKey = attribute.Key("host.cpu.model.name") + + // HostCPUSteppingKey is the attribute Key conforming to the "host.cpu.stepping" + // semantic conventions. It represents the stepping or core revisions. + // + // Type: string + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: "1", "r1p1" + HostCPUSteppingKey = attribute.Key("host.cpu.stepping") + + // HostCPUVendorIDKey is the attribute Key conforming to the + // "host.cpu.vendor.id" semantic conventions. It represents the processor + // manufacturer identifier. A maximum 12-character string. + // + // Type: string + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: "GenuineIntel" + // Note: [CPUID] command returns the vendor ID string in EBX, EDX and ECX + // registers. Writing these to memory in this order results in a 12-character + // string. + // + // [CPUID]: https://wiki.osdev.org/CPUID + HostCPUVendorIDKey = attribute.Key("host.cpu.vendor.id") + + // HostIDKey is the attribute Key conforming to the "host.id" semantic + // conventions. It represents the unique host ID. For Cloud, this must be the + // instance_id assigned by the cloud provider. For non-containerized systems, + // this should be the `machine-id`. See the table below for the sources to use + // to determine the `machine-id` based on operating system. + // + // Type: string + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: "fdbf79e8af94cb7f9e8df36789187052" + HostIDKey = attribute.Key("host.id") + + // HostImageIDKey is the attribute Key conforming to the "host.image.id" + // semantic conventions. It represents the VM image ID or host OS image ID. For + // Cloud, this value is from the provider. + // + // Type: string + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: "ami-07b06b442921831e5" + HostImageIDKey = attribute.Key("host.image.id") + + // HostImageNameKey is the attribute Key conforming to the "host.image.name" + // semantic conventions. It represents the name of the VM image or OS install + // the host was instantiated from. + // + // Type: string + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: "infra-ami-eks-worker-node-7d4ec78312", "CentOS-8-x86_64-1905" + HostImageNameKey = attribute.Key("host.image.name") + + // HostImageVersionKey is the attribute Key conforming to the + // "host.image.version" semantic conventions. It represents the version string + // of the VM image or host OS as defined in [Version Attributes]. + // + // Type: string + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: "0.1" + // + // [Version Attributes]: /docs/resource/README.md#version-attributes + HostImageVersionKey = attribute.Key("host.image.version") + + // HostIPKey is the attribute Key conforming to the "host.ip" semantic + // conventions. It represents the available IP addresses of the host, excluding + // loopback interfaces. + // + // Type: string[] + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: "192.168.1.140", "fe80::abc2:4a28:737a:609e" + // Note: IPv4 Addresses MUST be specified in dotted-quad notation. IPv6 + // addresses MUST be specified in the [RFC 5952] format. + // + // [RFC 5952]: https://www.rfc-editor.org/rfc/rfc5952.html + HostIPKey = attribute.Key("host.ip") + + // HostMacKey is the attribute Key conforming to the "host.mac" semantic + // conventions. It represents the available MAC addresses of the host, excluding + // loopback interfaces. + // + // Type: string[] + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: "AC-DE-48-23-45-67", "AC-DE-48-23-45-67-01-9F" + // Note: MAC Addresses MUST be represented in [IEEE RA hexadecimal form]: as + // hyphen-separated octets in uppercase hexadecimal form from most to least + // significant. + // + // [IEEE RA hexadecimal form]: https://standards.ieee.org/wp-content/uploads/import/documents/tutorials/eui.pdf + HostMacKey = attribute.Key("host.mac") + + // HostNameKey is the attribute Key conforming to the "host.name" semantic + // conventions. It represents the name of the host. On Unix systems, it may + // contain what the hostname command returns, or the fully qualified hostname, + // or another name specified by the user. + // + // Type: string + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: "opentelemetry-test" + HostNameKey = attribute.Key("host.name") + + // HostTypeKey is the attribute Key conforming to the "host.type" semantic + // conventions. It represents the type of host. For Cloud, this must be the + // machine type. + // + // Type: string + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: "n1-standard-1" + HostTypeKey = attribute.Key("host.type") +) + +// HostCPUCacheL2Size returns an attribute KeyValue conforming to the +// "host.cpu.cache.l2.size" semantic conventions. It represents the amount of +// level 2 memory cache available to the processor (in Bytes). +func HostCPUCacheL2Size(val int) attribute.KeyValue { + return HostCPUCacheL2SizeKey.Int(val) +} + +// HostCPUFamily returns an attribute KeyValue conforming to the +// "host.cpu.family" semantic conventions. It represents the family or generation +// of the CPU. +func HostCPUFamily(val string) attribute.KeyValue { + return HostCPUFamilyKey.String(val) +} + +// HostCPUModelID returns an attribute KeyValue conforming to the +// "host.cpu.model.id" semantic conventions. It represents the model identifier. +// It provides more granular information about the CPU, distinguishing it from +// other CPUs within the same family. +func HostCPUModelID(val string) attribute.KeyValue { + return HostCPUModelIDKey.String(val) +} + +// HostCPUModelName returns an attribute KeyValue conforming to the +// "host.cpu.model.name" semantic conventions. It represents the model +// designation of the processor. +func HostCPUModelName(val string) attribute.KeyValue { + return HostCPUModelNameKey.String(val) +} + +// HostCPUStepping returns an attribute KeyValue conforming to the +// "host.cpu.stepping" semantic conventions. It represents the stepping or core +// revisions. +func HostCPUStepping(val string) attribute.KeyValue { + return HostCPUSteppingKey.String(val) +} + +// HostCPUVendorID returns an attribute KeyValue conforming to the +// "host.cpu.vendor.id" semantic conventions. It represents the processor +// manufacturer identifier. A maximum 12-character string. +func HostCPUVendorID(val string) attribute.KeyValue { + return HostCPUVendorIDKey.String(val) +} + +// HostID returns an attribute KeyValue conforming to the "host.id" semantic +// conventions. It represents the unique host ID. For Cloud, this must be the +// instance_id assigned by the cloud provider. For non-containerized systems, +// this should be the `machine-id`. See the table below for the sources to use to +// determine the `machine-id` based on operating system. +func HostID(val string) attribute.KeyValue { + return HostIDKey.String(val) +} + +// HostImageID returns an attribute KeyValue conforming to the "host.image.id" +// semantic conventions. It represents the VM image ID or host OS image ID. For +// Cloud, this value is from the provider. +func HostImageID(val string) attribute.KeyValue { + return HostImageIDKey.String(val) +} + +// HostImageName returns an attribute KeyValue conforming to the +// "host.image.name" semantic conventions. It represents the name of the VM image +// or OS install the host was instantiated from. +func HostImageName(val string) attribute.KeyValue { + return HostImageNameKey.String(val) +} + +// HostImageVersion returns an attribute KeyValue conforming to the +// "host.image.version" semantic conventions. It represents the version string of +// the VM image or host OS as defined in [Version Attributes]. +// +// [Version Attributes]: /docs/resource/README.md#version-attributes +func HostImageVersion(val string) attribute.KeyValue { + return HostImageVersionKey.String(val) +} + +// HostIP returns an attribute KeyValue conforming to the "host.ip" semantic +// conventions. It represents the available IP addresses of the host, excluding +// loopback interfaces. +func HostIP(val ...string) attribute.KeyValue { + return HostIPKey.StringSlice(val) +} + +// HostMac returns an attribute KeyValue conforming to the "host.mac" semantic +// conventions. It represents the available MAC addresses of the host, excluding +// loopback interfaces. +func HostMac(val ...string) attribute.KeyValue { + return HostMacKey.StringSlice(val) +} + +// HostName returns an attribute KeyValue conforming to the "host.name" semantic +// conventions. It represents the name of the host. On Unix systems, it may +// contain what the hostname command returns, or the fully qualified hostname, or +// another name specified by the user. +func HostName(val string) attribute.KeyValue { + return HostNameKey.String(val) +} + +// HostType returns an attribute KeyValue conforming to the "host.type" semantic +// conventions. It represents the type of host. For Cloud, this must be the +// machine type. +func HostType(val string) attribute.KeyValue { + return HostTypeKey.String(val) +} + +// Enum values for host.arch +var ( + // AMD64 + // Stability: development + HostArchAMD64 = HostArchKey.String("amd64") + // ARM32 + // Stability: development + HostArchARM32 = HostArchKey.String("arm32") + // ARM64 + // Stability: development + HostArchARM64 = HostArchKey.String("arm64") + // Itanium + // Stability: development + HostArchIA64 = HostArchKey.String("ia64") + // 32-bit PowerPC + // Stability: development + HostArchPPC32 = HostArchKey.String("ppc32") + // 64-bit PowerPC + // Stability: development + HostArchPPC64 = HostArchKey.String("ppc64") + // IBM z/Architecture + // Stability: development + HostArchS390x = HostArchKey.String("s390x") + // 32-bit x86 + // Stability: development + HostArchX86 = HostArchKey.String("x86") +) + +// Namespace: http +const ( + // HTTPConnectionStateKey is the attribute Key conforming to the + // "http.connection.state" semantic conventions. It represents the state of the + // HTTP connection in the HTTP connection pool. + // + // Type: Enum + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: "active", "idle" + HTTPConnectionStateKey = attribute.Key("http.connection.state") + + // HTTPRequestBodySizeKey is the attribute Key conforming to the + // "http.request.body.size" semantic conventions. It represents the size of the + // request payload body in bytes. This is the number of bytes transferred + // excluding headers and is often, but not always, present as the + // [Content-Length] header. For requests using transport encoding, this should + // be the compressed size. + // + // Type: int + // RequirementLevel: Recommended + // Stability: Development + // + // [Content-Length]: https://www.rfc-editor.org/rfc/rfc9110.html#field.content-length + HTTPRequestBodySizeKey = attribute.Key("http.request.body.size") + + // HTTPRequestMethodKey is the attribute Key conforming to the + // "http.request.method" semantic conventions. It represents the HTTP request + // method. + // + // Type: Enum + // RequirementLevel: Recommended + // Stability: Stable + // + // Examples: "GET", "POST", "HEAD" + // Note: HTTP request method value SHOULD be "known" to the instrumentation. + // By default, this convention defines "known" methods as the ones listed in + // [RFC9110] + // and the PATCH method defined in [RFC5789]. + // + // If the HTTP request method is not known to instrumentation, it MUST set the + // `http.request.method` attribute to `_OTHER`. + // + // If the HTTP instrumentation could end up converting valid HTTP request + // methods to `_OTHER`, then it MUST provide a way to override + // the list of known HTTP methods. If this override is done via environment + // variable, then the environment variable MUST be named + // OTEL_INSTRUMENTATION_HTTP_KNOWN_METHODS and support a comma-separated list of + // case-sensitive known HTTP methods + // (this list MUST be a full override of the default known method, it is not a + // list of known methods in addition to the defaults). + // + // HTTP method names are case-sensitive and `http.request.method` attribute + // value MUST match a known HTTP method name exactly. + // Instrumentations for specific web frameworks that consider HTTP methods to be + // case insensitive, SHOULD populate a canonical equivalent. + // Tracing instrumentations that do so, MUST also set + // `http.request.method_original` to the original value. + // + // [RFC9110]: https://www.rfc-editor.org/rfc/rfc9110.html#name-methods + // [RFC5789]: https://www.rfc-editor.org/rfc/rfc5789.html + HTTPRequestMethodKey = attribute.Key("http.request.method") + + // HTTPRequestMethodOriginalKey is the attribute Key conforming to the + // "http.request.method_original" semantic conventions. It represents the + // original HTTP method sent by the client in the request line. + // + // Type: string + // RequirementLevel: Recommended + // Stability: Stable + // + // Examples: "GeT", "ACL", "foo" + HTTPRequestMethodOriginalKey = attribute.Key("http.request.method_original") + + // HTTPRequestResendCountKey is the attribute Key conforming to the + // "http.request.resend_count" semantic conventions. It represents the ordinal + // number of request resending attempt (for any reason, including redirects). + // + // Type: int + // RequirementLevel: Recommended + // Stability: Stable + // + // Note: The resend count SHOULD be updated each time an HTTP request gets + // resent by the client, regardless of what was the cause of the resending (e.g. + // redirection, authorization failure, 503 Server Unavailable, network issues, + // or any other). + HTTPRequestResendCountKey = attribute.Key("http.request.resend_count") + + // HTTPRequestSizeKey is the attribute Key conforming to the "http.request.size" + // semantic conventions. It represents the total size of the request in bytes. + // This should be the total number of bytes sent over the wire, including the + // request line (HTTP/1.1), framing (HTTP/2 and HTTP/3), headers, and request + // body if any. + // + // Type: int + // RequirementLevel: Recommended + // Stability: Development + HTTPRequestSizeKey = attribute.Key("http.request.size") + + // HTTPResponseBodySizeKey is the attribute Key conforming to the + // "http.response.body.size" semantic conventions. It represents the size of the + // response payload body in bytes. This is the number of bytes transferred + // excluding headers and is often, but not always, present as the + // [Content-Length] header. For requests using transport encoding, this should + // be the compressed size. + // + // Type: int + // RequirementLevel: Recommended + // Stability: Development + // + // [Content-Length]: https://www.rfc-editor.org/rfc/rfc9110.html#field.content-length + HTTPResponseBodySizeKey = attribute.Key("http.response.body.size") + + // HTTPResponseSizeKey is the attribute Key conforming to the + // "http.response.size" semantic conventions. It represents the total size of + // the response in bytes. This should be the total number of bytes sent over the + // wire, including the status line (HTTP/1.1), framing (HTTP/2 and HTTP/3), + // headers, and response body and trailers if any. + // + // Type: int + // RequirementLevel: Recommended + // Stability: Development + HTTPResponseSizeKey = attribute.Key("http.response.size") + + // HTTPResponseStatusCodeKey is the attribute Key conforming to the + // "http.response.status_code" semantic conventions. It represents the + // [HTTP response status code]. + // + // Type: int + // RequirementLevel: Recommended + // Stability: Stable + // + // Examples: 200 + // + // [HTTP response status code]: https://tools.ietf.org/html/rfc7231#section-6 + HTTPResponseStatusCodeKey = attribute.Key("http.response.status_code") + + // HTTPRouteKey is the attribute Key conforming to the "http.route" semantic + // conventions. It represents the matched route, that is, the path template in + // the format used by the respective server framework. + // + // Type: string + // RequirementLevel: Recommended + // Stability: Stable + // + // Examples: "/users/:userID?", "{controller}/{action}/{id?}" + // Note: MUST NOT be populated when this is not supported by the HTTP server + // framework as the route attribute should have low-cardinality and the URI path + // can NOT substitute it. + // SHOULD include the [application root] if there is one. + // + // [application root]: /docs/http/http-spans.md#http-server-definitions + HTTPRouteKey = attribute.Key("http.route") +) + +// HTTPRequestBodySize returns an attribute KeyValue conforming to the +// "http.request.body.size" semantic conventions. It represents the size of the +// request payload body in bytes. This is the number of bytes transferred +// excluding headers and is often, but not always, present as the +// [Content-Length] header. For requests using transport encoding, this should be +// the compressed size. +// +// [Content-Length]: https://www.rfc-editor.org/rfc/rfc9110.html#field.content-length +func HTTPRequestBodySize(val int) attribute.KeyValue { + return HTTPRequestBodySizeKey.Int(val) +} + +// HTTPRequestHeader returns an attribute KeyValue conforming to the +// "http.request.header" semantic conventions. It represents the HTTP request +// headers, `` being the normalized HTTP Header name (lowercase), the value +// being the header values. +func HTTPRequestHeader(key string, val ...string) attribute.KeyValue { + return attribute.StringSlice("http.request.header."+key, val) +} + +// HTTPRequestMethodOriginal returns an attribute KeyValue conforming to the +// "http.request.method_original" semantic conventions. It represents the +// original HTTP method sent by the client in the request line. +func HTTPRequestMethodOriginal(val string) attribute.KeyValue { + return HTTPRequestMethodOriginalKey.String(val) +} + +// HTTPRequestResendCount returns an attribute KeyValue conforming to the +// "http.request.resend_count" semantic conventions. It represents the ordinal +// number of request resending attempt (for any reason, including redirects). +func HTTPRequestResendCount(val int) attribute.KeyValue { + return HTTPRequestResendCountKey.Int(val) +} + +// HTTPRequestSize returns an attribute KeyValue conforming to the +// "http.request.size" semantic conventions. It represents the total size of the +// request in bytes. This should be the total number of bytes sent over the wire, +// including the request line (HTTP/1.1), framing (HTTP/2 and HTTP/3), headers, +// and request body if any. +func HTTPRequestSize(val int) attribute.KeyValue { + return HTTPRequestSizeKey.Int(val) +} + +// HTTPResponseBodySize returns an attribute KeyValue conforming to the +// "http.response.body.size" semantic conventions. It represents the size of the +// response payload body in bytes. This is the number of bytes transferred +// excluding headers and is often, but not always, present as the +// [Content-Length] header. For requests using transport encoding, this should be +// the compressed size. +// +// [Content-Length]: https://www.rfc-editor.org/rfc/rfc9110.html#field.content-length +func HTTPResponseBodySize(val int) attribute.KeyValue { + return HTTPResponseBodySizeKey.Int(val) +} + +// HTTPResponseHeader returns an attribute KeyValue conforming to the +// "http.response.header" semantic conventions. It represents the HTTP response +// headers, `` being the normalized HTTP Header name (lowercase), the value +// being the header values. +func HTTPResponseHeader(key string, val ...string) attribute.KeyValue { + return attribute.StringSlice("http.response.header."+key, val) +} + +// HTTPResponseSize returns an attribute KeyValue conforming to the +// "http.response.size" semantic conventions. It represents the total size of the +// response in bytes. This should be the total number of bytes sent over the +// wire, including the status line (HTTP/1.1), framing (HTTP/2 and HTTP/3), +// headers, and response body and trailers if any. +func HTTPResponseSize(val int) attribute.KeyValue { + return HTTPResponseSizeKey.Int(val) +} + +// HTTPResponseStatusCode returns an attribute KeyValue conforming to the +// "http.response.status_code" semantic conventions. It represents the +// [HTTP response status code]. +// +// [HTTP response status code]: https://tools.ietf.org/html/rfc7231#section-6 +func HTTPResponseStatusCode(val int) attribute.KeyValue { + return HTTPResponseStatusCodeKey.Int(val) +} + +// HTTPRoute returns an attribute KeyValue conforming to the "http.route" +// semantic conventions. It represents the matched route, that is, the path +// template in the format used by the respective server framework. +func HTTPRoute(val string) attribute.KeyValue { + return HTTPRouteKey.String(val) +} + +// Enum values for http.connection.state +var ( + // active state. + // Stability: development + HTTPConnectionStateActive = HTTPConnectionStateKey.String("active") + // idle state. + // Stability: development + HTTPConnectionStateIdle = HTTPConnectionStateKey.String("idle") +) + +// Enum values for http.request.method +var ( + // CONNECT method. + // Stability: stable + HTTPRequestMethodConnect = HTTPRequestMethodKey.String("CONNECT") + // DELETE method. + // Stability: stable + HTTPRequestMethodDelete = HTTPRequestMethodKey.String("DELETE") + // GET method. + // Stability: stable + HTTPRequestMethodGet = HTTPRequestMethodKey.String("GET") + // HEAD method. + // Stability: stable + HTTPRequestMethodHead = HTTPRequestMethodKey.String("HEAD") + // OPTIONS method. + // Stability: stable + HTTPRequestMethodOptions = HTTPRequestMethodKey.String("OPTIONS") + // PATCH method. + // Stability: stable + HTTPRequestMethodPatch = HTTPRequestMethodKey.String("PATCH") + // POST method. + // Stability: stable + HTTPRequestMethodPost = HTTPRequestMethodKey.String("POST") + // PUT method. + // Stability: stable + HTTPRequestMethodPut = HTTPRequestMethodKey.String("PUT") + // TRACE method. + // Stability: stable + HTTPRequestMethodTrace = HTTPRequestMethodKey.String("TRACE") + // Any HTTP method that the instrumentation has no prior knowledge of. + // Stability: stable + HTTPRequestMethodOther = HTTPRequestMethodKey.String("_OTHER") +) + +// Namespace: hw +const ( + // HwBatteryCapacityKey is the attribute Key conforming to the + // "hw.battery.capacity" semantic conventions. It represents the design capacity + // in Watts-hours or Amper-hours. + // + // Type: string + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: "9.3Ah", "50Wh" + HwBatteryCapacityKey = attribute.Key("hw.battery.capacity") + + // HwBatteryChemistryKey is the attribute Key conforming to the + // "hw.battery.chemistry" semantic conventions. It represents the battery + // [chemistry], e.g. Lithium-Ion, Nickel-Cadmium, etc. + // + // Type: string + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: "Li-ion", "NiMH" + // + // [chemistry]: https://schemas.dmtf.org/wbem/cim-html/2.31.0/CIM_Battery.html + HwBatteryChemistryKey = attribute.Key("hw.battery.chemistry") + + // HwBatteryStateKey is the attribute Key conforming to the "hw.battery.state" + // semantic conventions. It represents the current state of the battery. + // + // Type: Enum + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: + HwBatteryStateKey = attribute.Key("hw.battery.state") + + // HwBiosVersionKey is the attribute Key conforming to the "hw.bios_version" + // semantic conventions. It represents the BIOS version of the hardware + // component. + // + // Type: string + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: "1.2.3" + HwBiosVersionKey = attribute.Key("hw.bios_version") + + // HwDriverVersionKey is the attribute Key conforming to the "hw.driver_version" + // semantic conventions. It represents the driver version for the hardware + // component. + // + // Type: string + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: "10.2.1-3" + HwDriverVersionKey = attribute.Key("hw.driver_version") + + // HwEnclosureTypeKey is the attribute Key conforming to the "hw.enclosure.type" + // semantic conventions. It represents the type of the enclosure (useful for + // modular systems). + // + // Type: string + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: "Computer", "Storage", "Switch" + HwEnclosureTypeKey = attribute.Key("hw.enclosure.type") + + // HwFirmwareVersionKey is the attribute Key conforming to the + // "hw.firmware_version" semantic conventions. It represents the firmware + // version of the hardware component. + // + // Type: string + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: "2.0.1" + HwFirmwareVersionKey = attribute.Key("hw.firmware_version") + + // HwGpuTaskKey is the attribute Key conforming to the "hw.gpu.task" semantic + // conventions. It represents the type of task the GPU is performing. + // + // Type: Enum + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: + HwGpuTaskKey = attribute.Key("hw.gpu.task") + + // HwIDKey is the attribute Key conforming to the "hw.id" semantic conventions. + // It represents an identifier for the hardware component, unique within the + // monitored host. + // + // Type: string + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: "win32battery_battery_testsysa33_1" + HwIDKey = attribute.Key("hw.id") + + // HwLimitTypeKey is the attribute Key conforming to the "hw.limit_type" + // semantic conventions. It represents the type of limit for hardware + // components. + // + // Type: Enum + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: + HwLimitTypeKey = attribute.Key("hw.limit_type") + + // HwLogicalDiskRaidLevelKey is the attribute Key conforming to the + // "hw.logical_disk.raid_level" semantic conventions. It represents the RAID + // Level of the logical disk. + // + // Type: string + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: "RAID0+1", "RAID5", "RAID10" + HwLogicalDiskRaidLevelKey = attribute.Key("hw.logical_disk.raid_level") + + // HwLogicalDiskStateKey is the attribute Key conforming to the + // "hw.logical_disk.state" semantic conventions. It represents the state of the + // logical disk space usage. + // + // Type: Enum + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: + HwLogicalDiskStateKey = attribute.Key("hw.logical_disk.state") + + // HwMemoryTypeKey is the attribute Key conforming to the "hw.memory.type" + // semantic conventions. It represents the type of the memory module. + // + // Type: string + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: "DDR4", "DDR5", "LPDDR5" + HwMemoryTypeKey = attribute.Key("hw.memory.type") + + // HwModelKey is the attribute Key conforming to the "hw.model" semantic + // conventions. It represents the descriptive model name of the hardware + // component. + // + // Type: string + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: "PERC H740P", "Intel(R) Core(TM) i7-10700K", "Dell XPS 15 Battery" + HwModelKey = attribute.Key("hw.model") + + // HwNameKey is the attribute Key conforming to the "hw.name" semantic + // conventions. It represents an easily-recognizable name for the hardware + // component. + // + // Type: string + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: "eth0" + HwNameKey = attribute.Key("hw.name") + + // HwNetworkLogicalAddressesKey is the attribute Key conforming to the + // "hw.network.logical_addresses" semantic conventions. It represents the + // logical addresses of the adapter (e.g. IP address, or WWPN). + // + // Type: string[] + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: "172.16.8.21", "57.11.193.42" + HwNetworkLogicalAddressesKey = attribute.Key("hw.network.logical_addresses") + + // HwNetworkPhysicalAddressKey is the attribute Key conforming to the + // "hw.network.physical_address" semantic conventions. It represents the + // physical address of the adapter (e.g. MAC address, or WWNN). + // + // Type: string + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: "00-90-F5-E9-7B-36" + HwNetworkPhysicalAddressKey = attribute.Key("hw.network.physical_address") + + // HwParentKey is the attribute Key conforming to the "hw.parent" semantic + // conventions. It represents the unique identifier of the parent component + // (typically the `hw.id` attribute of the enclosure, or disk controller). + // + // Type: string + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: "dellStorage_perc_0" + HwParentKey = attribute.Key("hw.parent") + + // HwPhysicalDiskSmartAttributeKey is the attribute Key conforming to the + // "hw.physical_disk.smart_attribute" semantic conventions. It represents the + // [S.M.A.R.T.] (Self-Monitoring, Analysis, and Reporting Technology) attribute + // of the physical disk. + // + // Type: string + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: "Spin Retry Count", "Seek Error Rate", "Raw Read Error Rate" + // + // [S.M.A.R.T.]: https://wikipedia.org/wiki/S.M.A.R.T. + HwPhysicalDiskSmartAttributeKey = attribute.Key("hw.physical_disk.smart_attribute") + + // HwPhysicalDiskStateKey is the attribute Key conforming to the + // "hw.physical_disk.state" semantic conventions. It represents the state of the + // physical disk endurance utilization. + // + // Type: Enum + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: + HwPhysicalDiskStateKey = attribute.Key("hw.physical_disk.state") + + // HwPhysicalDiskTypeKey is the attribute Key conforming to the + // "hw.physical_disk.type" semantic conventions. It represents the type of the + // physical disk. + // + // Type: string + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: "HDD", "SSD", "10K" + HwPhysicalDiskTypeKey = attribute.Key("hw.physical_disk.type") + + // HwSensorLocationKey is the attribute Key conforming to the + // "hw.sensor_location" semantic conventions. It represents the location of the + // sensor. + // + // Type: string + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: "cpu0", "ps1", "INLET", "CPU0_DIE", "AMBIENT", "MOTHERBOARD", "PS0 + // V3_3", "MAIN_12V", "CPU_VCORE" + HwSensorLocationKey = attribute.Key("hw.sensor_location") + + // HwSerialNumberKey is the attribute Key conforming to the "hw.serial_number" + // semantic conventions. It represents the serial number of the hardware + // component. + // + // Type: string + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: "CNFCP0123456789" + HwSerialNumberKey = attribute.Key("hw.serial_number") + + // HwStateKey is the attribute Key conforming to the "hw.state" semantic + // conventions. It represents the current state of the component. + // + // Type: Enum + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: + HwStateKey = attribute.Key("hw.state") + + // HwTapeDriveOperationTypeKey is the attribute Key conforming to the + // "hw.tape_drive.operation_type" semantic conventions. It represents the type + // of tape drive operation. + // + // Type: Enum + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: + HwTapeDriveOperationTypeKey = attribute.Key("hw.tape_drive.operation_type") + + // HwTypeKey is the attribute Key conforming to the "hw.type" semantic + // conventions. It represents the type of the component. + // + // Type: Enum + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: + // Note: Describes the category of the hardware component for which `hw.state` + // is being reported. For example, `hw.type=temperature` along with + // `hw.state=degraded` would indicate that the temperature of the hardware + // component has been reported as `degraded`. + HwTypeKey = attribute.Key("hw.type") + + // HwVendorKey is the attribute Key conforming to the "hw.vendor" semantic + // conventions. It represents the vendor name of the hardware component. + // + // Type: string + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: "Dell", "HP", "Intel", "AMD", "LSI", "Lenovo" + HwVendorKey = attribute.Key("hw.vendor") +) + +// HwBatteryCapacity returns an attribute KeyValue conforming to the +// "hw.battery.capacity" semantic conventions. It represents the design capacity +// in Watts-hours or Amper-hours. +func HwBatteryCapacity(val string) attribute.KeyValue { + return HwBatteryCapacityKey.String(val) +} + +// HwBatteryChemistry returns an attribute KeyValue conforming to the +// "hw.battery.chemistry" semantic conventions. It represents the battery +// [chemistry], e.g. Lithium-Ion, Nickel-Cadmium, etc. +// +// [chemistry]: https://schemas.dmtf.org/wbem/cim-html/2.31.0/CIM_Battery.html +func HwBatteryChemistry(val string) attribute.KeyValue { + return HwBatteryChemistryKey.String(val) +} + +// HwBiosVersion returns an attribute KeyValue conforming to the +// "hw.bios_version" semantic conventions. It represents the BIOS version of the +// hardware component. +func HwBiosVersion(val string) attribute.KeyValue { + return HwBiosVersionKey.String(val) +} + +// HwDriverVersion returns an attribute KeyValue conforming to the +// "hw.driver_version" semantic conventions. It represents the driver version for +// the hardware component. +func HwDriverVersion(val string) attribute.KeyValue { + return HwDriverVersionKey.String(val) +} + +// HwEnclosureType returns an attribute KeyValue conforming to the +// "hw.enclosure.type" semantic conventions. It represents the type of the +// enclosure (useful for modular systems). +func HwEnclosureType(val string) attribute.KeyValue { + return HwEnclosureTypeKey.String(val) +} + +// HwFirmwareVersion returns an attribute KeyValue conforming to the +// "hw.firmware_version" semantic conventions. It represents the firmware version +// of the hardware component. +func HwFirmwareVersion(val string) attribute.KeyValue { + return HwFirmwareVersionKey.String(val) +} + +// HwID returns an attribute KeyValue conforming to the "hw.id" semantic +// conventions. It represents an identifier for the hardware component, unique +// within the monitored host. +func HwID(val string) attribute.KeyValue { + return HwIDKey.String(val) +} + +// HwLogicalDiskRaidLevel returns an attribute KeyValue conforming to the +// "hw.logical_disk.raid_level" semantic conventions. It represents the RAID +// Level of the logical disk. +func HwLogicalDiskRaidLevel(val string) attribute.KeyValue { + return HwLogicalDiskRaidLevelKey.String(val) +} + +// HwMemoryType returns an attribute KeyValue conforming to the "hw.memory.type" +// semantic conventions. It represents the type of the memory module. +func HwMemoryType(val string) attribute.KeyValue { + return HwMemoryTypeKey.String(val) +} + +// HwModel returns an attribute KeyValue conforming to the "hw.model" semantic +// conventions. It represents the descriptive model name of the hardware +// component. +func HwModel(val string) attribute.KeyValue { + return HwModelKey.String(val) +} + +// HwName returns an attribute KeyValue conforming to the "hw.name" semantic +// conventions. It represents an easily-recognizable name for the hardware +// component. +func HwName(val string) attribute.KeyValue { + return HwNameKey.String(val) +} + +// HwNetworkLogicalAddresses returns an attribute KeyValue conforming to the +// "hw.network.logical_addresses" semantic conventions. It represents the logical +// addresses of the adapter (e.g. IP address, or WWPN). +func HwNetworkLogicalAddresses(val ...string) attribute.KeyValue { + return HwNetworkLogicalAddressesKey.StringSlice(val) +} + +// HwNetworkPhysicalAddress returns an attribute KeyValue conforming to the +// "hw.network.physical_address" semantic conventions. It represents the physical +// address of the adapter (e.g. MAC address, or WWNN). +func HwNetworkPhysicalAddress(val string) attribute.KeyValue { + return HwNetworkPhysicalAddressKey.String(val) +} + +// HwParent returns an attribute KeyValue conforming to the "hw.parent" semantic +// conventions. It represents the unique identifier of the parent component +// (typically the `hw.id` attribute of the enclosure, or disk controller). +func HwParent(val string) attribute.KeyValue { + return HwParentKey.String(val) +} + +// HwPhysicalDiskSmartAttribute returns an attribute KeyValue conforming to the +// "hw.physical_disk.smart_attribute" semantic conventions. It represents the +// [S.M.A.R.T.] (Self-Monitoring, Analysis, and Reporting Technology) attribute +// of the physical disk. +// +// [S.M.A.R.T.]: https://wikipedia.org/wiki/S.M.A.R.T. +func HwPhysicalDiskSmartAttribute(val string) attribute.KeyValue { + return HwPhysicalDiskSmartAttributeKey.String(val) +} + +// HwPhysicalDiskType returns an attribute KeyValue conforming to the +// "hw.physical_disk.type" semantic conventions. It represents the type of the +// physical disk. +func HwPhysicalDiskType(val string) attribute.KeyValue { + return HwPhysicalDiskTypeKey.String(val) +} + +// HwSensorLocation returns an attribute KeyValue conforming to the +// "hw.sensor_location" semantic conventions. It represents the location of the +// sensor. +func HwSensorLocation(val string) attribute.KeyValue { + return HwSensorLocationKey.String(val) +} + +// HwSerialNumber returns an attribute KeyValue conforming to the +// "hw.serial_number" semantic conventions. It represents the serial number of +// the hardware component. +func HwSerialNumber(val string) attribute.KeyValue { + return HwSerialNumberKey.String(val) +} + +// HwVendor returns an attribute KeyValue conforming to the "hw.vendor" semantic +// conventions. It represents the vendor name of the hardware component. +func HwVendor(val string) attribute.KeyValue { + return HwVendorKey.String(val) +} + +// Enum values for hw.battery.state +var ( + // Charging + // Stability: development + HwBatteryStateCharging = HwBatteryStateKey.String("charging") + // Discharging + // Stability: development + HwBatteryStateDischarging = HwBatteryStateKey.String("discharging") +) + +// Enum values for hw.gpu.task +var ( + // Decoder + // Stability: development + HwGpuTaskDecoder = HwGpuTaskKey.String("decoder") + // Encoder + // Stability: development + HwGpuTaskEncoder = HwGpuTaskKey.String("encoder") + // General + // Stability: development + HwGpuTaskGeneral = HwGpuTaskKey.String("general") +) + +// Enum values for hw.limit_type +var ( + // Critical + // Stability: development + HwLimitTypeCritical = HwLimitTypeKey.String("critical") + // Degraded + // Stability: development + HwLimitTypeDegraded = HwLimitTypeKey.String("degraded") + // High Critical + // Stability: development + HwLimitTypeHighCritical = HwLimitTypeKey.String("high.critical") + // High Degraded + // Stability: development + HwLimitTypeHighDegraded = HwLimitTypeKey.String("high.degraded") + // Low Critical + // Stability: development + HwLimitTypeLowCritical = HwLimitTypeKey.String("low.critical") + // Low Degraded + // Stability: development + HwLimitTypeLowDegraded = HwLimitTypeKey.String("low.degraded") + // Maximum + // Stability: development + HwLimitTypeMax = HwLimitTypeKey.String("max") + // Throttled + // Stability: development + HwLimitTypeThrottled = HwLimitTypeKey.String("throttled") + // Turbo + // Stability: development + HwLimitTypeTurbo = HwLimitTypeKey.String("turbo") +) + +// Enum values for hw.logical_disk.state +var ( + // Used + // Stability: development + HwLogicalDiskStateUsed = HwLogicalDiskStateKey.String("used") + // Free + // Stability: development + HwLogicalDiskStateFree = HwLogicalDiskStateKey.String("free") +) + +// Enum values for hw.physical_disk.state +var ( + // Remaining + // Stability: development + HwPhysicalDiskStateRemaining = HwPhysicalDiskStateKey.String("remaining") +) + +// Enum values for hw.state +var ( + // Degraded + // Stability: development + HwStateDegraded = HwStateKey.String("degraded") + // Failed + // Stability: development + HwStateFailed = HwStateKey.String("failed") + // Needs Cleaning + // Stability: development + HwStateNeedsCleaning = HwStateKey.String("needs_cleaning") + // OK + // Stability: development + HwStateOk = HwStateKey.String("ok") + // Predicted Failure + // Stability: development + HwStatePredictedFailure = HwStateKey.String("predicted_failure") +) + +// Enum values for hw.tape_drive.operation_type +var ( + // Mount + // Stability: development + HwTapeDriveOperationTypeMount = HwTapeDriveOperationTypeKey.String("mount") + // Unmount + // Stability: development + HwTapeDriveOperationTypeUnmount = HwTapeDriveOperationTypeKey.String("unmount") + // Clean + // Stability: development + HwTapeDriveOperationTypeClean = HwTapeDriveOperationTypeKey.String("clean") +) + +// Enum values for hw.type +var ( + // Battery + // Stability: development + HwTypeBattery = HwTypeKey.String("battery") + // CPU + // Stability: development + HwTypeCPU = HwTypeKey.String("cpu") + // Disk controller + // Stability: development + HwTypeDiskController = HwTypeKey.String("disk_controller") + // Enclosure + // Stability: development + HwTypeEnclosure = HwTypeKey.String("enclosure") + // Fan + // Stability: development + HwTypeFan = HwTypeKey.String("fan") + // GPU + // Stability: development + HwTypeGpu = HwTypeKey.String("gpu") + // Logical disk + // Stability: development + HwTypeLogicalDisk = HwTypeKey.String("logical_disk") + // Memory + // Stability: development + HwTypeMemory = HwTypeKey.String("memory") + // Network + // Stability: development + HwTypeNetwork = HwTypeKey.String("network") + // Physical disk + // Stability: development + HwTypePhysicalDisk = HwTypeKey.String("physical_disk") + // Power supply + // Stability: development + HwTypePowerSupply = HwTypeKey.String("power_supply") + // Tape drive + // Stability: development + HwTypeTapeDrive = HwTypeKey.String("tape_drive") + // Temperature + // Stability: development + HwTypeTemperature = HwTypeKey.String("temperature") + // Voltage + // Stability: development + HwTypeVoltage = HwTypeKey.String("voltage") +) + +// Namespace: ios +const ( + // IOSAppStateKey is the attribute Key conforming to the "ios.app.state" + // semantic conventions. It represents the this attribute represents the state + // of the application. + // + // Type: Enum + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: + // Note: The iOS lifecycle states are defined in the + // [UIApplicationDelegate documentation], and from which the `OS terminology` + // column values are derived. + // + // [UIApplicationDelegate documentation]: https://developer.apple.com/documentation/uikit/uiapplicationdelegate + IOSAppStateKey = attribute.Key("ios.app.state") +) + +// Enum values for ios.app.state +var ( + // The app has become `active`. Associated with UIKit notification + // `applicationDidBecomeActive`. + // + // Stability: development + IOSAppStateActive = IOSAppStateKey.String("active") + // The app is now `inactive`. Associated with UIKit notification + // `applicationWillResignActive`. + // + // Stability: development + IOSAppStateInactive = IOSAppStateKey.String("inactive") + // The app is now in the background. This value is associated with UIKit + // notification `applicationDidEnterBackground`. + // + // Stability: development + IOSAppStateBackground = IOSAppStateKey.String("background") + // The app is now in the foreground. This value is associated with UIKit + // notification `applicationWillEnterForeground`. + // + // Stability: development + IOSAppStateForeground = IOSAppStateKey.String("foreground") + // The app is about to terminate. Associated with UIKit notification + // `applicationWillTerminate`. + // + // Stability: development + IOSAppStateTerminate = IOSAppStateKey.String("terminate") +) + +// Namespace: k8s +const ( + // K8SClusterNameKey is the attribute Key conforming to the "k8s.cluster.name" + // semantic conventions. It represents the name of the cluster. + // + // Type: string + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: "opentelemetry-cluster" + K8SClusterNameKey = attribute.Key("k8s.cluster.name") + + // K8SClusterUIDKey is the attribute Key conforming to the "k8s.cluster.uid" + // semantic conventions. It represents a pseudo-ID for the cluster, set to the + // UID of the `kube-system` namespace. + // + // Type: string + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: "218fc5a9-a5f1-4b54-aa05-46717d0ab26d" + // Note: K8s doesn't have support for obtaining a cluster ID. If this is ever + // added, we will recommend collecting the `k8s.cluster.uid` through the + // official APIs. In the meantime, we are able to use the `uid` of the + // `kube-system` namespace as a proxy for cluster ID. Read on for the + // rationale. + // + // Every object created in a K8s cluster is assigned a distinct UID. The + // `kube-system` namespace is used by Kubernetes itself and will exist + // for the lifetime of the cluster. Using the `uid` of the `kube-system` + // namespace is a reasonable proxy for the K8s ClusterID as it will only + // change if the cluster is rebuilt. Furthermore, Kubernetes UIDs are + // UUIDs as standardized by + // [ISO/IEC 9834-8 and ITU-T X.667]. + // Which states: + // + // > If generated according to one of the mechanisms defined in Rec. + // > ITU-T X.667 | ISO/IEC 9834-8, a UUID is either guaranteed to be + // > different from all other UUIDs generated before 3603 A.D., or is + // > extremely likely to be different (depending on the mechanism chosen). + // + // Therefore, UIDs between clusters should be extremely unlikely to + // conflict. + // + // [ISO/IEC 9834-8 and ITU-T X.667]: https://www.itu.int/ITU-T/studygroups/com17/oid.html + K8SClusterUIDKey = attribute.Key("k8s.cluster.uid") + + // K8SContainerNameKey is the attribute Key conforming to the + // "k8s.container.name" semantic conventions. It represents the name of the + // Container from Pod specification, must be unique within a Pod. Container + // runtime usually uses different globally unique name (`container.name`). + // + // Type: string + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: "redis" + K8SContainerNameKey = attribute.Key("k8s.container.name") + + // K8SContainerRestartCountKey is the attribute Key conforming to the + // "k8s.container.restart_count" semantic conventions. It represents the number + // of times the container was restarted. This attribute can be used to identify + // a particular container (running or stopped) within a container spec. + // + // Type: int + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: + K8SContainerRestartCountKey = attribute.Key("k8s.container.restart_count") + + // K8SContainerStatusLastTerminatedReasonKey is the attribute Key conforming to + // the "k8s.container.status.last_terminated_reason" semantic conventions. It + // represents the last terminated reason of the Container. + // + // Type: string + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: "Evicted", "Error" + K8SContainerStatusLastTerminatedReasonKey = attribute.Key("k8s.container.status.last_terminated_reason") + + // K8SContainerStatusReasonKey is the attribute Key conforming to the + // "k8s.container.status.reason" semantic conventions. It represents the reason + // for the container state. Corresponds to the `reason` field of the: + // [K8s ContainerStateWaiting] or [K8s ContainerStateTerminated]. + // + // Type: Enum + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: "ContainerCreating", "CrashLoopBackOff", + // "CreateContainerConfigError", "ErrImagePull", "ImagePullBackOff", + // "OOMKilled", "Completed", "Error", "ContainerCannotRun" + // + // [K8s ContainerStateWaiting]: https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.30/#containerstatewaiting-v1-core + // [K8s ContainerStateTerminated]: https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.30/#containerstateterminated-v1-core + K8SContainerStatusReasonKey = attribute.Key("k8s.container.status.reason") + + // K8SContainerStatusStateKey is the attribute Key conforming to the + // "k8s.container.status.state" semantic conventions. It represents the state of + // the container. [K8s ContainerState]. + // + // Type: Enum + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: "terminated", "running", "waiting" + // + // [K8s ContainerState]: https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.30/#containerstate-v1-core + K8SContainerStatusStateKey = attribute.Key("k8s.container.status.state") + + // K8SCronJobNameKey is the attribute Key conforming to the "k8s.cronjob.name" + // semantic conventions. It represents the name of the CronJob. + // + // Type: string + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: "opentelemetry" + K8SCronJobNameKey = attribute.Key("k8s.cronjob.name") + + // K8SCronJobUIDKey is the attribute Key conforming to the "k8s.cronjob.uid" + // semantic conventions. It represents the UID of the CronJob. + // + // Type: string + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: "275ecb36-5aa8-4c2a-9c47-d8bb681b9aff" + K8SCronJobUIDKey = attribute.Key("k8s.cronjob.uid") + + // K8SDaemonSetNameKey is the attribute Key conforming to the + // "k8s.daemonset.name" semantic conventions. It represents the name of the + // DaemonSet. + // + // Type: string + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: "opentelemetry" + K8SDaemonSetNameKey = attribute.Key("k8s.daemonset.name") + + // K8SDaemonSetUIDKey is the attribute Key conforming to the "k8s.daemonset.uid" + // semantic conventions. It represents the UID of the DaemonSet. + // + // Type: string + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: "275ecb36-5aa8-4c2a-9c47-d8bb681b9aff" + K8SDaemonSetUIDKey = attribute.Key("k8s.daemonset.uid") + + // K8SDeploymentNameKey is the attribute Key conforming to the + // "k8s.deployment.name" semantic conventions. It represents the name of the + // Deployment. + // + // Type: string + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: "opentelemetry" + K8SDeploymentNameKey = attribute.Key("k8s.deployment.name") + + // K8SDeploymentUIDKey is the attribute Key conforming to the + // "k8s.deployment.uid" semantic conventions. It represents the UID of the + // Deployment. + // + // Type: string + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: "275ecb36-5aa8-4c2a-9c47-d8bb681b9aff" + K8SDeploymentUIDKey = attribute.Key("k8s.deployment.uid") + + // K8SHPAMetricTypeKey is the attribute Key conforming to the + // "k8s.hpa.metric.type" semantic conventions. It represents the type of metric + // source for the horizontal pod autoscaler. + // + // Type: string + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: "Resource", "ContainerResource" + // Note: This attribute reflects the `type` field of spec.metrics[] in the HPA. + K8SHPAMetricTypeKey = attribute.Key("k8s.hpa.metric.type") + + // K8SHPANameKey is the attribute Key conforming to the "k8s.hpa.name" semantic + // conventions. It represents the name of the horizontal pod autoscaler. + // + // Type: string + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: "opentelemetry" + K8SHPANameKey = attribute.Key("k8s.hpa.name") + + // K8SHPAScaletargetrefAPIVersionKey is the attribute Key conforming to the + // "k8s.hpa.scaletargetref.api_version" semantic conventions. It represents the + // API version of the target resource to scale for the HorizontalPodAutoscaler. + // + // Type: string + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: "apps/v1", "autoscaling/v2" + // Note: This maps to the `apiVersion` field in the `scaleTargetRef` of the HPA + // spec. + K8SHPAScaletargetrefAPIVersionKey = attribute.Key("k8s.hpa.scaletargetref.api_version") + + // K8SHPAScaletargetrefKindKey is the attribute Key conforming to the + // "k8s.hpa.scaletargetref.kind" semantic conventions. It represents the kind of + // the target resource to scale for the HorizontalPodAutoscaler. + // + // Type: string + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: "Deployment", "StatefulSet" + // Note: This maps to the `kind` field in the `scaleTargetRef` of the HPA spec. + K8SHPAScaletargetrefKindKey = attribute.Key("k8s.hpa.scaletargetref.kind") + + // K8SHPAScaletargetrefNameKey is the attribute Key conforming to the + // "k8s.hpa.scaletargetref.name" semantic conventions. It represents the name of + // the target resource to scale for the HorizontalPodAutoscaler. + // + // Type: string + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: "my-deployment", "my-statefulset" + // Note: This maps to the `name` field in the `scaleTargetRef` of the HPA spec. + K8SHPAScaletargetrefNameKey = attribute.Key("k8s.hpa.scaletargetref.name") + + // K8SHPAUIDKey is the attribute Key conforming to the "k8s.hpa.uid" semantic + // conventions. It represents the UID of the horizontal pod autoscaler. + // + // Type: string + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: "275ecb36-5aa8-4c2a-9c47-d8bb681b9aff" + K8SHPAUIDKey = attribute.Key("k8s.hpa.uid") + + // K8SHugepageSizeKey is the attribute Key conforming to the "k8s.hugepage.size" + // semantic conventions. It represents the size (identifier) of the K8s huge + // page. + // + // Type: string + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: "2Mi" + K8SHugepageSizeKey = attribute.Key("k8s.hugepage.size") + + // K8SJobNameKey is the attribute Key conforming to the "k8s.job.name" semantic + // conventions. It represents the name of the Job. + // + // Type: string + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: "opentelemetry" + K8SJobNameKey = attribute.Key("k8s.job.name") + + // K8SJobUIDKey is the attribute Key conforming to the "k8s.job.uid" semantic + // conventions. It represents the UID of the Job. + // + // Type: string + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: "275ecb36-5aa8-4c2a-9c47-d8bb681b9aff" + K8SJobUIDKey = attribute.Key("k8s.job.uid") + + // K8SNamespaceNameKey is the attribute Key conforming to the + // "k8s.namespace.name" semantic conventions. It represents the name of the + // namespace that the pod is running in. + // + // Type: string + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: "default" + K8SNamespaceNameKey = attribute.Key("k8s.namespace.name") + + // K8SNamespacePhaseKey is the attribute Key conforming to the + // "k8s.namespace.phase" semantic conventions. It represents the phase of the + // K8s namespace. + // + // Type: Enum + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: "active", "terminating" + // Note: This attribute aligns with the `phase` field of the + // [K8s NamespaceStatus] + // + // [K8s NamespaceStatus]: https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.30/#namespacestatus-v1-core + K8SNamespacePhaseKey = attribute.Key("k8s.namespace.phase") + + // K8SNodeConditionStatusKey is the attribute Key conforming to the + // "k8s.node.condition.status" semantic conventions. It represents the status of + // the condition, one of True, False, Unknown. + // + // Type: Enum + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: "true", "false", "unknown" + // Note: This attribute aligns with the `status` field of the + // [NodeCondition] + // + // [NodeCondition]: https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.30/#nodecondition-v1-core + K8SNodeConditionStatusKey = attribute.Key("k8s.node.condition.status") + + // K8SNodeConditionTypeKey is the attribute Key conforming to the + // "k8s.node.condition.type" semantic conventions. It represents the condition + // type of a K8s Node. + // + // Type: Enum + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: "Ready", "DiskPressure" + // Note: K8s Node conditions as described + // by [K8s documentation]. + // + // This attribute aligns with the `type` field of the + // [NodeCondition] + // + // The set of possible values is not limited to those listed here. Managed + // Kubernetes environments, + // or custom controllers MAY introduce additional node condition types. + // When this occurs, the exact value as reported by the Kubernetes API SHOULD be + // used. + // + // [K8s documentation]: https://v1-32.docs.kubernetes.io/docs/reference/node/node-status/#condition + // [NodeCondition]: https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.30/#nodecondition-v1-core + K8SNodeConditionTypeKey = attribute.Key("k8s.node.condition.type") + + // K8SNodeNameKey is the attribute Key conforming to the "k8s.node.name" + // semantic conventions. It represents the name of the Node. + // + // Type: string + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: "node-1" + K8SNodeNameKey = attribute.Key("k8s.node.name") + + // K8SNodeUIDKey is the attribute Key conforming to the "k8s.node.uid" semantic + // conventions. It represents the UID of the Node. + // + // Type: string + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: "1eb3a0c6-0477-4080-a9cb-0cb7db65c6a2" + K8SNodeUIDKey = attribute.Key("k8s.node.uid") + + // K8SPodNameKey is the attribute Key conforming to the "k8s.pod.name" semantic + // conventions. It represents the name of the Pod. + // + // Type: string + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: "opentelemetry-pod-autoconf" + K8SPodNameKey = attribute.Key("k8s.pod.name") + + // K8SPodUIDKey is the attribute Key conforming to the "k8s.pod.uid" semantic + // conventions. It represents the UID of the Pod. + // + // Type: string + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: "275ecb36-5aa8-4c2a-9c47-d8bb681b9aff" + K8SPodUIDKey = attribute.Key("k8s.pod.uid") + + // K8SReplicaSetNameKey is the attribute Key conforming to the + // "k8s.replicaset.name" semantic conventions. It represents the name of the + // ReplicaSet. + // + // Type: string + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: "opentelemetry" + K8SReplicaSetNameKey = attribute.Key("k8s.replicaset.name") + + // K8SReplicaSetUIDKey is the attribute Key conforming to the + // "k8s.replicaset.uid" semantic conventions. It represents the UID of the + // ReplicaSet. + // + // Type: string + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: "275ecb36-5aa8-4c2a-9c47-d8bb681b9aff" + K8SReplicaSetUIDKey = attribute.Key("k8s.replicaset.uid") + + // K8SReplicationControllerNameKey is the attribute Key conforming to the + // "k8s.replicationcontroller.name" semantic conventions. It represents the name + // of the replication controller. + // + // Type: string + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: "opentelemetry" + K8SReplicationControllerNameKey = attribute.Key("k8s.replicationcontroller.name") + + // K8SReplicationControllerUIDKey is the attribute Key conforming to the + // "k8s.replicationcontroller.uid" semantic conventions. It represents the UID + // of the replication controller. + // + // Type: string + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: "275ecb36-5aa8-4c2a-9c47-d8bb681b9aff" + K8SReplicationControllerUIDKey = attribute.Key("k8s.replicationcontroller.uid") + + // K8SResourceQuotaNameKey is the attribute Key conforming to the + // "k8s.resourcequota.name" semantic conventions. It represents the name of the + // resource quota. + // + // Type: string + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: "opentelemetry" + K8SResourceQuotaNameKey = attribute.Key("k8s.resourcequota.name") + + // K8SResourceQuotaResourceNameKey is the attribute Key conforming to the + // "k8s.resourcequota.resource_name" semantic conventions. It represents the + // name of the K8s resource a resource quota defines. + // + // Type: string + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: "count/replicationcontrollers" + // Note: The value for this attribute can be either the full + // `count/[.]` string (e.g., count/deployments.apps, + // count/pods), or, for certain core Kubernetes resources, just the resource + // name (e.g., pods, services, configmaps). Both forms are supported by + // Kubernetes for object count quotas. See + // [Kubernetes Resource Quotas documentation] for more details. + // + // [Kubernetes Resource Quotas documentation]: https://kubernetes.io/docs/concepts/policy/resource-quotas/#object-count-quota + K8SResourceQuotaResourceNameKey = attribute.Key("k8s.resourcequota.resource_name") + + // K8SResourceQuotaUIDKey is the attribute Key conforming to the + // "k8s.resourcequota.uid" semantic conventions. It represents the UID of the + // resource quota. + // + // Type: string + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: "275ecb36-5aa8-4c2a-9c47-d8bb681b9aff" + K8SResourceQuotaUIDKey = attribute.Key("k8s.resourcequota.uid") + + // K8SStatefulSetNameKey is the attribute Key conforming to the + // "k8s.statefulset.name" semantic conventions. It represents the name of the + // StatefulSet. + // + // Type: string + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: "opentelemetry" + K8SStatefulSetNameKey = attribute.Key("k8s.statefulset.name") + + // K8SStatefulSetUIDKey is the attribute Key conforming to the + // "k8s.statefulset.uid" semantic conventions. It represents the UID of the + // StatefulSet. + // + // Type: string + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: "275ecb36-5aa8-4c2a-9c47-d8bb681b9aff" + K8SStatefulSetUIDKey = attribute.Key("k8s.statefulset.uid") + + // K8SStorageclassNameKey is the attribute Key conforming to the + // "k8s.storageclass.name" semantic conventions. It represents the name of K8s + // [StorageClass] object. + // + // Type: string + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: "gold.storageclass.storage.k8s.io" + // + // [StorageClass]: https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.30/#storageclass-v1-storage-k8s-io + K8SStorageclassNameKey = attribute.Key("k8s.storageclass.name") + + // K8SVolumeNameKey is the attribute Key conforming to the "k8s.volume.name" + // semantic conventions. It represents the name of the K8s volume. + // + // Type: string + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: "volume0" + K8SVolumeNameKey = attribute.Key("k8s.volume.name") + + // K8SVolumeTypeKey is the attribute Key conforming to the "k8s.volume.type" + // semantic conventions. It represents the type of the K8s volume. + // + // Type: Enum + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: "emptyDir", "persistentVolumeClaim" + K8SVolumeTypeKey = attribute.Key("k8s.volume.type") +) + +// K8SClusterName returns an attribute KeyValue conforming to the +// "k8s.cluster.name" semantic conventions. It represents the name of the +// cluster. +func K8SClusterName(val string) attribute.KeyValue { + return K8SClusterNameKey.String(val) +} + +// K8SClusterUID returns an attribute KeyValue conforming to the +// "k8s.cluster.uid" semantic conventions. It represents a pseudo-ID for the +// cluster, set to the UID of the `kube-system` namespace. +func K8SClusterUID(val string) attribute.KeyValue { + return K8SClusterUIDKey.String(val) +} + +// K8SContainerName returns an attribute KeyValue conforming to the +// "k8s.container.name" semantic conventions. It represents the name of the +// Container from Pod specification, must be unique within a Pod. Container +// runtime usually uses different globally unique name (`container.name`). +func K8SContainerName(val string) attribute.KeyValue { + return K8SContainerNameKey.String(val) +} + +// K8SContainerRestartCount returns an attribute KeyValue conforming to the +// "k8s.container.restart_count" semantic conventions. It represents the number +// of times the container was restarted. This attribute can be used to identify a +// particular container (running or stopped) within a container spec. +func K8SContainerRestartCount(val int) attribute.KeyValue { + return K8SContainerRestartCountKey.Int(val) +} + +// K8SContainerStatusLastTerminatedReason returns an attribute KeyValue +// conforming to the "k8s.container.status.last_terminated_reason" semantic +// conventions. It represents the last terminated reason of the Container. +func K8SContainerStatusLastTerminatedReason(val string) attribute.KeyValue { + return K8SContainerStatusLastTerminatedReasonKey.String(val) +} + +// K8SCronJobAnnotation returns an attribute KeyValue conforming to the +// "k8s.cronjob.annotation" semantic conventions. It represents the cronjob +// annotation placed on the CronJob, the `` being the annotation name, the +// value being the annotation value. +func K8SCronJobAnnotation(key string, val string) attribute.KeyValue { + return attribute.String("k8s.cronjob.annotation."+key, val) +} + +// K8SCronJobLabel returns an attribute KeyValue conforming to the +// "k8s.cronjob.label" semantic conventions. It represents the label placed on +// the CronJob, the `` being the label name, the value being the label +// value. +func K8SCronJobLabel(key string, val string) attribute.KeyValue { + return attribute.String("k8s.cronjob.label."+key, val) +} + +// K8SCronJobName returns an attribute KeyValue conforming to the +// "k8s.cronjob.name" semantic conventions. It represents the name of the +// CronJob. +func K8SCronJobName(val string) attribute.KeyValue { + return K8SCronJobNameKey.String(val) +} + +// K8SCronJobUID returns an attribute KeyValue conforming to the +// "k8s.cronjob.uid" semantic conventions. It represents the UID of the CronJob. +func K8SCronJobUID(val string) attribute.KeyValue { + return K8SCronJobUIDKey.String(val) +} + +// K8SDaemonSetAnnotation returns an attribute KeyValue conforming to the +// "k8s.daemonset.annotation" semantic conventions. It represents the annotation +// placed on the DaemonSet, the `` being the annotation name, the value +// being the annotation value, even if the value is empty. +func K8SDaemonSetAnnotation(key string, val string) attribute.KeyValue { + return attribute.String("k8s.daemonset.annotation."+key, val) +} + +// K8SDaemonSetLabel returns an attribute KeyValue conforming to the +// "k8s.daemonset.label" semantic conventions. It represents the label placed on +// the DaemonSet, the `` being the label name, the value being the label +// value, even if the value is empty. +func K8SDaemonSetLabel(key string, val string) attribute.KeyValue { + return attribute.String("k8s.daemonset.label."+key, val) +} + +// K8SDaemonSetName returns an attribute KeyValue conforming to the +// "k8s.daemonset.name" semantic conventions. It represents the name of the +// DaemonSet. +func K8SDaemonSetName(val string) attribute.KeyValue { + return K8SDaemonSetNameKey.String(val) +} + +// K8SDaemonSetUID returns an attribute KeyValue conforming to the +// "k8s.daemonset.uid" semantic conventions. It represents the UID of the +// DaemonSet. +func K8SDaemonSetUID(val string) attribute.KeyValue { + return K8SDaemonSetUIDKey.String(val) +} + +// K8SDeploymentAnnotation returns an attribute KeyValue conforming to the +// "k8s.deployment.annotation" semantic conventions. It represents the annotation +// placed on the Deployment, the `` being the annotation name, the value +// being the annotation value, even if the value is empty. +func K8SDeploymentAnnotation(key string, val string) attribute.KeyValue { + return attribute.String("k8s.deployment.annotation."+key, val) +} + +// K8SDeploymentLabel returns an attribute KeyValue conforming to the +// "k8s.deployment.label" semantic conventions. It represents the label placed on +// the Deployment, the `` being the label name, the value being the label +// value, even if the value is empty. +func K8SDeploymentLabel(key string, val string) attribute.KeyValue { + return attribute.String("k8s.deployment.label."+key, val) +} + +// K8SDeploymentName returns an attribute KeyValue conforming to the +// "k8s.deployment.name" semantic conventions. It represents the name of the +// Deployment. +func K8SDeploymentName(val string) attribute.KeyValue { + return K8SDeploymentNameKey.String(val) +} + +// K8SDeploymentUID returns an attribute KeyValue conforming to the +// "k8s.deployment.uid" semantic conventions. It represents the UID of the +// Deployment. +func K8SDeploymentUID(val string) attribute.KeyValue { + return K8SDeploymentUIDKey.String(val) +} + +// K8SHPAMetricType returns an attribute KeyValue conforming to the +// "k8s.hpa.metric.type" semantic conventions. It represents the type of metric +// source for the horizontal pod autoscaler. +func K8SHPAMetricType(val string) attribute.KeyValue { + return K8SHPAMetricTypeKey.String(val) +} + +// K8SHPAName returns an attribute KeyValue conforming to the "k8s.hpa.name" +// semantic conventions. It represents the name of the horizontal pod autoscaler. +func K8SHPAName(val string) attribute.KeyValue { + return K8SHPANameKey.String(val) +} + +// K8SHPAScaletargetrefAPIVersion returns an attribute KeyValue conforming to the +// "k8s.hpa.scaletargetref.api_version" semantic conventions. It represents the +// API version of the target resource to scale for the HorizontalPodAutoscaler. +func K8SHPAScaletargetrefAPIVersion(val string) attribute.KeyValue { + return K8SHPAScaletargetrefAPIVersionKey.String(val) +} + +// K8SHPAScaletargetrefKind returns an attribute KeyValue conforming to the +// "k8s.hpa.scaletargetref.kind" semantic conventions. It represents the kind of +// the target resource to scale for the HorizontalPodAutoscaler. +func K8SHPAScaletargetrefKind(val string) attribute.KeyValue { + return K8SHPAScaletargetrefKindKey.String(val) +} + +// K8SHPAScaletargetrefName returns an attribute KeyValue conforming to the +// "k8s.hpa.scaletargetref.name" semantic conventions. It represents the name of +// the target resource to scale for the HorizontalPodAutoscaler. +func K8SHPAScaletargetrefName(val string) attribute.KeyValue { + return K8SHPAScaletargetrefNameKey.String(val) +} + +// K8SHPAUID returns an attribute KeyValue conforming to the "k8s.hpa.uid" +// semantic conventions. It represents the UID of the horizontal pod autoscaler. +func K8SHPAUID(val string) attribute.KeyValue { + return K8SHPAUIDKey.String(val) +} + +// K8SHugepageSize returns an attribute KeyValue conforming to the +// "k8s.hugepage.size" semantic conventions. It represents the size (identifier) +// of the K8s huge page. +func K8SHugepageSize(val string) attribute.KeyValue { + return K8SHugepageSizeKey.String(val) +} + +// K8SJobAnnotation returns an attribute KeyValue conforming to the +// "k8s.job.annotation" semantic conventions. It represents the annotation placed +// on the Job, the `` being the annotation name, the value being the +// annotation value, even if the value is empty. +func K8SJobAnnotation(key string, val string) attribute.KeyValue { + return attribute.String("k8s.job.annotation."+key, val) +} + +// K8SJobLabel returns an attribute KeyValue conforming to the "k8s.job.label" +// semantic conventions. It represents the label placed on the Job, the `` +// being the label name, the value being the label value, even if the value is +// empty. +func K8SJobLabel(key string, val string) attribute.KeyValue { + return attribute.String("k8s.job.label."+key, val) +} + +// K8SJobName returns an attribute KeyValue conforming to the "k8s.job.name" +// semantic conventions. It represents the name of the Job. +func K8SJobName(val string) attribute.KeyValue { + return K8SJobNameKey.String(val) +} + +// K8SJobUID returns an attribute KeyValue conforming to the "k8s.job.uid" +// semantic conventions. It represents the UID of the Job. +func K8SJobUID(val string) attribute.KeyValue { + return K8SJobUIDKey.String(val) +} + +// K8SNamespaceAnnotation returns an attribute KeyValue conforming to the +// "k8s.namespace.annotation" semantic conventions. It represents the annotation +// placed on the Namespace, the `` being the annotation name, the value +// being the annotation value, even if the value is empty. +func K8SNamespaceAnnotation(key string, val string) attribute.KeyValue { + return attribute.String("k8s.namespace.annotation."+key, val) +} + +// K8SNamespaceLabel returns an attribute KeyValue conforming to the +// "k8s.namespace.label" semantic conventions. It represents the label placed on +// the Namespace, the `` being the label name, the value being the label +// value, even if the value is empty. +func K8SNamespaceLabel(key string, val string) attribute.KeyValue { + return attribute.String("k8s.namespace.label."+key, val) +} + +// K8SNamespaceName returns an attribute KeyValue conforming to the +// "k8s.namespace.name" semantic conventions. It represents the name of the +// namespace that the pod is running in. +func K8SNamespaceName(val string) attribute.KeyValue { + return K8SNamespaceNameKey.String(val) +} + +// K8SNodeAnnotation returns an attribute KeyValue conforming to the +// "k8s.node.annotation" semantic conventions. It represents the annotation +// placed on the Node, the `` being the annotation name, the value being the +// annotation value, even if the value is empty. +func K8SNodeAnnotation(key string, val string) attribute.KeyValue { + return attribute.String("k8s.node.annotation."+key, val) +} + +// K8SNodeLabel returns an attribute KeyValue conforming to the "k8s.node.label" +// semantic conventions. It represents the label placed on the Node, the `` +// being the label name, the value being the label value, even if the value is +// empty. +func K8SNodeLabel(key string, val string) attribute.KeyValue { + return attribute.String("k8s.node.label."+key, val) +} + +// K8SNodeName returns an attribute KeyValue conforming to the "k8s.node.name" +// semantic conventions. It represents the name of the Node. +func K8SNodeName(val string) attribute.KeyValue { + return K8SNodeNameKey.String(val) +} + +// K8SNodeUID returns an attribute KeyValue conforming to the "k8s.node.uid" +// semantic conventions. It represents the UID of the Node. +func K8SNodeUID(val string) attribute.KeyValue { + return K8SNodeUIDKey.String(val) +} + +// K8SPodAnnotation returns an attribute KeyValue conforming to the +// "k8s.pod.annotation" semantic conventions. It represents the annotation placed +// on the Pod, the `` being the annotation name, the value being the +// annotation value. +func K8SPodAnnotation(key string, val string) attribute.KeyValue { + return attribute.String("k8s.pod.annotation."+key, val) +} + +// K8SPodLabel returns an attribute KeyValue conforming to the "k8s.pod.label" +// semantic conventions. It represents the label placed on the Pod, the `` +// being the label name, the value being the label value. +func K8SPodLabel(key string, val string) attribute.KeyValue { + return attribute.String("k8s.pod.label."+key, val) +} + +// K8SPodName returns an attribute KeyValue conforming to the "k8s.pod.name" +// semantic conventions. It represents the name of the Pod. +func K8SPodName(val string) attribute.KeyValue { + return K8SPodNameKey.String(val) +} + +// K8SPodUID returns an attribute KeyValue conforming to the "k8s.pod.uid" +// semantic conventions. It represents the UID of the Pod. +func K8SPodUID(val string) attribute.KeyValue { + return K8SPodUIDKey.String(val) +} + +// K8SReplicaSetAnnotation returns an attribute KeyValue conforming to the +// "k8s.replicaset.annotation" semantic conventions. It represents the annotation +// placed on the ReplicaSet, the `` being the annotation name, the value +// being the annotation value, even if the value is empty. +func K8SReplicaSetAnnotation(key string, val string) attribute.KeyValue { + return attribute.String("k8s.replicaset.annotation."+key, val) +} + +// K8SReplicaSetLabel returns an attribute KeyValue conforming to the +// "k8s.replicaset.label" semantic conventions. It represents the label placed on +// the ReplicaSet, the `` being the label name, the value being the label +// value, even if the value is empty. +func K8SReplicaSetLabel(key string, val string) attribute.KeyValue { + return attribute.String("k8s.replicaset.label."+key, val) +} + +// K8SReplicaSetName returns an attribute KeyValue conforming to the +// "k8s.replicaset.name" semantic conventions. It represents the name of the +// ReplicaSet. +func K8SReplicaSetName(val string) attribute.KeyValue { + return K8SReplicaSetNameKey.String(val) +} + +// K8SReplicaSetUID returns an attribute KeyValue conforming to the +// "k8s.replicaset.uid" semantic conventions. It represents the UID of the +// ReplicaSet. +func K8SReplicaSetUID(val string) attribute.KeyValue { + return K8SReplicaSetUIDKey.String(val) +} + +// K8SReplicationControllerName returns an attribute KeyValue conforming to the +// "k8s.replicationcontroller.name" semantic conventions. It represents the name +// of the replication controller. +func K8SReplicationControllerName(val string) attribute.KeyValue { + return K8SReplicationControllerNameKey.String(val) +} + +// K8SReplicationControllerUID returns an attribute KeyValue conforming to the +// "k8s.replicationcontroller.uid" semantic conventions. It represents the UID of +// the replication controller. +func K8SReplicationControllerUID(val string) attribute.KeyValue { + return K8SReplicationControllerUIDKey.String(val) +} + +// K8SResourceQuotaName returns an attribute KeyValue conforming to the +// "k8s.resourcequota.name" semantic conventions. It represents the name of the +// resource quota. +func K8SResourceQuotaName(val string) attribute.KeyValue { + return K8SResourceQuotaNameKey.String(val) +} + +// K8SResourceQuotaResourceName returns an attribute KeyValue conforming to the +// "k8s.resourcequota.resource_name" semantic conventions. It represents the name +// of the K8s resource a resource quota defines. +func K8SResourceQuotaResourceName(val string) attribute.KeyValue { + return K8SResourceQuotaResourceNameKey.String(val) +} + +// K8SResourceQuotaUID returns an attribute KeyValue conforming to the +// "k8s.resourcequota.uid" semantic conventions. It represents the UID of the +// resource quota. +func K8SResourceQuotaUID(val string) attribute.KeyValue { + return K8SResourceQuotaUIDKey.String(val) +} + +// K8SStatefulSetAnnotation returns an attribute KeyValue conforming to the +// "k8s.statefulset.annotation" semantic conventions. It represents the +// annotation placed on the StatefulSet, the `` being the annotation name, +// the value being the annotation value, even if the value is empty. +func K8SStatefulSetAnnotation(key string, val string) attribute.KeyValue { + return attribute.String("k8s.statefulset.annotation."+key, val) +} + +// K8SStatefulSetLabel returns an attribute KeyValue conforming to the +// "k8s.statefulset.label" semantic conventions. It represents the label placed +// on the StatefulSet, the `` being the label name, the value being the +// label value, even if the value is empty. +func K8SStatefulSetLabel(key string, val string) attribute.KeyValue { + return attribute.String("k8s.statefulset.label."+key, val) +} + +// K8SStatefulSetName returns an attribute KeyValue conforming to the +// "k8s.statefulset.name" semantic conventions. It represents the name of the +// StatefulSet. +func K8SStatefulSetName(val string) attribute.KeyValue { + return K8SStatefulSetNameKey.String(val) +} + +// K8SStatefulSetUID returns an attribute KeyValue conforming to the +// "k8s.statefulset.uid" semantic conventions. It represents the UID of the +// StatefulSet. +func K8SStatefulSetUID(val string) attribute.KeyValue { + return K8SStatefulSetUIDKey.String(val) +} + +// K8SStorageclassName returns an attribute KeyValue conforming to the +// "k8s.storageclass.name" semantic conventions. It represents the name of K8s +// [StorageClass] object. +// +// [StorageClass]: https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.30/#storageclass-v1-storage-k8s-io +func K8SStorageclassName(val string) attribute.KeyValue { + return K8SStorageclassNameKey.String(val) +} + +// K8SVolumeName returns an attribute KeyValue conforming to the +// "k8s.volume.name" semantic conventions. It represents the name of the K8s +// volume. +func K8SVolumeName(val string) attribute.KeyValue { + return K8SVolumeNameKey.String(val) +} + +// Enum values for k8s.container.status.reason +var ( + // The container is being created. + // Stability: development + K8SContainerStatusReasonContainerCreating = K8SContainerStatusReasonKey.String("ContainerCreating") + // The container is in a crash loop back off state. + // Stability: development + K8SContainerStatusReasonCrashLoopBackOff = K8SContainerStatusReasonKey.String("CrashLoopBackOff") + // There was an error creating the container configuration. + // Stability: development + K8SContainerStatusReasonCreateContainerConfigError = K8SContainerStatusReasonKey.String("CreateContainerConfigError") + // There was an error pulling the container image. + // Stability: development + K8SContainerStatusReasonErrImagePull = K8SContainerStatusReasonKey.String("ErrImagePull") + // The container image pull is in back off state. + // Stability: development + K8SContainerStatusReasonImagePullBackOff = K8SContainerStatusReasonKey.String("ImagePullBackOff") + // The container was killed due to out of memory. + // Stability: development + K8SContainerStatusReasonOomKilled = K8SContainerStatusReasonKey.String("OOMKilled") + // The container has completed execution. + // Stability: development + K8SContainerStatusReasonCompleted = K8SContainerStatusReasonKey.String("Completed") + // There was an error with the container. + // Stability: development + K8SContainerStatusReasonError = K8SContainerStatusReasonKey.String("Error") + // The container cannot run. + // Stability: development + K8SContainerStatusReasonContainerCannotRun = K8SContainerStatusReasonKey.String("ContainerCannotRun") +) + +// Enum values for k8s.container.status.state +var ( + // The container has terminated. + // Stability: development + K8SContainerStatusStateTerminated = K8SContainerStatusStateKey.String("terminated") + // The container is running. + // Stability: development + K8SContainerStatusStateRunning = K8SContainerStatusStateKey.String("running") + // The container is waiting. + // Stability: development + K8SContainerStatusStateWaiting = K8SContainerStatusStateKey.String("waiting") +) + +// Enum values for k8s.namespace.phase +var ( + // Active namespace phase as described by [K8s API] + // Stability: development + // + // [K8s API]: https://pkg.go.dev/k8s.io/api@v0.31.3/core/v1#NamespacePhase + K8SNamespacePhaseActive = K8SNamespacePhaseKey.String("active") + // Terminating namespace phase as described by [K8s API] + // Stability: development + // + // [K8s API]: https://pkg.go.dev/k8s.io/api@v0.31.3/core/v1#NamespacePhase + K8SNamespacePhaseTerminating = K8SNamespacePhaseKey.String("terminating") +) + +// Enum values for k8s.node.condition.status +var ( + // condition_true + // Stability: development + K8SNodeConditionStatusConditionTrue = K8SNodeConditionStatusKey.String("true") + // condition_false + // Stability: development + K8SNodeConditionStatusConditionFalse = K8SNodeConditionStatusKey.String("false") + // condition_unknown + // Stability: development + K8SNodeConditionStatusConditionUnknown = K8SNodeConditionStatusKey.String("unknown") +) + +// Enum values for k8s.node.condition.type +var ( + // The node is healthy and ready to accept pods + // Stability: development + K8SNodeConditionTypeReady = K8SNodeConditionTypeKey.String("Ready") + // Pressure exists on the disk size—that is, if the disk capacity is low + // Stability: development + K8SNodeConditionTypeDiskPressure = K8SNodeConditionTypeKey.String("DiskPressure") + // Pressure exists on the node memory—that is, if the node memory is low + // Stability: development + K8SNodeConditionTypeMemoryPressure = K8SNodeConditionTypeKey.String("MemoryPressure") + // Pressure exists on the processes—that is, if there are too many processes + // on the node + // Stability: development + K8SNodeConditionTypePIDPressure = K8SNodeConditionTypeKey.String("PIDPressure") + // The network for the node is not correctly configured + // Stability: development + K8SNodeConditionTypeNetworkUnavailable = K8SNodeConditionTypeKey.String("NetworkUnavailable") +) + +// Enum values for k8s.volume.type +var ( + // A [persistentVolumeClaim] volume + // Stability: development + // + // [persistentVolumeClaim]: https://v1-30.docs.kubernetes.io/docs/concepts/storage/volumes/#persistentvolumeclaim + K8SVolumeTypePersistentVolumeClaim = K8SVolumeTypeKey.String("persistentVolumeClaim") + // A [configMap] volume + // Stability: development + // + // [configMap]: https://v1-30.docs.kubernetes.io/docs/concepts/storage/volumes/#configmap + K8SVolumeTypeConfigMap = K8SVolumeTypeKey.String("configMap") + // A [downwardAPI] volume + // Stability: development + // + // [downwardAPI]: https://v1-30.docs.kubernetes.io/docs/concepts/storage/volumes/#downwardapi + K8SVolumeTypeDownwardAPI = K8SVolumeTypeKey.String("downwardAPI") + // An [emptyDir] volume + // Stability: development + // + // [emptyDir]: https://v1-30.docs.kubernetes.io/docs/concepts/storage/volumes/#emptydir + K8SVolumeTypeEmptyDir = K8SVolumeTypeKey.String("emptyDir") + // A [secret] volume + // Stability: development + // + // [secret]: https://v1-30.docs.kubernetes.io/docs/concepts/storage/volumes/#secret + K8SVolumeTypeSecret = K8SVolumeTypeKey.String("secret") + // A [local] volume + // Stability: development + // + // [local]: https://v1-30.docs.kubernetes.io/docs/concepts/storage/volumes/#local + K8SVolumeTypeLocal = K8SVolumeTypeKey.String("local") +) + +// Namespace: linux +const ( + // LinuxMemorySlabStateKey is the attribute Key conforming to the + // "linux.memory.slab.state" semantic conventions. It represents the Linux Slab + // memory state. + // + // Type: Enum + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: "reclaimable", "unreclaimable" + LinuxMemorySlabStateKey = attribute.Key("linux.memory.slab.state") +) + +// Enum values for linux.memory.slab.state +var ( + // reclaimable + // Stability: development + LinuxMemorySlabStateReclaimable = LinuxMemorySlabStateKey.String("reclaimable") + // unreclaimable + // Stability: development + LinuxMemorySlabStateUnreclaimable = LinuxMemorySlabStateKey.String("unreclaimable") +) + +// Namespace: log +const ( + // LogFileNameKey is the attribute Key conforming to the "log.file.name" + // semantic conventions. It represents the basename of the file. + // + // Type: string + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: "audit.log" + LogFileNameKey = attribute.Key("log.file.name") + + // LogFileNameResolvedKey is the attribute Key conforming to the + // "log.file.name_resolved" semantic conventions. It represents the basename of + // the file, with symlinks resolved. + // + // Type: string + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: "uuid.log" + LogFileNameResolvedKey = attribute.Key("log.file.name_resolved") + + // LogFilePathKey is the attribute Key conforming to the "log.file.path" + // semantic conventions. It represents the full path to the file. + // + // Type: string + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: "/var/log/mysql/audit.log" + LogFilePathKey = attribute.Key("log.file.path") + + // LogFilePathResolvedKey is the attribute Key conforming to the + // "log.file.path_resolved" semantic conventions. It represents the full path to + // the file, with symlinks resolved. + // + // Type: string + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: "/var/lib/docker/uuid.log" + LogFilePathResolvedKey = attribute.Key("log.file.path_resolved") + + // LogIostreamKey is the attribute Key conforming to the "log.iostream" semantic + // conventions. It represents the stream associated with the log. See below for + // a list of well-known values. + // + // Type: Enum + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: + LogIostreamKey = attribute.Key("log.iostream") + + // LogRecordOriginalKey is the attribute Key conforming to the + // "log.record.original" semantic conventions. It represents the complete + // original Log Record. + // + // Type: string + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: "77 <86>1 2015-08-06T21:58:59.694Z 192.168.2.133 inactive - - - + // Something happened", "[INFO] 8/3/24 12:34:56 Something happened" + // Note: This value MAY be added when processing a Log Record which was + // originally transmitted as a string or equivalent data type AND the Body field + // of the Log Record does not contain the same value. (e.g. a syslog or a log + // record read from a file.) + LogRecordOriginalKey = attribute.Key("log.record.original") + + // LogRecordUIDKey is the attribute Key conforming to the "log.record.uid" + // semantic conventions. It represents a unique identifier for the Log Record. + // + // Type: string + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: "01ARZ3NDEKTSV4RRFFQ69G5FAV" + // Note: If an id is provided, other log records with the same id will be + // considered duplicates and can be removed safely. This means, that two + // distinguishable log records MUST have different values. + // The id MAY be an + // [Universally Unique Lexicographically Sortable Identifier (ULID)], but other + // identifiers (e.g. UUID) may be used as needed. + // + // [Universally Unique Lexicographically Sortable Identifier (ULID)]: https://github.com/ulid/spec + LogRecordUIDKey = attribute.Key("log.record.uid") +) + +// LogFileName returns an attribute KeyValue conforming to the "log.file.name" +// semantic conventions. It represents the basename of the file. +func LogFileName(val string) attribute.KeyValue { + return LogFileNameKey.String(val) +} + +// LogFileNameResolved returns an attribute KeyValue conforming to the +// "log.file.name_resolved" semantic conventions. It represents the basename of +// the file, with symlinks resolved. +func LogFileNameResolved(val string) attribute.KeyValue { + return LogFileNameResolvedKey.String(val) +} + +// LogFilePath returns an attribute KeyValue conforming to the "log.file.path" +// semantic conventions. It represents the full path to the file. +func LogFilePath(val string) attribute.KeyValue { + return LogFilePathKey.String(val) +} + +// LogFilePathResolved returns an attribute KeyValue conforming to the +// "log.file.path_resolved" semantic conventions. It represents the full path to +// the file, with symlinks resolved. +func LogFilePathResolved(val string) attribute.KeyValue { + return LogFilePathResolvedKey.String(val) +} + +// LogRecordOriginal returns an attribute KeyValue conforming to the +// "log.record.original" semantic conventions. It represents the complete +// original Log Record. +func LogRecordOriginal(val string) attribute.KeyValue { + return LogRecordOriginalKey.String(val) +} + +// LogRecordUID returns an attribute KeyValue conforming to the "log.record.uid" +// semantic conventions. It represents a unique identifier for the Log Record. +func LogRecordUID(val string) attribute.KeyValue { + return LogRecordUIDKey.String(val) +} + +// Enum values for log.iostream +var ( + // Logs from stdout stream + // Stability: development + LogIostreamStdout = LogIostreamKey.String("stdout") + // Events from stderr stream + // Stability: development + LogIostreamStderr = LogIostreamKey.String("stderr") +) + +// Namespace: mainframe +const ( + // MainframeLparNameKey is the attribute Key conforming to the + // "mainframe.lpar.name" semantic conventions. It represents the name of the + // logical partition that hosts a systems with a mainframe operating system. + // + // Type: string + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: "LPAR01" + MainframeLparNameKey = attribute.Key("mainframe.lpar.name") +) + +// MainframeLparName returns an attribute KeyValue conforming to the +// "mainframe.lpar.name" semantic conventions. It represents the name of the +// logical partition that hosts a systems with a mainframe operating system. +func MainframeLparName(val string) attribute.KeyValue { + return MainframeLparNameKey.String(val) +} + +// Namespace: messaging +const ( + // MessagingBatchMessageCountKey is the attribute Key conforming to the + // "messaging.batch.message_count" semantic conventions. It represents the + // number of messages sent, received, or processed in the scope of the batching + // operation. + // + // Type: int + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: 0, 1, 2 + // Note: Instrumentations SHOULD NOT set `messaging.batch.message_count` on + // spans that operate with a single message. When a messaging client library + // supports both batch and single-message API for the same operation, + // instrumentations SHOULD use `messaging.batch.message_count` for batching APIs + // and SHOULD NOT use it for single-message APIs. + MessagingBatchMessageCountKey = attribute.Key("messaging.batch.message_count") + + // MessagingClientIDKey is the attribute Key conforming to the + // "messaging.client.id" semantic conventions. It represents a unique identifier + // for the client that consumes or produces a message. + // + // Type: string + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: "client-5", "myhost@8742@s8083jm" + MessagingClientIDKey = attribute.Key("messaging.client.id") + + // MessagingConsumerGroupNameKey is the attribute Key conforming to the + // "messaging.consumer.group.name" semantic conventions. It represents the name + // of the consumer group with which a consumer is associated. + // + // Type: string + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: "my-group", "indexer" + // Note: Semantic conventions for individual messaging systems SHOULD document + // whether `messaging.consumer.group.name` is applicable and what it means in + // the context of that system. + MessagingConsumerGroupNameKey = attribute.Key("messaging.consumer.group.name") + + // MessagingDestinationAnonymousKey is the attribute Key conforming to the + // "messaging.destination.anonymous" semantic conventions. It represents a + // boolean that is true if the message destination is anonymous (could be + // unnamed or have auto-generated name). + // + // Type: boolean + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: + MessagingDestinationAnonymousKey = attribute.Key("messaging.destination.anonymous") + + // MessagingDestinationNameKey is the attribute Key conforming to the + // "messaging.destination.name" semantic conventions. It represents the message + // destination name. + // + // Type: string + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: "MyQueue", "MyTopic" + // Note: Destination name SHOULD uniquely identify a specific queue, topic or + // other entity within the broker. If + // the broker doesn't have such notion, the destination name SHOULD uniquely + // identify the broker. + MessagingDestinationNameKey = attribute.Key("messaging.destination.name") + + // MessagingDestinationPartitionIDKey is the attribute Key conforming to the + // "messaging.destination.partition.id" semantic conventions. It represents the + // identifier of the partition messages are sent to or received from, unique + // within the `messaging.destination.name`. + // + // Type: string + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: 1 + MessagingDestinationPartitionIDKey = attribute.Key("messaging.destination.partition.id") + + // MessagingDestinationSubscriptionNameKey is the attribute Key conforming to + // the "messaging.destination.subscription.name" semantic conventions. It + // represents the name of the destination subscription from which a message is + // consumed. + // + // Type: string + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: "subscription-a" + // Note: Semantic conventions for individual messaging systems SHOULD document + // whether `messaging.destination.subscription.name` is applicable and what it + // means in the context of that system. + MessagingDestinationSubscriptionNameKey = attribute.Key("messaging.destination.subscription.name") + + // MessagingDestinationTemplateKey is the attribute Key conforming to the + // "messaging.destination.template" semantic conventions. It represents the low + // cardinality representation of the messaging destination name. + // + // Type: string + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: "/customers/{customerId}" + // Note: Destination names could be constructed from templates. An example would + // be a destination name involving a user name or product id. Although the + // destination name in this case is of high cardinality, the underlying template + // is of low cardinality and can be effectively used for grouping and + // aggregation. + MessagingDestinationTemplateKey = attribute.Key("messaging.destination.template") + + // MessagingDestinationTemporaryKey is the attribute Key conforming to the + // "messaging.destination.temporary" semantic conventions. It represents a + // boolean that is true if the message destination is temporary and might not + // exist anymore after messages are processed. + // + // Type: boolean + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: + MessagingDestinationTemporaryKey = attribute.Key("messaging.destination.temporary") + + // MessagingEventHubsMessageEnqueuedTimeKey is the attribute Key conforming to + // the "messaging.eventhubs.message.enqueued_time" semantic conventions. It + // represents the UTC epoch seconds at which the message has been accepted and + // stored in the entity. + // + // Type: int + // RequirementLevel: Recommended + // Stability: Development + MessagingEventHubsMessageEnqueuedTimeKey = attribute.Key("messaging.eventhubs.message.enqueued_time") + + // MessagingGCPPubSubMessageAckDeadlineKey is the attribute Key conforming to + // the "messaging.gcp_pubsub.message.ack_deadline" semantic conventions. It + // represents the ack deadline in seconds set for the modify ack deadline + // request. + // + // Type: int + // RequirementLevel: Recommended + // Stability: Development + MessagingGCPPubSubMessageAckDeadlineKey = attribute.Key("messaging.gcp_pubsub.message.ack_deadline") + + // MessagingGCPPubSubMessageAckIDKey is the attribute Key conforming to the + // "messaging.gcp_pubsub.message.ack_id" semantic conventions. It represents the + // ack id for a given message. + // + // Type: string + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: ack_id + MessagingGCPPubSubMessageAckIDKey = attribute.Key("messaging.gcp_pubsub.message.ack_id") + + // MessagingGCPPubSubMessageDeliveryAttemptKey is the attribute Key conforming + // to the "messaging.gcp_pubsub.message.delivery_attempt" semantic conventions. + // It represents the delivery attempt for a given message. + // + // Type: int + // RequirementLevel: Recommended + // Stability: Development + MessagingGCPPubSubMessageDeliveryAttemptKey = attribute.Key("messaging.gcp_pubsub.message.delivery_attempt") + + // MessagingGCPPubSubMessageOrderingKeyKey is the attribute Key conforming to + // the "messaging.gcp_pubsub.message.ordering_key" semantic conventions. It + // represents the ordering key for a given message. If the attribute is not + // present, the message does not have an ordering key. + // + // Type: string + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: ordering_key + MessagingGCPPubSubMessageOrderingKeyKey = attribute.Key("messaging.gcp_pubsub.message.ordering_key") + + // MessagingKafkaMessageKeyKey is the attribute Key conforming to the + // "messaging.kafka.message.key" semantic conventions. It represents the message + // keys in Kafka are used for grouping alike messages to ensure they're + // processed on the same partition. They differ from `messaging.message.id` in + // that they're not unique. If the key is `null`, the attribute MUST NOT be set. + // + // Type: string + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: myKey + // Note: If the key type is not string, it's string representation has to be + // supplied for the attribute. If the key has no unambiguous, canonical string + // form, don't include its value. + MessagingKafkaMessageKeyKey = attribute.Key("messaging.kafka.message.key") + + // MessagingKafkaMessageTombstoneKey is the attribute Key conforming to the + // "messaging.kafka.message.tombstone" semantic conventions. It represents a + // boolean that is true if the message is a tombstone. + // + // Type: boolean + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: + MessagingKafkaMessageTombstoneKey = attribute.Key("messaging.kafka.message.tombstone") + + // MessagingKafkaOffsetKey is the attribute Key conforming to the + // "messaging.kafka.offset" semantic conventions. It represents the offset of a + // record in the corresponding Kafka partition. + // + // Type: int + // RequirementLevel: Recommended + // Stability: Development + MessagingKafkaOffsetKey = attribute.Key("messaging.kafka.offset") + + // MessagingMessageBodySizeKey is the attribute Key conforming to the + // "messaging.message.body.size" semantic conventions. It represents the size of + // the message body in bytes. + // + // Type: int + // RequirementLevel: Recommended + // Stability: Development + // + // Note: This can refer to both the compressed or uncompressed body size. If + // both sizes are known, the uncompressed + // body size should be used. + MessagingMessageBodySizeKey = attribute.Key("messaging.message.body.size") + + // MessagingMessageConversationIDKey is the attribute Key conforming to the + // "messaging.message.conversation_id" semantic conventions. It represents the + // conversation ID identifying the conversation to which the message belongs, + // represented as a string. Sometimes called "Correlation ID". + // + // Type: string + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: MyConversationId + MessagingMessageConversationIDKey = attribute.Key("messaging.message.conversation_id") + + // MessagingMessageEnvelopeSizeKey is the attribute Key conforming to the + // "messaging.message.envelope.size" semantic conventions. It represents the + // size of the message body and metadata in bytes. + // + // Type: int + // RequirementLevel: Recommended + // Stability: Development + // + // Note: This can refer to both the compressed or uncompressed size. If both + // sizes are known, the uncompressed + // size should be used. + MessagingMessageEnvelopeSizeKey = attribute.Key("messaging.message.envelope.size") + + // MessagingMessageIDKey is the attribute Key conforming to the + // "messaging.message.id" semantic conventions. It represents a value used by + // the messaging system as an identifier for the message, represented as a + // string. + // + // Type: string + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: 452a7c7c7c7048c2f887f61572b18fc2 + MessagingMessageIDKey = attribute.Key("messaging.message.id") + + // MessagingOperationNameKey is the attribute Key conforming to the + // "messaging.operation.name" semantic conventions. It represents the + // system-specific name of the messaging operation. + // + // Type: string + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: "ack", "nack", "send" + MessagingOperationNameKey = attribute.Key("messaging.operation.name") + + // MessagingOperationTypeKey is the attribute Key conforming to the + // "messaging.operation.type" semantic conventions. It represents a string + // identifying the type of the messaging operation. + // + // Type: Enum + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: + // Note: If a custom value is used, it MUST be of low cardinality. + MessagingOperationTypeKey = attribute.Key("messaging.operation.type") + + // MessagingRabbitMQDestinationRoutingKeyKey is the attribute Key conforming to + // the "messaging.rabbitmq.destination.routing_key" semantic conventions. It + // represents the rabbitMQ message routing key. + // + // Type: string + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: myKey + MessagingRabbitMQDestinationRoutingKeyKey = attribute.Key("messaging.rabbitmq.destination.routing_key") + + // MessagingRabbitMQMessageDeliveryTagKey is the attribute Key conforming to the + // "messaging.rabbitmq.message.delivery_tag" semantic conventions. It represents + // the rabbitMQ message delivery tag. + // + // Type: int + // RequirementLevel: Recommended + // Stability: Development + MessagingRabbitMQMessageDeliveryTagKey = attribute.Key("messaging.rabbitmq.message.delivery_tag") + + // MessagingRocketMQConsumptionModelKey is the attribute Key conforming to the + // "messaging.rocketmq.consumption_model" semantic conventions. It represents + // the model of message consumption. This only applies to consumer spans. + // + // Type: Enum + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: + MessagingRocketMQConsumptionModelKey = attribute.Key("messaging.rocketmq.consumption_model") + + // MessagingRocketMQMessageDelayTimeLevelKey is the attribute Key conforming to + // the "messaging.rocketmq.message.delay_time_level" semantic conventions. It + // represents the delay time level for delay message, which determines the + // message delay time. + // + // Type: int + // RequirementLevel: Recommended + // Stability: Development + MessagingRocketMQMessageDelayTimeLevelKey = attribute.Key("messaging.rocketmq.message.delay_time_level") + + // MessagingRocketMQMessageDeliveryTimestampKey is the attribute Key conforming + // to the "messaging.rocketmq.message.delivery_timestamp" semantic conventions. + // It represents the timestamp in milliseconds that the delay message is + // expected to be delivered to consumer. + // + // Type: int + // RequirementLevel: Recommended + // Stability: Development + MessagingRocketMQMessageDeliveryTimestampKey = attribute.Key("messaging.rocketmq.message.delivery_timestamp") + + // MessagingRocketMQMessageGroupKey is the attribute Key conforming to the + // "messaging.rocketmq.message.group" semantic conventions. It represents the it + // is essential for FIFO message. Messages that belong to the same message group + // are always processed one by one within the same consumer group. + // + // Type: string + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: myMessageGroup + MessagingRocketMQMessageGroupKey = attribute.Key("messaging.rocketmq.message.group") + + // MessagingRocketMQMessageKeysKey is the attribute Key conforming to the + // "messaging.rocketmq.message.keys" semantic conventions. It represents the + // key(s) of message, another way to mark message besides message id. + // + // Type: string[] + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: "keyA", "keyB" + MessagingRocketMQMessageKeysKey = attribute.Key("messaging.rocketmq.message.keys") + + // MessagingRocketMQMessageTagKey is the attribute Key conforming to the + // "messaging.rocketmq.message.tag" semantic conventions. It represents the + // secondary classifier of message besides topic. + // + // Type: string + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: tagA + MessagingRocketMQMessageTagKey = attribute.Key("messaging.rocketmq.message.tag") + + // MessagingRocketMQMessageTypeKey is the attribute Key conforming to the + // "messaging.rocketmq.message.type" semantic conventions. It represents the + // type of message. + // + // Type: Enum + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: + MessagingRocketMQMessageTypeKey = attribute.Key("messaging.rocketmq.message.type") + + // MessagingRocketMQNamespaceKey is the attribute Key conforming to the + // "messaging.rocketmq.namespace" semantic conventions. It represents the + // namespace of RocketMQ resources, resources in different namespaces are + // individual. + // + // Type: string + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: myNamespace + MessagingRocketMQNamespaceKey = attribute.Key("messaging.rocketmq.namespace") + + // MessagingServiceBusDispositionStatusKey is the attribute Key conforming to + // the "messaging.servicebus.disposition_status" semantic conventions. It + // represents the describes the [settlement type]. + // + // Type: Enum + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: + // + // [settlement type]: https://learn.microsoft.com/azure/service-bus-messaging/message-transfers-locks-settlement#peeklock + MessagingServiceBusDispositionStatusKey = attribute.Key("messaging.servicebus.disposition_status") + + // MessagingServiceBusMessageDeliveryCountKey is the attribute Key conforming to + // the "messaging.servicebus.message.delivery_count" semantic conventions. It + // represents the number of deliveries that have been attempted for this + // message. + // + // Type: int + // RequirementLevel: Recommended + // Stability: Development + MessagingServiceBusMessageDeliveryCountKey = attribute.Key("messaging.servicebus.message.delivery_count") + + // MessagingServiceBusMessageEnqueuedTimeKey is the attribute Key conforming to + // the "messaging.servicebus.message.enqueued_time" semantic conventions. It + // represents the UTC epoch seconds at which the message has been accepted and + // stored in the entity. + // + // Type: int + // RequirementLevel: Recommended + // Stability: Development + MessagingServiceBusMessageEnqueuedTimeKey = attribute.Key("messaging.servicebus.message.enqueued_time") + + // MessagingSystemKey is the attribute Key conforming to the "messaging.system" + // semantic conventions. It represents the messaging system as identified by the + // client instrumentation. + // + // Type: Enum + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: + // Note: The actual messaging system may differ from the one known by the + // client. For example, when using Kafka client libraries to communicate with + // Azure Event Hubs, the `messaging.system` is set to `kafka` based on the + // instrumentation's best knowledge. + MessagingSystemKey = attribute.Key("messaging.system") +) + +// MessagingBatchMessageCount returns an attribute KeyValue conforming to the +// "messaging.batch.message_count" semantic conventions. It represents the number +// of messages sent, received, or processed in the scope of the batching +// operation. +func MessagingBatchMessageCount(val int) attribute.KeyValue { + return MessagingBatchMessageCountKey.Int(val) +} + +// MessagingClientID returns an attribute KeyValue conforming to the +// "messaging.client.id" semantic conventions. It represents a unique identifier +// for the client that consumes or produces a message. +func MessagingClientID(val string) attribute.KeyValue { + return MessagingClientIDKey.String(val) +} + +// MessagingConsumerGroupName returns an attribute KeyValue conforming to the +// "messaging.consumer.group.name" semantic conventions. It represents the name +// of the consumer group with which a consumer is associated. +func MessagingConsumerGroupName(val string) attribute.KeyValue { + return MessagingConsumerGroupNameKey.String(val) +} + +// MessagingDestinationAnonymous returns an attribute KeyValue conforming to the +// "messaging.destination.anonymous" semantic conventions. It represents a +// boolean that is true if the message destination is anonymous (could be unnamed +// or have auto-generated name). +func MessagingDestinationAnonymous(val bool) attribute.KeyValue { + return MessagingDestinationAnonymousKey.Bool(val) +} + +// MessagingDestinationName returns an attribute KeyValue conforming to the +// "messaging.destination.name" semantic conventions. It represents the message +// destination name. +func MessagingDestinationName(val string) attribute.KeyValue { + return MessagingDestinationNameKey.String(val) +} + +// MessagingDestinationPartitionID returns an attribute KeyValue conforming to +// the "messaging.destination.partition.id" semantic conventions. It represents +// the identifier of the partition messages are sent to or received from, unique +// within the `messaging.destination.name`. +func MessagingDestinationPartitionID(val string) attribute.KeyValue { + return MessagingDestinationPartitionIDKey.String(val) +} + +// MessagingDestinationSubscriptionName returns an attribute KeyValue conforming +// to the "messaging.destination.subscription.name" semantic conventions. It +// represents the name of the destination subscription from which a message is +// consumed. +func MessagingDestinationSubscriptionName(val string) attribute.KeyValue { + return MessagingDestinationSubscriptionNameKey.String(val) +} + +// MessagingDestinationTemplate returns an attribute KeyValue conforming to the +// "messaging.destination.template" semantic conventions. It represents the low +// cardinality representation of the messaging destination name. +func MessagingDestinationTemplate(val string) attribute.KeyValue { + return MessagingDestinationTemplateKey.String(val) +} + +// MessagingDestinationTemporary returns an attribute KeyValue conforming to the +// "messaging.destination.temporary" semantic conventions. It represents a +// boolean that is true if the message destination is temporary and might not +// exist anymore after messages are processed. +func MessagingDestinationTemporary(val bool) attribute.KeyValue { + return MessagingDestinationTemporaryKey.Bool(val) +} + +// MessagingEventHubsMessageEnqueuedTime returns an attribute KeyValue conforming +// to the "messaging.eventhubs.message.enqueued_time" semantic conventions. It +// represents the UTC epoch seconds at which the message has been accepted and +// stored in the entity. +func MessagingEventHubsMessageEnqueuedTime(val int) attribute.KeyValue { + return MessagingEventHubsMessageEnqueuedTimeKey.Int(val) +} + +// MessagingGCPPubSubMessageAckDeadline returns an attribute KeyValue conforming +// to the "messaging.gcp_pubsub.message.ack_deadline" semantic conventions. It +// represents the ack deadline in seconds set for the modify ack deadline +// request. +func MessagingGCPPubSubMessageAckDeadline(val int) attribute.KeyValue { + return MessagingGCPPubSubMessageAckDeadlineKey.Int(val) +} + +// MessagingGCPPubSubMessageAckID returns an attribute KeyValue conforming to the +// "messaging.gcp_pubsub.message.ack_id" semantic conventions. It represents the +// ack id for a given message. +func MessagingGCPPubSubMessageAckID(val string) attribute.KeyValue { + return MessagingGCPPubSubMessageAckIDKey.String(val) +} + +// MessagingGCPPubSubMessageDeliveryAttempt returns an attribute KeyValue +// conforming to the "messaging.gcp_pubsub.message.delivery_attempt" semantic +// conventions. It represents the delivery attempt for a given message. +func MessagingGCPPubSubMessageDeliveryAttempt(val int) attribute.KeyValue { + return MessagingGCPPubSubMessageDeliveryAttemptKey.Int(val) +} + +// MessagingGCPPubSubMessageOrderingKey returns an attribute KeyValue conforming +// to the "messaging.gcp_pubsub.message.ordering_key" semantic conventions. It +// represents the ordering key for a given message. If the attribute is not +// present, the message does not have an ordering key. +func MessagingGCPPubSubMessageOrderingKey(val string) attribute.KeyValue { + return MessagingGCPPubSubMessageOrderingKeyKey.String(val) +} + +// MessagingKafkaMessageKey returns an attribute KeyValue conforming to the +// "messaging.kafka.message.key" semantic conventions. It represents the message +// keys in Kafka are used for grouping alike messages to ensure they're processed +// on the same partition. They differ from `messaging.message.id` in that they're +// not unique. If the key is `null`, the attribute MUST NOT be set. +func MessagingKafkaMessageKey(val string) attribute.KeyValue { + return MessagingKafkaMessageKeyKey.String(val) +} + +// MessagingKafkaMessageTombstone returns an attribute KeyValue conforming to the +// "messaging.kafka.message.tombstone" semantic conventions. It represents a +// boolean that is true if the message is a tombstone. +func MessagingKafkaMessageTombstone(val bool) attribute.KeyValue { + return MessagingKafkaMessageTombstoneKey.Bool(val) +} + +// MessagingKafkaOffset returns an attribute KeyValue conforming to the +// "messaging.kafka.offset" semantic conventions. It represents the offset of a +// record in the corresponding Kafka partition. +func MessagingKafkaOffset(val int) attribute.KeyValue { + return MessagingKafkaOffsetKey.Int(val) +} + +// MessagingMessageBodySize returns an attribute KeyValue conforming to the +// "messaging.message.body.size" semantic conventions. It represents the size of +// the message body in bytes. +func MessagingMessageBodySize(val int) attribute.KeyValue { + return MessagingMessageBodySizeKey.Int(val) +} + +// MessagingMessageConversationID returns an attribute KeyValue conforming to the +// "messaging.message.conversation_id" semantic conventions. It represents the +// conversation ID identifying the conversation to which the message belongs, +// represented as a string. Sometimes called "Correlation ID". +func MessagingMessageConversationID(val string) attribute.KeyValue { + return MessagingMessageConversationIDKey.String(val) +} + +// MessagingMessageEnvelopeSize returns an attribute KeyValue conforming to the +// "messaging.message.envelope.size" semantic conventions. It represents the size +// of the message body and metadata in bytes. +func MessagingMessageEnvelopeSize(val int) attribute.KeyValue { + return MessagingMessageEnvelopeSizeKey.Int(val) +} + +// MessagingMessageID returns an attribute KeyValue conforming to the +// "messaging.message.id" semantic conventions. It represents a value used by the +// messaging system as an identifier for the message, represented as a string. +func MessagingMessageID(val string) attribute.KeyValue { + return MessagingMessageIDKey.String(val) +} + +// MessagingOperationName returns an attribute KeyValue conforming to the +// "messaging.operation.name" semantic conventions. It represents the +// system-specific name of the messaging operation. +func MessagingOperationName(val string) attribute.KeyValue { + return MessagingOperationNameKey.String(val) +} + +// MessagingRabbitMQDestinationRoutingKey returns an attribute KeyValue +// conforming to the "messaging.rabbitmq.destination.routing_key" semantic +// conventions. It represents the rabbitMQ message routing key. +func MessagingRabbitMQDestinationRoutingKey(val string) attribute.KeyValue { + return MessagingRabbitMQDestinationRoutingKeyKey.String(val) +} + +// MessagingRabbitMQMessageDeliveryTag returns an attribute KeyValue conforming +// to the "messaging.rabbitmq.message.delivery_tag" semantic conventions. It +// represents the rabbitMQ message delivery tag. +func MessagingRabbitMQMessageDeliveryTag(val int) attribute.KeyValue { + return MessagingRabbitMQMessageDeliveryTagKey.Int(val) +} + +// MessagingRocketMQMessageDelayTimeLevel returns an attribute KeyValue +// conforming to the "messaging.rocketmq.message.delay_time_level" semantic +// conventions. It represents the delay time level for delay message, which +// determines the message delay time. +func MessagingRocketMQMessageDelayTimeLevel(val int) attribute.KeyValue { + return MessagingRocketMQMessageDelayTimeLevelKey.Int(val) +} + +// MessagingRocketMQMessageDeliveryTimestamp returns an attribute KeyValue +// conforming to the "messaging.rocketmq.message.delivery_timestamp" semantic +// conventions. It represents the timestamp in milliseconds that the delay +// message is expected to be delivered to consumer. +func MessagingRocketMQMessageDeliveryTimestamp(val int) attribute.KeyValue { + return MessagingRocketMQMessageDeliveryTimestampKey.Int(val) +} + +// MessagingRocketMQMessageGroup returns an attribute KeyValue conforming to the +// "messaging.rocketmq.message.group" semantic conventions. It represents the it +// is essential for FIFO message. Messages that belong to the same message group +// are always processed one by one within the same consumer group. +func MessagingRocketMQMessageGroup(val string) attribute.KeyValue { + return MessagingRocketMQMessageGroupKey.String(val) +} + +// MessagingRocketMQMessageKeys returns an attribute KeyValue conforming to the +// "messaging.rocketmq.message.keys" semantic conventions. It represents the +// key(s) of message, another way to mark message besides message id. +func MessagingRocketMQMessageKeys(val ...string) attribute.KeyValue { + return MessagingRocketMQMessageKeysKey.StringSlice(val) +} + +// MessagingRocketMQMessageTag returns an attribute KeyValue conforming to the +// "messaging.rocketmq.message.tag" semantic conventions. It represents the +// secondary classifier of message besides topic. +func MessagingRocketMQMessageTag(val string) attribute.KeyValue { + return MessagingRocketMQMessageTagKey.String(val) +} + +// MessagingRocketMQNamespace returns an attribute KeyValue conforming to the +// "messaging.rocketmq.namespace" semantic conventions. It represents the +// namespace of RocketMQ resources, resources in different namespaces are +// individual. +func MessagingRocketMQNamespace(val string) attribute.KeyValue { + return MessagingRocketMQNamespaceKey.String(val) +} + +// MessagingServiceBusMessageDeliveryCount returns an attribute KeyValue +// conforming to the "messaging.servicebus.message.delivery_count" semantic +// conventions. It represents the number of deliveries that have been attempted +// for this message. +func MessagingServiceBusMessageDeliveryCount(val int) attribute.KeyValue { + return MessagingServiceBusMessageDeliveryCountKey.Int(val) +} + +// MessagingServiceBusMessageEnqueuedTime returns an attribute KeyValue +// conforming to the "messaging.servicebus.message.enqueued_time" semantic +// conventions. It represents the UTC epoch seconds at which the message has been +// accepted and stored in the entity. +func MessagingServiceBusMessageEnqueuedTime(val int) attribute.KeyValue { + return MessagingServiceBusMessageEnqueuedTimeKey.Int(val) +} + +// Enum values for messaging.operation.type +var ( + // A message is created. "Create" spans always refer to a single message and are + // used to provide a unique creation context for messages in batch sending + // scenarios. + // + // Stability: development + MessagingOperationTypeCreate = MessagingOperationTypeKey.String("create") + // One or more messages are provided for sending to an intermediary. If a single + // message is sent, the context of the "Send" span can be used as the creation + // context and no "Create" span needs to be created. + // + // Stability: development + MessagingOperationTypeSend = MessagingOperationTypeKey.String("send") + // One or more messages are requested by a consumer. This operation refers to + // pull-based scenarios, where consumers explicitly call methods of messaging + // SDKs to receive messages. + // + // Stability: development + MessagingOperationTypeReceive = MessagingOperationTypeKey.String("receive") + // One or more messages are processed by a consumer. + // + // Stability: development + MessagingOperationTypeProcess = MessagingOperationTypeKey.String("process") + // One or more messages are settled. + // + // Stability: development + MessagingOperationTypeSettle = MessagingOperationTypeKey.String("settle") +) + +// Enum values for messaging.rocketmq.consumption_model +var ( + // Clustering consumption model + // Stability: development + MessagingRocketMQConsumptionModelClustering = MessagingRocketMQConsumptionModelKey.String("clustering") + // Broadcasting consumption model + // Stability: development + MessagingRocketMQConsumptionModelBroadcasting = MessagingRocketMQConsumptionModelKey.String("broadcasting") +) + +// Enum values for messaging.rocketmq.message.type +var ( + // Normal message + // Stability: development + MessagingRocketMQMessageTypeNormal = MessagingRocketMQMessageTypeKey.String("normal") + // FIFO message + // Stability: development + MessagingRocketMQMessageTypeFifo = MessagingRocketMQMessageTypeKey.String("fifo") + // Delay message + // Stability: development + MessagingRocketMQMessageTypeDelay = MessagingRocketMQMessageTypeKey.String("delay") + // Transaction message + // Stability: development + MessagingRocketMQMessageTypeTransaction = MessagingRocketMQMessageTypeKey.String("transaction") +) + +// Enum values for messaging.servicebus.disposition_status +var ( + // Message is completed + // Stability: development + MessagingServiceBusDispositionStatusComplete = MessagingServiceBusDispositionStatusKey.String("complete") + // Message is abandoned + // Stability: development + MessagingServiceBusDispositionStatusAbandon = MessagingServiceBusDispositionStatusKey.String("abandon") + // Message is sent to dead letter queue + // Stability: development + MessagingServiceBusDispositionStatusDeadLetter = MessagingServiceBusDispositionStatusKey.String("dead_letter") + // Message is deferred + // Stability: development + MessagingServiceBusDispositionStatusDefer = MessagingServiceBusDispositionStatusKey.String("defer") +) + +// Enum values for messaging.system +var ( + // Apache ActiveMQ + // Stability: development + MessagingSystemActiveMQ = MessagingSystemKey.String("activemq") + // Amazon Simple Notification Service (SNS) + // Stability: development + MessagingSystemAWSSNS = MessagingSystemKey.String("aws.sns") + // Amazon Simple Queue Service (SQS) + // Stability: development + MessagingSystemAWSSQS = MessagingSystemKey.String("aws_sqs") + // Azure Event Grid + // Stability: development + MessagingSystemEventGrid = MessagingSystemKey.String("eventgrid") + // Azure Event Hubs + // Stability: development + MessagingSystemEventHubs = MessagingSystemKey.String("eventhubs") + // Azure Service Bus + // Stability: development + MessagingSystemServiceBus = MessagingSystemKey.String("servicebus") + // Google Cloud Pub/Sub + // Stability: development + MessagingSystemGCPPubSub = MessagingSystemKey.String("gcp_pubsub") + // Java Message Service + // Stability: development + MessagingSystemJMS = MessagingSystemKey.String("jms") + // Apache Kafka + // Stability: development + MessagingSystemKafka = MessagingSystemKey.String("kafka") + // RabbitMQ + // Stability: development + MessagingSystemRabbitMQ = MessagingSystemKey.String("rabbitmq") + // Apache RocketMQ + // Stability: development + MessagingSystemRocketMQ = MessagingSystemKey.String("rocketmq") + // Apache Pulsar + // Stability: development + MessagingSystemPulsar = MessagingSystemKey.String("pulsar") +) + +// Namespace: network +const ( + // NetworkCarrierICCKey is the attribute Key conforming to the + // "network.carrier.icc" semantic conventions. It represents the ISO 3166-1 + // alpha-2 2-character country code associated with the mobile carrier network. + // + // Type: string + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: DE + NetworkCarrierICCKey = attribute.Key("network.carrier.icc") + + // NetworkCarrierMCCKey is the attribute Key conforming to the + // "network.carrier.mcc" semantic conventions. It represents the mobile carrier + // country code. + // + // Type: string + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: 310 + NetworkCarrierMCCKey = attribute.Key("network.carrier.mcc") + + // NetworkCarrierMNCKey is the attribute Key conforming to the + // "network.carrier.mnc" semantic conventions. It represents the mobile carrier + // network code. + // + // Type: string + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: 001 + NetworkCarrierMNCKey = attribute.Key("network.carrier.mnc") + + // NetworkCarrierNameKey is the attribute Key conforming to the + // "network.carrier.name" semantic conventions. It represents the name of the + // mobile carrier. + // + // Type: string + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: sprint + NetworkCarrierNameKey = attribute.Key("network.carrier.name") + + // NetworkConnectionStateKey is the attribute Key conforming to the + // "network.connection.state" semantic conventions. It represents the state of + // network connection. + // + // Type: Enum + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: "close_wait" + // Note: Connection states are defined as part of the [rfc9293] + // + // [rfc9293]: https://datatracker.ietf.org/doc/html/rfc9293#section-3.3.2 + NetworkConnectionStateKey = attribute.Key("network.connection.state") + + // NetworkConnectionSubtypeKey is the attribute Key conforming to the + // "network.connection.subtype" semantic conventions. It represents the this + // describes more details regarding the connection.type. It may be the type of + // cell technology connection, but it could be used for describing details about + // a wifi connection. + // + // Type: Enum + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: LTE + NetworkConnectionSubtypeKey = attribute.Key("network.connection.subtype") + + // NetworkConnectionTypeKey is the attribute Key conforming to the + // "network.connection.type" semantic conventions. It represents the internet + // connection type. + // + // Type: Enum + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: wifi + NetworkConnectionTypeKey = attribute.Key("network.connection.type") + + // NetworkInterfaceNameKey is the attribute Key conforming to the + // "network.interface.name" semantic conventions. It represents the network + // interface name. + // + // Type: string + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: "lo", "eth0" + NetworkInterfaceNameKey = attribute.Key("network.interface.name") + + // NetworkIODirectionKey is the attribute Key conforming to the + // "network.io.direction" semantic conventions. It represents the network IO + // operation direction. + // + // Type: Enum + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: "transmit" + NetworkIODirectionKey = attribute.Key("network.io.direction") + + // NetworkLocalAddressKey is the attribute Key conforming to the + // "network.local.address" semantic conventions. It represents the local address + // of the network connection - IP address or Unix domain socket name. + // + // Type: string + // RequirementLevel: Recommended + // Stability: Stable + // + // Examples: "10.1.2.80", "/tmp/my.sock" + NetworkLocalAddressKey = attribute.Key("network.local.address") + + // NetworkLocalPortKey is the attribute Key conforming to the + // "network.local.port" semantic conventions. It represents the local port + // number of the network connection. + // + // Type: int + // RequirementLevel: Recommended + // Stability: Stable + // + // Examples: 65123 + NetworkLocalPortKey = attribute.Key("network.local.port") + + // NetworkPeerAddressKey is the attribute Key conforming to the + // "network.peer.address" semantic conventions. It represents the peer address + // of the network connection - IP address or Unix domain socket name. + // + // Type: string + // RequirementLevel: Recommended + // Stability: Stable + // + // Examples: "10.1.2.80", "/tmp/my.sock" + NetworkPeerAddressKey = attribute.Key("network.peer.address") + + // NetworkPeerPortKey is the attribute Key conforming to the "network.peer.port" + // semantic conventions. It represents the peer port number of the network + // connection. + // + // Type: int + // RequirementLevel: Recommended + // Stability: Stable + // + // Examples: 65123 + NetworkPeerPortKey = attribute.Key("network.peer.port") + + // NetworkProtocolNameKey is the attribute Key conforming to the + // "network.protocol.name" semantic conventions. It represents the + // [OSI application layer] or non-OSI equivalent. + // + // Type: string + // RequirementLevel: Recommended + // Stability: Stable + // + // Examples: "amqp", "http", "mqtt" + // Note: The value SHOULD be normalized to lowercase. + // + // [OSI application layer]: https://wikipedia.org/wiki/Application_layer + NetworkProtocolNameKey = attribute.Key("network.protocol.name") + + // NetworkProtocolVersionKey is the attribute Key conforming to the + // "network.protocol.version" semantic conventions. It represents the actual + // version of the protocol used for network communication. + // + // Type: string + // RequirementLevel: Recommended + // Stability: Stable + // + // Examples: "1.1", "2" + // Note: If protocol version is subject to negotiation (for example using [ALPN] + // ), this attribute SHOULD be set to the negotiated version. If the actual + // protocol version is not known, this attribute SHOULD NOT be set. + // + // [ALPN]: https://www.rfc-editor.org/rfc/rfc7301.html + NetworkProtocolVersionKey = attribute.Key("network.protocol.version") + + // NetworkTransportKey is the attribute Key conforming to the + // "network.transport" semantic conventions. It represents the + // [OSI transport layer] or [inter-process communication method]. + // + // Type: Enum + // RequirementLevel: Recommended + // Stability: Stable + // + // Examples: "tcp", "udp" + // Note: The value SHOULD be normalized to lowercase. + // + // Consider always setting the transport when setting a port number, since + // a port number is ambiguous without knowing the transport. For example + // different processes could be listening on TCP port 12345 and UDP port 12345. + // + // [OSI transport layer]: https://wikipedia.org/wiki/Transport_layer + // [inter-process communication method]: https://wikipedia.org/wiki/Inter-process_communication + NetworkTransportKey = attribute.Key("network.transport") + + // NetworkTypeKey is the attribute Key conforming to the "network.type" semantic + // conventions. It represents the [OSI network layer] or non-OSI equivalent. + // + // Type: Enum + // RequirementLevel: Recommended + // Stability: Stable + // + // Examples: "ipv4", "ipv6" + // Note: The value SHOULD be normalized to lowercase. + // + // [OSI network layer]: https://wikipedia.org/wiki/Network_layer + NetworkTypeKey = attribute.Key("network.type") +) + +// NetworkCarrierICC returns an attribute KeyValue conforming to the +// "network.carrier.icc" semantic conventions. It represents the ISO 3166-1 +// alpha-2 2-character country code associated with the mobile carrier network. +func NetworkCarrierICC(val string) attribute.KeyValue { + return NetworkCarrierICCKey.String(val) +} + +// NetworkCarrierMCC returns an attribute KeyValue conforming to the +// "network.carrier.mcc" semantic conventions. It represents the mobile carrier +// country code. +func NetworkCarrierMCC(val string) attribute.KeyValue { + return NetworkCarrierMCCKey.String(val) +} + +// NetworkCarrierMNC returns an attribute KeyValue conforming to the +// "network.carrier.mnc" semantic conventions. It represents the mobile carrier +// network code. +func NetworkCarrierMNC(val string) attribute.KeyValue { + return NetworkCarrierMNCKey.String(val) +} + +// NetworkCarrierName returns an attribute KeyValue conforming to the +// "network.carrier.name" semantic conventions. It represents the name of the +// mobile carrier. +func NetworkCarrierName(val string) attribute.KeyValue { + return NetworkCarrierNameKey.String(val) +} + +// NetworkInterfaceName returns an attribute KeyValue conforming to the +// "network.interface.name" semantic conventions. It represents the network +// interface name. +func NetworkInterfaceName(val string) attribute.KeyValue { + return NetworkInterfaceNameKey.String(val) +} + +// NetworkLocalAddress returns an attribute KeyValue conforming to the +// "network.local.address" semantic conventions. It represents the local address +// of the network connection - IP address or Unix domain socket name. +func NetworkLocalAddress(val string) attribute.KeyValue { + return NetworkLocalAddressKey.String(val) +} + +// NetworkLocalPort returns an attribute KeyValue conforming to the +// "network.local.port" semantic conventions. It represents the local port number +// of the network connection. +func NetworkLocalPort(val int) attribute.KeyValue { + return NetworkLocalPortKey.Int(val) +} + +// NetworkPeerAddress returns an attribute KeyValue conforming to the +// "network.peer.address" semantic conventions. It represents the peer address of +// the network connection - IP address or Unix domain socket name. +func NetworkPeerAddress(val string) attribute.KeyValue { + return NetworkPeerAddressKey.String(val) +} + +// NetworkPeerPort returns an attribute KeyValue conforming to the +// "network.peer.port" semantic conventions. It represents the peer port number +// of the network connection. +func NetworkPeerPort(val int) attribute.KeyValue { + return NetworkPeerPortKey.Int(val) +} + +// NetworkProtocolName returns an attribute KeyValue conforming to the +// "network.protocol.name" semantic conventions. It represents the +// [OSI application layer] or non-OSI equivalent. +// +// [OSI application layer]: https://wikipedia.org/wiki/Application_layer +func NetworkProtocolName(val string) attribute.KeyValue { + return NetworkProtocolNameKey.String(val) +} + +// NetworkProtocolVersion returns an attribute KeyValue conforming to the +// "network.protocol.version" semantic conventions. It represents the actual +// version of the protocol used for network communication. +func NetworkProtocolVersion(val string) attribute.KeyValue { + return NetworkProtocolVersionKey.String(val) +} + +// Enum values for network.connection.state +var ( + // closed + // Stability: development + NetworkConnectionStateClosed = NetworkConnectionStateKey.String("closed") + // close_wait + // Stability: development + NetworkConnectionStateCloseWait = NetworkConnectionStateKey.String("close_wait") + // closing + // Stability: development + NetworkConnectionStateClosing = NetworkConnectionStateKey.String("closing") + // established + // Stability: development + NetworkConnectionStateEstablished = NetworkConnectionStateKey.String("established") + // fin_wait_1 + // Stability: development + NetworkConnectionStateFinWait1 = NetworkConnectionStateKey.String("fin_wait_1") + // fin_wait_2 + // Stability: development + NetworkConnectionStateFinWait2 = NetworkConnectionStateKey.String("fin_wait_2") + // last_ack + // Stability: development + NetworkConnectionStateLastAck = NetworkConnectionStateKey.String("last_ack") + // listen + // Stability: development + NetworkConnectionStateListen = NetworkConnectionStateKey.String("listen") + // syn_received + // Stability: development + NetworkConnectionStateSynReceived = NetworkConnectionStateKey.String("syn_received") + // syn_sent + // Stability: development + NetworkConnectionStateSynSent = NetworkConnectionStateKey.String("syn_sent") + // time_wait + // Stability: development + NetworkConnectionStateTimeWait = NetworkConnectionStateKey.String("time_wait") +) + +// Enum values for network.connection.subtype +var ( + // GPRS + // Stability: development + NetworkConnectionSubtypeGprs = NetworkConnectionSubtypeKey.String("gprs") + // EDGE + // Stability: development + NetworkConnectionSubtypeEdge = NetworkConnectionSubtypeKey.String("edge") + // UMTS + // Stability: development + NetworkConnectionSubtypeUmts = NetworkConnectionSubtypeKey.String("umts") + // CDMA + // Stability: development + NetworkConnectionSubtypeCdma = NetworkConnectionSubtypeKey.String("cdma") + // EVDO Rel. 0 + // Stability: development + NetworkConnectionSubtypeEvdo0 = NetworkConnectionSubtypeKey.String("evdo_0") + // EVDO Rev. A + // Stability: development + NetworkConnectionSubtypeEvdoA = NetworkConnectionSubtypeKey.String("evdo_a") + // CDMA2000 1XRTT + // Stability: development + NetworkConnectionSubtypeCdma20001xrtt = NetworkConnectionSubtypeKey.String("cdma2000_1xrtt") + // HSDPA + // Stability: development + NetworkConnectionSubtypeHsdpa = NetworkConnectionSubtypeKey.String("hsdpa") + // HSUPA + // Stability: development + NetworkConnectionSubtypeHsupa = NetworkConnectionSubtypeKey.String("hsupa") + // HSPA + // Stability: development + NetworkConnectionSubtypeHspa = NetworkConnectionSubtypeKey.String("hspa") + // IDEN + // Stability: development + NetworkConnectionSubtypeIden = NetworkConnectionSubtypeKey.String("iden") + // EVDO Rev. B + // Stability: development + NetworkConnectionSubtypeEvdoB = NetworkConnectionSubtypeKey.String("evdo_b") + // LTE + // Stability: development + NetworkConnectionSubtypeLte = NetworkConnectionSubtypeKey.String("lte") + // EHRPD + // Stability: development + NetworkConnectionSubtypeEhrpd = NetworkConnectionSubtypeKey.String("ehrpd") + // HSPAP + // Stability: development + NetworkConnectionSubtypeHspap = NetworkConnectionSubtypeKey.String("hspap") + // GSM + // Stability: development + NetworkConnectionSubtypeGsm = NetworkConnectionSubtypeKey.String("gsm") + // TD-SCDMA + // Stability: development + NetworkConnectionSubtypeTdScdma = NetworkConnectionSubtypeKey.String("td_scdma") + // IWLAN + // Stability: development + NetworkConnectionSubtypeIwlan = NetworkConnectionSubtypeKey.String("iwlan") + // 5G NR (New Radio) + // Stability: development + NetworkConnectionSubtypeNr = NetworkConnectionSubtypeKey.String("nr") + // 5G NRNSA (New Radio Non-Standalone) + // Stability: development + NetworkConnectionSubtypeNrnsa = NetworkConnectionSubtypeKey.String("nrnsa") + // LTE CA + // Stability: development + NetworkConnectionSubtypeLteCa = NetworkConnectionSubtypeKey.String("lte_ca") +) + +// Enum values for network.connection.type +var ( + // wifi + // Stability: development + NetworkConnectionTypeWifi = NetworkConnectionTypeKey.String("wifi") + // wired + // Stability: development + NetworkConnectionTypeWired = NetworkConnectionTypeKey.String("wired") + // cell + // Stability: development + NetworkConnectionTypeCell = NetworkConnectionTypeKey.String("cell") + // unavailable + // Stability: development + NetworkConnectionTypeUnavailable = NetworkConnectionTypeKey.String("unavailable") + // unknown + // Stability: development + NetworkConnectionTypeUnknown = NetworkConnectionTypeKey.String("unknown") +) + +// Enum values for network.io.direction +var ( + // transmit + // Stability: development + NetworkIODirectionTransmit = NetworkIODirectionKey.String("transmit") + // receive + // Stability: development + NetworkIODirectionReceive = NetworkIODirectionKey.String("receive") +) + +// Enum values for network.transport +var ( + // TCP + // Stability: stable + NetworkTransportTCP = NetworkTransportKey.String("tcp") + // UDP + // Stability: stable + NetworkTransportUDP = NetworkTransportKey.String("udp") + // Named or anonymous pipe. + // Stability: stable + NetworkTransportPipe = NetworkTransportKey.String("pipe") + // Unix domain socket + // Stability: stable + NetworkTransportUnix = NetworkTransportKey.String("unix") + // QUIC + // Stability: stable + NetworkTransportQUIC = NetworkTransportKey.String("quic") +) + +// Enum values for network.type +var ( + // IPv4 + // Stability: stable + NetworkTypeIPv4 = NetworkTypeKey.String("ipv4") + // IPv6 + // Stability: stable + NetworkTypeIPv6 = NetworkTypeKey.String("ipv6") +) + +// Namespace: oci +const ( + // OCIManifestDigestKey is the attribute Key conforming to the + // "oci.manifest.digest" semantic conventions. It represents the digest of the + // OCI image manifest. For container images specifically is the digest by which + // the container image is known. + // + // Type: string + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: + // "sha256:e4ca62c0d62f3e886e684806dfe9d4e0cda60d54986898173c1083856cfda0f4" + // Note: Follows [OCI Image Manifest Specification], and specifically the + // [Digest property]. + // An example can be found in [Example Image Manifest]. + // + // [OCI Image Manifest Specification]: https://github.com/opencontainers/image-spec/blob/main/manifest.md + // [Digest property]: https://github.com/opencontainers/image-spec/blob/main/descriptor.md#digests + // [Example Image Manifest]: https://github.com/opencontainers/image-spec/blob/main/manifest.md#example-image-manifest + OCIManifestDigestKey = attribute.Key("oci.manifest.digest") +) + +// OCIManifestDigest returns an attribute KeyValue conforming to the +// "oci.manifest.digest" semantic conventions. It represents the digest of the +// OCI image manifest. For container images specifically is the digest by which +// the container image is known. +func OCIManifestDigest(val string) attribute.KeyValue { + return OCIManifestDigestKey.String(val) +} + +// Namespace: openai +const ( + // OpenAIRequestServiceTierKey is the attribute Key conforming to the + // "openai.request.service_tier" semantic conventions. It represents the service + // tier requested. May be a specific tier, default, or auto. + // + // Type: Enum + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: "auto", "default" + OpenAIRequestServiceTierKey = attribute.Key("openai.request.service_tier") + + // OpenAIResponseServiceTierKey is the attribute Key conforming to the + // "openai.response.service_tier" semantic conventions. It represents the + // service tier used for the response. + // + // Type: string + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: "scale", "default" + OpenAIResponseServiceTierKey = attribute.Key("openai.response.service_tier") + + // OpenAIResponseSystemFingerprintKey is the attribute Key conforming to the + // "openai.response.system_fingerprint" semantic conventions. It represents a + // fingerprint to track any eventual change in the Generative AI environment. + // + // Type: string + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: "fp_44709d6fcb" + OpenAIResponseSystemFingerprintKey = attribute.Key("openai.response.system_fingerprint") +) + +// OpenAIResponseServiceTier returns an attribute KeyValue conforming to the +// "openai.response.service_tier" semantic conventions. It represents the service +// tier used for the response. +func OpenAIResponseServiceTier(val string) attribute.KeyValue { + return OpenAIResponseServiceTierKey.String(val) +} + +// OpenAIResponseSystemFingerprint returns an attribute KeyValue conforming to +// the "openai.response.system_fingerprint" semantic conventions. It represents a +// fingerprint to track any eventual change in the Generative AI environment. +func OpenAIResponseSystemFingerprint(val string) attribute.KeyValue { + return OpenAIResponseSystemFingerprintKey.String(val) +} + +// Enum values for openai.request.service_tier +var ( + // The system will utilize scale tier credits until they are exhausted. + // Stability: development + OpenAIRequestServiceTierAuto = OpenAIRequestServiceTierKey.String("auto") + // The system will utilize the default scale tier. + // Stability: development + OpenAIRequestServiceTierDefault = OpenAIRequestServiceTierKey.String("default") +) + +// Namespace: opentracing +const ( + // OpenTracingRefTypeKey is the attribute Key conforming to the + // "opentracing.ref_type" semantic conventions. It represents the parent-child + // Reference type. + // + // Type: Enum + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: + // Note: The causal relationship between a child Span and a parent Span. + OpenTracingRefTypeKey = attribute.Key("opentracing.ref_type") +) + +// Enum values for opentracing.ref_type +var ( + // The parent Span depends on the child Span in some capacity + // Stability: development + OpenTracingRefTypeChildOf = OpenTracingRefTypeKey.String("child_of") + // The parent Span doesn't depend in any way on the result of the child Span + // Stability: development + OpenTracingRefTypeFollowsFrom = OpenTracingRefTypeKey.String("follows_from") +) + +// Namespace: os +const ( + // OSBuildIDKey is the attribute Key conforming to the "os.build_id" semantic + // conventions. It represents the unique identifier for a particular build or + // compilation of the operating system. + // + // Type: string + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: "TQ3C.230805.001.B2", "20E247", "22621" + OSBuildIDKey = attribute.Key("os.build_id") + + // OSDescriptionKey is the attribute Key conforming to the "os.description" + // semantic conventions. It represents the human readable (not intended to be + // parsed) OS version information, like e.g. reported by `ver` or + // `lsb_release -a` commands. + // + // Type: string + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: "Microsoft Windows [Version 10.0.18363.778]", "Ubuntu 18.04.1 LTS" + OSDescriptionKey = attribute.Key("os.description") + + // OSNameKey is the attribute Key conforming to the "os.name" semantic + // conventions. It represents the human readable operating system name. + // + // Type: string + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: "iOS", "Android", "Ubuntu" + OSNameKey = attribute.Key("os.name") + + // OSTypeKey is the attribute Key conforming to the "os.type" semantic + // conventions. It represents the operating system type. + // + // Type: Enum + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: + OSTypeKey = attribute.Key("os.type") + + // OSVersionKey is the attribute Key conforming to the "os.version" semantic + // conventions. It represents the version string of the operating system as + // defined in [Version Attributes]. + // + // Type: string + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: "14.2.1", "18.04.1" + // + // [Version Attributes]: /docs/resource/README.md#version-attributes + OSVersionKey = attribute.Key("os.version") +) + +// OSBuildID returns an attribute KeyValue conforming to the "os.build_id" +// semantic conventions. It represents the unique identifier for a particular +// build or compilation of the operating system. +func OSBuildID(val string) attribute.KeyValue { + return OSBuildIDKey.String(val) +} + +// OSDescription returns an attribute KeyValue conforming to the "os.description" +// semantic conventions. It represents the human readable (not intended to be +// parsed) OS version information, like e.g. reported by `ver` or +// `lsb_release -a` commands. +func OSDescription(val string) attribute.KeyValue { + return OSDescriptionKey.String(val) +} + +// OSName returns an attribute KeyValue conforming to the "os.name" semantic +// conventions. It represents the human readable operating system name. +func OSName(val string) attribute.KeyValue { + return OSNameKey.String(val) +} + +// OSVersion returns an attribute KeyValue conforming to the "os.version" +// semantic conventions. It represents the version string of the operating system +// as defined in [Version Attributes]. +// +// [Version Attributes]: /docs/resource/README.md#version-attributes +func OSVersion(val string) attribute.KeyValue { + return OSVersionKey.String(val) +} + +// Enum values for os.type +var ( + // Microsoft Windows + // Stability: development + OSTypeWindows = OSTypeKey.String("windows") + // Linux + // Stability: development + OSTypeLinux = OSTypeKey.String("linux") + // Apple Darwin + // Stability: development + OSTypeDarwin = OSTypeKey.String("darwin") + // FreeBSD + // Stability: development + OSTypeFreeBSD = OSTypeKey.String("freebsd") + // NetBSD + // Stability: development + OSTypeNetBSD = OSTypeKey.String("netbsd") + // OpenBSD + // Stability: development + OSTypeOpenBSD = OSTypeKey.String("openbsd") + // DragonFly BSD + // Stability: development + OSTypeDragonflyBSD = OSTypeKey.String("dragonflybsd") + // HP-UX (Hewlett Packard Unix) + // Stability: development + OSTypeHPUX = OSTypeKey.String("hpux") + // AIX (Advanced Interactive eXecutive) + // Stability: development + OSTypeAIX = OSTypeKey.String("aix") + // SunOS, Oracle Solaris + // Stability: development + OSTypeSolaris = OSTypeKey.String("solaris") + // IBM z/OS + // Stability: development + OSTypeZOS = OSTypeKey.String("zos") +) + +// Namespace: otel +const ( + // OTelComponentNameKey is the attribute Key conforming to the + // "otel.component.name" semantic conventions. It represents a name uniquely + // identifying the instance of the OpenTelemetry component within its containing + // SDK instance. + // + // Type: string + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: "otlp_grpc_span_exporter/0", "custom-name" + // Note: Implementations SHOULD ensure a low cardinality for this attribute, + // even across application or SDK restarts. + // E.g. implementations MUST NOT use UUIDs as values for this attribute. + // + // Implementations MAY achieve these goals by following a + // `/` pattern, e.g. + // `batching_span_processor/0`. + // Hereby `otel.component.type` refers to the corresponding attribute value of + // the component. + // + // The value of `instance-counter` MAY be automatically assigned by the + // component and uniqueness within the enclosing SDK instance MUST be + // guaranteed. + // For example, `` MAY be implemented by using a monotonically + // increasing counter (starting with `0`), which is incremented every time an + // instance of the given component type is started. + // + // With this implementation, for example the first Batching Span Processor would + // have `batching_span_processor/0` + // as `otel.component.name`, the second one `batching_span_processor/1` and so + // on. + // These values will therefore be reused in the case of an application restart. + OTelComponentNameKey = attribute.Key("otel.component.name") + + // OTelComponentTypeKey is the attribute Key conforming to the + // "otel.component.type" semantic conventions. It represents a name identifying + // the type of the OpenTelemetry component. + // + // Type: Enum + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: "batching_span_processor", "com.example.MySpanExporter" + // Note: If none of the standardized values apply, implementations SHOULD use + // the language-defined name of the type. + // E.g. for Java the fully qualified classname SHOULD be used in this case. + OTelComponentTypeKey = attribute.Key("otel.component.type") + + // OTelScopeNameKey is the attribute Key conforming to the "otel.scope.name" + // semantic conventions. It represents the name of the instrumentation scope - ( + // `InstrumentationScope.Name` in OTLP). + // + // Type: string + // RequirementLevel: Recommended + // Stability: Stable + // + // Examples: "io.opentelemetry.contrib.mongodb" + OTelScopeNameKey = attribute.Key("otel.scope.name") + + // OTelScopeSchemaURLKey is the attribute Key conforming to the + // "otel.scope.schema_url" semantic conventions. It represents the schema URL of + // the instrumentation scope. + // + // Type: string + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: "https://opentelemetry.io/schemas/1.31.0" + OTelScopeSchemaURLKey = attribute.Key("otel.scope.schema_url") + + // OTelScopeVersionKey is the attribute Key conforming to the + // "otel.scope.version" semantic conventions. It represents the version of the + // instrumentation scope - (`InstrumentationScope.Version` in OTLP). + // + // Type: string + // RequirementLevel: Recommended + // Stability: Stable + // + // Examples: "1.0.0" + OTelScopeVersionKey = attribute.Key("otel.scope.version") + + // OTelSpanParentOriginKey is the attribute Key conforming to the + // "otel.span.parent.origin" semantic conventions. It represents the determines + // whether the span has a parent span, and if so, + // [whether it is a remote parent]. + // + // Type: Enum + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: + // + // [whether it is a remote parent]: https://opentelemetry.io/docs/specs/otel/trace/api/#isremote + OTelSpanParentOriginKey = attribute.Key("otel.span.parent.origin") + + // OTelSpanSamplingResultKey is the attribute Key conforming to the + // "otel.span.sampling_result" semantic conventions. It represents the result + // value of the sampler for this span. + // + // Type: Enum + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: + OTelSpanSamplingResultKey = attribute.Key("otel.span.sampling_result") + + // OTelStatusCodeKey is the attribute Key conforming to the "otel.status_code" + // semantic conventions. It represents the name of the code, either "OK" or + // "ERROR". MUST NOT be set if the status code is UNSET. + // + // Type: Enum + // RequirementLevel: Recommended + // Stability: Stable + // + // Examples: + OTelStatusCodeKey = attribute.Key("otel.status_code") + + // OTelStatusDescriptionKey is the attribute Key conforming to the + // "otel.status_description" semantic conventions. It represents the description + // of the Status if it has a value, otherwise not set. + // + // Type: string + // RequirementLevel: Recommended + // Stability: Stable + // + // Examples: "resource not found" + OTelStatusDescriptionKey = attribute.Key("otel.status_description") +) + +// OTelComponentName returns an attribute KeyValue conforming to the +// "otel.component.name" semantic conventions. It represents a name uniquely +// identifying the instance of the OpenTelemetry component within its containing +// SDK instance. +func OTelComponentName(val string) attribute.KeyValue { + return OTelComponentNameKey.String(val) +} + +// OTelScopeName returns an attribute KeyValue conforming to the +// "otel.scope.name" semantic conventions. It represents the name of the +// instrumentation scope - (`InstrumentationScope.Name` in OTLP). +func OTelScopeName(val string) attribute.KeyValue { + return OTelScopeNameKey.String(val) +} + +// OTelScopeSchemaURL returns an attribute KeyValue conforming to the +// "otel.scope.schema_url" semantic conventions. It represents the schema URL of +// the instrumentation scope. +func OTelScopeSchemaURL(val string) attribute.KeyValue { + return OTelScopeSchemaURLKey.String(val) +} + +// OTelScopeVersion returns an attribute KeyValue conforming to the +// "otel.scope.version" semantic conventions. It represents the version of the +// instrumentation scope - (`InstrumentationScope.Version` in OTLP). +func OTelScopeVersion(val string) attribute.KeyValue { + return OTelScopeVersionKey.String(val) +} + +// OTelStatusDescription returns an attribute KeyValue conforming to the +// "otel.status_description" semantic conventions. It represents the description +// of the Status if it has a value, otherwise not set. +func OTelStatusDescription(val string) attribute.KeyValue { + return OTelStatusDescriptionKey.String(val) +} + +// Enum values for otel.component.type +var ( + // The builtin SDK batching span processor + // + // Stability: development + OTelComponentTypeBatchingSpanProcessor = OTelComponentTypeKey.String("batching_span_processor") + // The builtin SDK simple span processor + // + // Stability: development + OTelComponentTypeSimpleSpanProcessor = OTelComponentTypeKey.String("simple_span_processor") + // The builtin SDK batching log record processor + // + // Stability: development + OTelComponentTypeBatchingLogProcessor = OTelComponentTypeKey.String("batching_log_processor") + // The builtin SDK simple log record processor + // + // Stability: development + OTelComponentTypeSimpleLogProcessor = OTelComponentTypeKey.String("simple_log_processor") + // OTLP span exporter over gRPC with protobuf serialization + // + // Stability: development + OTelComponentTypeOtlpGRPCSpanExporter = OTelComponentTypeKey.String("otlp_grpc_span_exporter") + // OTLP span exporter over HTTP with protobuf serialization + // + // Stability: development + OTelComponentTypeOtlpHTTPSpanExporter = OTelComponentTypeKey.String("otlp_http_span_exporter") + // OTLP span exporter over HTTP with JSON serialization + // + // Stability: development + OTelComponentTypeOtlpHTTPJSONSpanExporter = OTelComponentTypeKey.String("otlp_http_json_span_exporter") + // Zipkin span exporter over HTTP + // + // Stability: development + OTelComponentTypeZipkinHTTPSpanExporter = OTelComponentTypeKey.String("zipkin_http_span_exporter") + // OTLP log record exporter over gRPC with protobuf serialization + // + // Stability: development + OTelComponentTypeOtlpGRPCLogExporter = OTelComponentTypeKey.String("otlp_grpc_log_exporter") + // OTLP log record exporter over HTTP with protobuf serialization + // + // Stability: development + OTelComponentTypeOtlpHTTPLogExporter = OTelComponentTypeKey.String("otlp_http_log_exporter") + // OTLP log record exporter over HTTP with JSON serialization + // + // Stability: development + OTelComponentTypeOtlpHTTPJSONLogExporter = OTelComponentTypeKey.String("otlp_http_json_log_exporter") + // The builtin SDK periodically exporting metric reader + // + // Stability: development + OTelComponentTypePeriodicMetricReader = OTelComponentTypeKey.String("periodic_metric_reader") + // OTLP metric exporter over gRPC with protobuf serialization + // + // Stability: development + OTelComponentTypeOtlpGRPCMetricExporter = OTelComponentTypeKey.String("otlp_grpc_metric_exporter") + // OTLP metric exporter over HTTP with protobuf serialization + // + // Stability: development + OTelComponentTypeOtlpHTTPMetricExporter = OTelComponentTypeKey.String("otlp_http_metric_exporter") + // OTLP metric exporter over HTTP with JSON serialization + // + // Stability: development + OTelComponentTypeOtlpHTTPJSONMetricExporter = OTelComponentTypeKey.String("otlp_http_json_metric_exporter") + // Prometheus metric exporter over HTTP with the default text-based format + // + // Stability: development + OTelComponentTypePrometheusHTTPTextMetricExporter = OTelComponentTypeKey.String("prometheus_http_text_metric_exporter") +) + +// Enum values for otel.span.parent.origin +var ( + // The span does not have a parent, it is a root span + // Stability: development + OTelSpanParentOriginNone = OTelSpanParentOriginKey.String("none") + // The span has a parent and the parent's span context [isRemote()] is false + // Stability: development + // + // [isRemote()]: https://opentelemetry.io/docs/specs/otel/trace/api/#isremote + OTelSpanParentOriginLocal = OTelSpanParentOriginKey.String("local") + // The span has a parent and the parent's span context [isRemote()] is true + // Stability: development + // + // [isRemote()]: https://opentelemetry.io/docs/specs/otel/trace/api/#isremote + OTelSpanParentOriginRemote = OTelSpanParentOriginKey.String("remote") +) + +// Enum values for otel.span.sampling_result +var ( + // The span is not sampled and not recording + // Stability: development + OTelSpanSamplingResultDrop = OTelSpanSamplingResultKey.String("DROP") + // The span is not sampled, but recording + // Stability: development + OTelSpanSamplingResultRecordOnly = OTelSpanSamplingResultKey.String("RECORD_ONLY") + // The span is sampled and recording + // Stability: development + OTelSpanSamplingResultRecordAndSample = OTelSpanSamplingResultKey.String("RECORD_AND_SAMPLE") +) + +// Enum values for otel.status_code +var ( + // The operation has been validated by an Application developer or Operator to + // have completed successfully. + // Stability: stable + OTelStatusCodeOk = OTelStatusCodeKey.String("OK") + // The operation contains an error. + // Stability: stable + OTelStatusCodeError = OTelStatusCodeKey.String("ERROR") +) + +// Namespace: peer +const ( + // PeerServiceKey is the attribute Key conforming to the "peer.service" semantic + // conventions. It represents the [`service.name`] of the remote service. SHOULD + // be equal to the actual `service.name` resource attribute of the remote + // service if any. + // + // Type: string + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: AuthTokenCache + // + // [`service.name`]: /docs/resource/README.md#service + PeerServiceKey = attribute.Key("peer.service") +) + +// PeerService returns an attribute KeyValue conforming to the "peer.service" +// semantic conventions. It represents the [`service.name`] of the remote +// service. SHOULD be equal to the actual `service.name` resource attribute of +// the remote service if any. +// +// [`service.name`]: /docs/resource/README.md#service +func PeerService(val string) attribute.KeyValue { + return PeerServiceKey.String(val) +} + +// Namespace: process +const ( + // ProcessArgsCountKey is the attribute Key conforming to the + // "process.args_count" semantic conventions. It represents the length of the + // process.command_args array. + // + // Type: int + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: 4 + // Note: This field can be useful for querying or performing bucket analysis on + // how many arguments were provided to start a process. More arguments may be an + // indication of suspicious activity. + ProcessArgsCountKey = attribute.Key("process.args_count") + + // ProcessCommandKey is the attribute Key conforming to the "process.command" + // semantic conventions. It represents the command used to launch the process + // (i.e. the command name). On Linux based systems, can be set to the zeroth + // string in `proc/[pid]/cmdline`. On Windows, can be set to the first parameter + // extracted from `GetCommandLineW`. + // + // Type: string + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: "cmd/otelcol" + ProcessCommandKey = attribute.Key("process.command") + + // ProcessCommandArgsKey is the attribute Key conforming to the + // "process.command_args" semantic conventions. It represents the all the + // command arguments (including the command/executable itself) as received by + // the process. On Linux-based systems (and some other Unixoid systems + // supporting procfs), can be set according to the list of null-delimited + // strings extracted from `proc/[pid]/cmdline`. For libc-based executables, this + // would be the full argv vector passed to `main`. SHOULD NOT be collected by + // default unless there is sanitization that excludes sensitive data. + // + // Type: string[] + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: "cmd/otecol", "--config=config.yaml" + ProcessCommandArgsKey = attribute.Key("process.command_args") + + // ProcessCommandLineKey is the attribute Key conforming to the + // "process.command_line" semantic conventions. It represents the full command + // used to launch the process as a single string representing the full command. + // On Windows, can be set to the result of `GetCommandLineW`. Do not set this if + // you have to assemble it just for monitoring; use `process.command_args` + // instead. SHOULD NOT be collected by default unless there is sanitization that + // excludes sensitive data. + // + // Type: string + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: "C:\cmd\otecol --config="my directory\config.yaml"" + ProcessCommandLineKey = attribute.Key("process.command_line") + + // ProcessContextSwitchTypeKey is the attribute Key conforming to the + // "process.context_switch_type" semantic conventions. It represents the + // specifies whether the context switches for this data point were voluntary or + // involuntary. + // + // Type: Enum + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: + ProcessContextSwitchTypeKey = attribute.Key("process.context_switch_type") + + // ProcessCreationTimeKey is the attribute Key conforming to the + // "process.creation.time" semantic conventions. It represents the date and time + // the process was created, in ISO 8601 format. + // + // Type: string + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: "2023-11-21T09:25:34.853Z" + ProcessCreationTimeKey = attribute.Key("process.creation.time") + + // ProcessExecutableBuildIDGNUKey is the attribute Key conforming to the + // "process.executable.build_id.gnu" semantic conventions. It represents the GNU + // build ID as found in the `.note.gnu.build-id` ELF section (hex string). + // + // Type: string + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: "c89b11207f6479603b0d49bf291c092c2b719293" + ProcessExecutableBuildIDGNUKey = attribute.Key("process.executable.build_id.gnu") + + // ProcessExecutableBuildIDGoKey is the attribute Key conforming to the + // "process.executable.build_id.go" semantic conventions. It represents the Go + // build ID as retrieved by `go tool buildid `. + // + // Type: string + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: + // "foh3mEXu7BLZjsN9pOwG/kATcXlYVCDEFouRMQed_/WwRFB1hPo9LBkekthSPG/x8hMC8emW2cCjXD0_1aY" + ProcessExecutableBuildIDGoKey = attribute.Key("process.executable.build_id.go") + + // ProcessExecutableBuildIDHtlhashKey is the attribute Key conforming to the + // "process.executable.build_id.htlhash" semantic conventions. It represents the + // profiling specific build ID for executables. See the OTel specification for + // Profiles for more information. + // + // Type: string + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: "600DCAFE4A110000F2BF38C493F5FB92" + ProcessExecutableBuildIDHtlhashKey = attribute.Key("process.executable.build_id.htlhash") + + // ProcessExecutableNameKey is the attribute Key conforming to the + // "process.executable.name" semantic conventions. It represents the name of the + // process executable. On Linux based systems, this SHOULD be set to the base + // name of the target of `/proc/[pid]/exe`. On Windows, this SHOULD be set to + // the base name of `GetProcessImageFileNameW`. + // + // Type: string + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: "otelcol" + ProcessExecutableNameKey = attribute.Key("process.executable.name") + + // ProcessExecutablePathKey is the attribute Key conforming to the + // "process.executable.path" semantic conventions. It represents the full path + // to the process executable. On Linux based systems, can be set to the target + // of `proc/[pid]/exe`. On Windows, can be set to the result of + // `GetProcessImageFileNameW`. + // + // Type: string + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: "/usr/bin/cmd/otelcol" + ProcessExecutablePathKey = attribute.Key("process.executable.path") + + // ProcessExitCodeKey is the attribute Key conforming to the "process.exit.code" + // semantic conventions. It represents the exit code of the process. + // + // Type: int + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: 127 + ProcessExitCodeKey = attribute.Key("process.exit.code") + + // ProcessExitTimeKey is the attribute Key conforming to the "process.exit.time" + // semantic conventions. It represents the date and time the process exited, in + // ISO 8601 format. + // + // Type: string + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: "2023-11-21T09:26:12.315Z" + ProcessExitTimeKey = attribute.Key("process.exit.time") + + // ProcessGroupLeaderPIDKey is the attribute Key conforming to the + // "process.group_leader.pid" semantic conventions. It represents the PID of the + // process's group leader. This is also the process group ID (PGID) of the + // process. + // + // Type: int + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: 23 + ProcessGroupLeaderPIDKey = attribute.Key("process.group_leader.pid") + + // ProcessInteractiveKey is the attribute Key conforming to the + // "process.interactive" semantic conventions. It represents the whether the + // process is connected to an interactive shell. + // + // Type: boolean + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: + ProcessInteractiveKey = attribute.Key("process.interactive") + + // ProcessLinuxCgroupKey is the attribute Key conforming to the + // "process.linux.cgroup" semantic conventions. It represents the control group + // associated with the process. + // + // Type: string + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: "1:name=systemd:/user.slice/user-1000.slice/session-3.scope", + // "0::/user.slice/user-1000.slice/user@1000.service/tmux-spawn-0267755b-4639-4a27-90ed-f19f88e53748.scope" + // Note: Control groups (cgroups) are a kernel feature used to organize and + // manage process resources. This attribute provides the path(s) to the + // cgroup(s) associated with the process, which should match the contents of the + // [/proc/[PID]/cgroup] file. + // + // [/proc/[PID]/cgroup]: https://man7.org/linux/man-pages/man7/cgroups.7.html + ProcessLinuxCgroupKey = attribute.Key("process.linux.cgroup") + + // ProcessOwnerKey is the attribute Key conforming to the "process.owner" + // semantic conventions. It represents the username of the user that owns the + // process. + // + // Type: string + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: "root" + ProcessOwnerKey = attribute.Key("process.owner") + + // ProcessPagingFaultTypeKey is the attribute Key conforming to the + // "process.paging.fault_type" semantic conventions. It represents the type of + // page fault for this data point. Type `major` is for major/hard page faults, + // and `minor` is for minor/soft page faults. + // + // Type: Enum + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: + ProcessPagingFaultTypeKey = attribute.Key("process.paging.fault_type") + + // ProcessParentPIDKey is the attribute Key conforming to the + // "process.parent_pid" semantic conventions. It represents the parent Process + // identifier (PPID). + // + // Type: int + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: 111 + ProcessParentPIDKey = attribute.Key("process.parent_pid") + + // ProcessPIDKey is the attribute Key conforming to the "process.pid" semantic + // conventions. It represents the process identifier (PID). + // + // Type: int + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: 1234 + ProcessPIDKey = attribute.Key("process.pid") + + // ProcessRealUserIDKey is the attribute Key conforming to the + // "process.real_user.id" semantic conventions. It represents the real user ID + // (RUID) of the process. + // + // Type: int + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: 1000 + ProcessRealUserIDKey = attribute.Key("process.real_user.id") + + // ProcessRealUserNameKey is the attribute Key conforming to the + // "process.real_user.name" semantic conventions. It represents the username of + // the real user of the process. + // + // Type: string + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: "operator" + ProcessRealUserNameKey = attribute.Key("process.real_user.name") + + // ProcessRuntimeDescriptionKey is the attribute Key conforming to the + // "process.runtime.description" semantic conventions. It represents an + // additional description about the runtime of the process, for example a + // specific vendor customization of the runtime environment. + // + // Type: string + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: Eclipse OpenJ9 Eclipse OpenJ9 VM openj9-0.21.0 + ProcessRuntimeDescriptionKey = attribute.Key("process.runtime.description") + + // ProcessRuntimeNameKey is the attribute Key conforming to the + // "process.runtime.name" semantic conventions. It represents the name of the + // runtime of this process. + // + // Type: string + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: "OpenJDK Runtime Environment" + ProcessRuntimeNameKey = attribute.Key("process.runtime.name") + + // ProcessRuntimeVersionKey is the attribute Key conforming to the + // "process.runtime.version" semantic conventions. It represents the version of + // the runtime of this process, as returned by the runtime without modification. + // + // Type: string + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: 14.0.2 + ProcessRuntimeVersionKey = attribute.Key("process.runtime.version") + + // ProcessSavedUserIDKey is the attribute Key conforming to the + // "process.saved_user.id" semantic conventions. It represents the saved user ID + // (SUID) of the process. + // + // Type: int + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: 1002 + ProcessSavedUserIDKey = attribute.Key("process.saved_user.id") + + // ProcessSavedUserNameKey is the attribute Key conforming to the + // "process.saved_user.name" semantic conventions. It represents the username of + // the saved user. + // + // Type: string + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: "operator" + ProcessSavedUserNameKey = attribute.Key("process.saved_user.name") + + // ProcessSessionLeaderPIDKey is the attribute Key conforming to the + // "process.session_leader.pid" semantic conventions. It represents the PID of + // the process's session leader. This is also the session ID (SID) of the + // process. + // + // Type: int + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: 14 + ProcessSessionLeaderPIDKey = attribute.Key("process.session_leader.pid") + + // ProcessTitleKey is the attribute Key conforming to the "process.title" + // semantic conventions. It represents the process title (proctitle). + // + // Type: string + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: "cat /etc/hostname", "xfce4-session", "bash" + // Note: In many Unix-like systems, process title (proctitle), is the string + // that represents the name or command line of a running process, displayed by + // system monitoring tools like ps, top, and htop. + ProcessTitleKey = attribute.Key("process.title") + + // ProcessUserIDKey is the attribute Key conforming to the "process.user.id" + // semantic conventions. It represents the effective user ID (EUID) of the + // process. + // + // Type: int + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: 1001 + ProcessUserIDKey = attribute.Key("process.user.id") + + // ProcessUserNameKey is the attribute Key conforming to the "process.user.name" + // semantic conventions. It represents the username of the effective user of the + // process. + // + // Type: string + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: "root" + ProcessUserNameKey = attribute.Key("process.user.name") + + // ProcessVpidKey is the attribute Key conforming to the "process.vpid" semantic + // conventions. It represents the virtual process identifier. + // + // Type: int + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: 12 + // Note: The process ID within a PID namespace. This is not necessarily unique + // across all processes on the host but it is unique within the process + // namespace that the process exists within. + ProcessVpidKey = attribute.Key("process.vpid") + + // ProcessWorkingDirectoryKey is the attribute Key conforming to the + // "process.working_directory" semantic conventions. It represents the working + // directory of the process. + // + // Type: string + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: "/root" + ProcessWorkingDirectoryKey = attribute.Key("process.working_directory") +) + +// ProcessArgsCount returns an attribute KeyValue conforming to the +// "process.args_count" semantic conventions. It represents the length of the +// process.command_args array. +func ProcessArgsCount(val int) attribute.KeyValue { + return ProcessArgsCountKey.Int(val) +} + +// ProcessCommand returns an attribute KeyValue conforming to the +// "process.command" semantic conventions. It represents the command used to +// launch the process (i.e. the command name). On Linux based systems, can be set +// to the zeroth string in `proc/[pid]/cmdline`. On Windows, can be set to the +// first parameter extracted from `GetCommandLineW`. +func ProcessCommand(val string) attribute.KeyValue { + return ProcessCommandKey.String(val) +} + +// ProcessCommandArgs returns an attribute KeyValue conforming to the +// "process.command_args" semantic conventions. It represents the all the command +// arguments (including the command/executable itself) as received by the +// process. On Linux-based systems (and some other Unixoid systems supporting +// procfs), can be set according to the list of null-delimited strings extracted +// from `proc/[pid]/cmdline`. For libc-based executables, this would be the full +// argv vector passed to `main`. SHOULD NOT be collected by default unless there +// is sanitization that excludes sensitive data. +func ProcessCommandArgs(val ...string) attribute.KeyValue { + return ProcessCommandArgsKey.StringSlice(val) +} + +// ProcessCommandLine returns an attribute KeyValue conforming to the +// "process.command_line" semantic conventions. It represents the full command +// used to launch the process as a single string representing the full command. +// On Windows, can be set to the result of `GetCommandLineW`. Do not set this if +// you have to assemble it just for monitoring; use `process.command_args` +// instead. SHOULD NOT be collected by default unless there is sanitization that +// excludes sensitive data. +func ProcessCommandLine(val string) attribute.KeyValue { + return ProcessCommandLineKey.String(val) +} + +// ProcessCreationTime returns an attribute KeyValue conforming to the +// "process.creation.time" semantic conventions. It represents the date and time +// the process was created, in ISO 8601 format. +func ProcessCreationTime(val string) attribute.KeyValue { + return ProcessCreationTimeKey.String(val) +} + +// ProcessEnvironmentVariable returns an attribute KeyValue conforming to the +// "process.environment_variable" semantic conventions. It represents the process +// environment variables, `` being the environment variable name, the value +// being the environment variable value. +func ProcessEnvironmentVariable(key string, val string) attribute.KeyValue { + return attribute.String("process.environment_variable."+key, val) +} + +// ProcessExecutableBuildIDGNU returns an attribute KeyValue conforming to the +// "process.executable.build_id.gnu" semantic conventions. It represents the GNU +// build ID as found in the `.note.gnu.build-id` ELF section (hex string). +func ProcessExecutableBuildIDGNU(val string) attribute.KeyValue { + return ProcessExecutableBuildIDGNUKey.String(val) +} + +// ProcessExecutableBuildIDGo returns an attribute KeyValue conforming to the +// "process.executable.build_id.go" semantic conventions. It represents the Go +// build ID as retrieved by `go tool buildid `. +func ProcessExecutableBuildIDGo(val string) attribute.KeyValue { + return ProcessExecutableBuildIDGoKey.String(val) +} + +// ProcessExecutableBuildIDHtlhash returns an attribute KeyValue conforming to +// the "process.executable.build_id.htlhash" semantic conventions. It represents +// the profiling specific build ID for executables. See the OTel specification +// for Profiles for more information. +func ProcessExecutableBuildIDHtlhash(val string) attribute.KeyValue { + return ProcessExecutableBuildIDHtlhashKey.String(val) +} + +// ProcessExecutableName returns an attribute KeyValue conforming to the +// "process.executable.name" semantic conventions. It represents the name of the +// process executable. On Linux based systems, this SHOULD be set to the base +// name of the target of `/proc/[pid]/exe`. On Windows, this SHOULD be set to the +// base name of `GetProcessImageFileNameW`. +func ProcessExecutableName(val string) attribute.KeyValue { + return ProcessExecutableNameKey.String(val) +} + +// ProcessExecutablePath returns an attribute KeyValue conforming to the +// "process.executable.path" semantic conventions. It represents the full path to +// the process executable. On Linux based systems, can be set to the target of +// `proc/[pid]/exe`. On Windows, can be set to the result of +// `GetProcessImageFileNameW`. +func ProcessExecutablePath(val string) attribute.KeyValue { + return ProcessExecutablePathKey.String(val) +} + +// ProcessExitCode returns an attribute KeyValue conforming to the +// "process.exit.code" semantic conventions. It represents the exit code of the +// process. +func ProcessExitCode(val int) attribute.KeyValue { + return ProcessExitCodeKey.Int(val) +} + +// ProcessExitTime returns an attribute KeyValue conforming to the +// "process.exit.time" semantic conventions. It represents the date and time the +// process exited, in ISO 8601 format. +func ProcessExitTime(val string) attribute.KeyValue { + return ProcessExitTimeKey.String(val) +} + +// ProcessGroupLeaderPID returns an attribute KeyValue conforming to the +// "process.group_leader.pid" semantic conventions. It represents the PID of the +// process's group leader. This is also the process group ID (PGID) of the +// process. +func ProcessGroupLeaderPID(val int) attribute.KeyValue { + return ProcessGroupLeaderPIDKey.Int(val) +} + +// ProcessInteractive returns an attribute KeyValue conforming to the +// "process.interactive" semantic conventions. It represents the whether the +// process is connected to an interactive shell. +func ProcessInteractive(val bool) attribute.KeyValue { + return ProcessInteractiveKey.Bool(val) +} + +// ProcessLinuxCgroup returns an attribute KeyValue conforming to the +// "process.linux.cgroup" semantic conventions. It represents the control group +// associated with the process. +func ProcessLinuxCgroup(val string) attribute.KeyValue { + return ProcessLinuxCgroupKey.String(val) +} + +// ProcessOwner returns an attribute KeyValue conforming to the "process.owner" +// semantic conventions. It represents the username of the user that owns the +// process. +func ProcessOwner(val string) attribute.KeyValue { + return ProcessOwnerKey.String(val) +} + +// ProcessParentPID returns an attribute KeyValue conforming to the +// "process.parent_pid" semantic conventions. It represents the parent Process +// identifier (PPID). +func ProcessParentPID(val int) attribute.KeyValue { + return ProcessParentPIDKey.Int(val) +} + +// ProcessPID returns an attribute KeyValue conforming to the "process.pid" +// semantic conventions. It represents the process identifier (PID). +func ProcessPID(val int) attribute.KeyValue { + return ProcessPIDKey.Int(val) +} + +// ProcessRealUserID returns an attribute KeyValue conforming to the +// "process.real_user.id" semantic conventions. It represents the real user ID +// (RUID) of the process. +func ProcessRealUserID(val int) attribute.KeyValue { + return ProcessRealUserIDKey.Int(val) +} + +// ProcessRealUserName returns an attribute KeyValue conforming to the +// "process.real_user.name" semantic conventions. It represents the username of +// the real user of the process. +func ProcessRealUserName(val string) attribute.KeyValue { + return ProcessRealUserNameKey.String(val) +} + +// ProcessRuntimeDescription returns an attribute KeyValue conforming to the +// "process.runtime.description" semantic conventions. It represents an +// additional description about the runtime of the process, for example a +// specific vendor customization of the runtime environment. +func ProcessRuntimeDescription(val string) attribute.KeyValue { + return ProcessRuntimeDescriptionKey.String(val) +} + +// ProcessRuntimeName returns an attribute KeyValue conforming to the +// "process.runtime.name" semantic conventions. It represents the name of the +// runtime of this process. +func ProcessRuntimeName(val string) attribute.KeyValue { + return ProcessRuntimeNameKey.String(val) +} + +// ProcessRuntimeVersion returns an attribute KeyValue conforming to the +// "process.runtime.version" semantic conventions. It represents the version of +// the runtime of this process, as returned by the runtime without modification. +func ProcessRuntimeVersion(val string) attribute.KeyValue { + return ProcessRuntimeVersionKey.String(val) +} + +// ProcessSavedUserID returns an attribute KeyValue conforming to the +// "process.saved_user.id" semantic conventions. It represents the saved user ID +// (SUID) of the process. +func ProcessSavedUserID(val int) attribute.KeyValue { + return ProcessSavedUserIDKey.Int(val) +} + +// ProcessSavedUserName returns an attribute KeyValue conforming to the +// "process.saved_user.name" semantic conventions. It represents the username of +// the saved user. +func ProcessSavedUserName(val string) attribute.KeyValue { + return ProcessSavedUserNameKey.String(val) +} + +// ProcessSessionLeaderPID returns an attribute KeyValue conforming to the +// "process.session_leader.pid" semantic conventions. It represents the PID of +// the process's session leader. This is also the session ID (SID) of the +// process. +func ProcessSessionLeaderPID(val int) attribute.KeyValue { + return ProcessSessionLeaderPIDKey.Int(val) +} + +// ProcessTitle returns an attribute KeyValue conforming to the "process.title" +// semantic conventions. It represents the process title (proctitle). +func ProcessTitle(val string) attribute.KeyValue { + return ProcessTitleKey.String(val) +} + +// ProcessUserID returns an attribute KeyValue conforming to the +// "process.user.id" semantic conventions. It represents the effective user ID +// (EUID) of the process. +func ProcessUserID(val int) attribute.KeyValue { + return ProcessUserIDKey.Int(val) +} + +// ProcessUserName returns an attribute KeyValue conforming to the +// "process.user.name" semantic conventions. It represents the username of the +// effective user of the process. +func ProcessUserName(val string) attribute.KeyValue { + return ProcessUserNameKey.String(val) +} + +// ProcessVpid returns an attribute KeyValue conforming to the "process.vpid" +// semantic conventions. It represents the virtual process identifier. +func ProcessVpid(val int) attribute.KeyValue { + return ProcessVpidKey.Int(val) +} + +// ProcessWorkingDirectory returns an attribute KeyValue conforming to the +// "process.working_directory" semantic conventions. It represents the working +// directory of the process. +func ProcessWorkingDirectory(val string) attribute.KeyValue { + return ProcessWorkingDirectoryKey.String(val) +} + +// Enum values for process.context_switch_type +var ( + // voluntary + // Stability: development + ProcessContextSwitchTypeVoluntary = ProcessContextSwitchTypeKey.String("voluntary") + // involuntary + // Stability: development + ProcessContextSwitchTypeInvoluntary = ProcessContextSwitchTypeKey.String("involuntary") +) + +// Enum values for process.paging.fault_type +var ( + // major + // Stability: development + ProcessPagingFaultTypeMajor = ProcessPagingFaultTypeKey.String("major") + // minor + // Stability: development + ProcessPagingFaultTypeMinor = ProcessPagingFaultTypeKey.String("minor") +) + +// Namespace: profile +const ( + // ProfileFrameTypeKey is the attribute Key conforming to the + // "profile.frame.type" semantic conventions. It represents the describes the + // interpreter or compiler of a single frame. + // + // Type: Enum + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: "cpython" + ProfileFrameTypeKey = attribute.Key("profile.frame.type") +) + +// Enum values for profile.frame.type +var ( + // [.NET] + // + // Stability: development + // + // [.NET]: https://wikipedia.org/wiki/.NET + ProfileFrameTypeDotnet = ProfileFrameTypeKey.String("dotnet") + // [JVM] + // + // Stability: development + // + // [JVM]: https://wikipedia.org/wiki/Java_virtual_machine + ProfileFrameTypeJVM = ProfileFrameTypeKey.String("jvm") + // [Kernel] + // + // Stability: development + // + // [Kernel]: https://wikipedia.org/wiki/Kernel_(operating_system) + ProfileFrameTypeKernel = ProfileFrameTypeKey.String("kernel") + // Can be one of but not limited to [C], [C++], [Go] or [Rust]. If possible, a + // more precise value MUST be used. + // + // Stability: development + // + // [C]: https://wikipedia.org/wiki/C_(programming_language) + // [C++]: https://wikipedia.org/wiki/C%2B%2B + // [Go]: https://wikipedia.org/wiki/Go_(programming_language) + // [Rust]: https://wikipedia.org/wiki/Rust_(programming_language) + ProfileFrameTypeNative = ProfileFrameTypeKey.String("native") + // [Perl] + // + // Stability: development + // + // [Perl]: https://wikipedia.org/wiki/Perl + ProfileFrameTypePerl = ProfileFrameTypeKey.String("perl") + // [PHP] + // + // Stability: development + // + // [PHP]: https://wikipedia.org/wiki/PHP + ProfileFrameTypePHP = ProfileFrameTypeKey.String("php") + // [Python] + // + // Stability: development + // + // [Python]: https://wikipedia.org/wiki/Python_(programming_language) + ProfileFrameTypeCpython = ProfileFrameTypeKey.String("cpython") + // [Ruby] + // + // Stability: development + // + // [Ruby]: https://wikipedia.org/wiki/Ruby_(programming_language) + ProfileFrameTypeRuby = ProfileFrameTypeKey.String("ruby") + // [V8JS] + // + // Stability: development + // + // [V8JS]: https://wikipedia.org/wiki/V8_(JavaScript_engine) + ProfileFrameTypeV8JS = ProfileFrameTypeKey.String("v8js") + // [Erlang] + // + // Stability: development + // + // [Erlang]: https://en.wikipedia.org/wiki/BEAM_(Erlang_virtual_machine) + ProfileFrameTypeBeam = ProfileFrameTypeKey.String("beam") + // [Go], + // + // Stability: development + // + // [Go]: https://wikipedia.org/wiki/Go_(programming_language) + ProfileFrameTypeGo = ProfileFrameTypeKey.String("go") + // [Rust] + // + // Stability: development + // + // [Rust]: https://wikipedia.org/wiki/Rust_(programming_language) + ProfileFrameTypeRust = ProfileFrameTypeKey.String("rust") +) + +// Namespace: rpc +const ( + // RPCConnectRPCErrorCodeKey is the attribute Key conforming to the + // "rpc.connect_rpc.error_code" semantic conventions. It represents the + // [error codes] of the Connect request. Error codes are always string values. + // + // Type: Enum + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: + // + // [error codes]: https://connectrpc.com//docs/protocol/#error-codes + RPCConnectRPCErrorCodeKey = attribute.Key("rpc.connect_rpc.error_code") + + // RPCGRPCStatusCodeKey is the attribute Key conforming to the + // "rpc.grpc.status_code" semantic conventions. It represents the + // [numeric status code] of the gRPC request. + // + // Type: Enum + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: + // + // [numeric status code]: https://github.com/grpc/grpc/blob/v1.33.2/doc/statuscodes.md + RPCGRPCStatusCodeKey = attribute.Key("rpc.grpc.status_code") + + // RPCJSONRPCErrorCodeKey is the attribute Key conforming to the + // "rpc.jsonrpc.error_code" semantic conventions. It represents the `error.code` + // property of response if it is an error response. + // + // Type: int + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: -32700, 100 + RPCJSONRPCErrorCodeKey = attribute.Key("rpc.jsonrpc.error_code") + + // RPCJSONRPCErrorMessageKey is the attribute Key conforming to the + // "rpc.jsonrpc.error_message" semantic conventions. It represents the + // `error.message` property of response if it is an error response. + // + // Type: string + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: "Parse error", "User already exists" + RPCJSONRPCErrorMessageKey = attribute.Key("rpc.jsonrpc.error_message") + + // RPCJSONRPCRequestIDKey is the attribute Key conforming to the + // "rpc.jsonrpc.request_id" semantic conventions. It represents the `id` + // property of request or response. Since protocol allows id to be int, string, + // `null` or missing (for notifications), value is expected to be cast to string + // for simplicity. Use empty string in case of `null` value. Omit entirely if + // this is a notification. + // + // Type: string + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: "10", "request-7", "" + RPCJSONRPCRequestIDKey = attribute.Key("rpc.jsonrpc.request_id") + + // RPCJSONRPCVersionKey is the attribute Key conforming to the + // "rpc.jsonrpc.version" semantic conventions. It represents the protocol + // version as in `jsonrpc` property of request/response. Since JSON-RPC 1.0 + // doesn't specify this, the value can be omitted. + // + // Type: string + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: "2.0", "1.0" + RPCJSONRPCVersionKey = attribute.Key("rpc.jsonrpc.version") + + // RPCMessageCompressedSizeKey is the attribute Key conforming to the + // "rpc.message.compressed_size" semantic conventions. It represents the + // compressed size of the message in bytes. + // + // Type: int + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: + RPCMessageCompressedSizeKey = attribute.Key("rpc.message.compressed_size") + + // RPCMessageIDKey is the attribute Key conforming to the "rpc.message.id" + // semantic conventions. It MUST be calculated as two different counters + // starting from `1` one for sent messages and one for received message.. + // + // Type: int + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: + // Note: This way we guarantee that the values will be consistent between + // different implementations. + RPCMessageIDKey = attribute.Key("rpc.message.id") + + // RPCMessageTypeKey is the attribute Key conforming to the "rpc.message.type" + // semantic conventions. It represents the whether this is a received or sent + // message. + // + // Type: Enum + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: + RPCMessageTypeKey = attribute.Key("rpc.message.type") + + // RPCMessageUncompressedSizeKey is the attribute Key conforming to the + // "rpc.message.uncompressed_size" semantic conventions. It represents the + // uncompressed size of the message in bytes. + // + // Type: int + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: + RPCMessageUncompressedSizeKey = attribute.Key("rpc.message.uncompressed_size") + + // RPCMethodKey is the attribute Key conforming to the "rpc.method" semantic + // conventions. It represents the name of the (logical) method being called, + // must be equal to the $method part in the span name. + // + // Type: string + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: exampleMethod + // Note: This is the logical name of the method from the RPC interface + // perspective, which can be different from the name of any implementing + // method/function. The `code.function.name` attribute may be used to store the + // latter (e.g., method actually executing the call on the server side, RPC + // client stub method on the client side). + RPCMethodKey = attribute.Key("rpc.method") + + // RPCServiceKey is the attribute Key conforming to the "rpc.service" semantic + // conventions. It represents the full (logical) name of the service being + // called, including its package name, if applicable. + // + // Type: string + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: myservice.EchoService + // Note: This is the logical name of the service from the RPC interface + // perspective, which can be different from the name of any implementing class. + // The `code.namespace` attribute may be used to store the latter (despite the + // attribute name, it may include a class name; e.g., class with method actually + // executing the call on the server side, RPC client stub class on the client + // side). + RPCServiceKey = attribute.Key("rpc.service") + + // RPCSystemKey is the attribute Key conforming to the "rpc.system" semantic + // conventions. It represents a string identifying the remoting system. See + // below for a list of well-known identifiers. + // + // Type: Enum + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: + RPCSystemKey = attribute.Key("rpc.system") +) + +// RPCConnectRPCRequestMetadata returns an attribute KeyValue conforming to the +// "rpc.connect_rpc.request.metadata" semantic conventions. It represents the +// connect request metadata, `` being the normalized Connect Metadata key +// (lowercase), the value being the metadata values. +func RPCConnectRPCRequestMetadata(key string, val ...string) attribute.KeyValue { + return attribute.StringSlice("rpc.connect_rpc.request.metadata."+key, val) +} + +// RPCConnectRPCResponseMetadata returns an attribute KeyValue conforming to the +// "rpc.connect_rpc.response.metadata" semantic conventions. It represents the +// connect response metadata, `` being the normalized Connect Metadata key +// (lowercase), the value being the metadata values. +func RPCConnectRPCResponseMetadata(key string, val ...string) attribute.KeyValue { + return attribute.StringSlice("rpc.connect_rpc.response.metadata."+key, val) +} + +// RPCGRPCRequestMetadata returns an attribute KeyValue conforming to the +// "rpc.grpc.request.metadata" semantic conventions. It represents the gRPC +// request metadata, `` being the normalized gRPC Metadata key (lowercase), +// the value being the metadata values. +func RPCGRPCRequestMetadata(key string, val ...string) attribute.KeyValue { + return attribute.StringSlice("rpc.grpc.request.metadata."+key, val) +} + +// RPCGRPCResponseMetadata returns an attribute KeyValue conforming to the +// "rpc.grpc.response.metadata" semantic conventions. It represents the gRPC +// response metadata, `` being the normalized gRPC Metadata key (lowercase), +// the value being the metadata values. +func RPCGRPCResponseMetadata(key string, val ...string) attribute.KeyValue { + return attribute.StringSlice("rpc.grpc.response.metadata."+key, val) +} + +// RPCJSONRPCErrorCode returns an attribute KeyValue conforming to the +// "rpc.jsonrpc.error_code" semantic conventions. It represents the `error.code` +// property of response if it is an error response. +func RPCJSONRPCErrorCode(val int) attribute.KeyValue { + return RPCJSONRPCErrorCodeKey.Int(val) +} + +// RPCJSONRPCErrorMessage returns an attribute KeyValue conforming to the +// "rpc.jsonrpc.error_message" semantic conventions. It represents the +// `error.message` property of response if it is an error response. +func RPCJSONRPCErrorMessage(val string) attribute.KeyValue { + return RPCJSONRPCErrorMessageKey.String(val) +} + +// RPCJSONRPCRequestID returns an attribute KeyValue conforming to the +// "rpc.jsonrpc.request_id" semantic conventions. It represents the `id` property +// of request or response. Since protocol allows id to be int, string, `null` or +// missing (for notifications), value is expected to be cast to string for +// simplicity. Use empty string in case of `null` value. Omit entirely if this is +// a notification. +func RPCJSONRPCRequestID(val string) attribute.KeyValue { + return RPCJSONRPCRequestIDKey.String(val) +} + +// RPCJSONRPCVersion returns an attribute KeyValue conforming to the +// "rpc.jsonrpc.version" semantic conventions. It represents the protocol version +// as in `jsonrpc` property of request/response. Since JSON-RPC 1.0 doesn't +// specify this, the value can be omitted. +func RPCJSONRPCVersion(val string) attribute.KeyValue { + return RPCJSONRPCVersionKey.String(val) +} + +// RPCMessageCompressedSize returns an attribute KeyValue conforming to the +// "rpc.message.compressed_size" semantic conventions. It represents the +// compressed size of the message in bytes. +func RPCMessageCompressedSize(val int) attribute.KeyValue { + return RPCMessageCompressedSizeKey.Int(val) +} + +// RPCMessageID returns an attribute KeyValue conforming to the "rpc.message.id" +// semantic conventions. It MUST be calculated as two different counters starting +// from `1` one for sent messages and one for received message.. +func RPCMessageID(val int) attribute.KeyValue { + return RPCMessageIDKey.Int(val) +} + +// RPCMessageUncompressedSize returns an attribute KeyValue conforming to the +// "rpc.message.uncompressed_size" semantic conventions. It represents the +// uncompressed size of the message in bytes. +func RPCMessageUncompressedSize(val int) attribute.KeyValue { + return RPCMessageUncompressedSizeKey.Int(val) +} + +// RPCMethod returns an attribute KeyValue conforming to the "rpc.method" +// semantic conventions. It represents the name of the (logical) method being +// called, must be equal to the $method part in the span name. +func RPCMethod(val string) attribute.KeyValue { + return RPCMethodKey.String(val) +} + +// RPCService returns an attribute KeyValue conforming to the "rpc.service" +// semantic conventions. It represents the full (logical) name of the service +// being called, including its package name, if applicable. +func RPCService(val string) attribute.KeyValue { + return RPCServiceKey.String(val) +} + +// Enum values for rpc.connect_rpc.error_code +var ( + // cancelled + // Stability: development + RPCConnectRPCErrorCodeCancelled = RPCConnectRPCErrorCodeKey.String("cancelled") + // unknown + // Stability: development + RPCConnectRPCErrorCodeUnknown = RPCConnectRPCErrorCodeKey.String("unknown") + // invalid_argument + // Stability: development + RPCConnectRPCErrorCodeInvalidArgument = RPCConnectRPCErrorCodeKey.String("invalid_argument") + // deadline_exceeded + // Stability: development + RPCConnectRPCErrorCodeDeadlineExceeded = RPCConnectRPCErrorCodeKey.String("deadline_exceeded") + // not_found + // Stability: development + RPCConnectRPCErrorCodeNotFound = RPCConnectRPCErrorCodeKey.String("not_found") + // already_exists + // Stability: development + RPCConnectRPCErrorCodeAlreadyExists = RPCConnectRPCErrorCodeKey.String("already_exists") + // permission_denied + // Stability: development + RPCConnectRPCErrorCodePermissionDenied = RPCConnectRPCErrorCodeKey.String("permission_denied") + // resource_exhausted + // Stability: development + RPCConnectRPCErrorCodeResourceExhausted = RPCConnectRPCErrorCodeKey.String("resource_exhausted") + // failed_precondition + // Stability: development + RPCConnectRPCErrorCodeFailedPrecondition = RPCConnectRPCErrorCodeKey.String("failed_precondition") + // aborted + // Stability: development + RPCConnectRPCErrorCodeAborted = RPCConnectRPCErrorCodeKey.String("aborted") + // out_of_range + // Stability: development + RPCConnectRPCErrorCodeOutOfRange = RPCConnectRPCErrorCodeKey.String("out_of_range") + // unimplemented + // Stability: development + RPCConnectRPCErrorCodeUnimplemented = RPCConnectRPCErrorCodeKey.String("unimplemented") + // internal + // Stability: development + RPCConnectRPCErrorCodeInternal = RPCConnectRPCErrorCodeKey.String("internal") + // unavailable + // Stability: development + RPCConnectRPCErrorCodeUnavailable = RPCConnectRPCErrorCodeKey.String("unavailable") + // data_loss + // Stability: development + RPCConnectRPCErrorCodeDataLoss = RPCConnectRPCErrorCodeKey.String("data_loss") + // unauthenticated + // Stability: development + RPCConnectRPCErrorCodeUnauthenticated = RPCConnectRPCErrorCodeKey.String("unauthenticated") +) + +// Enum values for rpc.grpc.status_code +var ( + // OK + // Stability: development + RPCGRPCStatusCodeOk = RPCGRPCStatusCodeKey.Int(0) + // CANCELLED + // Stability: development + RPCGRPCStatusCodeCancelled = RPCGRPCStatusCodeKey.Int(1) + // UNKNOWN + // Stability: development + RPCGRPCStatusCodeUnknown = RPCGRPCStatusCodeKey.Int(2) + // INVALID_ARGUMENT + // Stability: development + RPCGRPCStatusCodeInvalidArgument = RPCGRPCStatusCodeKey.Int(3) + // DEADLINE_EXCEEDED + // Stability: development + RPCGRPCStatusCodeDeadlineExceeded = RPCGRPCStatusCodeKey.Int(4) + // NOT_FOUND + // Stability: development + RPCGRPCStatusCodeNotFound = RPCGRPCStatusCodeKey.Int(5) + // ALREADY_EXISTS + // Stability: development + RPCGRPCStatusCodeAlreadyExists = RPCGRPCStatusCodeKey.Int(6) + // PERMISSION_DENIED + // Stability: development + RPCGRPCStatusCodePermissionDenied = RPCGRPCStatusCodeKey.Int(7) + // RESOURCE_EXHAUSTED + // Stability: development + RPCGRPCStatusCodeResourceExhausted = RPCGRPCStatusCodeKey.Int(8) + // FAILED_PRECONDITION + // Stability: development + RPCGRPCStatusCodeFailedPrecondition = RPCGRPCStatusCodeKey.Int(9) + // ABORTED + // Stability: development + RPCGRPCStatusCodeAborted = RPCGRPCStatusCodeKey.Int(10) + // OUT_OF_RANGE + // Stability: development + RPCGRPCStatusCodeOutOfRange = RPCGRPCStatusCodeKey.Int(11) + // UNIMPLEMENTED + // Stability: development + RPCGRPCStatusCodeUnimplemented = RPCGRPCStatusCodeKey.Int(12) + // INTERNAL + // Stability: development + RPCGRPCStatusCodeInternal = RPCGRPCStatusCodeKey.Int(13) + // UNAVAILABLE + // Stability: development + RPCGRPCStatusCodeUnavailable = RPCGRPCStatusCodeKey.Int(14) + // DATA_LOSS + // Stability: development + RPCGRPCStatusCodeDataLoss = RPCGRPCStatusCodeKey.Int(15) + // UNAUTHENTICATED + // Stability: development + RPCGRPCStatusCodeUnauthenticated = RPCGRPCStatusCodeKey.Int(16) +) + +// Enum values for rpc.message.type +var ( + // sent + // Stability: development + RPCMessageTypeSent = RPCMessageTypeKey.String("SENT") + // received + // Stability: development + RPCMessageTypeReceived = RPCMessageTypeKey.String("RECEIVED") +) + +// Enum values for rpc.system +var ( + // gRPC + // Stability: development + RPCSystemGRPC = RPCSystemKey.String("grpc") + // Java RMI + // Stability: development + RPCSystemJavaRmi = RPCSystemKey.String("java_rmi") + // .NET WCF + // Stability: development + RPCSystemDotnetWcf = RPCSystemKey.String("dotnet_wcf") + // Apache Dubbo + // Stability: development + RPCSystemApacheDubbo = RPCSystemKey.String("apache_dubbo") + // Connect RPC + // Stability: development + RPCSystemConnectRPC = RPCSystemKey.String("connect_rpc") +) + +// Namespace: security_rule +const ( + // SecurityRuleCategoryKey is the attribute Key conforming to the + // "security_rule.category" semantic conventions. It represents a categorization + // value keyword used by the entity using the rule for detection of this event. + // + // Type: string + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: "Attempted Information Leak" + SecurityRuleCategoryKey = attribute.Key("security_rule.category") + + // SecurityRuleDescriptionKey is the attribute Key conforming to the + // "security_rule.description" semantic conventions. It represents the + // description of the rule generating the event. + // + // Type: string + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: "Block requests to public DNS over HTTPS / TLS protocols" + SecurityRuleDescriptionKey = attribute.Key("security_rule.description") + + // SecurityRuleLicenseKey is the attribute Key conforming to the + // "security_rule.license" semantic conventions. It represents the name of the + // license under which the rule used to generate this event is made available. + // + // Type: string + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: "Apache 2.0" + SecurityRuleLicenseKey = attribute.Key("security_rule.license") + + // SecurityRuleNameKey is the attribute Key conforming to the + // "security_rule.name" semantic conventions. It represents the name of the rule + // or signature generating the event. + // + // Type: string + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: "BLOCK_DNS_over_TLS" + SecurityRuleNameKey = attribute.Key("security_rule.name") + + // SecurityRuleReferenceKey is the attribute Key conforming to the + // "security_rule.reference" semantic conventions. It represents the reference + // URL to additional information about the rule used to generate this event. + // + // Type: string + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: "https://en.wikipedia.org/wiki/DNS_over_TLS" + // Note: The URL can point to the vendor’s documentation about the rule. If + // that’s not available, it can also be a link to a more general page + // describing this type of alert. + SecurityRuleReferenceKey = attribute.Key("security_rule.reference") + + // SecurityRuleRulesetNameKey is the attribute Key conforming to the + // "security_rule.ruleset.name" semantic conventions. It represents the name of + // the ruleset, policy, group, or parent category in which the rule used to + // generate this event is a member. + // + // Type: string + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: "Standard_Protocol_Filters" + SecurityRuleRulesetNameKey = attribute.Key("security_rule.ruleset.name") + + // SecurityRuleUUIDKey is the attribute Key conforming to the + // "security_rule.uuid" semantic conventions. It represents a rule ID that is + // unique within the scope of a set or group of agents, observers, or other + // entities using the rule for detection of this event. + // + // Type: string + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: "550e8400-e29b-41d4-a716-446655440000", "1100110011" + SecurityRuleUUIDKey = attribute.Key("security_rule.uuid") + + // SecurityRuleVersionKey is the attribute Key conforming to the + // "security_rule.version" semantic conventions. It represents the version / + // revision of the rule being used for analysis. + // + // Type: string + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: "1.0.0" + SecurityRuleVersionKey = attribute.Key("security_rule.version") +) + +// SecurityRuleCategory returns an attribute KeyValue conforming to the +// "security_rule.category" semantic conventions. It represents a categorization +// value keyword used by the entity using the rule for detection of this event. +func SecurityRuleCategory(val string) attribute.KeyValue { + return SecurityRuleCategoryKey.String(val) +} + +// SecurityRuleDescription returns an attribute KeyValue conforming to the +// "security_rule.description" semantic conventions. It represents the +// description of the rule generating the event. +func SecurityRuleDescription(val string) attribute.KeyValue { + return SecurityRuleDescriptionKey.String(val) +} + +// SecurityRuleLicense returns an attribute KeyValue conforming to the +// "security_rule.license" semantic conventions. It represents the name of the +// license under which the rule used to generate this event is made available. +func SecurityRuleLicense(val string) attribute.KeyValue { + return SecurityRuleLicenseKey.String(val) +} + +// SecurityRuleName returns an attribute KeyValue conforming to the +// "security_rule.name" semantic conventions. It represents the name of the rule +// or signature generating the event. +func SecurityRuleName(val string) attribute.KeyValue { + return SecurityRuleNameKey.String(val) +} + +// SecurityRuleReference returns an attribute KeyValue conforming to the +// "security_rule.reference" semantic conventions. It represents the reference +// URL to additional information about the rule used to generate this event. +func SecurityRuleReference(val string) attribute.KeyValue { + return SecurityRuleReferenceKey.String(val) +} + +// SecurityRuleRulesetName returns an attribute KeyValue conforming to the +// "security_rule.ruleset.name" semantic conventions. It represents the name of +// the ruleset, policy, group, or parent category in which the rule used to +// generate this event is a member. +func SecurityRuleRulesetName(val string) attribute.KeyValue { + return SecurityRuleRulesetNameKey.String(val) +} + +// SecurityRuleUUID returns an attribute KeyValue conforming to the +// "security_rule.uuid" semantic conventions. It represents a rule ID that is +// unique within the scope of a set or group of agents, observers, or other +// entities using the rule for detection of this event. +func SecurityRuleUUID(val string) attribute.KeyValue { + return SecurityRuleUUIDKey.String(val) +} + +// SecurityRuleVersion returns an attribute KeyValue conforming to the +// "security_rule.version" semantic conventions. It represents the version / +// revision of the rule being used for analysis. +func SecurityRuleVersion(val string) attribute.KeyValue { + return SecurityRuleVersionKey.String(val) +} + +// Namespace: server +const ( + // ServerAddressKey is the attribute Key conforming to the "server.address" + // semantic conventions. It represents the server domain name if available + // without reverse DNS lookup; otherwise, IP address or Unix domain socket name. + // + // Type: string + // RequirementLevel: Recommended + // Stability: Stable + // + // Examples: "example.com", "10.1.2.80", "/tmp/my.sock" + // Note: When observed from the client side, and when communicating through an + // intermediary, `server.address` SHOULD represent the server address behind any + // intermediaries, for example proxies, if it's available. + ServerAddressKey = attribute.Key("server.address") + + // ServerPortKey is the attribute Key conforming to the "server.port" semantic + // conventions. It represents the server port number. + // + // Type: int + // RequirementLevel: Recommended + // Stability: Stable + // + // Examples: 80, 8080, 443 + // Note: When observed from the client side, and when communicating through an + // intermediary, `server.port` SHOULD represent the server port behind any + // intermediaries, for example proxies, if it's available. + ServerPortKey = attribute.Key("server.port") +) + +// ServerAddress returns an attribute KeyValue conforming to the "server.address" +// semantic conventions. It represents the server domain name if available +// without reverse DNS lookup; otherwise, IP address or Unix domain socket name. +func ServerAddress(val string) attribute.KeyValue { + return ServerAddressKey.String(val) +} + +// ServerPort returns an attribute KeyValue conforming to the "server.port" +// semantic conventions. It represents the server port number. +func ServerPort(val int) attribute.KeyValue { + return ServerPortKey.Int(val) +} + +// Namespace: service +const ( + // ServiceInstanceIDKey is the attribute Key conforming to the + // "service.instance.id" semantic conventions. It represents the string ID of + // the service instance. + // + // Type: string + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: "627cc493-f310-47de-96bd-71410b7dec09" + // Note: MUST be unique for each instance of the same + // `service.namespace,service.name` pair (in other words + // `service.namespace,service.name,service.instance.id` triplet MUST be globally + // unique). The ID helps to + // distinguish instances of the same service that exist at the same time (e.g. + // instances of a horizontally scaled + // service). + // + // Implementations, such as SDKs, are recommended to generate a random Version 1 + // or Version 4 [RFC + // 4122] UUID, but are free to use an inherent unique ID as + // the source of + // this value if stability is desirable. In that case, the ID SHOULD be used as + // source of a UUID Version 5 and + // SHOULD use the following UUID as the namespace: + // `4d63009a-8d0f-11ee-aad7-4c796ed8e320`. + // + // UUIDs are typically recommended, as only an opaque value for the purposes of + // identifying a service instance is + // needed. Similar to what can be seen in the man page for the + // [`/etc/machine-id`] file, the underlying + // data, such as pod name and namespace should be treated as confidential, being + // the user's choice to expose it + // or not via another resource attribute. + // + // For applications running behind an application server (like unicorn), we do + // not recommend using one identifier + // for all processes participating in the application. Instead, it's recommended + // each division (e.g. a worker + // thread in unicorn) to have its own instance.id. + // + // It's not recommended for a Collector to set `service.instance.id` if it can't + // unambiguously determine the + // service instance that is generating that telemetry. For instance, creating an + // UUID based on `pod.name` will + // likely be wrong, as the Collector might not know from which container within + // that pod the telemetry originated. + // However, Collectors can set the `service.instance.id` if they can + // unambiguously determine the service instance + // for that telemetry. This is typically the case for scraping receivers, as + // they know the target address and + // port. + // + // [RFC + // 4122]: https://www.ietf.org/rfc/rfc4122.txt + // [`/etc/machine-id`]: https://www.freedesktop.org/software/systemd/man/latest/machine-id.html + ServiceInstanceIDKey = attribute.Key("service.instance.id") + + // ServiceNameKey is the attribute Key conforming to the "service.name" semantic + // conventions. It represents the logical name of the service. + // + // Type: string + // RequirementLevel: Recommended + // Stability: Stable + // + // Examples: "shoppingcart" + // Note: MUST be the same for all instances of horizontally scaled services. If + // the value was not specified, SDKs MUST fallback to `unknown_service:` + // concatenated with [`process.executable.name`], e.g. `unknown_service:bash`. + // If `process.executable.name` is not available, the value MUST be set to + // `unknown_service`. + // + // [`process.executable.name`]: process.md + ServiceNameKey = attribute.Key("service.name") + + // ServiceNamespaceKey is the attribute Key conforming to the + // "service.namespace" semantic conventions. It represents a namespace for + // `service.name`. + // + // Type: string + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: "Shop" + // Note: A string value having a meaning that helps to distinguish a group of + // services, for example the team name that owns a group of services. + // `service.name` is expected to be unique within the same namespace. If + // `service.namespace` is not specified in the Resource then `service.name` is + // expected to be unique for all services that have no explicit namespace + // defined (so the empty/unspecified namespace is simply one more valid + // namespace). Zero-length namespace string is assumed equal to unspecified + // namespace. + ServiceNamespaceKey = attribute.Key("service.namespace") + + // ServiceVersionKey is the attribute Key conforming to the "service.version" + // semantic conventions. It represents the version string of the service API or + // implementation. The format is not defined by these conventions. + // + // Type: string + // RequirementLevel: Recommended + // Stability: Stable + // + // Examples: "2.0.0", "a01dbef8a" + ServiceVersionKey = attribute.Key("service.version") +) + +// ServiceInstanceID returns an attribute KeyValue conforming to the +// "service.instance.id" semantic conventions. It represents the string ID of the +// service instance. +func ServiceInstanceID(val string) attribute.KeyValue { + return ServiceInstanceIDKey.String(val) +} + +// ServiceName returns an attribute KeyValue conforming to the "service.name" +// semantic conventions. It represents the logical name of the service. +func ServiceName(val string) attribute.KeyValue { + return ServiceNameKey.String(val) +} + +// ServiceNamespace returns an attribute KeyValue conforming to the +// "service.namespace" semantic conventions. It represents a namespace for +// `service.name`. +func ServiceNamespace(val string) attribute.KeyValue { + return ServiceNamespaceKey.String(val) +} + +// ServiceVersion returns an attribute KeyValue conforming to the +// "service.version" semantic conventions. It represents the version string of +// the service API or implementation. The format is not defined by these +// conventions. +func ServiceVersion(val string) attribute.KeyValue { + return ServiceVersionKey.String(val) +} + +// Namespace: session +const ( + // SessionIDKey is the attribute Key conforming to the "session.id" semantic + // conventions. It represents a unique id to identify a session. + // + // Type: string + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: 00112233-4455-6677-8899-aabbccddeeff + SessionIDKey = attribute.Key("session.id") + + // SessionPreviousIDKey is the attribute Key conforming to the + // "session.previous_id" semantic conventions. It represents the previous + // `session.id` for this user, when known. + // + // Type: string + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: 00112233-4455-6677-8899-aabbccddeeff + SessionPreviousIDKey = attribute.Key("session.previous_id") +) + +// SessionID returns an attribute KeyValue conforming to the "session.id" +// semantic conventions. It represents a unique id to identify a session. +func SessionID(val string) attribute.KeyValue { + return SessionIDKey.String(val) +} + +// SessionPreviousID returns an attribute KeyValue conforming to the +// "session.previous_id" semantic conventions. It represents the previous +// `session.id` for this user, when known. +func SessionPreviousID(val string) attribute.KeyValue { + return SessionPreviousIDKey.String(val) +} + +// Namespace: signalr +const ( + // SignalRConnectionStatusKey is the attribute Key conforming to the + // "signalr.connection.status" semantic conventions. It represents the signalR + // HTTP connection closure status. + // + // Type: Enum + // RequirementLevel: Recommended + // Stability: Stable + // + // Examples: "app_shutdown", "timeout" + SignalRConnectionStatusKey = attribute.Key("signalr.connection.status") + + // SignalRTransportKey is the attribute Key conforming to the + // "signalr.transport" semantic conventions. It represents the + // [SignalR transport type]. + // + // Type: Enum + // RequirementLevel: Recommended + // Stability: Stable + // + // Examples: "web_sockets", "long_polling" + // + // [SignalR transport type]: https://github.com/dotnet/aspnetcore/blob/main/src/SignalR/docs/specs/TransportProtocols.md + SignalRTransportKey = attribute.Key("signalr.transport") +) + +// Enum values for signalr.connection.status +var ( + // The connection was closed normally. + // Stability: stable + SignalRConnectionStatusNormalClosure = SignalRConnectionStatusKey.String("normal_closure") + // The connection was closed due to a timeout. + // Stability: stable + SignalRConnectionStatusTimeout = SignalRConnectionStatusKey.String("timeout") + // The connection was closed because the app is shutting down. + // Stability: stable + SignalRConnectionStatusAppShutdown = SignalRConnectionStatusKey.String("app_shutdown") +) + +// Enum values for signalr.transport +var ( + // ServerSentEvents protocol + // Stability: stable + SignalRTransportServerSentEvents = SignalRTransportKey.String("server_sent_events") + // LongPolling protocol + // Stability: stable + SignalRTransportLongPolling = SignalRTransportKey.String("long_polling") + // WebSockets protocol + // Stability: stable + SignalRTransportWebSockets = SignalRTransportKey.String("web_sockets") +) + +// Namespace: source +const ( + // SourceAddressKey is the attribute Key conforming to the "source.address" + // semantic conventions. It represents the source address - domain name if + // available without reverse DNS lookup; otherwise, IP address or Unix domain + // socket name. + // + // Type: string + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: "source.example.com", "10.1.2.80", "/tmp/my.sock" + // Note: When observed from the destination side, and when communicating through + // an intermediary, `source.address` SHOULD represent the source address behind + // any intermediaries, for example proxies, if it's available. + SourceAddressKey = attribute.Key("source.address") + + // SourcePortKey is the attribute Key conforming to the "source.port" semantic + // conventions. It represents the source port number. + // + // Type: int + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: 3389, 2888 + SourcePortKey = attribute.Key("source.port") +) + +// SourceAddress returns an attribute KeyValue conforming to the "source.address" +// semantic conventions. It represents the source address - domain name if +// available without reverse DNS lookup; otherwise, IP address or Unix domain +// socket name. +func SourceAddress(val string) attribute.KeyValue { + return SourceAddressKey.String(val) +} + +// SourcePort returns an attribute KeyValue conforming to the "source.port" +// semantic conventions. It represents the source port number. +func SourcePort(val int) attribute.KeyValue { + return SourcePortKey.Int(val) +} + +// Namespace: system +const ( + // SystemCPULogicalNumberKey is the attribute Key conforming to the + // "system.cpu.logical_number" semantic conventions. It represents the + // deprecated, use `cpu.logical_number` instead. + // + // Type: int + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: 1 + SystemCPULogicalNumberKey = attribute.Key("system.cpu.logical_number") + + // SystemDeviceKey is the attribute Key conforming to the "system.device" + // semantic conventions. It represents the device identifier. + // + // Type: string + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: "(identifier)" + SystemDeviceKey = attribute.Key("system.device") + + // SystemFilesystemModeKey is the attribute Key conforming to the + // "system.filesystem.mode" semantic conventions. It represents the filesystem + // mode. + // + // Type: string + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: "rw, ro" + SystemFilesystemModeKey = attribute.Key("system.filesystem.mode") + + // SystemFilesystemMountpointKey is the attribute Key conforming to the + // "system.filesystem.mountpoint" semantic conventions. It represents the + // filesystem mount path. + // + // Type: string + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: "/mnt/data" + SystemFilesystemMountpointKey = attribute.Key("system.filesystem.mountpoint") + + // SystemFilesystemStateKey is the attribute Key conforming to the + // "system.filesystem.state" semantic conventions. It represents the filesystem + // state. + // + // Type: Enum + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: "used" + SystemFilesystemStateKey = attribute.Key("system.filesystem.state") + + // SystemFilesystemTypeKey is the attribute Key conforming to the + // "system.filesystem.type" semantic conventions. It represents the filesystem + // type. + // + // Type: Enum + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: "ext4" + SystemFilesystemTypeKey = attribute.Key("system.filesystem.type") + + // SystemMemoryStateKey is the attribute Key conforming to the + // "system.memory.state" semantic conventions. It represents the memory state. + // + // Type: Enum + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: "free", "cached" + SystemMemoryStateKey = attribute.Key("system.memory.state") + + // SystemPagingDirectionKey is the attribute Key conforming to the + // "system.paging.direction" semantic conventions. It represents the paging + // access direction. + // + // Type: Enum + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: "in" + SystemPagingDirectionKey = attribute.Key("system.paging.direction") + + // SystemPagingStateKey is the attribute Key conforming to the + // "system.paging.state" semantic conventions. It represents the memory paging + // state. + // + // Type: Enum + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: "free" + SystemPagingStateKey = attribute.Key("system.paging.state") + + // SystemPagingTypeKey is the attribute Key conforming to the + // "system.paging.type" semantic conventions. It represents the memory paging + // type. + // + // Type: Enum + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: "minor" + SystemPagingTypeKey = attribute.Key("system.paging.type") + + // SystemProcessStatusKey is the attribute Key conforming to the + // "system.process.status" semantic conventions. It represents the process + // state, e.g., [Linux Process State Codes]. + // + // Type: Enum + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: "running" + // + // [Linux Process State Codes]: https://man7.org/linux/man-pages/man1/ps.1.html#PROCESS_STATE_CODES + SystemProcessStatusKey = attribute.Key("system.process.status") +) + +// SystemCPULogicalNumber returns an attribute KeyValue conforming to the +// "system.cpu.logical_number" semantic conventions. It represents the +// deprecated, use `cpu.logical_number` instead. +func SystemCPULogicalNumber(val int) attribute.KeyValue { + return SystemCPULogicalNumberKey.Int(val) +} + +// SystemDevice returns an attribute KeyValue conforming to the "system.device" +// semantic conventions. It represents the device identifier. +func SystemDevice(val string) attribute.KeyValue { + return SystemDeviceKey.String(val) +} + +// SystemFilesystemMode returns an attribute KeyValue conforming to the +// "system.filesystem.mode" semantic conventions. It represents the filesystem +// mode. +func SystemFilesystemMode(val string) attribute.KeyValue { + return SystemFilesystemModeKey.String(val) +} + +// SystemFilesystemMountpoint returns an attribute KeyValue conforming to the +// "system.filesystem.mountpoint" semantic conventions. It represents the +// filesystem mount path. +func SystemFilesystemMountpoint(val string) attribute.KeyValue { + return SystemFilesystemMountpointKey.String(val) +} + +// Enum values for system.filesystem.state +var ( + // used + // Stability: development + SystemFilesystemStateUsed = SystemFilesystemStateKey.String("used") + // free + // Stability: development + SystemFilesystemStateFree = SystemFilesystemStateKey.String("free") + // reserved + // Stability: development + SystemFilesystemStateReserved = SystemFilesystemStateKey.String("reserved") +) + +// Enum values for system.filesystem.type +var ( + // fat32 + // Stability: development + SystemFilesystemTypeFat32 = SystemFilesystemTypeKey.String("fat32") + // exfat + // Stability: development + SystemFilesystemTypeExfat = SystemFilesystemTypeKey.String("exfat") + // ntfs + // Stability: development + SystemFilesystemTypeNtfs = SystemFilesystemTypeKey.String("ntfs") + // refs + // Stability: development + SystemFilesystemTypeRefs = SystemFilesystemTypeKey.String("refs") + // hfsplus + // Stability: development + SystemFilesystemTypeHfsplus = SystemFilesystemTypeKey.String("hfsplus") + // ext4 + // Stability: development + SystemFilesystemTypeExt4 = SystemFilesystemTypeKey.String("ext4") +) + +// Enum values for system.memory.state +var ( + // Actual used virtual memory in bytes. + // Stability: development + SystemMemoryStateUsed = SystemMemoryStateKey.String("used") + // free + // Stability: development + SystemMemoryStateFree = SystemMemoryStateKey.String("free") + // buffers + // Stability: development + SystemMemoryStateBuffers = SystemMemoryStateKey.String("buffers") + // cached + // Stability: development + SystemMemoryStateCached = SystemMemoryStateKey.String("cached") +) + +// Enum values for system.paging.direction +var ( + // in + // Stability: development + SystemPagingDirectionIn = SystemPagingDirectionKey.String("in") + // out + // Stability: development + SystemPagingDirectionOut = SystemPagingDirectionKey.String("out") +) + +// Enum values for system.paging.state +var ( + // used + // Stability: development + SystemPagingStateUsed = SystemPagingStateKey.String("used") + // free + // Stability: development + SystemPagingStateFree = SystemPagingStateKey.String("free") +) + +// Enum values for system.paging.type +var ( + // major + // Stability: development + SystemPagingTypeMajor = SystemPagingTypeKey.String("major") + // minor + // Stability: development + SystemPagingTypeMinor = SystemPagingTypeKey.String("minor") +) + +// Enum values for system.process.status +var ( + // running + // Stability: development + SystemProcessStatusRunning = SystemProcessStatusKey.String("running") + // sleeping + // Stability: development + SystemProcessStatusSleeping = SystemProcessStatusKey.String("sleeping") + // stopped + // Stability: development + SystemProcessStatusStopped = SystemProcessStatusKey.String("stopped") + // defunct + // Stability: development + SystemProcessStatusDefunct = SystemProcessStatusKey.String("defunct") +) + +// Namespace: telemetry +const ( + // TelemetryDistroNameKey is the attribute Key conforming to the + // "telemetry.distro.name" semantic conventions. It represents the name of the + // auto instrumentation agent or distribution, if used. + // + // Type: string + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: "parts-unlimited-java" + // Note: Official auto instrumentation agents and distributions SHOULD set the + // `telemetry.distro.name` attribute to + // a string starting with `opentelemetry-`, e.g. + // `opentelemetry-java-instrumentation`. + TelemetryDistroNameKey = attribute.Key("telemetry.distro.name") + + // TelemetryDistroVersionKey is the attribute Key conforming to the + // "telemetry.distro.version" semantic conventions. It represents the version + // string of the auto instrumentation agent or distribution, if used. + // + // Type: string + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: "1.2.3" + TelemetryDistroVersionKey = attribute.Key("telemetry.distro.version") + + // TelemetrySDKLanguageKey is the attribute Key conforming to the + // "telemetry.sdk.language" semantic conventions. It represents the language of + // the telemetry SDK. + // + // Type: Enum + // RequirementLevel: Recommended + // Stability: Stable + // + // Examples: + TelemetrySDKLanguageKey = attribute.Key("telemetry.sdk.language") + + // TelemetrySDKNameKey is the attribute Key conforming to the + // "telemetry.sdk.name" semantic conventions. It represents the name of the + // telemetry SDK as defined above. + // + // Type: string + // RequirementLevel: Recommended + // Stability: Stable + // + // Examples: "opentelemetry" + // Note: The OpenTelemetry SDK MUST set the `telemetry.sdk.name` attribute to + // `opentelemetry`. + // If another SDK, like a fork or a vendor-provided implementation, is used, + // this SDK MUST set the + // `telemetry.sdk.name` attribute to the fully-qualified class or module name of + // this SDK's main entry point + // or another suitable identifier depending on the language. + // The identifier `opentelemetry` is reserved and MUST NOT be used in this case. + // All custom identifiers SHOULD be stable across different versions of an + // implementation. + TelemetrySDKNameKey = attribute.Key("telemetry.sdk.name") + + // TelemetrySDKVersionKey is the attribute Key conforming to the + // "telemetry.sdk.version" semantic conventions. It represents the version + // string of the telemetry SDK. + // + // Type: string + // RequirementLevel: Recommended + // Stability: Stable + // + // Examples: "1.2.3" + TelemetrySDKVersionKey = attribute.Key("telemetry.sdk.version") +) + +// TelemetryDistroName returns an attribute KeyValue conforming to the +// "telemetry.distro.name" semantic conventions. It represents the name of the +// auto instrumentation agent or distribution, if used. +func TelemetryDistroName(val string) attribute.KeyValue { + return TelemetryDistroNameKey.String(val) +} + +// TelemetryDistroVersion returns an attribute KeyValue conforming to the +// "telemetry.distro.version" semantic conventions. It represents the version +// string of the auto instrumentation agent or distribution, if used. +func TelemetryDistroVersion(val string) attribute.KeyValue { + return TelemetryDistroVersionKey.String(val) +} + +// TelemetrySDKName returns an attribute KeyValue conforming to the +// "telemetry.sdk.name" semantic conventions. It represents the name of the +// telemetry SDK as defined above. +func TelemetrySDKName(val string) attribute.KeyValue { + return TelemetrySDKNameKey.String(val) +} + +// TelemetrySDKVersion returns an attribute KeyValue conforming to the +// "telemetry.sdk.version" semantic conventions. It represents the version string +// of the telemetry SDK. +func TelemetrySDKVersion(val string) attribute.KeyValue { + return TelemetrySDKVersionKey.String(val) +} + +// Enum values for telemetry.sdk.language +var ( + // cpp + // Stability: stable + TelemetrySDKLanguageCPP = TelemetrySDKLanguageKey.String("cpp") + // dotnet + // Stability: stable + TelemetrySDKLanguageDotnet = TelemetrySDKLanguageKey.String("dotnet") + // erlang + // Stability: stable + TelemetrySDKLanguageErlang = TelemetrySDKLanguageKey.String("erlang") + // go + // Stability: stable + TelemetrySDKLanguageGo = TelemetrySDKLanguageKey.String("go") + // java + // Stability: stable + TelemetrySDKLanguageJava = TelemetrySDKLanguageKey.String("java") + // nodejs + // Stability: stable + TelemetrySDKLanguageNodejs = TelemetrySDKLanguageKey.String("nodejs") + // php + // Stability: stable + TelemetrySDKLanguagePHP = TelemetrySDKLanguageKey.String("php") + // python + // Stability: stable + TelemetrySDKLanguagePython = TelemetrySDKLanguageKey.String("python") + // ruby + // Stability: stable + TelemetrySDKLanguageRuby = TelemetrySDKLanguageKey.String("ruby") + // rust + // Stability: stable + TelemetrySDKLanguageRust = TelemetrySDKLanguageKey.String("rust") + // swift + // Stability: stable + TelemetrySDKLanguageSwift = TelemetrySDKLanguageKey.String("swift") + // webjs + // Stability: stable + TelemetrySDKLanguageWebJS = TelemetrySDKLanguageKey.String("webjs") +) + +// Namespace: test +const ( + // TestCaseNameKey is the attribute Key conforming to the "test.case.name" + // semantic conventions. It represents the fully qualified human readable name + // of the [test case]. + // + // Type: string + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: "org.example.TestCase1.test1", "example/tests/TestCase1.test1", + // "ExampleTestCase1_test1" + // + // [test case]: https://wikipedia.org/wiki/Test_case + TestCaseNameKey = attribute.Key("test.case.name") + + // TestCaseResultStatusKey is the attribute Key conforming to the + // "test.case.result.status" semantic conventions. It represents the status of + // the actual test case result from test execution. + // + // Type: Enum + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: "pass", "fail" + TestCaseResultStatusKey = attribute.Key("test.case.result.status") + + // TestSuiteNameKey is the attribute Key conforming to the "test.suite.name" + // semantic conventions. It represents the human readable name of a [test suite] + // . + // + // Type: string + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: "TestSuite1" + // + // [test suite]: https://wikipedia.org/wiki/Test_suite + TestSuiteNameKey = attribute.Key("test.suite.name") + + // TestSuiteRunStatusKey is the attribute Key conforming to the + // "test.suite.run.status" semantic conventions. It represents the status of the + // test suite run. + // + // Type: Enum + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: "success", "failure", "skipped", "aborted", "timed_out", + // "in_progress" + TestSuiteRunStatusKey = attribute.Key("test.suite.run.status") +) + +// TestCaseName returns an attribute KeyValue conforming to the "test.case.name" +// semantic conventions. It represents the fully qualified human readable name of +// the [test case]. +// +// [test case]: https://wikipedia.org/wiki/Test_case +func TestCaseName(val string) attribute.KeyValue { + return TestCaseNameKey.String(val) +} + +// TestSuiteName returns an attribute KeyValue conforming to the +// "test.suite.name" semantic conventions. It represents the human readable name +// of a [test suite]. +// +// [test suite]: https://wikipedia.org/wiki/Test_suite +func TestSuiteName(val string) attribute.KeyValue { + return TestSuiteNameKey.String(val) +} + +// Enum values for test.case.result.status +var ( + // pass + // Stability: development + TestCaseResultStatusPass = TestCaseResultStatusKey.String("pass") + // fail + // Stability: development + TestCaseResultStatusFail = TestCaseResultStatusKey.String("fail") +) + +// Enum values for test.suite.run.status +var ( + // success + // Stability: development + TestSuiteRunStatusSuccess = TestSuiteRunStatusKey.String("success") + // failure + // Stability: development + TestSuiteRunStatusFailure = TestSuiteRunStatusKey.String("failure") + // skipped + // Stability: development + TestSuiteRunStatusSkipped = TestSuiteRunStatusKey.String("skipped") + // aborted + // Stability: development + TestSuiteRunStatusAborted = TestSuiteRunStatusKey.String("aborted") + // timed_out + // Stability: development + TestSuiteRunStatusTimedOut = TestSuiteRunStatusKey.String("timed_out") + // in_progress + // Stability: development + TestSuiteRunStatusInProgress = TestSuiteRunStatusKey.String("in_progress") +) + +// Namespace: thread +const ( + // ThreadIDKey is the attribute Key conforming to the "thread.id" semantic + // conventions. It represents the current "managed" thread ID (as opposed to OS + // thread ID). + // + // Type: int + // RequirementLevel: Recommended + // Stability: Development + ThreadIDKey = attribute.Key("thread.id") + + // ThreadNameKey is the attribute Key conforming to the "thread.name" semantic + // conventions. It represents the current thread name. + // + // Type: string + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: main + ThreadNameKey = attribute.Key("thread.name") +) + +// ThreadID returns an attribute KeyValue conforming to the "thread.id" semantic +// conventions. It represents the current "managed" thread ID (as opposed to OS +// thread ID). +func ThreadID(val int) attribute.KeyValue { + return ThreadIDKey.Int(val) +} + +// ThreadName returns an attribute KeyValue conforming to the "thread.name" +// semantic conventions. It represents the current thread name. +func ThreadName(val string) attribute.KeyValue { + return ThreadNameKey.String(val) +} + +// Namespace: tls +const ( + // TLSCipherKey is the attribute Key conforming to the "tls.cipher" semantic + // conventions. It represents the string indicating the [cipher] used during the + // current connection. + // + // Type: string + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: "TLS_RSA_WITH_3DES_EDE_CBC_SHA", + // "TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256" + // Note: The values allowed for `tls.cipher` MUST be one of the `Descriptions` + // of the [registered TLS Cipher Suits]. + // + // [cipher]: https://datatracker.ietf.org/doc/html/rfc5246#appendix-A.5 + // [registered TLS Cipher Suits]: https://www.iana.org/assignments/tls-parameters/tls-parameters.xhtml#table-tls-parameters-4 + TLSCipherKey = attribute.Key("tls.cipher") + + // TLSClientCertificateKey is the attribute Key conforming to the + // "tls.client.certificate" semantic conventions. It represents the PEM-encoded + // stand-alone certificate offered by the client. This is usually + // mutually-exclusive of `client.certificate_chain` since this value also exists + // in that list. + // + // Type: string + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: "MII..." + TLSClientCertificateKey = attribute.Key("tls.client.certificate") + + // TLSClientCertificateChainKey is the attribute Key conforming to the + // "tls.client.certificate_chain" semantic conventions. It represents the array + // of PEM-encoded certificates that make up the certificate chain offered by the + // client. This is usually mutually-exclusive of `client.certificate` since that + // value should be the first certificate in the chain. + // + // Type: string[] + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: "MII...", "MI..." + TLSClientCertificateChainKey = attribute.Key("tls.client.certificate_chain") + + // TLSClientHashMd5Key is the attribute Key conforming to the + // "tls.client.hash.md5" semantic conventions. It represents the certificate + // fingerprint using the MD5 digest of DER-encoded version of certificate + // offered by the client. For consistency with other hash values, this value + // should be formatted as an uppercase hash. + // + // Type: string + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: "0F76C7F2C55BFD7D8E8B8F4BFBF0C9EC" + TLSClientHashMd5Key = attribute.Key("tls.client.hash.md5") + + // TLSClientHashSha1Key is the attribute Key conforming to the + // "tls.client.hash.sha1" semantic conventions. It represents the certificate + // fingerprint using the SHA1 digest of DER-encoded version of certificate + // offered by the client. For consistency with other hash values, this value + // should be formatted as an uppercase hash. + // + // Type: string + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: "9E393D93138888D288266C2D915214D1D1CCEB2A" + TLSClientHashSha1Key = attribute.Key("tls.client.hash.sha1") + + // TLSClientHashSha256Key is the attribute Key conforming to the + // "tls.client.hash.sha256" semantic conventions. It represents the certificate + // fingerprint using the SHA256 digest of DER-encoded version of certificate + // offered by the client. For consistency with other hash values, this value + // should be formatted as an uppercase hash. + // + // Type: string + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: "0687F666A054EF17A08E2F2162EAB4CBC0D265E1D7875BE74BF3C712CA92DAF0" + TLSClientHashSha256Key = attribute.Key("tls.client.hash.sha256") + + // TLSClientIssuerKey is the attribute Key conforming to the "tls.client.issuer" + // semantic conventions. It represents the distinguished name of [subject] of + // the issuer of the x.509 certificate presented by the client. + // + // Type: string + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: "CN=Example Root CA, OU=Infrastructure Team, DC=example, DC=com" + // + // [subject]: https://datatracker.ietf.org/doc/html/rfc5280#section-4.1.2.6 + TLSClientIssuerKey = attribute.Key("tls.client.issuer") + + // TLSClientJa3Key is the attribute Key conforming to the "tls.client.ja3" + // semantic conventions. It represents a hash that identifies clients based on + // how they perform an SSL/TLS handshake. + // + // Type: string + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: "d4e5b18d6b55c71272893221c96ba240" + TLSClientJa3Key = attribute.Key("tls.client.ja3") + + // TLSClientNotAfterKey is the attribute Key conforming to the + // "tls.client.not_after" semantic conventions. It represents the date/Time + // indicating when client certificate is no longer considered valid. + // + // Type: string + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: "2021-01-01T00:00:00.000Z" + TLSClientNotAfterKey = attribute.Key("tls.client.not_after") + + // TLSClientNotBeforeKey is the attribute Key conforming to the + // "tls.client.not_before" semantic conventions. It represents the date/Time + // indicating when client certificate is first considered valid. + // + // Type: string + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: "1970-01-01T00:00:00.000Z" + TLSClientNotBeforeKey = attribute.Key("tls.client.not_before") + + // TLSClientSubjectKey is the attribute Key conforming to the + // "tls.client.subject" semantic conventions. It represents the distinguished + // name of subject of the x.509 certificate presented by the client. + // + // Type: string + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: "CN=myclient, OU=Documentation Team, DC=example, DC=com" + TLSClientSubjectKey = attribute.Key("tls.client.subject") + + // TLSClientSupportedCiphersKey is the attribute Key conforming to the + // "tls.client.supported_ciphers" semantic conventions. It represents the array + // of ciphers offered by the client during the client hello. + // + // Type: string[] + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: "TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384", + // "TLS_ECDHE_ECDSA_WITH_AES_256_GCM_SHA384" + TLSClientSupportedCiphersKey = attribute.Key("tls.client.supported_ciphers") + + // TLSCurveKey is the attribute Key conforming to the "tls.curve" semantic + // conventions. It represents the string indicating the curve used for the given + // cipher, when applicable. + // + // Type: string + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: "secp256r1" + TLSCurveKey = attribute.Key("tls.curve") + + // TLSEstablishedKey is the attribute Key conforming to the "tls.established" + // semantic conventions. It represents the boolean flag indicating if the TLS + // negotiation was successful and transitioned to an encrypted tunnel. + // + // Type: boolean + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: true + TLSEstablishedKey = attribute.Key("tls.established") + + // TLSNextProtocolKey is the attribute Key conforming to the "tls.next_protocol" + // semantic conventions. It represents the string indicating the protocol being + // tunneled. Per the values in the [IANA registry], this string should be lower + // case. + // + // Type: string + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: "http/1.1" + // + // [IANA registry]: https://www.iana.org/assignments/tls-extensiontype-values/tls-extensiontype-values.xhtml#alpn-protocol-ids + TLSNextProtocolKey = attribute.Key("tls.next_protocol") + + // TLSProtocolNameKey is the attribute Key conforming to the "tls.protocol.name" + // semantic conventions. It represents the normalized lowercase protocol name + // parsed from original string of the negotiated [SSL/TLS protocol version]. + // + // Type: Enum + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: + // + // [SSL/TLS protocol version]: https://docs.openssl.org/1.1.1/man3/SSL_get_version/#return-values + TLSProtocolNameKey = attribute.Key("tls.protocol.name") + + // TLSProtocolVersionKey is the attribute Key conforming to the + // "tls.protocol.version" semantic conventions. It represents the numeric part + // of the version parsed from the original string of the negotiated + // [SSL/TLS protocol version]. + // + // Type: string + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: "1.2", "3" + // + // [SSL/TLS protocol version]: https://docs.openssl.org/1.1.1/man3/SSL_get_version/#return-values + TLSProtocolVersionKey = attribute.Key("tls.protocol.version") + + // TLSResumedKey is the attribute Key conforming to the "tls.resumed" semantic + // conventions. It represents the boolean flag indicating if this TLS connection + // was resumed from an existing TLS negotiation. + // + // Type: boolean + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: true + TLSResumedKey = attribute.Key("tls.resumed") + + // TLSServerCertificateKey is the attribute Key conforming to the + // "tls.server.certificate" semantic conventions. It represents the PEM-encoded + // stand-alone certificate offered by the server. This is usually + // mutually-exclusive of `server.certificate_chain` since this value also exists + // in that list. + // + // Type: string + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: "MII..." + TLSServerCertificateKey = attribute.Key("tls.server.certificate") + + // TLSServerCertificateChainKey is the attribute Key conforming to the + // "tls.server.certificate_chain" semantic conventions. It represents the array + // of PEM-encoded certificates that make up the certificate chain offered by the + // server. This is usually mutually-exclusive of `server.certificate` since that + // value should be the first certificate in the chain. + // + // Type: string[] + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: "MII...", "MI..." + TLSServerCertificateChainKey = attribute.Key("tls.server.certificate_chain") + + // TLSServerHashMd5Key is the attribute Key conforming to the + // "tls.server.hash.md5" semantic conventions. It represents the certificate + // fingerprint using the MD5 digest of DER-encoded version of certificate + // offered by the server. For consistency with other hash values, this value + // should be formatted as an uppercase hash. + // + // Type: string + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: "0F76C7F2C55BFD7D8E8B8F4BFBF0C9EC" + TLSServerHashMd5Key = attribute.Key("tls.server.hash.md5") + + // TLSServerHashSha1Key is the attribute Key conforming to the + // "tls.server.hash.sha1" semantic conventions. It represents the certificate + // fingerprint using the SHA1 digest of DER-encoded version of certificate + // offered by the server. For consistency with other hash values, this value + // should be formatted as an uppercase hash. + // + // Type: string + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: "9E393D93138888D288266C2D915214D1D1CCEB2A" + TLSServerHashSha1Key = attribute.Key("tls.server.hash.sha1") + + // TLSServerHashSha256Key is the attribute Key conforming to the + // "tls.server.hash.sha256" semantic conventions. It represents the certificate + // fingerprint using the SHA256 digest of DER-encoded version of certificate + // offered by the server. For consistency with other hash values, this value + // should be formatted as an uppercase hash. + // + // Type: string + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: "0687F666A054EF17A08E2F2162EAB4CBC0D265E1D7875BE74BF3C712CA92DAF0" + TLSServerHashSha256Key = attribute.Key("tls.server.hash.sha256") + + // TLSServerIssuerKey is the attribute Key conforming to the "tls.server.issuer" + // semantic conventions. It represents the distinguished name of [subject] of + // the issuer of the x.509 certificate presented by the client. + // + // Type: string + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: "CN=Example Root CA, OU=Infrastructure Team, DC=example, DC=com" + // + // [subject]: https://datatracker.ietf.org/doc/html/rfc5280#section-4.1.2.6 + TLSServerIssuerKey = attribute.Key("tls.server.issuer") + + // TLSServerJa3sKey is the attribute Key conforming to the "tls.server.ja3s" + // semantic conventions. It represents a hash that identifies servers based on + // how they perform an SSL/TLS handshake. + // + // Type: string + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: "d4e5b18d6b55c71272893221c96ba240" + TLSServerJa3sKey = attribute.Key("tls.server.ja3s") + + // TLSServerNotAfterKey is the attribute Key conforming to the + // "tls.server.not_after" semantic conventions. It represents the date/Time + // indicating when server certificate is no longer considered valid. + // + // Type: string + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: "2021-01-01T00:00:00.000Z" + TLSServerNotAfterKey = attribute.Key("tls.server.not_after") + + // TLSServerNotBeforeKey is the attribute Key conforming to the + // "tls.server.not_before" semantic conventions. It represents the date/Time + // indicating when server certificate is first considered valid. + // + // Type: string + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: "1970-01-01T00:00:00.000Z" + TLSServerNotBeforeKey = attribute.Key("tls.server.not_before") + + // TLSServerSubjectKey is the attribute Key conforming to the + // "tls.server.subject" semantic conventions. It represents the distinguished + // name of subject of the x.509 certificate presented by the server. + // + // Type: string + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: "CN=myserver, OU=Documentation Team, DC=example, DC=com" + TLSServerSubjectKey = attribute.Key("tls.server.subject") +) + +// TLSCipher returns an attribute KeyValue conforming to the "tls.cipher" +// semantic conventions. It represents the string indicating the [cipher] used +// during the current connection. +// +// [cipher]: https://datatracker.ietf.org/doc/html/rfc5246#appendix-A.5 +func TLSCipher(val string) attribute.KeyValue { + return TLSCipherKey.String(val) +} + +// TLSClientCertificate returns an attribute KeyValue conforming to the +// "tls.client.certificate" semantic conventions. It represents the PEM-encoded +// stand-alone certificate offered by the client. This is usually +// mutually-exclusive of `client.certificate_chain` since this value also exists +// in that list. +func TLSClientCertificate(val string) attribute.KeyValue { + return TLSClientCertificateKey.String(val) +} + +// TLSClientCertificateChain returns an attribute KeyValue conforming to the +// "tls.client.certificate_chain" semantic conventions. It represents the array +// of PEM-encoded certificates that make up the certificate chain offered by the +// client. This is usually mutually-exclusive of `client.certificate` since that +// value should be the first certificate in the chain. +func TLSClientCertificateChain(val ...string) attribute.KeyValue { + return TLSClientCertificateChainKey.StringSlice(val) +} + +// TLSClientHashMd5 returns an attribute KeyValue conforming to the +// "tls.client.hash.md5" semantic conventions. It represents the certificate +// fingerprint using the MD5 digest of DER-encoded version of certificate offered +// by the client. For consistency with other hash values, this value should be +// formatted as an uppercase hash. +func TLSClientHashMd5(val string) attribute.KeyValue { + return TLSClientHashMd5Key.String(val) +} + +// TLSClientHashSha1 returns an attribute KeyValue conforming to the +// "tls.client.hash.sha1" semantic conventions. It represents the certificate +// fingerprint using the SHA1 digest of DER-encoded version of certificate +// offered by the client. For consistency with other hash values, this value +// should be formatted as an uppercase hash. +func TLSClientHashSha1(val string) attribute.KeyValue { + return TLSClientHashSha1Key.String(val) +} + +// TLSClientHashSha256 returns an attribute KeyValue conforming to the +// "tls.client.hash.sha256" semantic conventions. It represents the certificate +// fingerprint using the SHA256 digest of DER-encoded version of certificate +// offered by the client. For consistency with other hash values, this value +// should be formatted as an uppercase hash. +func TLSClientHashSha256(val string) attribute.KeyValue { + return TLSClientHashSha256Key.String(val) +} + +// TLSClientIssuer returns an attribute KeyValue conforming to the +// "tls.client.issuer" semantic conventions. It represents the distinguished name +// of [subject] of the issuer of the x.509 certificate presented by the client. +// +// [subject]: https://datatracker.ietf.org/doc/html/rfc5280#section-4.1.2.6 +func TLSClientIssuer(val string) attribute.KeyValue { + return TLSClientIssuerKey.String(val) +} + +// TLSClientJa3 returns an attribute KeyValue conforming to the "tls.client.ja3" +// semantic conventions. It represents a hash that identifies clients based on +// how they perform an SSL/TLS handshake. +func TLSClientJa3(val string) attribute.KeyValue { + return TLSClientJa3Key.String(val) +} + +// TLSClientNotAfter returns an attribute KeyValue conforming to the +// "tls.client.not_after" semantic conventions. It represents the date/Time +// indicating when client certificate is no longer considered valid. +func TLSClientNotAfter(val string) attribute.KeyValue { + return TLSClientNotAfterKey.String(val) +} + +// TLSClientNotBefore returns an attribute KeyValue conforming to the +// "tls.client.not_before" semantic conventions. It represents the date/Time +// indicating when client certificate is first considered valid. +func TLSClientNotBefore(val string) attribute.KeyValue { + return TLSClientNotBeforeKey.String(val) +} + +// TLSClientSubject returns an attribute KeyValue conforming to the +// "tls.client.subject" semantic conventions. It represents the distinguished +// name of subject of the x.509 certificate presented by the client. +func TLSClientSubject(val string) attribute.KeyValue { + return TLSClientSubjectKey.String(val) +} + +// TLSClientSupportedCiphers returns an attribute KeyValue conforming to the +// "tls.client.supported_ciphers" semantic conventions. It represents the array +// of ciphers offered by the client during the client hello. +func TLSClientSupportedCiphers(val ...string) attribute.KeyValue { + return TLSClientSupportedCiphersKey.StringSlice(val) +} + +// TLSCurve returns an attribute KeyValue conforming to the "tls.curve" semantic +// conventions. It represents the string indicating the curve used for the given +// cipher, when applicable. +func TLSCurve(val string) attribute.KeyValue { + return TLSCurveKey.String(val) +} + +// TLSEstablished returns an attribute KeyValue conforming to the +// "tls.established" semantic conventions. It represents the boolean flag +// indicating if the TLS negotiation was successful and transitioned to an +// encrypted tunnel. +func TLSEstablished(val bool) attribute.KeyValue { + return TLSEstablishedKey.Bool(val) +} + +// TLSNextProtocol returns an attribute KeyValue conforming to the +// "tls.next_protocol" semantic conventions. It represents the string indicating +// the protocol being tunneled. Per the values in the [IANA registry], this +// string should be lower case. +// +// [IANA registry]: https://www.iana.org/assignments/tls-extensiontype-values/tls-extensiontype-values.xhtml#alpn-protocol-ids +func TLSNextProtocol(val string) attribute.KeyValue { + return TLSNextProtocolKey.String(val) +} + +// TLSProtocolVersion returns an attribute KeyValue conforming to the +// "tls.protocol.version" semantic conventions. It represents the numeric part of +// the version parsed from the original string of the negotiated +// [SSL/TLS protocol version]. +// +// [SSL/TLS protocol version]: https://docs.openssl.org/1.1.1/man3/SSL_get_version/#return-values +func TLSProtocolVersion(val string) attribute.KeyValue { + return TLSProtocolVersionKey.String(val) +} + +// TLSResumed returns an attribute KeyValue conforming to the "tls.resumed" +// semantic conventions. It represents the boolean flag indicating if this TLS +// connection was resumed from an existing TLS negotiation. +func TLSResumed(val bool) attribute.KeyValue { + return TLSResumedKey.Bool(val) +} + +// TLSServerCertificate returns an attribute KeyValue conforming to the +// "tls.server.certificate" semantic conventions. It represents the PEM-encoded +// stand-alone certificate offered by the server. This is usually +// mutually-exclusive of `server.certificate_chain` since this value also exists +// in that list. +func TLSServerCertificate(val string) attribute.KeyValue { + return TLSServerCertificateKey.String(val) +} + +// TLSServerCertificateChain returns an attribute KeyValue conforming to the +// "tls.server.certificate_chain" semantic conventions. It represents the array +// of PEM-encoded certificates that make up the certificate chain offered by the +// server. This is usually mutually-exclusive of `server.certificate` since that +// value should be the first certificate in the chain. +func TLSServerCertificateChain(val ...string) attribute.KeyValue { + return TLSServerCertificateChainKey.StringSlice(val) +} + +// TLSServerHashMd5 returns an attribute KeyValue conforming to the +// "tls.server.hash.md5" semantic conventions. It represents the certificate +// fingerprint using the MD5 digest of DER-encoded version of certificate offered +// by the server. For consistency with other hash values, this value should be +// formatted as an uppercase hash. +func TLSServerHashMd5(val string) attribute.KeyValue { + return TLSServerHashMd5Key.String(val) +} + +// TLSServerHashSha1 returns an attribute KeyValue conforming to the +// "tls.server.hash.sha1" semantic conventions. It represents the certificate +// fingerprint using the SHA1 digest of DER-encoded version of certificate +// offered by the server. For consistency with other hash values, this value +// should be formatted as an uppercase hash. +func TLSServerHashSha1(val string) attribute.KeyValue { + return TLSServerHashSha1Key.String(val) +} + +// TLSServerHashSha256 returns an attribute KeyValue conforming to the +// "tls.server.hash.sha256" semantic conventions. It represents the certificate +// fingerprint using the SHA256 digest of DER-encoded version of certificate +// offered by the server. For consistency with other hash values, this value +// should be formatted as an uppercase hash. +func TLSServerHashSha256(val string) attribute.KeyValue { + return TLSServerHashSha256Key.String(val) +} + +// TLSServerIssuer returns an attribute KeyValue conforming to the +// "tls.server.issuer" semantic conventions. It represents the distinguished name +// of [subject] of the issuer of the x.509 certificate presented by the client. +// +// [subject]: https://datatracker.ietf.org/doc/html/rfc5280#section-4.1.2.6 +func TLSServerIssuer(val string) attribute.KeyValue { + return TLSServerIssuerKey.String(val) +} + +// TLSServerJa3s returns an attribute KeyValue conforming to the +// "tls.server.ja3s" semantic conventions. It represents a hash that identifies +// servers based on how they perform an SSL/TLS handshake. +func TLSServerJa3s(val string) attribute.KeyValue { + return TLSServerJa3sKey.String(val) +} + +// TLSServerNotAfter returns an attribute KeyValue conforming to the +// "tls.server.not_after" semantic conventions. It represents the date/Time +// indicating when server certificate is no longer considered valid. +func TLSServerNotAfter(val string) attribute.KeyValue { + return TLSServerNotAfterKey.String(val) +} + +// TLSServerNotBefore returns an attribute KeyValue conforming to the +// "tls.server.not_before" semantic conventions. It represents the date/Time +// indicating when server certificate is first considered valid. +func TLSServerNotBefore(val string) attribute.KeyValue { + return TLSServerNotBeforeKey.String(val) +} + +// TLSServerSubject returns an attribute KeyValue conforming to the +// "tls.server.subject" semantic conventions. It represents the distinguished +// name of subject of the x.509 certificate presented by the server. +func TLSServerSubject(val string) attribute.KeyValue { + return TLSServerSubjectKey.String(val) +} + +// Enum values for tls.protocol.name +var ( + // ssl + // Stability: development + TLSProtocolNameSsl = TLSProtocolNameKey.String("ssl") + // tls + // Stability: development + TLSProtocolNameTLS = TLSProtocolNameKey.String("tls") +) + +// Namespace: url +const ( + // URLDomainKey is the attribute Key conforming to the "url.domain" semantic + // conventions. It represents the domain extracted from the `url.full`, such as + // "opentelemetry.io". + // + // Type: string + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: "www.foo.bar", "opentelemetry.io", "3.12.167.2", + // "[1080:0:0:0:8:800:200C:417A]" + // Note: In some cases a URL may refer to an IP and/or port directly, without a + // domain name. In this case, the IP address would go to the domain field. If + // the URL contains a [literal IPv6 address] enclosed by `[` and `]`, the `[` + // and `]` characters should also be captured in the domain field. + // + // [literal IPv6 address]: https://www.rfc-editor.org/rfc/rfc2732#section-2 + URLDomainKey = attribute.Key("url.domain") + + // URLExtensionKey is the attribute Key conforming to the "url.extension" + // semantic conventions. It represents the file extension extracted from the + // `url.full`, excluding the leading dot. + // + // Type: string + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: "png", "gz" + // Note: The file extension is only set if it exists, as not every url has a + // file extension. When the file name has multiple extensions `example.tar.gz`, + // only the last one should be captured `gz`, not `tar.gz`. + URLExtensionKey = attribute.Key("url.extension") + + // URLFragmentKey is the attribute Key conforming to the "url.fragment" semantic + // conventions. It represents the [URI fragment] component. + // + // Type: string + // RequirementLevel: Recommended + // Stability: Stable + // + // Examples: "SemConv" + // + // [URI fragment]: https://www.rfc-editor.org/rfc/rfc3986#section-3.5 + URLFragmentKey = attribute.Key("url.fragment") + + // URLFullKey is the attribute Key conforming to the "url.full" semantic + // conventions. It represents the absolute URL describing a network resource + // according to [RFC3986]. + // + // Type: string + // RequirementLevel: Recommended + // Stability: Stable + // + // Examples: "https://www.foo.bar/search?q=OpenTelemetry#SemConv", "//localhost" + // Note: For network calls, URL usually has + // `scheme://host[:port][path][?query][#fragment]` format, where the fragment + // is not transmitted over HTTP, but if it is known, it SHOULD be included + // nevertheless. + // + // `url.full` MUST NOT contain credentials passed via URL in form of + // `https://username:password@www.example.com/`. + // In such case username and password SHOULD be redacted and attribute's value + // SHOULD be `https://REDACTED:REDACTED@www.example.com/`. + // + // `url.full` SHOULD capture the absolute URL when it is available (or can be + // reconstructed). + // + // Sensitive content provided in `url.full` SHOULD be scrubbed when + // instrumentations can identify it. + // + // + // Query string values for the following keys SHOULD be redacted by default and + // replaced by the + // value `REDACTED`: + // + // - [`AWSAccessKeyId`] + // - [`Signature`] + // - [`sig`] + // - [`X-Goog-Signature`] + // + // This list is subject to change over time. + // + // When a query string value is redacted, the query string key SHOULD still be + // preserved, e.g. + // `https://www.example.com/path?color=blue&sig=REDACTED`. + // + // [RFC3986]: https://www.rfc-editor.org/rfc/rfc3986 + // [`AWSAccessKeyId`]: https://docs.aws.amazon.com/AmazonS3/latest/userguide/RESTAuthentication.html#RESTAuthenticationQueryStringAuth + // [`Signature`]: https://docs.aws.amazon.com/AmazonS3/latest/userguide/RESTAuthentication.html#RESTAuthenticationQueryStringAuth + // [`sig`]: https://learn.microsoft.com/azure/storage/common/storage-sas-overview#sas-token + // [`X-Goog-Signature`]: https://cloud.google.com/storage/docs/access-control/signed-urls + URLFullKey = attribute.Key("url.full") + + // URLOriginalKey is the attribute Key conforming to the "url.original" semantic + // conventions. It represents the unmodified original URL as seen in the event + // source. + // + // Type: string + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: "https://www.foo.bar/search?q=OpenTelemetry#SemConv", + // "search?q=OpenTelemetry" + // Note: In network monitoring, the observed URL may be a full URL, whereas in + // access logs, the URL is often just represented as a path. This field is meant + // to represent the URL as it was observed, complete or not. + // `url.original` might contain credentials passed via URL in form of + // `https://username:password@www.example.com/`. In such case password and + // username SHOULD NOT be redacted and attribute's value SHOULD remain the same. + URLOriginalKey = attribute.Key("url.original") + + // URLPathKey is the attribute Key conforming to the "url.path" semantic + // conventions. It represents the [URI path] component. + // + // Type: string + // RequirementLevel: Recommended + // Stability: Stable + // + // Examples: "/search" + // Note: Sensitive content provided in `url.path` SHOULD be scrubbed when + // instrumentations can identify it. + // + // [URI path]: https://www.rfc-editor.org/rfc/rfc3986#section-3.3 + URLPathKey = attribute.Key("url.path") + + // URLPortKey is the attribute Key conforming to the "url.port" semantic + // conventions. It represents the port extracted from the `url.full`. + // + // Type: int + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: 443 + URLPortKey = attribute.Key("url.port") + + // URLQueryKey is the attribute Key conforming to the "url.query" semantic + // conventions. It represents the [URI query] component. + // + // Type: string + // RequirementLevel: Recommended + // Stability: Stable + // + // Examples: "q=OpenTelemetry" + // Note: Sensitive content provided in `url.query` SHOULD be scrubbed when + // instrumentations can identify it. + // + // + // Query string values for the following keys SHOULD be redacted by default and + // replaced by the value `REDACTED`: + // + // - [`AWSAccessKeyId`] + // - [`Signature`] + // - [`sig`] + // - [`X-Goog-Signature`] + // + // This list is subject to change over time. + // + // When a query string value is redacted, the query string key SHOULD still be + // preserved, e.g. + // `q=OpenTelemetry&sig=REDACTED`. + // + // [URI query]: https://www.rfc-editor.org/rfc/rfc3986#section-3.4 + // [`AWSAccessKeyId`]: https://docs.aws.amazon.com/AmazonS3/latest/userguide/RESTAuthentication.html#RESTAuthenticationQueryStringAuth + // [`Signature`]: https://docs.aws.amazon.com/AmazonS3/latest/userguide/RESTAuthentication.html#RESTAuthenticationQueryStringAuth + // [`sig`]: https://learn.microsoft.com/azure/storage/common/storage-sas-overview#sas-token + // [`X-Goog-Signature`]: https://cloud.google.com/storage/docs/access-control/signed-urls + URLQueryKey = attribute.Key("url.query") + + // URLRegisteredDomainKey is the attribute Key conforming to the + // "url.registered_domain" semantic conventions. It represents the highest + // registered url domain, stripped of the subdomain. + // + // Type: string + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: "example.com", "foo.co.uk" + // Note: This value can be determined precisely with the [public suffix list]. + // For example, the registered domain for `foo.example.com` is `example.com`. + // Trying to approximate this by simply taking the last two labels will not work + // well for TLDs such as `co.uk`. + // + // [public suffix list]: https://publicsuffix.org/ + URLRegisteredDomainKey = attribute.Key("url.registered_domain") + + // URLSchemeKey is the attribute Key conforming to the "url.scheme" semantic + // conventions. It represents the [URI scheme] component identifying the used + // protocol. + // + // Type: string + // RequirementLevel: Recommended + // Stability: Stable + // + // Examples: "https", "ftp", "telnet" + // + // [URI scheme]: https://www.rfc-editor.org/rfc/rfc3986#section-3.1 + URLSchemeKey = attribute.Key("url.scheme") + + // URLSubdomainKey is the attribute Key conforming to the "url.subdomain" + // semantic conventions. It represents the subdomain portion of a fully + // qualified domain name includes all of the names except the host name under + // the registered_domain. In a partially qualified domain, or if the + // qualification level of the full name cannot be determined, subdomain contains + // all of the names below the registered domain. + // + // Type: string + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: "east", "sub2.sub1" + // Note: The subdomain portion of `www.east.mydomain.co.uk` is `east`. If the + // domain has multiple levels of subdomain, such as `sub2.sub1.example.com`, the + // subdomain field should contain `sub2.sub1`, with no trailing period. + URLSubdomainKey = attribute.Key("url.subdomain") + + // URLTemplateKey is the attribute Key conforming to the "url.template" semantic + // conventions. It represents the low-cardinality template of an + // [absolute path reference]. + // + // Type: string + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: "/users/{id}", "/users/:id", "/users?id={id}" + // + // [absolute path reference]: https://www.rfc-editor.org/rfc/rfc3986#section-4.2 + URLTemplateKey = attribute.Key("url.template") + + // URLTopLevelDomainKey is the attribute Key conforming to the + // "url.top_level_domain" semantic conventions. It represents the effective top + // level domain (eTLD), also known as the domain suffix, is the last part of the + // domain name. For example, the top level domain for example.com is `com`. + // + // Type: string + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: "com", "co.uk" + // Note: This value can be determined precisely with the [public suffix list]. + // + // [public suffix list]: https://publicsuffix.org/ + URLTopLevelDomainKey = attribute.Key("url.top_level_domain") +) + +// URLDomain returns an attribute KeyValue conforming to the "url.domain" +// semantic conventions. It represents the domain extracted from the `url.full`, +// such as "opentelemetry.io". +func URLDomain(val string) attribute.KeyValue { + return URLDomainKey.String(val) +} + +// URLExtension returns an attribute KeyValue conforming to the "url.extension" +// semantic conventions. It represents the file extension extracted from the +// `url.full`, excluding the leading dot. +func URLExtension(val string) attribute.KeyValue { + return URLExtensionKey.String(val) +} + +// URLFragment returns an attribute KeyValue conforming to the "url.fragment" +// semantic conventions. It represents the [URI fragment] component. +// +// [URI fragment]: https://www.rfc-editor.org/rfc/rfc3986#section-3.5 +func URLFragment(val string) attribute.KeyValue { + return URLFragmentKey.String(val) +} + +// URLFull returns an attribute KeyValue conforming to the "url.full" semantic +// conventions. It represents the absolute URL describing a network resource +// according to [RFC3986]. +// +// [RFC3986]: https://www.rfc-editor.org/rfc/rfc3986 +func URLFull(val string) attribute.KeyValue { + return URLFullKey.String(val) +} + +// URLOriginal returns an attribute KeyValue conforming to the "url.original" +// semantic conventions. It represents the unmodified original URL as seen in the +// event source. +func URLOriginal(val string) attribute.KeyValue { + return URLOriginalKey.String(val) +} + +// URLPath returns an attribute KeyValue conforming to the "url.path" semantic +// conventions. It represents the [URI path] component. +// +// [URI path]: https://www.rfc-editor.org/rfc/rfc3986#section-3.3 +func URLPath(val string) attribute.KeyValue { + return URLPathKey.String(val) +} + +// URLPort returns an attribute KeyValue conforming to the "url.port" semantic +// conventions. It represents the port extracted from the `url.full`. +func URLPort(val int) attribute.KeyValue { + return URLPortKey.Int(val) +} + +// URLQuery returns an attribute KeyValue conforming to the "url.query" semantic +// conventions. It represents the [URI query] component. +// +// [URI query]: https://www.rfc-editor.org/rfc/rfc3986#section-3.4 +func URLQuery(val string) attribute.KeyValue { + return URLQueryKey.String(val) +} + +// URLRegisteredDomain returns an attribute KeyValue conforming to the +// "url.registered_domain" semantic conventions. It represents the highest +// registered url domain, stripped of the subdomain. +func URLRegisteredDomain(val string) attribute.KeyValue { + return URLRegisteredDomainKey.String(val) +} + +// URLScheme returns an attribute KeyValue conforming to the "url.scheme" +// semantic conventions. It represents the [URI scheme] component identifying the +// used protocol. +// +// [URI scheme]: https://www.rfc-editor.org/rfc/rfc3986#section-3.1 +func URLScheme(val string) attribute.KeyValue { + return URLSchemeKey.String(val) +} + +// URLSubdomain returns an attribute KeyValue conforming to the "url.subdomain" +// semantic conventions. It represents the subdomain portion of a fully qualified +// domain name includes all of the names except the host name under the +// registered_domain. In a partially qualified domain, or if the qualification +// level of the full name cannot be determined, subdomain contains all of the +// names below the registered domain. +func URLSubdomain(val string) attribute.KeyValue { + return URLSubdomainKey.String(val) +} + +// URLTemplate returns an attribute KeyValue conforming to the "url.template" +// semantic conventions. It represents the low-cardinality template of an +// [absolute path reference]. +// +// [absolute path reference]: https://www.rfc-editor.org/rfc/rfc3986#section-4.2 +func URLTemplate(val string) attribute.KeyValue { + return URLTemplateKey.String(val) +} + +// URLTopLevelDomain returns an attribute KeyValue conforming to the +// "url.top_level_domain" semantic conventions. It represents the effective top +// level domain (eTLD), also known as the domain suffix, is the last part of the +// domain name. For example, the top level domain for example.com is `com`. +func URLTopLevelDomain(val string) attribute.KeyValue { + return URLTopLevelDomainKey.String(val) +} + +// Namespace: user +const ( + // UserEmailKey is the attribute Key conforming to the "user.email" semantic + // conventions. It represents the user email address. + // + // Type: string + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: "a.einstein@example.com" + UserEmailKey = attribute.Key("user.email") + + // UserFullNameKey is the attribute Key conforming to the "user.full_name" + // semantic conventions. It represents the user's full name. + // + // Type: string + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: "Albert Einstein" + UserFullNameKey = attribute.Key("user.full_name") + + // UserHashKey is the attribute Key conforming to the "user.hash" semantic + // conventions. It represents the unique user hash to correlate information for + // a user in anonymized form. + // + // Type: string + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: "364fc68eaf4c8acec74a4e52d7d1feaa" + // Note: Useful if `user.id` or `user.name` contain confidential information and + // cannot be used. + UserHashKey = attribute.Key("user.hash") + + // UserIDKey is the attribute Key conforming to the "user.id" semantic + // conventions. It represents the unique identifier of the user. + // + // Type: string + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: "S-1-5-21-202424912787-2692429404-2351956786-1000" + UserIDKey = attribute.Key("user.id") + + // UserNameKey is the attribute Key conforming to the "user.name" semantic + // conventions. It represents the short name or login/username of the user. + // + // Type: string + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: "a.einstein" + UserNameKey = attribute.Key("user.name") + + // UserRolesKey is the attribute Key conforming to the "user.roles" semantic + // conventions. It represents the array of user roles at the time of the event. + // + // Type: string[] + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: "admin", "reporting_user" + UserRolesKey = attribute.Key("user.roles") +) + +// UserEmail returns an attribute KeyValue conforming to the "user.email" +// semantic conventions. It represents the user email address. +func UserEmail(val string) attribute.KeyValue { + return UserEmailKey.String(val) +} + +// UserFullName returns an attribute KeyValue conforming to the "user.full_name" +// semantic conventions. It represents the user's full name. +func UserFullName(val string) attribute.KeyValue { + return UserFullNameKey.String(val) +} + +// UserHash returns an attribute KeyValue conforming to the "user.hash" semantic +// conventions. It represents the unique user hash to correlate information for a +// user in anonymized form. +func UserHash(val string) attribute.KeyValue { + return UserHashKey.String(val) +} + +// UserID returns an attribute KeyValue conforming to the "user.id" semantic +// conventions. It represents the unique identifier of the user. +func UserID(val string) attribute.KeyValue { + return UserIDKey.String(val) +} + +// UserName returns an attribute KeyValue conforming to the "user.name" semantic +// conventions. It represents the short name or login/username of the user. +func UserName(val string) attribute.KeyValue { + return UserNameKey.String(val) +} + +// UserRoles returns an attribute KeyValue conforming to the "user.roles" +// semantic conventions. It represents the array of user roles at the time of the +// event. +func UserRoles(val ...string) attribute.KeyValue { + return UserRolesKey.StringSlice(val) +} + +// Namespace: user_agent +const ( + // UserAgentNameKey is the attribute Key conforming to the "user_agent.name" + // semantic conventions. It represents the name of the user-agent extracted from + // original. Usually refers to the browser's name. + // + // Type: string + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: "Safari", "YourApp" + // Note: [Example] of extracting browser's name from original string. In the + // case of using a user-agent for non-browser products, such as microservices + // with multiple names/versions inside the `user_agent.original`, the most + // significant name SHOULD be selected. In such a scenario it should align with + // `user_agent.version` + // + // [Example]: https://www.whatsmyua.info + UserAgentNameKey = attribute.Key("user_agent.name") + + // UserAgentOriginalKey is the attribute Key conforming to the + // "user_agent.original" semantic conventions. It represents the value of the + // [HTTP User-Agent] header sent by the client. + // + // Type: string + // RequirementLevel: Recommended + // Stability: Stable + // + // Examples: "CERN-LineMode/2.15 libwww/2.17b3", "Mozilla/5.0 (iPhone; CPU + // iPhone OS 14_7_1 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) + // Version/14.1.2 Mobile/15E148 Safari/604.1", "YourApp/1.0.0 + // grpc-java-okhttp/1.27.2" + // + // [HTTP User-Agent]: https://www.rfc-editor.org/rfc/rfc9110.html#field.user-agent + UserAgentOriginalKey = attribute.Key("user_agent.original") + + // UserAgentOSNameKey is the attribute Key conforming to the + // "user_agent.os.name" semantic conventions. It represents the human readable + // operating system name. + // + // Type: string + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: "iOS", "Android", "Ubuntu" + // Note: For mapping user agent strings to OS names, libraries such as + // [ua-parser] can be utilized. + // + // [ua-parser]: https://github.com/ua-parser + UserAgentOSNameKey = attribute.Key("user_agent.os.name") + + // UserAgentOSVersionKey is the attribute Key conforming to the + // "user_agent.os.version" semantic conventions. It represents the version + // string of the operating system as defined in [Version Attributes]. + // + // Type: string + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: "14.2.1", "18.04.1" + // Note: For mapping user agent strings to OS versions, libraries such as + // [ua-parser] can be utilized. + // + // [Version Attributes]: /docs/resource/README.md#version-attributes + // [ua-parser]: https://github.com/ua-parser + UserAgentOSVersionKey = attribute.Key("user_agent.os.version") + + // UserAgentSyntheticTypeKey is the attribute Key conforming to the + // "user_agent.synthetic.type" semantic conventions. It represents the specifies + // the category of synthetic traffic, such as tests or bots. + // + // Type: Enum + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: + // Note: This attribute MAY be derived from the contents of the + // `user_agent.original` attribute. Components that populate the attribute are + // responsible for determining what they consider to be synthetic bot or test + // traffic. This attribute can either be set for self-identification purposes, + // or on telemetry detected to be generated as a result of a synthetic request. + // This attribute is useful for distinguishing between genuine client traffic + // and synthetic traffic generated by bots or tests. + UserAgentSyntheticTypeKey = attribute.Key("user_agent.synthetic.type") + + // UserAgentVersionKey is the attribute Key conforming to the + // "user_agent.version" semantic conventions. It represents the version of the + // user-agent extracted from original. Usually refers to the browser's version. + // + // Type: string + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: "14.1.2", "1.0.0" + // Note: [Example] of extracting browser's version from original string. In the + // case of using a user-agent for non-browser products, such as microservices + // with multiple names/versions inside the `user_agent.original`, the most + // significant version SHOULD be selected. In such a scenario it should align + // with `user_agent.name` + // + // [Example]: https://www.whatsmyua.info + UserAgentVersionKey = attribute.Key("user_agent.version") +) + +// UserAgentName returns an attribute KeyValue conforming to the +// "user_agent.name" semantic conventions. It represents the name of the +// user-agent extracted from original. Usually refers to the browser's name. +func UserAgentName(val string) attribute.KeyValue { + return UserAgentNameKey.String(val) +} + +// UserAgentOriginal returns an attribute KeyValue conforming to the +// "user_agent.original" semantic conventions. It represents the value of the +// [HTTP User-Agent] header sent by the client. +// +// [HTTP User-Agent]: https://www.rfc-editor.org/rfc/rfc9110.html#field.user-agent +func UserAgentOriginal(val string) attribute.KeyValue { + return UserAgentOriginalKey.String(val) +} + +// UserAgentOSName returns an attribute KeyValue conforming to the +// "user_agent.os.name" semantic conventions. It represents the human readable +// operating system name. +func UserAgentOSName(val string) attribute.KeyValue { + return UserAgentOSNameKey.String(val) +} + +// UserAgentOSVersion returns an attribute KeyValue conforming to the +// "user_agent.os.version" semantic conventions. It represents the version string +// of the operating system as defined in [Version Attributes]. +// +// [Version Attributes]: /docs/resource/README.md#version-attributes +func UserAgentOSVersion(val string) attribute.KeyValue { + return UserAgentOSVersionKey.String(val) +} + +// UserAgentVersion returns an attribute KeyValue conforming to the +// "user_agent.version" semantic conventions. It represents the version of the +// user-agent extracted from original. Usually refers to the browser's version. +func UserAgentVersion(val string) attribute.KeyValue { + return UserAgentVersionKey.String(val) +} + +// Enum values for user_agent.synthetic.type +var ( + // Bot source. + // Stability: development + UserAgentSyntheticTypeBot = UserAgentSyntheticTypeKey.String("bot") + // Synthetic test source. + // Stability: development + UserAgentSyntheticTypeTest = UserAgentSyntheticTypeKey.String("test") +) + +// Namespace: vcs +const ( + // VCSChangeIDKey is the attribute Key conforming to the "vcs.change.id" + // semantic conventions. It represents the ID of the change (pull request/merge + // request/changelist) if applicable. This is usually a unique (within + // repository) identifier generated by the VCS system. + // + // Type: string + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: "123" + VCSChangeIDKey = attribute.Key("vcs.change.id") + + // VCSChangeStateKey is the attribute Key conforming to the "vcs.change.state" + // semantic conventions. It represents the state of the change (pull + // request/merge request/changelist). + // + // Type: Enum + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: "open", "closed", "merged" + VCSChangeStateKey = attribute.Key("vcs.change.state") + + // VCSChangeTitleKey is the attribute Key conforming to the "vcs.change.title" + // semantic conventions. It represents the human readable title of the change + // (pull request/merge request/changelist). This title is often a brief summary + // of the change and may get merged in to a ref as the commit summary. + // + // Type: string + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: "Fixes broken thing", "feat: add my new feature", "[chore] update + // dependency" + VCSChangeTitleKey = attribute.Key("vcs.change.title") + + // VCSLineChangeTypeKey is the attribute Key conforming to the + // "vcs.line_change.type" semantic conventions. It represents the type of line + // change being measured on a branch or change. + // + // Type: Enum + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: "added", "removed" + VCSLineChangeTypeKey = attribute.Key("vcs.line_change.type") + + // VCSOwnerNameKey is the attribute Key conforming to the "vcs.owner.name" + // semantic conventions. It represents the group owner within the version + // control system. + // + // Type: string + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: "my-org", "myteam", "business-unit" + VCSOwnerNameKey = attribute.Key("vcs.owner.name") + + // VCSProviderNameKey is the attribute Key conforming to the "vcs.provider.name" + // semantic conventions. It represents the name of the version control system + // provider. + // + // Type: Enum + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: "github", "gitlab", "gitea", "bitbucket" + VCSProviderNameKey = attribute.Key("vcs.provider.name") + + // VCSRefBaseNameKey is the attribute Key conforming to the "vcs.ref.base.name" + // semantic conventions. It represents the name of the [reference] such as + // **branch** or **tag** in the repository. + // + // Type: string + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: "my-feature-branch", "tag-1-test" + // Note: `base` refers to the starting point of a change. For example, `main` + // would be the base reference of type branch if you've created a new + // reference of type branch from it and created new commits. + // + // [reference]: https://git-scm.com/docs/gitglossary#def_ref + VCSRefBaseNameKey = attribute.Key("vcs.ref.base.name") + + // VCSRefBaseRevisionKey is the attribute Key conforming to the + // "vcs.ref.base.revision" semantic conventions. It represents the revision, + // literally [revised version], The revision most often refers to a commit + // object in Git, or a revision number in SVN. + // + // Type: string + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: "9d59409acf479dfa0df1aa568182e43e43df8bbe28d60fcf2bc52e30068802cc", + // "main", "123", "HEAD" + // Note: `base` refers to the starting point of a change. For example, `main` + // would be the base reference of type branch if you've created a new + // reference of type branch from it and created new commits. The + // revision can be a full [hash value (see + // glossary)], + // of the recorded change to a ref within a repository pointing to a + // commit [commit] object. It does + // not necessarily have to be a hash; it can simply define a [revision + // number] + // which is an integer that is monotonically increasing. In cases where + // it is identical to the `ref.base.name`, it SHOULD still be included. + // It is up to the implementer to decide which value to set as the + // revision based on the VCS system and situational context. + // + // [revised version]: https://www.merriam-webster.com/dictionary/revision + // [hash value (see + // glossary)]: https://nvlpubs.nist.gov/nistpubs/FIPS/NIST.FIPS.186-5.pdf + // [commit]: https://git-scm.com/docs/git-commit + // [revision + // number]: https://svnbook.red-bean.com/en/1.7/svn.tour.revs.specifiers.html + VCSRefBaseRevisionKey = attribute.Key("vcs.ref.base.revision") + + // VCSRefBaseTypeKey is the attribute Key conforming to the "vcs.ref.base.type" + // semantic conventions. It represents the type of the [reference] in the + // repository. + // + // Type: Enum + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: "branch", "tag" + // Note: `base` refers to the starting point of a change. For example, `main` + // would be the base reference of type branch if you've created a new + // reference of type branch from it and created new commits. + // + // [reference]: https://git-scm.com/docs/gitglossary#def_ref + VCSRefBaseTypeKey = attribute.Key("vcs.ref.base.type") + + // VCSRefHeadNameKey is the attribute Key conforming to the "vcs.ref.head.name" + // semantic conventions. It represents the name of the [reference] such as + // **branch** or **tag** in the repository. + // + // Type: string + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: "my-feature-branch", "tag-1-test" + // Note: `head` refers to where you are right now; the current reference at a + // given time. + // + // [reference]: https://git-scm.com/docs/gitglossary#def_ref + VCSRefHeadNameKey = attribute.Key("vcs.ref.head.name") + + // VCSRefHeadRevisionKey is the attribute Key conforming to the + // "vcs.ref.head.revision" semantic conventions. It represents the revision, + // literally [revised version], The revision most often refers to a commit + // object in Git, or a revision number in SVN. + // + // Type: string + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: "9d59409acf479dfa0df1aa568182e43e43df8bbe28d60fcf2bc52e30068802cc", + // "main", "123", "HEAD" + // Note: `head` refers to where you are right now; the current reference at a + // given time.The revision can be a full [hash value (see + // glossary)], + // of the recorded change to a ref within a repository pointing to a + // commit [commit] object. It does + // not necessarily have to be a hash; it can simply define a [revision + // number] + // which is an integer that is monotonically increasing. In cases where + // it is identical to the `ref.head.name`, it SHOULD still be included. + // It is up to the implementer to decide which value to set as the + // revision based on the VCS system and situational context. + // + // [revised version]: https://www.merriam-webster.com/dictionary/revision + // [hash value (see + // glossary)]: https://nvlpubs.nist.gov/nistpubs/FIPS/NIST.FIPS.186-5.pdf + // [commit]: https://git-scm.com/docs/git-commit + // [revision + // number]: https://svnbook.red-bean.com/en/1.7/svn.tour.revs.specifiers.html + VCSRefHeadRevisionKey = attribute.Key("vcs.ref.head.revision") + + // VCSRefHeadTypeKey is the attribute Key conforming to the "vcs.ref.head.type" + // semantic conventions. It represents the type of the [reference] in the + // repository. + // + // Type: Enum + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: "branch", "tag" + // Note: `head` refers to where you are right now; the current reference at a + // given time. + // + // [reference]: https://git-scm.com/docs/gitglossary#def_ref + VCSRefHeadTypeKey = attribute.Key("vcs.ref.head.type") + + // VCSRefTypeKey is the attribute Key conforming to the "vcs.ref.type" semantic + // conventions. It represents the type of the [reference] in the repository. + // + // Type: Enum + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: "branch", "tag" + // + // [reference]: https://git-scm.com/docs/gitglossary#def_ref + VCSRefTypeKey = attribute.Key("vcs.ref.type") + + // VCSRepositoryNameKey is the attribute Key conforming to the + // "vcs.repository.name" semantic conventions. It represents the human readable + // name of the repository. It SHOULD NOT include any additional identifier like + // Group/SubGroup in GitLab or organization in GitHub. + // + // Type: string + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: "semantic-conventions", "my-cool-repo" + // Note: Due to it only being the name, it can clash with forks of the same + // repository if collecting telemetry across multiple orgs or groups in + // the same backends. + VCSRepositoryNameKey = attribute.Key("vcs.repository.name") + + // VCSRepositoryURLFullKey is the attribute Key conforming to the + // "vcs.repository.url.full" semantic conventions. It represents the + // [canonical URL] of the repository providing the complete HTTP(S) address in + // order to locate and identify the repository through a browser. + // + // Type: string + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: + // "https://github.com/opentelemetry/open-telemetry-collector-contrib", + // "https://gitlab.com/my-org/my-project/my-projects-project/repo" + // Note: In Git Version Control Systems, the canonical URL SHOULD NOT include + // the `.git` extension. + // + // [canonical URL]: https://support.google.com/webmasters/answer/10347851?hl=en#:~:text=A%20canonical%20URL%20is%20the,Google%20chooses%20one%20as%20canonical. + VCSRepositoryURLFullKey = attribute.Key("vcs.repository.url.full") + + // VCSRevisionDeltaDirectionKey is the attribute Key conforming to the + // "vcs.revision_delta.direction" semantic conventions. It represents the type + // of revision comparison. + // + // Type: Enum + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: "ahead", "behind" + VCSRevisionDeltaDirectionKey = attribute.Key("vcs.revision_delta.direction") +) + +// VCSChangeID returns an attribute KeyValue conforming to the "vcs.change.id" +// semantic conventions. It represents the ID of the change (pull request/merge +// request/changelist) if applicable. This is usually a unique (within +// repository) identifier generated by the VCS system. +func VCSChangeID(val string) attribute.KeyValue { + return VCSChangeIDKey.String(val) +} + +// VCSChangeTitle returns an attribute KeyValue conforming to the +// "vcs.change.title" semantic conventions. It represents the human readable +// title of the change (pull request/merge request/changelist). This title is +// often a brief summary of the change and may get merged in to a ref as the +// commit summary. +func VCSChangeTitle(val string) attribute.KeyValue { + return VCSChangeTitleKey.String(val) +} + +// VCSOwnerName returns an attribute KeyValue conforming to the "vcs.owner.name" +// semantic conventions. It represents the group owner within the version control +// system. +func VCSOwnerName(val string) attribute.KeyValue { + return VCSOwnerNameKey.String(val) +} + +// VCSRefBaseName returns an attribute KeyValue conforming to the +// "vcs.ref.base.name" semantic conventions. It represents the name of the +// [reference] such as **branch** or **tag** in the repository. +// +// [reference]: https://git-scm.com/docs/gitglossary#def_ref +func VCSRefBaseName(val string) attribute.KeyValue { + return VCSRefBaseNameKey.String(val) +} + +// VCSRefBaseRevision returns an attribute KeyValue conforming to the +// "vcs.ref.base.revision" semantic conventions. It represents the revision, +// literally [revised version], The revision most often refers to a commit object +// in Git, or a revision number in SVN. +// +// [revised version]: https://www.merriam-webster.com/dictionary/revision +func VCSRefBaseRevision(val string) attribute.KeyValue { + return VCSRefBaseRevisionKey.String(val) +} + +// VCSRefHeadName returns an attribute KeyValue conforming to the +// "vcs.ref.head.name" semantic conventions. It represents the name of the +// [reference] such as **branch** or **tag** in the repository. +// +// [reference]: https://git-scm.com/docs/gitglossary#def_ref +func VCSRefHeadName(val string) attribute.KeyValue { + return VCSRefHeadNameKey.String(val) +} + +// VCSRefHeadRevision returns an attribute KeyValue conforming to the +// "vcs.ref.head.revision" semantic conventions. It represents the revision, +// literally [revised version], The revision most often refers to a commit object +// in Git, or a revision number in SVN. +// +// [revised version]: https://www.merriam-webster.com/dictionary/revision +func VCSRefHeadRevision(val string) attribute.KeyValue { + return VCSRefHeadRevisionKey.String(val) +} + +// VCSRepositoryName returns an attribute KeyValue conforming to the +// "vcs.repository.name" semantic conventions. It represents the human readable +// name of the repository. It SHOULD NOT include any additional identifier like +// Group/SubGroup in GitLab or organization in GitHub. +func VCSRepositoryName(val string) attribute.KeyValue { + return VCSRepositoryNameKey.String(val) +} + +// VCSRepositoryURLFull returns an attribute KeyValue conforming to the +// "vcs.repository.url.full" semantic conventions. It represents the +// [canonical URL] of the repository providing the complete HTTP(S) address in +// order to locate and identify the repository through a browser. +// +// [canonical URL]: https://support.google.com/webmasters/answer/10347851?hl=en#:~:text=A%20canonical%20URL%20is%20the,Google%20chooses%20one%20as%20canonical. +func VCSRepositoryURLFull(val string) attribute.KeyValue { + return VCSRepositoryURLFullKey.String(val) +} + +// Enum values for vcs.change.state +var ( + // Open means the change is currently active and under review. It hasn't been + // merged into the target branch yet, and it's still possible to make changes or + // add comments. + // Stability: development + VCSChangeStateOpen = VCSChangeStateKey.String("open") + // WIP (work-in-progress, draft) means the change is still in progress and not + // yet ready for a full review. It might still undergo significant changes. + // Stability: development + VCSChangeStateWip = VCSChangeStateKey.String("wip") + // Closed means the merge request has been closed without merging. This can + // happen for various reasons, such as the changes being deemed unnecessary, the + // issue being resolved in another way, or the author deciding to withdraw the + // request. + // Stability: development + VCSChangeStateClosed = VCSChangeStateKey.String("closed") + // Merged indicates that the change has been successfully integrated into the + // target codebase. + // Stability: development + VCSChangeStateMerged = VCSChangeStateKey.String("merged") +) + +// Enum values for vcs.line_change.type +var ( + // How many lines were added. + // Stability: development + VCSLineChangeTypeAdded = VCSLineChangeTypeKey.String("added") + // How many lines were removed. + // Stability: development + VCSLineChangeTypeRemoved = VCSLineChangeTypeKey.String("removed") +) + +// Enum values for vcs.provider.name +var ( + // [GitHub] + // Stability: development + // + // [GitHub]: https://github.com + VCSProviderNameGithub = VCSProviderNameKey.String("github") + // [GitLab] + // Stability: development + // + // [GitLab]: https://gitlab.com + VCSProviderNameGitlab = VCSProviderNameKey.String("gitlab") + // [Gitea] + // Stability: development + // + // [Gitea]: https://gitea.io + VCSProviderNameGitea = VCSProviderNameKey.String("gitea") + // [Bitbucket] + // Stability: development + // + // [Bitbucket]: https://bitbucket.org + VCSProviderNameBitbucket = VCSProviderNameKey.String("bitbucket") +) + +// Enum values for vcs.ref.base.type +var ( + // [branch] + // Stability: development + // + // [branch]: https://git-scm.com/docs/gitglossary#Documentation/gitglossary.txt-aiddefbranchabranch + VCSRefBaseTypeBranch = VCSRefBaseTypeKey.String("branch") + // [tag] + // Stability: development + // + // [tag]: https://git-scm.com/docs/gitglossary#Documentation/gitglossary.txt-aiddeftagatag + VCSRefBaseTypeTag = VCSRefBaseTypeKey.String("tag") +) + +// Enum values for vcs.ref.head.type +var ( + // [branch] + // Stability: development + // + // [branch]: https://git-scm.com/docs/gitglossary#Documentation/gitglossary.txt-aiddefbranchabranch + VCSRefHeadTypeBranch = VCSRefHeadTypeKey.String("branch") + // [tag] + // Stability: development + // + // [tag]: https://git-scm.com/docs/gitglossary#Documentation/gitglossary.txt-aiddeftagatag + VCSRefHeadTypeTag = VCSRefHeadTypeKey.String("tag") +) + +// Enum values for vcs.ref.type +var ( + // [branch] + // Stability: development + // + // [branch]: https://git-scm.com/docs/gitglossary#Documentation/gitglossary.txt-aiddefbranchabranch + VCSRefTypeBranch = VCSRefTypeKey.String("branch") + // [tag] + // Stability: development + // + // [tag]: https://git-scm.com/docs/gitglossary#Documentation/gitglossary.txt-aiddeftagatag + VCSRefTypeTag = VCSRefTypeKey.String("tag") +) + +// Enum values for vcs.revision_delta.direction +var ( + // How many revisions the change is behind the target ref. + // Stability: development + VCSRevisionDeltaDirectionBehind = VCSRevisionDeltaDirectionKey.String("behind") + // How many revisions the change is ahead of the target ref. + // Stability: development + VCSRevisionDeltaDirectionAhead = VCSRevisionDeltaDirectionKey.String("ahead") +) + +// Namespace: webengine +const ( + // WebEngineDescriptionKey is the attribute Key conforming to the + // "webengine.description" semantic conventions. It represents the additional + // description of the web engine (e.g. detailed version and edition + // information). + // + // Type: string + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: "WildFly Full 21.0.0.Final (WildFly Core 13.0.1.Final) - + // 2.2.2.Final" + WebEngineDescriptionKey = attribute.Key("webengine.description") + + // WebEngineNameKey is the attribute Key conforming to the "webengine.name" + // semantic conventions. It represents the name of the web engine. + // + // Type: string + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: "WildFly" + WebEngineNameKey = attribute.Key("webengine.name") + + // WebEngineVersionKey is the attribute Key conforming to the + // "webengine.version" semantic conventions. It represents the version of the + // web engine. + // + // Type: string + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: "21.0.0" + WebEngineVersionKey = attribute.Key("webengine.version") +) + +// WebEngineDescription returns an attribute KeyValue conforming to the +// "webengine.description" semantic conventions. It represents the additional +// description of the web engine (e.g. detailed version and edition information). +func WebEngineDescription(val string) attribute.KeyValue { + return WebEngineDescriptionKey.String(val) +} + +// WebEngineName returns an attribute KeyValue conforming to the "webengine.name" +// semantic conventions. It represents the name of the web engine. +func WebEngineName(val string) attribute.KeyValue { + return WebEngineNameKey.String(val) +} + +// WebEngineVersion returns an attribute KeyValue conforming to the +// "webengine.version" semantic conventions. It represents the version of the web +// engine. +func WebEngineVersion(val string) attribute.KeyValue { + return WebEngineVersionKey.String(val) +} + +// Namespace: zos +const ( + // ZOSSmfIDKey is the attribute Key conforming to the "zos.smf.id" semantic + // conventions. It represents the System Management Facility (SMF) Identifier + // uniquely identified a z/OS system within a SYSPLEX or mainframe environment + // and is used for system and performance analysis. + // + // Type: string + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: "SYS1" + ZOSSmfIDKey = attribute.Key("zos.smf.id") + + // ZOSSysplexNameKey is the attribute Key conforming to the "zos.sysplex.name" + // semantic conventions. It represents the name of the SYSPLEX to which the z/OS + // system belongs too. + // + // Type: string + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: "SYSPLEX1" + ZOSSysplexNameKey = attribute.Key("zos.sysplex.name") +) + +// ZOSSmfID returns an attribute KeyValue conforming to the "zos.smf.id" semantic +// conventions. It represents the System Management Facility (SMF) Identifier +// uniquely identified a z/OS system within a SYSPLEX or mainframe environment +// and is used for system and performance analysis. +func ZOSSmfID(val string) attribute.KeyValue { + return ZOSSmfIDKey.String(val) +} + +// ZOSSysplexName returns an attribute KeyValue conforming to the +// "zos.sysplex.name" semantic conventions. It represents the name of the SYSPLEX +// to which the z/OS system belongs too. +func ZOSSysplexName(val string) attribute.KeyValue { + return ZOSSysplexNameKey.String(val) +} \ No newline at end of file diff --git a/vendor/go.opentelemetry.io/otel/semconv/v1.37.0/doc.go b/vendor/go.opentelemetry.io/otel/semconv/v1.37.0/doc.go new file mode 100644 index 00000000..11101032 --- /dev/null +++ b/vendor/go.opentelemetry.io/otel/semconv/v1.37.0/doc.go @@ -0,0 +1,9 @@ +// Copyright The OpenTelemetry Authors +// SPDX-License-Identifier: Apache-2.0 + +// Package semconv implements OpenTelemetry semantic conventions. +// +// OpenTelemetry semantic conventions are agreed standardized naming +// patterns for OpenTelemetry things. This package represents the v1.37.0 +// version of the OpenTelemetry semantic conventions. +package semconv // import "go.opentelemetry.io/otel/semconv/v1.37.0" diff --git a/vendor/go.opentelemetry.io/otel/semconv/v1.37.0/error_type.go b/vendor/go.opentelemetry.io/otel/semconv/v1.37.0/error_type.go new file mode 100644 index 00000000..267979c0 --- /dev/null +++ b/vendor/go.opentelemetry.io/otel/semconv/v1.37.0/error_type.go @@ -0,0 +1,56 @@ +// Copyright The OpenTelemetry Authors +// SPDX-License-Identifier: Apache-2.0 + +package semconv // import "go.opentelemetry.io/otel/semconv/v1.37.0" + +import ( + "reflect" + + "go.opentelemetry.io/otel/attribute" +) + +// ErrorType returns an [attribute.KeyValue] identifying the error type of err. +// +// If err is nil, the returned attribute has the default value +// [ErrorTypeOther]. +// +// If err's type has the method +// +// ErrorType() string +// +// then the returned attribute has the value of err.ErrorType(). Otherwise, the +// returned attribute has a value derived from the concrete type of err. +// +// The key of the returned attribute is [ErrorTypeKey]. +func ErrorType(err error) attribute.KeyValue { + if err == nil { + return ErrorTypeOther + } + + return ErrorTypeKey.String(errorType(err)) +} + +func errorType(err error) string { + var s string + if et, ok := err.(interface{ ErrorType() string }); ok { + // Prioritize the ErrorType method if available. + s = et.ErrorType() + } + if s == "" { + // Fallback to reflection if the ErrorType method is not supported or + // returns an empty value. + + t := reflect.TypeOf(err) + pkg, name := t.PkgPath(), t.Name() + if pkg != "" && name != "" { + s = pkg + "." + name + } else { + // The type has no package path or name (predeclared, not-defined, + // or alias for a not-defined type). + // + // This is not guaranteed to be unique, but is a best effort. + s = t.String() + } + } + return s +} diff --git a/vendor/go.opentelemetry.io/otel/semconv/v1.37.0/exception.go b/vendor/go.opentelemetry.io/otel/semconv/v1.37.0/exception.go new file mode 100644 index 00000000..e67469a4 --- /dev/null +++ b/vendor/go.opentelemetry.io/otel/semconv/v1.37.0/exception.go @@ -0,0 +1,9 @@ +// Copyright The OpenTelemetry Authors +// SPDX-License-Identifier: Apache-2.0 + +package semconv // import "go.opentelemetry.io/otel/semconv/v1.37.0" + +const ( + // ExceptionEventName is the name of the Span event representing an exception. + ExceptionEventName = "exception" +) diff --git a/vendor/go.opentelemetry.io/otel/semconv/v1.37.0/schema.go b/vendor/go.opentelemetry.io/otel/semconv/v1.37.0/schema.go new file mode 100644 index 00000000..f8a0b704 --- /dev/null +++ b/vendor/go.opentelemetry.io/otel/semconv/v1.37.0/schema.go @@ -0,0 +1,9 @@ +// Copyright The OpenTelemetry Authors +// SPDX-License-Identifier: Apache-2.0 + +package semconv // import "go.opentelemetry.io/otel/semconv/v1.37.0" + +// SchemaURL is the schema URL that matches the version of the semantic conventions +// that this package defines. Semconv packages starting from v1.4.0 must declare +// non-empty schema URL in the form https://opentelemetry.io/schemas/ +const SchemaURL = "https://opentelemetry.io/schemas/1.37.0" diff --git a/vendor/go.opentelemetry.io/otel/semconv/v1.40.0/MIGRATION.md b/vendor/go.opentelemetry.io/otel/semconv/v1.40.0/MIGRATION.md new file mode 100644 index 00000000..e246b169 --- /dev/null +++ b/vendor/go.opentelemetry.io/otel/semconv/v1.40.0/MIGRATION.md @@ -0,0 +1,27 @@ + +# Migration from v1.39.0 to v1.40.0 + +The `go.opentelemetry.io/otel/semconv/v1.40.0` package should be a drop-in replacement for `go.opentelemetry.io/otel/semconv/v1.39.0` with the following exceptions. + +## Removed + +The following declarations have been removed. +Refer to the [OpenTelemetry Semantic Conventions documentation] for deprecation instructions. + +If the type is not listed in the documentation as deprecated, it has been removed in this version due to lack of applicability or use. +If you use any of these non-deprecated declarations in your Go application, please [open an issue] describing your use-case. + +- `ErrorMessage` +- `ErrorMessageKey` +- `RPCMessageCompressedSize` +- `RPCMessageCompressedSizeKey` +- `RPCMessageID` +- `RPCMessageIDKey` +- `RPCMessageTypeKey` +- `RPCMessageTypeReceived` +- `RPCMessageTypeSent` +- `RPCMessageUncompressedSize` +- `RPCMessageUncompressedSizeKey` + +[OpenTelemetry Semantic Conventions documentation]: https://github.com/open-telemetry/semantic-conventions +[open an issue]: https://github.com/open-telemetry/opentelemetry-go/issues/new?template=Blank+issue diff --git a/vendor/go.opentelemetry.io/otel/semconv/v1.40.0/README.md b/vendor/go.opentelemetry.io/otel/semconv/v1.40.0/README.md new file mode 100644 index 00000000..c51b7fb7 --- /dev/null +++ b/vendor/go.opentelemetry.io/otel/semconv/v1.40.0/README.md @@ -0,0 +1,3 @@ +# Semconv v1.40.0 + +[![PkgGoDev](https://pkg.go.dev/badge/go.opentelemetry.io/otel/semconv/v1.40.0)](https://pkg.go.dev/go.opentelemetry.io/otel/semconv/v1.40.0) diff --git a/vendor/go.opentelemetry.io/otel/semconv/v1.40.0/attribute_group.go b/vendor/go.opentelemetry.io/otel/semconv/v1.40.0/attribute_group.go new file mode 100644 index 00000000..ee6b1f79 --- /dev/null +++ b/vendor/go.opentelemetry.io/otel/semconv/v1.40.0/attribute_group.go @@ -0,0 +1,16861 @@ +// Copyright The OpenTelemetry Authors +// SPDX-License-Identifier: Apache-2.0 + +// Code generated from semantic convention specification. DO NOT EDIT. + +package semconv // import "go.opentelemetry.io/otel/semconv/v1.40.0" + +import "go.opentelemetry.io/otel/attribute" + +// Namespace: android +const ( + // AndroidAppStateKey is the attribute Key conforming to the "android.app.state" + // semantic conventions. It represents the this attribute represents the state + // of the application. + // + // Type: Enum + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: "created" + // Note: The Android lifecycle states are defined in + // [Activity lifecycle callbacks], and from which the `OS identifiers` are + // derived. + // + // [Activity lifecycle callbacks]: https://developer.android.com/guide/components/activities/activity-lifecycle#lc + AndroidAppStateKey = attribute.Key("android.app.state") + + // AndroidOSAPILevelKey is the attribute Key conforming to the + // "android.os.api_level" semantic conventions. It represents the uniquely + // identifies the framework API revision offered by a version (`os.version`) of + // the android operating system. More information can be found in the + // [Android API levels documentation]. + // + // Type: string + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: "33", "32" + // + // [Android API levels documentation]: https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels + AndroidOSAPILevelKey = attribute.Key("android.os.api_level") +) + +// AndroidOSAPILevel returns an attribute KeyValue conforming to the +// "android.os.api_level" semantic conventions. It represents the uniquely +// identifies the framework API revision offered by a version (`os.version`) of +// the android operating system. More information can be found in the +// [Android API levels documentation]. +// +// [Android API levels documentation]: https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels +func AndroidOSAPILevel(val string) attribute.KeyValue { + return AndroidOSAPILevelKey.String(val) +} + +// Enum values for android.app.state +var ( + // Any time before Activity.onResume() or, if the app has no Activity, + // Context.startService() has been called in the app for the first time. + // + // Stability: development + AndroidAppStateCreated = AndroidAppStateKey.String("created") + // Any time after Activity.onPause() or, if the app has no Activity, + // Context.stopService() has been called when the app was in the foreground + // state. + // + // Stability: development + AndroidAppStateBackground = AndroidAppStateKey.String("background") + // Any time after Activity.onResume() or, if the app has no Activity, + // Context.startService() has been called when the app was in either the created + // or background states. + // + // Stability: development + AndroidAppStateForeground = AndroidAppStateKey.String("foreground") +) + +// Namespace: app +const ( + // AppBuildIDKey is the attribute Key conforming to the "app.build_id" semantic + // conventions. It represents the unique identifier for a particular build or + // compilation of the application. + // + // Type: string + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: "6cff0a7e-cefc-4668-96f5-1273d8b334d0", + // "9f2b833506aa6973a92fde9733e6271f", "my-app-1.0.0-code-123" + AppBuildIDKey = attribute.Key("app.build_id") + + // AppInstallationIDKey is the attribute Key conforming to the + // "app.installation.id" semantic conventions. It represents a unique identifier + // representing the installation of an application on a specific device. + // + // Type: string + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: "2ab2916d-a51f-4ac8-80ee-45ac31a28092" + // Note: Its value SHOULD persist across launches of the same application + // installation, including through application upgrades. + // It SHOULD change if the application is uninstalled or if all applications of + // the vendor are uninstalled. + // Additionally, users might be able to reset this value (e.g. by clearing + // application data). + // If an app is installed multiple times on the same device (e.g. in different + // accounts on Android), each `app.installation.id` SHOULD have a different + // value. + // If multiple OpenTelemetry SDKs are used within the same application, they + // SHOULD use the same value for `app.installation.id`. + // Hardware IDs (e.g. serial number, IMEI, MAC address) MUST NOT be used as the + // `app.installation.id`. + // + // For iOS, this value SHOULD be equal to the [vendor identifier]. + // + // For Android, examples of `app.installation.id` implementations include: + // + // - [Firebase Installation ID]. + // - A globally unique UUID which is persisted across sessions in your + // application. + // - [App set ID]. + // - [`Settings.getString(Settings.Secure.ANDROID_ID)`]. + // + // More information about Android identifier best practices can be found in the + // [Android user data IDs guide]. + // + // [vendor identifier]: https://developer.apple.com/documentation/uikit/uidevice/identifierforvendor + // [Firebase Installation ID]: https://firebase.google.com/docs/projects/manage-installations + // [App set ID]: https://developer.android.com/identity/app-set-id + // [`Settings.getString(Settings.Secure.ANDROID_ID)`]: https://developer.android.com/reference/android/provider/Settings.Secure#ANDROID_ID + // [Android user data IDs guide]: https://developer.android.com/training/articles/user-data-ids + AppInstallationIDKey = attribute.Key("app.installation.id") + + // AppJankFrameCountKey is the attribute Key conforming to the + // "app.jank.frame_count" semantic conventions. It represents a number of frame + // renders that experienced jank. + // + // Type: int + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: 9, 42 + // Note: Depending on platform limitations, the value provided MAY be + // approximation. + AppJankFrameCountKey = attribute.Key("app.jank.frame_count") + + // AppJankPeriodKey is the attribute Key conforming to the "app.jank.period" + // semantic conventions. It represents the time period, in seconds, for which + // this jank is being reported. + // + // Type: double + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: 1.0, 5.0, 10.24 + AppJankPeriodKey = attribute.Key("app.jank.period") + + // AppJankThresholdKey is the attribute Key conforming to the + // "app.jank.threshold" semantic conventions. It represents the minimum + // rendering threshold for this jank, in seconds. + // + // Type: double + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: 0.016, 0.7, 1.024 + AppJankThresholdKey = attribute.Key("app.jank.threshold") + + // AppScreenCoordinateXKey is the attribute Key conforming to the + // "app.screen.coordinate.x" semantic conventions. It represents the x + // (horizontal) coordinate of a screen coordinate, in screen pixels. + // + // Type: int + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: 0, 131 + AppScreenCoordinateXKey = attribute.Key("app.screen.coordinate.x") + + // AppScreenCoordinateYKey is the attribute Key conforming to the + // "app.screen.coordinate.y" semantic conventions. It represents the y + // (vertical) component of a screen coordinate, in screen pixels. + // + // Type: int + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: 12, 99 + AppScreenCoordinateYKey = attribute.Key("app.screen.coordinate.y") + + // AppScreenIDKey is the attribute Key conforming to the "app.screen.id" + // semantic conventions. It represents an identifier that uniquely + // differentiates this screen from other screens in the same application. + // + // Type: string + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: "f9bc787d-ff05-48ad-90e1-fca1d46130b3", + // "com.example.app.MainActivity", "com.example.shop.ProductDetailFragment", + // "MyApp.ProfileView", "MyApp.ProfileViewController" + // Note: A screen represents only the part of the device display drawn by the + // app. It typically contains multiple widgets or UI components and is larger in + // scope than individual widgets. Multiple screens can coexist on the same + // display simultaneously (e.g., split view on tablets). + AppScreenIDKey = attribute.Key("app.screen.id") + + // AppScreenNameKey is the attribute Key conforming to the "app.screen.name" + // semantic conventions. It represents the name of an application screen. + // + // Type: string + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: "MainActivity", "ProductDetailFragment", "ProfileView", + // "ProfileViewController" + // Note: A screen represents only the part of the device display drawn by the + // app. It typically contains multiple widgets or UI components and is larger in + // scope than individual widgets. Multiple screens can coexist on the same + // display simultaneously (e.g., split view on tablets). + AppScreenNameKey = attribute.Key("app.screen.name") + + // AppWidgetIDKey is the attribute Key conforming to the "app.widget.id" + // semantic conventions. It represents an identifier that uniquely + // differentiates this widget from other widgets in the same application. + // + // Type: string + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: "f9bc787d-ff05-48ad-90e1-fca1d46130b3", "submit_order_1829" + // Note: A widget is an application component, typically an on-screen visual GUI + // element. + AppWidgetIDKey = attribute.Key("app.widget.id") + + // AppWidgetNameKey is the attribute Key conforming to the "app.widget.name" + // semantic conventions. It represents the name of an application widget. + // + // Type: string + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: "submit", "attack", "Clear Cart" + // Note: A widget is an application component, typically an on-screen visual GUI + // element. + AppWidgetNameKey = attribute.Key("app.widget.name") +) + +// AppBuildID returns an attribute KeyValue conforming to the "app.build_id" +// semantic conventions. It represents the unique identifier for a particular +// build or compilation of the application. +func AppBuildID(val string) attribute.KeyValue { + return AppBuildIDKey.String(val) +} + +// AppInstallationID returns an attribute KeyValue conforming to the +// "app.installation.id" semantic conventions. It represents a unique identifier +// representing the installation of an application on a specific device. +func AppInstallationID(val string) attribute.KeyValue { + return AppInstallationIDKey.String(val) +} + +// AppJankFrameCount returns an attribute KeyValue conforming to the +// "app.jank.frame_count" semantic conventions. It represents a number of frame +// renders that experienced jank. +func AppJankFrameCount(val int) attribute.KeyValue { + return AppJankFrameCountKey.Int(val) +} + +// AppJankPeriod returns an attribute KeyValue conforming to the +// "app.jank.period" semantic conventions. It represents the time period, in +// seconds, for which this jank is being reported. +func AppJankPeriod(val float64) attribute.KeyValue { + return AppJankPeriodKey.Float64(val) +} + +// AppJankThreshold returns an attribute KeyValue conforming to the +// "app.jank.threshold" semantic conventions. It represents the minimum rendering +// threshold for this jank, in seconds. +func AppJankThreshold(val float64) attribute.KeyValue { + return AppJankThresholdKey.Float64(val) +} + +// AppScreenCoordinateX returns an attribute KeyValue conforming to the +// "app.screen.coordinate.x" semantic conventions. It represents the x +// (horizontal) coordinate of a screen coordinate, in screen pixels. +func AppScreenCoordinateX(val int) attribute.KeyValue { + return AppScreenCoordinateXKey.Int(val) +} + +// AppScreenCoordinateY returns an attribute KeyValue conforming to the +// "app.screen.coordinate.y" semantic conventions. It represents the y (vertical) +// component of a screen coordinate, in screen pixels. +func AppScreenCoordinateY(val int) attribute.KeyValue { + return AppScreenCoordinateYKey.Int(val) +} + +// AppScreenID returns an attribute KeyValue conforming to the "app.screen.id" +// semantic conventions. It represents an identifier that uniquely differentiates +// this screen from other screens in the same application. +func AppScreenID(val string) attribute.KeyValue { + return AppScreenIDKey.String(val) +} + +// AppScreenName returns an attribute KeyValue conforming to the +// "app.screen.name" semantic conventions. It represents the name of an +// application screen. +func AppScreenName(val string) attribute.KeyValue { + return AppScreenNameKey.String(val) +} + +// AppWidgetID returns an attribute KeyValue conforming to the "app.widget.id" +// semantic conventions. It represents an identifier that uniquely differentiates +// this widget from other widgets in the same application. +func AppWidgetID(val string) attribute.KeyValue { + return AppWidgetIDKey.String(val) +} + +// AppWidgetName returns an attribute KeyValue conforming to the +// "app.widget.name" semantic conventions. It represents the name of an +// application widget. +func AppWidgetName(val string) attribute.KeyValue { + return AppWidgetNameKey.String(val) +} + +// Namespace: artifact +const ( + // ArtifactAttestationFilenameKey is the attribute Key conforming to the + // "artifact.attestation.filename" semantic conventions. It represents the + // provenance filename of the built attestation which directly relates to the + // build artifact filename. This filename SHOULD accompany the artifact at + // publish time. See the [SLSA Relationship] specification for more information. + // + // Type: string + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: "golang-binary-amd64-v0.1.0.attestation", + // "docker-image-amd64-v0.1.0.intoto.json1", "release-1.tar.gz.attestation", + // "file-name-package.tar.gz.intoto.json1" + // + // [SLSA Relationship]: https://slsa.dev/spec/v1.0/distributing-provenance#relationship-between-artifacts-and-attestations + ArtifactAttestationFilenameKey = attribute.Key("artifact.attestation.filename") + + // ArtifactAttestationHashKey is the attribute Key conforming to the + // "artifact.attestation.hash" semantic conventions. It represents the full + // [hash value (see glossary)], of the built attestation. Some envelopes in the + // [software attestation space] also refer to this as the **digest**. + // + // Type: string + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: "1b31dfcd5b7f9267bf2ff47651df1cfb9147b9e4df1f335accf65b4cda498408" + // + // [hash value (see glossary)]: https://nvlpubs.nist.gov/nistpubs/FIPS/NIST.FIPS.186-5.pdf + // [software attestation space]: https://github.com/in-toto/attestation/tree/main/spec + ArtifactAttestationHashKey = attribute.Key("artifact.attestation.hash") + + // ArtifactAttestationIDKey is the attribute Key conforming to the + // "artifact.attestation.id" semantic conventions. It represents the id of the + // build [software attestation]. + // + // Type: string + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: "123" + // + // [software attestation]: https://slsa.dev/attestation-model + ArtifactAttestationIDKey = attribute.Key("artifact.attestation.id") + + // ArtifactFilenameKey is the attribute Key conforming to the + // "artifact.filename" semantic conventions. It represents the human readable + // file name of the artifact, typically generated during build and release + // processes. Often includes the package name and version in the file name. + // + // Type: string + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: "golang-binary-amd64-v0.1.0", "docker-image-amd64-v0.1.0", + // "release-1.tar.gz", "file-name-package.tar.gz" + // Note: This file name can also act as the [Package Name] + // in cases where the package ecosystem maps accordingly. + // Additionally, the artifact [can be published] + // for others, but that is not a guarantee. + // + // [Package Name]: https://slsa.dev/spec/v1.0/terminology#package-model + // [can be published]: https://slsa.dev/spec/v1.0/terminology#software-supply-chain + ArtifactFilenameKey = attribute.Key("artifact.filename") + + // ArtifactHashKey is the attribute Key conforming to the "artifact.hash" + // semantic conventions. It represents the full [hash value (see glossary)], + // often found in checksum.txt on a release of the artifact and used to verify + // package integrity. + // + // Type: string + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: "9ff4c52759e2c4ac70b7d517bc7fcdc1cda631ca0045271ddd1b192544f8a3e9" + // Note: The specific algorithm used to create the cryptographic hash value is + // not defined. In situations where an artifact has multiple + // cryptographic hashes, it is up to the implementer to choose which + // hash value to set here; this should be the most secure hash algorithm + // that is suitable for the situation and consistent with the + // corresponding attestation. The implementer can then provide the other + // hash values through an additional set of attribute extensions as they + // deem necessary. + // + // [hash value (see glossary)]: https://nvlpubs.nist.gov/nistpubs/FIPS/NIST.FIPS.186-5.pdf + ArtifactHashKey = attribute.Key("artifact.hash") + + // ArtifactPurlKey is the attribute Key conforming to the "artifact.purl" + // semantic conventions. It represents the [Package URL] of the + // [package artifact] provides a standard way to identify and locate the + // packaged artifact. + // + // Type: string + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: "pkg:github/package-url/purl-spec@1209109710924", + // "pkg:npm/foo@12.12.3" + // + // [Package URL]: https://github.com/package-url/purl-spec + // [package artifact]: https://slsa.dev/spec/v1.0/terminology#package-model + ArtifactPurlKey = attribute.Key("artifact.purl") + + // ArtifactVersionKey is the attribute Key conforming to the "artifact.version" + // semantic conventions. It represents the version of the artifact. + // + // Type: string + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: "v0.1.0", "1.2.1", "122691-build" + ArtifactVersionKey = attribute.Key("artifact.version") +) + +// ArtifactAttestationFilename returns an attribute KeyValue conforming to the +// "artifact.attestation.filename" semantic conventions. It represents the +// provenance filename of the built attestation which directly relates to the +// build artifact filename. This filename SHOULD accompany the artifact at +// publish time. See the [SLSA Relationship] specification for more information. +// +// [SLSA Relationship]: https://slsa.dev/spec/v1.0/distributing-provenance#relationship-between-artifacts-and-attestations +func ArtifactAttestationFilename(val string) attribute.KeyValue { + return ArtifactAttestationFilenameKey.String(val) +} + +// ArtifactAttestationHash returns an attribute KeyValue conforming to the +// "artifact.attestation.hash" semantic conventions. It represents the full +// [hash value (see glossary)], of the built attestation. Some envelopes in the +// [software attestation space] also refer to this as the **digest**. +// +// [hash value (see glossary)]: https://nvlpubs.nist.gov/nistpubs/FIPS/NIST.FIPS.186-5.pdf +// [software attestation space]: https://github.com/in-toto/attestation/tree/main/spec +func ArtifactAttestationHash(val string) attribute.KeyValue { + return ArtifactAttestationHashKey.String(val) +} + +// ArtifactAttestationID returns an attribute KeyValue conforming to the +// "artifact.attestation.id" semantic conventions. It represents the id of the +// build [software attestation]. +// +// [software attestation]: https://slsa.dev/attestation-model +func ArtifactAttestationID(val string) attribute.KeyValue { + return ArtifactAttestationIDKey.String(val) +} + +// ArtifactFilename returns an attribute KeyValue conforming to the +// "artifact.filename" semantic conventions. It represents the human readable +// file name of the artifact, typically generated during build and release +// processes. Often includes the package name and version in the file name. +func ArtifactFilename(val string) attribute.KeyValue { + return ArtifactFilenameKey.String(val) +} + +// ArtifactHash returns an attribute KeyValue conforming to the "artifact.hash" +// semantic conventions. It represents the full [hash value (see glossary)], +// often found in checksum.txt on a release of the artifact and used to verify +// package integrity. +// +// [hash value (see glossary)]: https://nvlpubs.nist.gov/nistpubs/FIPS/NIST.FIPS.186-5.pdf +func ArtifactHash(val string) attribute.KeyValue { + return ArtifactHashKey.String(val) +} + +// ArtifactPurl returns an attribute KeyValue conforming to the "artifact.purl" +// semantic conventions. It represents the [Package URL] of the +// [package artifact] provides a standard way to identify and locate the packaged +// artifact. +// +// [Package URL]: https://github.com/package-url/purl-spec +// [package artifact]: https://slsa.dev/spec/v1.0/terminology#package-model +func ArtifactPurl(val string) attribute.KeyValue { + return ArtifactPurlKey.String(val) +} + +// ArtifactVersion returns an attribute KeyValue conforming to the +// "artifact.version" semantic conventions. It represents the version of the +// artifact. +func ArtifactVersion(val string) attribute.KeyValue { + return ArtifactVersionKey.String(val) +} + +// Namespace: aws +const ( + // AWSBedrockGuardrailIDKey is the attribute Key conforming to the + // "aws.bedrock.guardrail.id" semantic conventions. It represents the unique + // identifier of the AWS Bedrock Guardrail. A [guardrail] helps safeguard and + // prevent unwanted behavior from model responses or user messages. + // + // Type: string + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: "sgi5gkybzqak" + // + // [guardrail]: https://docs.aws.amazon.com/bedrock/latest/userguide/guardrails.html + AWSBedrockGuardrailIDKey = attribute.Key("aws.bedrock.guardrail.id") + + // AWSBedrockKnowledgeBaseIDKey is the attribute Key conforming to the + // "aws.bedrock.knowledge_base.id" semantic conventions. It represents the + // unique identifier of the AWS Bedrock Knowledge base. A [knowledge base] is a + // bank of information that can be queried by models to generate more relevant + // responses and augment prompts. + // + // Type: string + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: "XFWUPB9PAW" + // + // [knowledge base]: https://docs.aws.amazon.com/bedrock/latest/userguide/knowledge-base.html + AWSBedrockKnowledgeBaseIDKey = attribute.Key("aws.bedrock.knowledge_base.id") + + // AWSDynamoDBAttributeDefinitionsKey is the attribute Key conforming to the + // "aws.dynamodb.attribute_definitions" semantic conventions. It represents the + // JSON-serialized value of each item in the `AttributeDefinitions` request + // field. + // + // Type: string[] + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: "{ "AttributeName": "string", "AttributeType": "string" }" + AWSDynamoDBAttributeDefinitionsKey = attribute.Key("aws.dynamodb.attribute_definitions") + + // AWSDynamoDBAttributesToGetKey is the attribute Key conforming to the + // "aws.dynamodb.attributes_to_get" semantic conventions. It represents the + // value of the `AttributesToGet` request parameter. + // + // Type: string[] + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: "lives", "id" + AWSDynamoDBAttributesToGetKey = attribute.Key("aws.dynamodb.attributes_to_get") + + // AWSDynamoDBConsistentReadKey is the attribute Key conforming to the + // "aws.dynamodb.consistent_read" semantic conventions. It represents the value + // of the `ConsistentRead` request parameter. + // + // Type: boolean + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: + AWSDynamoDBConsistentReadKey = attribute.Key("aws.dynamodb.consistent_read") + + // AWSDynamoDBConsumedCapacityKey is the attribute Key conforming to the + // "aws.dynamodb.consumed_capacity" semantic conventions. It represents the + // JSON-serialized value of each item in the `ConsumedCapacity` response field. + // + // Type: string[] + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: "{ "CapacityUnits": number, "GlobalSecondaryIndexes": { "string" : + // { "CapacityUnits": number, "ReadCapacityUnits": number, "WriteCapacityUnits": + // number } }, "LocalSecondaryIndexes": { "string" : { "CapacityUnits": number, + // "ReadCapacityUnits": number, "WriteCapacityUnits": number } }, + // "ReadCapacityUnits": number, "Table": { "CapacityUnits": number, + // "ReadCapacityUnits": number, "WriteCapacityUnits": number }, "TableName": + // "string", "WriteCapacityUnits": number }" + AWSDynamoDBConsumedCapacityKey = attribute.Key("aws.dynamodb.consumed_capacity") + + // AWSDynamoDBCountKey is the attribute Key conforming to the + // "aws.dynamodb.count" semantic conventions. It represents the value of the + // `Count` response parameter. + // + // Type: int + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: 10 + AWSDynamoDBCountKey = attribute.Key("aws.dynamodb.count") + + // AWSDynamoDBExclusiveStartTableKey is the attribute Key conforming to the + // "aws.dynamodb.exclusive_start_table" semantic conventions. It represents the + // value of the `ExclusiveStartTableName` request parameter. + // + // Type: string + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: "Users", "CatsTable" + AWSDynamoDBExclusiveStartTableKey = attribute.Key("aws.dynamodb.exclusive_start_table") + + // AWSDynamoDBGlobalSecondaryIndexUpdatesKey is the attribute Key conforming to + // the "aws.dynamodb.global_secondary_index_updates" semantic conventions. It + // represents the JSON-serialized value of each item in the + // `GlobalSecondaryIndexUpdates` request field. + // + // Type: string[] + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: "{ "Create": { "IndexName": "string", "KeySchema": [ { + // "AttributeName": "string", "KeyType": "string" } ], "Projection": { + // "NonKeyAttributes": [ "string" ], "ProjectionType": "string" }, + // "ProvisionedThroughput": { "ReadCapacityUnits": number, "WriteCapacityUnits": + // number } }" + AWSDynamoDBGlobalSecondaryIndexUpdatesKey = attribute.Key("aws.dynamodb.global_secondary_index_updates") + + // AWSDynamoDBGlobalSecondaryIndexesKey is the attribute Key conforming to the + // "aws.dynamodb.global_secondary_indexes" semantic conventions. It represents + // the JSON-serialized value of each item of the `GlobalSecondaryIndexes` + // request field. + // + // Type: string[] + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: "{ "IndexName": "string", "KeySchema": [ { "AttributeName": + // "string", "KeyType": "string" } ], "Projection": { "NonKeyAttributes": [ + // "string" ], "ProjectionType": "string" }, "ProvisionedThroughput": { + // "ReadCapacityUnits": number, "WriteCapacityUnits": number } }" + AWSDynamoDBGlobalSecondaryIndexesKey = attribute.Key("aws.dynamodb.global_secondary_indexes") + + // AWSDynamoDBIndexNameKey is the attribute Key conforming to the + // "aws.dynamodb.index_name" semantic conventions. It represents the value of + // the `IndexName` request parameter. + // + // Type: string + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: "name_to_group" + AWSDynamoDBIndexNameKey = attribute.Key("aws.dynamodb.index_name") + + // AWSDynamoDBItemCollectionMetricsKey is the attribute Key conforming to the + // "aws.dynamodb.item_collection_metrics" semantic conventions. It represents + // the JSON-serialized value of the `ItemCollectionMetrics` response field. + // + // Type: string + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: "{ "string" : [ { "ItemCollectionKey": { "string" : { "B": blob, + // "BOOL": boolean, "BS": [ blob ], "L": [ "AttributeValue" ], "M": { "string" : + // "AttributeValue" }, "N": "string", "NS": [ "string" ], "NULL": boolean, "S": + // "string", "SS": [ "string" ] } }, "SizeEstimateRangeGB": [ number ] } ] }" + AWSDynamoDBItemCollectionMetricsKey = attribute.Key("aws.dynamodb.item_collection_metrics") + + // AWSDynamoDBLimitKey is the attribute Key conforming to the + // "aws.dynamodb.limit" semantic conventions. It represents the value of the + // `Limit` request parameter. + // + // Type: int + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: 10 + AWSDynamoDBLimitKey = attribute.Key("aws.dynamodb.limit") + + // AWSDynamoDBLocalSecondaryIndexesKey is the attribute Key conforming to the + // "aws.dynamodb.local_secondary_indexes" semantic conventions. It represents + // the JSON-serialized value of each item of the `LocalSecondaryIndexes` request + // field. + // + // Type: string[] + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: "{ "IndexArn": "string", "IndexName": "string", "IndexSizeBytes": + // number, "ItemCount": number, "KeySchema": [ { "AttributeName": "string", + // "KeyType": "string" } ], "Projection": { "NonKeyAttributes": [ "string" ], + // "ProjectionType": "string" } }" + AWSDynamoDBLocalSecondaryIndexesKey = attribute.Key("aws.dynamodb.local_secondary_indexes") + + // AWSDynamoDBProjectionKey is the attribute Key conforming to the + // "aws.dynamodb.projection" semantic conventions. It represents the value of + // the `ProjectionExpression` request parameter. + // + // Type: string + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: "Title", "Title, Price, Color", "Title, Description, RelatedItems, + // ProductReviews" + AWSDynamoDBProjectionKey = attribute.Key("aws.dynamodb.projection") + + // AWSDynamoDBProvisionedReadCapacityKey is the attribute Key conforming to the + // "aws.dynamodb.provisioned_read_capacity" semantic conventions. It represents + // the value of the `ProvisionedThroughput.ReadCapacityUnits` request parameter. + // + // Type: double + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: 1.0, 2.0 + AWSDynamoDBProvisionedReadCapacityKey = attribute.Key("aws.dynamodb.provisioned_read_capacity") + + // AWSDynamoDBProvisionedWriteCapacityKey is the attribute Key conforming to the + // "aws.dynamodb.provisioned_write_capacity" semantic conventions. It represents + // the value of the `ProvisionedThroughput.WriteCapacityUnits` request + // parameter. + // + // Type: double + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: 1.0, 2.0 + AWSDynamoDBProvisionedWriteCapacityKey = attribute.Key("aws.dynamodb.provisioned_write_capacity") + + // AWSDynamoDBScanForwardKey is the attribute Key conforming to the + // "aws.dynamodb.scan_forward" semantic conventions. It represents the value of + // the `ScanIndexForward` request parameter. + // + // Type: boolean + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: + AWSDynamoDBScanForwardKey = attribute.Key("aws.dynamodb.scan_forward") + + // AWSDynamoDBScannedCountKey is the attribute Key conforming to the + // "aws.dynamodb.scanned_count" semantic conventions. It represents the value of + // the `ScannedCount` response parameter. + // + // Type: int + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: 50 + AWSDynamoDBScannedCountKey = attribute.Key("aws.dynamodb.scanned_count") + + // AWSDynamoDBSegmentKey is the attribute Key conforming to the + // "aws.dynamodb.segment" semantic conventions. It represents the value of the + // `Segment` request parameter. + // + // Type: int + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: 10 + AWSDynamoDBSegmentKey = attribute.Key("aws.dynamodb.segment") + + // AWSDynamoDBSelectKey is the attribute Key conforming to the + // "aws.dynamodb.select" semantic conventions. It represents the value of the + // `Select` request parameter. + // + // Type: string + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: "ALL_ATTRIBUTES", "COUNT" + AWSDynamoDBSelectKey = attribute.Key("aws.dynamodb.select") + + // AWSDynamoDBTableCountKey is the attribute Key conforming to the + // "aws.dynamodb.table_count" semantic conventions. It represents the number of + // items in the `TableNames` response parameter. + // + // Type: int + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: 20 + AWSDynamoDBTableCountKey = attribute.Key("aws.dynamodb.table_count") + + // AWSDynamoDBTableNamesKey is the attribute Key conforming to the + // "aws.dynamodb.table_names" semantic conventions. It represents the keys in + // the `RequestItems` object field. + // + // Type: string[] + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: "Users", "Cats" + AWSDynamoDBTableNamesKey = attribute.Key("aws.dynamodb.table_names") + + // AWSDynamoDBTotalSegmentsKey is the attribute Key conforming to the + // "aws.dynamodb.total_segments" semantic conventions. It represents the value + // of the `TotalSegments` request parameter. + // + // Type: int + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: 100 + AWSDynamoDBTotalSegmentsKey = attribute.Key("aws.dynamodb.total_segments") + + // AWSECSClusterARNKey is the attribute Key conforming to the + // "aws.ecs.cluster.arn" semantic conventions. It represents the ARN of an + // [ECS cluster]. + // + // Type: string + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: "arn:aws:ecs:us-west-2:123456789123:cluster/my-cluster" + // + // [ECS cluster]: https://docs.aws.amazon.com/AmazonECS/latest/developerguide/clusters.html + AWSECSClusterARNKey = attribute.Key("aws.ecs.cluster.arn") + + // AWSECSContainerARNKey is the attribute Key conforming to the + // "aws.ecs.container.arn" semantic conventions. It represents the Amazon + // Resource Name (ARN) of an [ECS container instance]. + // + // Type: string + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: + // "arn:aws:ecs:us-west-1:123456789123:container/32624152-9086-4f0e-acae-1a75b14fe4d9" + // + // [ECS container instance]: https://docs.aws.amazon.com/AmazonECS/latest/developerguide/ECS_instances.html + AWSECSContainerARNKey = attribute.Key("aws.ecs.container.arn") + + // AWSECSLaunchtypeKey is the attribute Key conforming to the + // "aws.ecs.launchtype" semantic conventions. It represents the [launch type] + // for an ECS task. + // + // Type: Enum + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: + // + // [launch type]: https://docs.aws.amazon.com/AmazonECS/latest/developerguide/launch_types.html + AWSECSLaunchtypeKey = attribute.Key("aws.ecs.launchtype") + + // AWSECSTaskARNKey is the attribute Key conforming to the "aws.ecs.task.arn" + // semantic conventions. It represents the ARN of a running [ECS task]. + // + // Type: string + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: + // "arn:aws:ecs:us-west-1:123456789123:task/10838bed-421f-43ef-870a-f43feacbbb5b", + // "arn:aws:ecs:us-west-1:123456789123:task/my-cluster/task-id/23ebb8ac-c18f-46c6-8bbe-d55d0e37cfbd" + // + // [ECS task]: https://docs.aws.amazon.com/AmazonECS/latest/developerguide/ecs-account-settings.html#ecs-resource-ids + AWSECSTaskARNKey = attribute.Key("aws.ecs.task.arn") + + // AWSECSTaskFamilyKey is the attribute Key conforming to the + // "aws.ecs.task.family" semantic conventions. It represents the family name of + // the [ECS task definition] used to create the ECS task. + // + // Type: string + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: "opentelemetry-family" + // + // [ECS task definition]: https://docs.aws.amazon.com/AmazonECS/latest/developerguide/task_definitions.html + AWSECSTaskFamilyKey = attribute.Key("aws.ecs.task.family") + + // AWSECSTaskIDKey is the attribute Key conforming to the "aws.ecs.task.id" + // semantic conventions. It represents the ID of a running ECS task. The ID MUST + // be extracted from `task.arn`. + // + // Type: string + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: "10838bed-421f-43ef-870a-f43feacbbb5b", + // "23ebb8ac-c18f-46c6-8bbe-d55d0e37cfbd" + AWSECSTaskIDKey = attribute.Key("aws.ecs.task.id") + + // AWSECSTaskRevisionKey is the attribute Key conforming to the + // "aws.ecs.task.revision" semantic conventions. It represents the revision for + // the task definition used to create the ECS task. + // + // Type: string + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: "8", "26" + AWSECSTaskRevisionKey = attribute.Key("aws.ecs.task.revision") + + // AWSEKSClusterARNKey is the attribute Key conforming to the + // "aws.eks.cluster.arn" semantic conventions. It represents the ARN of an EKS + // cluster. + // + // Type: string + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: "arn:aws:ecs:us-west-2:123456789123:cluster/my-cluster" + AWSEKSClusterARNKey = attribute.Key("aws.eks.cluster.arn") + + // AWSExtendedRequestIDKey is the attribute Key conforming to the + // "aws.extended_request_id" semantic conventions. It represents the AWS + // extended request ID as returned in the response header `x-amz-id-2`. + // + // Type: string + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: + // "wzHcyEWfmOGDIE5QOhTAqFDoDWP3y8IUvpNINCwL9N4TEHbUw0/gZJ+VZTmCNCWR7fezEN3eCiQ=" + AWSExtendedRequestIDKey = attribute.Key("aws.extended_request_id") + + // AWSKinesisStreamNameKey is the attribute Key conforming to the + // "aws.kinesis.stream_name" semantic conventions. It represents the name of the + // AWS Kinesis [stream] the request refers to. Corresponds to the + // `--stream-name` parameter of the Kinesis [describe-stream] operation. + // + // Type: string + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: "some-stream-name" + // + // [stream]: https://docs.aws.amazon.com/streams/latest/dev/introduction.html + // [describe-stream]: https://docs.aws.amazon.com/cli/latest/reference/kinesis/describe-stream.html + AWSKinesisStreamNameKey = attribute.Key("aws.kinesis.stream_name") + + // AWSLambdaInvokedARNKey is the attribute Key conforming to the + // "aws.lambda.invoked_arn" semantic conventions. It represents the full invoked + // ARN as provided on the `Context` passed to the function ( + // `Lambda-Runtime-Invoked-Function-Arn` header on the + // `/runtime/invocation/next` applicable). + // + // Type: string + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: "arn:aws:lambda:us-east-1:123456:function:myfunction:myalias" + // Note: This may be different from `cloud.resource_id` if an alias is involved. + AWSLambdaInvokedARNKey = attribute.Key("aws.lambda.invoked_arn") + + // AWSLambdaResourceMappingIDKey is the attribute Key conforming to the + // "aws.lambda.resource_mapping.id" semantic conventions. It represents the UUID + // of the [AWS Lambda EvenSource Mapping]. An event source is mapped to a lambda + // function. It's contents are read by Lambda and used to trigger a function. + // This isn't available in the lambda execution context or the lambda runtime + // environtment. This is going to be populated by the AWS SDK for each language + // when that UUID is present. Some of these operations are + // Create/Delete/Get/List/Update EventSourceMapping. + // + // Type: string + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: "587ad24b-03b9-4413-8202-bbd56b36e5b7" + // + // [AWS Lambda EvenSource Mapping]: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-lambda-eventsourcemapping.html + AWSLambdaResourceMappingIDKey = attribute.Key("aws.lambda.resource_mapping.id") + + // AWSLogGroupARNsKey is the attribute Key conforming to the + // "aws.log.group.arns" semantic conventions. It represents the Amazon Resource + // Name(s) (ARN) of the AWS log group(s). + // + // Type: string[] + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: "arn:aws:logs:us-west-1:123456789012:log-group:/aws/my/group:*" + // Note: See the [log group ARN format documentation]. + // + // [log group ARN format documentation]: https://docs.aws.amazon.com/AmazonCloudWatch/latest/logs/iam-access-control-overview-cwl.html#CWL_ARN_Format + AWSLogGroupARNsKey = attribute.Key("aws.log.group.arns") + + // AWSLogGroupNamesKey is the attribute Key conforming to the + // "aws.log.group.names" semantic conventions. It represents the name(s) of the + // AWS log group(s) an application is writing to. + // + // Type: string[] + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: "/aws/lambda/my-function", "opentelemetry-service" + // Note: Multiple log groups must be supported for cases like multi-container + // applications, where a single application has sidecar containers, and each + // write to their own log group. + AWSLogGroupNamesKey = attribute.Key("aws.log.group.names") + + // AWSLogStreamARNsKey is the attribute Key conforming to the + // "aws.log.stream.arns" semantic conventions. It represents the ARN(s) of the + // AWS log stream(s). + // + // Type: string[] + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: + // "arn:aws:logs:us-west-1:123456789012:log-group:/aws/my/group:log-stream:logs/main/10838bed-421f-43ef-870a-f43feacbbb5b" + // Note: See the [log stream ARN format documentation]. One log group can + // contain several log streams, so these ARNs necessarily identify both a log + // group and a log stream. + // + // [log stream ARN format documentation]: https://docs.aws.amazon.com/AmazonCloudWatch/latest/logs/iam-access-control-overview-cwl.html#CWL_ARN_Format + AWSLogStreamARNsKey = attribute.Key("aws.log.stream.arns") + + // AWSLogStreamNamesKey is the attribute Key conforming to the + // "aws.log.stream.names" semantic conventions. It represents the name(s) of the + // AWS log stream(s) an application is writing to. + // + // Type: string[] + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: "logs/main/10838bed-421f-43ef-870a-f43feacbbb5b" + AWSLogStreamNamesKey = attribute.Key("aws.log.stream.names") + + // AWSRequestIDKey is the attribute Key conforming to the "aws.request_id" + // semantic conventions. It represents the AWS request ID as returned in the + // response headers `x-amzn-requestid`, `x-amzn-request-id` or + // `x-amz-request-id`. + // + // Type: string + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: "79b9da39-b7ae-508a-a6bc-864b2829c622", "C9ER4AJX75574TDJ" + AWSRequestIDKey = attribute.Key("aws.request_id") + + // AWSS3BucketKey is the attribute Key conforming to the "aws.s3.bucket" + // semantic conventions. It represents the S3 bucket name the request refers to. + // Corresponds to the `--bucket` parameter of the [S3 API] operations. + // + // Type: string + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: "some-bucket-name" + // Note: The `bucket` attribute is applicable to all S3 operations that + // reference a bucket, i.e. that require the bucket name as a mandatory + // parameter. + // This applies to almost all S3 operations except `list-buckets`. + // + // [S3 API]: https://docs.aws.amazon.com/cli/latest/reference/s3api/index.html + AWSS3BucketKey = attribute.Key("aws.s3.bucket") + + // AWSS3CopySourceKey is the attribute Key conforming to the + // "aws.s3.copy_source" semantic conventions. It represents the source object + // (in the form `bucket`/`key`) for the copy operation. + // + // Type: string + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: "someFile.yml" + // Note: The `copy_source` attribute applies to S3 copy operations and + // corresponds to the `--copy-source` parameter + // of the [copy-object operation within the S3 API]. + // This applies in particular to the following operations: + // + // - [copy-object] + // - [upload-part-copy] + // + // + // [copy-object operation within the S3 API]: https://docs.aws.amazon.com/cli/latest/reference/s3api/copy-object.html + // [copy-object]: https://docs.aws.amazon.com/cli/latest/reference/s3api/copy-object.html + // [upload-part-copy]: https://docs.aws.amazon.com/cli/latest/reference/s3api/upload-part-copy.html + AWSS3CopySourceKey = attribute.Key("aws.s3.copy_source") + + // AWSS3DeleteKey is the attribute Key conforming to the "aws.s3.delete" + // semantic conventions. It represents the delete request container that + // specifies the objects to be deleted. + // + // Type: string + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: + // "Objects=[{Key=string,VersionId=string},{Key=string,VersionId=string}],Quiet=boolean" + // Note: The `delete` attribute is only applicable to the [delete-object] + // operation. + // The `delete` attribute corresponds to the `--delete` parameter of the + // [delete-objects operation within the S3 API]. + // + // [delete-object]: https://docs.aws.amazon.com/cli/latest/reference/s3api/delete-object.html + // [delete-objects operation within the S3 API]: https://docs.aws.amazon.com/cli/latest/reference/s3api/delete-objects.html + AWSS3DeleteKey = attribute.Key("aws.s3.delete") + + // AWSS3KeyKey is the attribute Key conforming to the "aws.s3.key" semantic + // conventions. It represents the S3 object key the request refers to. + // Corresponds to the `--key` parameter of the [S3 API] operations. + // + // Type: string + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: "someFile.yml" + // Note: The `key` attribute is applicable to all object-related S3 operations, + // i.e. that require the object key as a mandatory parameter. + // This applies in particular to the following operations: + // + // - [copy-object] + // - [delete-object] + // - [get-object] + // - [head-object] + // - [put-object] + // - [restore-object] + // - [select-object-content] + // - [abort-multipart-upload] + // - [complete-multipart-upload] + // - [create-multipart-upload] + // - [list-parts] + // - [upload-part] + // - [upload-part-copy] + // + // + // [S3 API]: https://docs.aws.amazon.com/cli/latest/reference/s3api/index.html + // [copy-object]: https://docs.aws.amazon.com/cli/latest/reference/s3api/copy-object.html + // [delete-object]: https://docs.aws.amazon.com/cli/latest/reference/s3api/delete-object.html + // [get-object]: https://docs.aws.amazon.com/cli/latest/reference/s3api/get-object.html + // [head-object]: https://docs.aws.amazon.com/cli/latest/reference/s3api/head-object.html + // [put-object]: https://docs.aws.amazon.com/cli/latest/reference/s3api/put-object.html + // [restore-object]: https://docs.aws.amazon.com/cli/latest/reference/s3api/restore-object.html + // [select-object-content]: https://docs.aws.amazon.com/cli/latest/reference/s3api/select-object-content.html + // [abort-multipart-upload]: https://docs.aws.amazon.com/cli/latest/reference/s3api/abort-multipart-upload.html + // [complete-multipart-upload]: https://docs.aws.amazon.com/cli/latest/reference/s3api/complete-multipart-upload.html + // [create-multipart-upload]: https://docs.aws.amazon.com/cli/latest/reference/s3api/create-multipart-upload.html + // [list-parts]: https://docs.aws.amazon.com/cli/latest/reference/s3api/list-parts.html + // [upload-part]: https://docs.aws.amazon.com/cli/latest/reference/s3api/upload-part.html + // [upload-part-copy]: https://docs.aws.amazon.com/cli/latest/reference/s3api/upload-part-copy.html + AWSS3KeyKey = attribute.Key("aws.s3.key") + + // AWSS3PartNumberKey is the attribute Key conforming to the + // "aws.s3.part_number" semantic conventions. It represents the part number of + // the part being uploaded in a multipart-upload operation. This is a positive + // integer between 1 and 10,000. + // + // Type: int + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: 3456 + // Note: The `part_number` attribute is only applicable to the [upload-part] + // and [upload-part-copy] operations. + // The `part_number` attribute corresponds to the `--part-number` parameter of + // the + // [upload-part operation within the S3 API]. + // + // [upload-part]: https://docs.aws.amazon.com/cli/latest/reference/s3api/upload-part.html + // [upload-part-copy]: https://docs.aws.amazon.com/cli/latest/reference/s3api/upload-part-copy.html + // [upload-part operation within the S3 API]: https://docs.aws.amazon.com/cli/latest/reference/s3api/upload-part.html + AWSS3PartNumberKey = attribute.Key("aws.s3.part_number") + + // AWSS3UploadIDKey is the attribute Key conforming to the "aws.s3.upload_id" + // semantic conventions. It represents the upload ID that identifies the + // multipart upload. + // + // Type: string + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: "dfRtDYWFbkRONycy.Yxwh66Yjlx.cph0gtNBtJ" + // Note: The `upload_id` attribute applies to S3 multipart-upload operations and + // corresponds to the `--upload-id` parameter + // of the [S3 API] multipart operations. + // This applies in particular to the following operations: + // + // - [abort-multipart-upload] + // - [complete-multipart-upload] + // - [list-parts] + // - [upload-part] + // - [upload-part-copy] + // + // + // [S3 API]: https://docs.aws.amazon.com/cli/latest/reference/s3api/index.html + // [abort-multipart-upload]: https://docs.aws.amazon.com/cli/latest/reference/s3api/abort-multipart-upload.html + // [complete-multipart-upload]: https://docs.aws.amazon.com/cli/latest/reference/s3api/complete-multipart-upload.html + // [list-parts]: https://docs.aws.amazon.com/cli/latest/reference/s3api/list-parts.html + // [upload-part]: https://docs.aws.amazon.com/cli/latest/reference/s3api/upload-part.html + // [upload-part-copy]: https://docs.aws.amazon.com/cli/latest/reference/s3api/upload-part-copy.html + AWSS3UploadIDKey = attribute.Key("aws.s3.upload_id") + + // AWSSecretsmanagerSecretARNKey is the attribute Key conforming to the + // "aws.secretsmanager.secret.arn" semantic conventions. It represents the ARN + // of the Secret stored in the Secrets Mangger. + // + // Type: string + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: + // "arn:aws:secretsmanager:us-east-1:123456789012:secret:SecretName-6RandomCharacters" + AWSSecretsmanagerSecretARNKey = attribute.Key("aws.secretsmanager.secret.arn") + + // AWSSNSTopicARNKey is the attribute Key conforming to the "aws.sns.topic.arn" + // semantic conventions. It represents the ARN of the AWS SNS Topic. An Amazon + // SNS [topic] is a logical access point that acts as a communication channel. + // + // Type: string + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: "arn:aws:sns:us-east-1:123456789012:mystack-mytopic-NZJ5JSMVGFIE" + // + // [topic]: https://docs.aws.amazon.com/sns/latest/dg/sns-create-topic.html + AWSSNSTopicARNKey = attribute.Key("aws.sns.topic.arn") + + // AWSSQSQueueURLKey is the attribute Key conforming to the "aws.sqs.queue.url" + // semantic conventions. It represents the URL of the AWS SQS Queue. It's a + // unique identifier for a queue in Amazon Simple Queue Service (SQS) and is + // used to access the queue and perform actions on it. + // + // Type: string + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: "https://sqs.us-east-1.amazonaws.com/123456789012/MyQueue" + AWSSQSQueueURLKey = attribute.Key("aws.sqs.queue.url") + + // AWSStepFunctionsActivityARNKey is the attribute Key conforming to the + // "aws.step_functions.activity.arn" semantic conventions. It represents the ARN + // of the AWS Step Functions Activity. + // + // Type: string + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: "arn:aws:states:us-east-1:123456789012:activity:get-greeting" + AWSStepFunctionsActivityARNKey = attribute.Key("aws.step_functions.activity.arn") + + // AWSStepFunctionsStateMachineARNKey is the attribute Key conforming to the + // "aws.step_functions.state_machine.arn" semantic conventions. It represents + // the ARN of the AWS Step Functions State Machine. + // + // Type: string + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: + // "arn:aws:states:us-east-1:123456789012:stateMachine:myStateMachine:1" + AWSStepFunctionsStateMachineARNKey = attribute.Key("aws.step_functions.state_machine.arn") +) + +// AWSBedrockGuardrailID returns an attribute KeyValue conforming to the +// "aws.bedrock.guardrail.id" semantic conventions. It represents the unique +// identifier of the AWS Bedrock Guardrail. A [guardrail] helps safeguard and +// prevent unwanted behavior from model responses or user messages. +// +// [guardrail]: https://docs.aws.amazon.com/bedrock/latest/userguide/guardrails.html +func AWSBedrockGuardrailID(val string) attribute.KeyValue { + return AWSBedrockGuardrailIDKey.String(val) +} + +// AWSBedrockKnowledgeBaseID returns an attribute KeyValue conforming to the +// "aws.bedrock.knowledge_base.id" semantic conventions. It represents the unique +// identifier of the AWS Bedrock Knowledge base. A [knowledge base] is a bank of +// information that can be queried by models to generate more relevant responses +// and augment prompts. +// +// [knowledge base]: https://docs.aws.amazon.com/bedrock/latest/userguide/knowledge-base.html +func AWSBedrockKnowledgeBaseID(val string) attribute.KeyValue { + return AWSBedrockKnowledgeBaseIDKey.String(val) +} + +// AWSDynamoDBAttributeDefinitions returns an attribute KeyValue conforming to +// the "aws.dynamodb.attribute_definitions" semantic conventions. It represents +// the JSON-serialized value of each item in the `AttributeDefinitions` request +// field. +func AWSDynamoDBAttributeDefinitions(val ...string) attribute.KeyValue { + return AWSDynamoDBAttributeDefinitionsKey.StringSlice(val) +} + +// AWSDynamoDBAttributesToGet returns an attribute KeyValue conforming to the +// "aws.dynamodb.attributes_to_get" semantic conventions. It represents the value +// of the `AttributesToGet` request parameter. +func AWSDynamoDBAttributesToGet(val ...string) attribute.KeyValue { + return AWSDynamoDBAttributesToGetKey.StringSlice(val) +} + +// AWSDynamoDBConsistentRead returns an attribute KeyValue conforming to the +// "aws.dynamodb.consistent_read" semantic conventions. It represents the value +// of the `ConsistentRead` request parameter. +func AWSDynamoDBConsistentRead(val bool) attribute.KeyValue { + return AWSDynamoDBConsistentReadKey.Bool(val) +} + +// AWSDynamoDBConsumedCapacity returns an attribute KeyValue conforming to the +// "aws.dynamodb.consumed_capacity" semantic conventions. It represents the +// JSON-serialized value of each item in the `ConsumedCapacity` response field. +func AWSDynamoDBConsumedCapacity(val ...string) attribute.KeyValue { + return AWSDynamoDBConsumedCapacityKey.StringSlice(val) +} + +// AWSDynamoDBCount returns an attribute KeyValue conforming to the +// "aws.dynamodb.count" semantic conventions. It represents the value of the +// `Count` response parameter. +func AWSDynamoDBCount(val int) attribute.KeyValue { + return AWSDynamoDBCountKey.Int(val) +} + +// AWSDynamoDBExclusiveStartTable returns an attribute KeyValue conforming to the +// "aws.dynamodb.exclusive_start_table" semantic conventions. It represents the +// value of the `ExclusiveStartTableName` request parameter. +func AWSDynamoDBExclusiveStartTable(val string) attribute.KeyValue { + return AWSDynamoDBExclusiveStartTableKey.String(val) +} + +// AWSDynamoDBGlobalSecondaryIndexUpdates returns an attribute KeyValue +// conforming to the "aws.dynamodb.global_secondary_index_updates" semantic +// conventions. It represents the JSON-serialized value of each item in the +// `GlobalSecondaryIndexUpdates` request field. +func AWSDynamoDBGlobalSecondaryIndexUpdates(val ...string) attribute.KeyValue { + return AWSDynamoDBGlobalSecondaryIndexUpdatesKey.StringSlice(val) +} + +// AWSDynamoDBGlobalSecondaryIndexes returns an attribute KeyValue conforming to +// the "aws.dynamodb.global_secondary_indexes" semantic conventions. It +// represents the JSON-serialized value of each item of the +// `GlobalSecondaryIndexes` request field. +func AWSDynamoDBGlobalSecondaryIndexes(val ...string) attribute.KeyValue { + return AWSDynamoDBGlobalSecondaryIndexesKey.StringSlice(val) +} + +// AWSDynamoDBIndexName returns an attribute KeyValue conforming to the +// "aws.dynamodb.index_name" semantic conventions. It represents the value of the +// `IndexName` request parameter. +func AWSDynamoDBIndexName(val string) attribute.KeyValue { + return AWSDynamoDBIndexNameKey.String(val) +} + +// AWSDynamoDBItemCollectionMetrics returns an attribute KeyValue conforming to +// the "aws.dynamodb.item_collection_metrics" semantic conventions. It represents +// the JSON-serialized value of the `ItemCollectionMetrics` response field. +func AWSDynamoDBItemCollectionMetrics(val string) attribute.KeyValue { + return AWSDynamoDBItemCollectionMetricsKey.String(val) +} + +// AWSDynamoDBLimit returns an attribute KeyValue conforming to the +// "aws.dynamodb.limit" semantic conventions. It represents the value of the +// `Limit` request parameter. +func AWSDynamoDBLimit(val int) attribute.KeyValue { + return AWSDynamoDBLimitKey.Int(val) +} + +// AWSDynamoDBLocalSecondaryIndexes returns an attribute KeyValue conforming to +// the "aws.dynamodb.local_secondary_indexes" semantic conventions. It represents +// the JSON-serialized value of each item of the `LocalSecondaryIndexes` request +// field. +func AWSDynamoDBLocalSecondaryIndexes(val ...string) attribute.KeyValue { + return AWSDynamoDBLocalSecondaryIndexesKey.StringSlice(val) +} + +// AWSDynamoDBProjection returns an attribute KeyValue conforming to the +// "aws.dynamodb.projection" semantic conventions. It represents the value of the +// `ProjectionExpression` request parameter. +func AWSDynamoDBProjection(val string) attribute.KeyValue { + return AWSDynamoDBProjectionKey.String(val) +} + +// AWSDynamoDBProvisionedReadCapacity returns an attribute KeyValue conforming to +// the "aws.dynamodb.provisioned_read_capacity" semantic conventions. It +// represents the value of the `ProvisionedThroughput.ReadCapacityUnits` request +// parameter. +func AWSDynamoDBProvisionedReadCapacity(val float64) attribute.KeyValue { + return AWSDynamoDBProvisionedReadCapacityKey.Float64(val) +} + +// AWSDynamoDBProvisionedWriteCapacity returns an attribute KeyValue conforming +// to the "aws.dynamodb.provisioned_write_capacity" semantic conventions. It +// represents the value of the `ProvisionedThroughput.WriteCapacityUnits` request +// parameter. +func AWSDynamoDBProvisionedWriteCapacity(val float64) attribute.KeyValue { + return AWSDynamoDBProvisionedWriteCapacityKey.Float64(val) +} + +// AWSDynamoDBScanForward returns an attribute KeyValue conforming to the +// "aws.dynamodb.scan_forward" semantic conventions. It represents the value of +// the `ScanIndexForward` request parameter. +func AWSDynamoDBScanForward(val bool) attribute.KeyValue { + return AWSDynamoDBScanForwardKey.Bool(val) +} + +// AWSDynamoDBScannedCount returns an attribute KeyValue conforming to the +// "aws.dynamodb.scanned_count" semantic conventions. It represents the value of +// the `ScannedCount` response parameter. +func AWSDynamoDBScannedCount(val int) attribute.KeyValue { + return AWSDynamoDBScannedCountKey.Int(val) +} + +// AWSDynamoDBSegment returns an attribute KeyValue conforming to the +// "aws.dynamodb.segment" semantic conventions. It represents the value of the +// `Segment` request parameter. +func AWSDynamoDBSegment(val int) attribute.KeyValue { + return AWSDynamoDBSegmentKey.Int(val) +} + +// AWSDynamoDBSelect returns an attribute KeyValue conforming to the +// "aws.dynamodb.select" semantic conventions. It represents the value of the +// `Select` request parameter. +func AWSDynamoDBSelect(val string) attribute.KeyValue { + return AWSDynamoDBSelectKey.String(val) +} + +// AWSDynamoDBTableCount returns an attribute KeyValue conforming to the +// "aws.dynamodb.table_count" semantic conventions. It represents the number of +// items in the `TableNames` response parameter. +func AWSDynamoDBTableCount(val int) attribute.KeyValue { + return AWSDynamoDBTableCountKey.Int(val) +} + +// AWSDynamoDBTableNames returns an attribute KeyValue conforming to the +// "aws.dynamodb.table_names" semantic conventions. It represents the keys in the +// `RequestItems` object field. +func AWSDynamoDBTableNames(val ...string) attribute.KeyValue { + return AWSDynamoDBTableNamesKey.StringSlice(val) +} + +// AWSDynamoDBTotalSegments returns an attribute KeyValue conforming to the +// "aws.dynamodb.total_segments" semantic conventions. It represents the value of +// the `TotalSegments` request parameter. +func AWSDynamoDBTotalSegments(val int) attribute.KeyValue { + return AWSDynamoDBTotalSegmentsKey.Int(val) +} + +// AWSECSClusterARN returns an attribute KeyValue conforming to the +// "aws.ecs.cluster.arn" semantic conventions. It represents the ARN of an +// [ECS cluster]. +// +// [ECS cluster]: https://docs.aws.amazon.com/AmazonECS/latest/developerguide/clusters.html +func AWSECSClusterARN(val string) attribute.KeyValue { + return AWSECSClusterARNKey.String(val) +} + +// AWSECSContainerARN returns an attribute KeyValue conforming to the +// "aws.ecs.container.arn" semantic conventions. It represents the Amazon +// Resource Name (ARN) of an [ECS container instance]. +// +// [ECS container instance]: https://docs.aws.amazon.com/AmazonECS/latest/developerguide/ECS_instances.html +func AWSECSContainerARN(val string) attribute.KeyValue { + return AWSECSContainerARNKey.String(val) +} + +// AWSECSTaskARN returns an attribute KeyValue conforming to the +// "aws.ecs.task.arn" semantic conventions. It represents the ARN of a running +// [ECS task]. +// +// [ECS task]: https://docs.aws.amazon.com/AmazonECS/latest/developerguide/ecs-account-settings.html#ecs-resource-ids +func AWSECSTaskARN(val string) attribute.KeyValue { + return AWSECSTaskARNKey.String(val) +} + +// AWSECSTaskFamily returns an attribute KeyValue conforming to the +// "aws.ecs.task.family" semantic conventions. It represents the family name of +// the [ECS task definition] used to create the ECS task. +// +// [ECS task definition]: https://docs.aws.amazon.com/AmazonECS/latest/developerguide/task_definitions.html +func AWSECSTaskFamily(val string) attribute.KeyValue { + return AWSECSTaskFamilyKey.String(val) +} + +// AWSECSTaskID returns an attribute KeyValue conforming to the "aws.ecs.task.id" +// semantic conventions. It represents the ID of a running ECS task. The ID MUST +// be extracted from `task.arn`. +func AWSECSTaskID(val string) attribute.KeyValue { + return AWSECSTaskIDKey.String(val) +} + +// AWSECSTaskRevision returns an attribute KeyValue conforming to the +// "aws.ecs.task.revision" semantic conventions. It represents the revision for +// the task definition used to create the ECS task. +func AWSECSTaskRevision(val string) attribute.KeyValue { + return AWSECSTaskRevisionKey.String(val) +} + +// AWSEKSClusterARN returns an attribute KeyValue conforming to the +// "aws.eks.cluster.arn" semantic conventions. It represents the ARN of an EKS +// cluster. +func AWSEKSClusterARN(val string) attribute.KeyValue { + return AWSEKSClusterARNKey.String(val) +} + +// AWSExtendedRequestID returns an attribute KeyValue conforming to the +// "aws.extended_request_id" semantic conventions. It represents the AWS extended +// request ID as returned in the response header `x-amz-id-2`. +func AWSExtendedRequestID(val string) attribute.KeyValue { + return AWSExtendedRequestIDKey.String(val) +} + +// AWSKinesisStreamName returns an attribute KeyValue conforming to the +// "aws.kinesis.stream_name" semantic conventions. It represents the name of the +// AWS Kinesis [stream] the request refers to. Corresponds to the `--stream-name` +// parameter of the Kinesis [describe-stream] operation. +// +// [stream]: https://docs.aws.amazon.com/streams/latest/dev/introduction.html +// [describe-stream]: https://docs.aws.amazon.com/cli/latest/reference/kinesis/describe-stream.html +func AWSKinesisStreamName(val string) attribute.KeyValue { + return AWSKinesisStreamNameKey.String(val) +} + +// AWSLambdaInvokedARN returns an attribute KeyValue conforming to the +// "aws.lambda.invoked_arn" semantic conventions. It represents the full invoked +// ARN as provided on the `Context` passed to the function ( +// `Lambda-Runtime-Invoked-Function-Arn` header on the `/runtime/invocation/next` +// applicable). +func AWSLambdaInvokedARN(val string) attribute.KeyValue { + return AWSLambdaInvokedARNKey.String(val) +} + +// AWSLambdaResourceMappingID returns an attribute KeyValue conforming to the +// "aws.lambda.resource_mapping.id" semantic conventions. It represents the UUID +// of the [AWS Lambda EvenSource Mapping]. An event source is mapped to a lambda +// function. It's contents are read by Lambda and used to trigger a function. +// This isn't available in the lambda execution context or the lambda runtime +// environtment. This is going to be populated by the AWS SDK for each language +// when that UUID is present. Some of these operations are +// Create/Delete/Get/List/Update EventSourceMapping. +// +// [AWS Lambda EvenSource Mapping]: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-lambda-eventsourcemapping.html +func AWSLambdaResourceMappingID(val string) attribute.KeyValue { + return AWSLambdaResourceMappingIDKey.String(val) +} + +// AWSLogGroupARNs returns an attribute KeyValue conforming to the +// "aws.log.group.arns" semantic conventions. It represents the Amazon Resource +// Name(s) (ARN) of the AWS log group(s). +func AWSLogGroupARNs(val ...string) attribute.KeyValue { + return AWSLogGroupARNsKey.StringSlice(val) +} + +// AWSLogGroupNames returns an attribute KeyValue conforming to the +// "aws.log.group.names" semantic conventions. It represents the name(s) of the +// AWS log group(s) an application is writing to. +func AWSLogGroupNames(val ...string) attribute.KeyValue { + return AWSLogGroupNamesKey.StringSlice(val) +} + +// AWSLogStreamARNs returns an attribute KeyValue conforming to the +// "aws.log.stream.arns" semantic conventions. It represents the ARN(s) of the +// AWS log stream(s). +func AWSLogStreamARNs(val ...string) attribute.KeyValue { + return AWSLogStreamARNsKey.StringSlice(val) +} + +// AWSLogStreamNames returns an attribute KeyValue conforming to the +// "aws.log.stream.names" semantic conventions. It represents the name(s) of the +// AWS log stream(s) an application is writing to. +func AWSLogStreamNames(val ...string) attribute.KeyValue { + return AWSLogStreamNamesKey.StringSlice(val) +} + +// AWSRequestID returns an attribute KeyValue conforming to the "aws.request_id" +// semantic conventions. It represents the AWS request ID as returned in the +// response headers `x-amzn-requestid`, `x-amzn-request-id` or `x-amz-request-id` +// . +func AWSRequestID(val string) attribute.KeyValue { + return AWSRequestIDKey.String(val) +} + +// AWSS3Bucket returns an attribute KeyValue conforming to the "aws.s3.bucket" +// semantic conventions. It represents the S3 bucket name the request refers to. +// Corresponds to the `--bucket` parameter of the [S3 API] operations. +// +// [S3 API]: https://docs.aws.amazon.com/cli/latest/reference/s3api/index.html +func AWSS3Bucket(val string) attribute.KeyValue { + return AWSS3BucketKey.String(val) +} + +// AWSS3CopySource returns an attribute KeyValue conforming to the +// "aws.s3.copy_source" semantic conventions. It represents the source object (in +// the form `bucket`/`key`) for the copy operation. +func AWSS3CopySource(val string) attribute.KeyValue { + return AWSS3CopySourceKey.String(val) +} + +// AWSS3Delete returns an attribute KeyValue conforming to the "aws.s3.delete" +// semantic conventions. It represents the delete request container that +// specifies the objects to be deleted. +func AWSS3Delete(val string) attribute.KeyValue { + return AWSS3DeleteKey.String(val) +} + +// AWSS3Key returns an attribute KeyValue conforming to the "aws.s3.key" semantic +// conventions. It represents the S3 object key the request refers to. +// Corresponds to the `--key` parameter of the [S3 API] operations. +// +// [S3 API]: https://docs.aws.amazon.com/cli/latest/reference/s3api/index.html +func AWSS3Key(val string) attribute.KeyValue { + return AWSS3KeyKey.String(val) +} + +// AWSS3PartNumber returns an attribute KeyValue conforming to the +// "aws.s3.part_number" semantic conventions. It represents the part number of +// the part being uploaded in a multipart-upload operation. This is a positive +// integer between 1 and 10,000. +func AWSS3PartNumber(val int) attribute.KeyValue { + return AWSS3PartNumberKey.Int(val) +} + +// AWSS3UploadID returns an attribute KeyValue conforming to the +// "aws.s3.upload_id" semantic conventions. It represents the upload ID that +// identifies the multipart upload. +func AWSS3UploadID(val string) attribute.KeyValue { + return AWSS3UploadIDKey.String(val) +} + +// AWSSecretsmanagerSecretARN returns an attribute KeyValue conforming to the +// "aws.secretsmanager.secret.arn" semantic conventions. It represents the ARN of +// the Secret stored in the Secrets Mangger. +func AWSSecretsmanagerSecretARN(val string) attribute.KeyValue { + return AWSSecretsmanagerSecretARNKey.String(val) +} + +// AWSSNSTopicARN returns an attribute KeyValue conforming to the +// "aws.sns.topic.arn" semantic conventions. It represents the ARN of the AWS SNS +// Topic. An Amazon SNS [topic] is a logical access point that acts as a +// communication channel. +// +// [topic]: https://docs.aws.amazon.com/sns/latest/dg/sns-create-topic.html +func AWSSNSTopicARN(val string) attribute.KeyValue { + return AWSSNSTopicARNKey.String(val) +} + +// AWSSQSQueueURL returns an attribute KeyValue conforming to the +// "aws.sqs.queue.url" semantic conventions. It represents the URL of the AWS SQS +// Queue. It's a unique identifier for a queue in Amazon Simple Queue Service +// (SQS) and is used to access the queue and perform actions on it. +func AWSSQSQueueURL(val string) attribute.KeyValue { + return AWSSQSQueueURLKey.String(val) +} + +// AWSStepFunctionsActivityARN returns an attribute KeyValue conforming to the +// "aws.step_functions.activity.arn" semantic conventions. It represents the ARN +// of the AWS Step Functions Activity. +func AWSStepFunctionsActivityARN(val string) attribute.KeyValue { + return AWSStepFunctionsActivityARNKey.String(val) +} + +// AWSStepFunctionsStateMachineARN returns an attribute KeyValue conforming to +// the "aws.step_functions.state_machine.arn" semantic conventions. It represents +// the ARN of the AWS Step Functions State Machine. +func AWSStepFunctionsStateMachineARN(val string) attribute.KeyValue { + return AWSStepFunctionsStateMachineARNKey.String(val) +} + +// Enum values for aws.ecs.launchtype +var ( + // Amazon EC2 + // Stability: development + AWSECSLaunchtypeEC2 = AWSECSLaunchtypeKey.String("ec2") + // Amazon Fargate + // Stability: development + AWSECSLaunchtypeFargate = AWSECSLaunchtypeKey.String("fargate") +) + +// Namespace: azure +const ( + // AzureClientIDKey is the attribute Key conforming to the "azure.client.id" + // semantic conventions. It represents the unique identifier of the client + // instance. + // + // Type: string + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: "3ba4827d-4422-483f-b59f-85b74211c11d", "storage-client-1" + AzureClientIDKey = attribute.Key("azure.client.id") + + // AzureCosmosDBConnectionModeKey is the attribute Key conforming to the + // "azure.cosmosdb.connection.mode" semantic conventions. It represents the + // cosmos client connection mode. + // + // Type: Enum + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: + AzureCosmosDBConnectionModeKey = attribute.Key("azure.cosmosdb.connection.mode") + + // AzureCosmosDBConsistencyLevelKey is the attribute Key conforming to the + // "azure.cosmosdb.consistency.level" semantic conventions. It represents the + // account or request [consistency level]. + // + // Type: Enum + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: "Eventual", "ConsistentPrefix", "BoundedStaleness", "Strong", + // "Session" + // + // [consistency level]: https://learn.microsoft.com/azure/cosmos-db/consistency-levels + AzureCosmosDBConsistencyLevelKey = attribute.Key("azure.cosmosdb.consistency.level") + + // AzureCosmosDBOperationContactedRegionsKey is the attribute Key conforming to + // the "azure.cosmosdb.operation.contacted_regions" semantic conventions. It + // represents the list of regions contacted during operation in the order that + // they were contacted. If there is more than one region listed, it indicates + // that the operation was performed on multiple regions i.e. cross-regional + // call. + // + // Type: string[] + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: "North Central US", "Australia East", "Australia Southeast" + // Note: Region name matches the format of `displayName` in [Azure Location API] + // + // [Azure Location API]: https://learn.microsoft.com/rest/api/resources/subscriptions/list-locations + AzureCosmosDBOperationContactedRegionsKey = attribute.Key("azure.cosmosdb.operation.contacted_regions") + + // AzureCosmosDBOperationRequestChargeKey is the attribute Key conforming to the + // "azure.cosmosdb.operation.request_charge" semantic conventions. It represents + // the number of request units consumed by the operation. + // + // Type: double + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: 46.18, 1.0 + AzureCosmosDBOperationRequestChargeKey = attribute.Key("azure.cosmosdb.operation.request_charge") + + // AzureCosmosDBRequestBodySizeKey is the attribute Key conforming to the + // "azure.cosmosdb.request.body.size" semantic conventions. It represents the + // request payload size in bytes. + // + // Type: int + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: + AzureCosmosDBRequestBodySizeKey = attribute.Key("azure.cosmosdb.request.body.size") + + // AzureCosmosDBResponseSubStatusCodeKey is the attribute Key conforming to the + // "azure.cosmosdb.response.sub_status_code" semantic conventions. It represents + // the cosmos DB sub status code. + // + // Type: int + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: 1000, 1002 + AzureCosmosDBResponseSubStatusCodeKey = attribute.Key("azure.cosmosdb.response.sub_status_code") + + // AzureResourceProviderNamespaceKey is the attribute Key conforming to the + // "azure.resource_provider.namespace" semantic conventions. It represents the + // [Azure Resource Provider Namespace] as recognized by the client. + // + // Type: string + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: "Microsoft.Storage", "Microsoft.KeyVault", "Microsoft.ServiceBus" + // + // [Azure Resource Provider Namespace]: https://learn.microsoft.com/azure/azure-resource-manager/management/azure-services-resource-providers + AzureResourceProviderNamespaceKey = attribute.Key("azure.resource_provider.namespace") + + // AzureServiceRequestIDKey is the attribute Key conforming to the + // "azure.service.request.id" semantic conventions. It represents the unique + // identifier of the service request. It's generated by the Azure service and + // returned with the response. + // + // Type: string + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: "00000000-0000-0000-0000-000000000000" + AzureServiceRequestIDKey = attribute.Key("azure.service.request.id") +) + +// AzureClientID returns an attribute KeyValue conforming to the +// "azure.client.id" semantic conventions. It represents the unique identifier of +// the client instance. +func AzureClientID(val string) attribute.KeyValue { + return AzureClientIDKey.String(val) +} + +// AzureCosmosDBOperationContactedRegions returns an attribute KeyValue +// conforming to the "azure.cosmosdb.operation.contacted_regions" semantic +// conventions. It represents the list of regions contacted during operation in +// the order that they were contacted. If there is more than one region listed, +// it indicates that the operation was performed on multiple regions i.e. +// cross-regional call. +func AzureCosmosDBOperationContactedRegions(val ...string) attribute.KeyValue { + return AzureCosmosDBOperationContactedRegionsKey.StringSlice(val) +} + +// AzureCosmosDBOperationRequestCharge returns an attribute KeyValue conforming +// to the "azure.cosmosdb.operation.request_charge" semantic conventions. It +// represents the number of request units consumed by the operation. +func AzureCosmosDBOperationRequestCharge(val float64) attribute.KeyValue { + return AzureCosmosDBOperationRequestChargeKey.Float64(val) +} + +// AzureCosmosDBRequestBodySize returns an attribute KeyValue conforming to the +// "azure.cosmosdb.request.body.size" semantic conventions. It represents the +// request payload size in bytes. +func AzureCosmosDBRequestBodySize(val int) attribute.KeyValue { + return AzureCosmosDBRequestBodySizeKey.Int(val) +} + +// AzureCosmosDBResponseSubStatusCode returns an attribute KeyValue conforming to +// the "azure.cosmosdb.response.sub_status_code" semantic conventions. It +// represents the cosmos DB sub status code. +func AzureCosmosDBResponseSubStatusCode(val int) attribute.KeyValue { + return AzureCosmosDBResponseSubStatusCodeKey.Int(val) +} + +// AzureResourceProviderNamespace returns an attribute KeyValue conforming to the +// "azure.resource_provider.namespace" semantic conventions. It represents the +// [Azure Resource Provider Namespace] as recognized by the client. +// +// [Azure Resource Provider Namespace]: https://learn.microsoft.com/azure/azure-resource-manager/management/azure-services-resource-providers +func AzureResourceProviderNamespace(val string) attribute.KeyValue { + return AzureResourceProviderNamespaceKey.String(val) +} + +// AzureServiceRequestID returns an attribute KeyValue conforming to the +// "azure.service.request.id" semantic conventions. It represents the unique +// identifier of the service request. It's generated by the Azure service and +// returned with the response. +func AzureServiceRequestID(val string) attribute.KeyValue { + return AzureServiceRequestIDKey.String(val) +} + +// Enum values for azure.cosmosdb.connection.mode +var ( + // Gateway (HTTP) connection. + // Stability: development + AzureCosmosDBConnectionModeGateway = AzureCosmosDBConnectionModeKey.String("gateway") + // Direct connection. + // Stability: development + AzureCosmosDBConnectionModeDirect = AzureCosmosDBConnectionModeKey.String("direct") +) + +// Enum values for azure.cosmosdb.consistency.level +var ( + // Strong + // Stability: development + AzureCosmosDBConsistencyLevelStrong = AzureCosmosDBConsistencyLevelKey.String("Strong") + // Bounded Staleness + // Stability: development + AzureCosmosDBConsistencyLevelBoundedStaleness = AzureCosmosDBConsistencyLevelKey.String("BoundedStaleness") + // Session + // Stability: development + AzureCosmosDBConsistencyLevelSession = AzureCosmosDBConsistencyLevelKey.String("Session") + // Eventual + // Stability: development + AzureCosmosDBConsistencyLevelEventual = AzureCosmosDBConsistencyLevelKey.String("Eventual") + // Consistent Prefix + // Stability: development + AzureCosmosDBConsistencyLevelConsistentPrefix = AzureCosmosDBConsistencyLevelKey.String("ConsistentPrefix") +) + +// Namespace: browser +const ( + // BrowserBrandsKey is the attribute Key conforming to the "browser.brands" + // semantic conventions. It represents the array of brand name and version + // separated by a space. + // + // Type: string[] + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: " Not A;Brand 99", "Chromium 99", "Chrome 99" + // Note: This value is intended to be taken from the [UA client hints API] ( + // `navigator.userAgentData.brands`). + // + // [UA client hints API]: https://wicg.github.io/ua-client-hints/#interface + BrowserBrandsKey = attribute.Key("browser.brands") + + // BrowserLanguageKey is the attribute Key conforming to the "browser.language" + // semantic conventions. It represents the preferred language of the user using + // the browser. + // + // Type: string + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: "en", "en-US", "fr", "fr-FR" + // Note: This value is intended to be taken from the Navigator API + // `navigator.language`. + BrowserLanguageKey = attribute.Key("browser.language") + + // BrowserMobileKey is the attribute Key conforming to the "browser.mobile" + // semantic conventions. It represents a boolean that is true if the browser is + // running on a mobile device. + // + // Type: boolean + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: + // Note: This value is intended to be taken from the [UA client hints API] ( + // `navigator.userAgentData.mobile`). If unavailable, this attribute SHOULD be + // left unset. + // + // [UA client hints API]: https://wicg.github.io/ua-client-hints/#interface + BrowserMobileKey = attribute.Key("browser.mobile") + + // BrowserPlatformKey is the attribute Key conforming to the "browser.platform" + // semantic conventions. It represents the platform on which the browser is + // running. + // + // Type: string + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: "Windows", "macOS", "Android" + // Note: This value is intended to be taken from the [UA client hints API] ( + // `navigator.userAgentData.platform`). If unavailable, the legacy + // `navigator.platform` API SHOULD NOT be used instead and this attribute SHOULD + // be left unset in order for the values to be consistent. + // The list of possible values is defined in the + // [W3C User-Agent Client Hints specification]. Note that some (but not all) of + // these values can overlap with values in the + // [`os.type` and `os.name` attributes]. However, for consistency, the values in + // the `browser.platform` attribute should capture the exact value that the user + // agent provides. + // + // [UA client hints API]: https://wicg.github.io/ua-client-hints/#interface + // [W3C User-Agent Client Hints specification]: https://wicg.github.io/ua-client-hints/#sec-ch-ua-platform + // [`os.type` and `os.name` attributes]: ./os.md + BrowserPlatformKey = attribute.Key("browser.platform") +) + +// BrowserBrands returns an attribute KeyValue conforming to the "browser.brands" +// semantic conventions. It represents the array of brand name and version +// separated by a space. +func BrowserBrands(val ...string) attribute.KeyValue { + return BrowserBrandsKey.StringSlice(val) +} + +// BrowserLanguage returns an attribute KeyValue conforming to the +// "browser.language" semantic conventions. It represents the preferred language +// of the user using the browser. +func BrowserLanguage(val string) attribute.KeyValue { + return BrowserLanguageKey.String(val) +} + +// BrowserMobile returns an attribute KeyValue conforming to the "browser.mobile" +// semantic conventions. It represents a boolean that is true if the browser is +// running on a mobile device. +func BrowserMobile(val bool) attribute.KeyValue { + return BrowserMobileKey.Bool(val) +} + +// BrowserPlatform returns an attribute KeyValue conforming to the +// "browser.platform" semantic conventions. It represents the platform on which +// the browser is running. +func BrowserPlatform(val string) attribute.KeyValue { + return BrowserPlatformKey.String(val) +} + +// Namespace: cassandra +const ( + // CassandraConsistencyLevelKey is the attribute Key conforming to the + // "cassandra.consistency.level" semantic conventions. It represents the + // consistency level of the query. Based on consistency values from [CQL]. + // + // Type: Enum + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: + // + // [CQL]: https://docs.datastax.com/en/cassandra-oss/3.0/cassandra/dml/dmlConfigConsistency.html + CassandraConsistencyLevelKey = attribute.Key("cassandra.consistency.level") + + // CassandraCoordinatorDCKey is the attribute Key conforming to the + // "cassandra.coordinator.dc" semantic conventions. It represents the data + // center of the coordinating node for a query. + // + // Type: string + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: us-west-2 + CassandraCoordinatorDCKey = attribute.Key("cassandra.coordinator.dc") + + // CassandraCoordinatorIDKey is the attribute Key conforming to the + // "cassandra.coordinator.id" semantic conventions. It represents the ID of the + // coordinating node for a query. + // + // Type: string + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: be13faa2-8574-4d71-926d-27f16cf8a7af + CassandraCoordinatorIDKey = attribute.Key("cassandra.coordinator.id") + + // CassandraPageSizeKey is the attribute Key conforming to the + // "cassandra.page.size" semantic conventions. It represents the fetch size used + // for paging, i.e. how many rows will be returned at once. + // + // Type: int + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: 5000 + CassandraPageSizeKey = attribute.Key("cassandra.page.size") + + // CassandraQueryIdempotentKey is the attribute Key conforming to the + // "cassandra.query.idempotent" semantic conventions. It represents the whether + // or not the query is idempotent. + // + // Type: boolean + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: + CassandraQueryIdempotentKey = attribute.Key("cassandra.query.idempotent") + + // CassandraSpeculativeExecutionCountKey is the attribute Key conforming to the + // "cassandra.speculative_execution.count" semantic conventions. It represents + // the number of times a query was speculatively executed. Not set or `0` if the + // query was not executed speculatively. + // + // Type: int + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: 0, 2 + CassandraSpeculativeExecutionCountKey = attribute.Key("cassandra.speculative_execution.count") +) + +// CassandraCoordinatorDC returns an attribute KeyValue conforming to the +// "cassandra.coordinator.dc" semantic conventions. It represents the data center +// of the coordinating node for a query. +func CassandraCoordinatorDC(val string) attribute.KeyValue { + return CassandraCoordinatorDCKey.String(val) +} + +// CassandraCoordinatorID returns an attribute KeyValue conforming to the +// "cassandra.coordinator.id" semantic conventions. It represents the ID of the +// coordinating node for a query. +func CassandraCoordinatorID(val string) attribute.KeyValue { + return CassandraCoordinatorIDKey.String(val) +} + +// CassandraPageSize returns an attribute KeyValue conforming to the +// "cassandra.page.size" semantic conventions. It represents the fetch size used +// for paging, i.e. how many rows will be returned at once. +func CassandraPageSize(val int) attribute.KeyValue { + return CassandraPageSizeKey.Int(val) +} + +// CassandraQueryIdempotent returns an attribute KeyValue conforming to the +// "cassandra.query.idempotent" semantic conventions. It represents the whether +// or not the query is idempotent. +func CassandraQueryIdempotent(val bool) attribute.KeyValue { + return CassandraQueryIdempotentKey.Bool(val) +} + +// CassandraSpeculativeExecutionCount returns an attribute KeyValue conforming to +// the "cassandra.speculative_execution.count" semantic conventions. It +// represents the number of times a query was speculatively executed. Not set or +// `0` if the query was not executed speculatively. +func CassandraSpeculativeExecutionCount(val int) attribute.KeyValue { + return CassandraSpeculativeExecutionCountKey.Int(val) +} + +// Enum values for cassandra.consistency.level +var ( + // All + // Stability: development + CassandraConsistencyLevelAll = CassandraConsistencyLevelKey.String("all") + // Each Quorum + // Stability: development + CassandraConsistencyLevelEachQuorum = CassandraConsistencyLevelKey.String("each_quorum") + // Quorum + // Stability: development + CassandraConsistencyLevelQuorum = CassandraConsistencyLevelKey.String("quorum") + // Local Quorum + // Stability: development + CassandraConsistencyLevelLocalQuorum = CassandraConsistencyLevelKey.String("local_quorum") + // One + // Stability: development + CassandraConsistencyLevelOne = CassandraConsistencyLevelKey.String("one") + // Two + // Stability: development + CassandraConsistencyLevelTwo = CassandraConsistencyLevelKey.String("two") + // Three + // Stability: development + CassandraConsistencyLevelThree = CassandraConsistencyLevelKey.String("three") + // Local One + // Stability: development + CassandraConsistencyLevelLocalOne = CassandraConsistencyLevelKey.String("local_one") + // Any + // Stability: development + CassandraConsistencyLevelAny = CassandraConsistencyLevelKey.String("any") + // Serial + // Stability: development + CassandraConsistencyLevelSerial = CassandraConsistencyLevelKey.String("serial") + // Local Serial + // Stability: development + CassandraConsistencyLevelLocalSerial = CassandraConsistencyLevelKey.String("local_serial") +) + +// Namespace: cicd +const ( + // CICDPipelineActionNameKey is the attribute Key conforming to the + // "cicd.pipeline.action.name" semantic conventions. It represents the kind of + // action a pipeline run is performing. + // + // Type: Enum + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: "BUILD", "RUN", "SYNC" + CICDPipelineActionNameKey = attribute.Key("cicd.pipeline.action.name") + + // CICDPipelineNameKey is the attribute Key conforming to the + // "cicd.pipeline.name" semantic conventions. It represents the human readable + // name of the pipeline within a CI/CD system. + // + // Type: string + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: "Build and Test", "Lint", "Deploy Go Project", + // "deploy_to_environment" + CICDPipelineNameKey = attribute.Key("cicd.pipeline.name") + + // CICDPipelineResultKey is the attribute Key conforming to the + // "cicd.pipeline.result" semantic conventions. It represents the result of a + // pipeline run. + // + // Type: Enum + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: "success", "failure", "timeout", "skipped" + CICDPipelineResultKey = attribute.Key("cicd.pipeline.result") + + // CICDPipelineRunIDKey is the attribute Key conforming to the + // "cicd.pipeline.run.id" semantic conventions. It represents the unique + // identifier of a pipeline run within a CI/CD system. + // + // Type: string + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: "120912" + CICDPipelineRunIDKey = attribute.Key("cicd.pipeline.run.id") + + // CICDPipelineRunStateKey is the attribute Key conforming to the + // "cicd.pipeline.run.state" semantic conventions. It represents the pipeline + // run goes through these states during its lifecycle. + // + // Type: Enum + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: "pending", "executing", "finalizing" + CICDPipelineRunStateKey = attribute.Key("cicd.pipeline.run.state") + + // CICDPipelineRunURLFullKey is the attribute Key conforming to the + // "cicd.pipeline.run.url.full" semantic conventions. It represents the [URL] of + // the pipeline run, providing the complete address in order to locate and + // identify the pipeline run. + // + // Type: string + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: + // "https://github.com/open-telemetry/semantic-conventions/actions/runs/9753949763?pr=1075" + // + // [URL]: https://wikipedia.org/wiki/URL + CICDPipelineRunURLFullKey = attribute.Key("cicd.pipeline.run.url.full") + + // CICDPipelineTaskNameKey is the attribute Key conforming to the + // "cicd.pipeline.task.name" semantic conventions. It represents the human + // readable name of a task within a pipeline. Task here most closely aligns with + // a [computing process] in a pipeline. Other terms for tasks include commands, + // steps, and procedures. + // + // Type: string + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: "Run GoLang Linter", "Go Build", "go-test", "deploy_binary" + // + // [computing process]: https://wikipedia.org/wiki/Pipeline_(computing) + CICDPipelineTaskNameKey = attribute.Key("cicd.pipeline.task.name") + + // CICDPipelineTaskRunIDKey is the attribute Key conforming to the + // "cicd.pipeline.task.run.id" semantic conventions. It represents the unique + // identifier of a task run within a pipeline. + // + // Type: string + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: "12097" + CICDPipelineTaskRunIDKey = attribute.Key("cicd.pipeline.task.run.id") + + // CICDPipelineTaskRunResultKey is the attribute Key conforming to the + // "cicd.pipeline.task.run.result" semantic conventions. It represents the + // result of a task run. + // + // Type: Enum + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: "success", "failure", "timeout", "skipped" + CICDPipelineTaskRunResultKey = attribute.Key("cicd.pipeline.task.run.result") + + // CICDPipelineTaskRunURLFullKey is the attribute Key conforming to the + // "cicd.pipeline.task.run.url.full" semantic conventions. It represents the + // [URL] of the pipeline task run, providing the complete address in order to + // locate and identify the pipeline task run. + // + // Type: string + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: + // "https://github.com/open-telemetry/semantic-conventions/actions/runs/9753949763/job/26920038674?pr=1075" + // + // [URL]: https://wikipedia.org/wiki/URL + CICDPipelineTaskRunURLFullKey = attribute.Key("cicd.pipeline.task.run.url.full") + + // CICDPipelineTaskTypeKey is the attribute Key conforming to the + // "cicd.pipeline.task.type" semantic conventions. It represents the type of the + // task within a pipeline. + // + // Type: Enum + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: "build", "test", "deploy" + CICDPipelineTaskTypeKey = attribute.Key("cicd.pipeline.task.type") + + // CICDSystemComponentKey is the attribute Key conforming to the + // "cicd.system.component" semantic conventions. It represents the name of a + // component of the CICD system. + // + // Type: string + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: "controller", "scheduler", "agent" + CICDSystemComponentKey = attribute.Key("cicd.system.component") + + // CICDWorkerIDKey is the attribute Key conforming to the "cicd.worker.id" + // semantic conventions. It represents the unique identifier of a worker within + // a CICD system. + // + // Type: string + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: "abc123", "10.0.1.2", "controller" + CICDWorkerIDKey = attribute.Key("cicd.worker.id") + + // CICDWorkerNameKey is the attribute Key conforming to the "cicd.worker.name" + // semantic conventions. It represents the name of a worker within a CICD + // system. + // + // Type: string + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: "agent-abc", "controller", "Ubuntu LTS" + CICDWorkerNameKey = attribute.Key("cicd.worker.name") + + // CICDWorkerStateKey is the attribute Key conforming to the "cicd.worker.state" + // semantic conventions. It represents the state of a CICD worker / agent. + // + // Type: Enum + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: "idle", "busy", "down" + CICDWorkerStateKey = attribute.Key("cicd.worker.state") + + // CICDWorkerURLFullKey is the attribute Key conforming to the + // "cicd.worker.url.full" semantic conventions. It represents the [URL] of the + // worker, providing the complete address in order to locate and identify the + // worker. + // + // Type: string + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: "https://cicd.example.org/worker/abc123" + // + // [URL]: https://wikipedia.org/wiki/URL + CICDWorkerURLFullKey = attribute.Key("cicd.worker.url.full") +) + +// CICDPipelineName returns an attribute KeyValue conforming to the +// "cicd.pipeline.name" semantic conventions. It represents the human readable +// name of the pipeline within a CI/CD system. +func CICDPipelineName(val string) attribute.KeyValue { + return CICDPipelineNameKey.String(val) +} + +// CICDPipelineRunID returns an attribute KeyValue conforming to the +// "cicd.pipeline.run.id" semantic conventions. It represents the unique +// identifier of a pipeline run within a CI/CD system. +func CICDPipelineRunID(val string) attribute.KeyValue { + return CICDPipelineRunIDKey.String(val) +} + +// CICDPipelineRunURLFull returns an attribute KeyValue conforming to the +// "cicd.pipeline.run.url.full" semantic conventions. It represents the [URL] of +// the pipeline run, providing the complete address in order to locate and +// identify the pipeline run. +// +// [URL]: https://wikipedia.org/wiki/URL +func CICDPipelineRunURLFull(val string) attribute.KeyValue { + return CICDPipelineRunURLFullKey.String(val) +} + +// CICDPipelineTaskName returns an attribute KeyValue conforming to the +// "cicd.pipeline.task.name" semantic conventions. It represents the human +// readable name of a task within a pipeline. Task here most closely aligns with +// a [computing process] in a pipeline. Other terms for tasks include commands, +// steps, and procedures. +// +// [computing process]: https://wikipedia.org/wiki/Pipeline_(computing) +func CICDPipelineTaskName(val string) attribute.KeyValue { + return CICDPipelineTaskNameKey.String(val) +} + +// CICDPipelineTaskRunID returns an attribute KeyValue conforming to the +// "cicd.pipeline.task.run.id" semantic conventions. It represents the unique +// identifier of a task run within a pipeline. +func CICDPipelineTaskRunID(val string) attribute.KeyValue { + return CICDPipelineTaskRunIDKey.String(val) +} + +// CICDPipelineTaskRunURLFull returns an attribute KeyValue conforming to the +// "cicd.pipeline.task.run.url.full" semantic conventions. It represents the +// [URL] of the pipeline task run, providing the complete address in order to +// locate and identify the pipeline task run. +// +// [URL]: https://wikipedia.org/wiki/URL +func CICDPipelineTaskRunURLFull(val string) attribute.KeyValue { + return CICDPipelineTaskRunURLFullKey.String(val) +} + +// CICDSystemComponent returns an attribute KeyValue conforming to the +// "cicd.system.component" semantic conventions. It represents the name of a +// component of the CICD system. +func CICDSystemComponent(val string) attribute.KeyValue { + return CICDSystemComponentKey.String(val) +} + +// CICDWorkerID returns an attribute KeyValue conforming to the "cicd.worker.id" +// semantic conventions. It represents the unique identifier of a worker within a +// CICD system. +func CICDWorkerID(val string) attribute.KeyValue { + return CICDWorkerIDKey.String(val) +} + +// CICDWorkerName returns an attribute KeyValue conforming to the +// "cicd.worker.name" semantic conventions. It represents the name of a worker +// within a CICD system. +func CICDWorkerName(val string) attribute.KeyValue { + return CICDWorkerNameKey.String(val) +} + +// CICDWorkerURLFull returns an attribute KeyValue conforming to the +// "cicd.worker.url.full" semantic conventions. It represents the [URL] of the +// worker, providing the complete address in order to locate and identify the +// worker. +// +// [URL]: https://wikipedia.org/wiki/URL +func CICDWorkerURLFull(val string) attribute.KeyValue { + return CICDWorkerURLFullKey.String(val) +} + +// Enum values for cicd.pipeline.action.name +var ( + // The pipeline run is executing a build. + // Stability: development + CICDPipelineActionNameBuild = CICDPipelineActionNameKey.String("BUILD") + // The pipeline run is executing. + // Stability: development + CICDPipelineActionNameRun = CICDPipelineActionNameKey.String("RUN") + // The pipeline run is executing a sync. + // Stability: development + CICDPipelineActionNameSync = CICDPipelineActionNameKey.String("SYNC") +) + +// Enum values for cicd.pipeline.result +var ( + // The pipeline run finished successfully. + // Stability: development + CICDPipelineResultSuccess = CICDPipelineResultKey.String("success") + // The pipeline run did not finish successfully, eg. due to a compile error or a + // failing test. Such failures are usually detected by non-zero exit codes of + // the tools executed in the pipeline run. + // Stability: development + CICDPipelineResultFailure = CICDPipelineResultKey.String("failure") + // The pipeline run failed due to an error in the CICD system, eg. due to the + // worker being killed. + // Stability: development + CICDPipelineResultError = CICDPipelineResultKey.String("error") + // A timeout caused the pipeline run to be interrupted. + // Stability: development + CICDPipelineResultTimeout = CICDPipelineResultKey.String("timeout") + // The pipeline run was cancelled, eg. by a user manually cancelling the + // pipeline run. + // Stability: development + CICDPipelineResultCancellation = CICDPipelineResultKey.String("cancellation") + // The pipeline run was skipped, eg. due to a precondition not being met. + // Stability: development + CICDPipelineResultSkip = CICDPipelineResultKey.String("skip") +) + +// Enum values for cicd.pipeline.run.state +var ( + // The run pending state spans from the event triggering the pipeline run until + // the execution of the run starts (eg. time spent in a queue, provisioning + // agents, creating run resources). + // + // Stability: development + CICDPipelineRunStatePending = CICDPipelineRunStateKey.String("pending") + // The executing state spans the execution of any run tasks (eg. build, test). + // Stability: development + CICDPipelineRunStateExecuting = CICDPipelineRunStateKey.String("executing") + // The finalizing state spans from when the run has finished executing (eg. + // cleanup of run resources). + // Stability: development + CICDPipelineRunStateFinalizing = CICDPipelineRunStateKey.String("finalizing") +) + +// Enum values for cicd.pipeline.task.run.result +var ( + // The task run finished successfully. + // Stability: development + CICDPipelineTaskRunResultSuccess = CICDPipelineTaskRunResultKey.String("success") + // The task run did not finish successfully, eg. due to a compile error or a + // failing test. Such failures are usually detected by non-zero exit codes of + // the tools executed in the task run. + // Stability: development + CICDPipelineTaskRunResultFailure = CICDPipelineTaskRunResultKey.String("failure") + // The task run failed due to an error in the CICD system, eg. due to the worker + // being killed. + // Stability: development + CICDPipelineTaskRunResultError = CICDPipelineTaskRunResultKey.String("error") + // A timeout caused the task run to be interrupted. + // Stability: development + CICDPipelineTaskRunResultTimeout = CICDPipelineTaskRunResultKey.String("timeout") + // The task run was cancelled, eg. by a user manually cancelling the task run. + // Stability: development + CICDPipelineTaskRunResultCancellation = CICDPipelineTaskRunResultKey.String("cancellation") + // The task run was skipped, eg. due to a precondition not being met. + // Stability: development + CICDPipelineTaskRunResultSkip = CICDPipelineTaskRunResultKey.String("skip") +) + +// Enum values for cicd.pipeline.task.type +var ( + // build + // Stability: development + CICDPipelineTaskTypeBuild = CICDPipelineTaskTypeKey.String("build") + // test + // Stability: development + CICDPipelineTaskTypeTest = CICDPipelineTaskTypeKey.String("test") + // deploy + // Stability: development + CICDPipelineTaskTypeDeploy = CICDPipelineTaskTypeKey.String("deploy") +) + +// Enum values for cicd.worker.state +var ( + // The worker is not performing work for the CICD system. It is available to the + // CICD system to perform work on (online / idle). + // Stability: development + CICDWorkerStateAvailable = CICDWorkerStateKey.String("available") + // The worker is performing work for the CICD system. + // Stability: development + CICDWorkerStateBusy = CICDWorkerStateKey.String("busy") + // The worker is not available to the CICD system (disconnected / down). + // Stability: development + CICDWorkerStateOffline = CICDWorkerStateKey.String("offline") +) + +// Namespace: client +const ( + // ClientAddressKey is the attribute Key conforming to the "client.address" + // semantic conventions. It represents the client address - domain name if + // available without reverse DNS lookup; otherwise, IP address or Unix domain + // socket name. + // + // Type: string + // RequirementLevel: Recommended + // Stability: Stable + // + // Examples: "client.example.com", "10.1.2.80", "/tmp/my.sock" + // Note: When observed from the server side, and when communicating through an + // intermediary, `client.address` SHOULD represent the client address behind any + // intermediaries, for example proxies, if it's available. + ClientAddressKey = attribute.Key("client.address") + + // ClientPortKey is the attribute Key conforming to the "client.port" semantic + // conventions. It represents the client port number. + // + // Type: int + // RequirementLevel: Recommended + // Stability: Stable + // + // Examples: 65123 + // Note: When observed from the server side, and when communicating through an + // intermediary, `client.port` SHOULD represent the client port behind any + // intermediaries, for example proxies, if it's available. + ClientPortKey = attribute.Key("client.port") +) + +// ClientAddress returns an attribute KeyValue conforming to the "client.address" +// semantic conventions. It represents the client address - domain name if +// available without reverse DNS lookup; otherwise, IP address or Unix domain +// socket name. +func ClientAddress(val string) attribute.KeyValue { + return ClientAddressKey.String(val) +} + +// ClientPort returns an attribute KeyValue conforming to the "client.port" +// semantic conventions. It represents the client port number. +func ClientPort(val int) attribute.KeyValue { + return ClientPortKey.Int(val) +} + +// Namespace: cloud +const ( + // CloudAccountIDKey is the attribute Key conforming to the "cloud.account.id" + // semantic conventions. It represents the cloud account ID the resource is + // assigned to. + // + // Type: string + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: "111111111111", "opentelemetry" + CloudAccountIDKey = attribute.Key("cloud.account.id") + + // CloudAvailabilityZoneKey is the attribute Key conforming to the + // "cloud.availability_zone" semantic conventions. It represents the cloud + // regions often have multiple, isolated locations known as zones to increase + // availability. Availability zone represents the zone where the resource is + // running. + // + // Type: string + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: "us-east-1c" + // Note: Availability zones are called "zones" on Alibaba Cloud and Google + // Cloud. + CloudAvailabilityZoneKey = attribute.Key("cloud.availability_zone") + + // CloudPlatformKey is the attribute Key conforming to the "cloud.platform" + // semantic conventions. It represents the cloud platform in use. + // + // Type: Enum + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: + // Note: The prefix of the service SHOULD match the one specified in + // `cloud.provider`. + CloudPlatformKey = attribute.Key("cloud.platform") + + // CloudProviderKey is the attribute Key conforming to the "cloud.provider" + // semantic conventions. It represents the name of the cloud provider. + // + // Type: Enum + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: + CloudProviderKey = attribute.Key("cloud.provider") + + // CloudRegionKey is the attribute Key conforming to the "cloud.region" semantic + // conventions. It represents the geographical region within a cloud provider. + // When associated with a resource, this attribute specifies the region where + // the resource operates. When calling services or APIs deployed on a cloud, + // this attribute identifies the region where the called destination is + // deployed. + // + // Type: string + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: "us-central1", "us-east-1" + // Note: Refer to your provider's docs to see the available regions, for example + // [Alibaba Cloud regions], [AWS regions], [Azure regions], + // [Google Cloud regions], or [Tencent Cloud regions]. + // + // [Alibaba Cloud regions]: https://www.alibabacloud.com/help/doc-detail/40654.htm + // [AWS regions]: https://aws.amazon.com/about-aws/global-infrastructure/regions_az/ + // [Azure regions]: https://azure.microsoft.com/global-infrastructure/geographies/ + // [Google Cloud regions]: https://cloud.google.com/about/locations + // [Tencent Cloud regions]: https://www.tencentcloud.com/document/product/213/6091 + CloudRegionKey = attribute.Key("cloud.region") + + // CloudResourceIDKey is the attribute Key conforming to the "cloud.resource_id" + // semantic conventions. It represents the cloud provider-specific native + // identifier of the monitored cloud resource (e.g. an [ARN] on AWS, a + // [fully qualified resource ID] on Azure, a [full resource name] on GCP). + // + // Type: string + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: "arn:aws:lambda:REGION:ACCOUNT_ID:function:my-function", + // "//run.googleapis.com/projects/PROJECT_ID/locations/LOCATION_ID/services/SERVICE_ID", + // "/subscriptions//resourceGroups/ + // /providers/Microsoft.Web/sites//functions/" + // Note: On some cloud providers, it may not be possible to determine the full + // ID at startup, + // so it may be necessary to set `cloud.resource_id` as a span attribute + // instead. + // + // The exact value to use for `cloud.resource_id` depends on the cloud provider. + // The following well-known definitions MUST be used if you set this attribute + // and they apply: + // + // - **AWS Lambda:** The function [ARN]. + // Take care not to use the "invoked ARN" directly but replace any + // [alias suffix] + // with the resolved function version, as the same runtime instance may be + // invocable with + // multiple different aliases. + // - **GCP:** The [URI of the resource] + // - **Azure:** The [Fully Qualified Resource ID] of the invoked function, + // *not* the function app, having the form + // + // `/subscriptions//resourceGroups//providers/Microsoft.Web/sites//functions/` + // . + // This means that a span attribute MUST be used, as an Azure function app + // can host multiple functions that would usually share + // a TracerProvider. + // + // + // [ARN]: https://docs.aws.amazon.com/general/latest/gr/aws-arns-and-namespaces.html + // [fully qualified resource ID]: https://learn.microsoft.com/rest/api/resources/resources/get-by-id + // [full resource name]: https://google.aip.dev/122#full-resource-names + // [ARN]: https://docs.aws.amazon.com/general/latest/gr/aws-arns-and-namespaces.html + // [alias suffix]: https://docs.aws.amazon.com/lambda/latest/dg/configuration-aliases.html + // [URI of the resource]: https://cloud.google.com/iam/docs/full-resource-names + // [Fully Qualified Resource ID]: https://learn.microsoft.com/rest/api/resources/resources/get-by-id + CloudResourceIDKey = attribute.Key("cloud.resource_id") +) + +// CloudAccountID returns an attribute KeyValue conforming to the +// "cloud.account.id" semantic conventions. It represents the cloud account ID +// the resource is assigned to. +func CloudAccountID(val string) attribute.KeyValue { + return CloudAccountIDKey.String(val) +} + +// CloudAvailabilityZone returns an attribute KeyValue conforming to the +// "cloud.availability_zone" semantic conventions. It represents the cloud +// regions often have multiple, isolated locations known as zones to increase +// availability. Availability zone represents the zone where the resource is +// running. +func CloudAvailabilityZone(val string) attribute.KeyValue { + return CloudAvailabilityZoneKey.String(val) +} + +// CloudRegion returns an attribute KeyValue conforming to the "cloud.region" +// semantic conventions. It represents the geographical region within a cloud +// provider. When associated with a resource, this attribute specifies the region +// where the resource operates. When calling services or APIs deployed on a +// cloud, this attribute identifies the region where the called destination is +// deployed. +func CloudRegion(val string) attribute.KeyValue { + return CloudRegionKey.String(val) +} + +// CloudResourceID returns an attribute KeyValue conforming to the +// "cloud.resource_id" semantic conventions. It represents the cloud +// provider-specific native identifier of the monitored cloud resource (e.g. an +// [ARN] on AWS, a [fully qualified resource ID] on Azure, a [full resource name] +// on GCP). +// +// [ARN]: https://docs.aws.amazon.com/general/latest/gr/aws-arns-and-namespaces.html +// [fully qualified resource ID]: https://learn.microsoft.com/rest/api/resources/resources/get-by-id +// [full resource name]: https://google.aip.dev/122#full-resource-names +func CloudResourceID(val string) attribute.KeyValue { + return CloudResourceIDKey.String(val) +} + +// Enum values for cloud.platform +var ( + // Akamai Cloud Compute + // Stability: development + CloudPlatformAkamaiCloudCompute = CloudPlatformKey.String("akamai_cloud.compute") + // Alibaba Cloud Elastic Compute Service + // Stability: development + CloudPlatformAlibabaCloudECS = CloudPlatformKey.String("alibaba_cloud_ecs") + // Alibaba Cloud Function Compute + // Stability: development + CloudPlatformAlibabaCloudFC = CloudPlatformKey.String("alibaba_cloud_fc") + // Red Hat OpenShift on Alibaba Cloud + // Stability: development + CloudPlatformAlibabaCloudOpenShift = CloudPlatformKey.String("alibaba_cloud_openshift") + // AWS Elastic Compute Cloud + // Stability: development + CloudPlatformAWSEC2 = CloudPlatformKey.String("aws_ec2") + // AWS Elastic Container Service + // Stability: development + CloudPlatformAWSECS = CloudPlatformKey.String("aws_ecs") + // AWS Elastic Kubernetes Service + // Stability: development + CloudPlatformAWSEKS = CloudPlatformKey.String("aws_eks") + // AWS Lambda + // Stability: development + CloudPlatformAWSLambda = CloudPlatformKey.String("aws_lambda") + // AWS Elastic Beanstalk + // Stability: development + CloudPlatformAWSElasticBeanstalk = CloudPlatformKey.String("aws_elastic_beanstalk") + // AWS App Runner + // Stability: development + CloudPlatformAWSAppRunner = CloudPlatformKey.String("aws_app_runner") + // Red Hat OpenShift on AWS (ROSA) + // Stability: development + CloudPlatformAWSOpenShift = CloudPlatformKey.String("aws_openshift") + // Azure Virtual Machines + // Stability: development + CloudPlatformAzureVM = CloudPlatformKey.String("azure.vm") + // Azure Container Apps + // Stability: development + CloudPlatformAzureContainerApps = CloudPlatformKey.String("azure.container_apps") + // Azure Container Instances + // Stability: development + CloudPlatformAzureContainerInstances = CloudPlatformKey.String("azure.container_instances") + // Azure Kubernetes Service + // Stability: development + CloudPlatformAzureAKS = CloudPlatformKey.String("azure.aks") + // Azure Functions + // Stability: development + CloudPlatformAzureFunctions = CloudPlatformKey.String("azure.functions") + // Azure App Service + // Stability: development + CloudPlatformAzureAppService = CloudPlatformKey.String("azure.app_service") + // Azure Red Hat OpenShift + // Stability: development + CloudPlatformAzureOpenShift = CloudPlatformKey.String("azure.openshift") + // Google Vertex AI Agent Engine + // Stability: development + CloudPlatformGCPAgentEngine = CloudPlatformKey.String("gcp.agent_engine") + // Google Bare Metal Solution (BMS) + // Stability: development + CloudPlatformGCPBareMetalSolution = CloudPlatformKey.String("gcp_bare_metal_solution") + // Google Cloud Compute Engine (GCE) + // Stability: development + CloudPlatformGCPComputeEngine = CloudPlatformKey.String("gcp_compute_engine") + // Google Cloud Run + // Stability: development + CloudPlatformGCPCloudRun = CloudPlatformKey.String("gcp_cloud_run") + // Google Cloud Kubernetes Engine (GKE) + // Stability: development + CloudPlatformGCPKubernetesEngine = CloudPlatformKey.String("gcp_kubernetes_engine") + // Google Cloud Functions (GCF) + // Stability: development + CloudPlatformGCPCloudFunctions = CloudPlatformKey.String("gcp_cloud_functions") + // Google Cloud App Engine (GAE) + // Stability: development + CloudPlatformGCPAppEngine = CloudPlatformKey.String("gcp_app_engine") + // Red Hat OpenShift on Google Cloud + // Stability: development + CloudPlatformGCPOpenShift = CloudPlatformKey.String("gcp_openshift") + // Server on Hetzner Cloud + // Stability: development + CloudPlatformHetznerCloudServer = CloudPlatformKey.String("hetzner.cloud_server") + // Red Hat OpenShift on IBM Cloud + // Stability: development + CloudPlatformIBMCloudOpenShift = CloudPlatformKey.String("ibm_cloud_openshift") + // Compute on Oracle Cloud Infrastructure (OCI) + // Stability: development + CloudPlatformOracleCloudCompute = CloudPlatformKey.String("oracle_cloud_compute") + // Kubernetes Engine (OKE) on Oracle Cloud Infrastructure (OCI) + // Stability: development + CloudPlatformOracleCloudOKE = CloudPlatformKey.String("oracle_cloud_oke") + // Tencent Cloud Cloud Virtual Machine (CVM) + // Stability: development + CloudPlatformTencentCloudCVM = CloudPlatformKey.String("tencent_cloud_cvm") + // Tencent Cloud Elastic Kubernetes Service (EKS) + // Stability: development + CloudPlatformTencentCloudEKS = CloudPlatformKey.String("tencent_cloud_eks") + // Tencent Cloud Serverless Cloud Function (SCF) + // Stability: development + CloudPlatformTencentCloudSCF = CloudPlatformKey.String("tencent_cloud_scf") + // Vultr Cloud Compute + // Stability: development + CloudPlatformVultrCloudCompute = CloudPlatformKey.String("vultr.cloud_compute") +) + +// Enum values for cloud.provider +var ( + // Akamai Cloud + // Stability: development + CloudProviderAkamaiCloud = CloudProviderKey.String("akamai_cloud") + // Alibaba Cloud + // Stability: development + CloudProviderAlibabaCloud = CloudProviderKey.String("alibaba_cloud") + // Amazon Web Services + // Stability: development + CloudProviderAWS = CloudProviderKey.String("aws") + // Microsoft Azure + // Stability: development + CloudProviderAzure = CloudProviderKey.String("azure") + // Google Cloud Platform + // Stability: development + CloudProviderGCP = CloudProviderKey.String("gcp") + // Heroku Platform as a Service + // Stability: development + CloudProviderHeroku = CloudProviderKey.String("heroku") + // Hetzner + // Stability: development + CloudProviderHetzner = CloudProviderKey.String("hetzner") + // IBM Cloud + // Stability: development + CloudProviderIBMCloud = CloudProviderKey.String("ibm_cloud") + // Oracle Cloud Infrastructure (OCI) + // Stability: development + CloudProviderOracleCloud = CloudProviderKey.String("oracle_cloud") + // Tencent Cloud + // Stability: development + CloudProviderTencentCloud = CloudProviderKey.String("tencent_cloud") + // Vultr + // Stability: development + CloudProviderVultr = CloudProviderKey.String("vultr") +) + +// Namespace: cloudevents +const ( + // CloudEventsEventIDKey is the attribute Key conforming to the + // "cloudevents.event_id" semantic conventions. It represents the [event_id] + // uniquely identifies the event. + // + // Type: string + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: "123e4567-e89b-12d3-a456-426614174000", "0001" + // + // [event_id]: https://github.com/cloudevents/spec/blob/v1.0.2/cloudevents/spec.md#id + CloudEventsEventIDKey = attribute.Key("cloudevents.event_id") + + // CloudEventsEventSourceKey is the attribute Key conforming to the + // "cloudevents.event_source" semantic conventions. It represents the [source] + // identifies the context in which an event happened. + // + // Type: string + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: "https://github.com/cloudevents", "/cloudevents/spec/pull/123", + // "my-service" + // + // [source]: https://github.com/cloudevents/spec/blob/v1.0.2/cloudevents/spec.md#source-1 + CloudEventsEventSourceKey = attribute.Key("cloudevents.event_source") + + // CloudEventsEventSpecVersionKey is the attribute Key conforming to the + // "cloudevents.event_spec_version" semantic conventions. It represents the + // [version of the CloudEvents specification] which the event uses. + // + // Type: string + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: 1.0 + // + // [version of the CloudEvents specification]: https://github.com/cloudevents/spec/blob/v1.0.2/cloudevents/spec.md#specversion + CloudEventsEventSpecVersionKey = attribute.Key("cloudevents.event_spec_version") + + // CloudEventsEventSubjectKey is the attribute Key conforming to the + // "cloudevents.event_subject" semantic conventions. It represents the [subject] + // of the event in the context of the event producer (identified by source). + // + // Type: string + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: mynewfile.jpg + // + // [subject]: https://github.com/cloudevents/spec/blob/v1.0.2/cloudevents/spec.md#subject + CloudEventsEventSubjectKey = attribute.Key("cloudevents.event_subject") + + // CloudEventsEventTypeKey is the attribute Key conforming to the + // "cloudevents.event_type" semantic conventions. It represents the [event_type] + // contains a value describing the type of event related to the originating + // occurrence. + // + // Type: string + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: "com.github.pull_request.opened", "com.example.object.deleted.v2" + // + // [event_type]: https://github.com/cloudevents/spec/blob/v1.0.2/cloudevents/spec.md#type + CloudEventsEventTypeKey = attribute.Key("cloudevents.event_type") +) + +// CloudEventsEventID returns an attribute KeyValue conforming to the +// "cloudevents.event_id" semantic conventions. It represents the [event_id] +// uniquely identifies the event. +// +// [event_id]: https://github.com/cloudevents/spec/blob/v1.0.2/cloudevents/spec.md#id +func CloudEventsEventID(val string) attribute.KeyValue { + return CloudEventsEventIDKey.String(val) +} + +// CloudEventsEventSource returns an attribute KeyValue conforming to the +// "cloudevents.event_source" semantic conventions. It represents the [source] +// identifies the context in which an event happened. +// +// [source]: https://github.com/cloudevents/spec/blob/v1.0.2/cloudevents/spec.md#source-1 +func CloudEventsEventSource(val string) attribute.KeyValue { + return CloudEventsEventSourceKey.String(val) +} + +// CloudEventsEventSpecVersion returns an attribute KeyValue conforming to the +// "cloudevents.event_spec_version" semantic conventions. It represents the +// [version of the CloudEvents specification] which the event uses. +// +// [version of the CloudEvents specification]: https://github.com/cloudevents/spec/blob/v1.0.2/cloudevents/spec.md#specversion +func CloudEventsEventSpecVersion(val string) attribute.KeyValue { + return CloudEventsEventSpecVersionKey.String(val) +} + +// CloudEventsEventSubject returns an attribute KeyValue conforming to the +// "cloudevents.event_subject" semantic conventions. It represents the [subject] +// of the event in the context of the event producer (identified by source). +// +// [subject]: https://github.com/cloudevents/spec/blob/v1.0.2/cloudevents/spec.md#subject +func CloudEventsEventSubject(val string) attribute.KeyValue { + return CloudEventsEventSubjectKey.String(val) +} + +// CloudEventsEventType returns an attribute KeyValue conforming to the +// "cloudevents.event_type" semantic conventions. It represents the [event_type] +// contains a value describing the type of event related to the originating +// occurrence. +// +// [event_type]: https://github.com/cloudevents/spec/blob/v1.0.2/cloudevents/spec.md#type +func CloudEventsEventType(val string) attribute.KeyValue { + return CloudEventsEventTypeKey.String(val) +} + +// Namespace: cloudfoundry +const ( + // CloudFoundryAppIDKey is the attribute Key conforming to the + // "cloudfoundry.app.id" semantic conventions. It represents the guid of the + // application. + // + // Type: string + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: "218fc5a9-a5f1-4b54-aa05-46717d0ab26d" + // Note: Application instrumentation should use the value from environment + // variable `VCAP_APPLICATION.application_id`. This is the same value as + // reported by `cf app --guid`. + CloudFoundryAppIDKey = attribute.Key("cloudfoundry.app.id") + + // CloudFoundryAppInstanceIDKey is the attribute Key conforming to the + // "cloudfoundry.app.instance.id" semantic conventions. It represents the index + // of the application instance. 0 when just one instance is active. + // + // Type: string + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: "0", "1" + // Note: CloudFoundry defines the `instance_id` in the [Loggregator v2 envelope] + // . + // It is used for logs and metrics emitted by CloudFoundry. It is + // supposed to contain the application instance index for applications + // deployed on the runtime. + // + // Application instrumentation should use the value from environment + // variable `CF_INSTANCE_INDEX`. + // + // [Loggregator v2 envelope]: https://github.com/cloudfoundry/loggregator-api#v2-envelope + CloudFoundryAppInstanceIDKey = attribute.Key("cloudfoundry.app.instance.id") + + // CloudFoundryAppNameKey is the attribute Key conforming to the + // "cloudfoundry.app.name" semantic conventions. It represents the name of the + // application. + // + // Type: string + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: "my-app-name" + // Note: Application instrumentation should use the value from environment + // variable `VCAP_APPLICATION.application_name`. This is the same value + // as reported by `cf apps`. + CloudFoundryAppNameKey = attribute.Key("cloudfoundry.app.name") + + // CloudFoundryOrgIDKey is the attribute Key conforming to the + // "cloudfoundry.org.id" semantic conventions. It represents the guid of the + // CloudFoundry org the application is running in. + // + // Type: string + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: "218fc5a9-a5f1-4b54-aa05-46717d0ab26d" + // Note: Application instrumentation should use the value from environment + // variable `VCAP_APPLICATION.org_id`. This is the same value as + // reported by `cf org --guid`. + CloudFoundryOrgIDKey = attribute.Key("cloudfoundry.org.id") + + // CloudFoundryOrgNameKey is the attribute Key conforming to the + // "cloudfoundry.org.name" semantic conventions. It represents the name of the + // CloudFoundry organization the app is running in. + // + // Type: string + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: "my-org-name" + // Note: Application instrumentation should use the value from environment + // variable `VCAP_APPLICATION.org_name`. This is the same value as + // reported by `cf orgs`. + CloudFoundryOrgNameKey = attribute.Key("cloudfoundry.org.name") + + // CloudFoundryProcessIDKey is the attribute Key conforming to the + // "cloudfoundry.process.id" semantic conventions. It represents the UID + // identifying the process. + // + // Type: string + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: "218fc5a9-a5f1-4b54-aa05-46717d0ab26d" + // Note: Application instrumentation should use the value from environment + // variable `VCAP_APPLICATION.process_id`. It is supposed to be equal to + // `VCAP_APPLICATION.app_id` for applications deployed to the runtime. + // For system components, this could be the actual PID. + CloudFoundryProcessIDKey = attribute.Key("cloudfoundry.process.id") + + // CloudFoundryProcessTypeKey is the attribute Key conforming to the + // "cloudfoundry.process.type" semantic conventions. It represents the type of + // process. + // + // Type: string + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: "web" + // Note: CloudFoundry applications can consist of multiple jobs. Usually the + // main process will be of type `web`. There can be additional background + // tasks or side-cars with different process types. + CloudFoundryProcessTypeKey = attribute.Key("cloudfoundry.process.type") + + // CloudFoundrySpaceIDKey is the attribute Key conforming to the + // "cloudfoundry.space.id" semantic conventions. It represents the guid of the + // CloudFoundry space the application is running in. + // + // Type: string + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: "218fc5a9-a5f1-4b54-aa05-46717d0ab26d" + // Note: Application instrumentation should use the value from environment + // variable `VCAP_APPLICATION.space_id`. This is the same value as + // reported by `cf space --guid`. + CloudFoundrySpaceIDKey = attribute.Key("cloudfoundry.space.id") + + // CloudFoundrySpaceNameKey is the attribute Key conforming to the + // "cloudfoundry.space.name" semantic conventions. It represents the name of the + // CloudFoundry space the application is running in. + // + // Type: string + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: "my-space-name" + // Note: Application instrumentation should use the value from environment + // variable `VCAP_APPLICATION.space_name`. This is the same value as + // reported by `cf spaces`. + CloudFoundrySpaceNameKey = attribute.Key("cloudfoundry.space.name") + + // CloudFoundrySystemIDKey is the attribute Key conforming to the + // "cloudfoundry.system.id" semantic conventions. It represents a guid or + // another name describing the event source. + // + // Type: string + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: "cf/gorouter" + // Note: CloudFoundry defines the `source_id` in the [Loggregator v2 envelope]. + // It is used for logs and metrics emitted by CloudFoundry. It is + // supposed to contain the component name, e.g. "gorouter", for + // CloudFoundry components. + // + // When system components are instrumented, values from the + // [Bosh spec] + // should be used. The `system.id` should be set to + // `spec.deployment/spec.name`. + // + // [Loggregator v2 envelope]: https://github.com/cloudfoundry/loggregator-api#v2-envelope + // [Bosh spec]: https://bosh.io/docs/jobs/#properties-spec + CloudFoundrySystemIDKey = attribute.Key("cloudfoundry.system.id") + + // CloudFoundrySystemInstanceIDKey is the attribute Key conforming to the + // "cloudfoundry.system.instance.id" semantic conventions. It represents a guid + // describing the concrete instance of the event source. + // + // Type: string + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: "218fc5a9-a5f1-4b54-aa05-46717d0ab26d" + // Note: CloudFoundry defines the `instance_id` in the [Loggregator v2 envelope] + // . + // It is used for logs and metrics emitted by CloudFoundry. It is + // supposed to contain the vm id for CloudFoundry components. + // + // When system components are instrumented, values from the + // [Bosh spec] + // should be used. The `system.instance.id` should be set to `spec.id`. + // + // [Loggregator v2 envelope]: https://github.com/cloudfoundry/loggregator-api#v2-envelope + // [Bosh spec]: https://bosh.io/docs/jobs/#properties-spec + CloudFoundrySystemInstanceIDKey = attribute.Key("cloudfoundry.system.instance.id") +) + +// CloudFoundryAppID returns an attribute KeyValue conforming to the +// "cloudfoundry.app.id" semantic conventions. It represents the guid of the +// application. +func CloudFoundryAppID(val string) attribute.KeyValue { + return CloudFoundryAppIDKey.String(val) +} + +// CloudFoundryAppInstanceID returns an attribute KeyValue conforming to the +// "cloudfoundry.app.instance.id" semantic conventions. It represents the index +// of the application instance. 0 when just one instance is active. +func CloudFoundryAppInstanceID(val string) attribute.KeyValue { + return CloudFoundryAppInstanceIDKey.String(val) +} + +// CloudFoundryAppName returns an attribute KeyValue conforming to the +// "cloudfoundry.app.name" semantic conventions. It represents the name of the +// application. +func CloudFoundryAppName(val string) attribute.KeyValue { + return CloudFoundryAppNameKey.String(val) +} + +// CloudFoundryOrgID returns an attribute KeyValue conforming to the +// "cloudfoundry.org.id" semantic conventions. It represents the guid of the +// CloudFoundry org the application is running in. +func CloudFoundryOrgID(val string) attribute.KeyValue { + return CloudFoundryOrgIDKey.String(val) +} + +// CloudFoundryOrgName returns an attribute KeyValue conforming to the +// "cloudfoundry.org.name" semantic conventions. It represents the name of the +// CloudFoundry organization the app is running in. +func CloudFoundryOrgName(val string) attribute.KeyValue { + return CloudFoundryOrgNameKey.String(val) +} + +// CloudFoundryProcessID returns an attribute KeyValue conforming to the +// "cloudfoundry.process.id" semantic conventions. It represents the UID +// identifying the process. +func CloudFoundryProcessID(val string) attribute.KeyValue { + return CloudFoundryProcessIDKey.String(val) +} + +// CloudFoundryProcessType returns an attribute KeyValue conforming to the +// "cloudfoundry.process.type" semantic conventions. It represents the type of +// process. +func CloudFoundryProcessType(val string) attribute.KeyValue { + return CloudFoundryProcessTypeKey.String(val) +} + +// CloudFoundrySpaceID returns an attribute KeyValue conforming to the +// "cloudfoundry.space.id" semantic conventions. It represents the guid of the +// CloudFoundry space the application is running in. +func CloudFoundrySpaceID(val string) attribute.KeyValue { + return CloudFoundrySpaceIDKey.String(val) +} + +// CloudFoundrySpaceName returns an attribute KeyValue conforming to the +// "cloudfoundry.space.name" semantic conventions. It represents the name of the +// CloudFoundry space the application is running in. +func CloudFoundrySpaceName(val string) attribute.KeyValue { + return CloudFoundrySpaceNameKey.String(val) +} + +// CloudFoundrySystemID returns an attribute KeyValue conforming to the +// "cloudfoundry.system.id" semantic conventions. It represents a guid or another +// name describing the event source. +func CloudFoundrySystemID(val string) attribute.KeyValue { + return CloudFoundrySystemIDKey.String(val) +} + +// CloudFoundrySystemInstanceID returns an attribute KeyValue conforming to the +// "cloudfoundry.system.instance.id" semantic conventions. It represents a guid +// describing the concrete instance of the event source. +func CloudFoundrySystemInstanceID(val string) attribute.KeyValue { + return CloudFoundrySystemInstanceIDKey.String(val) +} + +// Namespace: code +const ( + // CodeColumnNumberKey is the attribute Key conforming to the + // "code.column.number" semantic conventions. It represents the column number in + // `code.file.path` best representing the operation. It SHOULD point within the + // code unit named in `code.function.name`. This attribute MUST NOT be used on + // the Profile signal since the data is already captured in 'message Line'. This + // constraint is imposed to prevent redundancy and maintain data integrity. + // + // Type: int + // RequirementLevel: Recommended + // Stability: Stable + CodeColumnNumberKey = attribute.Key("code.column.number") + + // CodeFilePathKey is the attribute Key conforming to the "code.file.path" + // semantic conventions. It represents the source code file name that identifies + // the code unit as uniquely as possible (preferably an absolute file path). + // This attribute MUST NOT be used on the Profile signal since the data is + // already captured in 'message Function'. This constraint is imposed to prevent + // redundancy and maintain data integrity. + // + // Type: string + // RequirementLevel: Recommended + // Stability: Stable + // + // Examples: /usr/local/MyApplication/content_root/app/index.php + CodeFilePathKey = attribute.Key("code.file.path") + + // CodeFunctionNameKey is the attribute Key conforming to the + // "code.function.name" semantic conventions. It represents the method or + // function fully-qualified name without arguments. The value should fit the + // natural representation of the language runtime, which is also likely the same + // used within `code.stacktrace` attribute value. This attribute MUST NOT be + // used on the Profile signal since the data is already captured in 'message + // Function'. This constraint is imposed to prevent redundancy and maintain data + // integrity. + // + // Type: string + // RequirementLevel: Recommended + // Stability: Stable + // + // Examples: "com.example.MyHttpService.serveRequest", + // "GuzzleHttp\Client::transfer", "fopen" + // Note: Values and format depends on each language runtime, thus it is + // impossible to provide an exhaustive list of examples. + // The values are usually the same (or prefixes of) the ones found in native + // stack trace representation stored in + // `code.stacktrace` without information on arguments. + // + // Examples: + // + // - Java method: `com.example.MyHttpService.serveRequest` + // - Java anonymous class method: `com.mycompany.Main$1.myMethod` + // - Java lambda method: + // `com.mycompany.Main$$Lambda/0x0000748ae4149c00.myMethod` + // - PHP function: `GuzzleHttp\Client::transfer` + // - Go function: `github.com/my/repo/pkg.foo.func5` + // - Elixir: `OpenTelemetry.Ctx.new` + // - Erlang: `opentelemetry_ctx:new` + // - Rust: `playground::my_module::my_cool_func` + // - C function: `fopen` + CodeFunctionNameKey = attribute.Key("code.function.name") + + // CodeLineNumberKey is the attribute Key conforming to the "code.line.number" + // semantic conventions. It represents the line number in `code.file.path` best + // representing the operation. It SHOULD point within the code unit named in + // `code.function.name`. This attribute MUST NOT be used on the Profile signal + // since the data is already captured in 'message Line'. This constraint is + // imposed to prevent redundancy and maintain data integrity. + // + // Type: int + // RequirementLevel: Recommended + // Stability: Stable + CodeLineNumberKey = attribute.Key("code.line.number") + + // CodeStacktraceKey is the attribute Key conforming to the "code.stacktrace" + // semantic conventions. It represents a stacktrace as a string in the natural + // representation for the language runtime. The representation is identical to + // [`exception.stacktrace`]. This attribute MUST NOT be used on the Profile + // signal since the data is already captured in 'message Location'. This + // constraint is imposed to prevent redundancy and maintain data integrity. + // + // Type: string + // RequirementLevel: Recommended + // Stability: Stable + // + // Examples: at com.example.GenerateTrace.methodB(GenerateTrace.java:13)\n at + // com.example.GenerateTrace.methodA(GenerateTrace.java:9)\n at + // com.example.GenerateTrace.main(GenerateTrace.java:5) + // + // [`exception.stacktrace`]: /docs/exceptions/exceptions-spans.md#stacktrace-representation + CodeStacktraceKey = attribute.Key("code.stacktrace") +) + +// CodeColumnNumber returns an attribute KeyValue conforming to the +// "code.column.number" semantic conventions. It represents the column number in +// `code.file.path` best representing the operation. It SHOULD point within the +// code unit named in `code.function.name`. This attribute MUST NOT be used on +// the Profile signal since the data is already captured in 'message Line'. This +// constraint is imposed to prevent redundancy and maintain data integrity. +func CodeColumnNumber(val int) attribute.KeyValue { + return CodeColumnNumberKey.Int(val) +} + +// CodeFilePath returns an attribute KeyValue conforming to the "code.file.path" +// semantic conventions. It represents the source code file name that identifies +// the code unit as uniquely as possible (preferably an absolute file path). This +// attribute MUST NOT be used on the Profile signal since the data is already +// captured in 'message Function'. This constraint is imposed to prevent +// redundancy and maintain data integrity. +func CodeFilePath(val string) attribute.KeyValue { + return CodeFilePathKey.String(val) +} + +// CodeFunctionName returns an attribute KeyValue conforming to the +// "code.function.name" semantic conventions. It represents the method or +// function fully-qualified name without arguments. The value should fit the +// natural representation of the language runtime, which is also likely the same +// used within `code.stacktrace` attribute value. This attribute MUST NOT be used +// on the Profile signal since the data is already captured in 'message +// Function'. This constraint is imposed to prevent redundancy and maintain data +// integrity. +func CodeFunctionName(val string) attribute.KeyValue { + return CodeFunctionNameKey.String(val) +} + +// CodeLineNumber returns an attribute KeyValue conforming to the +// "code.line.number" semantic conventions. It represents the line number in +// `code.file.path` best representing the operation. It SHOULD point within the +// code unit named in `code.function.name`. This attribute MUST NOT be used on +// the Profile signal since the data is already captured in 'message Line'. This +// constraint is imposed to prevent redundancy and maintain data integrity. +func CodeLineNumber(val int) attribute.KeyValue { + return CodeLineNumberKey.Int(val) +} + +// CodeStacktrace returns an attribute KeyValue conforming to the +// "code.stacktrace" semantic conventions. It represents a stacktrace as a string +// in the natural representation for the language runtime. The representation is +// identical to [`exception.stacktrace`]. This attribute MUST NOT be used on the +// Profile signal since the data is already captured in 'message Location'. This +// constraint is imposed to prevent redundancy and maintain data integrity. +// +// [`exception.stacktrace`]: /docs/exceptions/exceptions-spans.md#stacktrace-representation +func CodeStacktrace(val string) attribute.KeyValue { + return CodeStacktraceKey.String(val) +} + +// Namespace: container +const ( + // ContainerCommandKey is the attribute Key conforming to the + // "container.command" semantic conventions. It represents the command used to + // run the container (i.e. the command name). + // + // Type: string + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: "otelcontribcol" + // Note: If using embedded credentials or sensitive data, it is recommended to + // remove them to prevent potential leakage. + ContainerCommandKey = attribute.Key("container.command") + + // ContainerCommandArgsKey is the attribute Key conforming to the + // "container.command_args" semantic conventions. It represents the all the + // command arguments (including the command/executable itself) run by the + // container. + // + // Type: string[] + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: "otelcontribcol", "--config", "config.yaml" + ContainerCommandArgsKey = attribute.Key("container.command_args") + + // ContainerCommandLineKey is the attribute Key conforming to the + // "container.command_line" semantic conventions. It represents the full command + // run by the container as a single string representing the full command. + // + // Type: string + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: "otelcontribcol --config config.yaml" + ContainerCommandLineKey = attribute.Key("container.command_line") + + // ContainerCSIPluginNameKey is the attribute Key conforming to the + // "container.csi.plugin.name" semantic conventions. It represents the name of + // the CSI ([Container Storage Interface]) plugin used by the volume. + // + // Type: string + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: "pd.csi.storage.gke.io" + // Note: This can sometimes be referred to as a "driver" in CSI implementations. + // This should represent the `name` field of the GetPluginInfo RPC. + // + // [Container Storage Interface]: https://github.com/container-storage-interface/spec + ContainerCSIPluginNameKey = attribute.Key("container.csi.plugin.name") + + // ContainerCSIVolumeIDKey is the attribute Key conforming to the + // "container.csi.volume.id" semantic conventions. It represents the unique + // volume ID returned by the CSI ([Container Storage Interface]) plugin. + // + // Type: string + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: "projects/my-gcp-project/zones/my-gcp-zone/disks/my-gcp-disk" + // Note: This can sometimes be referred to as a "volume handle" in CSI + // implementations. This should represent the `Volume.volume_id` field in CSI + // spec. + // + // [Container Storage Interface]: https://github.com/container-storage-interface/spec + ContainerCSIVolumeIDKey = attribute.Key("container.csi.volume.id") + + // ContainerIDKey is the attribute Key conforming to the "container.id" semantic + // conventions. It represents the container ID. Usually a UUID, as for example + // used to [identify Docker containers]. The UUID might be abbreviated. + // + // Type: string + // RequirementLevel: Recommended + // Stability: Beta + // + // Examples: "a3bf90e006b2" + // + // [identify Docker containers]: https://docs.docker.com/engine/containers/run/#container-identification + ContainerIDKey = attribute.Key("container.id") + + // ContainerImageIDKey is the attribute Key conforming to the + // "container.image.id" semantic conventions. It represents the runtime specific + // image identifier. Usually a hash algorithm followed by a UUID. + // + // Type: string + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: + // "sha256:19c92d0a00d1b66d897bceaa7319bee0dd38a10a851c60bcec9474aa3f01e50f" + // Note: Docker defines a sha256 of the image id; `container.image.id` + // corresponds to the `Image` field from the Docker container inspect [API] + // endpoint. + // K8s defines a link to the container registry repository with digest + // `"imageID": "registry.azurecr.io /namespace/service/dockerfile@sha256:bdeabd40c3a8a492eaf9e8e44d0ebbb84bac7ee25ac0cf8a7159d25f62555625"` + // . + // The ID is assigned by the container runtime and can vary in different + // environments. Consider using `oci.manifest.digest` if it is important to + // identify the same image in different environments/runtimes. + // + // [API]: https://docs.docker.com/reference/api/engine/version/v1.52/#tag/Container/operation/ContainerInspect + ContainerImageIDKey = attribute.Key("container.image.id") + + // ContainerImageNameKey is the attribute Key conforming to the + // "container.image.name" semantic conventions. It represents the name of the + // image the container was built on. + // + // Type: string + // RequirementLevel: Recommended + // Stability: Beta + // + // Examples: "gcr.io/opentelemetry/operator" + ContainerImageNameKey = attribute.Key("container.image.name") + + // ContainerImageRepoDigestsKey is the attribute Key conforming to the + // "container.image.repo_digests" semantic conventions. It represents the repo + // digests of the container image as provided by the container runtime. + // + // Type: string[] + // RequirementLevel: Recommended + // Stability: Beta + // + // Examples: + // "example@sha256:afcc7f1ac1b49db317a7196c902e61c6c3c4607d63599ee1a82d702d249a0ccb", + // "internal.registry.example.com:5000/example@sha256:b69959407d21e8a062e0416bf13405bb2b71ed7a84dde4158ebafacfa06f5578" + // Note: [Docker] and [CRI] report those under the `RepoDigests` field. + // + // [Docker]: https://docs.docker.com/reference/api/engine/version/v1.52/#tag/Image/operation/ImageInspect + // [CRI]: https://github.com/kubernetes/cri-api/blob/c75ef5b473bbe2d0a4fc92f82235efd665ea8e9f/pkg/apis/runtime/v1/api.proto#L1237-L1238 + ContainerImageRepoDigestsKey = attribute.Key("container.image.repo_digests") + + // ContainerImageTagsKey is the attribute Key conforming to the + // "container.image.tags" semantic conventions. It represents the container + // image tags. An example can be found in [Docker Image Inspect]. Should be only + // the `` section of the full name for example from + // `registry.example.com/my-org/my-image:`. + // + // Type: string[] + // RequirementLevel: Recommended + // Stability: Beta + // + // Examples: "v1.27.1", "3.5.7-0" + // + // [Docker Image Inspect]: https://docs.docker.com/reference/api/engine/version/v1.52/#tag/Image/operation/ImageInspect + ContainerImageTagsKey = attribute.Key("container.image.tags") + + // ContainerNameKey is the attribute Key conforming to the "container.name" + // semantic conventions. It represents the container name used by container + // runtime. + // + // Type: string + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: "opentelemetry-autoconf" + ContainerNameKey = attribute.Key("container.name") + + // ContainerRuntimeDescriptionKey is the attribute Key conforming to the + // "container.runtime.description" semantic conventions. It represents a + // description about the runtime which could include, for example details about + // the CRI/API version being used or other customisations. + // + // Type: string + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: "docker://19.3.1 - CRI: 1.22.0" + ContainerRuntimeDescriptionKey = attribute.Key("container.runtime.description") + + // ContainerRuntimeNameKey is the attribute Key conforming to the + // "container.runtime.name" semantic conventions. It represents the container + // runtime managing this container. + // + // Type: string + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: "docker", "containerd", "rkt" + ContainerRuntimeNameKey = attribute.Key("container.runtime.name") + + // ContainerRuntimeVersionKey is the attribute Key conforming to the + // "container.runtime.version" semantic conventions. It represents the version + // of the runtime of this process, as returned by the runtime without + // modification. + // + // Type: string + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: 1.0.0 + ContainerRuntimeVersionKey = attribute.Key("container.runtime.version") +) + +// ContainerCommand returns an attribute KeyValue conforming to the +// "container.command" semantic conventions. It represents the command used to +// run the container (i.e. the command name). +func ContainerCommand(val string) attribute.KeyValue { + return ContainerCommandKey.String(val) +} + +// ContainerCommandArgs returns an attribute KeyValue conforming to the +// "container.command_args" semantic conventions. It represents the all the +// command arguments (including the command/executable itself) run by the +// container. +func ContainerCommandArgs(val ...string) attribute.KeyValue { + return ContainerCommandArgsKey.StringSlice(val) +} + +// ContainerCommandLine returns an attribute KeyValue conforming to the +// "container.command_line" semantic conventions. It represents the full command +// run by the container as a single string representing the full command. +func ContainerCommandLine(val string) attribute.KeyValue { + return ContainerCommandLineKey.String(val) +} + +// ContainerCSIPluginName returns an attribute KeyValue conforming to the +// "container.csi.plugin.name" semantic conventions. It represents the name of +// the CSI ([Container Storage Interface]) plugin used by the volume. +// +// [Container Storage Interface]: https://github.com/container-storage-interface/spec +func ContainerCSIPluginName(val string) attribute.KeyValue { + return ContainerCSIPluginNameKey.String(val) +} + +// ContainerCSIVolumeID returns an attribute KeyValue conforming to the +// "container.csi.volume.id" semantic conventions. It represents the unique +// volume ID returned by the CSI ([Container Storage Interface]) plugin. +// +// [Container Storage Interface]: https://github.com/container-storage-interface/spec +func ContainerCSIVolumeID(val string) attribute.KeyValue { + return ContainerCSIVolumeIDKey.String(val) +} + +// ContainerID returns an attribute KeyValue conforming to the "container.id" +// semantic conventions. It represents the container ID. Usually a UUID, as for +// example used to [identify Docker containers]. The UUID might be abbreviated. +// +// [identify Docker containers]: https://docs.docker.com/engine/containers/run/#container-identification +func ContainerID(val string) attribute.KeyValue { + return ContainerIDKey.String(val) +} + +// ContainerImageID returns an attribute KeyValue conforming to the +// "container.image.id" semantic conventions. It represents the runtime specific +// image identifier. Usually a hash algorithm followed by a UUID. +func ContainerImageID(val string) attribute.KeyValue { + return ContainerImageIDKey.String(val) +} + +// ContainerImageName returns an attribute KeyValue conforming to the +// "container.image.name" semantic conventions. It represents the name of the +// image the container was built on. +func ContainerImageName(val string) attribute.KeyValue { + return ContainerImageNameKey.String(val) +} + +// ContainerImageRepoDigests returns an attribute KeyValue conforming to the +// "container.image.repo_digests" semantic conventions. It represents the repo +// digests of the container image as provided by the container runtime. +func ContainerImageRepoDigests(val ...string) attribute.KeyValue { + return ContainerImageRepoDigestsKey.StringSlice(val) +} + +// ContainerImageTags returns an attribute KeyValue conforming to the +// "container.image.tags" semantic conventions. It represents the container image +// tags. An example can be found in [Docker Image Inspect]. Should be only the +// `` section of the full name for example from +// `registry.example.com/my-org/my-image:`. +// +// [Docker Image Inspect]: https://docs.docker.com/reference/api/engine/version/v1.52/#tag/Image/operation/ImageInspect +func ContainerImageTags(val ...string) attribute.KeyValue { + return ContainerImageTagsKey.StringSlice(val) +} + +// ContainerLabel returns an attribute KeyValue conforming to the +// "container.label" semantic conventions. It represents the container labels, +// `` being the label name, the value being the label value. +func ContainerLabel(key string, val string) attribute.KeyValue { + return attribute.String("container.label."+key, val) +} + +// ContainerName returns an attribute KeyValue conforming to the "container.name" +// semantic conventions. It represents the container name used by container +// runtime. +func ContainerName(val string) attribute.KeyValue { + return ContainerNameKey.String(val) +} + +// ContainerRuntimeDescription returns an attribute KeyValue conforming to the +// "container.runtime.description" semantic conventions. It represents a +// description about the runtime which could include, for example details about +// the CRI/API version being used or other customisations. +func ContainerRuntimeDescription(val string) attribute.KeyValue { + return ContainerRuntimeDescriptionKey.String(val) +} + +// ContainerRuntimeName returns an attribute KeyValue conforming to the +// "container.runtime.name" semantic conventions. It represents the container +// runtime managing this container. +func ContainerRuntimeName(val string) attribute.KeyValue { + return ContainerRuntimeNameKey.String(val) +} + +// ContainerRuntimeVersion returns an attribute KeyValue conforming to the +// "container.runtime.version" semantic conventions. It represents the version of +// the runtime of this process, as returned by the runtime without modification. +func ContainerRuntimeVersion(val string) attribute.KeyValue { + return ContainerRuntimeVersionKey.String(val) +} + +// Namespace: cpu +const ( + // CPULogicalNumberKey is the attribute Key conforming to the + // "cpu.logical_number" semantic conventions. It represents the logical CPU + // number [0..n-1]. + // + // Type: int + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: 1 + CPULogicalNumberKey = attribute.Key("cpu.logical_number") + + // CPUModeKey is the attribute Key conforming to the "cpu.mode" semantic + // conventions. It represents the mode of the CPU. + // + // Type: Enum + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: "user", "system" + CPUModeKey = attribute.Key("cpu.mode") +) + +// CPULogicalNumber returns an attribute KeyValue conforming to the +// "cpu.logical_number" semantic conventions. It represents the logical CPU +// number [0..n-1]. +func CPULogicalNumber(val int) attribute.KeyValue { + return CPULogicalNumberKey.Int(val) +} + +// Enum values for cpu.mode +var ( + // User + // Stability: development + CPUModeUser = CPUModeKey.String("user") + // System + // Stability: development + CPUModeSystem = CPUModeKey.String("system") + // Nice + // Stability: development + CPUModeNice = CPUModeKey.String("nice") + // Idle + // Stability: development + CPUModeIdle = CPUModeKey.String("idle") + // IO Wait + // Stability: development + CPUModeIOWait = CPUModeKey.String("iowait") + // Interrupt + // Stability: development + CPUModeInterrupt = CPUModeKey.String("interrupt") + // Steal + // Stability: development + CPUModeSteal = CPUModeKey.String("steal") + // Kernel + // Stability: development + CPUModeKernel = CPUModeKey.String("kernel") +) + +// Namespace: db +const ( + // DBClientConnectionPoolNameKey is the attribute Key conforming to the + // "db.client.connection.pool.name" semantic conventions. It represents the name + // of the connection pool; unique within the instrumented application. In case + // the connection pool implementation doesn't provide a name, instrumentation + // SHOULD use a combination of parameters that would make the name unique, for + // example, combining attributes `server.address`, `server.port`, and + // `db.namespace`, formatted as `server.address:server.port/db.namespace`. + // Instrumentations that generate connection pool name following different + // patterns SHOULD document it. + // + // Type: string + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: "myDataSource" + DBClientConnectionPoolNameKey = attribute.Key("db.client.connection.pool.name") + + // DBClientConnectionStateKey is the attribute Key conforming to the + // "db.client.connection.state" semantic conventions. It represents the state of + // a connection in the pool. + // + // Type: Enum + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: "idle" + DBClientConnectionStateKey = attribute.Key("db.client.connection.state") + + // DBCollectionNameKey is the attribute Key conforming to the + // "db.collection.name" semantic conventions. It represents the name of a + // collection (table, container) within the database. + // + // Type: string + // RequirementLevel: Recommended + // Stability: Stable + // + // Examples: "public.users", "customers" + // Note: It is RECOMMENDED to capture the value as provided by the application + // without attempting to do any case normalization. + // + // The collection name SHOULD NOT be extracted from `db.query.text`, + // when the database system supports query text with multiple collections + // in non-batch operations. + // + // For batch operations, if the individual operations are known to have the same + // collection name then that collection name SHOULD be used. + DBCollectionNameKey = attribute.Key("db.collection.name") + + // DBNamespaceKey is the attribute Key conforming to the "db.namespace" semantic + // conventions. It represents the name of the database, fully qualified within + // the server address and port. + // + // Type: string + // RequirementLevel: Recommended + // Stability: Stable + // + // Examples: "customers", "test.users" + // Note: If a database system has multiple namespace components, they SHOULD be + // concatenated from the most general to the most specific namespace component, + // using `|` as a separator between the components. Any missing components (and + // their associated separators) SHOULD be omitted. + // Semantic conventions for individual database systems SHOULD document what + // `db.namespace` means in the context of that system. + // It is RECOMMENDED to capture the value as provided by the application without + // attempting to do any case normalization. + DBNamespaceKey = attribute.Key("db.namespace") + + // DBOperationBatchSizeKey is the attribute Key conforming to the + // "db.operation.batch.size" semantic conventions. It represents the number of + // queries included in a batch operation. + // + // Type: int + // RequirementLevel: Recommended + // Stability: Stable + // + // Examples: 2, 3, 4 + // Note: Operations are only considered batches when they contain two or more + // operations, and so `db.operation.batch.size` SHOULD never be `1`. + DBOperationBatchSizeKey = attribute.Key("db.operation.batch.size") + + // DBOperationNameKey is the attribute Key conforming to the "db.operation.name" + // semantic conventions. It represents the name of the operation or command + // being executed. + // + // Type: string + // RequirementLevel: Recommended + // Stability: Stable + // + // Examples: "findAndModify", "HMSET", "SELECT" + // Note: It is RECOMMENDED to capture the value as provided by the application + // without attempting to do any case normalization. + // + // The operation name SHOULD NOT be extracted from `db.query.text`, + // when the database system supports query text with multiple operations + // in non-batch operations. + // + // If spaces can occur in the operation name, multiple consecutive spaces + // SHOULD be normalized to a single space. + // + // For batch operations, if the individual operations are known to have the same + // operation name + // then that operation name SHOULD be used prepended by `BATCH `, + // otherwise `db.operation.name` SHOULD be `BATCH` or some other database + // system specific term if more applicable. + DBOperationNameKey = attribute.Key("db.operation.name") + + // DBQuerySummaryKey is the attribute Key conforming to the "db.query.summary" + // semantic conventions. It represents the low cardinality summary of a database + // query. + // + // Type: string + // RequirementLevel: Recommended + // Stability: Stable + // + // Examples: "SELECT wuser_table", "INSERT shipping_details SELECT orders", "get + // user by id" + // Note: The query summary describes a class of database queries and is useful + // as a grouping key, especially when analyzing telemetry for database + // calls involving complex queries. + // + // Summary may be available to the instrumentation through + // instrumentation hooks or other means. If it is not available, + // instrumentations + // that support query parsing SHOULD generate a summary following + // [Generating query summary] + // section. + // + // For batch operations, if the individual operations are known to have the same + // query summary + // then that query summary SHOULD be used prepended by `BATCH `, + // otherwise `db.query.summary` SHOULD be `BATCH` or some other database + // system specific term if more applicable. + // + // [Generating query summary]: /docs/db/database-spans.md#generating-a-summary-of-the-query + DBQuerySummaryKey = attribute.Key("db.query.summary") + + // DBQueryTextKey is the attribute Key conforming to the "db.query.text" + // semantic conventions. It represents the database query being executed. + // + // Type: string + // RequirementLevel: Recommended + // Stability: Stable + // + // Examples: "SELECT * FROM wuser_table where username = ?", "SET mykey ?" + // Note: For sanitization see [Sanitization of `db.query.text`]. + // For batch operations, if the individual operations are known to have the same + // query text then that query text SHOULD be used, otherwise all of the + // individual query texts SHOULD be concatenated with separator `; ` or some + // other database system specific separator if more applicable. + // Parameterized query text SHOULD NOT be sanitized. Even though parameterized + // query text can potentially have sensitive data, by using a parameterized + // query the user is giving a strong signal that any sensitive data will be + // passed as parameter values, and the benefit to observability of capturing the + // static part of the query text by default outweighs the risk. + // + // [Sanitization of `db.query.text`]: /docs/db/database-spans.md#sanitization-of-dbquerytext + DBQueryTextKey = attribute.Key("db.query.text") + + // DBResponseReturnedRowsKey is the attribute Key conforming to the + // "db.response.returned_rows" semantic conventions. It represents the number of + // rows returned by the operation. + // + // Type: int + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: 10, 30, 1000 + DBResponseReturnedRowsKey = attribute.Key("db.response.returned_rows") + + // DBResponseStatusCodeKey is the attribute Key conforming to the + // "db.response.status_code" semantic conventions. It represents the database + // response status code. + // + // Type: string + // RequirementLevel: Recommended + // Stability: Stable + // + // Examples: "102", "ORA-17002", "08P01", "404" + // Note: The status code returned by the database. Usually it represents an + // error code, but may also represent partial success, warning, or differentiate + // between various types of successful outcomes. + // Semantic conventions for individual database systems SHOULD document what + // `db.response.status_code` means in the context of that system. + DBResponseStatusCodeKey = attribute.Key("db.response.status_code") + + // DBStoredProcedureNameKey is the attribute Key conforming to the + // "db.stored_procedure.name" semantic conventions. It represents the name of a + // stored procedure within the database. + // + // Type: string + // RequirementLevel: Recommended + // Stability: Stable + // + // Examples: "GetCustomer" + // Note: It is RECOMMENDED to capture the value as provided by the application + // without attempting to do any case normalization. + // + // For batch operations, if the individual operations are known to have the same + // stored procedure name then that stored procedure name SHOULD be used. + DBStoredProcedureNameKey = attribute.Key("db.stored_procedure.name") + + // DBSystemNameKey is the attribute Key conforming to the "db.system.name" + // semantic conventions. It represents the database management system (DBMS) + // product as identified by the client instrumentation. + // + // Type: Enum + // RequirementLevel: Recommended + // Stability: Stable + // + // Examples: + // Note: The actual DBMS may differ from the one identified by the client. For + // example, when using PostgreSQL client libraries to connect to a CockroachDB, + // the `db.system.name` is set to `postgresql` based on the instrumentation's + // best knowledge. + DBSystemNameKey = attribute.Key("db.system.name") +) + +// DBClientConnectionPoolName returns an attribute KeyValue conforming to the +// "db.client.connection.pool.name" semantic conventions. It represents the name +// of the connection pool; unique within the instrumented application. In case +// the connection pool implementation doesn't provide a name, instrumentation +// SHOULD use a combination of parameters that would make the name unique, for +// example, combining attributes `server.address`, `server.port`, and +// `db.namespace`, formatted as `server.address:server.port/db.namespace`. +// Instrumentations that generate connection pool name following different +// patterns SHOULD document it. +func DBClientConnectionPoolName(val string) attribute.KeyValue { + return DBClientConnectionPoolNameKey.String(val) +} + +// DBCollectionName returns an attribute KeyValue conforming to the +// "db.collection.name" semantic conventions. It represents the name of a +// collection (table, container) within the database. +func DBCollectionName(val string) attribute.KeyValue { + return DBCollectionNameKey.String(val) +} + +// DBNamespace returns an attribute KeyValue conforming to the "db.namespace" +// semantic conventions. It represents the name of the database, fully qualified +// within the server address and port. +func DBNamespace(val string) attribute.KeyValue { + return DBNamespaceKey.String(val) +} + +// DBOperationBatchSize returns an attribute KeyValue conforming to the +// "db.operation.batch.size" semantic conventions. It represents the number of +// queries included in a batch operation. +func DBOperationBatchSize(val int) attribute.KeyValue { + return DBOperationBatchSizeKey.Int(val) +} + +// DBOperationName returns an attribute KeyValue conforming to the +// "db.operation.name" semantic conventions. It represents the name of the +// operation or command being executed. +func DBOperationName(val string) attribute.KeyValue { + return DBOperationNameKey.String(val) +} + +// DBOperationParameter returns an attribute KeyValue conforming to the +// "db.operation.parameter" semantic conventions. It represents a database +// operation parameter, with `` being the parameter name, and the attribute +// value being a string representation of the parameter value. +func DBOperationParameter(key string, val string) attribute.KeyValue { + return attribute.String("db.operation.parameter."+key, val) +} + +// DBQueryParameter returns an attribute KeyValue conforming to the +// "db.query.parameter" semantic conventions. It represents a database query +// parameter, with `` being the parameter name, and the attribute value +// being a string representation of the parameter value. +func DBQueryParameter(key string, val string) attribute.KeyValue { + return attribute.String("db.query.parameter."+key, val) +} + +// DBQuerySummary returns an attribute KeyValue conforming to the +// "db.query.summary" semantic conventions. It represents the low cardinality +// summary of a database query. +func DBQuerySummary(val string) attribute.KeyValue { + return DBQuerySummaryKey.String(val) +} + +// DBQueryText returns an attribute KeyValue conforming to the "db.query.text" +// semantic conventions. It represents the database query being executed. +func DBQueryText(val string) attribute.KeyValue { + return DBQueryTextKey.String(val) +} + +// DBResponseReturnedRows returns an attribute KeyValue conforming to the +// "db.response.returned_rows" semantic conventions. It represents the number of +// rows returned by the operation. +func DBResponseReturnedRows(val int) attribute.KeyValue { + return DBResponseReturnedRowsKey.Int(val) +} + +// DBResponseStatusCode returns an attribute KeyValue conforming to the +// "db.response.status_code" semantic conventions. It represents the database +// response status code. +func DBResponseStatusCode(val string) attribute.KeyValue { + return DBResponseStatusCodeKey.String(val) +} + +// DBStoredProcedureName returns an attribute KeyValue conforming to the +// "db.stored_procedure.name" semantic conventions. It represents the name of a +// stored procedure within the database. +func DBStoredProcedureName(val string) attribute.KeyValue { + return DBStoredProcedureNameKey.String(val) +} + +// Enum values for db.client.connection.state +var ( + // idle + // Stability: development + DBClientConnectionStateIdle = DBClientConnectionStateKey.String("idle") + // used + // Stability: development + DBClientConnectionStateUsed = DBClientConnectionStateKey.String("used") +) + +// Enum values for db.system.name +var ( + // Some other SQL database. Fallback only. + // Stability: development + DBSystemNameOtherSQL = DBSystemNameKey.String("other_sql") + // [Adabas (Adaptable Database System)] + // Stability: development + // + // [Adabas (Adaptable Database System)]: https://documentation.softwareag.com/?pf=adabas + DBSystemNameSoftwareagAdabas = DBSystemNameKey.String("softwareag.adabas") + // [Actian Ingres] + // Stability: development + // + // [Actian Ingres]: https://www.actian.com/databases/ingres/ + DBSystemNameActianIngres = DBSystemNameKey.String("actian.ingres") + // [Amazon DynamoDB] + // Stability: development + // + // [Amazon DynamoDB]: https://aws.amazon.com/pm/dynamodb/ + DBSystemNameAWSDynamoDB = DBSystemNameKey.String("aws.dynamodb") + // [Amazon Redshift] + // Stability: development + // + // [Amazon Redshift]: https://aws.amazon.com/redshift/ + DBSystemNameAWSRedshift = DBSystemNameKey.String("aws.redshift") + // [Azure Cosmos DB] + // Stability: development + // + // [Azure Cosmos DB]: https://learn.microsoft.com/azure/cosmos-db + DBSystemNameAzureCosmosDB = DBSystemNameKey.String("azure.cosmosdb") + // [InterSystems Caché] + // Stability: development + // + // [InterSystems Caché]: https://www.intersystems.com/products/cache/ + DBSystemNameIntersystemsCache = DBSystemNameKey.String("intersystems.cache") + // [Apache Cassandra] + // Stability: development + // + // [Apache Cassandra]: https://cassandra.apache.org/ + DBSystemNameCassandra = DBSystemNameKey.String("cassandra") + // [ClickHouse] + // Stability: development + // + // [ClickHouse]: https://clickhouse.com/ + DBSystemNameClickHouse = DBSystemNameKey.String("clickhouse") + // [CockroachDB] + // Stability: development + // + // [CockroachDB]: https://www.cockroachlabs.com/ + DBSystemNameCockroachDB = DBSystemNameKey.String("cockroachdb") + // [Couchbase] + // Stability: development + // + // [Couchbase]: https://www.couchbase.com/ + DBSystemNameCouchbase = DBSystemNameKey.String("couchbase") + // [Apache CouchDB] + // Stability: development + // + // [Apache CouchDB]: https://couchdb.apache.org/ + DBSystemNameCouchDB = DBSystemNameKey.String("couchdb") + // [Apache Derby] + // Stability: development + // + // [Apache Derby]: https://db.apache.org/derby/ + DBSystemNameDerby = DBSystemNameKey.String("derby") + // [Elasticsearch] + // Stability: development + // + // [Elasticsearch]: https://www.elastic.co/elasticsearch + DBSystemNameElasticsearch = DBSystemNameKey.String("elasticsearch") + // [Firebird] + // Stability: development + // + // [Firebird]: https://www.firebirdsql.org/ + DBSystemNameFirebirdSQL = DBSystemNameKey.String("firebirdsql") + // [Google Cloud Spanner] + // Stability: development + // + // [Google Cloud Spanner]: https://cloud.google.com/spanner + DBSystemNameGCPSpanner = DBSystemNameKey.String("gcp.spanner") + // [Apache Geode] + // Stability: development + // + // [Apache Geode]: https://geode.apache.org/ + DBSystemNameGeode = DBSystemNameKey.String("geode") + // [H2 Database] + // Stability: development + // + // [H2 Database]: https://h2database.com/ + DBSystemNameH2database = DBSystemNameKey.String("h2database") + // [Apache HBase] + // Stability: development + // + // [Apache HBase]: https://hbase.apache.org/ + DBSystemNameHBase = DBSystemNameKey.String("hbase") + // [Apache Hive] + // Stability: development + // + // [Apache Hive]: https://hive.apache.org/ + DBSystemNameHive = DBSystemNameKey.String("hive") + // [HyperSQL Database] + // Stability: development + // + // [HyperSQL Database]: https://hsqldb.org/ + DBSystemNameHSQLDB = DBSystemNameKey.String("hsqldb") + // [IBM Db2] + // Stability: development + // + // [IBM Db2]: https://www.ibm.com/db2 + DBSystemNameIBMDB2 = DBSystemNameKey.String("ibm.db2") + // [IBM Informix] + // Stability: development + // + // [IBM Informix]: https://www.ibm.com/products/informix + DBSystemNameIBMInformix = DBSystemNameKey.String("ibm.informix") + // [IBM Netezza] + // Stability: development + // + // [IBM Netezza]: https://www.ibm.com/products/netezza + DBSystemNameIBMNetezza = DBSystemNameKey.String("ibm.netezza") + // [InfluxDB] + // Stability: development + // + // [InfluxDB]: https://www.influxdata.com/ + DBSystemNameInfluxDB = DBSystemNameKey.String("influxdb") + // [Instant] + // Stability: development + // + // [Instant]: https://www.instantdb.com/ + DBSystemNameInstantDB = DBSystemNameKey.String("instantdb") + // [MariaDB] + // Stability: stable + // + // [MariaDB]: https://mariadb.org/ + DBSystemNameMariaDB = DBSystemNameKey.String("mariadb") + // [Memcached] + // Stability: development + // + // [Memcached]: https://memcached.org/ + DBSystemNameMemcached = DBSystemNameKey.String("memcached") + // [MongoDB] + // Stability: development + // + // [MongoDB]: https://www.mongodb.com/ + DBSystemNameMongoDB = DBSystemNameKey.String("mongodb") + // [Microsoft SQL Server] + // Stability: stable + // + // [Microsoft SQL Server]: https://www.microsoft.com/sql-server + DBSystemNameMicrosoftSQLServer = DBSystemNameKey.String("microsoft.sql_server") + // [MySQL] + // Stability: stable + // + // [MySQL]: https://www.mysql.com/ + DBSystemNameMySQL = DBSystemNameKey.String("mysql") + // [Neo4j] + // Stability: development + // + // [Neo4j]: https://neo4j.com/ + DBSystemNameNeo4j = DBSystemNameKey.String("neo4j") + // [OpenSearch] + // Stability: development + // + // [OpenSearch]: https://opensearch.org/ + DBSystemNameOpenSearch = DBSystemNameKey.String("opensearch") + // [Oracle Database] + // Stability: development + // + // [Oracle Database]: https://www.oracle.com/database/ + DBSystemNameOracleDB = DBSystemNameKey.String("oracle.db") + // [PostgreSQL] + // Stability: stable + // + // [PostgreSQL]: https://www.postgresql.org/ + DBSystemNamePostgreSQL = DBSystemNameKey.String("postgresql") + // [Redis] + // Stability: development + // + // [Redis]: https://redis.io/ + DBSystemNameRedis = DBSystemNameKey.String("redis") + // [SAP HANA] + // Stability: development + // + // [SAP HANA]: https://www.sap.com/products/technology-platform/hana/what-is-sap-hana.html + DBSystemNameSAPHANA = DBSystemNameKey.String("sap.hana") + // [SAP MaxDB] + // Stability: development + // + // [SAP MaxDB]: https://maxdb.sap.com/ + DBSystemNameSAPMaxDB = DBSystemNameKey.String("sap.maxdb") + // [SQLite] + // Stability: development + // + // [SQLite]: https://www.sqlite.org/ + DBSystemNameSQLite = DBSystemNameKey.String("sqlite") + // [Teradata] + // Stability: development + // + // [Teradata]: https://www.teradata.com/ + DBSystemNameTeradata = DBSystemNameKey.String("teradata") + // [Trino] + // Stability: development + // + // [Trino]: https://trino.io/ + DBSystemNameTrino = DBSystemNameKey.String("trino") +) + +// Namespace: deployment +const ( + // DeploymentEnvironmentNameKey is the attribute Key conforming to the + // "deployment.environment.name" semantic conventions. It represents the name of + // the [deployment environment] (aka deployment tier). + // + // Type: string + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: "staging", "production" + // Note: `deployment.environment.name` does not affect the uniqueness + // constraints defined through + // the `service.namespace`, `service.name` and `service.instance.id` resource + // attributes. + // This implies that resources carrying the following attribute combinations + // MUST be + // considered to be identifying the same service: + // + // - `service.name=frontend`, `deployment.environment.name=production` + // - `service.name=frontend`, `deployment.environment.name=staging`. + // + // + // [deployment environment]: https://wikipedia.org/wiki/Deployment_environment + DeploymentEnvironmentNameKey = attribute.Key("deployment.environment.name") + + // DeploymentIDKey is the attribute Key conforming to the "deployment.id" + // semantic conventions. It represents the id of the deployment. + // + // Type: string + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: "1208" + DeploymentIDKey = attribute.Key("deployment.id") + + // DeploymentNameKey is the attribute Key conforming to the "deployment.name" + // semantic conventions. It represents the name of the deployment. + // + // Type: string + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: "deploy my app", "deploy-frontend" + DeploymentNameKey = attribute.Key("deployment.name") + + // DeploymentStatusKey is the attribute Key conforming to the + // "deployment.status" semantic conventions. It represents the status of the + // deployment. + // + // Type: Enum + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: + DeploymentStatusKey = attribute.Key("deployment.status") +) + +// DeploymentEnvironmentName returns an attribute KeyValue conforming to the +// "deployment.environment.name" semantic conventions. It represents the name of +// the [deployment environment] (aka deployment tier). +// +// [deployment environment]: https://wikipedia.org/wiki/Deployment_environment +func DeploymentEnvironmentName(val string) attribute.KeyValue { + return DeploymentEnvironmentNameKey.String(val) +} + +// DeploymentID returns an attribute KeyValue conforming to the "deployment.id" +// semantic conventions. It represents the id of the deployment. +func DeploymentID(val string) attribute.KeyValue { + return DeploymentIDKey.String(val) +} + +// DeploymentName returns an attribute KeyValue conforming to the +// "deployment.name" semantic conventions. It represents the name of the +// deployment. +func DeploymentName(val string) attribute.KeyValue { + return DeploymentNameKey.String(val) +} + +// Enum values for deployment.status +var ( + // failed + // Stability: development + DeploymentStatusFailed = DeploymentStatusKey.String("failed") + // succeeded + // Stability: development + DeploymentStatusSucceeded = DeploymentStatusKey.String("succeeded") +) + +// Namespace: destination +const ( + // DestinationAddressKey is the attribute Key conforming to the + // "destination.address" semantic conventions. It represents the destination + // address - domain name if available without reverse DNS lookup; otherwise, IP + // address or Unix domain socket name. + // + // Type: string + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: "destination.example.com", "10.1.2.80", "/tmp/my.sock" + // Note: When observed from the source side, and when communicating through an + // intermediary, `destination.address` SHOULD represent the destination address + // behind any intermediaries, for example proxies, if it's available. + DestinationAddressKey = attribute.Key("destination.address") + + // DestinationPortKey is the attribute Key conforming to the "destination.port" + // semantic conventions. It represents the destination port number. + // + // Type: int + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: 3389, 2888 + DestinationPortKey = attribute.Key("destination.port") +) + +// DestinationAddress returns an attribute KeyValue conforming to the +// "destination.address" semantic conventions. It represents the destination +// address - domain name if available without reverse DNS lookup; otherwise, IP +// address or Unix domain socket name. +func DestinationAddress(val string) attribute.KeyValue { + return DestinationAddressKey.String(val) +} + +// DestinationPort returns an attribute KeyValue conforming to the +// "destination.port" semantic conventions. It represents the destination port +// number. +func DestinationPort(val int) attribute.KeyValue { + return DestinationPortKey.Int(val) +} + +// Namespace: device +const ( + // DeviceIDKey is the attribute Key conforming to the "device.id" semantic + // conventions. It represents a unique identifier representing the device. + // + // Type: string + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: "123456789012345", "01:23:45:67:89:AB" + // Note: Its value SHOULD be identical for all apps on a device and it SHOULD + // NOT change if an app is uninstalled and re-installed. + // However, it might be resettable by the user for all apps on a device. + // Hardware IDs (e.g. vendor-specific serial number, IMEI or MAC address) MAY be + // used as values. + // + // More information about Android identifier best practices can be found in the + // [Android user data IDs guide]. + // + // > [!WARNING]> This attribute may contain sensitive (PII) information. Caution + // > should be taken when storing personal data or anything which can identify a + // > user. GDPR and data protection laws may apply, + // > ensure you do your own due diligence.> Due to these reasons, this + // > identifier is not recommended for consumer applications and will likely + // > result in rejection from both Google Play and App Store. + // > However, it may be appropriate for specific enterprise scenarios, such as + // > kiosk devices or enterprise-managed devices, with appropriate compliance + // > clearance. + // > Any instrumentation providing this identifier MUST implement it as an + // > opt-in feature.> See [`app.installation.id`]> for a more + // > privacy-preserving alternative. + // + // [Android user data IDs guide]: https://developer.android.com/training/articles/user-data-ids + // [`app.installation.id`]: /docs/registry/attributes/app.md#app-installation-id + DeviceIDKey = attribute.Key("device.id") + + // DeviceManufacturerKey is the attribute Key conforming to the + // "device.manufacturer" semantic conventions. It represents the name of the + // device manufacturer. + // + // Type: string + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: "Apple", "Samsung" + // Note: The Android OS provides this field via [Build]. iOS apps SHOULD + // hardcode the value `Apple`. + // + // [Build]: https://developer.android.com/reference/android/os/Build#MANUFACTURER + DeviceManufacturerKey = attribute.Key("device.manufacturer") + + // DeviceModelIdentifierKey is the attribute Key conforming to the + // "device.model.identifier" semantic conventions. It represents the model + // identifier for the device. + // + // Type: string + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: "iPhone3,4", "SM-G920F" + // Note: It's recommended this value represents a machine-readable version of + // the model identifier rather than the market or consumer-friendly name of the + // device. + DeviceModelIdentifierKey = attribute.Key("device.model.identifier") + + // DeviceModelNameKey is the attribute Key conforming to the "device.model.name" + // semantic conventions. It represents the marketing name for the device model. + // + // Type: string + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: "iPhone 6s Plus", "Samsung Galaxy S6" + // Note: It's recommended this value represents a human-readable version of the + // device model rather than a machine-readable alternative. + DeviceModelNameKey = attribute.Key("device.model.name") +) + +// DeviceID returns an attribute KeyValue conforming to the "device.id" semantic +// conventions. It represents a unique identifier representing the device. +func DeviceID(val string) attribute.KeyValue { + return DeviceIDKey.String(val) +} + +// DeviceManufacturer returns an attribute KeyValue conforming to the +// "device.manufacturer" semantic conventions. It represents the name of the +// device manufacturer. +func DeviceManufacturer(val string) attribute.KeyValue { + return DeviceManufacturerKey.String(val) +} + +// DeviceModelIdentifier returns an attribute KeyValue conforming to the +// "device.model.identifier" semantic conventions. It represents the model +// identifier for the device. +func DeviceModelIdentifier(val string) attribute.KeyValue { + return DeviceModelIdentifierKey.String(val) +} + +// DeviceModelName returns an attribute KeyValue conforming to the +// "device.model.name" semantic conventions. It represents the marketing name for +// the device model. +func DeviceModelName(val string) attribute.KeyValue { + return DeviceModelNameKey.String(val) +} + +// Namespace: disk +const ( + // DiskIODirectionKey is the attribute Key conforming to the "disk.io.direction" + // semantic conventions. It represents the disk IO operation direction. + // + // Type: Enum + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: "read" + DiskIODirectionKey = attribute.Key("disk.io.direction") +) + +// Enum values for disk.io.direction +var ( + // read + // Stability: development + DiskIODirectionRead = DiskIODirectionKey.String("read") + // write + // Stability: development + DiskIODirectionWrite = DiskIODirectionKey.String("write") +) + +// Namespace: dns +const ( + // DNSAnswersKey is the attribute Key conforming to the "dns.answers" semantic + // conventions. It represents the list of IPv4 or IPv6 addresses resolved during + // DNS lookup. + // + // Type: string[] + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: "10.0.0.1", "2001:0db8:85a3:0000:0000:8a2e:0370:7334" + DNSAnswersKey = attribute.Key("dns.answers") + + // DNSQuestionNameKey is the attribute Key conforming to the "dns.question.name" + // semantic conventions. It represents the name being queried. + // + // Type: string + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: "www.example.com", "opentelemetry.io" + // Note: The name represents the queried domain name as it appears in the DNS + // query without any additional normalization. + DNSQuestionNameKey = attribute.Key("dns.question.name") +) + +// DNSAnswers returns an attribute KeyValue conforming to the "dns.answers" +// semantic conventions. It represents the list of IPv4 or IPv6 addresses +// resolved during DNS lookup. +func DNSAnswers(val ...string) attribute.KeyValue { + return DNSAnswersKey.StringSlice(val) +} + +// DNSQuestionName returns an attribute KeyValue conforming to the +// "dns.question.name" semantic conventions. It represents the name being +// queried. +func DNSQuestionName(val string) attribute.KeyValue { + return DNSQuestionNameKey.String(val) +} + +// Namespace: elasticsearch +const ( + // ElasticsearchNodeNameKey is the attribute Key conforming to the + // "elasticsearch.node.name" semantic conventions. It represents the represents + // the human-readable identifier of the node/instance to which a request was + // routed. + // + // Type: string + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: "instance-0000000001" + ElasticsearchNodeNameKey = attribute.Key("elasticsearch.node.name") +) + +// ElasticsearchNodeName returns an attribute KeyValue conforming to the +// "elasticsearch.node.name" semantic conventions. It represents the represents +// the human-readable identifier of the node/instance to which a request was +// routed. +func ElasticsearchNodeName(val string) attribute.KeyValue { + return ElasticsearchNodeNameKey.String(val) +} + +// Namespace: enduser +const ( + // EnduserIDKey is the attribute Key conforming to the "enduser.id" semantic + // conventions. It represents the unique identifier of an end user in the + // system. It maybe a username, email address, or other identifier. + // + // Type: string + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: "username" + // Note: Unique identifier of an end user in the system. + // + // > [!Warning] + // > This field contains sensitive (PII) information. + EnduserIDKey = attribute.Key("enduser.id") + + // EnduserPseudoIDKey is the attribute Key conforming to the "enduser.pseudo.id" + // semantic conventions. It represents the pseudonymous identifier of an end + // user. This identifier should be a random value that is not directly linked or + // associated with the end user's actual identity. + // + // Type: string + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: "QdH5CAWJgqVT4rOr0qtumf" + // Note: Pseudonymous identifier of an end user. + // + // > [!Warning] + // > This field contains sensitive (linkable PII) information. + EnduserPseudoIDKey = attribute.Key("enduser.pseudo.id") +) + +// EnduserID returns an attribute KeyValue conforming to the "enduser.id" +// semantic conventions. It represents the unique identifier of an end user in +// the system. It maybe a username, email address, or other identifier. +func EnduserID(val string) attribute.KeyValue { + return EnduserIDKey.String(val) +} + +// EnduserPseudoID returns an attribute KeyValue conforming to the +// "enduser.pseudo.id" semantic conventions. It represents the pseudonymous +// identifier of an end user. This identifier should be a random value that is +// not directly linked or associated with the end user's actual identity. +func EnduserPseudoID(val string) attribute.KeyValue { + return EnduserPseudoIDKey.String(val) +} + +// Namespace: error +const ( + // ErrorTypeKey is the attribute Key conforming to the "error.type" semantic + // conventions. It represents the describes a class of error the operation ended + // with. + // + // Type: Enum + // RequirementLevel: Recommended + // Stability: Stable + // + // Examples: "timeout", "java.net.UnknownHostException", + // "server_certificate_invalid", "500" + // Note: The `error.type` SHOULD be predictable, and SHOULD have low + // cardinality. + // + // When `error.type` is set to a type (e.g., an exception type), its + // canonical class name identifying the type within the artifact SHOULD be used. + // + // Instrumentations SHOULD document the list of errors they report. + // + // The cardinality of `error.type` within one instrumentation library SHOULD be + // low. + // Telemetry consumers that aggregate data from multiple instrumentation + // libraries and applications + // should be prepared for `error.type` to have high cardinality at query time + // when no + // additional filters are applied. + // + // If the operation has completed successfully, instrumentations SHOULD NOT set + // `error.type`. + // + // If a specific domain defines its own set of error identifiers (such as HTTP + // or RPC status codes), + // it's RECOMMENDED to: + // + // - Use a domain-specific attribute + // - Set `error.type` to capture all errors, regardless of whether they are + // defined within the domain-specific set or not. + ErrorTypeKey = attribute.Key("error.type") +) + +// Enum values for error.type +var ( + // A fallback error value to be used when the instrumentation doesn't define a + // custom value. + // + // Stability: stable + ErrorTypeOther = ErrorTypeKey.String("_OTHER") +) + +// Namespace: exception +const ( + // ExceptionMessageKey is the attribute Key conforming to the + // "exception.message" semantic conventions. It represents the exception + // message. + // + // Type: string + // RequirementLevel: Recommended + // Stability: Stable + // + // Examples: "Division by zero", "Can't convert 'int' object to str implicitly" + // Note: > [!WARNING] + // + // > This attribute may contain sensitive information. + ExceptionMessageKey = attribute.Key("exception.message") + + // ExceptionStacktraceKey is the attribute Key conforming to the + // "exception.stacktrace" semantic conventions. It represents a stacktrace as a + // string in the natural representation for the language runtime. The + // representation is to be determined and documented by each language SIG. + // + // Type: string + // RequirementLevel: Recommended + // Stability: Stable + // + // Examples: Exception in thread "main" java.lang.RuntimeException: Test + // exception\n at com.example.GenerateTrace.methodB(GenerateTrace.java:13)\n at + // com.example.GenerateTrace.methodA(GenerateTrace.java:9)\n at + // com.example.GenerateTrace.main(GenerateTrace.java:5) + ExceptionStacktraceKey = attribute.Key("exception.stacktrace") + + // ExceptionTypeKey is the attribute Key conforming to the "exception.type" + // semantic conventions. It represents the type of the exception (its + // fully-qualified class name, if applicable). The dynamic type of the exception + // should be preferred over the static type in languages that support it. + // + // Type: string + // RequirementLevel: Recommended + // Stability: Stable + // + // Examples: "java.net.ConnectException", "OSError" + ExceptionTypeKey = attribute.Key("exception.type") +) + +// ExceptionMessage returns an attribute KeyValue conforming to the +// "exception.message" semantic conventions. It represents the exception message. +func ExceptionMessage(val string) attribute.KeyValue { + return ExceptionMessageKey.String(val) +} + +// ExceptionStacktrace returns an attribute KeyValue conforming to the +// "exception.stacktrace" semantic conventions. It represents a stacktrace as a +// string in the natural representation for the language runtime. The +// representation is to be determined and documented by each language SIG. +func ExceptionStacktrace(val string) attribute.KeyValue { + return ExceptionStacktraceKey.String(val) +} + +// ExceptionType returns an attribute KeyValue conforming to the "exception.type" +// semantic conventions. It represents the type of the exception (its +// fully-qualified class name, if applicable). The dynamic type of the exception +// should be preferred over the static type in languages that support it. +func ExceptionType(val string) attribute.KeyValue { + return ExceptionTypeKey.String(val) +} + +// Namespace: faas +const ( + // FaaSColdstartKey is the attribute Key conforming to the "faas.coldstart" + // semantic conventions. It represents a boolean that is true if the serverless + // function is executed for the first time (aka cold-start). + // + // Type: boolean + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: + FaaSColdstartKey = attribute.Key("faas.coldstart") + + // FaaSCronKey is the attribute Key conforming to the "faas.cron" semantic + // conventions. It represents a string containing the schedule period as + // [Cron Expression]. + // + // Type: string + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: 0/5 * * * ? * + // + // [Cron Expression]: https://docs.oracle.com/cd/E12058_01/doc/doc.1014/e12030/cron_expressions.htm + FaaSCronKey = attribute.Key("faas.cron") + + // FaaSDocumentCollectionKey is the attribute Key conforming to the + // "faas.document.collection" semantic conventions. It represents the name of + // the source on which the triggering operation was performed. For example, in + // Cloud Storage or S3 corresponds to the bucket name, and in Cosmos DB to the + // database name. + // + // Type: string + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: "myBucketName", "myDbName" + FaaSDocumentCollectionKey = attribute.Key("faas.document.collection") + + // FaaSDocumentNameKey is the attribute Key conforming to the + // "faas.document.name" semantic conventions. It represents the document + // name/table subjected to the operation. For example, in Cloud Storage or S3 is + // the name of the file, and in Cosmos DB the table name. + // + // Type: string + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: "myFile.txt", "myTableName" + FaaSDocumentNameKey = attribute.Key("faas.document.name") + + // FaaSDocumentOperationKey is the attribute Key conforming to the + // "faas.document.operation" semantic conventions. It represents the describes + // the type of the operation that was performed on the data. + // + // Type: Enum + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: + FaaSDocumentOperationKey = attribute.Key("faas.document.operation") + + // FaaSDocumentTimeKey is the attribute Key conforming to the + // "faas.document.time" semantic conventions. It represents a string containing + // the time when the data was accessed in the [ISO 8601] format expressed in + // [UTC]. + // + // Type: string + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: 2020-01-23T13:47:06Z + // + // [ISO 8601]: https://www.iso.org/iso-8601-date-and-time-format.html + // [UTC]: https://www.w3.org/TR/NOTE-datetime + FaaSDocumentTimeKey = attribute.Key("faas.document.time") + + // FaaSInstanceKey is the attribute Key conforming to the "faas.instance" + // semantic conventions. It represents the execution environment ID as a string, + // that will be potentially reused for other invocations to the same + // function/function version. + // + // Type: string + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: "2021/06/28/[$LATEST]2f399eb14537447da05ab2a2e39309de" + // Note: - **AWS Lambda:** Use the (full) log stream name. + FaaSInstanceKey = attribute.Key("faas.instance") + + // FaaSInvocationIDKey is the attribute Key conforming to the + // "faas.invocation_id" semantic conventions. It represents the invocation ID of + // the current function invocation. + // + // Type: string + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: af9d5aa4-a685-4c5f-a22b-444f80b3cc28 + FaaSInvocationIDKey = attribute.Key("faas.invocation_id") + + // FaaSInvokedNameKey is the attribute Key conforming to the "faas.invoked_name" + // semantic conventions. It represents the name of the invoked function. + // + // Type: string + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: my-function + // Note: SHOULD be equal to the `faas.name` resource attribute of the invoked + // function. + FaaSInvokedNameKey = attribute.Key("faas.invoked_name") + + // FaaSInvokedProviderKey is the attribute Key conforming to the + // "faas.invoked_provider" semantic conventions. It represents the cloud + // provider of the invoked function. + // + // Type: Enum + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: + // Note: SHOULD be equal to the `cloud.provider` resource attribute of the + // invoked function. + FaaSInvokedProviderKey = attribute.Key("faas.invoked_provider") + + // FaaSInvokedRegionKey is the attribute Key conforming to the + // "faas.invoked_region" semantic conventions. It represents the cloud region of + // the invoked function. + // + // Type: string + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: eu-central-1 + // Note: SHOULD be equal to the `cloud.region` resource attribute of the invoked + // function. + FaaSInvokedRegionKey = attribute.Key("faas.invoked_region") + + // FaaSMaxMemoryKey is the attribute Key conforming to the "faas.max_memory" + // semantic conventions. It represents the amount of memory available to the + // serverless function converted to Bytes. + // + // Type: int + // RequirementLevel: Recommended + // Stability: Development + // + // Note: It's recommended to set this attribute since e.g. too little memory can + // easily stop a Java AWS Lambda function from working correctly. On AWS Lambda, + // the environment variable `AWS_LAMBDA_FUNCTION_MEMORY_SIZE` provides this + // information (which must be multiplied by 1,048,576). + FaaSMaxMemoryKey = attribute.Key("faas.max_memory") + + // FaaSNameKey is the attribute Key conforming to the "faas.name" semantic + // conventions. It represents the name of the single function that this runtime + // instance executes. + // + // Type: string + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: "my-function", "myazurefunctionapp/some-function-name" + // Note: This is the name of the function as configured/deployed on the FaaS + // platform and is usually different from the name of the callback + // function (which may be stored in the + // [`code.namespace`/`code.function.name`] + // span attributes). + // + // For some cloud providers, the above definition is ambiguous. The following + // definition of function name MUST be used for this attribute + // (and consequently the span name) for the listed cloud providers/products: + // + // - **Azure:** The full name `/`, i.e., function app name + // followed by a forward slash followed by the function name (this form + // can also be seen in the resource JSON for the function). + // This means that a span attribute MUST be used, as an Azure function + // app can host multiple functions that would usually share + // a TracerProvider (see also the `cloud.resource_id` attribute). + // + // + // [`code.namespace`/`code.function.name`]: /docs/general/attributes.md#source-code-attributes + FaaSNameKey = attribute.Key("faas.name") + + // FaaSTimeKey is the attribute Key conforming to the "faas.time" semantic + // conventions. It represents a string containing the function invocation time + // in the [ISO 8601] format expressed in [UTC]. + // + // Type: string + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: 2020-01-23T13:47:06Z + // + // [ISO 8601]: https://www.iso.org/iso-8601-date-and-time-format.html + // [UTC]: https://www.w3.org/TR/NOTE-datetime + FaaSTimeKey = attribute.Key("faas.time") + + // FaaSTriggerKey is the attribute Key conforming to the "faas.trigger" semantic + // conventions. It represents the type of the trigger which caused this function + // invocation. + // + // Type: Enum + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: + FaaSTriggerKey = attribute.Key("faas.trigger") + + // FaaSVersionKey is the attribute Key conforming to the "faas.version" semantic + // conventions. It represents the immutable version of the function being + // executed. + // + // Type: string + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: "26", "pinkfroid-00002" + // Note: Depending on the cloud provider and platform, use: + // + // - **AWS Lambda:** The [function version] + // (an integer represented as a decimal string). + // - **Google Cloud Run (Services):** The [revision] + // (i.e., the function name plus the revision suffix). + // - **Google Cloud Functions:** The value of the + // [`K_REVISION` environment variable]. + // - **Azure Functions:** Not applicable. Do not set this attribute. + // + // + // [function version]: https://docs.aws.amazon.com/lambda/latest/dg/configuration-versions.html + // [revision]: https://cloud.google.com/run/docs/managing/revisions + // [`K_REVISION` environment variable]: https://cloud.google.com/run/docs/container-contract#services-env-vars + FaaSVersionKey = attribute.Key("faas.version") +) + +// FaaSColdstart returns an attribute KeyValue conforming to the "faas.coldstart" +// semantic conventions. It represents a boolean that is true if the serverless +// function is executed for the first time (aka cold-start). +func FaaSColdstart(val bool) attribute.KeyValue { + return FaaSColdstartKey.Bool(val) +} + +// FaaSCron returns an attribute KeyValue conforming to the "faas.cron" semantic +// conventions. It represents a string containing the schedule period as +// [Cron Expression]. +// +// [Cron Expression]: https://docs.oracle.com/cd/E12058_01/doc/doc.1014/e12030/cron_expressions.htm +func FaaSCron(val string) attribute.KeyValue { + return FaaSCronKey.String(val) +} + +// FaaSDocumentCollection returns an attribute KeyValue conforming to the +// "faas.document.collection" semantic conventions. It represents the name of the +// source on which the triggering operation was performed. For example, in Cloud +// Storage or S3 corresponds to the bucket name, and in Cosmos DB to the database +// name. +func FaaSDocumentCollection(val string) attribute.KeyValue { + return FaaSDocumentCollectionKey.String(val) +} + +// FaaSDocumentName returns an attribute KeyValue conforming to the +// "faas.document.name" semantic conventions. It represents the document +// name/table subjected to the operation. For example, in Cloud Storage or S3 is +// the name of the file, and in Cosmos DB the table name. +func FaaSDocumentName(val string) attribute.KeyValue { + return FaaSDocumentNameKey.String(val) +} + +// FaaSDocumentTime returns an attribute KeyValue conforming to the +// "faas.document.time" semantic conventions. It represents a string containing +// the time when the data was accessed in the [ISO 8601] format expressed in +// [UTC]. +// +// [ISO 8601]: https://www.iso.org/iso-8601-date-and-time-format.html +// [UTC]: https://www.w3.org/TR/NOTE-datetime +func FaaSDocumentTime(val string) attribute.KeyValue { + return FaaSDocumentTimeKey.String(val) +} + +// FaaSInstance returns an attribute KeyValue conforming to the "faas.instance" +// semantic conventions. It represents the execution environment ID as a string, +// that will be potentially reused for other invocations to the same +// function/function version. +func FaaSInstance(val string) attribute.KeyValue { + return FaaSInstanceKey.String(val) +} + +// FaaSInvocationID returns an attribute KeyValue conforming to the +// "faas.invocation_id" semantic conventions. It represents the invocation ID of +// the current function invocation. +func FaaSInvocationID(val string) attribute.KeyValue { + return FaaSInvocationIDKey.String(val) +} + +// FaaSInvokedName returns an attribute KeyValue conforming to the +// "faas.invoked_name" semantic conventions. It represents the name of the +// invoked function. +func FaaSInvokedName(val string) attribute.KeyValue { + return FaaSInvokedNameKey.String(val) +} + +// FaaSInvokedRegion returns an attribute KeyValue conforming to the +// "faas.invoked_region" semantic conventions. It represents the cloud region of +// the invoked function. +func FaaSInvokedRegion(val string) attribute.KeyValue { + return FaaSInvokedRegionKey.String(val) +} + +// FaaSMaxMemory returns an attribute KeyValue conforming to the +// "faas.max_memory" semantic conventions. It represents the amount of memory +// available to the serverless function converted to Bytes. +func FaaSMaxMemory(val int) attribute.KeyValue { + return FaaSMaxMemoryKey.Int(val) +} + +// FaaSName returns an attribute KeyValue conforming to the "faas.name" semantic +// conventions. It represents the name of the single function that this runtime +// instance executes. +func FaaSName(val string) attribute.KeyValue { + return FaaSNameKey.String(val) +} + +// FaaSTime returns an attribute KeyValue conforming to the "faas.time" semantic +// conventions. It represents a string containing the function invocation time in +// the [ISO 8601] format expressed in [UTC]. +// +// [ISO 8601]: https://www.iso.org/iso-8601-date-and-time-format.html +// [UTC]: https://www.w3.org/TR/NOTE-datetime +func FaaSTime(val string) attribute.KeyValue { + return FaaSTimeKey.String(val) +} + +// FaaSVersion returns an attribute KeyValue conforming to the "faas.version" +// semantic conventions. It represents the immutable version of the function +// being executed. +func FaaSVersion(val string) attribute.KeyValue { + return FaaSVersionKey.String(val) +} + +// Enum values for faas.document.operation +var ( + // When a new object is created. + // Stability: development + FaaSDocumentOperationInsert = FaaSDocumentOperationKey.String("insert") + // When an object is modified. + // Stability: development + FaaSDocumentOperationEdit = FaaSDocumentOperationKey.String("edit") + // When an object is deleted. + // Stability: development + FaaSDocumentOperationDelete = FaaSDocumentOperationKey.String("delete") +) + +// Enum values for faas.invoked_provider +var ( + // Alibaba Cloud + // Stability: development + FaaSInvokedProviderAlibabaCloud = FaaSInvokedProviderKey.String("alibaba_cloud") + // Amazon Web Services + // Stability: development + FaaSInvokedProviderAWS = FaaSInvokedProviderKey.String("aws") + // Microsoft Azure + // Stability: development + FaaSInvokedProviderAzure = FaaSInvokedProviderKey.String("azure") + // Google Cloud Platform + // Stability: development + FaaSInvokedProviderGCP = FaaSInvokedProviderKey.String("gcp") + // Tencent Cloud + // Stability: development + FaaSInvokedProviderTencentCloud = FaaSInvokedProviderKey.String("tencent_cloud") +) + +// Enum values for faas.trigger +var ( + // A response to some data source operation such as a database or filesystem + // read/write + // Stability: development + FaaSTriggerDatasource = FaaSTriggerKey.String("datasource") + // To provide an answer to an inbound HTTP request + // Stability: development + FaaSTriggerHTTP = FaaSTriggerKey.String("http") + // A function is set to be executed when messages are sent to a messaging system + // Stability: development + FaaSTriggerPubSub = FaaSTriggerKey.String("pubsub") + // A function is scheduled to be executed regularly + // Stability: development + FaaSTriggerTimer = FaaSTriggerKey.String("timer") + // If none of the others apply + // Stability: development + FaaSTriggerOther = FaaSTriggerKey.String("other") +) + +// Namespace: feature_flag +const ( + // FeatureFlagContextIDKey is the attribute Key conforming to the + // "feature_flag.context.id" semantic conventions. It represents the unique + // identifier for the flag evaluation context. For example, the targeting key. + // + // Type: string + // RequirementLevel: Recommended + // Stability: Release_Candidate + // + // Examples: "5157782b-2203-4c80-a857-dbbd5e7761db" + FeatureFlagContextIDKey = attribute.Key("feature_flag.context.id") + + // FeatureFlagErrorMessageKey is the attribute Key conforming to the + // "feature_flag.error.message" semantic conventions. It represents a message + // providing more detail about an error that occurred during feature flag + // evaluation in human-readable form. + // + // Type: string + // RequirementLevel: Recommended + // Stability: Release_Candidate + // + // Examples: "Unexpected input type: string", "The user has exceeded their + // storage quota" + FeatureFlagErrorMessageKey = attribute.Key("feature_flag.error.message") + + // FeatureFlagKeyKey is the attribute Key conforming to the "feature_flag.key" + // semantic conventions. It represents the lookup key of the feature flag. + // + // Type: string + // RequirementLevel: Recommended + // Stability: Release_Candidate + // + // Examples: "logo-color" + FeatureFlagKeyKey = attribute.Key("feature_flag.key") + + // FeatureFlagProviderNameKey is the attribute Key conforming to the + // "feature_flag.provider.name" semantic conventions. It represents the + // identifies the feature flag provider. + // + // Type: string + // RequirementLevel: Recommended + // Stability: Release_Candidate + // + // Examples: "Flag Manager" + FeatureFlagProviderNameKey = attribute.Key("feature_flag.provider.name") + + // FeatureFlagResultReasonKey is the attribute Key conforming to the + // "feature_flag.result.reason" semantic conventions. It represents the reason + // code which shows how a feature flag value was determined. + // + // Type: Enum + // RequirementLevel: Recommended + // Stability: Release_Candidate + // + // Examples: "static", "targeting_match", "error", "default" + FeatureFlagResultReasonKey = attribute.Key("feature_flag.result.reason") + + // FeatureFlagResultValueKey is the attribute Key conforming to the + // "feature_flag.result.value" semantic conventions. It represents the evaluated + // value of the feature flag. + // + // Type: any + // RequirementLevel: Recommended + // Stability: Release_Candidate + // + // Examples: "#ff0000", true, 3 + // Note: With some feature flag providers, feature flag results can be quite + // large or contain private or sensitive details. + // Because of this, `feature_flag.result.variant` is often the preferred + // attribute if it is available. + // + // It may be desirable to redact or otherwise limit the size and scope of + // `feature_flag.result.value` if possible. + // Because the evaluated flag value is unstructured and may be any type, it is + // left to the instrumentation author to determine how best to achieve this. + FeatureFlagResultValueKey = attribute.Key("feature_flag.result.value") + + // FeatureFlagResultVariantKey is the attribute Key conforming to the + // "feature_flag.result.variant" semantic conventions. It represents a semantic + // identifier for an evaluated flag value. + // + // Type: string + // RequirementLevel: Recommended + // Stability: Release_Candidate + // + // Examples: "red", "true", "on" + // Note: A semantic identifier, commonly referred to as a variant, provides a + // means + // for referring to a value without including the value itself. This can + // provide additional context for understanding the meaning behind a value. + // For example, the variant `red` maybe be used for the value `#c05543`. + FeatureFlagResultVariantKey = attribute.Key("feature_flag.result.variant") + + // FeatureFlagSetIDKey is the attribute Key conforming to the + // "feature_flag.set.id" semantic conventions. It represents the identifier of + // the [flag set] to which the feature flag belongs. + // + // Type: string + // RequirementLevel: Recommended + // Stability: Release_Candidate + // + // Examples: "proj-1", "ab98sgs", "service1/dev" + // + // [flag set]: https://openfeature.dev/specification/glossary/#flag-set + FeatureFlagSetIDKey = attribute.Key("feature_flag.set.id") + + // FeatureFlagVersionKey is the attribute Key conforming to the + // "feature_flag.version" semantic conventions. It represents the version of the + // ruleset used during the evaluation. This may be any stable value which + // uniquely identifies the ruleset. + // + // Type: string + // RequirementLevel: Recommended + // Stability: Release_Candidate + // + // Examples: "1", "01ABCDEF" + FeatureFlagVersionKey = attribute.Key("feature_flag.version") +) + +// FeatureFlagContextID returns an attribute KeyValue conforming to the +// "feature_flag.context.id" semantic conventions. It represents the unique +// identifier for the flag evaluation context. For example, the targeting key. +func FeatureFlagContextID(val string) attribute.KeyValue { + return FeatureFlagContextIDKey.String(val) +} + +// FeatureFlagErrorMessage returns an attribute KeyValue conforming to the +// "feature_flag.error.message" semantic conventions. It represents a message +// providing more detail about an error that occurred during feature flag +// evaluation in human-readable form. +func FeatureFlagErrorMessage(val string) attribute.KeyValue { + return FeatureFlagErrorMessageKey.String(val) +} + +// FeatureFlagKey returns an attribute KeyValue conforming to the +// "feature_flag.key" semantic conventions. It represents the lookup key of the +// feature flag. +func FeatureFlagKey(val string) attribute.KeyValue { + return FeatureFlagKeyKey.String(val) +} + +// FeatureFlagProviderName returns an attribute KeyValue conforming to the +// "feature_flag.provider.name" semantic conventions. It represents the +// identifies the feature flag provider. +func FeatureFlagProviderName(val string) attribute.KeyValue { + return FeatureFlagProviderNameKey.String(val) +} + +// FeatureFlagResultVariant returns an attribute KeyValue conforming to the +// "feature_flag.result.variant" semantic conventions. It represents a semantic +// identifier for an evaluated flag value. +func FeatureFlagResultVariant(val string) attribute.KeyValue { + return FeatureFlagResultVariantKey.String(val) +} + +// FeatureFlagSetID returns an attribute KeyValue conforming to the +// "feature_flag.set.id" semantic conventions. It represents the identifier of +// the [flag set] to which the feature flag belongs. +// +// [flag set]: https://openfeature.dev/specification/glossary/#flag-set +func FeatureFlagSetID(val string) attribute.KeyValue { + return FeatureFlagSetIDKey.String(val) +} + +// FeatureFlagVersion returns an attribute KeyValue conforming to the +// "feature_flag.version" semantic conventions. It represents the version of the +// ruleset used during the evaluation. This may be any stable value which +// uniquely identifies the ruleset. +func FeatureFlagVersion(val string) attribute.KeyValue { + return FeatureFlagVersionKey.String(val) +} + +// Enum values for feature_flag.result.reason +var ( + // The resolved value is static (no dynamic evaluation). + // Stability: release_candidate + FeatureFlagResultReasonStatic = FeatureFlagResultReasonKey.String("static") + // The resolved value fell back to a pre-configured value (no dynamic evaluation + // occurred or dynamic evaluation yielded no result). + // Stability: release_candidate + FeatureFlagResultReasonDefault = FeatureFlagResultReasonKey.String("default") + // The resolved value was the result of a dynamic evaluation, such as a rule or + // specific user-targeting. + // Stability: release_candidate + FeatureFlagResultReasonTargetingMatch = FeatureFlagResultReasonKey.String("targeting_match") + // The resolved value was the result of pseudorandom assignment. + // Stability: release_candidate + FeatureFlagResultReasonSplit = FeatureFlagResultReasonKey.String("split") + // The resolved value was retrieved from cache. + // Stability: release_candidate + FeatureFlagResultReasonCached = FeatureFlagResultReasonKey.String("cached") + // The resolved value was the result of the flag being disabled in the + // management system. + // Stability: release_candidate + FeatureFlagResultReasonDisabled = FeatureFlagResultReasonKey.String("disabled") + // The reason for the resolved value could not be determined. + // Stability: release_candidate + FeatureFlagResultReasonUnknown = FeatureFlagResultReasonKey.String("unknown") + // The resolved value is non-authoritative or possibly out of date + // Stability: release_candidate + FeatureFlagResultReasonStale = FeatureFlagResultReasonKey.String("stale") + // The resolved value was the result of an error. + // Stability: release_candidate + FeatureFlagResultReasonError = FeatureFlagResultReasonKey.String("error") +) + +// Namespace: file +const ( + // FileAccessedKey is the attribute Key conforming to the "file.accessed" + // semantic conventions. It represents the time when the file was last accessed, + // in ISO 8601 format. + // + // Type: string + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: "2021-01-01T12:00:00Z" + // Note: This attribute might not be supported by some file systems — NFS, + // FAT32, in embedded OS, etc. + FileAccessedKey = attribute.Key("file.accessed") + + // FileAttributesKey is the attribute Key conforming to the "file.attributes" + // semantic conventions. It represents the array of file attributes. + // + // Type: string[] + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: "readonly", "hidden" + // Note: Attributes names depend on the OS or file system. Here’s a + // non-exhaustive list of values expected for this attribute: `archive`, + // `compressed`, `directory`, `encrypted`, `execute`, `hidden`, `immutable`, + // `journaled`, `read`, `readonly`, `symbolic link`, `system`, `temporary`, + // `write`. + FileAttributesKey = attribute.Key("file.attributes") + + // FileChangedKey is the attribute Key conforming to the "file.changed" semantic + // conventions. It represents the time when the file attributes or metadata was + // last changed, in ISO 8601 format. + // + // Type: string + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: "2021-01-01T12:00:00Z" + // Note: `file.changed` captures the time when any of the file's properties or + // attributes (including the content) are changed, while `file.modified` + // captures the timestamp when the file content is modified. + FileChangedKey = attribute.Key("file.changed") + + // FileCreatedKey is the attribute Key conforming to the "file.created" semantic + // conventions. It represents the time when the file was created, in ISO 8601 + // format. + // + // Type: string + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: "2021-01-01T12:00:00Z" + // Note: This attribute might not be supported by some file systems — NFS, + // FAT32, in embedded OS, etc. + FileCreatedKey = attribute.Key("file.created") + + // FileDirectoryKey is the attribute Key conforming to the "file.directory" + // semantic conventions. It represents the directory where the file is located. + // It should include the drive letter, when appropriate. + // + // Type: string + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: "/home/user", "C:\Program Files\MyApp" + FileDirectoryKey = attribute.Key("file.directory") + + // FileExtensionKey is the attribute Key conforming to the "file.extension" + // semantic conventions. It represents the file extension, excluding the leading + // dot. + // + // Type: string + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: "png", "gz" + // Note: When the file name has multiple extensions (example.tar.gz), only the + // last one should be captured ("gz", not "tar.gz"). + FileExtensionKey = attribute.Key("file.extension") + + // FileForkNameKey is the attribute Key conforming to the "file.fork_name" + // semantic conventions. It represents the name of the fork. A fork is + // additional data associated with a filesystem object. + // + // Type: string + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: "Zone.Identifier" + // Note: On Linux, a resource fork is used to store additional data with a + // filesystem object. A file always has at least one fork for the data portion, + // and additional forks may exist. + // On NTFS, this is analogous to an Alternate Data Stream (ADS), and the default + // data stream for a file is just called $DATA. Zone.Identifier is commonly used + // by Windows to track contents downloaded from the Internet. An ADS is + // typically of the form: C:\path\to\filename.extension:some_fork_name, and + // some_fork_name is the value that should populate `fork_name`. + // `filename.extension` should populate `file.name`, and `extension` should + // populate `file.extension`. The full path, `file.path`, will include the fork + // name. + FileForkNameKey = attribute.Key("file.fork_name") + + // FileGroupIDKey is the attribute Key conforming to the "file.group.id" + // semantic conventions. It represents the primary Group ID (GID) of the file. + // + // Type: string + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: "1000" + FileGroupIDKey = attribute.Key("file.group.id") + + // FileGroupNameKey is the attribute Key conforming to the "file.group.name" + // semantic conventions. It represents the primary group name of the file. + // + // Type: string + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: "users" + FileGroupNameKey = attribute.Key("file.group.name") + + // FileInodeKey is the attribute Key conforming to the "file.inode" semantic + // conventions. It represents the inode representing the file in the filesystem. + // + // Type: string + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: "256383" + FileInodeKey = attribute.Key("file.inode") + + // FileModeKey is the attribute Key conforming to the "file.mode" semantic + // conventions. It represents the mode of the file in octal representation. + // + // Type: string + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: "0640" + FileModeKey = attribute.Key("file.mode") + + // FileModifiedKey is the attribute Key conforming to the "file.modified" + // semantic conventions. It represents the time when the file content was last + // modified, in ISO 8601 format. + // + // Type: string + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: "2021-01-01T12:00:00Z" + FileModifiedKey = attribute.Key("file.modified") + + // FileNameKey is the attribute Key conforming to the "file.name" semantic + // conventions. It represents the name of the file including the extension, + // without the directory. + // + // Type: string + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: "example.png" + FileNameKey = attribute.Key("file.name") + + // FileOwnerIDKey is the attribute Key conforming to the "file.owner.id" + // semantic conventions. It represents the user ID (UID) or security identifier + // (SID) of the file owner. + // + // Type: string + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: "1000" + FileOwnerIDKey = attribute.Key("file.owner.id") + + // FileOwnerNameKey is the attribute Key conforming to the "file.owner.name" + // semantic conventions. It represents the username of the file owner. + // + // Type: string + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: "root" + FileOwnerNameKey = attribute.Key("file.owner.name") + + // FilePathKey is the attribute Key conforming to the "file.path" semantic + // conventions. It represents the full path to the file, including the file + // name. It should include the drive letter, when appropriate. + // + // Type: string + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: "/home/alice/example.png", "C:\Program Files\MyApp\myapp.exe" + FilePathKey = attribute.Key("file.path") + + // FileSizeKey is the attribute Key conforming to the "file.size" semantic + // conventions. It represents the file size in bytes. + // + // Type: int + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: + FileSizeKey = attribute.Key("file.size") + + // FileSymbolicLinkTargetPathKey is the attribute Key conforming to the + // "file.symbolic_link.target_path" semantic conventions. It represents the path + // to the target of a symbolic link. + // + // Type: string + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: "/usr/bin/python3" + // Note: This attribute is only applicable to symbolic links. + FileSymbolicLinkTargetPathKey = attribute.Key("file.symbolic_link.target_path") +) + +// FileAccessed returns an attribute KeyValue conforming to the "file.accessed" +// semantic conventions. It represents the time when the file was last accessed, +// in ISO 8601 format. +func FileAccessed(val string) attribute.KeyValue { + return FileAccessedKey.String(val) +} + +// FileAttributes returns an attribute KeyValue conforming to the +// "file.attributes" semantic conventions. It represents the array of file +// attributes. +func FileAttributes(val ...string) attribute.KeyValue { + return FileAttributesKey.StringSlice(val) +} + +// FileChanged returns an attribute KeyValue conforming to the "file.changed" +// semantic conventions. It represents the time when the file attributes or +// metadata was last changed, in ISO 8601 format. +func FileChanged(val string) attribute.KeyValue { + return FileChangedKey.String(val) +} + +// FileCreated returns an attribute KeyValue conforming to the "file.created" +// semantic conventions. It represents the time when the file was created, in ISO +// 8601 format. +func FileCreated(val string) attribute.KeyValue { + return FileCreatedKey.String(val) +} + +// FileDirectory returns an attribute KeyValue conforming to the "file.directory" +// semantic conventions. It represents the directory where the file is located. +// It should include the drive letter, when appropriate. +func FileDirectory(val string) attribute.KeyValue { + return FileDirectoryKey.String(val) +} + +// FileExtension returns an attribute KeyValue conforming to the "file.extension" +// semantic conventions. It represents the file extension, excluding the leading +// dot. +func FileExtension(val string) attribute.KeyValue { + return FileExtensionKey.String(val) +} + +// FileForkName returns an attribute KeyValue conforming to the "file.fork_name" +// semantic conventions. It represents the name of the fork. A fork is additional +// data associated with a filesystem object. +func FileForkName(val string) attribute.KeyValue { + return FileForkNameKey.String(val) +} + +// FileGroupID returns an attribute KeyValue conforming to the "file.group.id" +// semantic conventions. It represents the primary Group ID (GID) of the file. +func FileGroupID(val string) attribute.KeyValue { + return FileGroupIDKey.String(val) +} + +// FileGroupName returns an attribute KeyValue conforming to the +// "file.group.name" semantic conventions. It represents the primary group name +// of the file. +func FileGroupName(val string) attribute.KeyValue { + return FileGroupNameKey.String(val) +} + +// FileInode returns an attribute KeyValue conforming to the "file.inode" +// semantic conventions. It represents the inode representing the file in the +// filesystem. +func FileInode(val string) attribute.KeyValue { + return FileInodeKey.String(val) +} + +// FileMode returns an attribute KeyValue conforming to the "file.mode" semantic +// conventions. It represents the mode of the file in octal representation. +func FileMode(val string) attribute.KeyValue { + return FileModeKey.String(val) +} + +// FileModified returns an attribute KeyValue conforming to the "file.modified" +// semantic conventions. It represents the time when the file content was last +// modified, in ISO 8601 format. +func FileModified(val string) attribute.KeyValue { + return FileModifiedKey.String(val) +} + +// FileName returns an attribute KeyValue conforming to the "file.name" semantic +// conventions. It represents the name of the file including the extension, +// without the directory. +func FileName(val string) attribute.KeyValue { + return FileNameKey.String(val) +} + +// FileOwnerID returns an attribute KeyValue conforming to the "file.owner.id" +// semantic conventions. It represents the user ID (UID) or security identifier +// (SID) of the file owner. +func FileOwnerID(val string) attribute.KeyValue { + return FileOwnerIDKey.String(val) +} + +// FileOwnerName returns an attribute KeyValue conforming to the +// "file.owner.name" semantic conventions. It represents the username of the file +// owner. +func FileOwnerName(val string) attribute.KeyValue { + return FileOwnerNameKey.String(val) +} + +// FilePath returns an attribute KeyValue conforming to the "file.path" semantic +// conventions. It represents the full path to the file, including the file name. +// It should include the drive letter, when appropriate. +func FilePath(val string) attribute.KeyValue { + return FilePathKey.String(val) +} + +// FileSize returns an attribute KeyValue conforming to the "file.size" semantic +// conventions. It represents the file size in bytes. +func FileSize(val int) attribute.KeyValue { + return FileSizeKey.Int(val) +} + +// FileSymbolicLinkTargetPath returns an attribute KeyValue conforming to the +// "file.symbolic_link.target_path" semantic conventions. It represents the path +// to the target of a symbolic link. +func FileSymbolicLinkTargetPath(val string) attribute.KeyValue { + return FileSymbolicLinkTargetPathKey.String(val) +} + +// Namespace: gcp +const ( + // GCPAppHubApplicationContainerKey is the attribute Key conforming to the + // "gcp.apphub.application.container" semantic conventions. It represents the + // container within GCP where the AppHub application is defined. + // + // Type: string + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: "projects/my-container-project" + GCPAppHubApplicationContainerKey = attribute.Key("gcp.apphub.application.container") + + // GCPAppHubApplicationIDKey is the attribute Key conforming to the + // "gcp.apphub.application.id" semantic conventions. It represents the name of + // the application as configured in AppHub. + // + // Type: string + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: "my-application" + GCPAppHubApplicationIDKey = attribute.Key("gcp.apphub.application.id") + + // GCPAppHubApplicationLocationKey is the attribute Key conforming to the + // "gcp.apphub.application.location" semantic conventions. It represents the GCP + // zone or region where the application is defined. + // + // Type: string + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: "us-central1" + GCPAppHubApplicationLocationKey = attribute.Key("gcp.apphub.application.location") + + // GCPAppHubServiceCriticalityTypeKey is the attribute Key conforming to the + // "gcp.apphub.service.criticality_type" semantic conventions. It represents the + // criticality of a service indicates its importance to the business. + // + // Type: Enum + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: + // Note: [See AppHub type enum] + // + // [See AppHub type enum]: https://cloud.google.com/app-hub/docs/reference/rest/v1/Attributes#type + GCPAppHubServiceCriticalityTypeKey = attribute.Key("gcp.apphub.service.criticality_type") + + // GCPAppHubServiceEnvironmentTypeKey is the attribute Key conforming to the + // "gcp.apphub.service.environment_type" semantic conventions. It represents the + // environment of a service is the stage of a software lifecycle. + // + // Type: Enum + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: + // Note: [See AppHub environment type] + // + // [See AppHub environment type]: https://cloud.google.com/app-hub/docs/reference/rest/v1/Attributes#type_1 + GCPAppHubServiceEnvironmentTypeKey = attribute.Key("gcp.apphub.service.environment_type") + + // GCPAppHubServiceIDKey is the attribute Key conforming to the + // "gcp.apphub.service.id" semantic conventions. It represents the name of the + // service as configured in AppHub. + // + // Type: string + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: "my-service" + GCPAppHubServiceIDKey = attribute.Key("gcp.apphub.service.id") + + // GCPAppHubWorkloadCriticalityTypeKey is the attribute Key conforming to the + // "gcp.apphub.workload.criticality_type" semantic conventions. It represents + // the criticality of a workload indicates its importance to the business. + // + // Type: Enum + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: + // Note: [See AppHub type enum] + // + // [See AppHub type enum]: https://cloud.google.com/app-hub/docs/reference/rest/v1/Attributes#type + GCPAppHubWorkloadCriticalityTypeKey = attribute.Key("gcp.apphub.workload.criticality_type") + + // GCPAppHubWorkloadEnvironmentTypeKey is the attribute Key conforming to the + // "gcp.apphub.workload.environment_type" semantic conventions. It represents + // the environment of a workload is the stage of a software lifecycle. + // + // Type: Enum + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: + // Note: [See AppHub environment type] + // + // [See AppHub environment type]: https://cloud.google.com/app-hub/docs/reference/rest/v1/Attributes#type_1 + GCPAppHubWorkloadEnvironmentTypeKey = attribute.Key("gcp.apphub.workload.environment_type") + + // GCPAppHubWorkloadIDKey is the attribute Key conforming to the + // "gcp.apphub.workload.id" semantic conventions. It represents the name of the + // workload as configured in AppHub. + // + // Type: string + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: "my-workload" + GCPAppHubWorkloadIDKey = attribute.Key("gcp.apphub.workload.id") + + // GCPAppHubDestinationApplicationContainerKey is the attribute Key conforming + // to the "gcp.apphub_destination.application.container" semantic conventions. + // It represents the container within GCP where the AppHub destination + // application is defined. + // + // Type: string + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: "projects/my-container-project" + GCPAppHubDestinationApplicationContainerKey = attribute.Key("gcp.apphub_destination.application.container") + + // GCPAppHubDestinationApplicationIDKey is the attribute Key conforming to the + // "gcp.apphub_destination.application.id" semantic conventions. It represents + // the name of the destination application as configured in AppHub. + // + // Type: string + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: "my-application" + GCPAppHubDestinationApplicationIDKey = attribute.Key("gcp.apphub_destination.application.id") + + // GCPAppHubDestinationApplicationLocationKey is the attribute Key conforming to + // the "gcp.apphub_destination.application.location" semantic conventions. It + // represents the GCP zone or region where the destination application is + // defined. + // + // Type: string + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: "us-central1" + GCPAppHubDestinationApplicationLocationKey = attribute.Key("gcp.apphub_destination.application.location") + + // GCPAppHubDestinationServiceCriticalityTypeKey is the attribute Key conforming + // to the "gcp.apphub_destination.service.criticality_type" semantic + // conventions. It represents the criticality of a destination workload + // indicates its importance to the business as specified in [AppHub type enum]. + // + // Type: Enum + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: + // + // [AppHub type enum]: https://cloud.google.com/app-hub/docs/reference/rest/v1/Attributes#type + GCPAppHubDestinationServiceCriticalityTypeKey = attribute.Key("gcp.apphub_destination.service.criticality_type") + + // GCPAppHubDestinationServiceEnvironmentTypeKey is the attribute Key conforming + // to the "gcp.apphub_destination.service.environment_type" semantic + // conventions. It represents the software lifecycle stage of a destination + // service as defined [AppHub environment type]. + // + // Type: Enum + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: + // + // [AppHub environment type]: https://cloud.google.com/app-hub/docs/reference/rest/v1/Attributes#type_1 + GCPAppHubDestinationServiceEnvironmentTypeKey = attribute.Key("gcp.apphub_destination.service.environment_type") + + // GCPAppHubDestinationServiceIDKey is the attribute Key conforming to the + // "gcp.apphub_destination.service.id" semantic conventions. It represents the + // name of the destination service as configured in AppHub. + // + // Type: string + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: "my-service" + GCPAppHubDestinationServiceIDKey = attribute.Key("gcp.apphub_destination.service.id") + + // GCPAppHubDestinationWorkloadCriticalityTypeKey is the attribute Key + // conforming to the "gcp.apphub_destination.workload.criticality_type" semantic + // conventions. It represents the criticality of a destination workload + // indicates its importance to the business as specified in [AppHub type enum]. + // + // Type: Enum + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: + // + // [AppHub type enum]: https://cloud.google.com/app-hub/docs/reference/rest/v1/Attributes#type + GCPAppHubDestinationWorkloadCriticalityTypeKey = attribute.Key("gcp.apphub_destination.workload.criticality_type") + + // GCPAppHubDestinationWorkloadEnvironmentTypeKey is the attribute Key + // conforming to the "gcp.apphub_destination.workload.environment_type" semantic + // conventions. It represents the environment of a destination workload is the + // stage of a software lifecycle as provided in the [AppHub environment type]. + // + // Type: Enum + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: + // + // [AppHub environment type]: https://cloud.google.com/app-hub/docs/reference/rest/v1/Attributes#type_1 + GCPAppHubDestinationWorkloadEnvironmentTypeKey = attribute.Key("gcp.apphub_destination.workload.environment_type") + + // GCPAppHubDestinationWorkloadIDKey is the attribute Key conforming to the + // "gcp.apphub_destination.workload.id" semantic conventions. It represents the + // name of the destination workload as configured in AppHub. + // + // Type: string + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: "my-workload" + GCPAppHubDestinationWorkloadIDKey = attribute.Key("gcp.apphub_destination.workload.id") + + // GCPClientServiceKey is the attribute Key conforming to the + // "gcp.client.service" semantic conventions. It represents the identifies the + // Google Cloud service for which the official client library is intended. + // + // Type: string + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: "appengine", "run", "firestore", "alloydb", "spanner" + // Note: Intended to be a stable identifier for Google Cloud client libraries + // that is uniform across implementation languages. The value should be derived + // from the canonical service domain for the service; for example, + // 'foo.googleapis.com' should result in a value of 'foo'. + GCPClientServiceKey = attribute.Key("gcp.client.service") + + // GCPCloudRunJobExecutionKey is the attribute Key conforming to the + // "gcp.cloud_run.job.execution" semantic conventions. It represents the name of + // the Cloud Run [execution] being run for the Job, as set by the + // [`CLOUD_RUN_EXECUTION`] environment variable. + // + // Type: string + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: "job-name-xxxx", "sample-job-mdw84" + // + // [execution]: https://cloud.google.com/run/docs/managing/job-executions + // [`CLOUD_RUN_EXECUTION`]: https://cloud.google.com/run/docs/container-contract#jobs-env-vars + GCPCloudRunJobExecutionKey = attribute.Key("gcp.cloud_run.job.execution") + + // GCPCloudRunJobTaskIndexKey is the attribute Key conforming to the + // "gcp.cloud_run.job.task_index" semantic conventions. It represents the index + // for a task within an execution as provided by the [`CLOUD_RUN_TASK_INDEX`] + // environment variable. + // + // Type: int + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: 0, 1 + // + // [`CLOUD_RUN_TASK_INDEX`]: https://cloud.google.com/run/docs/container-contract#jobs-env-vars + GCPCloudRunJobTaskIndexKey = attribute.Key("gcp.cloud_run.job.task_index") + + // GCPGCEInstanceHostnameKey is the attribute Key conforming to the + // "gcp.gce.instance.hostname" semantic conventions. It represents the hostname + // of a GCE instance. This is the full value of the default or [custom hostname] + // . + // + // Type: string + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: "my-host1234.example.com", + // "sample-vm.us-west1-b.c.my-project.internal" + // + // [custom hostname]: https://cloud.google.com/compute/docs/instances/custom-hostname-vm + GCPGCEInstanceHostnameKey = attribute.Key("gcp.gce.instance.hostname") + + // GCPGCEInstanceNameKey is the attribute Key conforming to the + // "gcp.gce.instance.name" semantic conventions. It represents the instance name + // of a GCE instance. This is the value provided by `host.name`, the visible + // name of the instance in the Cloud Console UI, and the prefix for the default + // hostname of the instance as defined by the [default internal DNS name]. + // + // Type: string + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: "instance-1", "my-vm-name" + // + // [default internal DNS name]: https://cloud.google.com/compute/docs/internal-dns#instance-fully-qualified-domain-names + GCPGCEInstanceNameKey = attribute.Key("gcp.gce.instance.name") + + // GCPGCEInstanceGroupManagerNameKey is the attribute Key conforming to the + // "gcp.gce.instance_group_manager.name" semantic conventions. It represents the + // name of the Instance Group Manager (IGM) that manages this VM, if any. + // + // Type: string + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: "web-igm", "my-managed-group" + GCPGCEInstanceGroupManagerNameKey = attribute.Key("gcp.gce.instance_group_manager.name") + + // GCPGCEInstanceGroupManagerRegionKey is the attribute Key conforming to the + // "gcp.gce.instance_group_manager.region" semantic conventions. It represents + // the region of a **regional** Instance Group Manager (e.g., `us-central1`). + // Set this **only** when the IGM is regional. + // + // Type: string + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: "us-central1", "europe-west1" + GCPGCEInstanceGroupManagerRegionKey = attribute.Key("gcp.gce.instance_group_manager.region") + + // GCPGCEInstanceGroupManagerZoneKey is the attribute Key conforming to the + // "gcp.gce.instance_group_manager.zone" semantic conventions. It represents the + // zone of a **zonal** Instance Group Manager (e.g., `us-central1-a`). Set this + // **only** when the IGM is zonal. + // + // Type: string + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: "us-central1-a", "europe-west1-b" + GCPGCEInstanceGroupManagerZoneKey = attribute.Key("gcp.gce.instance_group_manager.zone") +) + +// GCPAppHubApplicationContainer returns an attribute KeyValue conforming to the +// "gcp.apphub.application.container" semantic conventions. It represents the +// container within GCP where the AppHub application is defined. +func GCPAppHubApplicationContainer(val string) attribute.KeyValue { + return GCPAppHubApplicationContainerKey.String(val) +} + +// GCPAppHubApplicationID returns an attribute KeyValue conforming to the +// "gcp.apphub.application.id" semantic conventions. It represents the name of +// the application as configured in AppHub. +func GCPAppHubApplicationID(val string) attribute.KeyValue { + return GCPAppHubApplicationIDKey.String(val) +} + +// GCPAppHubApplicationLocation returns an attribute KeyValue conforming to the +// "gcp.apphub.application.location" semantic conventions. It represents the GCP +// zone or region where the application is defined. +func GCPAppHubApplicationLocation(val string) attribute.KeyValue { + return GCPAppHubApplicationLocationKey.String(val) +} + +// GCPAppHubServiceID returns an attribute KeyValue conforming to the +// "gcp.apphub.service.id" semantic conventions. It represents the name of the +// service as configured in AppHub. +func GCPAppHubServiceID(val string) attribute.KeyValue { + return GCPAppHubServiceIDKey.String(val) +} + +// GCPAppHubWorkloadID returns an attribute KeyValue conforming to the +// "gcp.apphub.workload.id" semantic conventions. It represents the name of the +// workload as configured in AppHub. +func GCPAppHubWorkloadID(val string) attribute.KeyValue { + return GCPAppHubWorkloadIDKey.String(val) +} + +// GCPAppHubDestinationApplicationContainer returns an attribute KeyValue +// conforming to the "gcp.apphub_destination.application.container" semantic +// conventions. It represents the container within GCP where the AppHub +// destination application is defined. +func GCPAppHubDestinationApplicationContainer(val string) attribute.KeyValue { + return GCPAppHubDestinationApplicationContainerKey.String(val) +} + +// GCPAppHubDestinationApplicationID returns an attribute KeyValue conforming to +// the "gcp.apphub_destination.application.id" semantic conventions. It +// represents the name of the destination application as configured in AppHub. +func GCPAppHubDestinationApplicationID(val string) attribute.KeyValue { + return GCPAppHubDestinationApplicationIDKey.String(val) +} + +// GCPAppHubDestinationApplicationLocation returns an attribute KeyValue +// conforming to the "gcp.apphub_destination.application.location" semantic +// conventions. It represents the GCP zone or region where the destination +// application is defined. +func GCPAppHubDestinationApplicationLocation(val string) attribute.KeyValue { + return GCPAppHubDestinationApplicationLocationKey.String(val) +} + +// GCPAppHubDestinationServiceID returns an attribute KeyValue conforming to the +// "gcp.apphub_destination.service.id" semantic conventions. It represents the +// name of the destination service as configured in AppHub. +func GCPAppHubDestinationServiceID(val string) attribute.KeyValue { + return GCPAppHubDestinationServiceIDKey.String(val) +} + +// GCPAppHubDestinationWorkloadID returns an attribute KeyValue conforming to the +// "gcp.apphub_destination.workload.id" semantic conventions. It represents the +// name of the destination workload as configured in AppHub. +func GCPAppHubDestinationWorkloadID(val string) attribute.KeyValue { + return GCPAppHubDestinationWorkloadIDKey.String(val) +} + +// GCPClientService returns an attribute KeyValue conforming to the +// "gcp.client.service" semantic conventions. It represents the identifies the +// Google Cloud service for which the official client library is intended. +func GCPClientService(val string) attribute.KeyValue { + return GCPClientServiceKey.String(val) +} + +// GCPCloudRunJobExecution returns an attribute KeyValue conforming to the +// "gcp.cloud_run.job.execution" semantic conventions. It represents the name of +// the Cloud Run [execution] being run for the Job, as set by the +// [`CLOUD_RUN_EXECUTION`] environment variable. +// +// [execution]: https://cloud.google.com/run/docs/managing/job-executions +// [`CLOUD_RUN_EXECUTION`]: https://cloud.google.com/run/docs/container-contract#jobs-env-vars +func GCPCloudRunJobExecution(val string) attribute.KeyValue { + return GCPCloudRunJobExecutionKey.String(val) +} + +// GCPCloudRunJobTaskIndex returns an attribute KeyValue conforming to the +// "gcp.cloud_run.job.task_index" semantic conventions. It represents the index +// for a task within an execution as provided by the [`CLOUD_RUN_TASK_INDEX`] +// environment variable. +// +// [`CLOUD_RUN_TASK_INDEX`]: https://cloud.google.com/run/docs/container-contract#jobs-env-vars +func GCPCloudRunJobTaskIndex(val int) attribute.KeyValue { + return GCPCloudRunJobTaskIndexKey.Int(val) +} + +// GCPGCEInstanceHostname returns an attribute KeyValue conforming to the +// "gcp.gce.instance.hostname" semantic conventions. It represents the hostname +// of a GCE instance. This is the full value of the default or [custom hostname] +// . +// +// [custom hostname]: https://cloud.google.com/compute/docs/instances/custom-hostname-vm +func GCPGCEInstanceHostname(val string) attribute.KeyValue { + return GCPGCEInstanceHostnameKey.String(val) +} + +// GCPGCEInstanceName returns an attribute KeyValue conforming to the +// "gcp.gce.instance.name" semantic conventions. It represents the instance name +// of a GCE instance. This is the value provided by `host.name`, the visible name +// of the instance in the Cloud Console UI, and the prefix for the default +// hostname of the instance as defined by the [default internal DNS name]. +// +// [default internal DNS name]: https://cloud.google.com/compute/docs/internal-dns#instance-fully-qualified-domain-names +func GCPGCEInstanceName(val string) attribute.KeyValue { + return GCPGCEInstanceNameKey.String(val) +} + +// GCPGCEInstanceGroupManagerName returns an attribute KeyValue conforming to the +// "gcp.gce.instance_group_manager.name" semantic conventions. It represents the +// name of the Instance Group Manager (IGM) that manages this VM, if any. +func GCPGCEInstanceGroupManagerName(val string) attribute.KeyValue { + return GCPGCEInstanceGroupManagerNameKey.String(val) +} + +// GCPGCEInstanceGroupManagerRegion returns an attribute KeyValue conforming to +// the "gcp.gce.instance_group_manager.region" semantic conventions. It +// represents the region of a **regional** Instance Group Manager (e.g., +// `us-central1`). Set this **only** when the IGM is regional. +func GCPGCEInstanceGroupManagerRegion(val string) attribute.KeyValue { + return GCPGCEInstanceGroupManagerRegionKey.String(val) +} + +// GCPGCEInstanceGroupManagerZone returns an attribute KeyValue conforming to the +// "gcp.gce.instance_group_manager.zone" semantic conventions. It represents the +// zone of a **zonal** Instance Group Manager (e.g., `us-central1-a`). Set this +// **only** when the IGM is zonal. +func GCPGCEInstanceGroupManagerZone(val string) attribute.KeyValue { + return GCPGCEInstanceGroupManagerZoneKey.String(val) +} + +// Enum values for gcp.apphub.service.criticality_type +var ( + // Mission critical service. + // Stability: development + GCPAppHubServiceCriticalityTypeMissionCritical = GCPAppHubServiceCriticalityTypeKey.String("MISSION_CRITICAL") + // High impact. + // Stability: development + GCPAppHubServiceCriticalityTypeHigh = GCPAppHubServiceCriticalityTypeKey.String("HIGH") + // Medium impact. + // Stability: development + GCPAppHubServiceCriticalityTypeMedium = GCPAppHubServiceCriticalityTypeKey.String("MEDIUM") + // Low impact. + // Stability: development + GCPAppHubServiceCriticalityTypeLow = GCPAppHubServiceCriticalityTypeKey.String("LOW") +) + +// Enum values for gcp.apphub.service.environment_type +var ( + // Production environment. + // Stability: development + GCPAppHubServiceEnvironmentTypeProduction = GCPAppHubServiceEnvironmentTypeKey.String("PRODUCTION") + // Staging environment. + // Stability: development + GCPAppHubServiceEnvironmentTypeStaging = GCPAppHubServiceEnvironmentTypeKey.String("STAGING") + // Test environment. + // Stability: development + GCPAppHubServiceEnvironmentTypeTest = GCPAppHubServiceEnvironmentTypeKey.String("TEST") + // Development environment. + // Stability: development + GCPAppHubServiceEnvironmentTypeDevelopment = GCPAppHubServiceEnvironmentTypeKey.String("DEVELOPMENT") +) + +// Enum values for gcp.apphub.workload.criticality_type +var ( + // Mission critical service. + // Stability: development + GCPAppHubWorkloadCriticalityTypeMissionCritical = GCPAppHubWorkloadCriticalityTypeKey.String("MISSION_CRITICAL") + // High impact. + // Stability: development + GCPAppHubWorkloadCriticalityTypeHigh = GCPAppHubWorkloadCriticalityTypeKey.String("HIGH") + // Medium impact. + // Stability: development + GCPAppHubWorkloadCriticalityTypeMedium = GCPAppHubWorkloadCriticalityTypeKey.String("MEDIUM") + // Low impact. + // Stability: development + GCPAppHubWorkloadCriticalityTypeLow = GCPAppHubWorkloadCriticalityTypeKey.String("LOW") +) + +// Enum values for gcp.apphub.workload.environment_type +var ( + // Production environment. + // Stability: development + GCPAppHubWorkloadEnvironmentTypeProduction = GCPAppHubWorkloadEnvironmentTypeKey.String("PRODUCTION") + // Staging environment. + // Stability: development + GCPAppHubWorkloadEnvironmentTypeStaging = GCPAppHubWorkloadEnvironmentTypeKey.String("STAGING") + // Test environment. + // Stability: development + GCPAppHubWorkloadEnvironmentTypeTest = GCPAppHubWorkloadEnvironmentTypeKey.String("TEST") + // Development environment. + // Stability: development + GCPAppHubWorkloadEnvironmentTypeDevelopment = GCPAppHubWorkloadEnvironmentTypeKey.String("DEVELOPMENT") +) + +// Enum values for gcp.apphub_destination.service.criticality_type +var ( + // Mission critical service. + // Stability: development + GCPAppHubDestinationServiceCriticalityTypeMissionCritical = GCPAppHubDestinationServiceCriticalityTypeKey.String("MISSION_CRITICAL") + // High impact. + // Stability: development + GCPAppHubDestinationServiceCriticalityTypeHigh = GCPAppHubDestinationServiceCriticalityTypeKey.String("HIGH") + // Medium impact. + // Stability: development + GCPAppHubDestinationServiceCriticalityTypeMedium = GCPAppHubDestinationServiceCriticalityTypeKey.String("MEDIUM") + // Low impact. + // Stability: development + GCPAppHubDestinationServiceCriticalityTypeLow = GCPAppHubDestinationServiceCriticalityTypeKey.String("LOW") +) + +// Enum values for gcp.apphub_destination.service.environment_type +var ( + // Production environment. + // Stability: development + GCPAppHubDestinationServiceEnvironmentTypeProduction = GCPAppHubDestinationServiceEnvironmentTypeKey.String("PRODUCTION") + // Staging environment. + // Stability: development + GCPAppHubDestinationServiceEnvironmentTypeStaging = GCPAppHubDestinationServiceEnvironmentTypeKey.String("STAGING") + // Test environment. + // Stability: development + GCPAppHubDestinationServiceEnvironmentTypeTest = GCPAppHubDestinationServiceEnvironmentTypeKey.String("TEST") + // Development environment. + // Stability: development + GCPAppHubDestinationServiceEnvironmentTypeDevelopment = GCPAppHubDestinationServiceEnvironmentTypeKey.String("DEVELOPMENT") +) + +// Enum values for gcp.apphub_destination.workload.criticality_type +var ( + // Mission critical service. + // Stability: development + GCPAppHubDestinationWorkloadCriticalityTypeMissionCritical = GCPAppHubDestinationWorkloadCriticalityTypeKey.String("MISSION_CRITICAL") + // High impact. + // Stability: development + GCPAppHubDestinationWorkloadCriticalityTypeHigh = GCPAppHubDestinationWorkloadCriticalityTypeKey.String("HIGH") + // Medium impact. + // Stability: development + GCPAppHubDestinationWorkloadCriticalityTypeMedium = GCPAppHubDestinationWorkloadCriticalityTypeKey.String("MEDIUM") + // Low impact. + // Stability: development + GCPAppHubDestinationWorkloadCriticalityTypeLow = GCPAppHubDestinationWorkloadCriticalityTypeKey.String("LOW") +) + +// Enum values for gcp.apphub_destination.workload.environment_type +var ( + // Production environment. + // Stability: development + GCPAppHubDestinationWorkloadEnvironmentTypeProduction = GCPAppHubDestinationWorkloadEnvironmentTypeKey.String("PRODUCTION") + // Staging environment. + // Stability: development + GCPAppHubDestinationWorkloadEnvironmentTypeStaging = GCPAppHubDestinationWorkloadEnvironmentTypeKey.String("STAGING") + // Test environment. + // Stability: development + GCPAppHubDestinationWorkloadEnvironmentTypeTest = GCPAppHubDestinationWorkloadEnvironmentTypeKey.String("TEST") + // Development environment. + // Stability: development + GCPAppHubDestinationWorkloadEnvironmentTypeDevelopment = GCPAppHubDestinationWorkloadEnvironmentTypeKey.String("DEVELOPMENT") +) + +// Namespace: gen_ai +const ( + // GenAIAgentDescriptionKey is the attribute Key conforming to the + // "gen_ai.agent.description" semantic conventions. It represents the free-form + // description of the GenAI agent provided by the application. + // + // Type: string + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: "Helps with math problems", "Generates fiction stories" + GenAIAgentDescriptionKey = attribute.Key("gen_ai.agent.description") + + // GenAIAgentIDKey is the attribute Key conforming to the "gen_ai.agent.id" + // semantic conventions. It represents the unique identifier of the GenAI agent. + // + // Type: string + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: "asst_5j66UpCpwteGg4YSxUnt7lPY" + GenAIAgentIDKey = attribute.Key("gen_ai.agent.id") + + // GenAIAgentNameKey is the attribute Key conforming to the "gen_ai.agent.name" + // semantic conventions. It represents the human-readable name of the GenAI + // agent provided by the application. + // + // Type: string + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: "Math Tutor", "Fiction Writer" + GenAIAgentNameKey = attribute.Key("gen_ai.agent.name") + + // GenAIAgentVersionKey is the attribute Key conforming to the + // "gen_ai.agent.version" semantic conventions. It represents the version of the + // GenAI agent. + // + // Type: string + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: "1.0.0", "2025-05-01" + GenAIAgentVersionKey = attribute.Key("gen_ai.agent.version") + + // GenAIConversationIDKey is the attribute Key conforming to the + // "gen_ai.conversation.id" semantic conventions. It represents the unique + // identifier for a conversation (session, thread), used to store and correlate + // messages within this conversation. + // + // Type: string + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: "conv_5j66UpCpwteGg4YSxUnt7lPY" + GenAIConversationIDKey = attribute.Key("gen_ai.conversation.id") + + // GenAIDataSourceIDKey is the attribute Key conforming to the + // "gen_ai.data_source.id" semantic conventions. It represents the data source + // identifier. + // + // Type: string + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: "H7STPQYOND" + // Note: Data sources are used by AI agents and RAG applications to store + // grounding data. A data source may be an external database, object store, + // document collection, website, or any other storage system used by the GenAI + // agent or application. The `gen_ai.data_source.id` SHOULD match the identifier + // used by the GenAI system rather than a name specific to the external storage, + // such as a database or object store. Semantic conventions referencing + // `gen_ai.data_source.id` MAY also leverage additional attributes, such as + // `db.*`, to further identify and describe the data source. + GenAIDataSourceIDKey = attribute.Key("gen_ai.data_source.id") + + // GenAIEmbeddingsDimensionCountKey is the attribute Key conforming to the + // "gen_ai.embeddings.dimension.count" semantic conventions. It represents the + // number of dimensions the resulting output embeddings should have. + // + // Type: int + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: 512, 1024 + GenAIEmbeddingsDimensionCountKey = attribute.Key("gen_ai.embeddings.dimension.count") + + // GenAIEvaluationExplanationKey is the attribute Key conforming to the + // "gen_ai.evaluation.explanation" semantic conventions. It represents a + // free-form explanation for the assigned score provided by the evaluator. + // + // Type: string + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: "The response is factually accurate but lacks sufficient detail to + // fully address the question." + GenAIEvaluationExplanationKey = attribute.Key("gen_ai.evaluation.explanation") + + // GenAIEvaluationNameKey is the attribute Key conforming to the + // "gen_ai.evaluation.name" semantic conventions. It represents the name of the + // evaluation metric used for the GenAI response. + // + // Type: string + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: "Relevance", "IntentResolution" + GenAIEvaluationNameKey = attribute.Key("gen_ai.evaluation.name") + + // GenAIEvaluationScoreLabelKey is the attribute Key conforming to the + // "gen_ai.evaluation.score.label" semantic conventions. It represents the human + // readable label for evaluation. + // + // Type: string + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: "relevant", "not_relevant", "correct", "incorrect", "pass", "fail" + // Note: This attribute provides a human-readable interpretation of the + // evaluation score produced by an evaluator. For example, a score value of 1 + // could mean "relevant" in one evaluation system and "not relevant" in another, + // depending on the scoring range and evaluator. The label SHOULD have low + // cardinality. Possible values depend on the evaluation metric and evaluator + // used; implementations SHOULD document the possible values. + GenAIEvaluationScoreLabelKey = attribute.Key("gen_ai.evaluation.score.label") + + // GenAIEvaluationScoreValueKey is the attribute Key conforming to the + // "gen_ai.evaluation.score.value" semantic conventions. It represents the + // evaluation score returned by the evaluator. + // + // Type: double + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: 4.0 + GenAIEvaluationScoreValueKey = attribute.Key("gen_ai.evaluation.score.value") + + // GenAIInputMessagesKey is the attribute Key conforming to the + // "gen_ai.input.messages" semantic conventions. It represents the chat history + // provided to the model as an input. + // + // Type: any + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: "[\n {\n "role": "user",\n "parts": [\n {\n "type": "text",\n + // "content": "Weather in Paris?"\n }\n ]\n },\n {\n "role": "assistant",\n + // "parts": [\n {\n "type": "tool_call",\n "id": + // "call_VSPygqKTWdrhaFErNvMV18Yl",\n "name": "get_weather",\n "arguments": {\n + // "location": "Paris"\n }\n }\n ]\n },\n {\n "role": "tool",\n "parts": [\n {\n + // "type": "tool_call_response",\n "id": " call_VSPygqKTWdrhaFErNvMV18Yl",\n + // "result": "rainy, 57°F"\n }\n ]\n }\n]\n" + // Note: Instrumentations MUST follow [Input messages JSON schema]. + // When the attribute is recorded on events, it MUST be recorded in structured + // form. When recorded on spans, it MAY be recorded as a JSON string if + // structured + // format is not supported and SHOULD be recorded in structured form otherwise. + // + // Messages MUST be provided in the order they were sent to the model. + // Instrumentations MAY provide a way for users to filter or truncate + // input messages. + // + // > [!Warning] + // > This attribute is likely to contain sensitive information including + // > user/PII data. + // + // See [Recording content on attributes] + // section for more details. + // + // [Input messages JSON schema]: /docs/gen-ai/gen-ai-input-messages.json + // [Recording content on attributes]: /docs/gen-ai/gen-ai-spans.md#recording-content-on-attributes + GenAIInputMessagesKey = attribute.Key("gen_ai.input.messages") + + // GenAIOperationNameKey is the attribute Key conforming to the + // "gen_ai.operation.name" semantic conventions. It represents the name of the + // operation being performed. + // + // Type: Enum + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: + // Note: If one of the predefined values applies, but specific system uses a + // different name it's RECOMMENDED to document it in the semantic conventions + // for specific GenAI system and use system-specific name in the + // instrumentation. If a different name is not documented, instrumentation + // libraries SHOULD use applicable predefined value. + GenAIOperationNameKey = attribute.Key("gen_ai.operation.name") + + // GenAIOutputMessagesKey is the attribute Key conforming to the + // "gen_ai.output.messages" semantic conventions. It represents the messages + // returned by the model where each message represents a specific model response + // (choice, candidate). + // + // Type: any + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: "[\n {\n "role": "assistant",\n "parts": [\n {\n "type": "text",\n + // "content": "The weather in Paris is currently rainy with a temperature of + // 57°F."\n }\n ],\n "finish_reason": "stop"\n }\n]\n" + // Note: Instrumentations MUST follow [Output messages JSON schema] + // + // Each message represents a single output choice/candidate generated by + // the model. Each message corresponds to exactly one generation + // (choice/candidate) and vice versa - one choice cannot be split across + // multiple messages or one message cannot contain parts from multiple choices. + // + // When the attribute is recorded on events, it MUST be recorded in structured + // form. When recorded on spans, it MAY be recorded as a JSON string if + // structured + // format is not supported and SHOULD be recorded in structured form otherwise. + // + // Instrumentations MAY provide a way for users to filter or truncate + // output messages. + // + // > [!Warning] + // > This attribute is likely to contain sensitive information including + // > user/PII data. + // + // See [Recording content on attributes] + // section for more details. + // + // [Output messages JSON schema]: /docs/gen-ai/gen-ai-output-messages.json + // [Recording content on attributes]: /docs/gen-ai/gen-ai-spans.md#recording-content-on-attributes + GenAIOutputMessagesKey = attribute.Key("gen_ai.output.messages") + + // GenAIOutputTypeKey is the attribute Key conforming to the + // "gen_ai.output.type" semantic conventions. It represents the represents the + // content type requested by the client. + // + // Type: Enum + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: + // Note: This attribute SHOULD be used when the client requests output of a + // specific type. The model may return zero or more outputs of this type. + // This attribute specifies the output modality and not the actual output + // format. For example, if an image is requested, the actual output could be a + // URL pointing to an image file. + // Additional output format details may be recorded in the future in the + // `gen_ai.output.{type}.*` attributes. + GenAIOutputTypeKey = attribute.Key("gen_ai.output.type") + + // GenAIPromptNameKey is the attribute Key conforming to the + // "gen_ai.prompt.name" semantic conventions. It represents the name of the + // prompt that uniquely identifies it. + // + // Type: string + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: "analyze-code" + GenAIPromptNameKey = attribute.Key("gen_ai.prompt.name") + + // GenAIProviderNameKey is the attribute Key conforming to the + // "gen_ai.provider.name" semantic conventions. It represents the Generative AI + // provider as identified by the client or server instrumentation. + // + // Type: Enum + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: + // Note: The attribute SHOULD be set based on the instrumentation's best + // knowledge and may differ from the actual model provider. + // + // Multiple providers, including Azure OpenAI, Gemini, and AI hosting platforms + // are accessible using the OpenAI REST API and corresponding client libraries, + // but may proxy or host models from different providers. + // + // The `gen_ai.request.model`, `gen_ai.response.model`, and `server.address` + // attributes may help identify the actual system in use. + // + // The `gen_ai.provider.name` attribute acts as a discriminator that + // identifies the GenAI telemetry format flavor specific to that provider + // within GenAI semantic conventions. + // It SHOULD be set consistently with provider-specific attributes and signals. + // For example, GenAI spans, metrics, and events related to AWS Bedrock + // should have the `gen_ai.provider.name` set to `aws.bedrock` and include + // applicable `aws.bedrock.*` attributes and are not expected to include + // `openai.*` attributes. + GenAIProviderNameKey = attribute.Key("gen_ai.provider.name") + + // GenAIRequestChoiceCountKey is the attribute Key conforming to the + // "gen_ai.request.choice.count" semantic conventions. It represents the target + // number of candidate completions to return. + // + // Type: int + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: 3 + GenAIRequestChoiceCountKey = attribute.Key("gen_ai.request.choice.count") + + // GenAIRequestEncodingFormatsKey is the attribute Key conforming to the + // "gen_ai.request.encoding_formats" semantic conventions. It represents the + // encoding formats requested in an embeddings operation, if specified. + // + // Type: string[] + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: "base64"], ["float", "binary" + // Note: In some GenAI systems the encoding formats are called embedding types. + // Also, some GenAI systems only accept a single format per request. + GenAIRequestEncodingFormatsKey = attribute.Key("gen_ai.request.encoding_formats") + + // GenAIRequestFrequencyPenaltyKey is the attribute Key conforming to the + // "gen_ai.request.frequency_penalty" semantic conventions. It represents the + // frequency penalty setting for the GenAI request. + // + // Type: double + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: 0.1 + GenAIRequestFrequencyPenaltyKey = attribute.Key("gen_ai.request.frequency_penalty") + + // GenAIRequestMaxTokensKey is the attribute Key conforming to the + // "gen_ai.request.max_tokens" semantic conventions. It represents the maximum + // number of tokens the model generates for a request. + // + // Type: int + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: 100 + GenAIRequestMaxTokensKey = attribute.Key("gen_ai.request.max_tokens") + + // GenAIRequestModelKey is the attribute Key conforming to the + // "gen_ai.request.model" semantic conventions. It represents the name of the + // GenAI model a request is being made to. + // + // Type: string + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: gpt-4 + GenAIRequestModelKey = attribute.Key("gen_ai.request.model") + + // GenAIRequestPresencePenaltyKey is the attribute Key conforming to the + // "gen_ai.request.presence_penalty" semantic conventions. It represents the + // presence penalty setting for the GenAI request. + // + // Type: double + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: 0.1 + GenAIRequestPresencePenaltyKey = attribute.Key("gen_ai.request.presence_penalty") + + // GenAIRequestSeedKey is the attribute Key conforming to the + // "gen_ai.request.seed" semantic conventions. It represents the requests with + // same seed value more likely to return same result. + // + // Type: int + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: 100 + GenAIRequestSeedKey = attribute.Key("gen_ai.request.seed") + + // GenAIRequestStopSequencesKey is the attribute Key conforming to the + // "gen_ai.request.stop_sequences" semantic conventions. It represents the list + // of sequences that the model will use to stop generating further tokens. + // + // Type: string[] + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: "forest", "lived" + GenAIRequestStopSequencesKey = attribute.Key("gen_ai.request.stop_sequences") + + // GenAIRequestTemperatureKey is the attribute Key conforming to the + // "gen_ai.request.temperature" semantic conventions. It represents the + // temperature setting for the GenAI request. + // + // Type: double + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: 0.0 + GenAIRequestTemperatureKey = attribute.Key("gen_ai.request.temperature") + + // GenAIRequestTopKKey is the attribute Key conforming to the + // "gen_ai.request.top_k" semantic conventions. It represents the top_k sampling + // setting for the GenAI request. + // + // Type: double + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: 1.0 + GenAIRequestTopKKey = attribute.Key("gen_ai.request.top_k") + + // GenAIRequestTopPKey is the attribute Key conforming to the + // "gen_ai.request.top_p" semantic conventions. It represents the top_p sampling + // setting for the GenAI request. + // + // Type: double + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: 1.0 + GenAIRequestTopPKey = attribute.Key("gen_ai.request.top_p") + + // GenAIResponseFinishReasonsKey is the attribute Key conforming to the + // "gen_ai.response.finish_reasons" semantic conventions. It represents the + // array of reasons the model stopped generating tokens, corresponding to each + // generation received. + // + // Type: string[] + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: "stop"], ["stop", "length" + GenAIResponseFinishReasonsKey = attribute.Key("gen_ai.response.finish_reasons") + + // GenAIResponseIDKey is the attribute Key conforming to the + // "gen_ai.response.id" semantic conventions. It represents the unique + // identifier for the completion. + // + // Type: string + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: "chatcmpl-123" + GenAIResponseIDKey = attribute.Key("gen_ai.response.id") + + // GenAIResponseModelKey is the attribute Key conforming to the + // "gen_ai.response.model" semantic conventions. It represents the name of the + // model that generated the response. + // + // Type: string + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: "gpt-4-0613" + GenAIResponseModelKey = attribute.Key("gen_ai.response.model") + + // GenAIRetrievalDocumentsKey is the attribute Key conforming to the + // "gen_ai.retrieval.documents" semantic conventions. It represents the + // documents retrieved. + // + // Type: any + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: "[\n {\n "id": "doc_123",\n "score": 0.95\n },\n {\n "id": + // "doc_456",\n "score": 0.87\n },\n {\n "id": "doc_789",\n "score": 0.82\n + // }\n]\n" + // Note: Instrumentations MUST follow [Retrieval documents JSON schema]. + // When the attribute is recorded on events, it MUST be recorded in structured + // form. When recorded on spans, it MAY be recorded as a JSON string if + // structured + // format is not supported and SHOULD be recorded in structured form otherwise. + // + // Each document object SHOULD contain at least the following properties: + // `id` (string): A unique identifier for the document, `score` (double): The + // relevance score of the document + // + // [Retrieval documents JSON schema]: /docs/gen-ai/gen-ai-retrieval-documents.json + GenAIRetrievalDocumentsKey = attribute.Key("gen_ai.retrieval.documents") + + // GenAIRetrievalQueryTextKey is the attribute Key conforming to the + // "gen_ai.retrieval.query.text" semantic conventions. It represents the query + // text used for retrieval. + // + // Type: string + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: "What is the capital of France?", "weather in Paris" + // Note: > [!Warning] + // + // > This attribute may contain sensitive information. + GenAIRetrievalQueryTextKey = attribute.Key("gen_ai.retrieval.query.text") + + // GenAISystemInstructionsKey is the attribute Key conforming to the + // "gen_ai.system_instructions" semantic conventions. It represents the system + // message or instructions provided to the GenAI model separately from the chat + // history. + // + // Type: any + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: "[\n {\n "type": "text",\n "content": "You are an Agent that greet + // users, always use greetings tool to respond"\n }\n]\n", "[\n {\n "type": + // "text",\n "content": "You are a language translator."\n },\n {\n "type": + // "text",\n "content": "Your mission is to translate text in English to + // French."\n }\n]\n" + // Note: This attribute SHOULD be used when the corresponding provider or API + // allows to provide system instructions or messages separately from the + // chat history. + // + // Instructions that are part of the chat history SHOULD be recorded in + // `gen_ai.input.messages` attribute instead. + // + // Instrumentations MUST follow [System instructions JSON schema]. + // + // When recorded on spans, it MAY be recorded as a JSON string if structured + // format is not supported and SHOULD be recorded in structured form otherwise. + // + // Instrumentations MAY provide a way for users to filter or truncate + // system instructions. + // + // > [!Warning] + // > This attribute may contain sensitive information. + // + // See [Recording content on attributes] + // section for more details. + // + // [System instructions JSON schema]: /docs/gen-ai/gen-ai-system-instructions.json + // [Recording content on attributes]: /docs/gen-ai/gen-ai-spans.md#recording-content-on-attributes + GenAISystemInstructionsKey = attribute.Key("gen_ai.system_instructions") + + // GenAITokenTypeKey is the attribute Key conforming to the "gen_ai.token.type" + // semantic conventions. It represents the type of token being counted. + // + // Type: Enum + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: "input", "output" + GenAITokenTypeKey = attribute.Key("gen_ai.token.type") + + // GenAIToolCallArgumentsKey is the attribute Key conforming to the + // "gen_ai.tool.call.arguments" semantic conventions. It represents the + // parameters passed to the tool call. + // + // Type: any + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: "{\n "location": "San Francisco?",\n "date": "2025-10-01"\n}\n" + // Note: > [!WARNING] + // + // > This attribute may contain sensitive information. + // + // It's expected to be an object - in case a serialized string is available + // to the instrumentation, the instrumentation SHOULD do the best effort to + // deserialize it to an object. When recorded on spans, it MAY be recorded as a + // JSON string if structured format is not supported and SHOULD be recorded in + // structured form otherwise. + GenAIToolCallArgumentsKey = attribute.Key("gen_ai.tool.call.arguments") + + // GenAIToolCallIDKey is the attribute Key conforming to the + // "gen_ai.tool.call.id" semantic conventions. It represents the tool call + // identifier. + // + // Type: string + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: "call_mszuSIzqtI65i1wAUOE8w5H4" + GenAIToolCallIDKey = attribute.Key("gen_ai.tool.call.id") + + // GenAIToolCallResultKey is the attribute Key conforming to the + // "gen_ai.tool.call.result" semantic conventions. It represents the result + // returned by the tool call (if any and if execution was successful). + // + // Type: any + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: "{\n "temperature_range": {\n "high": 75,\n "low": 60\n },\n + // "conditions": "sunny"\n}\n" + // Note: > [!WARNING] + // + // > This attribute may contain sensitive information. + // + // It's expected to be an object - in case a serialized string is available + // to the instrumentation, the instrumentation SHOULD do the best effort to + // deserialize it to an object. When recorded on spans, it MAY be recorded as a + // JSON string if structured format is not supported and SHOULD be recorded in + // structured form otherwise. + GenAIToolCallResultKey = attribute.Key("gen_ai.tool.call.result") + + // GenAIToolDefinitionsKey is the attribute Key conforming to the + // "gen_ai.tool.definitions" semantic conventions. It represents the list of + // source system tool definitions available to the GenAI agent or model. + // + // Type: any + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: "[\n {\n "type": "function",\n "name": "get_current_weather",\n + // "description": "Get the current weather in a given location",\n "parameters": + // {\n "type": "object",\n "properties": {\n "location": {\n "type": "string",\n + // "description": "The city and state, e.g. San Francisco, CA"\n },\n "unit": + // {\n "type": "string",\n "enum": [\n "celsius",\n "fahrenheit"\n ]\n }\n },\n + // "required": [\n "location",\n "unit"\n ]\n }\n }\n]\n" + // Note: The value of this attribute matches source system tool definition + // format. + // + // It's expected to be an array of objects where each object represents a tool + // definition. In case a serialized string is available + // to the instrumentation, the instrumentation SHOULD do the best effort to + // deserialize it to an array. When recorded on spans, it MAY be recorded as a + // JSON string if structured format is not supported and SHOULD be recorded in + // structured form otherwise. + // + // Since this attribute could be large, it's NOT RECOMMENDED to populate + // it by default. Instrumentations MAY provide a way to enable + // populating this attribute. + GenAIToolDefinitionsKey = attribute.Key("gen_ai.tool.definitions") + + // GenAIToolDescriptionKey is the attribute Key conforming to the + // "gen_ai.tool.description" semantic conventions. It represents the tool + // description. + // + // Type: string + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: "Multiply two numbers" + GenAIToolDescriptionKey = attribute.Key("gen_ai.tool.description") + + // GenAIToolNameKey is the attribute Key conforming to the "gen_ai.tool.name" + // semantic conventions. It represents the name of the tool utilized by the + // agent. + // + // Type: string + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: "Flights" + GenAIToolNameKey = attribute.Key("gen_ai.tool.name") + + // GenAIToolTypeKey is the attribute Key conforming to the "gen_ai.tool.type" + // semantic conventions. It represents the type of the tool utilized by the + // agent. + // + // Type: string + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: "function", "extension", "datastore" + // Note: Extension: A tool executed on the agent-side to directly call external + // APIs, bridging the gap between the agent and real-world systems. + // Agent-side operations involve actions that are performed by the agent on the + // server or within the agent's controlled environment. + // Function: A tool executed on the client-side, where the agent generates + // parameters for a predefined function, and the client executes the logic. + // Client-side operations are actions taken on the user's end or within the + // client application. + // Datastore: A tool used by the agent to access and query structured or + // unstructured external data for retrieval-augmented tasks or knowledge + // updates. + GenAIToolTypeKey = attribute.Key("gen_ai.tool.type") + + // GenAIUsageCacheCreationInputTokensKey is the attribute Key conforming to the + // "gen_ai.usage.cache_creation.input_tokens" semantic conventions. It + // represents the number of input tokens written to a provider-managed cache. + // + // Type: int + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: 25 + // Note: The value SHOULD be included in `gen_ai.usage.input_tokens`. + GenAIUsageCacheCreationInputTokensKey = attribute.Key("gen_ai.usage.cache_creation.input_tokens") + + // GenAIUsageCacheReadInputTokensKey is the attribute Key conforming to the + // "gen_ai.usage.cache_read.input_tokens" semantic conventions. It represents + // the number of input tokens served from a provider-managed cache. + // + // Type: int + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: 50 + // Note: The value SHOULD be included in `gen_ai.usage.input_tokens`. + GenAIUsageCacheReadInputTokensKey = attribute.Key("gen_ai.usage.cache_read.input_tokens") + + // GenAIUsageInputTokensKey is the attribute Key conforming to the + // "gen_ai.usage.input_tokens" semantic conventions. It represents the number of + // tokens used in the GenAI input (prompt). + // + // Type: int + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: 100 + // Note: This value SHOULD include all types of input tokens, including cached + // tokens. + // Instrumentations SHOULD make a best effort to populate this value, using a + // total + // provided by the provider when available or, depending on the provider API, + // by summing different token types parsed from the provider output. + GenAIUsageInputTokensKey = attribute.Key("gen_ai.usage.input_tokens") + + // GenAIUsageOutputTokensKey is the attribute Key conforming to the + // "gen_ai.usage.output_tokens" semantic conventions. It represents the number + // of tokens used in the GenAI response (completion). + // + // Type: int + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: 180 + GenAIUsageOutputTokensKey = attribute.Key("gen_ai.usage.output_tokens") +) + +// GenAIAgentDescription returns an attribute KeyValue conforming to the +// "gen_ai.agent.description" semantic conventions. It represents the free-form +// description of the GenAI agent provided by the application. +func GenAIAgentDescription(val string) attribute.KeyValue { + return GenAIAgentDescriptionKey.String(val) +} + +// GenAIAgentID returns an attribute KeyValue conforming to the "gen_ai.agent.id" +// semantic conventions. It represents the unique identifier of the GenAI agent. +func GenAIAgentID(val string) attribute.KeyValue { + return GenAIAgentIDKey.String(val) +} + +// GenAIAgentName returns an attribute KeyValue conforming to the +// "gen_ai.agent.name" semantic conventions. It represents the human-readable +// name of the GenAI agent provided by the application. +func GenAIAgentName(val string) attribute.KeyValue { + return GenAIAgentNameKey.String(val) +} + +// GenAIAgentVersion returns an attribute KeyValue conforming to the +// "gen_ai.agent.version" semantic conventions. It represents the version of the +// GenAI agent. +func GenAIAgentVersion(val string) attribute.KeyValue { + return GenAIAgentVersionKey.String(val) +} + +// GenAIConversationID returns an attribute KeyValue conforming to the +// "gen_ai.conversation.id" semantic conventions. It represents the unique +// identifier for a conversation (session, thread), used to store and correlate +// messages within this conversation. +func GenAIConversationID(val string) attribute.KeyValue { + return GenAIConversationIDKey.String(val) +} + +// GenAIDataSourceID returns an attribute KeyValue conforming to the +// "gen_ai.data_source.id" semantic conventions. It represents the data source +// identifier. +func GenAIDataSourceID(val string) attribute.KeyValue { + return GenAIDataSourceIDKey.String(val) +} + +// GenAIEmbeddingsDimensionCount returns an attribute KeyValue conforming to the +// "gen_ai.embeddings.dimension.count" semantic conventions. It represents the +// number of dimensions the resulting output embeddings should have. +func GenAIEmbeddingsDimensionCount(val int) attribute.KeyValue { + return GenAIEmbeddingsDimensionCountKey.Int(val) +} + +// GenAIEvaluationExplanation returns an attribute KeyValue conforming to the +// "gen_ai.evaluation.explanation" semantic conventions. It represents a +// free-form explanation for the assigned score provided by the evaluator. +func GenAIEvaluationExplanation(val string) attribute.KeyValue { + return GenAIEvaluationExplanationKey.String(val) +} + +// GenAIEvaluationName returns an attribute KeyValue conforming to the +// "gen_ai.evaluation.name" semantic conventions. It represents the name of the +// evaluation metric used for the GenAI response. +func GenAIEvaluationName(val string) attribute.KeyValue { + return GenAIEvaluationNameKey.String(val) +} + +// GenAIEvaluationScoreLabel returns an attribute KeyValue conforming to the +// "gen_ai.evaluation.score.label" semantic conventions. It represents the human +// readable label for evaluation. +func GenAIEvaluationScoreLabel(val string) attribute.KeyValue { + return GenAIEvaluationScoreLabelKey.String(val) +} + +// GenAIEvaluationScoreValue returns an attribute KeyValue conforming to the +// "gen_ai.evaluation.score.value" semantic conventions. It represents the +// evaluation score returned by the evaluator. +func GenAIEvaluationScoreValue(val float64) attribute.KeyValue { + return GenAIEvaluationScoreValueKey.Float64(val) +} + +// GenAIPromptName returns an attribute KeyValue conforming to the +// "gen_ai.prompt.name" semantic conventions. It represents the name of the +// prompt that uniquely identifies it. +func GenAIPromptName(val string) attribute.KeyValue { + return GenAIPromptNameKey.String(val) +} + +// GenAIRequestChoiceCount returns an attribute KeyValue conforming to the +// "gen_ai.request.choice.count" semantic conventions. It represents the target +// number of candidate completions to return. +func GenAIRequestChoiceCount(val int) attribute.KeyValue { + return GenAIRequestChoiceCountKey.Int(val) +} + +// GenAIRequestEncodingFormats returns an attribute KeyValue conforming to the +// "gen_ai.request.encoding_formats" semantic conventions. It represents the +// encoding formats requested in an embeddings operation, if specified. +func GenAIRequestEncodingFormats(val ...string) attribute.KeyValue { + return GenAIRequestEncodingFormatsKey.StringSlice(val) +} + +// GenAIRequestFrequencyPenalty returns an attribute KeyValue conforming to the +// "gen_ai.request.frequency_penalty" semantic conventions. It represents the +// frequency penalty setting for the GenAI request. +func GenAIRequestFrequencyPenalty(val float64) attribute.KeyValue { + return GenAIRequestFrequencyPenaltyKey.Float64(val) +} + +// GenAIRequestMaxTokens returns an attribute KeyValue conforming to the +// "gen_ai.request.max_tokens" semantic conventions. It represents the maximum +// number of tokens the model generates for a request. +func GenAIRequestMaxTokens(val int) attribute.KeyValue { + return GenAIRequestMaxTokensKey.Int(val) +} + +// GenAIRequestModel returns an attribute KeyValue conforming to the +// "gen_ai.request.model" semantic conventions. It represents the name of the +// GenAI model a request is being made to. +func GenAIRequestModel(val string) attribute.KeyValue { + return GenAIRequestModelKey.String(val) +} + +// GenAIRequestPresencePenalty returns an attribute KeyValue conforming to the +// "gen_ai.request.presence_penalty" semantic conventions. It represents the +// presence penalty setting for the GenAI request. +func GenAIRequestPresencePenalty(val float64) attribute.KeyValue { + return GenAIRequestPresencePenaltyKey.Float64(val) +} + +// GenAIRequestSeed returns an attribute KeyValue conforming to the +// "gen_ai.request.seed" semantic conventions. It represents the requests with +// same seed value more likely to return same result. +func GenAIRequestSeed(val int) attribute.KeyValue { + return GenAIRequestSeedKey.Int(val) +} + +// GenAIRequestStopSequences returns an attribute KeyValue conforming to the +// "gen_ai.request.stop_sequences" semantic conventions. It represents the list +// of sequences that the model will use to stop generating further tokens. +func GenAIRequestStopSequences(val ...string) attribute.KeyValue { + return GenAIRequestStopSequencesKey.StringSlice(val) +} + +// GenAIRequestTemperature returns an attribute KeyValue conforming to the +// "gen_ai.request.temperature" semantic conventions. It represents the +// temperature setting for the GenAI request. +func GenAIRequestTemperature(val float64) attribute.KeyValue { + return GenAIRequestTemperatureKey.Float64(val) +} + +// GenAIRequestTopK returns an attribute KeyValue conforming to the +// "gen_ai.request.top_k" semantic conventions. It represents the top_k sampling +// setting for the GenAI request. +func GenAIRequestTopK(val float64) attribute.KeyValue { + return GenAIRequestTopKKey.Float64(val) +} + +// GenAIRequestTopP returns an attribute KeyValue conforming to the +// "gen_ai.request.top_p" semantic conventions. It represents the top_p sampling +// setting for the GenAI request. +func GenAIRequestTopP(val float64) attribute.KeyValue { + return GenAIRequestTopPKey.Float64(val) +} + +// GenAIResponseFinishReasons returns an attribute KeyValue conforming to the +// "gen_ai.response.finish_reasons" semantic conventions. It represents the array +// of reasons the model stopped generating tokens, corresponding to each +// generation received. +func GenAIResponseFinishReasons(val ...string) attribute.KeyValue { + return GenAIResponseFinishReasonsKey.StringSlice(val) +} + +// GenAIResponseID returns an attribute KeyValue conforming to the +// "gen_ai.response.id" semantic conventions. It represents the unique identifier +// for the completion. +func GenAIResponseID(val string) attribute.KeyValue { + return GenAIResponseIDKey.String(val) +} + +// GenAIResponseModel returns an attribute KeyValue conforming to the +// "gen_ai.response.model" semantic conventions. It represents the name of the +// model that generated the response. +func GenAIResponseModel(val string) attribute.KeyValue { + return GenAIResponseModelKey.String(val) +} + +// GenAIRetrievalQueryText returns an attribute KeyValue conforming to the +// "gen_ai.retrieval.query.text" semantic conventions. It represents the query +// text used for retrieval. +func GenAIRetrievalQueryText(val string) attribute.KeyValue { + return GenAIRetrievalQueryTextKey.String(val) +} + +// GenAIToolCallID returns an attribute KeyValue conforming to the +// "gen_ai.tool.call.id" semantic conventions. It represents the tool call +// identifier. +func GenAIToolCallID(val string) attribute.KeyValue { + return GenAIToolCallIDKey.String(val) +} + +// GenAIToolDescription returns an attribute KeyValue conforming to the +// "gen_ai.tool.description" semantic conventions. It represents the tool +// description. +func GenAIToolDescription(val string) attribute.KeyValue { + return GenAIToolDescriptionKey.String(val) +} + +// GenAIToolName returns an attribute KeyValue conforming to the +// "gen_ai.tool.name" semantic conventions. It represents the name of the tool +// utilized by the agent. +func GenAIToolName(val string) attribute.KeyValue { + return GenAIToolNameKey.String(val) +} + +// GenAIToolType returns an attribute KeyValue conforming to the +// "gen_ai.tool.type" semantic conventions. It represents the type of the tool +// utilized by the agent. +func GenAIToolType(val string) attribute.KeyValue { + return GenAIToolTypeKey.String(val) +} + +// GenAIUsageCacheCreationInputTokens returns an attribute KeyValue conforming to +// the "gen_ai.usage.cache_creation.input_tokens" semantic conventions. It +// represents the number of input tokens written to a provider-managed cache. +func GenAIUsageCacheCreationInputTokens(val int) attribute.KeyValue { + return GenAIUsageCacheCreationInputTokensKey.Int(val) +} + +// GenAIUsageCacheReadInputTokens returns an attribute KeyValue conforming to the +// "gen_ai.usage.cache_read.input_tokens" semantic conventions. It represents the +// number of input tokens served from a provider-managed cache. +func GenAIUsageCacheReadInputTokens(val int) attribute.KeyValue { + return GenAIUsageCacheReadInputTokensKey.Int(val) +} + +// GenAIUsageInputTokens returns an attribute KeyValue conforming to the +// "gen_ai.usage.input_tokens" semantic conventions. It represents the number of +// tokens used in the GenAI input (prompt). +func GenAIUsageInputTokens(val int) attribute.KeyValue { + return GenAIUsageInputTokensKey.Int(val) +} + +// GenAIUsageOutputTokens returns an attribute KeyValue conforming to the +// "gen_ai.usage.output_tokens" semantic conventions. It represents the number of +// tokens used in the GenAI response (completion). +func GenAIUsageOutputTokens(val int) attribute.KeyValue { + return GenAIUsageOutputTokensKey.Int(val) +} + +// Enum values for gen_ai.operation.name +var ( + // Chat completion operation such as [OpenAI Chat API] + // Stability: development + // + // [OpenAI Chat API]: https://platform.openai.com/docs/api-reference/chat + GenAIOperationNameChat = GenAIOperationNameKey.String("chat") + // Multimodal content generation operation such as [Gemini Generate Content] + // Stability: development + // + // [Gemini Generate Content]: https://ai.google.dev/api/generate-content + GenAIOperationNameGenerateContent = GenAIOperationNameKey.String("generate_content") + // Text completions operation such as [OpenAI Completions API (Legacy)] + // Stability: development + // + // [OpenAI Completions API (Legacy)]: https://platform.openai.com/docs/api-reference/completions + GenAIOperationNameTextCompletion = GenAIOperationNameKey.String("text_completion") + // Embeddings operation such as [OpenAI Create embeddings API] + // Stability: development + // + // [OpenAI Create embeddings API]: https://platform.openai.com/docs/api-reference/embeddings/create + GenAIOperationNameEmbeddings = GenAIOperationNameKey.String("embeddings") + // Retrieval operation such as [OpenAI Search Vector Store API] + // Stability: development + // + // [OpenAI Search Vector Store API]: https://platform.openai.com/docs/api-reference/vector-stores/search + GenAIOperationNameRetrieval = GenAIOperationNameKey.String("retrieval") + // Create GenAI agent + // Stability: development + GenAIOperationNameCreateAgent = GenAIOperationNameKey.String("create_agent") + // Invoke GenAI agent + // Stability: development + GenAIOperationNameInvokeAgent = GenAIOperationNameKey.String("invoke_agent") + // Execute a tool + // Stability: development + GenAIOperationNameExecuteTool = GenAIOperationNameKey.String("execute_tool") +) + +// Enum values for gen_ai.output.type +var ( + // Plain text + // Stability: development + GenAIOutputTypeText = GenAIOutputTypeKey.String("text") + // JSON object with known or unknown schema + // Stability: development + GenAIOutputTypeJSON = GenAIOutputTypeKey.String("json") + // Image + // Stability: development + GenAIOutputTypeImage = GenAIOutputTypeKey.String("image") + // Speech + // Stability: development + GenAIOutputTypeSpeech = GenAIOutputTypeKey.String("speech") +) + +// Enum values for gen_ai.provider.name +var ( + // [OpenAI] + // Stability: development + // + // [OpenAI]: https://openai.com/ + GenAIProviderNameOpenAI = GenAIProviderNameKey.String("openai") + // Any Google generative AI endpoint + // Stability: development + GenAIProviderNameGCPGenAI = GenAIProviderNameKey.String("gcp.gen_ai") + // [Vertex AI] + // Stability: development + // + // [Vertex AI]: https://cloud.google.com/vertex-ai + GenAIProviderNameGCPVertexAI = GenAIProviderNameKey.String("gcp.vertex_ai") + // [Gemini] + // Stability: development + // + // [Gemini]: https://cloud.google.com/products/gemini + GenAIProviderNameGCPGemini = GenAIProviderNameKey.String("gcp.gemini") + // [Anthropic] + // Stability: development + // + // [Anthropic]: https://www.anthropic.com/ + GenAIProviderNameAnthropic = GenAIProviderNameKey.String("anthropic") + // [Cohere] + // Stability: development + // + // [Cohere]: https://cohere.com/ + GenAIProviderNameCohere = GenAIProviderNameKey.String("cohere") + // Azure AI Inference + // Stability: development + GenAIProviderNameAzureAIInference = GenAIProviderNameKey.String("azure.ai.inference") + // [Azure OpenAI] + // Stability: development + // + // [Azure OpenAI]: https://azure.microsoft.com/products/ai-services/openai-service/ + GenAIProviderNameAzureAIOpenAI = GenAIProviderNameKey.String("azure.ai.openai") + // [IBM Watsonx AI] + // Stability: development + // + // [IBM Watsonx AI]: https://www.ibm.com/products/watsonx-ai + GenAIProviderNameIBMWatsonxAI = GenAIProviderNameKey.String("ibm.watsonx.ai") + // [AWS Bedrock] + // Stability: development + // + // [AWS Bedrock]: https://aws.amazon.com/bedrock + GenAIProviderNameAWSBedrock = GenAIProviderNameKey.String("aws.bedrock") + // [Perplexity] + // Stability: development + // + // [Perplexity]: https://www.perplexity.ai/ + GenAIProviderNamePerplexity = GenAIProviderNameKey.String("perplexity") + // [xAI] + // Stability: development + // + // [xAI]: https://x.ai/ + GenAIProviderNameXAI = GenAIProviderNameKey.String("x_ai") + // [DeepSeek] + // Stability: development + // + // [DeepSeek]: https://www.deepseek.com/ + GenAIProviderNameDeepseek = GenAIProviderNameKey.String("deepseek") + // [Groq] + // Stability: development + // + // [Groq]: https://groq.com/ + GenAIProviderNameGroq = GenAIProviderNameKey.String("groq") + // [Mistral AI] + // Stability: development + // + // [Mistral AI]: https://mistral.ai/ + GenAIProviderNameMistralAI = GenAIProviderNameKey.String("mistral_ai") +) + +// Enum values for gen_ai.token.type +var ( + // Input tokens (prompt, input, etc.) + // Stability: development + GenAITokenTypeInput = GenAITokenTypeKey.String("input") + // Output tokens (completion, response, etc.) + // Stability: development + GenAITokenTypeOutput = GenAITokenTypeKey.String("output") +) + +// Namespace: geo +const ( + // GeoContinentCodeKey is the attribute Key conforming to the + // "geo.continent.code" semantic conventions. It represents the two-letter code + // representing continent’s name. + // + // Type: Enum + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: + GeoContinentCodeKey = attribute.Key("geo.continent.code") + + // GeoCountryISOCodeKey is the attribute Key conforming to the + // "geo.country.iso_code" semantic conventions. It represents the two-letter ISO + // Country Code ([ISO 3166-1 alpha2]). + // + // Type: string + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: "CA" + // + // [ISO 3166-1 alpha2]: https://wikipedia.org/wiki/ISO_3166-1#Codes + GeoCountryISOCodeKey = attribute.Key("geo.country.iso_code") + + // GeoLocalityNameKey is the attribute Key conforming to the "geo.locality.name" + // semantic conventions. It represents the locality name. Represents the name of + // a city, town, village, or similar populated place. + // + // Type: string + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: "Montreal", "Berlin" + GeoLocalityNameKey = attribute.Key("geo.locality.name") + + // GeoLocationLatKey is the attribute Key conforming to the "geo.location.lat" + // semantic conventions. It represents the latitude of the geo location in + // [WGS84]. + // + // Type: double + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: 45.505918 + // + // [WGS84]: https://wikipedia.org/wiki/World_Geodetic_System#WGS84 + GeoLocationLatKey = attribute.Key("geo.location.lat") + + // GeoLocationLonKey is the attribute Key conforming to the "geo.location.lon" + // semantic conventions. It represents the longitude of the geo location in + // [WGS84]. + // + // Type: double + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: -73.61483 + // + // [WGS84]: https://wikipedia.org/wiki/World_Geodetic_System#WGS84 + GeoLocationLonKey = attribute.Key("geo.location.lon") + + // GeoPostalCodeKey is the attribute Key conforming to the "geo.postal_code" + // semantic conventions. It represents the postal code associated with the + // location. Values appropriate for this field may also be known as a postcode + // or ZIP code and will vary widely from country to country. + // + // Type: string + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: "94040" + GeoPostalCodeKey = attribute.Key("geo.postal_code") + + // GeoRegionISOCodeKey is the attribute Key conforming to the + // "geo.region.iso_code" semantic conventions. It represents the region ISO code + // ([ISO 3166-2]). + // + // Type: string + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: "CA-QC" + // + // [ISO 3166-2]: https://wikipedia.org/wiki/ISO_3166-2 + GeoRegionISOCodeKey = attribute.Key("geo.region.iso_code") +) + +// GeoCountryISOCode returns an attribute KeyValue conforming to the +// "geo.country.iso_code" semantic conventions. It represents the two-letter ISO +// Country Code ([ISO 3166-1 alpha2]). +// +// [ISO 3166-1 alpha2]: https://wikipedia.org/wiki/ISO_3166-1#Codes +func GeoCountryISOCode(val string) attribute.KeyValue { + return GeoCountryISOCodeKey.String(val) +} + +// GeoLocalityName returns an attribute KeyValue conforming to the +// "geo.locality.name" semantic conventions. It represents the locality name. +// Represents the name of a city, town, village, or similar populated place. +func GeoLocalityName(val string) attribute.KeyValue { + return GeoLocalityNameKey.String(val) +} + +// GeoLocationLat returns an attribute KeyValue conforming to the +// "geo.location.lat" semantic conventions. It represents the latitude of the geo +// location in [WGS84]. +// +// [WGS84]: https://wikipedia.org/wiki/World_Geodetic_System#WGS84 +func GeoLocationLat(val float64) attribute.KeyValue { + return GeoLocationLatKey.Float64(val) +} + +// GeoLocationLon returns an attribute KeyValue conforming to the +// "geo.location.lon" semantic conventions. It represents the longitude of the +// geo location in [WGS84]. +// +// [WGS84]: https://wikipedia.org/wiki/World_Geodetic_System#WGS84 +func GeoLocationLon(val float64) attribute.KeyValue { + return GeoLocationLonKey.Float64(val) +} + +// GeoPostalCode returns an attribute KeyValue conforming to the +// "geo.postal_code" semantic conventions. It represents the postal code +// associated with the location. Values appropriate for this field may also be +// known as a postcode or ZIP code and will vary widely from country to country. +func GeoPostalCode(val string) attribute.KeyValue { + return GeoPostalCodeKey.String(val) +} + +// GeoRegionISOCode returns an attribute KeyValue conforming to the +// "geo.region.iso_code" semantic conventions. It represents the region ISO code +// ([ISO 3166-2]). +// +// [ISO 3166-2]: https://wikipedia.org/wiki/ISO_3166-2 +func GeoRegionISOCode(val string) attribute.KeyValue { + return GeoRegionISOCodeKey.String(val) +} + +// Enum values for geo.continent.code +var ( + // Africa + // Stability: development + GeoContinentCodeAf = GeoContinentCodeKey.String("AF") + // Antarctica + // Stability: development + GeoContinentCodeAn = GeoContinentCodeKey.String("AN") + // Asia + // Stability: development + GeoContinentCodeAs = GeoContinentCodeKey.String("AS") + // Europe + // Stability: development + GeoContinentCodeEu = GeoContinentCodeKey.String("EU") + // North America + // Stability: development + GeoContinentCodeNa = GeoContinentCodeKey.String("NA") + // Oceania + // Stability: development + GeoContinentCodeOc = GeoContinentCodeKey.String("OC") + // South America + // Stability: development + GeoContinentCodeSa = GeoContinentCodeKey.String("SA") +) + +// Namespace: go +const ( + // GoMemoryTypeKey is the attribute Key conforming to the "go.memory.type" + // semantic conventions. It represents the type of memory. + // + // Type: Enum + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: "other", "stack" + GoMemoryTypeKey = attribute.Key("go.memory.type") +) + +// Enum values for go.memory.type +var ( + // Memory allocated from the heap that is reserved for stack space, whether or + // not it is currently in-use. + // Stability: development + GoMemoryTypeStack = GoMemoryTypeKey.String("stack") + // Memory used by the Go runtime, excluding other categories of memory usage + // described in this enumeration. + // Stability: development + GoMemoryTypeOther = GoMemoryTypeKey.String("other") +) + +// Namespace: graphql +const ( + // GraphQLDocumentKey is the attribute Key conforming to the "graphql.document" + // semantic conventions. It represents the GraphQL document being executed. + // + // Type: string + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: query findBookById { bookById(id: ?) { name } } + // Note: The value may be sanitized to exclude sensitive information. + GraphQLDocumentKey = attribute.Key("graphql.document") + + // GraphQLOperationNameKey is the attribute Key conforming to the + // "graphql.operation.name" semantic conventions. It represents the name of the + // operation being executed. + // + // Type: string + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: findBookById + GraphQLOperationNameKey = attribute.Key("graphql.operation.name") + + // GraphQLOperationTypeKey is the attribute Key conforming to the + // "graphql.operation.type" semantic conventions. It represents the type of the + // operation being executed. + // + // Type: Enum + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: "query", "mutation", "subscription" + GraphQLOperationTypeKey = attribute.Key("graphql.operation.type") +) + +// GraphQLDocument returns an attribute KeyValue conforming to the +// "graphql.document" semantic conventions. It represents the GraphQL document +// being executed. +func GraphQLDocument(val string) attribute.KeyValue { + return GraphQLDocumentKey.String(val) +} + +// GraphQLOperationName returns an attribute KeyValue conforming to the +// "graphql.operation.name" semantic conventions. It represents the name of the +// operation being executed. +func GraphQLOperationName(val string) attribute.KeyValue { + return GraphQLOperationNameKey.String(val) +} + +// Enum values for graphql.operation.type +var ( + // GraphQL query + // Stability: development + GraphQLOperationTypeQuery = GraphQLOperationTypeKey.String("query") + // GraphQL mutation + // Stability: development + GraphQLOperationTypeMutation = GraphQLOperationTypeKey.String("mutation") + // GraphQL subscription + // Stability: development + GraphQLOperationTypeSubscription = GraphQLOperationTypeKey.String("subscription") +) + +// Namespace: heroku +const ( + // HerokuAppIDKey is the attribute Key conforming to the "heroku.app.id" + // semantic conventions. It represents the unique identifier for the + // application. + // + // Type: string + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: "2daa2797-e42b-4624-9322-ec3f968df4da" + HerokuAppIDKey = attribute.Key("heroku.app.id") + + // HerokuReleaseCommitKey is the attribute Key conforming to the + // "heroku.release.commit" semantic conventions. It represents the commit hash + // for the current release. + // + // Type: string + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: "e6134959463efd8966b20e75b913cafe3f5ec" + HerokuReleaseCommitKey = attribute.Key("heroku.release.commit") + + // HerokuReleaseCreationTimestampKey is the attribute Key conforming to the + // "heroku.release.creation_timestamp" semantic conventions. It represents the + // time and date the release was created. + // + // Type: string + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: "2022-10-23T18:00:42Z" + HerokuReleaseCreationTimestampKey = attribute.Key("heroku.release.creation_timestamp") +) + +// HerokuAppID returns an attribute KeyValue conforming to the "heroku.app.id" +// semantic conventions. It represents the unique identifier for the application. +func HerokuAppID(val string) attribute.KeyValue { + return HerokuAppIDKey.String(val) +} + +// HerokuReleaseCommit returns an attribute KeyValue conforming to the +// "heroku.release.commit" semantic conventions. It represents the commit hash +// for the current release. +func HerokuReleaseCommit(val string) attribute.KeyValue { + return HerokuReleaseCommitKey.String(val) +} + +// HerokuReleaseCreationTimestamp returns an attribute KeyValue conforming to the +// "heroku.release.creation_timestamp" semantic conventions. It represents the +// time and date the release was created. +func HerokuReleaseCreationTimestamp(val string) attribute.KeyValue { + return HerokuReleaseCreationTimestampKey.String(val) +} + +// Namespace: host +const ( + // HostArchKey is the attribute Key conforming to the "host.arch" semantic + // conventions. It represents the CPU architecture the host system is running + // on. + // + // Type: Enum + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: + HostArchKey = attribute.Key("host.arch") + + // HostCPUCacheL2SizeKey is the attribute Key conforming to the + // "host.cpu.cache.l2.size" semantic conventions. It represents the amount of + // level 2 memory cache available to the processor (in Bytes). + // + // Type: int + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: 12288000 + HostCPUCacheL2SizeKey = attribute.Key("host.cpu.cache.l2.size") + + // HostCPUFamilyKey is the attribute Key conforming to the "host.cpu.family" + // semantic conventions. It represents the family or generation of the CPU. + // + // Type: string + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: "6", "PA-RISC 1.1e" + HostCPUFamilyKey = attribute.Key("host.cpu.family") + + // HostCPUModelIDKey is the attribute Key conforming to the "host.cpu.model.id" + // semantic conventions. It represents the model identifier. It provides more + // granular information about the CPU, distinguishing it from other CPUs within + // the same family. + // + // Type: string + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: "6", "9000/778/B180L" + HostCPUModelIDKey = attribute.Key("host.cpu.model.id") + + // HostCPUModelNameKey is the attribute Key conforming to the + // "host.cpu.model.name" semantic conventions. It represents the model + // designation of the processor. + // + // Type: string + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: "11th Gen Intel(R) Core(TM) i7-1185G7 @ 3.00GHz" + HostCPUModelNameKey = attribute.Key("host.cpu.model.name") + + // HostCPUSteppingKey is the attribute Key conforming to the "host.cpu.stepping" + // semantic conventions. It represents the stepping or core revisions. + // + // Type: string + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: "1", "r1p1" + HostCPUSteppingKey = attribute.Key("host.cpu.stepping") + + // HostCPUVendorIDKey is the attribute Key conforming to the + // "host.cpu.vendor.id" semantic conventions. It represents the processor + // manufacturer identifier. A maximum 12-character string. + // + // Type: string + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: "GenuineIntel" + // Note: [CPUID] command returns the vendor ID string in EBX, EDX and ECX + // registers. Writing these to memory in this order results in a 12-character + // string. + // + // [CPUID]: https://wiki.osdev.org/CPUID + HostCPUVendorIDKey = attribute.Key("host.cpu.vendor.id") + + // HostIDKey is the attribute Key conforming to the "host.id" semantic + // conventions. It represents the unique host ID. For Cloud, this must be the + // instance_id assigned by the cloud provider. For non-containerized systems, + // this should be the `machine-id`. See the table below for the sources to use + // to determine the `machine-id` based on operating system. + // + // Type: string + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: "fdbf79e8af94cb7f9e8df36789187052" + HostIDKey = attribute.Key("host.id") + + // HostImageIDKey is the attribute Key conforming to the "host.image.id" + // semantic conventions. It represents the VM image ID or host OS image ID. For + // Cloud, this value is from the provider. + // + // Type: string + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: "ami-07b06b442921831e5" + HostImageIDKey = attribute.Key("host.image.id") + + // HostImageNameKey is the attribute Key conforming to the "host.image.name" + // semantic conventions. It represents the name of the VM image or OS install + // the host was instantiated from. + // + // Type: string + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: "infra-ami-eks-worker-node-7d4ec78312", "CentOS-8-x86_64-1905" + HostImageNameKey = attribute.Key("host.image.name") + + // HostImageVersionKey is the attribute Key conforming to the + // "host.image.version" semantic conventions. It represents the version string + // of the VM image or host OS as defined in [Version Attributes]. + // + // Type: string + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: "0.1" + // + // [Version Attributes]: /docs/resource/README.md#version-attributes + HostImageVersionKey = attribute.Key("host.image.version") + + // HostIPKey is the attribute Key conforming to the "host.ip" semantic + // conventions. It represents the available IP addresses of the host, excluding + // loopback interfaces. + // + // Type: string[] + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: "192.168.1.140", "fe80::abc2:4a28:737a:609e" + // Note: IPv4 Addresses MUST be specified in dotted-quad notation. IPv6 + // addresses MUST be specified in the [RFC 5952] format. + // + // [RFC 5952]: https://www.rfc-editor.org/rfc/rfc5952.html + HostIPKey = attribute.Key("host.ip") + + // HostMacKey is the attribute Key conforming to the "host.mac" semantic + // conventions. It represents the available MAC addresses of the host, excluding + // loopback interfaces. + // + // Type: string[] + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: "AC-DE-48-23-45-67", "AC-DE-48-23-45-67-01-9F" + // Note: MAC Addresses MUST be represented in [IEEE RA hexadecimal form]: as + // hyphen-separated octets in uppercase hexadecimal form from most to least + // significant. + // + // [IEEE RA hexadecimal form]: https://standards.ieee.org/wp-content/uploads/import/documents/tutorials/eui.pdf + HostMacKey = attribute.Key("host.mac") + + // HostNameKey is the attribute Key conforming to the "host.name" semantic + // conventions. It represents the name of the host. On Unix systems, it may + // contain what the hostname command returns, or the fully qualified hostname, + // or another name specified by the user. + // + // Type: string + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: "opentelemetry-test" + HostNameKey = attribute.Key("host.name") + + // HostTypeKey is the attribute Key conforming to the "host.type" semantic + // conventions. It represents the type of host. For Cloud, this must be the + // machine type. + // + // Type: string + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: "n1-standard-1" + HostTypeKey = attribute.Key("host.type") +) + +// HostCPUCacheL2Size returns an attribute KeyValue conforming to the +// "host.cpu.cache.l2.size" semantic conventions. It represents the amount of +// level 2 memory cache available to the processor (in Bytes). +func HostCPUCacheL2Size(val int) attribute.KeyValue { + return HostCPUCacheL2SizeKey.Int(val) +} + +// HostCPUFamily returns an attribute KeyValue conforming to the +// "host.cpu.family" semantic conventions. It represents the family or generation +// of the CPU. +func HostCPUFamily(val string) attribute.KeyValue { + return HostCPUFamilyKey.String(val) +} + +// HostCPUModelID returns an attribute KeyValue conforming to the +// "host.cpu.model.id" semantic conventions. It represents the model identifier. +// It provides more granular information about the CPU, distinguishing it from +// other CPUs within the same family. +func HostCPUModelID(val string) attribute.KeyValue { + return HostCPUModelIDKey.String(val) +} + +// HostCPUModelName returns an attribute KeyValue conforming to the +// "host.cpu.model.name" semantic conventions. It represents the model +// designation of the processor. +func HostCPUModelName(val string) attribute.KeyValue { + return HostCPUModelNameKey.String(val) +} + +// HostCPUStepping returns an attribute KeyValue conforming to the +// "host.cpu.stepping" semantic conventions. It represents the stepping or core +// revisions. +func HostCPUStepping(val string) attribute.KeyValue { + return HostCPUSteppingKey.String(val) +} + +// HostCPUVendorID returns an attribute KeyValue conforming to the +// "host.cpu.vendor.id" semantic conventions. It represents the processor +// manufacturer identifier. A maximum 12-character string. +func HostCPUVendorID(val string) attribute.KeyValue { + return HostCPUVendorIDKey.String(val) +} + +// HostID returns an attribute KeyValue conforming to the "host.id" semantic +// conventions. It represents the unique host ID. For Cloud, this must be the +// instance_id assigned by the cloud provider. For non-containerized systems, +// this should be the `machine-id`. See the table below for the sources to use to +// determine the `machine-id` based on operating system. +func HostID(val string) attribute.KeyValue { + return HostIDKey.String(val) +} + +// HostImageID returns an attribute KeyValue conforming to the "host.image.id" +// semantic conventions. It represents the VM image ID or host OS image ID. For +// Cloud, this value is from the provider. +func HostImageID(val string) attribute.KeyValue { + return HostImageIDKey.String(val) +} + +// HostImageName returns an attribute KeyValue conforming to the +// "host.image.name" semantic conventions. It represents the name of the VM image +// or OS install the host was instantiated from. +func HostImageName(val string) attribute.KeyValue { + return HostImageNameKey.String(val) +} + +// HostImageVersion returns an attribute KeyValue conforming to the +// "host.image.version" semantic conventions. It represents the version string of +// the VM image or host OS as defined in [Version Attributes]. +// +// [Version Attributes]: /docs/resource/README.md#version-attributes +func HostImageVersion(val string) attribute.KeyValue { + return HostImageVersionKey.String(val) +} + +// HostIP returns an attribute KeyValue conforming to the "host.ip" semantic +// conventions. It represents the available IP addresses of the host, excluding +// loopback interfaces. +func HostIP(val ...string) attribute.KeyValue { + return HostIPKey.StringSlice(val) +} + +// HostMac returns an attribute KeyValue conforming to the "host.mac" semantic +// conventions. It represents the available MAC addresses of the host, excluding +// loopback interfaces. +func HostMac(val ...string) attribute.KeyValue { + return HostMacKey.StringSlice(val) +} + +// HostName returns an attribute KeyValue conforming to the "host.name" semantic +// conventions. It represents the name of the host. On Unix systems, it may +// contain what the hostname command returns, or the fully qualified hostname, or +// another name specified by the user. +func HostName(val string) attribute.KeyValue { + return HostNameKey.String(val) +} + +// HostType returns an attribute KeyValue conforming to the "host.type" semantic +// conventions. It represents the type of host. For Cloud, this must be the +// machine type. +func HostType(val string) attribute.KeyValue { + return HostTypeKey.String(val) +} + +// Enum values for host.arch +var ( + // AMD64 + // Stability: development + HostArchAMD64 = HostArchKey.String("amd64") + // ARM32 + // Stability: development + HostArchARM32 = HostArchKey.String("arm32") + // ARM64 + // Stability: development + HostArchARM64 = HostArchKey.String("arm64") + // Itanium + // Stability: development + HostArchIA64 = HostArchKey.String("ia64") + // 32-bit PowerPC + // Stability: development + HostArchPPC32 = HostArchKey.String("ppc32") + // 64-bit PowerPC + // Stability: development + HostArchPPC64 = HostArchKey.String("ppc64") + // IBM z/Architecture + // Stability: development + HostArchS390x = HostArchKey.String("s390x") + // 32-bit x86 + // Stability: development + HostArchX86 = HostArchKey.String("x86") +) + +// Namespace: http +const ( + // HTTPConnectionStateKey is the attribute Key conforming to the + // "http.connection.state" semantic conventions. It represents the state of the + // HTTP connection in the HTTP connection pool. + // + // Type: Enum + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: "active", "idle" + HTTPConnectionStateKey = attribute.Key("http.connection.state") + + // HTTPRequestBodySizeKey is the attribute Key conforming to the + // "http.request.body.size" semantic conventions. It represents the size of the + // request payload body in bytes. This is the number of bytes transferred + // excluding headers and is often, but not always, present as the + // [Content-Length] header. For requests using transport encoding, this should + // be the compressed size. + // + // Type: int + // RequirementLevel: Recommended + // Stability: Development + // + // [Content-Length]: https://www.rfc-editor.org/rfc/rfc9110.html#field.content-length + HTTPRequestBodySizeKey = attribute.Key("http.request.body.size") + + // HTTPRequestMethodKey is the attribute Key conforming to the + // "http.request.method" semantic conventions. It represents the HTTP request + // method. + // + // Type: Enum + // RequirementLevel: Recommended + // Stability: Stable + // + // Examples: "GET", "POST", "HEAD" + // Note: HTTP request method value SHOULD be "known" to the instrumentation. + // By default, this convention defines "known" methods as the ones listed in + // [RFC9110], + // the PATCH method defined in [RFC5789] + // and the QUERY method defined in [httpbis-safe-method-w-body]. + // + // If the HTTP request method is not known to instrumentation, it MUST set the + // `http.request.method` attribute to `_OTHER`. + // + // If the HTTP instrumentation could end up converting valid HTTP request + // methods to `_OTHER`, then it MUST provide a way to override + // the list of known HTTP methods. If this override is done via environment + // variable, then the environment variable MUST be named + // OTEL_INSTRUMENTATION_HTTP_KNOWN_METHODS and support a comma-separated list of + // case-sensitive known HTTP methods. + // + // + // If this override is done via declarative configuration, then the list MUST be + // configurable via the `known_methods` property + // (an array of case-sensitive strings with minimum items 0) under + // `.instrumentation/development.general.http.client` and/or + // `.instrumentation/development.general.http.server`. + // + // In either case, this list MUST be a full override of the default known + // methods, + // it is not a list of known methods in addition to the defaults. + // + // HTTP method names are case-sensitive and `http.request.method` attribute + // value MUST match a known HTTP method name exactly. + // Instrumentations for specific web frameworks that consider HTTP methods to be + // case insensitive, SHOULD populate a canonical equivalent. + // Tracing instrumentations that do so, MUST also set + // `http.request.method_original` to the original value. + // + // [RFC9110]: https://www.rfc-editor.org/rfc/rfc9110.html#name-methods + // [RFC5789]: https://www.rfc-editor.org/rfc/rfc5789.html + // [httpbis-safe-method-w-body]: https://datatracker.ietf.org/doc/draft-ietf-httpbis-safe-method-w-body/?include_text=1 + HTTPRequestMethodKey = attribute.Key("http.request.method") + + // HTTPRequestMethodOriginalKey is the attribute Key conforming to the + // "http.request.method_original" semantic conventions. It represents the + // original HTTP method sent by the client in the request line. + // + // Type: string + // RequirementLevel: Recommended + // Stability: Stable + // + // Examples: "GeT", "ACL", "foo" + HTTPRequestMethodOriginalKey = attribute.Key("http.request.method_original") + + // HTTPRequestResendCountKey is the attribute Key conforming to the + // "http.request.resend_count" semantic conventions. It represents the ordinal + // number of request resending attempt (for any reason, including redirects). + // + // Type: int + // RequirementLevel: Recommended + // Stability: Stable + // + // Note: The resend count SHOULD be updated each time an HTTP request gets + // resent by the client, regardless of what was the cause of the resending (e.g. + // redirection, authorization failure, 503 Server Unavailable, network issues, + // or any other). + HTTPRequestResendCountKey = attribute.Key("http.request.resend_count") + + // HTTPRequestSizeKey is the attribute Key conforming to the "http.request.size" + // semantic conventions. It represents the total size of the request in bytes. + // This should be the total number of bytes sent over the wire, including the + // request line (HTTP/1.1), framing (HTTP/2 and HTTP/3), headers, and request + // body if any. + // + // Type: int + // RequirementLevel: Recommended + // Stability: Development + HTTPRequestSizeKey = attribute.Key("http.request.size") + + // HTTPResponseBodySizeKey is the attribute Key conforming to the + // "http.response.body.size" semantic conventions. It represents the size of the + // response payload body in bytes. This is the number of bytes transferred + // excluding headers and is often, but not always, present as the + // [Content-Length] header. For requests using transport encoding, this should + // be the compressed size. + // + // Type: int + // RequirementLevel: Recommended + // Stability: Development + // + // [Content-Length]: https://www.rfc-editor.org/rfc/rfc9110.html#field.content-length + HTTPResponseBodySizeKey = attribute.Key("http.response.body.size") + + // HTTPResponseSizeKey is the attribute Key conforming to the + // "http.response.size" semantic conventions. It represents the total size of + // the response in bytes. This should be the total number of bytes sent over the + // wire, including the status line (HTTP/1.1), framing (HTTP/2 and HTTP/3), + // headers, and response body and trailers if any. + // + // Type: int + // RequirementLevel: Recommended + // Stability: Development + HTTPResponseSizeKey = attribute.Key("http.response.size") + + // HTTPResponseStatusCodeKey is the attribute Key conforming to the + // "http.response.status_code" semantic conventions. It represents the + // [HTTP response status code]. + // + // Type: int + // RequirementLevel: Recommended + // Stability: Stable + // + // Examples: 200 + // + // [HTTP response status code]: https://tools.ietf.org/html/rfc7231#section-6 + HTTPResponseStatusCodeKey = attribute.Key("http.response.status_code") + + // HTTPRouteKey is the attribute Key conforming to the "http.route" semantic + // conventions. It represents the matched route template for the request. This + // MUST be low-cardinality and include all static path segments, with dynamic + // path segments represented with placeholders. + // + // Type: string + // RequirementLevel: Recommended + // Stability: Stable + // + // Examples: "/users/:userID?", "my-controller/my-action/{id?}" + // Note: MUST NOT be populated when this is not supported by the HTTP server + // framework as the route attribute should have low-cardinality and the URI path + // can NOT substitute it. + // SHOULD include the [application root] if there is one. + // + // A static path segment is a part of the route template with a fixed, + // low-cardinality value. This includes literal strings like `/users/` and + // placeholders that + // are constrained to a finite, predefined set of values, e.g. `{controller}` or + // `{action}`. + // + // A dynamic path segment is a placeholder for a value that can have high + // cardinality and is not constrained to a predefined list like static path + // segments. + // + // Instrumentations SHOULD use routing information provided by the corresponding + // web framework. They SHOULD pick the most precise source of routing + // information and MAY + // support custom route formatting. Instrumentations SHOULD document the format + // and the API used to obtain the route string. + // + // [application root]: /docs/http/http-spans.md#http-server-definitions + HTTPRouteKey = attribute.Key("http.route") +) + +// HTTPRequestBodySize returns an attribute KeyValue conforming to the +// "http.request.body.size" semantic conventions. It represents the size of the +// request payload body in bytes. This is the number of bytes transferred +// excluding headers and is often, but not always, present as the +// [Content-Length] header. For requests using transport encoding, this should be +// the compressed size. +// +// [Content-Length]: https://www.rfc-editor.org/rfc/rfc9110.html#field.content-length +func HTTPRequestBodySize(val int) attribute.KeyValue { + return HTTPRequestBodySizeKey.Int(val) +} + +// HTTPRequestHeader returns an attribute KeyValue conforming to the +// "http.request.header" semantic conventions. It represents the HTTP request +// headers, `` being the normalized HTTP Header name (lowercase), the value +// being the header values. +func HTTPRequestHeader(key string, val ...string) attribute.KeyValue { + return attribute.StringSlice("http.request.header."+key, val) +} + +// HTTPRequestMethodOriginal returns an attribute KeyValue conforming to the +// "http.request.method_original" semantic conventions. It represents the +// original HTTP method sent by the client in the request line. +func HTTPRequestMethodOriginal(val string) attribute.KeyValue { + return HTTPRequestMethodOriginalKey.String(val) +} + +// HTTPRequestResendCount returns an attribute KeyValue conforming to the +// "http.request.resend_count" semantic conventions. It represents the ordinal +// number of request resending attempt (for any reason, including redirects). +func HTTPRequestResendCount(val int) attribute.KeyValue { + return HTTPRequestResendCountKey.Int(val) +} + +// HTTPRequestSize returns an attribute KeyValue conforming to the +// "http.request.size" semantic conventions. It represents the total size of the +// request in bytes. This should be the total number of bytes sent over the wire, +// including the request line (HTTP/1.1), framing (HTTP/2 and HTTP/3), headers, +// and request body if any. +func HTTPRequestSize(val int) attribute.KeyValue { + return HTTPRequestSizeKey.Int(val) +} + +// HTTPResponseBodySize returns an attribute KeyValue conforming to the +// "http.response.body.size" semantic conventions. It represents the size of the +// response payload body in bytes. This is the number of bytes transferred +// excluding headers and is often, but not always, present as the +// [Content-Length] header. For requests using transport encoding, this should be +// the compressed size. +// +// [Content-Length]: https://www.rfc-editor.org/rfc/rfc9110.html#field.content-length +func HTTPResponseBodySize(val int) attribute.KeyValue { + return HTTPResponseBodySizeKey.Int(val) +} + +// HTTPResponseHeader returns an attribute KeyValue conforming to the +// "http.response.header" semantic conventions. It represents the HTTP response +// headers, `` being the normalized HTTP Header name (lowercase), the value +// being the header values. +func HTTPResponseHeader(key string, val ...string) attribute.KeyValue { + return attribute.StringSlice("http.response.header."+key, val) +} + +// HTTPResponseSize returns an attribute KeyValue conforming to the +// "http.response.size" semantic conventions. It represents the total size of the +// response in bytes. This should be the total number of bytes sent over the +// wire, including the status line (HTTP/1.1), framing (HTTP/2 and HTTP/3), +// headers, and response body and trailers if any. +func HTTPResponseSize(val int) attribute.KeyValue { + return HTTPResponseSizeKey.Int(val) +} + +// HTTPResponseStatusCode returns an attribute KeyValue conforming to the +// "http.response.status_code" semantic conventions. It represents the +// [HTTP response status code]. +// +// [HTTP response status code]: https://tools.ietf.org/html/rfc7231#section-6 +func HTTPResponseStatusCode(val int) attribute.KeyValue { + return HTTPResponseStatusCodeKey.Int(val) +} + +// HTTPRoute returns an attribute KeyValue conforming to the "http.route" +// semantic conventions. It represents the matched route template for the +// request. This MUST be low-cardinality and include all static path segments, +// with dynamic path segments represented with placeholders. +func HTTPRoute(val string) attribute.KeyValue { + return HTTPRouteKey.String(val) +} + +// Enum values for http.connection.state +var ( + // active state. + // Stability: development + HTTPConnectionStateActive = HTTPConnectionStateKey.String("active") + // idle state. + // Stability: development + HTTPConnectionStateIdle = HTTPConnectionStateKey.String("idle") +) + +// Enum values for http.request.method +var ( + // CONNECT method. + // Stability: stable + HTTPRequestMethodConnect = HTTPRequestMethodKey.String("CONNECT") + // DELETE method. + // Stability: stable + HTTPRequestMethodDelete = HTTPRequestMethodKey.String("DELETE") + // GET method. + // Stability: stable + HTTPRequestMethodGet = HTTPRequestMethodKey.String("GET") + // HEAD method. + // Stability: stable + HTTPRequestMethodHead = HTTPRequestMethodKey.String("HEAD") + // OPTIONS method. + // Stability: stable + HTTPRequestMethodOptions = HTTPRequestMethodKey.String("OPTIONS") + // PATCH method. + // Stability: stable + HTTPRequestMethodPatch = HTTPRequestMethodKey.String("PATCH") + // POST method. + // Stability: stable + HTTPRequestMethodPost = HTTPRequestMethodKey.String("POST") + // PUT method. + // Stability: stable + HTTPRequestMethodPut = HTTPRequestMethodKey.String("PUT") + // TRACE method. + // Stability: stable + HTTPRequestMethodTrace = HTTPRequestMethodKey.String("TRACE") + // QUERY method. + // Stability: development + HTTPRequestMethodQuery = HTTPRequestMethodKey.String("QUERY") + // Any HTTP method that the instrumentation has no prior knowledge of. + // Stability: stable + HTTPRequestMethodOther = HTTPRequestMethodKey.String("_OTHER") +) + +// Namespace: hw +const ( + // HwBatteryCapacityKey is the attribute Key conforming to the + // "hw.battery.capacity" semantic conventions. It represents the design capacity + // in Watts-hours or Amper-hours. + // + // Type: string + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: "9.3Ah", "50Wh" + HwBatteryCapacityKey = attribute.Key("hw.battery.capacity") + + // HwBatteryChemistryKey is the attribute Key conforming to the + // "hw.battery.chemistry" semantic conventions. It represents the battery + // [chemistry], e.g. Lithium-Ion, Nickel-Cadmium, etc. + // + // Type: string + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: "Li-ion", "NiMH" + // + // [chemistry]: https://schemas.dmtf.org/wbem/cim-html/2.31.0/CIM_Battery.html + HwBatteryChemistryKey = attribute.Key("hw.battery.chemistry") + + // HwBatteryStateKey is the attribute Key conforming to the "hw.battery.state" + // semantic conventions. It represents the current state of the battery. + // + // Type: Enum + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: + HwBatteryStateKey = attribute.Key("hw.battery.state") + + // HwBiosVersionKey is the attribute Key conforming to the "hw.bios_version" + // semantic conventions. It represents the BIOS version of the hardware + // component. + // + // Type: string + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: "1.2.3" + HwBiosVersionKey = attribute.Key("hw.bios_version") + + // HwDriverVersionKey is the attribute Key conforming to the "hw.driver_version" + // semantic conventions. It represents the driver version for the hardware + // component. + // + // Type: string + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: "10.2.1-3" + HwDriverVersionKey = attribute.Key("hw.driver_version") + + // HwEnclosureTypeKey is the attribute Key conforming to the "hw.enclosure.type" + // semantic conventions. It represents the type of the enclosure (useful for + // modular systems). + // + // Type: string + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: "Computer", "Storage", "Switch" + HwEnclosureTypeKey = attribute.Key("hw.enclosure.type") + + // HwFirmwareVersionKey is the attribute Key conforming to the + // "hw.firmware_version" semantic conventions. It represents the firmware + // version of the hardware component. + // + // Type: string + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: "2.0.1" + HwFirmwareVersionKey = attribute.Key("hw.firmware_version") + + // HwGpuTaskKey is the attribute Key conforming to the "hw.gpu.task" semantic + // conventions. It represents the type of task the GPU is performing. + // + // Type: Enum + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: + HwGpuTaskKey = attribute.Key("hw.gpu.task") + + // HwIDKey is the attribute Key conforming to the "hw.id" semantic conventions. + // It represents an identifier for the hardware component, unique within the + // monitored host. + // + // Type: string + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: "win32battery_battery_testsysa33_1" + HwIDKey = attribute.Key("hw.id") + + // HwLimitTypeKey is the attribute Key conforming to the "hw.limit_type" + // semantic conventions. It represents the type of limit for hardware + // components. + // + // Type: Enum + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: + HwLimitTypeKey = attribute.Key("hw.limit_type") + + // HwLogicalDiskRaidLevelKey is the attribute Key conforming to the + // "hw.logical_disk.raid_level" semantic conventions. It represents the RAID + // Level of the logical disk. + // + // Type: string + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: "RAID0+1", "RAID5", "RAID10" + HwLogicalDiskRaidLevelKey = attribute.Key("hw.logical_disk.raid_level") + + // HwLogicalDiskStateKey is the attribute Key conforming to the + // "hw.logical_disk.state" semantic conventions. It represents the state of the + // logical disk space usage. + // + // Type: Enum + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: + HwLogicalDiskStateKey = attribute.Key("hw.logical_disk.state") + + // HwMemoryTypeKey is the attribute Key conforming to the "hw.memory.type" + // semantic conventions. It represents the type of the memory module. + // + // Type: string + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: "DDR4", "DDR5", "LPDDR5" + HwMemoryTypeKey = attribute.Key("hw.memory.type") + + // HwModelKey is the attribute Key conforming to the "hw.model" semantic + // conventions. It represents the descriptive model name of the hardware + // component. + // + // Type: string + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: "PERC H740P", "Intel(R) Core(TM) i7-10700K", "Dell XPS 15 Battery" + HwModelKey = attribute.Key("hw.model") + + // HwNameKey is the attribute Key conforming to the "hw.name" semantic + // conventions. It represents an easily-recognizable name for the hardware + // component. + // + // Type: string + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: "eth0" + HwNameKey = attribute.Key("hw.name") + + // HwNetworkLogicalAddressesKey is the attribute Key conforming to the + // "hw.network.logical_addresses" semantic conventions. It represents the + // logical addresses of the adapter (e.g. IP address, or WWPN). + // + // Type: string[] + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: "172.16.8.21", "57.11.193.42" + HwNetworkLogicalAddressesKey = attribute.Key("hw.network.logical_addresses") + + // HwNetworkPhysicalAddressKey is the attribute Key conforming to the + // "hw.network.physical_address" semantic conventions. It represents the + // physical address of the adapter (e.g. MAC address, or WWNN). + // + // Type: string + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: "00-90-F5-E9-7B-36" + HwNetworkPhysicalAddressKey = attribute.Key("hw.network.physical_address") + + // HwParentKey is the attribute Key conforming to the "hw.parent" semantic + // conventions. It represents the unique identifier of the parent component + // (typically the `hw.id` attribute of the enclosure, or disk controller). + // + // Type: string + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: "dellStorage_perc_0" + HwParentKey = attribute.Key("hw.parent") + + // HwPhysicalDiskSmartAttributeKey is the attribute Key conforming to the + // "hw.physical_disk.smart_attribute" semantic conventions. It represents the + // [S.M.A.R.T.] (Self-Monitoring, Analysis, and Reporting Technology) attribute + // of the physical disk. + // + // Type: string + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: "Spin Retry Count", "Seek Error Rate", "Raw Read Error Rate" + // + // [S.M.A.R.T.]: https://wikipedia.org/wiki/S.M.A.R.T. + HwPhysicalDiskSmartAttributeKey = attribute.Key("hw.physical_disk.smart_attribute") + + // HwPhysicalDiskStateKey is the attribute Key conforming to the + // "hw.physical_disk.state" semantic conventions. It represents the state of the + // physical disk endurance utilization. + // + // Type: Enum + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: + HwPhysicalDiskStateKey = attribute.Key("hw.physical_disk.state") + + // HwPhysicalDiskTypeKey is the attribute Key conforming to the + // "hw.physical_disk.type" semantic conventions. It represents the type of the + // physical disk. + // + // Type: string + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: "HDD", "SSD", "10K" + HwPhysicalDiskTypeKey = attribute.Key("hw.physical_disk.type") + + // HwSensorLocationKey is the attribute Key conforming to the + // "hw.sensor_location" semantic conventions. It represents the location of the + // sensor. + // + // Type: string + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: "cpu0", "ps1", "INLET", "CPU0_DIE", "AMBIENT", "MOTHERBOARD", "PS0 + // V3_3", "MAIN_12V", "CPU_VCORE" + HwSensorLocationKey = attribute.Key("hw.sensor_location") + + // HwSerialNumberKey is the attribute Key conforming to the "hw.serial_number" + // semantic conventions. It represents the serial number of the hardware + // component. + // + // Type: string + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: "CNFCP0123456789" + HwSerialNumberKey = attribute.Key("hw.serial_number") + + // HwStateKey is the attribute Key conforming to the "hw.state" semantic + // conventions. It represents the current state of the component. + // + // Type: Enum + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: + HwStateKey = attribute.Key("hw.state") + + // HwTapeDriveOperationTypeKey is the attribute Key conforming to the + // "hw.tape_drive.operation_type" semantic conventions. It represents the type + // of tape drive operation. + // + // Type: Enum + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: + HwTapeDriveOperationTypeKey = attribute.Key("hw.tape_drive.operation_type") + + // HwTypeKey is the attribute Key conforming to the "hw.type" semantic + // conventions. It represents the type of the component. + // + // Type: Enum + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: + // Note: Describes the category of the hardware component for which `hw.state` + // is being reported. For example, `hw.type=temperature` along with + // `hw.state=degraded` would indicate that the temperature of the hardware + // component has been reported as `degraded`. + HwTypeKey = attribute.Key("hw.type") + + // HwVendorKey is the attribute Key conforming to the "hw.vendor" semantic + // conventions. It represents the vendor name of the hardware component. + // + // Type: string + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: "Dell", "HP", "Intel", "AMD", "LSI", "Lenovo" + HwVendorKey = attribute.Key("hw.vendor") +) + +// HwBatteryCapacity returns an attribute KeyValue conforming to the +// "hw.battery.capacity" semantic conventions. It represents the design capacity +// in Watts-hours or Amper-hours. +func HwBatteryCapacity(val string) attribute.KeyValue { + return HwBatteryCapacityKey.String(val) +} + +// HwBatteryChemistry returns an attribute KeyValue conforming to the +// "hw.battery.chemistry" semantic conventions. It represents the battery +// [chemistry], e.g. Lithium-Ion, Nickel-Cadmium, etc. +// +// [chemistry]: https://schemas.dmtf.org/wbem/cim-html/2.31.0/CIM_Battery.html +func HwBatteryChemistry(val string) attribute.KeyValue { + return HwBatteryChemistryKey.String(val) +} + +// HwBiosVersion returns an attribute KeyValue conforming to the +// "hw.bios_version" semantic conventions. It represents the BIOS version of the +// hardware component. +func HwBiosVersion(val string) attribute.KeyValue { + return HwBiosVersionKey.String(val) +} + +// HwDriverVersion returns an attribute KeyValue conforming to the +// "hw.driver_version" semantic conventions. It represents the driver version for +// the hardware component. +func HwDriverVersion(val string) attribute.KeyValue { + return HwDriverVersionKey.String(val) +} + +// HwEnclosureType returns an attribute KeyValue conforming to the +// "hw.enclosure.type" semantic conventions. It represents the type of the +// enclosure (useful for modular systems). +func HwEnclosureType(val string) attribute.KeyValue { + return HwEnclosureTypeKey.String(val) +} + +// HwFirmwareVersion returns an attribute KeyValue conforming to the +// "hw.firmware_version" semantic conventions. It represents the firmware version +// of the hardware component. +func HwFirmwareVersion(val string) attribute.KeyValue { + return HwFirmwareVersionKey.String(val) +} + +// HwID returns an attribute KeyValue conforming to the "hw.id" semantic +// conventions. It represents an identifier for the hardware component, unique +// within the monitored host. +func HwID(val string) attribute.KeyValue { + return HwIDKey.String(val) +} + +// HwLogicalDiskRaidLevel returns an attribute KeyValue conforming to the +// "hw.logical_disk.raid_level" semantic conventions. It represents the RAID +// Level of the logical disk. +func HwLogicalDiskRaidLevel(val string) attribute.KeyValue { + return HwLogicalDiskRaidLevelKey.String(val) +} + +// HwMemoryType returns an attribute KeyValue conforming to the "hw.memory.type" +// semantic conventions. It represents the type of the memory module. +func HwMemoryType(val string) attribute.KeyValue { + return HwMemoryTypeKey.String(val) +} + +// HwModel returns an attribute KeyValue conforming to the "hw.model" semantic +// conventions. It represents the descriptive model name of the hardware +// component. +func HwModel(val string) attribute.KeyValue { + return HwModelKey.String(val) +} + +// HwName returns an attribute KeyValue conforming to the "hw.name" semantic +// conventions. It represents an easily-recognizable name for the hardware +// component. +func HwName(val string) attribute.KeyValue { + return HwNameKey.String(val) +} + +// HwNetworkLogicalAddresses returns an attribute KeyValue conforming to the +// "hw.network.logical_addresses" semantic conventions. It represents the logical +// addresses of the adapter (e.g. IP address, or WWPN). +func HwNetworkLogicalAddresses(val ...string) attribute.KeyValue { + return HwNetworkLogicalAddressesKey.StringSlice(val) +} + +// HwNetworkPhysicalAddress returns an attribute KeyValue conforming to the +// "hw.network.physical_address" semantic conventions. It represents the physical +// address of the adapter (e.g. MAC address, or WWNN). +func HwNetworkPhysicalAddress(val string) attribute.KeyValue { + return HwNetworkPhysicalAddressKey.String(val) +} + +// HwParent returns an attribute KeyValue conforming to the "hw.parent" semantic +// conventions. It represents the unique identifier of the parent component +// (typically the `hw.id` attribute of the enclosure, or disk controller). +func HwParent(val string) attribute.KeyValue { + return HwParentKey.String(val) +} + +// HwPhysicalDiskSmartAttribute returns an attribute KeyValue conforming to the +// "hw.physical_disk.smart_attribute" semantic conventions. It represents the +// [S.M.A.R.T.] (Self-Monitoring, Analysis, and Reporting Technology) attribute +// of the physical disk. +// +// [S.M.A.R.T.]: https://wikipedia.org/wiki/S.M.A.R.T. +func HwPhysicalDiskSmartAttribute(val string) attribute.KeyValue { + return HwPhysicalDiskSmartAttributeKey.String(val) +} + +// HwPhysicalDiskType returns an attribute KeyValue conforming to the +// "hw.physical_disk.type" semantic conventions. It represents the type of the +// physical disk. +func HwPhysicalDiskType(val string) attribute.KeyValue { + return HwPhysicalDiskTypeKey.String(val) +} + +// HwSensorLocation returns an attribute KeyValue conforming to the +// "hw.sensor_location" semantic conventions. It represents the location of the +// sensor. +func HwSensorLocation(val string) attribute.KeyValue { + return HwSensorLocationKey.String(val) +} + +// HwSerialNumber returns an attribute KeyValue conforming to the +// "hw.serial_number" semantic conventions. It represents the serial number of +// the hardware component. +func HwSerialNumber(val string) attribute.KeyValue { + return HwSerialNumberKey.String(val) +} + +// HwVendor returns an attribute KeyValue conforming to the "hw.vendor" semantic +// conventions. It represents the vendor name of the hardware component. +func HwVendor(val string) attribute.KeyValue { + return HwVendorKey.String(val) +} + +// Enum values for hw.battery.state +var ( + // Charging + // Stability: development + HwBatteryStateCharging = HwBatteryStateKey.String("charging") + // Discharging + // Stability: development + HwBatteryStateDischarging = HwBatteryStateKey.String("discharging") +) + +// Enum values for hw.gpu.task +var ( + // Decoder + // Stability: development + HwGpuTaskDecoder = HwGpuTaskKey.String("decoder") + // Encoder + // Stability: development + HwGpuTaskEncoder = HwGpuTaskKey.String("encoder") + // General + // Stability: development + HwGpuTaskGeneral = HwGpuTaskKey.String("general") +) + +// Enum values for hw.limit_type +var ( + // Critical + // Stability: development + HwLimitTypeCritical = HwLimitTypeKey.String("critical") + // Degraded + // Stability: development + HwLimitTypeDegraded = HwLimitTypeKey.String("degraded") + // High Critical + // Stability: development + HwLimitTypeHighCritical = HwLimitTypeKey.String("high.critical") + // High Degraded + // Stability: development + HwLimitTypeHighDegraded = HwLimitTypeKey.String("high.degraded") + // Low Critical + // Stability: development + HwLimitTypeLowCritical = HwLimitTypeKey.String("low.critical") + // Low Degraded + // Stability: development + HwLimitTypeLowDegraded = HwLimitTypeKey.String("low.degraded") + // Maximum + // Stability: development + HwLimitTypeMax = HwLimitTypeKey.String("max") + // Throttled + // Stability: development + HwLimitTypeThrottled = HwLimitTypeKey.String("throttled") + // Turbo + // Stability: development + HwLimitTypeTurbo = HwLimitTypeKey.String("turbo") +) + +// Enum values for hw.logical_disk.state +var ( + // Used + // Stability: development + HwLogicalDiskStateUsed = HwLogicalDiskStateKey.String("used") + // Free + // Stability: development + HwLogicalDiskStateFree = HwLogicalDiskStateKey.String("free") +) + +// Enum values for hw.physical_disk.state +var ( + // Remaining + // Stability: development + HwPhysicalDiskStateRemaining = HwPhysicalDiskStateKey.String("remaining") +) + +// Enum values for hw.state +var ( + // Degraded + // Stability: development + HwStateDegraded = HwStateKey.String("degraded") + // Failed + // Stability: development + HwStateFailed = HwStateKey.String("failed") + // Needs Cleaning + // Stability: development + HwStateNeedsCleaning = HwStateKey.String("needs_cleaning") + // OK + // Stability: development + HwStateOk = HwStateKey.String("ok") + // Predicted Failure + // Stability: development + HwStatePredictedFailure = HwStateKey.String("predicted_failure") +) + +// Enum values for hw.tape_drive.operation_type +var ( + // Mount + // Stability: development + HwTapeDriveOperationTypeMount = HwTapeDriveOperationTypeKey.String("mount") + // Unmount + // Stability: development + HwTapeDriveOperationTypeUnmount = HwTapeDriveOperationTypeKey.String("unmount") + // Clean + // Stability: development + HwTapeDriveOperationTypeClean = HwTapeDriveOperationTypeKey.String("clean") +) + +// Enum values for hw.type +var ( + // Battery + // Stability: development + HwTypeBattery = HwTypeKey.String("battery") + // CPU + // Stability: development + HwTypeCPU = HwTypeKey.String("cpu") + // Disk controller + // Stability: development + HwTypeDiskController = HwTypeKey.String("disk_controller") + // Enclosure + // Stability: development + HwTypeEnclosure = HwTypeKey.String("enclosure") + // Fan + // Stability: development + HwTypeFan = HwTypeKey.String("fan") + // GPU + // Stability: development + HwTypeGpu = HwTypeKey.String("gpu") + // Logical disk + // Stability: development + HwTypeLogicalDisk = HwTypeKey.String("logical_disk") + // Memory + // Stability: development + HwTypeMemory = HwTypeKey.String("memory") + // Network + // Stability: development + HwTypeNetwork = HwTypeKey.String("network") + // Physical disk + // Stability: development + HwTypePhysicalDisk = HwTypeKey.String("physical_disk") + // Power supply + // Stability: development + HwTypePowerSupply = HwTypeKey.String("power_supply") + // Tape drive + // Stability: development + HwTypeTapeDrive = HwTypeKey.String("tape_drive") + // Temperature + // Stability: development + HwTypeTemperature = HwTypeKey.String("temperature") + // Voltage + // Stability: development + HwTypeVoltage = HwTypeKey.String("voltage") +) + +// Namespace: ios +const ( + // IOSAppStateKey is the attribute Key conforming to the "ios.app.state" + // semantic conventions. It represents the this attribute represents the state + // of the application. + // + // Type: Enum + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: + // Note: The iOS lifecycle states are defined in the + // [UIApplicationDelegate documentation], and from which the `OS terminology` + // column values are derived. + // + // [UIApplicationDelegate documentation]: https://developer.apple.com/documentation/uikit/uiapplicationdelegate + IOSAppStateKey = attribute.Key("ios.app.state") +) + +// Enum values for ios.app.state +var ( + // The app has become `active`. Associated with UIKit notification + // `applicationDidBecomeActive`. + // + // Stability: development + IOSAppStateActive = IOSAppStateKey.String("active") + // The app is now `inactive`. Associated with UIKit notification + // `applicationWillResignActive`. + // + // Stability: development + IOSAppStateInactive = IOSAppStateKey.String("inactive") + // The app is now in the background. This value is associated with UIKit + // notification `applicationDidEnterBackground`. + // + // Stability: development + IOSAppStateBackground = IOSAppStateKey.String("background") + // The app is now in the foreground. This value is associated with UIKit + // notification `applicationWillEnterForeground`. + // + // Stability: development + IOSAppStateForeground = IOSAppStateKey.String("foreground") + // The app is about to terminate. Associated with UIKit notification + // `applicationWillTerminate`. + // + // Stability: development + IOSAppStateTerminate = IOSAppStateKey.String("terminate") +) + +// Namespace: jsonrpc +const ( + // JSONRPCProtocolVersionKey is the attribute Key conforming to the + // "jsonrpc.protocol.version" semantic conventions. It represents the protocol + // version, as specified in the `jsonrpc` property of the request and its + // corresponding response. + // + // Type: string + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: "2.0", "1.0" + JSONRPCProtocolVersionKey = attribute.Key("jsonrpc.protocol.version") + + // JSONRPCRequestIDKey is the attribute Key conforming to the + // "jsonrpc.request.id" semantic conventions. It represents a string + // representation of the `id` property of the request and its corresponding + // response. + // + // Type: string + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: "10", "request-7" + // Note: Under the [JSON-RPC specification], the `id` property may be a string, + // number, null, or omitted entirely. When omitted, the request is treated as a + // notification. Using `null` is not equivalent to omitting the `id`, but it is + // discouraged. + // Instrumentations SHOULD NOT capture this attribute when the `id` is `null` or + // omitted. + // + // [JSON-RPC specification]: https://www.jsonrpc.org/specification + JSONRPCRequestIDKey = attribute.Key("jsonrpc.request.id") +) + +// JSONRPCProtocolVersion returns an attribute KeyValue conforming to the +// "jsonrpc.protocol.version" semantic conventions. It represents the protocol +// version, as specified in the `jsonrpc` property of the request and its +// corresponding response. +func JSONRPCProtocolVersion(val string) attribute.KeyValue { + return JSONRPCProtocolVersionKey.String(val) +} + +// JSONRPCRequestID returns an attribute KeyValue conforming to the +// "jsonrpc.request.id" semantic conventions. It represents a string +// representation of the `id` property of the request and its corresponding +// response. +func JSONRPCRequestID(val string) attribute.KeyValue { + return JSONRPCRequestIDKey.String(val) +} + +// Namespace: k8s +const ( + // K8SClusterNameKey is the attribute Key conforming to the "k8s.cluster.name" + // semantic conventions. It represents the name of the cluster. + // + // Type: string + // RequirementLevel: Recommended + // Stability: Beta + // + // Examples: "opentelemetry-cluster" + K8SClusterNameKey = attribute.Key("k8s.cluster.name") + + // K8SClusterUIDKey is the attribute Key conforming to the "k8s.cluster.uid" + // semantic conventions. It represents a pseudo-ID for the cluster, set to the + // UID of the `kube-system` namespace. + // + // Type: string + // RequirementLevel: Recommended + // Stability: Beta + // + // Examples: "218fc5a9-a5f1-4b54-aa05-46717d0ab26d" + // Note: K8s doesn't have support for obtaining a cluster ID. If this is ever + // added, we will recommend collecting the `k8s.cluster.uid` through the + // official APIs. In the meantime, we are able to use the `uid` of the + // `kube-system` namespace as a proxy for cluster ID. Read on for the + // rationale. + // + // Every object created in a K8s cluster is assigned a distinct UID. The + // `kube-system` namespace is used by Kubernetes itself and will exist + // for the lifetime of the cluster. Using the `uid` of the `kube-system` + // namespace is a reasonable proxy for the K8s ClusterID as it will only + // change if the cluster is rebuilt. Furthermore, Kubernetes UIDs are + // UUIDs as standardized by + // [ISO/IEC 9834-8 and ITU-T X.667]. + // Which states: + // + // > If generated according to one of the mechanisms defined in Rec. + // > ITU-T X.667 | ISO/IEC 9834-8, a UUID is either guaranteed to be + // > different from all other UUIDs generated before 3603 A.D., or is + // > extremely likely to be different (depending on the mechanism chosen). + // + // Therefore, UIDs between clusters should be extremely unlikely to + // conflict. + // + // [ISO/IEC 9834-8 and ITU-T X.667]: https://www.itu.int/ITU-T/studygroups/com17/oid.html + K8SClusterUIDKey = attribute.Key("k8s.cluster.uid") + + // K8SContainerNameKey is the attribute Key conforming to the + // "k8s.container.name" semantic conventions. It represents the name of the + // Container from Pod specification, must be unique within a Pod. Container + // runtime usually uses different globally unique name (`container.name`). + // + // Type: string + // RequirementLevel: Recommended + // Stability: Beta + // + // Examples: "redis" + K8SContainerNameKey = attribute.Key("k8s.container.name") + + // K8SContainerRestartCountKey is the attribute Key conforming to the + // "k8s.container.restart_count" semantic conventions. It represents the number + // of times the container was restarted. This attribute can be used to identify + // a particular container (running or stopped) within a container spec. + // + // Type: int + // RequirementLevel: Recommended + // Stability: Beta + // + // Examples: + K8SContainerRestartCountKey = attribute.Key("k8s.container.restart_count") + + // K8SContainerStatusLastTerminatedReasonKey is the attribute Key conforming to + // the "k8s.container.status.last_terminated_reason" semantic conventions. It + // represents the last terminated reason of the Container. + // + // Type: string + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: "Evicted", "Error" + K8SContainerStatusLastTerminatedReasonKey = attribute.Key("k8s.container.status.last_terminated_reason") + + // K8SContainerStatusReasonKey is the attribute Key conforming to the + // "k8s.container.status.reason" semantic conventions. It represents the reason + // for the container state. Corresponds to the `reason` field of the: + // [K8s ContainerStateWaiting] or [K8s ContainerStateTerminated]. + // + // Type: Enum + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: "ContainerCreating", "CrashLoopBackOff", + // "CreateContainerConfigError", "ErrImagePull", "ImagePullBackOff", + // "OOMKilled", "Completed", "Error", "ContainerCannotRun" + // + // [K8s ContainerStateWaiting]: https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.30/#containerstatewaiting-v1-core + // [K8s ContainerStateTerminated]: https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.30/#containerstateterminated-v1-core + K8SContainerStatusReasonKey = attribute.Key("k8s.container.status.reason") + + // K8SContainerStatusStateKey is the attribute Key conforming to the + // "k8s.container.status.state" semantic conventions. It represents the state of + // the container. [K8s ContainerState]. + // + // Type: Enum + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: "terminated", "running", "waiting" + // + // [K8s ContainerState]: https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.30/#containerstate-v1-core + K8SContainerStatusStateKey = attribute.Key("k8s.container.status.state") + + // K8SCronJobNameKey is the attribute Key conforming to the "k8s.cronjob.name" + // semantic conventions. It represents the name of the CronJob. + // + // Type: string + // RequirementLevel: Recommended + // Stability: Beta + // + // Examples: "opentelemetry" + K8SCronJobNameKey = attribute.Key("k8s.cronjob.name") + + // K8SCronJobUIDKey is the attribute Key conforming to the "k8s.cronjob.uid" + // semantic conventions. It represents the UID of the CronJob. + // + // Type: string + // RequirementLevel: Recommended + // Stability: Beta + // + // Examples: "275ecb36-5aa8-4c2a-9c47-d8bb681b9aff" + K8SCronJobUIDKey = attribute.Key("k8s.cronjob.uid") + + // K8SDaemonSetNameKey is the attribute Key conforming to the + // "k8s.daemonset.name" semantic conventions. It represents the name of the + // DaemonSet. + // + // Type: string + // RequirementLevel: Recommended + // Stability: Beta + // + // Examples: "opentelemetry" + K8SDaemonSetNameKey = attribute.Key("k8s.daemonset.name") + + // K8SDaemonSetUIDKey is the attribute Key conforming to the "k8s.daemonset.uid" + // semantic conventions. It represents the UID of the DaemonSet. + // + // Type: string + // RequirementLevel: Recommended + // Stability: Beta + // + // Examples: "275ecb36-5aa8-4c2a-9c47-d8bb681b9aff" + K8SDaemonSetUIDKey = attribute.Key("k8s.daemonset.uid") + + // K8SDeploymentNameKey is the attribute Key conforming to the + // "k8s.deployment.name" semantic conventions. It represents the name of the + // Deployment. + // + // Type: string + // RequirementLevel: Recommended + // Stability: Beta + // + // Examples: "opentelemetry" + K8SDeploymentNameKey = attribute.Key("k8s.deployment.name") + + // K8SDeploymentUIDKey is the attribute Key conforming to the + // "k8s.deployment.uid" semantic conventions. It represents the UID of the + // Deployment. + // + // Type: string + // RequirementLevel: Recommended + // Stability: Beta + // + // Examples: "275ecb36-5aa8-4c2a-9c47-d8bb681b9aff" + K8SDeploymentUIDKey = attribute.Key("k8s.deployment.uid") + + // K8SHPAMetricTypeKey is the attribute Key conforming to the + // "k8s.hpa.metric.type" semantic conventions. It represents the type of metric + // source for the horizontal pod autoscaler. + // + // Type: string + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: "Resource", "ContainerResource" + // Note: This attribute reflects the `type` field of spec.metrics[] in the HPA. + K8SHPAMetricTypeKey = attribute.Key("k8s.hpa.metric.type") + + // K8SHPANameKey is the attribute Key conforming to the "k8s.hpa.name" semantic + // conventions. It represents the name of the horizontal pod autoscaler. + // + // Type: string + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: "opentelemetry" + K8SHPANameKey = attribute.Key("k8s.hpa.name") + + // K8SHPAScaletargetrefAPIVersionKey is the attribute Key conforming to the + // "k8s.hpa.scaletargetref.api_version" semantic conventions. It represents the + // API version of the target resource to scale for the HorizontalPodAutoscaler. + // + // Type: string + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: "apps/v1", "autoscaling/v2" + // Note: This maps to the `apiVersion` field in the `scaleTargetRef` of the HPA + // spec. + K8SHPAScaletargetrefAPIVersionKey = attribute.Key("k8s.hpa.scaletargetref.api_version") + + // K8SHPAScaletargetrefKindKey is the attribute Key conforming to the + // "k8s.hpa.scaletargetref.kind" semantic conventions. It represents the kind of + // the target resource to scale for the HorizontalPodAutoscaler. + // + // Type: string + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: "Deployment", "StatefulSet" + // Note: This maps to the `kind` field in the `scaleTargetRef` of the HPA spec. + K8SHPAScaletargetrefKindKey = attribute.Key("k8s.hpa.scaletargetref.kind") + + // K8SHPAScaletargetrefNameKey is the attribute Key conforming to the + // "k8s.hpa.scaletargetref.name" semantic conventions. It represents the name of + // the target resource to scale for the HorizontalPodAutoscaler. + // + // Type: string + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: "my-deployment", "my-statefulset" + // Note: This maps to the `name` field in the `scaleTargetRef` of the HPA spec. + K8SHPAScaletargetrefNameKey = attribute.Key("k8s.hpa.scaletargetref.name") + + // K8SHPAUIDKey is the attribute Key conforming to the "k8s.hpa.uid" semantic + // conventions. It represents the UID of the horizontal pod autoscaler. + // + // Type: string + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: "275ecb36-5aa8-4c2a-9c47-d8bb681b9aff" + K8SHPAUIDKey = attribute.Key("k8s.hpa.uid") + + // K8SHugepageSizeKey is the attribute Key conforming to the "k8s.hugepage.size" + // semantic conventions. It represents the size (identifier) of the K8s huge + // page. + // + // Type: string + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: "2Mi" + K8SHugepageSizeKey = attribute.Key("k8s.hugepage.size") + + // K8SJobNameKey is the attribute Key conforming to the "k8s.job.name" semantic + // conventions. It represents the name of the Job. + // + // Type: string + // RequirementLevel: Recommended + // Stability: Beta + // + // Examples: "opentelemetry" + K8SJobNameKey = attribute.Key("k8s.job.name") + + // K8SJobUIDKey is the attribute Key conforming to the "k8s.job.uid" semantic + // conventions. It represents the UID of the Job. + // + // Type: string + // RequirementLevel: Recommended + // Stability: Beta + // + // Examples: "275ecb36-5aa8-4c2a-9c47-d8bb681b9aff" + K8SJobUIDKey = attribute.Key("k8s.job.uid") + + // K8SNamespaceNameKey is the attribute Key conforming to the + // "k8s.namespace.name" semantic conventions. It represents the name of the + // namespace that the pod is running in. + // + // Type: string + // RequirementLevel: Recommended + // Stability: Beta + // + // Examples: "default" + K8SNamespaceNameKey = attribute.Key("k8s.namespace.name") + + // K8SNamespacePhaseKey is the attribute Key conforming to the + // "k8s.namespace.phase" semantic conventions. It represents the phase of the + // K8s namespace. + // + // Type: Enum + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: "active", "terminating" + // Note: This attribute aligns with the `phase` field of the + // [K8s NamespaceStatus] + // + // [K8s NamespaceStatus]: https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.30/#namespacestatus-v1-core + K8SNamespacePhaseKey = attribute.Key("k8s.namespace.phase") + + // K8SNodeConditionStatusKey is the attribute Key conforming to the + // "k8s.node.condition.status" semantic conventions. It represents the status of + // the condition, one of True, False, Unknown. + // + // Type: Enum + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: "true", "false", "unknown" + // Note: This attribute aligns with the `status` field of the + // [NodeCondition] + // + // [NodeCondition]: https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.30/#nodecondition-v1-core + K8SNodeConditionStatusKey = attribute.Key("k8s.node.condition.status") + + // K8SNodeConditionTypeKey is the attribute Key conforming to the + // "k8s.node.condition.type" semantic conventions. It represents the condition + // type of a K8s Node. + // + // Type: Enum + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: "Ready", "DiskPressure" + // Note: K8s Node conditions as described + // by [K8s documentation]. + // + // This attribute aligns with the `type` field of the + // [NodeCondition] + // + // The set of possible values is not limited to those listed here. Managed + // Kubernetes environments, + // or custom controllers MAY introduce additional node condition types. + // When this occurs, the exact value as reported by the Kubernetes API SHOULD be + // used. + // + // [K8s documentation]: https://v1-32.docs.kubernetes.io/docs/reference/node/node-status/#condition + // [NodeCondition]: https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.30/#nodecondition-v1-core + K8SNodeConditionTypeKey = attribute.Key("k8s.node.condition.type") + + // K8SNodeNameKey is the attribute Key conforming to the "k8s.node.name" + // semantic conventions. It represents the name of the Node. + // + // Type: string + // RequirementLevel: Recommended + // Stability: Beta + // + // Examples: "node-1" + K8SNodeNameKey = attribute.Key("k8s.node.name") + + // K8SNodeUIDKey is the attribute Key conforming to the "k8s.node.uid" semantic + // conventions. It represents the UID of the Node. + // + // Type: string + // RequirementLevel: Recommended + // Stability: Beta + // + // Examples: "1eb3a0c6-0477-4080-a9cb-0cb7db65c6a2" + K8SNodeUIDKey = attribute.Key("k8s.node.uid") + + // K8SPodHostnameKey is the attribute Key conforming to the "k8s.pod.hostname" + // semantic conventions. It represents the specifies the hostname of the Pod. + // + // Type: string + // RequirementLevel: Recommended + // Stability: Beta + // + // Examples: "collector-gateway" + // Note: The K8s Pod spec has an optional hostname field, which can be used to + // specify a hostname. + // Refer to [K8s docs] + // for more information about this field. + // + // This attribute aligns with the `hostname` field of the + // [K8s PodSpec]. + // + // [K8s docs]: https://kubernetes.io/docs/concepts/services-networking/dns-pod-service/#pod-hostname-and-subdomain-field + // [K8s PodSpec]: https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.34/#podspec-v1-core + K8SPodHostnameKey = attribute.Key("k8s.pod.hostname") + + // K8SPodIPKey is the attribute Key conforming to the "k8s.pod.ip" semantic + // conventions. It represents the IP address allocated to the Pod. + // + // Type: string + // RequirementLevel: Recommended + // Stability: Beta + // + // Examples: "172.18.0.2" + // Note: This attribute aligns with the `podIP` field of the + // [K8s PodStatus]. + // + // [K8s PodStatus]: https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.34/#podstatus-v1-core + K8SPodIPKey = attribute.Key("k8s.pod.ip") + + // K8SPodNameKey is the attribute Key conforming to the "k8s.pod.name" semantic + // conventions. It represents the name of the Pod. + // + // Type: string + // RequirementLevel: Recommended + // Stability: Beta + // + // Examples: "opentelemetry-pod-autoconf" + K8SPodNameKey = attribute.Key("k8s.pod.name") + + // K8SPodStartTimeKey is the attribute Key conforming to the + // "k8s.pod.start_time" semantic conventions. It represents the start timestamp + // of the Pod. + // + // Type: string + // RequirementLevel: Recommended + // Stability: Beta + // + // Examples: "2025-12-04T08:41:03Z" + // Note: Date and time at which the object was acknowledged by the Kubelet. + // This is before the Kubelet pulled the container image(s) for the pod. + // + // This attribute aligns with the `startTime` field of the + // [K8s PodStatus], + // in ISO 8601 (RFC 3339 compatible) format. + // + // [K8s PodStatus]: https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.34/#podstatus-v1-core + K8SPodStartTimeKey = attribute.Key("k8s.pod.start_time") + + // K8SPodStatusPhaseKey is the attribute Key conforming to the + // "k8s.pod.status.phase" semantic conventions. It represents the phase for the + // pod. Corresponds to the `phase` field of the: [K8s PodStatus]. + // + // Type: Enum + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: "Pending", "Running" + // + // [K8s PodStatus]: https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.33/#podstatus-v1-core + K8SPodStatusPhaseKey = attribute.Key("k8s.pod.status.phase") + + // K8SPodStatusReasonKey is the attribute Key conforming to the + // "k8s.pod.status.reason" semantic conventions. It represents the reason for + // the pod state. Corresponds to the `reason` field of the: [K8s PodStatus]. + // + // Type: Enum + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: "Evicted", "NodeAffinity" + // + // [K8s PodStatus]: https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.33/#podstatus-v1-core + K8SPodStatusReasonKey = attribute.Key("k8s.pod.status.reason") + + // K8SPodUIDKey is the attribute Key conforming to the "k8s.pod.uid" semantic + // conventions. It represents the UID of the Pod. + // + // Type: string + // RequirementLevel: Recommended + // Stability: Beta + // + // Examples: "275ecb36-5aa8-4c2a-9c47-d8bb681b9aff" + K8SPodUIDKey = attribute.Key("k8s.pod.uid") + + // K8SReplicaSetNameKey is the attribute Key conforming to the + // "k8s.replicaset.name" semantic conventions. It represents the name of the + // ReplicaSet. + // + // Type: string + // RequirementLevel: Recommended + // Stability: Beta + // + // Examples: "opentelemetry" + K8SReplicaSetNameKey = attribute.Key("k8s.replicaset.name") + + // K8SReplicaSetUIDKey is the attribute Key conforming to the + // "k8s.replicaset.uid" semantic conventions. It represents the UID of the + // ReplicaSet. + // + // Type: string + // RequirementLevel: Recommended + // Stability: Beta + // + // Examples: "275ecb36-5aa8-4c2a-9c47-d8bb681b9aff" + K8SReplicaSetUIDKey = attribute.Key("k8s.replicaset.uid") + + // K8SReplicationControllerNameKey is the attribute Key conforming to the + // "k8s.replicationcontroller.name" semantic conventions. It represents the name + // of the replication controller. + // + // Type: string + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: "opentelemetry" + K8SReplicationControllerNameKey = attribute.Key("k8s.replicationcontroller.name") + + // K8SReplicationControllerUIDKey is the attribute Key conforming to the + // "k8s.replicationcontroller.uid" semantic conventions. It represents the UID + // of the replication controller. + // + // Type: string + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: "275ecb36-5aa8-4c2a-9c47-d8bb681b9aff" + K8SReplicationControllerUIDKey = attribute.Key("k8s.replicationcontroller.uid") + + // K8SResourceQuotaNameKey is the attribute Key conforming to the + // "k8s.resourcequota.name" semantic conventions. It represents the name of the + // resource quota. + // + // Type: string + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: "opentelemetry" + K8SResourceQuotaNameKey = attribute.Key("k8s.resourcequota.name") + + // K8SResourceQuotaResourceNameKey is the attribute Key conforming to the + // "k8s.resourcequota.resource_name" semantic conventions. It represents the + // name of the K8s resource a resource quota defines. + // + // Type: string + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: "count/replicationcontrollers" + // Note: The value for this attribute can be either the full + // `count/[.]` string (e.g., count/deployments.apps, + // count/pods), or, for certain core Kubernetes resources, just the resource + // name (e.g., pods, services, configmaps). Both forms are supported by + // Kubernetes for object count quotas. See + // [Kubernetes Resource Quotas documentation] for more details. + // + // [Kubernetes Resource Quotas documentation]: https://kubernetes.io/docs/concepts/policy/resource-quotas/#quota-on-object-count + K8SResourceQuotaResourceNameKey = attribute.Key("k8s.resourcequota.resource_name") + + // K8SResourceQuotaUIDKey is the attribute Key conforming to the + // "k8s.resourcequota.uid" semantic conventions. It represents the UID of the + // resource quota. + // + // Type: string + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: "275ecb36-5aa8-4c2a-9c47-d8bb681b9aff" + K8SResourceQuotaUIDKey = attribute.Key("k8s.resourcequota.uid") + + // K8SServiceEndpointAddressTypeKey is the attribute Key conforming to the + // "k8s.service.endpoint.address_type" semantic conventions. It represents the + // address type of the service endpoint. + // + // Type: Enum + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: "IPv4", "IPv6" + // Note: The network address family or type of the endpoint. + // This attribute aligns with the `addressType` field of the + // [K8s EndpointSlice]. + // It is used to differentiate metrics when a Service is backed by multiple + // address types + // (e.g., in dual-stack clusters). + // + // [K8s EndpointSlice]: https://kubernetes.io/docs/reference/kubernetes-api/service-resources/endpoint-slice-v1/ + K8SServiceEndpointAddressTypeKey = attribute.Key("k8s.service.endpoint.address_type") + + // K8SServiceEndpointConditionKey is the attribute Key conforming to the + // "k8s.service.endpoint.condition" semantic conventions. It represents the + // condition of the service endpoint. + // + // Type: Enum + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: "ready", "serving", "terminating" + // Note: The current operational condition of the service endpoint. + // An endpoint can have multiple conditions set at once (e.g., both `serving` + // and `terminating` during rollout). + // This attribute aligns with the condition fields in the [K8s EndpointSlice]. + // + // [K8s EndpointSlice]: https://kubernetes.io/docs/reference/kubernetes-api/service-resources/endpoint-slice-v1/ + K8SServiceEndpointConditionKey = attribute.Key("k8s.service.endpoint.condition") + + // K8SServiceEndpointZoneKey is the attribute Key conforming to the + // "k8s.service.endpoint.zone" semantic conventions. It represents the zone of + // the service endpoint. + // + // Type: string + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: "us-east-1a", "us-west-2b", "zone-a", "" + // Note: The zone where the endpoint is located, typically corresponding to a + // failure domain. + // This attribute aligns with the `zone` field of endpoints in the + // [K8s EndpointSlice]. + // It enables zone-aware monitoring of service endpoint distribution and + // supports + // features like [Topology Aware Routing]. + // + // If the zone is not populated (e.g., nodes without the + // `topology.kubernetes.io/zone` label), + // the attribute value will be an empty string. + // + // [K8s EndpointSlice]: https://kubernetes.io/docs/reference/kubernetes-api/service-resources/endpoint-slice-v1/ + // [Topology Aware Routing]: https://kubernetes.io/docs/concepts/services-networking/topology-aware-routing/ + K8SServiceEndpointZoneKey = attribute.Key("k8s.service.endpoint.zone") + + // K8SServiceNameKey is the attribute Key conforming to the "k8s.service.name" + // semantic conventions. It represents the name of the Service. + // + // Type: string + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: "my-service" + K8SServiceNameKey = attribute.Key("k8s.service.name") + + // K8SServicePublishNotReadyAddressesKey is the attribute Key conforming to the + // "k8s.service.publish_not_ready_addresses" semantic conventions. It represents + // the whether the Service publishes not-ready endpoints. + // + // Type: boolean + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: true, false + // Note: Whether the Service is configured to publish endpoints before the pods + // are ready. + // This attribute is typically used to indicate that a Service (such as a + // headless + // Service for a StatefulSet) allows peer discovery before pods pass their + // readiness probes. + // It aligns with the `publishNotReadyAddresses` field of the + // [K8s ServiceSpec]. + // + // [K8s ServiceSpec]: https://kubernetes.io/docs/reference/kubernetes-api/service-resources/service-v1/#ServiceSpec + K8SServicePublishNotReadyAddressesKey = attribute.Key("k8s.service.publish_not_ready_addresses") + + // K8SServiceTrafficDistributionKey is the attribute Key conforming to the + // "k8s.service.traffic_distribution" semantic conventions. It represents the + // traffic distribution policy for the Service. + // + // Type: string + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: "PreferSameZone", "PreferSameNode" + // Note: Specifies how traffic is distributed to endpoints for this Service. + // This attribute aligns with the `trafficDistribution` field of the + // [K8s ServiceSpec]. + // Known values include `PreferSameZone` (prefer endpoints in the same zone as + // the client) and + // `PreferSameNode` (prefer endpoints on the same node, fallback to same zone, + // then cluster-wide). + // If this field is not set on the Service, the attribute SHOULD NOT be emitted. + // When not set, Kubernetes distributes traffic evenly across all endpoints + // cluster-wide. + // + // [K8s ServiceSpec]: https://kubernetes.io/docs/reference/networking/virtual-ips/#traffic-distribution + K8SServiceTrafficDistributionKey = attribute.Key("k8s.service.traffic_distribution") + + // K8SServiceTypeKey is the attribute Key conforming to the "k8s.service.type" + // semantic conventions. It represents the type of the Kubernetes Service. + // + // Type: Enum + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: "ClusterIP", "NodePort", "LoadBalancer" + // Note: This attribute aligns with the `type` field of the + // [K8s ServiceSpec]. + // + // [K8s ServiceSpec]: https://kubernetes.io/docs/reference/kubernetes-api/service-resources/service-v1/#ServiceSpec + K8SServiceTypeKey = attribute.Key("k8s.service.type") + + // K8SServiceUIDKey is the attribute Key conforming to the "k8s.service.uid" + // semantic conventions. It represents the UID of the Service. + // + // Type: string + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: "275ecb36-5aa8-4c2a-9c47-d8bb681b9aff" + K8SServiceUIDKey = attribute.Key("k8s.service.uid") + + // K8SStatefulSetNameKey is the attribute Key conforming to the + // "k8s.statefulset.name" semantic conventions. It represents the name of the + // StatefulSet. + // + // Type: string + // RequirementLevel: Recommended + // Stability: Beta + // + // Examples: "opentelemetry" + K8SStatefulSetNameKey = attribute.Key("k8s.statefulset.name") + + // K8SStatefulSetUIDKey is the attribute Key conforming to the + // "k8s.statefulset.uid" semantic conventions. It represents the UID of the + // StatefulSet. + // + // Type: string + // RequirementLevel: Recommended + // Stability: Beta + // + // Examples: "275ecb36-5aa8-4c2a-9c47-d8bb681b9aff" + K8SStatefulSetUIDKey = attribute.Key("k8s.statefulset.uid") + + // K8SStorageclassNameKey is the attribute Key conforming to the + // "k8s.storageclass.name" semantic conventions. It represents the name of K8s + // [StorageClass] object. + // + // Type: string + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: "gold.storageclass.storage.k8s.io" + // + // [StorageClass]: https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.30/#storageclass-v1-storage-k8s-io + K8SStorageclassNameKey = attribute.Key("k8s.storageclass.name") + + // K8SVolumeNameKey is the attribute Key conforming to the "k8s.volume.name" + // semantic conventions. It represents the name of the K8s volume. + // + // Type: string + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: "volume0" + K8SVolumeNameKey = attribute.Key("k8s.volume.name") + + // K8SVolumeTypeKey is the attribute Key conforming to the "k8s.volume.type" + // semantic conventions. It represents the type of the K8s volume. + // + // Type: Enum + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: "emptyDir", "persistentVolumeClaim" + K8SVolumeTypeKey = attribute.Key("k8s.volume.type") +) + +// K8SClusterName returns an attribute KeyValue conforming to the +// "k8s.cluster.name" semantic conventions. It represents the name of the +// cluster. +func K8SClusterName(val string) attribute.KeyValue { + return K8SClusterNameKey.String(val) +} + +// K8SClusterUID returns an attribute KeyValue conforming to the +// "k8s.cluster.uid" semantic conventions. It represents a pseudo-ID for the +// cluster, set to the UID of the `kube-system` namespace. +func K8SClusterUID(val string) attribute.KeyValue { + return K8SClusterUIDKey.String(val) +} + +// K8SContainerName returns an attribute KeyValue conforming to the +// "k8s.container.name" semantic conventions. It represents the name of the +// Container from Pod specification, must be unique within a Pod. Container +// runtime usually uses different globally unique name (`container.name`). +func K8SContainerName(val string) attribute.KeyValue { + return K8SContainerNameKey.String(val) +} + +// K8SContainerRestartCount returns an attribute KeyValue conforming to the +// "k8s.container.restart_count" semantic conventions. It represents the number +// of times the container was restarted. This attribute can be used to identify a +// particular container (running or stopped) within a container spec. +func K8SContainerRestartCount(val int) attribute.KeyValue { + return K8SContainerRestartCountKey.Int(val) +} + +// K8SContainerStatusLastTerminatedReason returns an attribute KeyValue +// conforming to the "k8s.container.status.last_terminated_reason" semantic +// conventions. It represents the last terminated reason of the Container. +func K8SContainerStatusLastTerminatedReason(val string) attribute.KeyValue { + return K8SContainerStatusLastTerminatedReasonKey.String(val) +} + +// K8SCronJobAnnotation returns an attribute KeyValue conforming to the +// "k8s.cronjob.annotation" semantic conventions. It represents the cronjob +// annotation placed on the CronJob, the `` being the annotation name, the +// value being the annotation value. +func K8SCronJobAnnotation(key string, val string) attribute.KeyValue { + return attribute.String("k8s.cronjob.annotation."+key, val) +} + +// K8SCronJobLabel returns an attribute KeyValue conforming to the +// "k8s.cronjob.label" semantic conventions. It represents the label placed on +// the CronJob, the `` being the label name, the value being the label +// value. +func K8SCronJobLabel(key string, val string) attribute.KeyValue { + return attribute.String("k8s.cronjob.label."+key, val) +} + +// K8SCronJobName returns an attribute KeyValue conforming to the +// "k8s.cronjob.name" semantic conventions. It represents the name of the +// CronJob. +func K8SCronJobName(val string) attribute.KeyValue { + return K8SCronJobNameKey.String(val) +} + +// K8SCronJobUID returns an attribute KeyValue conforming to the +// "k8s.cronjob.uid" semantic conventions. It represents the UID of the CronJob. +func K8SCronJobUID(val string) attribute.KeyValue { + return K8SCronJobUIDKey.String(val) +} + +// K8SDaemonSetAnnotation returns an attribute KeyValue conforming to the +// "k8s.daemonset.annotation" semantic conventions. It represents the annotation +// placed on the DaemonSet, the `` being the annotation name, the value +// being the annotation value, even if the value is empty. +func K8SDaemonSetAnnotation(key string, val string) attribute.KeyValue { + return attribute.String("k8s.daemonset.annotation."+key, val) +} + +// K8SDaemonSetLabel returns an attribute KeyValue conforming to the +// "k8s.daemonset.label" semantic conventions. It represents the label placed on +// the DaemonSet, the `` being the label name, the value being the label +// value, even if the value is empty. +func K8SDaemonSetLabel(key string, val string) attribute.KeyValue { + return attribute.String("k8s.daemonset.label."+key, val) +} + +// K8SDaemonSetName returns an attribute KeyValue conforming to the +// "k8s.daemonset.name" semantic conventions. It represents the name of the +// DaemonSet. +func K8SDaemonSetName(val string) attribute.KeyValue { + return K8SDaemonSetNameKey.String(val) +} + +// K8SDaemonSetUID returns an attribute KeyValue conforming to the +// "k8s.daemonset.uid" semantic conventions. It represents the UID of the +// DaemonSet. +func K8SDaemonSetUID(val string) attribute.KeyValue { + return K8SDaemonSetUIDKey.String(val) +} + +// K8SDeploymentAnnotation returns an attribute KeyValue conforming to the +// "k8s.deployment.annotation" semantic conventions. It represents the annotation +// placed on the Deployment, the `` being the annotation name, the value +// being the annotation value, even if the value is empty. +func K8SDeploymentAnnotation(key string, val string) attribute.KeyValue { + return attribute.String("k8s.deployment.annotation."+key, val) +} + +// K8SDeploymentLabel returns an attribute KeyValue conforming to the +// "k8s.deployment.label" semantic conventions. It represents the label placed on +// the Deployment, the `` being the label name, the value being the label +// value, even if the value is empty. +func K8SDeploymentLabel(key string, val string) attribute.KeyValue { + return attribute.String("k8s.deployment.label."+key, val) +} + +// K8SDeploymentName returns an attribute KeyValue conforming to the +// "k8s.deployment.name" semantic conventions. It represents the name of the +// Deployment. +func K8SDeploymentName(val string) attribute.KeyValue { + return K8SDeploymentNameKey.String(val) +} + +// K8SDeploymentUID returns an attribute KeyValue conforming to the +// "k8s.deployment.uid" semantic conventions. It represents the UID of the +// Deployment. +func K8SDeploymentUID(val string) attribute.KeyValue { + return K8SDeploymentUIDKey.String(val) +} + +// K8SHPAMetricType returns an attribute KeyValue conforming to the +// "k8s.hpa.metric.type" semantic conventions. It represents the type of metric +// source for the horizontal pod autoscaler. +func K8SHPAMetricType(val string) attribute.KeyValue { + return K8SHPAMetricTypeKey.String(val) +} + +// K8SHPAName returns an attribute KeyValue conforming to the "k8s.hpa.name" +// semantic conventions. It represents the name of the horizontal pod autoscaler. +func K8SHPAName(val string) attribute.KeyValue { + return K8SHPANameKey.String(val) +} + +// K8SHPAScaletargetrefAPIVersion returns an attribute KeyValue conforming to the +// "k8s.hpa.scaletargetref.api_version" semantic conventions. It represents the +// API version of the target resource to scale for the HorizontalPodAutoscaler. +func K8SHPAScaletargetrefAPIVersion(val string) attribute.KeyValue { + return K8SHPAScaletargetrefAPIVersionKey.String(val) +} + +// K8SHPAScaletargetrefKind returns an attribute KeyValue conforming to the +// "k8s.hpa.scaletargetref.kind" semantic conventions. It represents the kind of +// the target resource to scale for the HorizontalPodAutoscaler. +func K8SHPAScaletargetrefKind(val string) attribute.KeyValue { + return K8SHPAScaletargetrefKindKey.String(val) +} + +// K8SHPAScaletargetrefName returns an attribute KeyValue conforming to the +// "k8s.hpa.scaletargetref.name" semantic conventions. It represents the name of +// the target resource to scale for the HorizontalPodAutoscaler. +func K8SHPAScaletargetrefName(val string) attribute.KeyValue { + return K8SHPAScaletargetrefNameKey.String(val) +} + +// K8SHPAUID returns an attribute KeyValue conforming to the "k8s.hpa.uid" +// semantic conventions. It represents the UID of the horizontal pod autoscaler. +func K8SHPAUID(val string) attribute.KeyValue { + return K8SHPAUIDKey.String(val) +} + +// K8SHugepageSize returns an attribute KeyValue conforming to the +// "k8s.hugepage.size" semantic conventions. It represents the size (identifier) +// of the K8s huge page. +func K8SHugepageSize(val string) attribute.KeyValue { + return K8SHugepageSizeKey.String(val) +} + +// K8SJobAnnotation returns an attribute KeyValue conforming to the +// "k8s.job.annotation" semantic conventions. It represents the annotation placed +// on the Job, the `` being the annotation name, the value being the +// annotation value, even if the value is empty. +func K8SJobAnnotation(key string, val string) attribute.KeyValue { + return attribute.String("k8s.job.annotation."+key, val) +} + +// K8SJobLabel returns an attribute KeyValue conforming to the "k8s.job.label" +// semantic conventions. It represents the label placed on the Job, the `` +// being the label name, the value being the label value, even if the value is +// empty. +func K8SJobLabel(key string, val string) attribute.KeyValue { + return attribute.String("k8s.job.label."+key, val) +} + +// K8SJobName returns an attribute KeyValue conforming to the "k8s.job.name" +// semantic conventions. It represents the name of the Job. +func K8SJobName(val string) attribute.KeyValue { + return K8SJobNameKey.String(val) +} + +// K8SJobUID returns an attribute KeyValue conforming to the "k8s.job.uid" +// semantic conventions. It represents the UID of the Job. +func K8SJobUID(val string) attribute.KeyValue { + return K8SJobUIDKey.String(val) +} + +// K8SNamespaceAnnotation returns an attribute KeyValue conforming to the +// "k8s.namespace.annotation" semantic conventions. It represents the annotation +// placed on the Namespace, the `` being the annotation name, the value +// being the annotation value, even if the value is empty. +func K8SNamespaceAnnotation(key string, val string) attribute.KeyValue { + return attribute.String("k8s.namespace.annotation."+key, val) +} + +// K8SNamespaceLabel returns an attribute KeyValue conforming to the +// "k8s.namespace.label" semantic conventions. It represents the label placed on +// the Namespace, the `` being the label name, the value being the label +// value, even if the value is empty. +func K8SNamespaceLabel(key string, val string) attribute.KeyValue { + return attribute.String("k8s.namespace.label."+key, val) +} + +// K8SNamespaceName returns an attribute KeyValue conforming to the +// "k8s.namespace.name" semantic conventions. It represents the name of the +// namespace that the pod is running in. +func K8SNamespaceName(val string) attribute.KeyValue { + return K8SNamespaceNameKey.String(val) +} + +// K8SNodeAnnotation returns an attribute KeyValue conforming to the +// "k8s.node.annotation" semantic conventions. It represents the annotation +// placed on the Node, the `` being the annotation name, the value being the +// annotation value, even if the value is empty. +func K8SNodeAnnotation(key string, val string) attribute.KeyValue { + return attribute.String("k8s.node.annotation."+key, val) +} + +// K8SNodeLabel returns an attribute KeyValue conforming to the "k8s.node.label" +// semantic conventions. It represents the label placed on the Node, the `` +// being the label name, the value being the label value, even if the value is +// empty. +func K8SNodeLabel(key string, val string) attribute.KeyValue { + return attribute.String("k8s.node.label."+key, val) +} + +// K8SNodeName returns an attribute KeyValue conforming to the "k8s.node.name" +// semantic conventions. It represents the name of the Node. +func K8SNodeName(val string) attribute.KeyValue { + return K8SNodeNameKey.String(val) +} + +// K8SNodeUID returns an attribute KeyValue conforming to the "k8s.node.uid" +// semantic conventions. It represents the UID of the Node. +func K8SNodeUID(val string) attribute.KeyValue { + return K8SNodeUIDKey.String(val) +} + +// K8SPodAnnotation returns an attribute KeyValue conforming to the +// "k8s.pod.annotation" semantic conventions. It represents the annotation placed +// on the Pod, the `` being the annotation name, the value being the +// annotation value. +func K8SPodAnnotation(key string, val string) attribute.KeyValue { + return attribute.String("k8s.pod.annotation."+key, val) +} + +// K8SPodHostname returns an attribute KeyValue conforming to the +// "k8s.pod.hostname" semantic conventions. It represents the specifies the +// hostname of the Pod. +func K8SPodHostname(val string) attribute.KeyValue { + return K8SPodHostnameKey.String(val) +} + +// K8SPodIP returns an attribute KeyValue conforming to the "k8s.pod.ip" semantic +// conventions. It represents the IP address allocated to the Pod. +func K8SPodIP(val string) attribute.KeyValue { + return K8SPodIPKey.String(val) +} + +// K8SPodLabel returns an attribute KeyValue conforming to the "k8s.pod.label" +// semantic conventions. It represents the label placed on the Pod, the `` +// being the label name, the value being the label value. +func K8SPodLabel(key string, val string) attribute.KeyValue { + return attribute.String("k8s.pod.label."+key, val) +} + +// K8SPodName returns an attribute KeyValue conforming to the "k8s.pod.name" +// semantic conventions. It represents the name of the Pod. +func K8SPodName(val string) attribute.KeyValue { + return K8SPodNameKey.String(val) +} + +// K8SPodStartTime returns an attribute KeyValue conforming to the +// "k8s.pod.start_time" semantic conventions. It represents the start timestamp +// of the Pod. +func K8SPodStartTime(val string) attribute.KeyValue { + return K8SPodStartTimeKey.String(val) +} + +// K8SPodUID returns an attribute KeyValue conforming to the "k8s.pod.uid" +// semantic conventions. It represents the UID of the Pod. +func K8SPodUID(val string) attribute.KeyValue { + return K8SPodUIDKey.String(val) +} + +// K8SReplicaSetAnnotation returns an attribute KeyValue conforming to the +// "k8s.replicaset.annotation" semantic conventions. It represents the annotation +// placed on the ReplicaSet, the `` being the annotation name, the value +// being the annotation value, even if the value is empty. +func K8SReplicaSetAnnotation(key string, val string) attribute.KeyValue { + return attribute.String("k8s.replicaset.annotation."+key, val) +} + +// K8SReplicaSetLabel returns an attribute KeyValue conforming to the +// "k8s.replicaset.label" semantic conventions. It represents the label placed on +// the ReplicaSet, the `` being the label name, the value being the label +// value, even if the value is empty. +func K8SReplicaSetLabel(key string, val string) attribute.KeyValue { + return attribute.String("k8s.replicaset.label."+key, val) +} + +// K8SReplicaSetName returns an attribute KeyValue conforming to the +// "k8s.replicaset.name" semantic conventions. It represents the name of the +// ReplicaSet. +func K8SReplicaSetName(val string) attribute.KeyValue { + return K8SReplicaSetNameKey.String(val) +} + +// K8SReplicaSetUID returns an attribute KeyValue conforming to the +// "k8s.replicaset.uid" semantic conventions. It represents the UID of the +// ReplicaSet. +func K8SReplicaSetUID(val string) attribute.KeyValue { + return K8SReplicaSetUIDKey.String(val) +} + +// K8SReplicationControllerName returns an attribute KeyValue conforming to the +// "k8s.replicationcontroller.name" semantic conventions. It represents the name +// of the replication controller. +func K8SReplicationControllerName(val string) attribute.KeyValue { + return K8SReplicationControllerNameKey.String(val) +} + +// K8SReplicationControllerUID returns an attribute KeyValue conforming to the +// "k8s.replicationcontroller.uid" semantic conventions. It represents the UID of +// the replication controller. +func K8SReplicationControllerUID(val string) attribute.KeyValue { + return K8SReplicationControllerUIDKey.String(val) +} + +// K8SResourceQuotaName returns an attribute KeyValue conforming to the +// "k8s.resourcequota.name" semantic conventions. It represents the name of the +// resource quota. +func K8SResourceQuotaName(val string) attribute.KeyValue { + return K8SResourceQuotaNameKey.String(val) +} + +// K8SResourceQuotaResourceName returns an attribute KeyValue conforming to the +// "k8s.resourcequota.resource_name" semantic conventions. It represents the name +// of the K8s resource a resource quota defines. +func K8SResourceQuotaResourceName(val string) attribute.KeyValue { + return K8SResourceQuotaResourceNameKey.String(val) +} + +// K8SResourceQuotaUID returns an attribute KeyValue conforming to the +// "k8s.resourcequota.uid" semantic conventions. It represents the UID of the +// resource quota. +func K8SResourceQuotaUID(val string) attribute.KeyValue { + return K8SResourceQuotaUIDKey.String(val) +} + +// K8SServiceAnnotation returns an attribute KeyValue conforming to the +// "k8s.service.annotation" semantic conventions. It represents the annotation +// placed on the Service, the `` being the annotation name, the value being +// the annotation value, even if the value is empty. +func K8SServiceAnnotation(key string, val string) attribute.KeyValue { + return attribute.String("k8s.service.annotation."+key, val) +} + +// K8SServiceEndpointZone returns an attribute KeyValue conforming to the +// "k8s.service.endpoint.zone" semantic conventions. It represents the zone of +// the service endpoint. +func K8SServiceEndpointZone(val string) attribute.KeyValue { + return K8SServiceEndpointZoneKey.String(val) +} + +// K8SServiceLabel returns an attribute KeyValue conforming to the +// "k8s.service.label" semantic conventions. It represents the label placed on +// the Service, the `` being the label name, the value being the label +// value, even if the value is empty. +func K8SServiceLabel(key string, val string) attribute.KeyValue { + return attribute.String("k8s.service.label."+key, val) +} + +// K8SServiceName returns an attribute KeyValue conforming to the +// "k8s.service.name" semantic conventions. It represents the name of the +// Service. +func K8SServiceName(val string) attribute.KeyValue { + return K8SServiceNameKey.String(val) +} + +// K8SServicePublishNotReadyAddresses returns an attribute KeyValue conforming to +// the "k8s.service.publish_not_ready_addresses" semantic conventions. It +// represents the whether the Service publishes not-ready endpoints. +func K8SServicePublishNotReadyAddresses(val bool) attribute.KeyValue { + return K8SServicePublishNotReadyAddressesKey.Bool(val) +} + +// K8SServiceSelector returns an attribute KeyValue conforming to the +// "k8s.service.selector" semantic conventions. It represents the selector +// key-value pair placed on the Service, the `` being the selector key, the +// value being the selector value. +func K8SServiceSelector(key string, val string) attribute.KeyValue { + return attribute.String("k8s.service.selector."+key, val) +} + +// K8SServiceTrafficDistribution returns an attribute KeyValue conforming to the +// "k8s.service.traffic_distribution" semantic conventions. It represents the +// traffic distribution policy for the Service. +func K8SServiceTrafficDistribution(val string) attribute.KeyValue { + return K8SServiceTrafficDistributionKey.String(val) +} + +// K8SServiceUID returns an attribute KeyValue conforming to the +// "k8s.service.uid" semantic conventions. It represents the UID of the Service. +func K8SServiceUID(val string) attribute.KeyValue { + return K8SServiceUIDKey.String(val) +} + +// K8SStatefulSetAnnotation returns an attribute KeyValue conforming to the +// "k8s.statefulset.annotation" semantic conventions. It represents the +// annotation placed on the StatefulSet, the `` being the annotation name, +// the value being the annotation value, even if the value is empty. +func K8SStatefulSetAnnotation(key string, val string) attribute.KeyValue { + return attribute.String("k8s.statefulset.annotation."+key, val) +} + +// K8SStatefulSetLabel returns an attribute KeyValue conforming to the +// "k8s.statefulset.label" semantic conventions. It represents the label placed +// on the StatefulSet, the `` being the label name, the value being the +// label value, even if the value is empty. +func K8SStatefulSetLabel(key string, val string) attribute.KeyValue { + return attribute.String("k8s.statefulset.label."+key, val) +} + +// K8SStatefulSetName returns an attribute KeyValue conforming to the +// "k8s.statefulset.name" semantic conventions. It represents the name of the +// StatefulSet. +func K8SStatefulSetName(val string) attribute.KeyValue { + return K8SStatefulSetNameKey.String(val) +} + +// K8SStatefulSetUID returns an attribute KeyValue conforming to the +// "k8s.statefulset.uid" semantic conventions. It represents the UID of the +// StatefulSet. +func K8SStatefulSetUID(val string) attribute.KeyValue { + return K8SStatefulSetUIDKey.String(val) +} + +// K8SStorageclassName returns an attribute KeyValue conforming to the +// "k8s.storageclass.name" semantic conventions. It represents the name of K8s +// [StorageClass] object. +// +// [StorageClass]: https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.30/#storageclass-v1-storage-k8s-io +func K8SStorageclassName(val string) attribute.KeyValue { + return K8SStorageclassNameKey.String(val) +} + +// K8SVolumeName returns an attribute KeyValue conforming to the +// "k8s.volume.name" semantic conventions. It represents the name of the K8s +// volume. +func K8SVolumeName(val string) attribute.KeyValue { + return K8SVolumeNameKey.String(val) +} + +// Enum values for k8s.container.status.reason +var ( + // The container is being created. + // Stability: development + K8SContainerStatusReasonContainerCreating = K8SContainerStatusReasonKey.String("ContainerCreating") + // The container is in a crash loop back off state. + // Stability: development + K8SContainerStatusReasonCrashLoopBackOff = K8SContainerStatusReasonKey.String("CrashLoopBackOff") + // There was an error creating the container configuration. + // Stability: development + K8SContainerStatusReasonCreateContainerConfigError = K8SContainerStatusReasonKey.String("CreateContainerConfigError") + // There was an error pulling the container image. + // Stability: development + K8SContainerStatusReasonErrImagePull = K8SContainerStatusReasonKey.String("ErrImagePull") + // The container image pull is in back off state. + // Stability: development + K8SContainerStatusReasonImagePullBackOff = K8SContainerStatusReasonKey.String("ImagePullBackOff") + // The container was killed due to out of memory. + // Stability: development + K8SContainerStatusReasonOomKilled = K8SContainerStatusReasonKey.String("OOMKilled") + // The container has completed execution. + // Stability: development + K8SContainerStatusReasonCompleted = K8SContainerStatusReasonKey.String("Completed") + // There was an error with the container. + // Stability: development + K8SContainerStatusReasonError = K8SContainerStatusReasonKey.String("Error") + // The container cannot run. + // Stability: development + K8SContainerStatusReasonContainerCannotRun = K8SContainerStatusReasonKey.String("ContainerCannotRun") +) + +// Enum values for k8s.container.status.state +var ( + // The container has terminated. + // Stability: development + K8SContainerStatusStateTerminated = K8SContainerStatusStateKey.String("terminated") + // The container is running. + // Stability: development + K8SContainerStatusStateRunning = K8SContainerStatusStateKey.String("running") + // The container is waiting. + // Stability: development + K8SContainerStatusStateWaiting = K8SContainerStatusStateKey.String("waiting") +) + +// Enum values for k8s.namespace.phase +var ( + // Active namespace phase as described by [K8s API] + // Stability: development + // + // [K8s API]: https://pkg.go.dev/k8s.io/api@v0.31.3/core/v1#NamespacePhase + K8SNamespacePhaseActive = K8SNamespacePhaseKey.String("active") + // Terminating namespace phase as described by [K8s API] + // Stability: development + // + // [K8s API]: https://pkg.go.dev/k8s.io/api@v0.31.3/core/v1#NamespacePhase + K8SNamespacePhaseTerminating = K8SNamespacePhaseKey.String("terminating") +) + +// Enum values for k8s.node.condition.status +var ( + // condition_true + // Stability: development + K8SNodeConditionStatusConditionTrue = K8SNodeConditionStatusKey.String("true") + // condition_false + // Stability: development + K8SNodeConditionStatusConditionFalse = K8SNodeConditionStatusKey.String("false") + // condition_unknown + // Stability: development + K8SNodeConditionStatusConditionUnknown = K8SNodeConditionStatusKey.String("unknown") +) + +// Enum values for k8s.node.condition.type +var ( + // The node is healthy and ready to accept pods + // Stability: development + K8SNodeConditionTypeReady = K8SNodeConditionTypeKey.String("Ready") + // Pressure exists on the disk size—that is, if the disk capacity is low + // Stability: development + K8SNodeConditionTypeDiskPressure = K8SNodeConditionTypeKey.String("DiskPressure") + // Pressure exists on the node memory—that is, if the node memory is low + // Stability: development + K8SNodeConditionTypeMemoryPressure = K8SNodeConditionTypeKey.String("MemoryPressure") + // Pressure exists on the processes—that is, if there are too many processes + // on the node + // Stability: development + K8SNodeConditionTypePIDPressure = K8SNodeConditionTypeKey.String("PIDPressure") + // The network for the node is not correctly configured + // Stability: development + K8SNodeConditionTypeNetworkUnavailable = K8SNodeConditionTypeKey.String("NetworkUnavailable") +) + +// Enum values for k8s.pod.status.phase +var ( + // The pod has been accepted by the system, but one or more of the containers + // has not been started. This includes time before being bound to a node, as + // well as time spent pulling images onto the host. + // + // Stability: development + K8SPodStatusPhasePending = K8SPodStatusPhaseKey.String("Pending") + // The pod has been bound to a node and all of the containers have been started. + // At least one container is still running or is in the process of being + // restarted. + // + // Stability: development + K8SPodStatusPhaseRunning = K8SPodStatusPhaseKey.String("Running") + // All containers in the pod have voluntarily terminated with a container exit + // code of 0, and the system is not going to restart any of these containers. + // + // Stability: development + K8SPodStatusPhaseSucceeded = K8SPodStatusPhaseKey.String("Succeeded") + // All containers in the pod have terminated, and at least one container has + // terminated in a failure (exited with a non-zero exit code or was stopped by + // the system). + // + // Stability: development + K8SPodStatusPhaseFailed = K8SPodStatusPhaseKey.String("Failed") + // For some reason the state of the pod could not be obtained, typically due to + // an error in communicating with the host of the pod. + // + // Stability: development + K8SPodStatusPhaseUnknown = K8SPodStatusPhaseKey.String("Unknown") +) + +// Enum values for k8s.pod.status.reason +var ( + // The pod is evicted. + // Stability: development + K8SPodStatusReasonEvicted = K8SPodStatusReasonKey.String("Evicted") + // The pod is in a status because of its node affinity + // Stability: development + K8SPodStatusReasonNodeAffinity = K8SPodStatusReasonKey.String("NodeAffinity") + // The reason on a pod when its state cannot be confirmed as kubelet is + // unresponsive on the node it is (was) running. + // + // Stability: development + K8SPodStatusReasonNodeLost = K8SPodStatusReasonKey.String("NodeLost") + // The node is shutdown + // Stability: development + K8SPodStatusReasonShutdown = K8SPodStatusReasonKey.String("Shutdown") + // The pod was rejected admission to the node because of an error during + // admission that could not be categorized. + // + // Stability: development + K8SPodStatusReasonUnexpectedAdmissionError = K8SPodStatusReasonKey.String("UnexpectedAdmissionError") +) + +// Enum values for k8s.service.endpoint.address_type +var ( + // IPv4 address type + // Stability: development + K8SServiceEndpointAddressTypeIPv4 = K8SServiceEndpointAddressTypeKey.String("IPv4") + // IPv6 address type + // Stability: development + K8SServiceEndpointAddressTypeIPv6 = K8SServiceEndpointAddressTypeKey.String("IPv6") + // FQDN address type + // Stability: development + K8SServiceEndpointAddressTypeFqdn = K8SServiceEndpointAddressTypeKey.String("FQDN") +) + +// Enum values for k8s.service.endpoint.condition +var ( + // The endpoint is ready to receive new connections. + // Stability: development + K8SServiceEndpointConditionReady = K8SServiceEndpointConditionKey.String("ready") + // The endpoint is currently handling traffic. + // Stability: development + K8SServiceEndpointConditionServing = K8SServiceEndpointConditionKey.String("serving") + // The endpoint is in the process of shutting down. + // Stability: development + K8SServiceEndpointConditionTerminating = K8SServiceEndpointConditionKey.String("terminating") +) + +// Enum values for k8s.service.type +var ( + // ClusterIP service type + // Stability: development + K8SServiceTypeClusterIP = K8SServiceTypeKey.String("ClusterIP") + // NodePort service type + // Stability: development + K8SServiceTypeNodePort = K8SServiceTypeKey.String("NodePort") + // LoadBalancer service type + // Stability: development + K8SServiceTypeLoadBalancer = K8SServiceTypeKey.String("LoadBalancer") + // ExternalName service type + // Stability: development + K8SServiceTypeExternalName = K8SServiceTypeKey.String("ExternalName") +) + +// Enum values for k8s.volume.type +var ( + // A [persistentVolumeClaim] volume + // Stability: development + // + // [persistentVolumeClaim]: https://v1-30.docs.kubernetes.io/docs/concepts/storage/volumes/#persistentvolumeclaim + K8SVolumeTypePersistentVolumeClaim = K8SVolumeTypeKey.String("persistentVolumeClaim") + // A [configMap] volume + // Stability: development + // + // [configMap]: https://v1-30.docs.kubernetes.io/docs/concepts/storage/volumes/#configmap + K8SVolumeTypeConfigMap = K8SVolumeTypeKey.String("configMap") + // A [downwardAPI] volume + // Stability: development + // + // [downwardAPI]: https://v1-30.docs.kubernetes.io/docs/concepts/storage/volumes/#downwardapi + K8SVolumeTypeDownwardAPI = K8SVolumeTypeKey.String("downwardAPI") + // An [emptyDir] volume + // Stability: development + // + // [emptyDir]: https://v1-30.docs.kubernetes.io/docs/concepts/storage/volumes/#emptydir + K8SVolumeTypeEmptyDir = K8SVolumeTypeKey.String("emptyDir") + // A [secret] volume + // Stability: development + // + // [secret]: https://v1-30.docs.kubernetes.io/docs/concepts/storage/volumes/#secret + K8SVolumeTypeSecret = K8SVolumeTypeKey.String("secret") + // A [local] volume + // Stability: development + // + // [local]: https://v1-30.docs.kubernetes.io/docs/concepts/storage/volumes/#local + K8SVolumeTypeLocal = K8SVolumeTypeKey.String("local") +) + +// Namespace: log +const ( + // LogFileNameKey is the attribute Key conforming to the "log.file.name" + // semantic conventions. It represents the basename of the file. + // + // Type: string + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: "audit.log" + LogFileNameKey = attribute.Key("log.file.name") + + // LogFileNameResolvedKey is the attribute Key conforming to the + // "log.file.name_resolved" semantic conventions. It represents the basename of + // the file, with symlinks resolved. + // + // Type: string + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: "uuid.log" + LogFileNameResolvedKey = attribute.Key("log.file.name_resolved") + + // LogFilePathKey is the attribute Key conforming to the "log.file.path" + // semantic conventions. It represents the full path to the file. + // + // Type: string + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: "/var/log/mysql/audit.log" + LogFilePathKey = attribute.Key("log.file.path") + + // LogFilePathResolvedKey is the attribute Key conforming to the + // "log.file.path_resolved" semantic conventions. It represents the full path to + // the file, with symlinks resolved. + // + // Type: string + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: "/var/lib/docker/uuid.log" + LogFilePathResolvedKey = attribute.Key("log.file.path_resolved") + + // LogIostreamKey is the attribute Key conforming to the "log.iostream" semantic + // conventions. It represents the stream associated with the log. See below for + // a list of well-known values. + // + // Type: Enum + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: + LogIostreamKey = attribute.Key("log.iostream") + + // LogRecordOriginalKey is the attribute Key conforming to the + // "log.record.original" semantic conventions. It represents the complete + // original Log Record. + // + // Type: string + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: "77 <86>1 2015-08-06T21:58:59.694Z 192.168.2.133 inactive - - - + // Something happened", "[INFO] 8/3/24 12:34:56 Something happened" + // Note: This value MAY be added when processing a Log Record which was + // originally transmitted as a string or equivalent data type AND the Body field + // of the Log Record does not contain the same value. (e.g. a syslog or a log + // record read from a file.) + LogRecordOriginalKey = attribute.Key("log.record.original") + + // LogRecordUIDKey is the attribute Key conforming to the "log.record.uid" + // semantic conventions. It represents a unique identifier for the Log Record. + // + // Type: string + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: "01ARZ3NDEKTSV4RRFFQ69G5FAV" + // Note: If an id is provided, other log records with the same id will be + // considered duplicates and can be removed safely. This means, that two + // distinguishable log records MUST have different values. + // The id MAY be an + // [Universally Unique Lexicographically Sortable Identifier (ULID)], but other + // identifiers (e.g. UUID) may be used as needed. + // + // [Universally Unique Lexicographically Sortable Identifier (ULID)]: https://github.com/ulid/spec + LogRecordUIDKey = attribute.Key("log.record.uid") +) + +// LogFileName returns an attribute KeyValue conforming to the "log.file.name" +// semantic conventions. It represents the basename of the file. +func LogFileName(val string) attribute.KeyValue { + return LogFileNameKey.String(val) +} + +// LogFileNameResolved returns an attribute KeyValue conforming to the +// "log.file.name_resolved" semantic conventions. It represents the basename of +// the file, with symlinks resolved. +func LogFileNameResolved(val string) attribute.KeyValue { + return LogFileNameResolvedKey.String(val) +} + +// LogFilePath returns an attribute KeyValue conforming to the "log.file.path" +// semantic conventions. It represents the full path to the file. +func LogFilePath(val string) attribute.KeyValue { + return LogFilePathKey.String(val) +} + +// LogFilePathResolved returns an attribute KeyValue conforming to the +// "log.file.path_resolved" semantic conventions. It represents the full path to +// the file, with symlinks resolved. +func LogFilePathResolved(val string) attribute.KeyValue { + return LogFilePathResolvedKey.String(val) +} + +// LogRecordOriginal returns an attribute KeyValue conforming to the +// "log.record.original" semantic conventions. It represents the complete +// original Log Record. +func LogRecordOriginal(val string) attribute.KeyValue { + return LogRecordOriginalKey.String(val) +} + +// LogRecordUID returns an attribute KeyValue conforming to the "log.record.uid" +// semantic conventions. It represents a unique identifier for the Log Record. +func LogRecordUID(val string) attribute.KeyValue { + return LogRecordUIDKey.String(val) +} + +// Enum values for log.iostream +var ( + // Logs from stdout stream + // Stability: development + LogIostreamStdout = LogIostreamKey.String("stdout") + // Events from stderr stream + // Stability: development + LogIostreamStderr = LogIostreamKey.String("stderr") +) + +// Namespace: mainframe +const ( + // MainframeLparNameKey is the attribute Key conforming to the + // "mainframe.lpar.name" semantic conventions. It represents the name of the + // logical partition that hosts a systems with a mainframe operating system. + // + // Type: string + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: "LPAR01" + MainframeLparNameKey = attribute.Key("mainframe.lpar.name") +) + +// MainframeLparName returns an attribute KeyValue conforming to the +// "mainframe.lpar.name" semantic conventions. It represents the name of the +// logical partition that hosts a systems with a mainframe operating system. +func MainframeLparName(val string) attribute.KeyValue { + return MainframeLparNameKey.String(val) +} + +// Namespace: mcp +const ( + // McpMethodNameKey is the attribute Key conforming to the "mcp.method.name" + // semantic conventions. It represents the name of the request or notification + // method. + // + // Type: Enum + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: + McpMethodNameKey = attribute.Key("mcp.method.name") + + // McpProtocolVersionKey is the attribute Key conforming to the + // "mcp.protocol.version" semantic conventions. It represents the [version] of + // the Model Context Protocol used. + // + // Type: string + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: "2025-06-18" + // + // [version]: https://modelcontextprotocol.io/specification/versioning + McpProtocolVersionKey = attribute.Key("mcp.protocol.version") + + // McpResourceURIKey is the attribute Key conforming to the "mcp.resource.uri" + // semantic conventions. It represents the value of the resource uri. + // + // Type: string + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: "postgres://database/customers/schema", + // "file:///home/user/documents/report.pdf" + // Note: This is a URI of the resource provided in the following requests or + // notifications: `resources/read`, `resources/subscribe`, + // `resources/unsubscribe`, or `notifications/resources/updated`. + McpResourceURIKey = attribute.Key("mcp.resource.uri") + + // McpSessionIDKey is the attribute Key conforming to the "mcp.session.id" + // semantic conventions. It represents the identifies [MCP session]. + // + // Type: string + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: "191c4850af6c49e08843a3f6c80e5046" + // + // [MCP session]: https://modelcontextprotocol.io/specification/2025-06-18/basic/transports#session-management + McpSessionIDKey = attribute.Key("mcp.session.id") +) + +// McpProtocolVersion returns an attribute KeyValue conforming to the +// "mcp.protocol.version" semantic conventions. It represents the [version] of +// the Model Context Protocol used. +// +// [version]: https://modelcontextprotocol.io/specification/versioning +func McpProtocolVersion(val string) attribute.KeyValue { + return McpProtocolVersionKey.String(val) +} + +// McpResourceURI returns an attribute KeyValue conforming to the +// "mcp.resource.uri" semantic conventions. It represents the value of the +// resource uri. +func McpResourceURI(val string) attribute.KeyValue { + return McpResourceURIKey.String(val) +} + +// McpSessionID returns an attribute KeyValue conforming to the "mcp.session.id" +// semantic conventions. It represents the identifies [MCP session]. +// +// [MCP session]: https://modelcontextprotocol.io/specification/2025-06-18/basic/transports#session-management +func McpSessionID(val string) attribute.KeyValue { + return McpSessionIDKey.String(val) +} + +// Enum values for mcp.method.name +var ( + // Notification cancelling a previously-issued request. + // + // Stability: development + McpMethodNameNotificationsCancelled = McpMethodNameKey.String("notifications/cancelled") + // Request to initialize the MCP client. + // + // Stability: development + McpMethodNameInitialize = McpMethodNameKey.String("initialize") + // Notification indicating that the MCP client has been initialized. + // + // Stability: development + McpMethodNameNotificationsInitialized = McpMethodNameKey.String("notifications/initialized") + // Notification indicating the progress for a long-running operation. + // + // Stability: development + McpMethodNameNotificationsProgress = McpMethodNameKey.String("notifications/progress") + // Request to check that the other party is still alive. + // + // Stability: development + McpMethodNamePing = McpMethodNameKey.String("ping") + // Request to list resources available on server. + // + // Stability: development + McpMethodNameResourcesList = McpMethodNameKey.String("resources/list") + // Request to list resource templates available on server. + // + // Stability: development + McpMethodNameResourcesTemplatesList = McpMethodNameKey.String("resources/templates/list") + // Request to read a resource. + // + // Stability: development + McpMethodNameResourcesRead = McpMethodNameKey.String("resources/read") + // Notification indicating that the list of resources has changed. + // + // Stability: development + McpMethodNameNotificationsResourcesListChanged = McpMethodNameKey.String("notifications/resources/list_changed") + // Request to subscribe to a resource. + // + // Stability: development + McpMethodNameResourcesSubscribe = McpMethodNameKey.String("resources/subscribe") + // Request to unsubscribe from resource updates. + // + // Stability: development + McpMethodNameResourcesUnsubscribe = McpMethodNameKey.String("resources/unsubscribe") + // Notification indicating that a resource has been updated. + // + // Stability: development + McpMethodNameNotificationsResourcesUpdated = McpMethodNameKey.String("notifications/resources/updated") + // Request to list prompts available on server. + // + // Stability: development + McpMethodNamePromptsList = McpMethodNameKey.String("prompts/list") + // Request to get a prompt. + // + // Stability: development + McpMethodNamePromptsGet = McpMethodNameKey.String("prompts/get") + // Notification indicating that the list of prompts has changed. + // + // Stability: development + McpMethodNameNotificationsPromptsListChanged = McpMethodNameKey.String("notifications/prompts/list_changed") + // Request to list tools available on server. + // + // Stability: development + McpMethodNameToolsList = McpMethodNameKey.String("tools/list") + // Request to call a tool. + // + // Stability: development + McpMethodNameToolsCall = McpMethodNameKey.String("tools/call") + // Notification indicating that the list of tools has changed. + // + // Stability: development + McpMethodNameNotificationsToolsListChanged = McpMethodNameKey.String("notifications/tools/list_changed") + // Request to set the logging level. + // + // Stability: development + McpMethodNameLoggingSetLevel = McpMethodNameKey.String("logging/setLevel") + // Notification indicating that a message has been received. + // + // Stability: development + McpMethodNameNotificationsMessage = McpMethodNameKey.String("notifications/message") + // Request to create a sampling message. + // + // Stability: development + McpMethodNameSamplingCreateMessage = McpMethodNameKey.String("sampling/createMessage") + // Request to complete a prompt. + // + // Stability: development + McpMethodNameCompletionComplete = McpMethodNameKey.String("completion/complete") + // Request to list roots available on server. + // + // Stability: development + McpMethodNameRootsList = McpMethodNameKey.String("roots/list") + // Notification indicating that the list of roots has changed. + // + // Stability: development + McpMethodNameNotificationsRootsListChanged = McpMethodNameKey.String("notifications/roots/list_changed") + // Request from the server to elicit additional information from the user via + // the client + // + // Stability: development + McpMethodNameElicitationCreate = McpMethodNameKey.String("elicitation/create") +) + +// Namespace: messaging +const ( + // MessagingBatchMessageCountKey is the attribute Key conforming to the + // "messaging.batch.message_count" semantic conventions. It represents the + // number of messages sent, received, or processed in the scope of the batching + // operation. + // + // Type: int + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: 0, 1, 2 + // Note: Instrumentations SHOULD NOT set `messaging.batch.message_count` on + // spans that operate with a single message. When a messaging client library + // supports both batch and single-message API for the same operation, + // instrumentations SHOULD use `messaging.batch.message_count` for batching APIs + // and SHOULD NOT use it for single-message APIs. + MessagingBatchMessageCountKey = attribute.Key("messaging.batch.message_count") + + // MessagingClientIDKey is the attribute Key conforming to the + // "messaging.client.id" semantic conventions. It represents a unique identifier + // for the client that consumes or produces a message. + // + // Type: string + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: "client-5", "myhost@8742@s8083jm" + MessagingClientIDKey = attribute.Key("messaging.client.id") + + // MessagingConsumerGroupNameKey is the attribute Key conforming to the + // "messaging.consumer.group.name" semantic conventions. It represents the name + // of the consumer group with which a consumer is associated. + // + // Type: string + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: "my-group", "indexer" + // Note: Semantic conventions for individual messaging systems SHOULD document + // whether `messaging.consumer.group.name` is applicable and what it means in + // the context of that system. + MessagingConsumerGroupNameKey = attribute.Key("messaging.consumer.group.name") + + // MessagingDestinationAnonymousKey is the attribute Key conforming to the + // "messaging.destination.anonymous" semantic conventions. It represents a + // boolean that is true if the message destination is anonymous (could be + // unnamed or have auto-generated name). + // + // Type: boolean + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: + MessagingDestinationAnonymousKey = attribute.Key("messaging.destination.anonymous") + + // MessagingDestinationNameKey is the attribute Key conforming to the + // "messaging.destination.name" semantic conventions. It represents the message + // destination name. + // + // Type: string + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: "MyQueue", "MyTopic" + // Note: Destination name SHOULD uniquely identify a specific queue, topic or + // other entity within the broker. If + // the broker doesn't have such notion, the destination name SHOULD uniquely + // identify the broker. + MessagingDestinationNameKey = attribute.Key("messaging.destination.name") + + // MessagingDestinationPartitionIDKey is the attribute Key conforming to the + // "messaging.destination.partition.id" semantic conventions. It represents the + // identifier of the partition messages are sent to or received from, unique + // within the `messaging.destination.name`. + // + // Type: string + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: 1 + MessagingDestinationPartitionIDKey = attribute.Key("messaging.destination.partition.id") + + // MessagingDestinationSubscriptionNameKey is the attribute Key conforming to + // the "messaging.destination.subscription.name" semantic conventions. It + // represents the name of the destination subscription from which a message is + // consumed. + // + // Type: string + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: "subscription-a" + // Note: Semantic conventions for individual messaging systems SHOULD document + // whether `messaging.destination.subscription.name` is applicable and what it + // means in the context of that system. + MessagingDestinationSubscriptionNameKey = attribute.Key("messaging.destination.subscription.name") + + // MessagingDestinationTemplateKey is the attribute Key conforming to the + // "messaging.destination.template" semantic conventions. It represents the low + // cardinality representation of the messaging destination name. + // + // Type: string + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: "/customers/{customerId}" + // Note: Destination names could be constructed from templates. An example would + // be a destination name involving a user name or product id. Although the + // destination name in this case is of high cardinality, the underlying template + // is of low cardinality and can be effectively used for grouping and + // aggregation. + MessagingDestinationTemplateKey = attribute.Key("messaging.destination.template") + + // MessagingDestinationTemporaryKey is the attribute Key conforming to the + // "messaging.destination.temporary" semantic conventions. It represents a + // boolean that is true if the message destination is temporary and might not + // exist anymore after messages are processed. + // + // Type: boolean + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: + MessagingDestinationTemporaryKey = attribute.Key("messaging.destination.temporary") + + // MessagingEventHubsMessageEnqueuedTimeKey is the attribute Key conforming to + // the "messaging.eventhubs.message.enqueued_time" semantic conventions. It + // represents the UTC epoch seconds at which the message has been accepted and + // stored in the entity. + // + // Type: int + // RequirementLevel: Recommended + // Stability: Development + MessagingEventHubsMessageEnqueuedTimeKey = attribute.Key("messaging.eventhubs.message.enqueued_time") + + // MessagingGCPPubSubMessageAckDeadlineKey is the attribute Key conforming to + // the "messaging.gcp_pubsub.message.ack_deadline" semantic conventions. It + // represents the ack deadline in seconds set for the modify ack deadline + // request. + // + // Type: int + // RequirementLevel: Recommended + // Stability: Development + MessagingGCPPubSubMessageAckDeadlineKey = attribute.Key("messaging.gcp_pubsub.message.ack_deadline") + + // MessagingGCPPubSubMessageAckIDKey is the attribute Key conforming to the + // "messaging.gcp_pubsub.message.ack_id" semantic conventions. It represents the + // ack id for a given message. + // + // Type: string + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: ack_id + MessagingGCPPubSubMessageAckIDKey = attribute.Key("messaging.gcp_pubsub.message.ack_id") + + // MessagingGCPPubSubMessageDeliveryAttemptKey is the attribute Key conforming + // to the "messaging.gcp_pubsub.message.delivery_attempt" semantic conventions. + // It represents the delivery attempt for a given message. + // + // Type: int + // RequirementLevel: Recommended + // Stability: Development + MessagingGCPPubSubMessageDeliveryAttemptKey = attribute.Key("messaging.gcp_pubsub.message.delivery_attempt") + + // MessagingGCPPubSubMessageOrderingKeyKey is the attribute Key conforming to + // the "messaging.gcp_pubsub.message.ordering_key" semantic conventions. It + // represents the ordering key for a given message. If the attribute is not + // present, the message does not have an ordering key. + // + // Type: string + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: ordering_key + MessagingGCPPubSubMessageOrderingKeyKey = attribute.Key("messaging.gcp_pubsub.message.ordering_key") + + // MessagingKafkaMessageKeyKey is the attribute Key conforming to the + // "messaging.kafka.message.key" semantic conventions. It represents the message + // keys in Kafka are used for grouping alike messages to ensure they're + // processed on the same partition. They differ from `messaging.message.id` in + // that they're not unique. If the key is `null`, the attribute MUST NOT be set. + // + // Type: string + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: myKey + // Note: If the key type is not string, it's string representation has to be + // supplied for the attribute. If the key has no unambiguous, canonical string + // form, don't include its value. + MessagingKafkaMessageKeyKey = attribute.Key("messaging.kafka.message.key") + + // MessagingKafkaMessageTombstoneKey is the attribute Key conforming to the + // "messaging.kafka.message.tombstone" semantic conventions. It represents a + // boolean that is true if the message is a tombstone. + // + // Type: boolean + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: + MessagingKafkaMessageTombstoneKey = attribute.Key("messaging.kafka.message.tombstone") + + // MessagingKafkaOffsetKey is the attribute Key conforming to the + // "messaging.kafka.offset" semantic conventions. It represents the offset of a + // record in the corresponding Kafka partition. + // + // Type: int + // RequirementLevel: Recommended + // Stability: Development + MessagingKafkaOffsetKey = attribute.Key("messaging.kafka.offset") + + // MessagingMessageBodySizeKey is the attribute Key conforming to the + // "messaging.message.body.size" semantic conventions. It represents the size of + // the message body in bytes. + // + // Type: int + // RequirementLevel: Recommended + // Stability: Development + // + // Note: This can refer to both the compressed or uncompressed body size. If + // both sizes are known, the uncompressed + // body size should be used. + MessagingMessageBodySizeKey = attribute.Key("messaging.message.body.size") + + // MessagingMessageConversationIDKey is the attribute Key conforming to the + // "messaging.message.conversation_id" semantic conventions. It represents the + // conversation ID identifying the conversation to which the message belongs, + // represented as a string. Sometimes called "Correlation ID". + // + // Type: string + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: MyConversationId + MessagingMessageConversationIDKey = attribute.Key("messaging.message.conversation_id") + + // MessagingMessageEnvelopeSizeKey is the attribute Key conforming to the + // "messaging.message.envelope.size" semantic conventions. It represents the + // size of the message body and metadata in bytes. + // + // Type: int + // RequirementLevel: Recommended + // Stability: Development + // + // Note: This can refer to both the compressed or uncompressed size. If both + // sizes are known, the uncompressed + // size should be used. + MessagingMessageEnvelopeSizeKey = attribute.Key("messaging.message.envelope.size") + + // MessagingMessageIDKey is the attribute Key conforming to the + // "messaging.message.id" semantic conventions. It represents a value used by + // the messaging system as an identifier for the message, represented as a + // string. + // + // Type: string + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: 452a7c7c7c7048c2f887f61572b18fc2 + MessagingMessageIDKey = attribute.Key("messaging.message.id") + + // MessagingOperationNameKey is the attribute Key conforming to the + // "messaging.operation.name" semantic conventions. It represents the + // system-specific name of the messaging operation. + // + // Type: string + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: "ack", "nack", "send" + MessagingOperationNameKey = attribute.Key("messaging.operation.name") + + // MessagingOperationTypeKey is the attribute Key conforming to the + // "messaging.operation.type" semantic conventions. It represents a string + // identifying the type of the messaging operation. + // + // Type: Enum + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: + // Note: If a custom value is used, it MUST be of low cardinality. + MessagingOperationTypeKey = attribute.Key("messaging.operation.type") + + // MessagingRabbitMQDestinationRoutingKeyKey is the attribute Key conforming to + // the "messaging.rabbitmq.destination.routing_key" semantic conventions. It + // represents the rabbitMQ message routing key. + // + // Type: string + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: myKey + MessagingRabbitMQDestinationRoutingKeyKey = attribute.Key("messaging.rabbitmq.destination.routing_key") + + // MessagingRabbitMQMessageDeliveryTagKey is the attribute Key conforming to the + // "messaging.rabbitmq.message.delivery_tag" semantic conventions. It represents + // the rabbitMQ message delivery tag. + // + // Type: int + // RequirementLevel: Recommended + // Stability: Development + MessagingRabbitMQMessageDeliveryTagKey = attribute.Key("messaging.rabbitmq.message.delivery_tag") + + // MessagingRocketMQConsumptionModelKey is the attribute Key conforming to the + // "messaging.rocketmq.consumption_model" semantic conventions. It represents + // the model of message consumption. This only applies to consumer spans. + // + // Type: Enum + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: + MessagingRocketMQConsumptionModelKey = attribute.Key("messaging.rocketmq.consumption_model") + + // MessagingRocketMQMessageDelayTimeLevelKey is the attribute Key conforming to + // the "messaging.rocketmq.message.delay_time_level" semantic conventions. It + // represents the delay time level for delay message, which determines the + // message delay time. + // + // Type: int + // RequirementLevel: Recommended + // Stability: Development + MessagingRocketMQMessageDelayTimeLevelKey = attribute.Key("messaging.rocketmq.message.delay_time_level") + + // MessagingRocketMQMessageDeliveryTimestampKey is the attribute Key conforming + // to the "messaging.rocketmq.message.delivery_timestamp" semantic conventions. + // It represents the timestamp in milliseconds that the delay message is + // expected to be delivered to consumer. + // + // Type: int + // RequirementLevel: Recommended + // Stability: Development + MessagingRocketMQMessageDeliveryTimestampKey = attribute.Key("messaging.rocketmq.message.delivery_timestamp") + + // MessagingRocketMQMessageGroupKey is the attribute Key conforming to the + // "messaging.rocketmq.message.group" semantic conventions. It represents the it + // is essential for FIFO message. Messages that belong to the same message group + // are always processed one by one within the same consumer group. + // + // Type: string + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: myMessageGroup + MessagingRocketMQMessageGroupKey = attribute.Key("messaging.rocketmq.message.group") + + // MessagingRocketMQMessageKeysKey is the attribute Key conforming to the + // "messaging.rocketmq.message.keys" semantic conventions. It represents the + // key(s) of message, another way to mark message besides message id. + // + // Type: string[] + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: "keyA", "keyB" + MessagingRocketMQMessageKeysKey = attribute.Key("messaging.rocketmq.message.keys") + + // MessagingRocketMQMessageTagKey is the attribute Key conforming to the + // "messaging.rocketmq.message.tag" semantic conventions. It represents the + // secondary classifier of message besides topic. + // + // Type: string + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: tagA + MessagingRocketMQMessageTagKey = attribute.Key("messaging.rocketmq.message.tag") + + // MessagingRocketMQMessageTypeKey is the attribute Key conforming to the + // "messaging.rocketmq.message.type" semantic conventions. It represents the + // type of message. + // + // Type: Enum + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: + MessagingRocketMQMessageTypeKey = attribute.Key("messaging.rocketmq.message.type") + + // MessagingRocketMQNamespaceKey is the attribute Key conforming to the + // "messaging.rocketmq.namespace" semantic conventions. It represents the + // namespace of RocketMQ resources, resources in different namespaces are + // individual. + // + // Type: string + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: myNamespace + MessagingRocketMQNamespaceKey = attribute.Key("messaging.rocketmq.namespace") + + // MessagingServiceBusDispositionStatusKey is the attribute Key conforming to + // the "messaging.servicebus.disposition_status" semantic conventions. It + // represents the describes the [settlement type]. + // + // Type: Enum + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: + // + // [settlement type]: https://learn.microsoft.com/azure/service-bus-messaging/message-transfers-locks-settlement#peeklock + MessagingServiceBusDispositionStatusKey = attribute.Key("messaging.servicebus.disposition_status") + + // MessagingServiceBusMessageDeliveryCountKey is the attribute Key conforming to + // the "messaging.servicebus.message.delivery_count" semantic conventions. It + // represents the number of deliveries that have been attempted for this + // message. + // + // Type: int + // RequirementLevel: Recommended + // Stability: Development + MessagingServiceBusMessageDeliveryCountKey = attribute.Key("messaging.servicebus.message.delivery_count") + + // MessagingServiceBusMessageEnqueuedTimeKey is the attribute Key conforming to + // the "messaging.servicebus.message.enqueued_time" semantic conventions. It + // represents the UTC epoch seconds at which the message has been accepted and + // stored in the entity. + // + // Type: int + // RequirementLevel: Recommended + // Stability: Development + MessagingServiceBusMessageEnqueuedTimeKey = attribute.Key("messaging.servicebus.message.enqueued_time") + + // MessagingSystemKey is the attribute Key conforming to the "messaging.system" + // semantic conventions. It represents the messaging system as identified by the + // client instrumentation. + // + // Type: Enum + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: + // Note: The actual messaging system may differ from the one known by the + // client. For example, when using Kafka client libraries to communicate with + // Azure Event Hubs, the `messaging.system` is set to `kafka` based on the + // instrumentation's best knowledge. + MessagingSystemKey = attribute.Key("messaging.system") +) + +// MessagingBatchMessageCount returns an attribute KeyValue conforming to the +// "messaging.batch.message_count" semantic conventions. It represents the number +// of messages sent, received, or processed in the scope of the batching +// operation. +func MessagingBatchMessageCount(val int) attribute.KeyValue { + return MessagingBatchMessageCountKey.Int(val) +} + +// MessagingClientID returns an attribute KeyValue conforming to the +// "messaging.client.id" semantic conventions. It represents a unique identifier +// for the client that consumes or produces a message. +func MessagingClientID(val string) attribute.KeyValue { + return MessagingClientIDKey.String(val) +} + +// MessagingConsumerGroupName returns an attribute KeyValue conforming to the +// "messaging.consumer.group.name" semantic conventions. It represents the name +// of the consumer group with which a consumer is associated. +func MessagingConsumerGroupName(val string) attribute.KeyValue { + return MessagingConsumerGroupNameKey.String(val) +} + +// MessagingDestinationAnonymous returns an attribute KeyValue conforming to the +// "messaging.destination.anonymous" semantic conventions. It represents a +// boolean that is true if the message destination is anonymous (could be unnamed +// or have auto-generated name). +func MessagingDestinationAnonymous(val bool) attribute.KeyValue { + return MessagingDestinationAnonymousKey.Bool(val) +} + +// MessagingDestinationName returns an attribute KeyValue conforming to the +// "messaging.destination.name" semantic conventions. It represents the message +// destination name. +func MessagingDestinationName(val string) attribute.KeyValue { + return MessagingDestinationNameKey.String(val) +} + +// MessagingDestinationPartitionID returns an attribute KeyValue conforming to +// the "messaging.destination.partition.id" semantic conventions. It represents +// the identifier of the partition messages are sent to or received from, unique +// within the `messaging.destination.name`. +func MessagingDestinationPartitionID(val string) attribute.KeyValue { + return MessagingDestinationPartitionIDKey.String(val) +} + +// MessagingDestinationSubscriptionName returns an attribute KeyValue conforming +// to the "messaging.destination.subscription.name" semantic conventions. It +// represents the name of the destination subscription from which a message is +// consumed. +func MessagingDestinationSubscriptionName(val string) attribute.KeyValue { + return MessagingDestinationSubscriptionNameKey.String(val) +} + +// MessagingDestinationTemplate returns an attribute KeyValue conforming to the +// "messaging.destination.template" semantic conventions. It represents the low +// cardinality representation of the messaging destination name. +func MessagingDestinationTemplate(val string) attribute.KeyValue { + return MessagingDestinationTemplateKey.String(val) +} + +// MessagingDestinationTemporary returns an attribute KeyValue conforming to the +// "messaging.destination.temporary" semantic conventions. It represents a +// boolean that is true if the message destination is temporary and might not +// exist anymore after messages are processed. +func MessagingDestinationTemporary(val bool) attribute.KeyValue { + return MessagingDestinationTemporaryKey.Bool(val) +} + +// MessagingEventHubsMessageEnqueuedTime returns an attribute KeyValue conforming +// to the "messaging.eventhubs.message.enqueued_time" semantic conventions. It +// represents the UTC epoch seconds at which the message has been accepted and +// stored in the entity. +func MessagingEventHubsMessageEnqueuedTime(val int) attribute.KeyValue { + return MessagingEventHubsMessageEnqueuedTimeKey.Int(val) +} + +// MessagingGCPPubSubMessageAckDeadline returns an attribute KeyValue conforming +// to the "messaging.gcp_pubsub.message.ack_deadline" semantic conventions. It +// represents the ack deadline in seconds set for the modify ack deadline +// request. +func MessagingGCPPubSubMessageAckDeadline(val int) attribute.KeyValue { + return MessagingGCPPubSubMessageAckDeadlineKey.Int(val) +} + +// MessagingGCPPubSubMessageAckID returns an attribute KeyValue conforming to the +// "messaging.gcp_pubsub.message.ack_id" semantic conventions. It represents the +// ack id for a given message. +func MessagingGCPPubSubMessageAckID(val string) attribute.KeyValue { + return MessagingGCPPubSubMessageAckIDKey.String(val) +} + +// MessagingGCPPubSubMessageDeliveryAttempt returns an attribute KeyValue +// conforming to the "messaging.gcp_pubsub.message.delivery_attempt" semantic +// conventions. It represents the delivery attempt for a given message. +func MessagingGCPPubSubMessageDeliveryAttempt(val int) attribute.KeyValue { + return MessagingGCPPubSubMessageDeliveryAttemptKey.Int(val) +} + +// MessagingGCPPubSubMessageOrderingKey returns an attribute KeyValue conforming +// to the "messaging.gcp_pubsub.message.ordering_key" semantic conventions. It +// represents the ordering key for a given message. If the attribute is not +// present, the message does not have an ordering key. +func MessagingGCPPubSubMessageOrderingKey(val string) attribute.KeyValue { + return MessagingGCPPubSubMessageOrderingKeyKey.String(val) +} + +// MessagingKafkaMessageKey returns an attribute KeyValue conforming to the +// "messaging.kafka.message.key" semantic conventions. It represents the message +// keys in Kafka are used for grouping alike messages to ensure they're processed +// on the same partition. They differ from `messaging.message.id` in that they're +// not unique. If the key is `null`, the attribute MUST NOT be set. +func MessagingKafkaMessageKey(val string) attribute.KeyValue { + return MessagingKafkaMessageKeyKey.String(val) +} + +// MessagingKafkaMessageTombstone returns an attribute KeyValue conforming to the +// "messaging.kafka.message.tombstone" semantic conventions. It represents a +// boolean that is true if the message is a tombstone. +func MessagingKafkaMessageTombstone(val bool) attribute.KeyValue { + return MessagingKafkaMessageTombstoneKey.Bool(val) +} + +// MessagingKafkaOffset returns an attribute KeyValue conforming to the +// "messaging.kafka.offset" semantic conventions. It represents the offset of a +// record in the corresponding Kafka partition. +func MessagingKafkaOffset(val int) attribute.KeyValue { + return MessagingKafkaOffsetKey.Int(val) +} + +// MessagingMessageBodySize returns an attribute KeyValue conforming to the +// "messaging.message.body.size" semantic conventions. It represents the size of +// the message body in bytes. +func MessagingMessageBodySize(val int) attribute.KeyValue { + return MessagingMessageBodySizeKey.Int(val) +} + +// MessagingMessageConversationID returns an attribute KeyValue conforming to the +// "messaging.message.conversation_id" semantic conventions. It represents the +// conversation ID identifying the conversation to which the message belongs, +// represented as a string. Sometimes called "Correlation ID". +func MessagingMessageConversationID(val string) attribute.KeyValue { + return MessagingMessageConversationIDKey.String(val) +} + +// MessagingMessageEnvelopeSize returns an attribute KeyValue conforming to the +// "messaging.message.envelope.size" semantic conventions. It represents the size +// of the message body and metadata in bytes. +func MessagingMessageEnvelopeSize(val int) attribute.KeyValue { + return MessagingMessageEnvelopeSizeKey.Int(val) +} + +// MessagingMessageID returns an attribute KeyValue conforming to the +// "messaging.message.id" semantic conventions. It represents a value used by the +// messaging system as an identifier for the message, represented as a string. +func MessagingMessageID(val string) attribute.KeyValue { + return MessagingMessageIDKey.String(val) +} + +// MessagingOperationName returns an attribute KeyValue conforming to the +// "messaging.operation.name" semantic conventions. It represents the +// system-specific name of the messaging operation. +func MessagingOperationName(val string) attribute.KeyValue { + return MessagingOperationNameKey.String(val) +} + +// MessagingRabbitMQDestinationRoutingKey returns an attribute KeyValue +// conforming to the "messaging.rabbitmq.destination.routing_key" semantic +// conventions. It represents the rabbitMQ message routing key. +func MessagingRabbitMQDestinationRoutingKey(val string) attribute.KeyValue { + return MessagingRabbitMQDestinationRoutingKeyKey.String(val) +} + +// MessagingRabbitMQMessageDeliveryTag returns an attribute KeyValue conforming +// to the "messaging.rabbitmq.message.delivery_tag" semantic conventions. It +// represents the rabbitMQ message delivery tag. +func MessagingRabbitMQMessageDeliveryTag(val int) attribute.KeyValue { + return MessagingRabbitMQMessageDeliveryTagKey.Int(val) +} + +// MessagingRocketMQMessageDelayTimeLevel returns an attribute KeyValue +// conforming to the "messaging.rocketmq.message.delay_time_level" semantic +// conventions. It represents the delay time level for delay message, which +// determines the message delay time. +func MessagingRocketMQMessageDelayTimeLevel(val int) attribute.KeyValue { + return MessagingRocketMQMessageDelayTimeLevelKey.Int(val) +} + +// MessagingRocketMQMessageDeliveryTimestamp returns an attribute KeyValue +// conforming to the "messaging.rocketmq.message.delivery_timestamp" semantic +// conventions. It represents the timestamp in milliseconds that the delay +// message is expected to be delivered to consumer. +func MessagingRocketMQMessageDeliveryTimestamp(val int) attribute.KeyValue { + return MessagingRocketMQMessageDeliveryTimestampKey.Int(val) +} + +// MessagingRocketMQMessageGroup returns an attribute KeyValue conforming to the +// "messaging.rocketmq.message.group" semantic conventions. It represents the it +// is essential for FIFO message. Messages that belong to the same message group +// are always processed one by one within the same consumer group. +func MessagingRocketMQMessageGroup(val string) attribute.KeyValue { + return MessagingRocketMQMessageGroupKey.String(val) +} + +// MessagingRocketMQMessageKeys returns an attribute KeyValue conforming to the +// "messaging.rocketmq.message.keys" semantic conventions. It represents the +// key(s) of message, another way to mark message besides message id. +func MessagingRocketMQMessageKeys(val ...string) attribute.KeyValue { + return MessagingRocketMQMessageKeysKey.StringSlice(val) +} + +// MessagingRocketMQMessageTag returns an attribute KeyValue conforming to the +// "messaging.rocketmq.message.tag" semantic conventions. It represents the +// secondary classifier of message besides topic. +func MessagingRocketMQMessageTag(val string) attribute.KeyValue { + return MessagingRocketMQMessageTagKey.String(val) +} + +// MessagingRocketMQNamespace returns an attribute KeyValue conforming to the +// "messaging.rocketmq.namespace" semantic conventions. It represents the +// namespace of RocketMQ resources, resources in different namespaces are +// individual. +func MessagingRocketMQNamespace(val string) attribute.KeyValue { + return MessagingRocketMQNamespaceKey.String(val) +} + +// MessagingServiceBusMessageDeliveryCount returns an attribute KeyValue +// conforming to the "messaging.servicebus.message.delivery_count" semantic +// conventions. It represents the number of deliveries that have been attempted +// for this message. +func MessagingServiceBusMessageDeliveryCount(val int) attribute.KeyValue { + return MessagingServiceBusMessageDeliveryCountKey.Int(val) +} + +// MessagingServiceBusMessageEnqueuedTime returns an attribute KeyValue +// conforming to the "messaging.servicebus.message.enqueued_time" semantic +// conventions. It represents the UTC epoch seconds at which the message has been +// accepted and stored in the entity. +func MessagingServiceBusMessageEnqueuedTime(val int) attribute.KeyValue { + return MessagingServiceBusMessageEnqueuedTimeKey.Int(val) +} + +// Enum values for messaging.operation.type +var ( + // A message is created. "Create" spans always refer to a single message and are + // used to provide a unique creation context for messages in batch sending + // scenarios. + // + // Stability: development + MessagingOperationTypeCreate = MessagingOperationTypeKey.String("create") + // One or more messages are provided for sending to an intermediary. If a single + // message is sent, the context of the "Send" span can be used as the creation + // context and no "Create" span needs to be created. + // + // Stability: development + MessagingOperationTypeSend = MessagingOperationTypeKey.String("send") + // One or more messages are requested by a consumer. This operation refers to + // pull-based scenarios, where consumers explicitly call methods of messaging + // SDKs to receive messages. + // + // Stability: development + MessagingOperationTypeReceive = MessagingOperationTypeKey.String("receive") + // One or more messages are processed by a consumer. + // + // Stability: development + MessagingOperationTypeProcess = MessagingOperationTypeKey.String("process") + // One or more messages are settled. + // + // Stability: development + MessagingOperationTypeSettle = MessagingOperationTypeKey.String("settle") +) + +// Enum values for messaging.rocketmq.consumption_model +var ( + // Clustering consumption model + // Stability: development + MessagingRocketMQConsumptionModelClustering = MessagingRocketMQConsumptionModelKey.String("clustering") + // Broadcasting consumption model + // Stability: development + MessagingRocketMQConsumptionModelBroadcasting = MessagingRocketMQConsumptionModelKey.String("broadcasting") +) + +// Enum values for messaging.rocketmq.message.type +var ( + // Normal message + // Stability: development + MessagingRocketMQMessageTypeNormal = MessagingRocketMQMessageTypeKey.String("normal") + // FIFO message + // Stability: development + MessagingRocketMQMessageTypeFifo = MessagingRocketMQMessageTypeKey.String("fifo") + // Delay message + // Stability: development + MessagingRocketMQMessageTypeDelay = MessagingRocketMQMessageTypeKey.String("delay") + // Transaction message + // Stability: development + MessagingRocketMQMessageTypeTransaction = MessagingRocketMQMessageTypeKey.String("transaction") +) + +// Enum values for messaging.servicebus.disposition_status +var ( + // Message is completed + // Stability: development + MessagingServiceBusDispositionStatusComplete = MessagingServiceBusDispositionStatusKey.String("complete") + // Message is abandoned + // Stability: development + MessagingServiceBusDispositionStatusAbandon = MessagingServiceBusDispositionStatusKey.String("abandon") + // Message is sent to dead letter queue + // Stability: development + MessagingServiceBusDispositionStatusDeadLetter = MessagingServiceBusDispositionStatusKey.String("dead_letter") + // Message is deferred + // Stability: development + MessagingServiceBusDispositionStatusDefer = MessagingServiceBusDispositionStatusKey.String("defer") +) + +// Enum values for messaging.system +var ( + // Apache ActiveMQ + // Stability: development + MessagingSystemActiveMQ = MessagingSystemKey.String("activemq") + // Amazon Simple Notification Service (SNS) + // Stability: development + MessagingSystemAWSSNS = MessagingSystemKey.String("aws.sns") + // Amazon Simple Queue Service (SQS) + // Stability: development + MessagingSystemAWSSQS = MessagingSystemKey.String("aws_sqs") + // Azure Event Grid + // Stability: development + MessagingSystemEventGrid = MessagingSystemKey.String("eventgrid") + // Azure Event Hubs + // Stability: development + MessagingSystemEventHubs = MessagingSystemKey.String("eventhubs") + // Azure Service Bus + // Stability: development + MessagingSystemServiceBus = MessagingSystemKey.String("servicebus") + // Google Cloud Pub/Sub + // Stability: development + MessagingSystemGCPPubSub = MessagingSystemKey.String("gcp_pubsub") + // Java Message Service + // Stability: development + MessagingSystemJMS = MessagingSystemKey.String("jms") + // Apache Kafka + // Stability: development + MessagingSystemKafka = MessagingSystemKey.String("kafka") + // RabbitMQ + // Stability: development + MessagingSystemRabbitMQ = MessagingSystemKey.String("rabbitmq") + // Apache RocketMQ + // Stability: development + MessagingSystemRocketMQ = MessagingSystemKey.String("rocketmq") + // Apache Pulsar + // Stability: development + MessagingSystemPulsar = MessagingSystemKey.String("pulsar") +) + +// Namespace: network +const ( + // NetworkCarrierICCKey is the attribute Key conforming to the + // "network.carrier.icc" semantic conventions. It represents the ISO 3166-1 + // alpha-2 2-character country code associated with the mobile carrier network. + // + // Type: string + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: DE + NetworkCarrierICCKey = attribute.Key("network.carrier.icc") + + // NetworkCarrierMCCKey is the attribute Key conforming to the + // "network.carrier.mcc" semantic conventions. It represents the mobile carrier + // country code. + // + // Type: string + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: 310 + NetworkCarrierMCCKey = attribute.Key("network.carrier.mcc") + + // NetworkCarrierMNCKey is the attribute Key conforming to the + // "network.carrier.mnc" semantic conventions. It represents the mobile carrier + // network code. + // + // Type: string + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: 001 + NetworkCarrierMNCKey = attribute.Key("network.carrier.mnc") + + // NetworkCarrierNameKey is the attribute Key conforming to the + // "network.carrier.name" semantic conventions. It represents the name of the + // mobile carrier. + // + // Type: string + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: sprint + NetworkCarrierNameKey = attribute.Key("network.carrier.name") + + // NetworkConnectionStateKey is the attribute Key conforming to the + // "network.connection.state" semantic conventions. It represents the state of + // network connection. + // + // Type: Enum + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: "close_wait" + // Note: Connection states are defined as part of the [rfc9293] + // + // [rfc9293]: https://datatracker.ietf.org/doc/html/rfc9293#section-3.3.2 + NetworkConnectionStateKey = attribute.Key("network.connection.state") + + // NetworkConnectionSubtypeKey is the attribute Key conforming to the + // "network.connection.subtype" semantic conventions. It represents the this + // describes more details regarding the connection.type. It may be the type of + // cell technology connection, but it could be used for describing details about + // a wifi connection. + // + // Type: Enum + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: LTE + NetworkConnectionSubtypeKey = attribute.Key("network.connection.subtype") + + // NetworkConnectionTypeKey is the attribute Key conforming to the + // "network.connection.type" semantic conventions. It represents the internet + // connection type. + // + // Type: Enum + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: wifi + NetworkConnectionTypeKey = attribute.Key("network.connection.type") + + // NetworkInterfaceNameKey is the attribute Key conforming to the + // "network.interface.name" semantic conventions. It represents the network + // interface name. + // + // Type: string + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: "lo", "eth0" + NetworkInterfaceNameKey = attribute.Key("network.interface.name") + + // NetworkIODirectionKey is the attribute Key conforming to the + // "network.io.direction" semantic conventions. It represents the network IO + // operation direction. + // + // Type: Enum + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: "transmit" + NetworkIODirectionKey = attribute.Key("network.io.direction") + + // NetworkLocalAddressKey is the attribute Key conforming to the + // "network.local.address" semantic conventions. It represents the local address + // of the network connection - IP address or Unix domain socket name. + // + // Type: string + // RequirementLevel: Recommended + // Stability: Stable + // + // Examples: "10.1.2.80", "/tmp/my.sock" + NetworkLocalAddressKey = attribute.Key("network.local.address") + + // NetworkLocalPortKey is the attribute Key conforming to the + // "network.local.port" semantic conventions. It represents the local port + // number of the network connection. + // + // Type: int + // RequirementLevel: Recommended + // Stability: Stable + // + // Examples: 65123 + NetworkLocalPortKey = attribute.Key("network.local.port") + + // NetworkPeerAddressKey is the attribute Key conforming to the + // "network.peer.address" semantic conventions. It represents the peer address + // of the network connection - IP address or Unix domain socket name. + // + // Type: string + // RequirementLevel: Recommended + // Stability: Stable + // + // Examples: "10.1.2.80", "/tmp/my.sock" + NetworkPeerAddressKey = attribute.Key("network.peer.address") + + // NetworkPeerPortKey is the attribute Key conforming to the "network.peer.port" + // semantic conventions. It represents the peer port number of the network + // connection. + // + // Type: int + // RequirementLevel: Recommended + // Stability: Stable + // + // Examples: 65123 + NetworkPeerPortKey = attribute.Key("network.peer.port") + + // NetworkProtocolNameKey is the attribute Key conforming to the + // "network.protocol.name" semantic conventions. It represents the + // [OSI application layer] or non-OSI equivalent. + // + // Type: string + // RequirementLevel: Recommended + // Stability: Stable + // + // Examples: "amqp", "http", "mqtt" + // Note: The value SHOULD be normalized to lowercase. + // + // [OSI application layer]: https://wikipedia.org/wiki/Application_layer + NetworkProtocolNameKey = attribute.Key("network.protocol.name") + + // NetworkProtocolVersionKey is the attribute Key conforming to the + // "network.protocol.version" semantic conventions. It represents the actual + // version of the protocol used for network communication. + // + // Type: string + // RequirementLevel: Recommended + // Stability: Stable + // + // Examples: "1.1", "2" + // Note: If protocol version is subject to negotiation (for example using [ALPN] + // ), this attribute SHOULD be set to the negotiated version. If the actual + // protocol version is not known, this attribute SHOULD NOT be set. + // + // [ALPN]: https://www.rfc-editor.org/rfc/rfc7301.html + NetworkProtocolVersionKey = attribute.Key("network.protocol.version") + + // NetworkTransportKey is the attribute Key conforming to the + // "network.transport" semantic conventions. It represents the + // [OSI transport layer] or [inter-process communication method]. + // + // Type: Enum + // RequirementLevel: Recommended + // Stability: Stable + // + // Examples: "tcp", "udp" + // Note: The value SHOULD be normalized to lowercase. + // + // Consider always setting the transport when setting a port number, since + // a port number is ambiguous without knowing the transport. For example + // different processes could be listening on TCP port 12345 and UDP port 12345. + // + // [OSI transport layer]: https://wikipedia.org/wiki/Transport_layer + // [inter-process communication method]: https://wikipedia.org/wiki/Inter-process_communication + NetworkTransportKey = attribute.Key("network.transport") + + // NetworkTypeKey is the attribute Key conforming to the "network.type" semantic + // conventions. It represents the [OSI network layer] or non-OSI equivalent. + // + // Type: Enum + // RequirementLevel: Recommended + // Stability: Stable + // + // Examples: "ipv4", "ipv6" + // Note: The value SHOULD be normalized to lowercase. + // + // [OSI network layer]: https://wikipedia.org/wiki/Network_layer + NetworkTypeKey = attribute.Key("network.type") +) + +// NetworkCarrierICC returns an attribute KeyValue conforming to the +// "network.carrier.icc" semantic conventions. It represents the ISO 3166-1 +// alpha-2 2-character country code associated with the mobile carrier network. +func NetworkCarrierICC(val string) attribute.KeyValue { + return NetworkCarrierICCKey.String(val) +} + +// NetworkCarrierMCC returns an attribute KeyValue conforming to the +// "network.carrier.mcc" semantic conventions. It represents the mobile carrier +// country code. +func NetworkCarrierMCC(val string) attribute.KeyValue { + return NetworkCarrierMCCKey.String(val) +} + +// NetworkCarrierMNC returns an attribute KeyValue conforming to the +// "network.carrier.mnc" semantic conventions. It represents the mobile carrier +// network code. +func NetworkCarrierMNC(val string) attribute.KeyValue { + return NetworkCarrierMNCKey.String(val) +} + +// NetworkCarrierName returns an attribute KeyValue conforming to the +// "network.carrier.name" semantic conventions. It represents the name of the +// mobile carrier. +func NetworkCarrierName(val string) attribute.KeyValue { + return NetworkCarrierNameKey.String(val) +} + +// NetworkInterfaceName returns an attribute KeyValue conforming to the +// "network.interface.name" semantic conventions. It represents the network +// interface name. +func NetworkInterfaceName(val string) attribute.KeyValue { + return NetworkInterfaceNameKey.String(val) +} + +// NetworkLocalAddress returns an attribute KeyValue conforming to the +// "network.local.address" semantic conventions. It represents the local address +// of the network connection - IP address or Unix domain socket name. +func NetworkLocalAddress(val string) attribute.KeyValue { + return NetworkLocalAddressKey.String(val) +} + +// NetworkLocalPort returns an attribute KeyValue conforming to the +// "network.local.port" semantic conventions. It represents the local port number +// of the network connection. +func NetworkLocalPort(val int) attribute.KeyValue { + return NetworkLocalPortKey.Int(val) +} + +// NetworkPeerAddress returns an attribute KeyValue conforming to the +// "network.peer.address" semantic conventions. It represents the peer address of +// the network connection - IP address or Unix domain socket name. +func NetworkPeerAddress(val string) attribute.KeyValue { + return NetworkPeerAddressKey.String(val) +} + +// NetworkPeerPort returns an attribute KeyValue conforming to the +// "network.peer.port" semantic conventions. It represents the peer port number +// of the network connection. +func NetworkPeerPort(val int) attribute.KeyValue { + return NetworkPeerPortKey.Int(val) +} + +// NetworkProtocolName returns an attribute KeyValue conforming to the +// "network.protocol.name" semantic conventions. It represents the +// [OSI application layer] or non-OSI equivalent. +// +// [OSI application layer]: https://wikipedia.org/wiki/Application_layer +func NetworkProtocolName(val string) attribute.KeyValue { + return NetworkProtocolNameKey.String(val) +} + +// NetworkProtocolVersion returns an attribute KeyValue conforming to the +// "network.protocol.version" semantic conventions. It represents the actual +// version of the protocol used for network communication. +func NetworkProtocolVersion(val string) attribute.KeyValue { + return NetworkProtocolVersionKey.String(val) +} + +// Enum values for network.connection.state +var ( + // closed + // Stability: development + NetworkConnectionStateClosed = NetworkConnectionStateKey.String("closed") + // close_wait + // Stability: development + NetworkConnectionStateCloseWait = NetworkConnectionStateKey.String("close_wait") + // closing + // Stability: development + NetworkConnectionStateClosing = NetworkConnectionStateKey.String("closing") + // established + // Stability: development + NetworkConnectionStateEstablished = NetworkConnectionStateKey.String("established") + // fin_wait_1 + // Stability: development + NetworkConnectionStateFinWait1 = NetworkConnectionStateKey.String("fin_wait_1") + // fin_wait_2 + // Stability: development + NetworkConnectionStateFinWait2 = NetworkConnectionStateKey.String("fin_wait_2") + // last_ack + // Stability: development + NetworkConnectionStateLastAck = NetworkConnectionStateKey.String("last_ack") + // listen + // Stability: development + NetworkConnectionStateListen = NetworkConnectionStateKey.String("listen") + // syn_received + // Stability: development + NetworkConnectionStateSynReceived = NetworkConnectionStateKey.String("syn_received") + // syn_sent + // Stability: development + NetworkConnectionStateSynSent = NetworkConnectionStateKey.String("syn_sent") + // time_wait + // Stability: development + NetworkConnectionStateTimeWait = NetworkConnectionStateKey.String("time_wait") +) + +// Enum values for network.connection.subtype +var ( + // GPRS + // Stability: development + NetworkConnectionSubtypeGprs = NetworkConnectionSubtypeKey.String("gprs") + // EDGE + // Stability: development + NetworkConnectionSubtypeEdge = NetworkConnectionSubtypeKey.String("edge") + // UMTS + // Stability: development + NetworkConnectionSubtypeUmts = NetworkConnectionSubtypeKey.String("umts") + // CDMA + // Stability: development + NetworkConnectionSubtypeCdma = NetworkConnectionSubtypeKey.String("cdma") + // EVDO Rel. 0 + // Stability: development + NetworkConnectionSubtypeEvdo0 = NetworkConnectionSubtypeKey.String("evdo_0") + // EVDO Rev. A + // Stability: development + NetworkConnectionSubtypeEvdoA = NetworkConnectionSubtypeKey.String("evdo_a") + // CDMA2000 1XRTT + // Stability: development + NetworkConnectionSubtypeCdma20001xrtt = NetworkConnectionSubtypeKey.String("cdma2000_1xrtt") + // HSDPA + // Stability: development + NetworkConnectionSubtypeHsdpa = NetworkConnectionSubtypeKey.String("hsdpa") + // HSUPA + // Stability: development + NetworkConnectionSubtypeHsupa = NetworkConnectionSubtypeKey.String("hsupa") + // HSPA + // Stability: development + NetworkConnectionSubtypeHspa = NetworkConnectionSubtypeKey.String("hspa") + // IDEN + // Stability: development + NetworkConnectionSubtypeIden = NetworkConnectionSubtypeKey.String("iden") + // EVDO Rev. B + // Stability: development + NetworkConnectionSubtypeEvdoB = NetworkConnectionSubtypeKey.String("evdo_b") + // LTE + // Stability: development + NetworkConnectionSubtypeLte = NetworkConnectionSubtypeKey.String("lte") + // EHRPD + // Stability: development + NetworkConnectionSubtypeEhrpd = NetworkConnectionSubtypeKey.String("ehrpd") + // HSPAP + // Stability: development + NetworkConnectionSubtypeHspap = NetworkConnectionSubtypeKey.String("hspap") + // GSM + // Stability: development + NetworkConnectionSubtypeGsm = NetworkConnectionSubtypeKey.String("gsm") + // TD-SCDMA + // Stability: development + NetworkConnectionSubtypeTdScdma = NetworkConnectionSubtypeKey.String("td_scdma") + // IWLAN + // Stability: development + NetworkConnectionSubtypeIwlan = NetworkConnectionSubtypeKey.String("iwlan") + // 5G NR (New Radio) + // Stability: development + NetworkConnectionSubtypeNr = NetworkConnectionSubtypeKey.String("nr") + // 5G NRNSA (New Radio Non-Standalone) + // Stability: development + NetworkConnectionSubtypeNrnsa = NetworkConnectionSubtypeKey.String("nrnsa") + // LTE CA + // Stability: development + NetworkConnectionSubtypeLteCa = NetworkConnectionSubtypeKey.String("lte_ca") +) + +// Enum values for network.connection.type +var ( + // wifi + // Stability: development + NetworkConnectionTypeWifi = NetworkConnectionTypeKey.String("wifi") + // wired + // Stability: development + NetworkConnectionTypeWired = NetworkConnectionTypeKey.String("wired") + // cell + // Stability: development + NetworkConnectionTypeCell = NetworkConnectionTypeKey.String("cell") + // unavailable + // Stability: development + NetworkConnectionTypeUnavailable = NetworkConnectionTypeKey.String("unavailable") + // unknown + // Stability: development + NetworkConnectionTypeUnknown = NetworkConnectionTypeKey.String("unknown") +) + +// Enum values for network.io.direction +var ( + // transmit + // Stability: development + NetworkIODirectionTransmit = NetworkIODirectionKey.String("transmit") + // receive + // Stability: development + NetworkIODirectionReceive = NetworkIODirectionKey.String("receive") +) + +// Enum values for network.transport +var ( + // TCP + // Stability: stable + NetworkTransportTCP = NetworkTransportKey.String("tcp") + // UDP + // Stability: stable + NetworkTransportUDP = NetworkTransportKey.String("udp") + // Named or anonymous pipe. + // Stability: stable + NetworkTransportPipe = NetworkTransportKey.String("pipe") + // Unix domain socket + // Stability: stable + NetworkTransportUnix = NetworkTransportKey.String("unix") + // QUIC + // Stability: stable + NetworkTransportQUIC = NetworkTransportKey.String("quic") +) + +// Enum values for network.type +var ( + // IPv4 + // Stability: stable + NetworkTypeIPv4 = NetworkTypeKey.String("ipv4") + // IPv6 + // Stability: stable + NetworkTypeIPv6 = NetworkTypeKey.String("ipv6") +) + +// Namespace: nfs +const ( + // NfsOperationNameKey is the attribute Key conforming to the + // "nfs.operation.name" semantic conventions. It represents the NFSv4+ operation + // name. + // + // Type: string + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: "OPEN", "READ", "GETATTR" + NfsOperationNameKey = attribute.Key("nfs.operation.name") + + // NfsServerRepcacheStatusKey is the attribute Key conforming to the + // "nfs.server.repcache.status" semantic conventions. It represents the linux: + // one of "hit" (NFSD_STATS_RC_HITS), "miss" (NFSD_STATS_RC_MISSES), or + // "nocache" (NFSD_STATS_RC_NOCACHE -- uncacheable). + // + // Type: string + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: hit + NfsServerRepcacheStatusKey = attribute.Key("nfs.server.repcache.status") +) + +// NfsOperationName returns an attribute KeyValue conforming to the +// "nfs.operation.name" semantic conventions. It represents the NFSv4+ operation +// name. +func NfsOperationName(val string) attribute.KeyValue { + return NfsOperationNameKey.String(val) +} + +// NfsServerRepcacheStatus returns an attribute KeyValue conforming to the +// "nfs.server.repcache.status" semantic conventions. It represents the linux: +// one of "hit" (NFSD_STATS_RC_HITS), "miss" (NFSD_STATS_RC_MISSES), or "nocache" +// (NFSD_STATS_RC_NOCACHE -- uncacheable). +func NfsServerRepcacheStatus(val string) attribute.KeyValue { + return NfsServerRepcacheStatusKey.String(val) +} + +// Namespace: oci +const ( + // OCIManifestDigestKey is the attribute Key conforming to the + // "oci.manifest.digest" semantic conventions. It represents the digest of the + // OCI image manifest. For container images specifically is the digest by which + // the container image is known. + // + // Type: string + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: + // "sha256:e4ca62c0d62f3e886e684806dfe9d4e0cda60d54986898173c1083856cfda0f4" + // Note: Follows [OCI Image Manifest Specification], and specifically the + // [Digest property]. + // An example can be found in [Example Image Manifest]. + // + // [OCI Image Manifest Specification]: https://github.com/opencontainers/image-spec/blob/main/manifest.md + // [Digest property]: https://github.com/opencontainers/image-spec/blob/main/descriptor.md#digests + // [Example Image Manifest]: https://github.com/opencontainers/image-spec/blob/main/manifest.md#example-image-manifest + OCIManifestDigestKey = attribute.Key("oci.manifest.digest") +) + +// OCIManifestDigest returns an attribute KeyValue conforming to the +// "oci.manifest.digest" semantic conventions. It represents the digest of the +// OCI image manifest. For container images specifically is the digest by which +// the container image is known. +func OCIManifestDigest(val string) attribute.KeyValue { + return OCIManifestDigestKey.String(val) +} + +// Namespace: onc_rpc +const ( + // OncRPCProcedureNameKey is the attribute Key conforming to the + // "onc_rpc.procedure.name" semantic conventions. It represents the ONC/Sun RPC + // procedure name. + // + // Type: string + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: "OPEN", "READ", "GETATTR" + OncRPCProcedureNameKey = attribute.Key("onc_rpc.procedure.name") + + // OncRPCProcedureNumberKey is the attribute Key conforming to the + // "onc_rpc.procedure.number" semantic conventions. It represents the ONC/Sun + // RPC procedure number. + // + // Type: int + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: + OncRPCProcedureNumberKey = attribute.Key("onc_rpc.procedure.number") + + // OncRPCProgramNameKey is the attribute Key conforming to the + // "onc_rpc.program.name" semantic conventions. It represents the ONC/Sun RPC + // program name. + // + // Type: string + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: "portmapper", "nfs" + OncRPCProgramNameKey = attribute.Key("onc_rpc.program.name") + + // OncRPCVersionKey is the attribute Key conforming to the "onc_rpc.version" + // semantic conventions. It represents the ONC/Sun RPC program version. + // + // Type: int + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: + OncRPCVersionKey = attribute.Key("onc_rpc.version") +) + +// OncRPCProcedureName returns an attribute KeyValue conforming to the +// "onc_rpc.procedure.name" semantic conventions. It represents the ONC/Sun RPC +// procedure name. +func OncRPCProcedureName(val string) attribute.KeyValue { + return OncRPCProcedureNameKey.String(val) +} + +// OncRPCProcedureNumber returns an attribute KeyValue conforming to the +// "onc_rpc.procedure.number" semantic conventions. It represents the ONC/Sun RPC +// procedure number. +func OncRPCProcedureNumber(val int) attribute.KeyValue { + return OncRPCProcedureNumberKey.Int(val) +} + +// OncRPCProgramName returns an attribute KeyValue conforming to the +// "onc_rpc.program.name" semantic conventions. It represents the ONC/Sun RPC +// program name. +func OncRPCProgramName(val string) attribute.KeyValue { + return OncRPCProgramNameKey.String(val) +} + +// OncRPCVersion returns an attribute KeyValue conforming to the +// "onc_rpc.version" semantic conventions. It represents the ONC/Sun RPC program +// version. +func OncRPCVersion(val int) attribute.KeyValue { + return OncRPCVersionKey.Int(val) +} + +// Namespace: openai +const ( + // OpenAIAPITypeKey is the attribute Key conforming to the "openai.api.type" + // semantic conventions. It represents the type of OpenAI API being used. + // + // Type: Enum + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: + OpenAIAPITypeKey = attribute.Key("openai.api.type") + + // OpenAIRequestServiceTierKey is the attribute Key conforming to the + // "openai.request.service_tier" semantic conventions. It represents the service + // tier requested. May be a specific tier, default, or auto. + // + // Type: Enum + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: "auto", "default" + OpenAIRequestServiceTierKey = attribute.Key("openai.request.service_tier") + + // OpenAIResponseServiceTierKey is the attribute Key conforming to the + // "openai.response.service_tier" semantic conventions. It represents the + // service tier used for the response. + // + // Type: string + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: "scale", "default" + OpenAIResponseServiceTierKey = attribute.Key("openai.response.service_tier") + + // OpenAIResponseSystemFingerprintKey is the attribute Key conforming to the + // "openai.response.system_fingerprint" semantic conventions. It represents a + // fingerprint to track any eventual change in the Generative AI environment. + // + // Type: string + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: "fp_44709d6fcb" + OpenAIResponseSystemFingerprintKey = attribute.Key("openai.response.system_fingerprint") +) + +// OpenAIResponseServiceTier returns an attribute KeyValue conforming to the +// "openai.response.service_tier" semantic conventions. It represents the service +// tier used for the response. +func OpenAIResponseServiceTier(val string) attribute.KeyValue { + return OpenAIResponseServiceTierKey.String(val) +} + +// OpenAIResponseSystemFingerprint returns an attribute KeyValue conforming to +// the "openai.response.system_fingerprint" semantic conventions. It represents a +// fingerprint to track any eventual change in the Generative AI environment. +func OpenAIResponseSystemFingerprint(val string) attribute.KeyValue { + return OpenAIResponseSystemFingerprintKey.String(val) +} + +// Enum values for openai.api.type +var ( + // The OpenAI [Chat Completions API]. + // Stability: development + // + // [Chat Completions API]: https://developers.openai.com/api/reference/chat-completions/overview + OpenAIAPITypeChatCompletions = OpenAIAPITypeKey.String("chat_completions") + // The OpenAI [Responses API]. + // Stability: development + // + // [Responses API]: https://developers.openai.com/api/reference/responses/overview + OpenAIAPITypeResponses = OpenAIAPITypeKey.String("responses") +) + +// Enum values for openai.request.service_tier +var ( + // The system will utilize scale tier credits until they are exhausted. + // Stability: development + OpenAIRequestServiceTierAuto = OpenAIRequestServiceTierKey.String("auto") + // The system will utilize the default scale tier. + // Stability: development + OpenAIRequestServiceTierDefault = OpenAIRequestServiceTierKey.String("default") +) + +// Namespace: openshift +const ( + // OpenShiftClusterquotaNameKey is the attribute Key conforming to the + // "openshift.clusterquota.name" semantic conventions. It represents the name of + // the cluster quota. + // + // Type: string + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: "opentelemetry" + OpenShiftClusterquotaNameKey = attribute.Key("openshift.clusterquota.name") + + // OpenShiftClusterquotaUIDKey is the attribute Key conforming to the + // "openshift.clusterquota.uid" semantic conventions. It represents the UID of + // the cluster quota. + // + // Type: string + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: "275ecb36-5aa8-4c2a-9c47-d8bb681b9aff" + OpenShiftClusterquotaUIDKey = attribute.Key("openshift.clusterquota.uid") +) + +// OpenShiftClusterquotaName returns an attribute KeyValue conforming to the +// "openshift.clusterquota.name" semantic conventions. It represents the name of +// the cluster quota. +func OpenShiftClusterquotaName(val string) attribute.KeyValue { + return OpenShiftClusterquotaNameKey.String(val) +} + +// OpenShiftClusterquotaUID returns an attribute KeyValue conforming to the +// "openshift.clusterquota.uid" semantic conventions. It represents the UID of +// the cluster quota. +func OpenShiftClusterquotaUID(val string) attribute.KeyValue { + return OpenShiftClusterquotaUIDKey.String(val) +} + +// Namespace: opentracing +const ( + // OpenTracingRefTypeKey is the attribute Key conforming to the + // "opentracing.ref_type" semantic conventions. It represents the parent-child + // Reference type. + // + // Type: Enum + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: + // Note: The causal relationship between a child Span and a parent Span. + OpenTracingRefTypeKey = attribute.Key("opentracing.ref_type") +) + +// Enum values for opentracing.ref_type +var ( + // The parent Span depends on the child Span in some capacity + // Stability: development + OpenTracingRefTypeChildOf = OpenTracingRefTypeKey.String("child_of") + // The parent Span doesn't depend in any way on the result of the child Span + // Stability: development + OpenTracingRefTypeFollowsFrom = OpenTracingRefTypeKey.String("follows_from") +) + +// Namespace: oracle +const ( + // OracleDBDomainKey is the attribute Key conforming to the "oracle.db.domain" + // semantic conventions. It represents the database domain associated with the + // connection. + // + // Type: string + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: "example.com", "corp.internal", "prod.db.local" + // Note: This attribute SHOULD be set to the value of the `DB_DOMAIN` + // initialization parameter, + // as exposed in `v$parameter`. `DB_DOMAIN` defines the domain portion of the + // global + // database name and SHOULD be configured when a database is, or may become, + // part of a + // distributed environment. Its value consists of one or more valid identifiers + // (alphanumeric ASCII characters) separated by periods. + OracleDBDomainKey = attribute.Key("oracle.db.domain") + + // OracleDBInstanceNameKey is the attribute Key conforming to the + // "oracle.db.instance.name" semantic conventions. It represents the instance + // name associated with the connection in an Oracle Real Application Clusters + // environment. + // + // Type: string + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: "ORCL1", "ORCL2", "ORCL3" + // Note: There can be multiple instances associated with a single database + // service. It indicates the + // unique instance name to which the connection is currently bound. For non-RAC + // databases, this value + // defaults to the `oracle.db.name`. + OracleDBInstanceNameKey = attribute.Key("oracle.db.instance.name") + + // OracleDBNameKey is the attribute Key conforming to the "oracle.db.name" + // semantic conventions. It represents the database name associated with the + // connection. + // + // Type: string + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: "ORCL1", "FREE" + // Note: This attribute SHOULD be set to the value of the parameter `DB_NAME` + // exposed in `v$parameter`. + OracleDBNameKey = attribute.Key("oracle.db.name") + + // OracleDBPdbKey is the attribute Key conforming to the "oracle.db.pdb" + // semantic conventions. It represents the pluggable database (PDB) name + // associated with the connection. + // + // Type: string + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: "PDB1", "FREEPDB" + // Note: This attribute SHOULD reflect the PDB that the session is currently + // connected to. + // If instrumentation cannot reliably obtain the active PDB name for each + // operation + // without issuing an additional query (such as `SELECT SYS_CONTEXT`), it is + // RECOMMENDED to fall back to the PDB name specified at connection + // establishment. + OracleDBPdbKey = attribute.Key("oracle.db.pdb") + + // OracleDBServiceKey is the attribute Key conforming to the "oracle.db.service" + // semantic conventions. It represents the service name currently associated + // with the database connection. + // + // Type: string + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: "order-processing-service", "db_low.adb.oraclecloud.com", + // "db_high.adb.oraclecloud.com" + // Note: The effective service name for a connection can change during its + // lifetime, + // for example after executing sql, `ALTER SESSION`. If an instrumentation + // cannot reliably + // obtain the current service name for each operation without issuing an + // additional + // query (such as `SELECT SYS_CONTEXT`), it is RECOMMENDED to fall back to the + // service name originally provided at connection establishment. + OracleDBServiceKey = attribute.Key("oracle.db.service") +) + +// OracleDBDomain returns an attribute KeyValue conforming to the +// "oracle.db.domain" semantic conventions. It represents the database domain +// associated with the connection. +func OracleDBDomain(val string) attribute.KeyValue { + return OracleDBDomainKey.String(val) +} + +// OracleDBInstanceName returns an attribute KeyValue conforming to the +// "oracle.db.instance.name" semantic conventions. It represents the instance +// name associated with the connection in an Oracle Real Application Clusters +// environment. +func OracleDBInstanceName(val string) attribute.KeyValue { + return OracleDBInstanceNameKey.String(val) +} + +// OracleDBName returns an attribute KeyValue conforming to the "oracle.db.name" +// semantic conventions. It represents the database name associated with the +// connection. +func OracleDBName(val string) attribute.KeyValue { + return OracleDBNameKey.String(val) +} + +// OracleDBPdb returns an attribute KeyValue conforming to the "oracle.db.pdb" +// semantic conventions. It represents the pluggable database (PDB) name +// associated with the connection. +func OracleDBPdb(val string) attribute.KeyValue { + return OracleDBPdbKey.String(val) +} + +// OracleDBService returns an attribute KeyValue conforming to the +// "oracle.db.service" semantic conventions. It represents the service name +// currently associated with the database connection. +func OracleDBService(val string) attribute.KeyValue { + return OracleDBServiceKey.String(val) +} + +// Namespace: oracle_cloud +const ( + // OracleCloudRealmKey is the attribute Key conforming to the + // "oracle_cloud.realm" semantic conventions. It represents the OCI realm + // identifier that indicates the isolated partition in which the tenancy and its + // resources reside. + // + // Type: string + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: "oc1", "oc2" + // Note: See [OCI documentation on realms] + // + // [OCI documentation on realms]: https://docs.oracle.com/iaas/Content/General/Concepts/regions.htm + OracleCloudRealmKey = attribute.Key("oracle_cloud.realm") +) + +// OracleCloudRealm returns an attribute KeyValue conforming to the +// "oracle_cloud.realm" semantic conventions. It represents the OCI realm +// identifier that indicates the isolated partition in which the tenancy and its +// resources reside. +func OracleCloudRealm(val string) attribute.KeyValue { + return OracleCloudRealmKey.String(val) +} + +// Namespace: os +const ( + // OSBuildIDKey is the attribute Key conforming to the "os.build_id" semantic + // conventions. It represents the unique identifier for a particular build or + // compilation of the operating system. + // + // Type: string + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: "TQ3C.230805.001.B2", "20E247", "22621" + OSBuildIDKey = attribute.Key("os.build_id") + + // OSDescriptionKey is the attribute Key conforming to the "os.description" + // semantic conventions. It represents the human readable (not intended to be + // parsed) OS version information, like e.g. reported by `ver` or + // `lsb_release -a` commands. + // + // Type: string + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: "Microsoft Windows [Version 10.0.18363.778]", "Ubuntu 18.04.1 LTS" + OSDescriptionKey = attribute.Key("os.description") + + // OSNameKey is the attribute Key conforming to the "os.name" semantic + // conventions. It represents the human readable operating system name. + // + // Type: string + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: "iOS", "Android", "Ubuntu" + OSNameKey = attribute.Key("os.name") + + // OSTypeKey is the attribute Key conforming to the "os.type" semantic + // conventions. It represents the operating system type. + // + // Type: Enum + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: + OSTypeKey = attribute.Key("os.type") + + // OSVersionKey is the attribute Key conforming to the "os.version" semantic + // conventions. It represents the version string of the operating system as + // defined in [Version Attributes]. + // + // Type: string + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: "14.2.1", "18.04.1" + // + // [Version Attributes]: /docs/resource/README.md#version-attributes + OSVersionKey = attribute.Key("os.version") +) + +// OSBuildID returns an attribute KeyValue conforming to the "os.build_id" +// semantic conventions. It represents the unique identifier for a particular +// build or compilation of the operating system. +func OSBuildID(val string) attribute.KeyValue { + return OSBuildIDKey.String(val) +} + +// OSDescription returns an attribute KeyValue conforming to the "os.description" +// semantic conventions. It represents the human readable (not intended to be +// parsed) OS version information, like e.g. reported by `ver` or +// `lsb_release -a` commands. +func OSDescription(val string) attribute.KeyValue { + return OSDescriptionKey.String(val) +} + +// OSName returns an attribute KeyValue conforming to the "os.name" semantic +// conventions. It represents the human readable operating system name. +func OSName(val string) attribute.KeyValue { + return OSNameKey.String(val) +} + +// OSVersion returns an attribute KeyValue conforming to the "os.version" +// semantic conventions. It represents the version string of the operating system +// as defined in [Version Attributes]. +// +// [Version Attributes]: /docs/resource/README.md#version-attributes +func OSVersion(val string) attribute.KeyValue { + return OSVersionKey.String(val) +} + +// Enum values for os.type +var ( + // Microsoft Windows + // Stability: development + OSTypeWindows = OSTypeKey.String("windows") + // Linux + // Stability: development + OSTypeLinux = OSTypeKey.String("linux") + // Apple Darwin + // Stability: development + OSTypeDarwin = OSTypeKey.String("darwin") + // FreeBSD + // Stability: development + OSTypeFreeBSD = OSTypeKey.String("freebsd") + // NetBSD + // Stability: development + OSTypeNetBSD = OSTypeKey.String("netbsd") + // OpenBSD + // Stability: development + OSTypeOpenBSD = OSTypeKey.String("openbsd") + // DragonFly BSD + // Stability: development + OSTypeDragonflyBSD = OSTypeKey.String("dragonflybsd") + // HP-UX (Hewlett Packard Unix) + // Stability: development + OSTypeHPUX = OSTypeKey.String("hpux") + // AIX (Advanced Interactive eXecutive) + // Stability: development + OSTypeAIX = OSTypeKey.String("aix") + // SunOS, Oracle Solaris + // Stability: development + OSTypeSolaris = OSTypeKey.String("solaris") + // IBM z/OS + // Stability: development + OSTypeZOS = OSTypeKey.String("zos") +) + +// Namespace: otel +const ( + // OTelComponentNameKey is the attribute Key conforming to the + // "otel.component.name" semantic conventions. It represents a name uniquely + // identifying the instance of the OpenTelemetry component within its containing + // SDK instance. + // + // Type: string + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: "otlp_grpc_span_exporter/0", "custom-name" + // Note: Implementations SHOULD ensure a low cardinality for this attribute, + // even across application or SDK restarts. + // E.g. implementations MUST NOT use UUIDs as values for this attribute. + // + // Implementations MAY achieve these goals by following a + // `/` pattern, e.g. + // `batching_span_processor/0`. + // Hereby `otel.component.type` refers to the corresponding attribute value of + // the component. + // + // The value of `instance-counter` MAY be automatically assigned by the + // component and uniqueness within the enclosing SDK instance MUST be + // guaranteed. + // For example, `` MAY be implemented by using a monotonically + // increasing counter (starting with `0`), which is incremented every time an + // instance of the given component type is started. + // + // With this implementation, for example the first Batching Span Processor would + // have `batching_span_processor/0` + // as `otel.component.name`, the second one `batching_span_processor/1` and so + // on. + // These values will therefore be reused in the case of an application restart. + OTelComponentNameKey = attribute.Key("otel.component.name") + + // OTelComponentTypeKey is the attribute Key conforming to the + // "otel.component.type" semantic conventions. It represents a name identifying + // the type of the OpenTelemetry component. + // + // Type: Enum + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: "batching_span_processor", "com.example.MySpanExporter" + // Note: If none of the standardized values apply, implementations SHOULD use + // the language-defined name of the type. + // E.g. for Java the fully qualified classname SHOULD be used in this case. + OTelComponentTypeKey = attribute.Key("otel.component.type") + + // OTelEventNameKey is the attribute Key conforming to the "otel.event.name" + // semantic conventions. It represents the identifies the class / type of event. + // + // Type: string + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: "browser.mouse.click", "device.app.lifecycle" + // Note: This attribute SHOULD be used by non-OTLP exporters when destination + // does not support `EventName` or equivalent field. This attribute MAY be used + // by applications using existing logging libraries so that it can be used to + // set the `EventName` field by Collector or SDK components. + OTelEventNameKey = attribute.Key("otel.event.name") + + // OTelScopeNameKey is the attribute Key conforming to the "otel.scope.name" + // semantic conventions. It represents the name of the instrumentation scope - ( + // `InstrumentationScope.Name` in OTLP). + // + // Type: string + // RequirementLevel: Recommended + // Stability: Stable + // + // Examples: "io.opentelemetry.contrib.mongodb" + OTelScopeNameKey = attribute.Key("otel.scope.name") + + // OTelScopeSchemaURLKey is the attribute Key conforming to the + // "otel.scope.schema_url" semantic conventions. It represents the schema URL of + // the instrumentation scope. + // + // Type: string + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: "https://opentelemetry.io/schemas/1.31.0" + OTelScopeSchemaURLKey = attribute.Key("otel.scope.schema_url") + + // OTelScopeVersionKey is the attribute Key conforming to the + // "otel.scope.version" semantic conventions. It represents the version of the + // instrumentation scope - (`InstrumentationScope.Version` in OTLP). + // + // Type: string + // RequirementLevel: Recommended + // Stability: Stable + // + // Examples: "1.0.0" + OTelScopeVersionKey = attribute.Key("otel.scope.version") + + // OTelSpanParentOriginKey is the attribute Key conforming to the + // "otel.span.parent.origin" semantic conventions. It represents the determines + // whether the span has a parent span, and if so, + // [whether it is a remote parent]. + // + // Type: Enum + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: + // + // [whether it is a remote parent]: https://opentelemetry.io/docs/specs/otel/trace/api/#isremote + OTelSpanParentOriginKey = attribute.Key("otel.span.parent.origin") + + // OTelSpanSamplingResultKey is the attribute Key conforming to the + // "otel.span.sampling_result" semantic conventions. It represents the result + // value of the sampler for this span. + // + // Type: Enum + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: + OTelSpanSamplingResultKey = attribute.Key("otel.span.sampling_result") + + // OTelStatusCodeKey is the attribute Key conforming to the "otel.status_code" + // semantic conventions. It represents the name of the code, either "OK" or + // "ERROR". MUST NOT be set if the status code is UNSET. + // + // Type: Enum + // RequirementLevel: Recommended + // Stability: Stable + // + // Examples: + OTelStatusCodeKey = attribute.Key("otel.status_code") + + // OTelStatusDescriptionKey is the attribute Key conforming to the + // "otel.status_description" semantic conventions. It represents the description + // of the Status if it has a value, otherwise not set. + // + // Type: string + // RequirementLevel: Recommended + // Stability: Stable + // + // Examples: "resource not found" + OTelStatusDescriptionKey = attribute.Key("otel.status_description") +) + +// OTelComponentName returns an attribute KeyValue conforming to the +// "otel.component.name" semantic conventions. It represents a name uniquely +// identifying the instance of the OpenTelemetry component within its containing +// SDK instance. +func OTelComponentName(val string) attribute.KeyValue { + return OTelComponentNameKey.String(val) +} + +// OTelEventName returns an attribute KeyValue conforming to the +// "otel.event.name" semantic conventions. It represents the identifies the class +// / type of event. +func OTelEventName(val string) attribute.KeyValue { + return OTelEventNameKey.String(val) +} + +// OTelScopeName returns an attribute KeyValue conforming to the +// "otel.scope.name" semantic conventions. It represents the name of the +// instrumentation scope - (`InstrumentationScope.Name` in OTLP). +func OTelScopeName(val string) attribute.KeyValue { + return OTelScopeNameKey.String(val) +} + +// OTelScopeSchemaURL returns an attribute KeyValue conforming to the +// "otel.scope.schema_url" semantic conventions. It represents the schema URL of +// the instrumentation scope. +func OTelScopeSchemaURL(val string) attribute.KeyValue { + return OTelScopeSchemaURLKey.String(val) +} + +// OTelScopeVersion returns an attribute KeyValue conforming to the +// "otel.scope.version" semantic conventions. It represents the version of the +// instrumentation scope - (`InstrumentationScope.Version` in OTLP). +func OTelScopeVersion(val string) attribute.KeyValue { + return OTelScopeVersionKey.String(val) +} + +// OTelStatusDescription returns an attribute KeyValue conforming to the +// "otel.status_description" semantic conventions. It represents the description +// of the Status if it has a value, otherwise not set. +func OTelStatusDescription(val string) attribute.KeyValue { + return OTelStatusDescriptionKey.String(val) +} + +// Enum values for otel.component.type +var ( + // The builtin SDK batching span processor + // + // Stability: development + OTelComponentTypeBatchingSpanProcessor = OTelComponentTypeKey.String("batching_span_processor") + // The builtin SDK simple span processor + // + // Stability: development + OTelComponentTypeSimpleSpanProcessor = OTelComponentTypeKey.String("simple_span_processor") + // The builtin SDK batching log record processor + // + // Stability: development + OTelComponentTypeBatchingLogProcessor = OTelComponentTypeKey.String("batching_log_processor") + // The builtin SDK simple log record processor + // + // Stability: development + OTelComponentTypeSimpleLogProcessor = OTelComponentTypeKey.String("simple_log_processor") + // OTLP span exporter over gRPC with protobuf serialization + // + // Stability: development + OTelComponentTypeOtlpGRPCSpanExporter = OTelComponentTypeKey.String("otlp_grpc_span_exporter") + // OTLP span exporter over HTTP with protobuf serialization + // + // Stability: development + OTelComponentTypeOtlpHTTPSpanExporter = OTelComponentTypeKey.String("otlp_http_span_exporter") + // OTLP span exporter over HTTP with JSON serialization + // + // Stability: development + OTelComponentTypeOtlpHTTPJSONSpanExporter = OTelComponentTypeKey.String("otlp_http_json_span_exporter") + // Zipkin span exporter over HTTP + // + // Stability: development + OTelComponentTypeZipkinHTTPSpanExporter = OTelComponentTypeKey.String("zipkin_http_span_exporter") + // OTLP log record exporter over gRPC with protobuf serialization + // + // Stability: development + OTelComponentTypeOtlpGRPCLogExporter = OTelComponentTypeKey.String("otlp_grpc_log_exporter") + // OTLP log record exporter over HTTP with protobuf serialization + // + // Stability: development + OTelComponentTypeOtlpHTTPLogExporter = OTelComponentTypeKey.String("otlp_http_log_exporter") + // OTLP log record exporter over HTTP with JSON serialization + // + // Stability: development + OTelComponentTypeOtlpHTTPJSONLogExporter = OTelComponentTypeKey.String("otlp_http_json_log_exporter") + // The builtin SDK periodically exporting metric reader + // + // Stability: development + OTelComponentTypePeriodicMetricReader = OTelComponentTypeKey.String("periodic_metric_reader") + // OTLP metric exporter over gRPC with protobuf serialization + // + // Stability: development + OTelComponentTypeOtlpGRPCMetricExporter = OTelComponentTypeKey.String("otlp_grpc_metric_exporter") + // OTLP metric exporter over HTTP with protobuf serialization + // + // Stability: development + OTelComponentTypeOtlpHTTPMetricExporter = OTelComponentTypeKey.String("otlp_http_metric_exporter") + // OTLP metric exporter over HTTP with JSON serialization + // + // Stability: development + OTelComponentTypeOtlpHTTPJSONMetricExporter = OTelComponentTypeKey.String("otlp_http_json_metric_exporter") + // Prometheus metric exporter over HTTP with the default text-based format + // + // Stability: development + OTelComponentTypePrometheusHTTPTextMetricExporter = OTelComponentTypeKey.String("prometheus_http_text_metric_exporter") +) + +// Enum values for otel.span.parent.origin +var ( + // The span does not have a parent, it is a root span + // Stability: development + OTelSpanParentOriginNone = OTelSpanParentOriginKey.String("none") + // The span has a parent and the parent's span context [isRemote()] is false + // Stability: development + // + // [isRemote()]: https://opentelemetry.io/docs/specs/otel/trace/api/#isremote + OTelSpanParentOriginLocal = OTelSpanParentOriginKey.String("local") + // The span has a parent and the parent's span context [isRemote()] is true + // Stability: development + // + // [isRemote()]: https://opentelemetry.io/docs/specs/otel/trace/api/#isremote + OTelSpanParentOriginRemote = OTelSpanParentOriginKey.String("remote") +) + +// Enum values for otel.span.sampling_result +var ( + // The span is not sampled and not recording + // Stability: development + OTelSpanSamplingResultDrop = OTelSpanSamplingResultKey.String("DROP") + // The span is not sampled, but recording + // Stability: development + OTelSpanSamplingResultRecordOnly = OTelSpanSamplingResultKey.String("RECORD_ONLY") + // The span is sampled and recording + // Stability: development + OTelSpanSamplingResultRecordAndSample = OTelSpanSamplingResultKey.String("RECORD_AND_SAMPLE") +) + +// Enum values for otel.status_code +var ( + // The operation has been validated by an Application developer or Operator to + // have completed successfully. + // Stability: stable + OTelStatusCodeOk = OTelStatusCodeKey.String("OK") + // The operation contains an error. + // Stability: stable + OTelStatusCodeError = OTelStatusCodeKey.String("ERROR") +) + +// Namespace: pprof +const ( + // PprofLocationIsFoldedKey is the attribute Key conforming to the + // "pprof.location.is_folded" semantic conventions. It represents the provides + // an indication that multiple symbols map to this location's address, for + // example due to identical code folding by the linker. In that case the line + // information represents one of the multiple symbols. This field must be + // recomputed when the symbolization state of the profile changes. + // + // Type: boolean + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: + PprofLocationIsFoldedKey = attribute.Key("pprof.location.is_folded") + + // PprofMappingHasFilenamesKey is the attribute Key conforming to the + // "pprof.mapping.has_filenames" semantic conventions. It represents the + // indicates that there are filenames related to this mapping. + // + // Type: boolean + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: + PprofMappingHasFilenamesKey = attribute.Key("pprof.mapping.has_filenames") + + // PprofMappingHasFunctionsKey is the attribute Key conforming to the + // "pprof.mapping.has_functions" semantic conventions. It represents the + // indicates that there are functions related to this mapping. + // + // Type: boolean + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: + PprofMappingHasFunctionsKey = attribute.Key("pprof.mapping.has_functions") + + // PprofMappingHasInlineFramesKey is the attribute Key conforming to the + // "pprof.mapping.has_inline_frames" semantic conventions. It represents the + // indicates that there are inline frames related to this mapping. + // + // Type: boolean + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: + PprofMappingHasInlineFramesKey = attribute.Key("pprof.mapping.has_inline_frames") + + // PprofMappingHasLineNumbersKey is the attribute Key conforming to the + // "pprof.mapping.has_line_numbers" semantic conventions. It represents the + // indicates that there are line numbers related to this mapping. + // + // Type: boolean + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: + PprofMappingHasLineNumbersKey = attribute.Key("pprof.mapping.has_line_numbers") + + // PprofProfileCommentKey is the attribute Key conforming to the + // "pprof.profile.comment" semantic conventions. It represents the free-form + // text associated with the profile. This field should not be used to store any + // machine-readable information, it is only for human-friendly content. + // + // Type: string[] + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: "hello world", "bazinga" + PprofProfileCommentKey = attribute.Key("pprof.profile.comment") + + // PprofProfileDocURLKey is the attribute Key conforming to the + // "pprof.profile.doc_url" semantic conventions. It represents the documentation + // link for this profile type. + // + // Type: string + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: "http://pprof.example.com/cpu-profile.html" + // Note: The URL must be absolute and may be missing if the profile was + // generated by code that did not supply a link + PprofProfileDocURLKey = attribute.Key("pprof.profile.doc_url") + + // PprofProfileDropFramesKey is the attribute Key conforming to the + // "pprof.profile.drop_frames" semantic conventions. It represents the frames + // with Function.function_name fully matching the regexp will be dropped from + // the samples, along with their successors. + // + // Type: string + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: "/foobar/" + PprofProfileDropFramesKey = attribute.Key("pprof.profile.drop_frames") + + // PprofProfileKeepFramesKey is the attribute Key conforming to the + // "pprof.profile.keep_frames" semantic conventions. It represents the frames + // with Function.function_name fully matching the regexp will be kept, even if + // it matches drop_frames. + // + // Type: string + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: "/bazinga/" + PprofProfileKeepFramesKey = attribute.Key("pprof.profile.keep_frames") + + // PprofScopeDefaultSampleTypeKey is the attribute Key conforming to the + // "pprof.scope.default_sample_type" semantic conventions. It represents the + // records the pprof's default_sample_type in the original profile. Not set if + // the default sample type was missing. + // + // Type: string + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: "cpu" + // Note: This attribute, if present, MUST be set at the scope level + // (resource_profiles[].scope_profiles[].scope.attributes[]). + PprofScopeDefaultSampleTypeKey = attribute.Key("pprof.scope.default_sample_type") + + // PprofScopeSampleTypeOrderKey is the attribute Key conforming to the + // "pprof.scope.sample_type_order" semantic conventions. It represents the + // records the indexes of the sample types in the original profile. + // + // Type: int[] + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: 3, 0, 1, 2 + // Note: This attribute, if present, MUST be set at the scope level + // (resource_profiles[].scope_profiles[].scope.attributes[]). + PprofScopeSampleTypeOrderKey = attribute.Key("pprof.scope.sample_type_order") +) + +// PprofLocationIsFolded returns an attribute KeyValue conforming to the +// "pprof.location.is_folded" semantic conventions. It represents the provides an +// indication that multiple symbols map to this location's address, for example +// due to identical code folding by the linker. In that case the line information +// represents one of the multiple symbols. This field must be recomputed when the +// symbolization state of the profile changes. +func PprofLocationIsFolded(val bool) attribute.KeyValue { + return PprofLocationIsFoldedKey.Bool(val) +} + +// PprofMappingHasFilenames returns an attribute KeyValue conforming to the +// "pprof.mapping.has_filenames" semantic conventions. It represents the +// indicates that there are filenames related to this mapping. +func PprofMappingHasFilenames(val bool) attribute.KeyValue { + return PprofMappingHasFilenamesKey.Bool(val) +} + +// PprofMappingHasFunctions returns an attribute KeyValue conforming to the +// "pprof.mapping.has_functions" semantic conventions. It represents the +// indicates that there are functions related to this mapping. +func PprofMappingHasFunctions(val bool) attribute.KeyValue { + return PprofMappingHasFunctionsKey.Bool(val) +} + +// PprofMappingHasInlineFrames returns an attribute KeyValue conforming to the +// "pprof.mapping.has_inline_frames" semantic conventions. It represents the +// indicates that there are inline frames related to this mapping. +func PprofMappingHasInlineFrames(val bool) attribute.KeyValue { + return PprofMappingHasInlineFramesKey.Bool(val) +} + +// PprofMappingHasLineNumbers returns an attribute KeyValue conforming to the +// "pprof.mapping.has_line_numbers" semantic conventions. It represents the +// indicates that there are line numbers related to this mapping. +func PprofMappingHasLineNumbers(val bool) attribute.KeyValue { + return PprofMappingHasLineNumbersKey.Bool(val) +} + +// PprofProfileComment returns an attribute KeyValue conforming to the +// "pprof.profile.comment" semantic conventions. It represents the free-form text +// associated with the profile. This field should not be used to store any +// machine-readable information, it is only for human-friendly content. +func PprofProfileComment(val ...string) attribute.KeyValue { + return PprofProfileCommentKey.StringSlice(val) +} + +// PprofProfileDocURL returns an attribute KeyValue conforming to the +// "pprof.profile.doc_url" semantic conventions. It represents the documentation +// link for this profile type. +func PprofProfileDocURL(val string) attribute.KeyValue { + return PprofProfileDocURLKey.String(val) +} + +// PprofProfileDropFrames returns an attribute KeyValue conforming to the +// "pprof.profile.drop_frames" semantic conventions. It represents the frames +// with Function.function_name fully matching the regexp will be dropped from the +// samples, along with their successors. +func PprofProfileDropFrames(val string) attribute.KeyValue { + return PprofProfileDropFramesKey.String(val) +} + +// PprofProfileKeepFrames returns an attribute KeyValue conforming to the +// "pprof.profile.keep_frames" semantic conventions. It represents the frames +// with Function.function_name fully matching the regexp will be kept, even if it +// matches drop_frames. +func PprofProfileKeepFrames(val string) attribute.KeyValue { + return PprofProfileKeepFramesKey.String(val) +} + +// PprofScopeDefaultSampleType returns an attribute KeyValue conforming to the +// "pprof.scope.default_sample_type" semantic conventions. It represents the +// records the pprof's default_sample_type in the original profile. Not set if +// the default sample type was missing. +func PprofScopeDefaultSampleType(val string) attribute.KeyValue { + return PprofScopeDefaultSampleTypeKey.String(val) +} + +// PprofScopeSampleTypeOrder returns an attribute KeyValue conforming to the +// "pprof.scope.sample_type_order" semantic conventions. It represents the +// records the indexes of the sample types in the original profile. +func PprofScopeSampleTypeOrder(val ...int) attribute.KeyValue { + return PprofScopeSampleTypeOrderKey.IntSlice(val) +} + +// Namespace: process +const ( + // ProcessArgsCountKey is the attribute Key conforming to the + // "process.args_count" semantic conventions. It represents the length of the + // process.command_args array. + // + // Type: int + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: 4 + // Note: This field can be useful for querying or performing bucket analysis on + // how many arguments were provided to start a process. More arguments may be an + // indication of suspicious activity. + ProcessArgsCountKey = attribute.Key("process.args_count") + + // ProcessCommandKey is the attribute Key conforming to the "process.command" + // semantic conventions. It represents the command used to launch the process + // (i.e. the command name). On Linux based systems, can be set to the zeroth + // string in `proc/[pid]/cmdline`. On Windows, can be set to the first parameter + // extracted from `GetCommandLineW`. + // + // Type: string + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: "cmd/otelcol" + ProcessCommandKey = attribute.Key("process.command") + + // ProcessCommandArgsKey is the attribute Key conforming to the + // "process.command_args" semantic conventions. It represents the all the + // command arguments (including the command/executable itself) as received by + // the process. On Linux-based systems (and some other Unixoid systems + // supporting procfs), can be set according to the list of null-delimited + // strings extracted from `proc/[pid]/cmdline`. For libc-based executables, this + // would be the full argv vector passed to `main`. SHOULD NOT be collected by + // default unless there is sanitization that excludes sensitive data. + // + // Type: string[] + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: "cmd/otecol", "--config=config.yaml" + ProcessCommandArgsKey = attribute.Key("process.command_args") + + // ProcessCommandLineKey is the attribute Key conforming to the + // "process.command_line" semantic conventions. It represents the full command + // used to launch the process as a single string representing the full command. + // On Windows, can be set to the result of `GetCommandLineW`. Do not set this if + // you have to assemble it just for monitoring; use `process.command_args` + // instead. SHOULD NOT be collected by default unless there is sanitization that + // excludes sensitive data. + // + // Type: string + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: "C:\cmd\otecol --config="my directory\config.yaml"" + ProcessCommandLineKey = attribute.Key("process.command_line") + + // ProcessContextSwitchTypeKey is the attribute Key conforming to the + // "process.context_switch.type" semantic conventions. It represents the + // specifies whether the context switches for this data point were voluntary or + // involuntary. + // + // Type: Enum + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: + ProcessContextSwitchTypeKey = attribute.Key("process.context_switch.type") + + // ProcessCreationTimeKey is the attribute Key conforming to the + // "process.creation.time" semantic conventions. It represents the date and time + // the process was created, in ISO 8601 format. + // + // Type: string + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: "2023-11-21T09:25:34.853Z" + ProcessCreationTimeKey = attribute.Key("process.creation.time") + + // ProcessExecutableBuildIDGNUKey is the attribute Key conforming to the + // "process.executable.build_id.gnu" semantic conventions. It represents the GNU + // build ID as found in the `.note.gnu.build-id` ELF section (hex string). + // + // Type: string + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: "c89b11207f6479603b0d49bf291c092c2b719293" + ProcessExecutableBuildIDGNUKey = attribute.Key("process.executable.build_id.gnu") + + // ProcessExecutableBuildIDGoKey is the attribute Key conforming to the + // "process.executable.build_id.go" semantic conventions. It represents the Go + // build ID as retrieved by `go tool buildid `. + // + // Type: string + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: + // "foh3mEXu7BLZjsN9pOwG/kATcXlYVCDEFouRMQed_/WwRFB1hPo9LBkekthSPG/x8hMC8emW2cCjXD0_1aY" + ProcessExecutableBuildIDGoKey = attribute.Key("process.executable.build_id.go") + + // ProcessExecutableBuildIDHtlhashKey is the attribute Key conforming to the + // "process.executable.build_id.htlhash" semantic conventions. It represents the + // profiling specific build ID for executables. See the OTel specification for + // Profiles for more information. + // + // Type: string + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: "600DCAFE4A110000F2BF38C493F5FB92" + ProcessExecutableBuildIDHtlhashKey = attribute.Key("process.executable.build_id.htlhash") + + // ProcessExecutableNameKey is the attribute Key conforming to the + // "process.executable.name" semantic conventions. It represents the name of the + // process executable. On Linux based systems, this SHOULD be set to the base + // name of the target of `/proc/[pid]/exe`. On Windows, this SHOULD be set to + // the base name of `GetProcessImageFileNameW`. + // + // Type: string + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: "otelcol" + ProcessExecutableNameKey = attribute.Key("process.executable.name") + + // ProcessExecutablePathKey is the attribute Key conforming to the + // "process.executable.path" semantic conventions. It represents the full path + // to the process executable. On Linux based systems, can be set to the target + // of `proc/[pid]/exe`. On Windows, can be set to the result of + // `GetProcessImageFileNameW`. + // + // Type: string + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: "/usr/bin/cmd/otelcol" + ProcessExecutablePathKey = attribute.Key("process.executable.path") + + // ProcessExitCodeKey is the attribute Key conforming to the "process.exit.code" + // semantic conventions. It represents the exit code of the process. + // + // Type: int + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: 127 + ProcessExitCodeKey = attribute.Key("process.exit.code") + + // ProcessExitTimeKey is the attribute Key conforming to the "process.exit.time" + // semantic conventions. It represents the date and time the process exited, in + // ISO 8601 format. + // + // Type: string + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: "2023-11-21T09:26:12.315Z" + ProcessExitTimeKey = attribute.Key("process.exit.time") + + // ProcessGroupLeaderPIDKey is the attribute Key conforming to the + // "process.group_leader.pid" semantic conventions. It represents the PID of the + // process's group leader. This is also the process group ID (PGID) of the + // process. + // + // Type: int + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: 23 + ProcessGroupLeaderPIDKey = attribute.Key("process.group_leader.pid") + + // ProcessInteractiveKey is the attribute Key conforming to the + // "process.interactive" semantic conventions. It represents the whether the + // process is connected to an interactive shell. + // + // Type: boolean + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: + ProcessInteractiveKey = attribute.Key("process.interactive") + + // ProcessLinuxCgroupKey is the attribute Key conforming to the + // "process.linux.cgroup" semantic conventions. It represents the control group + // associated with the process. + // + // Type: string + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: "1:name=systemd:/user.slice/user-1000.slice/session-3.scope", + // "0::/user.slice/user-1000.slice/user@1000.service/tmux-spawn-0267755b-4639-4a27-90ed-f19f88e53748.scope" + // Note: Control groups (cgroups) are a kernel feature used to organize and + // manage process resources. This attribute provides the path(s) to the + // cgroup(s) associated with the process, which should match the contents of the + // [/proc/[PID]/cgroup] file. + // + // [/proc/[PID]/cgroup]: https://man7.org/linux/man-pages/man7/cgroups.7.html + ProcessLinuxCgroupKey = attribute.Key("process.linux.cgroup") + + // ProcessOwnerKey is the attribute Key conforming to the "process.owner" + // semantic conventions. It represents the username of the user that owns the + // process. + // + // Type: string + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: "root" + ProcessOwnerKey = attribute.Key("process.owner") + + // ProcessParentPIDKey is the attribute Key conforming to the + // "process.parent_pid" semantic conventions. It represents the parent Process + // identifier (PPID). + // + // Type: int + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: 111 + ProcessParentPIDKey = attribute.Key("process.parent_pid") + + // ProcessPIDKey is the attribute Key conforming to the "process.pid" semantic + // conventions. It represents the process identifier (PID). + // + // Type: int + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: 1234 + ProcessPIDKey = attribute.Key("process.pid") + + // ProcessRealUserIDKey is the attribute Key conforming to the + // "process.real_user.id" semantic conventions. It represents the real user ID + // (RUID) of the process. + // + // Type: int + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: 1000 + ProcessRealUserIDKey = attribute.Key("process.real_user.id") + + // ProcessRealUserNameKey is the attribute Key conforming to the + // "process.real_user.name" semantic conventions. It represents the username of + // the real user of the process. + // + // Type: string + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: "operator" + ProcessRealUserNameKey = attribute.Key("process.real_user.name") + + // ProcessRuntimeDescriptionKey is the attribute Key conforming to the + // "process.runtime.description" semantic conventions. It represents an + // additional description about the runtime of the process, for example a + // specific vendor customization of the runtime environment. + // + // Type: string + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: Eclipse OpenJ9 Eclipse OpenJ9 VM openj9-0.21.0 + ProcessRuntimeDescriptionKey = attribute.Key("process.runtime.description") + + // ProcessRuntimeNameKey is the attribute Key conforming to the + // "process.runtime.name" semantic conventions. It represents the name of the + // runtime of this process. + // + // Type: string + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: "OpenJDK Runtime Environment" + ProcessRuntimeNameKey = attribute.Key("process.runtime.name") + + // ProcessRuntimeVersionKey is the attribute Key conforming to the + // "process.runtime.version" semantic conventions. It represents the version of + // the runtime of this process, as returned by the runtime without modification. + // + // Type: string + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: 14.0.2 + ProcessRuntimeVersionKey = attribute.Key("process.runtime.version") + + // ProcessSavedUserIDKey is the attribute Key conforming to the + // "process.saved_user.id" semantic conventions. It represents the saved user ID + // (SUID) of the process. + // + // Type: int + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: 1002 + ProcessSavedUserIDKey = attribute.Key("process.saved_user.id") + + // ProcessSavedUserNameKey is the attribute Key conforming to the + // "process.saved_user.name" semantic conventions. It represents the username of + // the saved user. + // + // Type: string + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: "operator" + ProcessSavedUserNameKey = attribute.Key("process.saved_user.name") + + // ProcessSessionLeaderPIDKey is the attribute Key conforming to the + // "process.session_leader.pid" semantic conventions. It represents the PID of + // the process's session leader. This is also the session ID (SID) of the + // process. + // + // Type: int + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: 14 + ProcessSessionLeaderPIDKey = attribute.Key("process.session_leader.pid") + + // ProcessStateKey is the attribute Key conforming to the "process.state" + // semantic conventions. It represents the process state, e.g., + // [Linux Process State Codes]. + // + // Type: Enum + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: "running" + // + // [Linux Process State Codes]: https://man7.org/linux/man-pages/man1/ps.1.html#PROCESS_STATE_CODES + ProcessStateKey = attribute.Key("process.state") + + // ProcessTitleKey is the attribute Key conforming to the "process.title" + // semantic conventions. It represents the process title (proctitle). + // + // Type: string + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: "cat /etc/hostname", "xfce4-session", "bash" + // Note: In many Unix-like systems, process title (proctitle), is the string + // that represents the name or command line of a running process, displayed by + // system monitoring tools like ps, top, and htop. + ProcessTitleKey = attribute.Key("process.title") + + // ProcessUserIDKey is the attribute Key conforming to the "process.user.id" + // semantic conventions. It represents the effective user ID (EUID) of the + // process. + // + // Type: int + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: 1001 + ProcessUserIDKey = attribute.Key("process.user.id") + + // ProcessUserNameKey is the attribute Key conforming to the "process.user.name" + // semantic conventions. It represents the username of the effective user of the + // process. + // + // Type: string + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: "root" + ProcessUserNameKey = attribute.Key("process.user.name") + + // ProcessVpidKey is the attribute Key conforming to the "process.vpid" semantic + // conventions. It represents the virtual process identifier. + // + // Type: int + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: 12 + // Note: The process ID within a PID namespace. This is not necessarily unique + // across all processes on the host but it is unique within the process + // namespace that the process exists within. + ProcessVpidKey = attribute.Key("process.vpid") + + // ProcessWorkingDirectoryKey is the attribute Key conforming to the + // "process.working_directory" semantic conventions. It represents the working + // directory of the process. + // + // Type: string + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: "/root" + ProcessWorkingDirectoryKey = attribute.Key("process.working_directory") +) + +// ProcessArgsCount returns an attribute KeyValue conforming to the +// "process.args_count" semantic conventions. It represents the length of the +// process.command_args array. +func ProcessArgsCount(val int) attribute.KeyValue { + return ProcessArgsCountKey.Int(val) +} + +// ProcessCommand returns an attribute KeyValue conforming to the +// "process.command" semantic conventions. It represents the command used to +// launch the process (i.e. the command name). On Linux based systems, can be set +// to the zeroth string in `proc/[pid]/cmdline`. On Windows, can be set to the +// first parameter extracted from `GetCommandLineW`. +func ProcessCommand(val string) attribute.KeyValue { + return ProcessCommandKey.String(val) +} + +// ProcessCommandArgs returns an attribute KeyValue conforming to the +// "process.command_args" semantic conventions. It represents the all the command +// arguments (including the command/executable itself) as received by the +// process. On Linux-based systems (and some other Unixoid systems supporting +// procfs), can be set according to the list of null-delimited strings extracted +// from `proc/[pid]/cmdline`. For libc-based executables, this would be the full +// argv vector passed to `main`. SHOULD NOT be collected by default unless there +// is sanitization that excludes sensitive data. +func ProcessCommandArgs(val ...string) attribute.KeyValue { + return ProcessCommandArgsKey.StringSlice(val) +} + +// ProcessCommandLine returns an attribute KeyValue conforming to the +// "process.command_line" semantic conventions. It represents the full command +// used to launch the process as a single string representing the full command. +// On Windows, can be set to the result of `GetCommandLineW`. Do not set this if +// you have to assemble it just for monitoring; use `process.command_args` +// instead. SHOULD NOT be collected by default unless there is sanitization that +// excludes sensitive data. +func ProcessCommandLine(val string) attribute.KeyValue { + return ProcessCommandLineKey.String(val) +} + +// ProcessCreationTime returns an attribute KeyValue conforming to the +// "process.creation.time" semantic conventions. It represents the date and time +// the process was created, in ISO 8601 format. +func ProcessCreationTime(val string) attribute.KeyValue { + return ProcessCreationTimeKey.String(val) +} + +// ProcessEnvironmentVariable returns an attribute KeyValue conforming to the +// "process.environment_variable" semantic conventions. It represents the process +// environment variables, `` being the environment variable name, the value +// being the environment variable value. +func ProcessEnvironmentVariable(key string, val string) attribute.KeyValue { + return attribute.String("process.environment_variable."+key, val) +} + +// ProcessExecutableBuildIDGNU returns an attribute KeyValue conforming to the +// "process.executable.build_id.gnu" semantic conventions. It represents the GNU +// build ID as found in the `.note.gnu.build-id` ELF section (hex string). +func ProcessExecutableBuildIDGNU(val string) attribute.KeyValue { + return ProcessExecutableBuildIDGNUKey.String(val) +} + +// ProcessExecutableBuildIDGo returns an attribute KeyValue conforming to the +// "process.executable.build_id.go" semantic conventions. It represents the Go +// build ID as retrieved by `go tool buildid `. +func ProcessExecutableBuildIDGo(val string) attribute.KeyValue { + return ProcessExecutableBuildIDGoKey.String(val) +} + +// ProcessExecutableBuildIDHtlhash returns an attribute KeyValue conforming to +// the "process.executable.build_id.htlhash" semantic conventions. It represents +// the profiling specific build ID for executables. See the OTel specification +// for Profiles for more information. +func ProcessExecutableBuildIDHtlhash(val string) attribute.KeyValue { + return ProcessExecutableBuildIDHtlhashKey.String(val) +} + +// ProcessExecutableName returns an attribute KeyValue conforming to the +// "process.executable.name" semantic conventions. It represents the name of the +// process executable. On Linux based systems, this SHOULD be set to the base +// name of the target of `/proc/[pid]/exe`. On Windows, this SHOULD be set to the +// base name of `GetProcessImageFileNameW`. +func ProcessExecutableName(val string) attribute.KeyValue { + return ProcessExecutableNameKey.String(val) +} + +// ProcessExecutablePath returns an attribute KeyValue conforming to the +// "process.executable.path" semantic conventions. It represents the full path to +// the process executable. On Linux based systems, can be set to the target of +// `proc/[pid]/exe`. On Windows, can be set to the result of +// `GetProcessImageFileNameW`. +func ProcessExecutablePath(val string) attribute.KeyValue { + return ProcessExecutablePathKey.String(val) +} + +// ProcessExitCode returns an attribute KeyValue conforming to the +// "process.exit.code" semantic conventions. It represents the exit code of the +// process. +func ProcessExitCode(val int) attribute.KeyValue { + return ProcessExitCodeKey.Int(val) +} + +// ProcessExitTime returns an attribute KeyValue conforming to the +// "process.exit.time" semantic conventions. It represents the date and time the +// process exited, in ISO 8601 format. +func ProcessExitTime(val string) attribute.KeyValue { + return ProcessExitTimeKey.String(val) +} + +// ProcessGroupLeaderPID returns an attribute KeyValue conforming to the +// "process.group_leader.pid" semantic conventions. It represents the PID of the +// process's group leader. This is also the process group ID (PGID) of the +// process. +func ProcessGroupLeaderPID(val int) attribute.KeyValue { + return ProcessGroupLeaderPIDKey.Int(val) +} + +// ProcessInteractive returns an attribute KeyValue conforming to the +// "process.interactive" semantic conventions. It represents the whether the +// process is connected to an interactive shell. +func ProcessInteractive(val bool) attribute.KeyValue { + return ProcessInteractiveKey.Bool(val) +} + +// ProcessLinuxCgroup returns an attribute KeyValue conforming to the +// "process.linux.cgroup" semantic conventions. It represents the control group +// associated with the process. +func ProcessLinuxCgroup(val string) attribute.KeyValue { + return ProcessLinuxCgroupKey.String(val) +} + +// ProcessOwner returns an attribute KeyValue conforming to the "process.owner" +// semantic conventions. It represents the username of the user that owns the +// process. +func ProcessOwner(val string) attribute.KeyValue { + return ProcessOwnerKey.String(val) +} + +// ProcessParentPID returns an attribute KeyValue conforming to the +// "process.parent_pid" semantic conventions. It represents the parent Process +// identifier (PPID). +func ProcessParentPID(val int) attribute.KeyValue { + return ProcessParentPIDKey.Int(val) +} + +// ProcessPID returns an attribute KeyValue conforming to the "process.pid" +// semantic conventions. It represents the process identifier (PID). +func ProcessPID(val int) attribute.KeyValue { + return ProcessPIDKey.Int(val) +} + +// ProcessRealUserID returns an attribute KeyValue conforming to the +// "process.real_user.id" semantic conventions. It represents the real user ID +// (RUID) of the process. +func ProcessRealUserID(val int) attribute.KeyValue { + return ProcessRealUserIDKey.Int(val) +} + +// ProcessRealUserName returns an attribute KeyValue conforming to the +// "process.real_user.name" semantic conventions. It represents the username of +// the real user of the process. +func ProcessRealUserName(val string) attribute.KeyValue { + return ProcessRealUserNameKey.String(val) +} + +// ProcessRuntimeDescription returns an attribute KeyValue conforming to the +// "process.runtime.description" semantic conventions. It represents an +// additional description about the runtime of the process, for example a +// specific vendor customization of the runtime environment. +func ProcessRuntimeDescription(val string) attribute.KeyValue { + return ProcessRuntimeDescriptionKey.String(val) +} + +// ProcessRuntimeName returns an attribute KeyValue conforming to the +// "process.runtime.name" semantic conventions. It represents the name of the +// runtime of this process. +func ProcessRuntimeName(val string) attribute.KeyValue { + return ProcessRuntimeNameKey.String(val) +} + +// ProcessRuntimeVersion returns an attribute KeyValue conforming to the +// "process.runtime.version" semantic conventions. It represents the version of +// the runtime of this process, as returned by the runtime without modification. +func ProcessRuntimeVersion(val string) attribute.KeyValue { + return ProcessRuntimeVersionKey.String(val) +} + +// ProcessSavedUserID returns an attribute KeyValue conforming to the +// "process.saved_user.id" semantic conventions. It represents the saved user ID +// (SUID) of the process. +func ProcessSavedUserID(val int) attribute.KeyValue { + return ProcessSavedUserIDKey.Int(val) +} + +// ProcessSavedUserName returns an attribute KeyValue conforming to the +// "process.saved_user.name" semantic conventions. It represents the username of +// the saved user. +func ProcessSavedUserName(val string) attribute.KeyValue { + return ProcessSavedUserNameKey.String(val) +} + +// ProcessSessionLeaderPID returns an attribute KeyValue conforming to the +// "process.session_leader.pid" semantic conventions. It represents the PID of +// the process's session leader. This is also the session ID (SID) of the +// process. +func ProcessSessionLeaderPID(val int) attribute.KeyValue { + return ProcessSessionLeaderPIDKey.Int(val) +} + +// ProcessTitle returns an attribute KeyValue conforming to the "process.title" +// semantic conventions. It represents the process title (proctitle). +func ProcessTitle(val string) attribute.KeyValue { + return ProcessTitleKey.String(val) +} + +// ProcessUserID returns an attribute KeyValue conforming to the +// "process.user.id" semantic conventions. It represents the effective user ID +// (EUID) of the process. +func ProcessUserID(val int) attribute.KeyValue { + return ProcessUserIDKey.Int(val) +} + +// ProcessUserName returns an attribute KeyValue conforming to the +// "process.user.name" semantic conventions. It represents the username of the +// effective user of the process. +func ProcessUserName(val string) attribute.KeyValue { + return ProcessUserNameKey.String(val) +} + +// ProcessVpid returns an attribute KeyValue conforming to the "process.vpid" +// semantic conventions. It represents the virtual process identifier. +func ProcessVpid(val int) attribute.KeyValue { + return ProcessVpidKey.Int(val) +} + +// ProcessWorkingDirectory returns an attribute KeyValue conforming to the +// "process.working_directory" semantic conventions. It represents the working +// directory of the process. +func ProcessWorkingDirectory(val string) attribute.KeyValue { + return ProcessWorkingDirectoryKey.String(val) +} + +// Enum values for process.context_switch.type +var ( + // voluntary + // Stability: development + ProcessContextSwitchTypeVoluntary = ProcessContextSwitchTypeKey.String("voluntary") + // involuntary + // Stability: development + ProcessContextSwitchTypeInvoluntary = ProcessContextSwitchTypeKey.String("involuntary") +) + +// Enum values for process.state +var ( + // running + // Stability: development + ProcessStateRunning = ProcessStateKey.String("running") + // sleeping + // Stability: development + ProcessStateSleeping = ProcessStateKey.String("sleeping") + // stopped + // Stability: development + ProcessStateStopped = ProcessStateKey.String("stopped") + // defunct + // Stability: development + ProcessStateDefunct = ProcessStateKey.String("defunct") +) + +// Namespace: profile +const ( + // ProfileFrameTypeKey is the attribute Key conforming to the + // "profile.frame.type" semantic conventions. It represents the describes the + // interpreter or compiler of a single frame. + // + // Type: Enum + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: "cpython" + ProfileFrameTypeKey = attribute.Key("profile.frame.type") +) + +// Enum values for profile.frame.type +var ( + // [.NET] + // + // Stability: development + // + // [.NET]: https://wikipedia.org/wiki/.NET + ProfileFrameTypeDotnet = ProfileFrameTypeKey.String("dotnet") + // [JVM] + // + // Stability: development + // + // [JVM]: https://wikipedia.org/wiki/Java_virtual_machine + ProfileFrameTypeJVM = ProfileFrameTypeKey.String("jvm") + // [Kernel] + // + // Stability: development + // + // [Kernel]: https://wikipedia.org/wiki/Kernel_(operating_system) + ProfileFrameTypeKernel = ProfileFrameTypeKey.String("kernel") + // Can be one of but not limited to [C], [C++], [Go] or [Rust]. If possible, a + // more precise value MUST be used. + // + // Stability: development + // + // [C]: https://wikipedia.org/wiki/C_(programming_language) + // [C++]: https://wikipedia.org/wiki/C%2B%2B + // [Go]: https://wikipedia.org/wiki/Go_(programming_language) + // [Rust]: https://wikipedia.org/wiki/Rust_(programming_language) + ProfileFrameTypeNative = ProfileFrameTypeKey.String("native") + // [Perl] + // + // Stability: development + // + // [Perl]: https://wikipedia.org/wiki/Perl + ProfileFrameTypePerl = ProfileFrameTypeKey.String("perl") + // [PHP] + // + // Stability: development + // + // [PHP]: https://wikipedia.org/wiki/PHP + ProfileFrameTypePHP = ProfileFrameTypeKey.String("php") + // [Python] + // + // Stability: development + // + // [Python]: https://wikipedia.org/wiki/Python_(programming_language) + ProfileFrameTypeCpython = ProfileFrameTypeKey.String("cpython") + // [Ruby] + // + // Stability: development + // + // [Ruby]: https://wikipedia.org/wiki/Ruby_(programming_language) + ProfileFrameTypeRuby = ProfileFrameTypeKey.String("ruby") + // [V8JS] + // + // Stability: development + // + // [V8JS]: https://wikipedia.org/wiki/V8_(JavaScript_engine) + ProfileFrameTypeV8JS = ProfileFrameTypeKey.String("v8js") + // [Erlang] + // + // Stability: development + // + // [Erlang]: https://en.wikipedia.org/wiki/BEAM_(Erlang_virtual_machine) + ProfileFrameTypeBeam = ProfileFrameTypeKey.String("beam") + // [Go], + // + // Stability: development + // + // [Go]: https://wikipedia.org/wiki/Go_(programming_language) + ProfileFrameTypeGo = ProfileFrameTypeKey.String("go") + // [Rust] + // + // Stability: development + // + // [Rust]: https://wikipedia.org/wiki/Rust_(programming_language) + ProfileFrameTypeRust = ProfileFrameTypeKey.String("rust") +) + +// Namespace: rpc +const ( + // RPCMethodKey is the attribute Key conforming to the "rpc.method" semantic + // conventions. It represents the fully-qualified logical name of the method + // from the RPC interface perspective. + // + // Type: string + // RequirementLevel: Recommended + // Stability: Release_Candidate + // + // Examples: "com.example.ExampleService/exampleMethod", "EchoService/Echo", + // "_OTHER" + // Note: The method name MAY have unbounded cardinality in edge or error cases. + // + // Some RPC frameworks or libraries provide a fixed set of recognized methods + // for client stubs and server implementations. Instrumentations for such + // frameworks MUST set this attribute to the original method name only + // when the method is recognized by the framework or library. + // + // When the method is not recognized, for example, when the server receives + // a request for a method that is not predefined on the server, or when + // instrumentation is not able to reliably detect if the method is predefined, + // the attribute MUST be set to `_OTHER`. In such cases, tracing + // instrumentations MUST also set `rpc.method_original` attribute to + // the original method value. + // + // If the RPC instrumentation could end up converting valid RPC methods to + // `_OTHER`, then it SHOULD provide a way to configure the list of recognized + // RPC methods. + // + // The `rpc.method` can be different from the name of any implementing + // method/function. + // The `code.function.name` attribute may be used to record the fully-qualified + // method actually executing the call on the server side, or the + // RPC client stub method on the client side. + RPCMethodKey = attribute.Key("rpc.method") + + // RPCMethodOriginalKey is the attribute Key conforming to the + // "rpc.method_original" semantic conventions. It represents the original name + // of the method used by the client. + // + // Type: string + // RequirementLevel: Recommended + // Stability: Release_Candidate + // + // Examples: "com.myservice.EchoService/catchAll", + // "com.myservice.EchoService/unknownMethod", "InvalidMethod" + RPCMethodOriginalKey = attribute.Key("rpc.method_original") + + // RPCResponseStatusCodeKey is the attribute Key conforming to the + // "rpc.response.status_code" semantic conventions. It represents the status + // code of the RPC returned by the RPC server or generated by the client. + // + // Type: string + // RequirementLevel: Recommended + // Stability: Release_Candidate + // + // Examples: "OK", "DEADLINE_EXCEEDED", "-32602" + // Note: Usually it represents an error code, but may also represent partial + // success, warning, or differentiate between various types of successful + // outcomes. + // Semantic conventions for individual RPC frameworks SHOULD document what + // `rpc.response.status_code` means in the context of that system and which + // values are considered to represent errors. + RPCResponseStatusCodeKey = attribute.Key("rpc.response.status_code") + + // RPCSystemNameKey is the attribute Key conforming to the "rpc.system.name" + // semantic conventions. It represents the Remote Procedure Call (RPC) system. + // + // Type: Enum + // RequirementLevel: Recommended + // Stability: Release_Candidate + // + // Examples: + // Note: The client and server RPC systems may differ for the same RPC + // interaction. For example, a client may use Apache Dubbo or Connect RPC to + // communicate with a server that uses gRPC since both protocols provide + // compatibility with gRPC. + RPCSystemNameKey = attribute.Key("rpc.system.name") +) + +// RPCMethod returns an attribute KeyValue conforming to the "rpc.method" +// semantic conventions. It represents the fully-qualified logical name of the +// method from the RPC interface perspective. +func RPCMethod(val string) attribute.KeyValue { + return RPCMethodKey.String(val) +} + +// RPCMethodOriginal returns an attribute KeyValue conforming to the +// "rpc.method_original" semantic conventions. It represents the original name of +// the method used by the client. +func RPCMethodOriginal(val string) attribute.KeyValue { + return RPCMethodOriginalKey.String(val) +} + +// RPCRequestMetadata returns an attribute KeyValue conforming to the +// "rpc.request.metadata" semantic conventions. It represents the RPC request +// metadata, `` being the normalized RPC metadata key (lowercase), the value +// being the metadata values. +func RPCRequestMetadata(key string, val ...string) attribute.KeyValue { + return attribute.StringSlice("rpc.request.metadata."+key, val) +} + +// RPCResponseMetadata returns an attribute KeyValue conforming to the +// "rpc.response.metadata" semantic conventions. It represents the RPC response +// metadata, `` being the normalized RPC metadata key (lowercase), the value +// being the metadata values. +func RPCResponseMetadata(key string, val ...string) attribute.KeyValue { + return attribute.StringSlice("rpc.response.metadata."+key, val) +} + +// RPCResponseStatusCode returns an attribute KeyValue conforming to the +// "rpc.response.status_code" semantic conventions. It represents the status code +// of the RPC returned by the RPC server or generated by the client. +func RPCResponseStatusCode(val string) attribute.KeyValue { + return RPCResponseStatusCodeKey.String(val) +} + +// Enum values for rpc.system.name +var ( + // [gRPC] + // Stability: release_candidate + // + // [gRPC]: https://grpc.io/ + RPCSystemNameGRPC = RPCSystemNameKey.String("grpc") + // [Apache Dubbo] + // Stability: release_candidate + // + // [Apache Dubbo]: https://dubbo.apache.org/ + RPCSystemNameDubbo = RPCSystemNameKey.String("dubbo") + // [Connect RPC] + // Stability: development + // + // [Connect RPC]: https://connectrpc.com/ + RPCSystemNameConnectrpc = RPCSystemNameKey.String("connectrpc") + // [JSON-RPC] + // Stability: development + // + // [JSON-RPC]: https://www.jsonrpc.org/ + RPCSystemNameJSONRPC = RPCSystemNameKey.String("jsonrpc") +) + +// Namespace: security_rule +const ( + // SecurityRuleCategoryKey is the attribute Key conforming to the + // "security_rule.category" semantic conventions. It represents a categorization + // value keyword used by the entity using the rule for detection of this event. + // + // Type: string + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: "Attempted Information Leak" + SecurityRuleCategoryKey = attribute.Key("security_rule.category") + + // SecurityRuleDescriptionKey is the attribute Key conforming to the + // "security_rule.description" semantic conventions. It represents the + // description of the rule generating the event. + // + // Type: string + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: "Block requests to public DNS over HTTPS / TLS protocols" + SecurityRuleDescriptionKey = attribute.Key("security_rule.description") + + // SecurityRuleLicenseKey is the attribute Key conforming to the + // "security_rule.license" semantic conventions. It represents the name of the + // license under which the rule used to generate this event is made available. + // + // Type: string + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: "Apache 2.0" + SecurityRuleLicenseKey = attribute.Key("security_rule.license") + + // SecurityRuleNameKey is the attribute Key conforming to the + // "security_rule.name" semantic conventions. It represents the name of the rule + // or signature generating the event. + // + // Type: string + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: "BLOCK_DNS_over_TLS" + SecurityRuleNameKey = attribute.Key("security_rule.name") + + // SecurityRuleReferenceKey is the attribute Key conforming to the + // "security_rule.reference" semantic conventions. It represents the reference + // URL to additional information about the rule used to generate this event. + // + // Type: string + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: "https://en.wikipedia.org/wiki/DNS_over_TLS" + // Note: The URL can point to the vendor’s documentation about the rule. If + // that’s not available, it can also be a link to a more general page + // describing this type of alert. + SecurityRuleReferenceKey = attribute.Key("security_rule.reference") + + // SecurityRuleRulesetNameKey is the attribute Key conforming to the + // "security_rule.ruleset.name" semantic conventions. It represents the name of + // the ruleset, policy, group, or parent category in which the rule used to + // generate this event is a member. + // + // Type: string + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: "Standard_Protocol_Filters" + SecurityRuleRulesetNameKey = attribute.Key("security_rule.ruleset.name") + + // SecurityRuleUUIDKey is the attribute Key conforming to the + // "security_rule.uuid" semantic conventions. It represents a rule ID that is + // unique within the scope of a set or group of agents, observers, or other + // entities using the rule for detection of this event. + // + // Type: string + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: "550e8400-e29b-41d4-a716-446655440000", "1100110011" + SecurityRuleUUIDKey = attribute.Key("security_rule.uuid") + + // SecurityRuleVersionKey is the attribute Key conforming to the + // "security_rule.version" semantic conventions. It represents the version / + // revision of the rule being used for analysis. + // + // Type: string + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: "1.0.0" + SecurityRuleVersionKey = attribute.Key("security_rule.version") +) + +// SecurityRuleCategory returns an attribute KeyValue conforming to the +// "security_rule.category" semantic conventions. It represents a categorization +// value keyword used by the entity using the rule for detection of this event. +func SecurityRuleCategory(val string) attribute.KeyValue { + return SecurityRuleCategoryKey.String(val) +} + +// SecurityRuleDescription returns an attribute KeyValue conforming to the +// "security_rule.description" semantic conventions. It represents the +// description of the rule generating the event. +func SecurityRuleDescription(val string) attribute.KeyValue { + return SecurityRuleDescriptionKey.String(val) +} + +// SecurityRuleLicense returns an attribute KeyValue conforming to the +// "security_rule.license" semantic conventions. It represents the name of the +// license under which the rule used to generate this event is made available. +func SecurityRuleLicense(val string) attribute.KeyValue { + return SecurityRuleLicenseKey.String(val) +} + +// SecurityRuleName returns an attribute KeyValue conforming to the +// "security_rule.name" semantic conventions. It represents the name of the rule +// or signature generating the event. +func SecurityRuleName(val string) attribute.KeyValue { + return SecurityRuleNameKey.String(val) +} + +// SecurityRuleReference returns an attribute KeyValue conforming to the +// "security_rule.reference" semantic conventions. It represents the reference +// URL to additional information about the rule used to generate this event. +func SecurityRuleReference(val string) attribute.KeyValue { + return SecurityRuleReferenceKey.String(val) +} + +// SecurityRuleRulesetName returns an attribute KeyValue conforming to the +// "security_rule.ruleset.name" semantic conventions. It represents the name of +// the ruleset, policy, group, or parent category in which the rule used to +// generate this event is a member. +func SecurityRuleRulesetName(val string) attribute.KeyValue { + return SecurityRuleRulesetNameKey.String(val) +} + +// SecurityRuleUUID returns an attribute KeyValue conforming to the +// "security_rule.uuid" semantic conventions. It represents a rule ID that is +// unique within the scope of a set or group of agents, observers, or other +// entities using the rule for detection of this event. +func SecurityRuleUUID(val string) attribute.KeyValue { + return SecurityRuleUUIDKey.String(val) +} + +// SecurityRuleVersion returns an attribute KeyValue conforming to the +// "security_rule.version" semantic conventions. It represents the version / +// revision of the rule being used for analysis. +func SecurityRuleVersion(val string) attribute.KeyValue { + return SecurityRuleVersionKey.String(val) +} + +// Namespace: server +const ( + // ServerAddressKey is the attribute Key conforming to the "server.address" + // semantic conventions. It represents the server domain name if available + // without reverse DNS lookup; otherwise, IP address or Unix domain socket name. + // + // Type: string + // RequirementLevel: Recommended + // Stability: Stable + // + // Examples: "example.com", "10.1.2.80", "/tmp/my.sock" + // Note: When observed from the client side, and when communicating through an + // intermediary, `server.address` SHOULD represent the server address behind any + // intermediaries, for example proxies, if it's available. + ServerAddressKey = attribute.Key("server.address") + + // ServerPortKey is the attribute Key conforming to the "server.port" semantic + // conventions. It represents the server port number. + // + // Type: int + // RequirementLevel: Recommended + // Stability: Stable + // + // Examples: 80, 8080, 443 + // Note: When observed from the client side, and when communicating through an + // intermediary, `server.port` SHOULD represent the server port behind any + // intermediaries, for example proxies, if it's available. + ServerPortKey = attribute.Key("server.port") +) + +// ServerAddress returns an attribute KeyValue conforming to the "server.address" +// semantic conventions. It represents the server domain name if available +// without reverse DNS lookup; otherwise, IP address or Unix domain socket name. +func ServerAddress(val string) attribute.KeyValue { + return ServerAddressKey.String(val) +} + +// ServerPort returns an attribute KeyValue conforming to the "server.port" +// semantic conventions. It represents the server port number. +func ServerPort(val int) attribute.KeyValue { + return ServerPortKey.Int(val) +} + +// Namespace: service +const ( + // ServiceCriticalityKey is the attribute Key conforming to the + // "service.criticality" semantic conventions. It represents the operational + // criticality of the service. + // + // Type: Enum + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: "critical", "high", "medium", "low" + // Note: Application developers are encouraged to set `service.criticality` to + // express the operational importance of their services. Telemetry consumers MAY + // use this attribute to optimize telemetry collection or improve user + // experience. + ServiceCriticalityKey = attribute.Key("service.criticality") + + // ServiceInstanceIDKey is the attribute Key conforming to the + // "service.instance.id" semantic conventions. It represents the string ID of + // the service instance. + // + // Type: string + // RequirementLevel: Recommended + // Stability: Stable + // + // Examples: "627cc493-f310-47de-96bd-71410b7dec09" + // Note: MUST be unique for each instance of the same + // `service.namespace,service.name` pair (in other words + // `service.namespace,service.name,service.instance.id` triplet MUST be globally + // unique). The ID helps to + // distinguish instances of the same service that exist at the same time (e.g. + // instances of a horizontally scaled + // service). + // + // Implementations, such as SDKs, are recommended to generate a random Version 1 + // or Version 4 [RFC + // 4122] UUID, but are free to use an inherent unique ID as + // the source of + // this value if stability is desirable. In that case, the ID SHOULD be used as + // source of a UUID Version 5 and + // SHOULD use the following UUID as the namespace: + // `4d63009a-8d0f-11ee-aad7-4c796ed8e320`. + // + // UUIDs are typically recommended, as only an opaque value for the purposes of + // identifying a service instance is + // needed. Similar to what can be seen in the man page for the + // [`/etc/machine-id`] file, the underlying + // data, such as pod name and namespace should be treated as confidential, being + // the user's choice to expose it + // or not via another resource attribute. + // + // For applications running behind an application server (like unicorn), we do + // not recommend using one identifier + // for all processes participating in the application. Instead, it's recommended + // each division (e.g. a worker + // thread in unicorn) to have its own instance.id. + // + // It's not recommended for a Collector to set `service.instance.id` if it can't + // unambiguously determine the + // service instance that is generating that telemetry. For instance, creating an + // UUID based on `pod.name` will + // likely be wrong, as the Collector might not know from which container within + // that pod the telemetry originated. + // However, Collectors can set the `service.instance.id` if they can + // unambiguously determine the service instance + // for that telemetry. This is typically the case for scraping receivers, as + // they know the target address and + // port. + // + // [RFC + // 4122]: https://www.ietf.org/rfc/rfc4122.txt + // [`/etc/machine-id`]: https://www.freedesktop.org/software/systemd/man/latest/machine-id.html + ServiceInstanceIDKey = attribute.Key("service.instance.id") + + // ServiceNameKey is the attribute Key conforming to the "service.name" semantic + // conventions. It represents the logical name of the service. + // + // Type: string + // RequirementLevel: Recommended + // Stability: Stable + // + // Examples: "shoppingcart" + // Note: MUST be the same for all instances of horizontally scaled services. If + // the value was not specified, SDKs MUST fallback to `unknown_service:` + // concatenated with [`process.executable.name`], e.g. `unknown_service:bash`. + // If `process.executable.name` is not available, the value MUST be set to + // `unknown_service`. + // + // [`process.executable.name`]: process.md + ServiceNameKey = attribute.Key("service.name") + + // ServiceNamespaceKey is the attribute Key conforming to the + // "service.namespace" semantic conventions. It represents a namespace for + // `service.name`. + // + // Type: string + // RequirementLevel: Recommended + // Stability: Stable + // + // Examples: "Shop" + // Note: A string value having a meaning that helps to distinguish a group of + // services, for example the team name that owns a group of services. + // `service.name` is expected to be unique within the same namespace. If + // `service.namespace` is not specified in the Resource then `service.name` is + // expected to be unique for all services that have no explicit namespace + // defined (so the empty/unspecified namespace is simply one more valid + // namespace). Zero-length namespace string is assumed equal to unspecified + // namespace. + ServiceNamespaceKey = attribute.Key("service.namespace") + + // ServicePeerNameKey is the attribute Key conforming to the "service.peer.name" + // semantic conventions. It represents the logical name of the service on the + // other side of the connection. SHOULD be equal to the actual [`service.name`] + // resource attribute of the remote service if any. + // + // Type: string + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: "shoppingcart" + // + // [`service.name`]: /docs/resource/README.md#service + ServicePeerNameKey = attribute.Key("service.peer.name") + + // ServicePeerNamespaceKey is the attribute Key conforming to the + // "service.peer.namespace" semantic conventions. It represents the logical + // namespace of the service on the other side of the connection. SHOULD be equal + // to the actual [`service.namespace`] resource attribute of the remote service + // if any. + // + // Type: string + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: "Shop" + // + // [`service.namespace`]: /docs/resource/README.md#service + ServicePeerNamespaceKey = attribute.Key("service.peer.namespace") + + // ServiceVersionKey is the attribute Key conforming to the "service.version" + // semantic conventions. It represents the version string of the service + // component. The format is not defined by these conventions. + // + // Type: string + // RequirementLevel: Recommended + // Stability: Stable + // + // Examples: "2.0.0", "a01dbef8a" + ServiceVersionKey = attribute.Key("service.version") +) + +// ServiceInstanceID returns an attribute KeyValue conforming to the +// "service.instance.id" semantic conventions. It represents the string ID of the +// service instance. +func ServiceInstanceID(val string) attribute.KeyValue { + return ServiceInstanceIDKey.String(val) +} + +// ServiceName returns an attribute KeyValue conforming to the "service.name" +// semantic conventions. It represents the logical name of the service. +func ServiceName(val string) attribute.KeyValue { + return ServiceNameKey.String(val) +} + +// ServiceNamespace returns an attribute KeyValue conforming to the +// "service.namespace" semantic conventions. It represents a namespace for +// `service.name`. +func ServiceNamespace(val string) attribute.KeyValue { + return ServiceNamespaceKey.String(val) +} + +// ServicePeerName returns an attribute KeyValue conforming to the +// "service.peer.name" semantic conventions. It represents the logical name of +// the service on the other side of the connection. SHOULD be equal to the actual +// [`service.name`] resource attribute of the remote service if any. +// +// [`service.name`]: /docs/resource/README.md#service +func ServicePeerName(val string) attribute.KeyValue { + return ServicePeerNameKey.String(val) +} + +// ServicePeerNamespace returns an attribute KeyValue conforming to the +// "service.peer.namespace" semantic conventions. It represents the logical +// namespace of the service on the other side of the connection. SHOULD be equal +// to the actual [`service.namespace`] resource attribute of the remote service +// if any. +// +// [`service.namespace`]: /docs/resource/README.md#service +func ServicePeerNamespace(val string) attribute.KeyValue { + return ServicePeerNamespaceKey.String(val) +} + +// ServiceVersion returns an attribute KeyValue conforming to the +// "service.version" semantic conventions. It represents the version string of +// the service component. The format is not defined by these conventions. +func ServiceVersion(val string) attribute.KeyValue { + return ServiceVersionKey.String(val) +} + +// Enum values for service.criticality +var ( + // Service is business-critical; downtime directly impacts revenue, user + // experience, or core functionality. + // + // Stability: development + ServiceCriticalityCritical = ServiceCriticalityKey.String("critical") + // Service is important but has degradation tolerance or fallback mechanisms. + // + // Stability: development + ServiceCriticalityHigh = ServiceCriticalityKey.String("high") + // Service provides supplementary functionality; degradation has limited user + // impact. + // + // Stability: development + ServiceCriticalityMedium = ServiceCriticalityKey.String("medium") + // Service is non-essential to core operations; used for background tasks or + // internal tools. + // + // Stability: development + ServiceCriticalityLow = ServiceCriticalityKey.String("low") +) + +// Namespace: session +const ( + // SessionIDKey is the attribute Key conforming to the "session.id" semantic + // conventions. It represents a unique id to identify a session. + // + // Type: string + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: 00112233-4455-6677-8899-aabbccddeeff + SessionIDKey = attribute.Key("session.id") + + // SessionPreviousIDKey is the attribute Key conforming to the + // "session.previous_id" semantic conventions. It represents the previous + // `session.id` for this user, when known. + // + // Type: string + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: 00112233-4455-6677-8899-aabbccddeeff + SessionPreviousIDKey = attribute.Key("session.previous_id") +) + +// SessionID returns an attribute KeyValue conforming to the "session.id" +// semantic conventions. It represents a unique id to identify a session. +func SessionID(val string) attribute.KeyValue { + return SessionIDKey.String(val) +} + +// SessionPreviousID returns an attribute KeyValue conforming to the +// "session.previous_id" semantic conventions. It represents the previous +// `session.id` for this user, when known. +func SessionPreviousID(val string) attribute.KeyValue { + return SessionPreviousIDKey.String(val) +} + +// Namespace: signalr +const ( + // SignalRConnectionStatusKey is the attribute Key conforming to the + // "signalr.connection.status" semantic conventions. It represents the signalR + // HTTP connection closure status. + // + // Type: Enum + // RequirementLevel: Recommended + // Stability: Stable + // + // Examples: "app_shutdown", "timeout" + SignalRConnectionStatusKey = attribute.Key("signalr.connection.status") + + // SignalRTransportKey is the attribute Key conforming to the + // "signalr.transport" semantic conventions. It represents the + // [SignalR transport type]. + // + // Type: Enum + // RequirementLevel: Recommended + // Stability: Stable + // + // Examples: "web_sockets", "long_polling" + // + // [SignalR transport type]: https://github.com/dotnet/aspnetcore/blob/main/src/SignalR/docs/specs/TransportProtocols.md + SignalRTransportKey = attribute.Key("signalr.transport") +) + +// Enum values for signalr.connection.status +var ( + // The connection was closed normally. + // Stability: stable + SignalRConnectionStatusNormalClosure = SignalRConnectionStatusKey.String("normal_closure") + // The connection was closed due to a timeout. + // Stability: stable + SignalRConnectionStatusTimeout = SignalRConnectionStatusKey.String("timeout") + // The connection was closed because the app is shutting down. + // Stability: stable + SignalRConnectionStatusAppShutdown = SignalRConnectionStatusKey.String("app_shutdown") +) + +// Enum values for signalr.transport +var ( + // ServerSentEvents protocol + // Stability: stable + SignalRTransportServerSentEvents = SignalRTransportKey.String("server_sent_events") + // LongPolling protocol + // Stability: stable + SignalRTransportLongPolling = SignalRTransportKey.String("long_polling") + // WebSockets protocol + // Stability: stable + SignalRTransportWebSockets = SignalRTransportKey.String("web_sockets") +) + +// Namespace: source +const ( + // SourceAddressKey is the attribute Key conforming to the "source.address" + // semantic conventions. It represents the source address - domain name if + // available without reverse DNS lookup; otherwise, IP address or Unix domain + // socket name. + // + // Type: string + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: "source.example.com", "10.1.2.80", "/tmp/my.sock" + // Note: When observed from the destination side, and when communicating through + // an intermediary, `source.address` SHOULD represent the source address behind + // any intermediaries, for example proxies, if it's available. + SourceAddressKey = attribute.Key("source.address") + + // SourcePortKey is the attribute Key conforming to the "source.port" semantic + // conventions. It represents the source port number. + // + // Type: int + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: 3389, 2888 + SourcePortKey = attribute.Key("source.port") +) + +// SourceAddress returns an attribute KeyValue conforming to the "source.address" +// semantic conventions. It represents the source address - domain name if +// available without reverse DNS lookup; otherwise, IP address or Unix domain +// socket name. +func SourceAddress(val string) attribute.KeyValue { + return SourceAddressKey.String(val) +} + +// SourcePort returns an attribute KeyValue conforming to the "source.port" +// semantic conventions. It represents the source port number. +func SourcePort(val int) attribute.KeyValue { + return SourcePortKey.Int(val) +} + +// Namespace: system +const ( + // SystemDeviceKey is the attribute Key conforming to the "system.device" + // semantic conventions. It represents the device identifier. + // + // Type: string + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: "(identifier)" + SystemDeviceKey = attribute.Key("system.device") + + // SystemFilesystemModeKey is the attribute Key conforming to the + // "system.filesystem.mode" semantic conventions. It represents the filesystem + // mode. + // + // Type: string + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: "rw, ro" + SystemFilesystemModeKey = attribute.Key("system.filesystem.mode") + + // SystemFilesystemMountpointKey is the attribute Key conforming to the + // "system.filesystem.mountpoint" semantic conventions. It represents the + // filesystem mount path. + // + // Type: string + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: "/mnt/data" + SystemFilesystemMountpointKey = attribute.Key("system.filesystem.mountpoint") + + // SystemFilesystemStateKey is the attribute Key conforming to the + // "system.filesystem.state" semantic conventions. It represents the filesystem + // state. + // + // Type: Enum + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: "used" + SystemFilesystemStateKey = attribute.Key("system.filesystem.state") + + // SystemFilesystemTypeKey is the attribute Key conforming to the + // "system.filesystem.type" semantic conventions. It represents the filesystem + // type. + // + // Type: Enum + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: "ext4" + SystemFilesystemTypeKey = attribute.Key("system.filesystem.type") + + // SystemMemoryLinuxSlabStateKey is the attribute Key conforming to the + // "system.memory.linux.slab.state" semantic conventions. It represents the + // Linux Slab memory state. + // + // Type: Enum + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: "reclaimable", "unreclaimable" + SystemMemoryLinuxSlabStateKey = attribute.Key("system.memory.linux.slab.state") + + // SystemMemoryStateKey is the attribute Key conforming to the + // "system.memory.state" semantic conventions. It represents the memory state. + // + // Type: Enum + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: "free", "cached" + SystemMemoryStateKey = attribute.Key("system.memory.state") + + // SystemPagingDirectionKey is the attribute Key conforming to the + // "system.paging.direction" semantic conventions. It represents the paging + // access direction. + // + // Type: Enum + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: "in" + SystemPagingDirectionKey = attribute.Key("system.paging.direction") + + // SystemPagingFaultTypeKey is the attribute Key conforming to the + // "system.paging.fault.type" semantic conventions. It represents the paging + // fault type. + // + // Type: Enum + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: "minor" + SystemPagingFaultTypeKey = attribute.Key("system.paging.fault.type") + + // SystemPagingStateKey is the attribute Key conforming to the + // "system.paging.state" semantic conventions. It represents the memory paging + // state. + // + // Type: Enum + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: "free" + SystemPagingStateKey = attribute.Key("system.paging.state") +) + +// SystemDevice returns an attribute KeyValue conforming to the "system.device" +// semantic conventions. It represents the device identifier. +func SystemDevice(val string) attribute.KeyValue { + return SystemDeviceKey.String(val) +} + +// SystemFilesystemMode returns an attribute KeyValue conforming to the +// "system.filesystem.mode" semantic conventions. It represents the filesystem +// mode. +func SystemFilesystemMode(val string) attribute.KeyValue { + return SystemFilesystemModeKey.String(val) +} + +// SystemFilesystemMountpoint returns an attribute KeyValue conforming to the +// "system.filesystem.mountpoint" semantic conventions. It represents the +// filesystem mount path. +func SystemFilesystemMountpoint(val string) attribute.KeyValue { + return SystemFilesystemMountpointKey.String(val) +} + +// Enum values for system.filesystem.state +var ( + // used + // Stability: development + SystemFilesystemStateUsed = SystemFilesystemStateKey.String("used") + // free + // Stability: development + SystemFilesystemStateFree = SystemFilesystemStateKey.String("free") + // reserved + // Stability: development + SystemFilesystemStateReserved = SystemFilesystemStateKey.String("reserved") +) + +// Enum values for system.filesystem.type +var ( + // fat32 + // Stability: development + SystemFilesystemTypeFat32 = SystemFilesystemTypeKey.String("fat32") + // exfat + // Stability: development + SystemFilesystemTypeExfat = SystemFilesystemTypeKey.String("exfat") + // ntfs + // Stability: development + SystemFilesystemTypeNtfs = SystemFilesystemTypeKey.String("ntfs") + // refs + // Stability: development + SystemFilesystemTypeRefs = SystemFilesystemTypeKey.String("refs") + // hfsplus + // Stability: development + SystemFilesystemTypeHfsplus = SystemFilesystemTypeKey.String("hfsplus") + // ext4 + // Stability: development + SystemFilesystemTypeExt4 = SystemFilesystemTypeKey.String("ext4") +) + +// Enum values for system.memory.linux.slab.state +var ( + // reclaimable + // Stability: development + SystemMemoryLinuxSlabStateReclaimable = SystemMemoryLinuxSlabStateKey.String("reclaimable") + // unreclaimable + // Stability: development + SystemMemoryLinuxSlabStateUnreclaimable = SystemMemoryLinuxSlabStateKey.String("unreclaimable") +) + +// Enum values for system.memory.state +var ( + // Actual used virtual memory in bytes. + // Stability: development + SystemMemoryStateUsed = SystemMemoryStateKey.String("used") + // free + // Stability: development + SystemMemoryStateFree = SystemMemoryStateKey.String("free") + // buffers + // Stability: development + SystemMemoryStateBuffers = SystemMemoryStateKey.String("buffers") + // cached + // Stability: development + SystemMemoryStateCached = SystemMemoryStateKey.String("cached") +) + +// Enum values for system.paging.direction +var ( + // in + // Stability: development + SystemPagingDirectionIn = SystemPagingDirectionKey.String("in") + // out + // Stability: development + SystemPagingDirectionOut = SystemPagingDirectionKey.String("out") +) + +// Enum values for system.paging.fault.type +var ( + // major + // Stability: development + SystemPagingFaultTypeMajor = SystemPagingFaultTypeKey.String("major") + // minor + // Stability: development + SystemPagingFaultTypeMinor = SystemPagingFaultTypeKey.String("minor") +) + +// Enum values for system.paging.state +var ( + // used + // Stability: development + SystemPagingStateUsed = SystemPagingStateKey.String("used") + // free + // Stability: development + SystemPagingStateFree = SystemPagingStateKey.String("free") +) + +// Namespace: telemetry +const ( + // TelemetryDistroNameKey is the attribute Key conforming to the + // "telemetry.distro.name" semantic conventions. It represents the name of the + // auto instrumentation agent or distribution, if used. + // + // Type: string + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: "parts-unlimited-java" + // Note: Official auto instrumentation agents and distributions SHOULD set the + // `telemetry.distro.name` attribute to + // a string starting with `opentelemetry-`, e.g. + // `opentelemetry-java-instrumentation`. + TelemetryDistroNameKey = attribute.Key("telemetry.distro.name") + + // TelemetryDistroVersionKey is the attribute Key conforming to the + // "telemetry.distro.version" semantic conventions. It represents the version + // string of the auto instrumentation agent or distribution, if used. + // + // Type: string + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: "1.2.3" + TelemetryDistroVersionKey = attribute.Key("telemetry.distro.version") + + // TelemetrySDKLanguageKey is the attribute Key conforming to the + // "telemetry.sdk.language" semantic conventions. It represents the language of + // the telemetry SDK. + // + // Type: Enum + // RequirementLevel: Recommended + // Stability: Stable + // + // Examples: + TelemetrySDKLanguageKey = attribute.Key("telemetry.sdk.language") + + // TelemetrySDKNameKey is the attribute Key conforming to the + // "telemetry.sdk.name" semantic conventions. It represents the name of the + // telemetry SDK as defined above. + // + // Type: string + // RequirementLevel: Recommended + // Stability: Stable + // + // Examples: "opentelemetry" + // Note: The OpenTelemetry SDK MUST set the `telemetry.sdk.name` attribute to + // `opentelemetry`. + // If another SDK, like a fork or a vendor-provided implementation, is used, + // this SDK MUST set the + // `telemetry.sdk.name` attribute to the fully-qualified class or module name of + // this SDK's main entry point + // or another suitable identifier depending on the language. + // The identifier `opentelemetry` is reserved and MUST NOT be used in this case. + // All custom identifiers SHOULD be stable across different versions of an + // implementation. + TelemetrySDKNameKey = attribute.Key("telemetry.sdk.name") + + // TelemetrySDKVersionKey is the attribute Key conforming to the + // "telemetry.sdk.version" semantic conventions. It represents the version + // string of the telemetry SDK. + // + // Type: string + // RequirementLevel: Recommended + // Stability: Stable + // + // Examples: "1.2.3" + TelemetrySDKVersionKey = attribute.Key("telemetry.sdk.version") +) + +// TelemetryDistroName returns an attribute KeyValue conforming to the +// "telemetry.distro.name" semantic conventions. It represents the name of the +// auto instrumentation agent or distribution, if used. +func TelemetryDistroName(val string) attribute.KeyValue { + return TelemetryDistroNameKey.String(val) +} + +// TelemetryDistroVersion returns an attribute KeyValue conforming to the +// "telemetry.distro.version" semantic conventions. It represents the version +// string of the auto instrumentation agent or distribution, if used. +func TelemetryDistroVersion(val string) attribute.KeyValue { + return TelemetryDistroVersionKey.String(val) +} + +// TelemetrySDKName returns an attribute KeyValue conforming to the +// "telemetry.sdk.name" semantic conventions. It represents the name of the +// telemetry SDK as defined above. +func TelemetrySDKName(val string) attribute.KeyValue { + return TelemetrySDKNameKey.String(val) +} + +// TelemetrySDKVersion returns an attribute KeyValue conforming to the +// "telemetry.sdk.version" semantic conventions. It represents the version string +// of the telemetry SDK. +func TelemetrySDKVersion(val string) attribute.KeyValue { + return TelemetrySDKVersionKey.String(val) +} + +// Enum values for telemetry.sdk.language +var ( + // cpp + // Stability: stable + TelemetrySDKLanguageCPP = TelemetrySDKLanguageKey.String("cpp") + // dotnet + // Stability: stable + TelemetrySDKLanguageDotnet = TelemetrySDKLanguageKey.String("dotnet") + // erlang + // Stability: stable + TelemetrySDKLanguageErlang = TelemetrySDKLanguageKey.String("erlang") + // go + // Stability: stable + TelemetrySDKLanguageGo = TelemetrySDKLanguageKey.String("go") + // java + // Stability: stable + TelemetrySDKLanguageJava = TelemetrySDKLanguageKey.String("java") + // nodejs + // Stability: stable + TelemetrySDKLanguageNodejs = TelemetrySDKLanguageKey.String("nodejs") + // php + // Stability: stable + TelemetrySDKLanguagePHP = TelemetrySDKLanguageKey.String("php") + // python + // Stability: stable + TelemetrySDKLanguagePython = TelemetrySDKLanguageKey.String("python") + // ruby + // Stability: stable + TelemetrySDKLanguageRuby = TelemetrySDKLanguageKey.String("ruby") + // rust + // Stability: stable + TelemetrySDKLanguageRust = TelemetrySDKLanguageKey.String("rust") + // swift + // Stability: stable + TelemetrySDKLanguageSwift = TelemetrySDKLanguageKey.String("swift") + // webjs + // Stability: stable + TelemetrySDKLanguageWebJS = TelemetrySDKLanguageKey.String("webjs") +) + +// Namespace: test +const ( + // TestCaseNameKey is the attribute Key conforming to the "test.case.name" + // semantic conventions. It represents the fully qualified human readable name + // of the [test case]. + // + // Type: string + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: "org.example.TestCase1.test1", "example/tests/TestCase1.test1", + // "ExampleTestCase1_test1" + // + // [test case]: https://wikipedia.org/wiki/Test_case + TestCaseNameKey = attribute.Key("test.case.name") + + // TestCaseResultStatusKey is the attribute Key conforming to the + // "test.case.result.status" semantic conventions. It represents the status of + // the actual test case result from test execution. + // + // Type: Enum + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: "pass", "fail" + TestCaseResultStatusKey = attribute.Key("test.case.result.status") + + // TestSuiteNameKey is the attribute Key conforming to the "test.suite.name" + // semantic conventions. It represents the human readable name of a [test suite] + // . + // + // Type: string + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: "TestSuite1" + // + // [test suite]: https://wikipedia.org/wiki/Test_suite + TestSuiteNameKey = attribute.Key("test.suite.name") + + // TestSuiteRunStatusKey is the attribute Key conforming to the + // "test.suite.run.status" semantic conventions. It represents the status of the + // test suite run. + // + // Type: Enum + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: "success", "failure", "skipped", "aborted", "timed_out", + // "in_progress" + TestSuiteRunStatusKey = attribute.Key("test.suite.run.status") +) + +// TestCaseName returns an attribute KeyValue conforming to the "test.case.name" +// semantic conventions. It represents the fully qualified human readable name of +// the [test case]. +// +// [test case]: https://wikipedia.org/wiki/Test_case +func TestCaseName(val string) attribute.KeyValue { + return TestCaseNameKey.String(val) +} + +// TestSuiteName returns an attribute KeyValue conforming to the +// "test.suite.name" semantic conventions. It represents the human readable name +// of a [test suite]. +// +// [test suite]: https://wikipedia.org/wiki/Test_suite +func TestSuiteName(val string) attribute.KeyValue { + return TestSuiteNameKey.String(val) +} + +// Enum values for test.case.result.status +var ( + // pass + // Stability: development + TestCaseResultStatusPass = TestCaseResultStatusKey.String("pass") + // fail + // Stability: development + TestCaseResultStatusFail = TestCaseResultStatusKey.String("fail") +) + +// Enum values for test.suite.run.status +var ( + // success + // Stability: development + TestSuiteRunStatusSuccess = TestSuiteRunStatusKey.String("success") + // failure + // Stability: development + TestSuiteRunStatusFailure = TestSuiteRunStatusKey.String("failure") + // skipped + // Stability: development + TestSuiteRunStatusSkipped = TestSuiteRunStatusKey.String("skipped") + // aborted + // Stability: development + TestSuiteRunStatusAborted = TestSuiteRunStatusKey.String("aborted") + // timed_out + // Stability: development + TestSuiteRunStatusTimedOut = TestSuiteRunStatusKey.String("timed_out") + // in_progress + // Stability: development + TestSuiteRunStatusInProgress = TestSuiteRunStatusKey.String("in_progress") +) + +// Namespace: thread +const ( + // ThreadIDKey is the attribute Key conforming to the "thread.id" semantic + // conventions. It represents the current "managed" thread ID (as opposed to OS + // thread ID). + // + // Type: int + // RequirementLevel: Recommended + // Stability: Development + // + // Note: + // Examples of where the value can be extracted from: + // + // | Language or platform | Source | + // | --- | --- | + // | JVM | `Thread.currentThread().threadId()` | + // | .NET | `Thread.CurrentThread.ManagedThreadId` | + // | Python | `threading.current_thread().ident` | + // | Ruby | `Thread.current.object_id` | + // | C++ | `std::this_thread::get_id()` | + // | Erlang | `erlang:self()` | + ThreadIDKey = attribute.Key("thread.id") + + // ThreadNameKey is the attribute Key conforming to the "thread.name" semantic + // conventions. It represents the current thread name. + // + // Type: string + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: main + // Note: + // Examples of where the value can be extracted from: + // + // | Language or platform | Source | + // | --- | --- | + // | JVM | `Thread.currentThread().getName()` | + // | .NET | `Thread.CurrentThread.Name` | + // | Python | `threading.current_thread().name` | + // | Ruby | `Thread.current.name` | + // | Erlang | `erlang:process_info(self(), registered_name)` | + ThreadNameKey = attribute.Key("thread.name") +) + +// ThreadID returns an attribute KeyValue conforming to the "thread.id" semantic +// conventions. It represents the current "managed" thread ID (as opposed to OS +// thread ID). +func ThreadID(val int) attribute.KeyValue { + return ThreadIDKey.Int(val) +} + +// ThreadName returns an attribute KeyValue conforming to the "thread.name" +// semantic conventions. It represents the current thread name. +func ThreadName(val string) attribute.KeyValue { + return ThreadNameKey.String(val) +} + +// Namespace: tls +const ( + // TLSCipherKey is the attribute Key conforming to the "tls.cipher" semantic + // conventions. It represents the string indicating the [cipher] used during the + // current connection. + // + // Type: string + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: "TLS_RSA_WITH_3DES_EDE_CBC_SHA", + // "TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256" + // Note: The values allowed for `tls.cipher` MUST be one of the `Descriptions` + // of the [registered TLS Cipher Suits]. + // + // [cipher]: https://datatracker.ietf.org/doc/html/rfc5246#appendix-A.5 + // [registered TLS Cipher Suits]: https://www.iana.org/assignments/tls-parameters/tls-parameters.xhtml#table-tls-parameters-4 + TLSCipherKey = attribute.Key("tls.cipher") + + // TLSClientCertificateKey is the attribute Key conforming to the + // "tls.client.certificate" semantic conventions. It represents the PEM-encoded + // stand-alone certificate offered by the client. This is usually + // mutually-exclusive of `client.certificate_chain` since this value also exists + // in that list. + // + // Type: string + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: "MII..." + TLSClientCertificateKey = attribute.Key("tls.client.certificate") + + // TLSClientCertificateChainKey is the attribute Key conforming to the + // "tls.client.certificate_chain" semantic conventions. It represents the array + // of PEM-encoded certificates that make up the certificate chain offered by the + // client. This is usually mutually-exclusive of `client.certificate` since that + // value should be the first certificate in the chain. + // + // Type: string[] + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: "MII...", "MI..." + TLSClientCertificateChainKey = attribute.Key("tls.client.certificate_chain") + + // TLSClientHashMd5Key is the attribute Key conforming to the + // "tls.client.hash.md5" semantic conventions. It represents the certificate + // fingerprint using the MD5 digest of DER-encoded version of certificate + // offered by the client. For consistency with other hash values, this value + // should be formatted as an uppercase hash. + // + // Type: string + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: "0F76C7F2C55BFD7D8E8B8F4BFBF0C9EC" + TLSClientHashMd5Key = attribute.Key("tls.client.hash.md5") + + // TLSClientHashSha1Key is the attribute Key conforming to the + // "tls.client.hash.sha1" semantic conventions. It represents the certificate + // fingerprint using the SHA1 digest of DER-encoded version of certificate + // offered by the client. For consistency with other hash values, this value + // should be formatted as an uppercase hash. + // + // Type: string + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: "9E393D93138888D288266C2D915214D1D1CCEB2A" + TLSClientHashSha1Key = attribute.Key("tls.client.hash.sha1") + + // TLSClientHashSha256Key is the attribute Key conforming to the + // "tls.client.hash.sha256" semantic conventions. It represents the certificate + // fingerprint using the SHA256 digest of DER-encoded version of certificate + // offered by the client. For consistency with other hash values, this value + // should be formatted as an uppercase hash. + // + // Type: string + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: "0687F666A054EF17A08E2F2162EAB4CBC0D265E1D7875BE74BF3C712CA92DAF0" + TLSClientHashSha256Key = attribute.Key("tls.client.hash.sha256") + + // TLSClientIssuerKey is the attribute Key conforming to the "tls.client.issuer" + // semantic conventions. It represents the distinguished name of [subject] of + // the issuer of the x.509 certificate presented by the client. + // + // Type: string + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: "CN=Example Root CA, OU=Infrastructure Team, DC=example, DC=com" + // + // [subject]: https://datatracker.ietf.org/doc/html/rfc5280#section-4.1.2.6 + TLSClientIssuerKey = attribute.Key("tls.client.issuer") + + // TLSClientJa3Key is the attribute Key conforming to the "tls.client.ja3" + // semantic conventions. It represents a hash that identifies clients based on + // how they perform an SSL/TLS handshake. + // + // Type: string + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: "d4e5b18d6b55c71272893221c96ba240" + TLSClientJa3Key = attribute.Key("tls.client.ja3") + + // TLSClientNotAfterKey is the attribute Key conforming to the + // "tls.client.not_after" semantic conventions. It represents the date/Time + // indicating when client certificate is no longer considered valid. + // + // Type: string + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: "2021-01-01T00:00:00.000Z" + TLSClientNotAfterKey = attribute.Key("tls.client.not_after") + + // TLSClientNotBeforeKey is the attribute Key conforming to the + // "tls.client.not_before" semantic conventions. It represents the date/Time + // indicating when client certificate is first considered valid. + // + // Type: string + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: "1970-01-01T00:00:00.000Z" + TLSClientNotBeforeKey = attribute.Key("tls.client.not_before") + + // TLSClientSubjectKey is the attribute Key conforming to the + // "tls.client.subject" semantic conventions. It represents the distinguished + // name of subject of the x.509 certificate presented by the client. + // + // Type: string + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: "CN=myclient, OU=Documentation Team, DC=example, DC=com" + TLSClientSubjectKey = attribute.Key("tls.client.subject") + + // TLSClientSupportedCiphersKey is the attribute Key conforming to the + // "tls.client.supported_ciphers" semantic conventions. It represents the array + // of ciphers offered by the client during the client hello. + // + // Type: string[] + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: "TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384", + // "TLS_ECDHE_ECDSA_WITH_AES_256_GCM_SHA384" + TLSClientSupportedCiphersKey = attribute.Key("tls.client.supported_ciphers") + + // TLSCurveKey is the attribute Key conforming to the "tls.curve" semantic + // conventions. It represents the string indicating the curve used for the given + // cipher, when applicable. + // + // Type: string + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: "secp256r1" + TLSCurveKey = attribute.Key("tls.curve") + + // TLSEstablishedKey is the attribute Key conforming to the "tls.established" + // semantic conventions. It represents the boolean flag indicating if the TLS + // negotiation was successful and transitioned to an encrypted tunnel. + // + // Type: boolean + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: true + TLSEstablishedKey = attribute.Key("tls.established") + + // TLSNextProtocolKey is the attribute Key conforming to the "tls.next_protocol" + // semantic conventions. It represents the string indicating the protocol being + // tunneled. Per the values in the [IANA registry], this string should be lower + // case. + // + // Type: string + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: "http/1.1" + // + // [IANA registry]: https://www.iana.org/assignments/tls-extensiontype-values/tls-extensiontype-values.xhtml#alpn-protocol-ids + TLSNextProtocolKey = attribute.Key("tls.next_protocol") + + // TLSProtocolNameKey is the attribute Key conforming to the "tls.protocol.name" + // semantic conventions. It represents the normalized lowercase protocol name + // parsed from original string of the negotiated [SSL/TLS protocol version]. + // + // Type: Enum + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: + // + // [SSL/TLS protocol version]: https://docs.openssl.org/1.1.1/man3/SSL_get_version/#return-values + TLSProtocolNameKey = attribute.Key("tls.protocol.name") + + // TLSProtocolVersionKey is the attribute Key conforming to the + // "tls.protocol.version" semantic conventions. It represents the numeric part + // of the version parsed from the original string of the negotiated + // [SSL/TLS protocol version]. + // + // Type: string + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: "1.2", "3" + // + // [SSL/TLS protocol version]: https://docs.openssl.org/1.1.1/man3/SSL_get_version/#return-values + TLSProtocolVersionKey = attribute.Key("tls.protocol.version") + + // TLSResumedKey is the attribute Key conforming to the "tls.resumed" semantic + // conventions. It represents the boolean flag indicating if this TLS connection + // was resumed from an existing TLS negotiation. + // + // Type: boolean + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: true + TLSResumedKey = attribute.Key("tls.resumed") + + // TLSServerCertificateKey is the attribute Key conforming to the + // "tls.server.certificate" semantic conventions. It represents the PEM-encoded + // stand-alone certificate offered by the server. This is usually + // mutually-exclusive of `server.certificate_chain` since this value also exists + // in that list. + // + // Type: string + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: "MII..." + TLSServerCertificateKey = attribute.Key("tls.server.certificate") + + // TLSServerCertificateChainKey is the attribute Key conforming to the + // "tls.server.certificate_chain" semantic conventions. It represents the array + // of PEM-encoded certificates that make up the certificate chain offered by the + // server. This is usually mutually-exclusive of `server.certificate` since that + // value should be the first certificate in the chain. + // + // Type: string[] + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: "MII...", "MI..." + TLSServerCertificateChainKey = attribute.Key("tls.server.certificate_chain") + + // TLSServerHashMd5Key is the attribute Key conforming to the + // "tls.server.hash.md5" semantic conventions. It represents the certificate + // fingerprint using the MD5 digest of DER-encoded version of certificate + // offered by the server. For consistency with other hash values, this value + // should be formatted as an uppercase hash. + // + // Type: string + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: "0F76C7F2C55BFD7D8E8B8F4BFBF0C9EC" + TLSServerHashMd5Key = attribute.Key("tls.server.hash.md5") + + // TLSServerHashSha1Key is the attribute Key conforming to the + // "tls.server.hash.sha1" semantic conventions. It represents the certificate + // fingerprint using the SHA1 digest of DER-encoded version of certificate + // offered by the server. For consistency with other hash values, this value + // should be formatted as an uppercase hash. + // + // Type: string + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: "9E393D93138888D288266C2D915214D1D1CCEB2A" + TLSServerHashSha1Key = attribute.Key("tls.server.hash.sha1") + + // TLSServerHashSha256Key is the attribute Key conforming to the + // "tls.server.hash.sha256" semantic conventions. It represents the certificate + // fingerprint using the SHA256 digest of DER-encoded version of certificate + // offered by the server. For consistency with other hash values, this value + // should be formatted as an uppercase hash. + // + // Type: string + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: "0687F666A054EF17A08E2F2162EAB4CBC0D265E1D7875BE74BF3C712CA92DAF0" + TLSServerHashSha256Key = attribute.Key("tls.server.hash.sha256") + + // TLSServerIssuerKey is the attribute Key conforming to the "tls.server.issuer" + // semantic conventions. It represents the distinguished name of [subject] of + // the issuer of the x.509 certificate presented by the client. + // + // Type: string + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: "CN=Example Root CA, OU=Infrastructure Team, DC=example, DC=com" + // + // [subject]: https://datatracker.ietf.org/doc/html/rfc5280#section-4.1.2.6 + TLSServerIssuerKey = attribute.Key("tls.server.issuer") + + // TLSServerJa3sKey is the attribute Key conforming to the "tls.server.ja3s" + // semantic conventions. It represents a hash that identifies servers based on + // how they perform an SSL/TLS handshake. + // + // Type: string + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: "d4e5b18d6b55c71272893221c96ba240" + TLSServerJa3sKey = attribute.Key("tls.server.ja3s") + + // TLSServerNotAfterKey is the attribute Key conforming to the + // "tls.server.not_after" semantic conventions. It represents the date/Time + // indicating when server certificate is no longer considered valid. + // + // Type: string + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: "2021-01-01T00:00:00.000Z" + TLSServerNotAfterKey = attribute.Key("tls.server.not_after") + + // TLSServerNotBeforeKey is the attribute Key conforming to the + // "tls.server.not_before" semantic conventions. It represents the date/Time + // indicating when server certificate is first considered valid. + // + // Type: string + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: "1970-01-01T00:00:00.000Z" + TLSServerNotBeforeKey = attribute.Key("tls.server.not_before") + + // TLSServerSubjectKey is the attribute Key conforming to the + // "tls.server.subject" semantic conventions. It represents the distinguished + // name of subject of the x.509 certificate presented by the server. + // + // Type: string + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: "CN=myserver, OU=Documentation Team, DC=example, DC=com" + TLSServerSubjectKey = attribute.Key("tls.server.subject") +) + +// TLSCipher returns an attribute KeyValue conforming to the "tls.cipher" +// semantic conventions. It represents the string indicating the [cipher] used +// during the current connection. +// +// [cipher]: https://datatracker.ietf.org/doc/html/rfc5246#appendix-A.5 +func TLSCipher(val string) attribute.KeyValue { + return TLSCipherKey.String(val) +} + +// TLSClientCertificate returns an attribute KeyValue conforming to the +// "tls.client.certificate" semantic conventions. It represents the PEM-encoded +// stand-alone certificate offered by the client. This is usually +// mutually-exclusive of `client.certificate_chain` since this value also exists +// in that list. +func TLSClientCertificate(val string) attribute.KeyValue { + return TLSClientCertificateKey.String(val) +} + +// TLSClientCertificateChain returns an attribute KeyValue conforming to the +// "tls.client.certificate_chain" semantic conventions. It represents the array +// of PEM-encoded certificates that make up the certificate chain offered by the +// client. This is usually mutually-exclusive of `client.certificate` since that +// value should be the first certificate in the chain. +func TLSClientCertificateChain(val ...string) attribute.KeyValue { + return TLSClientCertificateChainKey.StringSlice(val) +} + +// TLSClientHashMd5 returns an attribute KeyValue conforming to the +// "tls.client.hash.md5" semantic conventions. It represents the certificate +// fingerprint using the MD5 digest of DER-encoded version of certificate offered +// by the client. For consistency with other hash values, this value should be +// formatted as an uppercase hash. +func TLSClientHashMd5(val string) attribute.KeyValue { + return TLSClientHashMd5Key.String(val) +} + +// TLSClientHashSha1 returns an attribute KeyValue conforming to the +// "tls.client.hash.sha1" semantic conventions. It represents the certificate +// fingerprint using the SHA1 digest of DER-encoded version of certificate +// offered by the client. For consistency with other hash values, this value +// should be formatted as an uppercase hash. +func TLSClientHashSha1(val string) attribute.KeyValue { + return TLSClientHashSha1Key.String(val) +} + +// TLSClientHashSha256 returns an attribute KeyValue conforming to the +// "tls.client.hash.sha256" semantic conventions. It represents the certificate +// fingerprint using the SHA256 digest of DER-encoded version of certificate +// offered by the client. For consistency with other hash values, this value +// should be formatted as an uppercase hash. +func TLSClientHashSha256(val string) attribute.KeyValue { + return TLSClientHashSha256Key.String(val) +} + +// TLSClientIssuer returns an attribute KeyValue conforming to the +// "tls.client.issuer" semantic conventions. It represents the distinguished name +// of [subject] of the issuer of the x.509 certificate presented by the client. +// +// [subject]: https://datatracker.ietf.org/doc/html/rfc5280#section-4.1.2.6 +func TLSClientIssuer(val string) attribute.KeyValue { + return TLSClientIssuerKey.String(val) +} + +// TLSClientJa3 returns an attribute KeyValue conforming to the "tls.client.ja3" +// semantic conventions. It represents a hash that identifies clients based on +// how they perform an SSL/TLS handshake. +func TLSClientJa3(val string) attribute.KeyValue { + return TLSClientJa3Key.String(val) +} + +// TLSClientNotAfter returns an attribute KeyValue conforming to the +// "tls.client.not_after" semantic conventions. It represents the date/Time +// indicating when client certificate is no longer considered valid. +func TLSClientNotAfter(val string) attribute.KeyValue { + return TLSClientNotAfterKey.String(val) +} + +// TLSClientNotBefore returns an attribute KeyValue conforming to the +// "tls.client.not_before" semantic conventions. It represents the date/Time +// indicating when client certificate is first considered valid. +func TLSClientNotBefore(val string) attribute.KeyValue { + return TLSClientNotBeforeKey.String(val) +} + +// TLSClientSubject returns an attribute KeyValue conforming to the +// "tls.client.subject" semantic conventions. It represents the distinguished +// name of subject of the x.509 certificate presented by the client. +func TLSClientSubject(val string) attribute.KeyValue { + return TLSClientSubjectKey.String(val) +} + +// TLSClientSupportedCiphers returns an attribute KeyValue conforming to the +// "tls.client.supported_ciphers" semantic conventions. It represents the array +// of ciphers offered by the client during the client hello. +func TLSClientSupportedCiphers(val ...string) attribute.KeyValue { + return TLSClientSupportedCiphersKey.StringSlice(val) +} + +// TLSCurve returns an attribute KeyValue conforming to the "tls.curve" semantic +// conventions. It represents the string indicating the curve used for the given +// cipher, when applicable. +func TLSCurve(val string) attribute.KeyValue { + return TLSCurveKey.String(val) +} + +// TLSEstablished returns an attribute KeyValue conforming to the +// "tls.established" semantic conventions. It represents the boolean flag +// indicating if the TLS negotiation was successful and transitioned to an +// encrypted tunnel. +func TLSEstablished(val bool) attribute.KeyValue { + return TLSEstablishedKey.Bool(val) +} + +// TLSNextProtocol returns an attribute KeyValue conforming to the +// "tls.next_protocol" semantic conventions. It represents the string indicating +// the protocol being tunneled. Per the values in the [IANA registry], this +// string should be lower case. +// +// [IANA registry]: https://www.iana.org/assignments/tls-extensiontype-values/tls-extensiontype-values.xhtml#alpn-protocol-ids +func TLSNextProtocol(val string) attribute.KeyValue { + return TLSNextProtocolKey.String(val) +} + +// TLSProtocolVersion returns an attribute KeyValue conforming to the +// "tls.protocol.version" semantic conventions. It represents the numeric part of +// the version parsed from the original string of the negotiated +// [SSL/TLS protocol version]. +// +// [SSL/TLS protocol version]: https://docs.openssl.org/1.1.1/man3/SSL_get_version/#return-values +func TLSProtocolVersion(val string) attribute.KeyValue { + return TLSProtocolVersionKey.String(val) +} + +// TLSResumed returns an attribute KeyValue conforming to the "tls.resumed" +// semantic conventions. It represents the boolean flag indicating if this TLS +// connection was resumed from an existing TLS negotiation. +func TLSResumed(val bool) attribute.KeyValue { + return TLSResumedKey.Bool(val) +} + +// TLSServerCertificate returns an attribute KeyValue conforming to the +// "tls.server.certificate" semantic conventions. It represents the PEM-encoded +// stand-alone certificate offered by the server. This is usually +// mutually-exclusive of `server.certificate_chain` since this value also exists +// in that list. +func TLSServerCertificate(val string) attribute.KeyValue { + return TLSServerCertificateKey.String(val) +} + +// TLSServerCertificateChain returns an attribute KeyValue conforming to the +// "tls.server.certificate_chain" semantic conventions. It represents the array +// of PEM-encoded certificates that make up the certificate chain offered by the +// server. This is usually mutually-exclusive of `server.certificate` since that +// value should be the first certificate in the chain. +func TLSServerCertificateChain(val ...string) attribute.KeyValue { + return TLSServerCertificateChainKey.StringSlice(val) +} + +// TLSServerHashMd5 returns an attribute KeyValue conforming to the +// "tls.server.hash.md5" semantic conventions. It represents the certificate +// fingerprint using the MD5 digest of DER-encoded version of certificate offered +// by the server. For consistency with other hash values, this value should be +// formatted as an uppercase hash. +func TLSServerHashMd5(val string) attribute.KeyValue { + return TLSServerHashMd5Key.String(val) +} + +// TLSServerHashSha1 returns an attribute KeyValue conforming to the +// "tls.server.hash.sha1" semantic conventions. It represents the certificate +// fingerprint using the SHA1 digest of DER-encoded version of certificate +// offered by the server. For consistency with other hash values, this value +// should be formatted as an uppercase hash. +func TLSServerHashSha1(val string) attribute.KeyValue { + return TLSServerHashSha1Key.String(val) +} + +// TLSServerHashSha256 returns an attribute KeyValue conforming to the +// "tls.server.hash.sha256" semantic conventions. It represents the certificate +// fingerprint using the SHA256 digest of DER-encoded version of certificate +// offered by the server. For consistency with other hash values, this value +// should be formatted as an uppercase hash. +func TLSServerHashSha256(val string) attribute.KeyValue { + return TLSServerHashSha256Key.String(val) +} + +// TLSServerIssuer returns an attribute KeyValue conforming to the +// "tls.server.issuer" semantic conventions. It represents the distinguished name +// of [subject] of the issuer of the x.509 certificate presented by the client. +// +// [subject]: https://datatracker.ietf.org/doc/html/rfc5280#section-4.1.2.6 +func TLSServerIssuer(val string) attribute.KeyValue { + return TLSServerIssuerKey.String(val) +} + +// TLSServerJa3s returns an attribute KeyValue conforming to the +// "tls.server.ja3s" semantic conventions. It represents a hash that identifies +// servers based on how they perform an SSL/TLS handshake. +func TLSServerJa3s(val string) attribute.KeyValue { + return TLSServerJa3sKey.String(val) +} + +// TLSServerNotAfter returns an attribute KeyValue conforming to the +// "tls.server.not_after" semantic conventions. It represents the date/Time +// indicating when server certificate is no longer considered valid. +func TLSServerNotAfter(val string) attribute.KeyValue { + return TLSServerNotAfterKey.String(val) +} + +// TLSServerNotBefore returns an attribute KeyValue conforming to the +// "tls.server.not_before" semantic conventions. It represents the date/Time +// indicating when server certificate is first considered valid. +func TLSServerNotBefore(val string) attribute.KeyValue { + return TLSServerNotBeforeKey.String(val) +} + +// TLSServerSubject returns an attribute KeyValue conforming to the +// "tls.server.subject" semantic conventions. It represents the distinguished +// name of subject of the x.509 certificate presented by the server. +func TLSServerSubject(val string) attribute.KeyValue { + return TLSServerSubjectKey.String(val) +} + +// Enum values for tls.protocol.name +var ( + // ssl + // Stability: development + TLSProtocolNameSsl = TLSProtocolNameKey.String("ssl") + // tls + // Stability: development + TLSProtocolNameTLS = TLSProtocolNameKey.String("tls") +) + +// Namespace: url +const ( + // URLDomainKey is the attribute Key conforming to the "url.domain" semantic + // conventions. It represents the domain extracted from the `url.full`, such as + // "opentelemetry.io". + // + // Type: string + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: "www.foo.bar", "opentelemetry.io", "3.12.167.2", + // "[1080:0:0:0:8:800:200C:417A]" + // Note: In some cases a URL may refer to an IP and/or port directly, without a + // domain name. In this case, the IP address would go to the domain field. If + // the URL contains a [literal IPv6 address] enclosed by `[` and `]`, the `[` + // and `]` characters should also be captured in the domain field. + // + // [literal IPv6 address]: https://www.rfc-editor.org/rfc/rfc2732#section-2 + URLDomainKey = attribute.Key("url.domain") + + // URLExtensionKey is the attribute Key conforming to the "url.extension" + // semantic conventions. It represents the file extension extracted from the + // `url.full`, excluding the leading dot. + // + // Type: string + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: "png", "gz" + // Note: The file extension is only set if it exists, as not every url has a + // file extension. When the file name has multiple extensions `example.tar.gz`, + // only the last one should be captured `gz`, not `tar.gz`. + URLExtensionKey = attribute.Key("url.extension") + + // URLFragmentKey is the attribute Key conforming to the "url.fragment" semantic + // conventions. It represents the [URI fragment] component. + // + // Type: string + // RequirementLevel: Recommended + // Stability: Stable + // + // Examples: "SemConv" + // + // [URI fragment]: https://www.rfc-editor.org/rfc/rfc3986#section-3.5 + URLFragmentKey = attribute.Key("url.fragment") + + // URLFullKey is the attribute Key conforming to the "url.full" semantic + // conventions. It represents the absolute URL describing a network resource + // according to [RFC3986]. + // + // Type: string + // RequirementLevel: Recommended + // Stability: Stable + // + // Examples: "https://www.foo.bar/search?q=OpenTelemetry#SemConv", "//localhost" + // Note: For network calls, URL usually has + // `scheme://host[:port][path][?query][#fragment]` format, where the fragment + // is not transmitted over HTTP, but if it is known, it SHOULD be included + // nevertheless. + // + // `url.full` MUST NOT contain credentials passed via URL in form of + // `https://username:password@www.example.com/`. + // In such case username and password SHOULD be redacted and attribute's value + // SHOULD be `https://REDACTED:REDACTED@www.example.com/`. + // + // `url.full` SHOULD capture the absolute URL when it is available (or can be + // reconstructed). + // + // Sensitive content provided in `url.full` SHOULD be scrubbed when + // instrumentations can identify it. + // + // + // Query string values for the following keys SHOULD be redacted by default and + // replaced by the + // value `REDACTED`: + // + // - [`AWSAccessKeyId`] + // - [`Signature`] + // - [`sig`] + // - [`X-Goog-Signature`] + // + // This list is subject to change over time. + // + // Matching of query parameter keys against the sensitive list SHOULD be + // case-sensitive. + // + // + // Instrumentation MAY provide a way to override this list via declarative + // configuration. + // If so, it SHOULD use the `sensitive_query_parameters` property + // (an array of case-sensitive strings with minimum items 0) under + // `.instrumentation/development.general.sanitization.url`. + // This list is a full override of the default sensitive query parameter keys, + // it is not a list of keys in addition to the defaults. + // + // When a query string value is redacted, the query string key SHOULD still be + // preserved, e.g. + // `https://www.example.com/path?color=blue&sig=REDACTED`. + // + // [RFC3986]: https://www.rfc-editor.org/rfc/rfc3986 + // [`AWSAccessKeyId`]: https://docs.aws.amazon.com/AmazonS3/latest/userguide/RESTAuthentication.html#RESTAuthenticationQueryStringAuth + // [`Signature`]: https://docs.aws.amazon.com/AmazonS3/latest/userguide/RESTAuthentication.html#RESTAuthenticationQueryStringAuth + // [`sig`]: https://learn.microsoft.com/azure/storage/common/storage-sas-overview#sas-token + // [`X-Goog-Signature`]: https://cloud.google.com/storage/docs/access-control/signed-urls + URLFullKey = attribute.Key("url.full") + + // URLOriginalKey is the attribute Key conforming to the "url.original" semantic + // conventions. It represents the unmodified original URL as seen in the event + // source. + // + // Type: string + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: "https://www.foo.bar/search?q=OpenTelemetry#SemConv", + // "search?q=OpenTelemetry" + // Note: In network monitoring, the observed URL may be a full URL, whereas in + // access logs, the URL is often just represented as a path. This field is meant + // to represent the URL as it was observed, complete or not. + // `url.original` might contain credentials passed via URL in form of + // `https://username:password@www.example.com/`. In such case password and + // username SHOULD NOT be redacted and attribute's value SHOULD remain the same. + URLOriginalKey = attribute.Key("url.original") + + // URLPathKey is the attribute Key conforming to the "url.path" semantic + // conventions. It represents the [URI path] component. + // + // Type: string + // RequirementLevel: Recommended + // Stability: Stable + // + // Examples: "/search" + // Note: Sensitive content provided in `url.path` SHOULD be scrubbed when + // instrumentations can identify it. + // + // [URI path]: https://www.rfc-editor.org/rfc/rfc3986#section-3.3 + URLPathKey = attribute.Key("url.path") + + // URLPortKey is the attribute Key conforming to the "url.port" semantic + // conventions. It represents the port extracted from the `url.full`. + // + // Type: int + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: 443 + URLPortKey = attribute.Key("url.port") + + // URLQueryKey is the attribute Key conforming to the "url.query" semantic + // conventions. It represents the [URI query] component. + // + // Type: string + // RequirementLevel: Recommended + // Stability: Stable + // + // Examples: "q=OpenTelemetry" + // Note: Sensitive content provided in `url.query` SHOULD be scrubbed when + // instrumentations can identify it. + // + // + // Query string values for the following keys SHOULD be redacted by default and + // replaced by the value `REDACTED`: + // + // - [`AWSAccessKeyId`] + // - [`Signature`] + // - [`sig`] + // - [`X-Goog-Signature`] + // + // This list is subject to change over time. + // + // Matching of query parameter keys against the sensitive list SHOULD be + // case-sensitive. + // + // Instrumentation MAY provide a way to override this list via declarative + // configuration. + // If so, it SHOULD use the `sensitive_query_parameters` property + // (an array of case-sensitive strings with minimum items 0) under + // `.instrumentation/development.general.sanitization.url`. + // This list is a full override of the default sensitive query parameter keys, + // it is not a list of keys in addition to the defaults. + // + // When a query string value is redacted, the query string key SHOULD still be + // preserved, e.g. + // `q=OpenTelemetry&sig=REDACTED`. + // + // [URI query]: https://www.rfc-editor.org/rfc/rfc3986#section-3.4 + // [`AWSAccessKeyId`]: https://docs.aws.amazon.com/AmazonS3/latest/userguide/RESTAuthentication.html#RESTAuthenticationQueryStringAuth + // [`Signature`]: https://docs.aws.amazon.com/AmazonS3/latest/userguide/RESTAuthentication.html#RESTAuthenticationQueryStringAuth + // [`sig`]: https://learn.microsoft.com/azure/storage/common/storage-sas-overview#sas-token + // [`X-Goog-Signature`]: https://cloud.google.com/storage/docs/access-control/signed-urls + URLQueryKey = attribute.Key("url.query") + + // URLRegisteredDomainKey is the attribute Key conforming to the + // "url.registered_domain" semantic conventions. It represents the highest + // registered url domain, stripped of the subdomain. + // + // Type: string + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: "example.com", "foo.co.uk" + // Note: This value can be determined precisely with the [public suffix list]. + // For example, the registered domain for `foo.example.com` is `example.com`. + // Trying to approximate this by simply taking the last two labels will not work + // well for TLDs such as `co.uk`. + // + // [public suffix list]: https://publicsuffix.org/ + URLRegisteredDomainKey = attribute.Key("url.registered_domain") + + // URLSchemeKey is the attribute Key conforming to the "url.scheme" semantic + // conventions. It represents the [URI scheme] component identifying the used + // protocol. + // + // Type: string + // RequirementLevel: Recommended + // Stability: Stable + // + // Examples: "https", "ftp", "telnet" + // + // [URI scheme]: https://www.rfc-editor.org/rfc/rfc3986#section-3.1 + URLSchemeKey = attribute.Key("url.scheme") + + // URLSubdomainKey is the attribute Key conforming to the "url.subdomain" + // semantic conventions. It represents the subdomain portion of a fully + // qualified domain name includes all of the names except the host name under + // the registered_domain. In a partially qualified domain, or if the + // qualification level of the full name cannot be determined, subdomain contains + // all of the names below the registered domain. + // + // Type: string + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: "east", "sub2.sub1" + // Note: The subdomain portion of `www.east.mydomain.co.uk` is `east`. If the + // domain has multiple levels of subdomain, such as `sub2.sub1.example.com`, the + // subdomain field should contain `sub2.sub1`, with no trailing period. + URLSubdomainKey = attribute.Key("url.subdomain") + + // URLTemplateKey is the attribute Key conforming to the "url.template" semantic + // conventions. It represents the low-cardinality template of an + // [absolute path reference]. + // + // Type: string + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: "/users/{id}", "/users/:id", "/users?id={id}" + // + // [absolute path reference]: https://www.rfc-editor.org/rfc/rfc3986#section-4.2 + URLTemplateKey = attribute.Key("url.template") + + // URLTopLevelDomainKey is the attribute Key conforming to the + // "url.top_level_domain" semantic conventions. It represents the effective top + // level domain (eTLD), also known as the domain suffix, is the last part of the + // domain name. For example, the top level domain for example.com is `com`. + // + // Type: string + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: "com", "co.uk" + // Note: This value can be determined precisely with the [public suffix list]. + // + // [public suffix list]: https://publicsuffix.org/ + URLTopLevelDomainKey = attribute.Key("url.top_level_domain") +) + +// URLDomain returns an attribute KeyValue conforming to the "url.domain" +// semantic conventions. It represents the domain extracted from the `url.full`, +// such as "opentelemetry.io". +func URLDomain(val string) attribute.KeyValue { + return URLDomainKey.String(val) +} + +// URLExtension returns an attribute KeyValue conforming to the "url.extension" +// semantic conventions. It represents the file extension extracted from the +// `url.full`, excluding the leading dot. +func URLExtension(val string) attribute.KeyValue { + return URLExtensionKey.String(val) +} + +// URLFragment returns an attribute KeyValue conforming to the "url.fragment" +// semantic conventions. It represents the [URI fragment] component. +// +// [URI fragment]: https://www.rfc-editor.org/rfc/rfc3986#section-3.5 +func URLFragment(val string) attribute.KeyValue { + return URLFragmentKey.String(val) +} + +// URLFull returns an attribute KeyValue conforming to the "url.full" semantic +// conventions. It represents the absolute URL describing a network resource +// according to [RFC3986]. +// +// [RFC3986]: https://www.rfc-editor.org/rfc/rfc3986 +func URLFull(val string) attribute.KeyValue { + return URLFullKey.String(val) +} + +// URLOriginal returns an attribute KeyValue conforming to the "url.original" +// semantic conventions. It represents the unmodified original URL as seen in the +// event source. +func URLOriginal(val string) attribute.KeyValue { + return URLOriginalKey.String(val) +} + +// URLPath returns an attribute KeyValue conforming to the "url.path" semantic +// conventions. It represents the [URI path] component. +// +// [URI path]: https://www.rfc-editor.org/rfc/rfc3986#section-3.3 +func URLPath(val string) attribute.KeyValue { + return URLPathKey.String(val) +} + +// URLPort returns an attribute KeyValue conforming to the "url.port" semantic +// conventions. It represents the port extracted from the `url.full`. +func URLPort(val int) attribute.KeyValue { + return URLPortKey.Int(val) +} + +// URLQuery returns an attribute KeyValue conforming to the "url.query" semantic +// conventions. It represents the [URI query] component. +// +// [URI query]: https://www.rfc-editor.org/rfc/rfc3986#section-3.4 +func URLQuery(val string) attribute.KeyValue { + return URLQueryKey.String(val) +} + +// URLRegisteredDomain returns an attribute KeyValue conforming to the +// "url.registered_domain" semantic conventions. It represents the highest +// registered url domain, stripped of the subdomain. +func URLRegisteredDomain(val string) attribute.KeyValue { + return URLRegisteredDomainKey.String(val) +} + +// URLScheme returns an attribute KeyValue conforming to the "url.scheme" +// semantic conventions. It represents the [URI scheme] component identifying the +// used protocol. +// +// [URI scheme]: https://www.rfc-editor.org/rfc/rfc3986#section-3.1 +func URLScheme(val string) attribute.KeyValue { + return URLSchemeKey.String(val) +} + +// URLSubdomain returns an attribute KeyValue conforming to the "url.subdomain" +// semantic conventions. It represents the subdomain portion of a fully qualified +// domain name includes all of the names except the host name under the +// registered_domain. In a partially qualified domain, or if the qualification +// level of the full name cannot be determined, subdomain contains all of the +// names below the registered domain. +func URLSubdomain(val string) attribute.KeyValue { + return URLSubdomainKey.String(val) +} + +// URLTemplate returns an attribute KeyValue conforming to the "url.template" +// semantic conventions. It represents the low-cardinality template of an +// [absolute path reference]. +// +// [absolute path reference]: https://www.rfc-editor.org/rfc/rfc3986#section-4.2 +func URLTemplate(val string) attribute.KeyValue { + return URLTemplateKey.String(val) +} + +// URLTopLevelDomain returns an attribute KeyValue conforming to the +// "url.top_level_domain" semantic conventions. It represents the effective top +// level domain (eTLD), also known as the domain suffix, is the last part of the +// domain name. For example, the top level domain for example.com is `com`. +func URLTopLevelDomain(val string) attribute.KeyValue { + return URLTopLevelDomainKey.String(val) +} + +// Namespace: user +const ( + // UserEmailKey is the attribute Key conforming to the "user.email" semantic + // conventions. It represents the user email address. + // + // Type: string + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: "a.einstein@example.com" + UserEmailKey = attribute.Key("user.email") + + // UserFullNameKey is the attribute Key conforming to the "user.full_name" + // semantic conventions. It represents the user's full name. + // + // Type: string + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: "Albert Einstein" + UserFullNameKey = attribute.Key("user.full_name") + + // UserHashKey is the attribute Key conforming to the "user.hash" semantic + // conventions. It represents the unique user hash to correlate information for + // a user in anonymized form. + // + // Type: string + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: "364fc68eaf4c8acec74a4e52d7d1feaa" + // Note: Useful if `user.id` or `user.name` contain confidential information and + // cannot be used. + UserHashKey = attribute.Key("user.hash") + + // UserIDKey is the attribute Key conforming to the "user.id" semantic + // conventions. It represents the unique identifier of the user. + // + // Type: string + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: "S-1-5-21-202424912787-2692429404-2351956786-1000" + UserIDKey = attribute.Key("user.id") + + // UserNameKey is the attribute Key conforming to the "user.name" semantic + // conventions. It represents the short name or login/username of the user. + // + // Type: string + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: "a.einstein" + UserNameKey = attribute.Key("user.name") + + // UserRolesKey is the attribute Key conforming to the "user.roles" semantic + // conventions. It represents the array of user roles at the time of the event. + // + // Type: string[] + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: "admin", "reporting_user" + UserRolesKey = attribute.Key("user.roles") +) + +// UserEmail returns an attribute KeyValue conforming to the "user.email" +// semantic conventions. It represents the user email address. +func UserEmail(val string) attribute.KeyValue { + return UserEmailKey.String(val) +} + +// UserFullName returns an attribute KeyValue conforming to the "user.full_name" +// semantic conventions. It represents the user's full name. +func UserFullName(val string) attribute.KeyValue { + return UserFullNameKey.String(val) +} + +// UserHash returns an attribute KeyValue conforming to the "user.hash" semantic +// conventions. It represents the unique user hash to correlate information for a +// user in anonymized form. +func UserHash(val string) attribute.KeyValue { + return UserHashKey.String(val) +} + +// UserID returns an attribute KeyValue conforming to the "user.id" semantic +// conventions. It represents the unique identifier of the user. +func UserID(val string) attribute.KeyValue { + return UserIDKey.String(val) +} + +// UserName returns an attribute KeyValue conforming to the "user.name" semantic +// conventions. It represents the short name or login/username of the user. +func UserName(val string) attribute.KeyValue { + return UserNameKey.String(val) +} + +// UserRoles returns an attribute KeyValue conforming to the "user.roles" +// semantic conventions. It represents the array of user roles at the time of the +// event. +func UserRoles(val ...string) attribute.KeyValue { + return UserRolesKey.StringSlice(val) +} + +// Namespace: user_agent +const ( + // UserAgentNameKey is the attribute Key conforming to the "user_agent.name" + // semantic conventions. It represents the name of the user-agent extracted from + // original. Usually refers to the browser's name. + // + // Type: string + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: "Safari", "YourApp" + // Note: [Example] of extracting browser's name from original string. In the + // case of using a user-agent for non-browser products, such as microservices + // with multiple names/versions inside the `user_agent.original`, the most + // significant name SHOULD be selected. In such a scenario it should align with + // `user_agent.version` + // + // [Example]: https://uaparser.dev/#demo + UserAgentNameKey = attribute.Key("user_agent.name") + + // UserAgentOriginalKey is the attribute Key conforming to the + // "user_agent.original" semantic conventions. It represents the value of the + // [HTTP User-Agent] header sent by the client. + // + // Type: string + // RequirementLevel: Recommended + // Stability: Stable + // + // Examples: "CERN-LineMode/2.15 libwww/2.17b3", "Mozilla/5.0 (iPhone; CPU + // iPhone OS 14_7_1 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) + // Version/14.1.2 Mobile/15E148 Safari/604.1", "YourApp/1.0.0 + // grpc-java-okhttp/1.27.2" + // + // [HTTP User-Agent]: https://www.rfc-editor.org/rfc/rfc9110.html#field.user-agent + UserAgentOriginalKey = attribute.Key("user_agent.original") + + // UserAgentOSNameKey is the attribute Key conforming to the + // "user_agent.os.name" semantic conventions. It represents the human readable + // operating system name. + // + // Type: string + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: "iOS", "Android", "Ubuntu" + // Note: For mapping user agent strings to OS names, libraries such as + // [ua-parser] can be utilized. + // + // [ua-parser]: https://github.com/ua-parser + UserAgentOSNameKey = attribute.Key("user_agent.os.name") + + // UserAgentOSVersionKey is the attribute Key conforming to the + // "user_agent.os.version" semantic conventions. It represents the version + // string of the operating system as defined in [Version Attributes]. + // + // Type: string + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: "14.2.1", "18.04.1" + // Note: For mapping user agent strings to OS versions, libraries such as + // [ua-parser] can be utilized. + // + // [Version Attributes]: /docs/resource/README.md#version-attributes + // [ua-parser]: https://github.com/ua-parser + UserAgentOSVersionKey = attribute.Key("user_agent.os.version") + + // UserAgentSyntheticTypeKey is the attribute Key conforming to the + // "user_agent.synthetic.type" semantic conventions. It represents the specifies + // the category of synthetic traffic, such as tests or bots. + // + // Type: Enum + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: + // Note: This attribute MAY be derived from the contents of the + // `user_agent.original` attribute. Components that populate the attribute are + // responsible for determining what they consider to be synthetic bot or test + // traffic. This attribute can either be set for self-identification purposes, + // or on telemetry detected to be generated as a result of a synthetic request. + // This attribute is useful for distinguishing between genuine client traffic + // and synthetic traffic generated by bots or tests. + UserAgentSyntheticTypeKey = attribute.Key("user_agent.synthetic.type") + + // UserAgentVersionKey is the attribute Key conforming to the + // "user_agent.version" semantic conventions. It represents the version of the + // user-agent extracted from original. Usually refers to the browser's version. + // + // Type: string + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: "14.1.2", "1.0.0" + // Note: [Example] of extracting browser's version from original string. In the + // case of using a user-agent for non-browser products, such as microservices + // with multiple names/versions inside the `user_agent.original`, the most + // significant version SHOULD be selected. In such a scenario it should align + // with `user_agent.name` + // + // [Example]: https://uaparser.dev/#demo + UserAgentVersionKey = attribute.Key("user_agent.version") +) + +// UserAgentName returns an attribute KeyValue conforming to the +// "user_agent.name" semantic conventions. It represents the name of the +// user-agent extracted from original. Usually refers to the browser's name. +func UserAgentName(val string) attribute.KeyValue { + return UserAgentNameKey.String(val) +} + +// UserAgentOriginal returns an attribute KeyValue conforming to the +// "user_agent.original" semantic conventions. It represents the value of the +// [HTTP User-Agent] header sent by the client. +// +// [HTTP User-Agent]: https://www.rfc-editor.org/rfc/rfc9110.html#field.user-agent +func UserAgentOriginal(val string) attribute.KeyValue { + return UserAgentOriginalKey.String(val) +} + +// UserAgentOSName returns an attribute KeyValue conforming to the +// "user_agent.os.name" semantic conventions. It represents the human readable +// operating system name. +func UserAgentOSName(val string) attribute.KeyValue { + return UserAgentOSNameKey.String(val) +} + +// UserAgentOSVersion returns an attribute KeyValue conforming to the +// "user_agent.os.version" semantic conventions. It represents the version string +// of the operating system as defined in [Version Attributes]. +// +// [Version Attributes]: /docs/resource/README.md#version-attributes +func UserAgentOSVersion(val string) attribute.KeyValue { + return UserAgentOSVersionKey.String(val) +} + +// UserAgentVersion returns an attribute KeyValue conforming to the +// "user_agent.version" semantic conventions. It represents the version of the +// user-agent extracted from original. Usually refers to the browser's version. +func UserAgentVersion(val string) attribute.KeyValue { + return UserAgentVersionKey.String(val) +} + +// Enum values for user_agent.synthetic.type +var ( + // Bot source. + // Stability: development + UserAgentSyntheticTypeBot = UserAgentSyntheticTypeKey.String("bot") + // Synthetic test source. + // Stability: development + UserAgentSyntheticTypeTest = UserAgentSyntheticTypeKey.String("test") +) + +// Namespace: vcs +const ( + // VCSChangeIDKey is the attribute Key conforming to the "vcs.change.id" + // semantic conventions. It represents the ID of the change (pull request/merge + // request/changelist) if applicable. This is usually a unique (within + // repository) identifier generated by the VCS system. + // + // Type: string + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: "123" + VCSChangeIDKey = attribute.Key("vcs.change.id") + + // VCSChangeStateKey is the attribute Key conforming to the "vcs.change.state" + // semantic conventions. It represents the state of the change (pull + // request/merge request/changelist). + // + // Type: Enum + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: "open", "closed", "merged" + VCSChangeStateKey = attribute.Key("vcs.change.state") + + // VCSChangeTitleKey is the attribute Key conforming to the "vcs.change.title" + // semantic conventions. It represents the human readable title of the change + // (pull request/merge request/changelist). This title is often a brief summary + // of the change and may get merged in to a ref as the commit summary. + // + // Type: string + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: "Fixes broken thing", "feat: add my new feature", "[chore] update + // dependency" + VCSChangeTitleKey = attribute.Key("vcs.change.title") + + // VCSLineChangeTypeKey is the attribute Key conforming to the + // "vcs.line_change.type" semantic conventions. It represents the type of line + // change being measured on a branch or change. + // + // Type: Enum + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: "added", "removed" + VCSLineChangeTypeKey = attribute.Key("vcs.line_change.type") + + // VCSOwnerNameKey is the attribute Key conforming to the "vcs.owner.name" + // semantic conventions. It represents the group owner within the version + // control system. + // + // Type: string + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: "my-org", "myteam", "business-unit" + VCSOwnerNameKey = attribute.Key("vcs.owner.name") + + // VCSProviderNameKey is the attribute Key conforming to the "vcs.provider.name" + // semantic conventions. It represents the name of the version control system + // provider. + // + // Type: Enum + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: "github", "gitlab", "gitea", "bitbucket" + VCSProviderNameKey = attribute.Key("vcs.provider.name") + + // VCSRefBaseNameKey is the attribute Key conforming to the "vcs.ref.base.name" + // semantic conventions. It represents the name of the [reference] such as + // **branch** or **tag** in the repository. + // + // Type: string + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: "my-feature-branch", "tag-1-test" + // Note: `base` refers to the starting point of a change. For example, `main` + // would be the base reference of type branch if you've created a new + // reference of type branch from it and created new commits. + // + // [reference]: https://git-scm.com/docs/gitglossary#def_ref + VCSRefBaseNameKey = attribute.Key("vcs.ref.base.name") + + // VCSRefBaseRevisionKey is the attribute Key conforming to the + // "vcs.ref.base.revision" semantic conventions. It represents the revision, + // literally [revised version], The revision most often refers to a commit + // object in Git, or a revision number in SVN. + // + // Type: string + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: "9d59409acf479dfa0df1aa568182e43e43df8bbe28d60fcf2bc52e30068802cc", + // "main", "123", "HEAD" + // Note: `base` refers to the starting point of a change. For example, `main` + // would be the base reference of type branch if you've created a new + // reference of type branch from it and created new commits. The + // revision can be a full [hash value (see + // glossary)], + // of the recorded change to a ref within a repository pointing to a + // commit [commit] object. It does + // not necessarily have to be a hash; it can simply define a [revision + // number] + // which is an integer that is monotonically increasing. In cases where + // it is identical to the `ref.base.name`, it SHOULD still be included. + // It is up to the implementer to decide which value to set as the + // revision based on the VCS system and situational context. + // + // [revised version]: https://www.merriam-webster.com/dictionary/revision + // [hash value (see + // glossary)]: https://nvlpubs.nist.gov/nistpubs/FIPS/NIST.FIPS.186-5.pdf + // [commit]: https://git-scm.com/docs/git-commit + // [revision + // number]: https://svnbook.red-bean.com/en/1.7/svn.tour.revs.specifiers.html + VCSRefBaseRevisionKey = attribute.Key("vcs.ref.base.revision") + + // VCSRefBaseTypeKey is the attribute Key conforming to the "vcs.ref.base.type" + // semantic conventions. It represents the type of the [reference] in the + // repository. + // + // Type: Enum + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: "branch", "tag" + // Note: `base` refers to the starting point of a change. For example, `main` + // would be the base reference of type branch if you've created a new + // reference of type branch from it and created new commits. + // + // [reference]: https://git-scm.com/docs/gitglossary#def_ref + VCSRefBaseTypeKey = attribute.Key("vcs.ref.base.type") + + // VCSRefHeadNameKey is the attribute Key conforming to the "vcs.ref.head.name" + // semantic conventions. It represents the name of the [reference] such as + // **branch** or **tag** in the repository. + // + // Type: string + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: "my-feature-branch", "tag-1-test" + // Note: `head` refers to where you are right now; the current reference at a + // given time. + // + // [reference]: https://git-scm.com/docs/gitglossary#def_ref + VCSRefHeadNameKey = attribute.Key("vcs.ref.head.name") + + // VCSRefHeadRevisionKey is the attribute Key conforming to the + // "vcs.ref.head.revision" semantic conventions. It represents the revision, + // literally [revised version], The revision most often refers to a commit + // object in Git, or a revision number in SVN. + // + // Type: string + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: "9d59409acf479dfa0df1aa568182e43e43df8bbe28d60fcf2bc52e30068802cc", + // "main", "123", "HEAD" + // Note: `head` refers to where you are right now; the current reference at a + // given time.The revision can be a full [hash value (see + // glossary)], + // of the recorded change to a ref within a repository pointing to a + // commit [commit] object. It does + // not necessarily have to be a hash; it can simply define a [revision + // number] + // which is an integer that is monotonically increasing. In cases where + // it is identical to the `ref.head.name`, it SHOULD still be included. + // It is up to the implementer to decide which value to set as the + // revision based on the VCS system and situational context. + // + // [revised version]: https://www.merriam-webster.com/dictionary/revision + // [hash value (see + // glossary)]: https://nvlpubs.nist.gov/nistpubs/FIPS/NIST.FIPS.186-5.pdf + // [commit]: https://git-scm.com/docs/git-commit + // [revision + // number]: https://svnbook.red-bean.com/en/1.7/svn.tour.revs.specifiers.html + VCSRefHeadRevisionKey = attribute.Key("vcs.ref.head.revision") + + // VCSRefHeadTypeKey is the attribute Key conforming to the "vcs.ref.head.type" + // semantic conventions. It represents the type of the [reference] in the + // repository. + // + // Type: Enum + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: "branch", "tag" + // Note: `head` refers to where you are right now; the current reference at a + // given time. + // + // [reference]: https://git-scm.com/docs/gitglossary#def_ref + VCSRefHeadTypeKey = attribute.Key("vcs.ref.head.type") + + // VCSRefTypeKey is the attribute Key conforming to the "vcs.ref.type" semantic + // conventions. It represents the type of the [reference] in the repository. + // + // Type: Enum + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: "branch", "tag" + // + // [reference]: https://git-scm.com/docs/gitglossary#def_ref + VCSRefTypeKey = attribute.Key("vcs.ref.type") + + // VCSRepositoryNameKey is the attribute Key conforming to the + // "vcs.repository.name" semantic conventions. It represents the human readable + // name of the repository. It SHOULD NOT include any additional identifier like + // Group/SubGroup in GitLab or organization in GitHub. + // + // Type: string + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: "semantic-conventions", "my-cool-repo" + // Note: Due to it only being the name, it can clash with forks of the same + // repository if collecting telemetry across multiple orgs or groups in + // the same backends. + VCSRepositoryNameKey = attribute.Key("vcs.repository.name") + + // VCSRepositoryURLFullKey is the attribute Key conforming to the + // "vcs.repository.url.full" semantic conventions. It represents the + // [canonical URL] of the repository providing the complete HTTP(S) address in + // order to locate and identify the repository through a browser. + // + // Type: string + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: + // "https://github.com/opentelemetry/open-telemetry-collector-contrib", + // "https://gitlab.com/my-org/my-project/my-projects-project/repo" + // Note: In Git Version Control Systems, the canonical URL SHOULD NOT include + // the `.git` extension. + // + // [canonical URL]: https://support.google.com/webmasters/answer/10347851 + VCSRepositoryURLFullKey = attribute.Key("vcs.repository.url.full") + + // VCSRevisionDeltaDirectionKey is the attribute Key conforming to the + // "vcs.revision_delta.direction" semantic conventions. It represents the type + // of revision comparison. + // + // Type: Enum + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: "ahead", "behind" + VCSRevisionDeltaDirectionKey = attribute.Key("vcs.revision_delta.direction") +) + +// VCSChangeID returns an attribute KeyValue conforming to the "vcs.change.id" +// semantic conventions. It represents the ID of the change (pull request/merge +// request/changelist) if applicable. This is usually a unique (within +// repository) identifier generated by the VCS system. +func VCSChangeID(val string) attribute.KeyValue { + return VCSChangeIDKey.String(val) +} + +// VCSChangeTitle returns an attribute KeyValue conforming to the +// "vcs.change.title" semantic conventions. It represents the human readable +// title of the change (pull request/merge request/changelist). This title is +// often a brief summary of the change and may get merged in to a ref as the +// commit summary. +func VCSChangeTitle(val string) attribute.KeyValue { + return VCSChangeTitleKey.String(val) +} + +// VCSOwnerName returns an attribute KeyValue conforming to the "vcs.owner.name" +// semantic conventions. It represents the group owner within the version control +// system. +func VCSOwnerName(val string) attribute.KeyValue { + return VCSOwnerNameKey.String(val) +} + +// VCSRefBaseName returns an attribute KeyValue conforming to the +// "vcs.ref.base.name" semantic conventions. It represents the name of the +// [reference] such as **branch** or **tag** in the repository. +// +// [reference]: https://git-scm.com/docs/gitglossary#def_ref +func VCSRefBaseName(val string) attribute.KeyValue { + return VCSRefBaseNameKey.String(val) +} + +// VCSRefBaseRevision returns an attribute KeyValue conforming to the +// "vcs.ref.base.revision" semantic conventions. It represents the revision, +// literally [revised version], The revision most often refers to a commit object +// in Git, or a revision number in SVN. +// +// [revised version]: https://www.merriam-webster.com/dictionary/revision +func VCSRefBaseRevision(val string) attribute.KeyValue { + return VCSRefBaseRevisionKey.String(val) +} + +// VCSRefHeadName returns an attribute KeyValue conforming to the +// "vcs.ref.head.name" semantic conventions. It represents the name of the +// [reference] such as **branch** or **tag** in the repository. +// +// [reference]: https://git-scm.com/docs/gitglossary#def_ref +func VCSRefHeadName(val string) attribute.KeyValue { + return VCSRefHeadNameKey.String(val) +} + +// VCSRefHeadRevision returns an attribute KeyValue conforming to the +// "vcs.ref.head.revision" semantic conventions. It represents the revision, +// literally [revised version], The revision most often refers to a commit object +// in Git, or a revision number in SVN. +// +// [revised version]: https://www.merriam-webster.com/dictionary/revision +func VCSRefHeadRevision(val string) attribute.KeyValue { + return VCSRefHeadRevisionKey.String(val) +} + +// VCSRepositoryName returns an attribute KeyValue conforming to the +// "vcs.repository.name" semantic conventions. It represents the human readable +// name of the repository. It SHOULD NOT include any additional identifier like +// Group/SubGroup in GitLab or organization in GitHub. +func VCSRepositoryName(val string) attribute.KeyValue { + return VCSRepositoryNameKey.String(val) +} + +// VCSRepositoryURLFull returns an attribute KeyValue conforming to the +// "vcs.repository.url.full" semantic conventions. It represents the +// [canonical URL] of the repository providing the complete HTTP(S) address in +// order to locate and identify the repository through a browser. +// +// [canonical URL]: https://support.google.com/webmasters/answer/10347851 +func VCSRepositoryURLFull(val string) attribute.KeyValue { + return VCSRepositoryURLFullKey.String(val) +} + +// Enum values for vcs.change.state +var ( + // Open means the change is currently active and under review. It hasn't been + // merged into the target branch yet, and it's still possible to make changes or + // add comments. + // Stability: development + VCSChangeStateOpen = VCSChangeStateKey.String("open") + // WIP (work-in-progress, draft) means the change is still in progress and not + // yet ready for a full review. It might still undergo significant changes. + // Stability: development + VCSChangeStateWip = VCSChangeStateKey.String("wip") + // Closed means the merge request has been closed without merging. This can + // happen for various reasons, such as the changes being deemed unnecessary, the + // issue being resolved in another way, or the author deciding to withdraw the + // request. + // Stability: development + VCSChangeStateClosed = VCSChangeStateKey.String("closed") + // Merged indicates that the change has been successfully integrated into the + // target codebase. + // Stability: development + VCSChangeStateMerged = VCSChangeStateKey.String("merged") +) + +// Enum values for vcs.line_change.type +var ( + // How many lines were added. + // Stability: development + VCSLineChangeTypeAdded = VCSLineChangeTypeKey.String("added") + // How many lines were removed. + // Stability: development + VCSLineChangeTypeRemoved = VCSLineChangeTypeKey.String("removed") +) + +// Enum values for vcs.provider.name +var ( + // [GitHub] + // Stability: development + // + // [GitHub]: https://github.com + VCSProviderNameGithub = VCSProviderNameKey.String("github") + // [GitLab] + // Stability: development + // + // [GitLab]: https://gitlab.com + VCSProviderNameGitlab = VCSProviderNameKey.String("gitlab") + // [Gitea] + // Stability: development + // + // [Gitea]: https://gitea.io + VCSProviderNameGitea = VCSProviderNameKey.String("gitea") + // [Bitbucket] + // Stability: development + // + // [Bitbucket]: https://bitbucket.org + VCSProviderNameBitbucket = VCSProviderNameKey.String("bitbucket") +) + +// Enum values for vcs.ref.base.type +var ( + // [branch] + // Stability: development + // + // [branch]: https://git-scm.com/docs/gitglossary#Documentation/gitglossary.txt-aiddefbranchabranch + VCSRefBaseTypeBranch = VCSRefBaseTypeKey.String("branch") + // [tag] + // Stability: development + // + // [tag]: https://git-scm.com/docs/gitglossary#Documentation/gitglossary.txt-aiddeftagatag + VCSRefBaseTypeTag = VCSRefBaseTypeKey.String("tag") +) + +// Enum values for vcs.ref.head.type +var ( + // [branch] + // Stability: development + // + // [branch]: https://git-scm.com/docs/gitglossary#Documentation/gitglossary.txt-aiddefbranchabranch + VCSRefHeadTypeBranch = VCSRefHeadTypeKey.String("branch") + // [tag] + // Stability: development + // + // [tag]: https://git-scm.com/docs/gitglossary#Documentation/gitglossary.txt-aiddeftagatag + VCSRefHeadTypeTag = VCSRefHeadTypeKey.String("tag") +) + +// Enum values for vcs.ref.type +var ( + // [branch] + // Stability: development + // + // [branch]: https://git-scm.com/docs/gitglossary#Documentation/gitglossary.txt-aiddefbranchabranch + VCSRefTypeBranch = VCSRefTypeKey.String("branch") + // [tag] + // Stability: development + // + // [tag]: https://git-scm.com/docs/gitglossary#Documentation/gitglossary.txt-aiddeftagatag + VCSRefTypeTag = VCSRefTypeKey.String("tag") +) + +// Enum values for vcs.revision_delta.direction +var ( + // How many revisions the change is behind the target ref. + // Stability: development + VCSRevisionDeltaDirectionBehind = VCSRevisionDeltaDirectionKey.String("behind") + // How many revisions the change is ahead of the target ref. + // Stability: development + VCSRevisionDeltaDirectionAhead = VCSRevisionDeltaDirectionKey.String("ahead") +) + +// Namespace: webengine +const ( + // WebEngineDescriptionKey is the attribute Key conforming to the + // "webengine.description" semantic conventions. It represents the additional + // description of the web engine (e.g. detailed version and edition + // information). + // + // Type: string + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: "WildFly Full 21.0.0.Final (WildFly Core 13.0.1.Final) - + // 2.2.2.Final" + WebEngineDescriptionKey = attribute.Key("webengine.description") + + // WebEngineNameKey is the attribute Key conforming to the "webengine.name" + // semantic conventions. It represents the name of the web engine. + // + // Type: string + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: "WildFly" + WebEngineNameKey = attribute.Key("webengine.name") + + // WebEngineVersionKey is the attribute Key conforming to the + // "webengine.version" semantic conventions. It represents the version of the + // web engine. + // + // Type: string + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: "21.0.0" + WebEngineVersionKey = attribute.Key("webengine.version") +) + +// WebEngineDescription returns an attribute KeyValue conforming to the +// "webengine.description" semantic conventions. It represents the additional +// description of the web engine (e.g. detailed version and edition information). +func WebEngineDescription(val string) attribute.KeyValue { + return WebEngineDescriptionKey.String(val) +} + +// WebEngineName returns an attribute KeyValue conforming to the "webengine.name" +// semantic conventions. It represents the name of the web engine. +func WebEngineName(val string) attribute.KeyValue { + return WebEngineNameKey.String(val) +} + +// WebEngineVersion returns an attribute KeyValue conforming to the +// "webengine.version" semantic conventions. It represents the version of the web +// engine. +func WebEngineVersion(val string) attribute.KeyValue { + return WebEngineVersionKey.String(val) +} + +// Namespace: zos +const ( + // ZOSSmfIDKey is the attribute Key conforming to the "zos.smf.id" semantic + // conventions. It represents the System Management Facility (SMF) Identifier + // uniquely identified a z/OS system within a SYSPLEX or mainframe environment + // and is used for system and performance analysis. + // + // Type: string + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: "SYS1" + ZOSSmfIDKey = attribute.Key("zos.smf.id") + + // ZOSSysplexNameKey is the attribute Key conforming to the "zos.sysplex.name" + // semantic conventions. It represents the name of the SYSPLEX to which the z/OS + // system belongs too. + // + // Type: string + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: "SYSPLEX1" + ZOSSysplexNameKey = attribute.Key("zos.sysplex.name") +) + +// ZOSSmfID returns an attribute KeyValue conforming to the "zos.smf.id" semantic +// conventions. It represents the System Management Facility (SMF) Identifier +// uniquely identified a z/OS system within a SYSPLEX or mainframe environment +// and is used for system and performance analysis. +func ZOSSmfID(val string) attribute.KeyValue { + return ZOSSmfIDKey.String(val) +} + +// ZOSSysplexName returns an attribute KeyValue conforming to the +// "zos.sysplex.name" semantic conventions. It represents the name of the SYSPLEX +// to which the z/OS system belongs too. +func ZOSSysplexName(val string) attribute.KeyValue { + return ZOSSysplexNameKey.String(val) +} \ No newline at end of file diff --git a/vendor/go.opentelemetry.io/otel/semconv/v1.40.0/doc.go b/vendor/go.opentelemetry.io/otel/semconv/v1.40.0/doc.go new file mode 100644 index 00000000..c5c41e4d --- /dev/null +++ b/vendor/go.opentelemetry.io/otel/semconv/v1.40.0/doc.go @@ -0,0 +1,9 @@ +// Copyright The OpenTelemetry Authors +// SPDX-License-Identifier: Apache-2.0 + +// Package semconv implements OpenTelemetry semantic conventions. +// +// OpenTelemetry semantic conventions are agreed standardized naming +// patterns for OpenTelemetry things. This package represents the v1.40.0 +// version of the OpenTelemetry semantic conventions. +package semconv // import "go.opentelemetry.io/otel/semconv/v1.40.0" diff --git a/vendor/go.opentelemetry.io/otel/semconv/v1.40.0/error_type.go b/vendor/go.opentelemetry.io/otel/semconv/v1.40.0/error_type.go new file mode 100644 index 00000000..6d26e528 --- /dev/null +++ b/vendor/go.opentelemetry.io/otel/semconv/v1.40.0/error_type.go @@ -0,0 +1,66 @@ +// Copyright The OpenTelemetry Authors +// SPDX-License-Identifier: Apache-2.0 + +package semconv // import "go.opentelemetry.io/otel/semconv/v1.40.0" + +import ( + "errors" + "reflect" + + "go.opentelemetry.io/otel/attribute" +) + +// ErrorType returns an [attribute.KeyValue] identifying the error type of err. +// +// If err is nil, the returned attribute has the default value +// [ErrorTypeOther]. +// +// If err or one of the errors in its chain has the method +// +// ErrorType() string +// +// the returned attribute has that method's return value. If multiple errors in +// the chain implement this method, the value from the first match found by +// [errors.As] is used. Otherwise, the returned attribute has a value derived +// from the concrete type of err. +// +// The key of the returned attribute is [ErrorTypeKey]. +func ErrorType(err error) attribute.KeyValue { + if err == nil { + return ErrorTypeOther + } + + return ErrorTypeKey.String(errorType(err)) +} + +func errorType(err error) string { + var s string + if et, ok := err.(interface{ ErrorType() string }); ok { + // Fast path: check the top-level error first. + s = et.ErrorType() + } else { + // Fallback: search the error chain for an ErrorType method. + var et interface{ ErrorType() string } + if errors.As(err, &et) { + // Prioritize the ErrorType method if available. + s = et.ErrorType() + } + } + if s == "" { + // Fallback to reflection if the ErrorType method is not supported or + // returns an empty value. + + t := reflect.TypeOf(err) + pkg, name := t.PkgPath(), t.Name() + if pkg != "" && name != "" { + s = pkg + "." + name + } else { + // The type has no package path or name (predeclared, not-defined, + // or alias for a not-defined type). + // + // This is not guaranteed to be unique, but is a best effort. + s = t.String() + } + } + return s +} diff --git a/vendor/go.opentelemetry.io/otel/semconv/v1.40.0/exception.go b/vendor/go.opentelemetry.io/otel/semconv/v1.40.0/exception.go new file mode 100644 index 00000000..6a26231a --- /dev/null +++ b/vendor/go.opentelemetry.io/otel/semconv/v1.40.0/exception.go @@ -0,0 +1,9 @@ +// Copyright The OpenTelemetry Authors +// SPDX-License-Identifier: Apache-2.0 + +package semconv // import "go.opentelemetry.io/otel/semconv/v1.40.0" + +const ( + // ExceptionEventName is the name of the Span event representing an exception. + ExceptionEventName = "exception" +) diff --git a/vendor/go.opentelemetry.io/otel/semconv/v1.40.0/httpconv/metric.go b/vendor/go.opentelemetry.io/otel/semconv/v1.40.0/httpconv/metric.go new file mode 100644 index 00000000..7264925b --- /dev/null +++ b/vendor/go.opentelemetry.io/otel/semconv/v1.40.0/httpconv/metric.go @@ -0,0 +1,1767 @@ +// Code generated from semantic convention specification. DO NOT EDIT. + +// Copyright The OpenTelemetry Authors +// SPDX-License-Identifier: Apache-2.0 + +// Package httpconv provides types and functionality for OpenTelemetry semantic +// conventions in the "http" namespace. +package httpconv + +import ( + "context" + "sync" + + "go.opentelemetry.io/otel/attribute" + "go.opentelemetry.io/otel/metric" + "go.opentelemetry.io/otel/metric/noop" +) + +var ( + addOptPool = &sync.Pool{New: func() any { return &[]metric.AddOption{} }} + recOptPool = &sync.Pool{New: func() any { return &[]metric.RecordOption{} }} +) + +// ErrorTypeAttr is an attribute conforming to the error.type semantic +// conventions. It represents the describes a class of error the operation ended +// with. +type ErrorTypeAttr string + +var ( + // ErrorTypeOther is a fallback error value to be used when the instrumentation + // doesn't define a custom value. + ErrorTypeOther ErrorTypeAttr = "_OTHER" +) + +// ConnectionStateAttr is an attribute conforming to the http.connection.state +// semantic conventions. It represents the state of the HTTP connection in the +// HTTP connection pool. +type ConnectionStateAttr string + +var ( + // ConnectionStateActive is the active state. + ConnectionStateActive ConnectionStateAttr = "active" + // ConnectionStateIdle is the idle state. + ConnectionStateIdle ConnectionStateAttr = "idle" +) + +// RequestMethodAttr is an attribute conforming to the http.request.method +// semantic conventions. It represents the HTTP request method. +type RequestMethodAttr string + +var ( + // RequestMethodConnect is the CONNECT method. + RequestMethodConnect RequestMethodAttr = "CONNECT" + // RequestMethodDelete is the DELETE method. + RequestMethodDelete RequestMethodAttr = "DELETE" + // RequestMethodGet is the GET method. + RequestMethodGet RequestMethodAttr = "GET" + // RequestMethodHead is the HEAD method. + RequestMethodHead RequestMethodAttr = "HEAD" + // RequestMethodOptions is the OPTIONS method. + RequestMethodOptions RequestMethodAttr = "OPTIONS" + // RequestMethodPatch is the PATCH method. + RequestMethodPatch RequestMethodAttr = "PATCH" + // RequestMethodPost is the POST method. + RequestMethodPost RequestMethodAttr = "POST" + // RequestMethodPut is the PUT method. + RequestMethodPut RequestMethodAttr = "PUT" + // RequestMethodTrace is the TRACE method. + RequestMethodTrace RequestMethodAttr = "TRACE" + // RequestMethodQuery is the QUERY method. + RequestMethodQuery RequestMethodAttr = "QUERY" + // RequestMethodOther is the any HTTP method that the instrumentation has no + // prior knowledge of. + RequestMethodOther RequestMethodAttr = "_OTHER" +) + +// UserAgentSyntheticTypeAttr is an attribute conforming to the +// user_agent.synthetic.type semantic conventions. It represents the specifies +// the category of synthetic traffic, such as tests or bots. +type UserAgentSyntheticTypeAttr string + +var ( + // UserAgentSyntheticTypeBot is the bot source. + UserAgentSyntheticTypeBot UserAgentSyntheticTypeAttr = "bot" + // UserAgentSyntheticTypeTest is the synthetic test source. + UserAgentSyntheticTypeTest UserAgentSyntheticTypeAttr = "test" +) + +// ClientActiveRequests is an instrument used to record metric values conforming +// to the "http.client.active_requests" semantic conventions. It represents the +// number of active HTTP requests. +type ClientActiveRequests struct { + metric.Int64UpDownCounter +} + +var newClientActiveRequestsOpts = []metric.Int64UpDownCounterOption{ + metric.WithDescription("Number of active HTTP requests."), + metric.WithUnit("{request}"), +} + +// NewClientActiveRequests returns a new ClientActiveRequests instrument. +func NewClientActiveRequests( + m metric.Meter, + opt ...metric.Int64UpDownCounterOption, +) (ClientActiveRequests, error) { + // Check if the meter is nil. + if m == nil { + return ClientActiveRequests{noop.Int64UpDownCounter{}}, nil + } + + if len(opt) == 0 { + opt = newClientActiveRequestsOpts + } else { + opt = append(opt, newClientActiveRequestsOpts...) + } + + i, err := m.Int64UpDownCounter( + "http.client.active_requests", + opt..., + ) + if err != nil { + return ClientActiveRequests{noop.Int64UpDownCounter{}}, err + } + return ClientActiveRequests{i}, nil +} + +// Inst returns the underlying metric instrument. +func (m ClientActiveRequests) Inst() metric.Int64UpDownCounter { + return m.Int64UpDownCounter +} + +// Name returns the semantic convention name of the instrument. +func (ClientActiveRequests) Name() string { + return "http.client.active_requests" +} + +// Unit returns the semantic convention unit of the instrument +func (ClientActiveRequests) Unit() string { + return "{request}" +} + +// Description returns the semantic convention description of the instrument +func (ClientActiveRequests) Description() string { + return "Number of active HTTP requests." +} + +// Add adds incr to the existing count for attrs. +// +// The serverAddress is the server domain name if available without reverse DNS +// lookup; otherwise, IP address or Unix domain socket name. +// +// The serverPort is the server port number. +// +// All additional attrs passed are included in the recorded value. +func (m ClientActiveRequests) Add( + ctx context.Context, + incr int64, + serverAddress string, + serverPort int, + attrs ...attribute.KeyValue, +) { + if len(attrs) == 0 { + m.Int64UpDownCounter.Add(ctx, incr, metric.WithAttributes( + attribute.String("server.address", serverAddress), + attribute.Int("server.port", serverPort), + )) + return + } + + o := addOptPool.Get().(*[]metric.AddOption) + defer func() { + *o = (*o)[:0] + addOptPool.Put(o) + }() + + *o = append( + *o, + metric.WithAttributes( + append( + attrs[:len(attrs):len(attrs)], + attribute.String("server.address", serverAddress), + attribute.Int("server.port", serverPort), + )..., + ), + ) + + m.Int64UpDownCounter.Add(ctx, incr, *o...) +} + +// AddSet adds incr to the existing count for set. +func (m ClientActiveRequests) AddSet(ctx context.Context, incr int64, set attribute.Set) { + if set.Len() == 0 { + m.Int64UpDownCounter.Add(ctx, incr) + return + } + + o := addOptPool.Get().(*[]metric.AddOption) + defer func() { + *o = (*o)[:0] + addOptPool.Put(o) + }() + + *o = append(*o, metric.WithAttributeSet(set)) + m.Int64UpDownCounter.Add(ctx, incr, *o...) +} + +// AttrURLTemplate returns an optional attribute for the "url.template" semantic +// convention. It represents the low-cardinality template of an +// [absolute path reference]. +// +// [absolute path reference]: https://www.rfc-editor.org/rfc/rfc3986#section-4.2 +func (ClientActiveRequests) AttrURLTemplate(val string) attribute.KeyValue { + return attribute.String("url.template", val) +} + +// AttrRequestMethod returns an optional attribute for the "http.request.method" +// semantic convention. It represents the HTTP request method. +func (ClientActiveRequests) AttrRequestMethod(val RequestMethodAttr) attribute.KeyValue { + return attribute.String("http.request.method", string(val)) +} + +// AttrURLScheme returns an optional attribute for the "url.scheme" semantic +// convention. It represents the [URI scheme] component identifying the used +// protocol. +// +// [URI scheme]: https://www.rfc-editor.org/rfc/rfc3986#section-3.1 +func (ClientActiveRequests) AttrURLScheme(val string) attribute.KeyValue { + return attribute.String("url.scheme", val) +} + +// ClientConnectionDuration is an instrument used to record metric values +// conforming to the "http.client.connection.duration" semantic conventions. It +// represents the duration of the successfully established outbound HTTP +// connections. +type ClientConnectionDuration struct { + metric.Float64Histogram +} + +var newClientConnectionDurationOpts = []metric.Float64HistogramOption{ + metric.WithDescription("The duration of the successfully established outbound HTTP connections."), + metric.WithUnit("s"), +} + +// NewClientConnectionDuration returns a new ClientConnectionDuration instrument. +func NewClientConnectionDuration( + m metric.Meter, + opt ...metric.Float64HistogramOption, +) (ClientConnectionDuration, error) { + // Check if the meter is nil. + if m == nil { + return ClientConnectionDuration{noop.Float64Histogram{}}, nil + } + + if len(opt) == 0 { + opt = newClientConnectionDurationOpts + } else { + opt = append(opt, newClientConnectionDurationOpts...) + } + + i, err := m.Float64Histogram( + "http.client.connection.duration", + opt..., + ) + if err != nil { + return ClientConnectionDuration{noop.Float64Histogram{}}, err + } + return ClientConnectionDuration{i}, nil +} + +// Inst returns the underlying metric instrument. +func (m ClientConnectionDuration) Inst() metric.Float64Histogram { + return m.Float64Histogram +} + +// Name returns the semantic convention name of the instrument. +func (ClientConnectionDuration) Name() string { + return "http.client.connection.duration" +} + +// Unit returns the semantic convention unit of the instrument +func (ClientConnectionDuration) Unit() string { + return "s" +} + +// Description returns the semantic convention description of the instrument +func (ClientConnectionDuration) Description() string { + return "The duration of the successfully established outbound HTTP connections." +} + +// Record records val to the current distribution for attrs. +// +// The serverAddress is the server domain name if available without reverse DNS +// lookup; otherwise, IP address or Unix domain socket name. +// +// The serverPort is the server port number. +// +// All additional attrs passed are included in the recorded value. +func (m ClientConnectionDuration) Record( + ctx context.Context, + val float64, + serverAddress string, + serverPort int, + attrs ...attribute.KeyValue, +) { + if len(attrs) == 0 { + m.Float64Histogram.Record(ctx, val, metric.WithAttributes( + attribute.String("server.address", serverAddress), + attribute.Int("server.port", serverPort), + )) + return + } + + o := recOptPool.Get().(*[]metric.RecordOption) + defer func() { + *o = (*o)[:0] + recOptPool.Put(o) + }() + + *o = append( + *o, + metric.WithAttributes( + append( + attrs[:len(attrs):len(attrs)], + attribute.String("server.address", serverAddress), + attribute.Int("server.port", serverPort), + )..., + ), + ) + + m.Float64Histogram.Record(ctx, val, *o...) +} + +// RecordSet records val to the current distribution for set. +func (m ClientConnectionDuration) RecordSet(ctx context.Context, val float64, set attribute.Set) { + if set.Len() == 0 { + m.Float64Histogram.Record(ctx, val) + return + } + + o := recOptPool.Get().(*[]metric.RecordOption) + defer func() { + *o = (*o)[:0] + recOptPool.Put(o) + }() + + *o = append(*o, metric.WithAttributeSet(set)) + m.Float64Histogram.Record(ctx, val, *o...) +} + +// AttrNetworkPeerAddress returns an optional attribute for the +// "network.peer.address" semantic convention. It represents the peer address of +// the network connection - IP address or Unix domain socket name. +func (ClientConnectionDuration) AttrNetworkPeerAddress(val string) attribute.KeyValue { + return attribute.String("network.peer.address", val) +} + +// AttrNetworkProtocolVersion returns an optional attribute for the +// "network.protocol.version" semantic convention. It represents the actual +// version of the protocol used for network communication. +func (ClientConnectionDuration) AttrNetworkProtocolVersion(val string) attribute.KeyValue { + return attribute.String("network.protocol.version", val) +} + +// AttrURLScheme returns an optional attribute for the "url.scheme" semantic +// convention. It represents the [URI scheme] component identifying the used +// protocol. +// +// [URI scheme]: https://www.rfc-editor.org/rfc/rfc3986#section-3.1 +func (ClientConnectionDuration) AttrURLScheme(val string) attribute.KeyValue { + return attribute.String("url.scheme", val) +} + +// ClientOpenConnections is an instrument used to record metric values conforming +// to the "http.client.open_connections" semantic conventions. It represents the +// number of outbound HTTP connections that are currently active or idle on the +// client. +type ClientOpenConnections struct { + metric.Int64UpDownCounter +} + +var newClientOpenConnectionsOpts = []metric.Int64UpDownCounterOption{ + metric.WithDescription("Number of outbound HTTP connections that are currently active or idle on the client."), + metric.WithUnit("{connection}"), +} + +// NewClientOpenConnections returns a new ClientOpenConnections instrument. +func NewClientOpenConnections( + m metric.Meter, + opt ...metric.Int64UpDownCounterOption, +) (ClientOpenConnections, error) { + // Check if the meter is nil. + if m == nil { + return ClientOpenConnections{noop.Int64UpDownCounter{}}, nil + } + + if len(opt) == 0 { + opt = newClientOpenConnectionsOpts + } else { + opt = append(opt, newClientOpenConnectionsOpts...) + } + + i, err := m.Int64UpDownCounter( + "http.client.open_connections", + opt..., + ) + if err != nil { + return ClientOpenConnections{noop.Int64UpDownCounter{}}, err + } + return ClientOpenConnections{i}, nil +} + +// Inst returns the underlying metric instrument. +func (m ClientOpenConnections) Inst() metric.Int64UpDownCounter { + return m.Int64UpDownCounter +} + +// Name returns the semantic convention name of the instrument. +func (ClientOpenConnections) Name() string { + return "http.client.open_connections" +} + +// Unit returns the semantic convention unit of the instrument +func (ClientOpenConnections) Unit() string { + return "{connection}" +} + +// Description returns the semantic convention description of the instrument +func (ClientOpenConnections) Description() string { + return "Number of outbound HTTP connections that are currently active or idle on the client." +} + +// Add adds incr to the existing count for attrs. +// +// The connectionState is the state of the HTTP connection in the HTTP connection +// pool. +// +// The serverAddress is the server domain name if available without reverse DNS +// lookup; otherwise, IP address or Unix domain socket name. +// +// The serverPort is the server port number. +// +// All additional attrs passed are included in the recorded value. +func (m ClientOpenConnections) Add( + ctx context.Context, + incr int64, + connectionState ConnectionStateAttr, + serverAddress string, + serverPort int, + attrs ...attribute.KeyValue, +) { + if len(attrs) == 0 { + m.Int64UpDownCounter.Add(ctx, incr, metric.WithAttributes( + attribute.String("http.connection.state", string(connectionState)), + attribute.String("server.address", serverAddress), + attribute.Int("server.port", serverPort), + )) + return + } + + o := addOptPool.Get().(*[]metric.AddOption) + defer func() { + *o = (*o)[:0] + addOptPool.Put(o) + }() + + *o = append( + *o, + metric.WithAttributes( + append( + attrs[:len(attrs):len(attrs)], + attribute.String("http.connection.state", string(connectionState)), + attribute.String("server.address", serverAddress), + attribute.Int("server.port", serverPort), + )..., + ), + ) + + m.Int64UpDownCounter.Add(ctx, incr, *o...) +} + +// AddSet adds incr to the existing count for set. +func (m ClientOpenConnections) AddSet(ctx context.Context, incr int64, set attribute.Set) { + if set.Len() == 0 { + m.Int64UpDownCounter.Add(ctx, incr) + return + } + + o := addOptPool.Get().(*[]metric.AddOption) + defer func() { + *o = (*o)[:0] + addOptPool.Put(o) + }() + + *o = append(*o, metric.WithAttributeSet(set)) + m.Int64UpDownCounter.Add(ctx, incr, *o...) +} + +// AttrNetworkPeerAddress returns an optional attribute for the +// "network.peer.address" semantic convention. It represents the peer address of +// the network connection - IP address or Unix domain socket name. +func (ClientOpenConnections) AttrNetworkPeerAddress(val string) attribute.KeyValue { + return attribute.String("network.peer.address", val) +} + +// AttrNetworkProtocolVersion returns an optional attribute for the +// "network.protocol.version" semantic convention. It represents the actual +// version of the protocol used for network communication. +func (ClientOpenConnections) AttrNetworkProtocolVersion(val string) attribute.KeyValue { + return attribute.String("network.protocol.version", val) +} + +// AttrURLScheme returns an optional attribute for the "url.scheme" semantic +// convention. It represents the [URI scheme] component identifying the used +// protocol. +// +// [URI scheme]: https://www.rfc-editor.org/rfc/rfc3986#section-3.1 +func (ClientOpenConnections) AttrURLScheme(val string) attribute.KeyValue { + return attribute.String("url.scheme", val) +} + +// ClientRequestBodySize is an instrument used to record metric values conforming +// to the "http.client.request.body.size" semantic conventions. It represents the +// size of HTTP client request bodies. +type ClientRequestBodySize struct { + metric.Int64Histogram +} + +var newClientRequestBodySizeOpts = []metric.Int64HistogramOption{ + metric.WithDescription("Size of HTTP client request bodies."), + metric.WithUnit("By"), +} + +// NewClientRequestBodySize returns a new ClientRequestBodySize instrument. +func NewClientRequestBodySize( + m metric.Meter, + opt ...metric.Int64HistogramOption, +) (ClientRequestBodySize, error) { + // Check if the meter is nil. + if m == nil { + return ClientRequestBodySize{noop.Int64Histogram{}}, nil + } + + if len(opt) == 0 { + opt = newClientRequestBodySizeOpts + } else { + opt = append(opt, newClientRequestBodySizeOpts...) + } + + i, err := m.Int64Histogram( + "http.client.request.body.size", + opt..., + ) + if err != nil { + return ClientRequestBodySize{noop.Int64Histogram{}}, err + } + return ClientRequestBodySize{i}, nil +} + +// Inst returns the underlying metric instrument. +func (m ClientRequestBodySize) Inst() metric.Int64Histogram { + return m.Int64Histogram +} + +// Name returns the semantic convention name of the instrument. +func (ClientRequestBodySize) Name() string { + return "http.client.request.body.size" +} + +// Unit returns the semantic convention unit of the instrument +func (ClientRequestBodySize) Unit() string { + return "By" +} + +// Description returns the semantic convention description of the instrument +func (ClientRequestBodySize) Description() string { + return "Size of HTTP client request bodies." +} + +// Record records val to the current distribution for attrs. +// +// The requestMethod is the HTTP request method. +// +// The serverAddress is the server domain name if available without reverse DNS +// lookup; otherwise, IP address or Unix domain socket name. +// +// The serverPort is the server port number. +// +// All additional attrs passed are included in the recorded value. +// +// The size of the request payload body in bytes. This is the number of bytes +// transferred excluding headers and is often, but not always, present as the +// [Content-Length] header. For requests using transport encoding, this should be +// the compressed size. +// +// [Content-Length]: https://www.rfc-editor.org/rfc/rfc9110.html#field.content-length +func (m ClientRequestBodySize) Record( + ctx context.Context, + val int64, + requestMethod RequestMethodAttr, + serverAddress string, + serverPort int, + attrs ...attribute.KeyValue, +) { + if len(attrs) == 0 { + m.Int64Histogram.Record(ctx, val, metric.WithAttributes( + attribute.String("http.request.method", string(requestMethod)), + attribute.String("server.address", serverAddress), + attribute.Int("server.port", serverPort), + )) + return + } + + o := recOptPool.Get().(*[]metric.RecordOption) + defer func() { + *o = (*o)[:0] + recOptPool.Put(o) + }() + + *o = append( + *o, + metric.WithAttributes( + append( + attrs[:len(attrs):len(attrs)], + attribute.String("http.request.method", string(requestMethod)), + attribute.String("server.address", serverAddress), + attribute.Int("server.port", serverPort), + )..., + ), + ) + + m.Int64Histogram.Record(ctx, val, *o...) +} + +// RecordSet records val to the current distribution for set. +// +// The size of the request payload body in bytes. This is the number of bytes +// transferred excluding headers and is often, but not always, present as the +// [Content-Length] header. For requests using transport encoding, this should be +// the compressed size. +// +// [Content-Length]: https://www.rfc-editor.org/rfc/rfc9110.html#field.content-length +func (m ClientRequestBodySize) RecordSet(ctx context.Context, val int64, set attribute.Set) { + if set.Len() == 0 { + m.Int64Histogram.Record(ctx, val) + return + } + + o := recOptPool.Get().(*[]metric.RecordOption) + defer func() { + *o = (*o)[:0] + recOptPool.Put(o) + }() + + *o = append(*o, metric.WithAttributeSet(set)) + m.Int64Histogram.Record(ctx, val, *o...) +} + +// AttrErrorType returns an optional attribute for the "error.type" semantic +// convention. It represents the describes a class of error the operation ended +// with. +func (ClientRequestBodySize) AttrErrorType(val ErrorTypeAttr) attribute.KeyValue { + return attribute.String("error.type", string(val)) +} + +// AttrResponseStatusCode returns an optional attribute for the +// "http.response.status_code" semantic convention. It represents the +// [HTTP response status code]. +// +// [HTTP response status code]: https://tools.ietf.org/html/rfc7231#section-6 +func (ClientRequestBodySize) AttrResponseStatusCode(val int) attribute.KeyValue { + return attribute.Int("http.response.status_code", val) +} + +// AttrNetworkProtocolName returns an optional attribute for the +// "network.protocol.name" semantic convention. It represents the +// [OSI application layer] or non-OSI equivalent. +// +// [OSI application layer]: https://wikipedia.org/wiki/Application_layer +func (ClientRequestBodySize) AttrNetworkProtocolName(val string) attribute.KeyValue { + return attribute.String("network.protocol.name", val) +} + +// AttrURLTemplate returns an optional attribute for the "url.template" semantic +// convention. It represents the low-cardinality template of an +// [absolute path reference]. +// +// [absolute path reference]: https://www.rfc-editor.org/rfc/rfc3986#section-4.2 +func (ClientRequestBodySize) AttrURLTemplate(val string) attribute.KeyValue { + return attribute.String("url.template", val) +} + +// AttrNetworkProtocolVersion returns an optional attribute for the +// "network.protocol.version" semantic convention. It represents the actual +// version of the protocol used for network communication. +func (ClientRequestBodySize) AttrNetworkProtocolVersion(val string) attribute.KeyValue { + return attribute.String("network.protocol.version", val) +} + +// AttrURLScheme returns an optional attribute for the "url.scheme" semantic +// convention. It represents the [URI scheme] component identifying the used +// protocol. +// +// [URI scheme]: https://www.rfc-editor.org/rfc/rfc3986#section-3.1 +func (ClientRequestBodySize) AttrURLScheme(val string) attribute.KeyValue { + return attribute.String("url.scheme", val) +} + +// ClientRequestDuration is an instrument used to record metric values conforming +// to the "http.client.request.duration" semantic conventions. It represents the +// duration of HTTP client requests. +type ClientRequestDuration struct { + metric.Float64Histogram +} + +var newClientRequestDurationOpts = []metric.Float64HistogramOption{ + metric.WithDescription("Duration of HTTP client requests."), + metric.WithUnit("s"), +} + +// NewClientRequestDuration returns a new ClientRequestDuration instrument. +func NewClientRequestDuration( + m metric.Meter, + opt ...metric.Float64HistogramOption, +) (ClientRequestDuration, error) { + // Check if the meter is nil. + if m == nil { + return ClientRequestDuration{noop.Float64Histogram{}}, nil + } + + if len(opt) == 0 { + opt = newClientRequestDurationOpts + } else { + opt = append(opt, newClientRequestDurationOpts...) + } + + i, err := m.Float64Histogram( + "http.client.request.duration", + opt..., + ) + if err != nil { + return ClientRequestDuration{noop.Float64Histogram{}}, err + } + return ClientRequestDuration{i}, nil +} + +// Inst returns the underlying metric instrument. +func (m ClientRequestDuration) Inst() metric.Float64Histogram { + return m.Float64Histogram +} + +// Name returns the semantic convention name of the instrument. +func (ClientRequestDuration) Name() string { + return "http.client.request.duration" +} + +// Unit returns the semantic convention unit of the instrument +func (ClientRequestDuration) Unit() string { + return "s" +} + +// Description returns the semantic convention description of the instrument +func (ClientRequestDuration) Description() string { + return "Duration of HTTP client requests." +} + +// Record records val to the current distribution for attrs. +// +// The requestMethod is the HTTP request method. +// +// The serverAddress is the server domain name if available without reverse DNS +// lookup; otherwise, IP address or Unix domain socket name. +// +// The serverPort is the server port number. +// +// All additional attrs passed are included in the recorded value. +func (m ClientRequestDuration) Record( + ctx context.Context, + val float64, + requestMethod RequestMethodAttr, + serverAddress string, + serverPort int, + attrs ...attribute.KeyValue, +) { + if len(attrs) == 0 { + m.Float64Histogram.Record(ctx, val, metric.WithAttributes( + attribute.String("http.request.method", string(requestMethod)), + attribute.String("server.address", serverAddress), + attribute.Int("server.port", serverPort), + )) + return + } + + o := recOptPool.Get().(*[]metric.RecordOption) + defer func() { + *o = (*o)[:0] + recOptPool.Put(o) + }() + + *o = append( + *o, + metric.WithAttributes( + append( + attrs[:len(attrs):len(attrs)], + attribute.String("http.request.method", string(requestMethod)), + attribute.String("server.address", serverAddress), + attribute.Int("server.port", serverPort), + )..., + ), + ) + + m.Float64Histogram.Record(ctx, val, *o...) +} + +// RecordSet records val to the current distribution for set. +func (m ClientRequestDuration) RecordSet(ctx context.Context, val float64, set attribute.Set) { + if set.Len() == 0 { + m.Float64Histogram.Record(ctx, val) + return + } + + o := recOptPool.Get().(*[]metric.RecordOption) + defer func() { + *o = (*o)[:0] + recOptPool.Put(o) + }() + + *o = append(*o, metric.WithAttributeSet(set)) + m.Float64Histogram.Record(ctx, val, *o...) +} + +// AttrErrorType returns an optional attribute for the "error.type" semantic +// convention. It represents the describes a class of error the operation ended +// with. +func (ClientRequestDuration) AttrErrorType(val ErrorTypeAttr) attribute.KeyValue { + return attribute.String("error.type", string(val)) +} + +// AttrResponseStatusCode returns an optional attribute for the +// "http.response.status_code" semantic convention. It represents the +// [HTTP response status code]. +// +// [HTTP response status code]: https://tools.ietf.org/html/rfc7231#section-6 +func (ClientRequestDuration) AttrResponseStatusCode(val int) attribute.KeyValue { + return attribute.Int("http.response.status_code", val) +} + +// AttrNetworkProtocolName returns an optional attribute for the +// "network.protocol.name" semantic convention. It represents the +// [OSI application layer] or non-OSI equivalent. +// +// [OSI application layer]: https://wikipedia.org/wiki/Application_layer +func (ClientRequestDuration) AttrNetworkProtocolName(val string) attribute.KeyValue { + return attribute.String("network.protocol.name", val) +} + +// AttrNetworkProtocolVersion returns an optional attribute for the +// "network.protocol.version" semantic convention. It represents the actual +// version of the protocol used for network communication. +func (ClientRequestDuration) AttrNetworkProtocolVersion(val string) attribute.KeyValue { + return attribute.String("network.protocol.version", val) +} + +// AttrURLScheme returns an optional attribute for the "url.scheme" semantic +// convention. It represents the [URI scheme] component identifying the used +// protocol. +// +// [URI scheme]: https://www.rfc-editor.org/rfc/rfc3986#section-3.1 +func (ClientRequestDuration) AttrURLScheme(val string) attribute.KeyValue { + return attribute.String("url.scheme", val) +} + +// AttrURLTemplate returns an optional attribute for the "url.template" semantic +// convention. It represents the low-cardinality template of an +// [absolute path reference]. +// +// [absolute path reference]: https://www.rfc-editor.org/rfc/rfc3986#section-4.2 +func (ClientRequestDuration) AttrURLTemplate(val string) attribute.KeyValue { + return attribute.String("url.template", val) +} + +// ClientResponseBodySize is an instrument used to record metric values +// conforming to the "http.client.response.body.size" semantic conventions. It +// represents the size of HTTP client response bodies. +type ClientResponseBodySize struct { + metric.Int64Histogram +} + +var newClientResponseBodySizeOpts = []metric.Int64HistogramOption{ + metric.WithDescription("Size of HTTP client response bodies."), + metric.WithUnit("By"), +} + +// NewClientResponseBodySize returns a new ClientResponseBodySize instrument. +func NewClientResponseBodySize( + m metric.Meter, + opt ...metric.Int64HistogramOption, +) (ClientResponseBodySize, error) { + // Check if the meter is nil. + if m == nil { + return ClientResponseBodySize{noop.Int64Histogram{}}, nil + } + + if len(opt) == 0 { + opt = newClientResponseBodySizeOpts + } else { + opt = append(opt, newClientResponseBodySizeOpts...) + } + + i, err := m.Int64Histogram( + "http.client.response.body.size", + opt..., + ) + if err != nil { + return ClientResponseBodySize{noop.Int64Histogram{}}, err + } + return ClientResponseBodySize{i}, nil +} + +// Inst returns the underlying metric instrument. +func (m ClientResponseBodySize) Inst() metric.Int64Histogram { + return m.Int64Histogram +} + +// Name returns the semantic convention name of the instrument. +func (ClientResponseBodySize) Name() string { + return "http.client.response.body.size" +} + +// Unit returns the semantic convention unit of the instrument +func (ClientResponseBodySize) Unit() string { + return "By" +} + +// Description returns the semantic convention description of the instrument +func (ClientResponseBodySize) Description() string { + return "Size of HTTP client response bodies." +} + +// Record records val to the current distribution for attrs. +// +// The requestMethod is the HTTP request method. +// +// The serverAddress is the server domain name if available without reverse DNS +// lookup; otherwise, IP address or Unix domain socket name. +// +// The serverPort is the server port number. +// +// All additional attrs passed are included in the recorded value. +// +// The size of the response payload body in bytes. This is the number of bytes +// transferred excluding headers and is often, but not always, present as the +// [Content-Length] header. For requests using transport encoding, this should be +// the compressed size. +// +// [Content-Length]: https://www.rfc-editor.org/rfc/rfc9110.html#field.content-length +func (m ClientResponseBodySize) Record( + ctx context.Context, + val int64, + requestMethod RequestMethodAttr, + serverAddress string, + serverPort int, + attrs ...attribute.KeyValue, +) { + if len(attrs) == 0 { + m.Int64Histogram.Record(ctx, val, metric.WithAttributes( + attribute.String("http.request.method", string(requestMethod)), + attribute.String("server.address", serverAddress), + attribute.Int("server.port", serverPort), + )) + return + } + + o := recOptPool.Get().(*[]metric.RecordOption) + defer func() { + *o = (*o)[:0] + recOptPool.Put(o) + }() + + *o = append( + *o, + metric.WithAttributes( + append( + attrs[:len(attrs):len(attrs)], + attribute.String("http.request.method", string(requestMethod)), + attribute.String("server.address", serverAddress), + attribute.Int("server.port", serverPort), + )..., + ), + ) + + m.Int64Histogram.Record(ctx, val, *o...) +} + +// RecordSet records val to the current distribution for set. +// +// The size of the response payload body in bytes. This is the number of bytes +// transferred excluding headers and is often, but not always, present as the +// [Content-Length] header. For requests using transport encoding, this should be +// the compressed size. +// +// [Content-Length]: https://www.rfc-editor.org/rfc/rfc9110.html#field.content-length +func (m ClientResponseBodySize) RecordSet(ctx context.Context, val int64, set attribute.Set) { + if set.Len() == 0 { + m.Int64Histogram.Record(ctx, val) + return + } + + o := recOptPool.Get().(*[]metric.RecordOption) + defer func() { + *o = (*o)[:0] + recOptPool.Put(o) + }() + + *o = append(*o, metric.WithAttributeSet(set)) + m.Int64Histogram.Record(ctx, val, *o...) +} + +// AttrErrorType returns an optional attribute for the "error.type" semantic +// convention. It represents the describes a class of error the operation ended +// with. +func (ClientResponseBodySize) AttrErrorType(val ErrorTypeAttr) attribute.KeyValue { + return attribute.String("error.type", string(val)) +} + +// AttrResponseStatusCode returns an optional attribute for the +// "http.response.status_code" semantic convention. It represents the +// [HTTP response status code]. +// +// [HTTP response status code]: https://tools.ietf.org/html/rfc7231#section-6 +func (ClientResponseBodySize) AttrResponseStatusCode(val int) attribute.KeyValue { + return attribute.Int("http.response.status_code", val) +} + +// AttrNetworkProtocolName returns an optional attribute for the +// "network.protocol.name" semantic convention. It represents the +// [OSI application layer] or non-OSI equivalent. +// +// [OSI application layer]: https://wikipedia.org/wiki/Application_layer +func (ClientResponseBodySize) AttrNetworkProtocolName(val string) attribute.KeyValue { + return attribute.String("network.protocol.name", val) +} + +// AttrURLTemplate returns an optional attribute for the "url.template" semantic +// convention. It represents the low-cardinality template of an +// [absolute path reference]. +// +// [absolute path reference]: https://www.rfc-editor.org/rfc/rfc3986#section-4.2 +func (ClientResponseBodySize) AttrURLTemplate(val string) attribute.KeyValue { + return attribute.String("url.template", val) +} + +// AttrNetworkProtocolVersion returns an optional attribute for the +// "network.protocol.version" semantic convention. It represents the actual +// version of the protocol used for network communication. +func (ClientResponseBodySize) AttrNetworkProtocolVersion(val string) attribute.KeyValue { + return attribute.String("network.protocol.version", val) +} + +// AttrURLScheme returns an optional attribute for the "url.scheme" semantic +// convention. It represents the [URI scheme] component identifying the used +// protocol. +// +// [URI scheme]: https://www.rfc-editor.org/rfc/rfc3986#section-3.1 +func (ClientResponseBodySize) AttrURLScheme(val string) attribute.KeyValue { + return attribute.String("url.scheme", val) +} + +// ServerActiveRequests is an instrument used to record metric values conforming +// to the "http.server.active_requests" semantic conventions. It represents the +// number of active HTTP server requests. +type ServerActiveRequests struct { + metric.Int64UpDownCounter +} + +var newServerActiveRequestsOpts = []metric.Int64UpDownCounterOption{ + metric.WithDescription("Number of active HTTP server requests."), + metric.WithUnit("{request}"), +} + +// NewServerActiveRequests returns a new ServerActiveRequests instrument. +func NewServerActiveRequests( + m metric.Meter, + opt ...metric.Int64UpDownCounterOption, +) (ServerActiveRequests, error) { + // Check if the meter is nil. + if m == nil { + return ServerActiveRequests{noop.Int64UpDownCounter{}}, nil + } + + if len(opt) == 0 { + opt = newServerActiveRequestsOpts + } else { + opt = append(opt, newServerActiveRequestsOpts...) + } + + i, err := m.Int64UpDownCounter( + "http.server.active_requests", + opt..., + ) + if err != nil { + return ServerActiveRequests{noop.Int64UpDownCounter{}}, err + } + return ServerActiveRequests{i}, nil +} + +// Inst returns the underlying metric instrument. +func (m ServerActiveRequests) Inst() metric.Int64UpDownCounter { + return m.Int64UpDownCounter +} + +// Name returns the semantic convention name of the instrument. +func (ServerActiveRequests) Name() string { + return "http.server.active_requests" +} + +// Unit returns the semantic convention unit of the instrument +func (ServerActiveRequests) Unit() string { + return "{request}" +} + +// Description returns the semantic convention description of the instrument +func (ServerActiveRequests) Description() string { + return "Number of active HTTP server requests." +} + +// Add adds incr to the existing count for attrs. +// +// The requestMethod is the HTTP request method. +// +// The urlScheme is the the [URI scheme] component identifying the used protocol. +// +// All additional attrs passed are included in the recorded value. +// +// [URI scheme]: https://www.rfc-editor.org/rfc/rfc3986#section-3.1 +func (m ServerActiveRequests) Add( + ctx context.Context, + incr int64, + requestMethod RequestMethodAttr, + urlScheme string, + attrs ...attribute.KeyValue, +) { + if len(attrs) == 0 { + m.Int64UpDownCounter.Add(ctx, incr, metric.WithAttributes( + attribute.String("http.request.method", string(requestMethod)), + attribute.String("url.scheme", urlScheme), + )) + return + } + + o := addOptPool.Get().(*[]metric.AddOption) + defer func() { + *o = (*o)[:0] + addOptPool.Put(o) + }() + + *o = append( + *o, + metric.WithAttributes( + append( + attrs[:len(attrs):len(attrs)], + attribute.String("http.request.method", string(requestMethod)), + attribute.String("url.scheme", urlScheme), + )..., + ), + ) + + m.Int64UpDownCounter.Add(ctx, incr, *o...) +} + +// AddSet adds incr to the existing count for set. +func (m ServerActiveRequests) AddSet(ctx context.Context, incr int64, set attribute.Set) { + if set.Len() == 0 { + m.Int64UpDownCounter.Add(ctx, incr) + return + } + + o := addOptPool.Get().(*[]metric.AddOption) + defer func() { + *o = (*o)[:0] + addOptPool.Put(o) + }() + + *o = append(*o, metric.WithAttributeSet(set)) + m.Int64UpDownCounter.Add(ctx, incr, *o...) +} + +// AttrServerAddress returns an optional attribute for the "server.address" +// semantic convention. It represents the name of the local HTTP server that +// received the request. +func (ServerActiveRequests) AttrServerAddress(val string) attribute.KeyValue { + return attribute.String("server.address", val) +} + +// AttrServerPort returns an optional attribute for the "server.port" semantic +// convention. It represents the port of the local HTTP server that received the +// request. +func (ServerActiveRequests) AttrServerPort(val int) attribute.KeyValue { + return attribute.Int("server.port", val) +} + +// ServerRequestBodySize is an instrument used to record metric values conforming +// to the "http.server.request.body.size" semantic conventions. It represents the +// size of HTTP server request bodies. +type ServerRequestBodySize struct { + metric.Int64Histogram +} + +var newServerRequestBodySizeOpts = []metric.Int64HistogramOption{ + metric.WithDescription("Size of HTTP server request bodies."), + metric.WithUnit("By"), +} + +// NewServerRequestBodySize returns a new ServerRequestBodySize instrument. +func NewServerRequestBodySize( + m metric.Meter, + opt ...metric.Int64HistogramOption, +) (ServerRequestBodySize, error) { + // Check if the meter is nil. + if m == nil { + return ServerRequestBodySize{noop.Int64Histogram{}}, nil + } + + if len(opt) == 0 { + opt = newServerRequestBodySizeOpts + } else { + opt = append(opt, newServerRequestBodySizeOpts...) + } + + i, err := m.Int64Histogram( + "http.server.request.body.size", + opt..., + ) + if err != nil { + return ServerRequestBodySize{noop.Int64Histogram{}}, err + } + return ServerRequestBodySize{i}, nil +} + +// Inst returns the underlying metric instrument. +func (m ServerRequestBodySize) Inst() metric.Int64Histogram { + return m.Int64Histogram +} + +// Name returns the semantic convention name of the instrument. +func (ServerRequestBodySize) Name() string { + return "http.server.request.body.size" +} + +// Unit returns the semantic convention unit of the instrument +func (ServerRequestBodySize) Unit() string { + return "By" +} + +// Description returns the semantic convention description of the instrument +func (ServerRequestBodySize) Description() string { + return "Size of HTTP server request bodies." +} + +// Record records val to the current distribution for attrs. +// +// The requestMethod is the HTTP request method. +// +// The urlScheme is the the [URI scheme] component identifying the used protocol. +// +// All additional attrs passed are included in the recorded value. +// +// [URI scheme]: https://www.rfc-editor.org/rfc/rfc3986#section-3.1 +// +// The size of the request payload body in bytes. This is the number of bytes +// transferred excluding headers and is often, but not always, present as the +// [Content-Length] header. For requests using transport encoding, this should be +// the compressed size. +// +// [Content-Length]: https://www.rfc-editor.org/rfc/rfc9110.html#field.content-length +func (m ServerRequestBodySize) Record( + ctx context.Context, + val int64, + requestMethod RequestMethodAttr, + urlScheme string, + attrs ...attribute.KeyValue, +) { + if len(attrs) == 0 { + m.Int64Histogram.Record(ctx, val, metric.WithAttributes( + attribute.String("http.request.method", string(requestMethod)), + attribute.String("url.scheme", urlScheme), + )) + return + } + + o := recOptPool.Get().(*[]metric.RecordOption) + defer func() { + *o = (*o)[:0] + recOptPool.Put(o) + }() + + *o = append( + *o, + metric.WithAttributes( + append( + attrs[:len(attrs):len(attrs)], + attribute.String("http.request.method", string(requestMethod)), + attribute.String("url.scheme", urlScheme), + )..., + ), + ) + + m.Int64Histogram.Record(ctx, val, *o...) +} + +// RecordSet records val to the current distribution for set. +// +// The size of the request payload body in bytes. This is the number of bytes +// transferred excluding headers and is often, but not always, present as the +// [Content-Length] header. For requests using transport encoding, this should be +// the compressed size. +// +// [Content-Length]: https://www.rfc-editor.org/rfc/rfc9110.html#field.content-length +func (m ServerRequestBodySize) RecordSet(ctx context.Context, val int64, set attribute.Set) { + if set.Len() == 0 { + m.Int64Histogram.Record(ctx, val) + return + } + + o := recOptPool.Get().(*[]metric.RecordOption) + defer func() { + *o = (*o)[:0] + recOptPool.Put(o) + }() + + *o = append(*o, metric.WithAttributeSet(set)) + m.Int64Histogram.Record(ctx, val, *o...) +} + +// AttrErrorType returns an optional attribute for the "error.type" semantic +// convention. It represents the describes a class of error the operation ended +// with. +func (ServerRequestBodySize) AttrErrorType(val ErrorTypeAttr) attribute.KeyValue { + return attribute.String("error.type", string(val)) +} + +// AttrResponseStatusCode returns an optional attribute for the +// "http.response.status_code" semantic convention. It represents the +// [HTTP response status code]. +// +// [HTTP response status code]: https://tools.ietf.org/html/rfc7231#section-6 +func (ServerRequestBodySize) AttrResponseStatusCode(val int) attribute.KeyValue { + return attribute.Int("http.response.status_code", val) +} + +// AttrRoute returns an optional attribute for the "http.route" semantic +// convention. It represents the matched route template for the request. This +// MUST be low-cardinality and include all static path segments, with dynamic +// path segments represented with placeholders. +func (ServerRequestBodySize) AttrRoute(val string) attribute.KeyValue { + return attribute.String("http.route", val) +} + +// AttrNetworkProtocolName returns an optional attribute for the +// "network.protocol.name" semantic convention. It represents the +// [OSI application layer] or non-OSI equivalent. +// +// [OSI application layer]: https://wikipedia.org/wiki/Application_layer +func (ServerRequestBodySize) AttrNetworkProtocolName(val string) attribute.KeyValue { + return attribute.String("network.protocol.name", val) +} + +// AttrNetworkProtocolVersion returns an optional attribute for the +// "network.protocol.version" semantic convention. It represents the actual +// version of the protocol used for network communication. +func (ServerRequestBodySize) AttrNetworkProtocolVersion(val string) attribute.KeyValue { + return attribute.String("network.protocol.version", val) +} + +// AttrServerAddress returns an optional attribute for the "server.address" +// semantic convention. It represents the name of the local HTTP server that +// received the request. +func (ServerRequestBodySize) AttrServerAddress(val string) attribute.KeyValue { + return attribute.String("server.address", val) +} + +// AttrServerPort returns an optional attribute for the "server.port" semantic +// convention. It represents the port of the local HTTP server that received the +// request. +func (ServerRequestBodySize) AttrServerPort(val int) attribute.KeyValue { + return attribute.Int("server.port", val) +} + +// AttrUserAgentSyntheticType returns an optional attribute for the +// "user_agent.synthetic.type" semantic convention. It represents the specifies +// the category of synthetic traffic, such as tests or bots. +func (ServerRequestBodySize) AttrUserAgentSyntheticType(val UserAgentSyntheticTypeAttr) attribute.KeyValue { + return attribute.String("user_agent.synthetic.type", string(val)) +} + +// ServerRequestDuration is an instrument used to record metric values conforming +// to the "http.server.request.duration" semantic conventions. It represents the +// duration of HTTP server requests. +type ServerRequestDuration struct { + metric.Float64Histogram +} + +var newServerRequestDurationOpts = []metric.Float64HistogramOption{ + metric.WithDescription("Duration of HTTP server requests."), + metric.WithUnit("s"), +} + +// NewServerRequestDuration returns a new ServerRequestDuration instrument. +func NewServerRequestDuration( + m metric.Meter, + opt ...metric.Float64HistogramOption, +) (ServerRequestDuration, error) { + // Check if the meter is nil. + if m == nil { + return ServerRequestDuration{noop.Float64Histogram{}}, nil + } + + if len(opt) == 0 { + opt = newServerRequestDurationOpts + } else { + opt = append(opt, newServerRequestDurationOpts...) + } + + i, err := m.Float64Histogram( + "http.server.request.duration", + opt..., + ) + if err != nil { + return ServerRequestDuration{noop.Float64Histogram{}}, err + } + return ServerRequestDuration{i}, nil +} + +// Inst returns the underlying metric instrument. +func (m ServerRequestDuration) Inst() metric.Float64Histogram { + return m.Float64Histogram +} + +// Name returns the semantic convention name of the instrument. +func (ServerRequestDuration) Name() string { + return "http.server.request.duration" +} + +// Unit returns the semantic convention unit of the instrument +func (ServerRequestDuration) Unit() string { + return "s" +} + +// Description returns the semantic convention description of the instrument +func (ServerRequestDuration) Description() string { + return "Duration of HTTP server requests." +} + +// Record records val to the current distribution for attrs. +// +// The requestMethod is the HTTP request method. +// +// The urlScheme is the the [URI scheme] component identifying the used protocol. +// +// All additional attrs passed are included in the recorded value. +// +// [URI scheme]: https://www.rfc-editor.org/rfc/rfc3986#section-3.1 +func (m ServerRequestDuration) Record( + ctx context.Context, + val float64, + requestMethod RequestMethodAttr, + urlScheme string, + attrs ...attribute.KeyValue, +) { + if len(attrs) == 0 { + m.Float64Histogram.Record(ctx, val, metric.WithAttributes( + attribute.String("http.request.method", string(requestMethod)), + attribute.String("url.scheme", urlScheme), + )) + return + } + + o := recOptPool.Get().(*[]metric.RecordOption) + defer func() { + *o = (*o)[:0] + recOptPool.Put(o) + }() + + *o = append( + *o, + metric.WithAttributes( + append( + attrs[:len(attrs):len(attrs)], + attribute.String("http.request.method", string(requestMethod)), + attribute.String("url.scheme", urlScheme), + )..., + ), + ) + + m.Float64Histogram.Record(ctx, val, *o...) +} + +// RecordSet records val to the current distribution for set. +func (m ServerRequestDuration) RecordSet(ctx context.Context, val float64, set attribute.Set) { + if set.Len() == 0 { + m.Float64Histogram.Record(ctx, val) + return + } + + o := recOptPool.Get().(*[]metric.RecordOption) + defer func() { + *o = (*o)[:0] + recOptPool.Put(o) + }() + + *o = append(*o, metric.WithAttributeSet(set)) + m.Float64Histogram.Record(ctx, val, *o...) +} + +// AttrErrorType returns an optional attribute for the "error.type" semantic +// convention. It represents the describes a class of error the operation ended +// with. +func (ServerRequestDuration) AttrErrorType(val ErrorTypeAttr) attribute.KeyValue { + return attribute.String("error.type", string(val)) +} + +// AttrResponseStatusCode returns an optional attribute for the +// "http.response.status_code" semantic convention. It represents the +// [HTTP response status code]. +// +// [HTTP response status code]: https://tools.ietf.org/html/rfc7231#section-6 +func (ServerRequestDuration) AttrResponseStatusCode(val int) attribute.KeyValue { + return attribute.Int("http.response.status_code", val) +} + +// AttrRoute returns an optional attribute for the "http.route" semantic +// convention. It represents the matched route template for the request. This +// MUST be low-cardinality and include all static path segments, with dynamic +// path segments represented with placeholders. +func (ServerRequestDuration) AttrRoute(val string) attribute.KeyValue { + return attribute.String("http.route", val) +} + +// AttrNetworkProtocolName returns an optional attribute for the +// "network.protocol.name" semantic convention. It represents the +// [OSI application layer] or non-OSI equivalent. +// +// [OSI application layer]: https://wikipedia.org/wiki/Application_layer +func (ServerRequestDuration) AttrNetworkProtocolName(val string) attribute.KeyValue { + return attribute.String("network.protocol.name", val) +} + +// AttrNetworkProtocolVersion returns an optional attribute for the +// "network.protocol.version" semantic convention. It represents the actual +// version of the protocol used for network communication. +func (ServerRequestDuration) AttrNetworkProtocolVersion(val string) attribute.KeyValue { + return attribute.String("network.protocol.version", val) +} + +// AttrServerAddress returns an optional attribute for the "server.address" +// semantic convention. It represents the name of the local HTTP server that +// received the request. +func (ServerRequestDuration) AttrServerAddress(val string) attribute.KeyValue { + return attribute.String("server.address", val) +} + +// AttrServerPort returns an optional attribute for the "server.port" semantic +// convention. It represents the port of the local HTTP server that received the +// request. +func (ServerRequestDuration) AttrServerPort(val int) attribute.KeyValue { + return attribute.Int("server.port", val) +} + +// AttrUserAgentSyntheticType returns an optional attribute for the +// "user_agent.synthetic.type" semantic convention. It represents the specifies +// the category of synthetic traffic, such as tests or bots. +func (ServerRequestDuration) AttrUserAgentSyntheticType(val UserAgentSyntheticTypeAttr) attribute.KeyValue { + return attribute.String("user_agent.synthetic.type", string(val)) +} + +// ServerResponseBodySize is an instrument used to record metric values +// conforming to the "http.server.response.body.size" semantic conventions. It +// represents the size of HTTP server response bodies. +type ServerResponseBodySize struct { + metric.Int64Histogram +} + +var newServerResponseBodySizeOpts = []metric.Int64HistogramOption{ + metric.WithDescription("Size of HTTP server response bodies."), + metric.WithUnit("By"), +} + +// NewServerResponseBodySize returns a new ServerResponseBodySize instrument. +func NewServerResponseBodySize( + m metric.Meter, + opt ...metric.Int64HistogramOption, +) (ServerResponseBodySize, error) { + // Check if the meter is nil. + if m == nil { + return ServerResponseBodySize{noop.Int64Histogram{}}, nil + } + + if len(opt) == 0 { + opt = newServerResponseBodySizeOpts + } else { + opt = append(opt, newServerResponseBodySizeOpts...) + } + + i, err := m.Int64Histogram( + "http.server.response.body.size", + opt..., + ) + if err != nil { + return ServerResponseBodySize{noop.Int64Histogram{}}, err + } + return ServerResponseBodySize{i}, nil +} + +// Inst returns the underlying metric instrument. +func (m ServerResponseBodySize) Inst() metric.Int64Histogram { + return m.Int64Histogram +} + +// Name returns the semantic convention name of the instrument. +func (ServerResponseBodySize) Name() string { + return "http.server.response.body.size" +} + +// Unit returns the semantic convention unit of the instrument +func (ServerResponseBodySize) Unit() string { + return "By" +} + +// Description returns the semantic convention description of the instrument +func (ServerResponseBodySize) Description() string { + return "Size of HTTP server response bodies." +} + +// Record records val to the current distribution for attrs. +// +// The requestMethod is the HTTP request method. +// +// The urlScheme is the the [URI scheme] component identifying the used protocol. +// +// All additional attrs passed are included in the recorded value. +// +// [URI scheme]: https://www.rfc-editor.org/rfc/rfc3986#section-3.1 +// +// The size of the response payload body in bytes. This is the number of bytes +// transferred excluding headers and is often, but not always, present as the +// [Content-Length] header. For requests using transport encoding, this should be +// the compressed size. +// +// [Content-Length]: https://www.rfc-editor.org/rfc/rfc9110.html#field.content-length +func (m ServerResponseBodySize) Record( + ctx context.Context, + val int64, + requestMethod RequestMethodAttr, + urlScheme string, + attrs ...attribute.KeyValue, +) { + if len(attrs) == 0 { + m.Int64Histogram.Record(ctx, val, metric.WithAttributes( + attribute.String("http.request.method", string(requestMethod)), + attribute.String("url.scheme", urlScheme), + )) + return + } + + o := recOptPool.Get().(*[]metric.RecordOption) + defer func() { + *o = (*o)[:0] + recOptPool.Put(o) + }() + + *o = append( + *o, + metric.WithAttributes( + append( + attrs[:len(attrs):len(attrs)], + attribute.String("http.request.method", string(requestMethod)), + attribute.String("url.scheme", urlScheme), + )..., + ), + ) + + m.Int64Histogram.Record(ctx, val, *o...) +} + +// RecordSet records val to the current distribution for set. +// +// The size of the response payload body in bytes. This is the number of bytes +// transferred excluding headers and is often, but not always, present as the +// [Content-Length] header. For requests using transport encoding, this should be +// the compressed size. +// +// [Content-Length]: https://www.rfc-editor.org/rfc/rfc9110.html#field.content-length +func (m ServerResponseBodySize) RecordSet(ctx context.Context, val int64, set attribute.Set) { + if set.Len() == 0 { + m.Int64Histogram.Record(ctx, val) + return + } + + o := recOptPool.Get().(*[]metric.RecordOption) + defer func() { + *o = (*o)[:0] + recOptPool.Put(o) + }() + + *o = append(*o, metric.WithAttributeSet(set)) + m.Int64Histogram.Record(ctx, val, *o...) +} + +// AttrErrorType returns an optional attribute for the "error.type" semantic +// convention. It represents the describes a class of error the operation ended +// with. +func (ServerResponseBodySize) AttrErrorType(val ErrorTypeAttr) attribute.KeyValue { + return attribute.String("error.type", string(val)) +} + +// AttrResponseStatusCode returns an optional attribute for the +// "http.response.status_code" semantic convention. It represents the +// [HTTP response status code]. +// +// [HTTP response status code]: https://tools.ietf.org/html/rfc7231#section-6 +func (ServerResponseBodySize) AttrResponseStatusCode(val int) attribute.KeyValue { + return attribute.Int("http.response.status_code", val) +} + +// AttrRoute returns an optional attribute for the "http.route" semantic +// convention. It represents the matched route template for the request. This +// MUST be low-cardinality and include all static path segments, with dynamic +// path segments represented with placeholders. +func (ServerResponseBodySize) AttrRoute(val string) attribute.KeyValue { + return attribute.String("http.route", val) +} + +// AttrNetworkProtocolName returns an optional attribute for the +// "network.protocol.name" semantic convention. It represents the +// [OSI application layer] or non-OSI equivalent. +// +// [OSI application layer]: https://wikipedia.org/wiki/Application_layer +func (ServerResponseBodySize) AttrNetworkProtocolName(val string) attribute.KeyValue { + return attribute.String("network.protocol.name", val) +} + +// AttrNetworkProtocolVersion returns an optional attribute for the +// "network.protocol.version" semantic convention. It represents the actual +// version of the protocol used for network communication. +func (ServerResponseBodySize) AttrNetworkProtocolVersion(val string) attribute.KeyValue { + return attribute.String("network.protocol.version", val) +} + +// AttrServerAddress returns an optional attribute for the "server.address" +// semantic convention. It represents the name of the local HTTP server that +// received the request. +func (ServerResponseBodySize) AttrServerAddress(val string) attribute.KeyValue { + return attribute.String("server.address", val) +} + +// AttrServerPort returns an optional attribute for the "server.port" semantic +// convention. It represents the port of the local HTTP server that received the +// request. +func (ServerResponseBodySize) AttrServerPort(val int) attribute.KeyValue { + return attribute.Int("server.port", val) +} + +// AttrUserAgentSyntheticType returns an optional attribute for the +// "user_agent.synthetic.type" semantic convention. It represents the specifies +// the category of synthetic traffic, such as tests or bots. +func (ServerResponseBodySize) AttrUserAgentSyntheticType(val UserAgentSyntheticTypeAttr) attribute.KeyValue { + return attribute.String("user_agent.synthetic.type", string(val)) +} diff --git a/vendor/go.opentelemetry.io/otel/semconv/v1.40.0/schema.go b/vendor/go.opentelemetry.io/otel/semconv/v1.40.0/schema.go new file mode 100644 index 00000000..a07ffa33 --- /dev/null +++ b/vendor/go.opentelemetry.io/otel/semconv/v1.40.0/schema.go @@ -0,0 +1,9 @@ +// Copyright The OpenTelemetry Authors +// SPDX-License-Identifier: Apache-2.0 + +package semconv // import "go.opentelemetry.io/otel/semconv/v1.40.0" + +// SchemaURL is the schema URL that matches the version of the semantic conventions +// that this package defines. Semconv packages starting from v1.4.0 must declare +// non-empty schema URL in the form https://opentelemetry.io/schemas/ +const SchemaURL = "https://opentelemetry.io/schemas/1.40.0" diff --git a/vendor/go.opentelemetry.io/otel/trace.go b/vendor/go.opentelemetry.io/otel/trace.go new file mode 100644 index 00000000..6836c654 --- /dev/null +++ b/vendor/go.opentelemetry.io/otel/trace.go @@ -0,0 +1,36 @@ +// Copyright The OpenTelemetry Authors +// SPDX-License-Identifier: Apache-2.0 + +package otel // import "go.opentelemetry.io/otel" + +import ( + "go.opentelemetry.io/otel/internal/global" + "go.opentelemetry.io/otel/trace" +) + +// Tracer creates a named tracer that implements Tracer interface. +// If the name is an empty string then provider uses default name. +// +// This is short for GetTracerProvider().Tracer(name, opts...) +func Tracer(name string, opts ...trace.TracerOption) trace.Tracer { + return GetTracerProvider().Tracer(name, opts...) +} + +// GetTracerProvider returns the registered global trace provider. +// If none is registered then an instance of NoopTracerProvider is returned. +// +// Use the trace provider to create a named tracer. E.g. +// +// tracer := otel.GetTracerProvider().Tracer("example.com/foo") +// +// or +// +// tracer := otel.Tracer("example.com/foo") +func GetTracerProvider() trace.TracerProvider { + return global.TracerProvider() +} + +// SetTracerProvider registers `tp` as the global trace provider. +func SetTracerProvider(tp trace.TracerProvider) { + global.SetTracerProvider(tp) +} diff --git a/vendor/go.opentelemetry.io/otel/trace/LICENSE b/vendor/go.opentelemetry.io/otel/trace/LICENSE new file mode 100644 index 00000000..f1aee0f1 --- /dev/null +++ b/vendor/go.opentelemetry.io/otel/trace/LICENSE @@ -0,0 +1,231 @@ + Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + + TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + + 1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + + 2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + + 3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + + 4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + + 5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + + 6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + + 7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + + 8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + + 9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + + END OF TERMS AND CONDITIONS + + APPENDIX: How to apply the Apache License to your work. + + To apply the Apache License to your work, attach the following + boilerplate notice, with the fields enclosed by brackets "[]" + replaced with your own identifying information. (Don't include + the brackets!) The text should be enclosed in the appropriate + comment syntax for the file format. We also recommend that a + file or class name and description of purpose be included on the + same "printed page" as the copyright notice for easier + identification within third-party archives. + + Copyright [yyyy] [name of copyright owner] + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. + +-------------------------------------------------------------------------------- + +Copyright 2009 The Go Authors. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are +met: + + * Redistributions of source code must retain the above copyright +notice, this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above +copyright notice, this list of conditions and the following disclaimer +in the documentation and/or other materials provided with the +distribution. + * Neither the name of Google LLC nor the names of its +contributors may be used to endorse or promote products derived from +this software without specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. \ No newline at end of file diff --git a/vendor/go.opentelemetry.io/otel/trace/README.md b/vendor/go.opentelemetry.io/otel/trace/README.md new file mode 100644 index 00000000..58ccaba6 --- /dev/null +++ b/vendor/go.opentelemetry.io/otel/trace/README.md @@ -0,0 +1,3 @@ +# Trace API + +[![PkgGoDev](https://pkg.go.dev/badge/go.opentelemetry.io/otel/trace)](https://pkg.go.dev/go.opentelemetry.io/otel/trace) diff --git a/vendor/go.opentelemetry.io/otel/trace/auto.go b/vendor/go.opentelemetry.io/otel/trace/auto.go new file mode 100644 index 00000000..9316fd0a --- /dev/null +++ b/vendor/go.opentelemetry.io/otel/trace/auto.go @@ -0,0 +1,662 @@ +// Copyright The OpenTelemetry Authors +// SPDX-License-Identifier: Apache-2.0 + +package trace // import "go.opentelemetry.io/otel/trace" + +import ( + "context" + "encoding/json" + "fmt" + "math" + "os" + "reflect" + "runtime" + "strconv" + "strings" + "sync" + "sync/atomic" + "time" + "unicode/utf8" + + "go.opentelemetry.io/otel/attribute" + "go.opentelemetry.io/otel/codes" + semconv "go.opentelemetry.io/otel/semconv/v1.40.0" + "go.opentelemetry.io/otel/trace/embedded" + "go.opentelemetry.io/otel/trace/internal/telemetry" +) + +// newAutoTracerProvider returns an auto-instrumentable [trace.TracerProvider]. +// If an [go.opentelemetry.io/auto.Instrumentation] is configured to instrument +// the process using the returned TracerProvider, all of the telemetry it +// produces will be processed and handled by that Instrumentation. By default, +// if no Instrumentation instruments the TracerProvider it will not generate +// any trace telemetry. +func newAutoTracerProvider() TracerProvider { return tracerProviderInstance } + +var tracerProviderInstance = new(autoTracerProvider) + +type autoTracerProvider struct{ embedded.TracerProvider } + +var _ TracerProvider = autoTracerProvider{} + +func (autoTracerProvider) Tracer(name string, opts ...TracerOption) Tracer { + cfg := NewTracerConfig(opts...) + return autoTracer{ + name: name, + version: cfg.InstrumentationVersion(), + schemaURL: cfg.SchemaURL(), + } +} + +type autoTracer struct { + embedded.Tracer + + name, schemaURL, version string +} + +var _ Tracer = autoTracer{} + +func (t autoTracer) Start(ctx context.Context, name string, opts ...SpanStartOption) (context.Context, Span) { + var psc, sc SpanContext + sampled := true + span := new(autoSpan) + + // Ask eBPF for sampling decision and span context info. + t.start(ctx, span, &psc, &sampled, &sc) + + span.sampled.Store(sampled) + span.spanContext = sc + + ctx = ContextWithSpan(ctx, span) + + if sampled { + // Only build traces if sampled. + cfg := NewSpanStartConfig(opts...) + span.traces, span.span = t.traces(name, cfg, span.spanContext, psc) + } + + return ctx, span +} + +// Expected to be implemented in eBPF. +// +//go:noinline +func (*autoTracer) start( + ctx context.Context, + spanPtr *autoSpan, + psc *SpanContext, + sampled *bool, + sc *SpanContext, +) { + start(ctx, spanPtr, psc, sampled, sc) +} + +// start is used for testing. +var start = func(context.Context, *autoSpan, *SpanContext, *bool, *SpanContext) {} + +func (t autoTracer) traces(name string, cfg SpanConfig, sc, psc SpanContext) (*telemetry.Traces, *telemetry.Span) { + span := &telemetry.Span{ + TraceID: telemetry.TraceID(sc.TraceID()), + SpanID: telemetry.SpanID(sc.SpanID()), + Flags: uint32(sc.TraceFlags()), + TraceState: sc.TraceState().String(), + ParentSpanID: telemetry.SpanID(psc.SpanID()), + Name: name, + Kind: spanKind(cfg.SpanKind()), + } + + span.Attrs, span.DroppedAttrs = convCappedAttrs(maxSpan.Attrs, cfg.Attributes()) + + links := cfg.Links() + if limit := maxSpan.Links; limit == 0 { + n := int64(len(links)) + if n > 0 { + span.DroppedLinks = uint32(min(n, math.MaxUint32)) // nolint: gosec // Bounds checked. + } + } else { + if limit > 0 { + n := int64(max(len(links)-limit, 0)) + span.DroppedLinks = uint32(min(n, math.MaxUint32)) // nolint: gosec // Bounds checked. + links = links[n:] + } + span.Links = convLinks(links) + } + + if t := cfg.Timestamp(); !t.IsZero() { + span.StartTime = cfg.Timestamp() + } else { + span.StartTime = time.Now() + } + + return &telemetry.Traces{ + ResourceSpans: []*telemetry.ResourceSpans{ + { + ScopeSpans: []*telemetry.ScopeSpans{ + { + Scope: &telemetry.Scope{ + Name: t.name, + Version: t.version, + }, + Spans: []*telemetry.Span{span}, + SchemaURL: t.schemaURL, + }, + }, + }, + }, + }, span +} + +func spanKind(kind SpanKind) telemetry.SpanKind { + switch kind { + case SpanKindInternal: + return telemetry.SpanKindInternal + case SpanKindServer: + return telemetry.SpanKindServer + case SpanKindClient: + return telemetry.SpanKindClient + case SpanKindProducer: + return telemetry.SpanKindProducer + case SpanKindConsumer: + return telemetry.SpanKindConsumer + } + return telemetry.SpanKind(0) // undefined. +} + +type autoSpan struct { + embedded.Span + + spanContext SpanContext + sampled atomic.Bool + + mu sync.Mutex + traces *telemetry.Traces + span *telemetry.Span +} + +func (s *autoSpan) SpanContext() SpanContext { + if s == nil { + return SpanContext{} + } + // s.spanContext is immutable, do not acquire lock s.mu. + return s.spanContext +} + +func (s *autoSpan) IsRecording() bool { + if s == nil { + return false + } + + return s.sampled.Load() +} + +func (s *autoSpan) SetStatus(c codes.Code, msg string) { + if s == nil || !s.sampled.Load() { + return + } + + s.mu.Lock() + defer s.mu.Unlock() + + if s.span.Status == nil { + s.span.Status = new(telemetry.Status) + } + + s.span.Status.Message = msg + + switch c { + case codes.Unset: + s.span.Status.Code = telemetry.StatusCodeUnset + case codes.Error: + s.span.Status.Code = telemetry.StatusCodeError + case codes.Ok: + s.span.Status.Code = telemetry.StatusCodeOK + } +} + +func (s *autoSpan) SetAttributes(attrs ...attribute.KeyValue) { + if s == nil || !s.sampled.Load() { + return + } + + s.mu.Lock() + defer s.mu.Unlock() + + limit := maxSpan.Attrs + if limit == 0 { + // No attributes allowed. + n := int64(len(attrs)) + if n > 0 { + s.span.DroppedAttrs += uint32(min(n, math.MaxUint32)) // nolint: gosec // Bounds checked. + } + return + } + + m := make(map[string]int) + for i, a := range s.span.Attrs { + m[a.Key] = i + } + + for _, a := range attrs { + val := convAttrValue(a.Value) + if val.Empty() { + s.span.DroppedAttrs++ + continue + } + + if idx, ok := m[string(a.Key)]; ok { + s.span.Attrs[idx] = telemetry.Attr{ + Key: string(a.Key), + Value: val, + } + } else if limit < 0 || len(s.span.Attrs) < limit { + s.span.Attrs = append(s.span.Attrs, telemetry.Attr{ + Key: string(a.Key), + Value: val, + }) + m[string(a.Key)] = len(s.span.Attrs) - 1 + } else { + s.span.DroppedAttrs++ + } + } +} + +// convCappedAttrs converts up to limit attrs into a []telemetry.Attr. The +// number of dropped attributes is also returned. +func convCappedAttrs(limit int, attrs []attribute.KeyValue) ([]telemetry.Attr, uint32) { + n := len(attrs) + if limit == 0 { + var out uint32 + if n > 0 { + out = uint32(min(int64(n), math.MaxUint32)) // nolint: gosec // Bounds checked. + } + return nil, out + } + + if limit < 0 { + // Unlimited. + return convAttrs(attrs), 0 + } + + if n < 0 { + n = 0 + } + + limit = min(n, limit) + return convAttrs(attrs[:limit]), uint32(n - limit) // nolint: gosec // Bounds checked. +} + +func convAttrs(attrs []attribute.KeyValue) []telemetry.Attr { + if len(attrs) == 0 { + // Avoid allocations if not necessary. + return nil + } + + out := make([]telemetry.Attr, 0, len(attrs)) + for _, attr := range attrs { + key := string(attr.Key) + val := convAttrValue(attr.Value) + if val.Empty() { + continue + } + out = append(out, telemetry.Attr{Key: key, Value: val}) + } + return out +} + +func convAttrValue(value attribute.Value) telemetry.Value { + switch value.Type() { + case attribute.BOOL: + return telemetry.BoolValue(value.AsBool()) + case attribute.INT64: + return telemetry.Int64Value(value.AsInt64()) + case attribute.FLOAT64: + return telemetry.Float64Value(value.AsFloat64()) + case attribute.STRING: + v := truncate(maxSpan.AttrValueLen, value.AsString()) + return telemetry.StringValue(v) + case attribute.BOOLSLICE: + slice := value.AsBoolSlice() + out := make([]telemetry.Value, 0, len(slice)) + for _, v := range slice { + out = append(out, telemetry.BoolValue(v)) + } + return telemetry.SliceValue(out...) + case attribute.INT64SLICE: + slice := value.AsInt64Slice() + out := make([]telemetry.Value, 0, len(slice)) + for _, v := range slice { + out = append(out, telemetry.Int64Value(v)) + } + return telemetry.SliceValue(out...) + case attribute.FLOAT64SLICE: + slice := value.AsFloat64Slice() + out := make([]telemetry.Value, 0, len(slice)) + for _, v := range slice { + out = append(out, telemetry.Float64Value(v)) + } + return telemetry.SliceValue(out...) + case attribute.STRINGSLICE: + slice := value.AsStringSlice() + out := make([]telemetry.Value, 0, len(slice)) + for _, v := range slice { + v = truncate(maxSpan.AttrValueLen, v) + out = append(out, telemetry.StringValue(v)) + } + return telemetry.SliceValue(out...) + } + return telemetry.Value{} +} + +// truncate returns a truncated version of s such that it contains less than +// the limit number of characters. Truncation is applied by returning the limit +// number of valid characters contained in s. +// +// If limit is negative, it returns the original string. +// +// UTF-8 is supported. When truncating, all invalid characters are dropped +// before applying truncation. +// +// If s already contains less than the limit number of bytes, it is returned +// unchanged. No invalid characters are removed. +func truncate(limit int, s string) string { + // This prioritize performance in the following order based on the most + // common expected use-cases. + // + // - Short values less than the default limit (128). + // - Strings with valid encodings that exceed the limit. + // - No limit. + // - Strings with invalid encodings that exceed the limit. + if limit < 0 || len(s) <= limit { + return s + } + + // Optimistically, assume all valid UTF-8. + var b strings.Builder + count := 0 + for i, c := range s { + if c != utf8.RuneError { + count++ + if count > limit { + return s[:i] + } + continue + } + + _, size := utf8.DecodeRuneInString(s[i:]) + if size == 1 { + // Invalid encoding. + b.Grow(len(s) - 1) + _, _ = b.WriteString(s[:i]) + s = s[i:] + break + } + } + + // Fast-path, no invalid input. + if b.Cap() == 0 { + return s + } + + // Truncate while validating UTF-8. + for i := 0; i < len(s) && count < limit; { + c := s[i] + if c < utf8.RuneSelf { + // Optimization for single byte runes (common case). + _ = b.WriteByte(c) + i++ + count++ + continue + } + + _, size := utf8.DecodeRuneInString(s[i:]) + if size == 1 { + // We checked for all 1-byte runes above, this is a RuneError. + i++ + continue + } + + _, _ = b.WriteString(s[i : i+size]) + i += size + count++ + } + + return b.String() +} + +func (s *autoSpan) End(opts ...SpanEndOption) { + if s == nil || !s.sampled.Swap(false) { + return + } + + // s.end exists so the lock (s.mu) is not held while s.ended is called. + s.ended(s.end(opts)) +} + +func (s *autoSpan) end(opts []SpanEndOption) []byte { + s.mu.Lock() + defer s.mu.Unlock() + + cfg := NewSpanEndConfig(opts...) + if t := cfg.Timestamp(); !t.IsZero() { + s.span.EndTime = cfg.Timestamp() + } else { + s.span.EndTime = time.Now() + } + + b, _ := json.Marshal(s.traces) // TODO: do not ignore this error. + return b +} + +// Expected to be implemented in eBPF. +// +//go:noinline +func (*autoSpan) ended(buf []byte) { ended(buf) } + +// ended is used for testing. +var ended = func([]byte) {} + +func (s *autoSpan) RecordError(err error, opts ...EventOption) { + if s == nil || err == nil || !s.sampled.Load() { + return + } + + cfg := NewEventConfig(opts...) + + attrs := cfg.Attributes() + attrs = append(attrs, + semconv.ExceptionType(typeStr(err)), + semconv.ExceptionMessage(err.Error()), + ) + if cfg.StackTrace() { + buf := make([]byte, 2048) + n := runtime.Stack(buf, false) + attrs = append(attrs, semconv.ExceptionStacktrace(string(buf[0:n]))) + } + + s.mu.Lock() + defer s.mu.Unlock() + + s.addEvent(semconv.ExceptionEventName, cfg.Timestamp(), attrs) +} + +func typeStr(i any) string { + t := reflect.TypeOf(i) + if t.PkgPath() == "" && t.Name() == "" { + // Likely a builtin type. + return t.String() + } + return fmt.Sprintf("%s.%s", t.PkgPath(), t.Name()) +} + +func (s *autoSpan) AddEvent(name string, opts ...EventOption) { + if s == nil || !s.sampled.Load() { + return + } + + cfg := NewEventConfig(opts...) + + s.mu.Lock() + defer s.mu.Unlock() + + s.addEvent(name, cfg.Timestamp(), cfg.Attributes()) +} + +// addEvent adds an event with name and attrs at tStamp to the span. The span +// lock (s.mu) needs to be held by the caller. +func (s *autoSpan) addEvent(name string, tStamp time.Time, attrs []attribute.KeyValue) { + limit := maxSpan.Events + + if limit == 0 { + s.span.DroppedEvents++ + return + } + + if limit > 0 && len(s.span.Events) == limit { + // Drop head while avoiding allocation of more capacity. + copy(s.span.Events[:limit-1], s.span.Events[1:]) + s.span.Events = s.span.Events[:limit-1] + s.span.DroppedEvents++ + } + + e := &telemetry.SpanEvent{Time: tStamp, Name: name} + e.Attrs, e.DroppedAttrs = convCappedAttrs(maxSpan.EventAttrs, attrs) + + s.span.Events = append(s.span.Events, e) +} + +func (s *autoSpan) AddLink(link Link) { + if s == nil || !s.sampled.Load() { + return + } + + l := maxSpan.Links + + s.mu.Lock() + defer s.mu.Unlock() + + if l == 0 { + s.span.DroppedLinks++ + return + } + + if l > 0 && len(s.span.Links) == l { + // Drop head while avoiding allocation of more capacity. + copy(s.span.Links[:l-1], s.span.Links[1:]) + s.span.Links = s.span.Links[:l-1] + s.span.DroppedLinks++ + } + + s.span.Links = append(s.span.Links, convLink(link)) +} + +func convLinks(links []Link) []*telemetry.SpanLink { + out := make([]*telemetry.SpanLink, 0, len(links)) + for _, link := range links { + out = append(out, convLink(link)) + } + return out +} + +func convLink(link Link) *telemetry.SpanLink { + l := &telemetry.SpanLink{ + TraceID: telemetry.TraceID(link.SpanContext.TraceID()), + SpanID: telemetry.SpanID(link.SpanContext.SpanID()), + TraceState: link.SpanContext.TraceState().String(), + Flags: uint32(link.SpanContext.TraceFlags()), + } + l.Attrs, l.DroppedAttrs = convCappedAttrs(maxSpan.LinkAttrs, link.Attributes) + + return l +} + +func (s *autoSpan) SetName(name string) { + if s == nil || !s.sampled.Load() { + return + } + + s.mu.Lock() + defer s.mu.Unlock() + + s.span.Name = name +} + +func (*autoSpan) TracerProvider() TracerProvider { return newAutoTracerProvider() } + +// maxSpan are the span limits resolved during startup. +var maxSpan = newSpanLimits() + +type spanLimits struct { + // Attrs is the number of allowed attributes for a span. + // + // This is resolved from the environment variable value for the + // OTEL_SPAN_ATTRIBUTE_COUNT_LIMIT key if it exists. Otherwise, the + // environment variable value for OTEL_ATTRIBUTE_COUNT_LIMIT, or 128 if + // that is not set, is used. + Attrs int + // AttrValueLen is the maximum attribute value length allowed for a span. + // + // This is resolved from the environment variable value for the + // OTEL_SPAN_ATTRIBUTE_VALUE_LENGTH_LIMIT key if it exists. Otherwise, the + // environment variable value for OTEL_ATTRIBUTE_VALUE_LENGTH_LIMIT, or -1 + // if that is not set, is used. + AttrValueLen int + // Events is the number of allowed events for a span. + // + // This is resolved from the environment variable value for the + // OTEL_SPAN_EVENT_COUNT_LIMIT key, or 128 is used if that is not set. + Events int + // EventAttrs is the number of allowed attributes for a span event. + // + // The is resolved from the environment variable value for the + // OTEL_EVENT_ATTRIBUTE_COUNT_LIMIT key, or 128 is used if that is not set. + EventAttrs int + // Links is the number of allowed Links for a span. + // + // This is resolved from the environment variable value for the + // OTEL_SPAN_LINK_COUNT_LIMIT, or 128 is used if that is not set. + Links int + // LinkAttrs is the number of allowed attributes for a span link. + // + // This is resolved from the environment variable value for the + // OTEL_LINK_ATTRIBUTE_COUNT_LIMIT, or 128 is used if that is not set. + LinkAttrs int +} + +func newSpanLimits() spanLimits { + return spanLimits{ + Attrs: firstEnv( + 128, + "OTEL_SPAN_ATTRIBUTE_COUNT_LIMIT", + "OTEL_ATTRIBUTE_COUNT_LIMIT", + ), + AttrValueLen: firstEnv( + -1, // Unlimited. + "OTEL_SPAN_ATTRIBUTE_VALUE_LENGTH_LIMIT", + "OTEL_ATTRIBUTE_VALUE_LENGTH_LIMIT", + ), + Events: firstEnv(128, "OTEL_SPAN_EVENT_COUNT_LIMIT"), + EventAttrs: firstEnv(128, "OTEL_EVENT_ATTRIBUTE_COUNT_LIMIT"), + Links: firstEnv(128, "OTEL_SPAN_LINK_COUNT_LIMIT"), + LinkAttrs: firstEnv(128, "OTEL_LINK_ATTRIBUTE_COUNT_LIMIT"), + } +} + +// firstEnv returns the parsed integer value of the first matching environment +// variable from keys. The defaultVal is returned if the value is not an +// integer or no match is found. +func firstEnv(defaultVal int, keys ...string) int { + for _, key := range keys { + strV := os.Getenv(key) + if strV == "" { + continue + } + + v, err := strconv.Atoi(strV) + if err == nil { + return v + } + // Ignore invalid environment variable. + } + + return defaultVal +} diff --git a/vendor/go.opentelemetry.io/otel/trace/config.go b/vendor/go.opentelemetry.io/otel/trace/config.go new file mode 100644 index 00000000..d9ecef1c --- /dev/null +++ b/vendor/go.opentelemetry.io/otel/trace/config.go @@ -0,0 +1,362 @@ +// Copyright The OpenTelemetry Authors +// SPDX-License-Identifier: Apache-2.0 + +package trace // import "go.opentelemetry.io/otel/trace" + +import ( + "slices" + "time" + + "go.opentelemetry.io/otel/attribute" +) + +// TracerConfig is a group of options for a Tracer. +type TracerConfig struct { + instrumentationVersion string + // Schema URL of the telemetry emitted by the Tracer. + schemaURL string + attrs attribute.Set +} + +// InstrumentationVersion returns the version of the library providing instrumentation. +func (t *TracerConfig) InstrumentationVersion() string { + return t.instrumentationVersion +} + +// InstrumentationAttributes returns the attributes associated with the library +// providing instrumentation. +func (t *TracerConfig) InstrumentationAttributes() attribute.Set { + return t.attrs +} + +// SchemaURL returns the Schema URL of the telemetry emitted by the Tracer. +func (t *TracerConfig) SchemaURL() string { + return t.schemaURL +} + +// NewTracerConfig applies all the options to a returned TracerConfig. +func NewTracerConfig(options ...TracerOption) TracerConfig { + var config TracerConfig + for _, option := range options { + config = option.apply(config) + } + return config +} + +// TracerOption applies an option to a TracerConfig. +type TracerOption interface { + apply(TracerConfig) TracerConfig +} + +type tracerOptionFunc func(TracerConfig) TracerConfig + +func (fn tracerOptionFunc) apply(cfg TracerConfig) TracerConfig { + return fn(cfg) +} + +// SpanConfig is a group of options for a Span. +type SpanConfig struct { + attributes []attribute.KeyValue + timestamp time.Time + links []Link + newRoot bool + spanKind SpanKind + stackTrace bool +} + +// Attributes describe the associated qualities of a Span. +func (cfg *SpanConfig) Attributes() []attribute.KeyValue { + return cfg.attributes +} + +// Timestamp is a time in a Span life-cycle. +func (cfg *SpanConfig) Timestamp() time.Time { + return cfg.timestamp +} + +// StackTrace reports whether stack trace capturing is enabled. +func (cfg *SpanConfig) StackTrace() bool { + return cfg.stackTrace +} + +// Links are the associations a Span has with other Spans. +func (cfg *SpanConfig) Links() []Link { + return cfg.links +} + +// NewRoot identifies a Span as the root Span for a new trace. This is +// commonly used when an existing trace crosses trust boundaries and the +// remote parent span context should be ignored for security. +func (cfg *SpanConfig) NewRoot() bool { + return cfg.newRoot +} + +// SpanKind is the role a Span has in a trace. +func (cfg *SpanConfig) SpanKind() SpanKind { + return cfg.spanKind +} + +// NewSpanStartConfig applies all the options to a returned SpanConfig. +// No validation is performed on the returned SpanConfig (e.g. no uniqueness +// checking or bounding of data), it is left to the SDK to perform this +// action. +func NewSpanStartConfig(options ...SpanStartOption) SpanConfig { + var c SpanConfig + for _, option := range options { + c = option.applySpanStart(c) + } + return c +} + +// NewSpanEndConfig applies all the options to a returned SpanConfig. +// No validation is performed on the returned SpanConfig (e.g. no uniqueness +// checking or bounding of data), it is left to the SDK to perform this +// action. +func NewSpanEndConfig(options ...SpanEndOption) SpanConfig { + var c SpanConfig + for _, option := range options { + c = option.applySpanEnd(c) + } + return c +} + +// SpanStartOption applies an option to a SpanConfig. These options are applicable +// only when the span is created. +type SpanStartOption interface { + applySpanStart(SpanConfig) SpanConfig +} + +type spanOptionFunc func(SpanConfig) SpanConfig + +func (fn spanOptionFunc) applySpanStart(cfg SpanConfig) SpanConfig { + return fn(cfg) +} + +// SpanEndOption applies an option to a SpanConfig. These options are +// applicable only when the span is ended. +type SpanEndOption interface { + applySpanEnd(SpanConfig) SpanConfig +} + +// EventConfig is a group of options for an Event. +type EventConfig struct { + attributes []attribute.KeyValue + timestamp time.Time + stackTrace bool +} + +// Attributes describe the associated qualities of an Event. +func (cfg *EventConfig) Attributes() []attribute.KeyValue { + return cfg.attributes +} + +// Timestamp is a time in an Event life-cycle. +func (cfg *EventConfig) Timestamp() time.Time { + return cfg.timestamp +} + +// StackTrace reports whether stack trace capturing is enabled. +func (cfg *EventConfig) StackTrace() bool { + return cfg.stackTrace +} + +// NewEventConfig applies all the EventOptions to a returned EventConfig. If no +// timestamp option is passed, the returned EventConfig will have a Timestamp +// set to the call time, otherwise no validation is performed on the returned +// EventConfig. +func NewEventConfig(options ...EventOption) EventConfig { + var c EventConfig + for _, option := range options { + c = option.applyEvent(c) + } + if c.timestamp.IsZero() { + c.timestamp = time.Now() + } + return c +} + +// EventOption applies span event options to an EventConfig. +type EventOption interface { + applyEvent(EventConfig) EventConfig +} + +// SpanOption are options that can be used at both the beginning and end of a span. +type SpanOption interface { + SpanStartOption + SpanEndOption +} + +// SpanStartEventOption are options that can be used at the start of a span, or with an event. +type SpanStartEventOption interface { + SpanStartOption + EventOption +} + +// SpanEndEventOption are options that can be used at the end of a span, or with an event. +type SpanEndEventOption interface { + SpanEndOption + EventOption +} + +type attributeOption []attribute.KeyValue + +func (o attributeOption) applySpan(c SpanConfig) SpanConfig { + c.attributes = append(c.attributes, []attribute.KeyValue(o)...) + return c +} +func (o attributeOption) applySpanStart(c SpanConfig) SpanConfig { return o.applySpan(c) } +func (o attributeOption) applyEvent(c EventConfig) EventConfig { + c.attributes = append(c.attributes, []attribute.KeyValue(o)...) + return c +} + +var _ SpanStartEventOption = attributeOption{} + +// WithAttributes adds the attributes related to a span life-cycle event. +// These attributes are used to describe the work a Span represents when this +// option is provided to a Span's start event. Otherwise, these +// attributes provide additional information about the event being recorded +// (e.g. error, state change, processing progress, system event). +// +// If multiple of these options are passed the attributes of each successive +// option will extend the attributes instead of overwriting. There is no +// guarantee of uniqueness in the resulting attributes. +func WithAttributes(attributes ...attribute.KeyValue) SpanStartEventOption { + return attributeOption(attributes) +} + +// SpanEventOption are options that can be used with an event or a span. +type SpanEventOption interface { + SpanOption + EventOption +} + +type timestampOption time.Time + +func (o timestampOption) applySpan(c SpanConfig) SpanConfig { + c.timestamp = time.Time(o) + return c +} +func (o timestampOption) applySpanStart(c SpanConfig) SpanConfig { return o.applySpan(c) } +func (o timestampOption) applySpanEnd(c SpanConfig) SpanConfig { return o.applySpan(c) } +func (o timestampOption) applyEvent(c EventConfig) EventConfig { + c.timestamp = time.Time(o) + return c +} + +var _ SpanEventOption = timestampOption{} + +// WithTimestamp sets the time of a Span or Event life-cycle moment (e.g. +// started, stopped, errored). +func WithTimestamp(t time.Time) SpanEventOption { + return timestampOption(t) +} + +type stackTraceOption bool + +func (o stackTraceOption) applyEvent(c EventConfig) EventConfig { + c.stackTrace = bool(o) + return c +} + +func (o stackTraceOption) applySpan(c SpanConfig) SpanConfig { + c.stackTrace = bool(o) + return c +} +func (o stackTraceOption) applySpanEnd(c SpanConfig) SpanConfig { return o.applySpan(c) } + +// WithStackTrace sets the flag to capture the error with stack trace (e.g. true, false). +func WithStackTrace(b bool) SpanEndEventOption { + return stackTraceOption(b) +} + +// WithLinks adds links to a Span. The links are added to the existing Span +// links, i.e. this does not overwrite. Links with invalid span context are ignored. +func WithLinks(links ...Link) SpanStartOption { + return spanOptionFunc(func(cfg SpanConfig) SpanConfig { + cfg.links = append(cfg.links, links...) + return cfg + }) +} + +// WithNewRoot specifies that the Span should be treated as a root Span. Any +// existing parent span context will be ignored when defining the Span's trace +// identifiers. +func WithNewRoot() SpanStartOption { + return spanOptionFunc(func(cfg SpanConfig) SpanConfig { + cfg.newRoot = true + return cfg + }) +} + +// WithSpanKind sets the SpanKind of a Span. +func WithSpanKind(kind SpanKind) SpanStartOption { + return spanOptionFunc(func(cfg SpanConfig) SpanConfig { + cfg.spanKind = kind + return cfg + }) +} + +// WithInstrumentationVersion sets the instrumentation version. +func WithInstrumentationVersion(version string) TracerOption { + return tracerOptionFunc(func(cfg TracerConfig) TracerConfig { + cfg.instrumentationVersion = version + return cfg + }) +} + +// mergeSets returns the union of keys between a and b. Any duplicate keys will +// use the value associated with b. +func mergeSets(a, b attribute.Set) attribute.Set { + // NewMergeIterator uses the first value for any duplicates. + iter := attribute.NewMergeIterator(&b, &a) + merged := make([]attribute.KeyValue, 0, a.Len()+b.Len()) + for iter.Next() { + merged = append(merged, iter.Attribute()) + } + return attribute.NewSet(merged...) +} + +// WithInstrumentationAttributes adds the instrumentation attributes. +// +// This is equivalent to calling [WithInstrumentationAttributeSet] with an +// [attribute.Set] created from a clone of the passed attributes. +// [WithInstrumentationAttributeSet] is recommended for more control. +// +// If multiple [WithInstrumentationAttributes] or [WithInstrumentationAttributeSet] +// options are passed, the attributes will be merged together in the order +// they are passed. Attributes with duplicate keys will use the last value passed. +func WithInstrumentationAttributes(attr ...attribute.KeyValue) TracerOption { + set := attribute.NewSet(slices.Clone(attr)...) + return WithInstrumentationAttributeSet(set) +} + +// WithInstrumentationAttributeSet adds the instrumentation attributes. +// +// If multiple [WithInstrumentationAttributes] or [WithInstrumentationAttributeSet] +// options are passed, the attributes will be merged together in the order +// they are passed. Attributes with duplicate keys will use the last value passed. +func WithInstrumentationAttributeSet(set attribute.Set) TracerOption { + if set.Len() == 0 { + return tracerOptionFunc(func(config TracerConfig) TracerConfig { + return config + }) + } + + return tracerOptionFunc(func(config TracerConfig) TracerConfig { + if config.attrs.Len() == 0 { + config.attrs = set + } else { + config.attrs = mergeSets(config.attrs, set) + } + return config + }) +} + +// WithSchemaURL sets the schema URL for the Tracer. +func WithSchemaURL(schemaURL string) TracerOption { + return tracerOptionFunc(func(cfg TracerConfig) TracerConfig { + cfg.schemaURL = schemaURL + return cfg + }) +} diff --git a/vendor/go.opentelemetry.io/otel/trace/context.go b/vendor/go.opentelemetry.io/otel/trace/context.go new file mode 100644 index 00000000..8c45a710 --- /dev/null +++ b/vendor/go.opentelemetry.io/otel/trace/context.go @@ -0,0 +1,50 @@ +// Copyright The OpenTelemetry Authors +// SPDX-License-Identifier: Apache-2.0 + +package trace // import "go.opentelemetry.io/otel/trace" + +import "context" + +type traceContextKeyType int + +const currentSpanKey traceContextKeyType = iota + +// ContextWithSpan returns a copy of parent with span set as the current Span. +func ContextWithSpan(parent context.Context, span Span) context.Context { + return context.WithValue(parent, currentSpanKey, span) +} + +// ContextWithSpanContext returns a copy of parent with sc as the current +// Span. The Span implementation that wraps sc is non-recording and performs +// no operations other than to return sc as the SpanContext from the +// SpanContext method. +func ContextWithSpanContext(parent context.Context, sc SpanContext) context.Context { + return ContextWithSpan(parent, nonRecordingSpan{sc: sc}) +} + +// ContextWithRemoteSpanContext returns a copy of parent with rsc set explicitly +// as a remote SpanContext and as the current Span. The Span implementation +// that wraps rsc is non-recording and performs no operations other than to +// return rsc as the SpanContext from the SpanContext method. +func ContextWithRemoteSpanContext(parent context.Context, rsc SpanContext) context.Context { + return ContextWithSpanContext(parent, rsc.WithRemote(true)) +} + +// SpanFromContext returns the current Span from ctx. +// +// If no Span is currently set in ctx an implementation of a Span that +// performs no operations is returned. +func SpanFromContext(ctx context.Context) Span { + if ctx == nil { + return noopSpanInstance + } + if span, ok := ctx.Value(currentSpanKey).(Span); ok { + return span + } + return noopSpanInstance +} + +// SpanContextFromContext returns the current Span's SpanContext. +func SpanContextFromContext(ctx context.Context) SpanContext { + return SpanFromContext(ctx).SpanContext() +} diff --git a/vendor/go.opentelemetry.io/otel/trace/doc.go b/vendor/go.opentelemetry.io/otel/trace/doc.go new file mode 100644 index 00000000..cdbf41d6 --- /dev/null +++ b/vendor/go.opentelemetry.io/otel/trace/doc.go @@ -0,0 +1,119 @@ +// Copyright The OpenTelemetry Authors +// SPDX-License-Identifier: Apache-2.0 + +/* +Package trace provides an implementation of the tracing part of the +OpenTelemetry API. + +To participate in distributed traces a Span needs to be created for the +operation being performed as part of a traced workflow. In its simplest form: + + var tracer trace.Tracer + + func init() { + tracer = otel.Tracer("instrumentation/package/name") + } + + func operation(ctx context.Context) { + var span trace.Span + ctx, span = tracer.Start(ctx, "operation") + defer span.End() + // ... + } + +A Tracer is unique to the instrumentation and is used to create Spans. +Instrumentation should be designed to accept a TracerProvider from which it +can create its own unique Tracer. Alternatively, the registered global +TracerProvider from the go.opentelemetry.io/otel package can be used as +a default. + + const ( + name = "instrumentation/package/name" + version = "0.1.0" + ) + + type Instrumentation struct { + tracer trace.Tracer + } + + func NewInstrumentation(tp trace.TracerProvider) *Instrumentation { + if tp == nil { + tp = otel.TracerProvider() + } + return &Instrumentation{ + tracer: tp.Tracer(name, trace.WithInstrumentationVersion(version)), + } + } + + func operation(ctx context.Context, inst *Instrumentation) { + var span trace.Span + ctx, span = inst.tracer.Start(ctx, "operation") + defer span.End() + // ... + } + +# API Implementations + +This package does not conform to the standard Go versioning policy; all of its +interfaces may have methods added to them without a package major version bump. +This non-standard API evolution could surprise an uninformed implementation +author. They could unknowingly build their implementation in a way that would +result in a runtime panic for their users that update to the new API. + +The API is designed to help inform an instrumentation author about this +non-standard API evolution. It requires them to choose a default behavior for +unimplemented interface methods. There are three behavior choices they can +make: + + - Compilation failure + - Panic + - Default to another implementation + +All interfaces in this API embed a corresponding interface from +[go.opentelemetry.io/otel/trace/embedded]. If an author wants the default +behavior of their implementations to be a compilation failure, signaling to +their users they need to update to the latest version of that implementation, +they need to embed the corresponding interface from +[go.opentelemetry.io/otel/trace/embedded] in their implementation. For +example, + + import "go.opentelemetry.io/otel/trace/embedded" + + type TracerProvider struct { + embedded.TracerProvider + // ... + } + +If an author wants the default behavior of their implementations to panic, they +can embed the API interface directly. + + import "go.opentelemetry.io/otel/trace" + + type TracerProvider struct { + trace.TracerProvider + // ... + } + +This option is not recommended. It will lead to publishing packages that +contain runtime panics when users update to newer versions of +[go.opentelemetry.io/otel/trace], which may be done with a transitive +dependency. + +Finally, an author can embed another implementation in theirs. The embedded +implementation will be used for methods not defined by the author. For example, +an author who wants to default to silently dropping the call can use +[go.opentelemetry.io/otel/trace/noop]: + + import "go.opentelemetry.io/otel/trace/noop" + + type TracerProvider struct { + noop.TracerProvider + // ... + } + +It is strongly recommended that authors only embed +[go.opentelemetry.io/otel/trace/noop] if they choose this default behavior. +That implementation is the only one OpenTelemetry authors can guarantee will +fully implement all the API interfaces when a user updates their API. +*/ +package trace // import "go.opentelemetry.io/otel/trace" diff --git a/vendor/go.opentelemetry.io/otel/trace/embedded/README.md b/vendor/go.opentelemetry.io/otel/trace/embedded/README.md new file mode 100644 index 00000000..7754a239 --- /dev/null +++ b/vendor/go.opentelemetry.io/otel/trace/embedded/README.md @@ -0,0 +1,3 @@ +# Trace Embedded + +[![PkgGoDev](https://pkg.go.dev/badge/go.opentelemetry.io/otel/trace/embedded)](https://pkg.go.dev/go.opentelemetry.io/otel/trace/embedded) diff --git a/vendor/go.opentelemetry.io/otel/trace/embedded/embedded.go b/vendor/go.opentelemetry.io/otel/trace/embedded/embedded.go new file mode 100644 index 00000000..3e359a00 --- /dev/null +++ b/vendor/go.opentelemetry.io/otel/trace/embedded/embedded.go @@ -0,0 +1,45 @@ +// Copyright The OpenTelemetry Authors +// SPDX-License-Identifier: Apache-2.0 + +// Package embedded provides interfaces embedded within the [OpenTelemetry +// trace API]. +// +// Implementers of the [OpenTelemetry trace API] can embed the relevant type +// from this package into their implementation directly. Doing so will result +// in a compilation error for users when the [OpenTelemetry trace API] is +// extended (which is something that can happen without a major version bump of +// the API package). +// +// [OpenTelemetry trace API]: https://pkg.go.dev/go.opentelemetry.io/otel/trace +package embedded // import "go.opentelemetry.io/otel/trace/embedded" + +// TracerProvider is embedded in +// [go.opentelemetry.io/otel/trace.TracerProvider]. +// +// Embed this interface in your implementation of the +// [go.opentelemetry.io/otel/trace.TracerProvider] if you want users to +// experience a compilation error, signaling they need to update to your latest +// implementation, when the [go.opentelemetry.io/otel/trace.TracerProvider] +// interface is extended (which is something that can happen without a major +// version bump of the API package). +type TracerProvider interface{ tracerProvider() } + +// Tracer is embedded in [go.opentelemetry.io/otel/trace.Tracer]. +// +// Embed this interface in your implementation of the +// [go.opentelemetry.io/otel/trace.Tracer] if you want users to experience a +// compilation error, signaling they need to update to your latest +// implementation, when the [go.opentelemetry.io/otel/trace.Tracer] interface +// is extended (which is something that can happen without a major version bump +// of the API package). +type Tracer interface{ tracer() } + +// Span is embedded in [go.opentelemetry.io/otel/trace.Span]. +// +// Embed this interface in your implementation of the +// [go.opentelemetry.io/otel/trace.Span] if you want users to experience a +// compilation error, signaling they need to update to your latest +// implementation, when the [go.opentelemetry.io/otel/trace.Span] interface is +// extended (which is something that can happen without a major version bump of +// the API package). +type Span interface{ span() } diff --git a/vendor/go.opentelemetry.io/otel/trace/hex.go b/vendor/go.opentelemetry.io/otel/trace/hex.go new file mode 100644 index 00000000..1cbef1d4 --- /dev/null +++ b/vendor/go.opentelemetry.io/otel/trace/hex.go @@ -0,0 +1,38 @@ +// Copyright The OpenTelemetry Authors +// SPDX-License-Identifier: Apache-2.0 + +package trace // import "go.opentelemetry.io/otel/trace" + +const ( + // hexLU is a hex lookup table of the 16 lowercase hex digits. + // The character values of the string are indexed at the equivalent + // hexadecimal value they represent. This table efficiently encodes byte data + // into a string representation of hexadecimal. + hexLU = "0123456789abcdef" + + // hexRev is a reverse hex lookup table for lowercase hex digits. + // The table is efficiently decodes a hexadecimal string into bytes. + // Valid hexadecimal characters are indexed at their respective values. All + // other invalid ASCII characters are represented with '\xff'. + // + // The '\xff' character is used as invalid because no valid character has + // the upper 4 bits set. Meaning, an efficient validation can be performed + // over multiple character parsing by checking these bits remain zero. + hexRev = "" + + "\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff" + + "\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff" + + "\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff" + + "\x00\x01\x02\x03\x04\x05\x06\x07\x08\x09\xff\xff\xff\xff\xff\xff" + + "\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff" + + "\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff" + + "\xff\x0a\x0b\x0c\x0d\x0e\x0f\xff\xff\xff\xff\xff\xff\xff\xff\xff" + + "\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff" + + "\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff" + + "\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff" + + "\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff" + + "\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff" + + "\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff" + + "\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff" + + "\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff" + + "\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff" +) diff --git a/vendor/go.opentelemetry.io/otel/trace/internal/telemetry/attr.go b/vendor/go.opentelemetry.io/otel/trace/internal/telemetry/attr.go new file mode 100644 index 00000000..ff0f6eac --- /dev/null +++ b/vendor/go.opentelemetry.io/otel/trace/internal/telemetry/attr.go @@ -0,0 +1,58 @@ +// Copyright The OpenTelemetry Authors +// SPDX-License-Identifier: Apache-2.0 + +package telemetry // import "go.opentelemetry.io/otel/trace/internal/telemetry" + +// Attr is a key-value pair. +type Attr struct { + Key string `json:"key,omitempty"` + Value Value `json:"value,omitempty"` +} + +// String returns an Attr for a string value. +func String(key, value string) Attr { + return Attr{key, StringValue(value)} +} + +// Int64 returns an Attr for an int64 value. +func Int64(key string, value int64) Attr { + return Attr{key, Int64Value(value)} +} + +// Int returns an Attr for an int value. +func Int(key string, value int) Attr { + return Int64(key, int64(value)) +} + +// Float64 returns an Attr for a float64 value. +func Float64(key string, value float64) Attr { + return Attr{key, Float64Value(value)} +} + +// Bool returns an Attr for a bool value. +func Bool(key string, value bool) Attr { + return Attr{key, BoolValue(value)} +} + +// Bytes returns an Attr for a []byte value. +// The passed slice must not be changed after it is passed. +func Bytes(key string, value []byte) Attr { + return Attr{key, BytesValue(value)} +} + +// Slice returns an Attr for a []Value value. +// The passed slice must not be changed after it is passed. +func Slice(key string, value ...Value) Attr { + return Attr{key, SliceValue(value...)} +} + +// Map returns an Attr for a map value. +// The passed slice must not be changed after it is passed. +func Map(key string, value ...Attr) Attr { + return Attr{key, MapValue(value...)} +} + +// Equal reports whether a is equal to b. +func (a Attr) Equal(b Attr) bool { + return a.Key == b.Key && a.Value.Equal(b.Value) +} diff --git a/vendor/go.opentelemetry.io/otel/trace/internal/telemetry/doc.go b/vendor/go.opentelemetry.io/otel/trace/internal/telemetry/doc.go new file mode 100644 index 00000000..5debe90b --- /dev/null +++ b/vendor/go.opentelemetry.io/otel/trace/internal/telemetry/doc.go @@ -0,0 +1,8 @@ +// Copyright The OpenTelemetry Authors +// SPDX-License-Identifier: Apache-2.0 + +/* +Package telemetry provides a lightweight representations of OpenTelemetry +telemetry that is compatible with the OTLP JSON protobuf encoding. +*/ +package telemetry // import "go.opentelemetry.io/otel/trace/internal/telemetry" diff --git a/vendor/go.opentelemetry.io/otel/trace/internal/telemetry/id.go b/vendor/go.opentelemetry.io/otel/trace/internal/telemetry/id.go new file mode 100644 index 00000000..bea56f2e --- /dev/null +++ b/vendor/go.opentelemetry.io/otel/trace/internal/telemetry/id.go @@ -0,0 +1,103 @@ +// Copyright The OpenTelemetry Authors +// SPDX-License-Identifier: Apache-2.0 + +package telemetry // import "go.opentelemetry.io/otel/trace/internal/telemetry" + +import ( + "encoding/hex" + "errors" + "fmt" +) + +const ( + traceIDSize = 16 + spanIDSize = 8 +) + +// TraceID is a custom data type that is used for all trace IDs. +type TraceID [traceIDSize]byte + +// String returns the hex string representation form of a TraceID. +func (tid TraceID) String() string { + return hex.EncodeToString(tid[:]) +} + +// IsEmpty reports whether the TraceID contains only zero bytes. +func (tid TraceID) IsEmpty() bool { + return tid == [traceIDSize]byte{} +} + +// MarshalJSON converts the trace ID into a hex string enclosed in quotes. +func (tid TraceID) MarshalJSON() ([]byte, error) { + if tid.IsEmpty() { + return []byte(`""`), nil + } + return marshalJSON(tid[:]) +} + +// UnmarshalJSON inflates the trace ID from hex string, possibly enclosed in +// quotes. +func (tid *TraceID) UnmarshalJSON(data []byte) error { + *tid = [traceIDSize]byte{} + return unmarshalJSON(tid[:], data) +} + +// SpanID is a custom data type that is used for all span IDs. +type SpanID [spanIDSize]byte + +// String returns the hex string representation form of a SpanID. +func (sid SpanID) String() string { + return hex.EncodeToString(sid[:]) +} + +// IsEmpty reports whether the SpanID contains only zero bytes. +func (sid SpanID) IsEmpty() bool { + return sid == [spanIDSize]byte{} +} + +// MarshalJSON converts span ID into a hex string enclosed in quotes. +func (sid SpanID) MarshalJSON() ([]byte, error) { + if sid.IsEmpty() { + return []byte(`""`), nil + } + return marshalJSON(sid[:]) +} + +// UnmarshalJSON decodes span ID from hex string, possibly enclosed in quotes. +func (sid *SpanID) UnmarshalJSON(data []byte) error { + *sid = [spanIDSize]byte{} + return unmarshalJSON(sid[:], data) +} + +// marshalJSON converts id into a hex string enclosed in quotes. +func marshalJSON(id []byte) ([]byte, error) { + // Plus 2 quote chars at the start and end. + hexLen := hex.EncodedLen(len(id)) + 2 + + b := make([]byte, hexLen) + hex.Encode(b[1:hexLen-1], id) + b[0], b[hexLen-1] = '"', '"' + + return b, nil +} + +// unmarshalJSON inflates trace id from hex string, possibly enclosed in quotes. +func unmarshalJSON(dst, src []byte) error { + if l := len(src); l >= 2 && src[0] == '"' && src[l-1] == '"' { + src = src[1 : l-1] + } + nLen := len(src) + if nLen == 0 { + return nil + } + + if len(dst) != hex.DecodedLen(nLen) { + return errors.New("invalid length for ID") + } + + _, err := hex.Decode(dst, src) + if err != nil { + return fmt.Errorf("cannot unmarshal ID from string '%s': %w", string(src), err) + } + return nil +} diff --git a/vendor/go.opentelemetry.io/otel/trace/internal/telemetry/number.go b/vendor/go.opentelemetry.io/otel/trace/internal/telemetry/number.go new file mode 100644 index 00000000..f5e3a8ce --- /dev/null +++ b/vendor/go.opentelemetry.io/otel/trace/internal/telemetry/number.go @@ -0,0 +1,67 @@ +// Copyright The OpenTelemetry Authors +// SPDX-License-Identifier: Apache-2.0 + +package telemetry // import "go.opentelemetry.io/otel/trace/internal/telemetry" + +import ( + "encoding/json" + "strconv" +) + +// protoInt64 represents the protobuf encoding of integers which can be either +// strings or integers. +type protoInt64 int64 + +// Int64 returns the protoInt64 as an int64. +func (i *protoInt64) Int64() int64 { return int64(*i) } + +// UnmarshalJSON decodes both strings and integers. +func (i *protoInt64) UnmarshalJSON(data []byte) error { + if data[0] == '"' { + var str string + if err := json.Unmarshal(data, &str); err != nil { + return err + } + parsedInt, err := strconv.ParseInt(str, 10, 64) + if err != nil { + return err + } + *i = protoInt64(parsedInt) + } else { + var parsedInt int64 + if err := json.Unmarshal(data, &parsedInt); err != nil { + return err + } + *i = protoInt64(parsedInt) + } + return nil +} + +// protoUint64 represents the protobuf encoding of integers which can be either +// strings or integers. +type protoUint64 uint64 + +// Int64 returns the protoUint64 as a uint64. +func (i *protoUint64) Uint64() uint64 { return uint64(*i) } + +// UnmarshalJSON decodes both strings and integers. +func (i *protoUint64) UnmarshalJSON(data []byte) error { + if data[0] == '"' { + var str string + if err := json.Unmarshal(data, &str); err != nil { + return err + } + parsedUint, err := strconv.ParseUint(str, 10, 64) + if err != nil { + return err + } + *i = protoUint64(parsedUint) + } else { + var parsedUint uint64 + if err := json.Unmarshal(data, &parsedUint); err != nil { + return err + } + *i = protoUint64(parsedUint) + } + return nil +} diff --git a/vendor/go.opentelemetry.io/otel/trace/internal/telemetry/resource.go b/vendor/go.opentelemetry.io/otel/trace/internal/telemetry/resource.go new file mode 100644 index 00000000..1798a702 --- /dev/null +++ b/vendor/go.opentelemetry.io/otel/trace/internal/telemetry/resource.go @@ -0,0 +1,66 @@ +// Copyright The OpenTelemetry Authors +// SPDX-License-Identifier: Apache-2.0 + +package telemetry // import "go.opentelemetry.io/otel/trace/internal/telemetry" + +import ( + "bytes" + "encoding/json" + "errors" + "fmt" + "io" +) + +// Resource information. +type Resource struct { + // Attrs are the set of attributes that describe the resource. Attribute + // keys MUST be unique (it is not allowed to have more than one attribute + // with the same key). + Attrs []Attr `json:"attributes,omitempty"` + // DroppedAttrs is the number of dropped attributes. If the value + // is 0, then no attributes were dropped. + DroppedAttrs uint32 `json:"droppedAttributesCount,omitempty"` +} + +// UnmarshalJSON decodes the OTLP formatted JSON contained in data into r. +func (r *Resource) UnmarshalJSON(data []byte) error { + decoder := json.NewDecoder(bytes.NewReader(data)) + + t, err := decoder.Token() + if err != nil { + return err + } + if t != json.Delim('{') { + return errors.New("invalid Resource type") + } + + for decoder.More() { + keyIface, err := decoder.Token() + if err != nil { + if errors.Is(err, io.EOF) { + // Empty. + return nil + } + return err + } + + key, ok := keyIface.(string) + if !ok { + return fmt.Errorf("invalid Resource field: %#v", keyIface) + } + + switch key { + case "attributes": + err = decoder.Decode(&r.Attrs) + case "droppedAttributesCount", "dropped_attributes_count": + err = decoder.Decode(&r.DroppedAttrs) + default: + // Skip unknown. + } + + if err != nil { + return err + } + } + return nil +} diff --git a/vendor/go.opentelemetry.io/otel/trace/internal/telemetry/scope.go b/vendor/go.opentelemetry.io/otel/trace/internal/telemetry/scope.go new file mode 100644 index 00000000..c2b4c635 --- /dev/null +++ b/vendor/go.opentelemetry.io/otel/trace/internal/telemetry/scope.go @@ -0,0 +1,67 @@ +// Copyright The OpenTelemetry Authors +// SPDX-License-Identifier: Apache-2.0 + +package telemetry // import "go.opentelemetry.io/otel/trace/internal/telemetry" + +import ( + "bytes" + "encoding/json" + "errors" + "fmt" + "io" +) + +// Scope is the identifying values of the instrumentation scope. +type Scope struct { + Name string `json:"name,omitempty"` + Version string `json:"version,omitempty"` + Attrs []Attr `json:"attributes,omitempty"` + DroppedAttrs uint32 `json:"droppedAttributesCount,omitempty"` +} + +// UnmarshalJSON decodes the OTLP formatted JSON contained in data into r. +func (s *Scope) UnmarshalJSON(data []byte) error { + decoder := json.NewDecoder(bytes.NewReader(data)) + + t, err := decoder.Token() + if err != nil { + return err + } + if t != json.Delim('{') { + return errors.New("invalid Scope type") + } + + for decoder.More() { + keyIface, err := decoder.Token() + if err != nil { + if errors.Is(err, io.EOF) { + // Empty. + return nil + } + return err + } + + key, ok := keyIface.(string) + if !ok { + return fmt.Errorf("invalid Scope field: %#v", keyIface) + } + + switch key { + case "name": + err = decoder.Decode(&s.Name) + case "version": + err = decoder.Decode(&s.Version) + case "attributes": + err = decoder.Decode(&s.Attrs) + case "droppedAttributesCount", "dropped_attributes_count": + err = decoder.Decode(&s.DroppedAttrs) + default: + // Skip unknown. + } + + if err != nil { + return err + } + } + return nil +} diff --git a/vendor/go.opentelemetry.io/otel/trace/internal/telemetry/span.go b/vendor/go.opentelemetry.io/otel/trace/internal/telemetry/span.go new file mode 100644 index 00000000..e7ca62c6 --- /dev/null +++ b/vendor/go.opentelemetry.io/otel/trace/internal/telemetry/span.go @@ -0,0 +1,472 @@ +// Copyright The OpenTelemetry Authors +// SPDX-License-Identifier: Apache-2.0 + +package telemetry // import "go.opentelemetry.io/otel/trace/internal/telemetry" + +import ( + "bytes" + "encoding/hex" + "encoding/json" + "errors" + "fmt" + "io" + "math" + "time" +) + +// A Span represents a single operation performed by a single component of the +// system. +type Span struct { + // A unique identifier for a trace. All spans from the same trace share + // the same `trace_id`. The ID is a 16-byte array. An ID with all zeroes OR + // of length other than 16 bytes is considered invalid (empty string in OTLP/JSON + // is zero-length and thus is also invalid). + // + // This field is required. + TraceID TraceID `json:"traceId,omitempty"` + // A unique identifier for a span within a trace, assigned when the span + // is created. The ID is an 8-byte array. An ID with all zeroes OR of length + // other than 8 bytes is considered invalid (empty string in OTLP/JSON + // is zero-length and thus is also invalid). + // + // This field is required. + SpanID SpanID `json:"spanId,omitempty"` + // trace_state conveys information about request position in multiple distributed tracing graphs. + // It is a trace_state in w3c-trace-context format: https://www.w3.org/TR/trace-context/#tracestate-header + // See also https://github.com/w3c/distributed-tracing for more details about this field. + TraceState string `json:"traceState,omitempty"` + // The `span_id` of this span's parent span. If this is a root span, then this + // field must be empty. The ID is an 8-byte array. + ParentSpanID SpanID `json:"parentSpanId,omitempty"` + // Flags, a bit field. + // + // Bits 0-7 (8 least significant bits) are the trace flags as defined in W3C Trace + // Context specification. To read the 8-bit W3C trace flag, use + // `flags & SPAN_FLAGS_TRACE_FLAGS_MASK`. + // + // See https://www.w3.org/TR/trace-context-2/#trace-flags for the flag definitions. + // + // Bits 8 and 9 represent the 3 states of whether a span's parent + // is remote. The states are (unknown, is not remote, is remote). + // To read whether the value is known, use `(flags & SPAN_FLAGS_CONTEXT_HAS_IS_REMOTE_MASK) != 0`. + // To read whether the span is remote, use `(flags & SPAN_FLAGS_CONTEXT_IS_REMOTE_MASK) != 0`. + // + // When creating span messages, if the message is logically forwarded from another source + // with an equivalent flags fields (i.e., usually another OTLP span message), the field SHOULD + // be copied as-is. If creating from a source that does not have an equivalent flags field + // (such as a runtime representation of an OpenTelemetry span), the high 22 bits MUST + // be set to zero. + // Readers MUST NOT assume that bits 10-31 (22 most significant bits) will be zero. + // + // [Optional]. + Flags uint32 `json:"flags,omitempty"` + // A description of the span's operation. + // + // For example, the name can be a qualified method name or a file name + // and a line number where the operation is called. A best practice is to use + // the same display name at the same call point in an application. + // This makes it easier to correlate spans in different traces. + // + // This field is semantically required to be set to non-empty string. + // Empty value is equivalent to an unknown span name. + // + // This field is required. + Name string `json:"name"` + // Distinguishes between spans generated in a particular context. For example, + // two spans with the same name may be distinguished using `CLIENT` (caller) + // and `SERVER` (callee) to identify queueing latency associated with the span. + Kind SpanKind `json:"kind,omitempty"` + // start_time_unix_nano is the start time of the span. On the client side, this is the time + // kept by the local machine where the span execution starts. On the server side, this + // is the time when the server's application handler starts running. + // Value is UNIX Epoch time in nanoseconds since 00:00:00 UTC on 1 January 1970. + // + // This field is semantically required and it is expected that end_time >= start_time. + StartTime time.Time `json:"startTimeUnixNano,omitempty"` + // end_time_unix_nano is the end time of the span. On the client side, this is the time + // kept by the local machine where the span execution ends. On the server side, this + // is the time when the server application handler stops running. + // Value is UNIX Epoch time in nanoseconds since 00:00:00 UTC on 1 January 1970. + // + // This field is semantically required and it is expected that end_time >= start_time. + EndTime time.Time `json:"endTimeUnixNano,omitempty"` + // attributes is a collection of key/value pairs. Note, global attributes + // like server name can be set using the resource API. Examples of attributes: + // + // "/http/user_agent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_14_2) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/71.0.3578.98 Safari/537.36" + // "/http/server_latency": 300 + // "example.com/myattribute": true + // "example.com/score": 10.239 + // + // The OpenTelemetry API specification further restricts the allowed value types: + // https://github.com/open-telemetry/opentelemetry-specification/blob/main/specification/common/README.md#attribute + // Attribute keys MUST be unique (it is not allowed to have more than one + // attribute with the same key). + Attrs []Attr `json:"attributes,omitempty"` + // dropped_attributes_count is the number of attributes that were discarded. Attributes + // can be discarded because their keys are too long or because there are too many + // attributes. If this value is 0, then no attributes were dropped. + DroppedAttrs uint32 `json:"droppedAttributesCount,omitempty"` + // events is a collection of Event items. + Events []*SpanEvent `json:"events,omitempty"` + // dropped_events_count is the number of dropped events. If the value is 0, then no + // events were dropped. + DroppedEvents uint32 `json:"droppedEventsCount,omitempty"` + // links is a collection of Links, which are references from this span to a span + // in the same or different trace. + Links []*SpanLink `json:"links,omitempty"` + // dropped_links_count is the number of dropped links after the maximum size was + // enforced. If this value is 0, then no links were dropped. + DroppedLinks uint32 `json:"droppedLinksCount,omitempty"` + // An optional final status for this span. Semantically when Status isn't set, it means + // span's status code is unset, i.e. assume STATUS_CODE_UNSET (code = 0). + Status *Status `json:"status,omitempty"` +} + +// MarshalJSON encodes s into OTLP formatted JSON. +func (s Span) MarshalJSON() ([]byte, error) { + startT := s.StartTime.UnixNano() + if s.StartTime.IsZero() || startT < 0 { + startT = 0 + } + + endT := s.EndTime.UnixNano() + if s.EndTime.IsZero() || endT < 0 { + endT = 0 + } + + // Override non-empty default SpanID marshal and omitempty. + var parentSpanId string + if !s.ParentSpanID.IsEmpty() { + b := make([]byte, hex.EncodedLen(spanIDSize)) + hex.Encode(b, s.ParentSpanID[:]) + parentSpanId = string(b) + } + + type Alias Span + return json.Marshal(struct { + Alias + ParentSpanID string `json:"parentSpanId,omitempty"` + StartTime uint64 `json:"startTimeUnixNano,omitempty"` + EndTime uint64 `json:"endTimeUnixNano,omitempty"` + }{ + Alias: Alias(s), + ParentSpanID: parentSpanId, + StartTime: uint64(startT), // nolint:gosec // >0 checked above. + EndTime: uint64(endT), // nolint:gosec // >0 checked above. + }) +} + +// UnmarshalJSON decodes the OTLP formatted JSON contained in data into s. +func (s *Span) UnmarshalJSON(data []byte) error { + decoder := json.NewDecoder(bytes.NewReader(data)) + + t, err := decoder.Token() + if err != nil { + return err + } + if t != json.Delim('{') { + return errors.New("invalid Span type") + } + + for decoder.More() { + keyIface, err := decoder.Token() + if err != nil { + if errors.Is(err, io.EOF) { + // Empty. + return nil + } + return err + } + + key, ok := keyIface.(string) + if !ok { + return fmt.Errorf("invalid Span field: %#v", keyIface) + } + + switch key { + case "traceId", "trace_id": + err = decoder.Decode(&s.TraceID) + case "spanId", "span_id": + err = decoder.Decode(&s.SpanID) + case "traceState", "trace_state": + err = decoder.Decode(&s.TraceState) + case "parentSpanId", "parent_span_id": + err = decoder.Decode(&s.ParentSpanID) + case "flags": + err = decoder.Decode(&s.Flags) + case "name": + err = decoder.Decode(&s.Name) + case "kind": + err = decoder.Decode(&s.Kind) + case "startTimeUnixNano", "start_time_unix_nano": + var val protoUint64 + err = decoder.Decode(&val) + v := int64(min(val.Uint64(), math.MaxInt64)) // nolint: gosec // Overflow checked. + s.StartTime = time.Unix(0, v) + case "endTimeUnixNano", "end_time_unix_nano": + var val protoUint64 + err = decoder.Decode(&val) + v := int64(min(val.Uint64(), math.MaxInt64)) // nolint: gosec // Overflow checked. + s.EndTime = time.Unix(0, v) + case "attributes": + err = decoder.Decode(&s.Attrs) + case "droppedAttributesCount", "dropped_attributes_count": + err = decoder.Decode(&s.DroppedAttrs) + case "events": + err = decoder.Decode(&s.Events) + case "droppedEventsCount", "dropped_events_count": + err = decoder.Decode(&s.DroppedEvents) + case "links": + err = decoder.Decode(&s.Links) + case "droppedLinksCount", "dropped_links_count": + err = decoder.Decode(&s.DroppedLinks) + case "status": + err = decoder.Decode(&s.Status) + default: + // Skip unknown. + } + + if err != nil { + return err + } + } + return nil +} + +// SpanFlags represents constants used to interpret the +// Span.flags field, which is protobuf 'fixed32' type and is to +// be used as bit-fields. Each non-zero value defined in this enum is +// a bit-mask. To extract the bit-field, for example, use an +// expression like: +// +// (span.flags & SPAN_FLAGS_TRACE_FLAGS_MASK) +// +// See https://www.w3.org/TR/trace-context-2/#trace-flags for the flag definitions. +// +// Note that Span flags were introduced in version 1.1 of the +// OpenTelemetry protocol. Older Span producers do not set this +// field, consequently consumers should not rely on the absence of a +// particular flag bit to indicate the presence of a particular feature. +type SpanFlags int32 + +const ( + // SpanFlagsTraceFlagsMask is a mask for trace-flags. + // + // Bits 0-7 are used for trace flags. + SpanFlagsTraceFlagsMask SpanFlags = 255 + // SpanFlagsContextHasIsRemoteMask is a mask for HAS_IS_REMOTE status. + // + // Bits 8 and 9 are used to indicate that the parent span or link span is + // remote. Bit 8 (`HAS_IS_REMOTE`) indicates whether the value is known. + SpanFlagsContextHasIsRemoteMask SpanFlags = 256 + // SpanFlagsContextIsRemoteMask is a mask for IS_REMOTE status. + // + // Bits 8 and 9 are used to indicate that the parent span or link span is + // remote. Bit 9 (`IS_REMOTE`) indicates whether the span or link is + // remote. + SpanFlagsContextIsRemoteMask SpanFlags = 512 +) + +// SpanKind is the type of span. Can be used to specify additional relationships between spans +// in addition to a parent/child relationship. +type SpanKind int32 + +const ( + // SpanKindInternal indicates that the span represents an internal + // operation within an application, as opposed to an operation happening at + // the boundaries. + SpanKindInternal SpanKind = 1 + // SpanKindServer indicates that the span covers server-side handling of an + // RPC or other remote network request. + SpanKindServer SpanKind = 2 + // SpanKindClient indicates that the span describes a request to some + // remote service. + SpanKindClient SpanKind = 3 + // SpanKindProducer indicates that the span describes a producer sending a + // message to a broker. Unlike SpanKindClient and SpanKindServer, there is + // often no direct critical path latency relationship between producer and + // consumer spans. A SpanKindProducer span ends when the message was + // accepted by the broker while the logical processing of the message might + // span a much longer time. + SpanKindProducer SpanKind = 4 + // SpanKindConsumer indicates that the span describes a consumer receiving + // a message from a broker. Like SpanKindProducer, there is often no direct + // critical path latency relationship between producer and consumer spans. + SpanKindConsumer SpanKind = 5 +) + +// SpanEvent is a time-stamped annotation of the span, consisting of +// user-supplied text description and key-value pairs. +type SpanEvent struct { + // time_unix_nano is the time the event occurred. + Time time.Time `json:"timeUnixNano,omitempty"` + // name of the event. + // This field is semantically required to be set to non-empty string. + Name string `json:"name,omitempty"` + // attributes is a collection of attribute key/value pairs on the event. + // Attribute keys MUST be unique (it is not allowed to have more than one + // attribute with the same key). + Attrs []Attr `json:"attributes,omitempty"` + // dropped_attributes_count is the number of dropped attributes. If the value is 0, + // then no attributes were dropped. + DroppedAttrs uint32 `json:"droppedAttributesCount,omitempty"` +} + +// MarshalJSON encodes e into OTLP formatted JSON. +func (e SpanEvent) MarshalJSON() ([]byte, error) { + t := e.Time.UnixNano() + if e.Time.IsZero() || t < 0 { + t = 0 + } + + type Alias SpanEvent + return json.Marshal(struct { + Alias + Time uint64 `json:"timeUnixNano,omitempty"` + }{ + Alias: Alias(e), + Time: uint64(t), // nolint: gosec // >0 checked above + }) +} + +// UnmarshalJSON decodes the OTLP formatted JSON contained in data into se. +func (se *SpanEvent) UnmarshalJSON(data []byte) error { + decoder := json.NewDecoder(bytes.NewReader(data)) + + t, err := decoder.Token() + if err != nil { + return err + } + if t != json.Delim('{') { + return errors.New("invalid SpanEvent type") + } + + for decoder.More() { + keyIface, err := decoder.Token() + if err != nil { + if errors.Is(err, io.EOF) { + // Empty. + return nil + } + return err + } + + key, ok := keyIface.(string) + if !ok { + return fmt.Errorf("invalid SpanEvent field: %#v", keyIface) + } + + switch key { + case "timeUnixNano", "time_unix_nano": + var val protoUint64 + err = decoder.Decode(&val) + v := int64(min(val.Uint64(), math.MaxInt64)) // nolint: gosec // Overflow checked. + se.Time = time.Unix(0, v) + case "name": + err = decoder.Decode(&se.Name) + case "attributes": + err = decoder.Decode(&se.Attrs) + case "droppedAttributesCount", "dropped_attributes_count": + err = decoder.Decode(&se.DroppedAttrs) + default: + // Skip unknown. + } + + if err != nil { + return err + } + } + return nil +} + +// SpanLink is a reference from the current span to another span in the same +// trace or in a different trace. For example, this can be used in batching +// operations, where a single batch handler processes multiple requests from +// different traces or when the handler receives a request from a different +// project. +type SpanLink struct { + // A unique identifier of a trace that this linked span is part of. The ID is a + // 16-byte array. + TraceID TraceID `json:"traceId,omitempty"` + // A unique identifier for the linked span. The ID is an 8-byte array. + SpanID SpanID `json:"spanId,omitempty"` + // The trace_state associated with the link. + TraceState string `json:"traceState,omitempty"` + // attributes is a collection of attribute key/value pairs on the link. + // Attribute keys MUST be unique (it is not allowed to have more than one + // attribute with the same key). + Attrs []Attr `json:"attributes,omitempty"` + // dropped_attributes_count is the number of dropped attributes. If the value is 0, + // then no attributes were dropped. + DroppedAttrs uint32 `json:"droppedAttributesCount,omitempty"` + // Flags, a bit field. + // + // Bits 0-7 (8 least significant bits) are the trace flags as defined in W3C Trace + // Context specification. To read the 8-bit W3C trace flag, use + // `flags & SPAN_FLAGS_TRACE_FLAGS_MASK`. + // + // See https://www.w3.org/TR/trace-context-2/#trace-flags for the flag definitions. + // + // Bits 8 and 9 represent the 3 states of whether the link is remote. + // The states are (unknown, is not remote, is remote). + // To read whether the value is known, use `(flags & SPAN_FLAGS_CONTEXT_HAS_IS_REMOTE_MASK) != 0`. + // To read whether the link is remote, use `(flags & SPAN_FLAGS_CONTEXT_IS_REMOTE_MASK) != 0`. + // + // Readers MUST NOT assume that bits 10-31 (22 most significant bits) will be zero. + // When creating new spans, bits 10-31 (most-significant 22-bits) MUST be zero. + // + // [Optional]. + Flags uint32 `json:"flags,omitempty"` +} + +// UnmarshalJSON decodes the OTLP formatted JSON contained in data into sl. +func (sl *SpanLink) UnmarshalJSON(data []byte) error { + decoder := json.NewDecoder(bytes.NewReader(data)) + + t, err := decoder.Token() + if err != nil { + return err + } + if t != json.Delim('{') { + return errors.New("invalid SpanLink type") + } + + for decoder.More() { + keyIface, err := decoder.Token() + if err != nil { + if errors.Is(err, io.EOF) { + // Empty. + return nil + } + return err + } + + key, ok := keyIface.(string) + if !ok { + return fmt.Errorf("invalid SpanLink field: %#v", keyIface) + } + + switch key { + case "traceId", "trace_id": + err = decoder.Decode(&sl.TraceID) + case "spanId", "span_id": + err = decoder.Decode(&sl.SpanID) + case "traceState", "trace_state": + err = decoder.Decode(&sl.TraceState) + case "attributes": + err = decoder.Decode(&sl.Attrs) + case "droppedAttributesCount", "dropped_attributes_count": + err = decoder.Decode(&sl.DroppedAttrs) + case "flags": + err = decoder.Decode(&sl.Flags) + default: + // Skip unknown. + } + + if err != nil { + return err + } + } + return nil +} diff --git a/vendor/go.opentelemetry.io/otel/trace/internal/telemetry/status.go b/vendor/go.opentelemetry.io/otel/trace/internal/telemetry/status.go new file mode 100644 index 00000000..1039bf40 --- /dev/null +++ b/vendor/go.opentelemetry.io/otel/trace/internal/telemetry/status.go @@ -0,0 +1,42 @@ +// Copyright The OpenTelemetry Authors +// SPDX-License-Identifier: Apache-2.0 + +package telemetry // import "go.opentelemetry.io/otel/trace/internal/telemetry" + +// StatusCode is the status of a Span. +// +// For the semantics of status codes see +// https://github.com/open-telemetry/opentelemetry-specification/blob/main/specification/trace/api.md#set-status +type StatusCode int32 + +const ( + // StatusCodeUnset is the default status. + StatusCodeUnset StatusCode = 0 + // StatusCodeOK is used when the Span has been validated by an Application + // developer or Operator to have completed successfully. + StatusCodeOK StatusCode = 1 + // StatusCodeError is used when the Span contains an error. + StatusCodeError StatusCode = 2 +) + +var statusCodeStrings = []string{ + "Unset", + "OK", + "Error", +} + +func (s StatusCode) String() string { + if s >= 0 && int(s) < len(statusCodeStrings) { + return statusCodeStrings[s] + } + return "" +} + +// Status defines a logical error model that is suitable for different +// programming environments, including REST APIs and RPC APIs. +type Status struct { + // A developer-facing human readable error message. + Message string `json:"message,omitempty"` + // The status code. + Code StatusCode `json:"code,omitempty"` +} diff --git a/vendor/go.opentelemetry.io/otel/trace/internal/telemetry/traces.go b/vendor/go.opentelemetry.io/otel/trace/internal/telemetry/traces.go new file mode 100644 index 00000000..e5f10767 --- /dev/null +++ b/vendor/go.opentelemetry.io/otel/trace/internal/telemetry/traces.go @@ -0,0 +1,189 @@ +// Copyright The OpenTelemetry Authors +// SPDX-License-Identifier: Apache-2.0 + +package telemetry // import "go.opentelemetry.io/otel/trace/internal/telemetry" + +import ( + "bytes" + "encoding/json" + "errors" + "fmt" + "io" +) + +// Traces represents the traces data that can be stored in a persistent storage, +// OR can be embedded by other protocols that transfer OTLP traces data but do +// not implement the OTLP protocol. +// +// The main difference between this message and collector protocol is that +// in this message there will not be any "control" or "metadata" specific to +// OTLP protocol. +// +// When new fields are added into this message, the OTLP request MUST be updated +// as well. +type Traces struct { + // An array of ResourceSpans. + // For data coming from a single resource this array will typically contain + // one element. Intermediary nodes that receive data from multiple origins + // typically batch the data before forwarding further and in that case this + // array will contain multiple elements. + ResourceSpans []*ResourceSpans `json:"resourceSpans,omitempty"` +} + +// UnmarshalJSON decodes the OTLP formatted JSON contained in data into td. +func (td *Traces) UnmarshalJSON(data []byte) error { + decoder := json.NewDecoder(bytes.NewReader(data)) + + t, err := decoder.Token() + if err != nil { + return err + } + if t != json.Delim('{') { + return errors.New("invalid TracesData type") + } + + for decoder.More() { + keyIface, err := decoder.Token() + if err != nil { + if errors.Is(err, io.EOF) { + // Empty. + return nil + } + return err + } + + key, ok := keyIface.(string) + if !ok { + return fmt.Errorf("invalid TracesData field: %#v", keyIface) + } + + switch key { + case "resourceSpans", "resource_spans": + err = decoder.Decode(&td.ResourceSpans) + default: + // Skip unknown. + } + + if err != nil { + return err + } + } + return nil +} + +// ResourceSpans is a collection of ScopeSpans from a Resource. +type ResourceSpans struct { + // The resource for the spans in this message. + // If this field is not set then no resource info is known. + Resource Resource `json:"resource"` + // A list of ScopeSpans that originate from a resource. + ScopeSpans []*ScopeSpans `json:"scopeSpans,omitempty"` + // This schema_url applies to the data in the "resource" field. It does not apply + // to the data in the "scope_spans" field which have their own schema_url field. + SchemaURL string `json:"schemaUrl,omitempty"` +} + +// UnmarshalJSON decodes the OTLP formatted JSON contained in data into rs. +func (rs *ResourceSpans) UnmarshalJSON(data []byte) error { + decoder := json.NewDecoder(bytes.NewReader(data)) + + t, err := decoder.Token() + if err != nil { + return err + } + if t != json.Delim('{') { + return errors.New("invalid ResourceSpans type") + } + + for decoder.More() { + keyIface, err := decoder.Token() + if err != nil { + if errors.Is(err, io.EOF) { + // Empty. + return nil + } + return err + } + + key, ok := keyIface.(string) + if !ok { + return fmt.Errorf("invalid ResourceSpans field: %#v", keyIface) + } + + switch key { + case "resource": + err = decoder.Decode(&rs.Resource) + case "scopeSpans", "scope_spans": + err = decoder.Decode(&rs.ScopeSpans) + case "schemaUrl", "schema_url": + err = decoder.Decode(&rs.SchemaURL) + default: + // Skip unknown. + } + + if err != nil { + return err + } + } + return nil +} + +// ScopeSpans is a collection of Spans produced by an InstrumentationScope. +type ScopeSpans struct { + // The instrumentation scope information for the spans in this message. + // Semantically when InstrumentationScope isn't set, it is equivalent with + // an empty instrumentation scope name (unknown). + Scope *Scope `json:"scope"` + // A list of Spans that originate from an instrumentation scope. + Spans []*Span `json:"spans,omitempty"` + // The Schema URL, if known. This is the identifier of the Schema that the span data + // is recorded in. To learn more about Schema URL see + // https://opentelemetry.io/docs/specs/otel/schemas/#schema-url + // This schema_url applies to all spans and span events in the "spans" field. + SchemaURL string `json:"schemaUrl,omitempty"` +} + +// UnmarshalJSON decodes the OTLP formatted JSON contained in data into ss. +func (ss *ScopeSpans) UnmarshalJSON(data []byte) error { + decoder := json.NewDecoder(bytes.NewReader(data)) + + t, err := decoder.Token() + if err != nil { + return err + } + if t != json.Delim('{') { + return errors.New("invalid ScopeSpans type") + } + + for decoder.More() { + keyIface, err := decoder.Token() + if err != nil { + if errors.Is(err, io.EOF) { + // Empty. + return nil + } + return err + } + + key, ok := keyIface.(string) + if !ok { + return fmt.Errorf("invalid ScopeSpans field: %#v", keyIface) + } + + switch key { + case "scope": + err = decoder.Decode(&ss.Scope) + case "spans": + err = decoder.Decode(&ss.Spans) + case "schemaUrl", "schema_url": + err = decoder.Decode(&ss.SchemaURL) + default: + // Skip unknown. + } + + if err != nil { + return err + } + } + return nil +} diff --git a/vendor/go.opentelemetry.io/otel/trace/internal/telemetry/value.go b/vendor/go.opentelemetry.io/otel/trace/internal/telemetry/value.go new file mode 100644 index 00000000..cb7927b8 --- /dev/null +++ b/vendor/go.opentelemetry.io/otel/trace/internal/telemetry/value.go @@ -0,0 +1,453 @@ +// Copyright The OpenTelemetry Authors +// SPDX-License-Identifier: Apache-2.0 + +package telemetry // import "go.opentelemetry.io/otel/trace/internal/telemetry" + +import ( + "bytes" + "cmp" + "encoding/base64" + "encoding/json" + "errors" + "fmt" + "io" + "math" + "slices" + "strconv" + "unsafe" +) + +// A Value represents a structured value. +// A zero value is valid and represents an empty value. +type Value struct { + // Ensure forward compatibility by explicitly making this not comparable. + noCmp [0]func() //nolint: unused // This is indeed used. + + // num holds the value for Int64, Float64, and Bool. It holds the length + // for String, Bytes, Slice, Map. + num uint64 + // any holds either the KindBool, KindInt64, KindFloat64, stringptr, + // bytesptr, sliceptr, or mapptr. If KindBool, KindInt64, or KindFloat64 + // then the value of Value is in num as described above. Otherwise, it + // contains the value wrapped in the appropriate type. + any any +} + +type ( + // sliceptr represents a value in Value.any for KindString Values. + stringptr *byte + // bytesptr represents a value in Value.any for KindBytes Values. + bytesptr *byte + // sliceptr represents a value in Value.any for KindSlice Values. + sliceptr *Value + // mapptr represents a value in Value.any for KindMap Values. + mapptr *Attr +) + +// ValueKind is the kind of a [Value]. +type ValueKind int + +// ValueKind values. +const ( + ValueKindEmpty ValueKind = iota + ValueKindBool + ValueKindFloat64 + ValueKindInt64 + ValueKindString + ValueKindBytes + ValueKindSlice + ValueKindMap +) + +var valueKindStrings = []string{ + "Empty", + "Bool", + "Float64", + "Int64", + "String", + "Bytes", + "Slice", + "Map", +} + +func (k ValueKind) String() string { + if k >= 0 && int(k) < len(valueKindStrings) { + return valueKindStrings[k] + } + return "" +} + +// StringValue returns a new [Value] for a string. +func StringValue(v string) Value { + return Value{ + num: uint64(len(v)), + any: stringptr(unsafe.StringData(v)), + } +} + +// IntValue returns a [Value] for an int. +func IntValue(v int) Value { return Int64Value(int64(v)) } + +// Int64Value returns a [Value] for an int64. +func Int64Value(v int64) Value { + return Value{ + num: uint64(v), // nolint: gosec // Store raw bytes. + any: ValueKindInt64, + } +} + +// Float64Value returns a [Value] for a float64. +func Float64Value(v float64) Value { + return Value{num: math.Float64bits(v), any: ValueKindFloat64} +} + +// BoolValue returns a [Value] for a bool. +func BoolValue(v bool) Value { //nolint:revive // Not a control flag. + var n uint64 + if v { + n = 1 + } + return Value{num: n, any: ValueKindBool} +} + +// BytesValue returns a [Value] for a byte slice. The passed slice must not be +// changed after it is passed. +func BytesValue(v []byte) Value { + return Value{ + num: uint64(len(v)), + any: bytesptr(unsafe.SliceData(v)), + } +} + +// SliceValue returns a [Value] for a slice of [Value]. The passed slice must +// not be changed after it is passed. +func SliceValue(vs ...Value) Value { + return Value{ + num: uint64(len(vs)), + any: sliceptr(unsafe.SliceData(vs)), + } +} + +// MapValue returns a new [Value] for a slice of key-value pairs. The passed +// slice must not be changed after it is passed. +func MapValue(kvs ...Attr) Value { + return Value{ + num: uint64(len(kvs)), + any: mapptr(unsafe.SliceData(kvs)), + } +} + +// AsString returns the value held by v as a string. +func (v Value) AsString() string { + if sp, ok := v.any.(stringptr); ok { + return unsafe.String(sp, v.num) + } + // TODO: error handle + return "" +} + +// asString returns the value held by v as a string. It will panic if the Value +// is not KindString. +func (v Value) asString() string { + return unsafe.String(v.any.(stringptr), v.num) +} + +// AsInt64 returns the value held by v as an int64. +func (v Value) AsInt64() int64 { + if v.Kind() != ValueKindInt64 { + // TODO: error handle + return 0 + } + return v.asInt64() +} + +// asInt64 returns the value held by v as an int64. If v is not of KindInt64, +// this will return garbage. +func (v Value) asInt64() int64 { + // Assumes v.num was a valid int64 (overflow not checked). + return int64(v.num) // nolint: gosec +} + +// AsBool returns the value held by v as a bool. +func (v Value) AsBool() bool { + if v.Kind() != ValueKindBool { + // TODO: error handle + return false + } + return v.asBool() +} + +// asBool returns the value held by v as a bool. If v is not of KindBool, this +// will return garbage. +func (v Value) asBool() bool { return v.num == 1 } + +// AsFloat64 returns the value held by v as a float64. +func (v Value) AsFloat64() float64 { + if v.Kind() != ValueKindFloat64 { + // TODO: error handle + return 0 + } + return v.asFloat64() +} + +// asFloat64 returns the value held by v as a float64. If v is not of +// KindFloat64, this will return garbage. +func (v Value) asFloat64() float64 { return math.Float64frombits(v.num) } + +// AsBytes returns the value held by v as a []byte. +func (v Value) AsBytes() []byte { + if sp, ok := v.any.(bytesptr); ok { + return unsafe.Slice((*byte)(sp), v.num) + } + // TODO: error handle + return nil +} + +// asBytes returns the value held by v as a []byte. It will panic if the Value +// is not KindBytes. +func (v Value) asBytes() []byte { + return unsafe.Slice((*byte)(v.any.(bytesptr)), v.num) +} + +// AsSlice returns the value held by v as a []Value. +func (v Value) AsSlice() []Value { + if sp, ok := v.any.(sliceptr); ok { + return unsafe.Slice((*Value)(sp), v.num) + } + // TODO: error handle + return nil +} + +// asSlice returns the value held by v as a []Value. It will panic if the Value +// is not KindSlice. +func (v Value) asSlice() []Value { + return unsafe.Slice((*Value)(v.any.(sliceptr)), v.num) +} + +// AsMap returns the value held by v as a []Attr. +func (v Value) AsMap() []Attr { + if sp, ok := v.any.(mapptr); ok { + return unsafe.Slice((*Attr)(sp), v.num) + } + // TODO: error handle + return nil +} + +// asMap returns the value held by v as a []Attr. It will panic if the +// Value is not KindMap. +func (v Value) asMap() []Attr { + return unsafe.Slice((*Attr)(v.any.(mapptr)), v.num) +} + +// Kind returns the Kind of v. +func (v Value) Kind() ValueKind { + switch x := v.any.(type) { + case ValueKind: + return x + case stringptr: + return ValueKindString + case bytesptr: + return ValueKindBytes + case sliceptr: + return ValueKindSlice + case mapptr: + return ValueKindMap + default: + return ValueKindEmpty + } +} + +// Empty reports whether v does not hold any value. +func (v Value) Empty() bool { return v.Kind() == ValueKindEmpty } + +// Equal reports whether v is equal to w. +func (v Value) Equal(w Value) bool { + k1 := v.Kind() + k2 := w.Kind() + if k1 != k2 { + return false + } + switch k1 { + case ValueKindInt64, ValueKindBool: + return v.num == w.num + case ValueKindString: + return v.asString() == w.asString() + case ValueKindFloat64: + return v.asFloat64() == w.asFloat64() + case ValueKindSlice: + return slices.EqualFunc(v.asSlice(), w.asSlice(), Value.Equal) + case ValueKindMap: + sv := sortMap(v.asMap()) + sw := sortMap(w.asMap()) + return slices.EqualFunc(sv, sw, Attr.Equal) + case ValueKindBytes: + return bytes.Equal(v.asBytes(), w.asBytes()) + case ValueKindEmpty: + return true + default: + // TODO: error handle + return false + } +} + +func sortMap(m []Attr) []Attr { + sm := make([]Attr, len(m)) + copy(sm, m) + slices.SortFunc(sm, func(a, b Attr) int { + return cmp.Compare(a.Key, b.Key) + }) + + return sm +} + +// String returns Value's value as a string, formatted like [fmt.Sprint]. +// +// The returned string is meant for debugging; +// the string representation is not stable. +func (v Value) String() string { + switch v.Kind() { + case ValueKindString: + return v.asString() + case ValueKindInt64: + // Assumes v.num was a valid int64 (overflow not checked). + return strconv.FormatInt(int64(v.num), 10) // nolint: gosec + case ValueKindFloat64: + return strconv.FormatFloat(v.asFloat64(), 'g', -1, 64) + case ValueKindBool: + return strconv.FormatBool(v.asBool()) + case ValueKindBytes: + return string(v.asBytes()) + case ValueKindMap: + return fmt.Sprint(v.asMap()) + case ValueKindSlice: + return fmt.Sprint(v.asSlice()) + case ValueKindEmpty: + return "" + default: + // Try to handle this as gracefully as possible. + // + // Don't panic here. The goal here is to have developers find this + // first if a slog.Kind is is not handled. It is + // preferable to have user's open issue asking why their attributes + // have a "unhandled: " prefix than say that their code is panicking. + return fmt.Sprintf("", v.Kind()) + } +} + +// MarshalJSON encodes v into OTLP formatted JSON. +func (v *Value) MarshalJSON() ([]byte, error) { + switch v.Kind() { + case ValueKindString: + return json.Marshal(struct { + Value string `json:"stringValue"` + }{v.asString()}) + case ValueKindInt64: + return json.Marshal(struct { + Value string `json:"intValue"` + }{strconv.FormatInt(int64(v.num), 10)}) // nolint: gosec // From raw bytes. + case ValueKindFloat64: + return json.Marshal(struct { + Value float64 `json:"doubleValue"` + }{v.asFloat64()}) + case ValueKindBool: + return json.Marshal(struct { + Value bool `json:"boolValue"` + }{v.asBool()}) + case ValueKindBytes: + return json.Marshal(struct { + Value []byte `json:"bytesValue"` + }{v.asBytes()}) + case ValueKindMap: + return json.Marshal(struct { + Value struct { + Values []Attr `json:"values"` + } `json:"kvlistValue"` + }{struct { + Values []Attr `json:"values"` + }{v.asMap()}}) + case ValueKindSlice: + return json.Marshal(struct { + Value struct { + Values []Value `json:"values"` + } `json:"arrayValue"` + }{struct { + Values []Value `json:"values"` + }{v.asSlice()}}) + case ValueKindEmpty: + return nil, nil + default: + return nil, fmt.Errorf("unknown Value kind: %s", v.Kind().String()) + } +} + +// UnmarshalJSON decodes the OTLP formatted JSON contained in data into v. +func (v *Value) UnmarshalJSON(data []byte) error { + decoder := json.NewDecoder(bytes.NewReader(data)) + + t, err := decoder.Token() + if err != nil { + return err + } + if t != json.Delim('{') { + return errors.New("invalid Value type") + } + + for decoder.More() { + keyIface, err := decoder.Token() + if err != nil { + if errors.Is(err, io.EOF) { + // Empty. + return nil + } + return err + } + + key, ok := keyIface.(string) + if !ok { + return fmt.Errorf("invalid Value key: %#v", keyIface) + } + + switch key { + case "stringValue", "string_value": + var val string + err = decoder.Decode(&val) + *v = StringValue(val) + case "boolValue", "bool_value": + var val bool + err = decoder.Decode(&val) + *v = BoolValue(val) + case "intValue", "int_value": + var val protoInt64 + err = decoder.Decode(&val) + *v = Int64Value(val.Int64()) + case "doubleValue", "double_value": + var val float64 + err = decoder.Decode(&val) + *v = Float64Value(val) + case "bytesValue", "bytes_value": + var val64 string + if err := decoder.Decode(&val64); err != nil { + return err + } + var val []byte + val, err = base64.StdEncoding.DecodeString(val64) + *v = BytesValue(val) + case "arrayValue", "array_value": + var val struct{ Values []Value } + err = decoder.Decode(&val) + *v = SliceValue(val.Values...) + case "kvlistValue", "kvlist_value": + var val struct{ Values []Attr } + err = decoder.Decode(&val) + *v = MapValue(val.Values...) + default: + // Skip unknown. + continue + } + // Use first valid. Ignore the rest. + return err + } + + // Only unknown fields. Return nil without unmarshaling any value. + return nil +} diff --git a/vendor/go.opentelemetry.io/otel/trace/nonrecording.go b/vendor/go.opentelemetry.io/otel/trace/nonrecording.go new file mode 100644 index 00000000..c00221e7 --- /dev/null +++ b/vendor/go.opentelemetry.io/otel/trace/nonrecording.go @@ -0,0 +1,16 @@ +// Copyright The OpenTelemetry Authors +// SPDX-License-Identifier: Apache-2.0 + +package trace // import "go.opentelemetry.io/otel/trace" + +// nonRecordingSpan is a minimal implementation of a Span that wraps a +// SpanContext. It performs no operations other than to return the wrapped +// SpanContext. +type nonRecordingSpan struct { + noopSpan + + sc SpanContext +} + +// SpanContext returns the wrapped SpanContext. +func (s nonRecordingSpan) SpanContext() SpanContext { return s.sc } diff --git a/vendor/go.opentelemetry.io/otel/trace/noop.go b/vendor/go.opentelemetry.io/otel/trace/noop.go new file mode 100644 index 00000000..400fab12 --- /dev/null +++ b/vendor/go.opentelemetry.io/otel/trace/noop.go @@ -0,0 +1,105 @@ +// Copyright The OpenTelemetry Authors +// SPDX-License-Identifier: Apache-2.0 + +package trace // import "go.opentelemetry.io/otel/trace" + +import ( + "context" + + "go.opentelemetry.io/otel/attribute" + "go.opentelemetry.io/otel/codes" + "go.opentelemetry.io/otel/trace/embedded" +) + +// NewNoopTracerProvider returns an implementation of TracerProvider that +// performs no operations. The Tracer and Spans created from the returned +// TracerProvider also perform no operations. +// +// Deprecated: Use [go.opentelemetry.io/otel/trace/noop.NewTracerProvider] +// instead. +func NewNoopTracerProvider() TracerProvider { + return noopTracerProvider{} +} + +type noopTracerProvider struct{ embedded.TracerProvider } + +var _ TracerProvider = noopTracerProvider{} + +// Tracer returns noop implementation of Tracer. +func (noopTracerProvider) Tracer(string, ...TracerOption) Tracer { + return noopTracer{} +} + +// noopTracer is an implementation of Tracer that performs no operations. +type noopTracer struct{ embedded.Tracer } + +var _ Tracer = noopTracer{} + +// Start carries forward a non-recording Span, if one is present in the context, otherwise it +// creates a no-op Span. +func (noopTracer) Start(ctx context.Context, _ string, _ ...SpanStartOption) (context.Context, Span) { + span := SpanFromContext(ctx) + if _, ok := span.(nonRecordingSpan); !ok { + // span is likely already a noopSpan, but let's be sure + span = noopSpanInstance + } + return ContextWithSpan(ctx, span), span +} + +// noopSpan is an implementation of Span that performs no operations. +type noopSpan struct{ embedded.Span } + +var noopSpanInstance Span = noopSpan{} + +// SpanContext returns an empty span context. +func (noopSpan) SpanContext() SpanContext { return SpanContext{} } + +// IsRecording always returns false. +func (noopSpan) IsRecording() bool { return false } + +// SetStatus does nothing. +func (noopSpan) SetStatus(codes.Code, string) {} + +// SetError does nothing. +func (noopSpan) SetError(bool) {} + +// SetAttributes does nothing. +func (noopSpan) SetAttributes(...attribute.KeyValue) {} + +// End does nothing. +func (noopSpan) End(...SpanEndOption) {} + +// RecordError does nothing. +func (noopSpan) RecordError(error, ...EventOption) {} + +// AddEvent does nothing. +func (noopSpan) AddEvent(string, ...EventOption) {} + +// AddLink does nothing. +func (noopSpan) AddLink(Link) {} + +// SetName does nothing. +func (noopSpan) SetName(string) {} + +// TracerProvider returns a no-op TracerProvider. +func (s noopSpan) TracerProvider() TracerProvider { + return s.tracerProvider(autoInstEnabled) +} + +// autoInstEnabled defines if the auto-instrumentation SDK is enabled. +// +// The auto-instrumentation is expected to overwrite this value to true when it +// attaches to the process. +var autoInstEnabled = new(bool) + +// tracerProvider return a noopTracerProvider if autoEnabled is false, +// otherwise it will return a TracerProvider from the sdk package used in +// auto-instrumentation. +// +//go:noinline +func (noopSpan) tracerProvider(autoEnabled *bool) TracerProvider { + if *autoEnabled { + return newAutoTracerProvider() + } + return noopTracerProvider{} +} diff --git a/vendor/go.opentelemetry.io/otel/trace/noop/README.md b/vendor/go.opentelemetry.io/otel/trace/noop/README.md new file mode 100644 index 00000000..cd382c82 --- /dev/null +++ b/vendor/go.opentelemetry.io/otel/trace/noop/README.md @@ -0,0 +1,3 @@ +# Trace Noop + +[![PkgGoDev](https://pkg.go.dev/badge/go.opentelemetry.io/otel/trace/noop)](https://pkg.go.dev/go.opentelemetry.io/otel/trace/noop) diff --git a/vendor/go.opentelemetry.io/otel/trace/noop/noop.go b/vendor/go.opentelemetry.io/otel/trace/noop/noop.go new file mode 100644 index 00000000..689d220d --- /dev/null +++ b/vendor/go.opentelemetry.io/otel/trace/noop/noop.go @@ -0,0 +1,112 @@ +// Copyright The OpenTelemetry Authors +// SPDX-License-Identifier: Apache-2.0 + +// Package noop provides an implementation of the OpenTelemetry trace API that +// produces no telemetry and minimizes used computation resources. +// +// Using this package to implement the OpenTelemetry trace API will effectively +// disable OpenTelemetry. +// +// This implementation can be embedded in other implementations of the +// OpenTelemetry trace API. Doing so will mean the implementation defaults to +// no operation for methods it does not implement. +package noop // import "go.opentelemetry.io/otel/trace/noop" + +import ( + "context" + + "go.opentelemetry.io/otel/attribute" + "go.opentelemetry.io/otel/codes" + "go.opentelemetry.io/otel/trace" + "go.opentelemetry.io/otel/trace/embedded" +) + +var ( + // Compile-time check this implements the OpenTelemetry API. + + _ trace.TracerProvider = TracerProvider{} + _ trace.Tracer = Tracer{} + _ trace.Span = Span{} +) + +// TracerProvider is an OpenTelemetry No-Op TracerProvider. +type TracerProvider struct{ embedded.TracerProvider } + +// NewTracerProvider returns a TracerProvider that does not record any telemetry. +func NewTracerProvider() TracerProvider { + return TracerProvider{} +} + +// Tracer returns an OpenTelemetry Tracer that does not record any telemetry. +func (TracerProvider) Tracer(string, ...trace.TracerOption) trace.Tracer { + return Tracer{} +} + +// Tracer is an OpenTelemetry No-Op Tracer. +type Tracer struct{ embedded.Tracer } + +// Start creates a span. The created span will be set in a child context of ctx +// and returned with the span. +// +// If ctx contains a span context, the returned span will also contain that +// span context. If the span context in ctx is for a non-recording span, that +// span instance will be returned directly. +func (Tracer) Start(ctx context.Context, _ string, _ ...trace.SpanStartOption) (context.Context, trace.Span) { + span := trace.SpanFromContext(ctx) + + // If the parent context contains a non-zero span context, that span + // context needs to be returned as a non-recording span + // (https://github.com/open-telemetry/opentelemetry-specification/blob/3a1dde966a4ce87cce5adf464359fe369741bbea/specification/trace/api.md#behavior-of-the-api-in-the-absence-of-an-installed-sdk). + var zeroSC trace.SpanContext + if sc := span.SpanContext(); !sc.Equal(zeroSC) { + if !span.IsRecording() { + // If the span is not recording return it directly. + return ctx, span + } + // Otherwise, return the span context needs in a non-recording span. + span = Span{sc: sc} + } else { + // No parent, return a No-Op span with an empty span context. + span = noopSpanInstance + } + return trace.ContextWithSpan(ctx, span), span +} + +var noopSpanInstance trace.Span = Span{} + +// Span is an OpenTelemetry No-Op Span. +type Span struct { + embedded.Span + + sc trace.SpanContext +} + +// SpanContext returns an empty span context. +func (s Span) SpanContext() trace.SpanContext { return s.sc } + +// IsRecording always returns false. +func (Span) IsRecording() bool { return false } + +// SetStatus does nothing. +func (Span) SetStatus(codes.Code, string) {} + +// SetAttributes does nothing. +func (Span) SetAttributes(...attribute.KeyValue) {} + +// End does nothing. +func (Span) End(...trace.SpanEndOption) {} + +// RecordError does nothing. +func (Span) RecordError(error, ...trace.EventOption) {} + +// AddEvent does nothing. +func (Span) AddEvent(string, ...trace.EventOption) {} + +// AddLink does nothing. +func (Span) AddLink(trace.Link) {} + +// SetName does nothing. +func (Span) SetName(string) {} + +// TracerProvider returns a No-Op TracerProvider. +func (Span) TracerProvider() trace.TracerProvider { return TracerProvider{} } diff --git a/vendor/go.opentelemetry.io/otel/trace/provider.go b/vendor/go.opentelemetry.io/otel/trace/provider.go new file mode 100644 index 00000000..ef85cb70 --- /dev/null +++ b/vendor/go.opentelemetry.io/otel/trace/provider.go @@ -0,0 +1,59 @@ +// Copyright The OpenTelemetry Authors +// SPDX-License-Identifier: Apache-2.0 + +package trace // import "go.opentelemetry.io/otel/trace" + +import "go.opentelemetry.io/otel/trace/embedded" + +// TracerProvider provides Tracers that are used by instrumentation code to +// trace computational workflows. +// +// A TracerProvider is the collection destination of all Spans from Tracers it +// provides, it represents a unique telemetry collection pipeline. How that +// pipeline is defined, meaning how those Spans are collected, processed, and +// where they are exported, depends on its implementation. Instrumentation +// authors do not need to define this implementation, rather just use the +// provided Tracers to instrument code. +// +// Commonly, instrumentation code will accept a TracerProvider implementation +// at runtime from its users or it can simply use the globally registered one +// (see https://pkg.go.dev/go.opentelemetry.io/otel#GetTracerProvider). +// +// Warning: Methods may be added to this interface in minor releases. See +// package documentation on API implementation for information on how to set +// default behavior for unimplemented methods. +type TracerProvider interface { + // Users of the interface can ignore this. This embedded type is only used + // by implementations of this interface. See the "API Implementations" + // section of the package documentation for more information. + embedded.TracerProvider + + // Tracer returns a unique Tracer scoped to be used by instrumentation code + // to trace computational workflows. The scope and identity of that + // instrumentation code is uniquely defined by the name and options passed. + // + // The passed name needs to uniquely identify instrumentation code. + // Therefore, it is recommended that name is the Go package name of the + // library providing instrumentation (note: not the code being + // instrumented). Instrumentation libraries can have multiple versions, + // therefore, the WithInstrumentationVersion option should be used to + // distinguish these different codebases. Additionally, instrumentation + // libraries may sometimes use traces to communicate different domains of + // workflow data (i.e. using spans to communicate workflow events only). If + // this is the case, the WithScopeAttributes option should be used to + // uniquely identify Tracers that handle the different domains of workflow + // data. + // + // If the same name and options are passed multiple times, the same Tracer + // will be returned (it is up to the implementation if this will be the + // same underlying instance of that Tracer or not). It is not necessary to + // call this multiple times with the same name and options to get an + // up-to-date Tracer. All implementations will ensure any TracerProvider + // configuration changes are propagated to all provided Tracers. + // + // If name is empty, then an implementation defined default name will be + // used instead. + // + // This method is safe to call concurrently. + Tracer(name string, options ...TracerOption) Tracer +} diff --git a/vendor/go.opentelemetry.io/otel/trace/span.go b/vendor/go.opentelemetry.io/otel/trace/span.go new file mode 100644 index 00000000..d01e7936 --- /dev/null +++ b/vendor/go.opentelemetry.io/otel/trace/span.go @@ -0,0 +1,181 @@ +// Copyright The OpenTelemetry Authors +// SPDX-License-Identifier: Apache-2.0 + +package trace // import "go.opentelemetry.io/otel/trace" + +import ( + "context" + + "go.opentelemetry.io/otel/attribute" + "go.opentelemetry.io/otel/codes" + "go.opentelemetry.io/otel/trace/embedded" +) + +// Span is the individual component of a trace. It represents a single named +// and timed operation of a workflow that is traced. A Tracer is used to +// create a Span and it is then up to the operation the Span represents to +// properly end the Span when the operation itself ends. +// +// Warning: Methods may be added to this interface in minor releases. See +// package documentation on API implementation for information on how to set +// default behavior for unimplemented methods. +type Span interface { + // Users of the interface can ignore this. This embedded type is only used + // by implementations of this interface. See the "API Implementations" + // section of the package documentation for more information. + embedded.Span + + // End completes the Span. The Span is considered complete and ready to be + // delivered through the rest of the telemetry pipeline after this method + // is called. Therefore, updates to the Span are not allowed after this + // method has been called. + End(options ...SpanEndOption) + + // AddEvent adds an event with the provided name and options. + AddEvent(name string, options ...EventOption) + + // AddLink adds a link. + // Adding links at span creation using WithLinks is preferred to calling AddLink + // later, for contexts that are available during span creation, because head + // sampling decisions can only consider information present during span creation. + AddLink(link Link) + + // IsRecording returns the recording state of the Span. It will return + // true if the Span is active and events can be recorded. + IsRecording() bool + + // RecordError will record err as an exception span event for this span. An + // additional call to SetStatus is required if the Status of the Span should + // be set to Error, as this method does not change the Span status. If this + // span is not being recorded or err is nil then this method does nothing. + RecordError(err error, options ...EventOption) + + // SpanContext returns the SpanContext of the Span. The returned SpanContext + // is usable even after the End method has been called for the Span. + SpanContext() SpanContext + + // SetStatus sets the status of the Span in the form of a code and a + // description, provided the status hasn't already been set to a higher + // value before (OK > Error > Unset). The description is only included in a + // status when the code is for an error. + SetStatus(code codes.Code, description string) + + // SetName sets the Span name. + SetName(name string) + + // SetAttributes sets kv as attributes of the Span. If a key from kv + // already exists for an attribute of the Span it will be overwritten with + // the value contained in kv. + // + // Note that adding attributes at span creation using [WithAttributes] is preferred + // to calling SetAttribute later, as samplers can only consider information + // already present during span creation. + SetAttributes(kv ...attribute.KeyValue) + + // TracerProvider returns a TracerProvider that can be used to generate + // additional Spans on the same telemetry pipeline as the current Span. + TracerProvider() TracerProvider +} + +// Link is the relationship between two Spans. The relationship can be within +// the same Trace or across different Traces. +// +// For example, a Link is used in the following situations: +// +// 1. Batch Processing: A batch of operations may contain operations +// associated with one or more traces/spans. Since there can only be one +// parent SpanContext, a Link is used to keep reference to the +// SpanContext of all operations in the batch. +// 2. Public Endpoint: A SpanContext for an in incoming client request on a +// public endpoint should be considered untrusted. In such a case, a new +// trace with its own identity and sampling decision needs to be created, +// but this new trace needs to be related to the original trace in some +// form. A Link is used to keep reference to the original SpanContext and +// track the relationship. +type Link struct { + // SpanContext of the linked Span. + SpanContext SpanContext + + // Attributes describe the aspects of the link. + Attributes []attribute.KeyValue +} + +// LinkFromContext returns a link encapsulating the SpanContext in the provided +// ctx. +func LinkFromContext(ctx context.Context, attrs ...attribute.KeyValue) Link { + return Link{ + SpanContext: SpanContextFromContext(ctx), + Attributes: attrs, + } +} + +// SpanKind is the role a Span plays in a Trace. +type SpanKind int + +// As a convenience, these match the proto definition, see +// https://github.com/open-telemetry/opentelemetry-proto/blob/30d237e1ff3ab7aa50e0922b5bebdd93505090af/opentelemetry/proto/trace/v1/trace.proto#L101-L129 +// +// The unspecified value is not a valid `SpanKind`. Use `ValidateSpanKind()` +// to coerce a span kind to a valid value. +const ( + // SpanKindUnspecified is an unspecified SpanKind and is not a valid + // SpanKind. SpanKindUnspecified should be replaced with SpanKindInternal + // if it is received. + SpanKindUnspecified SpanKind = 0 + // SpanKindInternal is a SpanKind for a Span that represents an internal + // operation within an application. + SpanKindInternal SpanKind = 1 + // SpanKindServer is a SpanKind for a Span that represents the operation + // of handling a request from a client. + SpanKindServer SpanKind = 2 + // SpanKindClient is a SpanKind for a Span that represents the operation + // of client making a request to a server. + SpanKindClient SpanKind = 3 + // SpanKindProducer is a SpanKind for a Span that represents the operation + // of a producer sending a message to a message broker. Unlike + // SpanKindClient and SpanKindServer, there is often no direct + // relationship between this kind of Span and a SpanKindConsumer kind. A + // SpanKindProducer Span will end once the message is accepted by the + // message broker which might not overlap with the processing of that + // message. + SpanKindProducer SpanKind = 4 + // SpanKindConsumer is a SpanKind for a Span that represents the operation + // of a consumer receiving a message from a message broker. Like + // SpanKindProducer Spans, there is often no direct relationship between + // this Span and the Span that produced the message. + SpanKindConsumer SpanKind = 5 +) + +// ValidateSpanKind returns a valid span kind value. This will coerce +// invalid values into the default value, SpanKindInternal. +func ValidateSpanKind(spanKind SpanKind) SpanKind { + switch spanKind { + case SpanKindInternal, + SpanKindServer, + SpanKindClient, + SpanKindProducer, + SpanKindConsumer: + // valid + return spanKind + default: + return SpanKindInternal + } +} + +// String returns the specified name of the SpanKind in lower-case. +func (sk SpanKind) String() string { + switch sk { + case SpanKindInternal: + return "internal" + case SpanKindServer: + return "server" + case SpanKindClient: + return "client" + case SpanKindProducer: + return "producer" + case SpanKindConsumer: + return "consumer" + default: + return "unspecified" + } +} diff --git a/vendor/go.opentelemetry.io/otel/trace/trace.go b/vendor/go.opentelemetry.io/otel/trace/trace.go new file mode 100644 index 00000000..e3d103c4 --- /dev/null +++ b/vendor/go.opentelemetry.io/otel/trace/trace.go @@ -0,0 +1,389 @@ +// Copyright The OpenTelemetry Authors +// SPDX-License-Identifier: Apache-2.0 + +package trace // import "go.opentelemetry.io/otel/trace" + +import ( + "encoding/json" +) + +const ( + // FlagsSampled is a bitmask with the sampled bit set. A SpanContext + // with the sampling bit set means the span is sampled. + FlagsSampled = TraceFlags(0x01) + + // FlagsRandom is a bitmask with the random trace ID flag set. When + // set, it signals that the trace ID was generated randomly with at + // least 56 bits of randomness (W3C Trace Context Level 2). + FlagsRandom = TraceFlags(0x02) + + errInvalidHexID errorConst = "trace-id and span-id can only contain [0-9a-f] characters, all lowercase" + + errInvalidTraceIDLength errorConst = "hex encoded trace-id must have length equals to 32" + errNilTraceID errorConst = "trace-id can't be all zero" + + errInvalidSpanIDLength errorConst = "hex encoded span-id must have length equals to 16" + errNilSpanID errorConst = "span-id can't be all zero" +) + +type errorConst string + +func (e errorConst) Error() string { + return string(e) +} + +// TraceID is a unique identity of a trace. +// nolint:revive // revive complains about stutter of `trace.TraceID`. +type TraceID [16]byte + +var ( + nilTraceID TraceID + _ json.Marshaler = nilTraceID +) + +// IsValid reports whether the trace TraceID is valid. A valid trace ID does +// not consist of zeros only. +func (t TraceID) IsValid() bool { + return t != nilTraceID +} + +// MarshalJSON implements a custom marshal function to encode TraceID +// as a hex string. +func (t TraceID) MarshalJSON() ([]byte, error) { + b := [32 + 2]byte{0: '"', 33: '"'} + h := t.hexBytes() + copy(b[1:], h[:]) + return b[:], nil +} + +// String returns the hex string representation form of a TraceID. +func (t TraceID) String() string { + h := t.hexBytes() + return string(h[:]) +} + +// hexBytes returns the hex string representation form of a TraceID. +func (t TraceID) hexBytes() [32]byte { + return [32]byte{ + hexLU[t[0x0]>>4], hexLU[t[0x0]&0xf], + hexLU[t[0x1]>>4], hexLU[t[0x1]&0xf], + hexLU[t[0x2]>>4], hexLU[t[0x2]&0xf], + hexLU[t[0x3]>>4], hexLU[t[0x3]&0xf], + hexLU[t[0x4]>>4], hexLU[t[0x4]&0xf], + hexLU[t[0x5]>>4], hexLU[t[0x5]&0xf], + hexLU[t[0x6]>>4], hexLU[t[0x6]&0xf], + hexLU[t[0x7]>>4], hexLU[t[0x7]&0xf], + hexLU[t[0x8]>>4], hexLU[t[0x8]&0xf], + hexLU[t[0x9]>>4], hexLU[t[0x9]&0xf], + hexLU[t[0xa]>>4], hexLU[t[0xa]&0xf], + hexLU[t[0xb]>>4], hexLU[t[0xb]&0xf], + hexLU[t[0xc]>>4], hexLU[t[0xc]&0xf], + hexLU[t[0xd]>>4], hexLU[t[0xd]&0xf], + hexLU[t[0xe]>>4], hexLU[t[0xe]&0xf], + hexLU[t[0xf]>>4], hexLU[t[0xf]&0xf], + } +} + +// SpanID is a unique identity of a span in a trace. +type SpanID [8]byte + +var ( + nilSpanID SpanID + _ json.Marshaler = nilSpanID +) + +// IsValid reports whether the SpanID is valid. A valid SpanID does not consist +// of zeros only. +func (s SpanID) IsValid() bool { + return s != nilSpanID +} + +// MarshalJSON implements a custom marshal function to encode SpanID +// as a hex string. +func (s SpanID) MarshalJSON() ([]byte, error) { + b := [16 + 2]byte{0: '"', 17: '"'} + h := s.hexBytes() + copy(b[1:], h[:]) + return b[:], nil +} + +// String returns the hex string representation form of a SpanID. +func (s SpanID) String() string { + b := s.hexBytes() + return string(b[:]) +} + +func (s SpanID) hexBytes() [16]byte { + return [16]byte{ + hexLU[s[0]>>4], hexLU[s[0]&0xf], + hexLU[s[1]>>4], hexLU[s[1]&0xf], + hexLU[s[2]>>4], hexLU[s[2]&0xf], + hexLU[s[3]>>4], hexLU[s[3]&0xf], + hexLU[s[4]>>4], hexLU[s[4]&0xf], + hexLU[s[5]>>4], hexLU[s[5]&0xf], + hexLU[s[6]>>4], hexLU[s[6]&0xf], + hexLU[s[7]>>4], hexLU[s[7]&0xf], + } +} + +// TraceIDFromHex returns a TraceID from a hex string if it is compliant with +// the W3C trace-context specification. See more at +// https://www.w3.org/TR/trace-context/#trace-id +// nolint:revive // revive complains about stutter of `trace.TraceIDFromHex`. +func TraceIDFromHex(h string) (TraceID, error) { + if len(h) != 32 { + return [16]byte{}, errInvalidTraceIDLength + } + var b [16]byte + invalidMark := byte(0) + for i := 0; i < len(h); i += 4 { + b[i/2] = (hexRev[h[i]] << 4) | hexRev[h[i+1]] + b[i/2+1] = (hexRev[h[i+2]] << 4) | hexRev[h[i+3]] + invalidMark |= hexRev[h[i]] | hexRev[h[i+1]] | hexRev[h[i+2]] | hexRev[h[i+3]] + } + // If the upper 4 bits of any byte are not zero, there was an invalid hex + // character since invalid hex characters are 0xff in hexRev. + if invalidMark&0xf0 != 0 { + return [16]byte{}, errInvalidHexID + } + // If we didn't set any bits, then h was all zeros. + if invalidMark == 0 { + return [16]byte{}, errNilTraceID + } + return b, nil +} + +// SpanIDFromHex returns a SpanID from a hex string if it is compliant +// with the w3c trace-context specification. +// See more at https://www.w3.org/TR/trace-context/#parent-id +func SpanIDFromHex(h string) (SpanID, error) { + if len(h) != 16 { + return [8]byte{}, errInvalidSpanIDLength + } + var b [8]byte + invalidMark := byte(0) + for i := 0; i < len(h); i += 4 { + b[i/2] = (hexRev[h[i]] << 4) | hexRev[h[i+1]] + b[i/2+1] = (hexRev[h[i+2]] << 4) | hexRev[h[i+3]] + invalidMark |= hexRev[h[i]] | hexRev[h[i+1]] | hexRev[h[i+2]] | hexRev[h[i+3]] + } + // If the upper 4 bits of any byte are not zero, there was an invalid hex + // character since invalid hex characters are 0xff in hexRev. + if invalidMark&0xf0 != 0 { + return [8]byte{}, errInvalidHexID + } + // If we didn't set any bits, then h was all zeros. + if invalidMark == 0 { + return [8]byte{}, errNilSpanID + } + return b, nil +} + +// TraceFlags contains flags that can be set on a SpanContext. +type TraceFlags byte //nolint:revive // revive complains about stutter of `trace.TraceFlags`. + +// IsSampled reports whether the sampling bit is set in the TraceFlags. +func (tf TraceFlags) IsSampled() bool { + return tf&FlagsSampled == FlagsSampled +} + +// WithSampled sets the sampling bit in a new copy of the TraceFlags. +func (tf TraceFlags) WithSampled(sampled bool) TraceFlags { // nolint:revive // sampled is not a control flag. + if sampled { + return tf | FlagsSampled + } + + return tf &^ FlagsSampled +} + +// IsRandom reports whether the random bit is set in the TraceFlags. +func (tf TraceFlags) IsRandom() bool { + return tf&FlagsRandom == FlagsRandom +} + +// WithRandom sets the random bit in a new copy of the TraceFlags. +func (tf TraceFlags) WithRandom(random bool) TraceFlags { // nolint:revive // random is not a control flag. + if random { + return tf | FlagsRandom + } + + return tf &^ FlagsRandom +} + +// MarshalJSON implements a custom marshal function to encode TraceFlags +// as a hex string. +func (tf TraceFlags) MarshalJSON() ([]byte, error) { + b := [2 + 2]byte{0: '"', 3: '"'} + h := tf.hexBytes() + copy(b[1:], h[:]) + return b[:], nil +} + +// String returns the hex string representation form of TraceFlags. +func (tf TraceFlags) String() string { + h := tf.hexBytes() + return string(h[:]) +} + +func (tf TraceFlags) hexBytes() [2]byte { + return [2]byte{hexLU[tf>>4], hexLU[tf&0xf]} +} + +// SpanContextConfig contains mutable fields usable for constructing +// an immutable SpanContext. +type SpanContextConfig struct { + TraceID TraceID + SpanID SpanID + TraceFlags TraceFlags + TraceState TraceState + Remote bool +} + +// NewSpanContext constructs a SpanContext using values from the provided +// SpanContextConfig. +func NewSpanContext(config SpanContextConfig) SpanContext { + return SpanContext{ + traceID: config.TraceID, + spanID: config.SpanID, + traceFlags: config.TraceFlags, + traceState: config.TraceState, + remote: config.Remote, + } +} + +// SpanContext contains identifying trace information about a Span. +type SpanContext struct { + traceID TraceID + spanID SpanID + traceFlags TraceFlags + traceState TraceState + remote bool +} + +var _ json.Marshaler = SpanContext{} + +// IsValid reports whether the SpanContext is valid. A valid span context has a +// valid TraceID and SpanID. +func (sc SpanContext) IsValid() bool { + return sc.HasTraceID() && sc.HasSpanID() +} + +// IsRemote reports whether the SpanContext represents a remotely-created Span. +func (sc SpanContext) IsRemote() bool { + return sc.remote +} + +// WithRemote returns a copy of sc with the Remote property set to remote. +func (sc SpanContext) WithRemote(remote bool) SpanContext { + return SpanContext{ + traceID: sc.traceID, + spanID: sc.spanID, + traceFlags: sc.traceFlags, + traceState: sc.traceState, + remote: remote, + } +} + +// TraceID returns the TraceID from the SpanContext. +func (sc SpanContext) TraceID() TraceID { + return sc.traceID +} + +// HasTraceID reports whether the SpanContext has a valid TraceID. +func (sc SpanContext) HasTraceID() bool { + return sc.traceID.IsValid() +} + +// WithTraceID returns a new SpanContext with the TraceID replaced. +func (sc SpanContext) WithTraceID(traceID TraceID) SpanContext { + return SpanContext{ + traceID: traceID, + spanID: sc.spanID, + traceFlags: sc.traceFlags, + traceState: sc.traceState, + remote: sc.remote, + } +} + +// SpanID returns the SpanID from the SpanContext. +func (sc SpanContext) SpanID() SpanID { + return sc.spanID +} + +// HasSpanID reports whether the SpanContext has a valid SpanID. +func (sc SpanContext) HasSpanID() bool { + return sc.spanID.IsValid() +} + +// WithSpanID returns a new SpanContext with the SpanID replaced. +func (sc SpanContext) WithSpanID(spanID SpanID) SpanContext { + return SpanContext{ + traceID: sc.traceID, + spanID: spanID, + traceFlags: sc.traceFlags, + traceState: sc.traceState, + remote: sc.remote, + } +} + +// TraceFlags returns the flags from the SpanContext. +func (sc SpanContext) TraceFlags() TraceFlags { + return sc.traceFlags +} + +// IsSampled reports whether the sampling bit is set in the SpanContext's TraceFlags. +func (sc SpanContext) IsSampled() bool { + return sc.traceFlags.IsSampled() +} + +// IsRandom reports whether the random bit is set in the SpanContext's TraceFlags. +func (sc SpanContext) IsRandom() bool { + return sc.traceFlags.IsRandom() +} + +// WithTraceFlags returns a new SpanContext with the TraceFlags replaced. +func (sc SpanContext) WithTraceFlags(flags TraceFlags) SpanContext { + return SpanContext{ + traceID: sc.traceID, + spanID: sc.spanID, + traceFlags: flags, + traceState: sc.traceState, + remote: sc.remote, + } +} + +// TraceState returns the TraceState from the SpanContext. +func (sc SpanContext) TraceState() TraceState { + return sc.traceState +} + +// WithTraceState returns a new SpanContext with the TraceState replaced. +func (sc SpanContext) WithTraceState(state TraceState) SpanContext { + return SpanContext{ + traceID: sc.traceID, + spanID: sc.spanID, + traceFlags: sc.traceFlags, + traceState: state, + remote: sc.remote, + } +} + +// Equal reports whether two SpanContext values are equal. +func (sc SpanContext) Equal(other SpanContext) bool { + return sc.traceID == other.traceID && + sc.spanID == other.spanID && + sc.traceFlags == other.traceFlags && + sc.traceState.String() == other.traceState.String() && + sc.remote == other.remote +} + +// MarshalJSON implements a custom marshal function to encode a SpanContext. +func (sc SpanContext) MarshalJSON() ([]byte, error) { + return json.Marshal(SpanContextConfig{ + TraceID: sc.traceID, + SpanID: sc.spanID, + TraceFlags: sc.traceFlags, + TraceState: sc.traceState, + Remote: sc.remote, + }) +} diff --git a/vendor/go.opentelemetry.io/otel/trace/tracer.go b/vendor/go.opentelemetry.io/otel/trace/tracer.go new file mode 100644 index 00000000..77952d2a --- /dev/null +++ b/vendor/go.opentelemetry.io/otel/trace/tracer.go @@ -0,0 +1,37 @@ +// Copyright The OpenTelemetry Authors +// SPDX-License-Identifier: Apache-2.0 + +package trace // import "go.opentelemetry.io/otel/trace" + +import ( + "context" + + "go.opentelemetry.io/otel/trace/embedded" +) + +// Tracer is the creator of Spans. +// +// Warning: Methods may be added to this interface in minor releases. See +// package documentation on API implementation for information on how to set +// default behavior for unimplemented methods. +type Tracer interface { + // Users of the interface can ignore this. This embedded type is only used + // by implementations of this interface. See the "API Implementations" + // section of the package documentation for more information. + embedded.Tracer + + // Start creates a span and a context.Context containing the newly-created span. + // + // If the context.Context provided in `ctx` contains a Span then the newly-created + // Span will be a child of that span, otherwise it will be a root span. This behavior + // can be overridden by providing `WithNewRoot()` as a SpanOption, causing the + // newly-created Span to be a root span even if `ctx` contains a Span. + // + // When creating a Span it is recommended to provide all known span attributes using + // the `WithAttributes()` SpanOption as samplers will only have access to the + // attributes provided when a Span is created. + // + // Any Span that is created MUST also be ended. This is the responsibility of the user. + // Implementations of this API may leak memory or other resources if Spans are not ended. + Start(ctx context.Context, spanName string, opts ...SpanStartOption) (context.Context, Span) +} diff --git a/vendor/go.opentelemetry.io/otel/trace/tracestate.go b/vendor/go.opentelemetry.io/otel/trace/tracestate.go new file mode 100644 index 00000000..e9cb3fd4 --- /dev/null +++ b/vendor/go.opentelemetry.io/otel/trace/tracestate.go @@ -0,0 +1,333 @@ +// Copyright The OpenTelemetry Authors +// SPDX-License-Identifier: Apache-2.0 + +package trace // import "go.opentelemetry.io/otel/trace" + +import ( + "encoding/json" + "fmt" + "strings" +) + +const ( + maxListMembers = 32 + + listDelimiters = "," + memberDelimiter = "=" + + errInvalidKey errorConst = "invalid tracestate key" + errInvalidValue errorConst = "invalid tracestate value" + errInvalidMember errorConst = "invalid tracestate list-member" + errMemberNumber errorConst = "too many list-members in tracestate" + errDuplicate errorConst = "duplicate list-member in tracestate" +) + +type member struct { + Key string + Value string +} + +// according to (chr = %x20 / (nblk-char = %x21-2B / %x2D-3C / %x3E-7E) ) +// means (chr = %x20-2B / %x2D-3C / %x3E-7E) . +func checkValueChar(v byte) bool { + return v >= '\x20' && v <= '\x7e' && v != '\x2c' && v != '\x3d' +} + +// according to (nblk-chr = %x21-2B / %x2D-3C / %x3E-7E) . +func checkValueLast(v byte) bool { + return v >= '\x21' && v <= '\x7e' && v != '\x2c' && v != '\x3d' +} + +// based on the W3C Trace Context specification +// +// value = (0*255(chr)) nblk-chr +// nblk-chr = %x21-2B / %x2D-3C / %x3E-7E +// chr = %x20 / nblk-chr +// +// see https://www.w3.org/TR/trace-context-1/#value +func checkValue(val string) bool { + n := len(val) + if n == 0 || n > 256 { + return false + } + for i := 0; i < n-1; i++ { + if !checkValueChar(val[i]) { + return false + } + } + return checkValueLast(val[n-1]) +} + +func checkKeyRemain(key string) bool { + // ( lcalpha / DIGIT / "_" / "-"/ "*" / "/" ) + for _, v := range key { + if v > 127 { + return false + } + if isAlphaNumASCII(v) { + continue + } + switch v { + case '_', '-', '*', '/': + continue + } + return false + } + return true +} + +// according to +// +// simple-key = lcalpha (0*255( lcalpha / DIGIT / "_" / "-"/ "*" / "/" )) +// system-id = lcalpha (0*13( lcalpha / DIGIT / "_" / "-"/ "*" / "/" )) +// +// param n is remain part length, should be 255 in simple-key or 13 in system-id. +func checkKeyPart(key string, n int) bool { + if key == "" { + return false + } + first := key[0] // key's first char + ret := len(key[1:]) <= n + ret = ret && first >= 'a' && first <= 'z' + return ret && checkKeyRemain(key[1:]) +} + +func isAlphaNumASCII[T rune | byte](c T) bool { + if c >= 'a' && c <= 'z' { + return true + } + return c >= '0' && c <= '9' +} + +// according to +// +// tenant-id = ( lcalpha / DIGIT ) 0*240( lcalpha / DIGIT / "_" / "-"/ "*" / "/" ) +// +// param n is remain part length, should be 240 exactly. +func checkKeyTenant(key string, n int) bool { + if key == "" { + return false + } + return isAlphaNumASCII(key[0]) && len(key[1:]) <= n && checkKeyRemain(key[1:]) +} + +// based on the W3C Trace Context specification +// +// key = simple-key / multi-tenant-key +// simple-key = lcalpha (0*255( lcalpha / DIGIT / "_" / "-"/ "*" / "/" )) +// multi-tenant-key = tenant-id "@" system-id +// tenant-id = ( lcalpha / DIGIT ) (0*240( lcalpha / DIGIT / "_" / "-"/ "*" / "/" )) +// system-id = lcalpha (0*13( lcalpha / DIGIT / "_" / "-"/ "*" / "/" )) +// lcalpha = %x61-7A ; a-z +// +// see https://www.w3.org/TR/trace-context-1/#tracestate-header. +func checkKey(key string) bool { + tenant, system, ok := strings.Cut(key, "@") + if !ok { + return checkKeyPart(key, 255) + } + return checkKeyTenant(tenant, 240) && checkKeyPart(system, 13) +} + +func newMember(key, value string) (member, error) { + if !checkKey(key) { + return member{}, errInvalidKey + } + if !checkValue(value) { + return member{}, errInvalidValue + } + return member{Key: key, Value: value}, nil +} + +func parseMember(m string) (member, error) { + key, val, ok := strings.Cut(m, memberDelimiter) + if !ok { + return member{}, fmt.Errorf("%w: %s", errInvalidMember, m) + } + key = strings.TrimLeft(key, " \t") + val = strings.TrimRight(val, " \t") + result, e := newMember(key, val) + if e != nil { + return member{}, fmt.Errorf("%w: %s", errInvalidMember, m) + } + return result, nil +} + +// String encodes member into a string compliant with the W3C Trace Context +// specification. +func (m member) String() string { + return m.Key + "=" + m.Value +} + +// TraceState provides additional vendor-specific trace identification +// information across different distributed tracing systems. It represents an +// immutable list consisting of key/value pairs, each pair is referred to as a +// list-member. +// +// TraceState conforms to the W3C Trace Context specification +// (https://www.w3.org/TR/trace-context-1). All operations that create or copy +// a TraceState do so by validating all input and will only produce TraceState +// that conform to the specification. Specifically, this means that all +// list-member's key/value pairs are valid, no duplicate list-members exist, +// and the maximum number of list-members (32) is not exceeded. +type TraceState struct { //nolint:revive // revive complains about stutter of `trace.TraceState` + // list is the members in order. + list []member +} + +var _ json.Marshaler = TraceState{} + +// ParseTraceState attempts to decode a TraceState from the passed +// string. It returns an error if the input is invalid according to the W3C +// Trace Context specification. +func ParseTraceState(ts string) (TraceState, error) { + if ts == "" { + return TraceState{}, nil + } + + wrapErr := func(err error) error { + return fmt.Errorf("failed to parse tracestate: %w", err) + } + + var members []member + found := make(map[string]struct{}) + for ts != "" { + var memberStr string + memberStr, ts, _ = strings.Cut(ts, listDelimiters) + if memberStr == "" { + continue + } + + m, err := parseMember(memberStr) + if err != nil { + return TraceState{}, wrapErr(err) + } + + if _, ok := found[m.Key]; ok { + return TraceState{}, wrapErr(errDuplicate) + } + found[m.Key] = struct{}{} + + members = append(members, m) + if n := len(members); n > maxListMembers { + return TraceState{}, wrapErr(errMemberNumber) + } + } + + return TraceState{list: members}, nil +} + +// MarshalJSON marshals the TraceState into JSON. +func (ts TraceState) MarshalJSON() ([]byte, error) { + return json.Marshal(ts.String()) +} + +// String encodes the TraceState into a string compliant with the W3C +// Trace Context specification. The returned string will be invalid if the +// TraceState contains any invalid members. +func (ts TraceState) String() string { + if len(ts.list) == 0 { + return "" + } + var n int + n += len(ts.list) // member delimiters: '=' + n += len(ts.list) - 1 // list delimiters: ',' + for _, mem := range ts.list { + n += len(mem.Key) + n += len(mem.Value) + } + + var sb strings.Builder + sb.Grow(n) + _, _ = sb.WriteString(ts.list[0].Key) + _ = sb.WriteByte('=') + _, _ = sb.WriteString(ts.list[0].Value) + for i := 1; i < len(ts.list); i++ { + _ = sb.WriteByte(listDelimiters[0]) + _, _ = sb.WriteString(ts.list[i].Key) + _ = sb.WriteByte('=') + _, _ = sb.WriteString(ts.list[i].Value) + } + return sb.String() +} + +// Get returns the value paired with key from the corresponding TraceState +// list-member if it exists, otherwise an empty string is returned. +func (ts TraceState) Get(key string) string { + for _, member := range ts.list { + if member.Key == key { + return member.Value + } + } + + return "" +} + +// Walk walks all key value pairs in the TraceState by calling f +// Iteration stops if f returns false. +func (ts TraceState) Walk(f func(key, value string) bool) { + for _, m := range ts.list { + if !f(m.Key, m.Value) { + break + } + } +} + +// Insert adds a new list-member defined by the key/value pair to the +// TraceState. If a list-member already exists for the given key, that +// list-member's value is updated. The new or updated list-member is always +// moved to the beginning of the TraceState as specified by the W3C Trace +// Context specification. +// +// If key or value are invalid according to the W3C Trace Context +// specification an error is returned with the original TraceState. +// +// If adding a new list-member means the TraceState would have more members +// then is allowed, the new list-member will be inserted and the right-most +// list-member will be dropped in the returned TraceState. +func (ts TraceState) Insert(key, value string) (TraceState, error) { + m, err := newMember(key, value) + if err != nil { + return ts, err + } + n := len(ts.list) + found := n + for i := range ts.list { + if ts.list[i].Key == key { + found = i + } + } + cTS := TraceState{} + if found == n && n < maxListMembers { + cTS.list = make([]member, n+1) + } else { + cTS.list = make([]member, n) + } + cTS.list[0] = m + // When the number of members exceeds capacity, drop the "right-most". + copy(cTS.list[1:], ts.list[0:found]) + if found < n { + copy(cTS.list[1+found:], ts.list[found+1:]) + } + return cTS, nil +} + +// Delete returns a copy of the TraceState with the list-member identified by +// key removed. +func (ts TraceState) Delete(key string) TraceState { + members := make([]member, ts.Len()) + copy(members, ts.list) + for i, member := range ts.list { + if member.Key == key { + members = append(members[:i], members[i+1:]...) + // TraceState should contain no duplicate members. + break + } + } + return TraceState{list: members} +} + +// Len returns the number of list-members in the TraceState. +func (ts TraceState) Len() int { + return len(ts.list) +} diff --git a/vendor/go.opentelemetry.io/otel/verify_released_changelog.sh b/vendor/go.opentelemetry.io/otel/verify_released_changelog.sh new file mode 100644 index 00000000..c9b7cdbb --- /dev/null +++ b/vendor/go.opentelemetry.io/otel/verify_released_changelog.sh @@ -0,0 +1,42 @@ +#!/bin/bash + +# Copyright The OpenTelemetry Authors +# SPDX-License-Identifier: Apache-2.0 + +set -euo pipefail + +TARGET="${1:?Must provide target ref}" + +FILE="CHANGELOG.md" +TEMP_DIR=$(mktemp -d) +echo "Temp folder: $TEMP_DIR" + +# Only the latest commit of the feature branch is available +# automatically. To diff with the base branch, we need to +# fetch that too (and we only need its latest commit). +git fetch origin "${TARGET}" --depth=1 + +# Checkout the previous version on the base branch of the changelog to tmpfolder +git --work-tree="$TEMP_DIR" checkout FETCH_HEAD $FILE + +PREVIOUS_FILE="$TEMP_DIR/$FILE" +CURRENT_FILE="$FILE" +PREVIOUS_LOCKED_FILE="$TEMP_DIR/previous_locked_section.md" +CURRENT_LOCKED_FILE="$TEMP_DIR/current_locked_section.md" + +# Extract released sections from the previous version +awk '/^/ {flag=1} /^/ {flag=0} flag' "$PREVIOUS_FILE" > "$PREVIOUS_LOCKED_FILE" + +# Extract released sections from the current version +awk '/^/ {flag=1} /^/ {flag=0} flag' "$CURRENT_FILE" > "$CURRENT_LOCKED_FILE" + +# Compare the released sections +if ! diff -q "$PREVIOUS_LOCKED_FILE" "$CURRENT_LOCKED_FILE"; then + echo "Error: The released sections of the changelog file have been modified." + diff "$PREVIOUS_LOCKED_FILE" "$CURRENT_LOCKED_FILE" + rm -rf "$TEMP_DIR" + false +fi + +rm -rf "$TEMP_DIR" +echo "The released sections remain unchanged." diff --git a/vendor/go.opentelemetry.io/otel/version.go b/vendor/go.opentelemetry.io/otel/version.go new file mode 100644 index 00000000..1db4f47e --- /dev/null +++ b/vendor/go.opentelemetry.io/otel/version.go @@ -0,0 +1,9 @@ +// Copyright The OpenTelemetry Authors +// SPDX-License-Identifier: Apache-2.0 + +package otel // import "go.opentelemetry.io/otel" + +// Version is the current release version of OpenTelemetry in use. +func Version() string { + return "1.43.0" +} diff --git a/vendor/go.opentelemetry.io/otel/versions.yaml b/vendor/go.opentelemetry.io/otel/versions.yaml new file mode 100644 index 00000000..bcc6ee78 --- /dev/null +++ b/vendor/go.opentelemetry.io/otel/versions.yaml @@ -0,0 +1,69 @@ +# Copyright The OpenTelemetry Authors +# SPDX-License-Identifier: Apache-2.0 + +module-sets: + stable-v1: + version: v1.43.0 + modules: + - go.opentelemetry.io/otel + - go.opentelemetry.io/otel/bridge/opencensus + - go.opentelemetry.io/otel/bridge/opencensus/test + - go.opentelemetry.io/otel/bridge/opentracing + - go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetricgrpc + - go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetrichttp + - go.opentelemetry.io/otel/exporters/otlp/otlptrace + - go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc + - go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracehttp + - go.opentelemetry.io/otel/exporters/stdout/stdoutmetric + - go.opentelemetry.io/otel/exporters/stdout/stdouttrace + - go.opentelemetry.io/otel/exporters/zipkin + - go.opentelemetry.io/otel/metric + - go.opentelemetry.io/otel/sdk + - go.opentelemetry.io/otel/sdk/metric + - go.opentelemetry.io/otel/trace + experimental-metrics: + version: v0.65.0 + modules: + - go.opentelemetry.io/otel/exporters/prometheus + experimental-logs: + version: v0.19.0 + modules: + - go.opentelemetry.io/otel/log + - go.opentelemetry.io/otel/log/logtest + - go.opentelemetry.io/otel/sdk/log + - go.opentelemetry.io/otel/sdk/log/logtest + - go.opentelemetry.io/otel/exporters/otlp/otlplog/otlploggrpc + - go.opentelemetry.io/otel/exporters/otlp/otlplog/otlploghttp + - go.opentelemetry.io/otel/exporters/stdout/stdoutlog + experimental-schema: + version: v0.0.16 + modules: + - go.opentelemetry.io/otel/schema +excluded-modules: + - go.opentelemetry.io/otel/internal/tools + - go.opentelemetry.io/otel/trace/internal/telemetry/test +modules: + go.opentelemetry.io/otel/exporters/stdout/stdouttrace: + version-refs: + - ./internal/version.go + go.opentelemetry.io/otel/exporters/stdout/stdoutmetric: + version-refs: + - ./internal/version.go + go.opentelemetry.io/otel/exporters/prometheus: + version-refs: + - ./internal/version.go + go.opentelemetry.io/otel/exporters/otlp/otlplog/otlploggrpc: + version-refs: + - ./internal/version.go + go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc: + version-refs: + - ./internal/version.go + go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracehttp: + version-refs: + - ./internal/version.go + go.opentelemetry.io/otel/exporters/otlp/otlplog/otlploghttp: + version-refs: + - ./internal/version.go + go.opentelemetry.io/otel/exporters/stdout/stdoutlog: + version-refs: + - ./internal/version.go diff --git a/vendor/golang.org/x/sys/LICENSE b/vendor/golang.org/x/sys/LICENSE new file mode 100644 index 00000000..2a7cf70d --- /dev/null +++ b/vendor/golang.org/x/sys/LICENSE @@ -0,0 +1,27 @@ +Copyright 2009 The Go Authors. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are +met: + + * Redistributions of source code must retain the above copyright +notice, this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above +copyright notice, this list of conditions and the following disclaimer +in the documentation and/or other materials provided with the +distribution. + * Neither the name of Google LLC nor the names of its +contributors may be used to endorse or promote products derived from +this software without specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. diff --git a/vendor/golang.org/x/sys/PATENTS b/vendor/golang.org/x/sys/PATENTS new file mode 100644 index 00000000..73309904 --- /dev/null +++ b/vendor/golang.org/x/sys/PATENTS @@ -0,0 +1,22 @@ +Additional IP Rights Grant (Patents) + +"This implementation" means the copyrightable works distributed by +Google as part of the Go project. + +Google hereby grants to You a perpetual, worldwide, non-exclusive, +no-charge, royalty-free, irrevocable (except as stated in this section) +patent license to make, have made, use, offer to sell, sell, import, +transfer and otherwise run, modify and propagate the contents of this +implementation of Go, where such license applies only to those patent +claims, both currently owned or controlled by Google and acquired in +the future, licensable by Google that are necessarily infringed by this +implementation of Go. This grant does not include claims that would be +infringed only as a consequence of further modification of this +implementation. If you or your agent or exclusive licensee institute or +order or agree to the institution of patent litigation against any +entity (including a cross-claim or counterclaim in a lawsuit) alleging +that this implementation of Go or any code incorporated within this +implementation of Go constitutes direct or contributory patent +infringement, or inducement of patent infringement, then any patent +rights granted to you under this License for this implementation of Go +shall terminate as of the date such litigation is filed. diff --git a/vendor/golang.org/x/sys/windows/aliases.go b/vendor/golang.org/x/sys/windows/aliases.go new file mode 100644 index 00000000..96317966 --- /dev/null +++ b/vendor/golang.org/x/sys/windows/aliases.go @@ -0,0 +1,13 @@ +// Copyright 2018 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +//go:build windows + +package windows + +import "syscall" + +type Signal = syscall.Signal +type Errno = syscall.Errno +type SysProcAttr = syscall.SysProcAttr diff --git a/vendor/golang.org/x/sys/windows/dll_windows.go b/vendor/golang.org/x/sys/windows/dll_windows.go new file mode 100644 index 00000000..1157b06d --- /dev/null +++ b/vendor/golang.org/x/sys/windows/dll_windows.go @@ -0,0 +1,380 @@ +// Copyright 2011 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +package windows + +import ( + "sync" + "sync/atomic" + "syscall" + "unsafe" +) + +// We need to use LoadLibrary and GetProcAddress from the Go runtime, because +// the these symbols are loaded by the system linker and are required to +// dynamically load additional symbols. Note that in the Go runtime, these +// return syscall.Handle and syscall.Errno, but these are the same, in fact, +// as windows.Handle and windows.Errno, and we intend to keep these the same. + +//go:linkname syscall_loadlibrary syscall.loadlibrary +func syscall_loadlibrary(filename *uint16) (handle Handle, err Errno) + +//go:linkname syscall_getprocaddress syscall.getprocaddress +func syscall_getprocaddress(handle Handle, procname *uint8) (proc uintptr, err Errno) + +// DLLError describes reasons for DLL load failures. +type DLLError struct { + Err error + ObjName string + Msg string +} + +func (e *DLLError) Error() string { return e.Msg } + +func (e *DLLError) Unwrap() error { return e.Err } + +// A DLL implements access to a single DLL. +type DLL struct { + Name string + Handle Handle +} + +// LoadDLL loads DLL file into memory. +// +// Warning: using LoadDLL without an absolute path name is subject to +// DLL preloading attacks. To safely load a system DLL, use [NewLazySystemDLL], +// or use [LoadLibraryEx] directly. +func LoadDLL(name string) (dll *DLL, err error) { + namep, err := UTF16PtrFromString(name) + if err != nil { + return nil, err + } + h, e := syscall_loadlibrary(namep) + if e != 0 { + return nil, &DLLError{ + Err: e, + ObjName: name, + Msg: "Failed to load " + name + ": " + e.Error(), + } + } + d := &DLL{ + Name: name, + Handle: h, + } + return d, nil +} + +// MustLoadDLL is like LoadDLL but panics if load operation fails. +func MustLoadDLL(name string) *DLL { + d, e := LoadDLL(name) + if e != nil { + panic(e) + } + return d +} + +// FindProc searches DLL d for procedure named name and returns *Proc +// if found. It returns an error if search fails. +func (d *DLL) FindProc(name string) (proc *Proc, err error) { + namep, err := BytePtrFromString(name) + if err != nil { + return nil, err + } + a, e := syscall_getprocaddress(d.Handle, namep) + if e != 0 { + return nil, &DLLError{ + Err: e, + ObjName: name, + Msg: "Failed to find " + name + " procedure in " + d.Name + ": " + e.Error(), + } + } + p := &Proc{ + Dll: d, + Name: name, + addr: a, + } + return p, nil +} + +// MustFindProc is like FindProc but panics if search fails. +func (d *DLL) MustFindProc(name string) *Proc { + p, e := d.FindProc(name) + if e != nil { + panic(e) + } + return p +} + +// FindProcByOrdinal searches DLL d for procedure by ordinal and returns *Proc +// if found. It returns an error if search fails. +func (d *DLL) FindProcByOrdinal(ordinal uintptr) (proc *Proc, err error) { + a, e := GetProcAddressByOrdinal(d.Handle, ordinal) + name := "#" + itoa(int(ordinal)) + if e != nil { + return nil, &DLLError{ + Err: e, + ObjName: name, + Msg: "Failed to find " + name + " procedure in " + d.Name + ": " + e.Error(), + } + } + p := &Proc{ + Dll: d, + Name: name, + addr: a, + } + return p, nil +} + +// MustFindProcByOrdinal is like FindProcByOrdinal but panics if search fails. +func (d *DLL) MustFindProcByOrdinal(ordinal uintptr) *Proc { + p, e := d.FindProcByOrdinal(ordinal) + if e != nil { + panic(e) + } + return p +} + +// Release unloads DLL d from memory. +func (d *DLL) Release() (err error) { + return FreeLibrary(d.Handle) +} + +// A Proc implements access to a procedure inside a DLL. +type Proc struct { + Dll *DLL + Name string + addr uintptr +} + +// Addr returns the address of the procedure represented by p. +// The return value can be passed to Syscall to run the procedure. +func (p *Proc) Addr() uintptr { + return p.addr +} + +//go:uintptrescapes + +// Call executes procedure p with arguments a. It will panic, if more than 15 arguments +// are supplied. +// +// The returned error is always non-nil, constructed from the result of GetLastError. +// Callers must inspect the primary return value to decide whether an error occurred +// (according to the semantics of the specific function being called) before consulting +// the error. The error will be guaranteed to contain windows.Errno. +func (p *Proc) Call(a ...uintptr) (r1, r2 uintptr, lastErr error) { + return syscall.SyscallN(p.Addr(), a...) +} + +// A LazyDLL implements access to a single DLL. +// It will delay the load of the DLL until the first +// call to its Handle method or to one of its +// LazyProc's Addr method. +type LazyDLL struct { + Name string + + // System determines whether the DLL must be loaded from the + // Windows System directory, bypassing the normal DLL search + // path. + System bool + + mu sync.Mutex + dll *DLL // non nil once DLL is loaded +} + +// Load loads DLL file d.Name into memory. It returns an error if fails. +// Load will not try to load DLL, if it is already loaded into memory. +func (d *LazyDLL) Load() error { + // Non-racy version of: + // if d.dll != nil { + if atomic.LoadPointer((*unsafe.Pointer)(unsafe.Pointer(&d.dll))) != nil { + return nil + } + d.mu.Lock() + defer d.mu.Unlock() + if d.dll != nil { + return nil + } + + // kernel32.dll is special, since it's where LoadLibraryEx comes from. + // The kernel already special-cases its name, so it's always + // loaded from system32. + var dll *DLL + var err error + if d.Name == "kernel32.dll" { + dll, err = LoadDLL(d.Name) + } else { + dll, err = loadLibraryEx(d.Name, d.System) + } + if err != nil { + return err + } + + // Non-racy version of: + // d.dll = dll + atomic.StorePointer((*unsafe.Pointer)(unsafe.Pointer(&d.dll)), unsafe.Pointer(dll)) + return nil +} + +// mustLoad is like Load but panics if search fails. +func (d *LazyDLL) mustLoad() { + e := d.Load() + if e != nil { + panic(e) + } +} + +// Handle returns d's module handle. +func (d *LazyDLL) Handle() uintptr { + d.mustLoad() + return uintptr(d.dll.Handle) +} + +// NewProc returns a LazyProc for accessing the named procedure in the DLL d. +func (d *LazyDLL) NewProc(name string) *LazyProc { + return &LazyProc{l: d, Name: name} +} + +// NewLazyDLL creates new LazyDLL associated with DLL file. +// +// Warning: using NewLazyDLL without an absolute path name is subject to +// DLL preloading attacks. To safely load a system DLL, use [NewLazySystemDLL]. +func NewLazyDLL(name string) *LazyDLL { + return &LazyDLL{Name: name} +} + +// NewLazySystemDLL is like NewLazyDLL, but will only +// search Windows System directory for the DLL if name is +// a base name (like "advapi32.dll"). +func NewLazySystemDLL(name string) *LazyDLL { + return &LazyDLL{Name: name, System: true} +} + +// A LazyProc implements access to a procedure inside a LazyDLL. +// It delays the lookup until the Addr method is called. +type LazyProc struct { + Name string + + mu sync.Mutex + l *LazyDLL + proc *Proc +} + +// Find searches DLL for procedure named p.Name. It returns +// an error if search fails. Find will not search procedure, +// if it is already found and loaded into memory. +func (p *LazyProc) Find() error { + // Non-racy version of: + // if p.proc == nil { + if atomic.LoadPointer((*unsafe.Pointer)(unsafe.Pointer(&p.proc))) == nil { + p.mu.Lock() + defer p.mu.Unlock() + if p.proc == nil { + e := p.l.Load() + if e != nil { + return e + } + proc, e := p.l.dll.FindProc(p.Name) + if e != nil { + return e + } + // Non-racy version of: + // p.proc = proc + atomic.StorePointer((*unsafe.Pointer)(unsafe.Pointer(&p.proc)), unsafe.Pointer(proc)) + } + } + return nil +} + +// mustFind is like Find but panics if search fails. +func (p *LazyProc) mustFind() { + e := p.Find() + if e != nil { + panic(e) + } +} + +// Addr returns the address of the procedure represented by p. +// The return value can be passed to Syscall to run the procedure. +// It will panic if the procedure cannot be found. +func (p *LazyProc) Addr() uintptr { + p.mustFind() + return p.proc.Addr() +} + +//go:uintptrescapes + +// Call executes procedure p with arguments a. It will panic, if more than 15 arguments +// are supplied. It will also panic if the procedure cannot be found. +// +// The returned error is always non-nil, constructed from the result of GetLastError. +// Callers must inspect the primary return value to decide whether an error occurred +// (according to the semantics of the specific function being called) before consulting +// the error. The error will be guaranteed to contain windows.Errno. +func (p *LazyProc) Call(a ...uintptr) (r1, r2 uintptr, lastErr error) { + p.mustFind() + return p.proc.Call(a...) +} + +var canDoSearchSystem32Once struct { + sync.Once + v bool +} + +func initCanDoSearchSystem32() { + // https://msdn.microsoft.com/en-us/library/ms684179(v=vs.85).aspx says: + // "Windows 7, Windows Server 2008 R2, Windows Vista, and Windows + // Server 2008: The LOAD_LIBRARY_SEARCH_* flags are available on + // systems that have KB2533623 installed. To determine whether the + // flags are available, use GetProcAddress to get the address of the + // AddDllDirectory, RemoveDllDirectory, or SetDefaultDllDirectories + // function. If GetProcAddress succeeds, the LOAD_LIBRARY_SEARCH_* + // flags can be used with LoadLibraryEx." + canDoSearchSystem32Once.v = (modkernel32.NewProc("AddDllDirectory").Find() == nil) +} + +func canDoSearchSystem32() bool { + canDoSearchSystem32Once.Do(initCanDoSearchSystem32) + return canDoSearchSystem32Once.v +} + +func isBaseName(name string) bool { + for _, c := range name { + if c == ':' || c == '/' || c == '\\' { + return false + } + } + return true +} + +// loadLibraryEx wraps the Windows LoadLibraryEx function. +// +// See https://msdn.microsoft.com/en-us/library/windows/desktop/ms684179(v=vs.85).aspx +// +// If name is not an absolute path, LoadLibraryEx searches for the DLL +// in a variety of automatic locations unless constrained by flags. +// See: https://msdn.microsoft.com/en-us/library/ff919712%28VS.85%29.aspx +func loadLibraryEx(name string, system bool) (*DLL, error) { + loadDLL := name + var flags uintptr + if system { + if canDoSearchSystem32() { + flags = LOAD_LIBRARY_SEARCH_SYSTEM32 + } else if isBaseName(name) { + // WindowsXP or unpatched Windows machine + // trying to load "foo.dll" out of the system + // folder, but LoadLibraryEx doesn't support + // that yet on their system, so emulate it. + systemdir, err := GetSystemDirectory() + if err != nil { + return nil, err + } + loadDLL = systemdir + "\\" + name + } + } + h, err := LoadLibraryEx(loadDLL, 0, flags) + if err != nil { + return nil, err + } + return &DLL{Name: name, Handle: h}, nil +} diff --git a/vendor/golang.org/x/sys/windows/env_windows.go b/vendor/golang.org/x/sys/windows/env_windows.go new file mode 100644 index 00000000..d4577a42 --- /dev/null +++ b/vendor/golang.org/x/sys/windows/env_windows.go @@ -0,0 +1,57 @@ +// Copyright 2010 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +// Windows environment variables. + +package windows + +import ( + "syscall" + "unsafe" +) + +func Getenv(key string) (value string, found bool) { + return syscall.Getenv(key) +} + +func Setenv(key, value string) error { + return syscall.Setenv(key, value) +} + +func Clearenv() { + syscall.Clearenv() +} + +func Environ() []string { + return syscall.Environ() +} + +// Returns a default environment associated with the token, rather than the current +// process. If inheritExisting is true, then this environment also inherits the +// environment of the current process. +func (token Token) Environ(inheritExisting bool) (env []string, err error) { + var block *uint16 + err = CreateEnvironmentBlock(&block, token, inheritExisting) + if err != nil { + return nil, err + } + defer DestroyEnvironmentBlock(block) + size := unsafe.Sizeof(*block) + for *block != 0 { + // find NUL terminator + end := unsafe.Pointer(block) + for *(*uint16)(end) != 0 { + end = unsafe.Add(end, size) + } + + entry := unsafe.Slice(block, (uintptr(end)-uintptr(unsafe.Pointer(block)))/size) + env = append(env, UTF16ToString(entry)) + block = (*uint16)(unsafe.Add(end, size)) + } + return env, nil +} + +func Unsetenv(key string) error { + return syscall.Unsetenv(key) +} diff --git a/vendor/golang.org/x/sys/windows/eventlog.go b/vendor/golang.org/x/sys/windows/eventlog.go new file mode 100644 index 00000000..6c366955 --- /dev/null +++ b/vendor/golang.org/x/sys/windows/eventlog.go @@ -0,0 +1,20 @@ +// Copyright 2012 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +//go:build windows + +package windows + +const ( + EVENTLOG_SUCCESS = 0 + EVENTLOG_ERROR_TYPE = 1 + EVENTLOG_WARNING_TYPE = 2 + EVENTLOG_INFORMATION_TYPE = 4 + EVENTLOG_AUDIT_SUCCESS = 8 + EVENTLOG_AUDIT_FAILURE = 16 +) + +//sys RegisterEventSource(uncServerName *uint16, sourceName *uint16) (handle Handle, err error) [failretval==0] = advapi32.RegisterEventSourceW +//sys DeregisterEventSource(handle Handle) (err error) = advapi32.DeregisterEventSource +//sys ReportEvent(log Handle, etype uint16, category uint16, eventId uint32, usrSId uintptr, numStrings uint16, dataSize uint32, strings **uint16, rawData *byte) (err error) = advapi32.ReportEventW diff --git a/vendor/golang.org/x/sys/windows/exec_windows.go b/vendor/golang.org/x/sys/windows/exec_windows.go new file mode 100644 index 00000000..9cabbb69 --- /dev/null +++ b/vendor/golang.org/x/sys/windows/exec_windows.go @@ -0,0 +1,248 @@ +// Copyright 2009 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +// Fork, exec, wait, etc. + +package windows + +import ( + errorspkg "errors" + "unsafe" +) + +// EscapeArg rewrites command line argument s as prescribed +// in http://msdn.microsoft.com/en-us/library/ms880421. +// This function returns "" (2 double quotes) if s is empty. +// Alternatively, these transformations are done: +// - every back slash (\) is doubled, but only if immediately +// followed by double quote ("); +// - every double quote (") is escaped by back slash (\); +// - finally, s is wrapped with double quotes (arg -> "arg"), +// but only if there is space or tab inside s. +func EscapeArg(s string) string { + if len(s) == 0 { + return `""` + } + n := len(s) + hasSpace := false + for i := 0; i < len(s); i++ { + switch s[i] { + case '"', '\\': + n++ + case ' ', '\t': + hasSpace = true + } + } + if hasSpace { + n += 2 // Reserve space for quotes. + } + if n == len(s) { + return s + } + + qs := make([]byte, n) + j := 0 + if hasSpace { + qs[j] = '"' + j++ + } + slashes := 0 + for i := 0; i < len(s); i++ { + switch s[i] { + default: + slashes = 0 + qs[j] = s[i] + case '\\': + slashes++ + qs[j] = s[i] + case '"': + for ; slashes > 0; slashes-- { + qs[j] = '\\' + j++ + } + qs[j] = '\\' + j++ + qs[j] = s[i] + } + j++ + } + if hasSpace { + for ; slashes > 0; slashes-- { + qs[j] = '\\' + j++ + } + qs[j] = '"' + j++ + } + return string(qs[:j]) +} + +// ComposeCommandLine escapes and joins the given arguments suitable for use as a Windows command line, +// in CreateProcess's CommandLine argument, CreateService/ChangeServiceConfig's BinaryPathName argument, +// or any program that uses CommandLineToArgv. +func ComposeCommandLine(args []string) string { + if len(args) == 0 { + return "" + } + + // Per https://learn.microsoft.com/en-us/windows/win32/api/shellapi/nf-shellapi-commandlinetoargvw: + // “This function accepts command lines that contain a program name; the + // program name can be enclosed in quotation marks or not.” + // + // Unfortunately, it provides no means of escaping interior quotation marks + // within that program name, and we have no way to report them here. + prog := args[0] + mustQuote := len(prog) == 0 + for i := 0; i < len(prog); i++ { + c := prog[i] + if c <= ' ' || (c == '"' && i == 0) { + // Force quotes for not only the ASCII space and tab as described in the + // MSDN article, but also ASCII control characters. + // The documentation for CommandLineToArgvW doesn't say what happens when + // the first argument is not a valid program name, but it empirically + // seems to drop unquoted control characters. + mustQuote = true + break + } + } + var commandLine []byte + if mustQuote { + commandLine = make([]byte, 0, len(prog)+2) + commandLine = append(commandLine, '"') + for i := 0; i < len(prog); i++ { + c := prog[i] + if c == '"' { + // This quote would interfere with our surrounding quotes. + // We have no way to report an error, so just strip out + // the offending character instead. + continue + } + commandLine = append(commandLine, c) + } + commandLine = append(commandLine, '"') + } else { + if len(args) == 1 { + // args[0] is a valid command line representing itself. + // No need to allocate a new slice or string for it. + return prog + } + commandLine = []byte(prog) + } + + for _, arg := range args[1:] { + commandLine = append(commandLine, ' ') + // TODO(bcmills): since we're already appending to a slice, it would be nice + // to avoid the intermediate allocations of EscapeArg. + // Perhaps we can factor out an appendEscapedArg function. + commandLine = append(commandLine, EscapeArg(arg)...) + } + return string(commandLine) +} + +// DecomposeCommandLine breaks apart its argument command line into unescaped parts using CommandLineToArgv, +// as gathered from GetCommandLine, QUERY_SERVICE_CONFIG's BinaryPathName argument, or elsewhere that +// command lines are passed around. +// DecomposeCommandLine returns an error if commandLine contains NUL. +func DecomposeCommandLine(commandLine string) ([]string, error) { + if len(commandLine) == 0 { + return []string{}, nil + } + utf16CommandLine, err := UTF16FromString(commandLine) + if err != nil { + return nil, errorspkg.New("string with NUL passed to DecomposeCommandLine") + } + var argc int32 + argv, err := commandLineToArgv(&utf16CommandLine[0], &argc) + if err != nil { + return nil, err + } + defer LocalFree(Handle(unsafe.Pointer(argv))) + + var args []string + for _, p := range unsafe.Slice(argv, argc) { + args = append(args, UTF16PtrToString(p)) + } + return args, nil +} + +// CommandLineToArgv parses a Unicode command line string and sets +// argc to the number of parsed arguments. +// +// The returned memory should be freed using a single call to LocalFree. +// +// Note that although the return type of CommandLineToArgv indicates 8192 +// entries of up to 8192 characters each, the actual count of parsed arguments +// may exceed 8192, and the documentation for CommandLineToArgvW does not mention +// any bound on the lengths of the individual argument strings. +// (See https://go.dev/issue/63236.) +func CommandLineToArgv(cmd *uint16, argc *int32) (argv *[8192]*[8192]uint16, err error) { + argp, err := commandLineToArgv(cmd, argc) + argv = (*[8192]*[8192]uint16)(unsafe.Pointer(argp)) + return argv, err +} + +func CloseOnExec(fd Handle) { + SetHandleInformation(Handle(fd), HANDLE_FLAG_INHERIT, 0) +} + +// FullPath retrieves the full path of the specified file. +func FullPath(name string) (path string, err error) { + p, err := UTF16PtrFromString(name) + if err != nil { + return "", err + } + n := uint32(100) + for { + buf := make([]uint16, n) + n, err = GetFullPathName(p, uint32(len(buf)), &buf[0], nil) + if err != nil { + return "", err + } + if n <= uint32(len(buf)) { + return UTF16ToString(buf[:n]), nil + } + } +} + +// NewProcThreadAttributeList allocates a new ProcThreadAttributeListContainer, with the requested maximum number of attributes. +func NewProcThreadAttributeList(maxAttrCount uint32) (*ProcThreadAttributeListContainer, error) { + var size uintptr + err := initializeProcThreadAttributeList(nil, maxAttrCount, 0, &size) + if err != ERROR_INSUFFICIENT_BUFFER { + if err == nil { + return nil, errorspkg.New("unable to query buffer size from InitializeProcThreadAttributeList") + } + return nil, err + } + alloc, err := LocalAlloc(LMEM_FIXED, uint32(size)) + if err != nil { + return nil, err + } + // size is guaranteed to be ≥1 by InitializeProcThreadAttributeList. + al := &ProcThreadAttributeListContainer{data: (*ProcThreadAttributeList)(unsafe.Pointer(alloc))} + err = initializeProcThreadAttributeList(al.data, maxAttrCount, 0, &size) + if err != nil { + return nil, err + } + return al, err +} + +// Update modifies the ProcThreadAttributeList using UpdateProcThreadAttribute. +func (al *ProcThreadAttributeListContainer) Update(attribute uintptr, value unsafe.Pointer, size uintptr) error { + al.pointers = append(al.pointers, value) + return updateProcThreadAttribute(al.data, 0, attribute, value, size, nil, nil) +} + +// Delete frees ProcThreadAttributeList's resources. +func (al *ProcThreadAttributeListContainer) Delete() { + deleteProcThreadAttributeList(al.data) + LocalFree(Handle(unsafe.Pointer(al.data))) + al.data = nil + al.pointers = nil +} + +// List returns the actual ProcThreadAttributeList to be passed to StartupInfoEx. +func (al *ProcThreadAttributeListContainer) List() *ProcThreadAttributeList { + return al.data +} diff --git a/vendor/golang.org/x/sys/windows/memory_windows.go b/vendor/golang.org/x/sys/windows/memory_windows.go new file mode 100644 index 00000000..6dc0920a --- /dev/null +++ b/vendor/golang.org/x/sys/windows/memory_windows.go @@ -0,0 +1,48 @@ +// Copyright 2017 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +package windows + +const ( + MEM_COMMIT = 0x00001000 + MEM_RESERVE = 0x00002000 + MEM_DECOMMIT = 0x00004000 + MEM_RELEASE = 0x00008000 + MEM_RESET = 0x00080000 + MEM_TOP_DOWN = 0x00100000 + MEM_WRITE_WATCH = 0x00200000 + MEM_PHYSICAL = 0x00400000 + MEM_RESET_UNDO = 0x01000000 + MEM_LARGE_PAGES = 0x20000000 + + PAGE_NOACCESS = 0x00000001 + PAGE_READONLY = 0x00000002 + PAGE_READWRITE = 0x00000004 + PAGE_WRITECOPY = 0x00000008 + PAGE_EXECUTE = 0x00000010 + PAGE_EXECUTE_READ = 0x00000020 + PAGE_EXECUTE_READWRITE = 0x00000040 + PAGE_EXECUTE_WRITECOPY = 0x00000080 + PAGE_GUARD = 0x00000100 + PAGE_NOCACHE = 0x00000200 + PAGE_WRITECOMBINE = 0x00000400 + PAGE_TARGETS_INVALID = 0x40000000 + PAGE_TARGETS_NO_UPDATE = 0x40000000 + + QUOTA_LIMITS_HARDWS_MIN_DISABLE = 0x00000002 + QUOTA_LIMITS_HARDWS_MIN_ENABLE = 0x00000001 + QUOTA_LIMITS_HARDWS_MAX_DISABLE = 0x00000008 + QUOTA_LIMITS_HARDWS_MAX_ENABLE = 0x00000004 +) + +type MemoryBasicInformation struct { + BaseAddress uintptr + AllocationBase uintptr + AllocationProtect uint32 + PartitionId uint16 + RegionSize uintptr + State uint32 + Protect uint32 + Type uint32 +} diff --git a/vendor/golang.org/x/sys/windows/mkerrors.bash b/vendor/golang.org/x/sys/windows/mkerrors.bash new file mode 100644 index 00000000..58e0188f --- /dev/null +++ b/vendor/golang.org/x/sys/windows/mkerrors.bash @@ -0,0 +1,70 @@ +#!/bin/bash + +# Copyright 2019 The Go Authors. All rights reserved. +# Use of this source code is governed by a BSD-style +# license that can be found in the LICENSE file. + +set -e +shopt -s nullglob + +winerror="$(printf '%s\n' "/mnt/c/Program Files (x86)/Windows Kits/"/*/Include/*/shared/winerror.h | sort -Vr | head -n 1)" +[[ -n $winerror ]] || { echo "Unable to find winerror.h" >&2; exit 1; } +ntstatus="$(printf '%s\n' "/mnt/c/Program Files (x86)/Windows Kits/"/*/Include/*/shared/ntstatus.h | sort -Vr | head -n 1)" +[[ -n $ntstatus ]] || { echo "Unable to find ntstatus.h" >&2; exit 1; } + +declare -A errors + +{ + echo "// Code generated by 'mkerrors.bash'; DO NOT EDIT." + echo + echo "package windows" + echo "import \"syscall\"" + echo "const (" + + while read -r line; do + unset vtype + if [[ $line =~ ^#define\ +([A-Z0-9_]+k?)\ +([A-Z0-9_]+\()?([A-Z][A-Z0-9_]+k?)\)? ]]; then + key="${BASH_REMATCH[1]}" + value="${BASH_REMATCH[3]}" + elif [[ $line =~ ^#define\ +([A-Z0-9_]+k?)\ +([A-Z0-9_]+\()?((0x)?[0-9A-Fa-f]+)L?\)? ]]; then + key="${BASH_REMATCH[1]}" + value="${BASH_REMATCH[3]}" + vtype="${BASH_REMATCH[2]}" + elif [[ $line =~ ^#define\ +([A-Z0-9_]+k?)\ +\(\(([A-Z]+)\)((0x)?[0-9A-Fa-f]+)L?\) ]]; then + key="${BASH_REMATCH[1]}" + value="${BASH_REMATCH[3]}" + vtype="${BASH_REMATCH[2]}" + else + continue + fi + [[ -n $key && -n $value ]] || continue + [[ -z ${errors["$key"]} ]] || continue + errors["$key"]="$value" + if [[ -v vtype ]]; then + if [[ $key == FACILITY_* || $key == NO_ERROR ]]; then + vtype="" + elif [[ $vtype == *HANDLE* || $vtype == *HRESULT* ]]; then + vtype="Handle" + else + vtype="syscall.Errno" + fi + last_vtype="$vtype" + else + vtype="" + if [[ $last_vtype == Handle && $value == NO_ERROR ]]; then + value="S_OK" + elif [[ $last_vtype == syscall.Errno && $value == NO_ERROR ]]; then + value="ERROR_SUCCESS" + fi + fi + + echo "$key $vtype = $value" + done < "$winerror" + + while read -r line; do + [[ $line =~ ^#define\ (STATUS_[^\s]+)\ +\(\(NTSTATUS\)((0x)?[0-9a-fA-F]+)L?\) ]] || continue + echo "${BASH_REMATCH[1]} NTStatus = ${BASH_REMATCH[2]}" + done < "$ntstatus" + + echo ")" +} | gofmt > "zerrors_windows.go" diff --git a/vendor/golang.org/x/sys/windows/mkknownfolderids.bash b/vendor/golang.org/x/sys/windows/mkknownfolderids.bash new file mode 100644 index 00000000..ab8924e9 --- /dev/null +++ b/vendor/golang.org/x/sys/windows/mkknownfolderids.bash @@ -0,0 +1,27 @@ +#!/bin/bash + +# Copyright 2019 The Go Authors. All rights reserved. +# Use of this source code is governed by a BSD-style +# license that can be found in the LICENSE file. + +set -e +shopt -s nullglob + +knownfolders="$(printf '%s\n' "/mnt/c/Program Files (x86)/Windows Kits/"/*/Include/*/um/KnownFolders.h | sort -Vr | head -n 1)" +[[ -n $knownfolders ]] || { echo "Unable to find KnownFolders.h" >&2; exit 1; } + +{ + echo "// Code generated by 'mkknownfolderids.bash'; DO NOT EDIT." + echo + echo "package windows" + echo "type KNOWNFOLDERID GUID" + echo "var (" + while read -r line; do + [[ $line =~ DEFINE_KNOWN_FOLDER\((FOLDERID_[^,]+),[\t\ ]*(0x[^,]+),[\t\ ]*(0x[^,]+),[\t\ ]*(0x[^,]+),[\t\ ]*(0x[^,]+),[\t\ ]*(0x[^,]+),[\t\ ]*(0x[^,]+),[\t\ ]*(0x[^,]+),[\t\ ]*(0x[^,]+),[\t\ ]*(0x[^,]+),[\t\ ]*(0x[^,]+),[\t\ ]*(0x[^,]+)\) ]] || continue + printf "%s = &KNOWNFOLDERID{0x%08x, 0x%04x, 0x%04x, [8]byte{0x%02x, 0x%02x, 0x%02x, 0x%02x, 0x%02x, 0x%02x, 0x%02x, 0x%02x}}\n" \ + "${BASH_REMATCH[1]}" $(( "${BASH_REMATCH[2]}" )) $(( "${BASH_REMATCH[3]}" )) $(( "${BASH_REMATCH[4]}" )) \ + $(( "${BASH_REMATCH[5]}" )) $(( "${BASH_REMATCH[6]}" )) $(( "${BASH_REMATCH[7]}" )) $(( "${BASH_REMATCH[8]}" )) \ + $(( "${BASH_REMATCH[9]}" )) $(( "${BASH_REMATCH[10]}" )) $(( "${BASH_REMATCH[11]}" )) $(( "${BASH_REMATCH[12]}" )) + done < "$knownfolders" + echo ")" +} | gofmt > "zknownfolderids_windows.go" diff --git a/vendor/golang.org/x/sys/windows/mksyscall.go b/vendor/golang.org/x/sys/windows/mksyscall.go new file mode 100644 index 00000000..dbcdb090 --- /dev/null +++ b/vendor/golang.org/x/sys/windows/mksyscall.go @@ -0,0 +1,9 @@ +// Copyright 2009 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +//go:build generate + +package windows + +//go:generate go run golang.org/x/sys/windows/mkwinsyscall -output zsyscall_windows.go eventlog.go service.go syscall_windows.go security_windows.go setupapi_windows.go diff --git a/vendor/golang.org/x/sys/windows/race.go b/vendor/golang.org/x/sys/windows/race.go new file mode 100644 index 00000000..0f1bdc38 --- /dev/null +++ b/vendor/golang.org/x/sys/windows/race.go @@ -0,0 +1,30 @@ +// Copyright 2012 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +//go:build windows && race + +package windows + +import ( + "runtime" + "unsafe" +) + +const raceenabled = true + +func raceAcquire(addr unsafe.Pointer) { + runtime.RaceAcquire(addr) +} + +func raceReleaseMerge(addr unsafe.Pointer) { + runtime.RaceReleaseMerge(addr) +} + +func raceReadRange(addr unsafe.Pointer, len int) { + runtime.RaceReadRange(addr, len) +} + +func raceWriteRange(addr unsafe.Pointer, len int) { + runtime.RaceWriteRange(addr, len) +} diff --git a/vendor/golang.org/x/sys/windows/race0.go b/vendor/golang.org/x/sys/windows/race0.go new file mode 100644 index 00000000..0c78da78 --- /dev/null +++ b/vendor/golang.org/x/sys/windows/race0.go @@ -0,0 +1,25 @@ +// Copyright 2012 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +//go:build windows && !race + +package windows + +import ( + "unsafe" +) + +const raceenabled = false + +func raceAcquire(addr unsafe.Pointer) { +} + +func raceReleaseMerge(addr unsafe.Pointer) { +} + +func raceReadRange(addr unsafe.Pointer, len int) { +} + +func raceWriteRange(addr unsafe.Pointer, len int) { +} diff --git a/vendor/golang.org/x/sys/windows/security_windows.go b/vendor/golang.org/x/sys/windows/security_windows.go new file mode 100644 index 00000000..6c955cea --- /dev/null +++ b/vendor/golang.org/x/sys/windows/security_windows.go @@ -0,0 +1,1501 @@ +// Copyright 2012 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +package windows + +import ( + "syscall" + "unsafe" +) + +const ( + NameUnknown = 0 + NameFullyQualifiedDN = 1 + NameSamCompatible = 2 + NameDisplay = 3 + NameUniqueId = 6 + NameCanonical = 7 + NameUserPrincipal = 8 + NameCanonicalEx = 9 + NameServicePrincipal = 10 + NameDnsDomain = 12 +) + +// This function returns 1 byte BOOLEAN rather than the 4 byte BOOL. +// http://blogs.msdn.com/b/drnick/archive/2007/12/19/windows-and-upn-format-credentials.aspx +//sys TranslateName(accName *uint16, accNameFormat uint32, desiredNameFormat uint32, translatedName *uint16, nSize *uint32) (err error) [failretval&0xff==0] = secur32.TranslateNameW +//sys GetUserNameEx(nameFormat uint32, nameBuffre *uint16, nSize *uint32) (err error) [failretval&0xff==0] = secur32.GetUserNameExW + +// TranslateAccountName converts a directory service +// object name from one format to another. +func TranslateAccountName(username string, from, to uint32, initSize int) (string, error) { + u, e := UTF16PtrFromString(username) + if e != nil { + return "", e + } + n := uint32(50) + for { + b := make([]uint16, n) + e = TranslateName(u, from, to, &b[0], &n) + if e == nil { + return UTF16ToString(b[:n]), nil + } + if e != ERROR_INSUFFICIENT_BUFFER { + return "", e + } + if n <= uint32(len(b)) { + return "", e + } + } +} + +const ( + // do not reorder + NetSetupUnknownStatus = iota + NetSetupUnjoined + NetSetupWorkgroupName + NetSetupDomainName +) + +type UserInfo10 struct { + Name *uint16 + Comment *uint16 + UsrComment *uint16 + FullName *uint16 +} + +//sys NetUserGetInfo(serverName *uint16, userName *uint16, level uint32, buf **byte) (neterr error) = netapi32.NetUserGetInfo +//sys NetGetJoinInformation(server *uint16, name **uint16, bufType *uint32) (neterr error) = netapi32.NetGetJoinInformation +//sys NetApiBufferFree(buf *byte) (neterr error) = netapi32.NetApiBufferFree +//sys NetUserEnum(serverName *uint16, level uint32, filter uint32, buf **byte, prefMaxLen uint32, entriesRead *uint32, totalEntries *uint32, resumeHandle *uint32) (neterr error) = netapi32.NetUserEnum + +const ( + // do not reorder + SidTypeUser = 1 + iota + SidTypeGroup + SidTypeDomain + SidTypeAlias + SidTypeWellKnownGroup + SidTypeDeletedAccount + SidTypeInvalid + SidTypeUnknown + SidTypeComputer + SidTypeLabel +) + +type SidIdentifierAuthority struct { + Value [6]byte +} + +var ( + SECURITY_NULL_SID_AUTHORITY = SidIdentifierAuthority{[6]byte{0, 0, 0, 0, 0, 0}} + SECURITY_WORLD_SID_AUTHORITY = SidIdentifierAuthority{[6]byte{0, 0, 0, 0, 0, 1}} + SECURITY_LOCAL_SID_AUTHORITY = SidIdentifierAuthority{[6]byte{0, 0, 0, 0, 0, 2}} + SECURITY_CREATOR_SID_AUTHORITY = SidIdentifierAuthority{[6]byte{0, 0, 0, 0, 0, 3}} + SECURITY_NON_UNIQUE_AUTHORITY = SidIdentifierAuthority{[6]byte{0, 0, 0, 0, 0, 4}} + SECURITY_NT_AUTHORITY = SidIdentifierAuthority{[6]byte{0, 0, 0, 0, 0, 5}} + SECURITY_MANDATORY_LABEL_AUTHORITY = SidIdentifierAuthority{[6]byte{0, 0, 0, 0, 0, 16}} +) + +const ( + SECURITY_NULL_RID = 0 + SECURITY_WORLD_RID = 0 + SECURITY_LOCAL_RID = 0 + SECURITY_CREATOR_OWNER_RID = 0 + SECURITY_CREATOR_GROUP_RID = 1 + SECURITY_DIALUP_RID = 1 + SECURITY_NETWORK_RID = 2 + SECURITY_BATCH_RID = 3 + SECURITY_INTERACTIVE_RID = 4 + SECURITY_LOGON_IDS_RID = 5 + SECURITY_SERVICE_RID = 6 + SECURITY_LOCAL_SYSTEM_RID = 18 + SECURITY_BUILTIN_DOMAIN_RID = 32 + SECURITY_PRINCIPAL_SELF_RID = 10 + SECURITY_CREATOR_OWNER_SERVER_RID = 0x2 + SECURITY_CREATOR_GROUP_SERVER_RID = 0x3 + SECURITY_LOGON_IDS_RID_COUNT = 0x3 + SECURITY_ANONYMOUS_LOGON_RID = 0x7 + SECURITY_PROXY_RID = 0x8 + SECURITY_ENTERPRISE_CONTROLLERS_RID = 0x9 + SECURITY_SERVER_LOGON_RID = SECURITY_ENTERPRISE_CONTROLLERS_RID + SECURITY_AUTHENTICATED_USER_RID = 0xb + SECURITY_RESTRICTED_CODE_RID = 0xc + SECURITY_NT_NON_UNIQUE_RID = 0x15 +) + +// Predefined domain-relative RIDs for local groups. +// See https://msdn.microsoft.com/en-us/library/windows/desktop/aa379649(v=vs.85).aspx +const ( + DOMAIN_ALIAS_RID_ADMINS = 0x220 + DOMAIN_ALIAS_RID_USERS = 0x221 + DOMAIN_ALIAS_RID_GUESTS = 0x222 + DOMAIN_ALIAS_RID_POWER_USERS = 0x223 + DOMAIN_ALIAS_RID_ACCOUNT_OPS = 0x224 + DOMAIN_ALIAS_RID_SYSTEM_OPS = 0x225 + DOMAIN_ALIAS_RID_PRINT_OPS = 0x226 + DOMAIN_ALIAS_RID_BACKUP_OPS = 0x227 + DOMAIN_ALIAS_RID_REPLICATOR = 0x228 + DOMAIN_ALIAS_RID_RAS_SERVERS = 0x229 + DOMAIN_ALIAS_RID_PREW2KCOMPACCESS = 0x22a + DOMAIN_ALIAS_RID_REMOTE_DESKTOP_USERS = 0x22b + DOMAIN_ALIAS_RID_NETWORK_CONFIGURATION_OPS = 0x22c + DOMAIN_ALIAS_RID_INCOMING_FOREST_TRUST_BUILDERS = 0x22d + DOMAIN_ALIAS_RID_MONITORING_USERS = 0x22e + DOMAIN_ALIAS_RID_LOGGING_USERS = 0x22f + DOMAIN_ALIAS_RID_AUTHORIZATIONACCESS = 0x230 + DOMAIN_ALIAS_RID_TS_LICENSE_SERVERS = 0x231 + DOMAIN_ALIAS_RID_DCOM_USERS = 0x232 + DOMAIN_ALIAS_RID_IUSERS = 0x238 + DOMAIN_ALIAS_RID_CRYPTO_OPERATORS = 0x239 + DOMAIN_ALIAS_RID_CACHEABLE_PRINCIPALS_GROUP = 0x23b + DOMAIN_ALIAS_RID_NON_CACHEABLE_PRINCIPALS_GROUP = 0x23c + DOMAIN_ALIAS_RID_EVENT_LOG_READERS_GROUP = 0x23d + DOMAIN_ALIAS_RID_CERTSVC_DCOM_ACCESS_GROUP = 0x23e +) + +//sys LookupAccountSid(systemName *uint16, sid *SID, name *uint16, nameLen *uint32, refdDomainName *uint16, refdDomainNameLen *uint32, use *uint32) (err error) = advapi32.LookupAccountSidW +//sys LookupAccountName(systemName *uint16, accountName *uint16, sid *SID, sidLen *uint32, refdDomainName *uint16, refdDomainNameLen *uint32, use *uint32) (err error) = advapi32.LookupAccountNameW +//sys ConvertSidToStringSid(sid *SID, stringSid **uint16) (err error) = advapi32.ConvertSidToStringSidW +//sys ConvertStringSidToSid(stringSid *uint16, sid **SID) (err error) = advapi32.ConvertStringSidToSidW +//sys GetLengthSid(sid *SID) (len uint32) = advapi32.GetLengthSid +//sys CopySid(destSidLen uint32, destSid *SID, srcSid *SID) (err error) = advapi32.CopySid +//sys AllocateAndInitializeSid(identAuth *SidIdentifierAuthority, subAuth byte, subAuth0 uint32, subAuth1 uint32, subAuth2 uint32, subAuth3 uint32, subAuth4 uint32, subAuth5 uint32, subAuth6 uint32, subAuth7 uint32, sid **SID) (err error) = advapi32.AllocateAndInitializeSid +//sys createWellKnownSid(sidType WELL_KNOWN_SID_TYPE, domainSid *SID, sid *SID, sizeSid *uint32) (err error) = advapi32.CreateWellKnownSid +//sys isWellKnownSid(sid *SID, sidType WELL_KNOWN_SID_TYPE) (isWellKnown bool) = advapi32.IsWellKnownSid +//sys FreeSid(sid *SID) (err error) [failretval!=0] = advapi32.FreeSid +//sys EqualSid(sid1 *SID, sid2 *SID) (isEqual bool) = advapi32.EqualSid +//sys getSidIdentifierAuthority(sid *SID) (authority *SidIdentifierAuthority) = advapi32.GetSidIdentifierAuthority +//sys getSidSubAuthorityCount(sid *SID) (count *uint8) = advapi32.GetSidSubAuthorityCount +//sys getSidSubAuthority(sid *SID, index uint32) (subAuthority *uint32) = advapi32.GetSidSubAuthority +//sys isValidSid(sid *SID) (isValid bool) = advapi32.IsValidSid + +// The security identifier (SID) structure is a variable-length +// structure used to uniquely identify users or groups. +type SID struct{} + +// StringToSid converts a string-format security identifier +// SID into a valid, functional SID. +func StringToSid(s string) (*SID, error) { + var sid *SID + p, e := UTF16PtrFromString(s) + if e != nil { + return nil, e + } + e = ConvertStringSidToSid(p, &sid) + if e != nil { + return nil, e + } + defer LocalFree((Handle)(unsafe.Pointer(sid))) + return sid.Copy() +} + +// LookupSID retrieves a security identifier SID for the account +// and the name of the domain on which the account was found. +// System specify target computer to search. +func LookupSID(system, account string) (sid *SID, domain string, accType uint32, err error) { + if len(account) == 0 { + return nil, "", 0, syscall.EINVAL + } + acc, e := UTF16PtrFromString(account) + if e != nil { + return nil, "", 0, e + } + var sys *uint16 + if len(system) > 0 { + sys, e = UTF16PtrFromString(system) + if e != nil { + return nil, "", 0, e + } + } + n := uint32(50) + dn := uint32(50) + for { + b := make([]byte, n) + db := make([]uint16, dn) + sid = (*SID)(unsafe.Pointer(&b[0])) + e = LookupAccountName(sys, acc, sid, &n, &db[0], &dn, &accType) + if e == nil { + return sid, UTF16ToString(db), accType, nil + } + if e != ERROR_INSUFFICIENT_BUFFER { + return nil, "", 0, e + } + if n <= uint32(len(b)) { + return nil, "", 0, e + } + } +} + +// String converts SID to a string format suitable for display, storage, or transmission. +func (sid *SID) String() string { + var s *uint16 + e := ConvertSidToStringSid(sid, &s) + if e != nil { + return "" + } + defer LocalFree((Handle)(unsafe.Pointer(s))) + return UTF16ToString((*[256]uint16)(unsafe.Pointer(s))[:]) +} + +// Len returns the length, in bytes, of a valid security identifier SID. +func (sid *SID) Len() int { + return int(GetLengthSid(sid)) +} + +// Copy creates a duplicate of security identifier SID. +func (sid *SID) Copy() (*SID, error) { + b := make([]byte, sid.Len()) + sid2 := (*SID)(unsafe.Pointer(&b[0])) + e := CopySid(uint32(len(b)), sid2, sid) + if e != nil { + return nil, e + } + return sid2, nil +} + +// IdentifierAuthority returns the identifier authority of the SID. +func (sid *SID) IdentifierAuthority() SidIdentifierAuthority { + return *getSidIdentifierAuthority(sid) +} + +// SubAuthorityCount returns the number of sub-authorities in the SID. +func (sid *SID) SubAuthorityCount() uint8 { + return *getSidSubAuthorityCount(sid) +} + +// SubAuthority returns the sub-authority of the SID as specified by +// the index, which must be less than sid.SubAuthorityCount(). +func (sid *SID) SubAuthority(idx uint32) uint32 { + if idx >= uint32(sid.SubAuthorityCount()) { + panic("sub-authority index out of range") + } + return *getSidSubAuthority(sid, idx) +} + +// IsValid returns whether the SID has a valid revision and length. +func (sid *SID) IsValid() bool { + return isValidSid(sid) +} + +// Equals compares two SIDs for equality. +func (sid *SID) Equals(sid2 *SID) bool { + return EqualSid(sid, sid2) +} + +// IsWellKnown determines whether the SID matches the well-known sidType. +func (sid *SID) IsWellKnown(sidType WELL_KNOWN_SID_TYPE) bool { + return isWellKnownSid(sid, sidType) +} + +// LookupAccount retrieves the name of the account for this SID +// and the name of the first domain on which this SID is found. +// System specify target computer to search for. +func (sid *SID) LookupAccount(system string) (account, domain string, accType uint32, err error) { + var sys *uint16 + if len(system) > 0 { + sys, err = UTF16PtrFromString(system) + if err != nil { + return "", "", 0, err + } + } + n := uint32(50) + dn := uint32(50) + for { + b := make([]uint16, n) + db := make([]uint16, dn) + e := LookupAccountSid(sys, sid, &b[0], &n, &db[0], &dn, &accType) + if e == nil { + return UTF16ToString(b), UTF16ToString(db), accType, nil + } + if e != ERROR_INSUFFICIENT_BUFFER { + return "", "", 0, e + } + if n <= uint32(len(b)) { + return "", "", 0, e + } + } +} + +// Various types of pre-specified SIDs that can be synthesized and compared at runtime. +type WELL_KNOWN_SID_TYPE uint32 + +const ( + WinNullSid = 0 + WinWorldSid = 1 + WinLocalSid = 2 + WinCreatorOwnerSid = 3 + WinCreatorGroupSid = 4 + WinCreatorOwnerServerSid = 5 + WinCreatorGroupServerSid = 6 + WinNtAuthoritySid = 7 + WinDialupSid = 8 + WinNetworkSid = 9 + WinBatchSid = 10 + WinInteractiveSid = 11 + WinServiceSid = 12 + WinAnonymousSid = 13 + WinProxySid = 14 + WinEnterpriseControllersSid = 15 + WinSelfSid = 16 + WinAuthenticatedUserSid = 17 + WinRestrictedCodeSid = 18 + WinTerminalServerSid = 19 + WinRemoteLogonIdSid = 20 + WinLogonIdsSid = 21 + WinLocalSystemSid = 22 + WinLocalServiceSid = 23 + WinNetworkServiceSid = 24 + WinBuiltinDomainSid = 25 + WinBuiltinAdministratorsSid = 26 + WinBuiltinUsersSid = 27 + WinBuiltinGuestsSid = 28 + WinBuiltinPowerUsersSid = 29 + WinBuiltinAccountOperatorsSid = 30 + WinBuiltinSystemOperatorsSid = 31 + WinBuiltinPrintOperatorsSid = 32 + WinBuiltinBackupOperatorsSid = 33 + WinBuiltinReplicatorSid = 34 + WinBuiltinPreWindows2000CompatibleAccessSid = 35 + WinBuiltinRemoteDesktopUsersSid = 36 + WinBuiltinNetworkConfigurationOperatorsSid = 37 + WinAccountAdministratorSid = 38 + WinAccountGuestSid = 39 + WinAccountKrbtgtSid = 40 + WinAccountDomainAdminsSid = 41 + WinAccountDomainUsersSid = 42 + WinAccountDomainGuestsSid = 43 + WinAccountComputersSid = 44 + WinAccountControllersSid = 45 + WinAccountCertAdminsSid = 46 + WinAccountSchemaAdminsSid = 47 + WinAccountEnterpriseAdminsSid = 48 + WinAccountPolicyAdminsSid = 49 + WinAccountRasAndIasServersSid = 50 + WinNTLMAuthenticationSid = 51 + WinDigestAuthenticationSid = 52 + WinSChannelAuthenticationSid = 53 + WinThisOrganizationSid = 54 + WinOtherOrganizationSid = 55 + WinBuiltinIncomingForestTrustBuildersSid = 56 + WinBuiltinPerfMonitoringUsersSid = 57 + WinBuiltinPerfLoggingUsersSid = 58 + WinBuiltinAuthorizationAccessSid = 59 + WinBuiltinTerminalServerLicenseServersSid = 60 + WinBuiltinDCOMUsersSid = 61 + WinBuiltinIUsersSid = 62 + WinIUserSid = 63 + WinBuiltinCryptoOperatorsSid = 64 + WinUntrustedLabelSid = 65 + WinLowLabelSid = 66 + WinMediumLabelSid = 67 + WinHighLabelSid = 68 + WinSystemLabelSid = 69 + WinWriteRestrictedCodeSid = 70 + WinCreatorOwnerRightsSid = 71 + WinCacheablePrincipalsGroupSid = 72 + WinNonCacheablePrincipalsGroupSid = 73 + WinEnterpriseReadonlyControllersSid = 74 + WinAccountReadonlyControllersSid = 75 + WinBuiltinEventLogReadersGroup = 76 + WinNewEnterpriseReadonlyControllersSid = 77 + WinBuiltinCertSvcDComAccessGroup = 78 + WinMediumPlusLabelSid = 79 + WinLocalLogonSid = 80 + WinConsoleLogonSid = 81 + WinThisOrganizationCertificateSid = 82 + WinApplicationPackageAuthoritySid = 83 + WinBuiltinAnyPackageSid = 84 + WinCapabilityInternetClientSid = 85 + WinCapabilityInternetClientServerSid = 86 + WinCapabilityPrivateNetworkClientServerSid = 87 + WinCapabilityPicturesLibrarySid = 88 + WinCapabilityVideosLibrarySid = 89 + WinCapabilityMusicLibrarySid = 90 + WinCapabilityDocumentsLibrarySid = 91 + WinCapabilitySharedUserCertificatesSid = 92 + WinCapabilityEnterpriseAuthenticationSid = 93 + WinCapabilityRemovableStorageSid = 94 + WinBuiltinRDSRemoteAccessServersSid = 95 + WinBuiltinRDSEndpointServersSid = 96 + WinBuiltinRDSManagementServersSid = 97 + WinUserModeDriversSid = 98 + WinBuiltinHyperVAdminsSid = 99 + WinAccountCloneableControllersSid = 100 + WinBuiltinAccessControlAssistanceOperatorsSid = 101 + WinBuiltinRemoteManagementUsersSid = 102 + WinAuthenticationAuthorityAssertedSid = 103 + WinAuthenticationServiceAssertedSid = 104 + WinLocalAccountSid = 105 + WinLocalAccountAndAdministratorSid = 106 + WinAccountProtectedUsersSid = 107 + WinCapabilityAppointmentsSid = 108 + WinCapabilityContactsSid = 109 + WinAccountDefaultSystemManagedSid = 110 + WinBuiltinDefaultSystemManagedGroupSid = 111 + WinBuiltinStorageReplicaAdminsSid = 112 + WinAccountKeyAdminsSid = 113 + WinAccountEnterpriseKeyAdminsSid = 114 + WinAuthenticationKeyTrustSid = 115 + WinAuthenticationKeyPropertyMFASid = 116 + WinAuthenticationKeyPropertyAttestationSid = 117 + WinAuthenticationFreshKeyAuthSid = 118 + WinBuiltinDeviceOwnersSid = 119 +) + +// Creates a SID for a well-known predefined alias, generally using the constants of the form +// Win*Sid, for the local machine. +func CreateWellKnownSid(sidType WELL_KNOWN_SID_TYPE) (*SID, error) { + return CreateWellKnownDomainSid(sidType, nil) +} + +// Creates a SID for a well-known predefined alias, generally using the constants of the form +// Win*Sid, for the domain specified by the domainSid parameter. +func CreateWellKnownDomainSid(sidType WELL_KNOWN_SID_TYPE, domainSid *SID) (*SID, error) { + n := uint32(50) + for { + b := make([]byte, n) + sid := (*SID)(unsafe.Pointer(&b[0])) + err := createWellKnownSid(sidType, domainSid, sid, &n) + if err == nil { + return sid, nil + } + if err != ERROR_INSUFFICIENT_BUFFER { + return nil, err + } + if n <= uint32(len(b)) { + return nil, err + } + } +} + +const ( + // do not reorder + TOKEN_ASSIGN_PRIMARY = 1 << iota + TOKEN_DUPLICATE + TOKEN_IMPERSONATE + TOKEN_QUERY + TOKEN_QUERY_SOURCE + TOKEN_ADJUST_PRIVILEGES + TOKEN_ADJUST_GROUPS + TOKEN_ADJUST_DEFAULT + TOKEN_ADJUST_SESSIONID + + TOKEN_ALL_ACCESS = STANDARD_RIGHTS_REQUIRED | + TOKEN_ASSIGN_PRIMARY | + TOKEN_DUPLICATE | + TOKEN_IMPERSONATE | + TOKEN_QUERY | + TOKEN_QUERY_SOURCE | + TOKEN_ADJUST_PRIVILEGES | + TOKEN_ADJUST_GROUPS | + TOKEN_ADJUST_DEFAULT | + TOKEN_ADJUST_SESSIONID + TOKEN_READ = STANDARD_RIGHTS_READ | TOKEN_QUERY + TOKEN_WRITE = STANDARD_RIGHTS_WRITE | + TOKEN_ADJUST_PRIVILEGES | + TOKEN_ADJUST_GROUPS | + TOKEN_ADJUST_DEFAULT + TOKEN_EXECUTE = STANDARD_RIGHTS_EXECUTE +) + +const ( + // do not reorder + TokenUser = 1 + iota + TokenGroups + TokenPrivileges + TokenOwner + TokenPrimaryGroup + TokenDefaultDacl + TokenSource + TokenType + TokenImpersonationLevel + TokenStatistics + TokenRestrictedSids + TokenSessionId + TokenGroupsAndPrivileges + TokenSessionReference + TokenSandBoxInert + TokenAuditPolicy + TokenOrigin + TokenElevationType + TokenLinkedToken + TokenElevation + TokenHasRestrictions + TokenAccessInformation + TokenVirtualizationAllowed + TokenVirtualizationEnabled + TokenIntegrityLevel + TokenUIAccess + TokenMandatoryPolicy + TokenLogonSid + MaxTokenInfoClass +) + +// Group attributes inside of Tokengroups.Groups[i].Attributes +const ( + SE_GROUP_MANDATORY = 0x00000001 + SE_GROUP_ENABLED_BY_DEFAULT = 0x00000002 + SE_GROUP_ENABLED = 0x00000004 + SE_GROUP_OWNER = 0x00000008 + SE_GROUP_USE_FOR_DENY_ONLY = 0x00000010 + SE_GROUP_INTEGRITY = 0x00000020 + SE_GROUP_INTEGRITY_ENABLED = 0x00000040 + SE_GROUP_LOGON_ID = 0xC0000000 + SE_GROUP_RESOURCE = 0x20000000 + SE_GROUP_VALID_ATTRIBUTES = SE_GROUP_MANDATORY | SE_GROUP_ENABLED_BY_DEFAULT | SE_GROUP_ENABLED | SE_GROUP_OWNER | SE_GROUP_USE_FOR_DENY_ONLY | SE_GROUP_LOGON_ID | SE_GROUP_RESOURCE | SE_GROUP_INTEGRITY | SE_GROUP_INTEGRITY_ENABLED +) + +// Privilege attributes +const ( + SE_PRIVILEGE_ENABLED_BY_DEFAULT = 0x00000001 + SE_PRIVILEGE_ENABLED = 0x00000002 + SE_PRIVILEGE_REMOVED = 0x00000004 + SE_PRIVILEGE_USED_FOR_ACCESS = 0x80000000 + SE_PRIVILEGE_VALID_ATTRIBUTES = SE_PRIVILEGE_ENABLED_BY_DEFAULT | SE_PRIVILEGE_ENABLED | SE_PRIVILEGE_REMOVED | SE_PRIVILEGE_USED_FOR_ACCESS +) + +// Token types +const ( + TokenPrimary = 1 + TokenImpersonation = 2 +) + +// Impersonation levels +const ( + SecurityAnonymous = 0 + SecurityIdentification = 1 + SecurityImpersonation = 2 + SecurityDelegation = 3 +) + +type LUID struct { + LowPart uint32 + HighPart int32 +} + +type LUIDAndAttributes struct { + Luid LUID + Attributes uint32 +} + +type SIDAndAttributes struct { + Sid *SID + Attributes uint32 +} + +type Tokenuser struct { + User SIDAndAttributes +} + +type Tokenprimarygroup struct { + PrimaryGroup *SID +} + +type Tokengroups struct { + GroupCount uint32 + Groups [1]SIDAndAttributes // Use AllGroups() for iterating. +} + +// AllGroups returns a slice that can be used to iterate over the groups in g. +func (g *Tokengroups) AllGroups() []SIDAndAttributes { + return (*[(1 << 28) - 1]SIDAndAttributes)(unsafe.Pointer(&g.Groups[0]))[:g.GroupCount:g.GroupCount] +} + +type Tokenprivileges struct { + PrivilegeCount uint32 + Privileges [1]LUIDAndAttributes // Use AllPrivileges() for iterating. +} + +// AllPrivileges returns a slice that can be used to iterate over the privileges in p. +func (p *Tokenprivileges) AllPrivileges() []LUIDAndAttributes { + return (*[(1 << 27) - 1]LUIDAndAttributes)(unsafe.Pointer(&p.Privileges[0]))[:p.PrivilegeCount:p.PrivilegeCount] +} + +type Tokenmandatorylabel struct { + Label SIDAndAttributes +} + +func (tml *Tokenmandatorylabel) Size() uint32 { + return uint32(unsafe.Sizeof(Tokenmandatorylabel{})) + GetLengthSid(tml.Label.Sid) +} + +// Authorization Functions +//sys checkTokenMembership(tokenHandle Token, sidToCheck *SID, isMember *int32) (err error) = advapi32.CheckTokenMembership +//sys isTokenRestricted(tokenHandle Token) (ret bool, err error) [!failretval] = advapi32.IsTokenRestricted +//sys OpenProcessToken(process Handle, access uint32, token *Token) (err error) = advapi32.OpenProcessToken +//sys OpenThreadToken(thread Handle, access uint32, openAsSelf bool, token *Token) (err error) = advapi32.OpenThreadToken +//sys ImpersonateSelf(impersonationlevel uint32) (err error) = advapi32.ImpersonateSelf +//sys RevertToSelf() (err error) = advapi32.RevertToSelf +//sys SetThreadToken(thread *Handle, token Token) (err error) = advapi32.SetThreadToken +//sys LookupPrivilegeValue(systemname *uint16, name *uint16, luid *LUID) (err error) = advapi32.LookupPrivilegeValueW +//sys AdjustTokenPrivileges(token Token, disableAllPrivileges bool, newstate *Tokenprivileges, buflen uint32, prevstate *Tokenprivileges, returnlen *uint32) (err error) = advapi32.AdjustTokenPrivileges +//sys AdjustTokenGroups(token Token, resetToDefault bool, newstate *Tokengroups, buflen uint32, prevstate *Tokengroups, returnlen *uint32) (err error) = advapi32.AdjustTokenGroups +//sys GetTokenInformation(token Token, infoClass uint32, info *byte, infoLen uint32, returnedLen *uint32) (err error) = advapi32.GetTokenInformation +//sys SetTokenInformation(token Token, infoClass uint32, info *byte, infoLen uint32) (err error) = advapi32.SetTokenInformation +//sys DuplicateTokenEx(existingToken Token, desiredAccess uint32, tokenAttributes *SecurityAttributes, impersonationLevel uint32, tokenType uint32, newToken *Token) (err error) = advapi32.DuplicateTokenEx +//sys GetUserProfileDirectory(t Token, dir *uint16, dirLen *uint32) (err error) = userenv.GetUserProfileDirectoryW +//sys getSystemDirectory(dir *uint16, dirLen uint32) (len uint32, err error) = kernel32.GetSystemDirectoryW +//sys getWindowsDirectory(dir *uint16, dirLen uint32) (len uint32, err error) = kernel32.GetWindowsDirectoryW +//sys getSystemWindowsDirectory(dir *uint16, dirLen uint32) (len uint32, err error) = kernel32.GetSystemWindowsDirectoryW + +// An access token contains the security information for a logon session. +// The system creates an access token when a user logs on, and every +// process executed on behalf of the user has a copy of the token. +// The token identifies the user, the user's groups, and the user's +// privileges. The system uses the token to control access to securable +// objects and to control the ability of the user to perform various +// system-related operations on the local computer. +type Token Handle + +// OpenCurrentProcessToken opens an access token associated with current +// process with TOKEN_QUERY access. It is a real token that needs to be closed. +// +// Deprecated: Explicitly call OpenProcessToken(CurrentProcess(), ...) +// with the desired access instead, or use GetCurrentProcessToken for a +// TOKEN_QUERY token. +func OpenCurrentProcessToken() (Token, error) { + var token Token + err := OpenProcessToken(CurrentProcess(), TOKEN_QUERY, &token) + return token, err +} + +// GetCurrentProcessToken returns the access token associated with +// the current process. It is a pseudo token that does not need +// to be closed. +func GetCurrentProcessToken() Token { + return Token(^uintptr(4 - 1)) +} + +// GetCurrentThreadToken return the access token associated with +// the current thread. It is a pseudo token that does not need +// to be closed. +func GetCurrentThreadToken() Token { + return Token(^uintptr(5 - 1)) +} + +// GetCurrentThreadEffectiveToken returns the effective access token +// associated with the current thread. It is a pseudo token that does +// not need to be closed. +func GetCurrentThreadEffectiveToken() Token { + return Token(^uintptr(6 - 1)) +} + +// Close releases access to access token. +func (t Token) Close() error { + return CloseHandle(Handle(t)) +} + +// getInfo retrieves a specified type of information about an access token. +func (t Token) getInfo(class uint32, initSize int) (unsafe.Pointer, error) { + n := uint32(initSize) + for { + b := make([]byte, n) + e := GetTokenInformation(t, class, &b[0], uint32(len(b)), &n) + if e == nil { + return unsafe.Pointer(&b[0]), nil + } + if e != ERROR_INSUFFICIENT_BUFFER { + return nil, e + } + if n <= uint32(len(b)) { + return nil, e + } + } +} + +// GetTokenUser retrieves access token t user account information. +func (t Token) GetTokenUser() (*Tokenuser, error) { + i, e := t.getInfo(TokenUser, 50) + if e != nil { + return nil, e + } + return (*Tokenuser)(i), nil +} + +// GetTokenGroups retrieves group accounts associated with access token t. +func (t Token) GetTokenGroups() (*Tokengroups, error) { + i, e := t.getInfo(TokenGroups, 50) + if e != nil { + return nil, e + } + return (*Tokengroups)(i), nil +} + +// GetTokenPrimaryGroup retrieves access token t primary group information. +// A pointer to a SID structure representing a group that will become +// the primary group of any objects created by a process using this access token. +func (t Token) GetTokenPrimaryGroup() (*Tokenprimarygroup, error) { + i, e := t.getInfo(TokenPrimaryGroup, 50) + if e != nil { + return nil, e + } + return (*Tokenprimarygroup)(i), nil +} + +// GetUserProfileDirectory retrieves path to the +// root directory of the access token t user's profile. +func (t Token) GetUserProfileDirectory() (string, error) { + n := uint32(100) + for { + b := make([]uint16, n) + e := GetUserProfileDirectory(t, &b[0], &n) + if e == nil { + return UTF16ToString(b), nil + } + if e != ERROR_INSUFFICIENT_BUFFER { + return "", e + } + if n <= uint32(len(b)) { + return "", e + } + } +} + +// IsElevated returns whether the current token is elevated from a UAC perspective. +func (token Token) IsElevated() bool { + var isElevated uint32 + var outLen uint32 + err := GetTokenInformation(token, TokenElevation, (*byte)(unsafe.Pointer(&isElevated)), uint32(unsafe.Sizeof(isElevated)), &outLen) + if err != nil { + return false + } + return outLen == uint32(unsafe.Sizeof(isElevated)) && isElevated != 0 +} + +// GetLinkedToken returns the linked token, which may be an elevated UAC token. +func (token Token) GetLinkedToken() (Token, error) { + var linkedToken Token + var outLen uint32 + err := GetTokenInformation(token, TokenLinkedToken, (*byte)(unsafe.Pointer(&linkedToken)), uint32(unsafe.Sizeof(linkedToken)), &outLen) + if err != nil { + return Token(0), err + } + return linkedToken, nil +} + +// GetSystemDirectory retrieves the path to current location of the system +// directory, which is typically, though not always, `C:\Windows\System32`. +func GetSystemDirectory() (string, error) { + n := uint32(MAX_PATH) + for { + b := make([]uint16, n) + l, e := getSystemDirectory(&b[0], n) + if e != nil { + return "", e + } + if l <= n { + return UTF16ToString(b[:l]), nil + } + n = l + } +} + +// GetWindowsDirectory retrieves the path to current location of the Windows +// directory, which is typically, though not always, `C:\Windows`. This may +// be a private user directory in the case that the application is running +// under a terminal server. +func GetWindowsDirectory() (string, error) { + n := uint32(MAX_PATH) + for { + b := make([]uint16, n) + l, e := getWindowsDirectory(&b[0], n) + if e != nil { + return "", e + } + if l <= n { + return UTF16ToString(b[:l]), nil + } + n = l + } +} + +// GetSystemWindowsDirectory retrieves the path to current location of the +// Windows directory, which is typically, though not always, `C:\Windows`. +func GetSystemWindowsDirectory() (string, error) { + n := uint32(MAX_PATH) + for { + b := make([]uint16, n) + l, e := getSystemWindowsDirectory(&b[0], n) + if e != nil { + return "", e + } + if l <= n { + return UTF16ToString(b[:l]), nil + } + n = l + } +} + +// IsMember reports whether the access token t is a member of the provided SID. +func (t Token) IsMember(sid *SID) (bool, error) { + var b int32 + if e := checkTokenMembership(t, sid, &b); e != nil { + return false, e + } + return b != 0, nil +} + +// IsRestricted reports whether the access token t is a restricted token. +func (t Token) IsRestricted() (isRestricted bool, err error) { + isRestricted, err = isTokenRestricted(t) + if !isRestricted && err == syscall.EINVAL { + // If err is EINVAL, this returned ERROR_SUCCESS indicating a non-restricted token. + err = nil + } + return +} + +const ( + WTS_CONSOLE_CONNECT = 0x1 + WTS_CONSOLE_DISCONNECT = 0x2 + WTS_REMOTE_CONNECT = 0x3 + WTS_REMOTE_DISCONNECT = 0x4 + WTS_SESSION_LOGON = 0x5 + WTS_SESSION_LOGOFF = 0x6 + WTS_SESSION_LOCK = 0x7 + WTS_SESSION_UNLOCK = 0x8 + WTS_SESSION_REMOTE_CONTROL = 0x9 + WTS_SESSION_CREATE = 0xa + WTS_SESSION_TERMINATE = 0xb +) + +const ( + WTSActive = 0 + WTSConnected = 1 + WTSConnectQuery = 2 + WTSShadow = 3 + WTSDisconnected = 4 + WTSIdle = 5 + WTSListen = 6 + WTSReset = 7 + WTSDown = 8 + WTSInit = 9 +) + +type WTSSESSION_NOTIFICATION struct { + Size uint32 + SessionID uint32 +} + +type WTS_SESSION_INFO struct { + SessionID uint32 + WindowStationName *uint16 + State uint32 +} + +//sys WTSQueryUserToken(session uint32, token *Token) (err error) = wtsapi32.WTSQueryUserToken +//sys WTSEnumerateSessions(handle Handle, reserved uint32, version uint32, sessions **WTS_SESSION_INFO, count *uint32) (err error) = wtsapi32.WTSEnumerateSessionsW +//sys WTSFreeMemory(ptr uintptr) = wtsapi32.WTSFreeMemory +//sys WTSGetActiveConsoleSessionId() (sessionID uint32) + +type ACL struct { + aclRevision byte + sbz1 byte + aclSize uint16 + AceCount uint16 + sbz2 uint16 +} + +type SECURITY_DESCRIPTOR struct { + revision byte + sbz1 byte + control SECURITY_DESCRIPTOR_CONTROL + owner *SID + group *SID + sacl *ACL + dacl *ACL +} + +type SECURITY_QUALITY_OF_SERVICE struct { + Length uint32 + ImpersonationLevel uint32 + ContextTrackingMode byte + EffectiveOnly byte +} + +// Constants for the ContextTrackingMode field of SECURITY_QUALITY_OF_SERVICE. +const ( + SECURITY_STATIC_TRACKING = 0 + SECURITY_DYNAMIC_TRACKING = 1 +) + +type SecurityAttributes struct { + Length uint32 + SecurityDescriptor *SECURITY_DESCRIPTOR + InheritHandle uint32 +} + +type SE_OBJECT_TYPE uint32 + +// Constants for type SE_OBJECT_TYPE +const ( + SE_UNKNOWN_OBJECT_TYPE = 0 + SE_FILE_OBJECT = 1 + SE_SERVICE = 2 + SE_PRINTER = 3 + SE_REGISTRY_KEY = 4 + SE_LMSHARE = 5 + SE_KERNEL_OBJECT = 6 + SE_WINDOW_OBJECT = 7 + SE_DS_OBJECT = 8 + SE_DS_OBJECT_ALL = 9 + SE_PROVIDER_DEFINED_OBJECT = 10 + SE_WMIGUID_OBJECT = 11 + SE_REGISTRY_WOW64_32KEY = 12 + SE_REGISTRY_WOW64_64KEY = 13 +) + +type SECURITY_INFORMATION uint32 + +// Constants for type SECURITY_INFORMATION +const ( + OWNER_SECURITY_INFORMATION = 0x00000001 + GROUP_SECURITY_INFORMATION = 0x00000002 + DACL_SECURITY_INFORMATION = 0x00000004 + SACL_SECURITY_INFORMATION = 0x00000008 + LABEL_SECURITY_INFORMATION = 0x00000010 + ATTRIBUTE_SECURITY_INFORMATION = 0x00000020 + SCOPE_SECURITY_INFORMATION = 0x00000040 + BACKUP_SECURITY_INFORMATION = 0x00010000 + PROTECTED_DACL_SECURITY_INFORMATION = 0x80000000 + PROTECTED_SACL_SECURITY_INFORMATION = 0x40000000 + UNPROTECTED_DACL_SECURITY_INFORMATION = 0x20000000 + UNPROTECTED_SACL_SECURITY_INFORMATION = 0x10000000 +) + +type SECURITY_DESCRIPTOR_CONTROL uint16 + +// Constants for type SECURITY_DESCRIPTOR_CONTROL +const ( + SE_OWNER_DEFAULTED = 0x0001 + SE_GROUP_DEFAULTED = 0x0002 + SE_DACL_PRESENT = 0x0004 + SE_DACL_DEFAULTED = 0x0008 + SE_SACL_PRESENT = 0x0010 + SE_SACL_DEFAULTED = 0x0020 + SE_DACL_AUTO_INHERIT_REQ = 0x0100 + SE_SACL_AUTO_INHERIT_REQ = 0x0200 + SE_DACL_AUTO_INHERITED = 0x0400 + SE_SACL_AUTO_INHERITED = 0x0800 + SE_DACL_PROTECTED = 0x1000 + SE_SACL_PROTECTED = 0x2000 + SE_RM_CONTROL_VALID = 0x4000 + SE_SELF_RELATIVE = 0x8000 +) + +type ACCESS_MASK uint32 + +// Constants for type ACCESS_MASK +const ( + DELETE = 0x00010000 + READ_CONTROL = 0x00020000 + WRITE_DAC = 0x00040000 + WRITE_OWNER = 0x00080000 + SYNCHRONIZE = 0x00100000 + STANDARD_RIGHTS_REQUIRED = 0x000F0000 + STANDARD_RIGHTS_READ = READ_CONTROL + STANDARD_RIGHTS_WRITE = READ_CONTROL + STANDARD_RIGHTS_EXECUTE = READ_CONTROL + STANDARD_RIGHTS_ALL = 0x001F0000 + SPECIFIC_RIGHTS_ALL = 0x0000FFFF + ACCESS_SYSTEM_SECURITY = 0x01000000 + MAXIMUM_ALLOWED = 0x02000000 + GENERIC_READ = 0x80000000 + GENERIC_WRITE = 0x40000000 + GENERIC_EXECUTE = 0x20000000 + GENERIC_ALL = 0x10000000 +) + +type ACCESS_MODE uint32 + +// Constants for type ACCESS_MODE +const ( + NOT_USED_ACCESS = 0 + GRANT_ACCESS = 1 + SET_ACCESS = 2 + DENY_ACCESS = 3 + REVOKE_ACCESS = 4 + SET_AUDIT_SUCCESS = 5 + SET_AUDIT_FAILURE = 6 +) + +// Constants for AceFlags and Inheritance fields +const ( + NO_INHERITANCE = 0x0 + SUB_OBJECTS_ONLY_INHERIT = 0x1 + SUB_CONTAINERS_ONLY_INHERIT = 0x2 + SUB_CONTAINERS_AND_OBJECTS_INHERIT = 0x3 + INHERIT_NO_PROPAGATE = 0x4 + INHERIT_ONLY = 0x8 + INHERITED_ACCESS_ENTRY = 0x10 + INHERITED_PARENT = 0x10000000 + INHERITED_GRANDPARENT = 0x20000000 + OBJECT_INHERIT_ACE = 0x1 + CONTAINER_INHERIT_ACE = 0x2 + NO_PROPAGATE_INHERIT_ACE = 0x4 + INHERIT_ONLY_ACE = 0x8 + INHERITED_ACE = 0x10 + VALID_INHERIT_FLAGS = 0x1F +) + +type MULTIPLE_TRUSTEE_OPERATION uint32 + +// Constants for MULTIPLE_TRUSTEE_OPERATION +const ( + NO_MULTIPLE_TRUSTEE = 0 + TRUSTEE_IS_IMPERSONATE = 1 +) + +type TRUSTEE_FORM uint32 + +// Constants for TRUSTEE_FORM +const ( + TRUSTEE_IS_SID = 0 + TRUSTEE_IS_NAME = 1 + TRUSTEE_BAD_FORM = 2 + TRUSTEE_IS_OBJECTS_AND_SID = 3 + TRUSTEE_IS_OBJECTS_AND_NAME = 4 +) + +type TRUSTEE_TYPE uint32 + +// Constants for TRUSTEE_TYPE +const ( + TRUSTEE_IS_UNKNOWN = 0 + TRUSTEE_IS_USER = 1 + TRUSTEE_IS_GROUP = 2 + TRUSTEE_IS_DOMAIN = 3 + TRUSTEE_IS_ALIAS = 4 + TRUSTEE_IS_WELL_KNOWN_GROUP = 5 + TRUSTEE_IS_DELETED = 6 + TRUSTEE_IS_INVALID = 7 + TRUSTEE_IS_COMPUTER = 8 +) + +// Constants for ObjectsPresent field +const ( + ACE_OBJECT_TYPE_PRESENT = 0x1 + ACE_INHERITED_OBJECT_TYPE_PRESENT = 0x2 +) + +type EXPLICIT_ACCESS struct { + AccessPermissions ACCESS_MASK + AccessMode ACCESS_MODE + Inheritance uint32 + Trustee TRUSTEE +} + +// https://learn.microsoft.com/en-us/windows/win32/api/winnt/ns-winnt-ace_header +type ACE_HEADER struct { + AceType uint8 + AceFlags uint8 + AceSize uint16 +} + +// https://learn.microsoft.com/en-us/windows/win32/api/winnt/ns-winnt-access_allowed_ace +type ACCESS_ALLOWED_ACE struct { + Header ACE_HEADER + Mask ACCESS_MASK + SidStart uint32 +} + +const ( + // Constants for AceType + // https://learn.microsoft.com/en-us/windows/win32/api/winnt/ns-winnt-ace_header + ACCESS_ALLOWED_ACE_TYPE = 0 + ACCESS_DENIED_ACE_TYPE = 1 +) + +// This type is the union inside of TRUSTEE and must be created using one of the TrusteeValueFrom* functions. +type TrusteeValue uintptr + +func TrusteeValueFromString(str string) TrusteeValue { + return TrusteeValue(unsafe.Pointer(StringToUTF16Ptr(str))) +} +func TrusteeValueFromSID(sid *SID) TrusteeValue { + return TrusteeValue(unsafe.Pointer(sid)) +} +func TrusteeValueFromObjectsAndSid(objectsAndSid *OBJECTS_AND_SID) TrusteeValue { + return TrusteeValue(unsafe.Pointer(objectsAndSid)) +} +func TrusteeValueFromObjectsAndName(objectsAndName *OBJECTS_AND_NAME) TrusteeValue { + return TrusteeValue(unsafe.Pointer(objectsAndName)) +} + +type TRUSTEE struct { + MultipleTrustee *TRUSTEE + MultipleTrusteeOperation MULTIPLE_TRUSTEE_OPERATION + TrusteeForm TRUSTEE_FORM + TrusteeType TRUSTEE_TYPE + TrusteeValue TrusteeValue +} + +type OBJECTS_AND_SID struct { + ObjectsPresent uint32 + ObjectTypeGuid GUID + InheritedObjectTypeGuid GUID + Sid *SID +} + +type OBJECTS_AND_NAME struct { + ObjectsPresent uint32 + ObjectType SE_OBJECT_TYPE + ObjectTypeName *uint16 + InheritedObjectTypeName *uint16 + Name *uint16 +} + +//sys getSecurityInfo(handle Handle, objectType SE_OBJECT_TYPE, securityInformation SECURITY_INFORMATION, owner **SID, group **SID, dacl **ACL, sacl **ACL, sd **SECURITY_DESCRIPTOR) (ret error) = advapi32.GetSecurityInfo +//sys SetSecurityInfo(handle Handle, objectType SE_OBJECT_TYPE, securityInformation SECURITY_INFORMATION, owner *SID, group *SID, dacl *ACL, sacl *ACL) (ret error) = advapi32.SetSecurityInfo +//sys getNamedSecurityInfo(objectName string, objectType SE_OBJECT_TYPE, securityInformation SECURITY_INFORMATION, owner **SID, group **SID, dacl **ACL, sacl **ACL, sd **SECURITY_DESCRIPTOR) (ret error) = advapi32.GetNamedSecurityInfoW +//sys SetNamedSecurityInfo(objectName string, objectType SE_OBJECT_TYPE, securityInformation SECURITY_INFORMATION, owner *SID, group *SID, dacl *ACL, sacl *ACL) (ret error) = advapi32.SetNamedSecurityInfoW +//sys SetKernelObjectSecurity(handle Handle, securityInformation SECURITY_INFORMATION, securityDescriptor *SECURITY_DESCRIPTOR) (err error) = advapi32.SetKernelObjectSecurity + +//sys buildSecurityDescriptor(owner *TRUSTEE, group *TRUSTEE, countAccessEntries uint32, accessEntries *EXPLICIT_ACCESS, countAuditEntries uint32, auditEntries *EXPLICIT_ACCESS, oldSecurityDescriptor *SECURITY_DESCRIPTOR, sizeNewSecurityDescriptor *uint32, newSecurityDescriptor **SECURITY_DESCRIPTOR) (ret error) = advapi32.BuildSecurityDescriptorW +//sys initializeSecurityDescriptor(absoluteSD *SECURITY_DESCRIPTOR, revision uint32) (err error) = advapi32.InitializeSecurityDescriptor + +//sys getSecurityDescriptorControl(sd *SECURITY_DESCRIPTOR, control *SECURITY_DESCRIPTOR_CONTROL, revision *uint32) (err error) = advapi32.GetSecurityDescriptorControl +//sys getSecurityDescriptorDacl(sd *SECURITY_DESCRIPTOR, daclPresent *bool, dacl **ACL, daclDefaulted *bool) (err error) = advapi32.GetSecurityDescriptorDacl +//sys getSecurityDescriptorSacl(sd *SECURITY_DESCRIPTOR, saclPresent *bool, sacl **ACL, saclDefaulted *bool) (err error) = advapi32.GetSecurityDescriptorSacl +//sys getSecurityDescriptorOwner(sd *SECURITY_DESCRIPTOR, owner **SID, ownerDefaulted *bool) (err error) = advapi32.GetSecurityDescriptorOwner +//sys getSecurityDescriptorGroup(sd *SECURITY_DESCRIPTOR, group **SID, groupDefaulted *bool) (err error) = advapi32.GetSecurityDescriptorGroup +//sys getSecurityDescriptorLength(sd *SECURITY_DESCRIPTOR) (len uint32) = advapi32.GetSecurityDescriptorLength +//sys getSecurityDescriptorRMControl(sd *SECURITY_DESCRIPTOR, rmControl *uint8) (ret error) [failretval!=0] = advapi32.GetSecurityDescriptorRMControl +//sys isValidSecurityDescriptor(sd *SECURITY_DESCRIPTOR) (isValid bool) = advapi32.IsValidSecurityDescriptor + +//sys setSecurityDescriptorControl(sd *SECURITY_DESCRIPTOR, controlBitsOfInterest SECURITY_DESCRIPTOR_CONTROL, controlBitsToSet SECURITY_DESCRIPTOR_CONTROL) (err error) = advapi32.SetSecurityDescriptorControl +//sys setSecurityDescriptorDacl(sd *SECURITY_DESCRIPTOR, daclPresent bool, dacl *ACL, daclDefaulted bool) (err error) = advapi32.SetSecurityDescriptorDacl +//sys setSecurityDescriptorSacl(sd *SECURITY_DESCRIPTOR, saclPresent bool, sacl *ACL, saclDefaulted bool) (err error) = advapi32.SetSecurityDescriptorSacl +//sys setSecurityDescriptorOwner(sd *SECURITY_DESCRIPTOR, owner *SID, ownerDefaulted bool) (err error) = advapi32.SetSecurityDescriptorOwner +//sys setSecurityDescriptorGroup(sd *SECURITY_DESCRIPTOR, group *SID, groupDefaulted bool) (err error) = advapi32.SetSecurityDescriptorGroup +//sys setSecurityDescriptorRMControl(sd *SECURITY_DESCRIPTOR, rmControl *uint8) = advapi32.SetSecurityDescriptorRMControl + +//sys convertStringSecurityDescriptorToSecurityDescriptor(str string, revision uint32, sd **SECURITY_DESCRIPTOR, size *uint32) (err error) = advapi32.ConvertStringSecurityDescriptorToSecurityDescriptorW +//sys convertSecurityDescriptorToStringSecurityDescriptor(sd *SECURITY_DESCRIPTOR, revision uint32, securityInformation SECURITY_INFORMATION, str **uint16, strLen *uint32) (err error) = advapi32.ConvertSecurityDescriptorToStringSecurityDescriptorW + +//sys makeAbsoluteSD(selfRelativeSD *SECURITY_DESCRIPTOR, absoluteSD *SECURITY_DESCRIPTOR, absoluteSDSize *uint32, dacl *ACL, daclSize *uint32, sacl *ACL, saclSize *uint32, owner *SID, ownerSize *uint32, group *SID, groupSize *uint32) (err error) = advapi32.MakeAbsoluteSD +//sys makeSelfRelativeSD(absoluteSD *SECURITY_DESCRIPTOR, selfRelativeSD *SECURITY_DESCRIPTOR, selfRelativeSDSize *uint32) (err error) = advapi32.MakeSelfRelativeSD + +//sys setEntriesInAcl(countExplicitEntries uint32, explicitEntries *EXPLICIT_ACCESS, oldACL *ACL, newACL **ACL) (ret error) = advapi32.SetEntriesInAclW +//sys GetAce(acl *ACL, aceIndex uint32, pAce **ACCESS_ALLOWED_ACE) (err error) = advapi32.GetAce + +// Control returns the security descriptor control bits. +func (sd *SECURITY_DESCRIPTOR) Control() (control SECURITY_DESCRIPTOR_CONTROL, revision uint32, err error) { + err = getSecurityDescriptorControl(sd, &control, &revision) + return +} + +// SetControl sets the security descriptor control bits. +func (sd *SECURITY_DESCRIPTOR) SetControl(controlBitsOfInterest SECURITY_DESCRIPTOR_CONTROL, controlBitsToSet SECURITY_DESCRIPTOR_CONTROL) error { + return setSecurityDescriptorControl(sd, controlBitsOfInterest, controlBitsToSet) +} + +// RMControl returns the security descriptor resource manager control bits. +func (sd *SECURITY_DESCRIPTOR) RMControl() (control uint8, err error) { + err = getSecurityDescriptorRMControl(sd, &control) + return +} + +// SetRMControl sets the security descriptor resource manager control bits. +func (sd *SECURITY_DESCRIPTOR) SetRMControl(rmControl uint8) { + setSecurityDescriptorRMControl(sd, &rmControl) +} + +// DACL returns the security descriptor DACL and whether it was defaulted. The dacl return value may be nil +// if a DACL exists but is an "empty DACL", meaning fully permissive. If the DACL does not exist, err returns +// ERROR_OBJECT_NOT_FOUND. +func (sd *SECURITY_DESCRIPTOR) DACL() (dacl *ACL, defaulted bool, err error) { + var present bool + err = getSecurityDescriptorDacl(sd, &present, &dacl, &defaulted) + if !present { + err = ERROR_OBJECT_NOT_FOUND + } + return +} + +// SetDACL sets the absolute security descriptor DACL. +func (absoluteSD *SECURITY_DESCRIPTOR) SetDACL(dacl *ACL, present, defaulted bool) error { + return setSecurityDescriptorDacl(absoluteSD, present, dacl, defaulted) +} + +// SACL returns the security descriptor SACL and whether it was defaulted. The sacl return value may be nil +// if a SACL exists but is an "empty SACL", meaning fully permissive. If the SACL does not exist, err returns +// ERROR_OBJECT_NOT_FOUND. +func (sd *SECURITY_DESCRIPTOR) SACL() (sacl *ACL, defaulted bool, err error) { + var present bool + err = getSecurityDescriptorSacl(sd, &present, &sacl, &defaulted) + if !present { + err = ERROR_OBJECT_NOT_FOUND + } + return +} + +// SetSACL sets the absolute security descriptor SACL. +func (absoluteSD *SECURITY_DESCRIPTOR) SetSACL(sacl *ACL, present, defaulted bool) error { + return setSecurityDescriptorSacl(absoluteSD, present, sacl, defaulted) +} + +// Owner returns the security descriptor owner and whether it was defaulted. +func (sd *SECURITY_DESCRIPTOR) Owner() (owner *SID, defaulted bool, err error) { + err = getSecurityDescriptorOwner(sd, &owner, &defaulted) + return +} + +// SetOwner sets the absolute security descriptor owner. +func (absoluteSD *SECURITY_DESCRIPTOR) SetOwner(owner *SID, defaulted bool) error { + return setSecurityDescriptorOwner(absoluteSD, owner, defaulted) +} + +// Group returns the security descriptor group and whether it was defaulted. +func (sd *SECURITY_DESCRIPTOR) Group() (group *SID, defaulted bool, err error) { + err = getSecurityDescriptorGroup(sd, &group, &defaulted) + return +} + +// SetGroup sets the absolute security descriptor owner. +func (absoluteSD *SECURITY_DESCRIPTOR) SetGroup(group *SID, defaulted bool) error { + return setSecurityDescriptorGroup(absoluteSD, group, defaulted) +} + +// Length returns the length of the security descriptor. +func (sd *SECURITY_DESCRIPTOR) Length() uint32 { + return getSecurityDescriptorLength(sd) +} + +// IsValid returns whether the security descriptor is valid. +func (sd *SECURITY_DESCRIPTOR) IsValid() bool { + return isValidSecurityDescriptor(sd) +} + +// String returns the SDDL form of the security descriptor, with a function signature that can be +// used with %v formatting directives. +func (sd *SECURITY_DESCRIPTOR) String() string { + var sddl *uint16 + err := convertSecurityDescriptorToStringSecurityDescriptor(sd, 1, 0xff, &sddl, nil) + if err != nil { + return "" + } + defer LocalFree(Handle(unsafe.Pointer(sddl))) + return UTF16PtrToString(sddl) +} + +// ToAbsolute converts a self-relative security descriptor into an absolute one. +func (selfRelativeSD *SECURITY_DESCRIPTOR) ToAbsolute() (absoluteSD *SECURITY_DESCRIPTOR, err error) { + control, _, err := selfRelativeSD.Control() + if err != nil { + return + } + if control&SE_SELF_RELATIVE == 0 { + err = ERROR_INVALID_PARAMETER + return + } + var absoluteSDSize, daclSize, saclSize, ownerSize, groupSize uint32 + err = makeAbsoluteSD(selfRelativeSD, nil, &absoluteSDSize, + nil, &daclSize, nil, &saclSize, nil, &ownerSize, nil, &groupSize) + switch err { + case ERROR_INSUFFICIENT_BUFFER: + case nil: + // makeAbsoluteSD is expected to fail, but it succeeds. + return nil, ERROR_INTERNAL_ERROR + default: + return nil, err + } + if absoluteSDSize > 0 { + absoluteSD = new(SECURITY_DESCRIPTOR) + if unsafe.Sizeof(*absoluteSD) < uintptr(absoluteSDSize) { + panic("sizeof(SECURITY_DESCRIPTOR) too small") + } + } + var ( + dacl *ACL + sacl *ACL + owner *SID + group *SID + ) + if daclSize > 0 { + dacl = (*ACL)(unsafe.Pointer(unsafe.SliceData(make([]byte, daclSize)))) + } + if saclSize > 0 { + sacl = (*ACL)(unsafe.Pointer(unsafe.SliceData(make([]byte, saclSize)))) + } + if ownerSize > 0 { + owner = (*SID)(unsafe.Pointer(unsafe.SliceData(make([]byte, ownerSize)))) + } + if groupSize > 0 { + group = (*SID)(unsafe.Pointer(unsafe.SliceData(make([]byte, groupSize)))) + } + // We call into Windows via makeAbsoluteSD, which sets up + // pointers within absoluteSD that point to other chunks of memory + // we pass into makeAbsoluteSD, and that happens outside the view of the GC. + // We therefore take some care here to then verify the pointers are as we expect + // and set them explicitly in view of the GC. See https://go.dev/issue/73199. + // TODO: consider weak pointers once Go 1.24 is appropriate. See suggestion in https://go.dev/cl/663575. + err = makeAbsoluteSD(selfRelativeSD, absoluteSD, &absoluteSDSize, + dacl, &daclSize, sacl, &saclSize, owner, &ownerSize, group, &groupSize) + if err != nil { + // Don't return absoluteSD, which might be partially initialized. + return nil, err + } + // Before using any fields, verify absoluteSD is in the format we expect according to Windows. + // See https://learn.microsoft.com/en-us/windows/win32/secauthz/absolute-and-self-relative-security-descriptors + absControl, _, err := absoluteSD.Control() + if err != nil { + panic("absoluteSD: " + err.Error()) + } + if absControl&SE_SELF_RELATIVE != 0 { + panic("absoluteSD not in absolute format") + } + if absoluteSD.dacl != dacl { + panic("dacl pointer mismatch") + } + if absoluteSD.sacl != sacl { + panic("sacl pointer mismatch") + } + if absoluteSD.owner != owner { + panic("owner pointer mismatch") + } + if absoluteSD.group != group { + panic("group pointer mismatch") + } + absoluteSD.dacl = dacl + absoluteSD.sacl = sacl + absoluteSD.owner = owner + absoluteSD.group = group + + return +} + +// ToSelfRelative converts an absolute security descriptor into a self-relative one. +func (absoluteSD *SECURITY_DESCRIPTOR) ToSelfRelative() (selfRelativeSD *SECURITY_DESCRIPTOR, err error) { + control, _, err := absoluteSD.Control() + if err != nil { + return + } + if control&SE_SELF_RELATIVE != 0 { + err = ERROR_INVALID_PARAMETER + return + } + var selfRelativeSDSize uint32 + err = makeSelfRelativeSD(absoluteSD, nil, &selfRelativeSDSize) + switch err { + case ERROR_INSUFFICIENT_BUFFER: + case nil: + // makeSelfRelativeSD is expected to fail, but it succeeds. + return nil, ERROR_INTERNAL_ERROR + default: + return nil, err + } + if selfRelativeSDSize > 0 { + selfRelativeSD = (*SECURITY_DESCRIPTOR)(unsafe.Pointer(&make([]byte, selfRelativeSDSize)[0])) + } + err = makeSelfRelativeSD(absoluteSD, selfRelativeSD, &selfRelativeSDSize) + return +} + +func (selfRelativeSD *SECURITY_DESCRIPTOR) copySelfRelativeSecurityDescriptor() *SECURITY_DESCRIPTOR { + sdLen := int(selfRelativeSD.Length()) + const min = int(unsafe.Sizeof(SECURITY_DESCRIPTOR{})) + if sdLen < min { + sdLen = min + } + + src := unsafe.Slice((*byte)(unsafe.Pointer(selfRelativeSD)), sdLen) + // SECURITY_DESCRIPTOR has pointers in it, which means checkptr expects for it to + // be aligned properly. When we're copying a Windows-allocated struct to a + // Go-allocated one, make sure that the Go allocation is aligned to the + // pointer size. + const psize = int(unsafe.Sizeof(uintptr(0))) + alloc := make([]uintptr, (sdLen+psize-1)/psize) + dst := unsafe.Slice((*byte)(unsafe.Pointer(&alloc[0])), sdLen) + copy(dst, src) + return (*SECURITY_DESCRIPTOR)(unsafe.Pointer(&dst[0])) +} + +// SecurityDescriptorFromString converts an SDDL string describing a security descriptor into a +// self-relative security descriptor object allocated on the Go heap. +func SecurityDescriptorFromString(sddl string) (sd *SECURITY_DESCRIPTOR, err error) { + var winHeapSD *SECURITY_DESCRIPTOR + err = convertStringSecurityDescriptorToSecurityDescriptor(sddl, 1, &winHeapSD, nil) + if err != nil { + return + } + defer LocalFree(Handle(unsafe.Pointer(winHeapSD))) + return winHeapSD.copySelfRelativeSecurityDescriptor(), nil +} + +// GetSecurityInfo queries the security information for a given handle and returns the self-relative security +// descriptor result on the Go heap. +func GetSecurityInfo(handle Handle, objectType SE_OBJECT_TYPE, securityInformation SECURITY_INFORMATION) (sd *SECURITY_DESCRIPTOR, err error) { + var winHeapSD *SECURITY_DESCRIPTOR + err = getSecurityInfo(handle, objectType, securityInformation, nil, nil, nil, nil, &winHeapSD) + if err != nil { + return + } + defer LocalFree(Handle(unsafe.Pointer(winHeapSD))) + return winHeapSD.copySelfRelativeSecurityDescriptor(), nil +} + +// GetNamedSecurityInfo queries the security information for a given named object and returns the self-relative security +// descriptor result on the Go heap. The security descriptor might be nil, even when err is nil, if the object exists +// but has no security descriptor. +func GetNamedSecurityInfo(objectName string, objectType SE_OBJECT_TYPE, securityInformation SECURITY_INFORMATION) (sd *SECURITY_DESCRIPTOR, err error) { + var winHeapSD *SECURITY_DESCRIPTOR + err = getNamedSecurityInfo(objectName, objectType, securityInformation, nil, nil, nil, nil, &winHeapSD) + if err != nil { + return + } + if winHeapSD == nil { + return nil, nil + } + defer LocalFree(Handle(unsafe.Pointer(winHeapSD))) + return winHeapSD.copySelfRelativeSecurityDescriptor(), nil +} + +// BuildSecurityDescriptor makes a new security descriptor using the input trustees, explicit access lists, and +// prior security descriptor to be merged, any of which can be nil, returning the self-relative security descriptor +// result on the Go heap. +func BuildSecurityDescriptor(owner *TRUSTEE, group *TRUSTEE, accessEntries []EXPLICIT_ACCESS, auditEntries []EXPLICIT_ACCESS, mergedSecurityDescriptor *SECURITY_DESCRIPTOR) (sd *SECURITY_DESCRIPTOR, err error) { + var winHeapSD *SECURITY_DESCRIPTOR + var winHeapSDSize uint32 + var firstAccessEntry *EXPLICIT_ACCESS + if len(accessEntries) > 0 { + firstAccessEntry = &accessEntries[0] + } + var firstAuditEntry *EXPLICIT_ACCESS + if len(auditEntries) > 0 { + firstAuditEntry = &auditEntries[0] + } + err = buildSecurityDescriptor(owner, group, uint32(len(accessEntries)), firstAccessEntry, uint32(len(auditEntries)), firstAuditEntry, mergedSecurityDescriptor, &winHeapSDSize, &winHeapSD) + if err != nil { + return + } + defer LocalFree(Handle(unsafe.Pointer(winHeapSD))) + return winHeapSD.copySelfRelativeSecurityDescriptor(), nil +} + +// NewSecurityDescriptor creates and initializes a new absolute security descriptor. +func NewSecurityDescriptor() (absoluteSD *SECURITY_DESCRIPTOR, err error) { + absoluteSD = &SECURITY_DESCRIPTOR{} + err = initializeSecurityDescriptor(absoluteSD, 1) + return +} + +// ACLFromEntries returns a new ACL on the Go heap containing a list of explicit entries as well as those of another ACL. +// Both explicitEntries and mergedACL are optional and can be nil. +func ACLFromEntries(explicitEntries []EXPLICIT_ACCESS, mergedACL *ACL) (acl *ACL, err error) { + var firstExplicitEntry *EXPLICIT_ACCESS + if len(explicitEntries) > 0 { + firstExplicitEntry = &explicitEntries[0] + } + var winHeapACL *ACL + err = setEntriesInAcl(uint32(len(explicitEntries)), firstExplicitEntry, mergedACL, &winHeapACL) + if err != nil { + return + } + defer LocalFree(Handle(unsafe.Pointer(winHeapACL))) + aclBytes := make([]byte, winHeapACL.aclSize) + copy(aclBytes, (*[(1 << 31) - 1]byte)(unsafe.Pointer(winHeapACL))[:len(aclBytes):len(aclBytes)]) + return (*ACL)(unsafe.Pointer(&aclBytes[0])), nil +} diff --git a/vendor/golang.org/x/sys/windows/service.go b/vendor/golang.org/x/sys/windows/service.go new file mode 100644 index 00000000..a9dc6308 --- /dev/null +++ b/vendor/golang.org/x/sys/windows/service.go @@ -0,0 +1,257 @@ +// Copyright 2012 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +//go:build windows + +package windows + +const ( + SC_MANAGER_CONNECT = 1 + SC_MANAGER_CREATE_SERVICE = 2 + SC_MANAGER_ENUMERATE_SERVICE = 4 + SC_MANAGER_LOCK = 8 + SC_MANAGER_QUERY_LOCK_STATUS = 16 + SC_MANAGER_MODIFY_BOOT_CONFIG = 32 + SC_MANAGER_ALL_ACCESS = 0xf003f +) + +const ( + SERVICE_KERNEL_DRIVER = 1 + SERVICE_FILE_SYSTEM_DRIVER = 2 + SERVICE_ADAPTER = 4 + SERVICE_RECOGNIZER_DRIVER = 8 + SERVICE_WIN32_OWN_PROCESS = 16 + SERVICE_WIN32_SHARE_PROCESS = 32 + SERVICE_WIN32 = SERVICE_WIN32_OWN_PROCESS | SERVICE_WIN32_SHARE_PROCESS + SERVICE_INTERACTIVE_PROCESS = 256 + SERVICE_DRIVER = SERVICE_KERNEL_DRIVER | SERVICE_FILE_SYSTEM_DRIVER | SERVICE_RECOGNIZER_DRIVER + SERVICE_TYPE_ALL = SERVICE_WIN32 | SERVICE_ADAPTER | SERVICE_DRIVER | SERVICE_INTERACTIVE_PROCESS + + SERVICE_BOOT_START = 0 + SERVICE_SYSTEM_START = 1 + SERVICE_AUTO_START = 2 + SERVICE_DEMAND_START = 3 + SERVICE_DISABLED = 4 + + SERVICE_ERROR_IGNORE = 0 + SERVICE_ERROR_NORMAL = 1 + SERVICE_ERROR_SEVERE = 2 + SERVICE_ERROR_CRITICAL = 3 + + SC_STATUS_PROCESS_INFO = 0 + + SC_ACTION_NONE = 0 + SC_ACTION_RESTART = 1 + SC_ACTION_REBOOT = 2 + SC_ACTION_RUN_COMMAND = 3 + + SERVICE_STOPPED = 1 + SERVICE_START_PENDING = 2 + SERVICE_STOP_PENDING = 3 + SERVICE_RUNNING = 4 + SERVICE_CONTINUE_PENDING = 5 + SERVICE_PAUSE_PENDING = 6 + SERVICE_PAUSED = 7 + SERVICE_NO_CHANGE = 0xffffffff + + SERVICE_ACCEPT_STOP = 1 + SERVICE_ACCEPT_PAUSE_CONTINUE = 2 + SERVICE_ACCEPT_SHUTDOWN = 4 + SERVICE_ACCEPT_PARAMCHANGE = 8 + SERVICE_ACCEPT_NETBINDCHANGE = 16 + SERVICE_ACCEPT_HARDWAREPROFILECHANGE = 32 + SERVICE_ACCEPT_POWEREVENT = 64 + SERVICE_ACCEPT_SESSIONCHANGE = 128 + SERVICE_ACCEPT_PRESHUTDOWN = 256 + + SERVICE_CONTROL_STOP = 1 + SERVICE_CONTROL_PAUSE = 2 + SERVICE_CONTROL_CONTINUE = 3 + SERVICE_CONTROL_INTERROGATE = 4 + SERVICE_CONTROL_SHUTDOWN = 5 + SERVICE_CONTROL_PARAMCHANGE = 6 + SERVICE_CONTROL_NETBINDADD = 7 + SERVICE_CONTROL_NETBINDREMOVE = 8 + SERVICE_CONTROL_NETBINDENABLE = 9 + SERVICE_CONTROL_NETBINDDISABLE = 10 + SERVICE_CONTROL_DEVICEEVENT = 11 + SERVICE_CONTROL_HARDWAREPROFILECHANGE = 12 + SERVICE_CONTROL_POWEREVENT = 13 + SERVICE_CONTROL_SESSIONCHANGE = 14 + SERVICE_CONTROL_PRESHUTDOWN = 15 + + SERVICE_ACTIVE = 1 + SERVICE_INACTIVE = 2 + SERVICE_STATE_ALL = 3 + + SERVICE_QUERY_CONFIG = 1 + SERVICE_CHANGE_CONFIG = 2 + SERVICE_QUERY_STATUS = 4 + SERVICE_ENUMERATE_DEPENDENTS = 8 + SERVICE_START = 16 + SERVICE_STOP = 32 + SERVICE_PAUSE_CONTINUE = 64 + SERVICE_INTERROGATE = 128 + SERVICE_USER_DEFINED_CONTROL = 256 + SERVICE_ALL_ACCESS = STANDARD_RIGHTS_REQUIRED | SERVICE_QUERY_CONFIG | SERVICE_CHANGE_CONFIG | SERVICE_QUERY_STATUS | SERVICE_ENUMERATE_DEPENDENTS | SERVICE_START | SERVICE_STOP | SERVICE_PAUSE_CONTINUE | SERVICE_INTERROGATE | SERVICE_USER_DEFINED_CONTROL + + SERVICE_RUNS_IN_SYSTEM_PROCESS = 1 + + SERVICE_CONFIG_DESCRIPTION = 1 + SERVICE_CONFIG_FAILURE_ACTIONS = 2 + SERVICE_CONFIG_DELAYED_AUTO_START_INFO = 3 + SERVICE_CONFIG_FAILURE_ACTIONS_FLAG = 4 + SERVICE_CONFIG_SERVICE_SID_INFO = 5 + SERVICE_CONFIG_REQUIRED_PRIVILEGES_INFO = 6 + SERVICE_CONFIG_PRESHUTDOWN_INFO = 7 + SERVICE_CONFIG_TRIGGER_INFO = 8 + SERVICE_CONFIG_PREFERRED_NODE = 9 + SERVICE_CONFIG_LAUNCH_PROTECTED = 12 + + SERVICE_SID_TYPE_NONE = 0 + SERVICE_SID_TYPE_UNRESTRICTED = 1 + SERVICE_SID_TYPE_RESTRICTED = 2 | SERVICE_SID_TYPE_UNRESTRICTED + + SC_ENUM_PROCESS_INFO = 0 + + SERVICE_NOTIFY_STATUS_CHANGE = 2 + SERVICE_NOTIFY_STOPPED = 0x00000001 + SERVICE_NOTIFY_START_PENDING = 0x00000002 + SERVICE_NOTIFY_STOP_PENDING = 0x00000004 + SERVICE_NOTIFY_RUNNING = 0x00000008 + SERVICE_NOTIFY_CONTINUE_PENDING = 0x00000010 + SERVICE_NOTIFY_PAUSE_PENDING = 0x00000020 + SERVICE_NOTIFY_PAUSED = 0x00000040 + SERVICE_NOTIFY_CREATED = 0x00000080 + SERVICE_NOTIFY_DELETED = 0x00000100 + SERVICE_NOTIFY_DELETE_PENDING = 0x00000200 + + SC_EVENT_DATABASE_CHANGE = 0 + SC_EVENT_PROPERTY_CHANGE = 1 + SC_EVENT_STATUS_CHANGE = 2 + + SERVICE_START_REASON_DEMAND = 0x00000001 + SERVICE_START_REASON_AUTO = 0x00000002 + SERVICE_START_REASON_TRIGGER = 0x00000004 + SERVICE_START_REASON_RESTART_ON_FAILURE = 0x00000008 + SERVICE_START_REASON_DELAYEDAUTO = 0x00000010 + + SERVICE_DYNAMIC_INFORMATION_LEVEL_START_REASON = 1 +) + +type ENUM_SERVICE_STATUS struct { + ServiceName *uint16 + DisplayName *uint16 + ServiceStatus SERVICE_STATUS +} + +type SERVICE_STATUS struct { + ServiceType uint32 + CurrentState uint32 + ControlsAccepted uint32 + Win32ExitCode uint32 + ServiceSpecificExitCode uint32 + CheckPoint uint32 + WaitHint uint32 +} + +type SERVICE_TABLE_ENTRY struct { + ServiceName *uint16 + ServiceProc uintptr +} + +type QUERY_SERVICE_CONFIG struct { + ServiceType uint32 + StartType uint32 + ErrorControl uint32 + BinaryPathName *uint16 + LoadOrderGroup *uint16 + TagId uint32 + Dependencies *uint16 + ServiceStartName *uint16 + DisplayName *uint16 +} + +type SERVICE_DESCRIPTION struct { + Description *uint16 +} + +type SERVICE_DELAYED_AUTO_START_INFO struct { + IsDelayedAutoStartUp uint32 +} + +type SERVICE_STATUS_PROCESS struct { + ServiceType uint32 + CurrentState uint32 + ControlsAccepted uint32 + Win32ExitCode uint32 + ServiceSpecificExitCode uint32 + CheckPoint uint32 + WaitHint uint32 + ProcessId uint32 + ServiceFlags uint32 +} + +type ENUM_SERVICE_STATUS_PROCESS struct { + ServiceName *uint16 + DisplayName *uint16 + ServiceStatusProcess SERVICE_STATUS_PROCESS +} + +type SERVICE_NOTIFY struct { + Version uint32 + NotifyCallback uintptr + Context uintptr + NotificationStatus uint32 + ServiceStatus SERVICE_STATUS_PROCESS + NotificationTriggered uint32 + ServiceNames *uint16 +} + +type SERVICE_FAILURE_ACTIONS struct { + ResetPeriod uint32 + RebootMsg *uint16 + Command *uint16 + ActionsCount uint32 + Actions *SC_ACTION +} + +type SERVICE_FAILURE_ACTIONS_FLAG struct { + FailureActionsOnNonCrashFailures int32 +} + +type SC_ACTION struct { + Type uint32 + Delay uint32 +} + +type QUERY_SERVICE_LOCK_STATUS struct { + IsLocked uint32 + LockOwner *uint16 + LockDuration uint32 +} + +//sys OpenSCManager(machineName *uint16, databaseName *uint16, access uint32) (handle Handle, err error) [failretval==0] = advapi32.OpenSCManagerW +//sys CloseServiceHandle(handle Handle) (err error) = advapi32.CloseServiceHandle +//sys CreateService(mgr Handle, serviceName *uint16, displayName *uint16, access uint32, srvType uint32, startType uint32, errCtl uint32, pathName *uint16, loadOrderGroup *uint16, tagId *uint32, dependencies *uint16, serviceStartName *uint16, password *uint16) (handle Handle, err error) [failretval==0] = advapi32.CreateServiceW +//sys OpenService(mgr Handle, serviceName *uint16, access uint32) (handle Handle, err error) [failretval==0] = advapi32.OpenServiceW +//sys DeleteService(service Handle) (err error) = advapi32.DeleteService +//sys StartService(service Handle, numArgs uint32, argVectors **uint16) (err error) = advapi32.StartServiceW +//sys QueryServiceStatus(service Handle, status *SERVICE_STATUS) (err error) = advapi32.QueryServiceStatus +//sys QueryServiceLockStatus(mgr Handle, lockStatus *QUERY_SERVICE_LOCK_STATUS, bufSize uint32, bytesNeeded *uint32) (err error) = advapi32.QueryServiceLockStatusW +//sys ControlService(service Handle, control uint32, status *SERVICE_STATUS) (err error) = advapi32.ControlService +//sys StartServiceCtrlDispatcher(serviceTable *SERVICE_TABLE_ENTRY) (err error) = advapi32.StartServiceCtrlDispatcherW +//sys SetServiceStatus(service Handle, serviceStatus *SERVICE_STATUS) (err error) = advapi32.SetServiceStatus +//sys ChangeServiceConfig(service Handle, serviceType uint32, startType uint32, errorControl uint32, binaryPathName *uint16, loadOrderGroup *uint16, tagId *uint32, dependencies *uint16, serviceStartName *uint16, password *uint16, displayName *uint16) (err error) = advapi32.ChangeServiceConfigW +//sys QueryServiceConfig(service Handle, serviceConfig *QUERY_SERVICE_CONFIG, bufSize uint32, bytesNeeded *uint32) (err error) = advapi32.QueryServiceConfigW +//sys ChangeServiceConfig2(service Handle, infoLevel uint32, info *byte) (err error) = advapi32.ChangeServiceConfig2W +//sys QueryServiceConfig2(service Handle, infoLevel uint32, buff *byte, buffSize uint32, bytesNeeded *uint32) (err error) = advapi32.QueryServiceConfig2W +//sys EnumServicesStatusEx(mgr Handle, infoLevel uint32, serviceType uint32, serviceState uint32, services *byte, bufSize uint32, bytesNeeded *uint32, servicesReturned *uint32, resumeHandle *uint32, groupName *uint16) (err error) = advapi32.EnumServicesStatusExW +//sys QueryServiceStatusEx(service Handle, infoLevel uint32, buff *byte, buffSize uint32, bytesNeeded *uint32) (err error) = advapi32.QueryServiceStatusEx +//sys NotifyServiceStatusChange(service Handle, notifyMask uint32, notifier *SERVICE_NOTIFY) (ret error) = advapi32.NotifyServiceStatusChangeW +//sys SubscribeServiceChangeNotifications(service Handle, eventType uint32, callback uintptr, callbackCtx uintptr, subscription *uintptr) (ret error) = sechost.SubscribeServiceChangeNotifications? +//sys UnsubscribeServiceChangeNotifications(subscription uintptr) = sechost.UnsubscribeServiceChangeNotifications? +//sys RegisterServiceCtrlHandlerEx(serviceName *uint16, handlerProc uintptr, context uintptr) (handle Handle, err error) = advapi32.RegisterServiceCtrlHandlerExW +//sys QueryServiceDynamicInformation(service Handle, infoLevel uint32, dynamicInfo unsafe.Pointer) (err error) = advapi32.QueryServiceDynamicInformation? +//sys EnumDependentServices(service Handle, activityState uint32, services *ENUM_SERVICE_STATUS, buffSize uint32, bytesNeeded *uint32, servicesReturned *uint32) (err error) = advapi32.EnumDependentServicesW diff --git a/vendor/golang.org/x/sys/windows/setupapi_windows.go b/vendor/golang.org/x/sys/windows/setupapi_windows.go new file mode 100644 index 00000000..f8126482 --- /dev/null +++ b/vendor/golang.org/x/sys/windows/setupapi_windows.go @@ -0,0 +1,1425 @@ +// Copyright 2021 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +package windows + +import ( + "encoding/binary" + "errors" + "fmt" + "runtime" + "strings" + "syscall" + "unsafe" +) + +// This file contains functions that wrap SetupAPI.dll and CfgMgr32.dll, +// core system functions for managing hardware devices, drivers, and the PnP tree. +// Information about these APIs can be found at: +// https://docs.microsoft.com/en-us/windows-hardware/drivers/install/setupapi +// https://docs.microsoft.com/en-us/windows/win32/devinst/cfgmgr32- + +const ( + ERROR_EXPECTED_SECTION_NAME Errno = 0x20000000 | 0xC0000000 | 0 + ERROR_BAD_SECTION_NAME_LINE Errno = 0x20000000 | 0xC0000000 | 1 + ERROR_SECTION_NAME_TOO_LONG Errno = 0x20000000 | 0xC0000000 | 2 + ERROR_GENERAL_SYNTAX Errno = 0x20000000 | 0xC0000000 | 3 + ERROR_WRONG_INF_STYLE Errno = 0x20000000 | 0xC0000000 | 0x100 + ERROR_SECTION_NOT_FOUND Errno = 0x20000000 | 0xC0000000 | 0x101 + ERROR_LINE_NOT_FOUND Errno = 0x20000000 | 0xC0000000 | 0x102 + ERROR_NO_BACKUP Errno = 0x20000000 | 0xC0000000 | 0x103 + ERROR_NO_ASSOCIATED_CLASS Errno = 0x20000000 | 0xC0000000 | 0x200 + ERROR_CLASS_MISMATCH Errno = 0x20000000 | 0xC0000000 | 0x201 + ERROR_DUPLICATE_FOUND Errno = 0x20000000 | 0xC0000000 | 0x202 + ERROR_NO_DRIVER_SELECTED Errno = 0x20000000 | 0xC0000000 | 0x203 + ERROR_KEY_DOES_NOT_EXIST Errno = 0x20000000 | 0xC0000000 | 0x204 + ERROR_INVALID_DEVINST_NAME Errno = 0x20000000 | 0xC0000000 | 0x205 + ERROR_INVALID_CLASS Errno = 0x20000000 | 0xC0000000 | 0x206 + ERROR_DEVINST_ALREADY_EXISTS Errno = 0x20000000 | 0xC0000000 | 0x207 + ERROR_DEVINFO_NOT_REGISTERED Errno = 0x20000000 | 0xC0000000 | 0x208 + ERROR_INVALID_REG_PROPERTY Errno = 0x20000000 | 0xC0000000 | 0x209 + ERROR_NO_INF Errno = 0x20000000 | 0xC0000000 | 0x20A + ERROR_NO_SUCH_DEVINST Errno = 0x20000000 | 0xC0000000 | 0x20B + ERROR_CANT_LOAD_CLASS_ICON Errno = 0x20000000 | 0xC0000000 | 0x20C + ERROR_INVALID_CLASS_INSTALLER Errno = 0x20000000 | 0xC0000000 | 0x20D + ERROR_DI_DO_DEFAULT Errno = 0x20000000 | 0xC0000000 | 0x20E + ERROR_DI_NOFILECOPY Errno = 0x20000000 | 0xC0000000 | 0x20F + ERROR_INVALID_HWPROFILE Errno = 0x20000000 | 0xC0000000 | 0x210 + ERROR_NO_DEVICE_SELECTED Errno = 0x20000000 | 0xC0000000 | 0x211 + ERROR_DEVINFO_LIST_LOCKED Errno = 0x20000000 | 0xC0000000 | 0x212 + ERROR_DEVINFO_DATA_LOCKED Errno = 0x20000000 | 0xC0000000 | 0x213 + ERROR_DI_BAD_PATH Errno = 0x20000000 | 0xC0000000 | 0x214 + ERROR_NO_CLASSINSTALL_PARAMS Errno = 0x20000000 | 0xC0000000 | 0x215 + ERROR_FILEQUEUE_LOCKED Errno = 0x20000000 | 0xC0000000 | 0x216 + ERROR_BAD_SERVICE_INSTALLSECT Errno = 0x20000000 | 0xC0000000 | 0x217 + ERROR_NO_CLASS_DRIVER_LIST Errno = 0x20000000 | 0xC0000000 | 0x218 + ERROR_NO_ASSOCIATED_SERVICE Errno = 0x20000000 | 0xC0000000 | 0x219 + ERROR_NO_DEFAULT_DEVICE_INTERFACE Errno = 0x20000000 | 0xC0000000 | 0x21A + ERROR_DEVICE_INTERFACE_ACTIVE Errno = 0x20000000 | 0xC0000000 | 0x21B + ERROR_DEVICE_INTERFACE_REMOVED Errno = 0x20000000 | 0xC0000000 | 0x21C + ERROR_BAD_INTERFACE_INSTALLSECT Errno = 0x20000000 | 0xC0000000 | 0x21D + ERROR_NO_SUCH_INTERFACE_CLASS Errno = 0x20000000 | 0xC0000000 | 0x21E + ERROR_INVALID_REFERENCE_STRING Errno = 0x20000000 | 0xC0000000 | 0x21F + ERROR_INVALID_MACHINENAME Errno = 0x20000000 | 0xC0000000 | 0x220 + ERROR_REMOTE_COMM_FAILURE Errno = 0x20000000 | 0xC0000000 | 0x221 + ERROR_MACHINE_UNAVAILABLE Errno = 0x20000000 | 0xC0000000 | 0x222 + ERROR_NO_CONFIGMGR_SERVICES Errno = 0x20000000 | 0xC0000000 | 0x223 + ERROR_INVALID_PROPPAGE_PROVIDER Errno = 0x20000000 | 0xC0000000 | 0x224 + ERROR_NO_SUCH_DEVICE_INTERFACE Errno = 0x20000000 | 0xC0000000 | 0x225 + ERROR_DI_POSTPROCESSING_REQUIRED Errno = 0x20000000 | 0xC0000000 | 0x226 + ERROR_INVALID_COINSTALLER Errno = 0x20000000 | 0xC0000000 | 0x227 + ERROR_NO_COMPAT_DRIVERS Errno = 0x20000000 | 0xC0000000 | 0x228 + ERROR_NO_DEVICE_ICON Errno = 0x20000000 | 0xC0000000 | 0x229 + ERROR_INVALID_INF_LOGCONFIG Errno = 0x20000000 | 0xC0000000 | 0x22A + ERROR_DI_DONT_INSTALL Errno = 0x20000000 | 0xC0000000 | 0x22B + ERROR_INVALID_FILTER_DRIVER Errno = 0x20000000 | 0xC0000000 | 0x22C + ERROR_NON_WINDOWS_NT_DRIVER Errno = 0x20000000 | 0xC0000000 | 0x22D + ERROR_NON_WINDOWS_DRIVER Errno = 0x20000000 | 0xC0000000 | 0x22E + ERROR_NO_CATALOG_FOR_OEM_INF Errno = 0x20000000 | 0xC0000000 | 0x22F + ERROR_DEVINSTALL_QUEUE_NONNATIVE Errno = 0x20000000 | 0xC0000000 | 0x230 + ERROR_NOT_DISABLEABLE Errno = 0x20000000 | 0xC0000000 | 0x231 + ERROR_CANT_REMOVE_DEVINST Errno = 0x20000000 | 0xC0000000 | 0x232 + ERROR_INVALID_TARGET Errno = 0x20000000 | 0xC0000000 | 0x233 + ERROR_DRIVER_NONNATIVE Errno = 0x20000000 | 0xC0000000 | 0x234 + ERROR_IN_WOW64 Errno = 0x20000000 | 0xC0000000 | 0x235 + ERROR_SET_SYSTEM_RESTORE_POINT Errno = 0x20000000 | 0xC0000000 | 0x236 + ERROR_SCE_DISABLED Errno = 0x20000000 | 0xC0000000 | 0x238 + ERROR_UNKNOWN_EXCEPTION Errno = 0x20000000 | 0xC0000000 | 0x239 + ERROR_PNP_REGISTRY_ERROR Errno = 0x20000000 | 0xC0000000 | 0x23A + ERROR_REMOTE_REQUEST_UNSUPPORTED Errno = 0x20000000 | 0xC0000000 | 0x23B + ERROR_NOT_AN_INSTALLED_OEM_INF Errno = 0x20000000 | 0xC0000000 | 0x23C + ERROR_INF_IN_USE_BY_DEVICES Errno = 0x20000000 | 0xC0000000 | 0x23D + ERROR_DI_FUNCTION_OBSOLETE Errno = 0x20000000 | 0xC0000000 | 0x23E + ERROR_NO_AUTHENTICODE_CATALOG Errno = 0x20000000 | 0xC0000000 | 0x23F + ERROR_AUTHENTICODE_DISALLOWED Errno = 0x20000000 | 0xC0000000 | 0x240 + ERROR_AUTHENTICODE_TRUSTED_PUBLISHER Errno = 0x20000000 | 0xC0000000 | 0x241 + ERROR_AUTHENTICODE_TRUST_NOT_ESTABLISHED Errno = 0x20000000 | 0xC0000000 | 0x242 + ERROR_AUTHENTICODE_PUBLISHER_NOT_TRUSTED Errno = 0x20000000 | 0xC0000000 | 0x243 + ERROR_SIGNATURE_OSATTRIBUTE_MISMATCH Errno = 0x20000000 | 0xC0000000 | 0x244 + ERROR_ONLY_VALIDATE_VIA_AUTHENTICODE Errno = 0x20000000 | 0xC0000000 | 0x245 + ERROR_DEVICE_INSTALLER_NOT_READY Errno = 0x20000000 | 0xC0000000 | 0x246 + ERROR_DRIVER_STORE_ADD_FAILED Errno = 0x20000000 | 0xC0000000 | 0x247 + ERROR_DEVICE_INSTALL_BLOCKED Errno = 0x20000000 | 0xC0000000 | 0x248 + ERROR_DRIVER_INSTALL_BLOCKED Errno = 0x20000000 | 0xC0000000 | 0x249 + ERROR_WRONG_INF_TYPE Errno = 0x20000000 | 0xC0000000 | 0x24A + ERROR_FILE_HASH_NOT_IN_CATALOG Errno = 0x20000000 | 0xC0000000 | 0x24B + ERROR_DRIVER_STORE_DELETE_FAILED Errno = 0x20000000 | 0xC0000000 | 0x24C + ERROR_UNRECOVERABLE_STACK_OVERFLOW Errno = 0x20000000 | 0xC0000000 | 0x300 + EXCEPTION_SPAPI_UNRECOVERABLE_STACK_OVERFLOW Errno = ERROR_UNRECOVERABLE_STACK_OVERFLOW + ERROR_NO_DEFAULT_INTERFACE_DEVICE Errno = ERROR_NO_DEFAULT_DEVICE_INTERFACE + ERROR_INTERFACE_DEVICE_ACTIVE Errno = ERROR_DEVICE_INTERFACE_ACTIVE + ERROR_INTERFACE_DEVICE_REMOVED Errno = ERROR_DEVICE_INTERFACE_REMOVED + ERROR_NO_SUCH_INTERFACE_DEVICE Errno = ERROR_NO_SUCH_DEVICE_INTERFACE +) + +const ( + MAX_DEVICE_ID_LEN = 200 + MAX_DEVNODE_ID_LEN = MAX_DEVICE_ID_LEN + MAX_GUID_STRING_LEN = 39 // 38 chars + terminator null + MAX_CLASS_NAME_LEN = 32 + MAX_PROFILE_LEN = 80 + MAX_CONFIG_VALUE = 9999 + MAX_INSTANCE_VALUE = 9999 + CONFIGMG_VERSION = 0x0400 +) + +// Maximum string length constants +const ( + LINE_LEN = 256 // Windows 9x-compatible maximum for displayable strings coming from a device INF. + MAX_INF_STRING_LENGTH = 4096 // Actual maximum size of an INF string (including string substitutions). + MAX_INF_SECTION_NAME_LENGTH = 255 // For Windows 9x compatibility, INF section names should be constrained to 32 characters. + MAX_TITLE_LEN = 60 + MAX_INSTRUCTION_LEN = 256 + MAX_LABEL_LEN = 30 + MAX_SERVICE_NAME_LEN = 256 + MAX_SUBTITLE_LEN = 256 +) + +const ( + // SP_MAX_MACHINENAME_LENGTH defines maximum length of a machine name in the format expected by ConfigMgr32 CM_Connect_Machine (i.e., "\\\\MachineName\0"). + SP_MAX_MACHINENAME_LENGTH = MAX_PATH + 3 +) + +// HSPFILEQ is type for setup file queue +type HSPFILEQ uintptr + +// DevInfo holds reference to device information set +type DevInfo Handle + +// DEVINST is a handle usually recognized by cfgmgr32 APIs +type DEVINST uint32 + +// DevInfoData is a device information structure (references a device instance that is a member of a device information set) +type DevInfoData struct { + size uint32 + ClassGUID GUID + DevInst DEVINST + _ uintptr +} + +// DevInfoListDetailData is a structure for detailed information on a device information set (used for SetupDiGetDeviceInfoListDetail which supersedes the functionality of SetupDiGetDeviceInfoListClass). +type DevInfoListDetailData struct { + size uint32 // Use unsafeSizeOf method + ClassGUID GUID + RemoteMachineHandle Handle + remoteMachineName [SP_MAX_MACHINENAME_LENGTH]uint16 +} + +func (*DevInfoListDetailData) unsafeSizeOf() uint32 { + if unsafe.Sizeof(uintptr(0)) == 4 { + // Windows declares this with pshpack1.h + return uint32(unsafe.Offsetof(DevInfoListDetailData{}.remoteMachineName) + unsafe.Sizeof(DevInfoListDetailData{}.remoteMachineName)) + } + return uint32(unsafe.Sizeof(DevInfoListDetailData{})) +} + +func (data *DevInfoListDetailData) RemoteMachineName() string { + return UTF16ToString(data.remoteMachineName[:]) +} + +func (data *DevInfoListDetailData) SetRemoteMachineName(remoteMachineName string) error { + str, err := UTF16FromString(remoteMachineName) + if err != nil { + return err + } + copy(data.remoteMachineName[:], str) + return nil +} + +// DI_FUNCTION is function type for device installer +type DI_FUNCTION uint32 + +const ( + DIF_SELECTDEVICE DI_FUNCTION = 0x00000001 + DIF_INSTALLDEVICE DI_FUNCTION = 0x00000002 + DIF_ASSIGNRESOURCES DI_FUNCTION = 0x00000003 + DIF_PROPERTIES DI_FUNCTION = 0x00000004 + DIF_REMOVE DI_FUNCTION = 0x00000005 + DIF_FIRSTTIMESETUP DI_FUNCTION = 0x00000006 + DIF_FOUNDDEVICE DI_FUNCTION = 0x00000007 + DIF_SELECTCLASSDRIVERS DI_FUNCTION = 0x00000008 + DIF_VALIDATECLASSDRIVERS DI_FUNCTION = 0x00000009 + DIF_INSTALLCLASSDRIVERS DI_FUNCTION = 0x0000000A + DIF_CALCDISKSPACE DI_FUNCTION = 0x0000000B + DIF_DESTROYPRIVATEDATA DI_FUNCTION = 0x0000000C + DIF_VALIDATEDRIVER DI_FUNCTION = 0x0000000D + DIF_DETECT DI_FUNCTION = 0x0000000F + DIF_INSTALLWIZARD DI_FUNCTION = 0x00000010 + DIF_DESTROYWIZARDDATA DI_FUNCTION = 0x00000011 + DIF_PROPERTYCHANGE DI_FUNCTION = 0x00000012 + DIF_ENABLECLASS DI_FUNCTION = 0x00000013 + DIF_DETECTVERIFY DI_FUNCTION = 0x00000014 + DIF_INSTALLDEVICEFILES DI_FUNCTION = 0x00000015 + DIF_UNREMOVE DI_FUNCTION = 0x00000016 + DIF_SELECTBESTCOMPATDRV DI_FUNCTION = 0x00000017 + DIF_ALLOW_INSTALL DI_FUNCTION = 0x00000018 + DIF_REGISTERDEVICE DI_FUNCTION = 0x00000019 + DIF_NEWDEVICEWIZARD_PRESELECT DI_FUNCTION = 0x0000001A + DIF_NEWDEVICEWIZARD_SELECT DI_FUNCTION = 0x0000001B + DIF_NEWDEVICEWIZARD_PREANALYZE DI_FUNCTION = 0x0000001C + DIF_NEWDEVICEWIZARD_POSTANALYZE DI_FUNCTION = 0x0000001D + DIF_NEWDEVICEWIZARD_FINISHINSTALL DI_FUNCTION = 0x0000001E + DIF_INSTALLINTERFACES DI_FUNCTION = 0x00000020 + DIF_DETECTCANCEL DI_FUNCTION = 0x00000021 + DIF_REGISTER_COINSTALLERS DI_FUNCTION = 0x00000022 + DIF_ADDPROPERTYPAGE_ADVANCED DI_FUNCTION = 0x00000023 + DIF_ADDPROPERTYPAGE_BASIC DI_FUNCTION = 0x00000024 + DIF_TROUBLESHOOTER DI_FUNCTION = 0x00000026 + DIF_POWERMESSAGEWAKE DI_FUNCTION = 0x00000027 + DIF_ADDREMOTEPROPERTYPAGE_ADVANCED DI_FUNCTION = 0x00000028 + DIF_UPDATEDRIVER_UI DI_FUNCTION = 0x00000029 + DIF_FINISHINSTALL_ACTION DI_FUNCTION = 0x0000002A +) + +// DevInstallParams is device installation parameters structure (associated with a particular device information element, or globally with a device information set) +type DevInstallParams struct { + size uint32 + Flags DI_FLAGS + FlagsEx DI_FLAGSEX + hwndParent uintptr + InstallMsgHandler uintptr + InstallMsgHandlerContext uintptr + FileQueue HSPFILEQ + _ uintptr + _ uint32 + driverPath [MAX_PATH]uint16 +} + +func (params *DevInstallParams) DriverPath() string { + return UTF16ToString(params.driverPath[:]) +} + +func (params *DevInstallParams) SetDriverPath(driverPath string) error { + str, err := UTF16FromString(driverPath) + if err != nil { + return err + } + copy(params.driverPath[:], str) + return nil +} + +// DI_FLAGS is SP_DEVINSTALL_PARAMS.Flags values +type DI_FLAGS uint32 + +const ( + // Flags for choosing a device + DI_SHOWOEM DI_FLAGS = 0x00000001 // support Other... button + DI_SHOWCOMPAT DI_FLAGS = 0x00000002 // show compatibility list + DI_SHOWCLASS DI_FLAGS = 0x00000004 // show class list + DI_SHOWALL DI_FLAGS = 0x00000007 // both class & compat list shown + DI_NOVCP DI_FLAGS = 0x00000008 // don't create a new copy queue--use caller-supplied FileQueue + DI_DIDCOMPAT DI_FLAGS = 0x00000010 // Searched for compatible devices + DI_DIDCLASS DI_FLAGS = 0x00000020 // Searched for class devices + DI_AUTOASSIGNRES DI_FLAGS = 0x00000040 // No UI for resources if possible + + // Flags returned by DiInstallDevice to indicate need to reboot/restart + DI_NEEDRESTART DI_FLAGS = 0x00000080 // Reboot required to take effect + DI_NEEDREBOOT DI_FLAGS = 0x00000100 // "" + + // Flags for device installation + DI_NOBROWSE DI_FLAGS = 0x00000200 // no Browse... in InsertDisk + + // Flags set by DiBuildDriverInfoList + DI_MULTMFGS DI_FLAGS = 0x00000400 // Set if multiple manufacturers in class driver list + + // Flag indicates that device is disabled + DI_DISABLED DI_FLAGS = 0x00000800 // Set if device disabled + + // Flags for Device/Class Properties + DI_GENERALPAGE_ADDED DI_FLAGS = 0x00001000 + DI_RESOURCEPAGE_ADDED DI_FLAGS = 0x00002000 + + // Flag to indicate the setting properties for this Device (or class) caused a change so the Dev Mgr UI probably needs to be updated. + DI_PROPERTIES_CHANGE DI_FLAGS = 0x00004000 + + // Flag to indicate that the sorting from the INF file should be used. + DI_INF_IS_SORTED DI_FLAGS = 0x00008000 + + // Flag to indicate that only the INF specified by SP_DEVINSTALL_PARAMS.DriverPath should be searched. + DI_ENUMSINGLEINF DI_FLAGS = 0x00010000 + + // Flag that prevents ConfigMgr from removing/re-enumerating devices during device + // registration, installation, and deletion. + DI_DONOTCALLCONFIGMG DI_FLAGS = 0x00020000 + + // The following flag can be used to install a device disabled + DI_INSTALLDISABLED DI_FLAGS = 0x00040000 + + // Flag that causes SetupDiBuildDriverInfoList to build a device's compatible driver + // list from its existing class driver list, instead of the normal INF search. + DI_COMPAT_FROM_CLASS DI_FLAGS = 0x00080000 + + // This flag is set if the Class Install params should be used. + DI_CLASSINSTALLPARAMS DI_FLAGS = 0x00100000 + + // This flag is set if the caller of DiCallClassInstaller does NOT want the internal default action performed if the Class installer returns ERROR_DI_DO_DEFAULT. + DI_NODI_DEFAULTACTION DI_FLAGS = 0x00200000 + + // Flags for device installation + DI_QUIETINSTALL DI_FLAGS = 0x00800000 // don't confuse the user with questions or excess info + DI_NOFILECOPY DI_FLAGS = 0x01000000 // No file Copy necessary + DI_FORCECOPY DI_FLAGS = 0x02000000 // Force files to be copied from install path + DI_DRIVERPAGE_ADDED DI_FLAGS = 0x04000000 // Prop provider added Driver page. + DI_USECI_SELECTSTRINGS DI_FLAGS = 0x08000000 // Use Class Installer Provided strings in the Select Device Dlg + DI_OVERRIDE_INFFLAGS DI_FLAGS = 0x10000000 // Override INF flags + DI_PROPS_NOCHANGEUSAGE DI_FLAGS = 0x20000000 // No Enable/Disable in General Props + + DI_NOSELECTICONS DI_FLAGS = 0x40000000 // No small icons in select device dialogs + + DI_NOWRITE_IDS DI_FLAGS = 0x80000000 // Don't write HW & Compat IDs on install +) + +// DI_FLAGSEX is SP_DEVINSTALL_PARAMS.FlagsEx values +type DI_FLAGSEX uint32 + +const ( + DI_FLAGSEX_CI_FAILED DI_FLAGSEX = 0x00000004 // Failed to Load/Call class installer + DI_FLAGSEX_FINISHINSTALL_ACTION DI_FLAGSEX = 0x00000008 // Class/co-installer wants to get a DIF_FINISH_INSTALL action in client context. + DI_FLAGSEX_DIDINFOLIST DI_FLAGSEX = 0x00000010 // Did the Class Info List + DI_FLAGSEX_DIDCOMPATINFO DI_FLAGSEX = 0x00000020 // Did the Compat Info List + DI_FLAGSEX_FILTERCLASSES DI_FLAGSEX = 0x00000040 + DI_FLAGSEX_SETFAILEDINSTALL DI_FLAGSEX = 0x00000080 + DI_FLAGSEX_DEVICECHANGE DI_FLAGSEX = 0x00000100 + DI_FLAGSEX_ALWAYSWRITEIDS DI_FLAGSEX = 0x00000200 + DI_FLAGSEX_PROPCHANGE_PENDING DI_FLAGSEX = 0x00000400 // One or more device property sheets have had changes made to them, and need to have a DIF_PROPERTYCHANGE occur. + DI_FLAGSEX_ALLOWEXCLUDEDDRVS DI_FLAGSEX = 0x00000800 + DI_FLAGSEX_NOUIONQUERYREMOVE DI_FLAGSEX = 0x00001000 + DI_FLAGSEX_USECLASSFORCOMPAT DI_FLAGSEX = 0x00002000 // Use the device's class when building compat drv list. (Ignored if DI_COMPAT_FROM_CLASS flag is specified.) + DI_FLAGSEX_NO_DRVREG_MODIFY DI_FLAGSEX = 0x00008000 // Don't run AddReg and DelReg for device's software (driver) key. + DI_FLAGSEX_IN_SYSTEM_SETUP DI_FLAGSEX = 0x00010000 // Installation is occurring during initial system setup. + DI_FLAGSEX_INET_DRIVER DI_FLAGSEX = 0x00020000 // Driver came from Windows Update + DI_FLAGSEX_APPENDDRIVERLIST DI_FLAGSEX = 0x00040000 // Cause SetupDiBuildDriverInfoList to append a new driver list to an existing list. + DI_FLAGSEX_PREINSTALLBACKUP DI_FLAGSEX = 0x00080000 // not used + DI_FLAGSEX_BACKUPONREPLACE DI_FLAGSEX = 0x00100000 // not used + DI_FLAGSEX_DRIVERLIST_FROM_URL DI_FLAGSEX = 0x00200000 // build driver list from INF(s) retrieved from URL specified in SP_DEVINSTALL_PARAMS.DriverPath (empty string means Windows Update website) + DI_FLAGSEX_EXCLUDE_OLD_INET_DRIVERS DI_FLAGSEX = 0x00800000 // Don't include old Internet drivers when building a driver list. Ignored on Windows Vista and later. + DI_FLAGSEX_POWERPAGE_ADDED DI_FLAGSEX = 0x01000000 // class installer added their own power page + DI_FLAGSEX_FILTERSIMILARDRIVERS DI_FLAGSEX = 0x02000000 // only include similar drivers in class list + DI_FLAGSEX_INSTALLEDDRIVER DI_FLAGSEX = 0x04000000 // only add the installed driver to the class or compat driver list. Used in calls to SetupDiBuildDriverInfoList + DI_FLAGSEX_NO_CLASSLIST_NODE_MERGE DI_FLAGSEX = 0x08000000 // Don't remove identical driver nodes from the class list + DI_FLAGSEX_ALTPLATFORM_DRVSEARCH DI_FLAGSEX = 0x10000000 // Build driver list based on alternate platform information specified in associated file queue + DI_FLAGSEX_RESTART_DEVICE_ONLY DI_FLAGSEX = 0x20000000 // only restart the device drivers are being installed on as opposed to restarting all devices using those drivers. + DI_FLAGSEX_RECURSIVESEARCH DI_FLAGSEX = 0x40000000 // Tell SetupDiBuildDriverInfoList to do a recursive search + DI_FLAGSEX_SEARCH_PUBLISHED_INFS DI_FLAGSEX = 0x80000000 // Tell SetupDiBuildDriverInfoList to do a "published INF" search +) + +// ClassInstallHeader is the first member of any class install parameters structure. It contains the device installation request code that defines the format of the rest of the install parameters structure. +type ClassInstallHeader struct { + size uint32 + InstallFunction DI_FUNCTION +} + +func MakeClassInstallHeader(installFunction DI_FUNCTION) *ClassInstallHeader { + hdr := &ClassInstallHeader{InstallFunction: installFunction} + hdr.size = uint32(unsafe.Sizeof(*hdr)) + return hdr +} + +// DICS_STATE specifies values indicating a change in a device's state +type DICS_STATE uint32 + +const ( + DICS_ENABLE DICS_STATE = 0x00000001 // The device is being enabled. + DICS_DISABLE DICS_STATE = 0x00000002 // The device is being disabled. + DICS_PROPCHANGE DICS_STATE = 0x00000003 // The properties of the device have changed. + DICS_START DICS_STATE = 0x00000004 // The device is being started (if the request is for the currently active hardware profile). + DICS_STOP DICS_STATE = 0x00000005 // The device is being stopped. The driver stack will be unloaded and the CSCONFIGFLAG_DO_NOT_START flag will be set for the device. +) + +// DICS_FLAG specifies the scope of a device property change +type DICS_FLAG uint32 + +const ( + DICS_FLAG_GLOBAL DICS_FLAG = 0x00000001 // make change in all hardware profiles + DICS_FLAG_CONFIGSPECIFIC DICS_FLAG = 0x00000002 // make change in specified profile only + DICS_FLAG_CONFIGGENERAL DICS_FLAG = 0x00000004 // 1 or more hardware profile-specific changes to follow (obsolete) +) + +// PropChangeParams is a structure corresponding to a DIF_PROPERTYCHANGE install function. +type PropChangeParams struct { + ClassInstallHeader ClassInstallHeader + StateChange DICS_STATE + Scope DICS_FLAG + HwProfile uint32 +} + +// DI_REMOVEDEVICE specifies the scope of the device removal +type DI_REMOVEDEVICE uint32 + +const ( + DI_REMOVEDEVICE_GLOBAL DI_REMOVEDEVICE = 0x00000001 // Make this change in all hardware profiles. Remove information about the device from the registry. + DI_REMOVEDEVICE_CONFIGSPECIFIC DI_REMOVEDEVICE = 0x00000002 // Make this change to only the hardware profile specified by HwProfile. this flag only applies to root-enumerated devices. When Windows removes the device from the last hardware profile in which it was configured, Windows performs a global removal. +) + +// RemoveDeviceParams is a structure corresponding to a DIF_REMOVE install function. +type RemoveDeviceParams struct { + ClassInstallHeader ClassInstallHeader + Scope DI_REMOVEDEVICE + HwProfile uint32 +} + +// DrvInfoData is driver information structure (member of a driver info list that may be associated with a particular device instance, or (globally) with a device information set) +type DrvInfoData struct { + size uint32 + DriverType uint32 + _ uintptr + description [LINE_LEN]uint16 + mfgName [LINE_LEN]uint16 + providerName [LINE_LEN]uint16 + DriverDate Filetime + DriverVersion uint64 +} + +func (data *DrvInfoData) Description() string { + return UTF16ToString(data.description[:]) +} + +func (data *DrvInfoData) SetDescription(description string) error { + str, err := UTF16FromString(description) + if err != nil { + return err + } + copy(data.description[:], str) + return nil +} + +func (data *DrvInfoData) MfgName() string { + return UTF16ToString(data.mfgName[:]) +} + +func (data *DrvInfoData) SetMfgName(mfgName string) error { + str, err := UTF16FromString(mfgName) + if err != nil { + return err + } + copy(data.mfgName[:], str) + return nil +} + +func (data *DrvInfoData) ProviderName() string { + return UTF16ToString(data.providerName[:]) +} + +func (data *DrvInfoData) SetProviderName(providerName string) error { + str, err := UTF16FromString(providerName) + if err != nil { + return err + } + copy(data.providerName[:], str) + return nil +} + +// IsNewer method returns true if DrvInfoData date and version is newer than supplied parameters. +func (data *DrvInfoData) IsNewer(driverDate Filetime, driverVersion uint64) bool { + if data.DriverDate.HighDateTime > driverDate.HighDateTime { + return true + } + if data.DriverDate.HighDateTime < driverDate.HighDateTime { + return false + } + + if data.DriverDate.LowDateTime > driverDate.LowDateTime { + return true + } + if data.DriverDate.LowDateTime < driverDate.LowDateTime { + return false + } + + if data.DriverVersion > driverVersion { + return true + } + if data.DriverVersion < driverVersion { + return false + } + + return false +} + +// DrvInfoDetailData is driver information details structure (provides detailed information about a particular driver information structure) +type DrvInfoDetailData struct { + size uint32 // Use unsafeSizeOf method + InfDate Filetime + compatIDsOffset uint32 + compatIDsLength uint32 + _ uintptr + sectionName [LINE_LEN]uint16 + infFileName [MAX_PATH]uint16 + drvDescription [LINE_LEN]uint16 + hardwareID [1]uint16 +} + +func (*DrvInfoDetailData) unsafeSizeOf() uint32 { + if unsafe.Sizeof(uintptr(0)) == 4 { + // Windows declares this with pshpack1.h + return uint32(unsafe.Offsetof(DrvInfoDetailData{}.hardwareID) + unsafe.Sizeof(DrvInfoDetailData{}.hardwareID)) + } + return uint32(unsafe.Sizeof(DrvInfoDetailData{})) +} + +func (data *DrvInfoDetailData) SectionName() string { + return UTF16ToString(data.sectionName[:]) +} + +func (data *DrvInfoDetailData) InfFileName() string { + return UTF16ToString(data.infFileName[:]) +} + +func (data *DrvInfoDetailData) DrvDescription() string { + return UTF16ToString(data.drvDescription[:]) +} + +func (data *DrvInfoDetailData) HardwareID() string { + if data.compatIDsOffset > 1 { + bufW := data.getBuf() + return UTF16ToString(bufW[:wcslen(bufW)]) + } + + return "" +} + +func (data *DrvInfoDetailData) CompatIDs() []string { + a := make([]string, 0) + + if data.compatIDsLength > 0 { + bufW := data.getBuf() + bufW = bufW[data.compatIDsOffset : data.compatIDsOffset+data.compatIDsLength] + for i := 0; i < len(bufW); { + j := i + wcslen(bufW[i:]) + if i < j { + a = append(a, UTF16ToString(bufW[i:j])) + } + i = j + 1 + } + } + + return a +} + +func (data *DrvInfoDetailData) getBuf() []uint16 { + len := (data.size - uint32(unsafe.Offsetof(data.hardwareID))) / 2 + sl := struct { + addr *uint16 + len int + cap int + }{&data.hardwareID[0], int(len), int(len)} + return *(*[]uint16)(unsafe.Pointer(&sl)) +} + +// IsCompatible method tests if given hardware ID matches the driver or is listed on the compatible ID list. +func (data *DrvInfoDetailData) IsCompatible(hwid string) bool { + hwidLC := strings.ToLower(hwid) + if strings.ToLower(data.HardwareID()) == hwidLC { + return true + } + a := data.CompatIDs() + for i := range a { + if strings.ToLower(a[i]) == hwidLC { + return true + } + } + + return false +} + +// DICD flags control SetupDiCreateDeviceInfo +type DICD uint32 + +const ( + DICD_GENERATE_ID DICD = 0x00000001 + DICD_INHERIT_CLASSDRVS DICD = 0x00000002 +) + +// SUOI flags control SetupUninstallOEMInf +type SUOI uint32 + +const ( + SUOI_FORCEDELETE SUOI = 0x0001 +) + +// SPDIT flags to distinguish between class drivers and +// device drivers. (Passed in 'DriverType' parameter of +// driver information list APIs) +type SPDIT uint32 + +const ( + SPDIT_NODRIVER SPDIT = 0x00000000 + SPDIT_CLASSDRIVER SPDIT = 0x00000001 + SPDIT_COMPATDRIVER SPDIT = 0x00000002 +) + +// DIGCF flags control what is included in the device information set built by SetupDiGetClassDevs +type DIGCF uint32 + +const ( + DIGCF_DEFAULT DIGCF = 0x00000001 // only valid with DIGCF_DEVICEINTERFACE + DIGCF_PRESENT DIGCF = 0x00000002 + DIGCF_ALLCLASSES DIGCF = 0x00000004 + DIGCF_PROFILE DIGCF = 0x00000008 + DIGCF_DEVICEINTERFACE DIGCF = 0x00000010 +) + +// DIREG specifies values for SetupDiCreateDevRegKey, SetupDiOpenDevRegKey, and SetupDiDeleteDevRegKey. +type DIREG uint32 + +const ( + DIREG_DEV DIREG = 0x00000001 // Open/Create/Delete device key + DIREG_DRV DIREG = 0x00000002 // Open/Create/Delete driver key + DIREG_BOTH DIREG = 0x00000004 // Delete both driver and Device key +) + +// SPDRP specifies device registry property codes +// (Codes marked as read-only (R) may only be used for +// SetupDiGetDeviceRegistryProperty) +// +// These values should cover the same set of registry properties +// as defined by the CM_DRP codes in cfgmgr32.h. +// +// Note that SPDRP codes are zero based while CM_DRP codes are one based! +type SPDRP uint32 + +const ( + SPDRP_DEVICEDESC SPDRP = 0x00000000 // DeviceDesc (R/W) + SPDRP_HARDWAREID SPDRP = 0x00000001 // HardwareID (R/W) + SPDRP_COMPATIBLEIDS SPDRP = 0x00000002 // CompatibleIDs (R/W) + SPDRP_SERVICE SPDRP = 0x00000004 // Service (R/W) + SPDRP_CLASS SPDRP = 0x00000007 // Class (R--tied to ClassGUID) + SPDRP_CLASSGUID SPDRP = 0x00000008 // ClassGUID (R/W) + SPDRP_DRIVER SPDRP = 0x00000009 // Driver (R/W) + SPDRP_CONFIGFLAGS SPDRP = 0x0000000A // ConfigFlags (R/W) + SPDRP_MFG SPDRP = 0x0000000B // Mfg (R/W) + SPDRP_FRIENDLYNAME SPDRP = 0x0000000C // FriendlyName (R/W) + SPDRP_LOCATION_INFORMATION SPDRP = 0x0000000D // LocationInformation (R/W) + SPDRP_PHYSICAL_DEVICE_OBJECT_NAME SPDRP = 0x0000000E // PhysicalDeviceObjectName (R) + SPDRP_CAPABILITIES SPDRP = 0x0000000F // Capabilities (R) + SPDRP_UI_NUMBER SPDRP = 0x00000010 // UiNumber (R) + SPDRP_UPPERFILTERS SPDRP = 0x00000011 // UpperFilters (R/W) + SPDRP_LOWERFILTERS SPDRP = 0x00000012 // LowerFilters (R/W) + SPDRP_BUSTYPEGUID SPDRP = 0x00000013 // BusTypeGUID (R) + SPDRP_LEGACYBUSTYPE SPDRP = 0x00000014 // LegacyBusType (R) + SPDRP_BUSNUMBER SPDRP = 0x00000015 // BusNumber (R) + SPDRP_ENUMERATOR_NAME SPDRP = 0x00000016 // Enumerator Name (R) + SPDRP_SECURITY SPDRP = 0x00000017 // Security (R/W, binary form) + SPDRP_SECURITY_SDS SPDRP = 0x00000018 // Security (W, SDS form) + SPDRP_DEVTYPE SPDRP = 0x00000019 // Device Type (R/W) + SPDRP_EXCLUSIVE SPDRP = 0x0000001A // Device is exclusive-access (R/W) + SPDRP_CHARACTERISTICS SPDRP = 0x0000001B // Device Characteristics (R/W) + SPDRP_ADDRESS SPDRP = 0x0000001C // Device Address (R) + SPDRP_UI_NUMBER_DESC_FORMAT SPDRP = 0x0000001D // UiNumberDescFormat (R/W) + SPDRP_DEVICE_POWER_DATA SPDRP = 0x0000001E // Device Power Data (R) + SPDRP_REMOVAL_POLICY SPDRP = 0x0000001F // Removal Policy (R) + SPDRP_REMOVAL_POLICY_HW_DEFAULT SPDRP = 0x00000020 // Hardware Removal Policy (R) + SPDRP_REMOVAL_POLICY_OVERRIDE SPDRP = 0x00000021 // Removal Policy Override (RW) + SPDRP_INSTALL_STATE SPDRP = 0x00000022 // Device Install State (R) + SPDRP_LOCATION_PATHS SPDRP = 0x00000023 // Device Location Paths (R) + SPDRP_BASE_CONTAINERID SPDRP = 0x00000024 // Base ContainerID (R) + + SPDRP_MAXIMUM_PROPERTY SPDRP = 0x00000025 // Upper bound on ordinals +) + +// DEVPROPTYPE represents the property-data-type identifier that specifies the +// data type of a device property value in the unified device property model. +type DEVPROPTYPE uint32 + +const ( + DEVPROP_TYPEMOD_ARRAY DEVPROPTYPE = 0x00001000 + DEVPROP_TYPEMOD_LIST DEVPROPTYPE = 0x00002000 + + DEVPROP_TYPE_EMPTY DEVPROPTYPE = 0x00000000 + DEVPROP_TYPE_NULL DEVPROPTYPE = 0x00000001 + DEVPROP_TYPE_SBYTE DEVPROPTYPE = 0x00000002 + DEVPROP_TYPE_BYTE DEVPROPTYPE = 0x00000003 + DEVPROP_TYPE_INT16 DEVPROPTYPE = 0x00000004 + DEVPROP_TYPE_UINT16 DEVPROPTYPE = 0x00000005 + DEVPROP_TYPE_INT32 DEVPROPTYPE = 0x00000006 + DEVPROP_TYPE_UINT32 DEVPROPTYPE = 0x00000007 + DEVPROP_TYPE_INT64 DEVPROPTYPE = 0x00000008 + DEVPROP_TYPE_UINT64 DEVPROPTYPE = 0x00000009 + DEVPROP_TYPE_FLOAT DEVPROPTYPE = 0x0000000A + DEVPROP_TYPE_DOUBLE DEVPROPTYPE = 0x0000000B + DEVPROP_TYPE_DECIMAL DEVPROPTYPE = 0x0000000C + DEVPROP_TYPE_GUID DEVPROPTYPE = 0x0000000D + DEVPROP_TYPE_CURRENCY DEVPROPTYPE = 0x0000000E + DEVPROP_TYPE_DATE DEVPROPTYPE = 0x0000000F + DEVPROP_TYPE_FILETIME DEVPROPTYPE = 0x00000010 + DEVPROP_TYPE_BOOLEAN DEVPROPTYPE = 0x00000011 + DEVPROP_TYPE_STRING DEVPROPTYPE = 0x00000012 + DEVPROP_TYPE_STRING_LIST DEVPROPTYPE = DEVPROP_TYPE_STRING | DEVPROP_TYPEMOD_LIST + DEVPROP_TYPE_SECURITY_DESCRIPTOR DEVPROPTYPE = 0x00000013 + DEVPROP_TYPE_SECURITY_DESCRIPTOR_STRING DEVPROPTYPE = 0x00000014 + DEVPROP_TYPE_DEVPROPKEY DEVPROPTYPE = 0x00000015 + DEVPROP_TYPE_DEVPROPTYPE DEVPROPTYPE = 0x00000016 + DEVPROP_TYPE_BINARY DEVPROPTYPE = DEVPROP_TYPE_BYTE | DEVPROP_TYPEMOD_ARRAY + DEVPROP_TYPE_ERROR DEVPROPTYPE = 0x00000017 + DEVPROP_TYPE_NTSTATUS DEVPROPTYPE = 0x00000018 + DEVPROP_TYPE_STRING_INDIRECT DEVPROPTYPE = 0x00000019 + + MAX_DEVPROP_TYPE DEVPROPTYPE = 0x00000019 + MAX_DEVPROP_TYPEMOD DEVPROPTYPE = 0x00002000 + + DEVPROP_MASK_TYPE DEVPROPTYPE = 0x00000FFF + DEVPROP_MASK_TYPEMOD DEVPROPTYPE = 0x0000F000 +) + +// DEVPROPGUID specifies a property category. +type DEVPROPGUID GUID + +// DEVPROPID uniquely identifies the property within the property category. +type DEVPROPID uint32 + +const DEVPROPID_FIRST_USABLE DEVPROPID = 2 + +// DEVPROPKEY represents a device property key for a device property in the +// unified device property model. +type DEVPROPKEY struct { + FmtID DEVPROPGUID + PID DEVPROPID +} + +// CONFIGRET is a return value or error code from cfgmgr32 APIs +type CONFIGRET uint32 + +func (ret CONFIGRET) Error() string { + if win32Error, ok := ret.Unwrap().(Errno); ok { + return fmt.Sprintf("%s (CfgMgr error: 0x%08x)", win32Error.Error(), uint32(ret)) + } + return fmt.Sprintf("CfgMgr error: 0x%08x", uint32(ret)) +} + +func (ret CONFIGRET) Win32Error(defaultError Errno) Errno { + return cm_MapCrToWin32Err(ret, defaultError) +} + +func (ret CONFIGRET) Unwrap() error { + const noMatch = Errno(^uintptr(0)) + win32Error := ret.Win32Error(noMatch) + if win32Error == noMatch { + return nil + } + return win32Error +} + +const ( + CR_SUCCESS CONFIGRET = 0x00000000 + CR_DEFAULT CONFIGRET = 0x00000001 + CR_OUT_OF_MEMORY CONFIGRET = 0x00000002 + CR_INVALID_POINTER CONFIGRET = 0x00000003 + CR_INVALID_FLAG CONFIGRET = 0x00000004 + CR_INVALID_DEVNODE CONFIGRET = 0x00000005 + CR_INVALID_DEVINST = CR_INVALID_DEVNODE + CR_INVALID_RES_DES CONFIGRET = 0x00000006 + CR_INVALID_LOG_CONF CONFIGRET = 0x00000007 + CR_INVALID_ARBITRATOR CONFIGRET = 0x00000008 + CR_INVALID_NODELIST CONFIGRET = 0x00000009 + CR_DEVNODE_HAS_REQS CONFIGRET = 0x0000000A + CR_DEVINST_HAS_REQS = CR_DEVNODE_HAS_REQS + CR_INVALID_RESOURCEID CONFIGRET = 0x0000000B + CR_DLVXD_NOT_FOUND CONFIGRET = 0x0000000C + CR_NO_SUCH_DEVNODE CONFIGRET = 0x0000000D + CR_NO_SUCH_DEVINST = CR_NO_SUCH_DEVNODE + CR_NO_MORE_LOG_CONF CONFIGRET = 0x0000000E + CR_NO_MORE_RES_DES CONFIGRET = 0x0000000F + CR_ALREADY_SUCH_DEVNODE CONFIGRET = 0x00000010 + CR_ALREADY_SUCH_DEVINST = CR_ALREADY_SUCH_DEVNODE + CR_INVALID_RANGE_LIST CONFIGRET = 0x00000011 + CR_INVALID_RANGE CONFIGRET = 0x00000012 + CR_FAILURE CONFIGRET = 0x00000013 + CR_NO_SUCH_LOGICAL_DEV CONFIGRET = 0x00000014 + CR_CREATE_BLOCKED CONFIGRET = 0x00000015 + CR_NOT_SYSTEM_VM CONFIGRET = 0x00000016 + CR_REMOVE_VETOED CONFIGRET = 0x00000017 + CR_APM_VETOED CONFIGRET = 0x00000018 + CR_INVALID_LOAD_TYPE CONFIGRET = 0x00000019 + CR_BUFFER_SMALL CONFIGRET = 0x0000001A + CR_NO_ARBITRATOR CONFIGRET = 0x0000001B + CR_NO_REGISTRY_HANDLE CONFIGRET = 0x0000001C + CR_REGISTRY_ERROR CONFIGRET = 0x0000001D + CR_INVALID_DEVICE_ID CONFIGRET = 0x0000001E + CR_INVALID_DATA CONFIGRET = 0x0000001F + CR_INVALID_API CONFIGRET = 0x00000020 + CR_DEVLOADER_NOT_READY CONFIGRET = 0x00000021 + CR_NEED_RESTART CONFIGRET = 0x00000022 + CR_NO_MORE_HW_PROFILES CONFIGRET = 0x00000023 + CR_DEVICE_NOT_THERE CONFIGRET = 0x00000024 + CR_NO_SUCH_VALUE CONFIGRET = 0x00000025 + CR_WRONG_TYPE CONFIGRET = 0x00000026 + CR_INVALID_PRIORITY CONFIGRET = 0x00000027 + CR_NOT_DISABLEABLE CONFIGRET = 0x00000028 + CR_FREE_RESOURCES CONFIGRET = 0x00000029 + CR_QUERY_VETOED CONFIGRET = 0x0000002A + CR_CANT_SHARE_IRQ CONFIGRET = 0x0000002B + CR_NO_DEPENDENT CONFIGRET = 0x0000002C + CR_SAME_RESOURCES CONFIGRET = 0x0000002D + CR_NO_SUCH_REGISTRY_KEY CONFIGRET = 0x0000002E + CR_INVALID_MACHINENAME CONFIGRET = 0x0000002F + CR_REMOTE_COMM_FAILURE CONFIGRET = 0x00000030 + CR_MACHINE_UNAVAILABLE CONFIGRET = 0x00000031 + CR_NO_CM_SERVICES CONFIGRET = 0x00000032 + CR_ACCESS_DENIED CONFIGRET = 0x00000033 + CR_CALL_NOT_IMPLEMENTED CONFIGRET = 0x00000034 + CR_INVALID_PROPERTY CONFIGRET = 0x00000035 + CR_DEVICE_INTERFACE_ACTIVE CONFIGRET = 0x00000036 + CR_NO_SUCH_DEVICE_INTERFACE CONFIGRET = 0x00000037 + CR_INVALID_REFERENCE_STRING CONFIGRET = 0x00000038 + CR_INVALID_CONFLICT_LIST CONFIGRET = 0x00000039 + CR_INVALID_INDEX CONFIGRET = 0x0000003A + CR_INVALID_STRUCTURE_SIZE CONFIGRET = 0x0000003B + NUM_CR_RESULTS CONFIGRET = 0x0000003C +) + +const ( + CM_GET_DEVICE_INTERFACE_LIST_PRESENT = 0 // only currently 'live' device interfaces + CM_GET_DEVICE_INTERFACE_LIST_ALL_DEVICES = 1 // all registered device interfaces, live or not +) + +const ( + DN_ROOT_ENUMERATED = 0x00000001 // Was enumerated by ROOT + DN_DRIVER_LOADED = 0x00000002 // Has Register_Device_Driver + DN_ENUM_LOADED = 0x00000004 // Has Register_Enumerator + DN_STARTED = 0x00000008 // Is currently configured + DN_MANUAL = 0x00000010 // Manually installed + DN_NEED_TO_ENUM = 0x00000020 // May need reenumeration + DN_NOT_FIRST_TIME = 0x00000040 // Has received a config + DN_HARDWARE_ENUM = 0x00000080 // Enum generates hardware ID + DN_LIAR = 0x00000100 // Lied about can reconfig once + DN_HAS_MARK = 0x00000200 // Not CM_Create_DevInst lately + DN_HAS_PROBLEM = 0x00000400 // Need device installer + DN_FILTERED = 0x00000800 // Is filtered + DN_MOVED = 0x00001000 // Has been moved + DN_DISABLEABLE = 0x00002000 // Can be disabled + DN_REMOVABLE = 0x00004000 // Can be removed + DN_PRIVATE_PROBLEM = 0x00008000 // Has a private problem + DN_MF_PARENT = 0x00010000 // Multi function parent + DN_MF_CHILD = 0x00020000 // Multi function child + DN_WILL_BE_REMOVED = 0x00040000 // DevInst is being removed + DN_NOT_FIRST_TIMEE = 0x00080000 // Has received a config enumerate + DN_STOP_FREE_RES = 0x00100000 // When child is stopped, free resources + DN_REBAL_CANDIDATE = 0x00200000 // Don't skip during rebalance + DN_BAD_PARTIAL = 0x00400000 // This devnode's log_confs do not have same resources + DN_NT_ENUMERATOR = 0x00800000 // This devnode's is an NT enumerator + DN_NT_DRIVER = 0x01000000 // This devnode's is an NT driver + DN_NEEDS_LOCKING = 0x02000000 // Devnode need lock resume processing + DN_ARM_WAKEUP = 0x04000000 // Devnode can be the wakeup device + DN_APM_ENUMERATOR = 0x08000000 // APM aware enumerator + DN_APM_DRIVER = 0x10000000 // APM aware driver + DN_SILENT_INSTALL = 0x20000000 // Silent install + DN_NO_SHOW_IN_DM = 0x40000000 // No show in device manager + DN_BOOT_LOG_PROB = 0x80000000 // Had a problem during preassignment of boot log conf + DN_NEED_RESTART = DN_LIAR // System needs to be restarted for this Devnode to work properly + DN_DRIVER_BLOCKED = DN_NOT_FIRST_TIME // One or more drivers are blocked from loading for this Devnode + DN_LEGACY_DRIVER = DN_MOVED // This device is using a legacy driver + DN_CHILD_WITH_INVALID_ID = DN_HAS_MARK // One or more children have invalid IDs + DN_DEVICE_DISCONNECTED = DN_NEEDS_LOCKING // The function driver for a device reported that the device is not connected. Typically this means a wireless device is out of range. + DN_QUERY_REMOVE_PENDING = DN_MF_PARENT // Device is part of a set of related devices collectively pending query-removal + DN_QUERY_REMOVE_ACTIVE = DN_MF_CHILD // Device is actively engaged in a query-remove IRP + DN_CHANGEABLE_FLAGS = DN_NOT_FIRST_TIME | DN_HARDWARE_ENUM | DN_HAS_MARK | DN_DISABLEABLE | DN_REMOVABLE | DN_MF_CHILD | DN_MF_PARENT | DN_NOT_FIRST_TIMEE | DN_STOP_FREE_RES | DN_REBAL_CANDIDATE | DN_NT_ENUMERATOR | DN_NT_DRIVER | DN_SILENT_INSTALL | DN_NO_SHOW_IN_DM +) + +//sys setupDiCreateDeviceInfoListEx(classGUID *GUID, hwndParent uintptr, machineName *uint16, reserved uintptr) (handle DevInfo, err error) [failretval==DevInfo(InvalidHandle)] = setupapi.SetupDiCreateDeviceInfoListExW + +// SetupDiCreateDeviceInfoListEx function creates an empty device information set on a remote or a local computer and optionally associates the set with a device setup class. +func SetupDiCreateDeviceInfoListEx(classGUID *GUID, hwndParent uintptr, machineName string) (deviceInfoSet DevInfo, err error) { + var machineNameUTF16 *uint16 + if machineName != "" { + machineNameUTF16, err = UTF16PtrFromString(machineName) + if err != nil { + return + } + } + return setupDiCreateDeviceInfoListEx(classGUID, hwndParent, machineNameUTF16, 0) +} + +//sys setupDiGetDeviceInfoListDetail(deviceInfoSet DevInfo, deviceInfoSetDetailData *DevInfoListDetailData) (err error) = setupapi.SetupDiGetDeviceInfoListDetailW + +// SetupDiGetDeviceInfoListDetail function retrieves information associated with a device information set including the class GUID, remote computer handle, and remote computer name. +func SetupDiGetDeviceInfoListDetail(deviceInfoSet DevInfo) (deviceInfoSetDetailData *DevInfoListDetailData, err error) { + data := &DevInfoListDetailData{} + data.size = data.unsafeSizeOf() + + return data, setupDiGetDeviceInfoListDetail(deviceInfoSet, data) +} + +// DeviceInfoListDetail method retrieves information associated with a device information set including the class GUID, remote computer handle, and remote computer name. +func (deviceInfoSet DevInfo) DeviceInfoListDetail() (*DevInfoListDetailData, error) { + return SetupDiGetDeviceInfoListDetail(deviceInfoSet) +} + +//sys setupDiCreateDeviceInfo(deviceInfoSet DevInfo, DeviceName *uint16, classGUID *GUID, DeviceDescription *uint16, hwndParent uintptr, CreationFlags DICD, deviceInfoData *DevInfoData) (err error) = setupapi.SetupDiCreateDeviceInfoW + +// SetupDiCreateDeviceInfo function creates a new device information element and adds it as a new member to the specified device information set. +func SetupDiCreateDeviceInfo(deviceInfoSet DevInfo, deviceName string, classGUID *GUID, deviceDescription string, hwndParent uintptr, creationFlags DICD) (deviceInfoData *DevInfoData, err error) { + deviceNameUTF16, err := UTF16PtrFromString(deviceName) + if err != nil { + return + } + + var deviceDescriptionUTF16 *uint16 + if deviceDescription != "" { + deviceDescriptionUTF16, err = UTF16PtrFromString(deviceDescription) + if err != nil { + return + } + } + + data := &DevInfoData{} + data.size = uint32(unsafe.Sizeof(*data)) + + return data, setupDiCreateDeviceInfo(deviceInfoSet, deviceNameUTF16, classGUID, deviceDescriptionUTF16, hwndParent, creationFlags, data) +} + +// CreateDeviceInfo method creates a new device information element and adds it as a new member to the specified device information set. +func (deviceInfoSet DevInfo) CreateDeviceInfo(deviceName string, classGUID *GUID, deviceDescription string, hwndParent uintptr, creationFlags DICD) (*DevInfoData, error) { + return SetupDiCreateDeviceInfo(deviceInfoSet, deviceName, classGUID, deviceDescription, hwndParent, creationFlags) +} + +//sys setupDiEnumDeviceInfo(deviceInfoSet DevInfo, memberIndex uint32, deviceInfoData *DevInfoData) (err error) = setupapi.SetupDiEnumDeviceInfo + +// SetupDiEnumDeviceInfo function returns a DevInfoData structure that specifies a device information element in a device information set. +func SetupDiEnumDeviceInfo(deviceInfoSet DevInfo, memberIndex int) (*DevInfoData, error) { + data := &DevInfoData{} + data.size = uint32(unsafe.Sizeof(*data)) + + return data, setupDiEnumDeviceInfo(deviceInfoSet, uint32(memberIndex), data) +} + +// EnumDeviceInfo method returns a DevInfoData structure that specifies a device information element in a device information set. +func (deviceInfoSet DevInfo) EnumDeviceInfo(memberIndex int) (*DevInfoData, error) { + return SetupDiEnumDeviceInfo(deviceInfoSet, memberIndex) +} + +// SetupDiDestroyDeviceInfoList function deletes a device information set and frees all associated memory. +//sys SetupDiDestroyDeviceInfoList(deviceInfoSet DevInfo) (err error) = setupapi.SetupDiDestroyDeviceInfoList + +// Close method deletes a device information set and frees all associated memory. +func (deviceInfoSet DevInfo) Close() error { + return SetupDiDestroyDeviceInfoList(deviceInfoSet) +} + +//sys SetupDiBuildDriverInfoList(deviceInfoSet DevInfo, deviceInfoData *DevInfoData, driverType SPDIT) (err error) = setupapi.SetupDiBuildDriverInfoList + +// BuildDriverInfoList method builds a list of drivers that is associated with a specific device or with the global class driver list for a device information set. +func (deviceInfoSet DevInfo) BuildDriverInfoList(deviceInfoData *DevInfoData, driverType SPDIT) error { + return SetupDiBuildDriverInfoList(deviceInfoSet, deviceInfoData, driverType) +} + +//sys SetupDiCancelDriverInfoSearch(deviceInfoSet DevInfo) (err error) = setupapi.SetupDiCancelDriverInfoSearch + +// CancelDriverInfoSearch method cancels a driver list search that is currently in progress in a different thread. +func (deviceInfoSet DevInfo) CancelDriverInfoSearch() error { + return SetupDiCancelDriverInfoSearch(deviceInfoSet) +} + +//sys setupDiEnumDriverInfo(deviceInfoSet DevInfo, deviceInfoData *DevInfoData, driverType SPDIT, memberIndex uint32, driverInfoData *DrvInfoData) (err error) = setupapi.SetupDiEnumDriverInfoW + +// SetupDiEnumDriverInfo function enumerates the members of a driver list. +func SetupDiEnumDriverInfo(deviceInfoSet DevInfo, deviceInfoData *DevInfoData, driverType SPDIT, memberIndex int) (*DrvInfoData, error) { + data := &DrvInfoData{} + data.size = uint32(unsafe.Sizeof(*data)) + + return data, setupDiEnumDriverInfo(deviceInfoSet, deviceInfoData, driverType, uint32(memberIndex), data) +} + +// EnumDriverInfo method enumerates the members of a driver list. +func (deviceInfoSet DevInfo) EnumDriverInfo(deviceInfoData *DevInfoData, driverType SPDIT, memberIndex int) (*DrvInfoData, error) { + return SetupDiEnumDriverInfo(deviceInfoSet, deviceInfoData, driverType, memberIndex) +} + +//sys setupDiGetSelectedDriver(deviceInfoSet DevInfo, deviceInfoData *DevInfoData, driverInfoData *DrvInfoData) (err error) = setupapi.SetupDiGetSelectedDriverW + +// SetupDiGetSelectedDriver function retrieves the selected driver for a device information set or a particular device information element. +func SetupDiGetSelectedDriver(deviceInfoSet DevInfo, deviceInfoData *DevInfoData) (*DrvInfoData, error) { + data := &DrvInfoData{} + data.size = uint32(unsafe.Sizeof(*data)) + + return data, setupDiGetSelectedDriver(deviceInfoSet, deviceInfoData, data) +} + +// SelectedDriver method retrieves the selected driver for a device information set or a particular device information element. +func (deviceInfoSet DevInfo) SelectedDriver(deviceInfoData *DevInfoData) (*DrvInfoData, error) { + return SetupDiGetSelectedDriver(deviceInfoSet, deviceInfoData) +} + +//sys SetupDiSetSelectedDriver(deviceInfoSet DevInfo, deviceInfoData *DevInfoData, driverInfoData *DrvInfoData) (err error) = setupapi.SetupDiSetSelectedDriverW + +// SetSelectedDriver method sets, or resets, the selected driver for a device information element or the selected class driver for a device information set. +func (deviceInfoSet DevInfo) SetSelectedDriver(deviceInfoData *DevInfoData, driverInfoData *DrvInfoData) error { + return SetupDiSetSelectedDriver(deviceInfoSet, deviceInfoData, driverInfoData) +} + +//sys setupDiGetDriverInfoDetail(deviceInfoSet DevInfo, deviceInfoData *DevInfoData, driverInfoData *DrvInfoData, driverInfoDetailData *DrvInfoDetailData, driverInfoDetailDataSize uint32, requiredSize *uint32) (err error) = setupapi.SetupDiGetDriverInfoDetailW + +// SetupDiGetDriverInfoDetail function retrieves driver information detail for a device information set or a particular device information element in the device information set. +func SetupDiGetDriverInfoDetail(deviceInfoSet DevInfo, deviceInfoData *DevInfoData, driverInfoData *DrvInfoData) (*DrvInfoDetailData, error) { + reqSize := uint32(2048) + for { + buf := make([]byte, reqSize) + data := (*DrvInfoDetailData)(unsafe.Pointer(&buf[0])) + data.size = data.unsafeSizeOf() + err := setupDiGetDriverInfoDetail(deviceInfoSet, deviceInfoData, driverInfoData, data, uint32(len(buf)), &reqSize) + if err == ERROR_INSUFFICIENT_BUFFER { + continue + } + if err != nil { + return nil, err + } + data.size = reqSize + return data, nil + } +} + +// DriverInfoDetail method retrieves driver information detail for a device information set or a particular device information element in the device information set. +func (deviceInfoSet DevInfo) DriverInfoDetail(deviceInfoData *DevInfoData, driverInfoData *DrvInfoData) (*DrvInfoDetailData, error) { + return SetupDiGetDriverInfoDetail(deviceInfoSet, deviceInfoData, driverInfoData) +} + +//sys SetupDiDestroyDriverInfoList(deviceInfoSet DevInfo, deviceInfoData *DevInfoData, driverType SPDIT) (err error) = setupapi.SetupDiDestroyDriverInfoList + +// DestroyDriverInfoList method deletes a driver list. +func (deviceInfoSet DevInfo) DestroyDriverInfoList(deviceInfoData *DevInfoData, driverType SPDIT) error { + return SetupDiDestroyDriverInfoList(deviceInfoSet, deviceInfoData, driverType) +} + +//sys setupDiGetClassDevsEx(classGUID *GUID, Enumerator *uint16, hwndParent uintptr, Flags DIGCF, deviceInfoSet DevInfo, machineName *uint16, reserved uintptr) (handle DevInfo, err error) [failretval==DevInfo(InvalidHandle)] = setupapi.SetupDiGetClassDevsExW + +// SetupDiGetClassDevsEx function returns a handle to a device information set that contains requested device information elements for a local or a remote computer. +func SetupDiGetClassDevsEx(classGUID *GUID, enumerator string, hwndParent uintptr, flags DIGCF, deviceInfoSet DevInfo, machineName string) (handle DevInfo, err error) { + var enumeratorUTF16 *uint16 + if enumerator != "" { + enumeratorUTF16, err = UTF16PtrFromString(enumerator) + if err != nil { + return + } + } + var machineNameUTF16 *uint16 + if machineName != "" { + machineNameUTF16, err = UTF16PtrFromString(machineName) + if err != nil { + return + } + } + return setupDiGetClassDevsEx(classGUID, enumeratorUTF16, hwndParent, flags, deviceInfoSet, machineNameUTF16, 0) +} + +// SetupDiCallClassInstaller function calls the appropriate class installer, and any registered co-installers, with the specified installation request (DIF code). +//sys SetupDiCallClassInstaller(installFunction DI_FUNCTION, deviceInfoSet DevInfo, deviceInfoData *DevInfoData) (err error) = setupapi.SetupDiCallClassInstaller + +// CallClassInstaller member calls the appropriate class installer, and any registered co-installers, with the specified installation request (DIF code). +func (deviceInfoSet DevInfo) CallClassInstaller(installFunction DI_FUNCTION, deviceInfoData *DevInfoData) error { + return SetupDiCallClassInstaller(installFunction, deviceInfoSet, deviceInfoData) +} + +// SetupDiOpenDevRegKey function opens a registry key for device-specific configuration information. +//sys SetupDiOpenDevRegKey(deviceInfoSet DevInfo, deviceInfoData *DevInfoData, Scope DICS_FLAG, HwProfile uint32, KeyType DIREG, samDesired uint32) (key Handle, err error) [failretval==InvalidHandle] = setupapi.SetupDiOpenDevRegKey + +// OpenDevRegKey method opens a registry key for device-specific configuration information. +func (deviceInfoSet DevInfo) OpenDevRegKey(DeviceInfoData *DevInfoData, Scope DICS_FLAG, HwProfile uint32, KeyType DIREG, samDesired uint32) (Handle, error) { + return SetupDiOpenDevRegKey(deviceInfoSet, DeviceInfoData, Scope, HwProfile, KeyType, samDesired) +} + +//sys setupDiGetDeviceProperty(deviceInfoSet DevInfo, deviceInfoData *DevInfoData, propertyKey *DEVPROPKEY, propertyType *DEVPROPTYPE, propertyBuffer *byte, propertyBufferSize uint32, requiredSize *uint32, flags uint32) (err error) = setupapi.SetupDiGetDevicePropertyW + +// SetupDiGetDeviceProperty function retrieves a specified device instance property. +func SetupDiGetDeviceProperty(deviceInfoSet DevInfo, deviceInfoData *DevInfoData, propertyKey *DEVPROPKEY) (value interface{}, err error) { + reqSize := uint32(256) + for { + var dataType DEVPROPTYPE + buf := make([]byte, reqSize) + err = setupDiGetDeviceProperty(deviceInfoSet, deviceInfoData, propertyKey, &dataType, &buf[0], uint32(len(buf)), &reqSize, 0) + if err == ERROR_INSUFFICIENT_BUFFER { + continue + } + if err != nil { + return + } + switch dataType { + case DEVPROP_TYPE_STRING: + ret := UTF16ToString(bufToUTF16(buf)) + runtime.KeepAlive(buf) + return ret, nil + } + return nil, errors.New("unimplemented property type") + } +} + +//sys setupDiGetDeviceRegistryProperty(deviceInfoSet DevInfo, deviceInfoData *DevInfoData, property SPDRP, propertyRegDataType *uint32, propertyBuffer *byte, propertyBufferSize uint32, requiredSize *uint32) (err error) = setupapi.SetupDiGetDeviceRegistryPropertyW + +// SetupDiGetDeviceRegistryProperty function retrieves a specified Plug and Play device property. +func SetupDiGetDeviceRegistryProperty(deviceInfoSet DevInfo, deviceInfoData *DevInfoData, property SPDRP) (value interface{}, err error) { + reqSize := uint32(256) + for { + var dataType uint32 + buf := make([]byte, reqSize) + err = setupDiGetDeviceRegistryProperty(deviceInfoSet, deviceInfoData, property, &dataType, &buf[0], uint32(len(buf)), &reqSize) + if err == ERROR_INSUFFICIENT_BUFFER { + continue + } + if err != nil { + return + } + return getRegistryValue(buf[:reqSize], dataType) + } +} + +func getRegistryValue(buf []byte, dataType uint32) (interface{}, error) { + switch dataType { + case REG_SZ: + ret := UTF16ToString(bufToUTF16(buf)) + runtime.KeepAlive(buf) + return ret, nil + case REG_EXPAND_SZ: + value := UTF16ToString(bufToUTF16(buf)) + if value == "" { + return "", nil + } + p, err := syscall.UTF16PtrFromString(value) + if err != nil { + return "", err + } + ret := make([]uint16, 100) + for { + n, err := ExpandEnvironmentStrings(p, &ret[0], uint32(len(ret))) + if err != nil { + return "", err + } + if n <= uint32(len(ret)) { + return UTF16ToString(ret[:n]), nil + } + ret = make([]uint16, n) + } + case REG_BINARY: + return buf, nil + case REG_DWORD_LITTLE_ENDIAN: + return binary.LittleEndian.Uint32(buf), nil + case REG_DWORD_BIG_ENDIAN: + return binary.BigEndian.Uint32(buf), nil + case REG_MULTI_SZ: + bufW := bufToUTF16(buf) + a := []string{} + for i := 0; i < len(bufW); { + j := i + wcslen(bufW[i:]) + if i < j { + a = append(a, UTF16ToString(bufW[i:j])) + } + i = j + 1 + } + runtime.KeepAlive(buf) + return a, nil + case REG_QWORD_LITTLE_ENDIAN: + return binary.LittleEndian.Uint64(buf), nil + default: + return nil, fmt.Errorf("Unsupported registry value type: %v", dataType) + } +} + +// bufToUTF16 function reinterprets []byte buffer as []uint16 +func bufToUTF16(buf []byte) []uint16 { + sl := struct { + addr *uint16 + len int + cap int + }{(*uint16)(unsafe.Pointer(&buf[0])), len(buf) / 2, cap(buf) / 2} + return *(*[]uint16)(unsafe.Pointer(&sl)) +} + +// utf16ToBuf function reinterprets []uint16 as []byte +func utf16ToBuf(buf []uint16) []byte { + sl := struct { + addr *byte + len int + cap int + }{(*byte)(unsafe.Pointer(&buf[0])), len(buf) * 2, cap(buf) * 2} + return *(*[]byte)(unsafe.Pointer(&sl)) +} + +func wcslen(str []uint16) int { + for i := 0; i < len(str); i++ { + if str[i] == 0 { + return i + } + } + return len(str) +} + +// DeviceRegistryProperty method retrieves a specified Plug and Play device property. +func (deviceInfoSet DevInfo) DeviceRegistryProperty(deviceInfoData *DevInfoData, property SPDRP) (interface{}, error) { + return SetupDiGetDeviceRegistryProperty(deviceInfoSet, deviceInfoData, property) +} + +//sys setupDiSetDeviceRegistryProperty(deviceInfoSet DevInfo, deviceInfoData *DevInfoData, property SPDRP, propertyBuffer *byte, propertyBufferSize uint32) (err error) = setupapi.SetupDiSetDeviceRegistryPropertyW + +// SetupDiSetDeviceRegistryProperty function sets a Plug and Play device property for a device. +func SetupDiSetDeviceRegistryProperty(deviceInfoSet DevInfo, deviceInfoData *DevInfoData, property SPDRP, propertyBuffers []byte) error { + return setupDiSetDeviceRegistryProperty(deviceInfoSet, deviceInfoData, property, &propertyBuffers[0], uint32(len(propertyBuffers))) +} + +// SetDeviceRegistryProperty function sets a Plug and Play device property for a device. +func (deviceInfoSet DevInfo) SetDeviceRegistryProperty(deviceInfoData *DevInfoData, property SPDRP, propertyBuffers []byte) error { + return SetupDiSetDeviceRegistryProperty(deviceInfoSet, deviceInfoData, property, propertyBuffers) +} + +// SetDeviceRegistryPropertyString method sets a Plug and Play device property string for a device. +func (deviceInfoSet DevInfo) SetDeviceRegistryPropertyString(deviceInfoData *DevInfoData, property SPDRP, str string) error { + str16, err := UTF16FromString(str) + if err != nil { + return err + } + err = SetupDiSetDeviceRegistryProperty(deviceInfoSet, deviceInfoData, property, utf16ToBuf(append(str16, 0))) + runtime.KeepAlive(str16) + return err +} + +//sys setupDiGetDeviceInstallParams(deviceInfoSet DevInfo, deviceInfoData *DevInfoData, deviceInstallParams *DevInstallParams) (err error) = setupapi.SetupDiGetDeviceInstallParamsW + +// SetupDiGetDeviceInstallParams function retrieves device installation parameters for a device information set or a particular device information element. +func SetupDiGetDeviceInstallParams(deviceInfoSet DevInfo, deviceInfoData *DevInfoData) (*DevInstallParams, error) { + params := &DevInstallParams{} + params.size = uint32(unsafe.Sizeof(*params)) + + return params, setupDiGetDeviceInstallParams(deviceInfoSet, deviceInfoData, params) +} + +// DeviceInstallParams method retrieves device installation parameters for a device information set or a particular device information element. +func (deviceInfoSet DevInfo) DeviceInstallParams(deviceInfoData *DevInfoData) (*DevInstallParams, error) { + return SetupDiGetDeviceInstallParams(deviceInfoSet, deviceInfoData) +} + +//sys setupDiGetDeviceInstanceId(deviceInfoSet DevInfo, deviceInfoData *DevInfoData, instanceId *uint16, instanceIdSize uint32, instanceIdRequiredSize *uint32) (err error) = setupapi.SetupDiGetDeviceInstanceIdW + +// SetupDiGetDeviceInstanceId function retrieves the instance ID of the device. +func SetupDiGetDeviceInstanceId(deviceInfoSet DevInfo, deviceInfoData *DevInfoData) (string, error) { + reqSize := uint32(1024) + for { + buf := make([]uint16, reqSize) + err := setupDiGetDeviceInstanceId(deviceInfoSet, deviceInfoData, &buf[0], uint32(len(buf)), &reqSize) + if err == ERROR_INSUFFICIENT_BUFFER { + continue + } + if err != nil { + return "", err + } + return UTF16ToString(buf), nil + } +} + +// DeviceInstanceID method retrieves the instance ID of the device. +func (deviceInfoSet DevInfo) DeviceInstanceID(deviceInfoData *DevInfoData) (string, error) { + return SetupDiGetDeviceInstanceId(deviceInfoSet, deviceInfoData) +} + +// SetupDiGetClassInstallParams function retrieves class installation parameters for a device information set or a particular device information element. +//sys SetupDiGetClassInstallParams(deviceInfoSet DevInfo, deviceInfoData *DevInfoData, classInstallParams *ClassInstallHeader, classInstallParamsSize uint32, requiredSize *uint32) (err error) = setupapi.SetupDiGetClassInstallParamsW + +// ClassInstallParams method retrieves class installation parameters for a device information set or a particular device information element. +func (deviceInfoSet DevInfo) ClassInstallParams(deviceInfoData *DevInfoData, classInstallParams *ClassInstallHeader, classInstallParamsSize uint32, requiredSize *uint32) error { + return SetupDiGetClassInstallParams(deviceInfoSet, deviceInfoData, classInstallParams, classInstallParamsSize, requiredSize) +} + +//sys SetupDiSetDeviceInstallParams(deviceInfoSet DevInfo, deviceInfoData *DevInfoData, deviceInstallParams *DevInstallParams) (err error) = setupapi.SetupDiSetDeviceInstallParamsW + +// SetDeviceInstallParams member sets device installation parameters for a device information set or a particular device information element. +func (deviceInfoSet DevInfo) SetDeviceInstallParams(deviceInfoData *DevInfoData, deviceInstallParams *DevInstallParams) error { + return SetupDiSetDeviceInstallParams(deviceInfoSet, deviceInfoData, deviceInstallParams) +} + +// SetupDiSetClassInstallParams function sets or clears class install parameters for a device information set or a particular device information element. +//sys SetupDiSetClassInstallParams(deviceInfoSet DevInfo, deviceInfoData *DevInfoData, classInstallParams *ClassInstallHeader, classInstallParamsSize uint32) (err error) = setupapi.SetupDiSetClassInstallParamsW + +// SetClassInstallParams method sets or clears class install parameters for a device information set or a particular device information element. +func (deviceInfoSet DevInfo) SetClassInstallParams(deviceInfoData *DevInfoData, classInstallParams *ClassInstallHeader, classInstallParamsSize uint32) error { + return SetupDiSetClassInstallParams(deviceInfoSet, deviceInfoData, classInstallParams, classInstallParamsSize) +} + +//sys setupDiClassNameFromGuidEx(classGUID *GUID, className *uint16, classNameSize uint32, requiredSize *uint32, machineName *uint16, reserved uintptr) (err error) = setupapi.SetupDiClassNameFromGuidExW + +// SetupDiClassNameFromGuidEx function retrieves the class name associated with a class GUID. The class can be installed on a local or remote computer. +func SetupDiClassNameFromGuidEx(classGUID *GUID, machineName string) (className string, err error) { + var classNameUTF16 [MAX_CLASS_NAME_LEN]uint16 + + var machineNameUTF16 *uint16 + if machineName != "" { + machineNameUTF16, err = UTF16PtrFromString(machineName) + if err != nil { + return + } + } + + err = setupDiClassNameFromGuidEx(classGUID, &classNameUTF16[0], MAX_CLASS_NAME_LEN, nil, machineNameUTF16, 0) + if err != nil { + return + } + + className = UTF16ToString(classNameUTF16[:]) + return +} + +//sys setupDiClassGuidsFromNameEx(className *uint16, classGuidList *GUID, classGuidListSize uint32, requiredSize *uint32, machineName *uint16, reserved uintptr) (err error) = setupapi.SetupDiClassGuidsFromNameExW + +// SetupDiClassGuidsFromNameEx function retrieves the GUIDs associated with the specified class name. This resulting list contains the classes currently installed on a local or remote computer. +func SetupDiClassGuidsFromNameEx(className string, machineName string) ([]GUID, error) { + classNameUTF16, err := UTF16PtrFromString(className) + if err != nil { + return nil, err + } + + var machineNameUTF16 *uint16 + if machineName != "" { + machineNameUTF16, err = UTF16PtrFromString(machineName) + if err != nil { + return nil, err + } + } + + reqSize := uint32(4) + for { + buf := make([]GUID, reqSize) + err = setupDiClassGuidsFromNameEx(classNameUTF16, &buf[0], uint32(len(buf)), &reqSize, machineNameUTF16, 0) + if err == ERROR_INSUFFICIENT_BUFFER { + continue + } + if err != nil { + return nil, err + } + return buf[:reqSize], nil + } +} + +//sys setupDiGetSelectedDevice(deviceInfoSet DevInfo, deviceInfoData *DevInfoData) (err error) = setupapi.SetupDiGetSelectedDevice + +// SetupDiGetSelectedDevice function retrieves the selected device information element in a device information set. +func SetupDiGetSelectedDevice(deviceInfoSet DevInfo) (*DevInfoData, error) { + data := &DevInfoData{} + data.size = uint32(unsafe.Sizeof(*data)) + + return data, setupDiGetSelectedDevice(deviceInfoSet, data) +} + +// SelectedDevice method retrieves the selected device information element in a device information set. +func (deviceInfoSet DevInfo) SelectedDevice() (*DevInfoData, error) { + return SetupDiGetSelectedDevice(deviceInfoSet) +} + +// SetupDiSetSelectedDevice function sets a device information element as the selected member of a device information set. This function is typically used by an installation wizard. +//sys SetupDiSetSelectedDevice(deviceInfoSet DevInfo, deviceInfoData *DevInfoData) (err error) = setupapi.SetupDiSetSelectedDevice + +// SetSelectedDevice method sets a device information element as the selected member of a device information set. This function is typically used by an installation wizard. +func (deviceInfoSet DevInfo) SetSelectedDevice(deviceInfoData *DevInfoData) error { + return SetupDiSetSelectedDevice(deviceInfoSet, deviceInfoData) +} + +//sys setupUninstallOEMInf(infFileName *uint16, flags SUOI, reserved uintptr) (err error) = setupapi.SetupUninstallOEMInfW + +// SetupUninstallOEMInf uninstalls the specified driver. +func SetupUninstallOEMInf(infFileName string, flags SUOI) error { + infFileName16, err := UTF16PtrFromString(infFileName) + if err != nil { + return err + } + return setupUninstallOEMInf(infFileName16, flags, 0) +} + +//sys cm_MapCrToWin32Err(configRet CONFIGRET, defaultWin32Error Errno) (ret Errno) = CfgMgr32.CM_MapCrToWin32Err + +//sys cm_Get_Device_Interface_List_Size(len *uint32, interfaceClass *GUID, deviceID *uint16, flags uint32) (ret CONFIGRET) = CfgMgr32.CM_Get_Device_Interface_List_SizeW +//sys cm_Get_Device_Interface_List(interfaceClass *GUID, deviceID *uint16, buffer *uint16, bufferLen uint32, flags uint32) (ret CONFIGRET) = CfgMgr32.CM_Get_Device_Interface_ListW + +func CM_Get_Device_Interface_List(deviceID string, interfaceClass *GUID, flags uint32) ([]string, error) { + deviceID16, err := UTF16PtrFromString(deviceID) + if err != nil { + return nil, err + } + var buf []uint16 + var buflen uint32 + for { + if ret := cm_Get_Device_Interface_List_Size(&buflen, interfaceClass, deviceID16, flags); ret != CR_SUCCESS { + return nil, ret + } + buf = make([]uint16, buflen) + if ret := cm_Get_Device_Interface_List(interfaceClass, deviceID16, &buf[0], buflen, flags); ret == CR_SUCCESS { + break + } else if ret != CR_BUFFER_SMALL { + return nil, ret + } + } + var interfaces []string + for i := 0; i < len(buf); { + j := i + wcslen(buf[i:]) + if i < j { + interfaces = append(interfaces, UTF16ToString(buf[i:j])) + } + i = j + 1 + } + if interfaces == nil { + return nil, ERROR_NO_SUCH_DEVICE_INTERFACE + } + return interfaces, nil +} + +//sys cm_Get_DevNode_Status(status *uint32, problemNumber *uint32, devInst DEVINST, flags uint32) (ret CONFIGRET) = CfgMgr32.CM_Get_DevNode_Status + +func CM_Get_DevNode_Status(status *uint32, problemNumber *uint32, devInst DEVINST, flags uint32) error { + ret := cm_Get_DevNode_Status(status, problemNumber, devInst, flags) + if ret == CR_SUCCESS { + return nil + } + return ret +} diff --git a/vendor/golang.org/x/sys/windows/str.go b/vendor/golang.org/x/sys/windows/str.go new file mode 100644 index 00000000..6a4f9ce6 --- /dev/null +++ b/vendor/golang.org/x/sys/windows/str.go @@ -0,0 +1,22 @@ +// Copyright 2009 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +//go:build windows + +package windows + +func itoa(val int) string { // do it here rather than with fmt to avoid dependency + if val < 0 { + return "-" + itoa(-val) + } + var buf [32]byte // big enough for int64 + i := len(buf) - 1 + for val >= 10 { + buf[i] = byte(val%10 + '0') + i-- + val /= 10 + } + buf[i] = byte(val + '0') + return string(buf[i:]) +} diff --git a/vendor/golang.org/x/sys/windows/syscall.go b/vendor/golang.org/x/sys/windows/syscall.go new file mode 100644 index 00000000..e85ed6b9 --- /dev/null +++ b/vendor/golang.org/x/sys/windows/syscall.go @@ -0,0 +1,104 @@ +// Copyright 2009 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +//go:build windows + +// Package windows contains an interface to the low-level operating system +// primitives. OS details vary depending on the underlying system, and +// by default, godoc will display the OS-specific documentation for the current +// system. If you want godoc to display syscall documentation for another +// system, set $GOOS and $GOARCH to the desired system. For example, if +// you want to view documentation for freebsd/arm on linux/amd64, set $GOOS +// to freebsd and $GOARCH to arm. +// +// The primary use of this package is inside other packages that provide a more +// portable interface to the system, such as "os", "time" and "net". Use +// those packages rather than this one if you can. +// +// For details of the functions and data types in this package consult +// the manuals for the appropriate operating system. +// +// These calls return err == nil to indicate success; otherwise +// err represents an operating system error describing the failure and +// holds a value of type syscall.Errno. +package windows // import "golang.org/x/sys/windows" + +import ( + "bytes" + "strings" + "syscall" + "unsafe" +) + +// ByteSliceFromString returns a NUL-terminated slice of bytes +// containing the text of s. If s contains a NUL byte at any +// location, it returns (nil, syscall.EINVAL). +func ByteSliceFromString(s string) ([]byte, error) { + if strings.IndexByte(s, 0) != -1 { + return nil, syscall.EINVAL + } + a := make([]byte, len(s)+1) + copy(a, s) + return a, nil +} + +// BytePtrFromString returns a pointer to a NUL-terminated array of +// bytes containing the text of s. If s contains a NUL byte at any +// location, it returns (nil, syscall.EINVAL). +func BytePtrFromString(s string) (*byte, error) { + a, err := ByteSliceFromString(s) + if err != nil { + return nil, err + } + return &a[0], nil +} + +// ByteSliceToString returns a string form of the text represented by the slice s, with a terminating NUL and any +// bytes after the NUL removed. +func ByteSliceToString(s []byte) string { + if i := bytes.IndexByte(s, 0); i != -1 { + s = s[:i] + } + return string(s) +} + +// BytePtrToString takes a pointer to a sequence of text and returns the corresponding string. +// If the pointer is nil, it returns the empty string. It assumes that the text sequence is terminated +// at a zero byte; if the zero byte is not present, the program may crash. +func BytePtrToString(p *byte) string { + if p == nil { + return "" + } + if *p == 0 { + return "" + } + + // Find NUL terminator. + n := 0 + for ptr := unsafe.Pointer(p); *(*byte)(ptr) != 0; n++ { + ptr = unsafe.Pointer(uintptr(ptr) + 1) + } + + return string(unsafe.Slice(p, n)) +} + +// Single-word zero for use when we need a valid pointer to 0 bytes. +// See mksyscall.pl. +var _zero uintptr + +func (ts *Timespec) Unix() (sec int64, nsec int64) { + return int64(ts.Sec), int64(ts.Nsec) +} + +func (tv *Timeval) Unix() (sec int64, nsec int64) { + return int64(tv.Sec), int64(tv.Usec) * 1000 +} + +func (ts *Timespec) Nano() int64 { + return int64(ts.Sec)*1e9 + int64(ts.Nsec) +} + +func (tv *Timeval) Nano() int64 { + return int64(tv.Sec)*1e9 + int64(tv.Usec)*1000 +} diff --git a/vendor/golang.org/x/sys/windows/syscall_windows.go b/vendor/golang.org/x/sys/windows/syscall_windows.go new file mode 100644 index 00000000..d7664365 --- /dev/null +++ b/vendor/golang.org/x/sys/windows/syscall_windows.go @@ -0,0 +1,1938 @@ +// Copyright 2009 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +// Windows system calls. + +package windows + +import ( + errorspkg "errors" + "fmt" + "runtime" + "sync" + "syscall" + "time" + "unicode/utf16" + "unsafe" +) + +type ( + Handle uintptr + HWND uintptr +) + +const ( + InvalidHandle = ^Handle(0) + InvalidHWND = ^HWND(0) + + // Flags for DefineDosDevice. + DDD_EXACT_MATCH_ON_REMOVE = 0x00000004 + DDD_NO_BROADCAST_SYSTEM = 0x00000008 + DDD_RAW_TARGET_PATH = 0x00000001 + DDD_REMOVE_DEFINITION = 0x00000002 + + // Return values for GetDriveType. + DRIVE_UNKNOWN = 0 + DRIVE_NO_ROOT_DIR = 1 + DRIVE_REMOVABLE = 2 + DRIVE_FIXED = 3 + DRIVE_REMOTE = 4 + DRIVE_CDROM = 5 + DRIVE_RAMDISK = 6 + + // File system flags from GetVolumeInformation and GetVolumeInformationByHandle. + FILE_CASE_SENSITIVE_SEARCH = 0x00000001 + FILE_CASE_PRESERVED_NAMES = 0x00000002 + FILE_FILE_COMPRESSION = 0x00000010 + FILE_DAX_VOLUME = 0x20000000 + FILE_NAMED_STREAMS = 0x00040000 + FILE_PERSISTENT_ACLS = 0x00000008 + FILE_READ_ONLY_VOLUME = 0x00080000 + FILE_SEQUENTIAL_WRITE_ONCE = 0x00100000 + FILE_SUPPORTS_ENCRYPTION = 0x00020000 + FILE_SUPPORTS_EXTENDED_ATTRIBUTES = 0x00800000 + FILE_SUPPORTS_HARD_LINKS = 0x00400000 + FILE_SUPPORTS_OBJECT_IDS = 0x00010000 + FILE_SUPPORTS_OPEN_BY_FILE_ID = 0x01000000 + FILE_SUPPORTS_REPARSE_POINTS = 0x00000080 + FILE_SUPPORTS_SPARSE_FILES = 0x00000040 + FILE_SUPPORTS_TRANSACTIONS = 0x00200000 + FILE_SUPPORTS_USN_JOURNAL = 0x02000000 + FILE_UNICODE_ON_DISK = 0x00000004 + FILE_VOLUME_IS_COMPRESSED = 0x00008000 + FILE_VOLUME_QUOTAS = 0x00000020 + + // Flags for LockFileEx. + LOCKFILE_FAIL_IMMEDIATELY = 0x00000001 + LOCKFILE_EXCLUSIVE_LOCK = 0x00000002 + + // Return value of SleepEx and other APC functions + WAIT_IO_COMPLETION = 0x000000C0 +) + +// StringToUTF16 is deprecated. Use UTF16FromString instead. +// If s contains a NUL byte this function panics instead of +// returning an error. +func StringToUTF16(s string) []uint16 { + a, err := UTF16FromString(s) + if err != nil { + panic("windows: string with NUL passed to StringToUTF16") + } + return a +} + +// UTF16FromString returns the UTF-16 encoding of the UTF-8 string +// s, with a terminating NUL added. If s contains a NUL byte at any +// location, it returns (nil, syscall.EINVAL). +func UTF16FromString(s string) ([]uint16, error) { + return syscall.UTF16FromString(s) +} + +// UTF16ToString returns the UTF-8 encoding of the UTF-16 sequence s, +// with a terminating NUL and any bytes after the NUL removed. +func UTF16ToString(s []uint16) string { + return syscall.UTF16ToString(s) +} + +// StringToUTF16Ptr is deprecated. Use UTF16PtrFromString instead. +// If s contains a NUL byte this function panics instead of +// returning an error. +func StringToUTF16Ptr(s string) *uint16 { return &StringToUTF16(s)[0] } + +// UTF16PtrFromString returns pointer to the UTF-16 encoding of +// the UTF-8 string s, with a terminating NUL added. If s +// contains a NUL byte at any location, it returns (nil, syscall.EINVAL). +func UTF16PtrFromString(s string) (*uint16, error) { + a, err := UTF16FromString(s) + if err != nil { + return nil, err + } + return &a[0], nil +} + +// UTF16PtrToString takes a pointer to a UTF-16 sequence and returns the corresponding UTF-8 encoded string. +// If the pointer is nil, it returns the empty string. It assumes that the UTF-16 sequence is terminated +// at a zero word; if the zero word is not present, the program may crash. +func UTF16PtrToString(p *uint16) string { + if p == nil { + return "" + } + if *p == 0 { + return "" + } + + // Find NUL terminator. + n := 0 + for ptr := unsafe.Pointer(p); *(*uint16)(ptr) != 0; n++ { + ptr = unsafe.Pointer(uintptr(ptr) + unsafe.Sizeof(*p)) + } + return UTF16ToString(unsafe.Slice(p, n)) +} + +func Getpagesize() int { return 4096 } + +// NewCallback converts a Go function to a function pointer conforming to the stdcall calling convention. +// This is useful when interoperating with Windows code requiring callbacks. +// The argument is expected to be a function with one uintptr-sized result. The function must not have arguments with size larger than the size of uintptr. +func NewCallback(fn interface{}) uintptr { + return syscall.NewCallback(fn) +} + +// NewCallbackCDecl converts a Go function to a function pointer conforming to the cdecl calling convention. +// This is useful when interoperating with Windows code requiring callbacks. +// The argument is expected to be a function with one uintptr-sized result. The function must not have arguments with size larger than the size of uintptr. +func NewCallbackCDecl(fn interface{}) uintptr { + return syscall.NewCallbackCDecl(fn) +} + +// windows api calls + +//sys GetLastError() (lasterr error) +//sys LoadLibrary(libname string) (handle Handle, err error) = LoadLibraryW +//sys LoadLibraryEx(libname string, zero Handle, flags uintptr) (handle Handle, err error) = LoadLibraryExW +//sys FreeLibrary(handle Handle) (err error) +//sys GetProcAddress(module Handle, procname string) (proc uintptr, err error) +//sys GetModuleFileName(module Handle, filename *uint16, size uint32) (n uint32, err error) = kernel32.GetModuleFileNameW +//sys GetModuleHandleEx(flags uint32, moduleName *uint16, module *Handle) (err error) = kernel32.GetModuleHandleExW +//sys SetDefaultDllDirectories(directoryFlags uint32) (err error) +//sys AddDllDirectory(path *uint16) (cookie uintptr, err error) = kernel32.AddDllDirectory +//sys RemoveDllDirectory(cookie uintptr) (err error) = kernel32.RemoveDllDirectory +//sys SetDllDirectory(path string) (err error) = kernel32.SetDllDirectoryW +//sys GetVersion() (ver uint32, err error) +//sys FormatMessage(flags uint32, msgsrc uintptr, msgid uint32, langid uint32, buf []uint16, args *byte) (n uint32, err error) = FormatMessageW +//sys ExitProcess(exitcode uint32) +//sys IsWow64Process(handle Handle, isWow64 *bool) (err error) = IsWow64Process +//sys IsWow64Process2(handle Handle, processMachine *uint16, nativeMachine *uint16) (err error) = IsWow64Process2? +//sys CreateFile(name *uint16, access uint32, mode uint32, sa *SecurityAttributes, createmode uint32, attrs uint32, templatefile Handle) (handle Handle, err error) [failretval==InvalidHandle] = CreateFileW +//sys CreateNamedPipe(name *uint16, flags uint32, pipeMode uint32, maxInstances uint32, outSize uint32, inSize uint32, defaultTimeout uint32, sa *SecurityAttributes) (handle Handle, err error) [failretval==InvalidHandle] = CreateNamedPipeW +//sys ConnectNamedPipe(pipe Handle, overlapped *Overlapped) (err error) +//sys DisconnectNamedPipe(pipe Handle) (err error) +//sys GetNamedPipeClientProcessId(pipe Handle, clientProcessID *uint32) (err error) +//sys GetNamedPipeServerProcessId(pipe Handle, serverProcessID *uint32) (err error) +//sys GetNamedPipeInfo(pipe Handle, flags *uint32, outSize *uint32, inSize *uint32, maxInstances *uint32) (err error) +//sys GetNamedPipeHandleState(pipe Handle, state *uint32, curInstances *uint32, maxCollectionCount *uint32, collectDataTimeout *uint32, userName *uint16, maxUserNameSize uint32) (err error) = GetNamedPipeHandleStateW +//sys SetNamedPipeHandleState(pipe Handle, state *uint32, maxCollectionCount *uint32, collectDataTimeout *uint32) (err error) = SetNamedPipeHandleState +//sys readFile(handle Handle, buf []byte, done *uint32, overlapped *Overlapped) (err error) = ReadFile +//sys writeFile(handle Handle, buf []byte, done *uint32, overlapped *Overlapped) (err error) = WriteFile +//sys GetOverlappedResult(handle Handle, overlapped *Overlapped, done *uint32, wait bool) (err error) +//sys SetFilePointer(handle Handle, lowoffset int32, highoffsetptr *int32, whence uint32) (newlowoffset uint32, err error) [failretval==0xffffffff] +//sys CloseHandle(handle Handle) (err error) +//sys GetStdHandle(stdhandle uint32) (handle Handle, err error) [failretval==InvalidHandle] +//sys SetStdHandle(stdhandle uint32, handle Handle) (err error) +//sys findFirstFile1(name *uint16, data *win32finddata1) (handle Handle, err error) [failretval==InvalidHandle] = FindFirstFileW +//sys findNextFile1(handle Handle, data *win32finddata1) (err error) = FindNextFileW +//sys FindClose(handle Handle) (err error) +//sys GetFileInformationByHandle(handle Handle, data *ByHandleFileInformation) (err error) +//sys GetFileInformationByHandleEx(handle Handle, class uint32, outBuffer *byte, outBufferLen uint32) (err error) +//sys SetFileInformationByHandle(handle Handle, class uint32, inBuffer *byte, inBufferLen uint32) (err error) +//sys GetCurrentDirectory(buflen uint32, buf *uint16) (n uint32, err error) = GetCurrentDirectoryW +//sys SetCurrentDirectory(path *uint16) (err error) = SetCurrentDirectoryW +//sys CreateDirectory(path *uint16, sa *SecurityAttributes) (err error) = CreateDirectoryW +//sys RemoveDirectory(path *uint16) (err error) = RemoveDirectoryW +//sys DeleteFile(path *uint16) (err error) = DeleteFileW +//sys MoveFile(from *uint16, to *uint16) (err error) = MoveFileW +//sys MoveFileEx(from *uint16, to *uint16, flags uint32) (err error) = MoveFileExW +//sys LockFileEx(file Handle, flags uint32, reserved uint32, bytesLow uint32, bytesHigh uint32, overlapped *Overlapped) (err error) +//sys UnlockFileEx(file Handle, reserved uint32, bytesLow uint32, bytesHigh uint32, overlapped *Overlapped) (err error) +//sys GetComputerName(buf *uint16, n *uint32) (err error) = GetComputerNameW +//sys GetComputerNameEx(nametype uint32, buf *uint16, n *uint32) (err error) = GetComputerNameExW +//sys SetEndOfFile(handle Handle) (err error) +//sys SetFileValidData(handle Handle, validDataLength int64) (err error) +//sys GetSystemTimeAsFileTime(time *Filetime) +//sys GetSystemTimePreciseAsFileTime(time *Filetime) +//sys GetTimeZoneInformation(tzi *Timezoneinformation) (rc uint32, err error) [failretval==0xffffffff] +//sys CreateIoCompletionPort(filehandle Handle, cphandle Handle, key uintptr, threadcnt uint32) (handle Handle, err error) +//sys GetQueuedCompletionStatus(cphandle Handle, qty *uint32, key *uintptr, overlapped **Overlapped, timeout uint32) (err error) +//sys PostQueuedCompletionStatus(cphandle Handle, qty uint32, key uintptr, overlapped *Overlapped) (err error) +//sys CancelIo(s Handle) (err error) +//sys CancelIoEx(s Handle, o *Overlapped) (err error) +//sys CreateProcess(appName *uint16, commandLine *uint16, procSecurity *SecurityAttributes, threadSecurity *SecurityAttributes, inheritHandles bool, creationFlags uint32, env *uint16, currentDir *uint16, startupInfo *StartupInfo, outProcInfo *ProcessInformation) (err error) = CreateProcessW +//sys CreateProcessAsUser(token Token, appName *uint16, commandLine *uint16, procSecurity *SecurityAttributes, threadSecurity *SecurityAttributes, inheritHandles bool, creationFlags uint32, env *uint16, currentDir *uint16, startupInfo *StartupInfo, outProcInfo *ProcessInformation) (err error) = advapi32.CreateProcessAsUserW +//sys initializeProcThreadAttributeList(attrlist *ProcThreadAttributeList, attrcount uint32, flags uint32, size *uintptr) (err error) = InitializeProcThreadAttributeList +//sys deleteProcThreadAttributeList(attrlist *ProcThreadAttributeList) = DeleteProcThreadAttributeList +//sys updateProcThreadAttribute(attrlist *ProcThreadAttributeList, flags uint32, attr uintptr, value unsafe.Pointer, size uintptr, prevvalue unsafe.Pointer, returnedsize *uintptr) (err error) = UpdateProcThreadAttribute +//sys OpenProcess(desiredAccess uint32, inheritHandle bool, processId uint32) (handle Handle, err error) +//sys ShellExecute(hwnd Handle, verb *uint16, file *uint16, args *uint16, cwd *uint16, showCmd int32) (err error) [failretval<=32] = shell32.ShellExecuteW +//sys GetWindowThreadProcessId(hwnd HWND, pid *uint32) (tid uint32, err error) = user32.GetWindowThreadProcessId +//sys LoadKeyboardLayout(name *uint16, flags uint32) (hkl Handle, err error) [failretval==0] = user32.LoadKeyboardLayoutW +//sys UnloadKeyboardLayout(hkl Handle) (err error) = user32.UnloadKeyboardLayout +//sys GetKeyboardLayout(tid uint32) (hkl Handle) = user32.GetKeyboardLayout +//sys ToUnicodeEx(vkey uint32, scancode uint32, keystate *byte, pwszBuff *uint16, cchBuff int32, flags uint32, hkl Handle) (ret int32) = user32.ToUnicodeEx +//sys GetShellWindow() (shellWindow HWND) = user32.GetShellWindow +//sys MessageBox(hwnd HWND, text *uint16, caption *uint16, boxtype uint32) (ret int32, err error) [failretval==0] = user32.MessageBoxW +//sys ExitWindowsEx(flags uint32, reason uint32) (err error) = user32.ExitWindowsEx +//sys shGetKnownFolderPath(id *KNOWNFOLDERID, flags uint32, token Token, path **uint16) (ret error) = shell32.SHGetKnownFolderPath +//sys TerminateProcess(handle Handle, exitcode uint32) (err error) +//sys GetExitCodeProcess(handle Handle, exitcode *uint32) (err error) +//sys getStartupInfo(startupInfo *StartupInfo) = GetStartupInfoW +//sys GetProcessTimes(handle Handle, creationTime *Filetime, exitTime *Filetime, kernelTime *Filetime, userTime *Filetime) (err error) +//sys DuplicateHandle(hSourceProcessHandle Handle, hSourceHandle Handle, hTargetProcessHandle Handle, lpTargetHandle *Handle, dwDesiredAccess uint32, bInheritHandle bool, dwOptions uint32) (err error) +//sys WaitForSingleObject(handle Handle, waitMilliseconds uint32) (event uint32, err error) [failretval==0xffffffff] +//sys waitForMultipleObjects(count uint32, handles uintptr, waitAll bool, waitMilliseconds uint32) (event uint32, err error) [failretval==0xffffffff] = WaitForMultipleObjects +//sys GetTempPath(buflen uint32, buf *uint16) (n uint32, err error) = GetTempPathW +//sys CreatePipe(readhandle *Handle, writehandle *Handle, sa *SecurityAttributes, size uint32) (err error) +//sys GetFileType(filehandle Handle) (n uint32, err error) +//sys CryptAcquireContext(provhandle *Handle, container *uint16, provider *uint16, provtype uint32, flags uint32) (err error) = advapi32.CryptAcquireContextW +//sys CryptReleaseContext(provhandle Handle, flags uint32) (err error) = advapi32.CryptReleaseContext +//sys CryptGenRandom(provhandle Handle, buflen uint32, buf *byte) (err error) = advapi32.CryptGenRandom +//sys GetEnvironmentStrings() (envs *uint16, err error) [failretval==nil] = kernel32.GetEnvironmentStringsW +//sys FreeEnvironmentStrings(envs *uint16) (err error) = kernel32.FreeEnvironmentStringsW +//sys GetEnvironmentVariable(name *uint16, buffer *uint16, size uint32) (n uint32, err error) = kernel32.GetEnvironmentVariableW +//sys SetEnvironmentVariable(name *uint16, value *uint16) (err error) = kernel32.SetEnvironmentVariableW +//sys ExpandEnvironmentStrings(src *uint16, dst *uint16, size uint32) (n uint32, err error) = kernel32.ExpandEnvironmentStringsW +//sys CreateEnvironmentBlock(block **uint16, token Token, inheritExisting bool) (err error) = userenv.CreateEnvironmentBlock +//sys DestroyEnvironmentBlock(block *uint16) (err error) = userenv.DestroyEnvironmentBlock +//sys getTickCount64() (ms uint64) = kernel32.GetTickCount64 +//sys GetFileTime(handle Handle, ctime *Filetime, atime *Filetime, wtime *Filetime) (err error) +//sys SetFileTime(handle Handle, ctime *Filetime, atime *Filetime, wtime *Filetime) (err error) +//sys GetFileAttributes(name *uint16) (attrs uint32, err error) [failretval==INVALID_FILE_ATTRIBUTES] = kernel32.GetFileAttributesW +//sys SetFileAttributes(name *uint16, attrs uint32) (err error) = kernel32.SetFileAttributesW +//sys GetFileAttributesEx(name *uint16, level uint32, info *byte) (err error) = kernel32.GetFileAttributesExW +//sys GetCommandLine() (cmd *uint16) = kernel32.GetCommandLineW +//sys commandLineToArgv(cmd *uint16, argc *int32) (argv **uint16, err error) [failretval==nil] = shell32.CommandLineToArgvW +//sys LocalFree(hmem Handle) (handle Handle, err error) [failretval!=0] +//sys LocalAlloc(flags uint32, length uint32) (ptr uintptr, err error) +//sys SetHandleInformation(handle Handle, mask uint32, flags uint32) (err error) +//sys FlushFileBuffers(handle Handle) (err error) +//sys GetFullPathName(path *uint16, buflen uint32, buf *uint16, fname **uint16) (n uint32, err error) = kernel32.GetFullPathNameW +//sys GetLongPathName(path *uint16, buf *uint16, buflen uint32) (n uint32, err error) = kernel32.GetLongPathNameW +//sys GetShortPathName(longpath *uint16, shortpath *uint16, buflen uint32) (n uint32, err error) = kernel32.GetShortPathNameW +//sys GetFinalPathNameByHandle(file Handle, filePath *uint16, filePathSize uint32, flags uint32) (n uint32, err error) = kernel32.GetFinalPathNameByHandleW +//sys CreateFileMapping(fhandle Handle, sa *SecurityAttributes, prot uint32, maxSizeHigh uint32, maxSizeLow uint32, name *uint16) (handle Handle, err error) [failretval == 0 || e1 == ERROR_ALREADY_EXISTS] = kernel32.CreateFileMappingW +//sys MapViewOfFile(handle Handle, access uint32, offsetHigh uint32, offsetLow uint32, length uintptr) (addr uintptr, err error) +//sys UnmapViewOfFile(addr uintptr) (err error) +//sys FlushViewOfFile(addr uintptr, length uintptr) (err error) +//sys VirtualLock(addr uintptr, length uintptr) (err error) +//sys VirtualUnlock(addr uintptr, length uintptr) (err error) +//sys VirtualAlloc(address uintptr, size uintptr, alloctype uint32, protect uint32) (value uintptr, err error) = kernel32.VirtualAlloc +//sys VirtualFree(address uintptr, size uintptr, freetype uint32) (err error) = kernel32.VirtualFree +//sys VirtualProtect(address uintptr, size uintptr, newprotect uint32, oldprotect *uint32) (err error) = kernel32.VirtualProtect +//sys VirtualProtectEx(process Handle, address uintptr, size uintptr, newProtect uint32, oldProtect *uint32) (err error) = kernel32.VirtualProtectEx +//sys VirtualQuery(address uintptr, buffer *MemoryBasicInformation, length uintptr) (err error) = kernel32.VirtualQuery +//sys VirtualQueryEx(process Handle, address uintptr, buffer *MemoryBasicInformation, length uintptr) (err error) = kernel32.VirtualQueryEx +//sys ReadProcessMemory(process Handle, baseAddress uintptr, buffer *byte, size uintptr, numberOfBytesRead *uintptr) (err error) = kernel32.ReadProcessMemory +//sys WriteProcessMemory(process Handle, baseAddress uintptr, buffer *byte, size uintptr, numberOfBytesWritten *uintptr) (err error) = kernel32.WriteProcessMemory +//sys TransmitFile(s Handle, handle Handle, bytesToWrite uint32, bytsPerSend uint32, overlapped *Overlapped, transmitFileBuf *TransmitFileBuffers, flags uint32) (err error) = mswsock.TransmitFile +//sys ReadDirectoryChanges(handle Handle, buf *byte, buflen uint32, watchSubTree bool, mask uint32, retlen *uint32, overlapped *Overlapped, completionRoutine uintptr) (err error) = kernel32.ReadDirectoryChangesW +//sys FindFirstChangeNotification(path string, watchSubtree bool, notifyFilter uint32) (handle Handle, err error) [failretval==InvalidHandle] = kernel32.FindFirstChangeNotificationW +//sys FindNextChangeNotification(handle Handle) (err error) +//sys FindCloseChangeNotification(handle Handle) (err error) +//sys CertOpenSystemStore(hprov Handle, name *uint16) (store Handle, err error) = crypt32.CertOpenSystemStoreW +//sys CertOpenStore(storeProvider uintptr, msgAndCertEncodingType uint32, cryptProv uintptr, flags uint32, para uintptr) (handle Handle, err error) = crypt32.CertOpenStore +//sys CertEnumCertificatesInStore(store Handle, prevContext *CertContext) (context *CertContext, err error) [failretval==nil] = crypt32.CertEnumCertificatesInStore +//sys CertAddCertificateContextToStore(store Handle, certContext *CertContext, addDisposition uint32, storeContext **CertContext) (err error) = crypt32.CertAddCertificateContextToStore +//sys CertCloseStore(store Handle, flags uint32) (err error) = crypt32.CertCloseStore +//sys CertDeleteCertificateFromStore(certContext *CertContext) (err error) = crypt32.CertDeleteCertificateFromStore +//sys CertDuplicateCertificateContext(certContext *CertContext) (dupContext *CertContext) = crypt32.CertDuplicateCertificateContext +//sys PFXImportCertStore(pfx *CryptDataBlob, password *uint16, flags uint32) (store Handle, err error) = crypt32.PFXImportCertStore +//sys CertGetCertificateChain(engine Handle, leaf *CertContext, time *Filetime, additionalStore Handle, para *CertChainPara, flags uint32, reserved uintptr, chainCtx **CertChainContext) (err error) = crypt32.CertGetCertificateChain +//sys CertFreeCertificateChain(ctx *CertChainContext) = crypt32.CertFreeCertificateChain +//sys CertCreateCertificateContext(certEncodingType uint32, certEncoded *byte, encodedLen uint32) (context *CertContext, err error) [failretval==nil] = crypt32.CertCreateCertificateContext +//sys CertFreeCertificateContext(ctx *CertContext) (err error) = crypt32.CertFreeCertificateContext +//sys CertVerifyCertificateChainPolicy(policyOID uintptr, chain *CertChainContext, para *CertChainPolicyPara, status *CertChainPolicyStatus) (err error) = crypt32.CertVerifyCertificateChainPolicy +//sys CertGetNameString(certContext *CertContext, nameType uint32, flags uint32, typePara unsafe.Pointer, name *uint16, size uint32) (chars uint32) = crypt32.CertGetNameStringW +//sys CertFindExtension(objId *byte, countExtensions uint32, extensions *CertExtension) (ret *CertExtension) = crypt32.CertFindExtension +//sys CertFindCertificateInStore(store Handle, certEncodingType uint32, findFlags uint32, findType uint32, findPara unsafe.Pointer, prevCertContext *CertContext) (cert *CertContext, err error) [failretval==nil] = crypt32.CertFindCertificateInStore +//sys CertFindChainInStore(store Handle, certEncodingType uint32, findFlags uint32, findType uint32, findPara unsafe.Pointer, prevChainContext *CertChainContext) (certchain *CertChainContext, err error) [failretval==nil] = crypt32.CertFindChainInStore +//sys CryptAcquireCertificatePrivateKey(cert *CertContext, flags uint32, parameters unsafe.Pointer, cryptProvOrNCryptKey *Handle, keySpec *uint32, callerFreeProvOrNCryptKey *bool) (err error) = crypt32.CryptAcquireCertificatePrivateKey +//sys CryptQueryObject(objectType uint32, object unsafe.Pointer, expectedContentTypeFlags uint32, expectedFormatTypeFlags uint32, flags uint32, msgAndCertEncodingType *uint32, contentType *uint32, formatType *uint32, certStore *Handle, msg *Handle, context *unsafe.Pointer) (err error) = crypt32.CryptQueryObject +//sys CryptDecodeObject(encodingType uint32, structType *byte, encodedBytes *byte, lenEncodedBytes uint32, flags uint32, decoded unsafe.Pointer, decodedLen *uint32) (err error) = crypt32.CryptDecodeObject +//sys CryptProtectData(dataIn *DataBlob, name *uint16, optionalEntropy *DataBlob, reserved uintptr, promptStruct *CryptProtectPromptStruct, flags uint32, dataOut *DataBlob) (err error) = crypt32.CryptProtectData +//sys CryptUnprotectData(dataIn *DataBlob, name **uint16, optionalEntropy *DataBlob, reserved uintptr, promptStruct *CryptProtectPromptStruct, flags uint32, dataOut *DataBlob) (err error) = crypt32.CryptUnprotectData +//sys WinVerifyTrustEx(hwnd HWND, actionId *GUID, data *WinTrustData) (ret error) = wintrust.WinVerifyTrustEx +//sys RegOpenKeyEx(key Handle, subkey *uint16, options uint32, desiredAccess uint32, result *Handle) (regerrno error) = advapi32.RegOpenKeyExW +//sys RegCloseKey(key Handle) (regerrno error) = advapi32.RegCloseKey +//sys RegQueryInfoKey(key Handle, class *uint16, classLen *uint32, reserved *uint32, subkeysLen *uint32, maxSubkeyLen *uint32, maxClassLen *uint32, valuesLen *uint32, maxValueNameLen *uint32, maxValueLen *uint32, saLen *uint32, lastWriteTime *Filetime) (regerrno error) = advapi32.RegQueryInfoKeyW +//sys RegEnumKeyEx(key Handle, index uint32, name *uint16, nameLen *uint32, reserved *uint32, class *uint16, classLen *uint32, lastWriteTime *Filetime) (regerrno error) = advapi32.RegEnumKeyExW +//sys RegQueryValueEx(key Handle, name *uint16, reserved *uint32, valtype *uint32, buf *byte, buflen *uint32) (regerrno error) = advapi32.RegQueryValueExW +//sys RegNotifyChangeKeyValue(key Handle, watchSubtree bool, notifyFilter uint32, event Handle, asynchronous bool) (regerrno error) = advapi32.RegNotifyChangeKeyValue +//sys GetCurrentProcessId() (pid uint32) = kernel32.GetCurrentProcessId +//sys ProcessIdToSessionId(pid uint32, sessionid *uint32) (err error) = kernel32.ProcessIdToSessionId +//sys ClosePseudoConsole(console Handle) = kernel32.ClosePseudoConsole +//sys createPseudoConsole(size uint32, in Handle, out Handle, flags uint32, pconsole *Handle) (hr error) = kernel32.CreatePseudoConsole +//sys GetConsoleMode(console Handle, mode *uint32) (err error) = kernel32.GetConsoleMode +//sys SetConsoleMode(console Handle, mode uint32) (err error) = kernel32.SetConsoleMode +//sys GetConsoleScreenBufferInfo(console Handle, info *ConsoleScreenBufferInfo) (err error) = kernel32.GetConsoleScreenBufferInfo +//sys setConsoleCursorPosition(console Handle, position uint32) (err error) = kernel32.SetConsoleCursorPosition +//sys GetConsoleCP() (cp uint32, err error) = kernel32.GetConsoleCP +//sys GetConsoleOutputCP() (cp uint32, err error) = kernel32.GetConsoleOutputCP +//sys SetConsoleCP(cp uint32) (err error) = kernel32.SetConsoleCP +//sys SetConsoleOutputCP(cp uint32) (err error) = kernel32.SetConsoleOutputCP +//sys WriteConsole(console Handle, buf *uint16, towrite uint32, written *uint32, reserved *byte) (err error) = kernel32.WriteConsoleW +//sys ReadConsole(console Handle, buf *uint16, toread uint32, read *uint32, inputControl *byte) (err error) = kernel32.ReadConsoleW +//sys GetNumberOfConsoleInputEvents(console Handle, numevents *uint32) (err error) = kernel32.GetNumberOfConsoleInputEvents +//sys FlushConsoleInputBuffer(console Handle) (err error) = kernel32.FlushConsoleInputBuffer +//sys resizePseudoConsole(pconsole Handle, size uint32) (hr error) = kernel32.ResizePseudoConsole +//sys CreateToolhelp32Snapshot(flags uint32, processId uint32) (handle Handle, err error) [failretval==InvalidHandle] = kernel32.CreateToolhelp32Snapshot +//sys Module32First(snapshot Handle, moduleEntry *ModuleEntry32) (err error) = kernel32.Module32FirstW +//sys Module32Next(snapshot Handle, moduleEntry *ModuleEntry32) (err error) = kernel32.Module32NextW +//sys Process32First(snapshot Handle, procEntry *ProcessEntry32) (err error) = kernel32.Process32FirstW +//sys Process32Next(snapshot Handle, procEntry *ProcessEntry32) (err error) = kernel32.Process32NextW +//sys Thread32First(snapshot Handle, threadEntry *ThreadEntry32) (err error) +//sys Thread32Next(snapshot Handle, threadEntry *ThreadEntry32) (err error) +//sys DeviceIoControl(handle Handle, ioControlCode uint32, inBuffer *byte, inBufferSize uint32, outBuffer *byte, outBufferSize uint32, bytesReturned *uint32, overlapped *Overlapped) (err error) +// This function returns 1 byte BOOLEAN rather than the 4 byte BOOL. +//sys CreateSymbolicLink(symlinkfilename *uint16, targetfilename *uint16, flags uint32) (err error) [failretval&0xff==0] = CreateSymbolicLinkW +//sys CreateHardLink(filename *uint16, existingfilename *uint16, reserved uintptr) (err error) [failretval&0xff==0] = CreateHardLinkW +//sys GetCurrentThreadId() (id uint32) +//sys CreateEvent(eventAttrs *SecurityAttributes, manualReset uint32, initialState uint32, name *uint16) (handle Handle, err error) [failretval == 0 || e1 == ERROR_ALREADY_EXISTS] = kernel32.CreateEventW +//sys CreateEventEx(eventAttrs *SecurityAttributes, name *uint16, flags uint32, desiredAccess uint32) (handle Handle, err error) [failretval == 0 || e1 == ERROR_ALREADY_EXISTS] = kernel32.CreateEventExW +//sys OpenEvent(desiredAccess uint32, inheritHandle bool, name *uint16) (handle Handle, err error) = kernel32.OpenEventW +//sys SetEvent(event Handle) (err error) = kernel32.SetEvent +//sys ResetEvent(event Handle) (err error) = kernel32.ResetEvent +//sys PulseEvent(event Handle) (err error) = kernel32.PulseEvent +//sys CreateMutex(mutexAttrs *SecurityAttributes, initialOwner bool, name *uint16) (handle Handle, err error) [failretval == 0 || e1 == ERROR_ALREADY_EXISTS] = kernel32.CreateMutexW +//sys CreateMutexEx(mutexAttrs *SecurityAttributes, name *uint16, flags uint32, desiredAccess uint32) (handle Handle, err error) [failretval == 0 || e1 == ERROR_ALREADY_EXISTS] = kernel32.CreateMutexExW +//sys OpenMutex(desiredAccess uint32, inheritHandle bool, name *uint16) (handle Handle, err error) = kernel32.OpenMutexW +//sys ReleaseMutex(mutex Handle) (err error) = kernel32.ReleaseMutex +//sys SleepEx(milliseconds uint32, alertable bool) (ret uint32) = kernel32.SleepEx +//sys CreateJobObject(jobAttr *SecurityAttributes, name *uint16) (handle Handle, err error) = kernel32.CreateJobObjectW +//sys AssignProcessToJobObject(job Handle, process Handle) (err error) = kernel32.AssignProcessToJobObject +//sys TerminateJobObject(job Handle, exitCode uint32) (err error) = kernel32.TerminateJobObject +//sys SetErrorMode(mode uint32) (ret uint32) = kernel32.SetErrorMode +//sys ResumeThread(thread Handle) (ret uint32, err error) [failretval==0xffffffff] = kernel32.ResumeThread +//sys SetPriorityClass(process Handle, priorityClass uint32) (err error) = kernel32.SetPriorityClass +//sys GetPriorityClass(process Handle) (ret uint32, err error) = kernel32.GetPriorityClass +//sys QueryInformationJobObject(job Handle, JobObjectInformationClass int32, JobObjectInformation uintptr, JobObjectInformationLength uint32, retlen *uint32) (err error) = kernel32.QueryInformationJobObject +//sys SetInformationJobObject(job Handle, JobObjectInformationClass uint32, JobObjectInformation uintptr, JobObjectInformationLength uint32) (ret int, err error) +//sys GenerateConsoleCtrlEvent(ctrlEvent uint32, processGroupID uint32) (err error) +//sys GetProcessId(process Handle) (id uint32, err error) +//sys QueryFullProcessImageName(proc Handle, flags uint32, exeName *uint16, size *uint32) (err error) = kernel32.QueryFullProcessImageNameW +//sys OpenThread(desiredAccess uint32, inheritHandle bool, threadId uint32) (handle Handle, err error) +//sys SetProcessPriorityBoost(process Handle, disable bool) (err error) = kernel32.SetProcessPriorityBoost +//sys GetProcessWorkingSetSizeEx(hProcess Handle, lpMinimumWorkingSetSize *uintptr, lpMaximumWorkingSetSize *uintptr, flags *uint32) +//sys SetProcessWorkingSetSizeEx(hProcess Handle, dwMinimumWorkingSetSize uintptr, dwMaximumWorkingSetSize uintptr, flags uint32) (err error) +//sys ClearCommBreak(handle Handle) (err error) +//sys ClearCommError(handle Handle, lpErrors *uint32, lpStat *ComStat) (err error) +//sys EscapeCommFunction(handle Handle, dwFunc uint32) (err error) +//sys GetCommState(handle Handle, lpDCB *DCB) (err error) +//sys GetCommModemStatus(handle Handle, lpModemStat *uint32) (err error) +//sys GetCommTimeouts(handle Handle, timeouts *CommTimeouts) (err error) +//sys PurgeComm(handle Handle, dwFlags uint32) (err error) +//sys SetCommBreak(handle Handle) (err error) +//sys SetCommMask(handle Handle, dwEvtMask uint32) (err error) +//sys SetCommState(handle Handle, lpDCB *DCB) (err error) +//sys SetCommTimeouts(handle Handle, timeouts *CommTimeouts) (err error) +//sys SetupComm(handle Handle, dwInQueue uint32, dwOutQueue uint32) (err error) +//sys WaitCommEvent(handle Handle, lpEvtMask *uint32, lpOverlapped *Overlapped) (err error) +//sys GetActiveProcessorCount(groupNumber uint16) (ret uint32) +//sys GetMaximumProcessorCount(groupNumber uint16) (ret uint32) +//sys EnumWindows(enumFunc uintptr, param unsafe.Pointer) (err error) = user32.EnumWindows +//sys EnumChildWindows(hwnd HWND, enumFunc uintptr, param unsafe.Pointer) = user32.EnumChildWindows +//sys GetClassName(hwnd HWND, className *uint16, maxCount int32) (copied int32, err error) = user32.GetClassNameW +//sys GetDesktopWindow() (hwnd HWND) = user32.GetDesktopWindow +//sys GetForegroundWindow() (hwnd HWND) = user32.GetForegroundWindow +//sys IsWindow(hwnd HWND) (isWindow bool) = user32.IsWindow +//sys IsWindowUnicode(hwnd HWND) (isUnicode bool) = user32.IsWindowUnicode +//sys IsWindowVisible(hwnd HWND) (isVisible bool) = user32.IsWindowVisible +//sys GetGUIThreadInfo(thread uint32, info *GUIThreadInfo) (err error) = user32.GetGUIThreadInfo +//sys GetLargePageMinimum() (size uintptr) + +// Volume Management Functions +//sys DefineDosDevice(flags uint32, deviceName *uint16, targetPath *uint16) (err error) = DefineDosDeviceW +//sys DeleteVolumeMountPoint(volumeMountPoint *uint16) (err error) = DeleteVolumeMountPointW +//sys FindFirstVolume(volumeName *uint16, bufferLength uint32) (handle Handle, err error) [failretval==InvalidHandle] = FindFirstVolumeW +//sys FindFirstVolumeMountPoint(rootPathName *uint16, volumeMountPoint *uint16, bufferLength uint32) (handle Handle, err error) [failretval==InvalidHandle] = FindFirstVolumeMountPointW +//sys FindNextVolume(findVolume Handle, volumeName *uint16, bufferLength uint32) (err error) = FindNextVolumeW +//sys FindNextVolumeMountPoint(findVolumeMountPoint Handle, volumeMountPoint *uint16, bufferLength uint32) (err error) = FindNextVolumeMountPointW +//sys FindVolumeClose(findVolume Handle) (err error) +//sys FindVolumeMountPointClose(findVolumeMountPoint Handle) (err error) +//sys GetDiskFreeSpaceEx(directoryName *uint16, freeBytesAvailableToCaller *uint64, totalNumberOfBytes *uint64, totalNumberOfFreeBytes *uint64) (err error) = GetDiskFreeSpaceExW +//sys GetDriveType(rootPathName *uint16) (driveType uint32) = GetDriveTypeW +//sys GetLogicalDrives() (drivesBitMask uint32, err error) [failretval==0] +//sys GetLogicalDriveStrings(bufferLength uint32, buffer *uint16) (n uint32, err error) [failretval==0] = GetLogicalDriveStringsW +//sys GetVolumeInformation(rootPathName *uint16, volumeNameBuffer *uint16, volumeNameSize uint32, volumeNameSerialNumber *uint32, maximumComponentLength *uint32, fileSystemFlags *uint32, fileSystemNameBuffer *uint16, fileSystemNameSize uint32) (err error) = GetVolumeInformationW +//sys GetVolumeInformationByHandle(file Handle, volumeNameBuffer *uint16, volumeNameSize uint32, volumeNameSerialNumber *uint32, maximumComponentLength *uint32, fileSystemFlags *uint32, fileSystemNameBuffer *uint16, fileSystemNameSize uint32) (err error) = GetVolumeInformationByHandleW +//sys GetVolumeNameForVolumeMountPoint(volumeMountPoint *uint16, volumeName *uint16, bufferlength uint32) (err error) = GetVolumeNameForVolumeMountPointW +//sys GetVolumePathName(fileName *uint16, volumePathName *uint16, bufferLength uint32) (err error) = GetVolumePathNameW +//sys GetVolumePathNamesForVolumeName(volumeName *uint16, volumePathNames *uint16, bufferLength uint32, returnLength *uint32) (err error) = GetVolumePathNamesForVolumeNameW +//sys QueryDosDevice(deviceName *uint16, targetPath *uint16, max uint32) (n uint32, err error) [failretval==0] = QueryDosDeviceW +//sys SetVolumeLabel(rootPathName *uint16, volumeName *uint16) (err error) = SetVolumeLabelW +//sys SetVolumeMountPoint(volumeMountPoint *uint16, volumeName *uint16) (err error) = SetVolumeMountPointW +//sys InitiateSystemShutdownEx(machineName *uint16, message *uint16, timeout uint32, forceAppsClosed bool, rebootAfterShutdown bool, reason uint32) (err error) = advapi32.InitiateSystemShutdownExW +//sys SetProcessShutdownParameters(level uint32, flags uint32) (err error) = kernel32.SetProcessShutdownParameters +//sys GetProcessShutdownParameters(level *uint32, flags *uint32) (err error) = kernel32.GetProcessShutdownParameters +//sys clsidFromString(lpsz *uint16, pclsid *GUID) (ret error) = ole32.CLSIDFromString +//sys stringFromGUID2(rguid *GUID, lpsz *uint16, cchMax int32) (chars int32) = ole32.StringFromGUID2 +//sys coCreateGuid(pguid *GUID) (ret error) = ole32.CoCreateGuid +//sys CoTaskMemFree(address unsafe.Pointer) = ole32.CoTaskMemFree +//sys CoInitializeEx(reserved uintptr, coInit uint32) (ret error) = ole32.CoInitializeEx +//sys CoUninitialize() = ole32.CoUninitialize +//sys CoGetObject(name *uint16, bindOpts *BIND_OPTS3, guid *GUID, functionTable **uintptr) (ret error) = ole32.CoGetObject +//sys getProcessPreferredUILanguages(flags uint32, numLanguages *uint32, buf *uint16, bufSize *uint32) (err error) = kernel32.GetProcessPreferredUILanguages +//sys getThreadPreferredUILanguages(flags uint32, numLanguages *uint32, buf *uint16, bufSize *uint32) (err error) = kernel32.GetThreadPreferredUILanguages +//sys getUserPreferredUILanguages(flags uint32, numLanguages *uint32, buf *uint16, bufSize *uint32) (err error) = kernel32.GetUserPreferredUILanguages +//sys getSystemPreferredUILanguages(flags uint32, numLanguages *uint32, buf *uint16, bufSize *uint32) (err error) = kernel32.GetSystemPreferredUILanguages +//sys findResource(module Handle, name uintptr, resType uintptr) (resInfo Handle, err error) = kernel32.FindResourceW +//sys SizeofResource(module Handle, resInfo Handle) (size uint32, err error) = kernel32.SizeofResource +//sys LoadResource(module Handle, resInfo Handle) (resData Handle, err error) = kernel32.LoadResource +//sys LockResource(resData Handle) (addr uintptr, err error) = kernel32.LockResource + +// Version APIs +//sys GetFileVersionInfoSize(filename string, zeroHandle *Handle) (bufSize uint32, err error) = version.GetFileVersionInfoSizeW +//sys GetFileVersionInfo(filename string, handle uint32, bufSize uint32, buffer unsafe.Pointer) (err error) = version.GetFileVersionInfoW +//sys VerQueryValue(block unsafe.Pointer, subBlock string, pointerToBufferPointer unsafe.Pointer, bufSize *uint32) (err error) = version.VerQueryValueW + +// Process Status API (PSAPI) +//sys enumProcesses(processIds *uint32, nSize uint32, bytesReturned *uint32) (err error) = psapi.EnumProcesses +//sys EnumProcessModules(process Handle, module *Handle, cb uint32, cbNeeded *uint32) (err error) = psapi.EnumProcessModules +//sys EnumProcessModulesEx(process Handle, module *Handle, cb uint32, cbNeeded *uint32, filterFlag uint32) (err error) = psapi.EnumProcessModulesEx +//sys GetModuleInformation(process Handle, module Handle, modinfo *ModuleInfo, cb uint32) (err error) = psapi.GetModuleInformation +//sys GetModuleFileNameEx(process Handle, module Handle, filename *uint16, size uint32) (err error) = psapi.GetModuleFileNameExW +//sys GetModuleBaseName(process Handle, module Handle, baseName *uint16, size uint32) (err error) = psapi.GetModuleBaseNameW +//sys QueryWorkingSetEx(process Handle, pv uintptr, cb uint32) (err error) = psapi.QueryWorkingSetEx + +// NT Native APIs +//sys rtlNtStatusToDosErrorNoTeb(ntstatus NTStatus) (ret syscall.Errno) = ntdll.RtlNtStatusToDosErrorNoTeb +//sys rtlGetVersion(info *OsVersionInfoEx) (ntstatus error) = ntdll.RtlGetVersion +//sys rtlGetNtVersionNumbers(majorVersion *uint32, minorVersion *uint32, buildNumber *uint32) = ntdll.RtlGetNtVersionNumbers +//sys RtlGetCurrentPeb() (peb *PEB) = ntdll.RtlGetCurrentPeb +//sys RtlInitUnicodeString(destinationString *NTUnicodeString, sourceString *uint16) = ntdll.RtlInitUnicodeString +//sys RtlInitString(destinationString *NTString, sourceString *byte) = ntdll.RtlInitString +//sys NtCreateFile(handle *Handle, access uint32, oa *OBJECT_ATTRIBUTES, iosb *IO_STATUS_BLOCK, allocationSize *int64, attributes uint32, share uint32, disposition uint32, options uint32, eabuffer uintptr, ealength uint32) (ntstatus error) = ntdll.NtCreateFile +//sys NtCreateNamedPipeFile(pipe *Handle, access uint32, oa *OBJECT_ATTRIBUTES, iosb *IO_STATUS_BLOCK, share uint32, disposition uint32, options uint32, typ uint32, readMode uint32, completionMode uint32, maxInstances uint32, inboundQuota uint32, outputQuota uint32, timeout *int64) (ntstatus error) = ntdll.NtCreateNamedPipeFile +//sys NtSetInformationFile(handle Handle, iosb *IO_STATUS_BLOCK, inBuffer *byte, inBufferLen uint32, class uint32) (ntstatus error) = ntdll.NtSetInformationFile +//sys RtlDosPathNameToNtPathName(dosName *uint16, ntName *NTUnicodeString, ntFileNamePart *uint16, relativeName *RTL_RELATIVE_NAME) (ntstatus error) = ntdll.RtlDosPathNameToNtPathName_U_WithStatus +//sys RtlDosPathNameToRelativeNtPathName(dosName *uint16, ntName *NTUnicodeString, ntFileNamePart *uint16, relativeName *RTL_RELATIVE_NAME) (ntstatus error) = ntdll.RtlDosPathNameToRelativeNtPathName_U_WithStatus +//sys RtlDefaultNpAcl(acl **ACL) (ntstatus error) = ntdll.RtlDefaultNpAcl +//sys NtQueryInformationProcess(proc Handle, procInfoClass int32, procInfo unsafe.Pointer, procInfoLen uint32, retLen *uint32) (ntstatus error) = ntdll.NtQueryInformationProcess +//sys NtSetInformationProcess(proc Handle, procInfoClass int32, procInfo unsafe.Pointer, procInfoLen uint32) (ntstatus error) = ntdll.NtSetInformationProcess +//sys NtQuerySystemInformation(sysInfoClass int32, sysInfo unsafe.Pointer, sysInfoLen uint32, retLen *uint32) (ntstatus error) = ntdll.NtQuerySystemInformation +//sys NtSetSystemInformation(sysInfoClass int32, sysInfo unsafe.Pointer, sysInfoLen uint32) (ntstatus error) = ntdll.NtSetSystemInformation +//sys RtlAddFunctionTable(functionTable *RUNTIME_FUNCTION, entryCount uint32, baseAddress uintptr) (ret bool) = ntdll.RtlAddFunctionTable +//sys RtlDeleteFunctionTable(functionTable *RUNTIME_FUNCTION) (ret bool) = ntdll.RtlDeleteFunctionTable + +// Desktop Window Manager API (Dwmapi) +//sys DwmGetWindowAttribute(hwnd HWND, attribute uint32, value unsafe.Pointer, size uint32) (ret error) = dwmapi.DwmGetWindowAttribute +//sys DwmSetWindowAttribute(hwnd HWND, attribute uint32, value unsafe.Pointer, size uint32) (ret error) = dwmapi.DwmSetWindowAttribute + +// Windows Multimedia API +//sys TimeBeginPeriod (period uint32) (err error) [failretval != 0] = winmm.timeBeginPeriod +//sys TimeEndPeriod (period uint32) (err error) [failretval != 0] = winmm.timeEndPeriod + +// syscall interface implementation for other packages + +// GetCurrentProcess returns the handle for the current process. +// It is a pseudo handle that does not need to be closed. +// The returned error is always nil. +// +// Deprecated: use CurrentProcess for the same Handle without the nil +// error. +func GetCurrentProcess() (Handle, error) { + return CurrentProcess(), nil +} + +// CurrentProcess returns the handle for the current process. +// It is a pseudo handle that does not need to be closed. +func CurrentProcess() Handle { return Handle(^uintptr(1 - 1)) } + +// GetCurrentThread returns the handle for the current thread. +// It is a pseudo handle that does not need to be closed. +// The returned error is always nil. +// +// Deprecated: use CurrentThread for the same Handle without the nil +// error. +func GetCurrentThread() (Handle, error) { + return CurrentThread(), nil +} + +// CurrentThread returns the handle for the current thread. +// It is a pseudo handle that does not need to be closed. +func CurrentThread() Handle { return Handle(^uintptr(2 - 1)) } + +// GetProcAddressByOrdinal retrieves the address of the exported +// function from module by ordinal. +func GetProcAddressByOrdinal(module Handle, ordinal uintptr) (proc uintptr, err error) { + r0, _, e1 := syscall.Syscall(procGetProcAddress.Addr(), 2, uintptr(module), ordinal, 0) + proc = uintptr(r0) + if proc == 0 { + err = errnoErr(e1) + } + return +} + +func Exit(code int) { ExitProcess(uint32(code)) } + +func makeInheritSa() *SecurityAttributes { + var sa SecurityAttributes + sa.Length = uint32(unsafe.Sizeof(sa)) + sa.InheritHandle = 1 + return &sa +} + +func Open(path string, mode int, perm uint32) (fd Handle, err error) { + if len(path) == 0 { + return InvalidHandle, ERROR_FILE_NOT_FOUND + } + pathp, err := UTF16PtrFromString(path) + if err != nil { + return InvalidHandle, err + } + var access uint32 + switch mode & (O_RDONLY | O_WRONLY | O_RDWR) { + case O_RDONLY: + access = GENERIC_READ + case O_WRONLY: + access = GENERIC_WRITE + case O_RDWR: + access = GENERIC_READ | GENERIC_WRITE + } + if mode&O_CREAT != 0 { + access |= GENERIC_WRITE + } + if mode&O_APPEND != 0 { + access &^= GENERIC_WRITE + access |= FILE_APPEND_DATA + } + sharemode := uint32(FILE_SHARE_READ | FILE_SHARE_WRITE) + var sa *SecurityAttributes + if mode&O_CLOEXEC == 0 { + sa = makeInheritSa() + } + var createmode uint32 + switch { + case mode&(O_CREAT|O_EXCL) == (O_CREAT | O_EXCL): + createmode = CREATE_NEW + case mode&(O_CREAT|O_TRUNC) == (O_CREAT | O_TRUNC): + createmode = CREATE_ALWAYS + case mode&O_CREAT == O_CREAT: + createmode = OPEN_ALWAYS + case mode&O_TRUNC == O_TRUNC: + createmode = TRUNCATE_EXISTING + default: + createmode = OPEN_EXISTING + } + var attrs uint32 = FILE_ATTRIBUTE_NORMAL + if perm&S_IWRITE == 0 { + attrs = FILE_ATTRIBUTE_READONLY + } + h, e := CreateFile(pathp, access, sharemode, sa, createmode, attrs, 0) + return h, e +} + +func Read(fd Handle, p []byte) (n int, err error) { + var done uint32 + e := ReadFile(fd, p, &done, nil) + if e != nil { + if e == ERROR_BROKEN_PIPE { + // NOTE(brainman): work around ERROR_BROKEN_PIPE is returned on reading EOF from stdin + return 0, nil + } + return 0, e + } + return int(done), nil +} + +func Write(fd Handle, p []byte) (n int, err error) { + if raceenabled { + raceReleaseMerge(unsafe.Pointer(&ioSync)) + } + var done uint32 + e := WriteFile(fd, p, &done, nil) + if e != nil { + return 0, e + } + return int(done), nil +} + +func ReadFile(fd Handle, p []byte, done *uint32, overlapped *Overlapped) error { + err := readFile(fd, p, done, overlapped) + if raceenabled { + if *done > 0 { + raceWriteRange(unsafe.Pointer(&p[0]), int(*done)) + } + raceAcquire(unsafe.Pointer(&ioSync)) + } + return err +} + +func WriteFile(fd Handle, p []byte, done *uint32, overlapped *Overlapped) error { + if raceenabled { + raceReleaseMerge(unsafe.Pointer(&ioSync)) + } + err := writeFile(fd, p, done, overlapped) + if raceenabled && *done > 0 { + raceReadRange(unsafe.Pointer(&p[0]), int(*done)) + } + return err +} + +var ioSync int64 + +func Seek(fd Handle, offset int64, whence int) (newoffset int64, err error) { + var w uint32 + switch whence { + case 0: + w = FILE_BEGIN + case 1: + w = FILE_CURRENT + case 2: + w = FILE_END + } + hi := int32(offset >> 32) + lo := int32(offset) + // use GetFileType to check pipe, pipe can't do seek + ft, _ := GetFileType(fd) + if ft == FILE_TYPE_PIPE { + return 0, syscall.EPIPE + } + rlo, e := SetFilePointer(fd, lo, &hi, w) + if e != nil { + return 0, e + } + return int64(hi)<<32 + int64(rlo), nil +} + +func Close(fd Handle) (err error) { + return CloseHandle(fd) +} + +var ( + Stdin = getStdHandle(STD_INPUT_HANDLE) + Stdout = getStdHandle(STD_OUTPUT_HANDLE) + Stderr = getStdHandle(STD_ERROR_HANDLE) +) + +func getStdHandle(stdhandle uint32) (fd Handle) { + r, _ := GetStdHandle(stdhandle) + return r +} + +const ImplementsGetwd = true + +func Getwd() (wd string, err error) { + b := make([]uint16, 300) + n, e := GetCurrentDirectory(uint32(len(b)), &b[0]) + if e != nil { + return "", e + } + return string(utf16.Decode(b[0:n])), nil +} + +func Chdir(path string) (err error) { + pathp, err := UTF16PtrFromString(path) + if err != nil { + return err + } + return SetCurrentDirectory(pathp) +} + +func Mkdir(path string, mode uint32) (err error) { + pathp, err := UTF16PtrFromString(path) + if err != nil { + return err + } + return CreateDirectory(pathp, nil) +} + +func Rmdir(path string) (err error) { + pathp, err := UTF16PtrFromString(path) + if err != nil { + return err + } + return RemoveDirectory(pathp) +} + +func Unlink(path string) (err error) { + pathp, err := UTF16PtrFromString(path) + if err != nil { + return err + } + return DeleteFile(pathp) +} + +func Rename(oldpath, newpath string) (err error) { + from, err := UTF16PtrFromString(oldpath) + if err != nil { + return err + } + to, err := UTF16PtrFromString(newpath) + if err != nil { + return err + } + return MoveFileEx(from, to, MOVEFILE_REPLACE_EXISTING) +} + +func ComputerName() (name string, err error) { + var n uint32 = MAX_COMPUTERNAME_LENGTH + 1 + b := make([]uint16, n) + e := GetComputerName(&b[0], &n) + if e != nil { + return "", e + } + return string(utf16.Decode(b[0:n])), nil +} + +func DurationSinceBoot() time.Duration { + return time.Duration(getTickCount64()) * time.Millisecond +} + +func Ftruncate(fd Handle, length int64) (err error) { + type _FILE_END_OF_FILE_INFO struct { + EndOfFile int64 + } + var info _FILE_END_OF_FILE_INFO + info.EndOfFile = length + return SetFileInformationByHandle(fd, FileEndOfFileInfo, (*byte)(unsafe.Pointer(&info)), uint32(unsafe.Sizeof(info))) +} + +func Gettimeofday(tv *Timeval) (err error) { + var ft Filetime + GetSystemTimeAsFileTime(&ft) + *tv = NsecToTimeval(ft.Nanoseconds()) + return nil +} + +func Pipe(p []Handle) (err error) { + if len(p) != 2 { + return syscall.EINVAL + } + var r, w Handle + e := CreatePipe(&r, &w, makeInheritSa(), 0) + if e != nil { + return e + } + p[0] = r + p[1] = w + return nil +} + +func Utimes(path string, tv []Timeval) (err error) { + if len(tv) != 2 { + return syscall.EINVAL + } + pathp, e := UTF16PtrFromString(path) + if e != nil { + return e + } + h, e := CreateFile(pathp, + FILE_WRITE_ATTRIBUTES, FILE_SHARE_WRITE, nil, + OPEN_EXISTING, FILE_FLAG_BACKUP_SEMANTICS, 0) + if e != nil { + return e + } + defer CloseHandle(h) + a := NsecToFiletime(tv[0].Nanoseconds()) + w := NsecToFiletime(tv[1].Nanoseconds()) + return SetFileTime(h, nil, &a, &w) +} + +func UtimesNano(path string, ts []Timespec) (err error) { + if len(ts) != 2 { + return syscall.EINVAL + } + pathp, e := UTF16PtrFromString(path) + if e != nil { + return e + } + h, e := CreateFile(pathp, + FILE_WRITE_ATTRIBUTES, FILE_SHARE_WRITE, nil, + OPEN_EXISTING, FILE_FLAG_BACKUP_SEMANTICS, 0) + if e != nil { + return e + } + defer CloseHandle(h) + a := NsecToFiletime(TimespecToNsec(ts[0])) + w := NsecToFiletime(TimespecToNsec(ts[1])) + return SetFileTime(h, nil, &a, &w) +} + +func Fsync(fd Handle) (err error) { + return FlushFileBuffers(fd) +} + +func Chmod(path string, mode uint32) (err error) { + p, e := UTF16PtrFromString(path) + if e != nil { + return e + } + attrs, e := GetFileAttributes(p) + if e != nil { + return e + } + if mode&S_IWRITE != 0 { + attrs &^= FILE_ATTRIBUTE_READONLY + } else { + attrs |= FILE_ATTRIBUTE_READONLY + } + return SetFileAttributes(p, attrs) +} + +func LoadGetSystemTimePreciseAsFileTime() error { + return procGetSystemTimePreciseAsFileTime.Find() +} + +func LoadCancelIoEx() error { + return procCancelIoEx.Find() +} + +func LoadSetFileCompletionNotificationModes() error { + return procSetFileCompletionNotificationModes.Find() +} + +func WaitForMultipleObjects(handles []Handle, waitAll bool, waitMilliseconds uint32) (event uint32, err error) { + // Every other win32 array API takes arguments as "pointer, count", except for this function. So we + // can't declare it as a usual [] type, because mksyscall will use the opposite order. We therefore + // trivially stub this ourselves. + + var handlePtr *Handle + if len(handles) > 0 { + handlePtr = &handles[0] + } + return waitForMultipleObjects(uint32(len(handles)), uintptr(unsafe.Pointer(handlePtr)), waitAll, waitMilliseconds) +} + +// net api calls + +const socket_error = uintptr(^uint32(0)) + +//sys WSAStartup(verreq uint32, data *WSAData) (sockerr error) = ws2_32.WSAStartup +//sys WSACleanup() (err error) [failretval==socket_error] = ws2_32.WSACleanup +//sys WSAIoctl(s Handle, iocc uint32, inbuf *byte, cbif uint32, outbuf *byte, cbob uint32, cbbr *uint32, overlapped *Overlapped, completionRoutine uintptr) (err error) [failretval==socket_error] = ws2_32.WSAIoctl +//sys WSALookupServiceBegin(querySet *WSAQUERYSET, flags uint32, handle *Handle) (err error) [failretval==socket_error] = ws2_32.WSALookupServiceBeginW +//sys WSALookupServiceNext(handle Handle, flags uint32, size *int32, querySet *WSAQUERYSET) (err error) [failretval==socket_error] = ws2_32.WSALookupServiceNextW +//sys WSALookupServiceEnd(handle Handle) (err error) [failretval==socket_error] = ws2_32.WSALookupServiceEnd +//sys socket(af int32, typ int32, protocol int32) (handle Handle, err error) [failretval==InvalidHandle] = ws2_32.socket +//sys sendto(s Handle, buf []byte, flags int32, to unsafe.Pointer, tolen int32) (err error) [failretval==socket_error] = ws2_32.sendto +//sys recvfrom(s Handle, buf []byte, flags int32, from *RawSockaddrAny, fromlen *int32) (n int32, err error) [failretval==-1] = ws2_32.recvfrom +//sys Setsockopt(s Handle, level int32, optname int32, optval *byte, optlen int32) (err error) [failretval==socket_error] = ws2_32.setsockopt +//sys Getsockopt(s Handle, level int32, optname int32, optval *byte, optlen *int32) (err error) [failretval==socket_error] = ws2_32.getsockopt +//sys bind(s Handle, name unsafe.Pointer, namelen int32) (err error) [failretval==socket_error] = ws2_32.bind +//sys connect(s Handle, name unsafe.Pointer, namelen int32) (err error) [failretval==socket_error] = ws2_32.connect +//sys getsockname(s Handle, rsa *RawSockaddrAny, addrlen *int32) (err error) [failretval==socket_error] = ws2_32.getsockname +//sys getpeername(s Handle, rsa *RawSockaddrAny, addrlen *int32) (err error) [failretval==socket_error] = ws2_32.getpeername +//sys listen(s Handle, backlog int32) (err error) [failretval==socket_error] = ws2_32.listen +//sys shutdown(s Handle, how int32) (err error) [failretval==socket_error] = ws2_32.shutdown +//sys Closesocket(s Handle) (err error) [failretval==socket_error] = ws2_32.closesocket +//sys AcceptEx(ls Handle, as Handle, buf *byte, rxdatalen uint32, laddrlen uint32, raddrlen uint32, recvd *uint32, overlapped *Overlapped) (err error) = mswsock.AcceptEx +//sys GetAcceptExSockaddrs(buf *byte, rxdatalen uint32, laddrlen uint32, raddrlen uint32, lrsa **RawSockaddrAny, lrsalen *int32, rrsa **RawSockaddrAny, rrsalen *int32) = mswsock.GetAcceptExSockaddrs +//sys WSARecv(s Handle, bufs *WSABuf, bufcnt uint32, recvd *uint32, flags *uint32, overlapped *Overlapped, croutine *byte) (err error) [failretval==socket_error] = ws2_32.WSARecv +//sys WSASend(s Handle, bufs *WSABuf, bufcnt uint32, sent *uint32, flags uint32, overlapped *Overlapped, croutine *byte) (err error) [failretval==socket_error] = ws2_32.WSASend +//sys WSARecvFrom(s Handle, bufs *WSABuf, bufcnt uint32, recvd *uint32, flags *uint32, from *RawSockaddrAny, fromlen *int32, overlapped *Overlapped, croutine *byte) (err error) [failretval==socket_error] = ws2_32.WSARecvFrom +//sys WSASendTo(s Handle, bufs *WSABuf, bufcnt uint32, sent *uint32, flags uint32, to *RawSockaddrAny, tolen int32, overlapped *Overlapped, croutine *byte) (err error) [failretval==socket_error] = ws2_32.WSASendTo +//sys WSASocket(af int32, typ int32, protocol int32, protoInfo *WSAProtocolInfo, group uint32, flags uint32) (handle Handle, err error) [failretval==InvalidHandle] = ws2_32.WSASocketW +//sys WSADuplicateSocket(s Handle, processID uint32, info *WSAProtocolInfo) (err error) [failretval!=0] = ws2_32.WSADuplicateSocketW +//sys GetHostByName(name string) (h *Hostent, err error) [failretval==nil] = ws2_32.gethostbyname +//sys GetServByName(name string, proto string) (s *Servent, err error) [failretval==nil] = ws2_32.getservbyname +//sys Ntohs(netshort uint16) (u uint16) = ws2_32.ntohs +//sys GetProtoByName(name string) (p *Protoent, err error) [failretval==nil] = ws2_32.getprotobyname +//sys DnsQuery(name string, qtype uint16, options uint32, extra *byte, qrs **DNSRecord, pr *byte) (status error) = dnsapi.DnsQuery_W +//sys DnsRecordListFree(rl *DNSRecord, freetype uint32) = dnsapi.DnsRecordListFree +//sys DnsNameCompare(name1 *uint16, name2 *uint16) (same bool) = dnsapi.DnsNameCompare_W +//sys GetAddrInfoW(nodename *uint16, servicename *uint16, hints *AddrinfoW, result **AddrinfoW) (sockerr error) = ws2_32.GetAddrInfoW +//sys FreeAddrInfoW(addrinfo *AddrinfoW) = ws2_32.FreeAddrInfoW +//sys GetIfEntry(pIfRow *MibIfRow) (errcode error) = iphlpapi.GetIfEntry +//sys GetAdaptersInfo(ai *IpAdapterInfo, ol *uint32) (errcode error) = iphlpapi.GetAdaptersInfo +//sys SetFileCompletionNotificationModes(handle Handle, flags uint8) (err error) = kernel32.SetFileCompletionNotificationModes +//sys WSAEnumProtocols(protocols *int32, protocolBuffer *WSAProtocolInfo, bufferLength *uint32) (n int32, err error) [failretval==-1] = ws2_32.WSAEnumProtocolsW +//sys WSAGetOverlappedResult(h Handle, o *Overlapped, bytes *uint32, wait bool, flags *uint32) (err error) = ws2_32.WSAGetOverlappedResult +//sys GetAdaptersAddresses(family uint32, flags uint32, reserved uintptr, adapterAddresses *IpAdapterAddresses, sizePointer *uint32) (errcode error) = iphlpapi.GetAdaptersAddresses +//sys GetACP() (acp uint32) = kernel32.GetACP +//sys MultiByteToWideChar(codePage uint32, dwFlags uint32, str *byte, nstr int32, wchar *uint16, nwchar int32) (nwrite int32, err error) = kernel32.MultiByteToWideChar +//sys getBestInterfaceEx(sockaddr unsafe.Pointer, pdwBestIfIndex *uint32) (errcode error) = iphlpapi.GetBestInterfaceEx +//sys GetIfEntry2Ex(level uint32, row *MibIfRow2) (errcode error) = iphlpapi.GetIfEntry2Ex +//sys GetIpForwardEntry2(row *MibIpForwardRow2) (errcode error) = iphlpapi.GetIpForwardEntry2 +//sys GetIpForwardTable2(family uint16, table **MibIpForwardTable2) (errcode error) = iphlpapi.GetIpForwardTable2 +//sys GetUnicastIpAddressEntry(row *MibUnicastIpAddressRow) (errcode error) = iphlpapi.GetUnicastIpAddressEntry +//sys FreeMibTable(memory unsafe.Pointer) = iphlpapi.FreeMibTable +//sys NotifyIpInterfaceChange(family uint16, callback uintptr, callerContext unsafe.Pointer, initialNotification bool, notificationHandle *Handle) (errcode error) = iphlpapi.NotifyIpInterfaceChange +//sys NotifyRouteChange2(family uint16, callback uintptr, callerContext unsafe.Pointer, initialNotification bool, notificationHandle *Handle) (errcode error) = iphlpapi.NotifyRouteChange2 +//sys NotifyUnicastIpAddressChange(family uint16, callback uintptr, callerContext unsafe.Pointer, initialNotification bool, notificationHandle *Handle) (errcode error) = iphlpapi.NotifyUnicastIpAddressChange +//sys CancelMibChangeNotify2(notificationHandle Handle) (errcode error) = iphlpapi.CancelMibChangeNotify2 +//sys IsProcessorFeaturePresent(ProcessorFeature uint32) (ret bool) = kernel32.IsProcessorFeaturePresent + +// For testing: clients can set this flag to force +// creation of IPv6 sockets to return EAFNOSUPPORT. +var SocketDisableIPv6 bool + +type RawSockaddrInet4 struct { + Family uint16 + Port uint16 + Addr [4]byte /* in_addr */ + Zero [8]uint8 +} + +type RawSockaddrInet6 struct { + Family uint16 + Port uint16 + Flowinfo uint32 + Addr [16]byte /* in6_addr */ + Scope_id uint32 +} + +// RawSockaddrInet is a union that contains an IPv4, an IPv6 address, or an address family. See +// https://learn.microsoft.com/en-us/windows/win32/api/ws2ipdef/ns-ws2ipdef-sockaddr_inet. +// +// A [*RawSockaddrInet] may be converted to a [*RawSockaddrInet4] or [*RawSockaddrInet6] using +// unsafe, depending on the address family. +type RawSockaddrInet struct { + Family uint16 + Port uint16 + Data [6]uint32 +} + +type RawSockaddr struct { + Family uint16 + Data [14]int8 +} + +type RawSockaddrAny struct { + Addr RawSockaddr + Pad [100]int8 +} + +type Sockaddr interface { + sockaddr() (ptr unsafe.Pointer, len int32, err error) // lowercase; only we can define Sockaddrs +} + +type SockaddrInet4 struct { + Port int + Addr [4]byte + raw RawSockaddrInet4 +} + +func (sa *SockaddrInet4) sockaddr() (unsafe.Pointer, int32, error) { + if sa.Port < 0 || sa.Port > 0xFFFF { + return nil, 0, syscall.EINVAL + } + sa.raw.Family = AF_INET + p := (*[2]byte)(unsafe.Pointer(&sa.raw.Port)) + p[0] = byte(sa.Port >> 8) + p[1] = byte(sa.Port) + sa.raw.Addr = sa.Addr + return unsafe.Pointer(&sa.raw), int32(unsafe.Sizeof(sa.raw)), nil +} + +type SockaddrInet6 struct { + Port int + ZoneId uint32 + Addr [16]byte + raw RawSockaddrInet6 +} + +func (sa *SockaddrInet6) sockaddr() (unsafe.Pointer, int32, error) { + if sa.Port < 0 || sa.Port > 0xFFFF { + return nil, 0, syscall.EINVAL + } + sa.raw.Family = AF_INET6 + p := (*[2]byte)(unsafe.Pointer(&sa.raw.Port)) + p[0] = byte(sa.Port >> 8) + p[1] = byte(sa.Port) + sa.raw.Scope_id = sa.ZoneId + sa.raw.Addr = sa.Addr + return unsafe.Pointer(&sa.raw), int32(unsafe.Sizeof(sa.raw)), nil +} + +type RawSockaddrUnix struct { + Family uint16 + Path [UNIX_PATH_MAX]int8 +} + +type SockaddrUnix struct { + Name string + raw RawSockaddrUnix +} + +func (sa *SockaddrUnix) sockaddr() (unsafe.Pointer, int32, error) { + name := sa.Name + n := len(name) + if n > len(sa.raw.Path) { + return nil, 0, syscall.EINVAL + } + if n == len(sa.raw.Path) && name[0] != '@' { + return nil, 0, syscall.EINVAL + } + sa.raw.Family = AF_UNIX + for i := 0; i < n; i++ { + sa.raw.Path[i] = int8(name[i]) + } + // length is family (uint16), name, NUL. + sl := int32(2) + if n > 0 { + sl += int32(n) + 1 + } + if sa.raw.Path[0] == '@' || (sa.raw.Path[0] == 0 && sl > 3) { + // Check sl > 3 so we don't change unnamed socket behavior. + sa.raw.Path[0] = 0 + // Don't count trailing NUL for abstract address. + sl-- + } + + return unsafe.Pointer(&sa.raw), sl, nil +} + +type RawSockaddrBth struct { + AddressFamily [2]byte + BtAddr [8]byte + ServiceClassId [16]byte + Port [4]byte +} + +type SockaddrBth struct { + BtAddr uint64 + ServiceClassId GUID + Port uint32 + + raw RawSockaddrBth +} + +func (sa *SockaddrBth) sockaddr() (unsafe.Pointer, int32, error) { + family := AF_BTH + sa.raw = RawSockaddrBth{ + AddressFamily: *(*[2]byte)(unsafe.Pointer(&family)), + BtAddr: *(*[8]byte)(unsafe.Pointer(&sa.BtAddr)), + Port: *(*[4]byte)(unsafe.Pointer(&sa.Port)), + ServiceClassId: *(*[16]byte)(unsafe.Pointer(&sa.ServiceClassId)), + } + return unsafe.Pointer(&sa.raw), int32(unsafe.Sizeof(sa.raw)), nil +} + +func (rsa *RawSockaddrAny) Sockaddr() (Sockaddr, error) { + switch rsa.Addr.Family { + case AF_UNIX: + pp := (*RawSockaddrUnix)(unsafe.Pointer(rsa)) + sa := new(SockaddrUnix) + if pp.Path[0] == 0 { + // "Abstract" Unix domain socket. + // Rewrite leading NUL as @ for textual display. + // (This is the standard convention.) + // Not friendly to overwrite in place, + // but the callers below don't care. + pp.Path[0] = '@' + } + + // Assume path ends at NUL. + // This is not technically the Linux semantics for + // abstract Unix domain sockets--they are supposed + // to be uninterpreted fixed-size binary blobs--but + // everyone uses this convention. + n := 0 + for n < len(pp.Path) && pp.Path[n] != 0 { + n++ + } + sa.Name = string(unsafe.Slice((*byte)(unsafe.Pointer(&pp.Path[0])), n)) + return sa, nil + + case AF_INET: + pp := (*RawSockaddrInet4)(unsafe.Pointer(rsa)) + sa := new(SockaddrInet4) + p := (*[2]byte)(unsafe.Pointer(&pp.Port)) + sa.Port = int(p[0])<<8 + int(p[1]) + sa.Addr = pp.Addr + return sa, nil + + case AF_INET6: + pp := (*RawSockaddrInet6)(unsafe.Pointer(rsa)) + sa := new(SockaddrInet6) + p := (*[2]byte)(unsafe.Pointer(&pp.Port)) + sa.Port = int(p[0])<<8 + int(p[1]) + sa.ZoneId = pp.Scope_id + sa.Addr = pp.Addr + return sa, nil + } + return nil, syscall.EAFNOSUPPORT +} + +func Socket(domain, typ, proto int) (fd Handle, err error) { + if domain == AF_INET6 && SocketDisableIPv6 { + return InvalidHandle, syscall.EAFNOSUPPORT + } + return socket(int32(domain), int32(typ), int32(proto)) +} + +func SetsockoptInt(fd Handle, level, opt int, value int) (err error) { + v := int32(value) + return Setsockopt(fd, int32(level), int32(opt), (*byte)(unsafe.Pointer(&v)), int32(unsafe.Sizeof(v))) +} + +func Bind(fd Handle, sa Sockaddr) (err error) { + ptr, n, err := sa.sockaddr() + if err != nil { + return err + } + return bind(fd, ptr, n) +} + +func Connect(fd Handle, sa Sockaddr) (err error) { + ptr, n, err := sa.sockaddr() + if err != nil { + return err + } + return connect(fd, ptr, n) +} + +func GetBestInterfaceEx(sa Sockaddr, pdwBestIfIndex *uint32) (err error) { + ptr, _, err := sa.sockaddr() + if err != nil { + return err + } + return getBestInterfaceEx(ptr, pdwBestIfIndex) +} + +func Getsockname(fd Handle) (sa Sockaddr, err error) { + var rsa RawSockaddrAny + l := int32(unsafe.Sizeof(rsa)) + if err = getsockname(fd, &rsa, &l); err != nil { + return + } + return rsa.Sockaddr() +} + +func Getpeername(fd Handle) (sa Sockaddr, err error) { + var rsa RawSockaddrAny + l := int32(unsafe.Sizeof(rsa)) + if err = getpeername(fd, &rsa, &l); err != nil { + return + } + return rsa.Sockaddr() +} + +func Listen(s Handle, n int) (err error) { + return listen(s, int32(n)) +} + +func Shutdown(fd Handle, how int) (err error) { + return shutdown(fd, int32(how)) +} + +func WSASendto(s Handle, bufs *WSABuf, bufcnt uint32, sent *uint32, flags uint32, to Sockaddr, overlapped *Overlapped, croutine *byte) (err error) { + var rsa unsafe.Pointer + var l int32 + if to != nil { + rsa, l, err = to.sockaddr() + if err != nil { + return err + } + } + return WSASendTo(s, bufs, bufcnt, sent, flags, (*RawSockaddrAny)(unsafe.Pointer(rsa)), l, overlapped, croutine) +} + +func LoadGetAddrInfo() error { + return procGetAddrInfoW.Find() +} + +var connectExFunc struct { + once sync.Once + addr uintptr + err error +} + +func LoadConnectEx() error { + connectExFunc.once.Do(func() { + var s Handle + s, connectExFunc.err = Socket(AF_INET, SOCK_STREAM, IPPROTO_TCP) + if connectExFunc.err != nil { + return + } + defer CloseHandle(s) + var n uint32 + connectExFunc.err = WSAIoctl(s, + SIO_GET_EXTENSION_FUNCTION_POINTER, + (*byte)(unsafe.Pointer(&WSAID_CONNECTEX)), + uint32(unsafe.Sizeof(WSAID_CONNECTEX)), + (*byte)(unsafe.Pointer(&connectExFunc.addr)), + uint32(unsafe.Sizeof(connectExFunc.addr)), + &n, nil, 0) + }) + return connectExFunc.err +} + +func connectEx(s Handle, name unsafe.Pointer, namelen int32, sendBuf *byte, sendDataLen uint32, bytesSent *uint32, overlapped *Overlapped) (err error) { + r1, _, e1 := syscall.Syscall9(connectExFunc.addr, 7, uintptr(s), uintptr(name), uintptr(namelen), uintptr(unsafe.Pointer(sendBuf)), uintptr(sendDataLen), uintptr(unsafe.Pointer(bytesSent)), uintptr(unsafe.Pointer(overlapped)), 0, 0) + if r1 == 0 { + if e1 != 0 { + err = error(e1) + } else { + err = syscall.EINVAL + } + } + return +} + +func ConnectEx(fd Handle, sa Sockaddr, sendBuf *byte, sendDataLen uint32, bytesSent *uint32, overlapped *Overlapped) error { + err := LoadConnectEx() + if err != nil { + return errorspkg.New("failed to find ConnectEx: " + err.Error()) + } + ptr, n, err := sa.sockaddr() + if err != nil { + return err + } + return connectEx(fd, ptr, n, sendBuf, sendDataLen, bytesSent, overlapped) +} + +var sendRecvMsgFunc struct { + once sync.Once + sendAddr uintptr + recvAddr uintptr + err error +} + +func loadWSASendRecvMsg() error { + sendRecvMsgFunc.once.Do(func() { + var s Handle + s, sendRecvMsgFunc.err = Socket(AF_INET, SOCK_DGRAM, IPPROTO_UDP) + if sendRecvMsgFunc.err != nil { + return + } + defer CloseHandle(s) + var n uint32 + sendRecvMsgFunc.err = WSAIoctl(s, + SIO_GET_EXTENSION_FUNCTION_POINTER, + (*byte)(unsafe.Pointer(&WSAID_WSARECVMSG)), + uint32(unsafe.Sizeof(WSAID_WSARECVMSG)), + (*byte)(unsafe.Pointer(&sendRecvMsgFunc.recvAddr)), + uint32(unsafe.Sizeof(sendRecvMsgFunc.recvAddr)), + &n, nil, 0) + if sendRecvMsgFunc.err != nil { + return + } + sendRecvMsgFunc.err = WSAIoctl(s, + SIO_GET_EXTENSION_FUNCTION_POINTER, + (*byte)(unsafe.Pointer(&WSAID_WSASENDMSG)), + uint32(unsafe.Sizeof(WSAID_WSASENDMSG)), + (*byte)(unsafe.Pointer(&sendRecvMsgFunc.sendAddr)), + uint32(unsafe.Sizeof(sendRecvMsgFunc.sendAddr)), + &n, nil, 0) + }) + return sendRecvMsgFunc.err +} + +func WSASendMsg(fd Handle, msg *WSAMsg, flags uint32, bytesSent *uint32, overlapped *Overlapped, croutine *byte) error { + err := loadWSASendRecvMsg() + if err != nil { + return err + } + r1, _, e1 := syscall.Syscall6(sendRecvMsgFunc.sendAddr, 6, uintptr(fd), uintptr(unsafe.Pointer(msg)), uintptr(flags), uintptr(unsafe.Pointer(bytesSent)), uintptr(unsafe.Pointer(overlapped)), uintptr(unsafe.Pointer(croutine))) + if r1 == socket_error { + err = errnoErr(e1) + } + return err +} + +func WSARecvMsg(fd Handle, msg *WSAMsg, bytesReceived *uint32, overlapped *Overlapped, croutine *byte) error { + err := loadWSASendRecvMsg() + if err != nil { + return err + } + r1, _, e1 := syscall.Syscall6(sendRecvMsgFunc.recvAddr, 5, uintptr(fd), uintptr(unsafe.Pointer(msg)), uintptr(unsafe.Pointer(bytesReceived)), uintptr(unsafe.Pointer(overlapped)), uintptr(unsafe.Pointer(croutine)), 0) + if r1 == socket_error { + err = errnoErr(e1) + } + return err +} + +// Invented structures to support what package os expects. +type Rusage struct { + CreationTime Filetime + ExitTime Filetime + KernelTime Filetime + UserTime Filetime +} + +type WaitStatus struct { + ExitCode uint32 +} + +func (w WaitStatus) Exited() bool { return true } + +func (w WaitStatus) ExitStatus() int { return int(w.ExitCode) } + +func (w WaitStatus) Signal() Signal { return -1 } + +func (w WaitStatus) CoreDump() bool { return false } + +func (w WaitStatus) Stopped() bool { return false } + +func (w WaitStatus) Continued() bool { return false } + +func (w WaitStatus) StopSignal() Signal { return -1 } + +func (w WaitStatus) Signaled() bool { return false } + +func (w WaitStatus) TrapCause() int { return -1 } + +// Timespec is an invented structure on Windows, but here for +// consistency with the corresponding package for other operating systems. +type Timespec struct { + Sec int64 + Nsec int64 +} + +func TimespecToNsec(ts Timespec) int64 { return int64(ts.Sec)*1e9 + int64(ts.Nsec) } + +func NsecToTimespec(nsec int64) (ts Timespec) { + ts.Sec = nsec / 1e9 + ts.Nsec = nsec % 1e9 + return +} + +// TODO(brainman): fix all needed for net + +func Accept(fd Handle) (nfd Handle, sa Sockaddr, err error) { return 0, nil, syscall.EWINDOWS } + +func Recvfrom(fd Handle, p []byte, flags int) (n int, from Sockaddr, err error) { + var rsa RawSockaddrAny + l := int32(unsafe.Sizeof(rsa)) + n32, err := recvfrom(fd, p, int32(flags), &rsa, &l) + n = int(n32) + if err != nil { + return + } + from, err = rsa.Sockaddr() + return +} + +func Sendto(fd Handle, p []byte, flags int, to Sockaddr) (err error) { + ptr, l, err := to.sockaddr() + if err != nil { + return err + } + return sendto(fd, p, int32(flags), ptr, l) +} + +func SetsockoptTimeval(fd Handle, level, opt int, tv *Timeval) (err error) { return syscall.EWINDOWS } + +// The Linger struct is wrong but we only noticed after Go 1. +// sysLinger is the real system call structure. + +// BUG(brainman): The definition of Linger is not appropriate for direct use +// with Setsockopt and Getsockopt. +// Use SetsockoptLinger instead. + +type Linger struct { + Onoff int32 + Linger int32 +} + +type sysLinger struct { + Onoff uint16 + Linger uint16 +} + +type IPMreq struct { + Multiaddr [4]byte /* in_addr */ + Interface [4]byte /* in_addr */ +} + +type IPv6Mreq struct { + Multiaddr [16]byte /* in6_addr */ + Interface uint32 +} + +func GetsockoptInt(fd Handle, level, opt int) (int, error) { + v := int32(0) + l := int32(unsafe.Sizeof(v)) + err := Getsockopt(fd, int32(level), int32(opt), (*byte)(unsafe.Pointer(&v)), &l) + return int(v), err +} + +func SetsockoptLinger(fd Handle, level, opt int, l *Linger) (err error) { + sys := sysLinger{Onoff: uint16(l.Onoff), Linger: uint16(l.Linger)} + return Setsockopt(fd, int32(level), int32(opt), (*byte)(unsafe.Pointer(&sys)), int32(unsafe.Sizeof(sys))) +} + +func SetsockoptInet4Addr(fd Handle, level, opt int, value [4]byte) (err error) { + return Setsockopt(fd, int32(level), int32(opt), (*byte)(unsafe.Pointer(&value[0])), 4) +} + +func SetsockoptIPMreq(fd Handle, level, opt int, mreq *IPMreq) (err error) { + return Setsockopt(fd, int32(level), int32(opt), (*byte)(unsafe.Pointer(mreq)), int32(unsafe.Sizeof(*mreq))) +} + +func SetsockoptIPv6Mreq(fd Handle, level, opt int, mreq *IPv6Mreq) (err error) { + return syscall.EWINDOWS +} + +func EnumProcesses(processIds []uint32, bytesReturned *uint32) error { + // EnumProcesses syscall expects the size parameter to be in bytes, but the code generated with mksyscall uses + // the length of the processIds slice instead. Hence, this wrapper function is added to fix the discrepancy. + var p *uint32 + if len(processIds) > 0 { + p = &processIds[0] + } + size := uint32(len(processIds) * 4) + return enumProcesses(p, size, bytesReturned) +} + +func Getpid() (pid int) { return int(GetCurrentProcessId()) } + +func FindFirstFile(name *uint16, data *Win32finddata) (handle Handle, err error) { + // NOTE(rsc): The Win32finddata struct is wrong for the system call: + // the two paths are each one uint16 short. Use the correct struct, + // a win32finddata1, and then copy the results out. + // There is no loss of expressivity here, because the final + // uint16, if it is used, is supposed to be a NUL, and Go doesn't need that. + // For Go 1.1, we might avoid the allocation of win32finddata1 here + // by adding a final Bug [2]uint16 field to the struct and then + // adjusting the fields in the result directly. + var data1 win32finddata1 + handle, err = findFirstFile1(name, &data1) + if err == nil { + copyFindData(data, &data1) + } + return +} + +func FindNextFile(handle Handle, data *Win32finddata) (err error) { + var data1 win32finddata1 + err = findNextFile1(handle, &data1) + if err == nil { + copyFindData(data, &data1) + } + return +} + +func getProcessEntry(pid int) (*ProcessEntry32, error) { + snapshot, err := CreateToolhelp32Snapshot(TH32CS_SNAPPROCESS, 0) + if err != nil { + return nil, err + } + defer CloseHandle(snapshot) + var procEntry ProcessEntry32 + procEntry.Size = uint32(unsafe.Sizeof(procEntry)) + if err = Process32First(snapshot, &procEntry); err != nil { + return nil, err + } + for { + if procEntry.ProcessID == uint32(pid) { + return &procEntry, nil + } + err = Process32Next(snapshot, &procEntry) + if err != nil { + return nil, err + } + } +} + +func Getppid() (ppid int) { + pe, err := getProcessEntry(Getpid()) + if err != nil { + return -1 + } + return int(pe.ParentProcessID) +} + +// TODO(brainman): fix all needed for os +func Fchdir(fd Handle) (err error) { return syscall.EWINDOWS } +func Link(oldpath, newpath string) (err error) { return syscall.EWINDOWS } +func Symlink(path, link string) (err error) { return syscall.EWINDOWS } + +func Fchmod(fd Handle, mode uint32) (err error) { return syscall.EWINDOWS } +func Chown(path string, uid int, gid int) (err error) { return syscall.EWINDOWS } +func Lchown(path string, uid int, gid int) (err error) { return syscall.EWINDOWS } +func Fchown(fd Handle, uid int, gid int) (err error) { return syscall.EWINDOWS } + +func Getuid() (uid int) { return -1 } +func Geteuid() (euid int) { return -1 } +func Getgid() (gid int) { return -1 } +func Getegid() (egid int) { return -1 } +func Getgroups() (gids []int, err error) { return nil, syscall.EWINDOWS } + +func LoadCreateSymbolicLink() error { + return procCreateSymbolicLinkW.Find() +} + +// Readlink returns the destination of the named symbolic link. +func Readlink(path string, buf []byte) (n int, err error) { + fd, err := CreateFile(StringToUTF16Ptr(path), GENERIC_READ, 0, nil, OPEN_EXISTING, + FILE_FLAG_OPEN_REPARSE_POINT|FILE_FLAG_BACKUP_SEMANTICS, 0) + if err != nil { + return -1, err + } + defer CloseHandle(fd) + + rdbbuf := make([]byte, MAXIMUM_REPARSE_DATA_BUFFER_SIZE) + var bytesReturned uint32 + err = DeviceIoControl(fd, FSCTL_GET_REPARSE_POINT, nil, 0, &rdbbuf[0], uint32(len(rdbbuf)), &bytesReturned, nil) + if err != nil { + return -1, err + } + + rdb := (*reparseDataBuffer)(unsafe.Pointer(&rdbbuf[0])) + var s string + switch rdb.ReparseTag { + case IO_REPARSE_TAG_SYMLINK: + data := (*symbolicLinkReparseBuffer)(unsafe.Pointer(&rdb.reparseBuffer)) + p := (*[0xffff]uint16)(unsafe.Pointer(&data.PathBuffer[0])) + s = UTF16ToString(p[data.PrintNameOffset/2 : (data.PrintNameLength-data.PrintNameOffset)/2]) + case IO_REPARSE_TAG_MOUNT_POINT: + data := (*mountPointReparseBuffer)(unsafe.Pointer(&rdb.reparseBuffer)) + p := (*[0xffff]uint16)(unsafe.Pointer(&data.PathBuffer[0])) + s = UTF16ToString(p[data.PrintNameOffset/2 : (data.PrintNameLength-data.PrintNameOffset)/2]) + default: + // the path is not a symlink or junction but another type of reparse + // point + return -1, syscall.ENOENT + } + n = copy(buf, []byte(s)) + + return n, nil +} + +// GUIDFromString parses a string in the form of +// "{XXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX}" into a GUID. +func GUIDFromString(str string) (GUID, error) { + guid := GUID{} + str16, err := syscall.UTF16PtrFromString(str) + if err != nil { + return guid, err + } + err = clsidFromString(str16, &guid) + if err != nil { + return guid, err + } + return guid, nil +} + +// GenerateGUID creates a new random GUID. +func GenerateGUID() (GUID, error) { + guid := GUID{} + err := coCreateGuid(&guid) + if err != nil { + return guid, err + } + return guid, nil +} + +// String returns the canonical string form of the GUID, +// in the form of "{XXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX}". +func (guid GUID) String() string { + var str [100]uint16 + chars := stringFromGUID2(&guid, &str[0], int32(len(str))) + if chars <= 1 { + return "" + } + return string(utf16.Decode(str[:chars-1])) +} + +// KnownFolderPath returns a well-known folder path for the current user, specified by one of +// the FOLDERID_ constants, and chosen and optionally created based on a KF_ flag. +func KnownFolderPath(folderID *KNOWNFOLDERID, flags uint32) (string, error) { + return Token(0).KnownFolderPath(folderID, flags) +} + +// KnownFolderPath returns a well-known folder path for the user token, specified by one of +// the FOLDERID_ constants, and chosen and optionally created based on a KF_ flag. +func (t Token) KnownFolderPath(folderID *KNOWNFOLDERID, flags uint32) (string, error) { + var p *uint16 + err := shGetKnownFolderPath(folderID, flags, t, &p) + if err != nil { + return "", err + } + defer CoTaskMemFree(unsafe.Pointer(p)) + return UTF16PtrToString(p), nil +} + +// RtlGetVersion returns the version of the underlying operating system, ignoring +// manifest semantics but is affected by the application compatibility layer. +func RtlGetVersion() *OsVersionInfoEx { + info := &OsVersionInfoEx{} + info.osVersionInfoSize = uint32(unsafe.Sizeof(*info)) + // According to documentation, this function always succeeds. + // The function doesn't even check the validity of the + // osVersionInfoSize member. Disassembling ntdll.dll indicates + // that the documentation is indeed correct about that. + _ = rtlGetVersion(info) + return info +} + +// RtlGetNtVersionNumbers returns the version of the underlying operating system, +// ignoring manifest semantics and the application compatibility layer. +func RtlGetNtVersionNumbers() (majorVersion, minorVersion, buildNumber uint32) { + rtlGetNtVersionNumbers(&majorVersion, &minorVersion, &buildNumber) + buildNumber &= 0xffff + return +} + +// GetProcessPreferredUILanguages retrieves the process preferred UI languages. +func GetProcessPreferredUILanguages(flags uint32) ([]string, error) { + return getUILanguages(flags, getProcessPreferredUILanguages) +} + +// GetThreadPreferredUILanguages retrieves the thread preferred UI languages for the current thread. +func GetThreadPreferredUILanguages(flags uint32) ([]string, error) { + return getUILanguages(flags, getThreadPreferredUILanguages) +} + +// GetUserPreferredUILanguages retrieves information about the user preferred UI languages. +func GetUserPreferredUILanguages(flags uint32) ([]string, error) { + return getUILanguages(flags, getUserPreferredUILanguages) +} + +// GetSystemPreferredUILanguages retrieves the system preferred UI languages. +func GetSystemPreferredUILanguages(flags uint32) ([]string, error) { + return getUILanguages(flags, getSystemPreferredUILanguages) +} + +func getUILanguages(flags uint32, f func(flags uint32, numLanguages *uint32, buf *uint16, bufSize *uint32) error) ([]string, error) { + size := uint32(128) + for { + var numLanguages uint32 + buf := make([]uint16, size) + err := f(flags, &numLanguages, &buf[0], &size) + if err == ERROR_INSUFFICIENT_BUFFER { + continue + } + if err != nil { + return nil, err + } + buf = buf[:size] + if numLanguages == 0 || len(buf) == 0 { // GetProcessPreferredUILanguages may return numLanguages==0 with "\0\0" + return []string{}, nil + } + if buf[len(buf)-1] == 0 { + buf = buf[:len(buf)-1] // remove terminating null + } + languages := make([]string, 0, numLanguages) + from := 0 + for i, c := range buf { + if c == 0 { + languages = append(languages, string(utf16.Decode(buf[from:i]))) + from = i + 1 + } + } + return languages, nil + } +} + +func SetConsoleCursorPosition(console Handle, position Coord) error { + return setConsoleCursorPosition(console, *((*uint32)(unsafe.Pointer(&position)))) +} + +func GetStartupInfo(startupInfo *StartupInfo) error { + getStartupInfo(startupInfo) + return nil +} + +func (s NTStatus) Errno() syscall.Errno { + return rtlNtStatusToDosErrorNoTeb(s) +} + +func langID(pri, sub uint16) uint32 { return uint32(sub)<<10 | uint32(pri) } + +func (s NTStatus) Error() string { + b := make([]uint16, 300) + n, err := FormatMessage(FORMAT_MESSAGE_FROM_SYSTEM|FORMAT_MESSAGE_FROM_HMODULE|FORMAT_MESSAGE_ARGUMENT_ARRAY, modntdll.Handle(), uint32(s), langID(LANG_ENGLISH, SUBLANG_ENGLISH_US), b, nil) + if err != nil { + return fmt.Sprintf("NTSTATUS 0x%08x", uint32(s)) + } + // trim terminating \r and \n + for ; n > 0 && (b[n-1] == '\n' || b[n-1] == '\r'); n-- { + } + return string(utf16.Decode(b[:n])) +} + +// NewNTUnicodeString returns a new NTUnicodeString structure for use with native +// NT APIs that work over the NTUnicodeString type. Note that most Windows APIs +// do not use NTUnicodeString, and instead UTF16PtrFromString should be used for +// the more common *uint16 string type. +func NewNTUnicodeString(s string) (*NTUnicodeString, error) { + s16, err := UTF16FromString(s) + if err != nil { + return nil, err + } + n := uint16(len(s16) * 2) + return &NTUnicodeString{ + Length: n - 2, // subtract 2 bytes for the NULL terminator + MaximumLength: n, + Buffer: &s16[0], + }, nil +} + +// Slice returns a uint16 slice that aliases the data in the NTUnicodeString. +func (s *NTUnicodeString) Slice() []uint16 { + // Note: this rounds the length down, if it happens + // to (incorrectly) be odd. Probably safer than rounding up. + return unsafe.Slice(s.Buffer, s.MaximumLength/2)[:s.Length/2] +} + +func (s *NTUnicodeString) String() string { + return UTF16ToString(s.Slice()) +} + +// NewNTString returns a new NTString structure for use with native +// NT APIs that work over the NTString type. Note that most Windows APIs +// do not use NTString, and instead UTF16PtrFromString should be used for +// the more common *uint16 string type. +func NewNTString(s string) (*NTString, error) { + var nts NTString + s8, err := BytePtrFromString(s) + if err != nil { + return nil, err + } + RtlInitString(&nts, s8) + return &nts, nil +} + +// Slice returns a byte slice that aliases the data in the NTString. +func (s *NTString) Slice() []byte { + slice := unsafe.Slice(s.Buffer, s.MaximumLength) + return slice[:s.Length] +} + +func (s *NTString) String() string { + return ByteSliceToString(s.Slice()) +} + +// FindResource resolves a resource of the given name and resource type. +func FindResource(module Handle, name, resType ResourceIDOrString) (Handle, error) { + var namePtr, resTypePtr uintptr + var name16, resType16 *uint16 + var err error + resolvePtr := func(i interface{}, keep **uint16) (uintptr, error) { + switch v := i.(type) { + case string: + *keep, err = UTF16PtrFromString(v) + if err != nil { + return 0, err + } + return uintptr(unsafe.Pointer(*keep)), nil + case ResourceID: + return uintptr(v), nil + } + return 0, errorspkg.New("parameter must be a ResourceID or a string") + } + namePtr, err = resolvePtr(name, &name16) + if err != nil { + return 0, err + } + resTypePtr, err = resolvePtr(resType, &resType16) + if err != nil { + return 0, err + } + resInfo, err := findResource(module, namePtr, resTypePtr) + runtime.KeepAlive(name16) + runtime.KeepAlive(resType16) + return resInfo, err +} + +func LoadResourceData(module, resInfo Handle) (data []byte, err error) { + size, err := SizeofResource(module, resInfo) + if err != nil { + return + } + resData, err := LoadResource(module, resInfo) + if err != nil { + return + } + ptr, err := LockResource(resData) + if err != nil { + return + } + data = unsafe.Slice((*byte)(unsafe.Pointer(ptr)), size) + return +} + +// PSAPI_WORKING_SET_EX_BLOCK contains extended working set information for a page. +type PSAPI_WORKING_SET_EX_BLOCK uint64 + +// Valid returns the validity of this page. +// If this bit is 1, the subsequent members are valid; otherwise they should be ignored. +func (b PSAPI_WORKING_SET_EX_BLOCK) Valid() bool { + return (b & 1) == 1 +} + +// ShareCount is the number of processes that share this page. The maximum value of this member is 7. +func (b PSAPI_WORKING_SET_EX_BLOCK) ShareCount() uint64 { + return b.intField(1, 3) +} + +// Win32Protection is the memory protection attributes of the page. For a list of values, see +// https://docs.microsoft.com/en-us/windows/win32/memory/memory-protection-constants +func (b PSAPI_WORKING_SET_EX_BLOCK) Win32Protection() uint64 { + return b.intField(4, 11) +} + +// Shared returns the shared status of this page. +// If this bit is 1, the page can be shared. +func (b PSAPI_WORKING_SET_EX_BLOCK) Shared() bool { + return (b & (1 << 15)) == 1 +} + +// Node is the NUMA node. The maximum value of this member is 63. +func (b PSAPI_WORKING_SET_EX_BLOCK) Node() uint64 { + return b.intField(16, 6) +} + +// Locked returns the locked status of this page. +// If this bit is 1, the virtual page is locked in physical memory. +func (b PSAPI_WORKING_SET_EX_BLOCK) Locked() bool { + return (b & (1 << 22)) == 1 +} + +// LargePage returns the large page status of this page. +// If this bit is 1, the page is a large page. +func (b PSAPI_WORKING_SET_EX_BLOCK) LargePage() bool { + return (b & (1 << 23)) == 1 +} + +// Bad returns the bad status of this page. +// If this bit is 1, the page is has been reported as bad. +func (b PSAPI_WORKING_SET_EX_BLOCK) Bad() bool { + return (b & (1 << 31)) == 1 +} + +// intField extracts an integer field in the PSAPI_WORKING_SET_EX_BLOCK union. +func (b PSAPI_WORKING_SET_EX_BLOCK) intField(start, length int) uint64 { + var mask PSAPI_WORKING_SET_EX_BLOCK + for pos := start; pos < start+length; pos++ { + mask |= (1 << pos) + } + + masked := b & mask + return uint64(masked >> start) +} + +// PSAPI_WORKING_SET_EX_INFORMATION contains extended working set information for a process. +type PSAPI_WORKING_SET_EX_INFORMATION struct { + // The virtual address. + VirtualAddress Pointer + // A PSAPI_WORKING_SET_EX_BLOCK union that indicates the attributes of the page at VirtualAddress. + VirtualAttributes PSAPI_WORKING_SET_EX_BLOCK +} + +// CreatePseudoConsole creates a windows pseudo console. +func CreatePseudoConsole(size Coord, in Handle, out Handle, flags uint32, pconsole *Handle) error { + // We need this wrapper to manually cast Coord to uint32. The autogenerated wrappers only + // accept arguments that can be casted to uintptr, and Coord can't. + return createPseudoConsole(*((*uint32)(unsafe.Pointer(&size))), in, out, flags, pconsole) +} + +// ResizePseudoConsole resizes the internal buffers of the pseudo console to the width and height specified in `size`. +func ResizePseudoConsole(pconsole Handle, size Coord) error { + // We need this wrapper to manually cast Coord to uint32. The autogenerated wrappers only + // accept arguments that can be casted to uintptr, and Coord can't. + return resizePseudoConsole(pconsole, *((*uint32)(unsafe.Pointer(&size)))) +} + +// DCB constants. See https://learn.microsoft.com/en-us/windows/win32/api/winbase/ns-winbase-dcb. +const ( + CBR_110 = 110 + CBR_300 = 300 + CBR_600 = 600 + CBR_1200 = 1200 + CBR_2400 = 2400 + CBR_4800 = 4800 + CBR_9600 = 9600 + CBR_14400 = 14400 + CBR_19200 = 19200 + CBR_38400 = 38400 + CBR_57600 = 57600 + CBR_115200 = 115200 + CBR_128000 = 128000 + CBR_256000 = 256000 + + DTR_CONTROL_DISABLE = 0x00000000 + DTR_CONTROL_ENABLE = 0x00000010 + DTR_CONTROL_HANDSHAKE = 0x00000020 + + RTS_CONTROL_DISABLE = 0x00000000 + RTS_CONTROL_ENABLE = 0x00001000 + RTS_CONTROL_HANDSHAKE = 0x00002000 + RTS_CONTROL_TOGGLE = 0x00003000 + + NOPARITY = 0 + ODDPARITY = 1 + EVENPARITY = 2 + MARKPARITY = 3 + SPACEPARITY = 4 + + ONESTOPBIT = 0 + ONE5STOPBITS = 1 + TWOSTOPBITS = 2 +) + +// EscapeCommFunction constants. See https://learn.microsoft.com/en-us/windows/win32/api/winbase/nf-winbase-escapecommfunction. +const ( + SETXOFF = 1 + SETXON = 2 + SETRTS = 3 + CLRRTS = 4 + SETDTR = 5 + CLRDTR = 6 + SETBREAK = 8 + CLRBREAK = 9 +) + +// PurgeComm constants. See https://learn.microsoft.com/en-us/windows/win32/api/winbase/nf-winbase-purgecomm. +const ( + PURGE_TXABORT = 0x0001 + PURGE_RXABORT = 0x0002 + PURGE_TXCLEAR = 0x0004 + PURGE_RXCLEAR = 0x0008 +) + +// SetCommMask constants. See https://learn.microsoft.com/en-us/windows/win32/api/winbase/nf-winbase-setcommmask. +const ( + EV_RXCHAR = 0x0001 + EV_RXFLAG = 0x0002 + EV_TXEMPTY = 0x0004 + EV_CTS = 0x0008 + EV_DSR = 0x0010 + EV_RLSD = 0x0020 + EV_BREAK = 0x0040 + EV_ERR = 0x0080 + EV_RING = 0x0100 +) diff --git a/vendor/golang.org/x/sys/windows/types_windows.go b/vendor/golang.org/x/sys/windows/types_windows.go new file mode 100644 index 00000000..d5658a13 --- /dev/null +++ b/vendor/golang.org/x/sys/windows/types_windows.go @@ -0,0 +1,4025 @@ +// Copyright 2011 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +package windows + +import ( + "net" + "syscall" + "unsafe" +) + +// NTStatus corresponds with NTSTATUS, error values returned by ntdll.dll and +// other native functions. +type NTStatus uint32 + +const ( + // Invented values to support what package os expects. + O_RDONLY = 0x00000 + O_WRONLY = 0x00001 + O_RDWR = 0x00002 + O_CREAT = 0x00040 + O_EXCL = 0x00080 + O_NOCTTY = 0x00100 + O_TRUNC = 0x00200 + O_NONBLOCK = 0x00800 + O_APPEND = 0x00400 + O_SYNC = 0x01000 + O_ASYNC = 0x02000 + O_CLOEXEC = 0x80000 +) + +const ( + // More invented values for signals + SIGHUP = Signal(0x1) + SIGINT = Signal(0x2) + SIGQUIT = Signal(0x3) + SIGILL = Signal(0x4) + SIGTRAP = Signal(0x5) + SIGABRT = Signal(0x6) + SIGBUS = Signal(0x7) + SIGFPE = Signal(0x8) + SIGKILL = Signal(0x9) + SIGSEGV = Signal(0xb) + SIGPIPE = Signal(0xd) + SIGALRM = Signal(0xe) + SIGTERM = Signal(0xf) +) + +var signals = [...]string{ + 1: "hangup", + 2: "interrupt", + 3: "quit", + 4: "illegal instruction", + 5: "trace/breakpoint trap", + 6: "aborted", + 7: "bus error", + 8: "floating point exception", + 9: "killed", + 10: "user defined signal 1", + 11: "segmentation fault", + 12: "user defined signal 2", + 13: "broken pipe", + 14: "alarm clock", + 15: "terminated", +} + +// File flags for [os.OpenFile]. The O_ prefix is used to indicate +// that these flags are specific to the OpenFile function. +const ( + O_FILE_FLAG_OPEN_NO_RECALL = FILE_FLAG_OPEN_NO_RECALL + O_FILE_FLAG_OPEN_REPARSE_POINT = FILE_FLAG_OPEN_REPARSE_POINT + O_FILE_FLAG_SESSION_AWARE = FILE_FLAG_SESSION_AWARE + O_FILE_FLAG_POSIX_SEMANTICS = FILE_FLAG_POSIX_SEMANTICS + O_FILE_FLAG_BACKUP_SEMANTICS = FILE_FLAG_BACKUP_SEMANTICS + O_FILE_FLAG_DELETE_ON_CLOSE = FILE_FLAG_DELETE_ON_CLOSE + O_FILE_FLAG_SEQUENTIAL_SCAN = FILE_FLAG_SEQUENTIAL_SCAN + O_FILE_FLAG_RANDOM_ACCESS = FILE_FLAG_RANDOM_ACCESS + O_FILE_FLAG_NO_BUFFERING = FILE_FLAG_NO_BUFFERING + O_FILE_FLAG_OVERLAPPED = FILE_FLAG_OVERLAPPED + O_FILE_FLAG_WRITE_THROUGH = FILE_FLAG_WRITE_THROUGH +) + +const ( + FILE_READ_DATA = 0x00000001 + FILE_READ_ATTRIBUTES = 0x00000080 + FILE_READ_EA = 0x00000008 + FILE_WRITE_DATA = 0x00000002 + FILE_WRITE_ATTRIBUTES = 0x00000100 + FILE_WRITE_EA = 0x00000010 + FILE_APPEND_DATA = 0x00000004 + FILE_EXECUTE = 0x00000020 + + FILE_GENERIC_READ = STANDARD_RIGHTS_READ | FILE_READ_DATA | FILE_READ_ATTRIBUTES | FILE_READ_EA | SYNCHRONIZE + FILE_GENERIC_WRITE = STANDARD_RIGHTS_WRITE | FILE_WRITE_DATA | FILE_WRITE_ATTRIBUTES | FILE_WRITE_EA | FILE_APPEND_DATA | SYNCHRONIZE + FILE_GENERIC_EXECUTE = STANDARD_RIGHTS_EXECUTE | FILE_READ_ATTRIBUTES | FILE_EXECUTE | SYNCHRONIZE + + FILE_LIST_DIRECTORY = 0x00000001 + FILE_TRAVERSE = 0x00000020 + + FILE_SHARE_READ = 0x00000001 + FILE_SHARE_WRITE = 0x00000002 + FILE_SHARE_DELETE = 0x00000004 + + FILE_ATTRIBUTE_READONLY = 0x00000001 + FILE_ATTRIBUTE_HIDDEN = 0x00000002 + FILE_ATTRIBUTE_SYSTEM = 0x00000004 + FILE_ATTRIBUTE_DIRECTORY = 0x00000010 + FILE_ATTRIBUTE_ARCHIVE = 0x00000020 + FILE_ATTRIBUTE_DEVICE = 0x00000040 + FILE_ATTRIBUTE_NORMAL = 0x00000080 + FILE_ATTRIBUTE_TEMPORARY = 0x00000100 + FILE_ATTRIBUTE_SPARSE_FILE = 0x00000200 + FILE_ATTRIBUTE_REPARSE_POINT = 0x00000400 + FILE_ATTRIBUTE_COMPRESSED = 0x00000800 + FILE_ATTRIBUTE_OFFLINE = 0x00001000 + FILE_ATTRIBUTE_NOT_CONTENT_INDEXED = 0x00002000 + FILE_ATTRIBUTE_ENCRYPTED = 0x00004000 + FILE_ATTRIBUTE_INTEGRITY_STREAM = 0x00008000 + FILE_ATTRIBUTE_VIRTUAL = 0x00010000 + FILE_ATTRIBUTE_NO_SCRUB_DATA = 0x00020000 + FILE_ATTRIBUTE_RECALL_ON_OPEN = 0x00040000 + FILE_ATTRIBUTE_RECALL_ON_DATA_ACCESS = 0x00400000 + + INVALID_FILE_ATTRIBUTES = 0xffffffff + + CREATE_NEW = 1 + CREATE_ALWAYS = 2 + OPEN_EXISTING = 3 + OPEN_ALWAYS = 4 + TRUNCATE_EXISTING = 5 + + FILE_FLAG_OPEN_REQUIRING_OPLOCK = 0x00040000 + FILE_FLAG_FIRST_PIPE_INSTANCE = 0x00080000 + FILE_FLAG_OPEN_NO_RECALL = 0x00100000 + FILE_FLAG_OPEN_REPARSE_POINT = 0x00200000 + FILE_FLAG_SESSION_AWARE = 0x00800000 + FILE_FLAG_POSIX_SEMANTICS = 0x01000000 + FILE_FLAG_BACKUP_SEMANTICS = 0x02000000 + FILE_FLAG_DELETE_ON_CLOSE = 0x04000000 + FILE_FLAG_SEQUENTIAL_SCAN = 0x08000000 + FILE_FLAG_RANDOM_ACCESS = 0x10000000 + FILE_FLAG_NO_BUFFERING = 0x20000000 + FILE_FLAG_OVERLAPPED = 0x40000000 + FILE_FLAG_WRITE_THROUGH = 0x80000000 + + HANDLE_FLAG_INHERIT = 0x00000001 + STARTF_USESTDHANDLES = 0x00000100 + STARTF_USESHOWWINDOW = 0x00000001 + DUPLICATE_CLOSE_SOURCE = 0x00000001 + DUPLICATE_SAME_ACCESS = 0x00000002 + + STD_INPUT_HANDLE = -10 & (1<<32 - 1) + STD_OUTPUT_HANDLE = -11 & (1<<32 - 1) + STD_ERROR_HANDLE = -12 & (1<<32 - 1) + + FILE_BEGIN = 0 + FILE_CURRENT = 1 + FILE_END = 2 + + LANG_ENGLISH = 0x09 + SUBLANG_ENGLISH_US = 0x01 + + FORMAT_MESSAGE_ALLOCATE_BUFFER = 256 + FORMAT_MESSAGE_IGNORE_INSERTS = 512 + FORMAT_MESSAGE_FROM_STRING = 1024 + FORMAT_MESSAGE_FROM_HMODULE = 2048 + FORMAT_MESSAGE_FROM_SYSTEM = 4096 + FORMAT_MESSAGE_ARGUMENT_ARRAY = 8192 + FORMAT_MESSAGE_MAX_WIDTH_MASK = 255 + + MAX_PATH = 260 + MAX_LONG_PATH = 32768 + + MAX_MODULE_NAME32 = 255 + + MAX_COMPUTERNAME_LENGTH = 15 + + MAX_DHCPV6_DUID_LENGTH = 130 + + MAX_DNS_SUFFIX_STRING_LENGTH = 256 + + TIME_ZONE_ID_UNKNOWN = 0 + TIME_ZONE_ID_STANDARD = 1 + + TIME_ZONE_ID_DAYLIGHT = 2 + IGNORE = 0 + INFINITE = 0xffffffff + + WAIT_ABANDONED = 0x00000080 + WAIT_OBJECT_0 = 0x00000000 + WAIT_FAILED = 0xFFFFFFFF + + // Access rights for process. + PROCESS_ALL_ACCESS = 0xFFFF + PROCESS_CREATE_PROCESS = 0x0080 + PROCESS_CREATE_THREAD = 0x0002 + PROCESS_DUP_HANDLE = 0x0040 + PROCESS_QUERY_INFORMATION = 0x0400 + PROCESS_QUERY_LIMITED_INFORMATION = 0x1000 + PROCESS_SET_INFORMATION = 0x0200 + PROCESS_SET_QUOTA = 0x0100 + PROCESS_SUSPEND_RESUME = 0x0800 + PROCESS_TERMINATE = 0x0001 + PROCESS_VM_OPERATION = 0x0008 + PROCESS_VM_READ = 0x0010 + PROCESS_VM_WRITE = 0x0020 + + // Access rights for thread. + THREAD_DIRECT_IMPERSONATION = 0x0200 + THREAD_GET_CONTEXT = 0x0008 + THREAD_IMPERSONATE = 0x0100 + THREAD_QUERY_INFORMATION = 0x0040 + THREAD_QUERY_LIMITED_INFORMATION = 0x0800 + THREAD_SET_CONTEXT = 0x0010 + THREAD_SET_INFORMATION = 0x0020 + THREAD_SET_LIMITED_INFORMATION = 0x0400 + THREAD_SET_THREAD_TOKEN = 0x0080 + THREAD_SUSPEND_RESUME = 0x0002 + THREAD_TERMINATE = 0x0001 + + FILE_MAP_COPY = 0x01 + FILE_MAP_WRITE = 0x02 + FILE_MAP_READ = 0x04 + FILE_MAP_EXECUTE = 0x20 + + CTRL_C_EVENT = 0 + CTRL_BREAK_EVENT = 1 + CTRL_CLOSE_EVENT = 2 + CTRL_LOGOFF_EVENT = 5 + CTRL_SHUTDOWN_EVENT = 6 + + // Windows reserves errors >= 1<<29 for application use. + APPLICATION_ERROR = 1 << 29 +) + +const ( + // Process creation flags. + CREATE_BREAKAWAY_FROM_JOB = 0x01000000 + CREATE_DEFAULT_ERROR_MODE = 0x04000000 + CREATE_NEW_CONSOLE = 0x00000010 + CREATE_NEW_PROCESS_GROUP = 0x00000200 + CREATE_NO_WINDOW = 0x08000000 + CREATE_PROTECTED_PROCESS = 0x00040000 + CREATE_PRESERVE_CODE_AUTHZ_LEVEL = 0x02000000 + CREATE_SEPARATE_WOW_VDM = 0x00000800 + CREATE_SHARED_WOW_VDM = 0x00001000 + CREATE_SUSPENDED = 0x00000004 + CREATE_UNICODE_ENVIRONMENT = 0x00000400 + DEBUG_ONLY_THIS_PROCESS = 0x00000002 + DEBUG_PROCESS = 0x00000001 + DETACHED_PROCESS = 0x00000008 + EXTENDED_STARTUPINFO_PRESENT = 0x00080000 + INHERIT_PARENT_AFFINITY = 0x00010000 +) + +const ( + // attributes for ProcThreadAttributeList + PROC_THREAD_ATTRIBUTE_PARENT_PROCESS = 0x00020000 + PROC_THREAD_ATTRIBUTE_HANDLE_LIST = 0x00020002 + PROC_THREAD_ATTRIBUTE_GROUP_AFFINITY = 0x00030003 + PROC_THREAD_ATTRIBUTE_PREFERRED_NODE = 0x00020004 + PROC_THREAD_ATTRIBUTE_IDEAL_PROCESSOR = 0x00030005 + PROC_THREAD_ATTRIBUTE_MITIGATION_POLICY = 0x00020007 + PROC_THREAD_ATTRIBUTE_UMS_THREAD = 0x00030006 + PROC_THREAD_ATTRIBUTE_PROTECTION_LEVEL = 0x0002000b + PROC_THREAD_ATTRIBUTE_PSEUDOCONSOLE = 0x00020016 +) + +const ( + // flags for CreateToolhelp32Snapshot + TH32CS_SNAPHEAPLIST = 0x01 + TH32CS_SNAPPROCESS = 0x02 + TH32CS_SNAPTHREAD = 0x04 + TH32CS_SNAPMODULE = 0x08 + TH32CS_SNAPMODULE32 = 0x10 + TH32CS_SNAPALL = TH32CS_SNAPHEAPLIST | TH32CS_SNAPMODULE | TH32CS_SNAPPROCESS | TH32CS_SNAPTHREAD + TH32CS_INHERIT = 0x80000000 +) + +const ( + // flags for EnumProcessModulesEx + LIST_MODULES_32BIT = 0x01 + LIST_MODULES_64BIT = 0x02 + LIST_MODULES_ALL = 0x03 + LIST_MODULES_DEFAULT = 0x00 +) + +const ( + // filters for ReadDirectoryChangesW and FindFirstChangeNotificationW + FILE_NOTIFY_CHANGE_FILE_NAME = 0x001 + FILE_NOTIFY_CHANGE_DIR_NAME = 0x002 + FILE_NOTIFY_CHANGE_ATTRIBUTES = 0x004 + FILE_NOTIFY_CHANGE_SIZE = 0x008 + FILE_NOTIFY_CHANGE_LAST_WRITE = 0x010 + FILE_NOTIFY_CHANGE_LAST_ACCESS = 0x020 + FILE_NOTIFY_CHANGE_CREATION = 0x040 + FILE_NOTIFY_CHANGE_SECURITY = 0x100 +) + +const ( + // do not reorder + FILE_ACTION_ADDED = iota + 1 + FILE_ACTION_REMOVED + FILE_ACTION_MODIFIED + FILE_ACTION_RENAMED_OLD_NAME + FILE_ACTION_RENAMED_NEW_NAME +) + +const ( + // wincrypt.h + /* certenrolld_begin -- PROV_RSA_*/ + PROV_RSA_FULL = 1 + PROV_RSA_SIG = 2 + PROV_DSS = 3 + PROV_FORTEZZA = 4 + PROV_MS_EXCHANGE = 5 + PROV_SSL = 6 + PROV_RSA_SCHANNEL = 12 + PROV_DSS_DH = 13 + PROV_EC_ECDSA_SIG = 14 + PROV_EC_ECNRA_SIG = 15 + PROV_EC_ECDSA_FULL = 16 + PROV_EC_ECNRA_FULL = 17 + PROV_DH_SCHANNEL = 18 + PROV_SPYRUS_LYNKS = 20 + PROV_RNG = 21 + PROV_INTEL_SEC = 22 + PROV_REPLACE_OWF = 23 + PROV_RSA_AES = 24 + + /* dwFlags definitions for CryptAcquireContext */ + CRYPT_VERIFYCONTEXT = 0xF0000000 + CRYPT_NEWKEYSET = 0x00000008 + CRYPT_DELETEKEYSET = 0x00000010 + CRYPT_MACHINE_KEYSET = 0x00000020 + CRYPT_SILENT = 0x00000040 + CRYPT_DEFAULT_CONTAINER_OPTIONAL = 0x00000080 + + /* Flags for PFXImportCertStore */ + CRYPT_EXPORTABLE = 0x00000001 + CRYPT_USER_PROTECTED = 0x00000002 + CRYPT_USER_KEYSET = 0x00001000 + PKCS12_PREFER_CNG_KSP = 0x00000100 + PKCS12_ALWAYS_CNG_KSP = 0x00000200 + PKCS12_ALLOW_OVERWRITE_KEY = 0x00004000 + PKCS12_NO_PERSIST_KEY = 0x00008000 + PKCS12_INCLUDE_EXTENDED_PROPERTIES = 0x00000010 + + /* Flags for CryptAcquireCertificatePrivateKey */ + CRYPT_ACQUIRE_CACHE_FLAG = 0x00000001 + CRYPT_ACQUIRE_USE_PROV_INFO_FLAG = 0x00000002 + CRYPT_ACQUIRE_COMPARE_KEY_FLAG = 0x00000004 + CRYPT_ACQUIRE_NO_HEALING = 0x00000008 + CRYPT_ACQUIRE_SILENT_FLAG = 0x00000040 + CRYPT_ACQUIRE_WINDOW_HANDLE_FLAG = 0x00000080 + CRYPT_ACQUIRE_NCRYPT_KEY_FLAGS_MASK = 0x00070000 + CRYPT_ACQUIRE_ALLOW_NCRYPT_KEY_FLAG = 0x00010000 + CRYPT_ACQUIRE_PREFER_NCRYPT_KEY_FLAG = 0x00020000 + CRYPT_ACQUIRE_ONLY_NCRYPT_KEY_FLAG = 0x00040000 + + /* pdwKeySpec for CryptAcquireCertificatePrivateKey */ + AT_KEYEXCHANGE = 1 + AT_SIGNATURE = 2 + CERT_NCRYPT_KEY_SPEC = 0xFFFFFFFF + + /* Default usage match type is AND with value zero */ + USAGE_MATCH_TYPE_AND = 0 + USAGE_MATCH_TYPE_OR = 1 + + /* msgAndCertEncodingType values for CertOpenStore function */ + X509_ASN_ENCODING = 0x00000001 + PKCS_7_ASN_ENCODING = 0x00010000 + + /* storeProvider values for CertOpenStore function */ + CERT_STORE_PROV_MSG = 1 + CERT_STORE_PROV_MEMORY = 2 + CERT_STORE_PROV_FILE = 3 + CERT_STORE_PROV_REG = 4 + CERT_STORE_PROV_PKCS7 = 5 + CERT_STORE_PROV_SERIALIZED = 6 + CERT_STORE_PROV_FILENAME_A = 7 + CERT_STORE_PROV_FILENAME_W = 8 + CERT_STORE_PROV_FILENAME = CERT_STORE_PROV_FILENAME_W + CERT_STORE_PROV_SYSTEM_A = 9 + CERT_STORE_PROV_SYSTEM_W = 10 + CERT_STORE_PROV_SYSTEM = CERT_STORE_PROV_SYSTEM_W + CERT_STORE_PROV_COLLECTION = 11 + CERT_STORE_PROV_SYSTEM_REGISTRY_A = 12 + CERT_STORE_PROV_SYSTEM_REGISTRY_W = 13 + CERT_STORE_PROV_SYSTEM_REGISTRY = CERT_STORE_PROV_SYSTEM_REGISTRY_W + CERT_STORE_PROV_PHYSICAL_W = 14 + CERT_STORE_PROV_PHYSICAL = CERT_STORE_PROV_PHYSICAL_W + CERT_STORE_PROV_SMART_CARD_W = 15 + CERT_STORE_PROV_SMART_CARD = CERT_STORE_PROV_SMART_CARD_W + CERT_STORE_PROV_LDAP_W = 16 + CERT_STORE_PROV_LDAP = CERT_STORE_PROV_LDAP_W + CERT_STORE_PROV_PKCS12 = 17 + + /* store characteristics (low WORD of flag) for CertOpenStore function */ + CERT_STORE_NO_CRYPT_RELEASE_FLAG = 0x00000001 + CERT_STORE_SET_LOCALIZED_NAME_FLAG = 0x00000002 + CERT_STORE_DEFER_CLOSE_UNTIL_LAST_FREE_FLAG = 0x00000004 + CERT_STORE_DELETE_FLAG = 0x00000010 + CERT_STORE_UNSAFE_PHYSICAL_FLAG = 0x00000020 + CERT_STORE_SHARE_STORE_FLAG = 0x00000040 + CERT_STORE_SHARE_CONTEXT_FLAG = 0x00000080 + CERT_STORE_MANIFOLD_FLAG = 0x00000100 + CERT_STORE_ENUM_ARCHIVED_FLAG = 0x00000200 + CERT_STORE_UPDATE_KEYID_FLAG = 0x00000400 + CERT_STORE_BACKUP_RESTORE_FLAG = 0x00000800 + CERT_STORE_MAXIMUM_ALLOWED_FLAG = 0x00001000 + CERT_STORE_CREATE_NEW_FLAG = 0x00002000 + CERT_STORE_OPEN_EXISTING_FLAG = 0x00004000 + CERT_STORE_READONLY_FLAG = 0x00008000 + + /* store locations (high WORD of flag) for CertOpenStore function */ + CERT_SYSTEM_STORE_CURRENT_USER = 0x00010000 + CERT_SYSTEM_STORE_LOCAL_MACHINE = 0x00020000 + CERT_SYSTEM_STORE_CURRENT_SERVICE = 0x00040000 + CERT_SYSTEM_STORE_SERVICES = 0x00050000 + CERT_SYSTEM_STORE_USERS = 0x00060000 + CERT_SYSTEM_STORE_CURRENT_USER_GROUP_POLICY = 0x00070000 + CERT_SYSTEM_STORE_LOCAL_MACHINE_GROUP_POLICY = 0x00080000 + CERT_SYSTEM_STORE_LOCAL_MACHINE_ENTERPRISE = 0x00090000 + CERT_SYSTEM_STORE_UNPROTECTED_FLAG = 0x40000000 + CERT_SYSTEM_STORE_RELOCATE_FLAG = 0x80000000 + + /* Miscellaneous high-WORD flags for CertOpenStore function */ + CERT_REGISTRY_STORE_REMOTE_FLAG = 0x00010000 + CERT_REGISTRY_STORE_SERIALIZED_FLAG = 0x00020000 + CERT_REGISTRY_STORE_ROAMING_FLAG = 0x00040000 + CERT_REGISTRY_STORE_MY_IE_DIRTY_FLAG = 0x00080000 + CERT_REGISTRY_STORE_LM_GPT_FLAG = 0x01000000 + CERT_REGISTRY_STORE_CLIENT_GPT_FLAG = 0x80000000 + CERT_FILE_STORE_COMMIT_ENABLE_FLAG = 0x00010000 + CERT_LDAP_STORE_SIGN_FLAG = 0x00010000 + CERT_LDAP_STORE_AREC_EXCLUSIVE_FLAG = 0x00020000 + CERT_LDAP_STORE_OPENED_FLAG = 0x00040000 + CERT_LDAP_STORE_UNBIND_FLAG = 0x00080000 + + /* addDisposition values for CertAddCertificateContextToStore function */ + CERT_STORE_ADD_NEW = 1 + CERT_STORE_ADD_USE_EXISTING = 2 + CERT_STORE_ADD_REPLACE_EXISTING = 3 + CERT_STORE_ADD_ALWAYS = 4 + CERT_STORE_ADD_REPLACE_EXISTING_INHERIT_PROPERTIES = 5 + CERT_STORE_ADD_NEWER = 6 + CERT_STORE_ADD_NEWER_INHERIT_PROPERTIES = 7 + + /* ErrorStatus values for CertTrustStatus struct */ + CERT_TRUST_NO_ERROR = 0x00000000 + CERT_TRUST_IS_NOT_TIME_VALID = 0x00000001 + CERT_TRUST_IS_REVOKED = 0x00000004 + CERT_TRUST_IS_NOT_SIGNATURE_VALID = 0x00000008 + CERT_TRUST_IS_NOT_VALID_FOR_USAGE = 0x00000010 + CERT_TRUST_IS_UNTRUSTED_ROOT = 0x00000020 + CERT_TRUST_REVOCATION_STATUS_UNKNOWN = 0x00000040 + CERT_TRUST_IS_CYCLIC = 0x00000080 + CERT_TRUST_INVALID_EXTENSION = 0x00000100 + CERT_TRUST_INVALID_POLICY_CONSTRAINTS = 0x00000200 + CERT_TRUST_INVALID_BASIC_CONSTRAINTS = 0x00000400 + CERT_TRUST_INVALID_NAME_CONSTRAINTS = 0x00000800 + CERT_TRUST_HAS_NOT_SUPPORTED_NAME_CONSTRAINT = 0x00001000 + CERT_TRUST_HAS_NOT_DEFINED_NAME_CONSTRAINT = 0x00002000 + CERT_TRUST_HAS_NOT_PERMITTED_NAME_CONSTRAINT = 0x00004000 + CERT_TRUST_HAS_EXCLUDED_NAME_CONSTRAINT = 0x00008000 + CERT_TRUST_IS_PARTIAL_CHAIN = 0x00010000 + CERT_TRUST_CTL_IS_NOT_TIME_VALID = 0x00020000 + CERT_TRUST_CTL_IS_NOT_SIGNATURE_VALID = 0x00040000 + CERT_TRUST_CTL_IS_NOT_VALID_FOR_USAGE = 0x00080000 + CERT_TRUST_HAS_WEAK_SIGNATURE = 0x00100000 + CERT_TRUST_IS_OFFLINE_REVOCATION = 0x01000000 + CERT_TRUST_NO_ISSUANCE_CHAIN_POLICY = 0x02000000 + CERT_TRUST_IS_EXPLICIT_DISTRUST = 0x04000000 + CERT_TRUST_HAS_NOT_SUPPORTED_CRITICAL_EXT = 0x08000000 + + /* InfoStatus values for CertTrustStatus struct */ + CERT_TRUST_HAS_EXACT_MATCH_ISSUER = 0x00000001 + CERT_TRUST_HAS_KEY_MATCH_ISSUER = 0x00000002 + CERT_TRUST_HAS_NAME_MATCH_ISSUER = 0x00000004 + CERT_TRUST_IS_SELF_SIGNED = 0x00000008 + CERT_TRUST_HAS_PREFERRED_ISSUER = 0x00000100 + CERT_TRUST_HAS_ISSUANCE_CHAIN_POLICY = 0x00000400 + CERT_TRUST_HAS_VALID_NAME_CONSTRAINTS = 0x00000400 + CERT_TRUST_IS_PEER_TRUSTED = 0x00000800 + CERT_TRUST_HAS_CRL_VALIDITY_EXTENDED = 0x00001000 + CERT_TRUST_IS_FROM_EXCLUSIVE_TRUST_STORE = 0x00002000 + CERT_TRUST_IS_CA_TRUSTED = 0x00004000 + CERT_TRUST_IS_COMPLEX_CHAIN = 0x00010000 + + /* Certificate Information Flags */ + CERT_INFO_VERSION_FLAG = 1 + CERT_INFO_SERIAL_NUMBER_FLAG = 2 + CERT_INFO_SIGNATURE_ALGORITHM_FLAG = 3 + CERT_INFO_ISSUER_FLAG = 4 + CERT_INFO_NOT_BEFORE_FLAG = 5 + CERT_INFO_NOT_AFTER_FLAG = 6 + CERT_INFO_SUBJECT_FLAG = 7 + CERT_INFO_SUBJECT_PUBLIC_KEY_INFO_FLAG = 8 + CERT_INFO_ISSUER_UNIQUE_ID_FLAG = 9 + CERT_INFO_SUBJECT_UNIQUE_ID_FLAG = 10 + CERT_INFO_EXTENSION_FLAG = 11 + + /* dwFindType for CertFindCertificateInStore */ + CERT_COMPARE_MASK = 0xFFFF + CERT_COMPARE_SHIFT = 16 + CERT_COMPARE_ANY = 0 + CERT_COMPARE_SHA1_HASH = 1 + CERT_COMPARE_NAME = 2 + CERT_COMPARE_ATTR = 3 + CERT_COMPARE_MD5_HASH = 4 + CERT_COMPARE_PROPERTY = 5 + CERT_COMPARE_PUBLIC_KEY = 6 + CERT_COMPARE_HASH = CERT_COMPARE_SHA1_HASH + CERT_COMPARE_NAME_STR_A = 7 + CERT_COMPARE_NAME_STR_W = 8 + CERT_COMPARE_KEY_SPEC = 9 + CERT_COMPARE_ENHKEY_USAGE = 10 + CERT_COMPARE_CTL_USAGE = CERT_COMPARE_ENHKEY_USAGE + CERT_COMPARE_SUBJECT_CERT = 11 + CERT_COMPARE_ISSUER_OF = 12 + CERT_COMPARE_EXISTING = 13 + CERT_COMPARE_SIGNATURE_HASH = 14 + CERT_COMPARE_KEY_IDENTIFIER = 15 + CERT_COMPARE_CERT_ID = 16 + CERT_COMPARE_CROSS_CERT_DIST_POINTS = 17 + CERT_COMPARE_PUBKEY_MD5_HASH = 18 + CERT_COMPARE_SUBJECT_INFO_ACCESS = 19 + CERT_COMPARE_HASH_STR = 20 + CERT_COMPARE_HAS_PRIVATE_KEY = 21 + CERT_FIND_ANY = (CERT_COMPARE_ANY << CERT_COMPARE_SHIFT) + CERT_FIND_SHA1_HASH = (CERT_COMPARE_SHA1_HASH << CERT_COMPARE_SHIFT) + CERT_FIND_MD5_HASH = (CERT_COMPARE_MD5_HASH << CERT_COMPARE_SHIFT) + CERT_FIND_SIGNATURE_HASH = (CERT_COMPARE_SIGNATURE_HASH << CERT_COMPARE_SHIFT) + CERT_FIND_KEY_IDENTIFIER = (CERT_COMPARE_KEY_IDENTIFIER << CERT_COMPARE_SHIFT) + CERT_FIND_HASH = CERT_FIND_SHA1_HASH + CERT_FIND_PROPERTY = (CERT_COMPARE_PROPERTY << CERT_COMPARE_SHIFT) + CERT_FIND_PUBLIC_KEY = (CERT_COMPARE_PUBLIC_KEY << CERT_COMPARE_SHIFT) + CERT_FIND_SUBJECT_NAME = (CERT_COMPARE_NAME<> 32 & 0xffffffff) + return ft +} + +type Win32finddata struct { + FileAttributes uint32 + CreationTime Filetime + LastAccessTime Filetime + LastWriteTime Filetime + FileSizeHigh uint32 + FileSizeLow uint32 + Reserved0 uint32 + Reserved1 uint32 + FileName [MAX_PATH - 1]uint16 + AlternateFileName [13]uint16 +} + +// This is the actual system call structure. +// Win32finddata is what we committed to in Go 1. +type win32finddata1 struct { + FileAttributes uint32 + CreationTime Filetime + LastAccessTime Filetime + LastWriteTime Filetime + FileSizeHigh uint32 + FileSizeLow uint32 + Reserved0 uint32 + Reserved1 uint32 + FileName [MAX_PATH]uint16 + AlternateFileName [14]uint16 + + // The Microsoft documentation for this struct¹ describes three additional + // fields: dwFileType, dwCreatorType, and wFinderFlags. However, those fields + // are empirically only present in the macOS port of the Win32 API,² and thus + // not needed for binaries built for Windows. + // + // ¹ https://docs.microsoft.com/en-us/windows/win32/api/minwinbase/ns-minwinbase-win32_find_dataw describe + // ² https://golang.org/issue/42637#issuecomment-760715755. +} + +func copyFindData(dst *Win32finddata, src *win32finddata1) { + dst.FileAttributes = src.FileAttributes + dst.CreationTime = src.CreationTime + dst.LastAccessTime = src.LastAccessTime + dst.LastWriteTime = src.LastWriteTime + dst.FileSizeHigh = src.FileSizeHigh + dst.FileSizeLow = src.FileSizeLow + dst.Reserved0 = src.Reserved0 + dst.Reserved1 = src.Reserved1 + + // The src is 1 element bigger than dst, but it must be NUL. + copy(dst.FileName[:], src.FileName[:]) + copy(dst.AlternateFileName[:], src.AlternateFileName[:]) +} + +type ByHandleFileInformation struct { + FileAttributes uint32 + CreationTime Filetime + LastAccessTime Filetime + LastWriteTime Filetime + VolumeSerialNumber uint32 + FileSizeHigh uint32 + FileSizeLow uint32 + NumberOfLinks uint32 + FileIndexHigh uint32 + FileIndexLow uint32 +} + +const ( + GetFileExInfoStandard = 0 + GetFileExMaxInfoLevel = 1 +) + +type Win32FileAttributeData struct { + FileAttributes uint32 + CreationTime Filetime + LastAccessTime Filetime + LastWriteTime Filetime + FileSizeHigh uint32 + FileSizeLow uint32 +} + +// ShowWindow constants +const ( + // winuser.h + SW_HIDE = 0 + SW_NORMAL = 1 + SW_SHOWNORMAL = 1 + SW_SHOWMINIMIZED = 2 + SW_SHOWMAXIMIZED = 3 + SW_MAXIMIZE = 3 + SW_SHOWNOACTIVATE = 4 + SW_SHOW = 5 + SW_MINIMIZE = 6 + SW_SHOWMINNOACTIVE = 7 + SW_SHOWNA = 8 + SW_RESTORE = 9 + SW_SHOWDEFAULT = 10 + SW_FORCEMINIMIZE = 11 +) + +type StartupInfo struct { + Cb uint32 + _ *uint16 + Desktop *uint16 + Title *uint16 + X uint32 + Y uint32 + XSize uint32 + YSize uint32 + XCountChars uint32 + YCountChars uint32 + FillAttribute uint32 + Flags uint32 + ShowWindow uint16 + _ uint16 + _ *byte + StdInput Handle + StdOutput Handle + StdErr Handle +} + +type StartupInfoEx struct { + StartupInfo + ProcThreadAttributeList *ProcThreadAttributeList +} + +// ProcThreadAttributeList is a placeholder type to represent a PROC_THREAD_ATTRIBUTE_LIST. +// +// To create a *ProcThreadAttributeList, use NewProcThreadAttributeList, update +// it with ProcThreadAttributeListContainer.Update, free its memory using +// ProcThreadAttributeListContainer.Delete, and access the list itself using +// ProcThreadAttributeListContainer.List. +type ProcThreadAttributeList struct{} + +type ProcThreadAttributeListContainer struct { + data *ProcThreadAttributeList + pointers []unsafe.Pointer +} + +type ProcessInformation struct { + Process Handle + Thread Handle + ProcessId uint32 + ThreadId uint32 +} + +type ProcessEntry32 struct { + Size uint32 + Usage uint32 + ProcessID uint32 + DefaultHeapID uintptr + ModuleID uint32 + Threads uint32 + ParentProcessID uint32 + PriClassBase int32 + Flags uint32 + ExeFile [MAX_PATH]uint16 +} + +type ThreadEntry32 struct { + Size uint32 + Usage uint32 + ThreadID uint32 + OwnerProcessID uint32 + BasePri int32 + DeltaPri int32 + Flags uint32 +} + +type ModuleEntry32 struct { + Size uint32 + ModuleID uint32 + ProcessID uint32 + GlblcntUsage uint32 + ProccntUsage uint32 + ModBaseAddr uintptr + ModBaseSize uint32 + ModuleHandle Handle + Module [MAX_MODULE_NAME32 + 1]uint16 + ExePath [MAX_PATH]uint16 +} + +const SizeofModuleEntry32 = unsafe.Sizeof(ModuleEntry32{}) + +type Systemtime struct { + Year uint16 + Month uint16 + DayOfWeek uint16 + Day uint16 + Hour uint16 + Minute uint16 + Second uint16 + Milliseconds uint16 +} + +type Timezoneinformation struct { + Bias int32 + StandardName [32]uint16 + StandardDate Systemtime + StandardBias int32 + DaylightName [32]uint16 + DaylightDate Systemtime + DaylightBias int32 +} + +// Socket related. + +const ( + AF_UNSPEC = 0 + AF_UNIX = 1 + AF_INET = 2 + AF_NETBIOS = 17 + AF_INET6 = 23 + AF_IRDA = 26 + AF_BTH = 32 + + SOCK_STREAM = 1 + SOCK_DGRAM = 2 + SOCK_RAW = 3 + SOCK_RDM = 4 + SOCK_SEQPACKET = 5 + + IPPROTO_IP = 0 + IPPROTO_ICMP = 1 + IPPROTO_IGMP = 2 + BTHPROTO_RFCOMM = 3 + IPPROTO_TCP = 6 + IPPROTO_UDP = 17 + IPPROTO_IPV6 = 41 + IPPROTO_ICMPV6 = 58 + IPPROTO_RM = 113 + + SOL_SOCKET = 0xffff + SO_REUSEADDR = 4 + SO_KEEPALIVE = 8 + SO_DONTROUTE = 16 + SO_BROADCAST = 32 + SO_LINGER = 128 + SO_RCVBUF = 0x1002 + SO_RCVTIMEO = 0x1006 + SO_SNDBUF = 0x1001 + SO_UPDATE_ACCEPT_CONTEXT = 0x700b + SO_UPDATE_CONNECT_CONTEXT = 0x7010 + + IOC_OUT = 0x40000000 + IOC_IN = 0x80000000 + IOC_VENDOR = 0x18000000 + IOC_INOUT = IOC_IN | IOC_OUT + IOC_WS2 = 0x08000000 + SIO_GET_EXTENSION_FUNCTION_POINTER = IOC_INOUT | IOC_WS2 | 6 + SIO_KEEPALIVE_VALS = IOC_IN | IOC_VENDOR | 4 + SIO_UDP_CONNRESET = IOC_IN | IOC_VENDOR | 12 + SIO_UDP_NETRESET = IOC_IN | IOC_VENDOR | 15 + + // cf. http://support.microsoft.com/default.aspx?scid=kb;en-us;257460 + + IP_HDRINCL = 0x2 + IP_TOS = 0x3 + IP_TTL = 0x4 + IP_MULTICAST_IF = 0x9 + IP_MULTICAST_TTL = 0xa + IP_MULTICAST_LOOP = 0xb + IP_ADD_MEMBERSHIP = 0xc + IP_DROP_MEMBERSHIP = 0xd + IP_PKTINFO = 0x13 + IP_MTU_DISCOVER = 0x47 + + IPV6_V6ONLY = 0x1b + IPV6_UNICAST_HOPS = 0x4 + IPV6_MULTICAST_IF = 0x9 + IPV6_MULTICAST_HOPS = 0xa + IPV6_MULTICAST_LOOP = 0xb + IPV6_JOIN_GROUP = 0xc + IPV6_LEAVE_GROUP = 0xd + IPV6_PKTINFO = 0x13 + IPV6_MTU_DISCOVER = 0x47 + + MSG_OOB = 0x1 + MSG_PEEK = 0x2 + MSG_DONTROUTE = 0x4 + MSG_WAITALL = 0x8 + + MSG_TRUNC = 0x0100 + MSG_CTRUNC = 0x0200 + MSG_BCAST = 0x0400 + MSG_MCAST = 0x0800 + + SOMAXCONN = 0x7fffffff + + TCP_NODELAY = 1 + TCP_EXPEDITED_1122 = 2 + TCP_KEEPALIVE = 3 + TCP_MAXSEG = 4 + TCP_MAXRT = 5 + TCP_STDURG = 6 + TCP_NOURG = 7 + TCP_ATMARK = 8 + TCP_NOSYNRETRIES = 9 + TCP_TIMESTAMPS = 10 + TCP_OFFLOAD_PREFERENCE = 11 + TCP_CONGESTION_ALGORITHM = 12 + TCP_DELAY_FIN_ACK = 13 + TCP_MAXRTMS = 14 + TCP_FASTOPEN = 15 + TCP_KEEPCNT = 16 + TCP_KEEPIDLE = TCP_KEEPALIVE + TCP_KEEPINTVL = 17 + TCP_FAIL_CONNECT_ON_ICMP_ERROR = 18 + TCP_ICMP_ERROR_INFO = 19 + + UDP_NOCHECKSUM = 1 + UDP_SEND_MSG_SIZE = 2 + UDP_RECV_MAX_COALESCED_SIZE = 3 + UDP_CHECKSUM_COVERAGE = 20 + + UDP_COALESCED_INFO = 3 + + SHUT_RD = 0 + SHUT_WR = 1 + SHUT_RDWR = 2 + + WSADESCRIPTION_LEN = 256 + WSASYS_STATUS_LEN = 128 +) + +// enum PMTUD_STATE from ws2ipdef.h +const ( + IP_PMTUDISC_NOT_SET = 0 + IP_PMTUDISC_DO = 1 + IP_PMTUDISC_DONT = 2 + IP_PMTUDISC_PROBE = 3 + IP_PMTUDISC_MAX = 4 +) + +type WSABuf struct { + Len uint32 + Buf *byte +} + +type WSAMsg struct { + Name *syscall.RawSockaddrAny + Namelen int32 + Buffers *WSABuf + BufferCount uint32 + Control WSABuf + Flags uint32 +} + +type WSACMSGHDR struct { + Len uintptr + Level int32 + Type int32 +} + +type IN_PKTINFO struct { + Addr [4]byte + Ifindex uint32 +} + +type IN6_PKTINFO struct { + Addr [16]byte + Ifindex uint32 +} + +// Flags for WSASocket +const ( + WSA_FLAG_OVERLAPPED = 0x01 + WSA_FLAG_MULTIPOINT_C_ROOT = 0x02 + WSA_FLAG_MULTIPOINT_C_LEAF = 0x04 + WSA_FLAG_MULTIPOINT_D_ROOT = 0x08 + WSA_FLAG_MULTIPOINT_D_LEAF = 0x10 + WSA_FLAG_ACCESS_SYSTEM_SECURITY = 0x40 + WSA_FLAG_NO_HANDLE_INHERIT = 0x80 + WSA_FLAG_REGISTERED_IO = 0x100 +) + +// Invented values to support what package os expects. +const ( + S_IFMT = 0x1f000 + S_IFIFO = 0x1000 + S_IFCHR = 0x2000 + S_IFDIR = 0x4000 + S_IFBLK = 0x6000 + S_IFREG = 0x8000 + S_IFLNK = 0xa000 + S_IFSOCK = 0xc000 + S_ISUID = 0x800 + S_ISGID = 0x400 + S_ISVTX = 0x200 + S_IRUSR = 0x100 + S_IWRITE = 0x80 + S_IWUSR = 0x80 + S_IXUSR = 0x40 +) + +const ( + FILE_TYPE_CHAR = 0x0002 + FILE_TYPE_DISK = 0x0001 + FILE_TYPE_PIPE = 0x0003 + FILE_TYPE_REMOTE = 0x8000 + FILE_TYPE_UNKNOWN = 0x0000 +) + +type Hostent struct { + Name *byte + Aliases **byte + AddrType uint16 + Length uint16 + AddrList **byte +} + +type Protoent struct { + Name *byte + Aliases **byte + Proto uint16 +} + +const ( + DNS_TYPE_A = 0x0001 + DNS_TYPE_NS = 0x0002 + DNS_TYPE_MD = 0x0003 + DNS_TYPE_MF = 0x0004 + DNS_TYPE_CNAME = 0x0005 + DNS_TYPE_SOA = 0x0006 + DNS_TYPE_MB = 0x0007 + DNS_TYPE_MG = 0x0008 + DNS_TYPE_MR = 0x0009 + DNS_TYPE_NULL = 0x000a + DNS_TYPE_WKS = 0x000b + DNS_TYPE_PTR = 0x000c + DNS_TYPE_HINFO = 0x000d + DNS_TYPE_MINFO = 0x000e + DNS_TYPE_MX = 0x000f + DNS_TYPE_TEXT = 0x0010 + DNS_TYPE_RP = 0x0011 + DNS_TYPE_AFSDB = 0x0012 + DNS_TYPE_X25 = 0x0013 + DNS_TYPE_ISDN = 0x0014 + DNS_TYPE_RT = 0x0015 + DNS_TYPE_NSAP = 0x0016 + DNS_TYPE_NSAPPTR = 0x0017 + DNS_TYPE_SIG = 0x0018 + DNS_TYPE_KEY = 0x0019 + DNS_TYPE_PX = 0x001a + DNS_TYPE_GPOS = 0x001b + DNS_TYPE_AAAA = 0x001c + DNS_TYPE_LOC = 0x001d + DNS_TYPE_NXT = 0x001e + DNS_TYPE_EID = 0x001f + DNS_TYPE_NIMLOC = 0x0020 + DNS_TYPE_SRV = 0x0021 + DNS_TYPE_ATMA = 0x0022 + DNS_TYPE_NAPTR = 0x0023 + DNS_TYPE_KX = 0x0024 + DNS_TYPE_CERT = 0x0025 + DNS_TYPE_A6 = 0x0026 + DNS_TYPE_DNAME = 0x0027 + DNS_TYPE_SINK = 0x0028 + DNS_TYPE_OPT = 0x0029 + DNS_TYPE_DS = 0x002B + DNS_TYPE_RRSIG = 0x002E + DNS_TYPE_NSEC = 0x002F + DNS_TYPE_DNSKEY = 0x0030 + DNS_TYPE_DHCID = 0x0031 + DNS_TYPE_UINFO = 0x0064 + DNS_TYPE_UID = 0x0065 + DNS_TYPE_GID = 0x0066 + DNS_TYPE_UNSPEC = 0x0067 + DNS_TYPE_ADDRS = 0x00f8 + DNS_TYPE_TKEY = 0x00f9 + DNS_TYPE_TSIG = 0x00fa + DNS_TYPE_IXFR = 0x00fb + DNS_TYPE_AXFR = 0x00fc + DNS_TYPE_MAILB = 0x00fd + DNS_TYPE_MAILA = 0x00fe + DNS_TYPE_ALL = 0x00ff + DNS_TYPE_ANY = 0x00ff + DNS_TYPE_WINS = 0xff01 + DNS_TYPE_WINSR = 0xff02 + DNS_TYPE_NBSTAT = 0xff01 +) + +const ( + // flags inside DNSRecord.Dw + DnsSectionQuestion = 0x0000 + DnsSectionAnswer = 0x0001 + DnsSectionAuthority = 0x0002 + DnsSectionAdditional = 0x0003 +) + +const ( + // flags of WSALookupService + LUP_DEEP = 0x0001 + LUP_CONTAINERS = 0x0002 + LUP_NOCONTAINERS = 0x0004 + LUP_NEAREST = 0x0008 + LUP_RETURN_NAME = 0x0010 + LUP_RETURN_TYPE = 0x0020 + LUP_RETURN_VERSION = 0x0040 + LUP_RETURN_COMMENT = 0x0080 + LUP_RETURN_ADDR = 0x0100 + LUP_RETURN_BLOB = 0x0200 + LUP_RETURN_ALIASES = 0x0400 + LUP_RETURN_QUERY_STRING = 0x0800 + LUP_RETURN_ALL = 0x0FF0 + LUP_RES_SERVICE = 0x8000 + + LUP_FLUSHCACHE = 0x1000 + LUP_FLUSHPREVIOUS = 0x2000 + + LUP_NON_AUTHORITATIVE = 0x4000 + LUP_SECURE = 0x8000 + LUP_RETURN_PREFERRED_NAMES = 0x10000 + LUP_DNS_ONLY = 0x20000 + + LUP_ADDRCONFIG = 0x100000 + LUP_DUAL_ADDR = 0x200000 + LUP_FILESERVER = 0x400000 + LUP_DISABLE_IDN_ENCODING = 0x00800000 + LUP_API_ANSI = 0x01000000 + + LUP_RESOLUTION_HANDLE = 0x80000000 +) + +const ( + // values of WSAQUERYSET's namespace + NS_ALL = 0 + NS_DNS = 12 + NS_NLA = 15 + NS_BTH = 16 + NS_EMAIL = 37 + NS_PNRPNAME = 38 + NS_PNRPCLOUD = 39 +) + +type DNSSRVData struct { + Target *uint16 + Priority uint16 + Weight uint16 + Port uint16 + Pad uint16 +} + +type DNSPTRData struct { + Host *uint16 +} + +type DNSMXData struct { + NameExchange *uint16 + Preference uint16 + Pad uint16 +} + +type DNSTXTData struct { + StringCount uint16 + StringArray [1]*uint16 +} + +type DNSRecord struct { + Next *DNSRecord + Name *uint16 + Type uint16 + Length uint16 + Dw uint32 + Ttl uint32 + Reserved uint32 + Data [40]byte +} + +const ( + TF_DISCONNECT = 1 + TF_REUSE_SOCKET = 2 + TF_WRITE_BEHIND = 4 + TF_USE_DEFAULT_WORKER = 0 + TF_USE_SYSTEM_THREAD = 16 + TF_USE_KERNEL_APC = 32 +) + +type TransmitFileBuffers struct { + Head uintptr + HeadLength uint32 + Tail uintptr + TailLength uint32 +} + +const ( + IFF_UP = 1 + IFF_BROADCAST = 2 + IFF_LOOPBACK = 4 + IFF_POINTTOPOINT = 8 + IFF_MULTICAST = 16 +) + +const SIO_GET_INTERFACE_LIST = 0x4004747F + +// TODO(mattn): SockaddrGen is union of sockaddr/sockaddr_in/sockaddr_in6_old. +// will be fixed to change variable type as suitable. + +type SockaddrGen [24]byte + +type InterfaceInfo struct { + Flags uint32 + Address SockaddrGen + BroadcastAddress SockaddrGen + Netmask SockaddrGen +} + +type IpAddressString struct { + String [16]byte +} + +type IpMaskString IpAddressString + +type IpAddrString struct { + Next *IpAddrString + IpAddress IpAddressString + IpMask IpMaskString + Context uint32 +} + +const MAX_ADAPTER_NAME_LENGTH = 256 +const MAX_ADAPTER_DESCRIPTION_LENGTH = 128 +const MAX_ADAPTER_ADDRESS_LENGTH = 8 + +type IpAdapterInfo struct { + Next *IpAdapterInfo + ComboIndex uint32 + AdapterName [MAX_ADAPTER_NAME_LENGTH + 4]byte + Description [MAX_ADAPTER_DESCRIPTION_LENGTH + 4]byte + AddressLength uint32 + Address [MAX_ADAPTER_ADDRESS_LENGTH]byte + Index uint32 + Type uint32 + DhcpEnabled uint32 + CurrentIpAddress *IpAddrString + IpAddressList IpAddrString + GatewayList IpAddrString + DhcpServer IpAddrString + HaveWins bool + PrimaryWinsServer IpAddrString + SecondaryWinsServer IpAddrString + LeaseObtained int64 + LeaseExpires int64 +} + +const MAXLEN_PHYSADDR = 8 +const MAX_INTERFACE_NAME_LEN = 256 +const MAXLEN_IFDESCR = 256 + +type MibIfRow struct { + Name [MAX_INTERFACE_NAME_LEN]uint16 + Index uint32 + Type uint32 + Mtu uint32 + Speed uint32 + PhysAddrLen uint32 + PhysAddr [MAXLEN_PHYSADDR]byte + AdminStatus uint32 + OperStatus uint32 + LastChange uint32 + InOctets uint32 + InUcastPkts uint32 + InNUcastPkts uint32 + InDiscards uint32 + InErrors uint32 + InUnknownProtos uint32 + OutOctets uint32 + OutUcastPkts uint32 + OutNUcastPkts uint32 + OutDiscards uint32 + OutErrors uint32 + OutQLen uint32 + DescrLen uint32 + Descr [MAXLEN_IFDESCR]byte +} + +type CertInfo struct { + Version uint32 + SerialNumber CryptIntegerBlob + SignatureAlgorithm CryptAlgorithmIdentifier + Issuer CertNameBlob + NotBefore Filetime + NotAfter Filetime + Subject CertNameBlob + SubjectPublicKeyInfo CertPublicKeyInfo + IssuerUniqueId CryptBitBlob + SubjectUniqueId CryptBitBlob + CountExtensions uint32 + Extensions *CertExtension +} + +type CertExtension struct { + ObjId *byte + Critical int32 + Value CryptObjidBlob +} + +type CryptAlgorithmIdentifier struct { + ObjId *byte + Parameters CryptObjidBlob +} + +type CertPublicKeyInfo struct { + Algorithm CryptAlgorithmIdentifier + PublicKey CryptBitBlob +} + +type DataBlob struct { + Size uint32 + Data *byte +} +type CryptIntegerBlob DataBlob +type CryptUintBlob DataBlob +type CryptObjidBlob DataBlob +type CertNameBlob DataBlob +type CertRdnValueBlob DataBlob +type CertBlob DataBlob +type CrlBlob DataBlob +type CryptDataBlob DataBlob +type CryptHashBlob DataBlob +type CryptDigestBlob DataBlob +type CryptDerBlob DataBlob +type CryptAttrBlob DataBlob + +type CryptBitBlob struct { + Size uint32 + Data *byte + UnusedBits uint32 +} + +type CertContext struct { + EncodingType uint32 + EncodedCert *byte + Length uint32 + CertInfo *CertInfo + Store Handle +} + +type CertChainContext struct { + Size uint32 + TrustStatus CertTrustStatus + ChainCount uint32 + Chains **CertSimpleChain + LowerQualityChainCount uint32 + LowerQualityChains **CertChainContext + HasRevocationFreshnessTime uint32 + RevocationFreshnessTime uint32 +} + +type CertTrustListInfo struct { + // Not implemented +} + +type CertSimpleChain struct { + Size uint32 + TrustStatus CertTrustStatus + NumElements uint32 + Elements **CertChainElement + TrustListInfo *CertTrustListInfo + HasRevocationFreshnessTime uint32 + RevocationFreshnessTime uint32 +} + +type CertChainElement struct { + Size uint32 + CertContext *CertContext + TrustStatus CertTrustStatus + RevocationInfo *CertRevocationInfo + IssuanceUsage *CertEnhKeyUsage + ApplicationUsage *CertEnhKeyUsage + ExtendedErrorInfo *uint16 +} + +type CertRevocationCrlInfo struct { + // Not implemented +} + +type CertRevocationInfo struct { + Size uint32 + RevocationResult uint32 + RevocationOid *byte + OidSpecificInfo Pointer + HasFreshnessTime uint32 + FreshnessTime uint32 + CrlInfo *CertRevocationCrlInfo +} + +type CertTrustStatus struct { + ErrorStatus uint32 + InfoStatus uint32 +} + +type CertUsageMatch struct { + Type uint32 + Usage CertEnhKeyUsage +} + +type CertEnhKeyUsage struct { + Length uint32 + UsageIdentifiers **byte +} + +type CertChainPara struct { + Size uint32 + RequestedUsage CertUsageMatch + RequstedIssuancePolicy CertUsageMatch + URLRetrievalTimeout uint32 + CheckRevocationFreshnessTime uint32 + RevocationFreshnessTime uint32 + CacheResync *Filetime +} + +type CertChainPolicyPara struct { + Size uint32 + Flags uint32 + ExtraPolicyPara Pointer +} + +type SSLExtraCertChainPolicyPara struct { + Size uint32 + AuthType uint32 + Checks uint32 + ServerName *uint16 +} + +type CertChainPolicyStatus struct { + Size uint32 + Error uint32 + ChainIndex uint32 + ElementIndex uint32 + ExtraPolicyStatus Pointer +} + +type CertPolicyInfo struct { + Identifier *byte + CountQualifiers uint32 + Qualifiers *CertPolicyQualifierInfo +} + +type CertPoliciesInfo struct { + Count uint32 + PolicyInfos *CertPolicyInfo +} + +type CertPolicyQualifierInfo struct { + // Not implemented +} + +type CertStrongSignPara struct { + Size uint32 + InfoChoice uint32 + InfoOrSerializedInfoOrOID unsafe.Pointer +} + +type CryptProtectPromptStruct struct { + Size uint32 + PromptFlags uint32 + App HWND + Prompt *uint16 +} + +type CertChainFindByIssuerPara struct { + Size uint32 + UsageIdentifier *byte + KeySpec uint32 + AcquirePrivateKeyFlags uint32 + IssuerCount uint32 + Issuer Pointer + FindCallback Pointer + FindArg Pointer + IssuerChainIndex *uint32 + IssuerElementIndex *uint32 +} + +type WinTrustData struct { + Size uint32 + PolicyCallbackData uintptr + SIPClientData uintptr + UIChoice uint32 + RevocationChecks uint32 + UnionChoice uint32 + FileOrCatalogOrBlobOrSgnrOrCert unsafe.Pointer + StateAction uint32 + StateData Handle + URLReference *uint16 + ProvFlags uint32 + UIContext uint32 + SignatureSettings *WinTrustSignatureSettings +} + +type WinTrustFileInfo struct { + Size uint32 + FilePath *uint16 + File Handle + KnownSubject *GUID +} + +type WinTrustSignatureSettings struct { + Size uint32 + Index uint32 + Flags uint32 + SecondarySigs uint32 + VerifiedSigIndex uint32 + CryptoPolicy *CertStrongSignPara +} + +const ( + // do not reorder + HKEY_CLASSES_ROOT = 0x80000000 + iota + HKEY_CURRENT_USER + HKEY_LOCAL_MACHINE + HKEY_USERS + HKEY_PERFORMANCE_DATA + HKEY_CURRENT_CONFIG + HKEY_DYN_DATA + + KEY_QUERY_VALUE = 1 + KEY_SET_VALUE = 2 + KEY_CREATE_SUB_KEY = 4 + KEY_ENUMERATE_SUB_KEYS = 8 + KEY_NOTIFY = 16 + KEY_CREATE_LINK = 32 + KEY_WRITE = 0x20006 + KEY_EXECUTE = 0x20019 + KEY_READ = 0x20019 + KEY_WOW64_64KEY = 0x0100 + KEY_WOW64_32KEY = 0x0200 + KEY_ALL_ACCESS = 0xf003f +) + +const ( + // do not reorder + REG_NONE = iota + REG_SZ + REG_EXPAND_SZ + REG_BINARY + REG_DWORD_LITTLE_ENDIAN + REG_DWORD_BIG_ENDIAN + REG_LINK + REG_MULTI_SZ + REG_RESOURCE_LIST + REG_FULL_RESOURCE_DESCRIPTOR + REG_RESOURCE_REQUIREMENTS_LIST + REG_QWORD_LITTLE_ENDIAN + REG_DWORD = REG_DWORD_LITTLE_ENDIAN + REG_QWORD = REG_QWORD_LITTLE_ENDIAN +) + +const ( + EVENT_MODIFY_STATE = 0x0002 + EVENT_ALL_ACCESS = STANDARD_RIGHTS_REQUIRED | SYNCHRONIZE | 0x3 + + MUTANT_QUERY_STATE = 0x0001 + MUTANT_ALL_ACCESS = STANDARD_RIGHTS_REQUIRED | SYNCHRONIZE | MUTANT_QUERY_STATE + + SEMAPHORE_MODIFY_STATE = 0x0002 + SEMAPHORE_ALL_ACCESS = STANDARD_RIGHTS_REQUIRED | SYNCHRONIZE | 0x3 + + TIMER_QUERY_STATE = 0x0001 + TIMER_MODIFY_STATE = 0x0002 + TIMER_ALL_ACCESS = STANDARD_RIGHTS_REQUIRED | SYNCHRONIZE | TIMER_QUERY_STATE | TIMER_MODIFY_STATE + + MUTEX_MODIFY_STATE = MUTANT_QUERY_STATE + MUTEX_ALL_ACCESS = MUTANT_ALL_ACCESS + + CREATE_EVENT_MANUAL_RESET = 0x1 + CREATE_EVENT_INITIAL_SET = 0x2 + CREATE_MUTEX_INITIAL_OWNER = 0x1 +) + +type AddrinfoW struct { + Flags int32 + Family int32 + Socktype int32 + Protocol int32 + Addrlen uintptr + Canonname *uint16 + Addr uintptr + Next *AddrinfoW +} + +const ( + AI_PASSIVE = 1 + AI_CANONNAME = 2 + AI_NUMERICHOST = 4 +) + +type GUID struct { + Data1 uint32 + Data2 uint16 + Data3 uint16 + Data4 [8]byte +} + +var WSAID_CONNECTEX = GUID{ + 0x25a207b9, + 0xddf3, + 0x4660, + [8]byte{0x8e, 0xe9, 0x76, 0xe5, 0x8c, 0x74, 0x06, 0x3e}, +} + +var WSAID_WSASENDMSG = GUID{ + 0xa441e712, + 0x754f, + 0x43ca, + [8]byte{0x84, 0xa7, 0x0d, 0xee, 0x44, 0xcf, 0x60, 0x6d}, +} + +var WSAID_WSARECVMSG = GUID{ + 0xf689d7c8, + 0x6f1f, + 0x436b, + [8]byte{0x8a, 0x53, 0xe5, 0x4f, 0xe3, 0x51, 0xc3, 0x22}, +} + +const ( + FILE_SKIP_COMPLETION_PORT_ON_SUCCESS = 1 + FILE_SKIP_SET_EVENT_ON_HANDLE = 2 +) + +const ( + WSAPROTOCOL_LEN = 255 + MAX_PROTOCOL_CHAIN = 7 + BASE_PROTOCOL = 1 + LAYERED_PROTOCOL = 0 + + XP1_CONNECTIONLESS = 0x00000001 + XP1_GUARANTEED_DELIVERY = 0x00000002 + XP1_GUARANTEED_ORDER = 0x00000004 + XP1_MESSAGE_ORIENTED = 0x00000008 + XP1_PSEUDO_STREAM = 0x00000010 + XP1_GRACEFUL_CLOSE = 0x00000020 + XP1_EXPEDITED_DATA = 0x00000040 + XP1_CONNECT_DATA = 0x00000080 + XP1_DISCONNECT_DATA = 0x00000100 + XP1_SUPPORT_BROADCAST = 0x00000200 + XP1_SUPPORT_MULTIPOINT = 0x00000400 + XP1_MULTIPOINT_CONTROL_PLANE = 0x00000800 + XP1_MULTIPOINT_DATA_PLANE = 0x00001000 + XP1_QOS_SUPPORTED = 0x00002000 + XP1_UNI_SEND = 0x00008000 + XP1_UNI_RECV = 0x00010000 + XP1_IFS_HANDLES = 0x00020000 + XP1_PARTIAL_MESSAGE = 0x00040000 + XP1_SAN_SUPPORT_SDP = 0x00080000 + + PFL_MULTIPLE_PROTO_ENTRIES = 0x00000001 + PFL_RECOMMENDED_PROTO_ENTRY = 0x00000002 + PFL_HIDDEN = 0x00000004 + PFL_MATCHES_PROTOCOL_ZERO = 0x00000008 + PFL_NETWORKDIRECT_PROVIDER = 0x00000010 +) + +type WSAProtocolInfo struct { + ServiceFlags1 uint32 + ServiceFlags2 uint32 + ServiceFlags3 uint32 + ServiceFlags4 uint32 + ProviderFlags uint32 + ProviderId GUID + CatalogEntryId uint32 + ProtocolChain WSAProtocolChain + Version int32 + AddressFamily int32 + MaxSockAddr int32 + MinSockAddr int32 + SocketType int32 + Protocol int32 + ProtocolMaxOffset int32 + NetworkByteOrder int32 + SecurityScheme int32 + MessageSize uint32 + ProviderReserved uint32 + ProtocolName [WSAPROTOCOL_LEN + 1]uint16 +} + +type WSAProtocolChain struct { + ChainLen int32 + ChainEntries [MAX_PROTOCOL_CHAIN]uint32 +} + +type TCPKeepalive struct { + OnOff uint32 + Time uint32 + Interval uint32 +} + +type symbolicLinkReparseBuffer struct { + SubstituteNameOffset uint16 + SubstituteNameLength uint16 + PrintNameOffset uint16 + PrintNameLength uint16 + Flags uint32 + PathBuffer [1]uint16 +} + +type mountPointReparseBuffer struct { + SubstituteNameOffset uint16 + SubstituteNameLength uint16 + PrintNameOffset uint16 + PrintNameLength uint16 + PathBuffer [1]uint16 +} + +type reparseDataBuffer struct { + ReparseTag uint32 + ReparseDataLength uint16 + Reserved uint16 + + // GenericReparseBuffer + reparseBuffer byte +} + +const ( + FSCTL_CREATE_OR_GET_OBJECT_ID = 0x0900C0 + FSCTL_DELETE_OBJECT_ID = 0x0900A0 + FSCTL_DELETE_REPARSE_POINT = 0x0900AC + FSCTL_DUPLICATE_EXTENTS_TO_FILE = 0x098344 + FSCTL_DUPLICATE_EXTENTS_TO_FILE_EX = 0x0983E8 + FSCTL_FILESYSTEM_GET_STATISTICS = 0x090060 + FSCTL_FILE_LEVEL_TRIM = 0x098208 + FSCTL_FIND_FILES_BY_SID = 0x09008F + FSCTL_GET_COMPRESSION = 0x09003C + FSCTL_GET_INTEGRITY_INFORMATION = 0x09027C + FSCTL_GET_NTFS_VOLUME_DATA = 0x090064 + FSCTL_GET_REFS_VOLUME_DATA = 0x0902D8 + FSCTL_GET_OBJECT_ID = 0x09009C + FSCTL_GET_REPARSE_POINT = 0x0900A8 + FSCTL_GET_RETRIEVAL_POINTER_COUNT = 0x09042B + FSCTL_GET_RETRIEVAL_POINTERS = 0x090073 + FSCTL_GET_RETRIEVAL_POINTERS_AND_REFCOUNT = 0x0903D3 + FSCTL_IS_PATHNAME_VALID = 0x09002C + FSCTL_LMR_SET_LINK_TRACKING_INFORMATION = 0x1400EC + FSCTL_MARK_HANDLE = 0x0900FC + FSCTL_OFFLOAD_READ = 0x094264 + FSCTL_OFFLOAD_WRITE = 0x098268 + FSCTL_PIPE_PEEK = 0x11400C + FSCTL_PIPE_TRANSCEIVE = 0x11C017 + FSCTL_PIPE_WAIT = 0x110018 + FSCTL_QUERY_ALLOCATED_RANGES = 0x0940CF + FSCTL_QUERY_FAT_BPB = 0x090058 + FSCTL_QUERY_FILE_REGIONS = 0x090284 + FSCTL_QUERY_ON_DISK_VOLUME_INFO = 0x09013C + FSCTL_QUERY_SPARING_INFO = 0x090138 + FSCTL_READ_FILE_USN_DATA = 0x0900EB + FSCTL_RECALL_FILE = 0x090117 + FSCTL_REFS_STREAM_SNAPSHOT_MANAGEMENT = 0x090440 + FSCTL_SET_COMPRESSION = 0x09C040 + FSCTL_SET_DEFECT_MANAGEMENT = 0x098134 + FSCTL_SET_ENCRYPTION = 0x0900D7 + FSCTL_SET_INTEGRITY_INFORMATION = 0x09C280 + FSCTL_SET_INTEGRITY_INFORMATION_EX = 0x090380 + FSCTL_SET_OBJECT_ID = 0x090098 + FSCTL_SET_OBJECT_ID_EXTENDED = 0x0900BC + FSCTL_SET_REPARSE_POINT = 0x0900A4 + FSCTL_SET_SPARSE = 0x0900C4 + FSCTL_SET_ZERO_DATA = 0x0980C8 + FSCTL_SET_ZERO_ON_DEALLOCATION = 0x090194 + FSCTL_SIS_COPYFILE = 0x090100 + FSCTL_WRITE_USN_CLOSE_RECORD = 0x0900EF + + MAXIMUM_REPARSE_DATA_BUFFER_SIZE = 16 * 1024 + IO_REPARSE_TAG_MOUNT_POINT = 0xA0000003 + IO_REPARSE_TAG_SYMLINK = 0xA000000C + SYMBOLIC_LINK_FLAG_DIRECTORY = 0x1 +) + +// FILE_ZERO_DATA_INFORMATION from winioctl.h +type FileZeroDataInformation struct { + FileOffset int64 + BeyondFinalZero int64 +} + +const ( + ComputerNameNetBIOS = 0 + ComputerNameDnsHostname = 1 + ComputerNameDnsDomain = 2 + ComputerNameDnsFullyQualified = 3 + ComputerNamePhysicalNetBIOS = 4 + ComputerNamePhysicalDnsHostname = 5 + ComputerNamePhysicalDnsDomain = 6 + ComputerNamePhysicalDnsFullyQualified = 7 + ComputerNameMax = 8 +) + +// For MessageBox() +const ( + MB_OK = 0x00000000 + MB_OKCANCEL = 0x00000001 + MB_ABORTRETRYIGNORE = 0x00000002 + MB_YESNOCANCEL = 0x00000003 + MB_YESNO = 0x00000004 + MB_RETRYCANCEL = 0x00000005 + MB_CANCELTRYCONTINUE = 0x00000006 + MB_ICONHAND = 0x00000010 + MB_ICONQUESTION = 0x00000020 + MB_ICONEXCLAMATION = 0x00000030 + MB_ICONASTERISK = 0x00000040 + MB_USERICON = 0x00000080 + MB_ICONWARNING = MB_ICONEXCLAMATION + MB_ICONERROR = MB_ICONHAND + MB_ICONINFORMATION = MB_ICONASTERISK + MB_ICONSTOP = MB_ICONHAND + MB_DEFBUTTON1 = 0x00000000 + MB_DEFBUTTON2 = 0x00000100 + MB_DEFBUTTON3 = 0x00000200 + MB_DEFBUTTON4 = 0x00000300 + MB_APPLMODAL = 0x00000000 + MB_SYSTEMMODAL = 0x00001000 + MB_TASKMODAL = 0x00002000 + MB_HELP = 0x00004000 + MB_NOFOCUS = 0x00008000 + MB_SETFOREGROUND = 0x00010000 + MB_DEFAULT_DESKTOP_ONLY = 0x00020000 + MB_TOPMOST = 0x00040000 + MB_RIGHT = 0x00080000 + MB_RTLREADING = 0x00100000 + MB_SERVICE_NOTIFICATION = 0x00200000 +) + +const ( + MOVEFILE_REPLACE_EXISTING = 0x1 + MOVEFILE_COPY_ALLOWED = 0x2 + MOVEFILE_DELAY_UNTIL_REBOOT = 0x4 + MOVEFILE_WRITE_THROUGH = 0x8 + MOVEFILE_CREATE_HARDLINK = 0x10 + MOVEFILE_FAIL_IF_NOT_TRACKABLE = 0x20 +) + +// Flags for GetAdaptersAddresses, see +// https://learn.microsoft.com/en-us/windows/win32/api/iphlpapi/nf-iphlpapi-getadaptersaddresses. +const ( + GAA_FLAG_SKIP_UNICAST = 0x1 + GAA_FLAG_SKIP_ANYCAST = 0x2 + GAA_FLAG_SKIP_MULTICAST = 0x4 + GAA_FLAG_SKIP_DNS_SERVER = 0x8 + GAA_FLAG_INCLUDE_PREFIX = 0x10 + GAA_FLAG_SKIP_FRIENDLY_NAME = 0x20 + GAA_FLAG_INCLUDE_WINS_INFO = 0x40 + GAA_FLAG_INCLUDE_GATEWAYS = 0x80 + GAA_FLAG_INCLUDE_ALL_INTERFACES = 0x100 + GAA_FLAG_INCLUDE_ALL_COMPARTMENTS = 0x200 + GAA_FLAG_INCLUDE_TUNNEL_BINDINGORDER = 0x400 +) + +const ( + IF_TYPE_OTHER = 1 + IF_TYPE_ETHERNET_CSMACD = 6 + IF_TYPE_ISO88025_TOKENRING = 9 + IF_TYPE_PPP = 23 + IF_TYPE_SOFTWARE_LOOPBACK = 24 + IF_TYPE_ATM = 37 + IF_TYPE_IEEE80211 = 71 + IF_TYPE_TUNNEL = 131 + IF_TYPE_IEEE1394 = 144 +) + +// Enum NL_PREFIX_ORIGIN for [IpAdapterUnicastAddress], see +// https://learn.microsoft.com/en-us/windows/win32/api/nldef/ne-nldef-nl_prefix_origin +const ( + IpPrefixOriginOther = 0 + IpPrefixOriginManual = 1 + IpPrefixOriginWellKnown = 2 + IpPrefixOriginDhcp = 3 + IpPrefixOriginRouterAdvertisement = 4 + IpPrefixOriginUnchanged = 1 << 4 +) + +// Enum NL_SUFFIX_ORIGIN for [IpAdapterUnicastAddress], see +// https://learn.microsoft.com/en-us/windows/win32/api/nldef/ne-nldef-nl_suffix_origin +const ( + NlsoOther = 0 + NlsoManual = 1 + NlsoWellKnown = 2 + NlsoDhcp = 3 + NlsoLinkLayerAddress = 4 + NlsoRandom = 5 + IpSuffixOriginOther = 0 + IpSuffixOriginManual = 1 + IpSuffixOriginWellKnown = 2 + IpSuffixOriginDhcp = 3 + IpSuffixOriginLinkLayerAddress = 4 + IpSuffixOriginRandom = 5 + IpSuffixOriginUnchanged = 1 << 4 +) + +// Enum NL_DAD_STATE for [IpAdapterUnicastAddress], see +// https://learn.microsoft.com/en-us/windows/win32/api/nldef/ne-nldef-nl_dad_state +const ( + NldsInvalid = 0 + NldsTentative = 1 + NldsDuplicate = 2 + NldsDeprecated = 3 + NldsPreferred = 4 + IpDadStateInvalid = 0 + IpDadStateTentative = 1 + IpDadStateDuplicate = 2 + IpDadStateDeprecated = 3 + IpDadStatePreferred = 4 +) + +type SocketAddress struct { + Sockaddr *syscall.RawSockaddrAny + SockaddrLength int32 +} + +// IP returns an IPv4 or IPv6 address, or nil if the underlying SocketAddress is neither. +func (addr *SocketAddress) IP() net.IP { + if uintptr(addr.SockaddrLength) >= unsafe.Sizeof(RawSockaddrInet4{}) && addr.Sockaddr.Addr.Family == AF_INET { + return (*RawSockaddrInet4)(unsafe.Pointer(addr.Sockaddr)).Addr[:] + } else if uintptr(addr.SockaddrLength) >= unsafe.Sizeof(RawSockaddrInet6{}) && addr.Sockaddr.Addr.Family == AF_INET6 { + return (*RawSockaddrInet6)(unsafe.Pointer(addr.Sockaddr)).Addr[:] + } + return nil +} + +type IpAdapterUnicastAddress struct { + Length uint32 + Flags uint32 + Next *IpAdapterUnicastAddress + Address SocketAddress + PrefixOrigin int32 + SuffixOrigin int32 + DadState int32 + ValidLifetime uint32 + PreferredLifetime uint32 + LeaseLifetime uint32 + OnLinkPrefixLength uint8 +} + +type IpAdapterAnycastAddress struct { + Length uint32 + Flags uint32 + Next *IpAdapterAnycastAddress + Address SocketAddress +} + +type IpAdapterMulticastAddress struct { + Length uint32 + Flags uint32 + Next *IpAdapterMulticastAddress + Address SocketAddress +} + +type IpAdapterDnsServerAdapter struct { + Length uint32 + Reserved uint32 + Next *IpAdapterDnsServerAdapter + Address SocketAddress +} + +type IpAdapterPrefix struct { + Length uint32 + Flags uint32 + Next *IpAdapterPrefix + Address SocketAddress + PrefixLength uint32 +} + +type IpAdapterAddresses struct { + Length uint32 + IfIndex uint32 + Next *IpAdapterAddresses + AdapterName *byte + FirstUnicastAddress *IpAdapterUnicastAddress + FirstAnycastAddress *IpAdapterAnycastAddress + FirstMulticastAddress *IpAdapterMulticastAddress + FirstDnsServerAddress *IpAdapterDnsServerAdapter + DnsSuffix *uint16 + Description *uint16 + FriendlyName *uint16 + PhysicalAddress [syscall.MAX_ADAPTER_ADDRESS_LENGTH]byte + PhysicalAddressLength uint32 + Flags uint32 + Mtu uint32 + IfType uint32 + OperStatus uint32 + Ipv6IfIndex uint32 + ZoneIndices [16]uint32 + FirstPrefix *IpAdapterPrefix + TransmitLinkSpeed uint64 + ReceiveLinkSpeed uint64 + FirstWinsServerAddress *IpAdapterWinsServerAddress + FirstGatewayAddress *IpAdapterGatewayAddress + Ipv4Metric uint32 + Ipv6Metric uint32 + Luid uint64 + Dhcpv4Server SocketAddress + CompartmentId uint32 + NetworkGuid GUID + ConnectionType uint32 + TunnelType uint32 + Dhcpv6Server SocketAddress + Dhcpv6ClientDuid [MAX_DHCPV6_DUID_LENGTH]byte + Dhcpv6ClientDuidLength uint32 + Dhcpv6Iaid uint32 + FirstDnsSuffix *IpAdapterDNSSuffix +} + +type IpAdapterWinsServerAddress struct { + Length uint32 + Reserved uint32 + Next *IpAdapterWinsServerAddress + Address SocketAddress +} + +type IpAdapterGatewayAddress struct { + Length uint32 + Reserved uint32 + Next *IpAdapterGatewayAddress + Address SocketAddress +} + +type IpAdapterDNSSuffix struct { + Next *IpAdapterDNSSuffix + String [MAX_DNS_SUFFIX_STRING_LENGTH]uint16 +} + +const ( + IfOperStatusUp = 1 + IfOperStatusDown = 2 + IfOperStatusTesting = 3 + IfOperStatusUnknown = 4 + IfOperStatusDormant = 5 + IfOperStatusNotPresent = 6 + IfOperStatusLowerLayerDown = 7 +) + +const ( + IF_MAX_PHYS_ADDRESS_LENGTH = 32 + IF_MAX_STRING_SIZE = 256 +) + +// MIB_IF_ENTRY_LEVEL enumeration from netioapi.h or +// https://learn.microsoft.com/en-us/windows/win32/api/netioapi/nf-netioapi-getifentry2ex. +const ( + MibIfEntryNormal = 0 + MibIfEntryNormalWithoutStatistics = 2 +) + +// MIB_NOTIFICATION_TYPE enumeration from netioapi.h or +// https://learn.microsoft.com/en-us/windows/win32/api/netioapi/ne-netioapi-mib_notification_type. +const ( + MibParameterNotification = 0 + MibAddInstance = 1 + MibDeleteInstance = 2 + MibInitialNotification = 3 +) + +// MibIfRow2 stores information about a particular interface. See +// https://learn.microsoft.com/en-us/windows/win32/api/netioapi/ns-netioapi-mib_if_row2. +type MibIfRow2 struct { + InterfaceLuid uint64 + InterfaceIndex uint32 + InterfaceGuid GUID + Alias [IF_MAX_STRING_SIZE + 1]uint16 + Description [IF_MAX_STRING_SIZE + 1]uint16 + PhysicalAddressLength uint32 + PhysicalAddress [IF_MAX_PHYS_ADDRESS_LENGTH]uint8 + PermanentPhysicalAddress [IF_MAX_PHYS_ADDRESS_LENGTH]uint8 + Mtu uint32 + Type uint32 + TunnelType uint32 + MediaType uint32 + PhysicalMediumType uint32 + AccessType uint32 + DirectionType uint32 + InterfaceAndOperStatusFlags uint8 + OperStatus uint32 + AdminStatus uint32 + MediaConnectState uint32 + NetworkGuid GUID + ConnectionType uint32 + TransmitLinkSpeed uint64 + ReceiveLinkSpeed uint64 + InOctets uint64 + InUcastPkts uint64 + InNUcastPkts uint64 + InDiscards uint64 + InErrors uint64 + InUnknownProtos uint64 + InUcastOctets uint64 + InMulticastOctets uint64 + InBroadcastOctets uint64 + OutOctets uint64 + OutUcastPkts uint64 + OutNUcastPkts uint64 + OutDiscards uint64 + OutErrors uint64 + OutUcastOctets uint64 + OutMulticastOctets uint64 + OutBroadcastOctets uint64 + OutQLen uint64 +} + +// IP_ADDRESS_PREFIX stores an IP address prefix. See +// https://learn.microsoft.com/en-us/windows/win32/api/netioapi/ns-netioapi-ip_address_prefix. +type IpAddressPrefix struct { + Prefix RawSockaddrInet + PrefixLength uint8 +} + +// NL_ROUTE_ORIGIN enumeration from nldef.h or +// https://learn.microsoft.com/en-us/windows/win32/api/nldef/ne-nldef-nl_route_origin. +const ( + NlroManual = 0 + NlroWellKnown = 1 + NlroDHCP = 2 + NlroRouterAdvertisement = 3 + Nlro6to4 = 4 +) + +// NL_ROUTE_ORIGIN enumeration from nldef.h or +// https://learn.microsoft.com/en-us/windows/win32/api/nldef/ne-nldef-nl_route_protocol. +const ( + MIB_IPPROTO_OTHER = 1 + MIB_IPPROTO_LOCAL = 2 + MIB_IPPROTO_NETMGMT = 3 + MIB_IPPROTO_ICMP = 4 + MIB_IPPROTO_EGP = 5 + MIB_IPPROTO_GGP = 6 + MIB_IPPROTO_HELLO = 7 + MIB_IPPROTO_RIP = 8 + MIB_IPPROTO_IS_IS = 9 + MIB_IPPROTO_ES_IS = 10 + MIB_IPPROTO_CISCO = 11 + MIB_IPPROTO_BBN = 12 + MIB_IPPROTO_OSPF = 13 + MIB_IPPROTO_BGP = 14 + MIB_IPPROTO_IDPR = 15 + MIB_IPPROTO_EIGRP = 16 + MIB_IPPROTO_DVMRP = 17 + MIB_IPPROTO_RPL = 18 + MIB_IPPROTO_DHCP = 19 + MIB_IPPROTO_NT_AUTOSTATIC = 10002 + MIB_IPPROTO_NT_STATIC = 10006 + MIB_IPPROTO_NT_STATIC_NON_DOD = 10007 +) + +// MIB_IPFORWARD_ROW2 stores information about an IP route entry. See +// https://learn.microsoft.com/en-us/windows/win32/api/netioapi/ns-netioapi-mib_ipforward_row2. +type MibIpForwardRow2 struct { + InterfaceLuid uint64 + InterfaceIndex uint32 + DestinationPrefix IpAddressPrefix + NextHop RawSockaddrInet + SitePrefixLength uint8 + ValidLifetime uint32 + PreferredLifetime uint32 + Metric uint32 + Protocol uint32 + Loopback uint8 + AutoconfigureAddress uint8 + Publish uint8 + Immortal uint8 + Age uint32 + Origin uint32 +} + +// MIB_IPFORWARD_TABLE2 contains a table of IP route entries. See +// https://learn.microsoft.com/en-us/windows/win32/api/netioapi/ns-netioapi-mib_ipforward_table2. +type MibIpForwardTable2 struct { + NumEntries uint32 + Table [1]MibIpForwardRow2 +} + +// Rows returns the IP route entries in the table. +func (t *MibIpForwardTable2) Rows() []MibIpForwardRow2 { + return unsafe.Slice(&t.Table[0], t.NumEntries) +} + +// MIB_UNICASTIPADDRESS_ROW stores information about a unicast IP address. See +// https://learn.microsoft.com/en-us/windows/win32/api/netioapi/ns-netioapi-mib_unicastipaddress_row. +type MibUnicastIpAddressRow struct { + Address RawSockaddrInet6 // SOCKADDR_INET union + InterfaceLuid uint64 + InterfaceIndex uint32 + PrefixOrigin uint32 + SuffixOrigin uint32 + ValidLifetime uint32 + PreferredLifetime uint32 + OnLinkPrefixLength uint8 + SkipAsSource uint8 + DadState uint32 + ScopeId uint32 + CreationTimeStamp Filetime +} + +const ScopeLevelCount = 16 + +// MIB_IPINTERFACE_ROW stores interface management information for a particular IP address family on a network interface. +// See https://learn.microsoft.com/en-us/windows/win32/api/netioapi/ns-netioapi-mib_ipinterface_row. +type MibIpInterfaceRow struct { + Family uint16 + InterfaceLuid uint64 + InterfaceIndex uint32 + MaxReassemblySize uint32 + InterfaceIdentifier uint64 + MinRouterAdvertisementInterval uint32 + MaxRouterAdvertisementInterval uint32 + AdvertisingEnabled uint8 + ForwardingEnabled uint8 + WeakHostSend uint8 + WeakHostReceive uint8 + UseAutomaticMetric uint8 + UseNeighborUnreachabilityDetection uint8 + ManagedAddressConfigurationSupported uint8 + OtherStatefulConfigurationSupported uint8 + AdvertiseDefaultRoute uint8 + RouterDiscoveryBehavior uint32 + DadTransmits uint32 + BaseReachableTime uint32 + RetransmitTime uint32 + PathMtuDiscoveryTimeout uint32 + LinkLocalAddressBehavior uint32 + LinkLocalAddressTimeout uint32 + ZoneIndices [ScopeLevelCount]uint32 + SitePrefixLength uint32 + Metric uint32 + NlMtu uint32 + Connected uint8 + SupportsWakeUpPatterns uint8 + SupportsNeighborDiscovery uint8 + SupportsRouterDiscovery uint8 + ReachableTime uint32 + TransmitOffload uint32 + ReceiveOffload uint32 + DisableDefaultRoutes uint8 +} + +// Console related constants used for the mode parameter to SetConsoleMode. See +// https://docs.microsoft.com/en-us/windows/console/setconsolemode for details. + +const ( + ENABLE_PROCESSED_INPUT = 0x1 + ENABLE_LINE_INPUT = 0x2 + ENABLE_ECHO_INPUT = 0x4 + ENABLE_WINDOW_INPUT = 0x8 + ENABLE_MOUSE_INPUT = 0x10 + ENABLE_INSERT_MODE = 0x20 + ENABLE_QUICK_EDIT_MODE = 0x40 + ENABLE_EXTENDED_FLAGS = 0x80 + ENABLE_AUTO_POSITION = 0x100 + ENABLE_VIRTUAL_TERMINAL_INPUT = 0x200 + + ENABLE_PROCESSED_OUTPUT = 0x1 + ENABLE_WRAP_AT_EOL_OUTPUT = 0x2 + ENABLE_VIRTUAL_TERMINAL_PROCESSING = 0x4 + DISABLE_NEWLINE_AUTO_RETURN = 0x8 + ENABLE_LVB_GRID_WORLDWIDE = 0x10 +) + +// Pseudo console related constants used for the flags parameter to +// CreatePseudoConsole. See: https://learn.microsoft.com/en-us/windows/console/createpseudoconsole +const ( + PSEUDOCONSOLE_INHERIT_CURSOR = 0x1 +) + +type Coord struct { + X int16 + Y int16 +} + +type SmallRect struct { + Left int16 + Top int16 + Right int16 + Bottom int16 +} + +// Used with GetConsoleScreenBuffer to retrieve information about a console +// screen buffer. See +// https://docs.microsoft.com/en-us/windows/console/console-screen-buffer-info-str +// for details. + +type ConsoleScreenBufferInfo struct { + Size Coord + CursorPosition Coord + Attributes uint16 + Window SmallRect + MaximumWindowSize Coord +} + +const UNIX_PATH_MAX = 108 // defined in afunix.h + +const ( + // flags for JOBOBJECT_BASIC_LIMIT_INFORMATION.LimitFlags + JOB_OBJECT_LIMIT_ACTIVE_PROCESS = 0x00000008 + JOB_OBJECT_LIMIT_AFFINITY = 0x00000010 + JOB_OBJECT_LIMIT_BREAKAWAY_OK = 0x00000800 + JOB_OBJECT_LIMIT_DIE_ON_UNHANDLED_EXCEPTION = 0x00000400 + JOB_OBJECT_LIMIT_JOB_MEMORY = 0x00000200 + JOB_OBJECT_LIMIT_JOB_TIME = 0x00000004 + JOB_OBJECT_LIMIT_KILL_ON_JOB_CLOSE = 0x00002000 + JOB_OBJECT_LIMIT_PRESERVE_JOB_TIME = 0x00000040 + JOB_OBJECT_LIMIT_PRIORITY_CLASS = 0x00000020 + JOB_OBJECT_LIMIT_PROCESS_MEMORY = 0x00000100 + JOB_OBJECT_LIMIT_PROCESS_TIME = 0x00000002 + JOB_OBJECT_LIMIT_SCHEDULING_CLASS = 0x00000080 + JOB_OBJECT_LIMIT_SILENT_BREAKAWAY_OK = 0x00001000 + JOB_OBJECT_LIMIT_SUBSET_AFFINITY = 0x00004000 + JOB_OBJECT_LIMIT_WORKINGSET = 0x00000001 +) + +type IO_COUNTERS struct { + ReadOperationCount uint64 + WriteOperationCount uint64 + OtherOperationCount uint64 + ReadTransferCount uint64 + WriteTransferCount uint64 + OtherTransferCount uint64 +} + +type JOBOBJECT_EXTENDED_LIMIT_INFORMATION struct { + BasicLimitInformation JOBOBJECT_BASIC_LIMIT_INFORMATION + IoInfo IO_COUNTERS + ProcessMemoryLimit uintptr + JobMemoryLimit uintptr + PeakProcessMemoryUsed uintptr + PeakJobMemoryUsed uintptr +} + +const ( + // UIRestrictionsClass + JOB_OBJECT_UILIMIT_DESKTOP = 0x00000040 + JOB_OBJECT_UILIMIT_DISPLAYSETTINGS = 0x00000010 + JOB_OBJECT_UILIMIT_EXITWINDOWS = 0x00000080 + JOB_OBJECT_UILIMIT_GLOBALATOMS = 0x00000020 + JOB_OBJECT_UILIMIT_HANDLES = 0x00000001 + JOB_OBJECT_UILIMIT_READCLIPBOARD = 0x00000002 + JOB_OBJECT_UILIMIT_SYSTEMPARAMETERS = 0x00000008 + JOB_OBJECT_UILIMIT_WRITECLIPBOARD = 0x00000004 +) + +type JOBOBJECT_BASIC_UI_RESTRICTIONS struct { + UIRestrictionsClass uint32 +} + +const ( + // JobObjectInformationClass for QueryInformationJobObject and SetInformationJobObject + JobObjectAssociateCompletionPortInformation = 7 + JobObjectBasicAccountingInformation = 1 + JobObjectBasicAndIoAccountingInformation = 8 + JobObjectBasicLimitInformation = 2 + JobObjectBasicProcessIdList = 3 + JobObjectBasicUIRestrictions = 4 + JobObjectCpuRateControlInformation = 15 + JobObjectEndOfJobTimeInformation = 6 + JobObjectExtendedLimitInformation = 9 + JobObjectGroupInformation = 11 + JobObjectGroupInformationEx = 14 + JobObjectLimitViolationInformation = 13 + JobObjectLimitViolationInformation2 = 34 + JobObjectNetRateControlInformation = 32 + JobObjectNotificationLimitInformation = 12 + JobObjectNotificationLimitInformation2 = 33 + JobObjectSecurityLimitInformation = 5 +) + +const ( + KF_FLAG_DEFAULT = 0x00000000 + KF_FLAG_FORCE_APP_DATA_REDIRECTION = 0x00080000 + KF_FLAG_RETURN_FILTER_REDIRECTION_TARGET = 0x00040000 + KF_FLAG_FORCE_PACKAGE_REDIRECTION = 0x00020000 + KF_FLAG_NO_PACKAGE_REDIRECTION = 0x00010000 + KF_FLAG_FORCE_APPCONTAINER_REDIRECTION = 0x00020000 + KF_FLAG_NO_APPCONTAINER_REDIRECTION = 0x00010000 + KF_FLAG_CREATE = 0x00008000 + KF_FLAG_DONT_VERIFY = 0x00004000 + KF_FLAG_DONT_UNEXPAND = 0x00002000 + KF_FLAG_NO_ALIAS = 0x00001000 + KF_FLAG_INIT = 0x00000800 + KF_FLAG_DEFAULT_PATH = 0x00000400 + KF_FLAG_NOT_PARENT_RELATIVE = 0x00000200 + KF_FLAG_SIMPLE_IDLIST = 0x00000100 + KF_FLAG_ALIAS_ONLY = 0x80000000 +) + +type OsVersionInfoEx struct { + osVersionInfoSize uint32 + MajorVersion uint32 + MinorVersion uint32 + BuildNumber uint32 + PlatformId uint32 + CsdVersion [128]uint16 + ServicePackMajor uint16 + ServicePackMinor uint16 + SuiteMask uint16 + ProductType byte + _ byte +} + +const ( + EWX_LOGOFF = 0x00000000 + EWX_SHUTDOWN = 0x00000001 + EWX_REBOOT = 0x00000002 + EWX_FORCE = 0x00000004 + EWX_POWEROFF = 0x00000008 + EWX_FORCEIFHUNG = 0x00000010 + EWX_QUICKRESOLVE = 0x00000020 + EWX_RESTARTAPPS = 0x00000040 + EWX_HYBRID_SHUTDOWN = 0x00400000 + EWX_BOOTOPTIONS = 0x01000000 + + SHTDN_REASON_FLAG_COMMENT_REQUIRED = 0x01000000 + SHTDN_REASON_FLAG_DIRTY_PROBLEM_ID_REQUIRED = 0x02000000 + SHTDN_REASON_FLAG_CLEAN_UI = 0x04000000 + SHTDN_REASON_FLAG_DIRTY_UI = 0x08000000 + SHTDN_REASON_FLAG_USER_DEFINED = 0x40000000 + SHTDN_REASON_FLAG_PLANNED = 0x80000000 + SHTDN_REASON_MAJOR_OTHER = 0x00000000 + SHTDN_REASON_MAJOR_NONE = 0x00000000 + SHTDN_REASON_MAJOR_HARDWARE = 0x00010000 + SHTDN_REASON_MAJOR_OPERATINGSYSTEM = 0x00020000 + SHTDN_REASON_MAJOR_SOFTWARE = 0x00030000 + SHTDN_REASON_MAJOR_APPLICATION = 0x00040000 + SHTDN_REASON_MAJOR_SYSTEM = 0x00050000 + SHTDN_REASON_MAJOR_POWER = 0x00060000 + SHTDN_REASON_MAJOR_LEGACY_API = 0x00070000 + SHTDN_REASON_MINOR_OTHER = 0x00000000 + SHTDN_REASON_MINOR_NONE = 0x000000ff + SHTDN_REASON_MINOR_MAINTENANCE = 0x00000001 + SHTDN_REASON_MINOR_INSTALLATION = 0x00000002 + SHTDN_REASON_MINOR_UPGRADE = 0x00000003 + SHTDN_REASON_MINOR_RECONFIG = 0x00000004 + SHTDN_REASON_MINOR_HUNG = 0x00000005 + SHTDN_REASON_MINOR_UNSTABLE = 0x00000006 + SHTDN_REASON_MINOR_DISK = 0x00000007 + SHTDN_REASON_MINOR_PROCESSOR = 0x00000008 + SHTDN_REASON_MINOR_NETWORKCARD = 0x00000009 + SHTDN_REASON_MINOR_POWER_SUPPLY = 0x0000000a + SHTDN_REASON_MINOR_CORDUNPLUGGED = 0x0000000b + SHTDN_REASON_MINOR_ENVIRONMENT = 0x0000000c + SHTDN_REASON_MINOR_HARDWARE_DRIVER = 0x0000000d + SHTDN_REASON_MINOR_OTHERDRIVER = 0x0000000e + SHTDN_REASON_MINOR_BLUESCREEN = 0x0000000F + SHTDN_REASON_MINOR_SERVICEPACK = 0x00000010 + SHTDN_REASON_MINOR_HOTFIX = 0x00000011 + SHTDN_REASON_MINOR_SECURITYFIX = 0x00000012 + SHTDN_REASON_MINOR_SECURITY = 0x00000013 + SHTDN_REASON_MINOR_NETWORK_CONNECTIVITY = 0x00000014 + SHTDN_REASON_MINOR_WMI = 0x00000015 + SHTDN_REASON_MINOR_SERVICEPACK_UNINSTALL = 0x00000016 + SHTDN_REASON_MINOR_HOTFIX_UNINSTALL = 0x00000017 + SHTDN_REASON_MINOR_SECURITYFIX_UNINSTALL = 0x00000018 + SHTDN_REASON_MINOR_MMC = 0x00000019 + SHTDN_REASON_MINOR_SYSTEMRESTORE = 0x0000001a + SHTDN_REASON_MINOR_TERMSRV = 0x00000020 + SHTDN_REASON_MINOR_DC_PROMOTION = 0x00000021 + SHTDN_REASON_MINOR_DC_DEMOTION = 0x00000022 + SHTDN_REASON_UNKNOWN = SHTDN_REASON_MINOR_NONE + SHTDN_REASON_LEGACY_API = SHTDN_REASON_MAJOR_LEGACY_API | SHTDN_REASON_FLAG_PLANNED + SHTDN_REASON_VALID_BIT_MASK = 0xc0ffffff + + SHUTDOWN_NORETRY = 0x1 +) + +// Flags used for GetModuleHandleEx +const ( + GET_MODULE_HANDLE_EX_FLAG_PIN = 1 + GET_MODULE_HANDLE_EX_FLAG_UNCHANGED_REFCOUNT = 2 + GET_MODULE_HANDLE_EX_FLAG_FROM_ADDRESS = 4 +) + +// MUI function flag values +const ( + MUI_LANGUAGE_ID = 0x4 + MUI_LANGUAGE_NAME = 0x8 + MUI_MERGE_SYSTEM_FALLBACK = 0x10 + MUI_MERGE_USER_FALLBACK = 0x20 + MUI_UI_FALLBACK = MUI_MERGE_SYSTEM_FALLBACK | MUI_MERGE_USER_FALLBACK + MUI_THREAD_LANGUAGES = 0x40 + MUI_CONSOLE_FILTER = 0x100 + MUI_COMPLEX_SCRIPT_FILTER = 0x200 + MUI_RESET_FILTERS = 0x001 + MUI_USER_PREFERRED_UI_LANGUAGES = 0x10 + MUI_USE_INSTALLED_LANGUAGES = 0x20 + MUI_USE_SEARCH_ALL_LANGUAGES = 0x40 + MUI_LANG_NEUTRAL_PE_FILE = 0x100 + MUI_NON_LANG_NEUTRAL_FILE = 0x200 + MUI_MACHINE_LANGUAGE_SETTINGS = 0x400 + MUI_FILETYPE_NOT_LANGUAGE_NEUTRAL = 0x001 + MUI_FILETYPE_LANGUAGE_NEUTRAL_MAIN = 0x002 + MUI_FILETYPE_LANGUAGE_NEUTRAL_MUI = 0x004 + MUI_QUERY_TYPE = 0x001 + MUI_QUERY_CHECKSUM = 0x002 + MUI_QUERY_LANGUAGE_NAME = 0x004 + MUI_QUERY_RESOURCE_TYPES = 0x008 + MUI_FILEINFO_VERSION = 0x001 + + MUI_FULL_LANGUAGE = 0x01 + MUI_PARTIAL_LANGUAGE = 0x02 + MUI_LIP_LANGUAGE = 0x04 + MUI_LANGUAGE_INSTALLED = 0x20 + MUI_LANGUAGE_LICENSED = 0x40 +) + +// FILE_INFO_BY_HANDLE_CLASS constants for SetFileInformationByHandle/GetFileInformationByHandleEx +const ( + FileBasicInfo = 0 + FileStandardInfo = 1 + FileNameInfo = 2 + FileRenameInfo = 3 + FileDispositionInfo = 4 + FileAllocationInfo = 5 + FileEndOfFileInfo = 6 + FileStreamInfo = 7 + FileCompressionInfo = 8 + FileAttributeTagInfo = 9 + FileIdBothDirectoryInfo = 10 + FileIdBothDirectoryRestartInfo = 11 + FileIoPriorityHintInfo = 12 + FileRemoteProtocolInfo = 13 + FileFullDirectoryInfo = 14 + FileFullDirectoryRestartInfo = 15 + FileStorageInfo = 16 + FileAlignmentInfo = 17 + FileIdInfo = 18 + FileIdExtdDirectoryInfo = 19 + FileIdExtdDirectoryRestartInfo = 20 + FileDispositionInfoEx = 21 + FileRenameInfoEx = 22 + FileCaseSensitiveInfo = 23 + FileNormalizedNameInfo = 24 +) + +// LoadLibrary flags for determining from where to search for a DLL +const ( + DONT_RESOLVE_DLL_REFERENCES = 0x1 + LOAD_LIBRARY_AS_DATAFILE = 0x2 + LOAD_WITH_ALTERED_SEARCH_PATH = 0x8 + LOAD_IGNORE_CODE_AUTHZ_LEVEL = 0x10 + LOAD_LIBRARY_AS_IMAGE_RESOURCE = 0x20 + LOAD_LIBRARY_AS_DATAFILE_EXCLUSIVE = 0x40 + LOAD_LIBRARY_REQUIRE_SIGNED_TARGET = 0x80 + LOAD_LIBRARY_SEARCH_DLL_LOAD_DIR = 0x100 + LOAD_LIBRARY_SEARCH_APPLICATION_DIR = 0x200 + LOAD_LIBRARY_SEARCH_USER_DIRS = 0x400 + LOAD_LIBRARY_SEARCH_SYSTEM32 = 0x800 + LOAD_LIBRARY_SEARCH_DEFAULT_DIRS = 0x1000 + LOAD_LIBRARY_SAFE_CURRENT_DIRS = 0x00002000 + LOAD_LIBRARY_SEARCH_SYSTEM32_NO_FORWARDER = 0x00004000 + LOAD_LIBRARY_OS_INTEGRITY_CONTINUITY = 0x00008000 +) + +// RegNotifyChangeKeyValue notifyFilter flags. +const ( + // REG_NOTIFY_CHANGE_NAME notifies the caller if a subkey is added or deleted. + REG_NOTIFY_CHANGE_NAME = 0x00000001 + + // REG_NOTIFY_CHANGE_ATTRIBUTES notifies the caller of changes to the attributes of the key, such as the security descriptor information. + REG_NOTIFY_CHANGE_ATTRIBUTES = 0x00000002 + + // REG_NOTIFY_CHANGE_LAST_SET notifies the caller of changes to a value of the key. This can include adding or deleting a value, or changing an existing value. + REG_NOTIFY_CHANGE_LAST_SET = 0x00000004 + + // REG_NOTIFY_CHANGE_SECURITY notifies the caller of changes to the security descriptor of the key. + REG_NOTIFY_CHANGE_SECURITY = 0x00000008 + + // REG_NOTIFY_THREAD_AGNOSTIC indicates that the lifetime of the registration must not be tied to the lifetime of the thread issuing the RegNotifyChangeKeyValue call. Note: This flag value is only supported in Windows 8 and later. + REG_NOTIFY_THREAD_AGNOSTIC = 0x10000000 +) + +type CommTimeouts struct { + ReadIntervalTimeout uint32 + ReadTotalTimeoutMultiplier uint32 + ReadTotalTimeoutConstant uint32 + WriteTotalTimeoutMultiplier uint32 + WriteTotalTimeoutConstant uint32 +} + +// NTUnicodeString is a UTF-16 string for NT native APIs, corresponding to UNICODE_STRING. +type NTUnicodeString struct { + // Note: Length and MaximumLength are in *bytes*, not uint16s. + // They should always be even. + Length uint16 + MaximumLength uint16 + Buffer *uint16 +} + +// NTString is an ANSI string for NT native APIs, corresponding to STRING. +type NTString struct { + Length uint16 + MaximumLength uint16 + Buffer *byte +} + +type LIST_ENTRY struct { + Flink *LIST_ENTRY + Blink *LIST_ENTRY +} + +type RUNTIME_FUNCTION struct { + BeginAddress uint32 + EndAddress uint32 + UnwindData uint32 +} + +type LDR_DATA_TABLE_ENTRY struct { + reserved1 [2]uintptr + InMemoryOrderLinks LIST_ENTRY + reserved2 [2]uintptr + DllBase uintptr + reserved3 [2]uintptr + FullDllName NTUnicodeString + reserved4 [8]byte + reserved5 [3]uintptr + reserved6 uintptr + TimeDateStamp uint32 +} + +type PEB_LDR_DATA struct { + reserved1 [8]byte + reserved2 [3]uintptr + InMemoryOrderModuleList LIST_ENTRY +} + +type CURDIR struct { + DosPath NTUnicodeString + Handle Handle +} + +type RTL_DRIVE_LETTER_CURDIR struct { + Flags uint16 + Length uint16 + TimeStamp uint32 + DosPath NTString +} + +type RTL_USER_PROCESS_PARAMETERS struct { + MaximumLength, Length uint32 + + Flags, DebugFlags uint32 + + ConsoleHandle Handle + ConsoleFlags uint32 + StandardInput, StandardOutput, StandardError Handle + + CurrentDirectory CURDIR + DllPath NTUnicodeString + ImagePathName NTUnicodeString + CommandLine NTUnicodeString + Environment unsafe.Pointer + + StartingX, StartingY, CountX, CountY, CountCharsX, CountCharsY, FillAttribute uint32 + + WindowFlags, ShowWindowFlags uint32 + WindowTitle, DesktopInfo, ShellInfo, RuntimeData NTUnicodeString + CurrentDirectories [32]RTL_DRIVE_LETTER_CURDIR + + EnvironmentSize, EnvironmentVersion uintptr + + PackageDependencyData unsafe.Pointer + ProcessGroupId uint32 + LoaderThreads uint32 + + RedirectionDllName NTUnicodeString + HeapPartitionName NTUnicodeString + DefaultThreadpoolCpuSetMasks uintptr + DefaultThreadpoolCpuSetMaskCount uint32 +} + +type PEB struct { + reserved1 [2]byte + BeingDebugged byte + BitField byte + reserved3 uintptr + ImageBaseAddress uintptr + Ldr *PEB_LDR_DATA + ProcessParameters *RTL_USER_PROCESS_PARAMETERS + reserved4 [3]uintptr + AtlThunkSListPtr uintptr + reserved5 uintptr + reserved6 uint32 + reserved7 uintptr + reserved8 uint32 + AtlThunkSListPtr32 uint32 + reserved9 [45]uintptr + reserved10 [96]byte + PostProcessInitRoutine uintptr + reserved11 [128]byte + reserved12 [1]uintptr + SessionId uint32 +} + +type OBJECT_ATTRIBUTES struct { + Length uint32 + RootDirectory Handle + ObjectName *NTUnicodeString + Attributes uint32 + SecurityDescriptor *SECURITY_DESCRIPTOR + SecurityQoS *SECURITY_QUALITY_OF_SERVICE +} + +// Values for the Attributes member of OBJECT_ATTRIBUTES. +const ( + OBJ_INHERIT = 0x00000002 + OBJ_PERMANENT = 0x00000010 + OBJ_EXCLUSIVE = 0x00000020 + OBJ_CASE_INSENSITIVE = 0x00000040 + OBJ_OPENIF = 0x00000080 + OBJ_OPENLINK = 0x00000100 + OBJ_KERNEL_HANDLE = 0x00000200 + OBJ_FORCE_ACCESS_CHECK = 0x00000400 + OBJ_IGNORE_IMPERSONATED_DEVICEMAP = 0x00000800 + OBJ_DONT_REPARSE = 0x00001000 + OBJ_VALID_ATTRIBUTES = 0x00001FF2 +) + +type IO_STATUS_BLOCK struct { + Status NTStatus + Information uintptr +} + +type RTLP_CURDIR_REF struct { + RefCount int32 + Handle Handle +} + +type RTL_RELATIVE_NAME struct { + RelativeName NTUnicodeString + ContainingDirectory Handle + CurDirRef *RTLP_CURDIR_REF +} + +const ( + // CreateDisposition flags for NtCreateFile and NtCreateNamedPipeFile. + FILE_SUPERSEDE = 0x00000000 + FILE_OPEN = 0x00000001 + FILE_CREATE = 0x00000002 + FILE_OPEN_IF = 0x00000003 + FILE_OVERWRITE = 0x00000004 + FILE_OVERWRITE_IF = 0x00000005 + FILE_MAXIMUM_DISPOSITION = 0x00000005 + + // CreateOptions flags for NtCreateFile and NtCreateNamedPipeFile. + FILE_DIRECTORY_FILE = 0x00000001 + FILE_WRITE_THROUGH = 0x00000002 + FILE_SEQUENTIAL_ONLY = 0x00000004 + FILE_NO_INTERMEDIATE_BUFFERING = 0x00000008 + FILE_SYNCHRONOUS_IO_ALERT = 0x00000010 + FILE_SYNCHRONOUS_IO_NONALERT = 0x00000020 + FILE_NON_DIRECTORY_FILE = 0x00000040 + FILE_CREATE_TREE_CONNECTION = 0x00000080 + FILE_COMPLETE_IF_OPLOCKED = 0x00000100 + FILE_NO_EA_KNOWLEDGE = 0x00000200 + FILE_OPEN_REMOTE_INSTANCE = 0x00000400 + FILE_RANDOM_ACCESS = 0x00000800 + FILE_DELETE_ON_CLOSE = 0x00001000 + FILE_OPEN_BY_FILE_ID = 0x00002000 + FILE_OPEN_FOR_BACKUP_INTENT = 0x00004000 + FILE_NO_COMPRESSION = 0x00008000 + FILE_OPEN_REQUIRING_OPLOCK = 0x00010000 + FILE_DISALLOW_EXCLUSIVE = 0x00020000 + FILE_RESERVE_OPFILTER = 0x00100000 + FILE_OPEN_REPARSE_POINT = 0x00200000 + FILE_OPEN_NO_RECALL = 0x00400000 + FILE_OPEN_FOR_FREE_SPACE_QUERY = 0x00800000 + + // Parameter constants for NtCreateNamedPipeFile. + + FILE_PIPE_BYTE_STREAM_TYPE = 0x00000000 + FILE_PIPE_MESSAGE_TYPE = 0x00000001 + + FILE_PIPE_ACCEPT_REMOTE_CLIENTS = 0x00000000 + FILE_PIPE_REJECT_REMOTE_CLIENTS = 0x00000002 + + FILE_PIPE_TYPE_VALID_MASK = 0x00000003 + + FILE_PIPE_BYTE_STREAM_MODE = 0x00000000 + FILE_PIPE_MESSAGE_MODE = 0x00000001 + + FILE_PIPE_QUEUE_OPERATION = 0x00000000 + FILE_PIPE_COMPLETE_OPERATION = 0x00000001 + + FILE_PIPE_INBOUND = 0x00000000 + FILE_PIPE_OUTBOUND = 0x00000001 + FILE_PIPE_FULL_DUPLEX = 0x00000002 + + FILE_PIPE_DISCONNECTED_STATE = 0x00000001 + FILE_PIPE_LISTENING_STATE = 0x00000002 + FILE_PIPE_CONNECTED_STATE = 0x00000003 + FILE_PIPE_CLOSING_STATE = 0x00000004 + + FILE_PIPE_CLIENT_END = 0x00000000 + FILE_PIPE_SERVER_END = 0x00000001 +) + +const ( + // FileInformationClass for NtSetInformationFile + FileBasicInformation = 4 + FileRenameInformation = 10 + FileDispositionInformation = 13 + FilePositionInformation = 14 + FileEndOfFileInformation = 20 + FileValidDataLengthInformation = 39 + FileShortNameInformation = 40 + FileIoPriorityHintInformation = 43 + FileReplaceCompletionInformation = 61 + FileDispositionInformationEx = 64 + FileCaseSensitiveInformation = 71 + FileLinkInformation = 72 + FileCaseSensitiveInformationForceAccessCheck = 75 + FileKnownFolderInformation = 76 + + // Flags for FILE_RENAME_INFORMATION + FILE_RENAME_REPLACE_IF_EXISTS = 0x00000001 + FILE_RENAME_POSIX_SEMANTICS = 0x00000002 + FILE_RENAME_SUPPRESS_PIN_STATE_INHERITANCE = 0x00000004 + FILE_RENAME_SUPPRESS_STORAGE_RESERVE_INHERITANCE = 0x00000008 + FILE_RENAME_NO_INCREASE_AVAILABLE_SPACE = 0x00000010 + FILE_RENAME_NO_DECREASE_AVAILABLE_SPACE = 0x00000020 + FILE_RENAME_PRESERVE_AVAILABLE_SPACE = 0x00000030 + FILE_RENAME_IGNORE_READONLY_ATTRIBUTE = 0x00000040 + FILE_RENAME_FORCE_RESIZE_TARGET_SR = 0x00000080 + FILE_RENAME_FORCE_RESIZE_SOURCE_SR = 0x00000100 + FILE_RENAME_FORCE_RESIZE_SR = 0x00000180 + + // Flags for FILE_DISPOSITION_INFORMATION_EX + FILE_DISPOSITION_DO_NOT_DELETE = 0x00000000 + FILE_DISPOSITION_DELETE = 0x00000001 + FILE_DISPOSITION_POSIX_SEMANTICS = 0x00000002 + FILE_DISPOSITION_FORCE_IMAGE_SECTION_CHECK = 0x00000004 + FILE_DISPOSITION_ON_CLOSE = 0x00000008 + FILE_DISPOSITION_IGNORE_READONLY_ATTRIBUTE = 0x00000010 + + // Flags for FILE_CASE_SENSITIVE_INFORMATION + FILE_CS_FLAG_CASE_SENSITIVE_DIR = 0x00000001 + + // Flags for FILE_LINK_INFORMATION + FILE_LINK_REPLACE_IF_EXISTS = 0x00000001 + FILE_LINK_POSIX_SEMANTICS = 0x00000002 + FILE_LINK_SUPPRESS_STORAGE_RESERVE_INHERITANCE = 0x00000008 + FILE_LINK_NO_INCREASE_AVAILABLE_SPACE = 0x00000010 + FILE_LINK_NO_DECREASE_AVAILABLE_SPACE = 0x00000020 + FILE_LINK_PRESERVE_AVAILABLE_SPACE = 0x00000030 + FILE_LINK_IGNORE_READONLY_ATTRIBUTE = 0x00000040 + FILE_LINK_FORCE_RESIZE_TARGET_SR = 0x00000080 + FILE_LINK_FORCE_RESIZE_SOURCE_SR = 0x00000100 + FILE_LINK_FORCE_RESIZE_SR = 0x00000180 +) + +// ProcessInformationClasses for NtQueryInformationProcess and NtSetInformationProcess. +const ( + ProcessBasicInformation = iota + ProcessQuotaLimits + ProcessIoCounters + ProcessVmCounters + ProcessTimes + ProcessBasePriority + ProcessRaisePriority + ProcessDebugPort + ProcessExceptionPort + ProcessAccessToken + ProcessLdtInformation + ProcessLdtSize + ProcessDefaultHardErrorMode + ProcessIoPortHandlers + ProcessPooledUsageAndLimits + ProcessWorkingSetWatch + ProcessUserModeIOPL + ProcessEnableAlignmentFaultFixup + ProcessPriorityClass + ProcessWx86Information + ProcessHandleCount + ProcessAffinityMask + ProcessPriorityBoost + ProcessDeviceMap + ProcessSessionInformation + ProcessForegroundInformation + ProcessWow64Information + ProcessImageFileName + ProcessLUIDDeviceMapsEnabled + ProcessBreakOnTermination + ProcessDebugObjectHandle + ProcessDebugFlags + ProcessHandleTracing + ProcessIoPriority + ProcessExecuteFlags + ProcessTlsInformation + ProcessCookie + ProcessImageInformation + ProcessCycleTime + ProcessPagePriority + ProcessInstrumentationCallback + ProcessThreadStackAllocation + ProcessWorkingSetWatchEx + ProcessImageFileNameWin32 + ProcessImageFileMapping + ProcessAffinityUpdateMode + ProcessMemoryAllocationMode + ProcessGroupInformation + ProcessTokenVirtualizationEnabled + ProcessConsoleHostProcess + ProcessWindowInformation + ProcessHandleInformation + ProcessMitigationPolicy + ProcessDynamicFunctionTableInformation + ProcessHandleCheckingMode + ProcessKeepAliveCount + ProcessRevokeFileHandles + ProcessWorkingSetControl + ProcessHandleTable + ProcessCheckStackExtentsMode + ProcessCommandLineInformation + ProcessProtectionInformation + ProcessMemoryExhaustion + ProcessFaultInformation + ProcessTelemetryIdInformation + ProcessCommitReleaseInformation + ProcessDefaultCpuSetsInformation + ProcessAllowedCpuSetsInformation + ProcessSubsystemProcess + ProcessJobMemoryInformation + ProcessInPrivate + ProcessRaiseUMExceptionOnInvalidHandleClose + ProcessIumChallengeResponse + ProcessChildProcessInformation + ProcessHighGraphicsPriorityInformation + ProcessSubsystemInformation + ProcessEnergyValues + ProcessActivityThrottleState + ProcessActivityThrottlePolicy + ProcessWin32kSyscallFilterInformation + ProcessDisableSystemAllowedCpuSets + ProcessWakeInformation + ProcessEnergyTrackingState + ProcessManageWritesToExecutableMemory + ProcessCaptureTrustletLiveDump + ProcessTelemetryCoverage + ProcessEnclaveInformation + ProcessEnableReadWriteVmLogging + ProcessUptimeInformation + ProcessImageSection + ProcessDebugAuthInformation + ProcessSystemResourceManagement + ProcessSequenceNumber + ProcessLoaderDetour + ProcessSecurityDomainInformation + ProcessCombineSecurityDomainsInformation + ProcessEnableLogging + ProcessLeapSecondInformation + ProcessFiberShadowStackAllocation + ProcessFreeFiberShadowStackAllocation + ProcessAltSystemCallInformation + ProcessDynamicEHContinuationTargets + ProcessDynamicEnforcedCetCompatibleRanges +) + +type PROCESS_BASIC_INFORMATION struct { + ExitStatus NTStatus + PebBaseAddress *PEB + AffinityMask uintptr + BasePriority int32 + UniqueProcessId uintptr + InheritedFromUniqueProcessId uintptr +} + +type SYSTEM_PROCESS_INFORMATION struct { + NextEntryOffset uint32 + NumberOfThreads uint32 + WorkingSetPrivateSize int64 + HardFaultCount uint32 + NumberOfThreadsHighWatermark uint32 + CycleTime uint64 + CreateTime int64 + UserTime int64 + KernelTime int64 + ImageName NTUnicodeString + BasePriority int32 + UniqueProcessID uintptr + InheritedFromUniqueProcessID uintptr + HandleCount uint32 + SessionID uint32 + UniqueProcessKey *uint32 + PeakVirtualSize uintptr + VirtualSize uintptr + PageFaultCount uint32 + PeakWorkingSetSize uintptr + WorkingSetSize uintptr + QuotaPeakPagedPoolUsage uintptr + QuotaPagedPoolUsage uintptr + QuotaPeakNonPagedPoolUsage uintptr + QuotaNonPagedPoolUsage uintptr + PagefileUsage uintptr + PeakPagefileUsage uintptr + PrivatePageCount uintptr + ReadOperationCount int64 + WriteOperationCount int64 + OtherOperationCount int64 + ReadTransferCount int64 + WriteTransferCount int64 + OtherTransferCount int64 +} + +// SystemInformationClasses for NtQuerySystemInformation and NtSetSystemInformation +const ( + SystemBasicInformation = iota + SystemProcessorInformation + SystemPerformanceInformation + SystemTimeOfDayInformation + SystemPathInformation + SystemProcessInformation + SystemCallCountInformation + SystemDeviceInformation + SystemProcessorPerformanceInformation + SystemFlagsInformation + SystemCallTimeInformation + SystemModuleInformation + SystemLocksInformation + SystemStackTraceInformation + SystemPagedPoolInformation + SystemNonPagedPoolInformation + SystemHandleInformation + SystemObjectInformation + SystemPageFileInformation + SystemVdmInstemulInformation + SystemVdmBopInformation + SystemFileCacheInformation + SystemPoolTagInformation + SystemInterruptInformation + SystemDpcBehaviorInformation + SystemFullMemoryInformation + SystemLoadGdiDriverInformation + SystemUnloadGdiDriverInformation + SystemTimeAdjustmentInformation + SystemSummaryMemoryInformation + SystemMirrorMemoryInformation + SystemPerformanceTraceInformation + systemObsolete0 + SystemExceptionInformation + SystemCrashDumpStateInformation + SystemKernelDebuggerInformation + SystemContextSwitchInformation + SystemRegistryQuotaInformation + SystemExtendServiceTableInformation + SystemPrioritySeperation + SystemVerifierAddDriverInformation + SystemVerifierRemoveDriverInformation + SystemProcessorIdleInformation + SystemLegacyDriverInformation + SystemCurrentTimeZoneInformation + SystemLookasideInformation + SystemTimeSlipNotification + SystemSessionCreate + SystemSessionDetach + SystemSessionInformation + SystemRangeStartInformation + SystemVerifierInformation + SystemVerifierThunkExtend + SystemSessionProcessInformation + SystemLoadGdiDriverInSystemSpace + SystemNumaProcessorMap + SystemPrefetcherInformation + SystemExtendedProcessInformation + SystemRecommendedSharedDataAlignment + SystemComPlusPackage + SystemNumaAvailableMemory + SystemProcessorPowerInformation + SystemEmulationBasicInformation + SystemEmulationProcessorInformation + SystemExtendedHandleInformation + SystemLostDelayedWriteInformation + SystemBigPoolInformation + SystemSessionPoolTagInformation + SystemSessionMappedViewInformation + SystemHotpatchInformation + SystemObjectSecurityMode + SystemWatchdogTimerHandler + SystemWatchdogTimerInformation + SystemLogicalProcessorInformation + SystemWow64SharedInformationObsolete + SystemRegisterFirmwareTableInformationHandler + SystemFirmwareTableInformation + SystemModuleInformationEx + SystemVerifierTriageInformation + SystemSuperfetchInformation + SystemMemoryListInformation + SystemFileCacheInformationEx + SystemThreadPriorityClientIdInformation + SystemProcessorIdleCycleTimeInformation + SystemVerifierCancellationInformation + SystemProcessorPowerInformationEx + SystemRefTraceInformation + SystemSpecialPoolInformation + SystemProcessIdInformation + SystemErrorPortInformation + SystemBootEnvironmentInformation + SystemHypervisorInformation + SystemVerifierInformationEx + SystemTimeZoneInformation + SystemImageFileExecutionOptionsInformation + SystemCoverageInformation + SystemPrefetchPatchInformation + SystemVerifierFaultsInformation + SystemSystemPartitionInformation + SystemSystemDiskInformation + SystemProcessorPerformanceDistribution + SystemNumaProximityNodeInformation + SystemDynamicTimeZoneInformation + SystemCodeIntegrityInformation + SystemProcessorMicrocodeUpdateInformation + SystemProcessorBrandString + SystemVirtualAddressInformation + SystemLogicalProcessorAndGroupInformation + SystemProcessorCycleTimeInformation + SystemStoreInformation + SystemRegistryAppendString + SystemAitSamplingValue + SystemVhdBootInformation + SystemCpuQuotaInformation + SystemNativeBasicInformation + systemSpare1 + SystemLowPriorityIoInformation + SystemTpmBootEntropyInformation + SystemVerifierCountersInformation + SystemPagedPoolInformationEx + SystemSystemPtesInformationEx + SystemNodeDistanceInformation + SystemAcpiAuditInformation + SystemBasicPerformanceInformation + SystemQueryPerformanceCounterInformation + SystemSessionBigPoolInformation + SystemBootGraphicsInformation + SystemScrubPhysicalMemoryInformation + SystemBadPageInformation + SystemProcessorProfileControlArea + SystemCombinePhysicalMemoryInformation + SystemEntropyInterruptTimingCallback + SystemConsoleInformation + SystemPlatformBinaryInformation + SystemThrottleNotificationInformation + SystemHypervisorProcessorCountInformation + SystemDeviceDataInformation + SystemDeviceDataEnumerationInformation + SystemMemoryTopologyInformation + SystemMemoryChannelInformation + SystemBootLogoInformation + SystemProcessorPerformanceInformationEx + systemSpare0 + SystemSecureBootPolicyInformation + SystemPageFileInformationEx + SystemSecureBootInformation + SystemEntropyInterruptTimingRawInformation + SystemPortableWorkspaceEfiLauncherInformation + SystemFullProcessInformation + SystemKernelDebuggerInformationEx + SystemBootMetadataInformation + SystemSoftRebootInformation + SystemElamCertificateInformation + SystemOfflineDumpConfigInformation + SystemProcessorFeaturesInformation + SystemRegistryReconciliationInformation + SystemEdidInformation + SystemManufacturingInformation + SystemEnergyEstimationConfigInformation + SystemHypervisorDetailInformation + SystemProcessorCycleStatsInformation + SystemVmGenerationCountInformation + SystemTrustedPlatformModuleInformation + SystemKernelDebuggerFlags + SystemCodeIntegrityPolicyInformation + SystemIsolatedUserModeInformation + SystemHardwareSecurityTestInterfaceResultsInformation + SystemSingleModuleInformation + SystemAllowedCpuSetsInformation + SystemDmaProtectionInformation + SystemInterruptCpuSetsInformation + SystemSecureBootPolicyFullInformation + SystemCodeIntegrityPolicyFullInformation + SystemAffinitizedInterruptProcessorInformation + SystemRootSiloInformation +) + +type RTL_PROCESS_MODULE_INFORMATION struct { + Section Handle + MappedBase uintptr + ImageBase uintptr + ImageSize uint32 + Flags uint32 + LoadOrderIndex uint16 + InitOrderIndex uint16 + LoadCount uint16 + OffsetToFileName uint16 + FullPathName [256]byte +} + +type RTL_PROCESS_MODULES struct { + NumberOfModules uint32 + Modules [1]RTL_PROCESS_MODULE_INFORMATION +} + +// Constants for LocalAlloc flags. +const ( + LMEM_FIXED = 0x0 + LMEM_MOVEABLE = 0x2 + LMEM_NOCOMPACT = 0x10 + LMEM_NODISCARD = 0x20 + LMEM_ZEROINIT = 0x40 + LMEM_MODIFY = 0x80 + LMEM_DISCARDABLE = 0xf00 + LMEM_VALID_FLAGS = 0xf72 + LMEM_INVALID_HANDLE = 0x8000 + LHND = LMEM_MOVEABLE | LMEM_ZEROINIT + LPTR = LMEM_FIXED | LMEM_ZEROINIT + NONZEROLHND = LMEM_MOVEABLE + NONZEROLPTR = LMEM_FIXED +) + +// Constants for the CreateNamedPipe-family of functions. +const ( + PIPE_ACCESS_INBOUND = 0x1 + PIPE_ACCESS_OUTBOUND = 0x2 + PIPE_ACCESS_DUPLEX = 0x3 + + PIPE_CLIENT_END = 0x0 + PIPE_SERVER_END = 0x1 + + PIPE_WAIT = 0x0 + PIPE_NOWAIT = 0x1 + PIPE_READMODE_BYTE = 0x0 + PIPE_READMODE_MESSAGE = 0x2 + PIPE_TYPE_BYTE = 0x0 + PIPE_TYPE_MESSAGE = 0x4 + PIPE_ACCEPT_REMOTE_CLIENTS = 0x0 + PIPE_REJECT_REMOTE_CLIENTS = 0x8 + + PIPE_UNLIMITED_INSTANCES = 255 +) + +// Constants for security attributes when opening named pipes. +const ( + SECURITY_ANONYMOUS = SecurityAnonymous << 16 + SECURITY_IDENTIFICATION = SecurityIdentification << 16 + SECURITY_IMPERSONATION = SecurityImpersonation << 16 + SECURITY_DELEGATION = SecurityDelegation << 16 + + SECURITY_CONTEXT_TRACKING = 0x40000 + SECURITY_EFFECTIVE_ONLY = 0x80000 + + SECURITY_SQOS_PRESENT = 0x100000 + SECURITY_VALID_SQOS_FLAGS = 0x1f0000 +) + +// ResourceID represents a 16-bit resource identifier, traditionally created with the MAKEINTRESOURCE macro. +type ResourceID uint16 + +// ResourceIDOrString must be either a ResourceID, to specify a resource or resource type by ID, +// or a string, to specify a resource or resource type by name. +type ResourceIDOrString interface{} + +// Predefined resource names and types. +var ( + // Predefined names. + CREATEPROCESS_MANIFEST_RESOURCE_ID ResourceID = 1 + ISOLATIONAWARE_MANIFEST_RESOURCE_ID ResourceID = 2 + ISOLATIONAWARE_NOSTATICIMPORT_MANIFEST_RESOURCE_ID ResourceID = 3 + ISOLATIONPOLICY_MANIFEST_RESOURCE_ID ResourceID = 4 + ISOLATIONPOLICY_BROWSER_MANIFEST_RESOURCE_ID ResourceID = 5 + MINIMUM_RESERVED_MANIFEST_RESOURCE_ID ResourceID = 1 // inclusive + MAXIMUM_RESERVED_MANIFEST_RESOURCE_ID ResourceID = 16 // inclusive + + // Predefined types. + RT_CURSOR ResourceID = 1 + RT_BITMAP ResourceID = 2 + RT_ICON ResourceID = 3 + RT_MENU ResourceID = 4 + RT_DIALOG ResourceID = 5 + RT_STRING ResourceID = 6 + RT_FONTDIR ResourceID = 7 + RT_FONT ResourceID = 8 + RT_ACCELERATOR ResourceID = 9 + RT_RCDATA ResourceID = 10 + RT_MESSAGETABLE ResourceID = 11 + RT_GROUP_CURSOR ResourceID = 12 + RT_GROUP_ICON ResourceID = 14 + RT_VERSION ResourceID = 16 + RT_DLGINCLUDE ResourceID = 17 + RT_PLUGPLAY ResourceID = 19 + RT_VXD ResourceID = 20 + RT_ANICURSOR ResourceID = 21 + RT_ANIICON ResourceID = 22 + RT_HTML ResourceID = 23 + RT_MANIFEST ResourceID = 24 +) + +type VS_FIXEDFILEINFO struct { + Signature uint32 + StrucVersion uint32 + FileVersionMS uint32 + FileVersionLS uint32 + ProductVersionMS uint32 + ProductVersionLS uint32 + FileFlagsMask uint32 + FileFlags uint32 + FileOS uint32 + FileType uint32 + FileSubtype uint32 + FileDateMS uint32 + FileDateLS uint32 +} + +type COAUTHIDENTITY struct { + User *uint16 + UserLength uint32 + Domain *uint16 + DomainLength uint32 + Password *uint16 + PasswordLength uint32 + Flags uint32 +} + +type COAUTHINFO struct { + AuthnSvc uint32 + AuthzSvc uint32 + ServerPrincName *uint16 + AuthnLevel uint32 + ImpersonationLevel uint32 + AuthIdentityData *COAUTHIDENTITY + Capabilities uint32 +} + +type COSERVERINFO struct { + Reserved1 uint32 + Aame *uint16 + AuthInfo *COAUTHINFO + Reserved2 uint32 +} + +type BIND_OPTS3 struct { + CbStruct uint32 + Flags uint32 + Mode uint32 + TickCountDeadline uint32 + TrackFlags uint32 + ClassContext uint32 + Locale uint32 + ServerInfo *COSERVERINFO + Hwnd HWND +} + +const ( + CLSCTX_INPROC_SERVER = 0x1 + CLSCTX_INPROC_HANDLER = 0x2 + CLSCTX_LOCAL_SERVER = 0x4 + CLSCTX_INPROC_SERVER16 = 0x8 + CLSCTX_REMOTE_SERVER = 0x10 + CLSCTX_INPROC_HANDLER16 = 0x20 + CLSCTX_RESERVED1 = 0x40 + CLSCTX_RESERVED2 = 0x80 + CLSCTX_RESERVED3 = 0x100 + CLSCTX_RESERVED4 = 0x200 + CLSCTX_NO_CODE_DOWNLOAD = 0x400 + CLSCTX_RESERVED5 = 0x800 + CLSCTX_NO_CUSTOM_MARSHAL = 0x1000 + CLSCTX_ENABLE_CODE_DOWNLOAD = 0x2000 + CLSCTX_NO_FAILURE_LOG = 0x4000 + CLSCTX_DISABLE_AAA = 0x8000 + CLSCTX_ENABLE_AAA = 0x10000 + CLSCTX_FROM_DEFAULT_CONTEXT = 0x20000 + CLSCTX_ACTIVATE_32_BIT_SERVER = 0x40000 + CLSCTX_ACTIVATE_64_BIT_SERVER = 0x80000 + CLSCTX_ENABLE_CLOAKING = 0x100000 + CLSCTX_APPCONTAINER = 0x400000 + CLSCTX_ACTIVATE_AAA_AS_IU = 0x800000 + CLSCTX_PS_DLL = 0x80000000 + + COINIT_MULTITHREADED = 0x0 + COINIT_APARTMENTTHREADED = 0x2 + COINIT_DISABLE_OLE1DDE = 0x4 + COINIT_SPEED_OVER_MEMORY = 0x8 +) + +// Flag for QueryFullProcessImageName. +const PROCESS_NAME_NATIVE = 1 + +type ModuleInfo struct { + BaseOfDll uintptr + SizeOfImage uint32 + EntryPoint uintptr +} + +const ALL_PROCESSOR_GROUPS = 0xFFFF + +type Rect struct { + Left int32 + Top int32 + Right int32 + Bottom int32 +} + +type GUIThreadInfo struct { + Size uint32 + Flags uint32 + Active HWND + Focus HWND + Capture HWND + MenuOwner HWND + MoveSize HWND + CaretHandle HWND + CaretRect Rect +} + +const ( + DWMWA_NCRENDERING_ENABLED = 1 + DWMWA_NCRENDERING_POLICY = 2 + DWMWA_TRANSITIONS_FORCEDISABLED = 3 + DWMWA_ALLOW_NCPAINT = 4 + DWMWA_CAPTION_BUTTON_BOUNDS = 5 + DWMWA_NONCLIENT_RTL_LAYOUT = 6 + DWMWA_FORCE_ICONIC_REPRESENTATION = 7 + DWMWA_FLIP3D_POLICY = 8 + DWMWA_EXTENDED_FRAME_BOUNDS = 9 + DWMWA_HAS_ICONIC_BITMAP = 10 + DWMWA_DISALLOW_PEEK = 11 + DWMWA_EXCLUDED_FROM_PEEK = 12 + DWMWA_CLOAK = 13 + DWMWA_CLOAKED = 14 + DWMWA_FREEZE_REPRESENTATION = 15 + DWMWA_PASSIVE_UPDATE_MODE = 16 + DWMWA_USE_HOSTBACKDROPBRUSH = 17 + DWMWA_USE_IMMERSIVE_DARK_MODE = 20 + DWMWA_WINDOW_CORNER_PREFERENCE = 33 + DWMWA_BORDER_COLOR = 34 + DWMWA_CAPTION_COLOR = 35 + DWMWA_TEXT_COLOR = 36 + DWMWA_VISIBLE_FRAME_BORDER_THICKNESS = 37 +) + +type WSAQUERYSET struct { + Size uint32 + ServiceInstanceName *uint16 + ServiceClassId *GUID + Version *WSAVersion + Comment *uint16 + NameSpace uint32 + NSProviderId *GUID + Context *uint16 + NumberOfProtocols uint32 + AfpProtocols *AFProtocols + QueryString *uint16 + NumberOfCsAddrs uint32 + SaBuffer *CSAddrInfo + OutputFlags uint32 + Blob *BLOB +} + +type WSAVersion struct { + Version uint32 + EnumerationOfComparison int32 +} + +type AFProtocols struct { + AddressFamily int32 + Protocol int32 +} + +type CSAddrInfo struct { + LocalAddr SocketAddress + RemoteAddr SocketAddress + SocketType int32 + Protocol int32 +} + +type BLOB struct { + Size uint32 + BlobData *byte +} + +type ComStat struct { + Flags uint32 + CBInQue uint32 + CBOutQue uint32 +} + +type DCB struct { + DCBlength uint32 + BaudRate uint32 + Flags uint32 + wReserved uint16 + XonLim uint16 + XoffLim uint16 + ByteSize uint8 + Parity uint8 + StopBits uint8 + XonChar byte + XoffChar byte + ErrorChar byte + EofChar byte + EvtChar byte + wReserved1 uint16 +} + +// Keyboard Layout Flags. +// See https://learn.microsoft.com/en-us/windows/win32/api/winuser/nf-winuser-loadkeyboardlayoutw +const ( + KLF_ACTIVATE = 0x00000001 + KLF_SUBSTITUTE_OK = 0x00000002 + KLF_REORDER = 0x00000008 + KLF_REPLACELANG = 0x00000010 + KLF_NOTELLSHELL = 0x00000080 + KLF_SETFORPROCESS = 0x00000100 +) + +// Virtual Key codes +// https://docs.microsoft.com/en-us/windows/win32/inputdev/virtual-key-codes +const ( + VK_LBUTTON = 0x01 + VK_RBUTTON = 0x02 + VK_CANCEL = 0x03 + VK_MBUTTON = 0x04 + VK_XBUTTON1 = 0x05 + VK_XBUTTON2 = 0x06 + VK_BACK = 0x08 + VK_TAB = 0x09 + VK_CLEAR = 0x0C + VK_RETURN = 0x0D + VK_SHIFT = 0x10 + VK_CONTROL = 0x11 + VK_MENU = 0x12 + VK_PAUSE = 0x13 + VK_CAPITAL = 0x14 + VK_KANA = 0x15 + VK_HANGEUL = 0x15 + VK_HANGUL = 0x15 + VK_IME_ON = 0x16 + VK_JUNJA = 0x17 + VK_FINAL = 0x18 + VK_HANJA = 0x19 + VK_KANJI = 0x19 + VK_IME_OFF = 0x1A + VK_ESCAPE = 0x1B + VK_CONVERT = 0x1C + VK_NONCONVERT = 0x1D + VK_ACCEPT = 0x1E + VK_MODECHANGE = 0x1F + VK_SPACE = 0x20 + VK_PRIOR = 0x21 + VK_NEXT = 0x22 + VK_END = 0x23 + VK_HOME = 0x24 + VK_LEFT = 0x25 + VK_UP = 0x26 + VK_RIGHT = 0x27 + VK_DOWN = 0x28 + VK_SELECT = 0x29 + VK_PRINT = 0x2A + VK_EXECUTE = 0x2B + VK_SNAPSHOT = 0x2C + VK_INSERT = 0x2D + VK_DELETE = 0x2E + VK_HELP = 0x2F + VK_LWIN = 0x5B + VK_RWIN = 0x5C + VK_APPS = 0x5D + VK_SLEEP = 0x5F + VK_NUMPAD0 = 0x60 + VK_NUMPAD1 = 0x61 + VK_NUMPAD2 = 0x62 + VK_NUMPAD3 = 0x63 + VK_NUMPAD4 = 0x64 + VK_NUMPAD5 = 0x65 + VK_NUMPAD6 = 0x66 + VK_NUMPAD7 = 0x67 + VK_NUMPAD8 = 0x68 + VK_NUMPAD9 = 0x69 + VK_MULTIPLY = 0x6A + VK_ADD = 0x6B + VK_SEPARATOR = 0x6C + VK_SUBTRACT = 0x6D + VK_DECIMAL = 0x6E + VK_DIVIDE = 0x6F + VK_F1 = 0x70 + VK_F2 = 0x71 + VK_F3 = 0x72 + VK_F4 = 0x73 + VK_F5 = 0x74 + VK_F6 = 0x75 + VK_F7 = 0x76 + VK_F8 = 0x77 + VK_F9 = 0x78 + VK_F10 = 0x79 + VK_F11 = 0x7A + VK_F12 = 0x7B + VK_F13 = 0x7C + VK_F14 = 0x7D + VK_F15 = 0x7E + VK_F16 = 0x7F + VK_F17 = 0x80 + VK_F18 = 0x81 + VK_F19 = 0x82 + VK_F20 = 0x83 + VK_F21 = 0x84 + VK_F22 = 0x85 + VK_F23 = 0x86 + VK_F24 = 0x87 + VK_NUMLOCK = 0x90 + VK_SCROLL = 0x91 + VK_OEM_NEC_EQUAL = 0x92 + VK_OEM_FJ_JISHO = 0x92 + VK_OEM_FJ_MASSHOU = 0x93 + VK_OEM_FJ_TOUROKU = 0x94 + VK_OEM_FJ_LOYA = 0x95 + VK_OEM_FJ_ROYA = 0x96 + VK_LSHIFT = 0xA0 + VK_RSHIFT = 0xA1 + VK_LCONTROL = 0xA2 + VK_RCONTROL = 0xA3 + VK_LMENU = 0xA4 + VK_RMENU = 0xA5 + VK_BROWSER_BACK = 0xA6 + VK_BROWSER_FORWARD = 0xA7 + VK_BROWSER_REFRESH = 0xA8 + VK_BROWSER_STOP = 0xA9 + VK_BROWSER_SEARCH = 0xAA + VK_BROWSER_FAVORITES = 0xAB + VK_BROWSER_HOME = 0xAC + VK_VOLUME_MUTE = 0xAD + VK_VOLUME_DOWN = 0xAE + VK_VOLUME_UP = 0xAF + VK_MEDIA_NEXT_TRACK = 0xB0 + VK_MEDIA_PREV_TRACK = 0xB1 + VK_MEDIA_STOP = 0xB2 + VK_MEDIA_PLAY_PAUSE = 0xB3 + VK_LAUNCH_MAIL = 0xB4 + VK_LAUNCH_MEDIA_SELECT = 0xB5 + VK_LAUNCH_APP1 = 0xB6 + VK_LAUNCH_APP2 = 0xB7 + VK_OEM_1 = 0xBA + VK_OEM_PLUS = 0xBB + VK_OEM_COMMA = 0xBC + VK_OEM_MINUS = 0xBD + VK_OEM_PERIOD = 0xBE + VK_OEM_2 = 0xBF + VK_OEM_3 = 0xC0 + VK_OEM_4 = 0xDB + VK_OEM_5 = 0xDC + VK_OEM_6 = 0xDD + VK_OEM_7 = 0xDE + VK_OEM_8 = 0xDF + VK_OEM_AX = 0xE1 + VK_OEM_102 = 0xE2 + VK_ICO_HELP = 0xE3 + VK_ICO_00 = 0xE4 + VK_PROCESSKEY = 0xE5 + VK_ICO_CLEAR = 0xE6 + VK_OEM_RESET = 0xE9 + VK_OEM_JUMP = 0xEA + VK_OEM_PA1 = 0xEB + VK_OEM_PA2 = 0xEC + VK_OEM_PA3 = 0xED + VK_OEM_WSCTRL = 0xEE + VK_OEM_CUSEL = 0xEF + VK_OEM_ATTN = 0xF0 + VK_OEM_FINISH = 0xF1 + VK_OEM_COPY = 0xF2 + VK_OEM_AUTO = 0xF3 + VK_OEM_ENLW = 0xF4 + VK_OEM_BACKTAB = 0xF5 + VK_ATTN = 0xF6 + VK_CRSEL = 0xF7 + VK_EXSEL = 0xF8 + VK_EREOF = 0xF9 + VK_PLAY = 0xFA + VK_ZOOM = 0xFB + VK_NONAME = 0xFC + VK_PA1 = 0xFD + VK_OEM_CLEAR = 0xFE +) + +// Mouse button constants. +// https://docs.microsoft.com/en-us/windows/console/mouse-event-record-str +const ( + FROM_LEFT_1ST_BUTTON_PRESSED = 0x0001 + RIGHTMOST_BUTTON_PRESSED = 0x0002 + FROM_LEFT_2ND_BUTTON_PRESSED = 0x0004 + FROM_LEFT_3RD_BUTTON_PRESSED = 0x0008 + FROM_LEFT_4TH_BUTTON_PRESSED = 0x0010 +) + +// Control key state constaints. +// https://docs.microsoft.com/en-us/windows/console/key-event-record-str +// https://docs.microsoft.com/en-us/windows/console/mouse-event-record-str +const ( + CAPSLOCK_ON = 0x0080 + ENHANCED_KEY = 0x0100 + LEFT_ALT_PRESSED = 0x0002 + LEFT_CTRL_PRESSED = 0x0008 + NUMLOCK_ON = 0x0020 + RIGHT_ALT_PRESSED = 0x0001 + RIGHT_CTRL_PRESSED = 0x0004 + SCROLLLOCK_ON = 0x0040 + SHIFT_PRESSED = 0x0010 +) + +// Mouse event record event flags. +// https://docs.microsoft.com/en-us/windows/console/mouse-event-record-str +const ( + MOUSE_MOVED = 0x0001 + DOUBLE_CLICK = 0x0002 + MOUSE_WHEELED = 0x0004 + MOUSE_HWHEELED = 0x0008 +) + +// Input Record Event Types +// https://learn.microsoft.com/en-us/windows/console/input-record-str +const ( + FOCUS_EVENT = 0x0010 + KEY_EVENT = 0x0001 + MENU_EVENT = 0x0008 + MOUSE_EVENT = 0x0002 + WINDOW_BUFFER_SIZE_EVENT = 0x0004 +) + +// The processor features to be tested for IsProcessorFeaturePresent, see +// https://learn.microsoft.com/en-us/windows/win32/api/processthreadsapi/nf-processthreadsapi-isprocessorfeaturepresent +const ( + PF_ARM_64BIT_LOADSTORE_ATOMIC = 25 + PF_ARM_DIVIDE_INSTRUCTION_AVAILABLE = 24 + PF_ARM_EXTERNAL_CACHE_AVAILABLE = 26 + PF_ARM_FMAC_INSTRUCTIONS_AVAILABLE = 27 + PF_ARM_VFP_32_REGISTERS_AVAILABLE = 18 + PF_3DNOW_INSTRUCTIONS_AVAILABLE = 7 + PF_CHANNELS_ENABLED = 16 + PF_COMPARE_EXCHANGE_DOUBLE = 2 + PF_COMPARE_EXCHANGE128 = 14 + PF_COMPARE64_EXCHANGE128 = 15 + PF_FASTFAIL_AVAILABLE = 23 + PF_FLOATING_POINT_EMULATED = 1 + PF_FLOATING_POINT_PRECISION_ERRATA = 0 + PF_MMX_INSTRUCTIONS_AVAILABLE = 3 + PF_NX_ENABLED = 12 + PF_PAE_ENABLED = 9 + PF_RDTSC_INSTRUCTION_AVAILABLE = 8 + PF_RDWRFSGSBASE_AVAILABLE = 22 + PF_SECOND_LEVEL_ADDRESS_TRANSLATION = 20 + PF_SSE3_INSTRUCTIONS_AVAILABLE = 13 + PF_SSSE3_INSTRUCTIONS_AVAILABLE = 36 + PF_SSE4_1_INSTRUCTIONS_AVAILABLE = 37 + PF_SSE4_2_INSTRUCTIONS_AVAILABLE = 38 + PF_AVX_INSTRUCTIONS_AVAILABLE = 39 + PF_AVX2_INSTRUCTIONS_AVAILABLE = 40 + PF_AVX512F_INSTRUCTIONS_AVAILABLE = 41 + PF_VIRT_FIRMWARE_ENABLED = 21 + PF_XMMI_INSTRUCTIONS_AVAILABLE = 6 + PF_XMMI64_INSTRUCTIONS_AVAILABLE = 10 + PF_XSAVE_ENABLED = 17 + PF_ARM_V8_INSTRUCTIONS_AVAILABLE = 29 + PF_ARM_V8_CRYPTO_INSTRUCTIONS_AVAILABLE = 30 + PF_ARM_V8_CRC32_INSTRUCTIONS_AVAILABLE = 31 + PF_ARM_V81_ATOMIC_INSTRUCTIONS_AVAILABLE = 34 + PF_ARM_V82_DP_INSTRUCTIONS_AVAILABLE = 43 + PF_ARM_V83_JSCVT_INSTRUCTIONS_AVAILABLE = 44 + PF_ARM_V83_LRCPC_INSTRUCTIONS_AVAILABLE = 45 + PF_ARM_SVE_INSTRUCTIONS_AVAILABLE = 46 + PF_ARM_SVE2_INSTRUCTIONS_AVAILABLE = 47 + PF_ARM_SVE2_1_INSTRUCTIONS_AVAILABLE = 48 + PF_ARM_SVE_AES_INSTRUCTIONS_AVAILABLE = 49 + PF_ARM_SVE_PMULL128_INSTRUCTIONS_AVAILABLE = 50 + PF_ARM_SVE_BITPERM_INSTRUCTIONS_AVAILABLE = 51 + PF_ARM_SVE_BF16_INSTRUCTIONS_AVAILABLE = 52 + PF_ARM_SVE_EBF16_INSTRUCTIONS_AVAILABLE = 53 + PF_ARM_SVE_B16B16_INSTRUCTIONS_AVAILABLE = 54 + PF_ARM_SVE_SHA3_INSTRUCTIONS_AVAILABLE = 55 + PF_ARM_SVE_SM4_INSTRUCTIONS_AVAILABLE = 56 + PF_ARM_SVE_I8MM_INSTRUCTIONS_AVAILABLE = 57 + PF_ARM_SVE_F32MM_INSTRUCTIONS_AVAILABLE = 58 + PF_ARM_SVE_F64MM_INSTRUCTIONS_AVAILABLE = 59 + PF_BMI2_INSTRUCTIONS_AVAILABLE = 60 + PF_MOVDIR64B_INSTRUCTION_AVAILABLE = 61 + PF_ARM_LSE2_AVAILABLE = 62 + PF_ARM_SHA3_INSTRUCTIONS_AVAILABLE = 64 + PF_ARM_SHA512_INSTRUCTIONS_AVAILABLE = 65 + PF_ARM_V82_I8MM_INSTRUCTIONS_AVAILABLE = 66 + PF_ARM_V82_FP16_INSTRUCTIONS_AVAILABLE = 67 + PF_ARM_V86_BF16_INSTRUCTIONS_AVAILABLE = 68 + PF_ARM_V86_EBF16_INSTRUCTIONS_AVAILABLE = 69 + PF_ARM_SME_INSTRUCTIONS_AVAILABLE = 70 + PF_ARM_SME2_INSTRUCTIONS_AVAILABLE = 71 + PF_ARM_SME2_1_INSTRUCTIONS_AVAILABLE = 72 + PF_ARM_SME2_2_INSTRUCTIONS_AVAILABLE = 73 + PF_ARM_SME_AES_INSTRUCTIONS_AVAILABLE = 74 + PF_ARM_SME_SBITPERM_INSTRUCTIONS_AVAILABLE = 75 + PF_ARM_SME_SF8MM4_INSTRUCTIONS_AVAILABLE = 76 + PF_ARM_SME_SF8MM8_INSTRUCTIONS_AVAILABLE = 77 + PF_ARM_SME_SF8DP2_INSTRUCTIONS_AVAILABLE = 78 + PF_ARM_SME_SF8DP4_INSTRUCTIONS_AVAILABLE = 79 + PF_ARM_SME_SF8FMA_INSTRUCTIONS_AVAILABLE = 80 + PF_ARM_SME_F8F32_INSTRUCTIONS_AVAILABLE = 81 + PF_ARM_SME_F8F16_INSTRUCTIONS_AVAILABLE = 82 + PF_ARM_SME_F16F16_INSTRUCTIONS_AVAILABLE = 83 + PF_ARM_SME_B16B16_INSTRUCTIONS_AVAILABLE = 84 + PF_ARM_SME_F64F64_INSTRUCTIONS_AVAILABLE = 85 + PF_ARM_SME_I16I64_INSTRUCTIONS_AVAILABLE = 86 + PF_ARM_SME_LUTv2_INSTRUCTIONS_AVAILABLE = 87 + PF_ARM_SME_FA64_INSTRUCTIONS_AVAILABLE = 88 + PF_UMONITOR_INSTRUCTION_AVAILABLE = 89 +) diff --git a/vendor/golang.org/x/sys/windows/types_windows_386.go b/vendor/golang.org/x/sys/windows/types_windows_386.go new file mode 100644 index 00000000..8bce3e2f --- /dev/null +++ b/vendor/golang.org/x/sys/windows/types_windows_386.go @@ -0,0 +1,35 @@ +// Copyright 2011 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +package windows + +type WSAData struct { + Version uint16 + HighVersion uint16 + Description [WSADESCRIPTION_LEN + 1]byte + SystemStatus [WSASYS_STATUS_LEN + 1]byte + MaxSockets uint16 + MaxUdpDg uint16 + VendorInfo *byte +} + +type Servent struct { + Name *byte + Aliases **byte + Port uint16 + Proto *byte +} + +type JOBOBJECT_BASIC_LIMIT_INFORMATION struct { + PerProcessUserTimeLimit int64 + PerJobUserTimeLimit int64 + LimitFlags uint32 + MinimumWorkingSetSize uintptr + MaximumWorkingSetSize uintptr + ActiveProcessLimit uint32 + Affinity uintptr + PriorityClass uint32 + SchedulingClass uint32 + _ uint32 // pad to 8 byte boundary +} diff --git a/vendor/golang.org/x/sys/windows/types_windows_amd64.go b/vendor/golang.org/x/sys/windows/types_windows_amd64.go new file mode 100644 index 00000000..fdddc0c7 --- /dev/null +++ b/vendor/golang.org/x/sys/windows/types_windows_amd64.go @@ -0,0 +1,34 @@ +// Copyright 2011 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +package windows + +type WSAData struct { + Version uint16 + HighVersion uint16 + MaxSockets uint16 + MaxUdpDg uint16 + VendorInfo *byte + Description [WSADESCRIPTION_LEN + 1]byte + SystemStatus [WSASYS_STATUS_LEN + 1]byte +} + +type Servent struct { + Name *byte + Aliases **byte + Proto *byte + Port uint16 +} + +type JOBOBJECT_BASIC_LIMIT_INFORMATION struct { + PerProcessUserTimeLimit int64 + PerJobUserTimeLimit int64 + LimitFlags uint32 + MinimumWorkingSetSize uintptr + MaximumWorkingSetSize uintptr + ActiveProcessLimit uint32 + Affinity uintptr + PriorityClass uint32 + SchedulingClass uint32 +} diff --git a/vendor/golang.org/x/sys/windows/types_windows_arm.go b/vendor/golang.org/x/sys/windows/types_windows_arm.go new file mode 100644 index 00000000..321872c3 --- /dev/null +++ b/vendor/golang.org/x/sys/windows/types_windows_arm.go @@ -0,0 +1,35 @@ +// Copyright 2018 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +package windows + +type WSAData struct { + Version uint16 + HighVersion uint16 + Description [WSADESCRIPTION_LEN + 1]byte + SystemStatus [WSASYS_STATUS_LEN + 1]byte + MaxSockets uint16 + MaxUdpDg uint16 + VendorInfo *byte +} + +type Servent struct { + Name *byte + Aliases **byte + Port uint16 + Proto *byte +} + +type JOBOBJECT_BASIC_LIMIT_INFORMATION struct { + PerProcessUserTimeLimit int64 + PerJobUserTimeLimit int64 + LimitFlags uint32 + MinimumWorkingSetSize uintptr + MaximumWorkingSetSize uintptr + ActiveProcessLimit uint32 + Affinity uintptr + PriorityClass uint32 + SchedulingClass uint32 + _ uint32 // pad to 8 byte boundary +} diff --git a/vendor/golang.org/x/sys/windows/types_windows_arm64.go b/vendor/golang.org/x/sys/windows/types_windows_arm64.go new file mode 100644 index 00000000..fdddc0c7 --- /dev/null +++ b/vendor/golang.org/x/sys/windows/types_windows_arm64.go @@ -0,0 +1,34 @@ +// Copyright 2011 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +package windows + +type WSAData struct { + Version uint16 + HighVersion uint16 + MaxSockets uint16 + MaxUdpDg uint16 + VendorInfo *byte + Description [WSADESCRIPTION_LEN + 1]byte + SystemStatus [WSASYS_STATUS_LEN + 1]byte +} + +type Servent struct { + Name *byte + Aliases **byte + Proto *byte + Port uint16 +} + +type JOBOBJECT_BASIC_LIMIT_INFORMATION struct { + PerProcessUserTimeLimit int64 + PerJobUserTimeLimit int64 + LimitFlags uint32 + MinimumWorkingSetSize uintptr + MaximumWorkingSetSize uintptr + ActiveProcessLimit uint32 + Affinity uintptr + PriorityClass uint32 + SchedulingClass uint32 +} diff --git a/vendor/golang.org/x/sys/windows/zerrors_windows.go b/vendor/golang.org/x/sys/windows/zerrors_windows.go new file mode 100644 index 00000000..0cf658fb --- /dev/null +++ b/vendor/golang.org/x/sys/windows/zerrors_windows.go @@ -0,0 +1,9468 @@ +// Code generated by 'mkerrors.bash'; DO NOT EDIT. + +package windows + +import "syscall" + +const ( + FACILITY_NULL = 0 + FACILITY_RPC = 1 + FACILITY_DISPATCH = 2 + FACILITY_STORAGE = 3 + FACILITY_ITF = 4 + FACILITY_WIN32 = 7 + FACILITY_WINDOWS = 8 + FACILITY_SSPI = 9 + FACILITY_SECURITY = 9 + FACILITY_CONTROL = 10 + FACILITY_CERT = 11 + FACILITY_INTERNET = 12 + FACILITY_MEDIASERVER = 13 + FACILITY_MSMQ = 14 + FACILITY_SETUPAPI = 15 + FACILITY_SCARD = 16 + FACILITY_COMPLUS = 17 + FACILITY_AAF = 18 + FACILITY_URT = 19 + FACILITY_ACS = 20 + FACILITY_DPLAY = 21 + FACILITY_UMI = 22 + FACILITY_SXS = 23 + FACILITY_WINDOWS_CE = 24 + FACILITY_HTTP = 25 + FACILITY_USERMODE_COMMONLOG = 26 + FACILITY_WER = 27 + FACILITY_USERMODE_FILTER_MANAGER = 31 + FACILITY_BACKGROUNDCOPY = 32 + FACILITY_CONFIGURATION = 33 + FACILITY_WIA = 33 + FACILITY_STATE_MANAGEMENT = 34 + FACILITY_METADIRECTORY = 35 + FACILITY_WINDOWSUPDATE = 36 + FACILITY_DIRECTORYSERVICE = 37 + FACILITY_GRAPHICS = 38 + FACILITY_SHELL = 39 + FACILITY_NAP = 39 + FACILITY_TPM_SERVICES = 40 + FACILITY_TPM_SOFTWARE = 41 + FACILITY_UI = 42 + FACILITY_XAML = 43 + FACILITY_ACTION_QUEUE = 44 + FACILITY_PLA = 48 + FACILITY_WINDOWS_SETUP = 48 + FACILITY_FVE = 49 + FACILITY_FWP = 50 + FACILITY_WINRM = 51 + FACILITY_NDIS = 52 + FACILITY_USERMODE_HYPERVISOR = 53 + FACILITY_CMI = 54 + FACILITY_USERMODE_VIRTUALIZATION = 55 + FACILITY_USERMODE_VOLMGR = 56 + FACILITY_BCD = 57 + FACILITY_USERMODE_VHD = 58 + FACILITY_USERMODE_HNS = 59 + FACILITY_SDIAG = 60 + FACILITY_WEBSERVICES = 61 + FACILITY_WINPE = 61 + FACILITY_WPN = 62 + FACILITY_WINDOWS_STORE = 63 + FACILITY_INPUT = 64 + FACILITY_EAP = 66 + FACILITY_WINDOWS_DEFENDER = 80 + FACILITY_OPC = 81 + FACILITY_XPS = 82 + FACILITY_MBN = 84 + FACILITY_POWERSHELL = 84 + FACILITY_RAS = 83 + FACILITY_P2P_INT = 98 + FACILITY_P2P = 99 + FACILITY_DAF = 100 + FACILITY_BLUETOOTH_ATT = 101 + FACILITY_AUDIO = 102 + FACILITY_STATEREPOSITORY = 103 + FACILITY_VISUALCPP = 109 + FACILITY_SCRIPT = 112 + FACILITY_PARSE = 113 + FACILITY_BLB = 120 + FACILITY_BLB_CLI = 121 + FACILITY_WSBAPP = 122 + FACILITY_BLBUI = 128 + FACILITY_USN = 129 + FACILITY_USERMODE_VOLSNAP = 130 + FACILITY_TIERING = 131 + FACILITY_WSB_ONLINE = 133 + FACILITY_ONLINE_ID = 134 + FACILITY_DEVICE_UPDATE_AGENT = 135 + FACILITY_DRVSERVICING = 136 + FACILITY_DLS = 153 + FACILITY_DELIVERY_OPTIMIZATION = 208 + FACILITY_USERMODE_SPACES = 231 + FACILITY_USER_MODE_SECURITY_CORE = 232 + FACILITY_USERMODE_LICENSING = 234 + FACILITY_SOS = 160 + FACILITY_DEBUGGERS = 176 + FACILITY_SPP = 256 + FACILITY_RESTORE = 256 + FACILITY_DMSERVER = 256 + FACILITY_DEPLOYMENT_SERVICES_SERVER = 257 + FACILITY_DEPLOYMENT_SERVICES_IMAGING = 258 + FACILITY_DEPLOYMENT_SERVICES_MANAGEMENT = 259 + FACILITY_DEPLOYMENT_SERVICES_UTIL = 260 + FACILITY_DEPLOYMENT_SERVICES_BINLSVC = 261 + FACILITY_DEPLOYMENT_SERVICES_PXE = 263 + FACILITY_DEPLOYMENT_SERVICES_TFTP = 264 + FACILITY_DEPLOYMENT_SERVICES_TRANSPORT_MANAGEMENT = 272 + FACILITY_DEPLOYMENT_SERVICES_DRIVER_PROVISIONING = 278 + FACILITY_DEPLOYMENT_SERVICES_MULTICAST_SERVER = 289 + FACILITY_DEPLOYMENT_SERVICES_MULTICAST_CLIENT = 290 + FACILITY_DEPLOYMENT_SERVICES_CONTENT_PROVIDER = 293 + FACILITY_LINGUISTIC_SERVICES = 305 + FACILITY_AUDIOSTREAMING = 1094 + FACILITY_ACCELERATOR = 1536 + FACILITY_WMAAECMA = 1996 + FACILITY_DIRECTMUSIC = 2168 + FACILITY_DIRECT3D10 = 2169 + FACILITY_DXGI = 2170 + FACILITY_DXGI_DDI = 2171 + FACILITY_DIRECT3D11 = 2172 + FACILITY_DIRECT3D11_DEBUG = 2173 + FACILITY_DIRECT3D12 = 2174 + FACILITY_DIRECT3D12_DEBUG = 2175 + FACILITY_LEAP = 2184 + FACILITY_AUDCLNT = 2185 + FACILITY_WINCODEC_DWRITE_DWM = 2200 + FACILITY_WINML = 2192 + FACILITY_DIRECT2D = 2201 + FACILITY_DEFRAG = 2304 + FACILITY_USERMODE_SDBUS = 2305 + FACILITY_JSCRIPT = 2306 + FACILITY_PIDGENX = 2561 + FACILITY_EAS = 85 + FACILITY_WEB = 885 + FACILITY_WEB_SOCKET = 886 + FACILITY_MOBILE = 1793 + FACILITY_SQLITE = 1967 + FACILITY_UTC = 1989 + FACILITY_WEP = 2049 + FACILITY_SYNCENGINE = 2050 + FACILITY_XBOX = 2339 + FACILITY_GAME = 2340 + FACILITY_PIX = 2748 + ERROR_SUCCESS syscall.Errno = 0 + NO_ERROR = 0 + SEC_E_OK Handle = 0x00000000 + ERROR_INVALID_FUNCTION syscall.Errno = 1 + ERROR_FILE_NOT_FOUND syscall.Errno = 2 + ERROR_PATH_NOT_FOUND syscall.Errno = 3 + ERROR_TOO_MANY_OPEN_FILES syscall.Errno = 4 + ERROR_ACCESS_DENIED syscall.Errno = 5 + ERROR_INVALID_HANDLE syscall.Errno = 6 + ERROR_ARENA_TRASHED syscall.Errno = 7 + ERROR_NOT_ENOUGH_MEMORY syscall.Errno = 8 + ERROR_INVALID_BLOCK syscall.Errno = 9 + ERROR_BAD_ENVIRONMENT syscall.Errno = 10 + ERROR_BAD_FORMAT syscall.Errno = 11 + ERROR_INVALID_ACCESS syscall.Errno = 12 + ERROR_INVALID_DATA syscall.Errno = 13 + ERROR_OUTOFMEMORY syscall.Errno = 14 + ERROR_INVALID_DRIVE syscall.Errno = 15 + ERROR_CURRENT_DIRECTORY syscall.Errno = 16 + ERROR_NOT_SAME_DEVICE syscall.Errno = 17 + ERROR_NO_MORE_FILES syscall.Errno = 18 + ERROR_WRITE_PROTECT syscall.Errno = 19 + ERROR_BAD_UNIT syscall.Errno = 20 + ERROR_NOT_READY syscall.Errno = 21 + ERROR_BAD_COMMAND syscall.Errno = 22 + ERROR_CRC syscall.Errno = 23 + ERROR_BAD_LENGTH syscall.Errno = 24 + ERROR_SEEK syscall.Errno = 25 + ERROR_NOT_DOS_DISK syscall.Errno = 26 + ERROR_SECTOR_NOT_FOUND syscall.Errno = 27 + ERROR_OUT_OF_PAPER syscall.Errno = 28 + ERROR_WRITE_FAULT syscall.Errno = 29 + ERROR_READ_FAULT syscall.Errno = 30 + ERROR_GEN_FAILURE syscall.Errno = 31 + ERROR_SHARING_VIOLATION syscall.Errno = 32 + ERROR_LOCK_VIOLATION syscall.Errno = 33 + ERROR_WRONG_DISK syscall.Errno = 34 + ERROR_SHARING_BUFFER_EXCEEDED syscall.Errno = 36 + ERROR_HANDLE_EOF syscall.Errno = 38 + ERROR_HANDLE_DISK_FULL syscall.Errno = 39 + ERROR_NOT_SUPPORTED syscall.Errno = 50 + ERROR_REM_NOT_LIST syscall.Errno = 51 + ERROR_DUP_NAME syscall.Errno = 52 + ERROR_BAD_NETPATH syscall.Errno = 53 + ERROR_NETWORK_BUSY syscall.Errno = 54 + ERROR_DEV_NOT_EXIST syscall.Errno = 55 + ERROR_TOO_MANY_CMDS syscall.Errno = 56 + ERROR_ADAP_HDW_ERR syscall.Errno = 57 + ERROR_BAD_NET_RESP syscall.Errno = 58 + ERROR_UNEXP_NET_ERR syscall.Errno = 59 + ERROR_BAD_REM_ADAP syscall.Errno = 60 + ERROR_PRINTQ_FULL syscall.Errno = 61 + ERROR_NO_SPOOL_SPACE syscall.Errno = 62 + ERROR_PRINT_CANCELLED syscall.Errno = 63 + ERROR_NETNAME_DELETED syscall.Errno = 64 + ERROR_NETWORK_ACCESS_DENIED syscall.Errno = 65 + ERROR_BAD_DEV_TYPE syscall.Errno = 66 + ERROR_BAD_NET_NAME syscall.Errno = 67 + ERROR_TOO_MANY_NAMES syscall.Errno = 68 + ERROR_TOO_MANY_SESS syscall.Errno = 69 + ERROR_SHARING_PAUSED syscall.Errno = 70 + ERROR_REQ_NOT_ACCEP syscall.Errno = 71 + ERROR_REDIR_PAUSED syscall.Errno = 72 + ERROR_FILE_EXISTS syscall.Errno = 80 + ERROR_CANNOT_MAKE syscall.Errno = 82 + ERROR_FAIL_I24 syscall.Errno = 83 + ERROR_OUT_OF_STRUCTURES syscall.Errno = 84 + ERROR_ALREADY_ASSIGNED syscall.Errno = 85 + ERROR_INVALID_PASSWORD syscall.Errno = 86 + ERROR_INVALID_PARAMETER syscall.Errno = 87 + ERROR_NET_WRITE_FAULT syscall.Errno = 88 + ERROR_NO_PROC_SLOTS syscall.Errno = 89 + ERROR_TOO_MANY_SEMAPHORES syscall.Errno = 100 + ERROR_EXCL_SEM_ALREADY_OWNED syscall.Errno = 101 + ERROR_SEM_IS_SET syscall.Errno = 102 + ERROR_TOO_MANY_SEM_REQUESTS syscall.Errno = 103 + ERROR_INVALID_AT_INTERRUPT_TIME syscall.Errno = 104 + ERROR_SEM_OWNER_DIED syscall.Errno = 105 + ERROR_SEM_USER_LIMIT syscall.Errno = 106 + ERROR_DISK_CHANGE syscall.Errno = 107 + ERROR_DRIVE_LOCKED syscall.Errno = 108 + ERROR_BROKEN_PIPE syscall.Errno = 109 + ERROR_OPEN_FAILED syscall.Errno = 110 + ERROR_BUFFER_OVERFLOW syscall.Errno = 111 + ERROR_DISK_FULL syscall.Errno = 112 + ERROR_NO_MORE_SEARCH_HANDLES syscall.Errno = 113 + ERROR_INVALID_TARGET_HANDLE syscall.Errno = 114 + ERROR_INVALID_CATEGORY syscall.Errno = 117 + ERROR_INVALID_VERIFY_SWITCH syscall.Errno = 118 + ERROR_BAD_DRIVER_LEVEL syscall.Errno = 119 + ERROR_CALL_NOT_IMPLEMENTED syscall.Errno = 120 + ERROR_SEM_TIMEOUT syscall.Errno = 121 + ERROR_INSUFFICIENT_BUFFER syscall.Errno = 122 + ERROR_INVALID_NAME syscall.Errno = 123 + ERROR_INVALID_LEVEL syscall.Errno = 124 + ERROR_NO_VOLUME_LABEL syscall.Errno = 125 + ERROR_MOD_NOT_FOUND syscall.Errno = 126 + ERROR_PROC_NOT_FOUND syscall.Errno = 127 + ERROR_WAIT_NO_CHILDREN syscall.Errno = 128 + ERROR_CHILD_NOT_COMPLETE syscall.Errno = 129 + ERROR_DIRECT_ACCESS_HANDLE syscall.Errno = 130 + ERROR_NEGATIVE_SEEK syscall.Errno = 131 + ERROR_SEEK_ON_DEVICE syscall.Errno = 132 + ERROR_IS_JOIN_TARGET syscall.Errno = 133 + ERROR_IS_JOINED syscall.Errno = 134 + ERROR_IS_SUBSTED syscall.Errno = 135 + ERROR_NOT_JOINED syscall.Errno = 136 + ERROR_NOT_SUBSTED syscall.Errno = 137 + ERROR_JOIN_TO_JOIN syscall.Errno = 138 + ERROR_SUBST_TO_SUBST syscall.Errno = 139 + ERROR_JOIN_TO_SUBST syscall.Errno = 140 + ERROR_SUBST_TO_JOIN syscall.Errno = 141 + ERROR_BUSY_DRIVE syscall.Errno = 142 + ERROR_SAME_DRIVE syscall.Errno = 143 + ERROR_DIR_NOT_ROOT syscall.Errno = 144 + ERROR_DIR_NOT_EMPTY syscall.Errno = 145 + ERROR_IS_SUBST_PATH syscall.Errno = 146 + ERROR_IS_JOIN_PATH syscall.Errno = 147 + ERROR_PATH_BUSY syscall.Errno = 148 + ERROR_IS_SUBST_TARGET syscall.Errno = 149 + ERROR_SYSTEM_TRACE syscall.Errno = 150 + ERROR_INVALID_EVENT_COUNT syscall.Errno = 151 + ERROR_TOO_MANY_MUXWAITERS syscall.Errno = 152 + ERROR_INVALID_LIST_FORMAT syscall.Errno = 153 + ERROR_LABEL_TOO_LONG syscall.Errno = 154 + ERROR_TOO_MANY_TCBS syscall.Errno = 155 + ERROR_SIGNAL_REFUSED syscall.Errno = 156 + ERROR_DISCARDED syscall.Errno = 157 + ERROR_NOT_LOCKED syscall.Errno = 158 + ERROR_BAD_THREADID_ADDR syscall.Errno = 159 + ERROR_BAD_ARGUMENTS syscall.Errno = 160 + ERROR_BAD_PATHNAME syscall.Errno = 161 + ERROR_SIGNAL_PENDING syscall.Errno = 162 + ERROR_MAX_THRDS_REACHED syscall.Errno = 164 + ERROR_LOCK_FAILED syscall.Errno = 167 + ERROR_BUSY syscall.Errno = 170 + ERROR_DEVICE_SUPPORT_IN_PROGRESS syscall.Errno = 171 + ERROR_CANCEL_VIOLATION syscall.Errno = 173 + ERROR_ATOMIC_LOCKS_NOT_SUPPORTED syscall.Errno = 174 + ERROR_INVALID_SEGMENT_NUMBER syscall.Errno = 180 + ERROR_INVALID_ORDINAL syscall.Errno = 182 + ERROR_ALREADY_EXISTS syscall.Errno = 183 + ERROR_INVALID_FLAG_NUMBER syscall.Errno = 186 + ERROR_SEM_NOT_FOUND syscall.Errno = 187 + ERROR_INVALID_STARTING_CODESEG syscall.Errno = 188 + ERROR_INVALID_STACKSEG syscall.Errno = 189 + ERROR_INVALID_MODULETYPE syscall.Errno = 190 + ERROR_INVALID_EXE_SIGNATURE syscall.Errno = 191 + ERROR_EXE_MARKED_INVALID syscall.Errno = 192 + ERROR_BAD_EXE_FORMAT syscall.Errno = 193 + ERROR_ITERATED_DATA_EXCEEDS_64k syscall.Errno = 194 + ERROR_INVALID_MINALLOCSIZE syscall.Errno = 195 + ERROR_DYNLINK_FROM_INVALID_RING syscall.Errno = 196 + ERROR_IOPL_NOT_ENABLED syscall.Errno = 197 + ERROR_INVALID_SEGDPL syscall.Errno = 198 + ERROR_AUTODATASEG_EXCEEDS_64k syscall.Errno = 199 + ERROR_RING2SEG_MUST_BE_MOVABLE syscall.Errno = 200 + ERROR_RELOC_CHAIN_XEEDS_SEGLIM syscall.Errno = 201 + ERROR_INFLOOP_IN_RELOC_CHAIN syscall.Errno = 202 + ERROR_ENVVAR_NOT_FOUND syscall.Errno = 203 + ERROR_NO_SIGNAL_SENT syscall.Errno = 205 + ERROR_FILENAME_EXCED_RANGE syscall.Errno = 206 + ERROR_RING2_STACK_IN_USE syscall.Errno = 207 + ERROR_META_EXPANSION_TOO_LONG syscall.Errno = 208 + ERROR_INVALID_SIGNAL_NUMBER syscall.Errno = 209 + ERROR_THREAD_1_INACTIVE syscall.Errno = 210 + ERROR_LOCKED syscall.Errno = 212 + ERROR_TOO_MANY_MODULES syscall.Errno = 214 + ERROR_NESTING_NOT_ALLOWED syscall.Errno = 215 + ERROR_EXE_MACHINE_TYPE_MISMATCH syscall.Errno = 216 + ERROR_EXE_CANNOT_MODIFY_SIGNED_BINARY syscall.Errno = 217 + ERROR_EXE_CANNOT_MODIFY_STRONG_SIGNED_BINARY syscall.Errno = 218 + ERROR_FILE_CHECKED_OUT syscall.Errno = 220 + ERROR_CHECKOUT_REQUIRED syscall.Errno = 221 + ERROR_BAD_FILE_TYPE syscall.Errno = 222 + ERROR_FILE_TOO_LARGE syscall.Errno = 223 + ERROR_FORMS_AUTH_REQUIRED syscall.Errno = 224 + ERROR_VIRUS_INFECTED syscall.Errno = 225 + ERROR_VIRUS_DELETED syscall.Errno = 226 + ERROR_PIPE_LOCAL syscall.Errno = 229 + ERROR_BAD_PIPE syscall.Errno = 230 + ERROR_PIPE_BUSY syscall.Errno = 231 + ERROR_NO_DATA syscall.Errno = 232 + ERROR_PIPE_NOT_CONNECTED syscall.Errno = 233 + ERROR_MORE_DATA syscall.Errno = 234 + ERROR_NO_WORK_DONE syscall.Errno = 235 + ERROR_VC_DISCONNECTED syscall.Errno = 240 + ERROR_INVALID_EA_NAME syscall.Errno = 254 + ERROR_EA_LIST_INCONSISTENT syscall.Errno = 255 + WAIT_TIMEOUT syscall.Errno = 258 + ERROR_NO_MORE_ITEMS syscall.Errno = 259 + ERROR_CANNOT_COPY syscall.Errno = 266 + ERROR_DIRECTORY syscall.Errno = 267 + ERROR_EAS_DIDNT_FIT syscall.Errno = 275 + ERROR_EA_FILE_CORRUPT syscall.Errno = 276 + ERROR_EA_TABLE_FULL syscall.Errno = 277 + ERROR_INVALID_EA_HANDLE syscall.Errno = 278 + ERROR_EAS_NOT_SUPPORTED syscall.Errno = 282 + ERROR_NOT_OWNER syscall.Errno = 288 + ERROR_TOO_MANY_POSTS syscall.Errno = 298 + ERROR_PARTIAL_COPY syscall.Errno = 299 + ERROR_OPLOCK_NOT_GRANTED syscall.Errno = 300 + ERROR_INVALID_OPLOCK_PROTOCOL syscall.Errno = 301 + ERROR_DISK_TOO_FRAGMENTED syscall.Errno = 302 + ERROR_DELETE_PENDING syscall.Errno = 303 + ERROR_INCOMPATIBLE_WITH_GLOBAL_SHORT_NAME_REGISTRY_SETTING syscall.Errno = 304 + ERROR_SHORT_NAMES_NOT_ENABLED_ON_VOLUME syscall.Errno = 305 + ERROR_SECURITY_STREAM_IS_INCONSISTENT syscall.Errno = 306 + ERROR_INVALID_LOCK_RANGE syscall.Errno = 307 + ERROR_IMAGE_SUBSYSTEM_NOT_PRESENT syscall.Errno = 308 + ERROR_NOTIFICATION_GUID_ALREADY_DEFINED syscall.Errno = 309 + ERROR_INVALID_EXCEPTION_HANDLER syscall.Errno = 310 + ERROR_DUPLICATE_PRIVILEGES syscall.Errno = 311 + ERROR_NO_RANGES_PROCESSED syscall.Errno = 312 + ERROR_NOT_ALLOWED_ON_SYSTEM_FILE syscall.Errno = 313 + ERROR_DISK_RESOURCES_EXHAUSTED syscall.Errno = 314 + ERROR_INVALID_TOKEN syscall.Errno = 315 + ERROR_DEVICE_FEATURE_NOT_SUPPORTED syscall.Errno = 316 + ERROR_MR_MID_NOT_FOUND syscall.Errno = 317 + ERROR_SCOPE_NOT_FOUND syscall.Errno = 318 + ERROR_UNDEFINED_SCOPE syscall.Errno = 319 + ERROR_INVALID_CAP syscall.Errno = 320 + ERROR_DEVICE_UNREACHABLE syscall.Errno = 321 + ERROR_DEVICE_NO_RESOURCES syscall.Errno = 322 + ERROR_DATA_CHECKSUM_ERROR syscall.Errno = 323 + ERROR_INTERMIXED_KERNEL_EA_OPERATION syscall.Errno = 324 + ERROR_FILE_LEVEL_TRIM_NOT_SUPPORTED syscall.Errno = 326 + ERROR_OFFSET_ALIGNMENT_VIOLATION syscall.Errno = 327 + ERROR_INVALID_FIELD_IN_PARAMETER_LIST syscall.Errno = 328 + ERROR_OPERATION_IN_PROGRESS syscall.Errno = 329 + ERROR_BAD_DEVICE_PATH syscall.Errno = 330 + ERROR_TOO_MANY_DESCRIPTORS syscall.Errno = 331 + ERROR_SCRUB_DATA_DISABLED syscall.Errno = 332 + ERROR_NOT_REDUNDANT_STORAGE syscall.Errno = 333 + ERROR_RESIDENT_FILE_NOT_SUPPORTED syscall.Errno = 334 + ERROR_COMPRESSED_FILE_NOT_SUPPORTED syscall.Errno = 335 + ERROR_DIRECTORY_NOT_SUPPORTED syscall.Errno = 336 + ERROR_NOT_READ_FROM_COPY syscall.Errno = 337 + ERROR_FT_WRITE_FAILURE syscall.Errno = 338 + ERROR_FT_DI_SCAN_REQUIRED syscall.Errno = 339 + ERROR_INVALID_KERNEL_INFO_VERSION syscall.Errno = 340 + ERROR_INVALID_PEP_INFO_VERSION syscall.Errno = 341 + ERROR_OBJECT_NOT_EXTERNALLY_BACKED syscall.Errno = 342 + ERROR_EXTERNAL_BACKING_PROVIDER_UNKNOWN syscall.Errno = 343 + ERROR_COMPRESSION_NOT_BENEFICIAL syscall.Errno = 344 + ERROR_STORAGE_TOPOLOGY_ID_MISMATCH syscall.Errno = 345 + ERROR_BLOCKED_BY_PARENTAL_CONTROLS syscall.Errno = 346 + ERROR_BLOCK_TOO_MANY_REFERENCES syscall.Errno = 347 + ERROR_MARKED_TO_DISALLOW_WRITES syscall.Errno = 348 + ERROR_ENCLAVE_FAILURE syscall.Errno = 349 + ERROR_FAIL_NOACTION_REBOOT syscall.Errno = 350 + ERROR_FAIL_SHUTDOWN syscall.Errno = 351 + ERROR_FAIL_RESTART syscall.Errno = 352 + ERROR_MAX_SESSIONS_REACHED syscall.Errno = 353 + ERROR_NETWORK_ACCESS_DENIED_EDP syscall.Errno = 354 + ERROR_DEVICE_HINT_NAME_BUFFER_TOO_SMALL syscall.Errno = 355 + ERROR_EDP_POLICY_DENIES_OPERATION syscall.Errno = 356 + ERROR_EDP_DPL_POLICY_CANT_BE_SATISFIED syscall.Errno = 357 + ERROR_CLOUD_FILE_SYNC_ROOT_METADATA_CORRUPT syscall.Errno = 358 + ERROR_DEVICE_IN_MAINTENANCE syscall.Errno = 359 + ERROR_NOT_SUPPORTED_ON_DAX syscall.Errno = 360 + ERROR_DAX_MAPPING_EXISTS syscall.Errno = 361 + ERROR_CLOUD_FILE_PROVIDER_NOT_RUNNING syscall.Errno = 362 + ERROR_CLOUD_FILE_METADATA_CORRUPT syscall.Errno = 363 + ERROR_CLOUD_FILE_METADATA_TOO_LARGE syscall.Errno = 364 + ERROR_CLOUD_FILE_PROPERTY_BLOB_TOO_LARGE syscall.Errno = 365 + ERROR_CLOUD_FILE_PROPERTY_BLOB_CHECKSUM_MISMATCH syscall.Errno = 366 + ERROR_CHILD_PROCESS_BLOCKED syscall.Errno = 367 + ERROR_STORAGE_LOST_DATA_PERSISTENCE syscall.Errno = 368 + ERROR_FILE_SYSTEM_VIRTUALIZATION_UNAVAILABLE syscall.Errno = 369 + ERROR_FILE_SYSTEM_VIRTUALIZATION_METADATA_CORRUPT syscall.Errno = 370 + ERROR_FILE_SYSTEM_VIRTUALIZATION_BUSY syscall.Errno = 371 + ERROR_FILE_SYSTEM_VIRTUALIZATION_PROVIDER_UNKNOWN syscall.Errno = 372 + ERROR_GDI_HANDLE_LEAK syscall.Errno = 373 + ERROR_CLOUD_FILE_TOO_MANY_PROPERTY_BLOBS syscall.Errno = 374 + ERROR_CLOUD_FILE_PROPERTY_VERSION_NOT_SUPPORTED syscall.Errno = 375 + ERROR_NOT_A_CLOUD_FILE syscall.Errno = 376 + ERROR_CLOUD_FILE_NOT_IN_SYNC syscall.Errno = 377 + ERROR_CLOUD_FILE_ALREADY_CONNECTED syscall.Errno = 378 + ERROR_CLOUD_FILE_NOT_SUPPORTED syscall.Errno = 379 + ERROR_CLOUD_FILE_INVALID_REQUEST syscall.Errno = 380 + ERROR_CLOUD_FILE_READ_ONLY_VOLUME syscall.Errno = 381 + ERROR_CLOUD_FILE_CONNECTED_PROVIDER_ONLY syscall.Errno = 382 + ERROR_CLOUD_FILE_VALIDATION_FAILED syscall.Errno = 383 + ERROR_SMB1_NOT_AVAILABLE syscall.Errno = 384 + ERROR_FILE_SYSTEM_VIRTUALIZATION_INVALID_OPERATION syscall.Errno = 385 + ERROR_CLOUD_FILE_AUTHENTICATION_FAILED syscall.Errno = 386 + ERROR_CLOUD_FILE_INSUFFICIENT_RESOURCES syscall.Errno = 387 + ERROR_CLOUD_FILE_NETWORK_UNAVAILABLE syscall.Errno = 388 + ERROR_CLOUD_FILE_UNSUCCESSFUL syscall.Errno = 389 + ERROR_CLOUD_FILE_NOT_UNDER_SYNC_ROOT syscall.Errno = 390 + ERROR_CLOUD_FILE_IN_USE syscall.Errno = 391 + ERROR_CLOUD_FILE_PINNED syscall.Errno = 392 + ERROR_CLOUD_FILE_REQUEST_ABORTED syscall.Errno = 393 + ERROR_CLOUD_FILE_PROPERTY_CORRUPT syscall.Errno = 394 + ERROR_CLOUD_FILE_ACCESS_DENIED syscall.Errno = 395 + ERROR_CLOUD_FILE_INCOMPATIBLE_HARDLINKS syscall.Errno = 396 + ERROR_CLOUD_FILE_PROPERTY_LOCK_CONFLICT syscall.Errno = 397 + ERROR_CLOUD_FILE_REQUEST_CANCELED syscall.Errno = 398 + ERROR_EXTERNAL_SYSKEY_NOT_SUPPORTED syscall.Errno = 399 + ERROR_THREAD_MODE_ALREADY_BACKGROUND syscall.Errno = 400 + ERROR_THREAD_MODE_NOT_BACKGROUND syscall.Errno = 401 + ERROR_PROCESS_MODE_ALREADY_BACKGROUND syscall.Errno = 402 + ERROR_PROCESS_MODE_NOT_BACKGROUND syscall.Errno = 403 + ERROR_CLOUD_FILE_PROVIDER_TERMINATED syscall.Errno = 404 + ERROR_NOT_A_CLOUD_SYNC_ROOT syscall.Errno = 405 + ERROR_FILE_PROTECTED_UNDER_DPL syscall.Errno = 406 + ERROR_VOLUME_NOT_CLUSTER_ALIGNED syscall.Errno = 407 + ERROR_NO_PHYSICALLY_ALIGNED_FREE_SPACE_FOUND syscall.Errno = 408 + ERROR_APPX_FILE_NOT_ENCRYPTED syscall.Errno = 409 + ERROR_RWRAW_ENCRYPTED_FILE_NOT_ENCRYPTED syscall.Errno = 410 + ERROR_RWRAW_ENCRYPTED_INVALID_EDATAINFO_FILEOFFSET syscall.Errno = 411 + ERROR_RWRAW_ENCRYPTED_INVALID_EDATAINFO_FILERANGE syscall.Errno = 412 + ERROR_RWRAW_ENCRYPTED_INVALID_EDATAINFO_PARAMETER syscall.Errno = 413 + ERROR_LINUX_SUBSYSTEM_NOT_PRESENT syscall.Errno = 414 + ERROR_FT_READ_FAILURE syscall.Errno = 415 + ERROR_STORAGE_RESERVE_ID_INVALID syscall.Errno = 416 + ERROR_STORAGE_RESERVE_DOES_NOT_EXIST syscall.Errno = 417 + ERROR_STORAGE_RESERVE_ALREADY_EXISTS syscall.Errno = 418 + ERROR_STORAGE_RESERVE_NOT_EMPTY syscall.Errno = 419 + ERROR_NOT_A_DAX_VOLUME syscall.Errno = 420 + ERROR_NOT_DAX_MAPPABLE syscall.Errno = 421 + ERROR_TIME_SENSITIVE_THREAD syscall.Errno = 422 + ERROR_DPL_NOT_SUPPORTED_FOR_USER syscall.Errno = 423 + ERROR_CASE_DIFFERING_NAMES_IN_DIR syscall.Errno = 424 + ERROR_FILE_NOT_SUPPORTED syscall.Errno = 425 + ERROR_CLOUD_FILE_REQUEST_TIMEOUT syscall.Errno = 426 + ERROR_NO_TASK_QUEUE syscall.Errno = 427 + ERROR_SRC_SRV_DLL_LOAD_FAILED syscall.Errno = 428 + ERROR_NOT_SUPPORTED_WITH_BTT syscall.Errno = 429 + ERROR_ENCRYPTION_DISABLED syscall.Errno = 430 + ERROR_ENCRYPTING_METADATA_DISALLOWED syscall.Errno = 431 + ERROR_CANT_CLEAR_ENCRYPTION_FLAG syscall.Errno = 432 + ERROR_NO_SUCH_DEVICE syscall.Errno = 433 + ERROR_CAPAUTHZ_NOT_DEVUNLOCKED syscall.Errno = 450 + ERROR_CAPAUTHZ_CHANGE_TYPE syscall.Errno = 451 + ERROR_CAPAUTHZ_NOT_PROVISIONED syscall.Errno = 452 + ERROR_CAPAUTHZ_NOT_AUTHORIZED syscall.Errno = 453 + ERROR_CAPAUTHZ_NO_POLICY syscall.Errno = 454 + ERROR_CAPAUTHZ_DB_CORRUPTED syscall.Errno = 455 + ERROR_CAPAUTHZ_SCCD_INVALID_CATALOG syscall.Errno = 456 + ERROR_CAPAUTHZ_SCCD_NO_AUTH_ENTITY syscall.Errno = 457 + ERROR_CAPAUTHZ_SCCD_PARSE_ERROR syscall.Errno = 458 + ERROR_CAPAUTHZ_SCCD_DEV_MODE_REQUIRED syscall.Errno = 459 + ERROR_CAPAUTHZ_SCCD_NO_CAPABILITY_MATCH syscall.Errno = 460 + ERROR_PNP_QUERY_REMOVE_DEVICE_TIMEOUT syscall.Errno = 480 + ERROR_PNP_QUERY_REMOVE_RELATED_DEVICE_TIMEOUT syscall.Errno = 481 + ERROR_PNP_QUERY_REMOVE_UNRELATED_DEVICE_TIMEOUT syscall.Errno = 482 + ERROR_DEVICE_HARDWARE_ERROR syscall.Errno = 483 + ERROR_INVALID_ADDRESS syscall.Errno = 487 + ERROR_VRF_CFG_ENABLED syscall.Errno = 1183 + ERROR_PARTITION_TERMINATING syscall.Errno = 1184 + ERROR_USER_PROFILE_LOAD syscall.Errno = 500 + ERROR_ARITHMETIC_OVERFLOW syscall.Errno = 534 + ERROR_PIPE_CONNECTED syscall.Errno = 535 + ERROR_PIPE_LISTENING syscall.Errno = 536 + ERROR_VERIFIER_STOP syscall.Errno = 537 + ERROR_ABIOS_ERROR syscall.Errno = 538 + ERROR_WX86_WARNING syscall.Errno = 539 + ERROR_WX86_ERROR syscall.Errno = 540 + ERROR_TIMER_NOT_CANCELED syscall.Errno = 541 + ERROR_UNWIND syscall.Errno = 542 + ERROR_BAD_STACK syscall.Errno = 543 + ERROR_INVALID_UNWIND_TARGET syscall.Errno = 544 + ERROR_INVALID_PORT_ATTRIBUTES syscall.Errno = 545 + ERROR_PORT_MESSAGE_TOO_LONG syscall.Errno = 546 + ERROR_INVALID_QUOTA_LOWER syscall.Errno = 547 + ERROR_DEVICE_ALREADY_ATTACHED syscall.Errno = 548 + ERROR_INSTRUCTION_MISALIGNMENT syscall.Errno = 549 + ERROR_PROFILING_NOT_STARTED syscall.Errno = 550 + ERROR_PROFILING_NOT_STOPPED syscall.Errno = 551 + ERROR_COULD_NOT_INTERPRET syscall.Errno = 552 + ERROR_PROFILING_AT_LIMIT syscall.Errno = 553 + ERROR_CANT_WAIT syscall.Errno = 554 + ERROR_CANT_TERMINATE_SELF syscall.Errno = 555 + ERROR_UNEXPECTED_MM_CREATE_ERR syscall.Errno = 556 + ERROR_UNEXPECTED_MM_MAP_ERROR syscall.Errno = 557 + ERROR_UNEXPECTED_MM_EXTEND_ERR syscall.Errno = 558 + ERROR_BAD_FUNCTION_TABLE syscall.Errno = 559 + ERROR_NO_GUID_TRANSLATION syscall.Errno = 560 + ERROR_INVALID_LDT_SIZE syscall.Errno = 561 + ERROR_INVALID_LDT_OFFSET syscall.Errno = 563 + ERROR_INVALID_LDT_DESCRIPTOR syscall.Errno = 564 + ERROR_TOO_MANY_THREADS syscall.Errno = 565 + ERROR_THREAD_NOT_IN_PROCESS syscall.Errno = 566 + ERROR_PAGEFILE_QUOTA_EXCEEDED syscall.Errno = 567 + ERROR_LOGON_SERVER_CONFLICT syscall.Errno = 568 + ERROR_SYNCHRONIZATION_REQUIRED syscall.Errno = 569 + ERROR_NET_OPEN_FAILED syscall.Errno = 570 + ERROR_IO_PRIVILEGE_FAILED syscall.Errno = 571 + ERROR_CONTROL_C_EXIT syscall.Errno = 572 + ERROR_MISSING_SYSTEMFILE syscall.Errno = 573 + ERROR_UNHANDLED_EXCEPTION syscall.Errno = 574 + ERROR_APP_INIT_FAILURE syscall.Errno = 575 + ERROR_PAGEFILE_CREATE_FAILED syscall.Errno = 576 + ERROR_INVALID_IMAGE_HASH syscall.Errno = 577 + ERROR_NO_PAGEFILE syscall.Errno = 578 + ERROR_ILLEGAL_FLOAT_CONTEXT syscall.Errno = 579 + ERROR_NO_EVENT_PAIR syscall.Errno = 580 + ERROR_DOMAIN_CTRLR_CONFIG_ERROR syscall.Errno = 581 + ERROR_ILLEGAL_CHARACTER syscall.Errno = 582 + ERROR_UNDEFINED_CHARACTER syscall.Errno = 583 + ERROR_FLOPPY_VOLUME syscall.Errno = 584 + ERROR_BIOS_FAILED_TO_CONNECT_INTERRUPT syscall.Errno = 585 + ERROR_BACKUP_CONTROLLER syscall.Errno = 586 + ERROR_MUTANT_LIMIT_EXCEEDED syscall.Errno = 587 + ERROR_FS_DRIVER_REQUIRED syscall.Errno = 588 + ERROR_CANNOT_LOAD_REGISTRY_FILE syscall.Errno = 589 + ERROR_DEBUG_ATTACH_FAILED syscall.Errno = 590 + ERROR_SYSTEM_PROCESS_TERMINATED syscall.Errno = 591 + ERROR_DATA_NOT_ACCEPTED syscall.Errno = 592 + ERROR_VDM_HARD_ERROR syscall.Errno = 593 + ERROR_DRIVER_CANCEL_TIMEOUT syscall.Errno = 594 + ERROR_REPLY_MESSAGE_MISMATCH syscall.Errno = 595 + ERROR_LOST_WRITEBEHIND_DATA syscall.Errno = 596 + ERROR_CLIENT_SERVER_PARAMETERS_INVALID syscall.Errno = 597 + ERROR_NOT_TINY_STREAM syscall.Errno = 598 + ERROR_STACK_OVERFLOW_READ syscall.Errno = 599 + ERROR_CONVERT_TO_LARGE syscall.Errno = 600 + ERROR_FOUND_OUT_OF_SCOPE syscall.Errno = 601 + ERROR_ALLOCATE_BUCKET syscall.Errno = 602 + ERROR_MARSHALL_OVERFLOW syscall.Errno = 603 + ERROR_INVALID_VARIANT syscall.Errno = 604 + ERROR_BAD_COMPRESSION_BUFFER syscall.Errno = 605 + ERROR_AUDIT_FAILED syscall.Errno = 606 + ERROR_TIMER_RESOLUTION_NOT_SET syscall.Errno = 607 + ERROR_INSUFFICIENT_LOGON_INFO syscall.Errno = 608 + ERROR_BAD_DLL_ENTRYPOINT syscall.Errno = 609 + ERROR_BAD_SERVICE_ENTRYPOINT syscall.Errno = 610 + ERROR_IP_ADDRESS_CONFLICT1 syscall.Errno = 611 + ERROR_IP_ADDRESS_CONFLICT2 syscall.Errno = 612 + ERROR_REGISTRY_QUOTA_LIMIT syscall.Errno = 613 + ERROR_NO_CALLBACK_ACTIVE syscall.Errno = 614 + ERROR_PWD_TOO_SHORT syscall.Errno = 615 + ERROR_PWD_TOO_RECENT syscall.Errno = 616 + ERROR_PWD_HISTORY_CONFLICT syscall.Errno = 617 + ERROR_UNSUPPORTED_COMPRESSION syscall.Errno = 618 + ERROR_INVALID_HW_PROFILE syscall.Errno = 619 + ERROR_INVALID_PLUGPLAY_DEVICE_PATH syscall.Errno = 620 + ERROR_QUOTA_LIST_INCONSISTENT syscall.Errno = 621 + ERROR_EVALUATION_EXPIRATION syscall.Errno = 622 + ERROR_ILLEGAL_DLL_RELOCATION syscall.Errno = 623 + ERROR_DLL_INIT_FAILED_LOGOFF syscall.Errno = 624 + ERROR_VALIDATE_CONTINUE syscall.Errno = 625 + ERROR_NO_MORE_MATCHES syscall.Errno = 626 + ERROR_RANGE_LIST_CONFLICT syscall.Errno = 627 + ERROR_SERVER_SID_MISMATCH syscall.Errno = 628 + ERROR_CANT_ENABLE_DENY_ONLY syscall.Errno = 629 + ERROR_FLOAT_MULTIPLE_FAULTS syscall.Errno = 630 + ERROR_FLOAT_MULTIPLE_TRAPS syscall.Errno = 631 + ERROR_NOINTERFACE syscall.Errno = 632 + ERROR_DRIVER_FAILED_SLEEP syscall.Errno = 633 + ERROR_CORRUPT_SYSTEM_FILE syscall.Errno = 634 + ERROR_COMMITMENT_MINIMUM syscall.Errno = 635 + ERROR_PNP_RESTART_ENUMERATION syscall.Errno = 636 + ERROR_SYSTEM_IMAGE_BAD_SIGNATURE syscall.Errno = 637 + ERROR_PNP_REBOOT_REQUIRED syscall.Errno = 638 + ERROR_INSUFFICIENT_POWER syscall.Errno = 639 + ERROR_MULTIPLE_FAULT_VIOLATION syscall.Errno = 640 + ERROR_SYSTEM_SHUTDOWN syscall.Errno = 641 + ERROR_PORT_NOT_SET syscall.Errno = 642 + ERROR_DS_VERSION_CHECK_FAILURE syscall.Errno = 643 + ERROR_RANGE_NOT_FOUND syscall.Errno = 644 + ERROR_NOT_SAFE_MODE_DRIVER syscall.Errno = 646 + ERROR_FAILED_DRIVER_ENTRY syscall.Errno = 647 + ERROR_DEVICE_ENUMERATION_ERROR syscall.Errno = 648 + ERROR_MOUNT_POINT_NOT_RESOLVED syscall.Errno = 649 + ERROR_INVALID_DEVICE_OBJECT_PARAMETER syscall.Errno = 650 + ERROR_MCA_OCCURED syscall.Errno = 651 + ERROR_DRIVER_DATABASE_ERROR syscall.Errno = 652 + ERROR_SYSTEM_HIVE_TOO_LARGE syscall.Errno = 653 + ERROR_DRIVER_FAILED_PRIOR_UNLOAD syscall.Errno = 654 + ERROR_VOLSNAP_PREPARE_HIBERNATE syscall.Errno = 655 + ERROR_HIBERNATION_FAILURE syscall.Errno = 656 + ERROR_PWD_TOO_LONG syscall.Errno = 657 + ERROR_FILE_SYSTEM_LIMITATION syscall.Errno = 665 + ERROR_ASSERTION_FAILURE syscall.Errno = 668 + ERROR_ACPI_ERROR syscall.Errno = 669 + ERROR_WOW_ASSERTION syscall.Errno = 670 + ERROR_PNP_BAD_MPS_TABLE syscall.Errno = 671 + ERROR_PNP_TRANSLATION_FAILED syscall.Errno = 672 + ERROR_PNP_IRQ_TRANSLATION_FAILED syscall.Errno = 673 + ERROR_PNP_INVALID_ID syscall.Errno = 674 + ERROR_WAKE_SYSTEM_DEBUGGER syscall.Errno = 675 + ERROR_HANDLES_CLOSED syscall.Errno = 676 + ERROR_EXTRANEOUS_INFORMATION syscall.Errno = 677 + ERROR_RXACT_COMMIT_NECESSARY syscall.Errno = 678 + ERROR_MEDIA_CHECK syscall.Errno = 679 + ERROR_GUID_SUBSTITUTION_MADE syscall.Errno = 680 + ERROR_STOPPED_ON_SYMLINK syscall.Errno = 681 + ERROR_LONGJUMP syscall.Errno = 682 + ERROR_PLUGPLAY_QUERY_VETOED syscall.Errno = 683 + ERROR_UNWIND_CONSOLIDATE syscall.Errno = 684 + ERROR_REGISTRY_HIVE_RECOVERED syscall.Errno = 685 + ERROR_DLL_MIGHT_BE_INSECURE syscall.Errno = 686 + ERROR_DLL_MIGHT_BE_INCOMPATIBLE syscall.Errno = 687 + ERROR_DBG_EXCEPTION_NOT_HANDLED syscall.Errno = 688 + ERROR_DBG_REPLY_LATER syscall.Errno = 689 + ERROR_DBG_UNABLE_TO_PROVIDE_HANDLE syscall.Errno = 690 + ERROR_DBG_TERMINATE_THREAD syscall.Errno = 691 + ERROR_DBG_TERMINATE_PROCESS syscall.Errno = 692 + ERROR_DBG_CONTROL_C syscall.Errno = 693 + ERROR_DBG_PRINTEXCEPTION_C syscall.Errno = 694 + ERROR_DBG_RIPEXCEPTION syscall.Errno = 695 + ERROR_DBG_CONTROL_BREAK syscall.Errno = 696 + ERROR_DBG_COMMAND_EXCEPTION syscall.Errno = 697 + ERROR_OBJECT_NAME_EXISTS syscall.Errno = 698 + ERROR_THREAD_WAS_SUSPENDED syscall.Errno = 699 + ERROR_IMAGE_NOT_AT_BASE syscall.Errno = 700 + ERROR_RXACT_STATE_CREATED syscall.Errno = 701 + ERROR_SEGMENT_NOTIFICATION syscall.Errno = 702 + ERROR_BAD_CURRENT_DIRECTORY syscall.Errno = 703 + ERROR_FT_READ_RECOVERY_FROM_BACKUP syscall.Errno = 704 + ERROR_FT_WRITE_RECOVERY syscall.Errno = 705 + ERROR_IMAGE_MACHINE_TYPE_MISMATCH syscall.Errno = 706 + ERROR_RECEIVE_PARTIAL syscall.Errno = 707 + ERROR_RECEIVE_EXPEDITED syscall.Errno = 708 + ERROR_RECEIVE_PARTIAL_EXPEDITED syscall.Errno = 709 + ERROR_EVENT_DONE syscall.Errno = 710 + ERROR_EVENT_PENDING syscall.Errno = 711 + ERROR_CHECKING_FILE_SYSTEM syscall.Errno = 712 + ERROR_FATAL_APP_EXIT syscall.Errno = 713 + ERROR_PREDEFINED_HANDLE syscall.Errno = 714 + ERROR_WAS_UNLOCKED syscall.Errno = 715 + ERROR_SERVICE_NOTIFICATION syscall.Errno = 716 + ERROR_WAS_LOCKED syscall.Errno = 717 + ERROR_LOG_HARD_ERROR syscall.Errno = 718 + ERROR_ALREADY_WIN32 syscall.Errno = 719 + ERROR_IMAGE_MACHINE_TYPE_MISMATCH_EXE syscall.Errno = 720 + ERROR_NO_YIELD_PERFORMED syscall.Errno = 721 + ERROR_TIMER_RESUME_IGNORED syscall.Errno = 722 + ERROR_ARBITRATION_UNHANDLED syscall.Errno = 723 + ERROR_CARDBUS_NOT_SUPPORTED syscall.Errno = 724 + ERROR_MP_PROCESSOR_MISMATCH syscall.Errno = 725 + ERROR_HIBERNATED syscall.Errno = 726 + ERROR_RESUME_HIBERNATION syscall.Errno = 727 + ERROR_FIRMWARE_UPDATED syscall.Errno = 728 + ERROR_DRIVERS_LEAKING_LOCKED_PAGES syscall.Errno = 729 + ERROR_WAKE_SYSTEM syscall.Errno = 730 + ERROR_WAIT_1 syscall.Errno = 731 + ERROR_WAIT_2 syscall.Errno = 732 + ERROR_WAIT_3 syscall.Errno = 733 + ERROR_WAIT_63 syscall.Errno = 734 + ERROR_ABANDONED_WAIT_0 syscall.Errno = 735 + ERROR_ABANDONED_WAIT_63 syscall.Errno = 736 + ERROR_USER_APC syscall.Errno = 737 + ERROR_KERNEL_APC syscall.Errno = 738 + ERROR_ALERTED syscall.Errno = 739 + ERROR_ELEVATION_REQUIRED syscall.Errno = 740 + ERROR_REPARSE syscall.Errno = 741 + ERROR_OPLOCK_BREAK_IN_PROGRESS syscall.Errno = 742 + ERROR_VOLUME_MOUNTED syscall.Errno = 743 + ERROR_RXACT_COMMITTED syscall.Errno = 744 + ERROR_NOTIFY_CLEANUP syscall.Errno = 745 + ERROR_PRIMARY_TRANSPORT_CONNECT_FAILED syscall.Errno = 746 + ERROR_PAGE_FAULT_TRANSITION syscall.Errno = 747 + ERROR_PAGE_FAULT_DEMAND_ZERO syscall.Errno = 748 + ERROR_PAGE_FAULT_COPY_ON_WRITE syscall.Errno = 749 + ERROR_PAGE_FAULT_GUARD_PAGE syscall.Errno = 750 + ERROR_PAGE_FAULT_PAGING_FILE syscall.Errno = 751 + ERROR_CACHE_PAGE_LOCKED syscall.Errno = 752 + ERROR_CRASH_DUMP syscall.Errno = 753 + ERROR_BUFFER_ALL_ZEROS syscall.Errno = 754 + ERROR_REPARSE_OBJECT syscall.Errno = 755 + ERROR_RESOURCE_REQUIREMENTS_CHANGED syscall.Errno = 756 + ERROR_TRANSLATION_COMPLETE syscall.Errno = 757 + ERROR_NOTHING_TO_TERMINATE syscall.Errno = 758 + ERROR_PROCESS_NOT_IN_JOB syscall.Errno = 759 + ERROR_PROCESS_IN_JOB syscall.Errno = 760 + ERROR_VOLSNAP_HIBERNATE_READY syscall.Errno = 761 + ERROR_FSFILTER_OP_COMPLETED_SUCCESSFULLY syscall.Errno = 762 + ERROR_INTERRUPT_VECTOR_ALREADY_CONNECTED syscall.Errno = 763 + ERROR_INTERRUPT_STILL_CONNECTED syscall.Errno = 764 + ERROR_WAIT_FOR_OPLOCK syscall.Errno = 765 + ERROR_DBG_EXCEPTION_HANDLED syscall.Errno = 766 + ERROR_DBG_CONTINUE syscall.Errno = 767 + ERROR_CALLBACK_POP_STACK syscall.Errno = 768 + ERROR_COMPRESSION_DISABLED syscall.Errno = 769 + ERROR_CANTFETCHBACKWARDS syscall.Errno = 770 + ERROR_CANTSCROLLBACKWARDS syscall.Errno = 771 + ERROR_ROWSNOTRELEASED syscall.Errno = 772 + ERROR_BAD_ACCESSOR_FLAGS syscall.Errno = 773 + ERROR_ERRORS_ENCOUNTERED syscall.Errno = 774 + ERROR_NOT_CAPABLE syscall.Errno = 775 + ERROR_REQUEST_OUT_OF_SEQUENCE syscall.Errno = 776 + ERROR_VERSION_PARSE_ERROR syscall.Errno = 777 + ERROR_BADSTARTPOSITION syscall.Errno = 778 + ERROR_MEMORY_HARDWARE syscall.Errno = 779 + ERROR_DISK_REPAIR_DISABLED syscall.Errno = 780 + ERROR_INSUFFICIENT_RESOURCE_FOR_SPECIFIED_SHARED_SECTION_SIZE syscall.Errno = 781 + ERROR_SYSTEM_POWERSTATE_TRANSITION syscall.Errno = 782 + ERROR_SYSTEM_POWERSTATE_COMPLEX_TRANSITION syscall.Errno = 783 + ERROR_MCA_EXCEPTION syscall.Errno = 784 + ERROR_ACCESS_AUDIT_BY_POLICY syscall.Errno = 785 + ERROR_ACCESS_DISABLED_NO_SAFER_UI_BY_POLICY syscall.Errno = 786 + ERROR_ABANDON_HIBERFILE syscall.Errno = 787 + ERROR_LOST_WRITEBEHIND_DATA_NETWORK_DISCONNECTED syscall.Errno = 788 + ERROR_LOST_WRITEBEHIND_DATA_NETWORK_SERVER_ERROR syscall.Errno = 789 + ERROR_LOST_WRITEBEHIND_DATA_LOCAL_DISK_ERROR syscall.Errno = 790 + ERROR_BAD_MCFG_TABLE syscall.Errno = 791 + ERROR_DISK_REPAIR_REDIRECTED syscall.Errno = 792 + ERROR_DISK_REPAIR_UNSUCCESSFUL syscall.Errno = 793 + ERROR_CORRUPT_LOG_OVERFULL syscall.Errno = 794 + ERROR_CORRUPT_LOG_CORRUPTED syscall.Errno = 795 + ERROR_CORRUPT_LOG_UNAVAILABLE syscall.Errno = 796 + ERROR_CORRUPT_LOG_DELETED_FULL syscall.Errno = 797 + ERROR_CORRUPT_LOG_CLEARED syscall.Errno = 798 + ERROR_ORPHAN_NAME_EXHAUSTED syscall.Errno = 799 + ERROR_OPLOCK_SWITCHED_TO_NEW_HANDLE syscall.Errno = 800 + ERROR_CANNOT_GRANT_REQUESTED_OPLOCK syscall.Errno = 801 + ERROR_CANNOT_BREAK_OPLOCK syscall.Errno = 802 + ERROR_OPLOCK_HANDLE_CLOSED syscall.Errno = 803 + ERROR_NO_ACE_CONDITION syscall.Errno = 804 + ERROR_INVALID_ACE_CONDITION syscall.Errno = 805 + ERROR_FILE_HANDLE_REVOKED syscall.Errno = 806 + ERROR_IMAGE_AT_DIFFERENT_BASE syscall.Errno = 807 + ERROR_ENCRYPTED_IO_NOT_POSSIBLE syscall.Errno = 808 + ERROR_FILE_METADATA_OPTIMIZATION_IN_PROGRESS syscall.Errno = 809 + ERROR_QUOTA_ACTIVITY syscall.Errno = 810 + ERROR_HANDLE_REVOKED syscall.Errno = 811 + ERROR_CALLBACK_INVOKE_INLINE syscall.Errno = 812 + ERROR_CPU_SET_INVALID syscall.Errno = 813 + ERROR_ENCLAVE_NOT_TERMINATED syscall.Errno = 814 + ERROR_ENCLAVE_VIOLATION syscall.Errno = 815 + ERROR_EA_ACCESS_DENIED syscall.Errno = 994 + ERROR_OPERATION_ABORTED syscall.Errno = 995 + ERROR_IO_INCOMPLETE syscall.Errno = 996 + ERROR_IO_PENDING syscall.Errno = 997 + ERROR_NOACCESS syscall.Errno = 998 + ERROR_SWAPERROR syscall.Errno = 999 + ERROR_STACK_OVERFLOW syscall.Errno = 1001 + ERROR_INVALID_MESSAGE syscall.Errno = 1002 + ERROR_CAN_NOT_COMPLETE syscall.Errno = 1003 + ERROR_INVALID_FLAGS syscall.Errno = 1004 + ERROR_UNRECOGNIZED_VOLUME syscall.Errno = 1005 + ERROR_FILE_INVALID syscall.Errno = 1006 + ERROR_FULLSCREEN_MODE syscall.Errno = 1007 + ERROR_NO_TOKEN syscall.Errno = 1008 + ERROR_BADDB syscall.Errno = 1009 + ERROR_BADKEY syscall.Errno = 1010 + ERROR_CANTOPEN syscall.Errno = 1011 + ERROR_CANTREAD syscall.Errno = 1012 + ERROR_CANTWRITE syscall.Errno = 1013 + ERROR_REGISTRY_RECOVERED syscall.Errno = 1014 + ERROR_REGISTRY_CORRUPT syscall.Errno = 1015 + ERROR_REGISTRY_IO_FAILED syscall.Errno = 1016 + ERROR_NOT_REGISTRY_FILE syscall.Errno = 1017 + ERROR_KEY_DELETED syscall.Errno = 1018 + ERROR_NO_LOG_SPACE syscall.Errno = 1019 + ERROR_KEY_HAS_CHILDREN syscall.Errno = 1020 + ERROR_CHILD_MUST_BE_VOLATILE syscall.Errno = 1021 + ERROR_NOTIFY_ENUM_DIR syscall.Errno = 1022 + ERROR_DEPENDENT_SERVICES_RUNNING syscall.Errno = 1051 + ERROR_INVALID_SERVICE_CONTROL syscall.Errno = 1052 + ERROR_SERVICE_REQUEST_TIMEOUT syscall.Errno = 1053 + ERROR_SERVICE_NO_THREAD syscall.Errno = 1054 + ERROR_SERVICE_DATABASE_LOCKED syscall.Errno = 1055 + ERROR_SERVICE_ALREADY_RUNNING syscall.Errno = 1056 + ERROR_INVALID_SERVICE_ACCOUNT syscall.Errno = 1057 + ERROR_SERVICE_DISABLED syscall.Errno = 1058 + ERROR_CIRCULAR_DEPENDENCY syscall.Errno = 1059 + ERROR_SERVICE_DOES_NOT_EXIST syscall.Errno = 1060 + ERROR_SERVICE_CANNOT_ACCEPT_CTRL syscall.Errno = 1061 + ERROR_SERVICE_NOT_ACTIVE syscall.Errno = 1062 + ERROR_FAILED_SERVICE_CONTROLLER_CONNECT syscall.Errno = 1063 + ERROR_EXCEPTION_IN_SERVICE syscall.Errno = 1064 + ERROR_DATABASE_DOES_NOT_EXIST syscall.Errno = 1065 + ERROR_SERVICE_SPECIFIC_ERROR syscall.Errno = 1066 + ERROR_PROCESS_ABORTED syscall.Errno = 1067 + ERROR_SERVICE_DEPENDENCY_FAIL syscall.Errno = 1068 + ERROR_SERVICE_LOGON_FAILED syscall.Errno = 1069 + ERROR_SERVICE_START_HANG syscall.Errno = 1070 + ERROR_INVALID_SERVICE_LOCK syscall.Errno = 1071 + ERROR_SERVICE_MARKED_FOR_DELETE syscall.Errno = 1072 + ERROR_SERVICE_EXISTS syscall.Errno = 1073 + ERROR_ALREADY_RUNNING_LKG syscall.Errno = 1074 + ERROR_SERVICE_DEPENDENCY_DELETED syscall.Errno = 1075 + ERROR_BOOT_ALREADY_ACCEPTED syscall.Errno = 1076 + ERROR_SERVICE_NEVER_STARTED syscall.Errno = 1077 + ERROR_DUPLICATE_SERVICE_NAME syscall.Errno = 1078 + ERROR_DIFFERENT_SERVICE_ACCOUNT syscall.Errno = 1079 + ERROR_CANNOT_DETECT_DRIVER_FAILURE syscall.Errno = 1080 + ERROR_CANNOT_DETECT_PROCESS_ABORT syscall.Errno = 1081 + ERROR_NO_RECOVERY_PROGRAM syscall.Errno = 1082 + ERROR_SERVICE_NOT_IN_EXE syscall.Errno = 1083 + ERROR_NOT_SAFEBOOT_SERVICE syscall.Errno = 1084 + ERROR_END_OF_MEDIA syscall.Errno = 1100 + ERROR_FILEMARK_DETECTED syscall.Errno = 1101 + ERROR_BEGINNING_OF_MEDIA syscall.Errno = 1102 + ERROR_SETMARK_DETECTED syscall.Errno = 1103 + ERROR_NO_DATA_DETECTED syscall.Errno = 1104 + ERROR_PARTITION_FAILURE syscall.Errno = 1105 + ERROR_INVALID_BLOCK_LENGTH syscall.Errno = 1106 + ERROR_DEVICE_NOT_PARTITIONED syscall.Errno = 1107 + ERROR_UNABLE_TO_LOCK_MEDIA syscall.Errno = 1108 + ERROR_UNABLE_TO_UNLOAD_MEDIA syscall.Errno = 1109 + ERROR_MEDIA_CHANGED syscall.Errno = 1110 + ERROR_BUS_RESET syscall.Errno = 1111 + ERROR_NO_MEDIA_IN_DRIVE syscall.Errno = 1112 + ERROR_NO_UNICODE_TRANSLATION syscall.Errno = 1113 + ERROR_DLL_INIT_FAILED syscall.Errno = 1114 + ERROR_SHUTDOWN_IN_PROGRESS syscall.Errno = 1115 + ERROR_NO_SHUTDOWN_IN_PROGRESS syscall.Errno = 1116 + ERROR_IO_DEVICE syscall.Errno = 1117 + ERROR_SERIAL_NO_DEVICE syscall.Errno = 1118 + ERROR_IRQ_BUSY syscall.Errno = 1119 + ERROR_MORE_WRITES syscall.Errno = 1120 + ERROR_COUNTER_TIMEOUT syscall.Errno = 1121 + ERROR_FLOPPY_ID_MARK_NOT_FOUND syscall.Errno = 1122 + ERROR_FLOPPY_WRONG_CYLINDER syscall.Errno = 1123 + ERROR_FLOPPY_UNKNOWN_ERROR syscall.Errno = 1124 + ERROR_FLOPPY_BAD_REGISTERS syscall.Errno = 1125 + ERROR_DISK_RECALIBRATE_FAILED syscall.Errno = 1126 + ERROR_DISK_OPERATION_FAILED syscall.Errno = 1127 + ERROR_DISK_RESET_FAILED syscall.Errno = 1128 + ERROR_EOM_OVERFLOW syscall.Errno = 1129 + ERROR_NOT_ENOUGH_SERVER_MEMORY syscall.Errno = 1130 + ERROR_POSSIBLE_DEADLOCK syscall.Errno = 1131 + ERROR_MAPPED_ALIGNMENT syscall.Errno = 1132 + ERROR_SET_POWER_STATE_VETOED syscall.Errno = 1140 + ERROR_SET_POWER_STATE_FAILED syscall.Errno = 1141 + ERROR_TOO_MANY_LINKS syscall.Errno = 1142 + ERROR_OLD_WIN_VERSION syscall.Errno = 1150 + ERROR_APP_WRONG_OS syscall.Errno = 1151 + ERROR_SINGLE_INSTANCE_APP syscall.Errno = 1152 + ERROR_RMODE_APP syscall.Errno = 1153 + ERROR_INVALID_DLL syscall.Errno = 1154 + ERROR_NO_ASSOCIATION syscall.Errno = 1155 + ERROR_DDE_FAIL syscall.Errno = 1156 + ERROR_DLL_NOT_FOUND syscall.Errno = 1157 + ERROR_NO_MORE_USER_HANDLES syscall.Errno = 1158 + ERROR_MESSAGE_SYNC_ONLY syscall.Errno = 1159 + ERROR_SOURCE_ELEMENT_EMPTY syscall.Errno = 1160 + ERROR_DESTINATION_ELEMENT_FULL syscall.Errno = 1161 + ERROR_ILLEGAL_ELEMENT_ADDRESS syscall.Errno = 1162 + ERROR_MAGAZINE_NOT_PRESENT syscall.Errno = 1163 + ERROR_DEVICE_REINITIALIZATION_NEEDED syscall.Errno = 1164 + ERROR_DEVICE_REQUIRES_CLEANING syscall.Errno = 1165 + ERROR_DEVICE_DOOR_OPEN syscall.Errno = 1166 + ERROR_DEVICE_NOT_CONNECTED syscall.Errno = 1167 + ERROR_NOT_FOUND syscall.Errno = 1168 + ERROR_NO_MATCH syscall.Errno = 1169 + ERROR_SET_NOT_FOUND syscall.Errno = 1170 + ERROR_POINT_NOT_FOUND syscall.Errno = 1171 + ERROR_NO_TRACKING_SERVICE syscall.Errno = 1172 + ERROR_NO_VOLUME_ID syscall.Errno = 1173 + ERROR_UNABLE_TO_REMOVE_REPLACED syscall.Errno = 1175 + ERROR_UNABLE_TO_MOVE_REPLACEMENT syscall.Errno = 1176 + ERROR_UNABLE_TO_MOVE_REPLACEMENT_2 syscall.Errno = 1177 + ERROR_JOURNAL_DELETE_IN_PROGRESS syscall.Errno = 1178 + ERROR_JOURNAL_NOT_ACTIVE syscall.Errno = 1179 + ERROR_POTENTIAL_FILE_FOUND syscall.Errno = 1180 + ERROR_JOURNAL_ENTRY_DELETED syscall.Errno = 1181 + ERROR_SHUTDOWN_IS_SCHEDULED syscall.Errno = 1190 + ERROR_SHUTDOWN_USERS_LOGGED_ON syscall.Errno = 1191 + ERROR_BAD_DEVICE syscall.Errno = 1200 + ERROR_CONNECTION_UNAVAIL syscall.Errno = 1201 + ERROR_DEVICE_ALREADY_REMEMBERED syscall.Errno = 1202 + ERROR_NO_NET_OR_BAD_PATH syscall.Errno = 1203 + ERROR_BAD_PROVIDER syscall.Errno = 1204 + ERROR_CANNOT_OPEN_PROFILE syscall.Errno = 1205 + ERROR_BAD_PROFILE syscall.Errno = 1206 + ERROR_NOT_CONTAINER syscall.Errno = 1207 + ERROR_EXTENDED_ERROR syscall.Errno = 1208 + ERROR_INVALID_GROUPNAME syscall.Errno = 1209 + ERROR_INVALID_COMPUTERNAME syscall.Errno = 1210 + ERROR_INVALID_EVENTNAME syscall.Errno = 1211 + ERROR_INVALID_DOMAINNAME syscall.Errno = 1212 + ERROR_INVALID_SERVICENAME syscall.Errno = 1213 + ERROR_INVALID_NETNAME syscall.Errno = 1214 + ERROR_INVALID_SHARENAME syscall.Errno = 1215 + ERROR_INVALID_PASSWORDNAME syscall.Errno = 1216 + ERROR_INVALID_MESSAGENAME syscall.Errno = 1217 + ERROR_INVALID_MESSAGEDEST syscall.Errno = 1218 + ERROR_SESSION_CREDENTIAL_CONFLICT syscall.Errno = 1219 + ERROR_REMOTE_SESSION_LIMIT_EXCEEDED syscall.Errno = 1220 + ERROR_DUP_DOMAINNAME syscall.Errno = 1221 + ERROR_NO_NETWORK syscall.Errno = 1222 + ERROR_CANCELLED syscall.Errno = 1223 + ERROR_USER_MAPPED_FILE syscall.Errno = 1224 + ERROR_CONNECTION_REFUSED syscall.Errno = 1225 + ERROR_GRACEFUL_DISCONNECT syscall.Errno = 1226 + ERROR_ADDRESS_ALREADY_ASSOCIATED syscall.Errno = 1227 + ERROR_ADDRESS_NOT_ASSOCIATED syscall.Errno = 1228 + ERROR_CONNECTION_INVALID syscall.Errno = 1229 + ERROR_CONNECTION_ACTIVE syscall.Errno = 1230 + ERROR_NETWORK_UNREACHABLE syscall.Errno = 1231 + ERROR_HOST_UNREACHABLE syscall.Errno = 1232 + ERROR_PROTOCOL_UNREACHABLE syscall.Errno = 1233 + ERROR_PORT_UNREACHABLE syscall.Errno = 1234 + ERROR_REQUEST_ABORTED syscall.Errno = 1235 + ERROR_CONNECTION_ABORTED syscall.Errno = 1236 + ERROR_RETRY syscall.Errno = 1237 + ERROR_CONNECTION_COUNT_LIMIT syscall.Errno = 1238 + ERROR_LOGIN_TIME_RESTRICTION syscall.Errno = 1239 + ERROR_LOGIN_WKSTA_RESTRICTION syscall.Errno = 1240 + ERROR_INCORRECT_ADDRESS syscall.Errno = 1241 + ERROR_ALREADY_REGISTERED syscall.Errno = 1242 + ERROR_SERVICE_NOT_FOUND syscall.Errno = 1243 + ERROR_NOT_AUTHENTICATED syscall.Errno = 1244 + ERROR_NOT_LOGGED_ON syscall.Errno = 1245 + ERROR_CONTINUE syscall.Errno = 1246 + ERROR_ALREADY_INITIALIZED syscall.Errno = 1247 + ERROR_NO_MORE_DEVICES syscall.Errno = 1248 + ERROR_NO_SUCH_SITE syscall.Errno = 1249 + ERROR_DOMAIN_CONTROLLER_EXISTS syscall.Errno = 1250 + ERROR_ONLY_IF_CONNECTED syscall.Errno = 1251 + ERROR_OVERRIDE_NOCHANGES syscall.Errno = 1252 + ERROR_BAD_USER_PROFILE syscall.Errno = 1253 + ERROR_NOT_SUPPORTED_ON_SBS syscall.Errno = 1254 + ERROR_SERVER_SHUTDOWN_IN_PROGRESS syscall.Errno = 1255 + ERROR_HOST_DOWN syscall.Errno = 1256 + ERROR_NON_ACCOUNT_SID syscall.Errno = 1257 + ERROR_NON_DOMAIN_SID syscall.Errno = 1258 + ERROR_APPHELP_BLOCK syscall.Errno = 1259 + ERROR_ACCESS_DISABLED_BY_POLICY syscall.Errno = 1260 + ERROR_REG_NAT_CONSUMPTION syscall.Errno = 1261 + ERROR_CSCSHARE_OFFLINE syscall.Errno = 1262 + ERROR_PKINIT_FAILURE syscall.Errno = 1263 + ERROR_SMARTCARD_SUBSYSTEM_FAILURE syscall.Errno = 1264 + ERROR_DOWNGRADE_DETECTED syscall.Errno = 1265 + ERROR_MACHINE_LOCKED syscall.Errno = 1271 + ERROR_SMB_GUEST_LOGON_BLOCKED syscall.Errno = 1272 + ERROR_CALLBACK_SUPPLIED_INVALID_DATA syscall.Errno = 1273 + ERROR_SYNC_FOREGROUND_REFRESH_REQUIRED syscall.Errno = 1274 + ERROR_DRIVER_BLOCKED syscall.Errno = 1275 + ERROR_INVALID_IMPORT_OF_NON_DLL syscall.Errno = 1276 + ERROR_ACCESS_DISABLED_WEBBLADE syscall.Errno = 1277 + ERROR_ACCESS_DISABLED_WEBBLADE_TAMPER syscall.Errno = 1278 + ERROR_RECOVERY_FAILURE syscall.Errno = 1279 + ERROR_ALREADY_FIBER syscall.Errno = 1280 + ERROR_ALREADY_THREAD syscall.Errno = 1281 + ERROR_STACK_BUFFER_OVERRUN syscall.Errno = 1282 + ERROR_PARAMETER_QUOTA_EXCEEDED syscall.Errno = 1283 + ERROR_DEBUGGER_INACTIVE syscall.Errno = 1284 + ERROR_DELAY_LOAD_FAILED syscall.Errno = 1285 + ERROR_VDM_DISALLOWED syscall.Errno = 1286 + ERROR_UNIDENTIFIED_ERROR syscall.Errno = 1287 + ERROR_INVALID_CRUNTIME_PARAMETER syscall.Errno = 1288 + ERROR_BEYOND_VDL syscall.Errno = 1289 + ERROR_INCOMPATIBLE_SERVICE_SID_TYPE syscall.Errno = 1290 + ERROR_DRIVER_PROCESS_TERMINATED syscall.Errno = 1291 + ERROR_IMPLEMENTATION_LIMIT syscall.Errno = 1292 + ERROR_PROCESS_IS_PROTECTED syscall.Errno = 1293 + ERROR_SERVICE_NOTIFY_CLIENT_LAGGING syscall.Errno = 1294 + ERROR_DISK_QUOTA_EXCEEDED syscall.Errno = 1295 + ERROR_CONTENT_BLOCKED syscall.Errno = 1296 + ERROR_INCOMPATIBLE_SERVICE_PRIVILEGE syscall.Errno = 1297 + ERROR_APP_HANG syscall.Errno = 1298 + ERROR_INVALID_LABEL syscall.Errno = 1299 + ERROR_NOT_ALL_ASSIGNED syscall.Errno = 1300 + ERROR_SOME_NOT_MAPPED syscall.Errno = 1301 + ERROR_NO_QUOTAS_FOR_ACCOUNT syscall.Errno = 1302 + ERROR_LOCAL_USER_SESSION_KEY syscall.Errno = 1303 + ERROR_NULL_LM_PASSWORD syscall.Errno = 1304 + ERROR_UNKNOWN_REVISION syscall.Errno = 1305 + ERROR_REVISION_MISMATCH syscall.Errno = 1306 + ERROR_INVALID_OWNER syscall.Errno = 1307 + ERROR_INVALID_PRIMARY_GROUP syscall.Errno = 1308 + ERROR_NO_IMPERSONATION_TOKEN syscall.Errno = 1309 + ERROR_CANT_DISABLE_MANDATORY syscall.Errno = 1310 + ERROR_NO_LOGON_SERVERS syscall.Errno = 1311 + ERROR_NO_SUCH_LOGON_SESSION syscall.Errno = 1312 + ERROR_NO_SUCH_PRIVILEGE syscall.Errno = 1313 + ERROR_PRIVILEGE_NOT_HELD syscall.Errno = 1314 + ERROR_INVALID_ACCOUNT_NAME syscall.Errno = 1315 + ERROR_USER_EXISTS syscall.Errno = 1316 + ERROR_NO_SUCH_USER syscall.Errno = 1317 + ERROR_GROUP_EXISTS syscall.Errno = 1318 + ERROR_NO_SUCH_GROUP syscall.Errno = 1319 + ERROR_MEMBER_IN_GROUP syscall.Errno = 1320 + ERROR_MEMBER_NOT_IN_GROUP syscall.Errno = 1321 + ERROR_LAST_ADMIN syscall.Errno = 1322 + ERROR_WRONG_PASSWORD syscall.Errno = 1323 + ERROR_ILL_FORMED_PASSWORD syscall.Errno = 1324 + ERROR_PASSWORD_RESTRICTION syscall.Errno = 1325 + ERROR_LOGON_FAILURE syscall.Errno = 1326 + ERROR_ACCOUNT_RESTRICTION syscall.Errno = 1327 + ERROR_INVALID_LOGON_HOURS syscall.Errno = 1328 + ERROR_INVALID_WORKSTATION syscall.Errno = 1329 + ERROR_PASSWORD_EXPIRED syscall.Errno = 1330 + ERROR_ACCOUNT_DISABLED syscall.Errno = 1331 + ERROR_NONE_MAPPED syscall.Errno = 1332 + ERROR_TOO_MANY_LUIDS_REQUESTED syscall.Errno = 1333 + ERROR_LUIDS_EXHAUSTED syscall.Errno = 1334 + ERROR_INVALID_SUB_AUTHORITY syscall.Errno = 1335 + ERROR_INVALID_ACL syscall.Errno = 1336 + ERROR_INVALID_SID syscall.Errno = 1337 + ERROR_INVALID_SECURITY_DESCR syscall.Errno = 1338 + ERROR_BAD_INHERITANCE_ACL syscall.Errno = 1340 + ERROR_SERVER_DISABLED syscall.Errno = 1341 + ERROR_SERVER_NOT_DISABLED syscall.Errno = 1342 + ERROR_INVALID_ID_AUTHORITY syscall.Errno = 1343 + ERROR_ALLOTTED_SPACE_EXCEEDED syscall.Errno = 1344 + ERROR_INVALID_GROUP_ATTRIBUTES syscall.Errno = 1345 + ERROR_BAD_IMPERSONATION_LEVEL syscall.Errno = 1346 + ERROR_CANT_OPEN_ANONYMOUS syscall.Errno = 1347 + ERROR_BAD_VALIDATION_CLASS syscall.Errno = 1348 + ERROR_BAD_TOKEN_TYPE syscall.Errno = 1349 + ERROR_NO_SECURITY_ON_OBJECT syscall.Errno = 1350 + ERROR_CANT_ACCESS_DOMAIN_INFO syscall.Errno = 1351 + ERROR_INVALID_SERVER_STATE syscall.Errno = 1352 + ERROR_INVALID_DOMAIN_STATE syscall.Errno = 1353 + ERROR_INVALID_DOMAIN_ROLE syscall.Errno = 1354 + ERROR_NO_SUCH_DOMAIN syscall.Errno = 1355 + ERROR_DOMAIN_EXISTS syscall.Errno = 1356 + ERROR_DOMAIN_LIMIT_EXCEEDED syscall.Errno = 1357 + ERROR_INTERNAL_DB_CORRUPTION syscall.Errno = 1358 + ERROR_INTERNAL_ERROR syscall.Errno = 1359 + ERROR_GENERIC_NOT_MAPPED syscall.Errno = 1360 + ERROR_BAD_DESCRIPTOR_FORMAT syscall.Errno = 1361 + ERROR_NOT_LOGON_PROCESS syscall.Errno = 1362 + ERROR_LOGON_SESSION_EXISTS syscall.Errno = 1363 + ERROR_NO_SUCH_PACKAGE syscall.Errno = 1364 + ERROR_BAD_LOGON_SESSION_STATE syscall.Errno = 1365 + ERROR_LOGON_SESSION_COLLISION syscall.Errno = 1366 + ERROR_INVALID_LOGON_TYPE syscall.Errno = 1367 + ERROR_CANNOT_IMPERSONATE syscall.Errno = 1368 + ERROR_RXACT_INVALID_STATE syscall.Errno = 1369 + ERROR_RXACT_COMMIT_FAILURE syscall.Errno = 1370 + ERROR_SPECIAL_ACCOUNT syscall.Errno = 1371 + ERROR_SPECIAL_GROUP syscall.Errno = 1372 + ERROR_SPECIAL_USER syscall.Errno = 1373 + ERROR_MEMBERS_PRIMARY_GROUP syscall.Errno = 1374 + ERROR_TOKEN_ALREADY_IN_USE syscall.Errno = 1375 + ERROR_NO_SUCH_ALIAS syscall.Errno = 1376 + ERROR_MEMBER_NOT_IN_ALIAS syscall.Errno = 1377 + ERROR_MEMBER_IN_ALIAS syscall.Errno = 1378 + ERROR_ALIAS_EXISTS syscall.Errno = 1379 + ERROR_LOGON_NOT_GRANTED syscall.Errno = 1380 + ERROR_TOO_MANY_SECRETS syscall.Errno = 1381 + ERROR_SECRET_TOO_LONG syscall.Errno = 1382 + ERROR_INTERNAL_DB_ERROR syscall.Errno = 1383 + ERROR_TOO_MANY_CONTEXT_IDS syscall.Errno = 1384 + ERROR_LOGON_TYPE_NOT_GRANTED syscall.Errno = 1385 + ERROR_NT_CROSS_ENCRYPTION_REQUIRED syscall.Errno = 1386 + ERROR_NO_SUCH_MEMBER syscall.Errno = 1387 + ERROR_INVALID_MEMBER syscall.Errno = 1388 + ERROR_TOO_MANY_SIDS syscall.Errno = 1389 + ERROR_LM_CROSS_ENCRYPTION_REQUIRED syscall.Errno = 1390 + ERROR_NO_INHERITANCE syscall.Errno = 1391 + ERROR_FILE_CORRUPT syscall.Errno = 1392 + ERROR_DISK_CORRUPT syscall.Errno = 1393 + ERROR_NO_USER_SESSION_KEY syscall.Errno = 1394 + ERROR_LICENSE_QUOTA_EXCEEDED syscall.Errno = 1395 + ERROR_WRONG_TARGET_NAME syscall.Errno = 1396 + ERROR_MUTUAL_AUTH_FAILED syscall.Errno = 1397 + ERROR_TIME_SKEW syscall.Errno = 1398 + ERROR_CURRENT_DOMAIN_NOT_ALLOWED syscall.Errno = 1399 + ERROR_INVALID_WINDOW_HANDLE syscall.Errno = 1400 + ERROR_INVALID_MENU_HANDLE syscall.Errno = 1401 + ERROR_INVALID_CURSOR_HANDLE syscall.Errno = 1402 + ERROR_INVALID_ACCEL_HANDLE syscall.Errno = 1403 + ERROR_INVALID_HOOK_HANDLE syscall.Errno = 1404 + ERROR_INVALID_DWP_HANDLE syscall.Errno = 1405 + ERROR_TLW_WITH_WSCHILD syscall.Errno = 1406 + ERROR_CANNOT_FIND_WND_CLASS syscall.Errno = 1407 + ERROR_WINDOW_OF_OTHER_THREAD syscall.Errno = 1408 + ERROR_HOTKEY_ALREADY_REGISTERED syscall.Errno = 1409 + ERROR_CLASS_ALREADY_EXISTS syscall.Errno = 1410 + ERROR_CLASS_DOES_NOT_EXIST syscall.Errno = 1411 + ERROR_CLASS_HAS_WINDOWS syscall.Errno = 1412 + ERROR_INVALID_INDEX syscall.Errno = 1413 + ERROR_INVALID_ICON_HANDLE syscall.Errno = 1414 + ERROR_PRIVATE_DIALOG_INDEX syscall.Errno = 1415 + ERROR_LISTBOX_ID_NOT_FOUND syscall.Errno = 1416 + ERROR_NO_WILDCARD_CHARACTERS syscall.Errno = 1417 + ERROR_CLIPBOARD_NOT_OPEN syscall.Errno = 1418 + ERROR_HOTKEY_NOT_REGISTERED syscall.Errno = 1419 + ERROR_WINDOW_NOT_DIALOG syscall.Errno = 1420 + ERROR_CONTROL_ID_NOT_FOUND syscall.Errno = 1421 + ERROR_INVALID_COMBOBOX_MESSAGE syscall.Errno = 1422 + ERROR_WINDOW_NOT_COMBOBOX syscall.Errno = 1423 + ERROR_INVALID_EDIT_HEIGHT syscall.Errno = 1424 + ERROR_DC_NOT_FOUND syscall.Errno = 1425 + ERROR_INVALID_HOOK_FILTER syscall.Errno = 1426 + ERROR_INVALID_FILTER_PROC syscall.Errno = 1427 + ERROR_HOOK_NEEDS_HMOD syscall.Errno = 1428 + ERROR_GLOBAL_ONLY_HOOK syscall.Errno = 1429 + ERROR_JOURNAL_HOOK_SET syscall.Errno = 1430 + ERROR_HOOK_NOT_INSTALLED syscall.Errno = 1431 + ERROR_INVALID_LB_MESSAGE syscall.Errno = 1432 + ERROR_SETCOUNT_ON_BAD_LB syscall.Errno = 1433 + ERROR_LB_WITHOUT_TABSTOPS syscall.Errno = 1434 + ERROR_DESTROY_OBJECT_OF_OTHER_THREAD syscall.Errno = 1435 + ERROR_CHILD_WINDOW_MENU syscall.Errno = 1436 + ERROR_NO_SYSTEM_MENU syscall.Errno = 1437 + ERROR_INVALID_MSGBOX_STYLE syscall.Errno = 1438 + ERROR_INVALID_SPI_VALUE syscall.Errno = 1439 + ERROR_SCREEN_ALREADY_LOCKED syscall.Errno = 1440 + ERROR_HWNDS_HAVE_DIFF_PARENT syscall.Errno = 1441 + ERROR_NOT_CHILD_WINDOW syscall.Errno = 1442 + ERROR_INVALID_GW_COMMAND syscall.Errno = 1443 + ERROR_INVALID_THREAD_ID syscall.Errno = 1444 + ERROR_NON_MDICHILD_WINDOW syscall.Errno = 1445 + ERROR_POPUP_ALREADY_ACTIVE syscall.Errno = 1446 + ERROR_NO_SCROLLBARS syscall.Errno = 1447 + ERROR_INVALID_SCROLLBAR_RANGE syscall.Errno = 1448 + ERROR_INVALID_SHOWWIN_COMMAND syscall.Errno = 1449 + ERROR_NO_SYSTEM_RESOURCES syscall.Errno = 1450 + ERROR_NONPAGED_SYSTEM_RESOURCES syscall.Errno = 1451 + ERROR_PAGED_SYSTEM_RESOURCES syscall.Errno = 1452 + ERROR_WORKING_SET_QUOTA syscall.Errno = 1453 + ERROR_PAGEFILE_QUOTA syscall.Errno = 1454 + ERROR_COMMITMENT_LIMIT syscall.Errno = 1455 + ERROR_MENU_ITEM_NOT_FOUND syscall.Errno = 1456 + ERROR_INVALID_KEYBOARD_HANDLE syscall.Errno = 1457 + ERROR_HOOK_TYPE_NOT_ALLOWED syscall.Errno = 1458 + ERROR_REQUIRES_INTERACTIVE_WINDOWSTATION syscall.Errno = 1459 + ERROR_TIMEOUT syscall.Errno = 1460 + ERROR_INVALID_MONITOR_HANDLE syscall.Errno = 1461 + ERROR_INCORRECT_SIZE syscall.Errno = 1462 + ERROR_SYMLINK_CLASS_DISABLED syscall.Errno = 1463 + ERROR_SYMLINK_NOT_SUPPORTED syscall.Errno = 1464 + ERROR_XML_PARSE_ERROR syscall.Errno = 1465 + ERROR_XMLDSIG_ERROR syscall.Errno = 1466 + ERROR_RESTART_APPLICATION syscall.Errno = 1467 + ERROR_WRONG_COMPARTMENT syscall.Errno = 1468 + ERROR_AUTHIP_FAILURE syscall.Errno = 1469 + ERROR_NO_NVRAM_RESOURCES syscall.Errno = 1470 + ERROR_NOT_GUI_PROCESS syscall.Errno = 1471 + ERROR_EVENTLOG_FILE_CORRUPT syscall.Errno = 1500 + ERROR_EVENTLOG_CANT_START syscall.Errno = 1501 + ERROR_LOG_FILE_FULL syscall.Errno = 1502 + ERROR_EVENTLOG_FILE_CHANGED syscall.Errno = 1503 + ERROR_CONTAINER_ASSIGNED syscall.Errno = 1504 + ERROR_JOB_NO_CONTAINER syscall.Errno = 1505 + ERROR_INVALID_TASK_NAME syscall.Errno = 1550 + ERROR_INVALID_TASK_INDEX syscall.Errno = 1551 + ERROR_THREAD_ALREADY_IN_TASK syscall.Errno = 1552 + ERROR_INSTALL_SERVICE_FAILURE syscall.Errno = 1601 + ERROR_INSTALL_USEREXIT syscall.Errno = 1602 + ERROR_INSTALL_FAILURE syscall.Errno = 1603 + ERROR_INSTALL_SUSPEND syscall.Errno = 1604 + ERROR_UNKNOWN_PRODUCT syscall.Errno = 1605 + ERROR_UNKNOWN_FEATURE syscall.Errno = 1606 + ERROR_UNKNOWN_COMPONENT syscall.Errno = 1607 + ERROR_UNKNOWN_PROPERTY syscall.Errno = 1608 + ERROR_INVALID_HANDLE_STATE syscall.Errno = 1609 + ERROR_BAD_CONFIGURATION syscall.Errno = 1610 + ERROR_INDEX_ABSENT syscall.Errno = 1611 + ERROR_INSTALL_SOURCE_ABSENT syscall.Errno = 1612 + ERROR_INSTALL_PACKAGE_VERSION syscall.Errno = 1613 + ERROR_PRODUCT_UNINSTALLED syscall.Errno = 1614 + ERROR_BAD_QUERY_SYNTAX syscall.Errno = 1615 + ERROR_INVALID_FIELD syscall.Errno = 1616 + ERROR_DEVICE_REMOVED syscall.Errno = 1617 + ERROR_INSTALL_ALREADY_RUNNING syscall.Errno = 1618 + ERROR_INSTALL_PACKAGE_OPEN_FAILED syscall.Errno = 1619 + ERROR_INSTALL_PACKAGE_INVALID syscall.Errno = 1620 + ERROR_INSTALL_UI_FAILURE syscall.Errno = 1621 + ERROR_INSTALL_LOG_FAILURE syscall.Errno = 1622 + ERROR_INSTALL_LANGUAGE_UNSUPPORTED syscall.Errno = 1623 + ERROR_INSTALL_TRANSFORM_FAILURE syscall.Errno = 1624 + ERROR_INSTALL_PACKAGE_REJECTED syscall.Errno = 1625 + ERROR_FUNCTION_NOT_CALLED syscall.Errno = 1626 + ERROR_FUNCTION_FAILED syscall.Errno = 1627 + ERROR_INVALID_TABLE syscall.Errno = 1628 + ERROR_DATATYPE_MISMATCH syscall.Errno = 1629 + ERROR_UNSUPPORTED_TYPE syscall.Errno = 1630 + ERROR_CREATE_FAILED syscall.Errno = 1631 + ERROR_INSTALL_TEMP_UNWRITABLE syscall.Errno = 1632 + ERROR_INSTALL_PLATFORM_UNSUPPORTED syscall.Errno = 1633 + ERROR_INSTALL_NOTUSED syscall.Errno = 1634 + ERROR_PATCH_PACKAGE_OPEN_FAILED syscall.Errno = 1635 + ERROR_PATCH_PACKAGE_INVALID syscall.Errno = 1636 + ERROR_PATCH_PACKAGE_UNSUPPORTED syscall.Errno = 1637 + ERROR_PRODUCT_VERSION syscall.Errno = 1638 + ERROR_INVALID_COMMAND_LINE syscall.Errno = 1639 + ERROR_INSTALL_REMOTE_DISALLOWED syscall.Errno = 1640 + ERROR_SUCCESS_REBOOT_INITIATED syscall.Errno = 1641 + ERROR_PATCH_TARGET_NOT_FOUND syscall.Errno = 1642 + ERROR_PATCH_PACKAGE_REJECTED syscall.Errno = 1643 + ERROR_INSTALL_TRANSFORM_REJECTED syscall.Errno = 1644 + ERROR_INSTALL_REMOTE_PROHIBITED syscall.Errno = 1645 + ERROR_PATCH_REMOVAL_UNSUPPORTED syscall.Errno = 1646 + ERROR_UNKNOWN_PATCH syscall.Errno = 1647 + ERROR_PATCH_NO_SEQUENCE syscall.Errno = 1648 + ERROR_PATCH_REMOVAL_DISALLOWED syscall.Errno = 1649 + ERROR_INVALID_PATCH_XML syscall.Errno = 1650 + ERROR_PATCH_MANAGED_ADVERTISED_PRODUCT syscall.Errno = 1651 + ERROR_INSTALL_SERVICE_SAFEBOOT syscall.Errno = 1652 + ERROR_FAIL_FAST_EXCEPTION syscall.Errno = 1653 + ERROR_INSTALL_REJECTED syscall.Errno = 1654 + ERROR_DYNAMIC_CODE_BLOCKED syscall.Errno = 1655 + ERROR_NOT_SAME_OBJECT syscall.Errno = 1656 + ERROR_STRICT_CFG_VIOLATION syscall.Errno = 1657 + ERROR_SET_CONTEXT_DENIED syscall.Errno = 1660 + ERROR_CROSS_PARTITION_VIOLATION syscall.Errno = 1661 + RPC_S_INVALID_STRING_BINDING syscall.Errno = 1700 + RPC_S_WRONG_KIND_OF_BINDING syscall.Errno = 1701 + RPC_S_INVALID_BINDING syscall.Errno = 1702 + RPC_S_PROTSEQ_NOT_SUPPORTED syscall.Errno = 1703 + RPC_S_INVALID_RPC_PROTSEQ syscall.Errno = 1704 + RPC_S_INVALID_STRING_UUID syscall.Errno = 1705 + RPC_S_INVALID_ENDPOINT_FORMAT syscall.Errno = 1706 + RPC_S_INVALID_NET_ADDR syscall.Errno = 1707 + RPC_S_NO_ENDPOINT_FOUND syscall.Errno = 1708 + RPC_S_INVALID_TIMEOUT syscall.Errno = 1709 + RPC_S_OBJECT_NOT_FOUND syscall.Errno = 1710 + RPC_S_ALREADY_REGISTERED syscall.Errno = 1711 + RPC_S_TYPE_ALREADY_REGISTERED syscall.Errno = 1712 + RPC_S_ALREADY_LISTENING syscall.Errno = 1713 + RPC_S_NO_PROTSEQS_REGISTERED syscall.Errno = 1714 + RPC_S_NOT_LISTENING syscall.Errno = 1715 + RPC_S_UNKNOWN_MGR_TYPE syscall.Errno = 1716 + RPC_S_UNKNOWN_IF syscall.Errno = 1717 + RPC_S_NO_BINDINGS syscall.Errno = 1718 + RPC_S_NO_PROTSEQS syscall.Errno = 1719 + RPC_S_CANT_CREATE_ENDPOINT syscall.Errno = 1720 + RPC_S_OUT_OF_RESOURCES syscall.Errno = 1721 + RPC_S_SERVER_UNAVAILABLE syscall.Errno = 1722 + RPC_S_SERVER_TOO_BUSY syscall.Errno = 1723 + RPC_S_INVALID_NETWORK_OPTIONS syscall.Errno = 1724 + RPC_S_NO_CALL_ACTIVE syscall.Errno = 1725 + RPC_S_CALL_FAILED syscall.Errno = 1726 + RPC_S_CALL_FAILED_DNE syscall.Errno = 1727 + RPC_S_PROTOCOL_ERROR syscall.Errno = 1728 + RPC_S_PROXY_ACCESS_DENIED syscall.Errno = 1729 + RPC_S_UNSUPPORTED_TRANS_SYN syscall.Errno = 1730 + RPC_S_UNSUPPORTED_TYPE syscall.Errno = 1732 + RPC_S_INVALID_TAG syscall.Errno = 1733 + RPC_S_INVALID_BOUND syscall.Errno = 1734 + RPC_S_NO_ENTRY_NAME syscall.Errno = 1735 + RPC_S_INVALID_NAME_SYNTAX syscall.Errno = 1736 + RPC_S_UNSUPPORTED_NAME_SYNTAX syscall.Errno = 1737 + RPC_S_UUID_NO_ADDRESS syscall.Errno = 1739 + RPC_S_DUPLICATE_ENDPOINT syscall.Errno = 1740 + RPC_S_UNKNOWN_AUTHN_TYPE syscall.Errno = 1741 + RPC_S_MAX_CALLS_TOO_SMALL syscall.Errno = 1742 + RPC_S_STRING_TOO_LONG syscall.Errno = 1743 + RPC_S_PROTSEQ_NOT_FOUND syscall.Errno = 1744 + RPC_S_PROCNUM_OUT_OF_RANGE syscall.Errno = 1745 + RPC_S_BINDING_HAS_NO_AUTH syscall.Errno = 1746 + RPC_S_UNKNOWN_AUTHN_SERVICE syscall.Errno = 1747 + RPC_S_UNKNOWN_AUTHN_LEVEL syscall.Errno = 1748 + RPC_S_INVALID_AUTH_IDENTITY syscall.Errno = 1749 + RPC_S_UNKNOWN_AUTHZ_SERVICE syscall.Errno = 1750 + EPT_S_INVALID_ENTRY syscall.Errno = 1751 + EPT_S_CANT_PERFORM_OP syscall.Errno = 1752 + EPT_S_NOT_REGISTERED syscall.Errno = 1753 + RPC_S_NOTHING_TO_EXPORT syscall.Errno = 1754 + RPC_S_INCOMPLETE_NAME syscall.Errno = 1755 + RPC_S_INVALID_VERS_OPTION syscall.Errno = 1756 + RPC_S_NO_MORE_MEMBERS syscall.Errno = 1757 + RPC_S_NOT_ALL_OBJS_UNEXPORTED syscall.Errno = 1758 + RPC_S_INTERFACE_NOT_FOUND syscall.Errno = 1759 + RPC_S_ENTRY_ALREADY_EXISTS syscall.Errno = 1760 + RPC_S_ENTRY_NOT_FOUND syscall.Errno = 1761 + RPC_S_NAME_SERVICE_UNAVAILABLE syscall.Errno = 1762 + RPC_S_INVALID_NAF_ID syscall.Errno = 1763 + RPC_S_CANNOT_SUPPORT syscall.Errno = 1764 + RPC_S_NO_CONTEXT_AVAILABLE syscall.Errno = 1765 + RPC_S_INTERNAL_ERROR syscall.Errno = 1766 + RPC_S_ZERO_DIVIDE syscall.Errno = 1767 + RPC_S_ADDRESS_ERROR syscall.Errno = 1768 + RPC_S_FP_DIV_ZERO syscall.Errno = 1769 + RPC_S_FP_UNDERFLOW syscall.Errno = 1770 + RPC_S_FP_OVERFLOW syscall.Errno = 1771 + RPC_X_NO_MORE_ENTRIES syscall.Errno = 1772 + RPC_X_SS_CHAR_TRANS_OPEN_FAIL syscall.Errno = 1773 + RPC_X_SS_CHAR_TRANS_SHORT_FILE syscall.Errno = 1774 + RPC_X_SS_IN_NULL_CONTEXT syscall.Errno = 1775 + RPC_X_SS_CONTEXT_DAMAGED syscall.Errno = 1777 + RPC_X_SS_HANDLES_MISMATCH syscall.Errno = 1778 + RPC_X_SS_CANNOT_GET_CALL_HANDLE syscall.Errno = 1779 + RPC_X_NULL_REF_POINTER syscall.Errno = 1780 + RPC_X_ENUM_VALUE_OUT_OF_RANGE syscall.Errno = 1781 + RPC_X_BYTE_COUNT_TOO_SMALL syscall.Errno = 1782 + RPC_X_BAD_STUB_DATA syscall.Errno = 1783 + ERROR_INVALID_USER_BUFFER syscall.Errno = 1784 + ERROR_UNRECOGNIZED_MEDIA syscall.Errno = 1785 + ERROR_NO_TRUST_LSA_SECRET syscall.Errno = 1786 + ERROR_NO_TRUST_SAM_ACCOUNT syscall.Errno = 1787 + ERROR_TRUSTED_DOMAIN_FAILURE syscall.Errno = 1788 + ERROR_TRUSTED_RELATIONSHIP_FAILURE syscall.Errno = 1789 + ERROR_TRUST_FAILURE syscall.Errno = 1790 + RPC_S_CALL_IN_PROGRESS syscall.Errno = 1791 + ERROR_NETLOGON_NOT_STARTED syscall.Errno = 1792 + ERROR_ACCOUNT_EXPIRED syscall.Errno = 1793 + ERROR_REDIRECTOR_HAS_OPEN_HANDLES syscall.Errno = 1794 + ERROR_PRINTER_DRIVER_ALREADY_INSTALLED syscall.Errno = 1795 + ERROR_UNKNOWN_PORT syscall.Errno = 1796 + ERROR_UNKNOWN_PRINTER_DRIVER syscall.Errno = 1797 + ERROR_UNKNOWN_PRINTPROCESSOR syscall.Errno = 1798 + ERROR_INVALID_SEPARATOR_FILE syscall.Errno = 1799 + ERROR_INVALID_PRIORITY syscall.Errno = 1800 + ERROR_INVALID_PRINTER_NAME syscall.Errno = 1801 + ERROR_PRINTER_ALREADY_EXISTS syscall.Errno = 1802 + ERROR_INVALID_PRINTER_COMMAND syscall.Errno = 1803 + ERROR_INVALID_DATATYPE syscall.Errno = 1804 + ERROR_INVALID_ENVIRONMENT syscall.Errno = 1805 + RPC_S_NO_MORE_BINDINGS syscall.Errno = 1806 + ERROR_NOLOGON_INTERDOMAIN_TRUST_ACCOUNT syscall.Errno = 1807 + ERROR_NOLOGON_WORKSTATION_TRUST_ACCOUNT syscall.Errno = 1808 + ERROR_NOLOGON_SERVER_TRUST_ACCOUNT syscall.Errno = 1809 + ERROR_DOMAIN_TRUST_INCONSISTENT syscall.Errno = 1810 + ERROR_SERVER_HAS_OPEN_HANDLES syscall.Errno = 1811 + ERROR_RESOURCE_DATA_NOT_FOUND syscall.Errno = 1812 + ERROR_RESOURCE_TYPE_NOT_FOUND syscall.Errno = 1813 + ERROR_RESOURCE_NAME_NOT_FOUND syscall.Errno = 1814 + ERROR_RESOURCE_LANG_NOT_FOUND syscall.Errno = 1815 + ERROR_NOT_ENOUGH_QUOTA syscall.Errno = 1816 + RPC_S_NO_INTERFACES syscall.Errno = 1817 + RPC_S_CALL_CANCELLED syscall.Errno = 1818 + RPC_S_BINDING_INCOMPLETE syscall.Errno = 1819 + RPC_S_COMM_FAILURE syscall.Errno = 1820 + RPC_S_UNSUPPORTED_AUTHN_LEVEL syscall.Errno = 1821 + RPC_S_NO_PRINC_NAME syscall.Errno = 1822 + RPC_S_NOT_RPC_ERROR syscall.Errno = 1823 + RPC_S_UUID_LOCAL_ONLY syscall.Errno = 1824 + RPC_S_SEC_PKG_ERROR syscall.Errno = 1825 + RPC_S_NOT_CANCELLED syscall.Errno = 1826 + RPC_X_INVALID_ES_ACTION syscall.Errno = 1827 + RPC_X_WRONG_ES_VERSION syscall.Errno = 1828 + RPC_X_WRONG_STUB_VERSION syscall.Errno = 1829 + RPC_X_INVALID_PIPE_OBJECT syscall.Errno = 1830 + RPC_X_WRONG_PIPE_ORDER syscall.Errno = 1831 + RPC_X_WRONG_PIPE_VERSION syscall.Errno = 1832 + RPC_S_COOKIE_AUTH_FAILED syscall.Errno = 1833 + RPC_S_DO_NOT_DISTURB syscall.Errno = 1834 + RPC_S_SYSTEM_HANDLE_COUNT_EXCEEDED syscall.Errno = 1835 + RPC_S_SYSTEM_HANDLE_TYPE_MISMATCH syscall.Errno = 1836 + RPC_S_GROUP_MEMBER_NOT_FOUND syscall.Errno = 1898 + EPT_S_CANT_CREATE syscall.Errno = 1899 + RPC_S_INVALID_OBJECT syscall.Errno = 1900 + ERROR_INVALID_TIME syscall.Errno = 1901 + ERROR_INVALID_FORM_NAME syscall.Errno = 1902 + ERROR_INVALID_FORM_SIZE syscall.Errno = 1903 + ERROR_ALREADY_WAITING syscall.Errno = 1904 + ERROR_PRINTER_DELETED syscall.Errno = 1905 + ERROR_INVALID_PRINTER_STATE syscall.Errno = 1906 + ERROR_PASSWORD_MUST_CHANGE syscall.Errno = 1907 + ERROR_DOMAIN_CONTROLLER_NOT_FOUND syscall.Errno = 1908 + ERROR_ACCOUNT_LOCKED_OUT syscall.Errno = 1909 + OR_INVALID_OXID syscall.Errno = 1910 + OR_INVALID_OID syscall.Errno = 1911 + OR_INVALID_SET syscall.Errno = 1912 + RPC_S_SEND_INCOMPLETE syscall.Errno = 1913 + RPC_S_INVALID_ASYNC_HANDLE syscall.Errno = 1914 + RPC_S_INVALID_ASYNC_CALL syscall.Errno = 1915 + RPC_X_PIPE_CLOSED syscall.Errno = 1916 + RPC_X_PIPE_DISCIPLINE_ERROR syscall.Errno = 1917 + RPC_X_PIPE_EMPTY syscall.Errno = 1918 + ERROR_NO_SITENAME syscall.Errno = 1919 + ERROR_CANT_ACCESS_FILE syscall.Errno = 1920 + ERROR_CANT_RESOLVE_FILENAME syscall.Errno = 1921 + RPC_S_ENTRY_TYPE_MISMATCH syscall.Errno = 1922 + RPC_S_NOT_ALL_OBJS_EXPORTED syscall.Errno = 1923 + RPC_S_INTERFACE_NOT_EXPORTED syscall.Errno = 1924 + RPC_S_PROFILE_NOT_ADDED syscall.Errno = 1925 + RPC_S_PRF_ELT_NOT_ADDED syscall.Errno = 1926 + RPC_S_PRF_ELT_NOT_REMOVED syscall.Errno = 1927 + RPC_S_GRP_ELT_NOT_ADDED syscall.Errno = 1928 + RPC_S_GRP_ELT_NOT_REMOVED syscall.Errno = 1929 + ERROR_KM_DRIVER_BLOCKED syscall.Errno = 1930 + ERROR_CONTEXT_EXPIRED syscall.Errno = 1931 + ERROR_PER_USER_TRUST_QUOTA_EXCEEDED syscall.Errno = 1932 + ERROR_ALL_USER_TRUST_QUOTA_EXCEEDED syscall.Errno = 1933 + ERROR_USER_DELETE_TRUST_QUOTA_EXCEEDED syscall.Errno = 1934 + ERROR_AUTHENTICATION_FIREWALL_FAILED syscall.Errno = 1935 + ERROR_REMOTE_PRINT_CONNECTIONS_BLOCKED syscall.Errno = 1936 + ERROR_NTLM_BLOCKED syscall.Errno = 1937 + ERROR_PASSWORD_CHANGE_REQUIRED syscall.Errno = 1938 + ERROR_LOST_MODE_LOGON_RESTRICTION syscall.Errno = 1939 + ERROR_INVALID_PIXEL_FORMAT syscall.Errno = 2000 + ERROR_BAD_DRIVER syscall.Errno = 2001 + ERROR_INVALID_WINDOW_STYLE syscall.Errno = 2002 + ERROR_METAFILE_NOT_SUPPORTED syscall.Errno = 2003 + ERROR_TRANSFORM_NOT_SUPPORTED syscall.Errno = 2004 + ERROR_CLIPPING_NOT_SUPPORTED syscall.Errno = 2005 + ERROR_INVALID_CMM syscall.Errno = 2010 + ERROR_INVALID_PROFILE syscall.Errno = 2011 + ERROR_TAG_NOT_FOUND syscall.Errno = 2012 + ERROR_TAG_NOT_PRESENT syscall.Errno = 2013 + ERROR_DUPLICATE_TAG syscall.Errno = 2014 + ERROR_PROFILE_NOT_ASSOCIATED_WITH_DEVICE syscall.Errno = 2015 + ERROR_PROFILE_NOT_FOUND syscall.Errno = 2016 + ERROR_INVALID_COLORSPACE syscall.Errno = 2017 + ERROR_ICM_NOT_ENABLED syscall.Errno = 2018 + ERROR_DELETING_ICM_XFORM syscall.Errno = 2019 + ERROR_INVALID_TRANSFORM syscall.Errno = 2020 + ERROR_COLORSPACE_MISMATCH syscall.Errno = 2021 + ERROR_INVALID_COLORINDEX syscall.Errno = 2022 + ERROR_PROFILE_DOES_NOT_MATCH_DEVICE syscall.Errno = 2023 + ERROR_CONNECTED_OTHER_PASSWORD syscall.Errno = 2108 + ERROR_CONNECTED_OTHER_PASSWORD_DEFAULT syscall.Errno = 2109 + ERROR_BAD_USERNAME syscall.Errno = 2202 + ERROR_NOT_CONNECTED syscall.Errno = 2250 + ERROR_OPEN_FILES syscall.Errno = 2401 + ERROR_ACTIVE_CONNECTIONS syscall.Errno = 2402 + ERROR_DEVICE_IN_USE syscall.Errno = 2404 + ERROR_UNKNOWN_PRINT_MONITOR syscall.Errno = 3000 + ERROR_PRINTER_DRIVER_IN_USE syscall.Errno = 3001 + ERROR_SPOOL_FILE_NOT_FOUND syscall.Errno = 3002 + ERROR_SPL_NO_STARTDOC syscall.Errno = 3003 + ERROR_SPL_NO_ADDJOB syscall.Errno = 3004 + ERROR_PRINT_PROCESSOR_ALREADY_INSTALLED syscall.Errno = 3005 + ERROR_PRINT_MONITOR_ALREADY_INSTALLED syscall.Errno = 3006 + ERROR_INVALID_PRINT_MONITOR syscall.Errno = 3007 + ERROR_PRINT_MONITOR_IN_USE syscall.Errno = 3008 + ERROR_PRINTER_HAS_JOBS_QUEUED syscall.Errno = 3009 + ERROR_SUCCESS_REBOOT_REQUIRED syscall.Errno = 3010 + ERROR_SUCCESS_RESTART_REQUIRED syscall.Errno = 3011 + ERROR_PRINTER_NOT_FOUND syscall.Errno = 3012 + ERROR_PRINTER_DRIVER_WARNED syscall.Errno = 3013 + ERROR_PRINTER_DRIVER_BLOCKED syscall.Errno = 3014 + ERROR_PRINTER_DRIVER_PACKAGE_IN_USE syscall.Errno = 3015 + ERROR_CORE_DRIVER_PACKAGE_NOT_FOUND syscall.Errno = 3016 + ERROR_FAIL_REBOOT_REQUIRED syscall.Errno = 3017 + ERROR_FAIL_REBOOT_INITIATED syscall.Errno = 3018 + ERROR_PRINTER_DRIVER_DOWNLOAD_NEEDED syscall.Errno = 3019 + ERROR_PRINT_JOB_RESTART_REQUIRED syscall.Errno = 3020 + ERROR_INVALID_PRINTER_DRIVER_MANIFEST syscall.Errno = 3021 + ERROR_PRINTER_NOT_SHAREABLE syscall.Errno = 3022 + ERROR_REQUEST_PAUSED syscall.Errno = 3050 + ERROR_APPEXEC_CONDITION_NOT_SATISFIED syscall.Errno = 3060 + ERROR_APPEXEC_HANDLE_INVALIDATED syscall.Errno = 3061 + ERROR_APPEXEC_INVALID_HOST_GENERATION syscall.Errno = 3062 + ERROR_APPEXEC_UNEXPECTED_PROCESS_REGISTRATION syscall.Errno = 3063 + ERROR_APPEXEC_INVALID_HOST_STATE syscall.Errno = 3064 + ERROR_APPEXEC_NO_DONOR syscall.Errno = 3065 + ERROR_APPEXEC_HOST_ID_MISMATCH syscall.Errno = 3066 + ERROR_APPEXEC_UNKNOWN_USER syscall.Errno = 3067 + ERROR_IO_REISSUE_AS_CACHED syscall.Errno = 3950 + ERROR_WINS_INTERNAL syscall.Errno = 4000 + ERROR_CAN_NOT_DEL_LOCAL_WINS syscall.Errno = 4001 + ERROR_STATIC_INIT syscall.Errno = 4002 + ERROR_INC_BACKUP syscall.Errno = 4003 + ERROR_FULL_BACKUP syscall.Errno = 4004 + ERROR_REC_NON_EXISTENT syscall.Errno = 4005 + ERROR_RPL_NOT_ALLOWED syscall.Errno = 4006 + PEERDIST_ERROR_CONTENTINFO_VERSION_UNSUPPORTED syscall.Errno = 4050 + PEERDIST_ERROR_CANNOT_PARSE_CONTENTINFO syscall.Errno = 4051 + PEERDIST_ERROR_MISSING_DATA syscall.Errno = 4052 + PEERDIST_ERROR_NO_MORE syscall.Errno = 4053 + PEERDIST_ERROR_NOT_INITIALIZED syscall.Errno = 4054 + PEERDIST_ERROR_ALREADY_INITIALIZED syscall.Errno = 4055 + PEERDIST_ERROR_SHUTDOWN_IN_PROGRESS syscall.Errno = 4056 + PEERDIST_ERROR_INVALIDATED syscall.Errno = 4057 + PEERDIST_ERROR_ALREADY_EXISTS syscall.Errno = 4058 + PEERDIST_ERROR_OPERATION_NOTFOUND syscall.Errno = 4059 + PEERDIST_ERROR_ALREADY_COMPLETED syscall.Errno = 4060 + PEERDIST_ERROR_OUT_OF_BOUNDS syscall.Errno = 4061 + PEERDIST_ERROR_VERSION_UNSUPPORTED syscall.Errno = 4062 + PEERDIST_ERROR_INVALID_CONFIGURATION syscall.Errno = 4063 + PEERDIST_ERROR_NOT_LICENSED syscall.Errno = 4064 + PEERDIST_ERROR_SERVICE_UNAVAILABLE syscall.Errno = 4065 + PEERDIST_ERROR_TRUST_FAILURE syscall.Errno = 4066 + ERROR_DHCP_ADDRESS_CONFLICT syscall.Errno = 4100 + ERROR_WMI_GUID_NOT_FOUND syscall.Errno = 4200 + ERROR_WMI_INSTANCE_NOT_FOUND syscall.Errno = 4201 + ERROR_WMI_ITEMID_NOT_FOUND syscall.Errno = 4202 + ERROR_WMI_TRY_AGAIN syscall.Errno = 4203 + ERROR_WMI_DP_NOT_FOUND syscall.Errno = 4204 + ERROR_WMI_UNRESOLVED_INSTANCE_REF syscall.Errno = 4205 + ERROR_WMI_ALREADY_ENABLED syscall.Errno = 4206 + ERROR_WMI_GUID_DISCONNECTED syscall.Errno = 4207 + ERROR_WMI_SERVER_UNAVAILABLE syscall.Errno = 4208 + ERROR_WMI_DP_FAILED syscall.Errno = 4209 + ERROR_WMI_INVALID_MOF syscall.Errno = 4210 + ERROR_WMI_INVALID_REGINFO syscall.Errno = 4211 + ERROR_WMI_ALREADY_DISABLED syscall.Errno = 4212 + ERROR_WMI_READ_ONLY syscall.Errno = 4213 + ERROR_WMI_SET_FAILURE syscall.Errno = 4214 + ERROR_NOT_APPCONTAINER syscall.Errno = 4250 + ERROR_APPCONTAINER_REQUIRED syscall.Errno = 4251 + ERROR_NOT_SUPPORTED_IN_APPCONTAINER syscall.Errno = 4252 + ERROR_INVALID_PACKAGE_SID_LENGTH syscall.Errno = 4253 + ERROR_INVALID_MEDIA syscall.Errno = 4300 + ERROR_INVALID_LIBRARY syscall.Errno = 4301 + ERROR_INVALID_MEDIA_POOL syscall.Errno = 4302 + ERROR_DRIVE_MEDIA_MISMATCH syscall.Errno = 4303 + ERROR_MEDIA_OFFLINE syscall.Errno = 4304 + ERROR_LIBRARY_OFFLINE syscall.Errno = 4305 + ERROR_EMPTY syscall.Errno = 4306 + ERROR_NOT_EMPTY syscall.Errno = 4307 + ERROR_MEDIA_UNAVAILABLE syscall.Errno = 4308 + ERROR_RESOURCE_DISABLED syscall.Errno = 4309 + ERROR_INVALID_CLEANER syscall.Errno = 4310 + ERROR_UNABLE_TO_CLEAN syscall.Errno = 4311 + ERROR_OBJECT_NOT_FOUND syscall.Errno = 4312 + ERROR_DATABASE_FAILURE syscall.Errno = 4313 + ERROR_DATABASE_FULL syscall.Errno = 4314 + ERROR_MEDIA_INCOMPATIBLE syscall.Errno = 4315 + ERROR_RESOURCE_NOT_PRESENT syscall.Errno = 4316 + ERROR_INVALID_OPERATION syscall.Errno = 4317 + ERROR_MEDIA_NOT_AVAILABLE syscall.Errno = 4318 + ERROR_DEVICE_NOT_AVAILABLE syscall.Errno = 4319 + ERROR_REQUEST_REFUSED syscall.Errno = 4320 + ERROR_INVALID_DRIVE_OBJECT syscall.Errno = 4321 + ERROR_LIBRARY_FULL syscall.Errno = 4322 + ERROR_MEDIUM_NOT_ACCESSIBLE syscall.Errno = 4323 + ERROR_UNABLE_TO_LOAD_MEDIUM syscall.Errno = 4324 + ERROR_UNABLE_TO_INVENTORY_DRIVE syscall.Errno = 4325 + ERROR_UNABLE_TO_INVENTORY_SLOT syscall.Errno = 4326 + ERROR_UNABLE_TO_INVENTORY_TRANSPORT syscall.Errno = 4327 + ERROR_TRANSPORT_FULL syscall.Errno = 4328 + ERROR_CONTROLLING_IEPORT syscall.Errno = 4329 + ERROR_UNABLE_TO_EJECT_MOUNTED_MEDIA syscall.Errno = 4330 + ERROR_CLEANER_SLOT_SET syscall.Errno = 4331 + ERROR_CLEANER_SLOT_NOT_SET syscall.Errno = 4332 + ERROR_CLEANER_CARTRIDGE_SPENT syscall.Errno = 4333 + ERROR_UNEXPECTED_OMID syscall.Errno = 4334 + ERROR_CANT_DELETE_LAST_ITEM syscall.Errno = 4335 + ERROR_MESSAGE_EXCEEDS_MAX_SIZE syscall.Errno = 4336 + ERROR_VOLUME_CONTAINS_SYS_FILES syscall.Errno = 4337 + ERROR_INDIGENOUS_TYPE syscall.Errno = 4338 + ERROR_NO_SUPPORTING_DRIVES syscall.Errno = 4339 + ERROR_CLEANER_CARTRIDGE_INSTALLED syscall.Errno = 4340 + ERROR_IEPORT_FULL syscall.Errno = 4341 + ERROR_FILE_OFFLINE syscall.Errno = 4350 + ERROR_REMOTE_STORAGE_NOT_ACTIVE syscall.Errno = 4351 + ERROR_REMOTE_STORAGE_MEDIA_ERROR syscall.Errno = 4352 + ERROR_NOT_A_REPARSE_POINT syscall.Errno = 4390 + ERROR_REPARSE_ATTRIBUTE_CONFLICT syscall.Errno = 4391 + ERROR_INVALID_REPARSE_DATA syscall.Errno = 4392 + ERROR_REPARSE_TAG_INVALID syscall.Errno = 4393 + ERROR_REPARSE_TAG_MISMATCH syscall.Errno = 4394 + ERROR_REPARSE_POINT_ENCOUNTERED syscall.Errno = 4395 + ERROR_APP_DATA_NOT_FOUND syscall.Errno = 4400 + ERROR_APP_DATA_EXPIRED syscall.Errno = 4401 + ERROR_APP_DATA_CORRUPT syscall.Errno = 4402 + ERROR_APP_DATA_LIMIT_EXCEEDED syscall.Errno = 4403 + ERROR_APP_DATA_REBOOT_REQUIRED syscall.Errno = 4404 + ERROR_SECUREBOOT_ROLLBACK_DETECTED syscall.Errno = 4420 + ERROR_SECUREBOOT_POLICY_VIOLATION syscall.Errno = 4421 + ERROR_SECUREBOOT_INVALID_POLICY syscall.Errno = 4422 + ERROR_SECUREBOOT_POLICY_PUBLISHER_NOT_FOUND syscall.Errno = 4423 + ERROR_SECUREBOOT_POLICY_NOT_SIGNED syscall.Errno = 4424 + ERROR_SECUREBOOT_NOT_ENABLED syscall.Errno = 4425 + ERROR_SECUREBOOT_FILE_REPLACED syscall.Errno = 4426 + ERROR_SECUREBOOT_POLICY_NOT_AUTHORIZED syscall.Errno = 4427 + ERROR_SECUREBOOT_POLICY_UNKNOWN syscall.Errno = 4428 + ERROR_SECUREBOOT_POLICY_MISSING_ANTIROLLBACKVERSION syscall.Errno = 4429 + ERROR_SECUREBOOT_PLATFORM_ID_MISMATCH syscall.Errno = 4430 + ERROR_SECUREBOOT_POLICY_ROLLBACK_DETECTED syscall.Errno = 4431 + ERROR_SECUREBOOT_POLICY_UPGRADE_MISMATCH syscall.Errno = 4432 + ERROR_SECUREBOOT_REQUIRED_POLICY_FILE_MISSING syscall.Errno = 4433 + ERROR_SECUREBOOT_NOT_BASE_POLICY syscall.Errno = 4434 + ERROR_SECUREBOOT_NOT_SUPPLEMENTAL_POLICY syscall.Errno = 4435 + ERROR_OFFLOAD_READ_FLT_NOT_SUPPORTED syscall.Errno = 4440 + ERROR_OFFLOAD_WRITE_FLT_NOT_SUPPORTED syscall.Errno = 4441 + ERROR_OFFLOAD_READ_FILE_NOT_SUPPORTED syscall.Errno = 4442 + ERROR_OFFLOAD_WRITE_FILE_NOT_SUPPORTED syscall.Errno = 4443 + ERROR_ALREADY_HAS_STREAM_ID syscall.Errno = 4444 + ERROR_SMR_GARBAGE_COLLECTION_REQUIRED syscall.Errno = 4445 + ERROR_WOF_WIM_HEADER_CORRUPT syscall.Errno = 4446 + ERROR_WOF_WIM_RESOURCE_TABLE_CORRUPT syscall.Errno = 4447 + ERROR_WOF_FILE_RESOURCE_TABLE_CORRUPT syscall.Errno = 4448 + ERROR_VOLUME_NOT_SIS_ENABLED syscall.Errno = 4500 + ERROR_SYSTEM_INTEGRITY_ROLLBACK_DETECTED syscall.Errno = 4550 + ERROR_SYSTEM_INTEGRITY_POLICY_VIOLATION syscall.Errno = 4551 + ERROR_SYSTEM_INTEGRITY_INVALID_POLICY syscall.Errno = 4552 + ERROR_SYSTEM_INTEGRITY_POLICY_NOT_SIGNED syscall.Errno = 4553 + ERROR_SYSTEM_INTEGRITY_TOO_MANY_POLICIES syscall.Errno = 4554 + ERROR_SYSTEM_INTEGRITY_SUPPLEMENTAL_POLICY_NOT_AUTHORIZED syscall.Errno = 4555 + ERROR_VSM_NOT_INITIALIZED syscall.Errno = 4560 + ERROR_VSM_DMA_PROTECTION_NOT_IN_USE syscall.Errno = 4561 + ERROR_PLATFORM_MANIFEST_NOT_AUTHORIZED syscall.Errno = 4570 + ERROR_PLATFORM_MANIFEST_INVALID syscall.Errno = 4571 + ERROR_PLATFORM_MANIFEST_FILE_NOT_AUTHORIZED syscall.Errno = 4572 + ERROR_PLATFORM_MANIFEST_CATALOG_NOT_AUTHORIZED syscall.Errno = 4573 + ERROR_PLATFORM_MANIFEST_BINARY_ID_NOT_FOUND syscall.Errno = 4574 + ERROR_PLATFORM_MANIFEST_NOT_ACTIVE syscall.Errno = 4575 + ERROR_PLATFORM_MANIFEST_NOT_SIGNED syscall.Errno = 4576 + ERROR_DEPENDENT_RESOURCE_EXISTS syscall.Errno = 5001 + ERROR_DEPENDENCY_NOT_FOUND syscall.Errno = 5002 + ERROR_DEPENDENCY_ALREADY_EXISTS syscall.Errno = 5003 + ERROR_RESOURCE_NOT_ONLINE syscall.Errno = 5004 + ERROR_HOST_NODE_NOT_AVAILABLE syscall.Errno = 5005 + ERROR_RESOURCE_NOT_AVAILABLE syscall.Errno = 5006 + ERROR_RESOURCE_NOT_FOUND syscall.Errno = 5007 + ERROR_SHUTDOWN_CLUSTER syscall.Errno = 5008 + ERROR_CANT_EVICT_ACTIVE_NODE syscall.Errno = 5009 + ERROR_OBJECT_ALREADY_EXISTS syscall.Errno = 5010 + ERROR_OBJECT_IN_LIST syscall.Errno = 5011 + ERROR_GROUP_NOT_AVAILABLE syscall.Errno = 5012 + ERROR_GROUP_NOT_FOUND syscall.Errno = 5013 + ERROR_GROUP_NOT_ONLINE syscall.Errno = 5014 + ERROR_HOST_NODE_NOT_RESOURCE_OWNER syscall.Errno = 5015 + ERROR_HOST_NODE_NOT_GROUP_OWNER syscall.Errno = 5016 + ERROR_RESMON_CREATE_FAILED syscall.Errno = 5017 + ERROR_RESMON_ONLINE_FAILED syscall.Errno = 5018 + ERROR_RESOURCE_ONLINE syscall.Errno = 5019 + ERROR_QUORUM_RESOURCE syscall.Errno = 5020 + ERROR_NOT_QUORUM_CAPABLE syscall.Errno = 5021 + ERROR_CLUSTER_SHUTTING_DOWN syscall.Errno = 5022 + ERROR_INVALID_STATE syscall.Errno = 5023 + ERROR_RESOURCE_PROPERTIES_STORED syscall.Errno = 5024 + ERROR_NOT_QUORUM_CLASS syscall.Errno = 5025 + ERROR_CORE_RESOURCE syscall.Errno = 5026 + ERROR_QUORUM_RESOURCE_ONLINE_FAILED syscall.Errno = 5027 + ERROR_QUORUMLOG_OPEN_FAILED syscall.Errno = 5028 + ERROR_CLUSTERLOG_CORRUPT syscall.Errno = 5029 + ERROR_CLUSTERLOG_RECORD_EXCEEDS_MAXSIZE syscall.Errno = 5030 + ERROR_CLUSTERLOG_EXCEEDS_MAXSIZE syscall.Errno = 5031 + ERROR_CLUSTERLOG_CHKPOINT_NOT_FOUND syscall.Errno = 5032 + ERROR_CLUSTERLOG_NOT_ENOUGH_SPACE syscall.Errno = 5033 + ERROR_QUORUM_OWNER_ALIVE syscall.Errno = 5034 + ERROR_NETWORK_NOT_AVAILABLE syscall.Errno = 5035 + ERROR_NODE_NOT_AVAILABLE syscall.Errno = 5036 + ERROR_ALL_NODES_NOT_AVAILABLE syscall.Errno = 5037 + ERROR_RESOURCE_FAILED syscall.Errno = 5038 + ERROR_CLUSTER_INVALID_NODE syscall.Errno = 5039 + ERROR_CLUSTER_NODE_EXISTS syscall.Errno = 5040 + ERROR_CLUSTER_JOIN_IN_PROGRESS syscall.Errno = 5041 + ERROR_CLUSTER_NODE_NOT_FOUND syscall.Errno = 5042 + ERROR_CLUSTER_LOCAL_NODE_NOT_FOUND syscall.Errno = 5043 + ERROR_CLUSTER_NETWORK_EXISTS syscall.Errno = 5044 + ERROR_CLUSTER_NETWORK_NOT_FOUND syscall.Errno = 5045 + ERROR_CLUSTER_NETINTERFACE_EXISTS syscall.Errno = 5046 + ERROR_CLUSTER_NETINTERFACE_NOT_FOUND syscall.Errno = 5047 + ERROR_CLUSTER_INVALID_REQUEST syscall.Errno = 5048 + ERROR_CLUSTER_INVALID_NETWORK_PROVIDER syscall.Errno = 5049 + ERROR_CLUSTER_NODE_DOWN syscall.Errno = 5050 + ERROR_CLUSTER_NODE_UNREACHABLE syscall.Errno = 5051 + ERROR_CLUSTER_NODE_NOT_MEMBER syscall.Errno = 5052 + ERROR_CLUSTER_JOIN_NOT_IN_PROGRESS syscall.Errno = 5053 + ERROR_CLUSTER_INVALID_NETWORK syscall.Errno = 5054 + ERROR_CLUSTER_NODE_UP syscall.Errno = 5056 + ERROR_CLUSTER_IPADDR_IN_USE syscall.Errno = 5057 + ERROR_CLUSTER_NODE_NOT_PAUSED syscall.Errno = 5058 + ERROR_CLUSTER_NO_SECURITY_CONTEXT syscall.Errno = 5059 + ERROR_CLUSTER_NETWORK_NOT_INTERNAL syscall.Errno = 5060 + ERROR_CLUSTER_NODE_ALREADY_UP syscall.Errno = 5061 + ERROR_CLUSTER_NODE_ALREADY_DOWN syscall.Errno = 5062 + ERROR_CLUSTER_NETWORK_ALREADY_ONLINE syscall.Errno = 5063 + ERROR_CLUSTER_NETWORK_ALREADY_OFFLINE syscall.Errno = 5064 + ERROR_CLUSTER_NODE_ALREADY_MEMBER syscall.Errno = 5065 + ERROR_CLUSTER_LAST_INTERNAL_NETWORK syscall.Errno = 5066 + ERROR_CLUSTER_NETWORK_HAS_DEPENDENTS syscall.Errno = 5067 + ERROR_INVALID_OPERATION_ON_QUORUM syscall.Errno = 5068 + ERROR_DEPENDENCY_NOT_ALLOWED syscall.Errno = 5069 + ERROR_CLUSTER_NODE_PAUSED syscall.Errno = 5070 + ERROR_NODE_CANT_HOST_RESOURCE syscall.Errno = 5071 + ERROR_CLUSTER_NODE_NOT_READY syscall.Errno = 5072 + ERROR_CLUSTER_NODE_SHUTTING_DOWN syscall.Errno = 5073 + ERROR_CLUSTER_JOIN_ABORTED syscall.Errno = 5074 + ERROR_CLUSTER_INCOMPATIBLE_VERSIONS syscall.Errno = 5075 + ERROR_CLUSTER_MAXNUM_OF_RESOURCES_EXCEEDED syscall.Errno = 5076 + ERROR_CLUSTER_SYSTEM_CONFIG_CHANGED syscall.Errno = 5077 + ERROR_CLUSTER_RESOURCE_TYPE_NOT_FOUND syscall.Errno = 5078 + ERROR_CLUSTER_RESTYPE_NOT_SUPPORTED syscall.Errno = 5079 + ERROR_CLUSTER_RESNAME_NOT_FOUND syscall.Errno = 5080 + ERROR_CLUSTER_NO_RPC_PACKAGES_REGISTERED syscall.Errno = 5081 + ERROR_CLUSTER_OWNER_NOT_IN_PREFLIST syscall.Errno = 5082 + ERROR_CLUSTER_DATABASE_SEQMISMATCH syscall.Errno = 5083 + ERROR_RESMON_INVALID_STATE syscall.Errno = 5084 + ERROR_CLUSTER_GUM_NOT_LOCKER syscall.Errno = 5085 + ERROR_QUORUM_DISK_NOT_FOUND syscall.Errno = 5086 + ERROR_DATABASE_BACKUP_CORRUPT syscall.Errno = 5087 + ERROR_CLUSTER_NODE_ALREADY_HAS_DFS_ROOT syscall.Errno = 5088 + ERROR_RESOURCE_PROPERTY_UNCHANGEABLE syscall.Errno = 5089 + ERROR_NO_ADMIN_ACCESS_POINT syscall.Errno = 5090 + ERROR_CLUSTER_MEMBERSHIP_INVALID_STATE syscall.Errno = 5890 + ERROR_CLUSTER_QUORUMLOG_NOT_FOUND syscall.Errno = 5891 + ERROR_CLUSTER_MEMBERSHIP_HALT syscall.Errno = 5892 + ERROR_CLUSTER_INSTANCE_ID_MISMATCH syscall.Errno = 5893 + ERROR_CLUSTER_NETWORK_NOT_FOUND_FOR_IP syscall.Errno = 5894 + ERROR_CLUSTER_PROPERTY_DATA_TYPE_MISMATCH syscall.Errno = 5895 + ERROR_CLUSTER_EVICT_WITHOUT_CLEANUP syscall.Errno = 5896 + ERROR_CLUSTER_PARAMETER_MISMATCH syscall.Errno = 5897 + ERROR_NODE_CANNOT_BE_CLUSTERED syscall.Errno = 5898 + ERROR_CLUSTER_WRONG_OS_VERSION syscall.Errno = 5899 + ERROR_CLUSTER_CANT_CREATE_DUP_CLUSTER_NAME syscall.Errno = 5900 + ERROR_CLUSCFG_ALREADY_COMMITTED syscall.Errno = 5901 + ERROR_CLUSCFG_ROLLBACK_FAILED syscall.Errno = 5902 + ERROR_CLUSCFG_SYSTEM_DISK_DRIVE_LETTER_CONFLICT syscall.Errno = 5903 + ERROR_CLUSTER_OLD_VERSION syscall.Errno = 5904 + ERROR_CLUSTER_MISMATCHED_COMPUTER_ACCT_NAME syscall.Errno = 5905 + ERROR_CLUSTER_NO_NET_ADAPTERS syscall.Errno = 5906 + ERROR_CLUSTER_POISONED syscall.Errno = 5907 + ERROR_CLUSTER_GROUP_MOVING syscall.Errno = 5908 + ERROR_CLUSTER_RESOURCE_TYPE_BUSY syscall.Errno = 5909 + ERROR_RESOURCE_CALL_TIMED_OUT syscall.Errno = 5910 + ERROR_INVALID_CLUSTER_IPV6_ADDRESS syscall.Errno = 5911 + ERROR_CLUSTER_INTERNAL_INVALID_FUNCTION syscall.Errno = 5912 + ERROR_CLUSTER_PARAMETER_OUT_OF_BOUNDS syscall.Errno = 5913 + ERROR_CLUSTER_PARTIAL_SEND syscall.Errno = 5914 + ERROR_CLUSTER_REGISTRY_INVALID_FUNCTION syscall.Errno = 5915 + ERROR_CLUSTER_INVALID_STRING_TERMINATION syscall.Errno = 5916 + ERROR_CLUSTER_INVALID_STRING_FORMAT syscall.Errno = 5917 + ERROR_CLUSTER_DATABASE_TRANSACTION_IN_PROGRESS syscall.Errno = 5918 + ERROR_CLUSTER_DATABASE_TRANSACTION_NOT_IN_PROGRESS syscall.Errno = 5919 + ERROR_CLUSTER_NULL_DATA syscall.Errno = 5920 + ERROR_CLUSTER_PARTIAL_READ syscall.Errno = 5921 + ERROR_CLUSTER_PARTIAL_WRITE syscall.Errno = 5922 + ERROR_CLUSTER_CANT_DESERIALIZE_DATA syscall.Errno = 5923 + ERROR_DEPENDENT_RESOURCE_PROPERTY_CONFLICT syscall.Errno = 5924 + ERROR_CLUSTER_NO_QUORUM syscall.Errno = 5925 + ERROR_CLUSTER_INVALID_IPV6_NETWORK syscall.Errno = 5926 + ERROR_CLUSTER_INVALID_IPV6_TUNNEL_NETWORK syscall.Errno = 5927 + ERROR_QUORUM_NOT_ALLOWED_IN_THIS_GROUP syscall.Errno = 5928 + ERROR_DEPENDENCY_TREE_TOO_COMPLEX syscall.Errno = 5929 + ERROR_EXCEPTION_IN_RESOURCE_CALL syscall.Errno = 5930 + ERROR_CLUSTER_RHS_FAILED_INITIALIZATION syscall.Errno = 5931 + ERROR_CLUSTER_NOT_INSTALLED syscall.Errno = 5932 + ERROR_CLUSTER_RESOURCES_MUST_BE_ONLINE_ON_THE_SAME_NODE syscall.Errno = 5933 + ERROR_CLUSTER_MAX_NODES_IN_CLUSTER syscall.Errno = 5934 + ERROR_CLUSTER_TOO_MANY_NODES syscall.Errno = 5935 + ERROR_CLUSTER_OBJECT_ALREADY_USED syscall.Errno = 5936 + ERROR_NONCORE_GROUPS_FOUND syscall.Errno = 5937 + ERROR_FILE_SHARE_RESOURCE_CONFLICT syscall.Errno = 5938 + ERROR_CLUSTER_EVICT_INVALID_REQUEST syscall.Errno = 5939 + ERROR_CLUSTER_SINGLETON_RESOURCE syscall.Errno = 5940 + ERROR_CLUSTER_GROUP_SINGLETON_RESOURCE syscall.Errno = 5941 + ERROR_CLUSTER_RESOURCE_PROVIDER_FAILED syscall.Errno = 5942 + ERROR_CLUSTER_RESOURCE_CONFIGURATION_ERROR syscall.Errno = 5943 + ERROR_CLUSTER_GROUP_BUSY syscall.Errno = 5944 + ERROR_CLUSTER_NOT_SHARED_VOLUME syscall.Errno = 5945 + ERROR_CLUSTER_INVALID_SECURITY_DESCRIPTOR syscall.Errno = 5946 + ERROR_CLUSTER_SHARED_VOLUMES_IN_USE syscall.Errno = 5947 + ERROR_CLUSTER_USE_SHARED_VOLUMES_API syscall.Errno = 5948 + ERROR_CLUSTER_BACKUP_IN_PROGRESS syscall.Errno = 5949 + ERROR_NON_CSV_PATH syscall.Errno = 5950 + ERROR_CSV_VOLUME_NOT_LOCAL syscall.Errno = 5951 + ERROR_CLUSTER_WATCHDOG_TERMINATING syscall.Errno = 5952 + ERROR_CLUSTER_RESOURCE_VETOED_MOVE_INCOMPATIBLE_NODES syscall.Errno = 5953 + ERROR_CLUSTER_INVALID_NODE_WEIGHT syscall.Errno = 5954 + ERROR_CLUSTER_RESOURCE_VETOED_CALL syscall.Errno = 5955 + ERROR_RESMON_SYSTEM_RESOURCES_LACKING syscall.Errno = 5956 + ERROR_CLUSTER_RESOURCE_VETOED_MOVE_NOT_ENOUGH_RESOURCES_ON_DESTINATION syscall.Errno = 5957 + ERROR_CLUSTER_RESOURCE_VETOED_MOVE_NOT_ENOUGH_RESOURCES_ON_SOURCE syscall.Errno = 5958 + ERROR_CLUSTER_GROUP_QUEUED syscall.Errno = 5959 + ERROR_CLUSTER_RESOURCE_LOCKED_STATUS syscall.Errno = 5960 + ERROR_CLUSTER_SHARED_VOLUME_FAILOVER_NOT_ALLOWED syscall.Errno = 5961 + ERROR_CLUSTER_NODE_DRAIN_IN_PROGRESS syscall.Errno = 5962 + ERROR_CLUSTER_DISK_NOT_CONNECTED syscall.Errno = 5963 + ERROR_DISK_NOT_CSV_CAPABLE syscall.Errno = 5964 + ERROR_RESOURCE_NOT_IN_AVAILABLE_STORAGE syscall.Errno = 5965 + ERROR_CLUSTER_SHARED_VOLUME_REDIRECTED syscall.Errno = 5966 + ERROR_CLUSTER_SHARED_VOLUME_NOT_REDIRECTED syscall.Errno = 5967 + ERROR_CLUSTER_CANNOT_RETURN_PROPERTIES syscall.Errno = 5968 + ERROR_CLUSTER_RESOURCE_CONTAINS_UNSUPPORTED_DIFF_AREA_FOR_SHARED_VOLUMES syscall.Errno = 5969 + ERROR_CLUSTER_RESOURCE_IS_IN_MAINTENANCE_MODE syscall.Errno = 5970 + ERROR_CLUSTER_AFFINITY_CONFLICT syscall.Errno = 5971 + ERROR_CLUSTER_RESOURCE_IS_REPLICA_VIRTUAL_MACHINE syscall.Errno = 5972 + ERROR_CLUSTER_UPGRADE_INCOMPATIBLE_VERSIONS syscall.Errno = 5973 + ERROR_CLUSTER_UPGRADE_FIX_QUORUM_NOT_SUPPORTED syscall.Errno = 5974 + ERROR_CLUSTER_UPGRADE_RESTART_REQUIRED syscall.Errno = 5975 + ERROR_CLUSTER_UPGRADE_IN_PROGRESS syscall.Errno = 5976 + ERROR_CLUSTER_UPGRADE_INCOMPLETE syscall.Errno = 5977 + ERROR_CLUSTER_NODE_IN_GRACE_PERIOD syscall.Errno = 5978 + ERROR_CLUSTER_CSV_IO_PAUSE_TIMEOUT syscall.Errno = 5979 + ERROR_NODE_NOT_ACTIVE_CLUSTER_MEMBER syscall.Errno = 5980 + ERROR_CLUSTER_RESOURCE_NOT_MONITORED syscall.Errno = 5981 + ERROR_CLUSTER_RESOURCE_DOES_NOT_SUPPORT_UNMONITORED syscall.Errno = 5982 + ERROR_CLUSTER_RESOURCE_IS_REPLICATED syscall.Errno = 5983 + ERROR_CLUSTER_NODE_ISOLATED syscall.Errno = 5984 + ERROR_CLUSTER_NODE_QUARANTINED syscall.Errno = 5985 + ERROR_CLUSTER_DATABASE_UPDATE_CONDITION_FAILED syscall.Errno = 5986 + ERROR_CLUSTER_SPACE_DEGRADED syscall.Errno = 5987 + ERROR_CLUSTER_TOKEN_DELEGATION_NOT_SUPPORTED syscall.Errno = 5988 + ERROR_CLUSTER_CSV_INVALID_HANDLE syscall.Errno = 5989 + ERROR_CLUSTER_CSV_SUPPORTED_ONLY_ON_COORDINATOR syscall.Errno = 5990 + ERROR_GROUPSET_NOT_AVAILABLE syscall.Errno = 5991 + ERROR_GROUPSET_NOT_FOUND syscall.Errno = 5992 + ERROR_GROUPSET_CANT_PROVIDE syscall.Errno = 5993 + ERROR_CLUSTER_FAULT_DOMAIN_PARENT_NOT_FOUND syscall.Errno = 5994 + ERROR_CLUSTER_FAULT_DOMAIN_INVALID_HIERARCHY syscall.Errno = 5995 + ERROR_CLUSTER_FAULT_DOMAIN_FAILED_S2D_VALIDATION syscall.Errno = 5996 + ERROR_CLUSTER_FAULT_DOMAIN_S2D_CONNECTIVITY_LOSS syscall.Errno = 5997 + ERROR_CLUSTER_INVALID_INFRASTRUCTURE_FILESERVER_NAME syscall.Errno = 5998 + ERROR_CLUSTERSET_MANAGEMENT_CLUSTER_UNREACHABLE syscall.Errno = 5999 + ERROR_ENCRYPTION_FAILED syscall.Errno = 6000 + ERROR_DECRYPTION_FAILED syscall.Errno = 6001 + ERROR_FILE_ENCRYPTED syscall.Errno = 6002 + ERROR_NO_RECOVERY_POLICY syscall.Errno = 6003 + ERROR_NO_EFS syscall.Errno = 6004 + ERROR_WRONG_EFS syscall.Errno = 6005 + ERROR_NO_USER_KEYS syscall.Errno = 6006 + ERROR_FILE_NOT_ENCRYPTED syscall.Errno = 6007 + ERROR_NOT_EXPORT_FORMAT syscall.Errno = 6008 + ERROR_FILE_READ_ONLY syscall.Errno = 6009 + ERROR_DIR_EFS_DISALLOWED syscall.Errno = 6010 + ERROR_EFS_SERVER_NOT_TRUSTED syscall.Errno = 6011 + ERROR_BAD_RECOVERY_POLICY syscall.Errno = 6012 + ERROR_EFS_ALG_BLOB_TOO_BIG syscall.Errno = 6013 + ERROR_VOLUME_NOT_SUPPORT_EFS syscall.Errno = 6014 + ERROR_EFS_DISABLED syscall.Errno = 6015 + ERROR_EFS_VERSION_NOT_SUPPORT syscall.Errno = 6016 + ERROR_CS_ENCRYPTION_INVALID_SERVER_RESPONSE syscall.Errno = 6017 + ERROR_CS_ENCRYPTION_UNSUPPORTED_SERVER syscall.Errno = 6018 + ERROR_CS_ENCRYPTION_EXISTING_ENCRYPTED_FILE syscall.Errno = 6019 + ERROR_CS_ENCRYPTION_NEW_ENCRYPTED_FILE syscall.Errno = 6020 + ERROR_CS_ENCRYPTION_FILE_NOT_CSE syscall.Errno = 6021 + ERROR_ENCRYPTION_POLICY_DENIES_OPERATION syscall.Errno = 6022 + ERROR_WIP_ENCRYPTION_FAILED syscall.Errno = 6023 + ERROR_NO_BROWSER_SERVERS_FOUND syscall.Errno = 6118 + SCHED_E_SERVICE_NOT_LOCALSYSTEM syscall.Errno = 6200 + ERROR_LOG_SECTOR_INVALID syscall.Errno = 6600 + ERROR_LOG_SECTOR_PARITY_INVALID syscall.Errno = 6601 + ERROR_LOG_SECTOR_REMAPPED syscall.Errno = 6602 + ERROR_LOG_BLOCK_INCOMPLETE syscall.Errno = 6603 + ERROR_LOG_INVALID_RANGE syscall.Errno = 6604 + ERROR_LOG_BLOCKS_EXHAUSTED syscall.Errno = 6605 + ERROR_LOG_READ_CONTEXT_INVALID syscall.Errno = 6606 + ERROR_LOG_RESTART_INVALID syscall.Errno = 6607 + ERROR_LOG_BLOCK_VERSION syscall.Errno = 6608 + ERROR_LOG_BLOCK_INVALID syscall.Errno = 6609 + ERROR_LOG_READ_MODE_INVALID syscall.Errno = 6610 + ERROR_LOG_NO_RESTART syscall.Errno = 6611 + ERROR_LOG_METADATA_CORRUPT syscall.Errno = 6612 + ERROR_LOG_METADATA_INVALID syscall.Errno = 6613 + ERROR_LOG_METADATA_INCONSISTENT syscall.Errno = 6614 + ERROR_LOG_RESERVATION_INVALID syscall.Errno = 6615 + ERROR_LOG_CANT_DELETE syscall.Errno = 6616 + ERROR_LOG_CONTAINER_LIMIT_EXCEEDED syscall.Errno = 6617 + ERROR_LOG_START_OF_LOG syscall.Errno = 6618 + ERROR_LOG_POLICY_ALREADY_INSTALLED syscall.Errno = 6619 + ERROR_LOG_POLICY_NOT_INSTALLED syscall.Errno = 6620 + ERROR_LOG_POLICY_INVALID syscall.Errno = 6621 + ERROR_LOG_POLICY_CONFLICT syscall.Errno = 6622 + ERROR_LOG_PINNED_ARCHIVE_TAIL syscall.Errno = 6623 + ERROR_LOG_RECORD_NONEXISTENT syscall.Errno = 6624 + ERROR_LOG_RECORDS_RESERVED_INVALID syscall.Errno = 6625 + ERROR_LOG_SPACE_RESERVED_INVALID syscall.Errno = 6626 + ERROR_LOG_TAIL_INVALID syscall.Errno = 6627 + ERROR_LOG_FULL syscall.Errno = 6628 + ERROR_COULD_NOT_RESIZE_LOG syscall.Errno = 6629 + ERROR_LOG_MULTIPLEXED syscall.Errno = 6630 + ERROR_LOG_DEDICATED syscall.Errno = 6631 + ERROR_LOG_ARCHIVE_NOT_IN_PROGRESS syscall.Errno = 6632 + ERROR_LOG_ARCHIVE_IN_PROGRESS syscall.Errno = 6633 + ERROR_LOG_EPHEMERAL syscall.Errno = 6634 + ERROR_LOG_NOT_ENOUGH_CONTAINERS syscall.Errno = 6635 + ERROR_LOG_CLIENT_ALREADY_REGISTERED syscall.Errno = 6636 + ERROR_LOG_CLIENT_NOT_REGISTERED syscall.Errno = 6637 + ERROR_LOG_FULL_HANDLER_IN_PROGRESS syscall.Errno = 6638 + ERROR_LOG_CONTAINER_READ_FAILED syscall.Errno = 6639 + ERROR_LOG_CONTAINER_WRITE_FAILED syscall.Errno = 6640 + ERROR_LOG_CONTAINER_OPEN_FAILED syscall.Errno = 6641 + ERROR_LOG_CONTAINER_STATE_INVALID syscall.Errno = 6642 + ERROR_LOG_STATE_INVALID syscall.Errno = 6643 + ERROR_LOG_PINNED syscall.Errno = 6644 + ERROR_LOG_METADATA_FLUSH_FAILED syscall.Errno = 6645 + ERROR_LOG_INCONSISTENT_SECURITY syscall.Errno = 6646 + ERROR_LOG_APPENDED_FLUSH_FAILED syscall.Errno = 6647 + ERROR_LOG_PINNED_RESERVATION syscall.Errno = 6648 + ERROR_INVALID_TRANSACTION syscall.Errno = 6700 + ERROR_TRANSACTION_NOT_ACTIVE syscall.Errno = 6701 + ERROR_TRANSACTION_REQUEST_NOT_VALID syscall.Errno = 6702 + ERROR_TRANSACTION_NOT_REQUESTED syscall.Errno = 6703 + ERROR_TRANSACTION_ALREADY_ABORTED syscall.Errno = 6704 + ERROR_TRANSACTION_ALREADY_COMMITTED syscall.Errno = 6705 + ERROR_TM_INITIALIZATION_FAILED syscall.Errno = 6706 + ERROR_RESOURCEMANAGER_READ_ONLY syscall.Errno = 6707 + ERROR_TRANSACTION_NOT_JOINED syscall.Errno = 6708 + ERROR_TRANSACTION_SUPERIOR_EXISTS syscall.Errno = 6709 + ERROR_CRM_PROTOCOL_ALREADY_EXISTS syscall.Errno = 6710 + ERROR_TRANSACTION_PROPAGATION_FAILED syscall.Errno = 6711 + ERROR_CRM_PROTOCOL_NOT_FOUND syscall.Errno = 6712 + ERROR_TRANSACTION_INVALID_MARSHALL_BUFFER syscall.Errno = 6713 + ERROR_CURRENT_TRANSACTION_NOT_VALID syscall.Errno = 6714 + ERROR_TRANSACTION_NOT_FOUND syscall.Errno = 6715 + ERROR_RESOURCEMANAGER_NOT_FOUND syscall.Errno = 6716 + ERROR_ENLISTMENT_NOT_FOUND syscall.Errno = 6717 + ERROR_TRANSACTIONMANAGER_NOT_FOUND syscall.Errno = 6718 + ERROR_TRANSACTIONMANAGER_NOT_ONLINE syscall.Errno = 6719 + ERROR_TRANSACTIONMANAGER_RECOVERY_NAME_COLLISION syscall.Errno = 6720 + ERROR_TRANSACTION_NOT_ROOT syscall.Errno = 6721 + ERROR_TRANSACTION_OBJECT_EXPIRED syscall.Errno = 6722 + ERROR_TRANSACTION_RESPONSE_NOT_ENLISTED syscall.Errno = 6723 + ERROR_TRANSACTION_RECORD_TOO_LONG syscall.Errno = 6724 + ERROR_IMPLICIT_TRANSACTION_NOT_SUPPORTED syscall.Errno = 6725 + ERROR_TRANSACTION_INTEGRITY_VIOLATED syscall.Errno = 6726 + ERROR_TRANSACTIONMANAGER_IDENTITY_MISMATCH syscall.Errno = 6727 + ERROR_RM_CANNOT_BE_FROZEN_FOR_SNAPSHOT syscall.Errno = 6728 + ERROR_TRANSACTION_MUST_WRITETHROUGH syscall.Errno = 6729 + ERROR_TRANSACTION_NO_SUPERIOR syscall.Errno = 6730 + ERROR_HEURISTIC_DAMAGE_POSSIBLE syscall.Errno = 6731 + ERROR_TRANSACTIONAL_CONFLICT syscall.Errno = 6800 + ERROR_RM_NOT_ACTIVE syscall.Errno = 6801 + ERROR_RM_METADATA_CORRUPT syscall.Errno = 6802 + ERROR_DIRECTORY_NOT_RM syscall.Errno = 6803 + ERROR_TRANSACTIONS_UNSUPPORTED_REMOTE syscall.Errno = 6805 + ERROR_LOG_RESIZE_INVALID_SIZE syscall.Errno = 6806 + ERROR_OBJECT_NO_LONGER_EXISTS syscall.Errno = 6807 + ERROR_STREAM_MINIVERSION_NOT_FOUND syscall.Errno = 6808 + ERROR_STREAM_MINIVERSION_NOT_VALID syscall.Errno = 6809 + ERROR_MINIVERSION_INACCESSIBLE_FROM_SPECIFIED_TRANSACTION syscall.Errno = 6810 + ERROR_CANT_OPEN_MINIVERSION_WITH_MODIFY_INTENT syscall.Errno = 6811 + ERROR_CANT_CREATE_MORE_STREAM_MINIVERSIONS syscall.Errno = 6812 + ERROR_REMOTE_FILE_VERSION_MISMATCH syscall.Errno = 6814 + ERROR_HANDLE_NO_LONGER_VALID syscall.Errno = 6815 + ERROR_NO_TXF_METADATA syscall.Errno = 6816 + ERROR_LOG_CORRUPTION_DETECTED syscall.Errno = 6817 + ERROR_CANT_RECOVER_WITH_HANDLE_OPEN syscall.Errno = 6818 + ERROR_RM_DISCONNECTED syscall.Errno = 6819 + ERROR_ENLISTMENT_NOT_SUPERIOR syscall.Errno = 6820 + ERROR_RECOVERY_NOT_NEEDED syscall.Errno = 6821 + ERROR_RM_ALREADY_STARTED syscall.Errno = 6822 + ERROR_FILE_IDENTITY_NOT_PERSISTENT syscall.Errno = 6823 + ERROR_CANT_BREAK_TRANSACTIONAL_DEPENDENCY syscall.Errno = 6824 + ERROR_CANT_CROSS_RM_BOUNDARY syscall.Errno = 6825 + ERROR_TXF_DIR_NOT_EMPTY syscall.Errno = 6826 + ERROR_INDOUBT_TRANSACTIONS_EXIST syscall.Errno = 6827 + ERROR_TM_VOLATILE syscall.Errno = 6828 + ERROR_ROLLBACK_TIMER_EXPIRED syscall.Errno = 6829 + ERROR_TXF_ATTRIBUTE_CORRUPT syscall.Errno = 6830 + ERROR_EFS_NOT_ALLOWED_IN_TRANSACTION syscall.Errno = 6831 + ERROR_TRANSACTIONAL_OPEN_NOT_ALLOWED syscall.Errno = 6832 + ERROR_LOG_GROWTH_FAILED syscall.Errno = 6833 + ERROR_TRANSACTED_MAPPING_UNSUPPORTED_REMOTE syscall.Errno = 6834 + ERROR_TXF_METADATA_ALREADY_PRESENT syscall.Errno = 6835 + ERROR_TRANSACTION_SCOPE_CALLBACKS_NOT_SET syscall.Errno = 6836 + ERROR_TRANSACTION_REQUIRED_PROMOTION syscall.Errno = 6837 + ERROR_CANNOT_EXECUTE_FILE_IN_TRANSACTION syscall.Errno = 6838 + ERROR_TRANSACTIONS_NOT_FROZEN syscall.Errno = 6839 + ERROR_TRANSACTION_FREEZE_IN_PROGRESS syscall.Errno = 6840 + ERROR_NOT_SNAPSHOT_VOLUME syscall.Errno = 6841 + ERROR_NO_SAVEPOINT_WITH_OPEN_FILES syscall.Errno = 6842 + ERROR_DATA_LOST_REPAIR syscall.Errno = 6843 + ERROR_SPARSE_NOT_ALLOWED_IN_TRANSACTION syscall.Errno = 6844 + ERROR_TM_IDENTITY_MISMATCH syscall.Errno = 6845 + ERROR_FLOATED_SECTION syscall.Errno = 6846 + ERROR_CANNOT_ACCEPT_TRANSACTED_WORK syscall.Errno = 6847 + ERROR_CANNOT_ABORT_TRANSACTIONS syscall.Errno = 6848 + ERROR_BAD_CLUSTERS syscall.Errno = 6849 + ERROR_COMPRESSION_NOT_ALLOWED_IN_TRANSACTION syscall.Errno = 6850 + ERROR_VOLUME_DIRTY syscall.Errno = 6851 + ERROR_NO_LINK_TRACKING_IN_TRANSACTION syscall.Errno = 6852 + ERROR_OPERATION_NOT_SUPPORTED_IN_TRANSACTION syscall.Errno = 6853 + ERROR_EXPIRED_HANDLE syscall.Errno = 6854 + ERROR_TRANSACTION_NOT_ENLISTED syscall.Errno = 6855 + ERROR_CTX_WINSTATION_NAME_INVALID syscall.Errno = 7001 + ERROR_CTX_INVALID_PD syscall.Errno = 7002 + ERROR_CTX_PD_NOT_FOUND syscall.Errno = 7003 + ERROR_CTX_WD_NOT_FOUND syscall.Errno = 7004 + ERROR_CTX_CANNOT_MAKE_EVENTLOG_ENTRY syscall.Errno = 7005 + ERROR_CTX_SERVICE_NAME_COLLISION syscall.Errno = 7006 + ERROR_CTX_CLOSE_PENDING syscall.Errno = 7007 + ERROR_CTX_NO_OUTBUF syscall.Errno = 7008 + ERROR_CTX_MODEM_INF_NOT_FOUND syscall.Errno = 7009 + ERROR_CTX_INVALID_MODEMNAME syscall.Errno = 7010 + ERROR_CTX_MODEM_RESPONSE_ERROR syscall.Errno = 7011 + ERROR_CTX_MODEM_RESPONSE_TIMEOUT syscall.Errno = 7012 + ERROR_CTX_MODEM_RESPONSE_NO_CARRIER syscall.Errno = 7013 + ERROR_CTX_MODEM_RESPONSE_NO_DIALTONE syscall.Errno = 7014 + ERROR_CTX_MODEM_RESPONSE_BUSY syscall.Errno = 7015 + ERROR_CTX_MODEM_RESPONSE_VOICE syscall.Errno = 7016 + ERROR_CTX_TD_ERROR syscall.Errno = 7017 + ERROR_CTX_WINSTATION_NOT_FOUND syscall.Errno = 7022 + ERROR_CTX_WINSTATION_ALREADY_EXISTS syscall.Errno = 7023 + ERROR_CTX_WINSTATION_BUSY syscall.Errno = 7024 + ERROR_CTX_BAD_VIDEO_MODE syscall.Errno = 7025 + ERROR_CTX_GRAPHICS_INVALID syscall.Errno = 7035 + ERROR_CTX_LOGON_DISABLED syscall.Errno = 7037 + ERROR_CTX_NOT_CONSOLE syscall.Errno = 7038 + ERROR_CTX_CLIENT_QUERY_TIMEOUT syscall.Errno = 7040 + ERROR_CTX_CONSOLE_DISCONNECT syscall.Errno = 7041 + ERROR_CTX_CONSOLE_CONNECT syscall.Errno = 7042 + ERROR_CTX_SHADOW_DENIED syscall.Errno = 7044 + ERROR_CTX_WINSTATION_ACCESS_DENIED syscall.Errno = 7045 + ERROR_CTX_INVALID_WD syscall.Errno = 7049 + ERROR_CTX_SHADOW_INVALID syscall.Errno = 7050 + ERROR_CTX_SHADOW_DISABLED syscall.Errno = 7051 + ERROR_CTX_CLIENT_LICENSE_IN_USE syscall.Errno = 7052 + ERROR_CTX_CLIENT_LICENSE_NOT_SET syscall.Errno = 7053 + ERROR_CTX_LICENSE_NOT_AVAILABLE syscall.Errno = 7054 + ERROR_CTX_LICENSE_CLIENT_INVALID syscall.Errno = 7055 + ERROR_CTX_LICENSE_EXPIRED syscall.Errno = 7056 + ERROR_CTX_SHADOW_NOT_RUNNING syscall.Errno = 7057 + ERROR_CTX_SHADOW_ENDED_BY_MODE_CHANGE syscall.Errno = 7058 + ERROR_ACTIVATION_COUNT_EXCEEDED syscall.Errno = 7059 + ERROR_CTX_WINSTATIONS_DISABLED syscall.Errno = 7060 + ERROR_CTX_ENCRYPTION_LEVEL_REQUIRED syscall.Errno = 7061 + ERROR_CTX_SESSION_IN_USE syscall.Errno = 7062 + ERROR_CTX_NO_FORCE_LOGOFF syscall.Errno = 7063 + ERROR_CTX_ACCOUNT_RESTRICTION syscall.Errno = 7064 + ERROR_RDP_PROTOCOL_ERROR syscall.Errno = 7065 + ERROR_CTX_CDM_CONNECT syscall.Errno = 7066 + ERROR_CTX_CDM_DISCONNECT syscall.Errno = 7067 + ERROR_CTX_SECURITY_LAYER_ERROR syscall.Errno = 7068 + ERROR_TS_INCOMPATIBLE_SESSIONS syscall.Errno = 7069 + ERROR_TS_VIDEO_SUBSYSTEM_ERROR syscall.Errno = 7070 + FRS_ERR_INVALID_API_SEQUENCE syscall.Errno = 8001 + FRS_ERR_STARTING_SERVICE syscall.Errno = 8002 + FRS_ERR_STOPPING_SERVICE syscall.Errno = 8003 + FRS_ERR_INTERNAL_API syscall.Errno = 8004 + FRS_ERR_INTERNAL syscall.Errno = 8005 + FRS_ERR_SERVICE_COMM syscall.Errno = 8006 + FRS_ERR_INSUFFICIENT_PRIV syscall.Errno = 8007 + FRS_ERR_AUTHENTICATION syscall.Errno = 8008 + FRS_ERR_PARENT_INSUFFICIENT_PRIV syscall.Errno = 8009 + FRS_ERR_PARENT_AUTHENTICATION syscall.Errno = 8010 + FRS_ERR_CHILD_TO_PARENT_COMM syscall.Errno = 8011 + FRS_ERR_PARENT_TO_CHILD_COMM syscall.Errno = 8012 + FRS_ERR_SYSVOL_POPULATE syscall.Errno = 8013 + FRS_ERR_SYSVOL_POPULATE_TIMEOUT syscall.Errno = 8014 + FRS_ERR_SYSVOL_IS_BUSY syscall.Errno = 8015 + FRS_ERR_SYSVOL_DEMOTE syscall.Errno = 8016 + FRS_ERR_INVALID_SERVICE_PARAMETER syscall.Errno = 8017 + DS_S_SUCCESS = ERROR_SUCCESS + ERROR_DS_NOT_INSTALLED syscall.Errno = 8200 + ERROR_DS_MEMBERSHIP_EVALUATED_LOCALLY syscall.Errno = 8201 + ERROR_DS_NO_ATTRIBUTE_OR_VALUE syscall.Errno = 8202 + ERROR_DS_INVALID_ATTRIBUTE_SYNTAX syscall.Errno = 8203 + ERROR_DS_ATTRIBUTE_TYPE_UNDEFINED syscall.Errno = 8204 + ERROR_DS_ATTRIBUTE_OR_VALUE_EXISTS syscall.Errno = 8205 + ERROR_DS_BUSY syscall.Errno = 8206 + ERROR_DS_UNAVAILABLE syscall.Errno = 8207 + ERROR_DS_NO_RIDS_ALLOCATED syscall.Errno = 8208 + ERROR_DS_NO_MORE_RIDS syscall.Errno = 8209 + ERROR_DS_INCORRECT_ROLE_OWNER syscall.Errno = 8210 + ERROR_DS_RIDMGR_INIT_ERROR syscall.Errno = 8211 + ERROR_DS_OBJ_CLASS_VIOLATION syscall.Errno = 8212 + ERROR_DS_CANT_ON_NON_LEAF syscall.Errno = 8213 + ERROR_DS_CANT_ON_RDN syscall.Errno = 8214 + ERROR_DS_CANT_MOD_OBJ_CLASS syscall.Errno = 8215 + ERROR_DS_CROSS_DOM_MOVE_ERROR syscall.Errno = 8216 + ERROR_DS_GC_NOT_AVAILABLE syscall.Errno = 8217 + ERROR_SHARED_POLICY syscall.Errno = 8218 + ERROR_POLICY_OBJECT_NOT_FOUND syscall.Errno = 8219 + ERROR_POLICY_ONLY_IN_DS syscall.Errno = 8220 + ERROR_PROMOTION_ACTIVE syscall.Errno = 8221 + ERROR_NO_PROMOTION_ACTIVE syscall.Errno = 8222 + ERROR_DS_OPERATIONS_ERROR syscall.Errno = 8224 + ERROR_DS_PROTOCOL_ERROR syscall.Errno = 8225 + ERROR_DS_TIMELIMIT_EXCEEDED syscall.Errno = 8226 + ERROR_DS_SIZELIMIT_EXCEEDED syscall.Errno = 8227 + ERROR_DS_ADMIN_LIMIT_EXCEEDED syscall.Errno = 8228 + ERROR_DS_COMPARE_FALSE syscall.Errno = 8229 + ERROR_DS_COMPARE_TRUE syscall.Errno = 8230 + ERROR_DS_AUTH_METHOD_NOT_SUPPORTED syscall.Errno = 8231 + ERROR_DS_STRONG_AUTH_REQUIRED syscall.Errno = 8232 + ERROR_DS_INAPPROPRIATE_AUTH syscall.Errno = 8233 + ERROR_DS_AUTH_UNKNOWN syscall.Errno = 8234 + ERROR_DS_REFERRAL syscall.Errno = 8235 + ERROR_DS_UNAVAILABLE_CRIT_EXTENSION syscall.Errno = 8236 + ERROR_DS_CONFIDENTIALITY_REQUIRED syscall.Errno = 8237 + ERROR_DS_INAPPROPRIATE_MATCHING syscall.Errno = 8238 + ERROR_DS_CONSTRAINT_VIOLATION syscall.Errno = 8239 + ERROR_DS_NO_SUCH_OBJECT syscall.Errno = 8240 + ERROR_DS_ALIAS_PROBLEM syscall.Errno = 8241 + ERROR_DS_INVALID_DN_SYNTAX syscall.Errno = 8242 + ERROR_DS_IS_LEAF syscall.Errno = 8243 + ERROR_DS_ALIAS_DEREF_PROBLEM syscall.Errno = 8244 + ERROR_DS_UNWILLING_TO_PERFORM syscall.Errno = 8245 + ERROR_DS_LOOP_DETECT syscall.Errno = 8246 + ERROR_DS_NAMING_VIOLATION syscall.Errno = 8247 + ERROR_DS_OBJECT_RESULTS_TOO_LARGE syscall.Errno = 8248 + ERROR_DS_AFFECTS_MULTIPLE_DSAS syscall.Errno = 8249 + ERROR_DS_SERVER_DOWN syscall.Errno = 8250 + ERROR_DS_LOCAL_ERROR syscall.Errno = 8251 + ERROR_DS_ENCODING_ERROR syscall.Errno = 8252 + ERROR_DS_DECODING_ERROR syscall.Errno = 8253 + ERROR_DS_FILTER_UNKNOWN syscall.Errno = 8254 + ERROR_DS_PARAM_ERROR syscall.Errno = 8255 + ERROR_DS_NOT_SUPPORTED syscall.Errno = 8256 + ERROR_DS_NO_RESULTS_RETURNED syscall.Errno = 8257 + ERROR_DS_CONTROL_NOT_FOUND syscall.Errno = 8258 + ERROR_DS_CLIENT_LOOP syscall.Errno = 8259 + ERROR_DS_REFERRAL_LIMIT_EXCEEDED syscall.Errno = 8260 + ERROR_DS_SORT_CONTROL_MISSING syscall.Errno = 8261 + ERROR_DS_OFFSET_RANGE_ERROR syscall.Errno = 8262 + ERROR_DS_RIDMGR_DISABLED syscall.Errno = 8263 + ERROR_DS_ROOT_MUST_BE_NC syscall.Errno = 8301 + ERROR_DS_ADD_REPLICA_INHIBITED syscall.Errno = 8302 + ERROR_DS_ATT_NOT_DEF_IN_SCHEMA syscall.Errno = 8303 + ERROR_DS_MAX_OBJ_SIZE_EXCEEDED syscall.Errno = 8304 + ERROR_DS_OBJ_STRING_NAME_EXISTS syscall.Errno = 8305 + ERROR_DS_NO_RDN_DEFINED_IN_SCHEMA syscall.Errno = 8306 + ERROR_DS_RDN_DOESNT_MATCH_SCHEMA syscall.Errno = 8307 + ERROR_DS_NO_REQUESTED_ATTS_FOUND syscall.Errno = 8308 + ERROR_DS_USER_BUFFER_TO_SMALL syscall.Errno = 8309 + ERROR_DS_ATT_IS_NOT_ON_OBJ syscall.Errno = 8310 + ERROR_DS_ILLEGAL_MOD_OPERATION syscall.Errno = 8311 + ERROR_DS_OBJ_TOO_LARGE syscall.Errno = 8312 + ERROR_DS_BAD_INSTANCE_TYPE syscall.Errno = 8313 + ERROR_DS_MASTERDSA_REQUIRED syscall.Errno = 8314 + ERROR_DS_OBJECT_CLASS_REQUIRED syscall.Errno = 8315 + ERROR_DS_MISSING_REQUIRED_ATT syscall.Errno = 8316 + ERROR_DS_ATT_NOT_DEF_FOR_CLASS syscall.Errno = 8317 + ERROR_DS_ATT_ALREADY_EXISTS syscall.Errno = 8318 + ERROR_DS_CANT_ADD_ATT_VALUES syscall.Errno = 8320 + ERROR_DS_SINGLE_VALUE_CONSTRAINT syscall.Errno = 8321 + ERROR_DS_RANGE_CONSTRAINT syscall.Errno = 8322 + ERROR_DS_ATT_VAL_ALREADY_EXISTS syscall.Errno = 8323 + ERROR_DS_CANT_REM_MISSING_ATT syscall.Errno = 8324 + ERROR_DS_CANT_REM_MISSING_ATT_VAL syscall.Errno = 8325 + ERROR_DS_ROOT_CANT_BE_SUBREF syscall.Errno = 8326 + ERROR_DS_NO_CHAINING syscall.Errno = 8327 + ERROR_DS_NO_CHAINED_EVAL syscall.Errno = 8328 + ERROR_DS_NO_PARENT_OBJECT syscall.Errno = 8329 + ERROR_DS_PARENT_IS_AN_ALIAS syscall.Errno = 8330 + ERROR_DS_CANT_MIX_MASTER_AND_REPS syscall.Errno = 8331 + ERROR_DS_CHILDREN_EXIST syscall.Errno = 8332 + ERROR_DS_OBJ_NOT_FOUND syscall.Errno = 8333 + ERROR_DS_ALIASED_OBJ_MISSING syscall.Errno = 8334 + ERROR_DS_BAD_NAME_SYNTAX syscall.Errno = 8335 + ERROR_DS_ALIAS_POINTS_TO_ALIAS syscall.Errno = 8336 + ERROR_DS_CANT_DEREF_ALIAS syscall.Errno = 8337 + ERROR_DS_OUT_OF_SCOPE syscall.Errno = 8338 + ERROR_DS_OBJECT_BEING_REMOVED syscall.Errno = 8339 + ERROR_DS_CANT_DELETE_DSA_OBJ syscall.Errno = 8340 + ERROR_DS_GENERIC_ERROR syscall.Errno = 8341 + ERROR_DS_DSA_MUST_BE_INT_MASTER syscall.Errno = 8342 + ERROR_DS_CLASS_NOT_DSA syscall.Errno = 8343 + ERROR_DS_INSUFF_ACCESS_RIGHTS syscall.Errno = 8344 + ERROR_DS_ILLEGAL_SUPERIOR syscall.Errno = 8345 + ERROR_DS_ATTRIBUTE_OWNED_BY_SAM syscall.Errno = 8346 + ERROR_DS_NAME_TOO_MANY_PARTS syscall.Errno = 8347 + ERROR_DS_NAME_TOO_LONG syscall.Errno = 8348 + ERROR_DS_NAME_VALUE_TOO_LONG syscall.Errno = 8349 + ERROR_DS_NAME_UNPARSEABLE syscall.Errno = 8350 + ERROR_DS_NAME_TYPE_UNKNOWN syscall.Errno = 8351 + ERROR_DS_NOT_AN_OBJECT syscall.Errno = 8352 + ERROR_DS_SEC_DESC_TOO_SHORT syscall.Errno = 8353 + ERROR_DS_SEC_DESC_INVALID syscall.Errno = 8354 + ERROR_DS_NO_DELETED_NAME syscall.Errno = 8355 + ERROR_DS_SUBREF_MUST_HAVE_PARENT syscall.Errno = 8356 + ERROR_DS_NCNAME_MUST_BE_NC syscall.Errno = 8357 + ERROR_DS_CANT_ADD_SYSTEM_ONLY syscall.Errno = 8358 + ERROR_DS_CLASS_MUST_BE_CONCRETE syscall.Errno = 8359 + ERROR_DS_INVALID_DMD syscall.Errno = 8360 + ERROR_DS_OBJ_GUID_EXISTS syscall.Errno = 8361 + ERROR_DS_NOT_ON_BACKLINK syscall.Errno = 8362 + ERROR_DS_NO_CROSSREF_FOR_NC syscall.Errno = 8363 + ERROR_DS_SHUTTING_DOWN syscall.Errno = 8364 + ERROR_DS_UNKNOWN_OPERATION syscall.Errno = 8365 + ERROR_DS_INVALID_ROLE_OWNER syscall.Errno = 8366 + ERROR_DS_COULDNT_CONTACT_FSMO syscall.Errno = 8367 + ERROR_DS_CROSS_NC_DN_RENAME syscall.Errno = 8368 + ERROR_DS_CANT_MOD_SYSTEM_ONLY syscall.Errno = 8369 + ERROR_DS_REPLICATOR_ONLY syscall.Errno = 8370 + ERROR_DS_OBJ_CLASS_NOT_DEFINED syscall.Errno = 8371 + ERROR_DS_OBJ_CLASS_NOT_SUBCLASS syscall.Errno = 8372 + ERROR_DS_NAME_REFERENCE_INVALID syscall.Errno = 8373 + ERROR_DS_CROSS_REF_EXISTS syscall.Errno = 8374 + ERROR_DS_CANT_DEL_MASTER_CROSSREF syscall.Errno = 8375 + ERROR_DS_SUBTREE_NOTIFY_NOT_NC_HEAD syscall.Errno = 8376 + ERROR_DS_NOTIFY_FILTER_TOO_COMPLEX syscall.Errno = 8377 + ERROR_DS_DUP_RDN syscall.Errno = 8378 + ERROR_DS_DUP_OID syscall.Errno = 8379 + ERROR_DS_DUP_MAPI_ID syscall.Errno = 8380 + ERROR_DS_DUP_SCHEMA_ID_GUID syscall.Errno = 8381 + ERROR_DS_DUP_LDAP_DISPLAY_NAME syscall.Errno = 8382 + ERROR_DS_SEMANTIC_ATT_TEST syscall.Errno = 8383 + ERROR_DS_SYNTAX_MISMATCH syscall.Errno = 8384 + ERROR_DS_EXISTS_IN_MUST_HAVE syscall.Errno = 8385 + ERROR_DS_EXISTS_IN_MAY_HAVE syscall.Errno = 8386 + ERROR_DS_NONEXISTENT_MAY_HAVE syscall.Errno = 8387 + ERROR_DS_NONEXISTENT_MUST_HAVE syscall.Errno = 8388 + ERROR_DS_AUX_CLS_TEST_FAIL syscall.Errno = 8389 + ERROR_DS_NONEXISTENT_POSS_SUP syscall.Errno = 8390 + ERROR_DS_SUB_CLS_TEST_FAIL syscall.Errno = 8391 + ERROR_DS_BAD_RDN_ATT_ID_SYNTAX syscall.Errno = 8392 + ERROR_DS_EXISTS_IN_AUX_CLS syscall.Errno = 8393 + ERROR_DS_EXISTS_IN_SUB_CLS syscall.Errno = 8394 + ERROR_DS_EXISTS_IN_POSS_SUP syscall.Errno = 8395 + ERROR_DS_RECALCSCHEMA_FAILED syscall.Errno = 8396 + ERROR_DS_TREE_DELETE_NOT_FINISHED syscall.Errno = 8397 + ERROR_DS_CANT_DELETE syscall.Errno = 8398 + ERROR_DS_ATT_SCHEMA_REQ_ID syscall.Errno = 8399 + ERROR_DS_BAD_ATT_SCHEMA_SYNTAX syscall.Errno = 8400 + ERROR_DS_CANT_CACHE_ATT syscall.Errno = 8401 + ERROR_DS_CANT_CACHE_CLASS syscall.Errno = 8402 + ERROR_DS_CANT_REMOVE_ATT_CACHE syscall.Errno = 8403 + ERROR_DS_CANT_REMOVE_CLASS_CACHE syscall.Errno = 8404 + ERROR_DS_CANT_RETRIEVE_DN syscall.Errno = 8405 + ERROR_DS_MISSING_SUPREF syscall.Errno = 8406 + ERROR_DS_CANT_RETRIEVE_INSTANCE syscall.Errno = 8407 + ERROR_DS_CODE_INCONSISTENCY syscall.Errno = 8408 + ERROR_DS_DATABASE_ERROR syscall.Errno = 8409 + ERROR_DS_GOVERNSID_MISSING syscall.Errno = 8410 + ERROR_DS_MISSING_EXPECTED_ATT syscall.Errno = 8411 + ERROR_DS_NCNAME_MISSING_CR_REF syscall.Errno = 8412 + ERROR_DS_SECURITY_CHECKING_ERROR syscall.Errno = 8413 + ERROR_DS_SCHEMA_NOT_LOADED syscall.Errno = 8414 + ERROR_DS_SCHEMA_ALLOC_FAILED syscall.Errno = 8415 + ERROR_DS_ATT_SCHEMA_REQ_SYNTAX syscall.Errno = 8416 + ERROR_DS_GCVERIFY_ERROR syscall.Errno = 8417 + ERROR_DS_DRA_SCHEMA_MISMATCH syscall.Errno = 8418 + ERROR_DS_CANT_FIND_DSA_OBJ syscall.Errno = 8419 + ERROR_DS_CANT_FIND_EXPECTED_NC syscall.Errno = 8420 + ERROR_DS_CANT_FIND_NC_IN_CACHE syscall.Errno = 8421 + ERROR_DS_CANT_RETRIEVE_CHILD syscall.Errno = 8422 + ERROR_DS_SECURITY_ILLEGAL_MODIFY syscall.Errno = 8423 + ERROR_DS_CANT_REPLACE_HIDDEN_REC syscall.Errno = 8424 + ERROR_DS_BAD_HIERARCHY_FILE syscall.Errno = 8425 + ERROR_DS_BUILD_HIERARCHY_TABLE_FAILED syscall.Errno = 8426 + ERROR_DS_CONFIG_PARAM_MISSING syscall.Errno = 8427 + ERROR_DS_COUNTING_AB_INDICES_FAILED syscall.Errno = 8428 + ERROR_DS_HIERARCHY_TABLE_MALLOC_FAILED syscall.Errno = 8429 + ERROR_DS_INTERNAL_FAILURE syscall.Errno = 8430 + ERROR_DS_UNKNOWN_ERROR syscall.Errno = 8431 + ERROR_DS_ROOT_REQUIRES_CLASS_TOP syscall.Errno = 8432 + ERROR_DS_REFUSING_FSMO_ROLES syscall.Errno = 8433 + ERROR_DS_MISSING_FSMO_SETTINGS syscall.Errno = 8434 + ERROR_DS_UNABLE_TO_SURRENDER_ROLES syscall.Errno = 8435 + ERROR_DS_DRA_GENERIC syscall.Errno = 8436 + ERROR_DS_DRA_INVALID_PARAMETER syscall.Errno = 8437 + ERROR_DS_DRA_BUSY syscall.Errno = 8438 + ERROR_DS_DRA_BAD_DN syscall.Errno = 8439 + ERROR_DS_DRA_BAD_NC syscall.Errno = 8440 + ERROR_DS_DRA_DN_EXISTS syscall.Errno = 8441 + ERROR_DS_DRA_INTERNAL_ERROR syscall.Errno = 8442 + ERROR_DS_DRA_INCONSISTENT_DIT syscall.Errno = 8443 + ERROR_DS_DRA_CONNECTION_FAILED syscall.Errno = 8444 + ERROR_DS_DRA_BAD_INSTANCE_TYPE syscall.Errno = 8445 + ERROR_DS_DRA_OUT_OF_MEM syscall.Errno = 8446 + ERROR_DS_DRA_MAIL_PROBLEM syscall.Errno = 8447 + ERROR_DS_DRA_REF_ALREADY_EXISTS syscall.Errno = 8448 + ERROR_DS_DRA_REF_NOT_FOUND syscall.Errno = 8449 + ERROR_DS_DRA_OBJ_IS_REP_SOURCE syscall.Errno = 8450 + ERROR_DS_DRA_DB_ERROR syscall.Errno = 8451 + ERROR_DS_DRA_NO_REPLICA syscall.Errno = 8452 + ERROR_DS_DRA_ACCESS_DENIED syscall.Errno = 8453 + ERROR_DS_DRA_NOT_SUPPORTED syscall.Errno = 8454 + ERROR_DS_DRA_RPC_CANCELLED syscall.Errno = 8455 + ERROR_DS_DRA_SOURCE_DISABLED syscall.Errno = 8456 + ERROR_DS_DRA_SINK_DISABLED syscall.Errno = 8457 + ERROR_DS_DRA_NAME_COLLISION syscall.Errno = 8458 + ERROR_DS_DRA_SOURCE_REINSTALLED syscall.Errno = 8459 + ERROR_DS_DRA_MISSING_PARENT syscall.Errno = 8460 + ERROR_DS_DRA_PREEMPTED syscall.Errno = 8461 + ERROR_DS_DRA_ABANDON_SYNC syscall.Errno = 8462 + ERROR_DS_DRA_SHUTDOWN syscall.Errno = 8463 + ERROR_DS_DRA_INCOMPATIBLE_PARTIAL_SET syscall.Errno = 8464 + ERROR_DS_DRA_SOURCE_IS_PARTIAL_REPLICA syscall.Errno = 8465 + ERROR_DS_DRA_EXTN_CONNECTION_FAILED syscall.Errno = 8466 + ERROR_DS_INSTALL_SCHEMA_MISMATCH syscall.Errno = 8467 + ERROR_DS_DUP_LINK_ID syscall.Errno = 8468 + ERROR_DS_NAME_ERROR_RESOLVING syscall.Errno = 8469 + ERROR_DS_NAME_ERROR_NOT_FOUND syscall.Errno = 8470 + ERROR_DS_NAME_ERROR_NOT_UNIQUE syscall.Errno = 8471 + ERROR_DS_NAME_ERROR_NO_MAPPING syscall.Errno = 8472 + ERROR_DS_NAME_ERROR_DOMAIN_ONLY syscall.Errno = 8473 + ERROR_DS_NAME_ERROR_NO_SYNTACTICAL_MAPPING syscall.Errno = 8474 + ERROR_DS_CONSTRUCTED_ATT_MOD syscall.Errno = 8475 + ERROR_DS_WRONG_OM_OBJ_CLASS syscall.Errno = 8476 + ERROR_DS_DRA_REPL_PENDING syscall.Errno = 8477 + ERROR_DS_DS_REQUIRED syscall.Errno = 8478 + ERROR_DS_INVALID_LDAP_DISPLAY_NAME syscall.Errno = 8479 + ERROR_DS_NON_BASE_SEARCH syscall.Errno = 8480 + ERROR_DS_CANT_RETRIEVE_ATTS syscall.Errno = 8481 + ERROR_DS_BACKLINK_WITHOUT_LINK syscall.Errno = 8482 + ERROR_DS_EPOCH_MISMATCH syscall.Errno = 8483 + ERROR_DS_SRC_NAME_MISMATCH syscall.Errno = 8484 + ERROR_DS_SRC_AND_DST_NC_IDENTICAL syscall.Errno = 8485 + ERROR_DS_DST_NC_MISMATCH syscall.Errno = 8486 + ERROR_DS_NOT_AUTHORITIVE_FOR_DST_NC syscall.Errno = 8487 + ERROR_DS_SRC_GUID_MISMATCH syscall.Errno = 8488 + ERROR_DS_CANT_MOVE_DELETED_OBJECT syscall.Errno = 8489 + ERROR_DS_PDC_OPERATION_IN_PROGRESS syscall.Errno = 8490 + ERROR_DS_CROSS_DOMAIN_CLEANUP_REQD syscall.Errno = 8491 + ERROR_DS_ILLEGAL_XDOM_MOVE_OPERATION syscall.Errno = 8492 + ERROR_DS_CANT_WITH_ACCT_GROUP_MEMBERSHPS syscall.Errno = 8493 + ERROR_DS_NC_MUST_HAVE_NC_PARENT syscall.Errno = 8494 + ERROR_DS_CR_IMPOSSIBLE_TO_VALIDATE syscall.Errno = 8495 + ERROR_DS_DST_DOMAIN_NOT_NATIVE syscall.Errno = 8496 + ERROR_DS_MISSING_INFRASTRUCTURE_CONTAINER syscall.Errno = 8497 + ERROR_DS_CANT_MOVE_ACCOUNT_GROUP syscall.Errno = 8498 + ERROR_DS_CANT_MOVE_RESOURCE_GROUP syscall.Errno = 8499 + ERROR_DS_INVALID_SEARCH_FLAG syscall.Errno = 8500 + ERROR_DS_NO_TREE_DELETE_ABOVE_NC syscall.Errno = 8501 + ERROR_DS_COULDNT_LOCK_TREE_FOR_DELETE syscall.Errno = 8502 + ERROR_DS_COULDNT_IDENTIFY_OBJECTS_FOR_TREE_DELETE syscall.Errno = 8503 + ERROR_DS_SAM_INIT_FAILURE syscall.Errno = 8504 + ERROR_DS_SENSITIVE_GROUP_VIOLATION syscall.Errno = 8505 + ERROR_DS_CANT_MOD_PRIMARYGROUPID syscall.Errno = 8506 + ERROR_DS_ILLEGAL_BASE_SCHEMA_MOD syscall.Errno = 8507 + ERROR_DS_NONSAFE_SCHEMA_CHANGE syscall.Errno = 8508 + ERROR_DS_SCHEMA_UPDATE_DISALLOWED syscall.Errno = 8509 + ERROR_DS_CANT_CREATE_UNDER_SCHEMA syscall.Errno = 8510 + ERROR_DS_INSTALL_NO_SRC_SCH_VERSION syscall.Errno = 8511 + ERROR_DS_INSTALL_NO_SCH_VERSION_IN_INIFILE syscall.Errno = 8512 + ERROR_DS_INVALID_GROUP_TYPE syscall.Errno = 8513 + ERROR_DS_NO_NEST_GLOBALGROUP_IN_MIXEDDOMAIN syscall.Errno = 8514 + ERROR_DS_NO_NEST_LOCALGROUP_IN_MIXEDDOMAIN syscall.Errno = 8515 + ERROR_DS_GLOBAL_CANT_HAVE_LOCAL_MEMBER syscall.Errno = 8516 + ERROR_DS_GLOBAL_CANT_HAVE_UNIVERSAL_MEMBER syscall.Errno = 8517 + ERROR_DS_UNIVERSAL_CANT_HAVE_LOCAL_MEMBER syscall.Errno = 8518 + ERROR_DS_GLOBAL_CANT_HAVE_CROSSDOMAIN_MEMBER syscall.Errno = 8519 + ERROR_DS_LOCAL_CANT_HAVE_CROSSDOMAIN_LOCAL_MEMBER syscall.Errno = 8520 + ERROR_DS_HAVE_PRIMARY_MEMBERS syscall.Errno = 8521 + ERROR_DS_STRING_SD_CONVERSION_FAILED syscall.Errno = 8522 + ERROR_DS_NAMING_MASTER_GC syscall.Errno = 8523 + ERROR_DS_DNS_LOOKUP_FAILURE syscall.Errno = 8524 + ERROR_DS_COULDNT_UPDATE_SPNS syscall.Errno = 8525 + ERROR_DS_CANT_RETRIEVE_SD syscall.Errno = 8526 + ERROR_DS_KEY_NOT_UNIQUE syscall.Errno = 8527 + ERROR_DS_WRONG_LINKED_ATT_SYNTAX syscall.Errno = 8528 + ERROR_DS_SAM_NEED_BOOTKEY_PASSWORD syscall.Errno = 8529 + ERROR_DS_SAM_NEED_BOOTKEY_FLOPPY syscall.Errno = 8530 + ERROR_DS_CANT_START syscall.Errno = 8531 + ERROR_DS_INIT_FAILURE syscall.Errno = 8532 + ERROR_DS_NO_PKT_PRIVACY_ON_CONNECTION syscall.Errno = 8533 + ERROR_DS_SOURCE_DOMAIN_IN_FOREST syscall.Errno = 8534 + ERROR_DS_DESTINATION_DOMAIN_NOT_IN_FOREST syscall.Errno = 8535 + ERROR_DS_DESTINATION_AUDITING_NOT_ENABLED syscall.Errno = 8536 + ERROR_DS_CANT_FIND_DC_FOR_SRC_DOMAIN syscall.Errno = 8537 + ERROR_DS_SRC_OBJ_NOT_GROUP_OR_USER syscall.Errno = 8538 + ERROR_DS_SRC_SID_EXISTS_IN_FOREST syscall.Errno = 8539 + ERROR_DS_SRC_AND_DST_OBJECT_CLASS_MISMATCH syscall.Errno = 8540 + ERROR_SAM_INIT_FAILURE syscall.Errno = 8541 + ERROR_DS_DRA_SCHEMA_INFO_SHIP syscall.Errno = 8542 + ERROR_DS_DRA_SCHEMA_CONFLICT syscall.Errno = 8543 + ERROR_DS_DRA_EARLIER_SCHEMA_CONFLICT syscall.Errno = 8544 + ERROR_DS_DRA_OBJ_NC_MISMATCH syscall.Errno = 8545 + ERROR_DS_NC_STILL_HAS_DSAS syscall.Errno = 8546 + ERROR_DS_GC_REQUIRED syscall.Errno = 8547 + ERROR_DS_LOCAL_MEMBER_OF_LOCAL_ONLY syscall.Errno = 8548 + ERROR_DS_NO_FPO_IN_UNIVERSAL_GROUPS syscall.Errno = 8549 + ERROR_DS_CANT_ADD_TO_GC syscall.Errno = 8550 + ERROR_DS_NO_CHECKPOINT_WITH_PDC syscall.Errno = 8551 + ERROR_DS_SOURCE_AUDITING_NOT_ENABLED syscall.Errno = 8552 + ERROR_DS_CANT_CREATE_IN_NONDOMAIN_NC syscall.Errno = 8553 + ERROR_DS_INVALID_NAME_FOR_SPN syscall.Errno = 8554 + ERROR_DS_FILTER_USES_CONTRUCTED_ATTRS syscall.Errno = 8555 + ERROR_DS_UNICODEPWD_NOT_IN_QUOTES syscall.Errno = 8556 + ERROR_DS_MACHINE_ACCOUNT_QUOTA_EXCEEDED syscall.Errno = 8557 + ERROR_DS_MUST_BE_RUN_ON_DST_DC syscall.Errno = 8558 + ERROR_DS_SRC_DC_MUST_BE_SP4_OR_GREATER syscall.Errno = 8559 + ERROR_DS_CANT_TREE_DELETE_CRITICAL_OBJ syscall.Errno = 8560 + ERROR_DS_INIT_FAILURE_CONSOLE syscall.Errno = 8561 + ERROR_DS_SAM_INIT_FAILURE_CONSOLE syscall.Errno = 8562 + ERROR_DS_FOREST_VERSION_TOO_HIGH syscall.Errno = 8563 + ERROR_DS_DOMAIN_VERSION_TOO_HIGH syscall.Errno = 8564 + ERROR_DS_FOREST_VERSION_TOO_LOW syscall.Errno = 8565 + ERROR_DS_DOMAIN_VERSION_TOO_LOW syscall.Errno = 8566 + ERROR_DS_INCOMPATIBLE_VERSION syscall.Errno = 8567 + ERROR_DS_LOW_DSA_VERSION syscall.Errno = 8568 + ERROR_DS_NO_BEHAVIOR_VERSION_IN_MIXEDDOMAIN syscall.Errno = 8569 + ERROR_DS_NOT_SUPPORTED_SORT_ORDER syscall.Errno = 8570 + ERROR_DS_NAME_NOT_UNIQUE syscall.Errno = 8571 + ERROR_DS_MACHINE_ACCOUNT_CREATED_PRENT4 syscall.Errno = 8572 + ERROR_DS_OUT_OF_VERSION_STORE syscall.Errno = 8573 + ERROR_DS_INCOMPATIBLE_CONTROLS_USED syscall.Errno = 8574 + ERROR_DS_NO_REF_DOMAIN syscall.Errno = 8575 + ERROR_DS_RESERVED_LINK_ID syscall.Errno = 8576 + ERROR_DS_LINK_ID_NOT_AVAILABLE syscall.Errno = 8577 + ERROR_DS_AG_CANT_HAVE_UNIVERSAL_MEMBER syscall.Errno = 8578 + ERROR_DS_MODIFYDN_DISALLOWED_BY_INSTANCE_TYPE syscall.Errno = 8579 + ERROR_DS_NO_OBJECT_MOVE_IN_SCHEMA_NC syscall.Errno = 8580 + ERROR_DS_MODIFYDN_DISALLOWED_BY_FLAG syscall.Errno = 8581 + ERROR_DS_MODIFYDN_WRONG_GRANDPARENT syscall.Errno = 8582 + ERROR_DS_NAME_ERROR_TRUST_REFERRAL syscall.Errno = 8583 + ERROR_NOT_SUPPORTED_ON_STANDARD_SERVER syscall.Errno = 8584 + ERROR_DS_CANT_ACCESS_REMOTE_PART_OF_AD syscall.Errno = 8585 + ERROR_DS_CR_IMPOSSIBLE_TO_VALIDATE_V2 syscall.Errno = 8586 + ERROR_DS_THREAD_LIMIT_EXCEEDED syscall.Errno = 8587 + ERROR_DS_NOT_CLOSEST syscall.Errno = 8588 + ERROR_DS_CANT_DERIVE_SPN_WITHOUT_SERVER_REF syscall.Errno = 8589 + ERROR_DS_SINGLE_USER_MODE_FAILED syscall.Errno = 8590 + ERROR_DS_NTDSCRIPT_SYNTAX_ERROR syscall.Errno = 8591 + ERROR_DS_NTDSCRIPT_PROCESS_ERROR syscall.Errno = 8592 + ERROR_DS_DIFFERENT_REPL_EPOCHS syscall.Errno = 8593 + ERROR_DS_DRS_EXTENSIONS_CHANGED syscall.Errno = 8594 + ERROR_DS_REPLICA_SET_CHANGE_NOT_ALLOWED_ON_DISABLED_CR syscall.Errno = 8595 + ERROR_DS_NO_MSDS_INTID syscall.Errno = 8596 + ERROR_DS_DUP_MSDS_INTID syscall.Errno = 8597 + ERROR_DS_EXISTS_IN_RDNATTID syscall.Errno = 8598 + ERROR_DS_AUTHORIZATION_FAILED syscall.Errno = 8599 + ERROR_DS_INVALID_SCRIPT syscall.Errno = 8600 + ERROR_DS_REMOTE_CROSSREF_OP_FAILED syscall.Errno = 8601 + ERROR_DS_CROSS_REF_BUSY syscall.Errno = 8602 + ERROR_DS_CANT_DERIVE_SPN_FOR_DELETED_DOMAIN syscall.Errno = 8603 + ERROR_DS_CANT_DEMOTE_WITH_WRITEABLE_NC syscall.Errno = 8604 + ERROR_DS_DUPLICATE_ID_FOUND syscall.Errno = 8605 + ERROR_DS_INSUFFICIENT_ATTR_TO_CREATE_OBJECT syscall.Errno = 8606 + ERROR_DS_GROUP_CONVERSION_ERROR syscall.Errno = 8607 + ERROR_DS_CANT_MOVE_APP_BASIC_GROUP syscall.Errno = 8608 + ERROR_DS_CANT_MOVE_APP_QUERY_GROUP syscall.Errno = 8609 + ERROR_DS_ROLE_NOT_VERIFIED syscall.Errno = 8610 + ERROR_DS_WKO_CONTAINER_CANNOT_BE_SPECIAL syscall.Errno = 8611 + ERROR_DS_DOMAIN_RENAME_IN_PROGRESS syscall.Errno = 8612 + ERROR_DS_EXISTING_AD_CHILD_NC syscall.Errno = 8613 + ERROR_DS_REPL_LIFETIME_EXCEEDED syscall.Errno = 8614 + ERROR_DS_DISALLOWED_IN_SYSTEM_CONTAINER syscall.Errno = 8615 + ERROR_DS_LDAP_SEND_QUEUE_FULL syscall.Errno = 8616 + ERROR_DS_DRA_OUT_SCHEDULE_WINDOW syscall.Errno = 8617 + ERROR_DS_POLICY_NOT_KNOWN syscall.Errno = 8618 + ERROR_NO_SITE_SETTINGS_OBJECT syscall.Errno = 8619 + ERROR_NO_SECRETS syscall.Errno = 8620 + ERROR_NO_WRITABLE_DC_FOUND syscall.Errno = 8621 + ERROR_DS_NO_SERVER_OBJECT syscall.Errno = 8622 + ERROR_DS_NO_NTDSA_OBJECT syscall.Errno = 8623 + ERROR_DS_NON_ASQ_SEARCH syscall.Errno = 8624 + ERROR_DS_AUDIT_FAILURE syscall.Errno = 8625 + ERROR_DS_INVALID_SEARCH_FLAG_SUBTREE syscall.Errno = 8626 + ERROR_DS_INVALID_SEARCH_FLAG_TUPLE syscall.Errno = 8627 + ERROR_DS_HIERARCHY_TABLE_TOO_DEEP syscall.Errno = 8628 + ERROR_DS_DRA_CORRUPT_UTD_VECTOR syscall.Errno = 8629 + ERROR_DS_DRA_SECRETS_DENIED syscall.Errno = 8630 + ERROR_DS_RESERVED_MAPI_ID syscall.Errno = 8631 + ERROR_DS_MAPI_ID_NOT_AVAILABLE syscall.Errno = 8632 + ERROR_DS_DRA_MISSING_KRBTGT_SECRET syscall.Errno = 8633 + ERROR_DS_DOMAIN_NAME_EXISTS_IN_FOREST syscall.Errno = 8634 + ERROR_DS_FLAT_NAME_EXISTS_IN_FOREST syscall.Errno = 8635 + ERROR_INVALID_USER_PRINCIPAL_NAME syscall.Errno = 8636 + ERROR_DS_OID_MAPPED_GROUP_CANT_HAVE_MEMBERS syscall.Errno = 8637 + ERROR_DS_OID_NOT_FOUND syscall.Errno = 8638 + ERROR_DS_DRA_RECYCLED_TARGET syscall.Errno = 8639 + ERROR_DS_DISALLOWED_NC_REDIRECT syscall.Errno = 8640 + ERROR_DS_HIGH_ADLDS_FFL syscall.Errno = 8641 + ERROR_DS_HIGH_DSA_VERSION syscall.Errno = 8642 + ERROR_DS_LOW_ADLDS_FFL syscall.Errno = 8643 + ERROR_DOMAIN_SID_SAME_AS_LOCAL_WORKSTATION syscall.Errno = 8644 + ERROR_DS_UNDELETE_SAM_VALIDATION_FAILED syscall.Errno = 8645 + ERROR_INCORRECT_ACCOUNT_TYPE syscall.Errno = 8646 + ERROR_DS_SPN_VALUE_NOT_UNIQUE_IN_FOREST syscall.Errno = 8647 + ERROR_DS_UPN_VALUE_NOT_UNIQUE_IN_FOREST syscall.Errno = 8648 + ERROR_DS_MISSING_FOREST_TRUST syscall.Errno = 8649 + ERROR_DS_VALUE_KEY_NOT_UNIQUE syscall.Errno = 8650 + DNS_ERROR_RESPONSE_CODES_BASE syscall.Errno = 9000 + DNS_ERROR_RCODE_NO_ERROR = ERROR_SUCCESS + DNS_ERROR_MASK syscall.Errno = 0x00002328 + DNS_ERROR_RCODE_FORMAT_ERROR syscall.Errno = 9001 + DNS_ERROR_RCODE_SERVER_FAILURE syscall.Errno = 9002 + DNS_ERROR_RCODE_NAME_ERROR syscall.Errno = 9003 + DNS_ERROR_RCODE_NOT_IMPLEMENTED syscall.Errno = 9004 + DNS_ERROR_RCODE_REFUSED syscall.Errno = 9005 + DNS_ERROR_RCODE_YXDOMAIN syscall.Errno = 9006 + DNS_ERROR_RCODE_YXRRSET syscall.Errno = 9007 + DNS_ERROR_RCODE_NXRRSET syscall.Errno = 9008 + DNS_ERROR_RCODE_NOTAUTH syscall.Errno = 9009 + DNS_ERROR_RCODE_NOTZONE syscall.Errno = 9010 + DNS_ERROR_RCODE_BADSIG syscall.Errno = 9016 + DNS_ERROR_RCODE_BADKEY syscall.Errno = 9017 + DNS_ERROR_RCODE_BADTIME syscall.Errno = 9018 + DNS_ERROR_RCODE_LAST = DNS_ERROR_RCODE_BADTIME + DNS_ERROR_DNSSEC_BASE syscall.Errno = 9100 + DNS_ERROR_KEYMASTER_REQUIRED syscall.Errno = 9101 + DNS_ERROR_NOT_ALLOWED_ON_SIGNED_ZONE syscall.Errno = 9102 + DNS_ERROR_NSEC3_INCOMPATIBLE_WITH_RSA_SHA1 syscall.Errno = 9103 + DNS_ERROR_NOT_ENOUGH_SIGNING_KEY_DESCRIPTORS syscall.Errno = 9104 + DNS_ERROR_UNSUPPORTED_ALGORITHM syscall.Errno = 9105 + DNS_ERROR_INVALID_KEY_SIZE syscall.Errno = 9106 + DNS_ERROR_SIGNING_KEY_NOT_ACCESSIBLE syscall.Errno = 9107 + DNS_ERROR_KSP_DOES_NOT_SUPPORT_PROTECTION syscall.Errno = 9108 + DNS_ERROR_UNEXPECTED_DATA_PROTECTION_ERROR syscall.Errno = 9109 + DNS_ERROR_UNEXPECTED_CNG_ERROR syscall.Errno = 9110 + DNS_ERROR_UNKNOWN_SIGNING_PARAMETER_VERSION syscall.Errno = 9111 + DNS_ERROR_KSP_NOT_ACCESSIBLE syscall.Errno = 9112 + DNS_ERROR_TOO_MANY_SKDS syscall.Errno = 9113 + DNS_ERROR_INVALID_ROLLOVER_PERIOD syscall.Errno = 9114 + DNS_ERROR_INVALID_INITIAL_ROLLOVER_OFFSET syscall.Errno = 9115 + DNS_ERROR_ROLLOVER_IN_PROGRESS syscall.Errno = 9116 + DNS_ERROR_STANDBY_KEY_NOT_PRESENT syscall.Errno = 9117 + DNS_ERROR_NOT_ALLOWED_ON_ZSK syscall.Errno = 9118 + DNS_ERROR_NOT_ALLOWED_ON_ACTIVE_SKD syscall.Errno = 9119 + DNS_ERROR_ROLLOVER_ALREADY_QUEUED syscall.Errno = 9120 + DNS_ERROR_NOT_ALLOWED_ON_UNSIGNED_ZONE syscall.Errno = 9121 + DNS_ERROR_BAD_KEYMASTER syscall.Errno = 9122 + DNS_ERROR_INVALID_SIGNATURE_VALIDITY_PERIOD syscall.Errno = 9123 + DNS_ERROR_INVALID_NSEC3_ITERATION_COUNT syscall.Errno = 9124 + DNS_ERROR_DNSSEC_IS_DISABLED syscall.Errno = 9125 + DNS_ERROR_INVALID_XML syscall.Errno = 9126 + DNS_ERROR_NO_VALID_TRUST_ANCHORS syscall.Errno = 9127 + DNS_ERROR_ROLLOVER_NOT_POKEABLE syscall.Errno = 9128 + DNS_ERROR_NSEC3_NAME_COLLISION syscall.Errno = 9129 + DNS_ERROR_NSEC_INCOMPATIBLE_WITH_NSEC3_RSA_SHA1 syscall.Errno = 9130 + DNS_ERROR_PACKET_FMT_BASE syscall.Errno = 9500 + DNS_INFO_NO_RECORDS syscall.Errno = 9501 + DNS_ERROR_BAD_PACKET syscall.Errno = 9502 + DNS_ERROR_NO_PACKET syscall.Errno = 9503 + DNS_ERROR_RCODE syscall.Errno = 9504 + DNS_ERROR_UNSECURE_PACKET syscall.Errno = 9505 + DNS_STATUS_PACKET_UNSECURE = DNS_ERROR_UNSECURE_PACKET + DNS_REQUEST_PENDING syscall.Errno = 9506 + DNS_ERROR_NO_MEMORY = ERROR_OUTOFMEMORY + DNS_ERROR_INVALID_NAME = ERROR_INVALID_NAME + DNS_ERROR_INVALID_DATA = ERROR_INVALID_DATA + DNS_ERROR_GENERAL_API_BASE syscall.Errno = 9550 + DNS_ERROR_INVALID_TYPE syscall.Errno = 9551 + DNS_ERROR_INVALID_IP_ADDRESS syscall.Errno = 9552 + DNS_ERROR_INVALID_PROPERTY syscall.Errno = 9553 + DNS_ERROR_TRY_AGAIN_LATER syscall.Errno = 9554 + DNS_ERROR_NOT_UNIQUE syscall.Errno = 9555 + DNS_ERROR_NON_RFC_NAME syscall.Errno = 9556 + DNS_STATUS_FQDN syscall.Errno = 9557 + DNS_STATUS_DOTTED_NAME syscall.Errno = 9558 + DNS_STATUS_SINGLE_PART_NAME syscall.Errno = 9559 + DNS_ERROR_INVALID_NAME_CHAR syscall.Errno = 9560 + DNS_ERROR_NUMERIC_NAME syscall.Errno = 9561 + DNS_ERROR_NOT_ALLOWED_ON_ROOT_SERVER syscall.Errno = 9562 + DNS_ERROR_NOT_ALLOWED_UNDER_DELEGATION syscall.Errno = 9563 + DNS_ERROR_CANNOT_FIND_ROOT_HINTS syscall.Errno = 9564 + DNS_ERROR_INCONSISTENT_ROOT_HINTS syscall.Errno = 9565 + DNS_ERROR_DWORD_VALUE_TOO_SMALL syscall.Errno = 9566 + DNS_ERROR_DWORD_VALUE_TOO_LARGE syscall.Errno = 9567 + DNS_ERROR_BACKGROUND_LOADING syscall.Errno = 9568 + DNS_ERROR_NOT_ALLOWED_ON_RODC syscall.Errno = 9569 + DNS_ERROR_NOT_ALLOWED_UNDER_DNAME syscall.Errno = 9570 + DNS_ERROR_DELEGATION_REQUIRED syscall.Errno = 9571 + DNS_ERROR_INVALID_POLICY_TABLE syscall.Errno = 9572 + DNS_ERROR_ADDRESS_REQUIRED syscall.Errno = 9573 + DNS_ERROR_ZONE_BASE syscall.Errno = 9600 + DNS_ERROR_ZONE_DOES_NOT_EXIST syscall.Errno = 9601 + DNS_ERROR_NO_ZONE_INFO syscall.Errno = 9602 + DNS_ERROR_INVALID_ZONE_OPERATION syscall.Errno = 9603 + DNS_ERROR_ZONE_CONFIGURATION_ERROR syscall.Errno = 9604 + DNS_ERROR_ZONE_HAS_NO_SOA_RECORD syscall.Errno = 9605 + DNS_ERROR_ZONE_HAS_NO_NS_RECORDS syscall.Errno = 9606 + DNS_ERROR_ZONE_LOCKED syscall.Errno = 9607 + DNS_ERROR_ZONE_CREATION_FAILED syscall.Errno = 9608 + DNS_ERROR_ZONE_ALREADY_EXISTS syscall.Errno = 9609 + DNS_ERROR_AUTOZONE_ALREADY_EXISTS syscall.Errno = 9610 + DNS_ERROR_INVALID_ZONE_TYPE syscall.Errno = 9611 + DNS_ERROR_SECONDARY_REQUIRES_MASTER_IP syscall.Errno = 9612 + DNS_ERROR_ZONE_NOT_SECONDARY syscall.Errno = 9613 + DNS_ERROR_NEED_SECONDARY_ADDRESSES syscall.Errno = 9614 + DNS_ERROR_WINS_INIT_FAILED syscall.Errno = 9615 + DNS_ERROR_NEED_WINS_SERVERS syscall.Errno = 9616 + DNS_ERROR_NBSTAT_INIT_FAILED syscall.Errno = 9617 + DNS_ERROR_SOA_DELETE_INVALID syscall.Errno = 9618 + DNS_ERROR_FORWARDER_ALREADY_EXISTS syscall.Errno = 9619 + DNS_ERROR_ZONE_REQUIRES_MASTER_IP syscall.Errno = 9620 + DNS_ERROR_ZONE_IS_SHUTDOWN syscall.Errno = 9621 + DNS_ERROR_ZONE_LOCKED_FOR_SIGNING syscall.Errno = 9622 + DNS_ERROR_DATAFILE_BASE syscall.Errno = 9650 + DNS_ERROR_PRIMARY_REQUIRES_DATAFILE syscall.Errno = 9651 + DNS_ERROR_INVALID_DATAFILE_NAME syscall.Errno = 9652 + DNS_ERROR_DATAFILE_OPEN_FAILURE syscall.Errno = 9653 + DNS_ERROR_FILE_WRITEBACK_FAILED syscall.Errno = 9654 + DNS_ERROR_DATAFILE_PARSING syscall.Errno = 9655 + DNS_ERROR_DATABASE_BASE syscall.Errno = 9700 + DNS_ERROR_RECORD_DOES_NOT_EXIST syscall.Errno = 9701 + DNS_ERROR_RECORD_FORMAT syscall.Errno = 9702 + DNS_ERROR_NODE_CREATION_FAILED syscall.Errno = 9703 + DNS_ERROR_UNKNOWN_RECORD_TYPE syscall.Errno = 9704 + DNS_ERROR_RECORD_TIMED_OUT syscall.Errno = 9705 + DNS_ERROR_NAME_NOT_IN_ZONE syscall.Errno = 9706 + DNS_ERROR_CNAME_LOOP syscall.Errno = 9707 + DNS_ERROR_NODE_IS_CNAME syscall.Errno = 9708 + DNS_ERROR_CNAME_COLLISION syscall.Errno = 9709 + DNS_ERROR_RECORD_ONLY_AT_ZONE_ROOT syscall.Errno = 9710 + DNS_ERROR_RECORD_ALREADY_EXISTS syscall.Errno = 9711 + DNS_ERROR_SECONDARY_DATA syscall.Errno = 9712 + DNS_ERROR_NO_CREATE_CACHE_DATA syscall.Errno = 9713 + DNS_ERROR_NAME_DOES_NOT_EXIST syscall.Errno = 9714 + DNS_WARNING_PTR_CREATE_FAILED syscall.Errno = 9715 + DNS_WARNING_DOMAIN_UNDELETED syscall.Errno = 9716 + DNS_ERROR_DS_UNAVAILABLE syscall.Errno = 9717 + DNS_ERROR_DS_ZONE_ALREADY_EXISTS syscall.Errno = 9718 + DNS_ERROR_NO_BOOTFILE_IF_DS_ZONE syscall.Errno = 9719 + DNS_ERROR_NODE_IS_DNAME syscall.Errno = 9720 + DNS_ERROR_DNAME_COLLISION syscall.Errno = 9721 + DNS_ERROR_ALIAS_LOOP syscall.Errno = 9722 + DNS_ERROR_OPERATION_BASE syscall.Errno = 9750 + DNS_INFO_AXFR_COMPLETE syscall.Errno = 9751 + DNS_ERROR_AXFR syscall.Errno = 9752 + DNS_INFO_ADDED_LOCAL_WINS syscall.Errno = 9753 + DNS_ERROR_SECURE_BASE syscall.Errno = 9800 + DNS_STATUS_CONTINUE_NEEDED syscall.Errno = 9801 + DNS_ERROR_SETUP_BASE syscall.Errno = 9850 + DNS_ERROR_NO_TCPIP syscall.Errno = 9851 + DNS_ERROR_NO_DNS_SERVERS syscall.Errno = 9852 + DNS_ERROR_DP_BASE syscall.Errno = 9900 + DNS_ERROR_DP_DOES_NOT_EXIST syscall.Errno = 9901 + DNS_ERROR_DP_ALREADY_EXISTS syscall.Errno = 9902 + DNS_ERROR_DP_NOT_ENLISTED syscall.Errno = 9903 + DNS_ERROR_DP_ALREADY_ENLISTED syscall.Errno = 9904 + DNS_ERROR_DP_NOT_AVAILABLE syscall.Errno = 9905 + DNS_ERROR_DP_FSMO_ERROR syscall.Errno = 9906 + DNS_ERROR_RRL_NOT_ENABLED syscall.Errno = 9911 + DNS_ERROR_RRL_INVALID_WINDOW_SIZE syscall.Errno = 9912 + DNS_ERROR_RRL_INVALID_IPV4_PREFIX syscall.Errno = 9913 + DNS_ERROR_RRL_INVALID_IPV6_PREFIX syscall.Errno = 9914 + DNS_ERROR_RRL_INVALID_TC_RATE syscall.Errno = 9915 + DNS_ERROR_RRL_INVALID_LEAK_RATE syscall.Errno = 9916 + DNS_ERROR_RRL_LEAK_RATE_LESSTHAN_TC_RATE syscall.Errno = 9917 + DNS_ERROR_VIRTUALIZATION_INSTANCE_ALREADY_EXISTS syscall.Errno = 9921 + DNS_ERROR_VIRTUALIZATION_INSTANCE_DOES_NOT_EXIST syscall.Errno = 9922 + DNS_ERROR_VIRTUALIZATION_TREE_LOCKED syscall.Errno = 9923 + DNS_ERROR_INVAILD_VIRTUALIZATION_INSTANCE_NAME syscall.Errno = 9924 + DNS_ERROR_DEFAULT_VIRTUALIZATION_INSTANCE syscall.Errno = 9925 + DNS_ERROR_ZONESCOPE_ALREADY_EXISTS syscall.Errno = 9951 + DNS_ERROR_ZONESCOPE_DOES_NOT_EXIST syscall.Errno = 9952 + DNS_ERROR_DEFAULT_ZONESCOPE syscall.Errno = 9953 + DNS_ERROR_INVALID_ZONESCOPE_NAME syscall.Errno = 9954 + DNS_ERROR_NOT_ALLOWED_WITH_ZONESCOPES syscall.Errno = 9955 + DNS_ERROR_LOAD_ZONESCOPE_FAILED syscall.Errno = 9956 + DNS_ERROR_ZONESCOPE_FILE_WRITEBACK_FAILED syscall.Errno = 9957 + DNS_ERROR_INVALID_SCOPE_NAME syscall.Errno = 9958 + DNS_ERROR_SCOPE_DOES_NOT_EXIST syscall.Errno = 9959 + DNS_ERROR_DEFAULT_SCOPE syscall.Errno = 9960 + DNS_ERROR_INVALID_SCOPE_OPERATION syscall.Errno = 9961 + DNS_ERROR_SCOPE_LOCKED syscall.Errno = 9962 + DNS_ERROR_SCOPE_ALREADY_EXISTS syscall.Errno = 9963 + DNS_ERROR_POLICY_ALREADY_EXISTS syscall.Errno = 9971 + DNS_ERROR_POLICY_DOES_NOT_EXIST syscall.Errno = 9972 + DNS_ERROR_POLICY_INVALID_CRITERIA syscall.Errno = 9973 + DNS_ERROR_POLICY_INVALID_SETTINGS syscall.Errno = 9974 + DNS_ERROR_CLIENT_SUBNET_IS_ACCESSED syscall.Errno = 9975 + DNS_ERROR_CLIENT_SUBNET_DOES_NOT_EXIST syscall.Errno = 9976 + DNS_ERROR_CLIENT_SUBNET_ALREADY_EXISTS syscall.Errno = 9977 + DNS_ERROR_SUBNET_DOES_NOT_EXIST syscall.Errno = 9978 + DNS_ERROR_SUBNET_ALREADY_EXISTS syscall.Errno = 9979 + DNS_ERROR_POLICY_LOCKED syscall.Errno = 9980 + DNS_ERROR_POLICY_INVALID_WEIGHT syscall.Errno = 9981 + DNS_ERROR_POLICY_INVALID_NAME syscall.Errno = 9982 + DNS_ERROR_POLICY_MISSING_CRITERIA syscall.Errno = 9983 + DNS_ERROR_INVALID_CLIENT_SUBNET_NAME syscall.Errno = 9984 + DNS_ERROR_POLICY_PROCESSING_ORDER_INVALID syscall.Errno = 9985 + DNS_ERROR_POLICY_SCOPE_MISSING syscall.Errno = 9986 + DNS_ERROR_POLICY_SCOPE_NOT_ALLOWED syscall.Errno = 9987 + DNS_ERROR_SERVERSCOPE_IS_REFERENCED syscall.Errno = 9988 + DNS_ERROR_ZONESCOPE_IS_REFERENCED syscall.Errno = 9989 + DNS_ERROR_POLICY_INVALID_CRITERIA_CLIENT_SUBNET syscall.Errno = 9990 + DNS_ERROR_POLICY_INVALID_CRITERIA_TRANSPORT_PROTOCOL syscall.Errno = 9991 + DNS_ERROR_POLICY_INVALID_CRITERIA_NETWORK_PROTOCOL syscall.Errno = 9992 + DNS_ERROR_POLICY_INVALID_CRITERIA_INTERFACE syscall.Errno = 9993 + DNS_ERROR_POLICY_INVALID_CRITERIA_FQDN syscall.Errno = 9994 + DNS_ERROR_POLICY_INVALID_CRITERIA_QUERY_TYPE syscall.Errno = 9995 + DNS_ERROR_POLICY_INVALID_CRITERIA_TIME_OF_DAY syscall.Errno = 9996 + WSABASEERR syscall.Errno = 10000 + WSAEINTR syscall.Errno = 10004 + WSAEBADF syscall.Errno = 10009 + WSAEACCES syscall.Errno = 10013 + WSAEFAULT syscall.Errno = 10014 + WSAEINVAL syscall.Errno = 10022 + WSAEMFILE syscall.Errno = 10024 + WSAEWOULDBLOCK syscall.Errno = 10035 + WSAEINPROGRESS syscall.Errno = 10036 + WSAEALREADY syscall.Errno = 10037 + WSAENOTSOCK syscall.Errno = 10038 + WSAEDESTADDRREQ syscall.Errno = 10039 + WSAEMSGSIZE syscall.Errno = 10040 + WSAEPROTOTYPE syscall.Errno = 10041 + WSAENOPROTOOPT syscall.Errno = 10042 + WSAEPROTONOSUPPORT syscall.Errno = 10043 + WSAESOCKTNOSUPPORT syscall.Errno = 10044 + WSAEOPNOTSUPP syscall.Errno = 10045 + WSAEPFNOSUPPORT syscall.Errno = 10046 + WSAEAFNOSUPPORT syscall.Errno = 10047 + WSAEADDRINUSE syscall.Errno = 10048 + WSAEADDRNOTAVAIL syscall.Errno = 10049 + WSAENETDOWN syscall.Errno = 10050 + WSAENETUNREACH syscall.Errno = 10051 + WSAENETRESET syscall.Errno = 10052 + WSAECONNABORTED syscall.Errno = 10053 + WSAECONNRESET syscall.Errno = 10054 + WSAENOBUFS syscall.Errno = 10055 + WSAEISCONN syscall.Errno = 10056 + WSAENOTCONN syscall.Errno = 10057 + WSAESHUTDOWN syscall.Errno = 10058 + WSAETOOMANYREFS syscall.Errno = 10059 + WSAETIMEDOUT syscall.Errno = 10060 + WSAECONNREFUSED syscall.Errno = 10061 + WSAELOOP syscall.Errno = 10062 + WSAENAMETOOLONG syscall.Errno = 10063 + WSAEHOSTDOWN syscall.Errno = 10064 + WSAEHOSTUNREACH syscall.Errno = 10065 + WSAENOTEMPTY syscall.Errno = 10066 + WSAEPROCLIM syscall.Errno = 10067 + WSAEUSERS syscall.Errno = 10068 + WSAEDQUOT syscall.Errno = 10069 + WSAESTALE syscall.Errno = 10070 + WSAEREMOTE syscall.Errno = 10071 + WSASYSNOTREADY syscall.Errno = 10091 + WSAVERNOTSUPPORTED syscall.Errno = 10092 + WSANOTINITIALISED syscall.Errno = 10093 + WSAEDISCON syscall.Errno = 10101 + WSAENOMORE syscall.Errno = 10102 + WSAECANCELLED syscall.Errno = 10103 + WSAEINVALIDPROCTABLE syscall.Errno = 10104 + WSAEINVALIDPROVIDER syscall.Errno = 10105 + WSAEPROVIDERFAILEDINIT syscall.Errno = 10106 + WSASYSCALLFAILURE syscall.Errno = 10107 + WSASERVICE_NOT_FOUND syscall.Errno = 10108 + WSATYPE_NOT_FOUND syscall.Errno = 10109 + WSA_E_NO_MORE syscall.Errno = 10110 + WSA_E_CANCELLED syscall.Errno = 10111 + WSAEREFUSED syscall.Errno = 10112 + WSAHOST_NOT_FOUND syscall.Errno = 11001 + WSATRY_AGAIN syscall.Errno = 11002 + WSANO_RECOVERY syscall.Errno = 11003 + WSANO_DATA syscall.Errno = 11004 + WSA_QOS_RECEIVERS syscall.Errno = 11005 + WSA_QOS_SENDERS syscall.Errno = 11006 + WSA_QOS_NO_SENDERS syscall.Errno = 11007 + WSA_QOS_NO_RECEIVERS syscall.Errno = 11008 + WSA_QOS_REQUEST_CONFIRMED syscall.Errno = 11009 + WSA_QOS_ADMISSION_FAILURE syscall.Errno = 11010 + WSA_QOS_POLICY_FAILURE syscall.Errno = 11011 + WSA_QOS_BAD_STYLE syscall.Errno = 11012 + WSA_QOS_BAD_OBJECT syscall.Errno = 11013 + WSA_QOS_TRAFFIC_CTRL_ERROR syscall.Errno = 11014 + WSA_QOS_GENERIC_ERROR syscall.Errno = 11015 + WSA_QOS_ESERVICETYPE syscall.Errno = 11016 + WSA_QOS_EFLOWSPEC syscall.Errno = 11017 + WSA_QOS_EPROVSPECBUF syscall.Errno = 11018 + WSA_QOS_EFILTERSTYLE syscall.Errno = 11019 + WSA_QOS_EFILTERTYPE syscall.Errno = 11020 + WSA_QOS_EFILTERCOUNT syscall.Errno = 11021 + WSA_QOS_EOBJLENGTH syscall.Errno = 11022 + WSA_QOS_EFLOWCOUNT syscall.Errno = 11023 + WSA_QOS_EUNKOWNPSOBJ syscall.Errno = 11024 + WSA_QOS_EPOLICYOBJ syscall.Errno = 11025 + WSA_QOS_EFLOWDESC syscall.Errno = 11026 + WSA_QOS_EPSFLOWSPEC syscall.Errno = 11027 + WSA_QOS_EPSFILTERSPEC syscall.Errno = 11028 + WSA_QOS_ESDMODEOBJ syscall.Errno = 11029 + WSA_QOS_ESHAPERATEOBJ syscall.Errno = 11030 + WSA_QOS_RESERVED_PETYPE syscall.Errno = 11031 + WSA_SECURE_HOST_NOT_FOUND syscall.Errno = 11032 + WSA_IPSEC_NAME_POLICY_ERROR syscall.Errno = 11033 + ERROR_IPSEC_QM_POLICY_EXISTS syscall.Errno = 13000 + ERROR_IPSEC_QM_POLICY_NOT_FOUND syscall.Errno = 13001 + ERROR_IPSEC_QM_POLICY_IN_USE syscall.Errno = 13002 + ERROR_IPSEC_MM_POLICY_EXISTS syscall.Errno = 13003 + ERROR_IPSEC_MM_POLICY_NOT_FOUND syscall.Errno = 13004 + ERROR_IPSEC_MM_POLICY_IN_USE syscall.Errno = 13005 + ERROR_IPSEC_MM_FILTER_EXISTS syscall.Errno = 13006 + ERROR_IPSEC_MM_FILTER_NOT_FOUND syscall.Errno = 13007 + ERROR_IPSEC_TRANSPORT_FILTER_EXISTS syscall.Errno = 13008 + ERROR_IPSEC_TRANSPORT_FILTER_NOT_FOUND syscall.Errno = 13009 + ERROR_IPSEC_MM_AUTH_EXISTS syscall.Errno = 13010 + ERROR_IPSEC_MM_AUTH_NOT_FOUND syscall.Errno = 13011 + ERROR_IPSEC_MM_AUTH_IN_USE syscall.Errno = 13012 + ERROR_IPSEC_DEFAULT_MM_POLICY_NOT_FOUND syscall.Errno = 13013 + ERROR_IPSEC_DEFAULT_MM_AUTH_NOT_FOUND syscall.Errno = 13014 + ERROR_IPSEC_DEFAULT_QM_POLICY_NOT_FOUND syscall.Errno = 13015 + ERROR_IPSEC_TUNNEL_FILTER_EXISTS syscall.Errno = 13016 + ERROR_IPSEC_TUNNEL_FILTER_NOT_FOUND syscall.Errno = 13017 + ERROR_IPSEC_MM_FILTER_PENDING_DELETION syscall.Errno = 13018 + ERROR_IPSEC_TRANSPORT_FILTER_PENDING_DELETION syscall.Errno = 13019 + ERROR_IPSEC_TUNNEL_FILTER_PENDING_DELETION syscall.Errno = 13020 + ERROR_IPSEC_MM_POLICY_PENDING_DELETION syscall.Errno = 13021 + ERROR_IPSEC_MM_AUTH_PENDING_DELETION syscall.Errno = 13022 + ERROR_IPSEC_QM_POLICY_PENDING_DELETION syscall.Errno = 13023 + WARNING_IPSEC_MM_POLICY_PRUNED syscall.Errno = 13024 + WARNING_IPSEC_QM_POLICY_PRUNED syscall.Errno = 13025 + ERROR_IPSEC_IKE_NEG_STATUS_BEGIN syscall.Errno = 13800 + ERROR_IPSEC_IKE_AUTH_FAIL syscall.Errno = 13801 + ERROR_IPSEC_IKE_ATTRIB_FAIL syscall.Errno = 13802 + ERROR_IPSEC_IKE_NEGOTIATION_PENDING syscall.Errno = 13803 + ERROR_IPSEC_IKE_GENERAL_PROCESSING_ERROR syscall.Errno = 13804 + ERROR_IPSEC_IKE_TIMED_OUT syscall.Errno = 13805 + ERROR_IPSEC_IKE_NO_CERT syscall.Errno = 13806 + ERROR_IPSEC_IKE_SA_DELETED syscall.Errno = 13807 + ERROR_IPSEC_IKE_SA_REAPED syscall.Errno = 13808 + ERROR_IPSEC_IKE_MM_ACQUIRE_DROP syscall.Errno = 13809 + ERROR_IPSEC_IKE_QM_ACQUIRE_DROP syscall.Errno = 13810 + ERROR_IPSEC_IKE_QUEUE_DROP_MM syscall.Errno = 13811 + ERROR_IPSEC_IKE_QUEUE_DROP_NO_MM syscall.Errno = 13812 + ERROR_IPSEC_IKE_DROP_NO_RESPONSE syscall.Errno = 13813 + ERROR_IPSEC_IKE_MM_DELAY_DROP syscall.Errno = 13814 + ERROR_IPSEC_IKE_QM_DELAY_DROP syscall.Errno = 13815 + ERROR_IPSEC_IKE_ERROR syscall.Errno = 13816 + ERROR_IPSEC_IKE_CRL_FAILED syscall.Errno = 13817 + ERROR_IPSEC_IKE_INVALID_KEY_USAGE syscall.Errno = 13818 + ERROR_IPSEC_IKE_INVALID_CERT_TYPE syscall.Errno = 13819 + ERROR_IPSEC_IKE_NO_PRIVATE_KEY syscall.Errno = 13820 + ERROR_IPSEC_IKE_SIMULTANEOUS_REKEY syscall.Errno = 13821 + ERROR_IPSEC_IKE_DH_FAIL syscall.Errno = 13822 + ERROR_IPSEC_IKE_CRITICAL_PAYLOAD_NOT_RECOGNIZED syscall.Errno = 13823 + ERROR_IPSEC_IKE_INVALID_HEADER syscall.Errno = 13824 + ERROR_IPSEC_IKE_NO_POLICY syscall.Errno = 13825 + ERROR_IPSEC_IKE_INVALID_SIGNATURE syscall.Errno = 13826 + ERROR_IPSEC_IKE_KERBEROS_ERROR syscall.Errno = 13827 + ERROR_IPSEC_IKE_NO_PUBLIC_KEY syscall.Errno = 13828 + ERROR_IPSEC_IKE_PROCESS_ERR syscall.Errno = 13829 + ERROR_IPSEC_IKE_PROCESS_ERR_SA syscall.Errno = 13830 + ERROR_IPSEC_IKE_PROCESS_ERR_PROP syscall.Errno = 13831 + ERROR_IPSEC_IKE_PROCESS_ERR_TRANS syscall.Errno = 13832 + ERROR_IPSEC_IKE_PROCESS_ERR_KE syscall.Errno = 13833 + ERROR_IPSEC_IKE_PROCESS_ERR_ID syscall.Errno = 13834 + ERROR_IPSEC_IKE_PROCESS_ERR_CERT syscall.Errno = 13835 + ERROR_IPSEC_IKE_PROCESS_ERR_CERT_REQ syscall.Errno = 13836 + ERROR_IPSEC_IKE_PROCESS_ERR_HASH syscall.Errno = 13837 + ERROR_IPSEC_IKE_PROCESS_ERR_SIG syscall.Errno = 13838 + ERROR_IPSEC_IKE_PROCESS_ERR_NONCE syscall.Errno = 13839 + ERROR_IPSEC_IKE_PROCESS_ERR_NOTIFY syscall.Errno = 13840 + ERROR_IPSEC_IKE_PROCESS_ERR_DELETE syscall.Errno = 13841 + ERROR_IPSEC_IKE_PROCESS_ERR_VENDOR syscall.Errno = 13842 + ERROR_IPSEC_IKE_INVALID_PAYLOAD syscall.Errno = 13843 + ERROR_IPSEC_IKE_LOAD_SOFT_SA syscall.Errno = 13844 + ERROR_IPSEC_IKE_SOFT_SA_TORN_DOWN syscall.Errno = 13845 + ERROR_IPSEC_IKE_INVALID_COOKIE syscall.Errno = 13846 + ERROR_IPSEC_IKE_NO_PEER_CERT syscall.Errno = 13847 + ERROR_IPSEC_IKE_PEER_CRL_FAILED syscall.Errno = 13848 + ERROR_IPSEC_IKE_POLICY_CHANGE syscall.Errno = 13849 + ERROR_IPSEC_IKE_NO_MM_POLICY syscall.Errno = 13850 + ERROR_IPSEC_IKE_NOTCBPRIV syscall.Errno = 13851 + ERROR_IPSEC_IKE_SECLOADFAIL syscall.Errno = 13852 + ERROR_IPSEC_IKE_FAILSSPINIT syscall.Errno = 13853 + ERROR_IPSEC_IKE_FAILQUERYSSP syscall.Errno = 13854 + ERROR_IPSEC_IKE_SRVACQFAIL syscall.Errno = 13855 + ERROR_IPSEC_IKE_SRVQUERYCRED syscall.Errno = 13856 + ERROR_IPSEC_IKE_GETSPIFAIL syscall.Errno = 13857 + ERROR_IPSEC_IKE_INVALID_FILTER syscall.Errno = 13858 + ERROR_IPSEC_IKE_OUT_OF_MEMORY syscall.Errno = 13859 + ERROR_IPSEC_IKE_ADD_UPDATE_KEY_FAILED syscall.Errno = 13860 + ERROR_IPSEC_IKE_INVALID_POLICY syscall.Errno = 13861 + ERROR_IPSEC_IKE_UNKNOWN_DOI syscall.Errno = 13862 + ERROR_IPSEC_IKE_INVALID_SITUATION syscall.Errno = 13863 + ERROR_IPSEC_IKE_DH_FAILURE syscall.Errno = 13864 + ERROR_IPSEC_IKE_INVALID_GROUP syscall.Errno = 13865 + ERROR_IPSEC_IKE_ENCRYPT syscall.Errno = 13866 + ERROR_IPSEC_IKE_DECRYPT syscall.Errno = 13867 + ERROR_IPSEC_IKE_POLICY_MATCH syscall.Errno = 13868 + ERROR_IPSEC_IKE_UNSUPPORTED_ID syscall.Errno = 13869 + ERROR_IPSEC_IKE_INVALID_HASH syscall.Errno = 13870 + ERROR_IPSEC_IKE_INVALID_HASH_ALG syscall.Errno = 13871 + ERROR_IPSEC_IKE_INVALID_HASH_SIZE syscall.Errno = 13872 + ERROR_IPSEC_IKE_INVALID_ENCRYPT_ALG syscall.Errno = 13873 + ERROR_IPSEC_IKE_INVALID_AUTH_ALG syscall.Errno = 13874 + ERROR_IPSEC_IKE_INVALID_SIG syscall.Errno = 13875 + ERROR_IPSEC_IKE_LOAD_FAILED syscall.Errno = 13876 + ERROR_IPSEC_IKE_RPC_DELETE syscall.Errno = 13877 + ERROR_IPSEC_IKE_BENIGN_REINIT syscall.Errno = 13878 + ERROR_IPSEC_IKE_INVALID_RESPONDER_LIFETIME_NOTIFY syscall.Errno = 13879 + ERROR_IPSEC_IKE_INVALID_MAJOR_VERSION syscall.Errno = 13880 + ERROR_IPSEC_IKE_INVALID_CERT_KEYLEN syscall.Errno = 13881 + ERROR_IPSEC_IKE_MM_LIMIT syscall.Errno = 13882 + ERROR_IPSEC_IKE_NEGOTIATION_DISABLED syscall.Errno = 13883 + ERROR_IPSEC_IKE_QM_LIMIT syscall.Errno = 13884 + ERROR_IPSEC_IKE_MM_EXPIRED syscall.Errno = 13885 + ERROR_IPSEC_IKE_PEER_MM_ASSUMED_INVALID syscall.Errno = 13886 + ERROR_IPSEC_IKE_CERT_CHAIN_POLICY_MISMATCH syscall.Errno = 13887 + ERROR_IPSEC_IKE_UNEXPECTED_MESSAGE_ID syscall.Errno = 13888 + ERROR_IPSEC_IKE_INVALID_AUTH_PAYLOAD syscall.Errno = 13889 + ERROR_IPSEC_IKE_DOS_COOKIE_SENT syscall.Errno = 13890 + ERROR_IPSEC_IKE_SHUTTING_DOWN syscall.Errno = 13891 + ERROR_IPSEC_IKE_CGA_AUTH_FAILED syscall.Errno = 13892 + ERROR_IPSEC_IKE_PROCESS_ERR_NATOA syscall.Errno = 13893 + ERROR_IPSEC_IKE_INVALID_MM_FOR_QM syscall.Errno = 13894 + ERROR_IPSEC_IKE_QM_EXPIRED syscall.Errno = 13895 + ERROR_IPSEC_IKE_TOO_MANY_FILTERS syscall.Errno = 13896 + ERROR_IPSEC_IKE_NEG_STATUS_END syscall.Errno = 13897 + ERROR_IPSEC_IKE_KILL_DUMMY_NAP_TUNNEL syscall.Errno = 13898 + ERROR_IPSEC_IKE_INNER_IP_ASSIGNMENT_FAILURE syscall.Errno = 13899 + ERROR_IPSEC_IKE_REQUIRE_CP_PAYLOAD_MISSING syscall.Errno = 13900 + ERROR_IPSEC_KEY_MODULE_IMPERSONATION_NEGOTIATION_PENDING syscall.Errno = 13901 + ERROR_IPSEC_IKE_COEXISTENCE_SUPPRESS syscall.Errno = 13902 + ERROR_IPSEC_IKE_RATELIMIT_DROP syscall.Errno = 13903 + ERROR_IPSEC_IKE_PEER_DOESNT_SUPPORT_MOBIKE syscall.Errno = 13904 + ERROR_IPSEC_IKE_AUTHORIZATION_FAILURE syscall.Errno = 13905 + ERROR_IPSEC_IKE_STRONG_CRED_AUTHORIZATION_FAILURE syscall.Errno = 13906 + ERROR_IPSEC_IKE_AUTHORIZATION_FAILURE_WITH_OPTIONAL_RETRY syscall.Errno = 13907 + ERROR_IPSEC_IKE_STRONG_CRED_AUTHORIZATION_AND_CERTMAP_FAILURE syscall.Errno = 13908 + ERROR_IPSEC_IKE_NEG_STATUS_EXTENDED_END syscall.Errno = 13909 + ERROR_IPSEC_BAD_SPI syscall.Errno = 13910 + ERROR_IPSEC_SA_LIFETIME_EXPIRED syscall.Errno = 13911 + ERROR_IPSEC_WRONG_SA syscall.Errno = 13912 + ERROR_IPSEC_REPLAY_CHECK_FAILED syscall.Errno = 13913 + ERROR_IPSEC_INVALID_PACKET syscall.Errno = 13914 + ERROR_IPSEC_INTEGRITY_CHECK_FAILED syscall.Errno = 13915 + ERROR_IPSEC_CLEAR_TEXT_DROP syscall.Errno = 13916 + ERROR_IPSEC_AUTH_FIREWALL_DROP syscall.Errno = 13917 + ERROR_IPSEC_THROTTLE_DROP syscall.Errno = 13918 + ERROR_IPSEC_DOSP_BLOCK syscall.Errno = 13925 + ERROR_IPSEC_DOSP_RECEIVED_MULTICAST syscall.Errno = 13926 + ERROR_IPSEC_DOSP_INVALID_PACKET syscall.Errno = 13927 + ERROR_IPSEC_DOSP_STATE_LOOKUP_FAILED syscall.Errno = 13928 + ERROR_IPSEC_DOSP_MAX_ENTRIES syscall.Errno = 13929 + ERROR_IPSEC_DOSP_KEYMOD_NOT_ALLOWED syscall.Errno = 13930 + ERROR_IPSEC_DOSP_NOT_INSTALLED syscall.Errno = 13931 + ERROR_IPSEC_DOSP_MAX_PER_IP_RATELIMIT_QUEUES syscall.Errno = 13932 + ERROR_SXS_SECTION_NOT_FOUND syscall.Errno = 14000 + ERROR_SXS_CANT_GEN_ACTCTX syscall.Errno = 14001 + ERROR_SXS_INVALID_ACTCTXDATA_FORMAT syscall.Errno = 14002 + ERROR_SXS_ASSEMBLY_NOT_FOUND syscall.Errno = 14003 + ERROR_SXS_MANIFEST_FORMAT_ERROR syscall.Errno = 14004 + ERROR_SXS_MANIFEST_PARSE_ERROR syscall.Errno = 14005 + ERROR_SXS_ACTIVATION_CONTEXT_DISABLED syscall.Errno = 14006 + ERROR_SXS_KEY_NOT_FOUND syscall.Errno = 14007 + ERROR_SXS_VERSION_CONFLICT syscall.Errno = 14008 + ERROR_SXS_WRONG_SECTION_TYPE syscall.Errno = 14009 + ERROR_SXS_THREAD_QUERIES_DISABLED syscall.Errno = 14010 + ERROR_SXS_PROCESS_DEFAULT_ALREADY_SET syscall.Errno = 14011 + ERROR_SXS_UNKNOWN_ENCODING_GROUP syscall.Errno = 14012 + ERROR_SXS_UNKNOWN_ENCODING syscall.Errno = 14013 + ERROR_SXS_INVALID_XML_NAMESPACE_URI syscall.Errno = 14014 + ERROR_SXS_ROOT_MANIFEST_DEPENDENCY_NOT_INSTALLED syscall.Errno = 14015 + ERROR_SXS_LEAF_MANIFEST_DEPENDENCY_NOT_INSTALLED syscall.Errno = 14016 + ERROR_SXS_INVALID_ASSEMBLY_IDENTITY_ATTRIBUTE syscall.Errno = 14017 + ERROR_SXS_MANIFEST_MISSING_REQUIRED_DEFAULT_NAMESPACE syscall.Errno = 14018 + ERROR_SXS_MANIFEST_INVALID_REQUIRED_DEFAULT_NAMESPACE syscall.Errno = 14019 + ERROR_SXS_PRIVATE_MANIFEST_CROSS_PATH_WITH_REPARSE_POINT syscall.Errno = 14020 + ERROR_SXS_DUPLICATE_DLL_NAME syscall.Errno = 14021 + ERROR_SXS_DUPLICATE_WINDOWCLASS_NAME syscall.Errno = 14022 + ERROR_SXS_DUPLICATE_CLSID syscall.Errno = 14023 + ERROR_SXS_DUPLICATE_IID syscall.Errno = 14024 + ERROR_SXS_DUPLICATE_TLBID syscall.Errno = 14025 + ERROR_SXS_DUPLICATE_PROGID syscall.Errno = 14026 + ERROR_SXS_DUPLICATE_ASSEMBLY_NAME syscall.Errno = 14027 + ERROR_SXS_FILE_HASH_MISMATCH syscall.Errno = 14028 + ERROR_SXS_POLICY_PARSE_ERROR syscall.Errno = 14029 + ERROR_SXS_XML_E_MISSINGQUOTE syscall.Errno = 14030 + ERROR_SXS_XML_E_COMMENTSYNTAX syscall.Errno = 14031 + ERROR_SXS_XML_E_BADSTARTNAMECHAR syscall.Errno = 14032 + ERROR_SXS_XML_E_BADNAMECHAR syscall.Errno = 14033 + ERROR_SXS_XML_E_BADCHARINSTRING syscall.Errno = 14034 + ERROR_SXS_XML_E_XMLDECLSYNTAX syscall.Errno = 14035 + ERROR_SXS_XML_E_BADCHARDATA syscall.Errno = 14036 + ERROR_SXS_XML_E_MISSINGWHITESPACE syscall.Errno = 14037 + ERROR_SXS_XML_E_EXPECTINGTAGEND syscall.Errno = 14038 + ERROR_SXS_XML_E_MISSINGSEMICOLON syscall.Errno = 14039 + ERROR_SXS_XML_E_UNBALANCEDPAREN syscall.Errno = 14040 + ERROR_SXS_XML_E_INTERNALERROR syscall.Errno = 14041 + ERROR_SXS_XML_E_UNEXPECTED_WHITESPACE syscall.Errno = 14042 + ERROR_SXS_XML_E_INCOMPLETE_ENCODING syscall.Errno = 14043 + ERROR_SXS_XML_E_MISSING_PAREN syscall.Errno = 14044 + ERROR_SXS_XML_E_EXPECTINGCLOSEQUOTE syscall.Errno = 14045 + ERROR_SXS_XML_E_MULTIPLE_COLONS syscall.Errno = 14046 + ERROR_SXS_XML_E_INVALID_DECIMAL syscall.Errno = 14047 + ERROR_SXS_XML_E_INVALID_HEXIDECIMAL syscall.Errno = 14048 + ERROR_SXS_XML_E_INVALID_UNICODE syscall.Errno = 14049 + ERROR_SXS_XML_E_WHITESPACEORQUESTIONMARK syscall.Errno = 14050 + ERROR_SXS_XML_E_UNEXPECTEDENDTAG syscall.Errno = 14051 + ERROR_SXS_XML_E_UNCLOSEDTAG syscall.Errno = 14052 + ERROR_SXS_XML_E_DUPLICATEATTRIBUTE syscall.Errno = 14053 + ERROR_SXS_XML_E_MULTIPLEROOTS syscall.Errno = 14054 + ERROR_SXS_XML_E_INVALIDATROOTLEVEL syscall.Errno = 14055 + ERROR_SXS_XML_E_BADXMLDECL syscall.Errno = 14056 + ERROR_SXS_XML_E_MISSINGROOT syscall.Errno = 14057 + ERROR_SXS_XML_E_UNEXPECTEDEOF syscall.Errno = 14058 + ERROR_SXS_XML_E_BADPEREFINSUBSET syscall.Errno = 14059 + ERROR_SXS_XML_E_UNCLOSEDSTARTTAG syscall.Errno = 14060 + ERROR_SXS_XML_E_UNCLOSEDENDTAG syscall.Errno = 14061 + ERROR_SXS_XML_E_UNCLOSEDSTRING syscall.Errno = 14062 + ERROR_SXS_XML_E_UNCLOSEDCOMMENT syscall.Errno = 14063 + ERROR_SXS_XML_E_UNCLOSEDDECL syscall.Errno = 14064 + ERROR_SXS_XML_E_UNCLOSEDCDATA syscall.Errno = 14065 + ERROR_SXS_XML_E_RESERVEDNAMESPACE syscall.Errno = 14066 + ERROR_SXS_XML_E_INVALIDENCODING syscall.Errno = 14067 + ERROR_SXS_XML_E_INVALIDSWITCH syscall.Errno = 14068 + ERROR_SXS_XML_E_BADXMLCASE syscall.Errno = 14069 + ERROR_SXS_XML_E_INVALID_STANDALONE syscall.Errno = 14070 + ERROR_SXS_XML_E_UNEXPECTED_STANDALONE syscall.Errno = 14071 + ERROR_SXS_XML_E_INVALID_VERSION syscall.Errno = 14072 + ERROR_SXS_XML_E_MISSINGEQUALS syscall.Errno = 14073 + ERROR_SXS_PROTECTION_RECOVERY_FAILED syscall.Errno = 14074 + ERROR_SXS_PROTECTION_PUBLIC_KEY_TOO_SHORT syscall.Errno = 14075 + ERROR_SXS_PROTECTION_CATALOG_NOT_VALID syscall.Errno = 14076 + ERROR_SXS_UNTRANSLATABLE_HRESULT syscall.Errno = 14077 + ERROR_SXS_PROTECTION_CATALOG_FILE_MISSING syscall.Errno = 14078 + ERROR_SXS_MISSING_ASSEMBLY_IDENTITY_ATTRIBUTE syscall.Errno = 14079 + ERROR_SXS_INVALID_ASSEMBLY_IDENTITY_ATTRIBUTE_NAME syscall.Errno = 14080 + ERROR_SXS_ASSEMBLY_MISSING syscall.Errno = 14081 + ERROR_SXS_CORRUPT_ACTIVATION_STACK syscall.Errno = 14082 + ERROR_SXS_CORRUPTION syscall.Errno = 14083 + ERROR_SXS_EARLY_DEACTIVATION syscall.Errno = 14084 + ERROR_SXS_INVALID_DEACTIVATION syscall.Errno = 14085 + ERROR_SXS_MULTIPLE_DEACTIVATION syscall.Errno = 14086 + ERROR_SXS_PROCESS_TERMINATION_REQUESTED syscall.Errno = 14087 + ERROR_SXS_RELEASE_ACTIVATION_CONTEXT syscall.Errno = 14088 + ERROR_SXS_SYSTEM_DEFAULT_ACTIVATION_CONTEXT_EMPTY syscall.Errno = 14089 + ERROR_SXS_INVALID_IDENTITY_ATTRIBUTE_VALUE syscall.Errno = 14090 + ERROR_SXS_INVALID_IDENTITY_ATTRIBUTE_NAME syscall.Errno = 14091 + ERROR_SXS_IDENTITY_DUPLICATE_ATTRIBUTE syscall.Errno = 14092 + ERROR_SXS_IDENTITY_PARSE_ERROR syscall.Errno = 14093 + ERROR_MALFORMED_SUBSTITUTION_STRING syscall.Errno = 14094 + ERROR_SXS_INCORRECT_PUBLIC_KEY_TOKEN syscall.Errno = 14095 + ERROR_UNMAPPED_SUBSTITUTION_STRING syscall.Errno = 14096 + ERROR_SXS_ASSEMBLY_NOT_LOCKED syscall.Errno = 14097 + ERROR_SXS_COMPONENT_STORE_CORRUPT syscall.Errno = 14098 + ERROR_ADVANCED_INSTALLER_FAILED syscall.Errno = 14099 + ERROR_XML_ENCODING_MISMATCH syscall.Errno = 14100 + ERROR_SXS_MANIFEST_IDENTITY_SAME_BUT_CONTENTS_DIFFERENT syscall.Errno = 14101 + ERROR_SXS_IDENTITIES_DIFFERENT syscall.Errno = 14102 + ERROR_SXS_ASSEMBLY_IS_NOT_A_DEPLOYMENT syscall.Errno = 14103 + ERROR_SXS_FILE_NOT_PART_OF_ASSEMBLY syscall.Errno = 14104 + ERROR_SXS_MANIFEST_TOO_BIG syscall.Errno = 14105 + ERROR_SXS_SETTING_NOT_REGISTERED syscall.Errno = 14106 + ERROR_SXS_TRANSACTION_CLOSURE_INCOMPLETE syscall.Errno = 14107 + ERROR_SMI_PRIMITIVE_INSTALLER_FAILED syscall.Errno = 14108 + ERROR_GENERIC_COMMAND_FAILED syscall.Errno = 14109 + ERROR_SXS_FILE_HASH_MISSING syscall.Errno = 14110 + ERROR_SXS_DUPLICATE_ACTIVATABLE_CLASS syscall.Errno = 14111 + ERROR_EVT_INVALID_CHANNEL_PATH syscall.Errno = 15000 + ERROR_EVT_INVALID_QUERY syscall.Errno = 15001 + ERROR_EVT_PUBLISHER_METADATA_NOT_FOUND syscall.Errno = 15002 + ERROR_EVT_EVENT_TEMPLATE_NOT_FOUND syscall.Errno = 15003 + ERROR_EVT_INVALID_PUBLISHER_NAME syscall.Errno = 15004 + ERROR_EVT_INVALID_EVENT_DATA syscall.Errno = 15005 + ERROR_EVT_CHANNEL_NOT_FOUND syscall.Errno = 15007 + ERROR_EVT_MALFORMED_XML_TEXT syscall.Errno = 15008 + ERROR_EVT_SUBSCRIPTION_TO_DIRECT_CHANNEL syscall.Errno = 15009 + ERROR_EVT_CONFIGURATION_ERROR syscall.Errno = 15010 + ERROR_EVT_QUERY_RESULT_STALE syscall.Errno = 15011 + ERROR_EVT_QUERY_RESULT_INVALID_POSITION syscall.Errno = 15012 + ERROR_EVT_NON_VALIDATING_MSXML syscall.Errno = 15013 + ERROR_EVT_FILTER_ALREADYSCOPED syscall.Errno = 15014 + ERROR_EVT_FILTER_NOTELTSET syscall.Errno = 15015 + ERROR_EVT_FILTER_INVARG syscall.Errno = 15016 + ERROR_EVT_FILTER_INVTEST syscall.Errno = 15017 + ERROR_EVT_FILTER_INVTYPE syscall.Errno = 15018 + ERROR_EVT_FILTER_PARSEERR syscall.Errno = 15019 + ERROR_EVT_FILTER_UNSUPPORTEDOP syscall.Errno = 15020 + ERROR_EVT_FILTER_UNEXPECTEDTOKEN syscall.Errno = 15021 + ERROR_EVT_INVALID_OPERATION_OVER_ENABLED_DIRECT_CHANNEL syscall.Errno = 15022 + ERROR_EVT_INVALID_CHANNEL_PROPERTY_VALUE syscall.Errno = 15023 + ERROR_EVT_INVALID_PUBLISHER_PROPERTY_VALUE syscall.Errno = 15024 + ERROR_EVT_CHANNEL_CANNOT_ACTIVATE syscall.Errno = 15025 + ERROR_EVT_FILTER_TOO_COMPLEX syscall.Errno = 15026 + ERROR_EVT_MESSAGE_NOT_FOUND syscall.Errno = 15027 + ERROR_EVT_MESSAGE_ID_NOT_FOUND syscall.Errno = 15028 + ERROR_EVT_UNRESOLVED_VALUE_INSERT syscall.Errno = 15029 + ERROR_EVT_UNRESOLVED_PARAMETER_INSERT syscall.Errno = 15030 + ERROR_EVT_MAX_INSERTS_REACHED syscall.Errno = 15031 + ERROR_EVT_EVENT_DEFINITION_NOT_FOUND syscall.Errno = 15032 + ERROR_EVT_MESSAGE_LOCALE_NOT_FOUND syscall.Errno = 15033 + ERROR_EVT_VERSION_TOO_OLD syscall.Errno = 15034 + ERROR_EVT_VERSION_TOO_NEW syscall.Errno = 15035 + ERROR_EVT_CANNOT_OPEN_CHANNEL_OF_QUERY syscall.Errno = 15036 + ERROR_EVT_PUBLISHER_DISABLED syscall.Errno = 15037 + ERROR_EVT_FILTER_OUT_OF_RANGE syscall.Errno = 15038 + ERROR_EC_SUBSCRIPTION_CANNOT_ACTIVATE syscall.Errno = 15080 + ERROR_EC_LOG_DISABLED syscall.Errno = 15081 + ERROR_EC_CIRCULAR_FORWARDING syscall.Errno = 15082 + ERROR_EC_CREDSTORE_FULL syscall.Errno = 15083 + ERROR_EC_CRED_NOT_FOUND syscall.Errno = 15084 + ERROR_EC_NO_ACTIVE_CHANNEL syscall.Errno = 15085 + ERROR_MUI_FILE_NOT_FOUND syscall.Errno = 15100 + ERROR_MUI_INVALID_FILE syscall.Errno = 15101 + ERROR_MUI_INVALID_RC_CONFIG syscall.Errno = 15102 + ERROR_MUI_INVALID_LOCALE_NAME syscall.Errno = 15103 + ERROR_MUI_INVALID_ULTIMATEFALLBACK_NAME syscall.Errno = 15104 + ERROR_MUI_FILE_NOT_LOADED syscall.Errno = 15105 + ERROR_RESOURCE_ENUM_USER_STOP syscall.Errno = 15106 + ERROR_MUI_INTLSETTINGS_UILANG_NOT_INSTALLED syscall.Errno = 15107 + ERROR_MUI_INTLSETTINGS_INVALID_LOCALE_NAME syscall.Errno = 15108 + ERROR_MRM_RUNTIME_NO_DEFAULT_OR_NEUTRAL_RESOURCE syscall.Errno = 15110 + ERROR_MRM_INVALID_PRICONFIG syscall.Errno = 15111 + ERROR_MRM_INVALID_FILE_TYPE syscall.Errno = 15112 + ERROR_MRM_UNKNOWN_QUALIFIER syscall.Errno = 15113 + ERROR_MRM_INVALID_QUALIFIER_VALUE syscall.Errno = 15114 + ERROR_MRM_NO_CANDIDATE syscall.Errno = 15115 + ERROR_MRM_NO_MATCH_OR_DEFAULT_CANDIDATE syscall.Errno = 15116 + ERROR_MRM_RESOURCE_TYPE_MISMATCH syscall.Errno = 15117 + ERROR_MRM_DUPLICATE_MAP_NAME syscall.Errno = 15118 + ERROR_MRM_DUPLICATE_ENTRY syscall.Errno = 15119 + ERROR_MRM_INVALID_RESOURCE_IDENTIFIER syscall.Errno = 15120 + ERROR_MRM_FILEPATH_TOO_LONG syscall.Errno = 15121 + ERROR_MRM_UNSUPPORTED_DIRECTORY_TYPE syscall.Errno = 15122 + ERROR_MRM_INVALID_PRI_FILE syscall.Errno = 15126 + ERROR_MRM_NAMED_RESOURCE_NOT_FOUND syscall.Errno = 15127 + ERROR_MRM_MAP_NOT_FOUND syscall.Errno = 15135 + ERROR_MRM_UNSUPPORTED_PROFILE_TYPE syscall.Errno = 15136 + ERROR_MRM_INVALID_QUALIFIER_OPERATOR syscall.Errno = 15137 + ERROR_MRM_INDETERMINATE_QUALIFIER_VALUE syscall.Errno = 15138 + ERROR_MRM_AUTOMERGE_ENABLED syscall.Errno = 15139 + ERROR_MRM_TOO_MANY_RESOURCES syscall.Errno = 15140 + ERROR_MRM_UNSUPPORTED_FILE_TYPE_FOR_MERGE syscall.Errno = 15141 + ERROR_MRM_UNSUPPORTED_FILE_TYPE_FOR_LOAD_UNLOAD_PRI_FILE syscall.Errno = 15142 + ERROR_MRM_NO_CURRENT_VIEW_ON_THREAD syscall.Errno = 15143 + ERROR_DIFFERENT_PROFILE_RESOURCE_MANAGER_EXIST syscall.Errno = 15144 + ERROR_OPERATION_NOT_ALLOWED_FROM_SYSTEM_COMPONENT syscall.Errno = 15145 + ERROR_MRM_DIRECT_REF_TO_NON_DEFAULT_RESOURCE syscall.Errno = 15146 + ERROR_MRM_GENERATION_COUNT_MISMATCH syscall.Errno = 15147 + ERROR_PRI_MERGE_VERSION_MISMATCH syscall.Errno = 15148 + ERROR_PRI_MERGE_MISSING_SCHEMA syscall.Errno = 15149 + ERROR_PRI_MERGE_LOAD_FILE_FAILED syscall.Errno = 15150 + ERROR_PRI_MERGE_ADD_FILE_FAILED syscall.Errno = 15151 + ERROR_PRI_MERGE_WRITE_FILE_FAILED syscall.Errno = 15152 + ERROR_PRI_MERGE_MULTIPLE_PACKAGE_FAMILIES_NOT_ALLOWED syscall.Errno = 15153 + ERROR_PRI_MERGE_MULTIPLE_MAIN_PACKAGES_NOT_ALLOWED syscall.Errno = 15154 + ERROR_PRI_MERGE_BUNDLE_PACKAGES_NOT_ALLOWED syscall.Errno = 15155 + ERROR_PRI_MERGE_MAIN_PACKAGE_REQUIRED syscall.Errno = 15156 + ERROR_PRI_MERGE_RESOURCE_PACKAGE_REQUIRED syscall.Errno = 15157 + ERROR_PRI_MERGE_INVALID_FILE_NAME syscall.Errno = 15158 + ERROR_MRM_PACKAGE_NOT_FOUND syscall.Errno = 15159 + ERROR_MRM_MISSING_DEFAULT_LANGUAGE syscall.Errno = 15160 + ERROR_MCA_INVALID_CAPABILITIES_STRING syscall.Errno = 15200 + ERROR_MCA_INVALID_VCP_VERSION syscall.Errno = 15201 + ERROR_MCA_MONITOR_VIOLATES_MCCS_SPECIFICATION syscall.Errno = 15202 + ERROR_MCA_MCCS_VERSION_MISMATCH syscall.Errno = 15203 + ERROR_MCA_UNSUPPORTED_MCCS_VERSION syscall.Errno = 15204 + ERROR_MCA_INTERNAL_ERROR syscall.Errno = 15205 + ERROR_MCA_INVALID_TECHNOLOGY_TYPE_RETURNED syscall.Errno = 15206 + ERROR_MCA_UNSUPPORTED_COLOR_TEMPERATURE syscall.Errno = 15207 + ERROR_AMBIGUOUS_SYSTEM_DEVICE syscall.Errno = 15250 + ERROR_SYSTEM_DEVICE_NOT_FOUND syscall.Errno = 15299 + ERROR_HASH_NOT_SUPPORTED syscall.Errno = 15300 + ERROR_HASH_NOT_PRESENT syscall.Errno = 15301 + ERROR_SECONDARY_IC_PROVIDER_NOT_REGISTERED syscall.Errno = 15321 + ERROR_GPIO_CLIENT_INFORMATION_INVALID syscall.Errno = 15322 + ERROR_GPIO_VERSION_NOT_SUPPORTED syscall.Errno = 15323 + ERROR_GPIO_INVALID_REGISTRATION_PACKET syscall.Errno = 15324 + ERROR_GPIO_OPERATION_DENIED syscall.Errno = 15325 + ERROR_GPIO_INCOMPATIBLE_CONNECT_MODE syscall.Errno = 15326 + ERROR_GPIO_INTERRUPT_ALREADY_UNMASKED syscall.Errno = 15327 + ERROR_CANNOT_SWITCH_RUNLEVEL syscall.Errno = 15400 + ERROR_INVALID_RUNLEVEL_SETTING syscall.Errno = 15401 + ERROR_RUNLEVEL_SWITCH_TIMEOUT syscall.Errno = 15402 + ERROR_RUNLEVEL_SWITCH_AGENT_TIMEOUT syscall.Errno = 15403 + ERROR_RUNLEVEL_SWITCH_IN_PROGRESS syscall.Errno = 15404 + ERROR_SERVICES_FAILED_AUTOSTART syscall.Errno = 15405 + ERROR_COM_TASK_STOP_PENDING syscall.Errno = 15501 + ERROR_INSTALL_OPEN_PACKAGE_FAILED syscall.Errno = 15600 + ERROR_INSTALL_PACKAGE_NOT_FOUND syscall.Errno = 15601 + ERROR_INSTALL_INVALID_PACKAGE syscall.Errno = 15602 + ERROR_INSTALL_RESOLVE_DEPENDENCY_FAILED syscall.Errno = 15603 + ERROR_INSTALL_OUT_OF_DISK_SPACE syscall.Errno = 15604 + ERROR_INSTALL_NETWORK_FAILURE syscall.Errno = 15605 + ERROR_INSTALL_REGISTRATION_FAILURE syscall.Errno = 15606 + ERROR_INSTALL_DEREGISTRATION_FAILURE syscall.Errno = 15607 + ERROR_INSTALL_CANCEL syscall.Errno = 15608 + ERROR_INSTALL_FAILED syscall.Errno = 15609 + ERROR_REMOVE_FAILED syscall.Errno = 15610 + ERROR_PACKAGE_ALREADY_EXISTS syscall.Errno = 15611 + ERROR_NEEDS_REMEDIATION syscall.Errno = 15612 + ERROR_INSTALL_PREREQUISITE_FAILED syscall.Errno = 15613 + ERROR_PACKAGE_REPOSITORY_CORRUPTED syscall.Errno = 15614 + ERROR_INSTALL_POLICY_FAILURE syscall.Errno = 15615 + ERROR_PACKAGE_UPDATING syscall.Errno = 15616 + ERROR_DEPLOYMENT_BLOCKED_BY_POLICY syscall.Errno = 15617 + ERROR_PACKAGES_IN_USE syscall.Errno = 15618 + ERROR_RECOVERY_FILE_CORRUPT syscall.Errno = 15619 + ERROR_INVALID_STAGED_SIGNATURE syscall.Errno = 15620 + ERROR_DELETING_EXISTING_APPLICATIONDATA_STORE_FAILED syscall.Errno = 15621 + ERROR_INSTALL_PACKAGE_DOWNGRADE syscall.Errno = 15622 + ERROR_SYSTEM_NEEDS_REMEDIATION syscall.Errno = 15623 + ERROR_APPX_INTEGRITY_FAILURE_CLR_NGEN syscall.Errno = 15624 + ERROR_RESILIENCY_FILE_CORRUPT syscall.Errno = 15625 + ERROR_INSTALL_FIREWALL_SERVICE_NOT_RUNNING syscall.Errno = 15626 + ERROR_PACKAGE_MOVE_FAILED syscall.Errno = 15627 + ERROR_INSTALL_VOLUME_NOT_EMPTY syscall.Errno = 15628 + ERROR_INSTALL_VOLUME_OFFLINE syscall.Errno = 15629 + ERROR_INSTALL_VOLUME_CORRUPT syscall.Errno = 15630 + ERROR_NEEDS_REGISTRATION syscall.Errno = 15631 + ERROR_INSTALL_WRONG_PROCESSOR_ARCHITECTURE syscall.Errno = 15632 + ERROR_DEV_SIDELOAD_LIMIT_EXCEEDED syscall.Errno = 15633 + ERROR_INSTALL_OPTIONAL_PACKAGE_REQUIRES_MAIN_PACKAGE syscall.Errno = 15634 + ERROR_PACKAGE_NOT_SUPPORTED_ON_FILESYSTEM syscall.Errno = 15635 + ERROR_PACKAGE_MOVE_BLOCKED_BY_STREAMING syscall.Errno = 15636 + ERROR_INSTALL_OPTIONAL_PACKAGE_APPLICATIONID_NOT_UNIQUE syscall.Errno = 15637 + ERROR_PACKAGE_STAGING_ONHOLD syscall.Errno = 15638 + ERROR_INSTALL_INVALID_RELATED_SET_UPDATE syscall.Errno = 15639 + ERROR_INSTALL_OPTIONAL_PACKAGE_REQUIRES_MAIN_PACKAGE_FULLTRUST_CAPABILITY syscall.Errno = 15640 + ERROR_DEPLOYMENT_BLOCKED_BY_USER_LOG_OFF syscall.Errno = 15641 + ERROR_PROVISION_OPTIONAL_PACKAGE_REQUIRES_MAIN_PACKAGE_PROVISIONED syscall.Errno = 15642 + ERROR_PACKAGES_REPUTATION_CHECK_FAILED syscall.Errno = 15643 + ERROR_PACKAGES_REPUTATION_CHECK_TIMEDOUT syscall.Errno = 15644 + ERROR_DEPLOYMENT_OPTION_NOT_SUPPORTED syscall.Errno = 15645 + ERROR_APPINSTALLER_ACTIVATION_BLOCKED syscall.Errno = 15646 + ERROR_REGISTRATION_FROM_REMOTE_DRIVE_NOT_SUPPORTED syscall.Errno = 15647 + ERROR_APPX_RAW_DATA_WRITE_FAILED syscall.Errno = 15648 + ERROR_DEPLOYMENT_BLOCKED_BY_VOLUME_POLICY_PACKAGE syscall.Errno = 15649 + ERROR_DEPLOYMENT_BLOCKED_BY_VOLUME_POLICY_MACHINE syscall.Errno = 15650 + ERROR_DEPLOYMENT_BLOCKED_BY_PROFILE_POLICY syscall.Errno = 15651 + ERROR_DEPLOYMENT_FAILED_CONFLICTING_MUTABLE_PACKAGE_DIRECTORY syscall.Errno = 15652 + ERROR_SINGLETON_RESOURCE_INSTALLED_IN_ACTIVE_USER syscall.Errno = 15653 + ERROR_DIFFERENT_VERSION_OF_PACKAGED_SERVICE_INSTALLED syscall.Errno = 15654 + ERROR_SERVICE_EXISTS_AS_NON_PACKAGED_SERVICE syscall.Errno = 15655 + ERROR_PACKAGED_SERVICE_REQUIRES_ADMIN_PRIVILEGES syscall.Errno = 15656 + APPMODEL_ERROR_NO_PACKAGE syscall.Errno = 15700 + APPMODEL_ERROR_PACKAGE_RUNTIME_CORRUPT syscall.Errno = 15701 + APPMODEL_ERROR_PACKAGE_IDENTITY_CORRUPT syscall.Errno = 15702 + APPMODEL_ERROR_NO_APPLICATION syscall.Errno = 15703 + APPMODEL_ERROR_DYNAMIC_PROPERTY_READ_FAILED syscall.Errno = 15704 + APPMODEL_ERROR_DYNAMIC_PROPERTY_INVALID syscall.Errno = 15705 + APPMODEL_ERROR_PACKAGE_NOT_AVAILABLE syscall.Errno = 15706 + APPMODEL_ERROR_NO_MUTABLE_DIRECTORY syscall.Errno = 15707 + ERROR_STATE_LOAD_STORE_FAILED syscall.Errno = 15800 + ERROR_STATE_GET_VERSION_FAILED syscall.Errno = 15801 + ERROR_STATE_SET_VERSION_FAILED syscall.Errno = 15802 + ERROR_STATE_STRUCTURED_RESET_FAILED syscall.Errno = 15803 + ERROR_STATE_OPEN_CONTAINER_FAILED syscall.Errno = 15804 + ERROR_STATE_CREATE_CONTAINER_FAILED syscall.Errno = 15805 + ERROR_STATE_DELETE_CONTAINER_FAILED syscall.Errno = 15806 + ERROR_STATE_READ_SETTING_FAILED syscall.Errno = 15807 + ERROR_STATE_WRITE_SETTING_FAILED syscall.Errno = 15808 + ERROR_STATE_DELETE_SETTING_FAILED syscall.Errno = 15809 + ERROR_STATE_QUERY_SETTING_FAILED syscall.Errno = 15810 + ERROR_STATE_READ_COMPOSITE_SETTING_FAILED syscall.Errno = 15811 + ERROR_STATE_WRITE_COMPOSITE_SETTING_FAILED syscall.Errno = 15812 + ERROR_STATE_ENUMERATE_CONTAINER_FAILED syscall.Errno = 15813 + ERROR_STATE_ENUMERATE_SETTINGS_FAILED syscall.Errno = 15814 + ERROR_STATE_COMPOSITE_SETTING_VALUE_SIZE_LIMIT_EXCEEDED syscall.Errno = 15815 + ERROR_STATE_SETTING_VALUE_SIZE_LIMIT_EXCEEDED syscall.Errno = 15816 + ERROR_STATE_SETTING_NAME_SIZE_LIMIT_EXCEEDED syscall.Errno = 15817 + ERROR_STATE_CONTAINER_NAME_SIZE_LIMIT_EXCEEDED syscall.Errno = 15818 + ERROR_API_UNAVAILABLE syscall.Errno = 15841 + STORE_ERROR_UNLICENSED syscall.Errno = 15861 + STORE_ERROR_UNLICENSED_USER syscall.Errno = 15862 + STORE_ERROR_PENDING_COM_TRANSACTION syscall.Errno = 15863 + STORE_ERROR_LICENSE_REVOKED syscall.Errno = 15864 + SEVERITY_SUCCESS syscall.Errno = 0 + SEVERITY_ERROR syscall.Errno = 1 + FACILITY_NT_BIT = 0x10000000 + E_NOT_SET = ERROR_NOT_FOUND + E_NOT_VALID_STATE = ERROR_INVALID_STATE + E_NOT_SUFFICIENT_BUFFER = ERROR_INSUFFICIENT_BUFFER + E_TIME_SENSITIVE_THREAD = ERROR_TIME_SENSITIVE_THREAD + E_NO_TASK_QUEUE = ERROR_NO_TASK_QUEUE + NOERROR syscall.Errno = 0 + E_UNEXPECTED Handle = 0x8000FFFF + E_NOTIMPL Handle = 0x80004001 + E_OUTOFMEMORY Handle = 0x8007000E + E_INVALIDARG Handle = 0x80070057 + E_NOINTERFACE Handle = 0x80004002 + E_POINTER Handle = 0x80004003 + E_HANDLE Handle = 0x80070006 + E_ABORT Handle = 0x80004004 + E_FAIL Handle = 0x80004005 + E_ACCESSDENIED Handle = 0x80070005 + E_PENDING Handle = 0x8000000A + E_BOUNDS Handle = 0x8000000B + E_CHANGED_STATE Handle = 0x8000000C + E_ILLEGAL_STATE_CHANGE Handle = 0x8000000D + E_ILLEGAL_METHOD_CALL Handle = 0x8000000E + RO_E_METADATA_NAME_NOT_FOUND Handle = 0x8000000F + RO_E_METADATA_NAME_IS_NAMESPACE Handle = 0x80000010 + RO_E_METADATA_INVALID_TYPE_FORMAT Handle = 0x80000011 + RO_E_INVALID_METADATA_FILE Handle = 0x80000012 + RO_E_CLOSED Handle = 0x80000013 + RO_E_EXCLUSIVE_WRITE Handle = 0x80000014 + RO_E_CHANGE_NOTIFICATION_IN_PROGRESS Handle = 0x80000015 + RO_E_ERROR_STRING_NOT_FOUND Handle = 0x80000016 + E_STRING_NOT_NULL_TERMINATED Handle = 0x80000017 + E_ILLEGAL_DELEGATE_ASSIGNMENT Handle = 0x80000018 + E_ASYNC_OPERATION_NOT_STARTED Handle = 0x80000019 + E_APPLICATION_EXITING Handle = 0x8000001A + E_APPLICATION_VIEW_EXITING Handle = 0x8000001B + RO_E_MUST_BE_AGILE Handle = 0x8000001C + RO_E_UNSUPPORTED_FROM_MTA Handle = 0x8000001D + RO_E_COMMITTED Handle = 0x8000001E + RO_E_BLOCKED_CROSS_ASTA_CALL Handle = 0x8000001F + RO_E_CANNOT_ACTIVATE_FULL_TRUST_SERVER Handle = 0x80000020 + RO_E_CANNOT_ACTIVATE_UNIVERSAL_APPLICATION_SERVER Handle = 0x80000021 + CO_E_INIT_TLS Handle = 0x80004006 + CO_E_INIT_SHARED_ALLOCATOR Handle = 0x80004007 + CO_E_INIT_MEMORY_ALLOCATOR Handle = 0x80004008 + CO_E_INIT_CLASS_CACHE Handle = 0x80004009 + CO_E_INIT_RPC_CHANNEL Handle = 0x8000400A + CO_E_INIT_TLS_SET_CHANNEL_CONTROL Handle = 0x8000400B + CO_E_INIT_TLS_CHANNEL_CONTROL Handle = 0x8000400C + CO_E_INIT_UNACCEPTED_USER_ALLOCATOR Handle = 0x8000400D + CO_E_INIT_SCM_MUTEX_EXISTS Handle = 0x8000400E + CO_E_INIT_SCM_FILE_MAPPING_EXISTS Handle = 0x8000400F + CO_E_INIT_SCM_MAP_VIEW_OF_FILE Handle = 0x80004010 + CO_E_INIT_SCM_EXEC_FAILURE Handle = 0x80004011 + CO_E_INIT_ONLY_SINGLE_THREADED Handle = 0x80004012 + CO_E_CANT_REMOTE Handle = 0x80004013 + CO_E_BAD_SERVER_NAME Handle = 0x80004014 + CO_E_WRONG_SERVER_IDENTITY Handle = 0x80004015 + CO_E_OLE1DDE_DISABLED Handle = 0x80004016 + CO_E_RUNAS_SYNTAX Handle = 0x80004017 + CO_E_CREATEPROCESS_FAILURE Handle = 0x80004018 + CO_E_RUNAS_CREATEPROCESS_FAILURE Handle = 0x80004019 + CO_E_RUNAS_LOGON_FAILURE Handle = 0x8000401A + CO_E_LAUNCH_PERMSSION_DENIED Handle = 0x8000401B + CO_E_START_SERVICE_FAILURE Handle = 0x8000401C + CO_E_REMOTE_COMMUNICATION_FAILURE Handle = 0x8000401D + CO_E_SERVER_START_TIMEOUT Handle = 0x8000401E + CO_E_CLSREG_INCONSISTENT Handle = 0x8000401F + CO_E_IIDREG_INCONSISTENT Handle = 0x80004020 + CO_E_NOT_SUPPORTED Handle = 0x80004021 + CO_E_RELOAD_DLL Handle = 0x80004022 + CO_E_MSI_ERROR Handle = 0x80004023 + CO_E_ATTEMPT_TO_CREATE_OUTSIDE_CLIENT_CONTEXT Handle = 0x80004024 + CO_E_SERVER_PAUSED Handle = 0x80004025 + CO_E_SERVER_NOT_PAUSED Handle = 0x80004026 + CO_E_CLASS_DISABLED Handle = 0x80004027 + CO_E_CLRNOTAVAILABLE Handle = 0x80004028 + CO_E_ASYNC_WORK_REJECTED Handle = 0x80004029 + CO_E_SERVER_INIT_TIMEOUT Handle = 0x8000402A + CO_E_NO_SECCTX_IN_ACTIVATE Handle = 0x8000402B + CO_E_TRACKER_CONFIG Handle = 0x80004030 + CO_E_THREADPOOL_CONFIG Handle = 0x80004031 + CO_E_SXS_CONFIG Handle = 0x80004032 + CO_E_MALFORMED_SPN Handle = 0x80004033 + CO_E_UNREVOKED_REGISTRATION_ON_APARTMENT_SHUTDOWN Handle = 0x80004034 + CO_E_PREMATURE_STUB_RUNDOWN Handle = 0x80004035 + S_OK Handle = 0 + S_FALSE Handle = 1 + OLE_E_FIRST Handle = 0x80040000 + OLE_E_LAST Handle = 0x800400FF + OLE_S_FIRST Handle = 0x00040000 + OLE_S_LAST Handle = 0x000400FF + OLE_E_OLEVERB Handle = 0x80040000 + OLE_E_ADVF Handle = 0x80040001 + OLE_E_ENUM_NOMORE Handle = 0x80040002 + OLE_E_ADVISENOTSUPPORTED Handle = 0x80040003 + OLE_E_NOCONNECTION Handle = 0x80040004 + OLE_E_NOTRUNNING Handle = 0x80040005 + OLE_E_NOCACHE Handle = 0x80040006 + OLE_E_BLANK Handle = 0x80040007 + OLE_E_CLASSDIFF Handle = 0x80040008 + OLE_E_CANT_GETMONIKER Handle = 0x80040009 + OLE_E_CANT_BINDTOSOURCE Handle = 0x8004000A + OLE_E_STATIC Handle = 0x8004000B + OLE_E_PROMPTSAVECANCELLED Handle = 0x8004000C + OLE_E_INVALIDRECT Handle = 0x8004000D + OLE_E_WRONGCOMPOBJ Handle = 0x8004000E + OLE_E_INVALIDHWND Handle = 0x8004000F + OLE_E_NOT_INPLACEACTIVE Handle = 0x80040010 + OLE_E_CANTCONVERT Handle = 0x80040011 + OLE_E_NOSTORAGE Handle = 0x80040012 + DV_E_FORMATETC Handle = 0x80040064 + DV_E_DVTARGETDEVICE Handle = 0x80040065 + DV_E_STGMEDIUM Handle = 0x80040066 + DV_E_STATDATA Handle = 0x80040067 + DV_E_LINDEX Handle = 0x80040068 + DV_E_TYMED Handle = 0x80040069 + DV_E_CLIPFORMAT Handle = 0x8004006A + DV_E_DVASPECT Handle = 0x8004006B + DV_E_DVTARGETDEVICE_SIZE Handle = 0x8004006C + DV_E_NOIVIEWOBJECT Handle = 0x8004006D + DRAGDROP_E_FIRST syscall.Errno = 0x80040100 + DRAGDROP_E_LAST syscall.Errno = 0x8004010F + DRAGDROP_S_FIRST syscall.Errno = 0x00040100 + DRAGDROP_S_LAST syscall.Errno = 0x0004010F + DRAGDROP_E_NOTREGISTERED Handle = 0x80040100 + DRAGDROP_E_ALREADYREGISTERED Handle = 0x80040101 + DRAGDROP_E_INVALIDHWND Handle = 0x80040102 + DRAGDROP_E_CONCURRENT_DRAG_ATTEMPTED Handle = 0x80040103 + CLASSFACTORY_E_FIRST syscall.Errno = 0x80040110 + CLASSFACTORY_E_LAST syscall.Errno = 0x8004011F + CLASSFACTORY_S_FIRST syscall.Errno = 0x00040110 + CLASSFACTORY_S_LAST syscall.Errno = 0x0004011F + CLASS_E_NOAGGREGATION Handle = 0x80040110 + CLASS_E_CLASSNOTAVAILABLE Handle = 0x80040111 + CLASS_E_NOTLICENSED Handle = 0x80040112 + MARSHAL_E_FIRST syscall.Errno = 0x80040120 + MARSHAL_E_LAST syscall.Errno = 0x8004012F + MARSHAL_S_FIRST syscall.Errno = 0x00040120 + MARSHAL_S_LAST syscall.Errno = 0x0004012F + DATA_E_FIRST syscall.Errno = 0x80040130 + DATA_E_LAST syscall.Errno = 0x8004013F + DATA_S_FIRST syscall.Errno = 0x00040130 + DATA_S_LAST syscall.Errno = 0x0004013F + VIEW_E_FIRST syscall.Errno = 0x80040140 + VIEW_E_LAST syscall.Errno = 0x8004014F + VIEW_S_FIRST syscall.Errno = 0x00040140 + VIEW_S_LAST syscall.Errno = 0x0004014F + VIEW_E_DRAW Handle = 0x80040140 + REGDB_E_FIRST syscall.Errno = 0x80040150 + REGDB_E_LAST syscall.Errno = 0x8004015F + REGDB_S_FIRST syscall.Errno = 0x00040150 + REGDB_S_LAST syscall.Errno = 0x0004015F + REGDB_E_READREGDB Handle = 0x80040150 + REGDB_E_WRITEREGDB Handle = 0x80040151 + REGDB_E_KEYMISSING Handle = 0x80040152 + REGDB_E_INVALIDVALUE Handle = 0x80040153 + REGDB_E_CLASSNOTREG Handle = 0x80040154 + REGDB_E_IIDNOTREG Handle = 0x80040155 + REGDB_E_BADTHREADINGMODEL Handle = 0x80040156 + REGDB_E_PACKAGEPOLICYVIOLATION Handle = 0x80040157 + CAT_E_FIRST syscall.Errno = 0x80040160 + CAT_E_LAST syscall.Errno = 0x80040161 + CAT_E_CATIDNOEXIST Handle = 0x80040160 + CAT_E_NODESCRIPTION Handle = 0x80040161 + CS_E_FIRST syscall.Errno = 0x80040164 + CS_E_LAST syscall.Errno = 0x8004016F + CS_E_PACKAGE_NOTFOUND Handle = 0x80040164 + CS_E_NOT_DELETABLE Handle = 0x80040165 + CS_E_CLASS_NOTFOUND Handle = 0x80040166 + CS_E_INVALID_VERSION Handle = 0x80040167 + CS_E_NO_CLASSSTORE Handle = 0x80040168 + CS_E_OBJECT_NOTFOUND Handle = 0x80040169 + CS_E_OBJECT_ALREADY_EXISTS Handle = 0x8004016A + CS_E_INVALID_PATH Handle = 0x8004016B + CS_E_NETWORK_ERROR Handle = 0x8004016C + CS_E_ADMIN_LIMIT_EXCEEDED Handle = 0x8004016D + CS_E_SCHEMA_MISMATCH Handle = 0x8004016E + CS_E_INTERNAL_ERROR Handle = 0x8004016F + CACHE_E_FIRST syscall.Errno = 0x80040170 + CACHE_E_LAST syscall.Errno = 0x8004017F + CACHE_S_FIRST syscall.Errno = 0x00040170 + CACHE_S_LAST syscall.Errno = 0x0004017F + CACHE_E_NOCACHE_UPDATED Handle = 0x80040170 + OLEOBJ_E_FIRST syscall.Errno = 0x80040180 + OLEOBJ_E_LAST syscall.Errno = 0x8004018F + OLEOBJ_S_FIRST syscall.Errno = 0x00040180 + OLEOBJ_S_LAST syscall.Errno = 0x0004018F + OLEOBJ_E_NOVERBS Handle = 0x80040180 + OLEOBJ_E_INVALIDVERB Handle = 0x80040181 + CLIENTSITE_E_FIRST syscall.Errno = 0x80040190 + CLIENTSITE_E_LAST syscall.Errno = 0x8004019F + CLIENTSITE_S_FIRST syscall.Errno = 0x00040190 + CLIENTSITE_S_LAST syscall.Errno = 0x0004019F + INPLACE_E_NOTUNDOABLE Handle = 0x800401A0 + INPLACE_E_NOTOOLSPACE Handle = 0x800401A1 + INPLACE_E_FIRST syscall.Errno = 0x800401A0 + INPLACE_E_LAST syscall.Errno = 0x800401AF + INPLACE_S_FIRST syscall.Errno = 0x000401A0 + INPLACE_S_LAST syscall.Errno = 0x000401AF + ENUM_E_FIRST syscall.Errno = 0x800401B0 + ENUM_E_LAST syscall.Errno = 0x800401BF + ENUM_S_FIRST syscall.Errno = 0x000401B0 + ENUM_S_LAST syscall.Errno = 0x000401BF + CONVERT10_E_FIRST syscall.Errno = 0x800401C0 + CONVERT10_E_LAST syscall.Errno = 0x800401CF + CONVERT10_S_FIRST syscall.Errno = 0x000401C0 + CONVERT10_S_LAST syscall.Errno = 0x000401CF + CONVERT10_E_OLESTREAM_GET Handle = 0x800401C0 + CONVERT10_E_OLESTREAM_PUT Handle = 0x800401C1 + CONVERT10_E_OLESTREAM_FMT Handle = 0x800401C2 + CONVERT10_E_OLESTREAM_BITMAP_TO_DIB Handle = 0x800401C3 + CONVERT10_E_STG_FMT Handle = 0x800401C4 + CONVERT10_E_STG_NO_STD_STREAM Handle = 0x800401C5 + CONVERT10_E_STG_DIB_TO_BITMAP Handle = 0x800401C6 + CLIPBRD_E_FIRST syscall.Errno = 0x800401D0 + CLIPBRD_E_LAST syscall.Errno = 0x800401DF + CLIPBRD_S_FIRST syscall.Errno = 0x000401D0 + CLIPBRD_S_LAST syscall.Errno = 0x000401DF + CLIPBRD_E_CANT_OPEN Handle = 0x800401D0 + CLIPBRD_E_CANT_EMPTY Handle = 0x800401D1 + CLIPBRD_E_CANT_SET Handle = 0x800401D2 + CLIPBRD_E_BAD_DATA Handle = 0x800401D3 + CLIPBRD_E_CANT_CLOSE Handle = 0x800401D4 + MK_E_FIRST syscall.Errno = 0x800401E0 + MK_E_LAST syscall.Errno = 0x800401EF + MK_S_FIRST syscall.Errno = 0x000401E0 + MK_S_LAST syscall.Errno = 0x000401EF + MK_E_CONNECTMANUALLY Handle = 0x800401E0 + MK_E_EXCEEDEDDEADLINE Handle = 0x800401E1 + MK_E_NEEDGENERIC Handle = 0x800401E2 + MK_E_UNAVAILABLE Handle = 0x800401E3 + MK_E_SYNTAX Handle = 0x800401E4 + MK_E_NOOBJECT Handle = 0x800401E5 + MK_E_INVALIDEXTENSION Handle = 0x800401E6 + MK_E_INTERMEDIATEINTERFACENOTSUPPORTED Handle = 0x800401E7 + MK_E_NOTBINDABLE Handle = 0x800401E8 + MK_E_NOTBOUND Handle = 0x800401E9 + MK_E_CANTOPENFILE Handle = 0x800401EA + MK_E_MUSTBOTHERUSER Handle = 0x800401EB + MK_E_NOINVERSE Handle = 0x800401EC + MK_E_NOSTORAGE Handle = 0x800401ED + MK_E_NOPREFIX Handle = 0x800401EE + MK_E_ENUMERATION_FAILED Handle = 0x800401EF + CO_E_FIRST syscall.Errno = 0x800401F0 + CO_E_LAST syscall.Errno = 0x800401FF + CO_S_FIRST syscall.Errno = 0x000401F0 + CO_S_LAST syscall.Errno = 0x000401FF + CO_E_NOTINITIALIZED Handle = 0x800401F0 + CO_E_ALREADYINITIALIZED Handle = 0x800401F1 + CO_E_CANTDETERMINECLASS Handle = 0x800401F2 + CO_E_CLASSSTRING Handle = 0x800401F3 + CO_E_IIDSTRING Handle = 0x800401F4 + CO_E_APPNOTFOUND Handle = 0x800401F5 + CO_E_APPSINGLEUSE Handle = 0x800401F6 + CO_E_ERRORINAPP Handle = 0x800401F7 + CO_E_DLLNOTFOUND Handle = 0x800401F8 + CO_E_ERRORINDLL Handle = 0x800401F9 + CO_E_WRONGOSFORAPP Handle = 0x800401FA + CO_E_OBJNOTREG Handle = 0x800401FB + CO_E_OBJISREG Handle = 0x800401FC + CO_E_OBJNOTCONNECTED Handle = 0x800401FD + CO_E_APPDIDNTREG Handle = 0x800401FE + CO_E_RELEASED Handle = 0x800401FF + EVENT_E_FIRST syscall.Errno = 0x80040200 + EVENT_E_LAST syscall.Errno = 0x8004021F + EVENT_S_FIRST syscall.Errno = 0x00040200 + EVENT_S_LAST syscall.Errno = 0x0004021F + EVENT_S_SOME_SUBSCRIBERS_FAILED Handle = 0x00040200 + EVENT_E_ALL_SUBSCRIBERS_FAILED Handle = 0x80040201 + EVENT_S_NOSUBSCRIBERS Handle = 0x00040202 + EVENT_E_QUERYSYNTAX Handle = 0x80040203 + EVENT_E_QUERYFIELD Handle = 0x80040204 + EVENT_E_INTERNALEXCEPTION Handle = 0x80040205 + EVENT_E_INTERNALERROR Handle = 0x80040206 + EVENT_E_INVALID_PER_USER_SID Handle = 0x80040207 + EVENT_E_USER_EXCEPTION Handle = 0x80040208 + EVENT_E_TOO_MANY_METHODS Handle = 0x80040209 + EVENT_E_MISSING_EVENTCLASS Handle = 0x8004020A + EVENT_E_NOT_ALL_REMOVED Handle = 0x8004020B + EVENT_E_COMPLUS_NOT_INSTALLED Handle = 0x8004020C + EVENT_E_CANT_MODIFY_OR_DELETE_UNCONFIGURED_OBJECT Handle = 0x8004020D + EVENT_E_CANT_MODIFY_OR_DELETE_CONFIGURED_OBJECT Handle = 0x8004020E + EVENT_E_INVALID_EVENT_CLASS_PARTITION Handle = 0x8004020F + EVENT_E_PER_USER_SID_NOT_LOGGED_ON Handle = 0x80040210 + TPC_E_INVALID_PROPERTY Handle = 0x80040241 + TPC_E_NO_DEFAULT_TABLET Handle = 0x80040212 + TPC_E_UNKNOWN_PROPERTY Handle = 0x8004021B + TPC_E_INVALID_INPUT_RECT Handle = 0x80040219 + TPC_E_INVALID_STROKE Handle = 0x80040222 + TPC_E_INITIALIZE_FAIL Handle = 0x80040223 + TPC_E_NOT_RELEVANT Handle = 0x80040232 + TPC_E_INVALID_PACKET_DESCRIPTION Handle = 0x80040233 + TPC_E_RECOGNIZER_NOT_REGISTERED Handle = 0x80040235 + TPC_E_INVALID_RIGHTS Handle = 0x80040236 + TPC_E_OUT_OF_ORDER_CALL Handle = 0x80040237 + TPC_E_QUEUE_FULL Handle = 0x80040238 + TPC_E_INVALID_CONFIGURATION Handle = 0x80040239 + TPC_E_INVALID_DATA_FROM_RECOGNIZER Handle = 0x8004023A + TPC_S_TRUNCATED Handle = 0x00040252 + TPC_S_INTERRUPTED Handle = 0x00040253 + TPC_S_NO_DATA_TO_PROCESS Handle = 0x00040254 + XACT_E_FIRST syscall.Errno = 0x8004D000 + XACT_E_LAST syscall.Errno = 0x8004D02B + XACT_S_FIRST syscall.Errno = 0x0004D000 + XACT_S_LAST syscall.Errno = 0x0004D010 + XACT_E_ALREADYOTHERSINGLEPHASE Handle = 0x8004D000 + XACT_E_CANTRETAIN Handle = 0x8004D001 + XACT_E_COMMITFAILED Handle = 0x8004D002 + XACT_E_COMMITPREVENTED Handle = 0x8004D003 + XACT_E_HEURISTICABORT Handle = 0x8004D004 + XACT_E_HEURISTICCOMMIT Handle = 0x8004D005 + XACT_E_HEURISTICDAMAGE Handle = 0x8004D006 + XACT_E_HEURISTICDANGER Handle = 0x8004D007 + XACT_E_ISOLATIONLEVEL Handle = 0x8004D008 + XACT_E_NOASYNC Handle = 0x8004D009 + XACT_E_NOENLIST Handle = 0x8004D00A + XACT_E_NOISORETAIN Handle = 0x8004D00B + XACT_E_NORESOURCE Handle = 0x8004D00C + XACT_E_NOTCURRENT Handle = 0x8004D00D + XACT_E_NOTRANSACTION Handle = 0x8004D00E + XACT_E_NOTSUPPORTED Handle = 0x8004D00F + XACT_E_UNKNOWNRMGRID Handle = 0x8004D010 + XACT_E_WRONGSTATE Handle = 0x8004D011 + XACT_E_WRONGUOW Handle = 0x8004D012 + XACT_E_XTIONEXISTS Handle = 0x8004D013 + XACT_E_NOIMPORTOBJECT Handle = 0x8004D014 + XACT_E_INVALIDCOOKIE Handle = 0x8004D015 + XACT_E_INDOUBT Handle = 0x8004D016 + XACT_E_NOTIMEOUT Handle = 0x8004D017 + XACT_E_ALREADYINPROGRESS Handle = 0x8004D018 + XACT_E_ABORTED Handle = 0x8004D019 + XACT_E_LOGFULL Handle = 0x8004D01A + XACT_E_TMNOTAVAILABLE Handle = 0x8004D01B + XACT_E_CONNECTION_DOWN Handle = 0x8004D01C + XACT_E_CONNECTION_DENIED Handle = 0x8004D01D + XACT_E_REENLISTTIMEOUT Handle = 0x8004D01E + XACT_E_TIP_CONNECT_FAILED Handle = 0x8004D01F + XACT_E_TIP_PROTOCOL_ERROR Handle = 0x8004D020 + XACT_E_TIP_PULL_FAILED Handle = 0x8004D021 + XACT_E_DEST_TMNOTAVAILABLE Handle = 0x8004D022 + XACT_E_TIP_DISABLED Handle = 0x8004D023 + XACT_E_NETWORK_TX_DISABLED Handle = 0x8004D024 + XACT_E_PARTNER_NETWORK_TX_DISABLED Handle = 0x8004D025 + XACT_E_XA_TX_DISABLED Handle = 0x8004D026 + XACT_E_UNABLE_TO_READ_DTC_CONFIG Handle = 0x8004D027 + XACT_E_UNABLE_TO_LOAD_DTC_PROXY Handle = 0x8004D028 + XACT_E_ABORTING Handle = 0x8004D029 + XACT_E_PUSH_COMM_FAILURE Handle = 0x8004D02A + XACT_E_PULL_COMM_FAILURE Handle = 0x8004D02B + XACT_E_LU_TX_DISABLED Handle = 0x8004D02C + XACT_E_CLERKNOTFOUND Handle = 0x8004D080 + XACT_E_CLERKEXISTS Handle = 0x8004D081 + XACT_E_RECOVERYINPROGRESS Handle = 0x8004D082 + XACT_E_TRANSACTIONCLOSED Handle = 0x8004D083 + XACT_E_INVALIDLSN Handle = 0x8004D084 + XACT_E_REPLAYREQUEST Handle = 0x8004D085 + XACT_S_ASYNC Handle = 0x0004D000 + XACT_S_DEFECT Handle = 0x0004D001 + XACT_S_READONLY Handle = 0x0004D002 + XACT_S_SOMENORETAIN Handle = 0x0004D003 + XACT_S_OKINFORM Handle = 0x0004D004 + XACT_S_MADECHANGESCONTENT Handle = 0x0004D005 + XACT_S_MADECHANGESINFORM Handle = 0x0004D006 + XACT_S_ALLNORETAIN Handle = 0x0004D007 + XACT_S_ABORTING Handle = 0x0004D008 + XACT_S_SINGLEPHASE Handle = 0x0004D009 + XACT_S_LOCALLY_OK Handle = 0x0004D00A + XACT_S_LASTRESOURCEMANAGER Handle = 0x0004D010 + CONTEXT_E_FIRST syscall.Errno = 0x8004E000 + CONTEXT_E_LAST syscall.Errno = 0x8004E02F + CONTEXT_S_FIRST syscall.Errno = 0x0004E000 + CONTEXT_S_LAST syscall.Errno = 0x0004E02F + CONTEXT_E_ABORTED Handle = 0x8004E002 + CONTEXT_E_ABORTING Handle = 0x8004E003 + CONTEXT_E_NOCONTEXT Handle = 0x8004E004 + CONTEXT_E_WOULD_DEADLOCK Handle = 0x8004E005 + CONTEXT_E_SYNCH_TIMEOUT Handle = 0x8004E006 + CONTEXT_E_OLDREF Handle = 0x8004E007 + CONTEXT_E_ROLENOTFOUND Handle = 0x8004E00C + CONTEXT_E_TMNOTAVAILABLE Handle = 0x8004E00F + CO_E_ACTIVATIONFAILED Handle = 0x8004E021 + CO_E_ACTIVATIONFAILED_EVENTLOGGED Handle = 0x8004E022 + CO_E_ACTIVATIONFAILED_CATALOGERROR Handle = 0x8004E023 + CO_E_ACTIVATIONFAILED_TIMEOUT Handle = 0x8004E024 + CO_E_INITIALIZATIONFAILED Handle = 0x8004E025 + CONTEXT_E_NOJIT Handle = 0x8004E026 + CONTEXT_E_NOTRANSACTION Handle = 0x8004E027 + CO_E_THREADINGMODEL_CHANGED Handle = 0x8004E028 + CO_E_NOIISINTRINSICS Handle = 0x8004E029 + CO_E_NOCOOKIES Handle = 0x8004E02A + CO_E_DBERROR Handle = 0x8004E02B + CO_E_NOTPOOLED Handle = 0x8004E02C + CO_E_NOTCONSTRUCTED Handle = 0x8004E02D + CO_E_NOSYNCHRONIZATION Handle = 0x8004E02E + CO_E_ISOLEVELMISMATCH Handle = 0x8004E02F + CO_E_CALL_OUT_OF_TX_SCOPE_NOT_ALLOWED Handle = 0x8004E030 + CO_E_EXIT_TRANSACTION_SCOPE_NOT_CALLED Handle = 0x8004E031 + OLE_S_USEREG Handle = 0x00040000 + OLE_S_STATIC Handle = 0x00040001 + OLE_S_MAC_CLIPFORMAT Handle = 0x00040002 + DRAGDROP_S_DROP Handle = 0x00040100 + DRAGDROP_S_CANCEL Handle = 0x00040101 + DRAGDROP_S_USEDEFAULTCURSORS Handle = 0x00040102 + DATA_S_SAMEFORMATETC Handle = 0x00040130 + VIEW_S_ALREADY_FROZEN Handle = 0x00040140 + CACHE_S_FORMATETC_NOTSUPPORTED Handle = 0x00040170 + CACHE_S_SAMECACHE Handle = 0x00040171 + CACHE_S_SOMECACHES_NOTUPDATED Handle = 0x00040172 + OLEOBJ_S_INVALIDVERB Handle = 0x00040180 + OLEOBJ_S_CANNOT_DOVERB_NOW Handle = 0x00040181 + OLEOBJ_S_INVALIDHWND Handle = 0x00040182 + INPLACE_S_TRUNCATED Handle = 0x000401A0 + CONVERT10_S_NO_PRESENTATION Handle = 0x000401C0 + MK_S_REDUCED_TO_SELF Handle = 0x000401E2 + MK_S_ME Handle = 0x000401E4 + MK_S_HIM Handle = 0x000401E5 + MK_S_US Handle = 0x000401E6 + MK_S_MONIKERALREADYREGISTERED Handle = 0x000401E7 + SCHED_S_TASK_READY Handle = 0x00041300 + SCHED_S_TASK_RUNNING Handle = 0x00041301 + SCHED_S_TASK_DISABLED Handle = 0x00041302 + SCHED_S_TASK_HAS_NOT_RUN Handle = 0x00041303 + SCHED_S_TASK_NO_MORE_RUNS Handle = 0x00041304 + SCHED_S_TASK_NOT_SCHEDULED Handle = 0x00041305 + SCHED_S_TASK_TERMINATED Handle = 0x00041306 + SCHED_S_TASK_NO_VALID_TRIGGERS Handle = 0x00041307 + SCHED_S_EVENT_TRIGGER Handle = 0x00041308 + SCHED_E_TRIGGER_NOT_FOUND Handle = 0x80041309 + SCHED_E_TASK_NOT_READY Handle = 0x8004130A + SCHED_E_TASK_NOT_RUNNING Handle = 0x8004130B + SCHED_E_SERVICE_NOT_INSTALLED Handle = 0x8004130C + SCHED_E_CANNOT_OPEN_TASK Handle = 0x8004130D + SCHED_E_INVALID_TASK Handle = 0x8004130E + SCHED_E_ACCOUNT_INFORMATION_NOT_SET Handle = 0x8004130F + SCHED_E_ACCOUNT_NAME_NOT_FOUND Handle = 0x80041310 + SCHED_E_ACCOUNT_DBASE_CORRUPT Handle = 0x80041311 + SCHED_E_NO_SECURITY_SERVICES Handle = 0x80041312 + SCHED_E_UNKNOWN_OBJECT_VERSION Handle = 0x80041313 + SCHED_E_UNSUPPORTED_ACCOUNT_OPTION Handle = 0x80041314 + SCHED_E_SERVICE_NOT_RUNNING Handle = 0x80041315 + SCHED_E_UNEXPECTEDNODE Handle = 0x80041316 + SCHED_E_NAMESPACE Handle = 0x80041317 + SCHED_E_INVALIDVALUE Handle = 0x80041318 + SCHED_E_MISSINGNODE Handle = 0x80041319 + SCHED_E_MALFORMEDXML Handle = 0x8004131A + SCHED_S_SOME_TRIGGERS_FAILED Handle = 0x0004131B + SCHED_S_BATCH_LOGON_PROBLEM Handle = 0x0004131C + SCHED_E_TOO_MANY_NODES Handle = 0x8004131D + SCHED_E_PAST_END_BOUNDARY Handle = 0x8004131E + SCHED_E_ALREADY_RUNNING Handle = 0x8004131F + SCHED_E_USER_NOT_LOGGED_ON Handle = 0x80041320 + SCHED_E_INVALID_TASK_HASH Handle = 0x80041321 + SCHED_E_SERVICE_NOT_AVAILABLE Handle = 0x80041322 + SCHED_E_SERVICE_TOO_BUSY Handle = 0x80041323 + SCHED_E_TASK_ATTEMPTED Handle = 0x80041324 + SCHED_S_TASK_QUEUED Handle = 0x00041325 + SCHED_E_TASK_DISABLED Handle = 0x80041326 + SCHED_E_TASK_NOT_V1_COMPAT Handle = 0x80041327 + SCHED_E_START_ON_DEMAND Handle = 0x80041328 + SCHED_E_TASK_NOT_UBPM_COMPAT Handle = 0x80041329 + SCHED_E_DEPRECATED_FEATURE_USED Handle = 0x80041330 + CO_E_CLASS_CREATE_FAILED Handle = 0x80080001 + CO_E_SCM_ERROR Handle = 0x80080002 + CO_E_SCM_RPC_FAILURE Handle = 0x80080003 + CO_E_BAD_PATH Handle = 0x80080004 + CO_E_SERVER_EXEC_FAILURE Handle = 0x80080005 + CO_E_OBJSRV_RPC_FAILURE Handle = 0x80080006 + MK_E_NO_NORMALIZED Handle = 0x80080007 + CO_E_SERVER_STOPPING Handle = 0x80080008 + MEM_E_INVALID_ROOT Handle = 0x80080009 + MEM_E_INVALID_LINK Handle = 0x80080010 + MEM_E_INVALID_SIZE Handle = 0x80080011 + CO_S_NOTALLINTERFACES Handle = 0x00080012 + CO_S_MACHINENAMENOTFOUND Handle = 0x00080013 + CO_E_MISSING_DISPLAYNAME Handle = 0x80080015 + CO_E_RUNAS_VALUE_MUST_BE_AAA Handle = 0x80080016 + CO_E_ELEVATION_DISABLED Handle = 0x80080017 + APPX_E_PACKAGING_INTERNAL Handle = 0x80080200 + APPX_E_INTERLEAVING_NOT_ALLOWED Handle = 0x80080201 + APPX_E_RELATIONSHIPS_NOT_ALLOWED Handle = 0x80080202 + APPX_E_MISSING_REQUIRED_FILE Handle = 0x80080203 + APPX_E_INVALID_MANIFEST Handle = 0x80080204 + APPX_E_INVALID_BLOCKMAP Handle = 0x80080205 + APPX_E_CORRUPT_CONTENT Handle = 0x80080206 + APPX_E_BLOCK_HASH_INVALID Handle = 0x80080207 + APPX_E_REQUESTED_RANGE_TOO_LARGE Handle = 0x80080208 + APPX_E_INVALID_SIP_CLIENT_DATA Handle = 0x80080209 + APPX_E_INVALID_KEY_INFO Handle = 0x8008020A + APPX_E_INVALID_CONTENTGROUPMAP Handle = 0x8008020B + APPX_E_INVALID_APPINSTALLER Handle = 0x8008020C + APPX_E_DELTA_BASELINE_VERSION_MISMATCH Handle = 0x8008020D + APPX_E_DELTA_PACKAGE_MISSING_FILE Handle = 0x8008020E + APPX_E_INVALID_DELTA_PACKAGE Handle = 0x8008020F + APPX_E_DELTA_APPENDED_PACKAGE_NOT_ALLOWED Handle = 0x80080210 + APPX_E_INVALID_PACKAGING_LAYOUT Handle = 0x80080211 + APPX_E_INVALID_PACKAGESIGNCONFIG Handle = 0x80080212 + APPX_E_RESOURCESPRI_NOT_ALLOWED Handle = 0x80080213 + APPX_E_FILE_COMPRESSION_MISMATCH Handle = 0x80080214 + APPX_E_INVALID_PAYLOAD_PACKAGE_EXTENSION Handle = 0x80080215 + APPX_E_INVALID_ENCRYPTION_EXCLUSION_FILE_LIST Handle = 0x80080216 + BT_E_SPURIOUS_ACTIVATION Handle = 0x80080300 + DISP_E_UNKNOWNINTERFACE Handle = 0x80020001 + DISP_E_MEMBERNOTFOUND Handle = 0x80020003 + DISP_E_PARAMNOTFOUND Handle = 0x80020004 + DISP_E_TYPEMISMATCH Handle = 0x80020005 + DISP_E_UNKNOWNNAME Handle = 0x80020006 + DISP_E_NONAMEDARGS Handle = 0x80020007 + DISP_E_BADVARTYPE Handle = 0x80020008 + DISP_E_EXCEPTION Handle = 0x80020009 + DISP_E_OVERFLOW Handle = 0x8002000A + DISP_E_BADINDEX Handle = 0x8002000B + DISP_E_UNKNOWNLCID Handle = 0x8002000C + DISP_E_ARRAYISLOCKED Handle = 0x8002000D + DISP_E_BADPARAMCOUNT Handle = 0x8002000E + DISP_E_PARAMNOTOPTIONAL Handle = 0x8002000F + DISP_E_BADCALLEE Handle = 0x80020010 + DISP_E_NOTACOLLECTION Handle = 0x80020011 + DISP_E_DIVBYZERO Handle = 0x80020012 + DISP_E_BUFFERTOOSMALL Handle = 0x80020013 + TYPE_E_BUFFERTOOSMALL Handle = 0x80028016 + TYPE_E_FIELDNOTFOUND Handle = 0x80028017 + TYPE_E_INVDATAREAD Handle = 0x80028018 + TYPE_E_UNSUPFORMAT Handle = 0x80028019 + TYPE_E_REGISTRYACCESS Handle = 0x8002801C + TYPE_E_LIBNOTREGISTERED Handle = 0x8002801D + TYPE_E_UNDEFINEDTYPE Handle = 0x80028027 + TYPE_E_QUALIFIEDNAMEDISALLOWED Handle = 0x80028028 + TYPE_E_INVALIDSTATE Handle = 0x80028029 + TYPE_E_WRONGTYPEKIND Handle = 0x8002802A + TYPE_E_ELEMENTNOTFOUND Handle = 0x8002802B + TYPE_E_AMBIGUOUSNAME Handle = 0x8002802C + TYPE_E_NAMECONFLICT Handle = 0x8002802D + TYPE_E_UNKNOWNLCID Handle = 0x8002802E + TYPE_E_DLLFUNCTIONNOTFOUND Handle = 0x8002802F + TYPE_E_BADMODULEKIND Handle = 0x800288BD + TYPE_E_SIZETOOBIG Handle = 0x800288C5 + TYPE_E_DUPLICATEID Handle = 0x800288C6 + TYPE_E_INVALIDID Handle = 0x800288CF + TYPE_E_TYPEMISMATCH Handle = 0x80028CA0 + TYPE_E_OUTOFBOUNDS Handle = 0x80028CA1 + TYPE_E_IOERROR Handle = 0x80028CA2 + TYPE_E_CANTCREATETMPFILE Handle = 0x80028CA3 + TYPE_E_CANTLOADLIBRARY Handle = 0x80029C4A + TYPE_E_INCONSISTENTPROPFUNCS Handle = 0x80029C83 + TYPE_E_CIRCULARTYPE Handle = 0x80029C84 + STG_E_INVALIDFUNCTION Handle = 0x80030001 + STG_E_FILENOTFOUND Handle = 0x80030002 + STG_E_PATHNOTFOUND Handle = 0x80030003 + STG_E_TOOMANYOPENFILES Handle = 0x80030004 + STG_E_ACCESSDENIED Handle = 0x80030005 + STG_E_INVALIDHANDLE Handle = 0x80030006 + STG_E_INSUFFICIENTMEMORY Handle = 0x80030008 + STG_E_INVALIDPOINTER Handle = 0x80030009 + STG_E_NOMOREFILES Handle = 0x80030012 + STG_E_DISKISWRITEPROTECTED Handle = 0x80030013 + STG_E_SEEKERROR Handle = 0x80030019 + STG_E_WRITEFAULT Handle = 0x8003001D + STG_E_READFAULT Handle = 0x8003001E + STG_E_SHAREVIOLATION Handle = 0x80030020 + STG_E_LOCKVIOLATION Handle = 0x80030021 + STG_E_FILEALREADYEXISTS Handle = 0x80030050 + STG_E_INVALIDPARAMETER Handle = 0x80030057 + STG_E_MEDIUMFULL Handle = 0x80030070 + STG_E_PROPSETMISMATCHED Handle = 0x800300F0 + STG_E_ABNORMALAPIEXIT Handle = 0x800300FA + STG_E_INVALIDHEADER Handle = 0x800300FB + STG_E_INVALIDNAME Handle = 0x800300FC + STG_E_UNKNOWN Handle = 0x800300FD + STG_E_UNIMPLEMENTEDFUNCTION Handle = 0x800300FE + STG_E_INVALIDFLAG Handle = 0x800300FF + STG_E_INUSE Handle = 0x80030100 + STG_E_NOTCURRENT Handle = 0x80030101 + STG_E_REVERTED Handle = 0x80030102 + STG_E_CANTSAVE Handle = 0x80030103 + STG_E_OLDFORMAT Handle = 0x80030104 + STG_E_OLDDLL Handle = 0x80030105 + STG_E_SHAREREQUIRED Handle = 0x80030106 + STG_E_NOTFILEBASEDSTORAGE Handle = 0x80030107 + STG_E_EXTANTMARSHALLINGS Handle = 0x80030108 + STG_E_DOCFILECORRUPT Handle = 0x80030109 + STG_E_BADBASEADDRESS Handle = 0x80030110 + STG_E_DOCFILETOOLARGE Handle = 0x80030111 + STG_E_NOTSIMPLEFORMAT Handle = 0x80030112 + STG_E_INCOMPLETE Handle = 0x80030201 + STG_E_TERMINATED Handle = 0x80030202 + STG_S_CONVERTED Handle = 0x00030200 + STG_S_BLOCK Handle = 0x00030201 + STG_S_RETRYNOW Handle = 0x00030202 + STG_S_MONITORING Handle = 0x00030203 + STG_S_MULTIPLEOPENS Handle = 0x00030204 + STG_S_CONSOLIDATIONFAILED Handle = 0x00030205 + STG_S_CANNOTCONSOLIDATE Handle = 0x00030206 + STG_S_POWER_CYCLE_REQUIRED Handle = 0x00030207 + STG_E_FIRMWARE_SLOT_INVALID Handle = 0x80030208 + STG_E_FIRMWARE_IMAGE_INVALID Handle = 0x80030209 + STG_E_DEVICE_UNRESPONSIVE Handle = 0x8003020A + STG_E_STATUS_COPY_PROTECTION_FAILURE Handle = 0x80030305 + STG_E_CSS_AUTHENTICATION_FAILURE Handle = 0x80030306 + STG_E_CSS_KEY_NOT_PRESENT Handle = 0x80030307 + STG_E_CSS_KEY_NOT_ESTABLISHED Handle = 0x80030308 + STG_E_CSS_SCRAMBLED_SECTOR Handle = 0x80030309 + STG_E_CSS_REGION_MISMATCH Handle = 0x8003030A + STG_E_RESETS_EXHAUSTED Handle = 0x8003030B + RPC_E_CALL_REJECTED Handle = 0x80010001 + RPC_E_CALL_CANCELED Handle = 0x80010002 + RPC_E_CANTPOST_INSENDCALL Handle = 0x80010003 + RPC_E_CANTCALLOUT_INASYNCCALL Handle = 0x80010004 + RPC_E_CANTCALLOUT_INEXTERNALCALL Handle = 0x80010005 + RPC_E_CONNECTION_TERMINATED Handle = 0x80010006 + RPC_E_SERVER_DIED Handle = 0x80010007 + RPC_E_CLIENT_DIED Handle = 0x80010008 + RPC_E_INVALID_DATAPACKET Handle = 0x80010009 + RPC_E_CANTTRANSMIT_CALL Handle = 0x8001000A + RPC_E_CLIENT_CANTMARSHAL_DATA Handle = 0x8001000B + RPC_E_CLIENT_CANTUNMARSHAL_DATA Handle = 0x8001000C + RPC_E_SERVER_CANTMARSHAL_DATA Handle = 0x8001000D + RPC_E_SERVER_CANTUNMARSHAL_DATA Handle = 0x8001000E + RPC_E_INVALID_DATA Handle = 0x8001000F + RPC_E_INVALID_PARAMETER Handle = 0x80010010 + RPC_E_CANTCALLOUT_AGAIN Handle = 0x80010011 + RPC_E_SERVER_DIED_DNE Handle = 0x80010012 + RPC_E_SYS_CALL_FAILED Handle = 0x80010100 + RPC_E_OUT_OF_RESOURCES Handle = 0x80010101 + RPC_E_ATTEMPTED_MULTITHREAD Handle = 0x80010102 + RPC_E_NOT_REGISTERED Handle = 0x80010103 + RPC_E_FAULT Handle = 0x80010104 + RPC_E_SERVERFAULT Handle = 0x80010105 + RPC_E_CHANGED_MODE Handle = 0x80010106 + RPC_E_INVALIDMETHOD Handle = 0x80010107 + RPC_E_DISCONNECTED Handle = 0x80010108 + RPC_E_RETRY Handle = 0x80010109 + RPC_E_SERVERCALL_RETRYLATER Handle = 0x8001010A + RPC_E_SERVERCALL_REJECTED Handle = 0x8001010B + RPC_E_INVALID_CALLDATA Handle = 0x8001010C + RPC_E_CANTCALLOUT_ININPUTSYNCCALL Handle = 0x8001010D + RPC_E_WRONG_THREAD Handle = 0x8001010E + RPC_E_THREAD_NOT_INIT Handle = 0x8001010F + RPC_E_VERSION_MISMATCH Handle = 0x80010110 + RPC_E_INVALID_HEADER Handle = 0x80010111 + RPC_E_INVALID_EXTENSION Handle = 0x80010112 + RPC_E_INVALID_IPID Handle = 0x80010113 + RPC_E_INVALID_OBJECT Handle = 0x80010114 + RPC_S_CALLPENDING Handle = 0x80010115 + RPC_S_WAITONTIMER Handle = 0x80010116 + RPC_E_CALL_COMPLETE Handle = 0x80010117 + RPC_E_UNSECURE_CALL Handle = 0x80010118 + RPC_E_TOO_LATE Handle = 0x80010119 + RPC_E_NO_GOOD_SECURITY_PACKAGES Handle = 0x8001011A + RPC_E_ACCESS_DENIED Handle = 0x8001011B + RPC_E_REMOTE_DISABLED Handle = 0x8001011C + RPC_E_INVALID_OBJREF Handle = 0x8001011D + RPC_E_NO_CONTEXT Handle = 0x8001011E + RPC_E_TIMEOUT Handle = 0x8001011F + RPC_E_NO_SYNC Handle = 0x80010120 + RPC_E_FULLSIC_REQUIRED Handle = 0x80010121 + RPC_E_INVALID_STD_NAME Handle = 0x80010122 + CO_E_FAILEDTOIMPERSONATE Handle = 0x80010123 + CO_E_FAILEDTOGETSECCTX Handle = 0x80010124 + CO_E_FAILEDTOOPENTHREADTOKEN Handle = 0x80010125 + CO_E_FAILEDTOGETTOKENINFO Handle = 0x80010126 + CO_E_TRUSTEEDOESNTMATCHCLIENT Handle = 0x80010127 + CO_E_FAILEDTOQUERYCLIENTBLANKET Handle = 0x80010128 + CO_E_FAILEDTOSETDACL Handle = 0x80010129 + CO_E_ACCESSCHECKFAILED Handle = 0x8001012A + CO_E_NETACCESSAPIFAILED Handle = 0x8001012B + CO_E_WRONGTRUSTEENAMESYNTAX Handle = 0x8001012C + CO_E_INVALIDSID Handle = 0x8001012D + CO_E_CONVERSIONFAILED Handle = 0x8001012E + CO_E_NOMATCHINGSIDFOUND Handle = 0x8001012F + CO_E_LOOKUPACCSIDFAILED Handle = 0x80010130 + CO_E_NOMATCHINGNAMEFOUND Handle = 0x80010131 + CO_E_LOOKUPACCNAMEFAILED Handle = 0x80010132 + CO_E_SETSERLHNDLFAILED Handle = 0x80010133 + CO_E_FAILEDTOGETWINDIR Handle = 0x80010134 + CO_E_PATHTOOLONG Handle = 0x80010135 + CO_E_FAILEDTOGENUUID Handle = 0x80010136 + CO_E_FAILEDTOCREATEFILE Handle = 0x80010137 + CO_E_FAILEDTOCLOSEHANDLE Handle = 0x80010138 + CO_E_EXCEEDSYSACLLIMIT Handle = 0x80010139 + CO_E_ACESINWRONGORDER Handle = 0x8001013A + CO_E_INCOMPATIBLESTREAMVERSION Handle = 0x8001013B + CO_E_FAILEDTOOPENPROCESSTOKEN Handle = 0x8001013C + CO_E_DECODEFAILED Handle = 0x8001013D + CO_E_ACNOTINITIALIZED Handle = 0x8001013F + CO_E_CANCEL_DISABLED Handle = 0x80010140 + RPC_E_UNEXPECTED Handle = 0x8001FFFF + ERROR_AUDITING_DISABLED Handle = 0xC0090001 + ERROR_ALL_SIDS_FILTERED Handle = 0xC0090002 + ERROR_BIZRULES_NOT_ENABLED Handle = 0xC0090003 + NTE_BAD_UID Handle = 0x80090001 + NTE_BAD_HASH Handle = 0x80090002 + NTE_BAD_KEY Handle = 0x80090003 + NTE_BAD_LEN Handle = 0x80090004 + NTE_BAD_DATA Handle = 0x80090005 + NTE_BAD_SIGNATURE Handle = 0x80090006 + NTE_BAD_VER Handle = 0x80090007 + NTE_BAD_ALGID Handle = 0x80090008 + NTE_BAD_FLAGS Handle = 0x80090009 + NTE_BAD_TYPE Handle = 0x8009000A + NTE_BAD_KEY_STATE Handle = 0x8009000B + NTE_BAD_HASH_STATE Handle = 0x8009000C + NTE_NO_KEY Handle = 0x8009000D + NTE_NO_MEMORY Handle = 0x8009000E + NTE_EXISTS Handle = 0x8009000F + NTE_PERM Handle = 0x80090010 + NTE_NOT_FOUND Handle = 0x80090011 + NTE_DOUBLE_ENCRYPT Handle = 0x80090012 + NTE_BAD_PROVIDER Handle = 0x80090013 + NTE_BAD_PROV_TYPE Handle = 0x80090014 + NTE_BAD_PUBLIC_KEY Handle = 0x80090015 + NTE_BAD_KEYSET Handle = 0x80090016 + NTE_PROV_TYPE_NOT_DEF Handle = 0x80090017 + NTE_PROV_TYPE_ENTRY_BAD Handle = 0x80090018 + NTE_KEYSET_NOT_DEF Handle = 0x80090019 + NTE_KEYSET_ENTRY_BAD Handle = 0x8009001A + NTE_PROV_TYPE_NO_MATCH Handle = 0x8009001B + NTE_SIGNATURE_FILE_BAD Handle = 0x8009001C + NTE_PROVIDER_DLL_FAIL Handle = 0x8009001D + NTE_PROV_DLL_NOT_FOUND Handle = 0x8009001E + NTE_BAD_KEYSET_PARAM Handle = 0x8009001F + NTE_FAIL Handle = 0x80090020 + NTE_SYS_ERR Handle = 0x80090021 + NTE_SILENT_CONTEXT Handle = 0x80090022 + NTE_TOKEN_KEYSET_STORAGE_FULL Handle = 0x80090023 + NTE_TEMPORARY_PROFILE Handle = 0x80090024 + NTE_FIXEDPARAMETER Handle = 0x80090025 + NTE_INVALID_HANDLE Handle = 0x80090026 + NTE_INVALID_PARAMETER Handle = 0x80090027 + NTE_BUFFER_TOO_SMALL Handle = 0x80090028 + NTE_NOT_SUPPORTED Handle = 0x80090029 + NTE_NO_MORE_ITEMS Handle = 0x8009002A + NTE_BUFFERS_OVERLAP Handle = 0x8009002B + NTE_DECRYPTION_FAILURE Handle = 0x8009002C + NTE_INTERNAL_ERROR Handle = 0x8009002D + NTE_UI_REQUIRED Handle = 0x8009002E + NTE_HMAC_NOT_SUPPORTED Handle = 0x8009002F + NTE_DEVICE_NOT_READY Handle = 0x80090030 + NTE_AUTHENTICATION_IGNORED Handle = 0x80090031 + NTE_VALIDATION_FAILED Handle = 0x80090032 + NTE_INCORRECT_PASSWORD Handle = 0x80090033 + NTE_ENCRYPTION_FAILURE Handle = 0x80090034 + NTE_DEVICE_NOT_FOUND Handle = 0x80090035 + NTE_USER_CANCELLED Handle = 0x80090036 + NTE_PASSWORD_CHANGE_REQUIRED Handle = 0x80090037 + NTE_NOT_ACTIVE_CONSOLE Handle = 0x80090038 + SEC_E_INSUFFICIENT_MEMORY Handle = 0x80090300 + SEC_E_INVALID_HANDLE Handle = 0x80090301 + SEC_E_UNSUPPORTED_FUNCTION Handle = 0x80090302 + SEC_E_TARGET_UNKNOWN Handle = 0x80090303 + SEC_E_INTERNAL_ERROR Handle = 0x80090304 + SEC_E_SECPKG_NOT_FOUND Handle = 0x80090305 + SEC_E_NOT_OWNER Handle = 0x80090306 + SEC_E_CANNOT_INSTALL Handle = 0x80090307 + SEC_E_INVALID_TOKEN Handle = 0x80090308 + SEC_E_CANNOT_PACK Handle = 0x80090309 + SEC_E_QOP_NOT_SUPPORTED Handle = 0x8009030A + SEC_E_NO_IMPERSONATION Handle = 0x8009030B + SEC_E_LOGON_DENIED Handle = 0x8009030C + SEC_E_UNKNOWN_CREDENTIALS Handle = 0x8009030D + SEC_E_NO_CREDENTIALS Handle = 0x8009030E + SEC_E_MESSAGE_ALTERED Handle = 0x8009030F + SEC_E_OUT_OF_SEQUENCE Handle = 0x80090310 + SEC_E_NO_AUTHENTICATING_AUTHORITY Handle = 0x80090311 + SEC_I_CONTINUE_NEEDED Handle = 0x00090312 + SEC_I_COMPLETE_NEEDED Handle = 0x00090313 + SEC_I_COMPLETE_AND_CONTINUE Handle = 0x00090314 + SEC_I_LOCAL_LOGON Handle = 0x00090315 + SEC_I_GENERIC_EXTENSION_RECEIVED Handle = 0x00090316 + SEC_E_BAD_PKGID Handle = 0x80090316 + SEC_E_CONTEXT_EXPIRED Handle = 0x80090317 + SEC_I_CONTEXT_EXPIRED Handle = 0x00090317 + SEC_E_INCOMPLETE_MESSAGE Handle = 0x80090318 + SEC_E_INCOMPLETE_CREDENTIALS Handle = 0x80090320 + SEC_E_BUFFER_TOO_SMALL Handle = 0x80090321 + SEC_I_INCOMPLETE_CREDENTIALS Handle = 0x00090320 + SEC_I_RENEGOTIATE Handle = 0x00090321 + SEC_E_WRONG_PRINCIPAL Handle = 0x80090322 + SEC_I_NO_LSA_CONTEXT Handle = 0x00090323 + SEC_E_TIME_SKEW Handle = 0x80090324 + SEC_E_UNTRUSTED_ROOT Handle = 0x80090325 + SEC_E_ILLEGAL_MESSAGE Handle = 0x80090326 + SEC_E_CERT_UNKNOWN Handle = 0x80090327 + SEC_E_CERT_EXPIRED Handle = 0x80090328 + SEC_E_ENCRYPT_FAILURE Handle = 0x80090329 + SEC_E_DECRYPT_FAILURE Handle = 0x80090330 + SEC_E_ALGORITHM_MISMATCH Handle = 0x80090331 + SEC_E_SECURITY_QOS_FAILED Handle = 0x80090332 + SEC_E_UNFINISHED_CONTEXT_DELETED Handle = 0x80090333 + SEC_E_NO_TGT_REPLY Handle = 0x80090334 + SEC_E_NO_IP_ADDRESSES Handle = 0x80090335 + SEC_E_WRONG_CREDENTIAL_HANDLE Handle = 0x80090336 + SEC_E_CRYPTO_SYSTEM_INVALID Handle = 0x80090337 + SEC_E_MAX_REFERRALS_EXCEEDED Handle = 0x80090338 + SEC_E_MUST_BE_KDC Handle = 0x80090339 + SEC_E_STRONG_CRYPTO_NOT_SUPPORTED Handle = 0x8009033A + SEC_E_TOO_MANY_PRINCIPALS Handle = 0x8009033B + SEC_E_NO_PA_DATA Handle = 0x8009033C + SEC_E_PKINIT_NAME_MISMATCH Handle = 0x8009033D + SEC_E_SMARTCARD_LOGON_REQUIRED Handle = 0x8009033E + SEC_E_SHUTDOWN_IN_PROGRESS Handle = 0x8009033F + SEC_E_KDC_INVALID_REQUEST Handle = 0x80090340 + SEC_E_KDC_UNABLE_TO_REFER Handle = 0x80090341 + SEC_E_KDC_UNKNOWN_ETYPE Handle = 0x80090342 + SEC_E_UNSUPPORTED_PREAUTH Handle = 0x80090343 + SEC_E_DELEGATION_REQUIRED Handle = 0x80090345 + SEC_E_BAD_BINDINGS Handle = 0x80090346 + SEC_E_MULTIPLE_ACCOUNTS Handle = 0x80090347 + SEC_E_NO_KERB_KEY Handle = 0x80090348 + SEC_E_CERT_WRONG_USAGE Handle = 0x80090349 + SEC_E_DOWNGRADE_DETECTED Handle = 0x80090350 + SEC_E_SMARTCARD_CERT_REVOKED Handle = 0x80090351 + SEC_E_ISSUING_CA_UNTRUSTED Handle = 0x80090352 + SEC_E_REVOCATION_OFFLINE_C Handle = 0x80090353 + SEC_E_PKINIT_CLIENT_FAILURE Handle = 0x80090354 + SEC_E_SMARTCARD_CERT_EXPIRED Handle = 0x80090355 + SEC_E_NO_S4U_PROT_SUPPORT Handle = 0x80090356 + SEC_E_CROSSREALM_DELEGATION_FAILURE Handle = 0x80090357 + SEC_E_REVOCATION_OFFLINE_KDC Handle = 0x80090358 + SEC_E_ISSUING_CA_UNTRUSTED_KDC Handle = 0x80090359 + SEC_E_KDC_CERT_EXPIRED Handle = 0x8009035A + SEC_E_KDC_CERT_REVOKED Handle = 0x8009035B + SEC_I_SIGNATURE_NEEDED Handle = 0x0009035C + SEC_E_INVALID_PARAMETER Handle = 0x8009035D + SEC_E_DELEGATION_POLICY Handle = 0x8009035E + SEC_E_POLICY_NLTM_ONLY Handle = 0x8009035F + SEC_I_NO_RENEGOTIATION Handle = 0x00090360 + SEC_E_NO_CONTEXT Handle = 0x80090361 + SEC_E_PKU2U_CERT_FAILURE Handle = 0x80090362 + SEC_E_MUTUAL_AUTH_FAILED Handle = 0x80090363 + SEC_I_MESSAGE_FRAGMENT Handle = 0x00090364 + SEC_E_ONLY_HTTPS_ALLOWED Handle = 0x80090365 + SEC_I_CONTINUE_NEEDED_MESSAGE_OK Handle = 0x00090366 + SEC_E_APPLICATION_PROTOCOL_MISMATCH Handle = 0x80090367 + SEC_I_ASYNC_CALL_PENDING Handle = 0x00090368 + SEC_E_INVALID_UPN_NAME Handle = 0x80090369 + SEC_E_EXT_BUFFER_TOO_SMALL Handle = 0x8009036A + SEC_E_INSUFFICIENT_BUFFERS Handle = 0x8009036B + SEC_E_NO_SPM = SEC_E_INTERNAL_ERROR + SEC_E_NOT_SUPPORTED = SEC_E_UNSUPPORTED_FUNCTION + CRYPT_E_MSG_ERROR Handle = 0x80091001 + CRYPT_E_UNKNOWN_ALGO Handle = 0x80091002 + CRYPT_E_OID_FORMAT Handle = 0x80091003 + CRYPT_E_INVALID_MSG_TYPE Handle = 0x80091004 + CRYPT_E_UNEXPECTED_ENCODING Handle = 0x80091005 + CRYPT_E_AUTH_ATTR_MISSING Handle = 0x80091006 + CRYPT_E_HASH_VALUE Handle = 0x80091007 + CRYPT_E_INVALID_INDEX Handle = 0x80091008 + CRYPT_E_ALREADY_DECRYPTED Handle = 0x80091009 + CRYPT_E_NOT_DECRYPTED Handle = 0x8009100A + CRYPT_E_RECIPIENT_NOT_FOUND Handle = 0x8009100B + CRYPT_E_CONTROL_TYPE Handle = 0x8009100C + CRYPT_E_ISSUER_SERIALNUMBER Handle = 0x8009100D + CRYPT_E_SIGNER_NOT_FOUND Handle = 0x8009100E + CRYPT_E_ATTRIBUTES_MISSING Handle = 0x8009100F + CRYPT_E_STREAM_MSG_NOT_READY Handle = 0x80091010 + CRYPT_E_STREAM_INSUFFICIENT_DATA Handle = 0x80091011 + CRYPT_I_NEW_PROTECTION_REQUIRED Handle = 0x00091012 + CRYPT_E_BAD_LEN Handle = 0x80092001 + CRYPT_E_BAD_ENCODE Handle = 0x80092002 + CRYPT_E_FILE_ERROR Handle = 0x80092003 + CRYPT_E_NOT_FOUND Handle = 0x80092004 + CRYPT_E_EXISTS Handle = 0x80092005 + CRYPT_E_NO_PROVIDER Handle = 0x80092006 + CRYPT_E_SELF_SIGNED Handle = 0x80092007 + CRYPT_E_DELETED_PREV Handle = 0x80092008 + CRYPT_E_NO_MATCH Handle = 0x80092009 + CRYPT_E_UNEXPECTED_MSG_TYPE Handle = 0x8009200A + CRYPT_E_NO_KEY_PROPERTY Handle = 0x8009200B + CRYPT_E_NO_DECRYPT_CERT Handle = 0x8009200C + CRYPT_E_BAD_MSG Handle = 0x8009200D + CRYPT_E_NO_SIGNER Handle = 0x8009200E + CRYPT_E_PENDING_CLOSE Handle = 0x8009200F + CRYPT_E_REVOKED Handle = 0x80092010 + CRYPT_E_NO_REVOCATION_DLL Handle = 0x80092011 + CRYPT_E_NO_REVOCATION_CHECK Handle = 0x80092012 + CRYPT_E_REVOCATION_OFFLINE Handle = 0x80092013 + CRYPT_E_NOT_IN_REVOCATION_DATABASE Handle = 0x80092014 + CRYPT_E_INVALID_NUMERIC_STRING Handle = 0x80092020 + CRYPT_E_INVALID_PRINTABLE_STRING Handle = 0x80092021 + CRYPT_E_INVALID_IA5_STRING Handle = 0x80092022 + CRYPT_E_INVALID_X500_STRING Handle = 0x80092023 + CRYPT_E_NOT_CHAR_STRING Handle = 0x80092024 + CRYPT_E_FILERESIZED Handle = 0x80092025 + CRYPT_E_SECURITY_SETTINGS Handle = 0x80092026 + CRYPT_E_NO_VERIFY_USAGE_DLL Handle = 0x80092027 + CRYPT_E_NO_VERIFY_USAGE_CHECK Handle = 0x80092028 + CRYPT_E_VERIFY_USAGE_OFFLINE Handle = 0x80092029 + CRYPT_E_NOT_IN_CTL Handle = 0x8009202A + CRYPT_E_NO_TRUSTED_SIGNER Handle = 0x8009202B + CRYPT_E_MISSING_PUBKEY_PARA Handle = 0x8009202C + CRYPT_E_OBJECT_LOCATOR_OBJECT_NOT_FOUND Handle = 0x8009202D + CRYPT_E_OSS_ERROR Handle = 0x80093000 + OSS_MORE_BUF Handle = 0x80093001 + OSS_NEGATIVE_UINTEGER Handle = 0x80093002 + OSS_PDU_RANGE Handle = 0x80093003 + OSS_MORE_INPUT Handle = 0x80093004 + OSS_DATA_ERROR Handle = 0x80093005 + OSS_BAD_ARG Handle = 0x80093006 + OSS_BAD_VERSION Handle = 0x80093007 + OSS_OUT_MEMORY Handle = 0x80093008 + OSS_PDU_MISMATCH Handle = 0x80093009 + OSS_LIMITED Handle = 0x8009300A + OSS_BAD_PTR Handle = 0x8009300B + OSS_BAD_TIME Handle = 0x8009300C + OSS_INDEFINITE_NOT_SUPPORTED Handle = 0x8009300D + OSS_MEM_ERROR Handle = 0x8009300E + OSS_BAD_TABLE Handle = 0x8009300F + OSS_TOO_LONG Handle = 0x80093010 + OSS_CONSTRAINT_VIOLATED Handle = 0x80093011 + OSS_FATAL_ERROR Handle = 0x80093012 + OSS_ACCESS_SERIALIZATION_ERROR Handle = 0x80093013 + OSS_NULL_TBL Handle = 0x80093014 + OSS_NULL_FCN Handle = 0x80093015 + OSS_BAD_ENCRULES Handle = 0x80093016 + OSS_UNAVAIL_ENCRULES Handle = 0x80093017 + OSS_CANT_OPEN_TRACE_WINDOW Handle = 0x80093018 + OSS_UNIMPLEMENTED Handle = 0x80093019 + OSS_OID_DLL_NOT_LINKED Handle = 0x8009301A + OSS_CANT_OPEN_TRACE_FILE Handle = 0x8009301B + OSS_TRACE_FILE_ALREADY_OPEN Handle = 0x8009301C + OSS_TABLE_MISMATCH Handle = 0x8009301D + OSS_TYPE_NOT_SUPPORTED Handle = 0x8009301E + OSS_REAL_DLL_NOT_LINKED Handle = 0x8009301F + OSS_REAL_CODE_NOT_LINKED Handle = 0x80093020 + OSS_OUT_OF_RANGE Handle = 0x80093021 + OSS_COPIER_DLL_NOT_LINKED Handle = 0x80093022 + OSS_CONSTRAINT_DLL_NOT_LINKED Handle = 0x80093023 + OSS_COMPARATOR_DLL_NOT_LINKED Handle = 0x80093024 + OSS_COMPARATOR_CODE_NOT_LINKED Handle = 0x80093025 + OSS_MEM_MGR_DLL_NOT_LINKED Handle = 0x80093026 + OSS_PDV_DLL_NOT_LINKED Handle = 0x80093027 + OSS_PDV_CODE_NOT_LINKED Handle = 0x80093028 + OSS_API_DLL_NOT_LINKED Handle = 0x80093029 + OSS_BERDER_DLL_NOT_LINKED Handle = 0x8009302A + OSS_PER_DLL_NOT_LINKED Handle = 0x8009302B + OSS_OPEN_TYPE_ERROR Handle = 0x8009302C + OSS_MUTEX_NOT_CREATED Handle = 0x8009302D + OSS_CANT_CLOSE_TRACE_FILE Handle = 0x8009302E + CRYPT_E_ASN1_ERROR Handle = 0x80093100 + CRYPT_E_ASN1_INTERNAL Handle = 0x80093101 + CRYPT_E_ASN1_EOD Handle = 0x80093102 + CRYPT_E_ASN1_CORRUPT Handle = 0x80093103 + CRYPT_E_ASN1_LARGE Handle = 0x80093104 + CRYPT_E_ASN1_CONSTRAINT Handle = 0x80093105 + CRYPT_E_ASN1_MEMORY Handle = 0x80093106 + CRYPT_E_ASN1_OVERFLOW Handle = 0x80093107 + CRYPT_E_ASN1_BADPDU Handle = 0x80093108 + CRYPT_E_ASN1_BADARGS Handle = 0x80093109 + CRYPT_E_ASN1_BADREAL Handle = 0x8009310A + CRYPT_E_ASN1_BADTAG Handle = 0x8009310B + CRYPT_E_ASN1_CHOICE Handle = 0x8009310C + CRYPT_E_ASN1_RULE Handle = 0x8009310D + CRYPT_E_ASN1_UTF8 Handle = 0x8009310E + CRYPT_E_ASN1_PDU_TYPE Handle = 0x80093133 + CRYPT_E_ASN1_NYI Handle = 0x80093134 + CRYPT_E_ASN1_EXTENDED Handle = 0x80093201 + CRYPT_E_ASN1_NOEOD Handle = 0x80093202 + CERTSRV_E_BAD_REQUESTSUBJECT Handle = 0x80094001 + CERTSRV_E_NO_REQUEST Handle = 0x80094002 + CERTSRV_E_BAD_REQUESTSTATUS Handle = 0x80094003 + CERTSRV_E_PROPERTY_EMPTY Handle = 0x80094004 + CERTSRV_E_INVALID_CA_CERTIFICATE Handle = 0x80094005 + CERTSRV_E_SERVER_SUSPENDED Handle = 0x80094006 + CERTSRV_E_ENCODING_LENGTH Handle = 0x80094007 + CERTSRV_E_ROLECONFLICT Handle = 0x80094008 + CERTSRV_E_RESTRICTEDOFFICER Handle = 0x80094009 + CERTSRV_E_KEY_ARCHIVAL_NOT_CONFIGURED Handle = 0x8009400A + CERTSRV_E_NO_VALID_KRA Handle = 0x8009400B + CERTSRV_E_BAD_REQUEST_KEY_ARCHIVAL Handle = 0x8009400C + CERTSRV_E_NO_CAADMIN_DEFINED Handle = 0x8009400D + CERTSRV_E_BAD_RENEWAL_CERT_ATTRIBUTE Handle = 0x8009400E + CERTSRV_E_NO_DB_SESSIONS Handle = 0x8009400F + CERTSRV_E_ALIGNMENT_FAULT Handle = 0x80094010 + CERTSRV_E_ENROLL_DENIED Handle = 0x80094011 + CERTSRV_E_TEMPLATE_DENIED Handle = 0x80094012 + CERTSRV_E_DOWNLEVEL_DC_SSL_OR_UPGRADE Handle = 0x80094013 + CERTSRV_E_ADMIN_DENIED_REQUEST Handle = 0x80094014 + CERTSRV_E_NO_POLICY_SERVER Handle = 0x80094015 + CERTSRV_E_WEAK_SIGNATURE_OR_KEY Handle = 0x80094016 + CERTSRV_E_KEY_ATTESTATION_NOT_SUPPORTED Handle = 0x80094017 + CERTSRV_E_ENCRYPTION_CERT_REQUIRED Handle = 0x80094018 + CERTSRV_E_UNSUPPORTED_CERT_TYPE Handle = 0x80094800 + CERTSRV_E_NO_CERT_TYPE Handle = 0x80094801 + CERTSRV_E_TEMPLATE_CONFLICT Handle = 0x80094802 + CERTSRV_E_SUBJECT_ALT_NAME_REQUIRED Handle = 0x80094803 + CERTSRV_E_ARCHIVED_KEY_REQUIRED Handle = 0x80094804 + CERTSRV_E_SMIME_REQUIRED Handle = 0x80094805 + CERTSRV_E_BAD_RENEWAL_SUBJECT Handle = 0x80094806 + CERTSRV_E_BAD_TEMPLATE_VERSION Handle = 0x80094807 + CERTSRV_E_TEMPLATE_POLICY_REQUIRED Handle = 0x80094808 + CERTSRV_E_SIGNATURE_POLICY_REQUIRED Handle = 0x80094809 + CERTSRV_E_SIGNATURE_COUNT Handle = 0x8009480A + CERTSRV_E_SIGNATURE_REJECTED Handle = 0x8009480B + CERTSRV_E_ISSUANCE_POLICY_REQUIRED Handle = 0x8009480C + CERTSRV_E_SUBJECT_UPN_REQUIRED Handle = 0x8009480D + CERTSRV_E_SUBJECT_DIRECTORY_GUID_REQUIRED Handle = 0x8009480E + CERTSRV_E_SUBJECT_DNS_REQUIRED Handle = 0x8009480F + CERTSRV_E_ARCHIVED_KEY_UNEXPECTED Handle = 0x80094810 + CERTSRV_E_KEY_LENGTH Handle = 0x80094811 + CERTSRV_E_SUBJECT_EMAIL_REQUIRED Handle = 0x80094812 + CERTSRV_E_UNKNOWN_CERT_TYPE Handle = 0x80094813 + CERTSRV_E_CERT_TYPE_OVERLAP Handle = 0x80094814 + CERTSRV_E_TOO_MANY_SIGNATURES Handle = 0x80094815 + CERTSRV_E_RENEWAL_BAD_PUBLIC_KEY Handle = 0x80094816 + CERTSRV_E_INVALID_EK Handle = 0x80094817 + CERTSRV_E_INVALID_IDBINDING Handle = 0x80094818 + CERTSRV_E_INVALID_ATTESTATION Handle = 0x80094819 + CERTSRV_E_KEY_ATTESTATION Handle = 0x8009481A + CERTSRV_E_CORRUPT_KEY_ATTESTATION Handle = 0x8009481B + CERTSRV_E_EXPIRED_CHALLENGE Handle = 0x8009481C + CERTSRV_E_INVALID_RESPONSE Handle = 0x8009481D + CERTSRV_E_INVALID_REQUESTID Handle = 0x8009481E + CERTSRV_E_REQUEST_PRECERTIFICATE_MISMATCH Handle = 0x8009481F + CERTSRV_E_PENDING_CLIENT_RESPONSE Handle = 0x80094820 + XENROLL_E_KEY_NOT_EXPORTABLE Handle = 0x80095000 + XENROLL_E_CANNOT_ADD_ROOT_CERT Handle = 0x80095001 + XENROLL_E_RESPONSE_KA_HASH_NOT_FOUND Handle = 0x80095002 + XENROLL_E_RESPONSE_UNEXPECTED_KA_HASH Handle = 0x80095003 + XENROLL_E_RESPONSE_KA_HASH_MISMATCH Handle = 0x80095004 + XENROLL_E_KEYSPEC_SMIME_MISMATCH Handle = 0x80095005 + TRUST_E_SYSTEM_ERROR Handle = 0x80096001 + TRUST_E_NO_SIGNER_CERT Handle = 0x80096002 + TRUST_E_COUNTER_SIGNER Handle = 0x80096003 + TRUST_E_CERT_SIGNATURE Handle = 0x80096004 + TRUST_E_TIME_STAMP Handle = 0x80096005 + TRUST_E_BAD_DIGEST Handle = 0x80096010 + TRUST_E_MALFORMED_SIGNATURE Handle = 0x80096011 + TRUST_E_BASIC_CONSTRAINTS Handle = 0x80096019 + TRUST_E_FINANCIAL_CRITERIA Handle = 0x8009601E + MSSIPOTF_E_OUTOFMEMRANGE Handle = 0x80097001 + MSSIPOTF_E_CANTGETOBJECT Handle = 0x80097002 + MSSIPOTF_E_NOHEADTABLE Handle = 0x80097003 + MSSIPOTF_E_BAD_MAGICNUMBER Handle = 0x80097004 + MSSIPOTF_E_BAD_OFFSET_TABLE Handle = 0x80097005 + MSSIPOTF_E_TABLE_TAGORDER Handle = 0x80097006 + MSSIPOTF_E_TABLE_LONGWORD Handle = 0x80097007 + MSSIPOTF_E_BAD_FIRST_TABLE_PLACEMENT Handle = 0x80097008 + MSSIPOTF_E_TABLES_OVERLAP Handle = 0x80097009 + MSSIPOTF_E_TABLE_PADBYTES Handle = 0x8009700A + MSSIPOTF_E_FILETOOSMALL Handle = 0x8009700B + MSSIPOTF_E_TABLE_CHECKSUM Handle = 0x8009700C + MSSIPOTF_E_FILE_CHECKSUM Handle = 0x8009700D + MSSIPOTF_E_FAILED_POLICY Handle = 0x80097010 + MSSIPOTF_E_FAILED_HINTS_CHECK Handle = 0x80097011 + MSSIPOTF_E_NOT_OPENTYPE Handle = 0x80097012 + MSSIPOTF_E_FILE Handle = 0x80097013 + MSSIPOTF_E_CRYPT Handle = 0x80097014 + MSSIPOTF_E_BADVERSION Handle = 0x80097015 + MSSIPOTF_E_DSIG_STRUCTURE Handle = 0x80097016 + MSSIPOTF_E_PCONST_CHECK Handle = 0x80097017 + MSSIPOTF_E_STRUCTURE Handle = 0x80097018 + ERROR_CRED_REQUIRES_CONFIRMATION Handle = 0x80097019 + NTE_OP_OK syscall.Errno = 0 + TRUST_E_PROVIDER_UNKNOWN Handle = 0x800B0001 + TRUST_E_ACTION_UNKNOWN Handle = 0x800B0002 + TRUST_E_SUBJECT_FORM_UNKNOWN Handle = 0x800B0003 + TRUST_E_SUBJECT_NOT_TRUSTED Handle = 0x800B0004 + DIGSIG_E_ENCODE Handle = 0x800B0005 + DIGSIG_E_DECODE Handle = 0x800B0006 + DIGSIG_E_EXTENSIBILITY Handle = 0x800B0007 + DIGSIG_E_CRYPTO Handle = 0x800B0008 + PERSIST_E_SIZEDEFINITE Handle = 0x800B0009 + PERSIST_E_SIZEINDEFINITE Handle = 0x800B000A + PERSIST_E_NOTSELFSIZING Handle = 0x800B000B + TRUST_E_NOSIGNATURE Handle = 0x800B0100 + CERT_E_EXPIRED Handle = 0x800B0101 + CERT_E_VALIDITYPERIODNESTING Handle = 0x800B0102 + CERT_E_ROLE Handle = 0x800B0103 + CERT_E_PATHLENCONST Handle = 0x800B0104 + CERT_E_CRITICAL Handle = 0x800B0105 + CERT_E_PURPOSE Handle = 0x800B0106 + CERT_E_ISSUERCHAINING Handle = 0x800B0107 + CERT_E_MALFORMED Handle = 0x800B0108 + CERT_E_UNTRUSTEDROOT Handle = 0x800B0109 + CERT_E_CHAINING Handle = 0x800B010A + TRUST_E_FAIL Handle = 0x800B010B + CERT_E_REVOKED Handle = 0x800B010C + CERT_E_UNTRUSTEDTESTROOT Handle = 0x800B010D + CERT_E_REVOCATION_FAILURE Handle = 0x800B010E + CERT_E_CN_NO_MATCH Handle = 0x800B010F + CERT_E_WRONG_USAGE Handle = 0x800B0110 + TRUST_E_EXPLICIT_DISTRUST Handle = 0x800B0111 + CERT_E_UNTRUSTEDCA Handle = 0x800B0112 + CERT_E_INVALID_POLICY Handle = 0x800B0113 + CERT_E_INVALID_NAME Handle = 0x800B0114 + SPAPI_E_EXPECTED_SECTION_NAME Handle = 0x800F0000 + SPAPI_E_BAD_SECTION_NAME_LINE Handle = 0x800F0001 + SPAPI_E_SECTION_NAME_TOO_LONG Handle = 0x800F0002 + SPAPI_E_GENERAL_SYNTAX Handle = 0x800F0003 + SPAPI_E_WRONG_INF_STYLE Handle = 0x800F0100 + SPAPI_E_SECTION_NOT_FOUND Handle = 0x800F0101 + SPAPI_E_LINE_NOT_FOUND Handle = 0x800F0102 + SPAPI_E_NO_BACKUP Handle = 0x800F0103 + SPAPI_E_NO_ASSOCIATED_CLASS Handle = 0x800F0200 + SPAPI_E_CLASS_MISMATCH Handle = 0x800F0201 + SPAPI_E_DUPLICATE_FOUND Handle = 0x800F0202 + SPAPI_E_NO_DRIVER_SELECTED Handle = 0x800F0203 + SPAPI_E_KEY_DOES_NOT_EXIST Handle = 0x800F0204 + SPAPI_E_INVALID_DEVINST_NAME Handle = 0x800F0205 + SPAPI_E_INVALID_CLASS Handle = 0x800F0206 + SPAPI_E_DEVINST_ALREADY_EXISTS Handle = 0x800F0207 + SPAPI_E_DEVINFO_NOT_REGISTERED Handle = 0x800F0208 + SPAPI_E_INVALID_REG_PROPERTY Handle = 0x800F0209 + SPAPI_E_NO_INF Handle = 0x800F020A + SPAPI_E_NO_SUCH_DEVINST Handle = 0x800F020B + SPAPI_E_CANT_LOAD_CLASS_ICON Handle = 0x800F020C + SPAPI_E_INVALID_CLASS_INSTALLER Handle = 0x800F020D + SPAPI_E_DI_DO_DEFAULT Handle = 0x800F020E + SPAPI_E_DI_NOFILECOPY Handle = 0x800F020F + SPAPI_E_INVALID_HWPROFILE Handle = 0x800F0210 + SPAPI_E_NO_DEVICE_SELECTED Handle = 0x800F0211 + SPAPI_E_DEVINFO_LIST_LOCKED Handle = 0x800F0212 + SPAPI_E_DEVINFO_DATA_LOCKED Handle = 0x800F0213 + SPAPI_E_DI_BAD_PATH Handle = 0x800F0214 + SPAPI_E_NO_CLASSINSTALL_PARAMS Handle = 0x800F0215 + SPAPI_E_FILEQUEUE_LOCKED Handle = 0x800F0216 + SPAPI_E_BAD_SERVICE_INSTALLSECT Handle = 0x800F0217 + SPAPI_E_NO_CLASS_DRIVER_LIST Handle = 0x800F0218 + SPAPI_E_NO_ASSOCIATED_SERVICE Handle = 0x800F0219 + SPAPI_E_NO_DEFAULT_DEVICE_INTERFACE Handle = 0x800F021A + SPAPI_E_DEVICE_INTERFACE_ACTIVE Handle = 0x800F021B + SPAPI_E_DEVICE_INTERFACE_REMOVED Handle = 0x800F021C + SPAPI_E_BAD_INTERFACE_INSTALLSECT Handle = 0x800F021D + SPAPI_E_NO_SUCH_INTERFACE_CLASS Handle = 0x800F021E + SPAPI_E_INVALID_REFERENCE_STRING Handle = 0x800F021F + SPAPI_E_INVALID_MACHINENAME Handle = 0x800F0220 + SPAPI_E_REMOTE_COMM_FAILURE Handle = 0x800F0221 + SPAPI_E_MACHINE_UNAVAILABLE Handle = 0x800F0222 + SPAPI_E_NO_CONFIGMGR_SERVICES Handle = 0x800F0223 + SPAPI_E_INVALID_PROPPAGE_PROVIDER Handle = 0x800F0224 + SPAPI_E_NO_SUCH_DEVICE_INTERFACE Handle = 0x800F0225 + SPAPI_E_DI_POSTPROCESSING_REQUIRED Handle = 0x800F0226 + SPAPI_E_INVALID_COINSTALLER Handle = 0x800F0227 + SPAPI_E_NO_COMPAT_DRIVERS Handle = 0x800F0228 + SPAPI_E_NO_DEVICE_ICON Handle = 0x800F0229 + SPAPI_E_INVALID_INF_LOGCONFIG Handle = 0x800F022A + SPAPI_E_DI_DONT_INSTALL Handle = 0x800F022B + SPAPI_E_INVALID_FILTER_DRIVER Handle = 0x800F022C + SPAPI_E_NON_WINDOWS_NT_DRIVER Handle = 0x800F022D + SPAPI_E_NON_WINDOWS_DRIVER Handle = 0x800F022E + SPAPI_E_NO_CATALOG_FOR_OEM_INF Handle = 0x800F022F + SPAPI_E_DEVINSTALL_QUEUE_NONNATIVE Handle = 0x800F0230 + SPAPI_E_NOT_DISABLEABLE Handle = 0x800F0231 + SPAPI_E_CANT_REMOVE_DEVINST Handle = 0x800F0232 + SPAPI_E_INVALID_TARGET Handle = 0x800F0233 + SPAPI_E_DRIVER_NONNATIVE Handle = 0x800F0234 + SPAPI_E_IN_WOW64 Handle = 0x800F0235 + SPAPI_E_SET_SYSTEM_RESTORE_POINT Handle = 0x800F0236 + SPAPI_E_INCORRECTLY_COPIED_INF Handle = 0x800F0237 + SPAPI_E_SCE_DISABLED Handle = 0x800F0238 + SPAPI_E_UNKNOWN_EXCEPTION Handle = 0x800F0239 + SPAPI_E_PNP_REGISTRY_ERROR Handle = 0x800F023A + SPAPI_E_REMOTE_REQUEST_UNSUPPORTED Handle = 0x800F023B + SPAPI_E_NOT_AN_INSTALLED_OEM_INF Handle = 0x800F023C + SPAPI_E_INF_IN_USE_BY_DEVICES Handle = 0x800F023D + SPAPI_E_DI_FUNCTION_OBSOLETE Handle = 0x800F023E + SPAPI_E_NO_AUTHENTICODE_CATALOG Handle = 0x800F023F + SPAPI_E_AUTHENTICODE_DISALLOWED Handle = 0x800F0240 + SPAPI_E_AUTHENTICODE_TRUSTED_PUBLISHER Handle = 0x800F0241 + SPAPI_E_AUTHENTICODE_TRUST_NOT_ESTABLISHED Handle = 0x800F0242 + SPAPI_E_AUTHENTICODE_PUBLISHER_NOT_TRUSTED Handle = 0x800F0243 + SPAPI_E_SIGNATURE_OSATTRIBUTE_MISMATCH Handle = 0x800F0244 + SPAPI_E_ONLY_VALIDATE_VIA_AUTHENTICODE Handle = 0x800F0245 + SPAPI_E_DEVICE_INSTALLER_NOT_READY Handle = 0x800F0246 + SPAPI_E_DRIVER_STORE_ADD_FAILED Handle = 0x800F0247 + SPAPI_E_DEVICE_INSTALL_BLOCKED Handle = 0x800F0248 + SPAPI_E_DRIVER_INSTALL_BLOCKED Handle = 0x800F0249 + SPAPI_E_WRONG_INF_TYPE Handle = 0x800F024A + SPAPI_E_FILE_HASH_NOT_IN_CATALOG Handle = 0x800F024B + SPAPI_E_DRIVER_STORE_DELETE_FAILED Handle = 0x800F024C + SPAPI_E_UNRECOVERABLE_STACK_OVERFLOW Handle = 0x800F0300 + SPAPI_E_ERROR_NOT_INSTALLED Handle = 0x800F1000 + SCARD_S_SUCCESS = S_OK + SCARD_F_INTERNAL_ERROR Handle = 0x80100001 + SCARD_E_CANCELLED Handle = 0x80100002 + SCARD_E_INVALID_HANDLE Handle = 0x80100003 + SCARD_E_INVALID_PARAMETER Handle = 0x80100004 + SCARD_E_INVALID_TARGET Handle = 0x80100005 + SCARD_E_NO_MEMORY Handle = 0x80100006 + SCARD_F_WAITED_TOO_LONG Handle = 0x80100007 + SCARD_E_INSUFFICIENT_BUFFER Handle = 0x80100008 + SCARD_E_UNKNOWN_READER Handle = 0x80100009 + SCARD_E_TIMEOUT Handle = 0x8010000A + SCARD_E_SHARING_VIOLATION Handle = 0x8010000B + SCARD_E_NO_SMARTCARD Handle = 0x8010000C + SCARD_E_UNKNOWN_CARD Handle = 0x8010000D + SCARD_E_CANT_DISPOSE Handle = 0x8010000E + SCARD_E_PROTO_MISMATCH Handle = 0x8010000F + SCARD_E_NOT_READY Handle = 0x80100010 + SCARD_E_INVALID_VALUE Handle = 0x80100011 + SCARD_E_SYSTEM_CANCELLED Handle = 0x80100012 + SCARD_F_COMM_ERROR Handle = 0x80100013 + SCARD_F_UNKNOWN_ERROR Handle = 0x80100014 + SCARD_E_INVALID_ATR Handle = 0x80100015 + SCARD_E_NOT_TRANSACTED Handle = 0x80100016 + SCARD_E_READER_UNAVAILABLE Handle = 0x80100017 + SCARD_P_SHUTDOWN Handle = 0x80100018 + SCARD_E_PCI_TOO_SMALL Handle = 0x80100019 + SCARD_E_READER_UNSUPPORTED Handle = 0x8010001A + SCARD_E_DUPLICATE_READER Handle = 0x8010001B + SCARD_E_CARD_UNSUPPORTED Handle = 0x8010001C + SCARD_E_NO_SERVICE Handle = 0x8010001D + SCARD_E_SERVICE_STOPPED Handle = 0x8010001E + SCARD_E_UNEXPECTED Handle = 0x8010001F + SCARD_E_ICC_INSTALLATION Handle = 0x80100020 + SCARD_E_ICC_CREATEORDER Handle = 0x80100021 + SCARD_E_UNSUPPORTED_FEATURE Handle = 0x80100022 + SCARD_E_DIR_NOT_FOUND Handle = 0x80100023 + SCARD_E_FILE_NOT_FOUND Handle = 0x80100024 + SCARD_E_NO_DIR Handle = 0x80100025 + SCARD_E_NO_FILE Handle = 0x80100026 + SCARD_E_NO_ACCESS Handle = 0x80100027 + SCARD_E_WRITE_TOO_MANY Handle = 0x80100028 + SCARD_E_BAD_SEEK Handle = 0x80100029 + SCARD_E_INVALID_CHV Handle = 0x8010002A + SCARD_E_UNKNOWN_RES_MNG Handle = 0x8010002B + SCARD_E_NO_SUCH_CERTIFICATE Handle = 0x8010002C + SCARD_E_CERTIFICATE_UNAVAILABLE Handle = 0x8010002D + SCARD_E_NO_READERS_AVAILABLE Handle = 0x8010002E + SCARD_E_COMM_DATA_LOST Handle = 0x8010002F + SCARD_E_NO_KEY_CONTAINER Handle = 0x80100030 + SCARD_E_SERVER_TOO_BUSY Handle = 0x80100031 + SCARD_E_PIN_CACHE_EXPIRED Handle = 0x80100032 + SCARD_E_NO_PIN_CACHE Handle = 0x80100033 + SCARD_E_READ_ONLY_CARD Handle = 0x80100034 + SCARD_W_UNSUPPORTED_CARD Handle = 0x80100065 + SCARD_W_UNRESPONSIVE_CARD Handle = 0x80100066 + SCARD_W_UNPOWERED_CARD Handle = 0x80100067 + SCARD_W_RESET_CARD Handle = 0x80100068 + SCARD_W_REMOVED_CARD Handle = 0x80100069 + SCARD_W_SECURITY_VIOLATION Handle = 0x8010006A + SCARD_W_WRONG_CHV Handle = 0x8010006B + SCARD_W_CHV_BLOCKED Handle = 0x8010006C + SCARD_W_EOF Handle = 0x8010006D + SCARD_W_CANCELLED_BY_USER Handle = 0x8010006E + SCARD_W_CARD_NOT_AUTHENTICATED Handle = 0x8010006F + SCARD_W_CACHE_ITEM_NOT_FOUND Handle = 0x80100070 + SCARD_W_CACHE_ITEM_STALE Handle = 0x80100071 + SCARD_W_CACHE_ITEM_TOO_BIG Handle = 0x80100072 + COMADMIN_E_OBJECTERRORS Handle = 0x80110401 + COMADMIN_E_OBJECTINVALID Handle = 0x80110402 + COMADMIN_E_KEYMISSING Handle = 0x80110403 + COMADMIN_E_ALREADYINSTALLED Handle = 0x80110404 + COMADMIN_E_APP_FILE_WRITEFAIL Handle = 0x80110407 + COMADMIN_E_APP_FILE_READFAIL Handle = 0x80110408 + COMADMIN_E_APP_FILE_VERSION Handle = 0x80110409 + COMADMIN_E_BADPATH Handle = 0x8011040A + COMADMIN_E_APPLICATIONEXISTS Handle = 0x8011040B + COMADMIN_E_ROLEEXISTS Handle = 0x8011040C + COMADMIN_E_CANTCOPYFILE Handle = 0x8011040D + COMADMIN_E_NOUSER Handle = 0x8011040F + COMADMIN_E_INVALIDUSERIDS Handle = 0x80110410 + COMADMIN_E_NOREGISTRYCLSID Handle = 0x80110411 + COMADMIN_E_BADREGISTRYPROGID Handle = 0x80110412 + COMADMIN_E_AUTHENTICATIONLEVEL Handle = 0x80110413 + COMADMIN_E_USERPASSWDNOTVALID Handle = 0x80110414 + COMADMIN_E_CLSIDORIIDMISMATCH Handle = 0x80110418 + COMADMIN_E_REMOTEINTERFACE Handle = 0x80110419 + COMADMIN_E_DLLREGISTERSERVER Handle = 0x8011041A + COMADMIN_E_NOSERVERSHARE Handle = 0x8011041B + COMADMIN_E_DLLLOADFAILED Handle = 0x8011041D + COMADMIN_E_BADREGISTRYLIBID Handle = 0x8011041E + COMADMIN_E_APPDIRNOTFOUND Handle = 0x8011041F + COMADMIN_E_REGISTRARFAILED Handle = 0x80110423 + COMADMIN_E_COMPFILE_DOESNOTEXIST Handle = 0x80110424 + COMADMIN_E_COMPFILE_LOADDLLFAIL Handle = 0x80110425 + COMADMIN_E_COMPFILE_GETCLASSOBJ Handle = 0x80110426 + COMADMIN_E_COMPFILE_CLASSNOTAVAIL Handle = 0x80110427 + COMADMIN_E_COMPFILE_BADTLB Handle = 0x80110428 + COMADMIN_E_COMPFILE_NOTINSTALLABLE Handle = 0x80110429 + COMADMIN_E_NOTCHANGEABLE Handle = 0x8011042A + COMADMIN_E_NOTDELETEABLE Handle = 0x8011042B + COMADMIN_E_SESSION Handle = 0x8011042C + COMADMIN_E_COMP_MOVE_LOCKED Handle = 0x8011042D + COMADMIN_E_COMP_MOVE_BAD_DEST Handle = 0x8011042E + COMADMIN_E_REGISTERTLB Handle = 0x80110430 + COMADMIN_E_SYSTEMAPP Handle = 0x80110433 + COMADMIN_E_COMPFILE_NOREGISTRAR Handle = 0x80110434 + COMADMIN_E_COREQCOMPINSTALLED Handle = 0x80110435 + COMADMIN_E_SERVICENOTINSTALLED Handle = 0x80110436 + COMADMIN_E_PROPERTYSAVEFAILED Handle = 0x80110437 + COMADMIN_E_OBJECTEXISTS Handle = 0x80110438 + COMADMIN_E_COMPONENTEXISTS Handle = 0x80110439 + COMADMIN_E_REGFILE_CORRUPT Handle = 0x8011043B + COMADMIN_E_PROPERTY_OVERFLOW Handle = 0x8011043C + COMADMIN_E_NOTINREGISTRY Handle = 0x8011043E + COMADMIN_E_OBJECTNOTPOOLABLE Handle = 0x8011043F + COMADMIN_E_APPLID_MATCHES_CLSID Handle = 0x80110446 + COMADMIN_E_ROLE_DOES_NOT_EXIST Handle = 0x80110447 + COMADMIN_E_START_APP_NEEDS_COMPONENTS Handle = 0x80110448 + COMADMIN_E_REQUIRES_DIFFERENT_PLATFORM Handle = 0x80110449 + COMADMIN_E_CAN_NOT_EXPORT_APP_PROXY Handle = 0x8011044A + COMADMIN_E_CAN_NOT_START_APP Handle = 0x8011044B + COMADMIN_E_CAN_NOT_EXPORT_SYS_APP Handle = 0x8011044C + COMADMIN_E_CANT_SUBSCRIBE_TO_COMPONENT Handle = 0x8011044D + COMADMIN_E_EVENTCLASS_CANT_BE_SUBSCRIBER Handle = 0x8011044E + COMADMIN_E_LIB_APP_PROXY_INCOMPATIBLE Handle = 0x8011044F + COMADMIN_E_BASE_PARTITION_ONLY Handle = 0x80110450 + COMADMIN_E_START_APP_DISABLED Handle = 0x80110451 + COMADMIN_E_CAT_DUPLICATE_PARTITION_NAME Handle = 0x80110457 + COMADMIN_E_CAT_INVALID_PARTITION_NAME Handle = 0x80110458 + COMADMIN_E_CAT_PARTITION_IN_USE Handle = 0x80110459 + COMADMIN_E_FILE_PARTITION_DUPLICATE_FILES Handle = 0x8011045A + COMADMIN_E_CAT_IMPORTED_COMPONENTS_NOT_ALLOWED Handle = 0x8011045B + COMADMIN_E_AMBIGUOUS_APPLICATION_NAME Handle = 0x8011045C + COMADMIN_E_AMBIGUOUS_PARTITION_NAME Handle = 0x8011045D + COMADMIN_E_REGDB_NOTINITIALIZED Handle = 0x80110472 + COMADMIN_E_REGDB_NOTOPEN Handle = 0x80110473 + COMADMIN_E_REGDB_SYSTEMERR Handle = 0x80110474 + COMADMIN_E_REGDB_ALREADYRUNNING Handle = 0x80110475 + COMADMIN_E_MIG_VERSIONNOTSUPPORTED Handle = 0x80110480 + COMADMIN_E_MIG_SCHEMANOTFOUND Handle = 0x80110481 + COMADMIN_E_CAT_BITNESSMISMATCH Handle = 0x80110482 + COMADMIN_E_CAT_UNACCEPTABLEBITNESS Handle = 0x80110483 + COMADMIN_E_CAT_WRONGAPPBITNESS Handle = 0x80110484 + COMADMIN_E_CAT_PAUSE_RESUME_NOT_SUPPORTED Handle = 0x80110485 + COMADMIN_E_CAT_SERVERFAULT Handle = 0x80110486 + COMQC_E_APPLICATION_NOT_QUEUED Handle = 0x80110600 + COMQC_E_NO_QUEUEABLE_INTERFACES Handle = 0x80110601 + COMQC_E_QUEUING_SERVICE_NOT_AVAILABLE Handle = 0x80110602 + COMQC_E_NO_IPERSISTSTREAM Handle = 0x80110603 + COMQC_E_BAD_MESSAGE Handle = 0x80110604 + COMQC_E_UNAUTHENTICATED Handle = 0x80110605 + COMQC_E_UNTRUSTED_ENQUEUER Handle = 0x80110606 + MSDTC_E_DUPLICATE_RESOURCE Handle = 0x80110701 + COMADMIN_E_OBJECT_PARENT_MISSING Handle = 0x80110808 + COMADMIN_E_OBJECT_DOES_NOT_EXIST Handle = 0x80110809 + COMADMIN_E_APP_NOT_RUNNING Handle = 0x8011080A + COMADMIN_E_INVALID_PARTITION Handle = 0x8011080B + COMADMIN_E_SVCAPP_NOT_POOLABLE_OR_RECYCLABLE Handle = 0x8011080D + COMADMIN_E_USER_IN_SET Handle = 0x8011080E + COMADMIN_E_CANTRECYCLELIBRARYAPPS Handle = 0x8011080F + COMADMIN_E_CANTRECYCLESERVICEAPPS Handle = 0x80110811 + COMADMIN_E_PROCESSALREADYRECYCLED Handle = 0x80110812 + COMADMIN_E_PAUSEDPROCESSMAYNOTBERECYCLED Handle = 0x80110813 + COMADMIN_E_CANTMAKEINPROCSERVICE Handle = 0x80110814 + COMADMIN_E_PROGIDINUSEBYCLSID Handle = 0x80110815 + COMADMIN_E_DEFAULT_PARTITION_NOT_IN_SET Handle = 0x80110816 + COMADMIN_E_RECYCLEDPROCESSMAYNOTBEPAUSED Handle = 0x80110817 + COMADMIN_E_PARTITION_ACCESSDENIED Handle = 0x80110818 + COMADMIN_E_PARTITION_MSI_ONLY Handle = 0x80110819 + COMADMIN_E_LEGACYCOMPS_NOT_ALLOWED_IN_1_0_FORMAT Handle = 0x8011081A + COMADMIN_E_LEGACYCOMPS_NOT_ALLOWED_IN_NONBASE_PARTITIONS Handle = 0x8011081B + COMADMIN_E_COMP_MOVE_SOURCE Handle = 0x8011081C + COMADMIN_E_COMP_MOVE_DEST Handle = 0x8011081D + COMADMIN_E_COMP_MOVE_PRIVATE Handle = 0x8011081E + COMADMIN_E_BASEPARTITION_REQUIRED_IN_SET Handle = 0x8011081F + COMADMIN_E_CANNOT_ALIAS_EVENTCLASS Handle = 0x80110820 + COMADMIN_E_PRIVATE_ACCESSDENIED Handle = 0x80110821 + COMADMIN_E_SAFERINVALID Handle = 0x80110822 + COMADMIN_E_REGISTRY_ACCESSDENIED Handle = 0x80110823 + COMADMIN_E_PARTITIONS_DISABLED Handle = 0x80110824 + WER_S_REPORT_DEBUG Handle = 0x001B0000 + WER_S_REPORT_UPLOADED Handle = 0x001B0001 + WER_S_REPORT_QUEUED Handle = 0x001B0002 + WER_S_DISABLED Handle = 0x001B0003 + WER_S_SUSPENDED_UPLOAD Handle = 0x001B0004 + WER_S_DISABLED_QUEUE Handle = 0x001B0005 + WER_S_DISABLED_ARCHIVE Handle = 0x001B0006 + WER_S_REPORT_ASYNC Handle = 0x001B0007 + WER_S_IGNORE_ASSERT_INSTANCE Handle = 0x001B0008 + WER_S_IGNORE_ALL_ASSERTS Handle = 0x001B0009 + WER_S_ASSERT_CONTINUE Handle = 0x001B000A + WER_S_THROTTLED Handle = 0x001B000B + WER_S_REPORT_UPLOADED_CAB Handle = 0x001B000C + WER_E_CRASH_FAILURE Handle = 0x801B8000 + WER_E_CANCELED Handle = 0x801B8001 + WER_E_NETWORK_FAILURE Handle = 0x801B8002 + WER_E_NOT_INITIALIZED Handle = 0x801B8003 + WER_E_ALREADY_REPORTING Handle = 0x801B8004 + WER_E_DUMP_THROTTLED Handle = 0x801B8005 + WER_E_INSUFFICIENT_CONSENT Handle = 0x801B8006 + WER_E_TOO_HEAVY Handle = 0x801B8007 + ERROR_FLT_IO_COMPLETE Handle = 0x001F0001 + ERROR_FLT_NO_HANDLER_DEFINED Handle = 0x801F0001 + ERROR_FLT_CONTEXT_ALREADY_DEFINED Handle = 0x801F0002 + ERROR_FLT_INVALID_ASYNCHRONOUS_REQUEST Handle = 0x801F0003 + ERROR_FLT_DISALLOW_FAST_IO Handle = 0x801F0004 + ERROR_FLT_INVALID_NAME_REQUEST Handle = 0x801F0005 + ERROR_FLT_NOT_SAFE_TO_POST_OPERATION Handle = 0x801F0006 + ERROR_FLT_NOT_INITIALIZED Handle = 0x801F0007 + ERROR_FLT_FILTER_NOT_READY Handle = 0x801F0008 + ERROR_FLT_POST_OPERATION_CLEANUP Handle = 0x801F0009 + ERROR_FLT_INTERNAL_ERROR Handle = 0x801F000A + ERROR_FLT_DELETING_OBJECT Handle = 0x801F000B + ERROR_FLT_MUST_BE_NONPAGED_POOL Handle = 0x801F000C + ERROR_FLT_DUPLICATE_ENTRY Handle = 0x801F000D + ERROR_FLT_CBDQ_DISABLED Handle = 0x801F000E + ERROR_FLT_DO_NOT_ATTACH Handle = 0x801F000F + ERROR_FLT_DO_NOT_DETACH Handle = 0x801F0010 + ERROR_FLT_INSTANCE_ALTITUDE_COLLISION Handle = 0x801F0011 + ERROR_FLT_INSTANCE_NAME_COLLISION Handle = 0x801F0012 + ERROR_FLT_FILTER_NOT_FOUND Handle = 0x801F0013 + ERROR_FLT_VOLUME_NOT_FOUND Handle = 0x801F0014 + ERROR_FLT_INSTANCE_NOT_FOUND Handle = 0x801F0015 + ERROR_FLT_CONTEXT_ALLOCATION_NOT_FOUND Handle = 0x801F0016 + ERROR_FLT_INVALID_CONTEXT_REGISTRATION Handle = 0x801F0017 + ERROR_FLT_NAME_CACHE_MISS Handle = 0x801F0018 + ERROR_FLT_NO_DEVICE_OBJECT Handle = 0x801F0019 + ERROR_FLT_VOLUME_ALREADY_MOUNTED Handle = 0x801F001A + ERROR_FLT_ALREADY_ENLISTED Handle = 0x801F001B + ERROR_FLT_CONTEXT_ALREADY_LINKED Handle = 0x801F001C + ERROR_FLT_NO_WAITER_FOR_REPLY Handle = 0x801F0020 + ERROR_FLT_REGISTRATION_BUSY Handle = 0x801F0023 + ERROR_HUNG_DISPLAY_DRIVER_THREAD Handle = 0x80260001 + DWM_E_COMPOSITIONDISABLED Handle = 0x80263001 + DWM_E_REMOTING_NOT_SUPPORTED Handle = 0x80263002 + DWM_E_NO_REDIRECTION_SURFACE_AVAILABLE Handle = 0x80263003 + DWM_E_NOT_QUEUING_PRESENTS Handle = 0x80263004 + DWM_E_ADAPTER_NOT_FOUND Handle = 0x80263005 + DWM_S_GDI_REDIRECTION_SURFACE Handle = 0x00263005 + DWM_E_TEXTURE_TOO_LARGE Handle = 0x80263007 + DWM_S_GDI_REDIRECTION_SURFACE_BLT_VIA_GDI Handle = 0x00263008 + ERROR_MONITOR_NO_DESCRIPTOR Handle = 0x00261001 + ERROR_MONITOR_UNKNOWN_DESCRIPTOR_FORMAT Handle = 0x00261002 + ERROR_MONITOR_INVALID_DESCRIPTOR_CHECKSUM Handle = 0xC0261003 + ERROR_MONITOR_INVALID_STANDARD_TIMING_BLOCK Handle = 0xC0261004 + ERROR_MONITOR_WMI_DATABLOCK_REGISTRATION_FAILED Handle = 0xC0261005 + ERROR_MONITOR_INVALID_SERIAL_NUMBER_MONDSC_BLOCK Handle = 0xC0261006 + ERROR_MONITOR_INVALID_USER_FRIENDLY_MONDSC_BLOCK Handle = 0xC0261007 + ERROR_MONITOR_NO_MORE_DESCRIPTOR_DATA Handle = 0xC0261008 + ERROR_MONITOR_INVALID_DETAILED_TIMING_BLOCK Handle = 0xC0261009 + ERROR_MONITOR_INVALID_MANUFACTURE_DATE Handle = 0xC026100A + ERROR_GRAPHICS_NOT_EXCLUSIVE_MODE_OWNER Handle = 0xC0262000 + ERROR_GRAPHICS_INSUFFICIENT_DMA_BUFFER Handle = 0xC0262001 + ERROR_GRAPHICS_INVALID_DISPLAY_ADAPTER Handle = 0xC0262002 + ERROR_GRAPHICS_ADAPTER_WAS_RESET Handle = 0xC0262003 + ERROR_GRAPHICS_INVALID_DRIVER_MODEL Handle = 0xC0262004 + ERROR_GRAPHICS_PRESENT_MODE_CHANGED Handle = 0xC0262005 + ERROR_GRAPHICS_PRESENT_OCCLUDED Handle = 0xC0262006 + ERROR_GRAPHICS_PRESENT_DENIED Handle = 0xC0262007 + ERROR_GRAPHICS_CANNOTCOLORCONVERT Handle = 0xC0262008 + ERROR_GRAPHICS_DRIVER_MISMATCH Handle = 0xC0262009 + ERROR_GRAPHICS_PARTIAL_DATA_POPULATED Handle = 0x4026200A + ERROR_GRAPHICS_PRESENT_REDIRECTION_DISABLED Handle = 0xC026200B + ERROR_GRAPHICS_PRESENT_UNOCCLUDED Handle = 0xC026200C + ERROR_GRAPHICS_WINDOWDC_NOT_AVAILABLE Handle = 0xC026200D + ERROR_GRAPHICS_WINDOWLESS_PRESENT_DISABLED Handle = 0xC026200E + ERROR_GRAPHICS_PRESENT_INVALID_WINDOW Handle = 0xC026200F + ERROR_GRAPHICS_PRESENT_BUFFER_NOT_BOUND Handle = 0xC0262010 + ERROR_GRAPHICS_VAIL_STATE_CHANGED Handle = 0xC0262011 + ERROR_GRAPHICS_INDIRECT_DISPLAY_ABANDON_SWAPCHAIN Handle = 0xC0262012 + ERROR_GRAPHICS_INDIRECT_DISPLAY_DEVICE_STOPPED Handle = 0xC0262013 + ERROR_GRAPHICS_NO_VIDEO_MEMORY Handle = 0xC0262100 + ERROR_GRAPHICS_CANT_LOCK_MEMORY Handle = 0xC0262101 + ERROR_GRAPHICS_ALLOCATION_BUSY Handle = 0xC0262102 + ERROR_GRAPHICS_TOO_MANY_REFERENCES Handle = 0xC0262103 + ERROR_GRAPHICS_TRY_AGAIN_LATER Handle = 0xC0262104 + ERROR_GRAPHICS_TRY_AGAIN_NOW Handle = 0xC0262105 + ERROR_GRAPHICS_ALLOCATION_INVALID Handle = 0xC0262106 + ERROR_GRAPHICS_UNSWIZZLING_APERTURE_UNAVAILABLE Handle = 0xC0262107 + ERROR_GRAPHICS_UNSWIZZLING_APERTURE_UNSUPPORTED Handle = 0xC0262108 + ERROR_GRAPHICS_CANT_EVICT_PINNED_ALLOCATION Handle = 0xC0262109 + ERROR_GRAPHICS_INVALID_ALLOCATION_USAGE Handle = 0xC0262110 + ERROR_GRAPHICS_CANT_RENDER_LOCKED_ALLOCATION Handle = 0xC0262111 + ERROR_GRAPHICS_ALLOCATION_CLOSED Handle = 0xC0262112 + ERROR_GRAPHICS_INVALID_ALLOCATION_INSTANCE Handle = 0xC0262113 + ERROR_GRAPHICS_INVALID_ALLOCATION_HANDLE Handle = 0xC0262114 + ERROR_GRAPHICS_WRONG_ALLOCATION_DEVICE Handle = 0xC0262115 + ERROR_GRAPHICS_ALLOCATION_CONTENT_LOST Handle = 0xC0262116 + ERROR_GRAPHICS_GPU_EXCEPTION_ON_DEVICE Handle = 0xC0262200 + ERROR_GRAPHICS_SKIP_ALLOCATION_PREPARATION Handle = 0x40262201 + ERROR_GRAPHICS_INVALID_VIDPN_TOPOLOGY Handle = 0xC0262300 + ERROR_GRAPHICS_VIDPN_TOPOLOGY_NOT_SUPPORTED Handle = 0xC0262301 + ERROR_GRAPHICS_VIDPN_TOPOLOGY_CURRENTLY_NOT_SUPPORTED Handle = 0xC0262302 + ERROR_GRAPHICS_INVALID_VIDPN Handle = 0xC0262303 + ERROR_GRAPHICS_INVALID_VIDEO_PRESENT_SOURCE Handle = 0xC0262304 + ERROR_GRAPHICS_INVALID_VIDEO_PRESENT_TARGET Handle = 0xC0262305 + ERROR_GRAPHICS_VIDPN_MODALITY_NOT_SUPPORTED Handle = 0xC0262306 + ERROR_GRAPHICS_MODE_NOT_PINNED Handle = 0x00262307 + ERROR_GRAPHICS_INVALID_VIDPN_SOURCEMODESET Handle = 0xC0262308 + ERROR_GRAPHICS_INVALID_VIDPN_TARGETMODESET Handle = 0xC0262309 + ERROR_GRAPHICS_INVALID_FREQUENCY Handle = 0xC026230A + ERROR_GRAPHICS_INVALID_ACTIVE_REGION Handle = 0xC026230B + ERROR_GRAPHICS_INVALID_TOTAL_REGION Handle = 0xC026230C + ERROR_GRAPHICS_INVALID_VIDEO_PRESENT_SOURCE_MODE Handle = 0xC0262310 + ERROR_GRAPHICS_INVALID_VIDEO_PRESENT_TARGET_MODE Handle = 0xC0262311 + ERROR_GRAPHICS_PINNED_MODE_MUST_REMAIN_IN_SET Handle = 0xC0262312 + ERROR_GRAPHICS_PATH_ALREADY_IN_TOPOLOGY Handle = 0xC0262313 + ERROR_GRAPHICS_MODE_ALREADY_IN_MODESET Handle = 0xC0262314 + ERROR_GRAPHICS_INVALID_VIDEOPRESENTSOURCESET Handle = 0xC0262315 + ERROR_GRAPHICS_INVALID_VIDEOPRESENTTARGETSET Handle = 0xC0262316 + ERROR_GRAPHICS_SOURCE_ALREADY_IN_SET Handle = 0xC0262317 + ERROR_GRAPHICS_TARGET_ALREADY_IN_SET Handle = 0xC0262318 + ERROR_GRAPHICS_INVALID_VIDPN_PRESENT_PATH Handle = 0xC0262319 + ERROR_GRAPHICS_NO_RECOMMENDED_VIDPN_TOPOLOGY Handle = 0xC026231A + ERROR_GRAPHICS_INVALID_MONITOR_FREQUENCYRANGESET Handle = 0xC026231B + ERROR_GRAPHICS_INVALID_MONITOR_FREQUENCYRANGE Handle = 0xC026231C + ERROR_GRAPHICS_FREQUENCYRANGE_NOT_IN_SET Handle = 0xC026231D + ERROR_GRAPHICS_NO_PREFERRED_MODE Handle = 0x0026231E + ERROR_GRAPHICS_FREQUENCYRANGE_ALREADY_IN_SET Handle = 0xC026231F + ERROR_GRAPHICS_STALE_MODESET Handle = 0xC0262320 + ERROR_GRAPHICS_INVALID_MONITOR_SOURCEMODESET Handle = 0xC0262321 + ERROR_GRAPHICS_INVALID_MONITOR_SOURCE_MODE Handle = 0xC0262322 + ERROR_GRAPHICS_NO_RECOMMENDED_FUNCTIONAL_VIDPN Handle = 0xC0262323 + ERROR_GRAPHICS_MODE_ID_MUST_BE_UNIQUE Handle = 0xC0262324 + ERROR_GRAPHICS_EMPTY_ADAPTER_MONITOR_MODE_SUPPORT_INTERSECTION Handle = 0xC0262325 + ERROR_GRAPHICS_VIDEO_PRESENT_TARGETS_LESS_THAN_SOURCES Handle = 0xC0262326 + ERROR_GRAPHICS_PATH_NOT_IN_TOPOLOGY Handle = 0xC0262327 + ERROR_GRAPHICS_ADAPTER_MUST_HAVE_AT_LEAST_ONE_SOURCE Handle = 0xC0262328 + ERROR_GRAPHICS_ADAPTER_MUST_HAVE_AT_LEAST_ONE_TARGET Handle = 0xC0262329 + ERROR_GRAPHICS_INVALID_MONITORDESCRIPTORSET Handle = 0xC026232A + ERROR_GRAPHICS_INVALID_MONITORDESCRIPTOR Handle = 0xC026232B + ERROR_GRAPHICS_MONITORDESCRIPTOR_NOT_IN_SET Handle = 0xC026232C + ERROR_GRAPHICS_MONITORDESCRIPTOR_ALREADY_IN_SET Handle = 0xC026232D + ERROR_GRAPHICS_MONITORDESCRIPTOR_ID_MUST_BE_UNIQUE Handle = 0xC026232E + ERROR_GRAPHICS_INVALID_VIDPN_TARGET_SUBSET_TYPE Handle = 0xC026232F + ERROR_GRAPHICS_RESOURCES_NOT_RELATED Handle = 0xC0262330 + ERROR_GRAPHICS_SOURCE_ID_MUST_BE_UNIQUE Handle = 0xC0262331 + ERROR_GRAPHICS_TARGET_ID_MUST_BE_UNIQUE Handle = 0xC0262332 + ERROR_GRAPHICS_NO_AVAILABLE_VIDPN_TARGET Handle = 0xC0262333 + ERROR_GRAPHICS_MONITOR_COULD_NOT_BE_ASSOCIATED_WITH_ADAPTER Handle = 0xC0262334 + ERROR_GRAPHICS_NO_VIDPNMGR Handle = 0xC0262335 + ERROR_GRAPHICS_NO_ACTIVE_VIDPN Handle = 0xC0262336 + ERROR_GRAPHICS_STALE_VIDPN_TOPOLOGY Handle = 0xC0262337 + ERROR_GRAPHICS_MONITOR_NOT_CONNECTED Handle = 0xC0262338 + ERROR_GRAPHICS_SOURCE_NOT_IN_TOPOLOGY Handle = 0xC0262339 + ERROR_GRAPHICS_INVALID_PRIMARYSURFACE_SIZE Handle = 0xC026233A + ERROR_GRAPHICS_INVALID_VISIBLEREGION_SIZE Handle = 0xC026233B + ERROR_GRAPHICS_INVALID_STRIDE Handle = 0xC026233C + ERROR_GRAPHICS_INVALID_PIXELFORMAT Handle = 0xC026233D + ERROR_GRAPHICS_INVALID_COLORBASIS Handle = 0xC026233E + ERROR_GRAPHICS_INVALID_PIXELVALUEACCESSMODE Handle = 0xC026233F + ERROR_GRAPHICS_TARGET_NOT_IN_TOPOLOGY Handle = 0xC0262340 + ERROR_GRAPHICS_NO_DISPLAY_MODE_MANAGEMENT_SUPPORT Handle = 0xC0262341 + ERROR_GRAPHICS_VIDPN_SOURCE_IN_USE Handle = 0xC0262342 + ERROR_GRAPHICS_CANT_ACCESS_ACTIVE_VIDPN Handle = 0xC0262343 + ERROR_GRAPHICS_INVALID_PATH_IMPORTANCE_ORDINAL Handle = 0xC0262344 + ERROR_GRAPHICS_INVALID_PATH_CONTENT_GEOMETRY_TRANSFORMATION Handle = 0xC0262345 + ERROR_GRAPHICS_PATH_CONTENT_GEOMETRY_TRANSFORMATION_NOT_SUPPORTED Handle = 0xC0262346 + ERROR_GRAPHICS_INVALID_GAMMA_RAMP Handle = 0xC0262347 + ERROR_GRAPHICS_GAMMA_RAMP_NOT_SUPPORTED Handle = 0xC0262348 + ERROR_GRAPHICS_MULTISAMPLING_NOT_SUPPORTED Handle = 0xC0262349 + ERROR_GRAPHICS_MODE_NOT_IN_MODESET Handle = 0xC026234A + ERROR_GRAPHICS_DATASET_IS_EMPTY Handle = 0x0026234B + ERROR_GRAPHICS_NO_MORE_ELEMENTS_IN_DATASET Handle = 0x0026234C + ERROR_GRAPHICS_INVALID_VIDPN_TOPOLOGY_RECOMMENDATION_REASON Handle = 0xC026234D + ERROR_GRAPHICS_INVALID_PATH_CONTENT_TYPE Handle = 0xC026234E + ERROR_GRAPHICS_INVALID_COPYPROTECTION_TYPE Handle = 0xC026234F + ERROR_GRAPHICS_UNASSIGNED_MODESET_ALREADY_EXISTS Handle = 0xC0262350 + ERROR_GRAPHICS_PATH_CONTENT_GEOMETRY_TRANSFORMATION_NOT_PINNED Handle = 0x00262351 + ERROR_GRAPHICS_INVALID_SCANLINE_ORDERING Handle = 0xC0262352 + ERROR_GRAPHICS_TOPOLOGY_CHANGES_NOT_ALLOWED Handle = 0xC0262353 + ERROR_GRAPHICS_NO_AVAILABLE_IMPORTANCE_ORDINALS Handle = 0xC0262354 + ERROR_GRAPHICS_INCOMPATIBLE_PRIVATE_FORMAT Handle = 0xC0262355 + ERROR_GRAPHICS_INVALID_MODE_PRUNING_ALGORITHM Handle = 0xC0262356 + ERROR_GRAPHICS_INVALID_MONITOR_CAPABILITY_ORIGIN Handle = 0xC0262357 + ERROR_GRAPHICS_INVALID_MONITOR_FREQUENCYRANGE_CONSTRAINT Handle = 0xC0262358 + ERROR_GRAPHICS_MAX_NUM_PATHS_REACHED Handle = 0xC0262359 + ERROR_GRAPHICS_CANCEL_VIDPN_TOPOLOGY_AUGMENTATION Handle = 0xC026235A + ERROR_GRAPHICS_INVALID_CLIENT_TYPE Handle = 0xC026235B + ERROR_GRAPHICS_CLIENTVIDPN_NOT_SET Handle = 0xC026235C + ERROR_GRAPHICS_SPECIFIED_CHILD_ALREADY_CONNECTED Handle = 0xC0262400 + ERROR_GRAPHICS_CHILD_DESCRIPTOR_NOT_SUPPORTED Handle = 0xC0262401 + ERROR_GRAPHICS_UNKNOWN_CHILD_STATUS Handle = 0x4026242F + ERROR_GRAPHICS_NOT_A_LINKED_ADAPTER Handle = 0xC0262430 + ERROR_GRAPHICS_LEADLINK_NOT_ENUMERATED Handle = 0xC0262431 + ERROR_GRAPHICS_CHAINLINKS_NOT_ENUMERATED Handle = 0xC0262432 + ERROR_GRAPHICS_ADAPTER_CHAIN_NOT_READY Handle = 0xC0262433 + ERROR_GRAPHICS_CHAINLINKS_NOT_STARTED Handle = 0xC0262434 + ERROR_GRAPHICS_CHAINLINKS_NOT_POWERED_ON Handle = 0xC0262435 + ERROR_GRAPHICS_INCONSISTENT_DEVICE_LINK_STATE Handle = 0xC0262436 + ERROR_GRAPHICS_LEADLINK_START_DEFERRED Handle = 0x40262437 + ERROR_GRAPHICS_NOT_POST_DEVICE_DRIVER Handle = 0xC0262438 + ERROR_GRAPHICS_POLLING_TOO_FREQUENTLY Handle = 0x40262439 + ERROR_GRAPHICS_START_DEFERRED Handle = 0x4026243A + ERROR_GRAPHICS_ADAPTER_ACCESS_NOT_EXCLUDED Handle = 0xC026243B + ERROR_GRAPHICS_DEPENDABLE_CHILD_STATUS Handle = 0x4026243C + ERROR_GRAPHICS_OPM_NOT_SUPPORTED Handle = 0xC0262500 + ERROR_GRAPHICS_COPP_NOT_SUPPORTED Handle = 0xC0262501 + ERROR_GRAPHICS_UAB_NOT_SUPPORTED Handle = 0xC0262502 + ERROR_GRAPHICS_OPM_INVALID_ENCRYPTED_PARAMETERS Handle = 0xC0262503 + ERROR_GRAPHICS_OPM_NO_VIDEO_OUTPUTS_EXIST Handle = 0xC0262505 + ERROR_GRAPHICS_OPM_INTERNAL_ERROR Handle = 0xC026250B + ERROR_GRAPHICS_OPM_INVALID_HANDLE Handle = 0xC026250C + ERROR_GRAPHICS_PVP_INVALID_CERTIFICATE_LENGTH Handle = 0xC026250E + ERROR_GRAPHICS_OPM_SPANNING_MODE_ENABLED Handle = 0xC026250F + ERROR_GRAPHICS_OPM_THEATER_MODE_ENABLED Handle = 0xC0262510 + ERROR_GRAPHICS_PVP_HFS_FAILED Handle = 0xC0262511 + ERROR_GRAPHICS_OPM_INVALID_SRM Handle = 0xC0262512 + ERROR_GRAPHICS_OPM_OUTPUT_DOES_NOT_SUPPORT_HDCP Handle = 0xC0262513 + ERROR_GRAPHICS_OPM_OUTPUT_DOES_NOT_SUPPORT_ACP Handle = 0xC0262514 + ERROR_GRAPHICS_OPM_OUTPUT_DOES_NOT_SUPPORT_CGMSA Handle = 0xC0262515 + ERROR_GRAPHICS_OPM_HDCP_SRM_NEVER_SET Handle = 0xC0262516 + ERROR_GRAPHICS_OPM_RESOLUTION_TOO_HIGH Handle = 0xC0262517 + ERROR_GRAPHICS_OPM_ALL_HDCP_HARDWARE_ALREADY_IN_USE Handle = 0xC0262518 + ERROR_GRAPHICS_OPM_VIDEO_OUTPUT_NO_LONGER_EXISTS Handle = 0xC026251A + ERROR_GRAPHICS_OPM_SESSION_TYPE_CHANGE_IN_PROGRESS Handle = 0xC026251B + ERROR_GRAPHICS_OPM_VIDEO_OUTPUT_DOES_NOT_HAVE_COPP_SEMANTICS Handle = 0xC026251C + ERROR_GRAPHICS_OPM_INVALID_INFORMATION_REQUEST Handle = 0xC026251D + ERROR_GRAPHICS_OPM_DRIVER_INTERNAL_ERROR Handle = 0xC026251E + ERROR_GRAPHICS_OPM_VIDEO_OUTPUT_DOES_NOT_HAVE_OPM_SEMANTICS Handle = 0xC026251F + ERROR_GRAPHICS_OPM_SIGNALING_NOT_SUPPORTED Handle = 0xC0262520 + ERROR_GRAPHICS_OPM_INVALID_CONFIGURATION_REQUEST Handle = 0xC0262521 + ERROR_GRAPHICS_I2C_NOT_SUPPORTED Handle = 0xC0262580 + ERROR_GRAPHICS_I2C_DEVICE_DOES_NOT_EXIST Handle = 0xC0262581 + ERROR_GRAPHICS_I2C_ERROR_TRANSMITTING_DATA Handle = 0xC0262582 + ERROR_GRAPHICS_I2C_ERROR_RECEIVING_DATA Handle = 0xC0262583 + ERROR_GRAPHICS_DDCCI_VCP_NOT_SUPPORTED Handle = 0xC0262584 + ERROR_GRAPHICS_DDCCI_INVALID_DATA Handle = 0xC0262585 + ERROR_GRAPHICS_DDCCI_MONITOR_RETURNED_INVALID_TIMING_STATUS_BYTE Handle = 0xC0262586 + ERROR_GRAPHICS_MCA_INVALID_CAPABILITIES_STRING Handle = 0xC0262587 + ERROR_GRAPHICS_MCA_INTERNAL_ERROR Handle = 0xC0262588 + ERROR_GRAPHICS_DDCCI_INVALID_MESSAGE_COMMAND Handle = 0xC0262589 + ERROR_GRAPHICS_DDCCI_INVALID_MESSAGE_LENGTH Handle = 0xC026258A + ERROR_GRAPHICS_DDCCI_INVALID_MESSAGE_CHECKSUM Handle = 0xC026258B + ERROR_GRAPHICS_INVALID_PHYSICAL_MONITOR_HANDLE Handle = 0xC026258C + ERROR_GRAPHICS_MONITOR_NO_LONGER_EXISTS Handle = 0xC026258D + ERROR_GRAPHICS_DDCCI_CURRENT_CURRENT_VALUE_GREATER_THAN_MAXIMUM_VALUE Handle = 0xC02625D8 + ERROR_GRAPHICS_MCA_INVALID_VCP_VERSION Handle = 0xC02625D9 + ERROR_GRAPHICS_MCA_MONITOR_VIOLATES_MCCS_SPECIFICATION Handle = 0xC02625DA + ERROR_GRAPHICS_MCA_MCCS_VERSION_MISMATCH Handle = 0xC02625DB + ERROR_GRAPHICS_MCA_UNSUPPORTED_MCCS_VERSION Handle = 0xC02625DC + ERROR_GRAPHICS_MCA_INVALID_TECHNOLOGY_TYPE_RETURNED Handle = 0xC02625DE + ERROR_GRAPHICS_MCA_UNSUPPORTED_COLOR_TEMPERATURE Handle = 0xC02625DF + ERROR_GRAPHICS_ONLY_CONSOLE_SESSION_SUPPORTED Handle = 0xC02625E0 + ERROR_GRAPHICS_NO_DISPLAY_DEVICE_CORRESPONDS_TO_NAME Handle = 0xC02625E1 + ERROR_GRAPHICS_DISPLAY_DEVICE_NOT_ATTACHED_TO_DESKTOP Handle = 0xC02625E2 + ERROR_GRAPHICS_MIRRORING_DEVICES_NOT_SUPPORTED Handle = 0xC02625E3 + ERROR_GRAPHICS_INVALID_POINTER Handle = 0xC02625E4 + ERROR_GRAPHICS_NO_MONITORS_CORRESPOND_TO_DISPLAY_DEVICE Handle = 0xC02625E5 + ERROR_GRAPHICS_PARAMETER_ARRAY_TOO_SMALL Handle = 0xC02625E6 + ERROR_GRAPHICS_INTERNAL_ERROR Handle = 0xC02625E7 + ERROR_GRAPHICS_SESSION_TYPE_CHANGE_IN_PROGRESS Handle = 0xC02605E8 + NAP_E_INVALID_PACKET Handle = 0x80270001 + NAP_E_MISSING_SOH Handle = 0x80270002 + NAP_E_CONFLICTING_ID Handle = 0x80270003 + NAP_E_NO_CACHED_SOH Handle = 0x80270004 + NAP_E_STILL_BOUND Handle = 0x80270005 + NAP_E_NOT_REGISTERED Handle = 0x80270006 + NAP_E_NOT_INITIALIZED Handle = 0x80270007 + NAP_E_MISMATCHED_ID Handle = 0x80270008 + NAP_E_NOT_PENDING Handle = 0x80270009 + NAP_E_ID_NOT_FOUND Handle = 0x8027000A + NAP_E_MAXSIZE_TOO_SMALL Handle = 0x8027000B + NAP_E_SERVICE_NOT_RUNNING Handle = 0x8027000C + NAP_S_CERT_ALREADY_PRESENT Handle = 0x0027000D + NAP_E_ENTITY_DISABLED Handle = 0x8027000E + NAP_E_NETSH_GROUPPOLICY_ERROR Handle = 0x8027000F + NAP_E_TOO_MANY_CALLS Handle = 0x80270010 + NAP_E_SHV_CONFIG_EXISTED Handle = 0x80270011 + NAP_E_SHV_CONFIG_NOT_FOUND Handle = 0x80270012 + NAP_E_SHV_TIMEOUT Handle = 0x80270013 + TPM_E_ERROR_MASK Handle = 0x80280000 + TPM_E_AUTHFAIL Handle = 0x80280001 + TPM_E_BADINDEX Handle = 0x80280002 + TPM_E_BAD_PARAMETER Handle = 0x80280003 + TPM_E_AUDITFAILURE Handle = 0x80280004 + TPM_E_CLEAR_DISABLED Handle = 0x80280005 + TPM_E_DEACTIVATED Handle = 0x80280006 + TPM_E_DISABLED Handle = 0x80280007 + TPM_E_DISABLED_CMD Handle = 0x80280008 + TPM_E_FAIL Handle = 0x80280009 + TPM_E_BAD_ORDINAL Handle = 0x8028000A + TPM_E_INSTALL_DISABLED Handle = 0x8028000B + TPM_E_INVALID_KEYHANDLE Handle = 0x8028000C + TPM_E_KEYNOTFOUND Handle = 0x8028000D + TPM_E_INAPPROPRIATE_ENC Handle = 0x8028000E + TPM_E_MIGRATEFAIL Handle = 0x8028000F + TPM_E_INVALID_PCR_INFO Handle = 0x80280010 + TPM_E_NOSPACE Handle = 0x80280011 + TPM_E_NOSRK Handle = 0x80280012 + TPM_E_NOTSEALED_BLOB Handle = 0x80280013 + TPM_E_OWNER_SET Handle = 0x80280014 + TPM_E_RESOURCES Handle = 0x80280015 + TPM_E_SHORTRANDOM Handle = 0x80280016 + TPM_E_SIZE Handle = 0x80280017 + TPM_E_WRONGPCRVAL Handle = 0x80280018 + TPM_E_BAD_PARAM_SIZE Handle = 0x80280019 + TPM_E_SHA_THREAD Handle = 0x8028001A + TPM_E_SHA_ERROR Handle = 0x8028001B + TPM_E_FAILEDSELFTEST Handle = 0x8028001C + TPM_E_AUTH2FAIL Handle = 0x8028001D + TPM_E_BADTAG Handle = 0x8028001E + TPM_E_IOERROR Handle = 0x8028001F + TPM_E_ENCRYPT_ERROR Handle = 0x80280020 + TPM_E_DECRYPT_ERROR Handle = 0x80280021 + TPM_E_INVALID_AUTHHANDLE Handle = 0x80280022 + TPM_E_NO_ENDORSEMENT Handle = 0x80280023 + TPM_E_INVALID_KEYUSAGE Handle = 0x80280024 + TPM_E_WRONG_ENTITYTYPE Handle = 0x80280025 + TPM_E_INVALID_POSTINIT Handle = 0x80280026 + TPM_E_INAPPROPRIATE_SIG Handle = 0x80280027 + TPM_E_BAD_KEY_PROPERTY Handle = 0x80280028 + TPM_E_BAD_MIGRATION Handle = 0x80280029 + TPM_E_BAD_SCHEME Handle = 0x8028002A + TPM_E_BAD_DATASIZE Handle = 0x8028002B + TPM_E_BAD_MODE Handle = 0x8028002C + TPM_E_BAD_PRESENCE Handle = 0x8028002D + TPM_E_BAD_VERSION Handle = 0x8028002E + TPM_E_NO_WRAP_TRANSPORT Handle = 0x8028002F + TPM_E_AUDITFAIL_UNSUCCESSFUL Handle = 0x80280030 + TPM_E_AUDITFAIL_SUCCESSFUL Handle = 0x80280031 + TPM_E_NOTRESETABLE Handle = 0x80280032 + TPM_E_NOTLOCAL Handle = 0x80280033 + TPM_E_BAD_TYPE Handle = 0x80280034 + TPM_E_INVALID_RESOURCE Handle = 0x80280035 + TPM_E_NOTFIPS Handle = 0x80280036 + TPM_E_INVALID_FAMILY Handle = 0x80280037 + TPM_E_NO_NV_PERMISSION Handle = 0x80280038 + TPM_E_REQUIRES_SIGN Handle = 0x80280039 + TPM_E_KEY_NOTSUPPORTED Handle = 0x8028003A + TPM_E_AUTH_CONFLICT Handle = 0x8028003B + TPM_E_AREA_LOCKED Handle = 0x8028003C + TPM_E_BAD_LOCALITY Handle = 0x8028003D + TPM_E_READ_ONLY Handle = 0x8028003E + TPM_E_PER_NOWRITE Handle = 0x8028003F + TPM_E_FAMILYCOUNT Handle = 0x80280040 + TPM_E_WRITE_LOCKED Handle = 0x80280041 + TPM_E_BAD_ATTRIBUTES Handle = 0x80280042 + TPM_E_INVALID_STRUCTURE Handle = 0x80280043 + TPM_E_KEY_OWNER_CONTROL Handle = 0x80280044 + TPM_E_BAD_COUNTER Handle = 0x80280045 + TPM_E_NOT_FULLWRITE Handle = 0x80280046 + TPM_E_CONTEXT_GAP Handle = 0x80280047 + TPM_E_MAXNVWRITES Handle = 0x80280048 + TPM_E_NOOPERATOR Handle = 0x80280049 + TPM_E_RESOURCEMISSING Handle = 0x8028004A + TPM_E_DELEGATE_LOCK Handle = 0x8028004B + TPM_E_DELEGATE_FAMILY Handle = 0x8028004C + TPM_E_DELEGATE_ADMIN Handle = 0x8028004D + TPM_E_TRANSPORT_NOTEXCLUSIVE Handle = 0x8028004E + TPM_E_OWNER_CONTROL Handle = 0x8028004F + TPM_E_DAA_RESOURCES Handle = 0x80280050 + TPM_E_DAA_INPUT_DATA0 Handle = 0x80280051 + TPM_E_DAA_INPUT_DATA1 Handle = 0x80280052 + TPM_E_DAA_ISSUER_SETTINGS Handle = 0x80280053 + TPM_E_DAA_TPM_SETTINGS Handle = 0x80280054 + TPM_E_DAA_STAGE Handle = 0x80280055 + TPM_E_DAA_ISSUER_VALIDITY Handle = 0x80280056 + TPM_E_DAA_WRONG_W Handle = 0x80280057 + TPM_E_BAD_HANDLE Handle = 0x80280058 + TPM_E_BAD_DELEGATE Handle = 0x80280059 + TPM_E_BADCONTEXT Handle = 0x8028005A + TPM_E_TOOMANYCONTEXTS Handle = 0x8028005B + TPM_E_MA_TICKET_SIGNATURE Handle = 0x8028005C + TPM_E_MA_DESTINATION Handle = 0x8028005D + TPM_E_MA_SOURCE Handle = 0x8028005E + TPM_E_MA_AUTHORITY Handle = 0x8028005F + TPM_E_PERMANENTEK Handle = 0x80280061 + TPM_E_BAD_SIGNATURE Handle = 0x80280062 + TPM_E_NOCONTEXTSPACE Handle = 0x80280063 + TPM_20_E_ASYMMETRIC Handle = 0x80280081 + TPM_20_E_ATTRIBUTES Handle = 0x80280082 + TPM_20_E_HASH Handle = 0x80280083 + TPM_20_E_VALUE Handle = 0x80280084 + TPM_20_E_HIERARCHY Handle = 0x80280085 + TPM_20_E_KEY_SIZE Handle = 0x80280087 + TPM_20_E_MGF Handle = 0x80280088 + TPM_20_E_MODE Handle = 0x80280089 + TPM_20_E_TYPE Handle = 0x8028008A + TPM_20_E_HANDLE Handle = 0x8028008B + TPM_20_E_KDF Handle = 0x8028008C + TPM_20_E_RANGE Handle = 0x8028008D + TPM_20_E_AUTH_FAIL Handle = 0x8028008E + TPM_20_E_NONCE Handle = 0x8028008F + TPM_20_E_PP Handle = 0x80280090 + TPM_20_E_SCHEME Handle = 0x80280092 + TPM_20_E_SIZE Handle = 0x80280095 + TPM_20_E_SYMMETRIC Handle = 0x80280096 + TPM_20_E_TAG Handle = 0x80280097 + TPM_20_E_SELECTOR Handle = 0x80280098 + TPM_20_E_INSUFFICIENT Handle = 0x8028009A + TPM_20_E_SIGNATURE Handle = 0x8028009B + TPM_20_E_KEY Handle = 0x8028009C + TPM_20_E_POLICY_FAIL Handle = 0x8028009D + TPM_20_E_INTEGRITY Handle = 0x8028009F + TPM_20_E_TICKET Handle = 0x802800A0 + TPM_20_E_RESERVED_BITS Handle = 0x802800A1 + TPM_20_E_BAD_AUTH Handle = 0x802800A2 + TPM_20_E_EXPIRED Handle = 0x802800A3 + TPM_20_E_POLICY_CC Handle = 0x802800A4 + TPM_20_E_BINDING Handle = 0x802800A5 + TPM_20_E_CURVE Handle = 0x802800A6 + TPM_20_E_ECC_POINT Handle = 0x802800A7 + TPM_20_E_INITIALIZE Handle = 0x80280100 + TPM_20_E_FAILURE Handle = 0x80280101 + TPM_20_E_SEQUENCE Handle = 0x80280103 + TPM_20_E_PRIVATE Handle = 0x8028010B + TPM_20_E_HMAC Handle = 0x80280119 + TPM_20_E_DISABLED Handle = 0x80280120 + TPM_20_E_EXCLUSIVE Handle = 0x80280121 + TPM_20_E_ECC_CURVE Handle = 0x80280123 + TPM_20_E_AUTH_TYPE Handle = 0x80280124 + TPM_20_E_AUTH_MISSING Handle = 0x80280125 + TPM_20_E_POLICY Handle = 0x80280126 + TPM_20_E_PCR Handle = 0x80280127 + TPM_20_E_PCR_CHANGED Handle = 0x80280128 + TPM_20_E_UPGRADE Handle = 0x8028012D + TPM_20_E_TOO_MANY_CONTEXTS Handle = 0x8028012E + TPM_20_E_AUTH_UNAVAILABLE Handle = 0x8028012F + TPM_20_E_REBOOT Handle = 0x80280130 + TPM_20_E_UNBALANCED Handle = 0x80280131 + TPM_20_E_COMMAND_SIZE Handle = 0x80280142 + TPM_20_E_COMMAND_CODE Handle = 0x80280143 + TPM_20_E_AUTHSIZE Handle = 0x80280144 + TPM_20_E_AUTH_CONTEXT Handle = 0x80280145 + TPM_20_E_NV_RANGE Handle = 0x80280146 + TPM_20_E_NV_SIZE Handle = 0x80280147 + TPM_20_E_NV_LOCKED Handle = 0x80280148 + TPM_20_E_NV_AUTHORIZATION Handle = 0x80280149 + TPM_20_E_NV_UNINITIALIZED Handle = 0x8028014A + TPM_20_E_NV_SPACE Handle = 0x8028014B + TPM_20_E_NV_DEFINED Handle = 0x8028014C + TPM_20_E_BAD_CONTEXT Handle = 0x80280150 + TPM_20_E_CPHASH Handle = 0x80280151 + TPM_20_E_PARENT Handle = 0x80280152 + TPM_20_E_NEEDS_TEST Handle = 0x80280153 + TPM_20_E_NO_RESULT Handle = 0x80280154 + TPM_20_E_SENSITIVE Handle = 0x80280155 + TPM_E_COMMAND_BLOCKED Handle = 0x80280400 + TPM_E_INVALID_HANDLE Handle = 0x80280401 + TPM_E_DUPLICATE_VHANDLE Handle = 0x80280402 + TPM_E_EMBEDDED_COMMAND_BLOCKED Handle = 0x80280403 + TPM_E_EMBEDDED_COMMAND_UNSUPPORTED Handle = 0x80280404 + TPM_E_RETRY Handle = 0x80280800 + TPM_E_NEEDS_SELFTEST Handle = 0x80280801 + TPM_E_DOING_SELFTEST Handle = 0x80280802 + TPM_E_DEFEND_LOCK_RUNNING Handle = 0x80280803 + TPM_20_E_CONTEXT_GAP Handle = 0x80280901 + TPM_20_E_OBJECT_MEMORY Handle = 0x80280902 + TPM_20_E_SESSION_MEMORY Handle = 0x80280903 + TPM_20_E_MEMORY Handle = 0x80280904 + TPM_20_E_SESSION_HANDLES Handle = 0x80280905 + TPM_20_E_OBJECT_HANDLES Handle = 0x80280906 + TPM_20_E_LOCALITY Handle = 0x80280907 + TPM_20_E_YIELDED Handle = 0x80280908 + TPM_20_E_CANCELED Handle = 0x80280909 + TPM_20_E_TESTING Handle = 0x8028090A + TPM_20_E_NV_RATE Handle = 0x80280920 + TPM_20_E_LOCKOUT Handle = 0x80280921 + TPM_20_E_RETRY Handle = 0x80280922 + TPM_20_E_NV_UNAVAILABLE Handle = 0x80280923 + TBS_E_INTERNAL_ERROR Handle = 0x80284001 + TBS_E_BAD_PARAMETER Handle = 0x80284002 + TBS_E_INVALID_OUTPUT_POINTER Handle = 0x80284003 + TBS_E_INVALID_CONTEXT Handle = 0x80284004 + TBS_E_INSUFFICIENT_BUFFER Handle = 0x80284005 + TBS_E_IOERROR Handle = 0x80284006 + TBS_E_INVALID_CONTEXT_PARAM Handle = 0x80284007 + TBS_E_SERVICE_NOT_RUNNING Handle = 0x80284008 + TBS_E_TOO_MANY_TBS_CONTEXTS Handle = 0x80284009 + TBS_E_TOO_MANY_RESOURCES Handle = 0x8028400A + TBS_E_SERVICE_START_PENDING Handle = 0x8028400B + TBS_E_PPI_NOT_SUPPORTED Handle = 0x8028400C + TBS_E_COMMAND_CANCELED Handle = 0x8028400D + TBS_E_BUFFER_TOO_LARGE Handle = 0x8028400E + TBS_E_TPM_NOT_FOUND Handle = 0x8028400F + TBS_E_SERVICE_DISABLED Handle = 0x80284010 + TBS_E_NO_EVENT_LOG Handle = 0x80284011 + TBS_E_ACCESS_DENIED Handle = 0x80284012 + TBS_E_PROVISIONING_NOT_ALLOWED Handle = 0x80284013 + TBS_E_PPI_FUNCTION_UNSUPPORTED Handle = 0x80284014 + TBS_E_OWNERAUTH_NOT_FOUND Handle = 0x80284015 + TBS_E_PROVISIONING_INCOMPLETE Handle = 0x80284016 + TPMAPI_E_INVALID_STATE Handle = 0x80290100 + TPMAPI_E_NOT_ENOUGH_DATA Handle = 0x80290101 + TPMAPI_E_TOO_MUCH_DATA Handle = 0x80290102 + TPMAPI_E_INVALID_OUTPUT_POINTER Handle = 0x80290103 + TPMAPI_E_INVALID_PARAMETER Handle = 0x80290104 + TPMAPI_E_OUT_OF_MEMORY Handle = 0x80290105 + TPMAPI_E_BUFFER_TOO_SMALL Handle = 0x80290106 + TPMAPI_E_INTERNAL_ERROR Handle = 0x80290107 + TPMAPI_E_ACCESS_DENIED Handle = 0x80290108 + TPMAPI_E_AUTHORIZATION_FAILED Handle = 0x80290109 + TPMAPI_E_INVALID_CONTEXT_HANDLE Handle = 0x8029010A + TPMAPI_E_TBS_COMMUNICATION_ERROR Handle = 0x8029010B + TPMAPI_E_TPM_COMMAND_ERROR Handle = 0x8029010C + TPMAPI_E_MESSAGE_TOO_LARGE Handle = 0x8029010D + TPMAPI_E_INVALID_ENCODING Handle = 0x8029010E + TPMAPI_E_INVALID_KEY_SIZE Handle = 0x8029010F + TPMAPI_E_ENCRYPTION_FAILED Handle = 0x80290110 + TPMAPI_E_INVALID_KEY_PARAMS Handle = 0x80290111 + TPMAPI_E_INVALID_MIGRATION_AUTHORIZATION_BLOB Handle = 0x80290112 + TPMAPI_E_INVALID_PCR_INDEX Handle = 0x80290113 + TPMAPI_E_INVALID_DELEGATE_BLOB Handle = 0x80290114 + TPMAPI_E_INVALID_CONTEXT_PARAMS Handle = 0x80290115 + TPMAPI_E_INVALID_KEY_BLOB Handle = 0x80290116 + TPMAPI_E_INVALID_PCR_DATA Handle = 0x80290117 + TPMAPI_E_INVALID_OWNER_AUTH Handle = 0x80290118 + TPMAPI_E_FIPS_RNG_CHECK_FAILED Handle = 0x80290119 + TPMAPI_E_EMPTY_TCG_LOG Handle = 0x8029011A + TPMAPI_E_INVALID_TCG_LOG_ENTRY Handle = 0x8029011B + TPMAPI_E_TCG_SEPARATOR_ABSENT Handle = 0x8029011C + TPMAPI_E_TCG_INVALID_DIGEST_ENTRY Handle = 0x8029011D + TPMAPI_E_POLICY_DENIES_OPERATION Handle = 0x8029011E + TPMAPI_E_NV_BITS_NOT_DEFINED Handle = 0x8029011F + TPMAPI_E_NV_BITS_NOT_READY Handle = 0x80290120 + TPMAPI_E_SEALING_KEY_NOT_AVAILABLE Handle = 0x80290121 + TPMAPI_E_NO_AUTHORIZATION_CHAIN_FOUND Handle = 0x80290122 + TPMAPI_E_SVN_COUNTER_NOT_AVAILABLE Handle = 0x80290123 + TPMAPI_E_OWNER_AUTH_NOT_NULL Handle = 0x80290124 + TPMAPI_E_ENDORSEMENT_AUTH_NOT_NULL Handle = 0x80290125 + TPMAPI_E_AUTHORIZATION_REVOKED Handle = 0x80290126 + TPMAPI_E_MALFORMED_AUTHORIZATION_KEY Handle = 0x80290127 + TPMAPI_E_AUTHORIZING_KEY_NOT_SUPPORTED Handle = 0x80290128 + TPMAPI_E_INVALID_AUTHORIZATION_SIGNATURE Handle = 0x80290129 + TPMAPI_E_MALFORMED_AUTHORIZATION_POLICY Handle = 0x8029012A + TPMAPI_E_MALFORMED_AUTHORIZATION_OTHER Handle = 0x8029012B + TPMAPI_E_SEALING_KEY_CHANGED Handle = 0x8029012C + TBSIMP_E_BUFFER_TOO_SMALL Handle = 0x80290200 + TBSIMP_E_CLEANUP_FAILED Handle = 0x80290201 + TBSIMP_E_INVALID_CONTEXT_HANDLE Handle = 0x80290202 + TBSIMP_E_INVALID_CONTEXT_PARAM Handle = 0x80290203 + TBSIMP_E_TPM_ERROR Handle = 0x80290204 + TBSIMP_E_HASH_BAD_KEY Handle = 0x80290205 + TBSIMP_E_DUPLICATE_VHANDLE Handle = 0x80290206 + TBSIMP_E_INVALID_OUTPUT_POINTER Handle = 0x80290207 + TBSIMP_E_INVALID_PARAMETER Handle = 0x80290208 + TBSIMP_E_RPC_INIT_FAILED Handle = 0x80290209 + TBSIMP_E_SCHEDULER_NOT_RUNNING Handle = 0x8029020A + TBSIMP_E_COMMAND_CANCELED Handle = 0x8029020B + TBSIMP_E_OUT_OF_MEMORY Handle = 0x8029020C + TBSIMP_E_LIST_NO_MORE_ITEMS Handle = 0x8029020D + TBSIMP_E_LIST_NOT_FOUND Handle = 0x8029020E + TBSIMP_E_NOT_ENOUGH_SPACE Handle = 0x8029020F + TBSIMP_E_NOT_ENOUGH_TPM_CONTEXTS Handle = 0x80290210 + TBSIMP_E_COMMAND_FAILED Handle = 0x80290211 + TBSIMP_E_UNKNOWN_ORDINAL Handle = 0x80290212 + TBSIMP_E_RESOURCE_EXPIRED Handle = 0x80290213 + TBSIMP_E_INVALID_RESOURCE Handle = 0x80290214 + TBSIMP_E_NOTHING_TO_UNLOAD Handle = 0x80290215 + TBSIMP_E_HASH_TABLE_FULL Handle = 0x80290216 + TBSIMP_E_TOO_MANY_TBS_CONTEXTS Handle = 0x80290217 + TBSIMP_E_TOO_MANY_RESOURCES Handle = 0x80290218 + TBSIMP_E_PPI_NOT_SUPPORTED Handle = 0x80290219 + TBSIMP_E_TPM_INCOMPATIBLE Handle = 0x8029021A + TBSIMP_E_NO_EVENT_LOG Handle = 0x8029021B + TPM_E_PPI_ACPI_FAILURE Handle = 0x80290300 + TPM_E_PPI_USER_ABORT Handle = 0x80290301 + TPM_E_PPI_BIOS_FAILURE Handle = 0x80290302 + TPM_E_PPI_NOT_SUPPORTED Handle = 0x80290303 + TPM_E_PPI_BLOCKED_IN_BIOS Handle = 0x80290304 + TPM_E_PCP_ERROR_MASK Handle = 0x80290400 + TPM_E_PCP_DEVICE_NOT_READY Handle = 0x80290401 + TPM_E_PCP_INVALID_HANDLE Handle = 0x80290402 + TPM_E_PCP_INVALID_PARAMETER Handle = 0x80290403 + TPM_E_PCP_FLAG_NOT_SUPPORTED Handle = 0x80290404 + TPM_E_PCP_NOT_SUPPORTED Handle = 0x80290405 + TPM_E_PCP_BUFFER_TOO_SMALL Handle = 0x80290406 + TPM_E_PCP_INTERNAL_ERROR Handle = 0x80290407 + TPM_E_PCP_AUTHENTICATION_FAILED Handle = 0x80290408 + TPM_E_PCP_AUTHENTICATION_IGNORED Handle = 0x80290409 + TPM_E_PCP_POLICY_NOT_FOUND Handle = 0x8029040A + TPM_E_PCP_PROFILE_NOT_FOUND Handle = 0x8029040B + TPM_E_PCP_VALIDATION_FAILED Handle = 0x8029040C + TPM_E_PCP_WRONG_PARENT Handle = 0x8029040E + TPM_E_KEY_NOT_LOADED Handle = 0x8029040F + TPM_E_NO_KEY_CERTIFICATION Handle = 0x80290410 + TPM_E_KEY_NOT_FINALIZED Handle = 0x80290411 + TPM_E_ATTESTATION_CHALLENGE_NOT_SET Handle = 0x80290412 + TPM_E_NOT_PCR_BOUND Handle = 0x80290413 + TPM_E_KEY_ALREADY_FINALIZED Handle = 0x80290414 + TPM_E_KEY_USAGE_POLICY_NOT_SUPPORTED Handle = 0x80290415 + TPM_E_KEY_USAGE_POLICY_INVALID Handle = 0x80290416 + TPM_E_SOFT_KEY_ERROR Handle = 0x80290417 + TPM_E_KEY_NOT_AUTHENTICATED Handle = 0x80290418 + TPM_E_PCP_KEY_NOT_AIK Handle = 0x80290419 + TPM_E_KEY_NOT_SIGNING_KEY Handle = 0x8029041A + TPM_E_LOCKED_OUT Handle = 0x8029041B + TPM_E_CLAIM_TYPE_NOT_SUPPORTED Handle = 0x8029041C + TPM_E_VERSION_NOT_SUPPORTED Handle = 0x8029041D + TPM_E_BUFFER_LENGTH_MISMATCH Handle = 0x8029041E + TPM_E_PCP_IFX_RSA_KEY_CREATION_BLOCKED Handle = 0x8029041F + TPM_E_PCP_TICKET_MISSING Handle = 0x80290420 + TPM_E_PCP_RAW_POLICY_NOT_SUPPORTED Handle = 0x80290421 + TPM_E_PCP_KEY_HANDLE_INVALIDATED Handle = 0x80290422 + TPM_E_PCP_UNSUPPORTED_PSS_SALT Handle = 0x40290423 + TPM_E_ZERO_EXHAUST_ENABLED Handle = 0x80290500 + PLA_E_DCS_NOT_FOUND Handle = 0x80300002 + PLA_E_DCS_IN_USE Handle = 0x803000AA + PLA_E_TOO_MANY_FOLDERS Handle = 0x80300045 + PLA_E_NO_MIN_DISK Handle = 0x80300070 + PLA_E_DCS_ALREADY_EXISTS Handle = 0x803000B7 + PLA_S_PROPERTY_IGNORED Handle = 0x00300100 + PLA_E_PROPERTY_CONFLICT Handle = 0x80300101 + PLA_E_DCS_SINGLETON_REQUIRED Handle = 0x80300102 + PLA_E_CREDENTIALS_REQUIRED Handle = 0x80300103 + PLA_E_DCS_NOT_RUNNING Handle = 0x80300104 + PLA_E_CONFLICT_INCL_EXCL_API Handle = 0x80300105 + PLA_E_NETWORK_EXE_NOT_VALID Handle = 0x80300106 + PLA_E_EXE_ALREADY_CONFIGURED Handle = 0x80300107 + PLA_E_EXE_PATH_NOT_VALID Handle = 0x80300108 + PLA_E_DC_ALREADY_EXISTS Handle = 0x80300109 + PLA_E_DCS_START_WAIT_TIMEOUT Handle = 0x8030010A + PLA_E_DC_START_WAIT_TIMEOUT Handle = 0x8030010B + PLA_E_REPORT_WAIT_TIMEOUT Handle = 0x8030010C + PLA_E_NO_DUPLICATES Handle = 0x8030010D + PLA_E_EXE_FULL_PATH_REQUIRED Handle = 0x8030010E + PLA_E_INVALID_SESSION_NAME Handle = 0x8030010F + PLA_E_PLA_CHANNEL_NOT_ENABLED Handle = 0x80300110 + PLA_E_TASKSCHED_CHANNEL_NOT_ENABLED Handle = 0x80300111 + PLA_E_RULES_MANAGER_FAILED Handle = 0x80300112 + PLA_E_CABAPI_FAILURE Handle = 0x80300113 + FVE_E_LOCKED_VOLUME Handle = 0x80310000 + FVE_E_NOT_ENCRYPTED Handle = 0x80310001 + FVE_E_NO_TPM_BIOS Handle = 0x80310002 + FVE_E_NO_MBR_METRIC Handle = 0x80310003 + FVE_E_NO_BOOTSECTOR_METRIC Handle = 0x80310004 + FVE_E_NO_BOOTMGR_METRIC Handle = 0x80310005 + FVE_E_WRONG_BOOTMGR Handle = 0x80310006 + FVE_E_SECURE_KEY_REQUIRED Handle = 0x80310007 + FVE_E_NOT_ACTIVATED Handle = 0x80310008 + FVE_E_ACTION_NOT_ALLOWED Handle = 0x80310009 + FVE_E_AD_SCHEMA_NOT_INSTALLED Handle = 0x8031000A + FVE_E_AD_INVALID_DATATYPE Handle = 0x8031000B + FVE_E_AD_INVALID_DATASIZE Handle = 0x8031000C + FVE_E_AD_NO_VALUES Handle = 0x8031000D + FVE_E_AD_ATTR_NOT_SET Handle = 0x8031000E + FVE_E_AD_GUID_NOT_FOUND Handle = 0x8031000F + FVE_E_BAD_INFORMATION Handle = 0x80310010 + FVE_E_TOO_SMALL Handle = 0x80310011 + FVE_E_SYSTEM_VOLUME Handle = 0x80310012 + FVE_E_FAILED_WRONG_FS Handle = 0x80310013 + FVE_E_BAD_PARTITION_SIZE Handle = 0x80310014 + FVE_E_NOT_SUPPORTED Handle = 0x80310015 + FVE_E_BAD_DATA Handle = 0x80310016 + FVE_E_VOLUME_NOT_BOUND Handle = 0x80310017 + FVE_E_TPM_NOT_OWNED Handle = 0x80310018 + FVE_E_NOT_DATA_VOLUME Handle = 0x80310019 + FVE_E_AD_INSUFFICIENT_BUFFER Handle = 0x8031001A + FVE_E_CONV_READ Handle = 0x8031001B + FVE_E_CONV_WRITE Handle = 0x8031001C + FVE_E_KEY_REQUIRED Handle = 0x8031001D + FVE_E_CLUSTERING_NOT_SUPPORTED Handle = 0x8031001E + FVE_E_VOLUME_BOUND_ALREADY Handle = 0x8031001F + FVE_E_OS_NOT_PROTECTED Handle = 0x80310020 + FVE_E_PROTECTION_DISABLED Handle = 0x80310021 + FVE_E_RECOVERY_KEY_REQUIRED Handle = 0x80310022 + FVE_E_FOREIGN_VOLUME Handle = 0x80310023 + FVE_E_OVERLAPPED_UPDATE Handle = 0x80310024 + FVE_E_TPM_SRK_AUTH_NOT_ZERO Handle = 0x80310025 + FVE_E_FAILED_SECTOR_SIZE Handle = 0x80310026 + FVE_E_FAILED_AUTHENTICATION Handle = 0x80310027 + FVE_E_NOT_OS_VOLUME Handle = 0x80310028 + FVE_E_AUTOUNLOCK_ENABLED Handle = 0x80310029 + FVE_E_WRONG_BOOTSECTOR Handle = 0x8031002A + FVE_E_WRONG_SYSTEM_FS Handle = 0x8031002B + FVE_E_POLICY_PASSWORD_REQUIRED Handle = 0x8031002C + FVE_E_CANNOT_SET_FVEK_ENCRYPTED Handle = 0x8031002D + FVE_E_CANNOT_ENCRYPT_NO_KEY Handle = 0x8031002E + FVE_E_BOOTABLE_CDDVD Handle = 0x80310030 + FVE_E_PROTECTOR_EXISTS Handle = 0x80310031 + FVE_E_RELATIVE_PATH Handle = 0x80310032 + FVE_E_PROTECTOR_NOT_FOUND Handle = 0x80310033 + FVE_E_INVALID_KEY_FORMAT Handle = 0x80310034 + FVE_E_INVALID_PASSWORD_FORMAT Handle = 0x80310035 + FVE_E_FIPS_RNG_CHECK_FAILED Handle = 0x80310036 + FVE_E_FIPS_PREVENTS_RECOVERY_PASSWORD Handle = 0x80310037 + FVE_E_FIPS_PREVENTS_EXTERNAL_KEY_EXPORT Handle = 0x80310038 + FVE_E_NOT_DECRYPTED Handle = 0x80310039 + FVE_E_INVALID_PROTECTOR_TYPE Handle = 0x8031003A + FVE_E_NO_PROTECTORS_TO_TEST Handle = 0x8031003B + FVE_E_KEYFILE_NOT_FOUND Handle = 0x8031003C + FVE_E_KEYFILE_INVALID Handle = 0x8031003D + FVE_E_KEYFILE_NO_VMK Handle = 0x8031003E + FVE_E_TPM_DISABLED Handle = 0x8031003F + FVE_E_NOT_ALLOWED_IN_SAFE_MODE Handle = 0x80310040 + FVE_E_TPM_INVALID_PCR Handle = 0x80310041 + FVE_E_TPM_NO_VMK Handle = 0x80310042 + FVE_E_PIN_INVALID Handle = 0x80310043 + FVE_E_AUTH_INVALID_APPLICATION Handle = 0x80310044 + FVE_E_AUTH_INVALID_CONFIG Handle = 0x80310045 + FVE_E_FIPS_DISABLE_PROTECTION_NOT_ALLOWED Handle = 0x80310046 + FVE_E_FS_NOT_EXTENDED Handle = 0x80310047 + FVE_E_FIRMWARE_TYPE_NOT_SUPPORTED Handle = 0x80310048 + FVE_E_NO_LICENSE Handle = 0x80310049 + FVE_E_NOT_ON_STACK Handle = 0x8031004A + FVE_E_FS_MOUNTED Handle = 0x8031004B + FVE_E_TOKEN_NOT_IMPERSONATED Handle = 0x8031004C + FVE_E_DRY_RUN_FAILED Handle = 0x8031004D + FVE_E_REBOOT_REQUIRED Handle = 0x8031004E + FVE_E_DEBUGGER_ENABLED Handle = 0x8031004F + FVE_E_RAW_ACCESS Handle = 0x80310050 + FVE_E_RAW_BLOCKED Handle = 0x80310051 + FVE_E_BCD_APPLICATIONS_PATH_INCORRECT Handle = 0x80310052 + FVE_E_NOT_ALLOWED_IN_VERSION Handle = 0x80310053 + FVE_E_NO_AUTOUNLOCK_MASTER_KEY Handle = 0x80310054 + FVE_E_MOR_FAILED Handle = 0x80310055 + FVE_E_HIDDEN_VOLUME Handle = 0x80310056 + FVE_E_TRANSIENT_STATE Handle = 0x80310057 + FVE_E_PUBKEY_NOT_ALLOWED Handle = 0x80310058 + FVE_E_VOLUME_HANDLE_OPEN Handle = 0x80310059 + FVE_E_NO_FEATURE_LICENSE Handle = 0x8031005A + FVE_E_INVALID_STARTUP_OPTIONS Handle = 0x8031005B + FVE_E_POLICY_RECOVERY_PASSWORD_NOT_ALLOWED Handle = 0x8031005C + FVE_E_POLICY_RECOVERY_PASSWORD_REQUIRED Handle = 0x8031005D + FVE_E_POLICY_RECOVERY_KEY_NOT_ALLOWED Handle = 0x8031005E + FVE_E_POLICY_RECOVERY_KEY_REQUIRED Handle = 0x8031005F + FVE_E_POLICY_STARTUP_PIN_NOT_ALLOWED Handle = 0x80310060 + FVE_E_POLICY_STARTUP_PIN_REQUIRED Handle = 0x80310061 + FVE_E_POLICY_STARTUP_KEY_NOT_ALLOWED Handle = 0x80310062 + FVE_E_POLICY_STARTUP_KEY_REQUIRED Handle = 0x80310063 + FVE_E_POLICY_STARTUP_PIN_KEY_NOT_ALLOWED Handle = 0x80310064 + FVE_E_POLICY_STARTUP_PIN_KEY_REQUIRED Handle = 0x80310065 + FVE_E_POLICY_STARTUP_TPM_NOT_ALLOWED Handle = 0x80310066 + FVE_E_POLICY_STARTUP_TPM_REQUIRED Handle = 0x80310067 + FVE_E_POLICY_INVALID_PIN_LENGTH Handle = 0x80310068 + FVE_E_KEY_PROTECTOR_NOT_SUPPORTED Handle = 0x80310069 + FVE_E_POLICY_PASSPHRASE_NOT_ALLOWED Handle = 0x8031006A + FVE_E_POLICY_PASSPHRASE_REQUIRED Handle = 0x8031006B + FVE_E_FIPS_PREVENTS_PASSPHRASE Handle = 0x8031006C + FVE_E_OS_VOLUME_PASSPHRASE_NOT_ALLOWED Handle = 0x8031006D + FVE_E_INVALID_BITLOCKER_OID Handle = 0x8031006E + FVE_E_VOLUME_TOO_SMALL Handle = 0x8031006F + FVE_E_DV_NOT_SUPPORTED_ON_FS Handle = 0x80310070 + FVE_E_DV_NOT_ALLOWED_BY_GP Handle = 0x80310071 + FVE_E_POLICY_USER_CERTIFICATE_NOT_ALLOWED Handle = 0x80310072 + FVE_E_POLICY_USER_CERTIFICATE_REQUIRED Handle = 0x80310073 + FVE_E_POLICY_USER_CERT_MUST_BE_HW Handle = 0x80310074 + FVE_E_POLICY_USER_CONFIGURE_FDV_AUTOUNLOCK_NOT_ALLOWED Handle = 0x80310075 + FVE_E_POLICY_USER_CONFIGURE_RDV_AUTOUNLOCK_NOT_ALLOWED Handle = 0x80310076 + FVE_E_POLICY_USER_CONFIGURE_RDV_NOT_ALLOWED Handle = 0x80310077 + FVE_E_POLICY_USER_ENABLE_RDV_NOT_ALLOWED Handle = 0x80310078 + FVE_E_POLICY_USER_DISABLE_RDV_NOT_ALLOWED Handle = 0x80310079 + FVE_E_POLICY_INVALID_PASSPHRASE_LENGTH Handle = 0x80310080 + FVE_E_POLICY_PASSPHRASE_TOO_SIMPLE Handle = 0x80310081 + FVE_E_RECOVERY_PARTITION Handle = 0x80310082 + FVE_E_POLICY_CONFLICT_FDV_RK_OFF_AUK_ON Handle = 0x80310083 + FVE_E_POLICY_CONFLICT_RDV_RK_OFF_AUK_ON Handle = 0x80310084 + FVE_E_NON_BITLOCKER_OID Handle = 0x80310085 + FVE_E_POLICY_PROHIBITS_SELFSIGNED Handle = 0x80310086 + FVE_E_POLICY_CONFLICT_RO_AND_STARTUP_KEY_REQUIRED Handle = 0x80310087 + FVE_E_CONV_RECOVERY_FAILED Handle = 0x80310088 + FVE_E_VIRTUALIZED_SPACE_TOO_BIG Handle = 0x80310089 + FVE_E_POLICY_CONFLICT_OSV_RP_OFF_ADB_ON Handle = 0x80310090 + FVE_E_POLICY_CONFLICT_FDV_RP_OFF_ADB_ON Handle = 0x80310091 + FVE_E_POLICY_CONFLICT_RDV_RP_OFF_ADB_ON Handle = 0x80310092 + FVE_E_NON_BITLOCKER_KU Handle = 0x80310093 + FVE_E_PRIVATEKEY_AUTH_FAILED Handle = 0x80310094 + FVE_E_REMOVAL_OF_DRA_FAILED Handle = 0x80310095 + FVE_E_OPERATION_NOT_SUPPORTED_ON_VISTA_VOLUME Handle = 0x80310096 + FVE_E_CANT_LOCK_AUTOUNLOCK_ENABLED_VOLUME Handle = 0x80310097 + FVE_E_FIPS_HASH_KDF_NOT_ALLOWED Handle = 0x80310098 + FVE_E_ENH_PIN_INVALID Handle = 0x80310099 + FVE_E_INVALID_PIN_CHARS Handle = 0x8031009A + FVE_E_INVALID_DATUM_TYPE Handle = 0x8031009B + FVE_E_EFI_ONLY Handle = 0x8031009C + FVE_E_MULTIPLE_NKP_CERTS Handle = 0x8031009D + FVE_E_REMOVAL_OF_NKP_FAILED Handle = 0x8031009E + FVE_E_INVALID_NKP_CERT Handle = 0x8031009F + FVE_E_NO_EXISTING_PIN Handle = 0x803100A0 + FVE_E_PROTECTOR_CHANGE_PIN_MISMATCH Handle = 0x803100A1 + FVE_E_PIN_PROTECTOR_CHANGE_BY_STD_USER_DISALLOWED Handle = 0x803100A2 + FVE_E_PROTECTOR_CHANGE_MAX_PIN_CHANGE_ATTEMPTS_REACHED Handle = 0x803100A3 + FVE_E_POLICY_PASSPHRASE_REQUIRES_ASCII Handle = 0x803100A4 + FVE_E_FULL_ENCRYPTION_NOT_ALLOWED_ON_TP_STORAGE Handle = 0x803100A5 + FVE_E_WIPE_NOT_ALLOWED_ON_TP_STORAGE Handle = 0x803100A6 + FVE_E_KEY_LENGTH_NOT_SUPPORTED_BY_EDRIVE Handle = 0x803100A7 + FVE_E_NO_EXISTING_PASSPHRASE Handle = 0x803100A8 + FVE_E_PROTECTOR_CHANGE_PASSPHRASE_MISMATCH Handle = 0x803100A9 + FVE_E_PASSPHRASE_TOO_LONG Handle = 0x803100AA + FVE_E_NO_PASSPHRASE_WITH_TPM Handle = 0x803100AB + FVE_E_NO_TPM_WITH_PASSPHRASE Handle = 0x803100AC + FVE_E_NOT_ALLOWED_ON_CSV_STACK Handle = 0x803100AD + FVE_E_NOT_ALLOWED_ON_CLUSTER Handle = 0x803100AE + FVE_E_EDRIVE_NO_FAILOVER_TO_SW Handle = 0x803100AF + FVE_E_EDRIVE_BAND_IN_USE Handle = 0x803100B0 + FVE_E_EDRIVE_DISALLOWED_BY_GP Handle = 0x803100B1 + FVE_E_EDRIVE_INCOMPATIBLE_VOLUME Handle = 0x803100B2 + FVE_E_NOT_ALLOWED_TO_UPGRADE_WHILE_CONVERTING Handle = 0x803100B3 + FVE_E_EDRIVE_DV_NOT_SUPPORTED Handle = 0x803100B4 + FVE_E_NO_PREBOOT_KEYBOARD_DETECTED Handle = 0x803100B5 + FVE_E_NO_PREBOOT_KEYBOARD_OR_WINRE_DETECTED Handle = 0x803100B6 + FVE_E_POLICY_REQUIRES_STARTUP_PIN_ON_TOUCH_DEVICE Handle = 0x803100B7 + FVE_E_POLICY_REQUIRES_RECOVERY_PASSWORD_ON_TOUCH_DEVICE Handle = 0x803100B8 + FVE_E_WIPE_CANCEL_NOT_APPLICABLE Handle = 0x803100B9 + FVE_E_SECUREBOOT_DISABLED Handle = 0x803100BA + FVE_E_SECUREBOOT_CONFIGURATION_INVALID Handle = 0x803100BB + FVE_E_EDRIVE_DRY_RUN_FAILED Handle = 0x803100BC + FVE_E_SHADOW_COPY_PRESENT Handle = 0x803100BD + FVE_E_POLICY_INVALID_ENHANCED_BCD_SETTINGS Handle = 0x803100BE + FVE_E_EDRIVE_INCOMPATIBLE_FIRMWARE Handle = 0x803100BF + FVE_E_PROTECTOR_CHANGE_MAX_PASSPHRASE_CHANGE_ATTEMPTS_REACHED Handle = 0x803100C0 + FVE_E_PASSPHRASE_PROTECTOR_CHANGE_BY_STD_USER_DISALLOWED Handle = 0x803100C1 + FVE_E_LIVEID_ACCOUNT_SUSPENDED Handle = 0x803100C2 + FVE_E_LIVEID_ACCOUNT_BLOCKED Handle = 0x803100C3 + FVE_E_NOT_PROVISIONED_ON_ALL_VOLUMES Handle = 0x803100C4 + FVE_E_DE_FIXED_DATA_NOT_SUPPORTED Handle = 0x803100C5 + FVE_E_DE_HARDWARE_NOT_COMPLIANT Handle = 0x803100C6 + FVE_E_DE_WINRE_NOT_CONFIGURED Handle = 0x803100C7 + FVE_E_DE_PROTECTION_SUSPENDED Handle = 0x803100C8 + FVE_E_DE_OS_VOLUME_NOT_PROTECTED Handle = 0x803100C9 + FVE_E_DE_DEVICE_LOCKEDOUT Handle = 0x803100CA + FVE_E_DE_PROTECTION_NOT_YET_ENABLED Handle = 0x803100CB + FVE_E_INVALID_PIN_CHARS_DETAILED Handle = 0x803100CC + FVE_E_DEVICE_LOCKOUT_COUNTER_UNAVAILABLE Handle = 0x803100CD + FVE_E_DEVICELOCKOUT_COUNTER_MISMATCH Handle = 0x803100CE + FVE_E_BUFFER_TOO_LARGE Handle = 0x803100CF + FVE_E_NO_SUCH_CAPABILITY_ON_TARGET Handle = 0x803100D0 + FVE_E_DE_PREVENTED_FOR_OS Handle = 0x803100D1 + FVE_E_DE_VOLUME_OPTED_OUT Handle = 0x803100D2 + FVE_E_DE_VOLUME_NOT_SUPPORTED Handle = 0x803100D3 + FVE_E_EOW_NOT_SUPPORTED_IN_VERSION Handle = 0x803100D4 + FVE_E_ADBACKUP_NOT_ENABLED Handle = 0x803100D5 + FVE_E_VOLUME_EXTEND_PREVENTS_EOW_DECRYPT Handle = 0x803100D6 + FVE_E_NOT_DE_VOLUME Handle = 0x803100D7 + FVE_E_PROTECTION_CANNOT_BE_DISABLED Handle = 0x803100D8 + FVE_E_OSV_KSR_NOT_ALLOWED Handle = 0x803100D9 + FVE_E_AD_BACKUP_REQUIRED_POLICY_NOT_SET_OS_DRIVE Handle = 0x803100DA + FVE_E_AD_BACKUP_REQUIRED_POLICY_NOT_SET_FIXED_DRIVE Handle = 0x803100DB + FVE_E_AD_BACKUP_REQUIRED_POLICY_NOT_SET_REMOVABLE_DRIVE Handle = 0x803100DC + FVE_E_KEY_ROTATION_NOT_SUPPORTED Handle = 0x803100DD + FVE_E_EXECUTE_REQUEST_SENT_TOO_SOON Handle = 0x803100DE + FVE_E_KEY_ROTATION_NOT_ENABLED Handle = 0x803100DF + FVE_E_DEVICE_NOT_JOINED Handle = 0x803100E0 + FWP_E_CALLOUT_NOT_FOUND Handle = 0x80320001 + FWP_E_CONDITION_NOT_FOUND Handle = 0x80320002 + FWP_E_FILTER_NOT_FOUND Handle = 0x80320003 + FWP_E_LAYER_NOT_FOUND Handle = 0x80320004 + FWP_E_PROVIDER_NOT_FOUND Handle = 0x80320005 + FWP_E_PROVIDER_CONTEXT_NOT_FOUND Handle = 0x80320006 + FWP_E_SUBLAYER_NOT_FOUND Handle = 0x80320007 + FWP_E_NOT_FOUND Handle = 0x80320008 + FWP_E_ALREADY_EXISTS Handle = 0x80320009 + FWP_E_IN_USE Handle = 0x8032000A + FWP_E_DYNAMIC_SESSION_IN_PROGRESS Handle = 0x8032000B + FWP_E_WRONG_SESSION Handle = 0x8032000C + FWP_E_NO_TXN_IN_PROGRESS Handle = 0x8032000D + FWP_E_TXN_IN_PROGRESS Handle = 0x8032000E + FWP_E_TXN_ABORTED Handle = 0x8032000F + FWP_E_SESSION_ABORTED Handle = 0x80320010 + FWP_E_INCOMPATIBLE_TXN Handle = 0x80320011 + FWP_E_TIMEOUT Handle = 0x80320012 + FWP_E_NET_EVENTS_DISABLED Handle = 0x80320013 + FWP_E_INCOMPATIBLE_LAYER Handle = 0x80320014 + FWP_E_KM_CLIENTS_ONLY Handle = 0x80320015 + FWP_E_LIFETIME_MISMATCH Handle = 0x80320016 + FWP_E_BUILTIN_OBJECT Handle = 0x80320017 + FWP_E_TOO_MANY_CALLOUTS Handle = 0x80320018 + FWP_E_NOTIFICATION_DROPPED Handle = 0x80320019 + FWP_E_TRAFFIC_MISMATCH Handle = 0x8032001A + FWP_E_INCOMPATIBLE_SA_STATE Handle = 0x8032001B + FWP_E_NULL_POINTER Handle = 0x8032001C + FWP_E_INVALID_ENUMERATOR Handle = 0x8032001D + FWP_E_INVALID_FLAGS Handle = 0x8032001E + FWP_E_INVALID_NET_MASK Handle = 0x8032001F + FWP_E_INVALID_RANGE Handle = 0x80320020 + FWP_E_INVALID_INTERVAL Handle = 0x80320021 + FWP_E_ZERO_LENGTH_ARRAY Handle = 0x80320022 + FWP_E_NULL_DISPLAY_NAME Handle = 0x80320023 + FWP_E_INVALID_ACTION_TYPE Handle = 0x80320024 + FWP_E_INVALID_WEIGHT Handle = 0x80320025 + FWP_E_MATCH_TYPE_MISMATCH Handle = 0x80320026 + FWP_E_TYPE_MISMATCH Handle = 0x80320027 + FWP_E_OUT_OF_BOUNDS Handle = 0x80320028 + FWP_E_RESERVED Handle = 0x80320029 + FWP_E_DUPLICATE_CONDITION Handle = 0x8032002A + FWP_E_DUPLICATE_KEYMOD Handle = 0x8032002B + FWP_E_ACTION_INCOMPATIBLE_WITH_LAYER Handle = 0x8032002C + FWP_E_ACTION_INCOMPATIBLE_WITH_SUBLAYER Handle = 0x8032002D + FWP_E_CONTEXT_INCOMPATIBLE_WITH_LAYER Handle = 0x8032002E + FWP_E_CONTEXT_INCOMPATIBLE_WITH_CALLOUT Handle = 0x8032002F + FWP_E_INCOMPATIBLE_AUTH_METHOD Handle = 0x80320030 + FWP_E_INCOMPATIBLE_DH_GROUP Handle = 0x80320031 + FWP_E_EM_NOT_SUPPORTED Handle = 0x80320032 + FWP_E_NEVER_MATCH Handle = 0x80320033 + FWP_E_PROVIDER_CONTEXT_MISMATCH Handle = 0x80320034 + FWP_E_INVALID_PARAMETER Handle = 0x80320035 + FWP_E_TOO_MANY_SUBLAYERS Handle = 0x80320036 + FWP_E_CALLOUT_NOTIFICATION_FAILED Handle = 0x80320037 + FWP_E_INVALID_AUTH_TRANSFORM Handle = 0x80320038 + FWP_E_INVALID_CIPHER_TRANSFORM Handle = 0x80320039 + FWP_E_INCOMPATIBLE_CIPHER_TRANSFORM Handle = 0x8032003A + FWP_E_INVALID_TRANSFORM_COMBINATION Handle = 0x8032003B + FWP_E_DUPLICATE_AUTH_METHOD Handle = 0x8032003C + FWP_E_INVALID_TUNNEL_ENDPOINT Handle = 0x8032003D + FWP_E_L2_DRIVER_NOT_READY Handle = 0x8032003E + FWP_E_KEY_DICTATOR_ALREADY_REGISTERED Handle = 0x8032003F + FWP_E_KEY_DICTATION_INVALID_KEYING_MATERIAL Handle = 0x80320040 + FWP_E_CONNECTIONS_DISABLED Handle = 0x80320041 + FWP_E_INVALID_DNS_NAME Handle = 0x80320042 + FWP_E_STILL_ON Handle = 0x80320043 + FWP_E_IKEEXT_NOT_RUNNING Handle = 0x80320044 + FWP_E_DROP_NOICMP Handle = 0x80320104 + WS_S_ASYNC Handle = 0x003D0000 + WS_S_END Handle = 0x003D0001 + WS_E_INVALID_FORMAT Handle = 0x803D0000 + WS_E_OBJECT_FAULTED Handle = 0x803D0001 + WS_E_NUMERIC_OVERFLOW Handle = 0x803D0002 + WS_E_INVALID_OPERATION Handle = 0x803D0003 + WS_E_OPERATION_ABORTED Handle = 0x803D0004 + WS_E_ENDPOINT_ACCESS_DENIED Handle = 0x803D0005 + WS_E_OPERATION_TIMED_OUT Handle = 0x803D0006 + WS_E_OPERATION_ABANDONED Handle = 0x803D0007 + WS_E_QUOTA_EXCEEDED Handle = 0x803D0008 + WS_E_NO_TRANSLATION_AVAILABLE Handle = 0x803D0009 + WS_E_SECURITY_VERIFICATION_FAILURE Handle = 0x803D000A + WS_E_ADDRESS_IN_USE Handle = 0x803D000B + WS_E_ADDRESS_NOT_AVAILABLE Handle = 0x803D000C + WS_E_ENDPOINT_NOT_FOUND Handle = 0x803D000D + WS_E_ENDPOINT_NOT_AVAILABLE Handle = 0x803D000E + WS_E_ENDPOINT_FAILURE Handle = 0x803D000F + WS_E_ENDPOINT_UNREACHABLE Handle = 0x803D0010 + WS_E_ENDPOINT_ACTION_NOT_SUPPORTED Handle = 0x803D0011 + WS_E_ENDPOINT_TOO_BUSY Handle = 0x803D0012 + WS_E_ENDPOINT_FAULT_RECEIVED Handle = 0x803D0013 + WS_E_ENDPOINT_DISCONNECTED Handle = 0x803D0014 + WS_E_PROXY_FAILURE Handle = 0x803D0015 + WS_E_PROXY_ACCESS_DENIED Handle = 0x803D0016 + WS_E_NOT_SUPPORTED Handle = 0x803D0017 + WS_E_PROXY_REQUIRES_BASIC_AUTH Handle = 0x803D0018 + WS_E_PROXY_REQUIRES_DIGEST_AUTH Handle = 0x803D0019 + WS_E_PROXY_REQUIRES_NTLM_AUTH Handle = 0x803D001A + WS_E_PROXY_REQUIRES_NEGOTIATE_AUTH Handle = 0x803D001B + WS_E_SERVER_REQUIRES_BASIC_AUTH Handle = 0x803D001C + WS_E_SERVER_REQUIRES_DIGEST_AUTH Handle = 0x803D001D + WS_E_SERVER_REQUIRES_NTLM_AUTH Handle = 0x803D001E + WS_E_SERVER_REQUIRES_NEGOTIATE_AUTH Handle = 0x803D001F + WS_E_INVALID_ENDPOINT_URL Handle = 0x803D0020 + WS_E_OTHER Handle = 0x803D0021 + WS_E_SECURITY_TOKEN_EXPIRED Handle = 0x803D0022 + WS_E_SECURITY_SYSTEM_FAILURE Handle = 0x803D0023 + ERROR_NDIS_INTERFACE_CLOSING syscall.Errno = 0x80340002 + ERROR_NDIS_BAD_VERSION syscall.Errno = 0x80340004 + ERROR_NDIS_BAD_CHARACTERISTICS syscall.Errno = 0x80340005 + ERROR_NDIS_ADAPTER_NOT_FOUND syscall.Errno = 0x80340006 + ERROR_NDIS_OPEN_FAILED syscall.Errno = 0x80340007 + ERROR_NDIS_DEVICE_FAILED syscall.Errno = 0x80340008 + ERROR_NDIS_MULTICAST_FULL syscall.Errno = 0x80340009 + ERROR_NDIS_MULTICAST_EXISTS syscall.Errno = 0x8034000A + ERROR_NDIS_MULTICAST_NOT_FOUND syscall.Errno = 0x8034000B + ERROR_NDIS_REQUEST_ABORTED syscall.Errno = 0x8034000C + ERROR_NDIS_RESET_IN_PROGRESS syscall.Errno = 0x8034000D + ERROR_NDIS_NOT_SUPPORTED syscall.Errno = 0x803400BB + ERROR_NDIS_INVALID_PACKET syscall.Errno = 0x8034000F + ERROR_NDIS_ADAPTER_NOT_READY syscall.Errno = 0x80340011 + ERROR_NDIS_INVALID_LENGTH syscall.Errno = 0x80340014 + ERROR_NDIS_INVALID_DATA syscall.Errno = 0x80340015 + ERROR_NDIS_BUFFER_TOO_SHORT syscall.Errno = 0x80340016 + ERROR_NDIS_INVALID_OID syscall.Errno = 0x80340017 + ERROR_NDIS_ADAPTER_REMOVED syscall.Errno = 0x80340018 + ERROR_NDIS_UNSUPPORTED_MEDIA syscall.Errno = 0x80340019 + ERROR_NDIS_GROUP_ADDRESS_IN_USE syscall.Errno = 0x8034001A + ERROR_NDIS_FILE_NOT_FOUND syscall.Errno = 0x8034001B + ERROR_NDIS_ERROR_READING_FILE syscall.Errno = 0x8034001C + ERROR_NDIS_ALREADY_MAPPED syscall.Errno = 0x8034001D + ERROR_NDIS_RESOURCE_CONFLICT syscall.Errno = 0x8034001E + ERROR_NDIS_MEDIA_DISCONNECTED syscall.Errno = 0x8034001F + ERROR_NDIS_INVALID_ADDRESS syscall.Errno = 0x80340022 + ERROR_NDIS_INVALID_DEVICE_REQUEST syscall.Errno = 0x80340010 + ERROR_NDIS_PAUSED syscall.Errno = 0x8034002A + ERROR_NDIS_INTERFACE_NOT_FOUND syscall.Errno = 0x8034002B + ERROR_NDIS_UNSUPPORTED_REVISION syscall.Errno = 0x8034002C + ERROR_NDIS_INVALID_PORT syscall.Errno = 0x8034002D + ERROR_NDIS_INVALID_PORT_STATE syscall.Errno = 0x8034002E + ERROR_NDIS_LOW_POWER_STATE syscall.Errno = 0x8034002F + ERROR_NDIS_REINIT_REQUIRED syscall.Errno = 0x80340030 + ERROR_NDIS_NO_QUEUES syscall.Errno = 0x80340031 + ERROR_NDIS_DOT11_AUTO_CONFIG_ENABLED syscall.Errno = 0x80342000 + ERROR_NDIS_DOT11_MEDIA_IN_USE syscall.Errno = 0x80342001 + ERROR_NDIS_DOT11_POWER_STATE_INVALID syscall.Errno = 0x80342002 + ERROR_NDIS_PM_WOL_PATTERN_LIST_FULL syscall.Errno = 0x80342003 + ERROR_NDIS_PM_PROTOCOL_OFFLOAD_LIST_FULL syscall.Errno = 0x80342004 + ERROR_NDIS_DOT11_AP_CHANNEL_CURRENTLY_NOT_AVAILABLE syscall.Errno = 0x80342005 + ERROR_NDIS_DOT11_AP_BAND_CURRENTLY_NOT_AVAILABLE syscall.Errno = 0x80342006 + ERROR_NDIS_DOT11_AP_CHANNEL_NOT_ALLOWED syscall.Errno = 0x80342007 + ERROR_NDIS_DOT11_AP_BAND_NOT_ALLOWED syscall.Errno = 0x80342008 + ERROR_NDIS_INDICATION_REQUIRED syscall.Errno = 0x00340001 + ERROR_NDIS_OFFLOAD_POLICY syscall.Errno = 0xC034100F + ERROR_NDIS_OFFLOAD_CONNECTION_REJECTED syscall.Errno = 0xC0341012 + ERROR_NDIS_OFFLOAD_PATH_REJECTED syscall.Errno = 0xC0341013 + ERROR_HV_INVALID_HYPERCALL_CODE syscall.Errno = 0xC0350002 + ERROR_HV_INVALID_HYPERCALL_INPUT syscall.Errno = 0xC0350003 + ERROR_HV_INVALID_ALIGNMENT syscall.Errno = 0xC0350004 + ERROR_HV_INVALID_PARAMETER syscall.Errno = 0xC0350005 + ERROR_HV_ACCESS_DENIED syscall.Errno = 0xC0350006 + ERROR_HV_INVALID_PARTITION_STATE syscall.Errno = 0xC0350007 + ERROR_HV_OPERATION_DENIED syscall.Errno = 0xC0350008 + ERROR_HV_UNKNOWN_PROPERTY syscall.Errno = 0xC0350009 + ERROR_HV_PROPERTY_VALUE_OUT_OF_RANGE syscall.Errno = 0xC035000A + ERROR_HV_INSUFFICIENT_MEMORY syscall.Errno = 0xC035000B + ERROR_HV_PARTITION_TOO_DEEP syscall.Errno = 0xC035000C + ERROR_HV_INVALID_PARTITION_ID syscall.Errno = 0xC035000D + ERROR_HV_INVALID_VP_INDEX syscall.Errno = 0xC035000E + ERROR_HV_INVALID_PORT_ID syscall.Errno = 0xC0350011 + ERROR_HV_INVALID_CONNECTION_ID syscall.Errno = 0xC0350012 + ERROR_HV_INSUFFICIENT_BUFFERS syscall.Errno = 0xC0350013 + ERROR_HV_NOT_ACKNOWLEDGED syscall.Errno = 0xC0350014 + ERROR_HV_INVALID_VP_STATE syscall.Errno = 0xC0350015 + ERROR_HV_ACKNOWLEDGED syscall.Errno = 0xC0350016 + ERROR_HV_INVALID_SAVE_RESTORE_STATE syscall.Errno = 0xC0350017 + ERROR_HV_INVALID_SYNIC_STATE syscall.Errno = 0xC0350018 + ERROR_HV_OBJECT_IN_USE syscall.Errno = 0xC0350019 + ERROR_HV_INVALID_PROXIMITY_DOMAIN_INFO syscall.Errno = 0xC035001A + ERROR_HV_NO_DATA syscall.Errno = 0xC035001B + ERROR_HV_INACTIVE syscall.Errno = 0xC035001C + ERROR_HV_NO_RESOURCES syscall.Errno = 0xC035001D + ERROR_HV_FEATURE_UNAVAILABLE syscall.Errno = 0xC035001E + ERROR_HV_INSUFFICIENT_BUFFER syscall.Errno = 0xC0350033 + ERROR_HV_INSUFFICIENT_DEVICE_DOMAINS syscall.Errno = 0xC0350038 + ERROR_HV_CPUID_FEATURE_VALIDATION syscall.Errno = 0xC035003C + ERROR_HV_CPUID_XSAVE_FEATURE_VALIDATION syscall.Errno = 0xC035003D + ERROR_HV_PROCESSOR_STARTUP_TIMEOUT syscall.Errno = 0xC035003E + ERROR_HV_SMX_ENABLED syscall.Errno = 0xC035003F + ERROR_HV_INVALID_LP_INDEX syscall.Errno = 0xC0350041 + ERROR_HV_INVALID_REGISTER_VALUE syscall.Errno = 0xC0350050 + ERROR_HV_INVALID_VTL_STATE syscall.Errno = 0xC0350051 + ERROR_HV_NX_NOT_DETECTED syscall.Errno = 0xC0350055 + ERROR_HV_INVALID_DEVICE_ID syscall.Errno = 0xC0350057 + ERROR_HV_INVALID_DEVICE_STATE syscall.Errno = 0xC0350058 + ERROR_HV_PENDING_PAGE_REQUESTS syscall.Errno = 0x00350059 + ERROR_HV_PAGE_REQUEST_INVALID syscall.Errno = 0xC0350060 + ERROR_HV_INVALID_CPU_GROUP_ID syscall.Errno = 0xC035006F + ERROR_HV_INVALID_CPU_GROUP_STATE syscall.Errno = 0xC0350070 + ERROR_HV_OPERATION_FAILED syscall.Errno = 0xC0350071 + ERROR_HV_NOT_ALLOWED_WITH_NESTED_VIRT_ACTIVE syscall.Errno = 0xC0350072 + ERROR_HV_INSUFFICIENT_ROOT_MEMORY syscall.Errno = 0xC0350073 + ERROR_HV_NOT_PRESENT syscall.Errno = 0xC0351000 + ERROR_VID_DUPLICATE_HANDLER syscall.Errno = 0xC0370001 + ERROR_VID_TOO_MANY_HANDLERS syscall.Errno = 0xC0370002 + ERROR_VID_QUEUE_FULL syscall.Errno = 0xC0370003 + ERROR_VID_HANDLER_NOT_PRESENT syscall.Errno = 0xC0370004 + ERROR_VID_INVALID_OBJECT_NAME syscall.Errno = 0xC0370005 + ERROR_VID_PARTITION_NAME_TOO_LONG syscall.Errno = 0xC0370006 + ERROR_VID_MESSAGE_QUEUE_NAME_TOO_LONG syscall.Errno = 0xC0370007 + ERROR_VID_PARTITION_ALREADY_EXISTS syscall.Errno = 0xC0370008 + ERROR_VID_PARTITION_DOES_NOT_EXIST syscall.Errno = 0xC0370009 + ERROR_VID_PARTITION_NAME_NOT_FOUND syscall.Errno = 0xC037000A + ERROR_VID_MESSAGE_QUEUE_ALREADY_EXISTS syscall.Errno = 0xC037000B + ERROR_VID_EXCEEDED_MBP_ENTRY_MAP_LIMIT syscall.Errno = 0xC037000C + ERROR_VID_MB_STILL_REFERENCED syscall.Errno = 0xC037000D + ERROR_VID_CHILD_GPA_PAGE_SET_CORRUPTED syscall.Errno = 0xC037000E + ERROR_VID_INVALID_NUMA_SETTINGS syscall.Errno = 0xC037000F + ERROR_VID_INVALID_NUMA_NODE_INDEX syscall.Errno = 0xC0370010 + ERROR_VID_NOTIFICATION_QUEUE_ALREADY_ASSOCIATED syscall.Errno = 0xC0370011 + ERROR_VID_INVALID_MEMORY_BLOCK_HANDLE syscall.Errno = 0xC0370012 + ERROR_VID_PAGE_RANGE_OVERFLOW syscall.Errno = 0xC0370013 + ERROR_VID_INVALID_MESSAGE_QUEUE_HANDLE syscall.Errno = 0xC0370014 + ERROR_VID_INVALID_GPA_RANGE_HANDLE syscall.Errno = 0xC0370015 + ERROR_VID_NO_MEMORY_BLOCK_NOTIFICATION_QUEUE syscall.Errno = 0xC0370016 + ERROR_VID_MEMORY_BLOCK_LOCK_COUNT_EXCEEDED syscall.Errno = 0xC0370017 + ERROR_VID_INVALID_PPM_HANDLE syscall.Errno = 0xC0370018 + ERROR_VID_MBPS_ARE_LOCKED syscall.Errno = 0xC0370019 + ERROR_VID_MESSAGE_QUEUE_CLOSED syscall.Errno = 0xC037001A + ERROR_VID_VIRTUAL_PROCESSOR_LIMIT_EXCEEDED syscall.Errno = 0xC037001B + ERROR_VID_STOP_PENDING syscall.Errno = 0xC037001C + ERROR_VID_INVALID_PROCESSOR_STATE syscall.Errno = 0xC037001D + ERROR_VID_EXCEEDED_KM_CONTEXT_COUNT_LIMIT syscall.Errno = 0xC037001E + ERROR_VID_KM_INTERFACE_ALREADY_INITIALIZED syscall.Errno = 0xC037001F + ERROR_VID_MB_PROPERTY_ALREADY_SET_RESET syscall.Errno = 0xC0370020 + ERROR_VID_MMIO_RANGE_DESTROYED syscall.Errno = 0xC0370021 + ERROR_VID_INVALID_CHILD_GPA_PAGE_SET syscall.Errno = 0xC0370022 + ERROR_VID_RESERVE_PAGE_SET_IS_BEING_USED syscall.Errno = 0xC0370023 + ERROR_VID_RESERVE_PAGE_SET_TOO_SMALL syscall.Errno = 0xC0370024 + ERROR_VID_MBP_ALREADY_LOCKED_USING_RESERVED_PAGE syscall.Errno = 0xC0370025 + ERROR_VID_MBP_COUNT_EXCEEDED_LIMIT syscall.Errno = 0xC0370026 + ERROR_VID_SAVED_STATE_CORRUPT syscall.Errno = 0xC0370027 + ERROR_VID_SAVED_STATE_UNRECOGNIZED_ITEM syscall.Errno = 0xC0370028 + ERROR_VID_SAVED_STATE_INCOMPATIBLE syscall.Errno = 0xC0370029 + ERROR_VID_VTL_ACCESS_DENIED syscall.Errno = 0xC037002A + ERROR_VMCOMPUTE_TERMINATED_DURING_START syscall.Errno = 0xC0370100 + ERROR_VMCOMPUTE_IMAGE_MISMATCH syscall.Errno = 0xC0370101 + ERROR_VMCOMPUTE_HYPERV_NOT_INSTALLED syscall.Errno = 0xC0370102 + ERROR_VMCOMPUTE_OPERATION_PENDING syscall.Errno = 0xC0370103 + ERROR_VMCOMPUTE_TOO_MANY_NOTIFICATIONS syscall.Errno = 0xC0370104 + ERROR_VMCOMPUTE_INVALID_STATE syscall.Errno = 0xC0370105 + ERROR_VMCOMPUTE_UNEXPECTED_EXIT syscall.Errno = 0xC0370106 + ERROR_VMCOMPUTE_TERMINATED syscall.Errno = 0xC0370107 + ERROR_VMCOMPUTE_CONNECT_FAILED syscall.Errno = 0xC0370108 + ERROR_VMCOMPUTE_TIMEOUT syscall.Errno = 0xC0370109 + ERROR_VMCOMPUTE_CONNECTION_CLOSED syscall.Errno = 0xC037010A + ERROR_VMCOMPUTE_UNKNOWN_MESSAGE syscall.Errno = 0xC037010B + ERROR_VMCOMPUTE_UNSUPPORTED_PROTOCOL_VERSION syscall.Errno = 0xC037010C + ERROR_VMCOMPUTE_INVALID_JSON syscall.Errno = 0xC037010D + ERROR_VMCOMPUTE_SYSTEM_NOT_FOUND syscall.Errno = 0xC037010E + ERROR_VMCOMPUTE_SYSTEM_ALREADY_EXISTS syscall.Errno = 0xC037010F + ERROR_VMCOMPUTE_SYSTEM_ALREADY_STOPPED syscall.Errno = 0xC0370110 + ERROR_VMCOMPUTE_PROTOCOL_ERROR syscall.Errno = 0xC0370111 + ERROR_VMCOMPUTE_INVALID_LAYER syscall.Errno = 0xC0370112 + ERROR_VMCOMPUTE_WINDOWS_INSIDER_REQUIRED syscall.Errno = 0xC0370113 + HCS_E_TERMINATED_DURING_START Handle = 0x80370100 + HCS_E_IMAGE_MISMATCH Handle = 0x80370101 + HCS_E_HYPERV_NOT_INSTALLED Handle = 0x80370102 + HCS_E_INVALID_STATE Handle = 0x80370105 + HCS_E_UNEXPECTED_EXIT Handle = 0x80370106 + HCS_E_TERMINATED Handle = 0x80370107 + HCS_E_CONNECT_FAILED Handle = 0x80370108 + HCS_E_CONNECTION_TIMEOUT Handle = 0x80370109 + HCS_E_CONNECTION_CLOSED Handle = 0x8037010A + HCS_E_UNKNOWN_MESSAGE Handle = 0x8037010B + HCS_E_UNSUPPORTED_PROTOCOL_VERSION Handle = 0x8037010C + HCS_E_INVALID_JSON Handle = 0x8037010D + HCS_E_SYSTEM_NOT_FOUND Handle = 0x8037010E + HCS_E_SYSTEM_ALREADY_EXISTS Handle = 0x8037010F + HCS_E_SYSTEM_ALREADY_STOPPED Handle = 0x80370110 + HCS_E_PROTOCOL_ERROR Handle = 0x80370111 + HCS_E_INVALID_LAYER Handle = 0x80370112 + HCS_E_WINDOWS_INSIDER_REQUIRED Handle = 0x80370113 + HCS_E_SERVICE_NOT_AVAILABLE Handle = 0x80370114 + HCS_E_OPERATION_NOT_STARTED Handle = 0x80370115 + HCS_E_OPERATION_ALREADY_STARTED Handle = 0x80370116 + HCS_E_OPERATION_PENDING Handle = 0x80370117 + HCS_E_OPERATION_TIMEOUT Handle = 0x80370118 + HCS_E_OPERATION_SYSTEM_CALLBACK_ALREADY_SET Handle = 0x80370119 + HCS_E_OPERATION_RESULT_ALLOCATION_FAILED Handle = 0x8037011A + HCS_E_ACCESS_DENIED Handle = 0x8037011B + HCS_E_GUEST_CRITICAL_ERROR Handle = 0x8037011C + ERROR_VNET_VIRTUAL_SWITCH_NAME_NOT_FOUND syscall.Errno = 0xC0370200 + ERROR_VID_REMOTE_NODE_PARENT_GPA_PAGES_USED syscall.Errno = 0x80370001 + WHV_E_UNKNOWN_CAPABILITY Handle = 0x80370300 + WHV_E_INSUFFICIENT_BUFFER Handle = 0x80370301 + WHV_E_UNKNOWN_PROPERTY Handle = 0x80370302 + WHV_E_UNSUPPORTED_HYPERVISOR_CONFIG Handle = 0x80370303 + WHV_E_INVALID_PARTITION_CONFIG Handle = 0x80370304 + WHV_E_GPA_RANGE_NOT_FOUND Handle = 0x80370305 + WHV_E_VP_ALREADY_EXISTS Handle = 0x80370306 + WHV_E_VP_DOES_NOT_EXIST Handle = 0x80370307 + WHV_E_INVALID_VP_STATE Handle = 0x80370308 + WHV_E_INVALID_VP_REGISTER_NAME Handle = 0x80370309 + ERROR_VSMB_SAVED_STATE_FILE_NOT_FOUND syscall.Errno = 0xC0370400 + ERROR_VSMB_SAVED_STATE_CORRUPT syscall.Errno = 0xC0370401 + ERROR_VOLMGR_INCOMPLETE_REGENERATION syscall.Errno = 0x80380001 + ERROR_VOLMGR_INCOMPLETE_DISK_MIGRATION syscall.Errno = 0x80380002 + ERROR_VOLMGR_DATABASE_FULL syscall.Errno = 0xC0380001 + ERROR_VOLMGR_DISK_CONFIGURATION_CORRUPTED syscall.Errno = 0xC0380002 + ERROR_VOLMGR_DISK_CONFIGURATION_NOT_IN_SYNC syscall.Errno = 0xC0380003 + ERROR_VOLMGR_PACK_CONFIG_UPDATE_FAILED syscall.Errno = 0xC0380004 + ERROR_VOLMGR_DISK_CONTAINS_NON_SIMPLE_VOLUME syscall.Errno = 0xC0380005 + ERROR_VOLMGR_DISK_DUPLICATE syscall.Errno = 0xC0380006 + ERROR_VOLMGR_DISK_DYNAMIC syscall.Errno = 0xC0380007 + ERROR_VOLMGR_DISK_ID_INVALID syscall.Errno = 0xC0380008 + ERROR_VOLMGR_DISK_INVALID syscall.Errno = 0xC0380009 + ERROR_VOLMGR_DISK_LAST_VOTER syscall.Errno = 0xC038000A + ERROR_VOLMGR_DISK_LAYOUT_INVALID syscall.Errno = 0xC038000B + ERROR_VOLMGR_DISK_LAYOUT_NON_BASIC_BETWEEN_BASIC_PARTITIONS syscall.Errno = 0xC038000C + ERROR_VOLMGR_DISK_LAYOUT_NOT_CYLINDER_ALIGNED syscall.Errno = 0xC038000D + ERROR_VOLMGR_DISK_LAYOUT_PARTITIONS_TOO_SMALL syscall.Errno = 0xC038000E + ERROR_VOLMGR_DISK_LAYOUT_PRIMARY_BETWEEN_LOGICAL_PARTITIONS syscall.Errno = 0xC038000F + ERROR_VOLMGR_DISK_LAYOUT_TOO_MANY_PARTITIONS syscall.Errno = 0xC0380010 + ERROR_VOLMGR_DISK_MISSING syscall.Errno = 0xC0380011 + ERROR_VOLMGR_DISK_NOT_EMPTY syscall.Errno = 0xC0380012 + ERROR_VOLMGR_DISK_NOT_ENOUGH_SPACE syscall.Errno = 0xC0380013 + ERROR_VOLMGR_DISK_REVECTORING_FAILED syscall.Errno = 0xC0380014 + ERROR_VOLMGR_DISK_SECTOR_SIZE_INVALID syscall.Errno = 0xC0380015 + ERROR_VOLMGR_DISK_SET_NOT_CONTAINED syscall.Errno = 0xC0380016 + ERROR_VOLMGR_DISK_USED_BY_MULTIPLE_MEMBERS syscall.Errno = 0xC0380017 + ERROR_VOLMGR_DISK_USED_BY_MULTIPLE_PLEXES syscall.Errno = 0xC0380018 + ERROR_VOLMGR_DYNAMIC_DISK_NOT_SUPPORTED syscall.Errno = 0xC0380019 + ERROR_VOLMGR_EXTENT_ALREADY_USED syscall.Errno = 0xC038001A + ERROR_VOLMGR_EXTENT_NOT_CONTIGUOUS syscall.Errno = 0xC038001B + ERROR_VOLMGR_EXTENT_NOT_IN_PUBLIC_REGION syscall.Errno = 0xC038001C + ERROR_VOLMGR_EXTENT_NOT_SECTOR_ALIGNED syscall.Errno = 0xC038001D + ERROR_VOLMGR_EXTENT_OVERLAPS_EBR_PARTITION syscall.Errno = 0xC038001E + ERROR_VOLMGR_EXTENT_VOLUME_LENGTHS_DO_NOT_MATCH syscall.Errno = 0xC038001F + ERROR_VOLMGR_FAULT_TOLERANT_NOT_SUPPORTED syscall.Errno = 0xC0380020 + ERROR_VOLMGR_INTERLEAVE_LENGTH_INVALID syscall.Errno = 0xC0380021 + ERROR_VOLMGR_MAXIMUM_REGISTERED_USERS syscall.Errno = 0xC0380022 + ERROR_VOLMGR_MEMBER_IN_SYNC syscall.Errno = 0xC0380023 + ERROR_VOLMGR_MEMBER_INDEX_DUPLICATE syscall.Errno = 0xC0380024 + ERROR_VOLMGR_MEMBER_INDEX_INVALID syscall.Errno = 0xC0380025 + ERROR_VOLMGR_MEMBER_MISSING syscall.Errno = 0xC0380026 + ERROR_VOLMGR_MEMBER_NOT_DETACHED syscall.Errno = 0xC0380027 + ERROR_VOLMGR_MEMBER_REGENERATING syscall.Errno = 0xC0380028 + ERROR_VOLMGR_ALL_DISKS_FAILED syscall.Errno = 0xC0380029 + ERROR_VOLMGR_NO_REGISTERED_USERS syscall.Errno = 0xC038002A + ERROR_VOLMGR_NO_SUCH_USER syscall.Errno = 0xC038002B + ERROR_VOLMGR_NOTIFICATION_RESET syscall.Errno = 0xC038002C + ERROR_VOLMGR_NUMBER_OF_MEMBERS_INVALID syscall.Errno = 0xC038002D + ERROR_VOLMGR_NUMBER_OF_PLEXES_INVALID syscall.Errno = 0xC038002E + ERROR_VOLMGR_PACK_DUPLICATE syscall.Errno = 0xC038002F + ERROR_VOLMGR_PACK_ID_INVALID syscall.Errno = 0xC0380030 + ERROR_VOLMGR_PACK_INVALID syscall.Errno = 0xC0380031 + ERROR_VOLMGR_PACK_NAME_INVALID syscall.Errno = 0xC0380032 + ERROR_VOLMGR_PACK_OFFLINE syscall.Errno = 0xC0380033 + ERROR_VOLMGR_PACK_HAS_QUORUM syscall.Errno = 0xC0380034 + ERROR_VOLMGR_PACK_WITHOUT_QUORUM syscall.Errno = 0xC0380035 + ERROR_VOLMGR_PARTITION_STYLE_INVALID syscall.Errno = 0xC0380036 + ERROR_VOLMGR_PARTITION_UPDATE_FAILED syscall.Errno = 0xC0380037 + ERROR_VOLMGR_PLEX_IN_SYNC syscall.Errno = 0xC0380038 + ERROR_VOLMGR_PLEX_INDEX_DUPLICATE syscall.Errno = 0xC0380039 + ERROR_VOLMGR_PLEX_INDEX_INVALID syscall.Errno = 0xC038003A + ERROR_VOLMGR_PLEX_LAST_ACTIVE syscall.Errno = 0xC038003B + ERROR_VOLMGR_PLEX_MISSING syscall.Errno = 0xC038003C + ERROR_VOLMGR_PLEX_REGENERATING syscall.Errno = 0xC038003D + ERROR_VOLMGR_PLEX_TYPE_INVALID syscall.Errno = 0xC038003E + ERROR_VOLMGR_PLEX_NOT_RAID5 syscall.Errno = 0xC038003F + ERROR_VOLMGR_PLEX_NOT_SIMPLE syscall.Errno = 0xC0380040 + ERROR_VOLMGR_STRUCTURE_SIZE_INVALID syscall.Errno = 0xC0380041 + ERROR_VOLMGR_TOO_MANY_NOTIFICATION_REQUESTS syscall.Errno = 0xC0380042 + ERROR_VOLMGR_TRANSACTION_IN_PROGRESS syscall.Errno = 0xC0380043 + ERROR_VOLMGR_UNEXPECTED_DISK_LAYOUT_CHANGE syscall.Errno = 0xC0380044 + ERROR_VOLMGR_VOLUME_CONTAINS_MISSING_DISK syscall.Errno = 0xC0380045 + ERROR_VOLMGR_VOLUME_ID_INVALID syscall.Errno = 0xC0380046 + ERROR_VOLMGR_VOLUME_LENGTH_INVALID syscall.Errno = 0xC0380047 + ERROR_VOLMGR_VOLUME_LENGTH_NOT_SECTOR_SIZE_MULTIPLE syscall.Errno = 0xC0380048 + ERROR_VOLMGR_VOLUME_NOT_MIRRORED syscall.Errno = 0xC0380049 + ERROR_VOLMGR_VOLUME_NOT_RETAINED syscall.Errno = 0xC038004A + ERROR_VOLMGR_VOLUME_OFFLINE syscall.Errno = 0xC038004B + ERROR_VOLMGR_VOLUME_RETAINED syscall.Errno = 0xC038004C + ERROR_VOLMGR_NUMBER_OF_EXTENTS_INVALID syscall.Errno = 0xC038004D + ERROR_VOLMGR_DIFFERENT_SECTOR_SIZE syscall.Errno = 0xC038004E + ERROR_VOLMGR_BAD_BOOT_DISK syscall.Errno = 0xC038004F + ERROR_VOLMGR_PACK_CONFIG_OFFLINE syscall.Errno = 0xC0380050 + ERROR_VOLMGR_PACK_CONFIG_ONLINE syscall.Errno = 0xC0380051 + ERROR_VOLMGR_NOT_PRIMARY_PACK syscall.Errno = 0xC0380052 + ERROR_VOLMGR_PACK_LOG_UPDATE_FAILED syscall.Errno = 0xC0380053 + ERROR_VOLMGR_NUMBER_OF_DISKS_IN_PLEX_INVALID syscall.Errno = 0xC0380054 + ERROR_VOLMGR_NUMBER_OF_DISKS_IN_MEMBER_INVALID syscall.Errno = 0xC0380055 + ERROR_VOLMGR_VOLUME_MIRRORED syscall.Errno = 0xC0380056 + ERROR_VOLMGR_PLEX_NOT_SIMPLE_SPANNED syscall.Errno = 0xC0380057 + ERROR_VOLMGR_NO_VALID_LOG_COPIES syscall.Errno = 0xC0380058 + ERROR_VOLMGR_PRIMARY_PACK_PRESENT syscall.Errno = 0xC0380059 + ERROR_VOLMGR_NUMBER_OF_DISKS_INVALID syscall.Errno = 0xC038005A + ERROR_VOLMGR_MIRROR_NOT_SUPPORTED syscall.Errno = 0xC038005B + ERROR_VOLMGR_RAID5_NOT_SUPPORTED syscall.Errno = 0xC038005C + ERROR_BCD_NOT_ALL_ENTRIES_IMPORTED syscall.Errno = 0x80390001 + ERROR_BCD_TOO_MANY_ELEMENTS syscall.Errno = 0xC0390002 + ERROR_BCD_NOT_ALL_ENTRIES_SYNCHRONIZED syscall.Errno = 0x80390003 + ERROR_VHD_DRIVE_FOOTER_MISSING syscall.Errno = 0xC03A0001 + ERROR_VHD_DRIVE_FOOTER_CHECKSUM_MISMATCH syscall.Errno = 0xC03A0002 + ERROR_VHD_DRIVE_FOOTER_CORRUPT syscall.Errno = 0xC03A0003 + ERROR_VHD_FORMAT_UNKNOWN syscall.Errno = 0xC03A0004 + ERROR_VHD_FORMAT_UNSUPPORTED_VERSION syscall.Errno = 0xC03A0005 + ERROR_VHD_SPARSE_HEADER_CHECKSUM_MISMATCH syscall.Errno = 0xC03A0006 + ERROR_VHD_SPARSE_HEADER_UNSUPPORTED_VERSION syscall.Errno = 0xC03A0007 + ERROR_VHD_SPARSE_HEADER_CORRUPT syscall.Errno = 0xC03A0008 + ERROR_VHD_BLOCK_ALLOCATION_FAILURE syscall.Errno = 0xC03A0009 + ERROR_VHD_BLOCK_ALLOCATION_TABLE_CORRUPT syscall.Errno = 0xC03A000A + ERROR_VHD_INVALID_BLOCK_SIZE syscall.Errno = 0xC03A000B + ERROR_VHD_BITMAP_MISMATCH syscall.Errno = 0xC03A000C + ERROR_VHD_PARENT_VHD_NOT_FOUND syscall.Errno = 0xC03A000D + ERROR_VHD_CHILD_PARENT_ID_MISMATCH syscall.Errno = 0xC03A000E + ERROR_VHD_CHILD_PARENT_TIMESTAMP_MISMATCH syscall.Errno = 0xC03A000F + ERROR_VHD_METADATA_READ_FAILURE syscall.Errno = 0xC03A0010 + ERROR_VHD_METADATA_WRITE_FAILURE syscall.Errno = 0xC03A0011 + ERROR_VHD_INVALID_SIZE syscall.Errno = 0xC03A0012 + ERROR_VHD_INVALID_FILE_SIZE syscall.Errno = 0xC03A0013 + ERROR_VIRTDISK_PROVIDER_NOT_FOUND syscall.Errno = 0xC03A0014 + ERROR_VIRTDISK_NOT_VIRTUAL_DISK syscall.Errno = 0xC03A0015 + ERROR_VHD_PARENT_VHD_ACCESS_DENIED syscall.Errno = 0xC03A0016 + ERROR_VHD_CHILD_PARENT_SIZE_MISMATCH syscall.Errno = 0xC03A0017 + ERROR_VHD_DIFFERENCING_CHAIN_CYCLE_DETECTED syscall.Errno = 0xC03A0018 + ERROR_VHD_DIFFERENCING_CHAIN_ERROR_IN_PARENT syscall.Errno = 0xC03A0019 + ERROR_VIRTUAL_DISK_LIMITATION syscall.Errno = 0xC03A001A + ERROR_VHD_INVALID_TYPE syscall.Errno = 0xC03A001B + ERROR_VHD_INVALID_STATE syscall.Errno = 0xC03A001C + ERROR_VIRTDISK_UNSUPPORTED_DISK_SECTOR_SIZE syscall.Errno = 0xC03A001D + ERROR_VIRTDISK_DISK_ALREADY_OWNED syscall.Errno = 0xC03A001E + ERROR_VIRTDISK_DISK_ONLINE_AND_WRITABLE syscall.Errno = 0xC03A001F + ERROR_CTLOG_TRACKING_NOT_INITIALIZED syscall.Errno = 0xC03A0020 + ERROR_CTLOG_LOGFILE_SIZE_EXCEEDED_MAXSIZE syscall.Errno = 0xC03A0021 + ERROR_CTLOG_VHD_CHANGED_OFFLINE syscall.Errno = 0xC03A0022 + ERROR_CTLOG_INVALID_TRACKING_STATE syscall.Errno = 0xC03A0023 + ERROR_CTLOG_INCONSISTENT_TRACKING_FILE syscall.Errno = 0xC03A0024 + ERROR_VHD_RESIZE_WOULD_TRUNCATE_DATA syscall.Errno = 0xC03A0025 + ERROR_VHD_COULD_NOT_COMPUTE_MINIMUM_VIRTUAL_SIZE syscall.Errno = 0xC03A0026 + ERROR_VHD_ALREADY_AT_OR_BELOW_MINIMUM_VIRTUAL_SIZE syscall.Errno = 0xC03A0027 + ERROR_VHD_METADATA_FULL syscall.Errno = 0xC03A0028 + ERROR_VHD_INVALID_CHANGE_TRACKING_ID syscall.Errno = 0xC03A0029 + ERROR_VHD_CHANGE_TRACKING_DISABLED syscall.Errno = 0xC03A002A + ERROR_VHD_MISSING_CHANGE_TRACKING_INFORMATION syscall.Errno = 0xC03A0030 + ERROR_QUERY_STORAGE_ERROR syscall.Errno = 0x803A0001 + HCN_E_NETWORK_NOT_FOUND Handle = 0x803B0001 + HCN_E_ENDPOINT_NOT_FOUND Handle = 0x803B0002 + HCN_E_LAYER_NOT_FOUND Handle = 0x803B0003 + HCN_E_SWITCH_NOT_FOUND Handle = 0x803B0004 + HCN_E_SUBNET_NOT_FOUND Handle = 0x803B0005 + HCN_E_ADAPTER_NOT_FOUND Handle = 0x803B0006 + HCN_E_PORT_NOT_FOUND Handle = 0x803B0007 + HCN_E_POLICY_NOT_FOUND Handle = 0x803B0008 + HCN_E_VFP_PORTSETTING_NOT_FOUND Handle = 0x803B0009 + HCN_E_INVALID_NETWORK Handle = 0x803B000A + HCN_E_INVALID_NETWORK_TYPE Handle = 0x803B000B + HCN_E_INVALID_ENDPOINT Handle = 0x803B000C + HCN_E_INVALID_POLICY Handle = 0x803B000D + HCN_E_INVALID_POLICY_TYPE Handle = 0x803B000E + HCN_E_INVALID_REMOTE_ENDPOINT_OPERATION Handle = 0x803B000F + HCN_E_NETWORK_ALREADY_EXISTS Handle = 0x803B0010 + HCN_E_LAYER_ALREADY_EXISTS Handle = 0x803B0011 + HCN_E_POLICY_ALREADY_EXISTS Handle = 0x803B0012 + HCN_E_PORT_ALREADY_EXISTS Handle = 0x803B0013 + HCN_E_ENDPOINT_ALREADY_ATTACHED Handle = 0x803B0014 + HCN_E_REQUEST_UNSUPPORTED Handle = 0x803B0015 + HCN_E_MAPPING_NOT_SUPPORTED Handle = 0x803B0016 + HCN_E_DEGRADED_OPERATION Handle = 0x803B0017 + HCN_E_SHARED_SWITCH_MODIFICATION Handle = 0x803B0018 + HCN_E_GUID_CONVERSION_FAILURE Handle = 0x803B0019 + HCN_E_REGKEY_FAILURE Handle = 0x803B001A + HCN_E_INVALID_JSON Handle = 0x803B001B + HCN_E_INVALID_JSON_REFERENCE Handle = 0x803B001C + HCN_E_ENDPOINT_SHARING_DISABLED Handle = 0x803B001D + HCN_E_INVALID_IP Handle = 0x803B001E + HCN_E_SWITCH_EXTENSION_NOT_FOUND Handle = 0x803B001F + HCN_E_MANAGER_STOPPED Handle = 0x803B0020 + GCN_E_MODULE_NOT_FOUND Handle = 0x803B0021 + GCN_E_NO_REQUEST_HANDLERS Handle = 0x803B0022 + GCN_E_REQUEST_UNSUPPORTED Handle = 0x803B0023 + GCN_E_RUNTIMEKEYS_FAILED Handle = 0x803B0024 + GCN_E_NETADAPTER_TIMEOUT Handle = 0x803B0025 + GCN_E_NETADAPTER_NOT_FOUND Handle = 0x803B0026 + GCN_E_NETCOMPARTMENT_NOT_FOUND Handle = 0x803B0027 + GCN_E_NETINTERFACE_NOT_FOUND Handle = 0x803B0028 + GCN_E_DEFAULTNAMESPACE_EXISTS Handle = 0x803B0029 + HCN_E_ICS_DISABLED Handle = 0x803B002A + HCN_E_ENDPOINT_NAMESPACE_ALREADY_EXISTS Handle = 0x803B002B + HCN_E_ENTITY_HAS_REFERENCES Handle = 0x803B002C + HCN_E_INVALID_INTERNAL_PORT Handle = 0x803B002D + HCN_E_NAMESPACE_ATTACH_FAILED Handle = 0x803B002E + HCN_E_ADDR_INVALID_OR_RESERVED Handle = 0x803B002F + SDIAG_E_CANCELLED syscall.Errno = 0x803C0100 + SDIAG_E_SCRIPT syscall.Errno = 0x803C0101 + SDIAG_E_POWERSHELL syscall.Errno = 0x803C0102 + SDIAG_E_MANAGEDHOST syscall.Errno = 0x803C0103 + SDIAG_E_NOVERIFIER syscall.Errno = 0x803C0104 + SDIAG_S_CANNOTRUN syscall.Errno = 0x003C0105 + SDIAG_E_DISABLED syscall.Errno = 0x803C0106 + SDIAG_E_TRUST syscall.Errno = 0x803C0107 + SDIAG_E_CANNOTRUN syscall.Errno = 0x803C0108 + SDIAG_E_VERSION syscall.Errno = 0x803C0109 + SDIAG_E_RESOURCE syscall.Errno = 0x803C010A + SDIAG_E_ROOTCAUSE syscall.Errno = 0x803C010B + WPN_E_CHANNEL_CLOSED Handle = 0x803E0100 + WPN_E_CHANNEL_REQUEST_NOT_COMPLETE Handle = 0x803E0101 + WPN_E_INVALID_APP Handle = 0x803E0102 + WPN_E_OUTSTANDING_CHANNEL_REQUEST Handle = 0x803E0103 + WPN_E_DUPLICATE_CHANNEL Handle = 0x803E0104 + WPN_E_PLATFORM_UNAVAILABLE Handle = 0x803E0105 + WPN_E_NOTIFICATION_POSTED Handle = 0x803E0106 + WPN_E_NOTIFICATION_HIDDEN Handle = 0x803E0107 + WPN_E_NOTIFICATION_NOT_POSTED Handle = 0x803E0108 + WPN_E_CLOUD_DISABLED Handle = 0x803E0109 + WPN_E_CLOUD_INCAPABLE Handle = 0x803E0110 + WPN_E_CLOUD_AUTH_UNAVAILABLE Handle = 0x803E011A + WPN_E_CLOUD_SERVICE_UNAVAILABLE Handle = 0x803E011B + WPN_E_FAILED_LOCK_SCREEN_UPDATE_INTIALIZATION Handle = 0x803E011C + WPN_E_NOTIFICATION_DISABLED Handle = 0x803E0111 + WPN_E_NOTIFICATION_INCAPABLE Handle = 0x803E0112 + WPN_E_INTERNET_INCAPABLE Handle = 0x803E0113 + WPN_E_NOTIFICATION_TYPE_DISABLED Handle = 0x803E0114 + WPN_E_NOTIFICATION_SIZE Handle = 0x803E0115 + WPN_E_TAG_SIZE Handle = 0x803E0116 + WPN_E_ACCESS_DENIED Handle = 0x803E0117 + WPN_E_DUPLICATE_REGISTRATION Handle = 0x803E0118 + WPN_E_PUSH_NOTIFICATION_INCAPABLE Handle = 0x803E0119 + WPN_E_DEV_ID_SIZE Handle = 0x803E0120 + WPN_E_TAG_ALPHANUMERIC Handle = 0x803E012A + WPN_E_INVALID_HTTP_STATUS_CODE Handle = 0x803E012B + WPN_E_OUT_OF_SESSION Handle = 0x803E0200 + WPN_E_POWER_SAVE Handle = 0x803E0201 + WPN_E_IMAGE_NOT_FOUND_IN_CACHE Handle = 0x803E0202 + WPN_E_ALL_URL_NOT_COMPLETED Handle = 0x803E0203 + WPN_E_INVALID_CLOUD_IMAGE Handle = 0x803E0204 + WPN_E_NOTIFICATION_ID_MATCHED Handle = 0x803E0205 + WPN_E_CALLBACK_ALREADY_REGISTERED Handle = 0x803E0206 + WPN_E_TOAST_NOTIFICATION_DROPPED Handle = 0x803E0207 + WPN_E_STORAGE_LOCKED Handle = 0x803E0208 + WPN_E_GROUP_SIZE Handle = 0x803E0209 + WPN_E_GROUP_ALPHANUMERIC Handle = 0x803E020A + WPN_E_CLOUD_DISABLED_FOR_APP Handle = 0x803E020B + E_MBN_CONTEXT_NOT_ACTIVATED Handle = 0x80548201 + E_MBN_BAD_SIM Handle = 0x80548202 + E_MBN_DATA_CLASS_NOT_AVAILABLE Handle = 0x80548203 + E_MBN_INVALID_ACCESS_STRING Handle = 0x80548204 + E_MBN_MAX_ACTIVATED_CONTEXTS Handle = 0x80548205 + E_MBN_PACKET_SVC_DETACHED Handle = 0x80548206 + E_MBN_PROVIDER_NOT_VISIBLE Handle = 0x80548207 + E_MBN_RADIO_POWER_OFF Handle = 0x80548208 + E_MBN_SERVICE_NOT_ACTIVATED Handle = 0x80548209 + E_MBN_SIM_NOT_INSERTED Handle = 0x8054820A + E_MBN_VOICE_CALL_IN_PROGRESS Handle = 0x8054820B + E_MBN_INVALID_CACHE Handle = 0x8054820C + E_MBN_NOT_REGISTERED Handle = 0x8054820D + E_MBN_PROVIDERS_NOT_FOUND Handle = 0x8054820E + E_MBN_PIN_NOT_SUPPORTED Handle = 0x8054820F + E_MBN_PIN_REQUIRED Handle = 0x80548210 + E_MBN_PIN_DISABLED Handle = 0x80548211 + E_MBN_FAILURE Handle = 0x80548212 + E_MBN_INVALID_PROFILE Handle = 0x80548218 + E_MBN_DEFAULT_PROFILE_EXIST Handle = 0x80548219 + E_MBN_SMS_ENCODING_NOT_SUPPORTED Handle = 0x80548220 + E_MBN_SMS_FILTER_NOT_SUPPORTED Handle = 0x80548221 + E_MBN_SMS_INVALID_MEMORY_INDEX Handle = 0x80548222 + E_MBN_SMS_LANG_NOT_SUPPORTED Handle = 0x80548223 + E_MBN_SMS_MEMORY_FAILURE Handle = 0x80548224 + E_MBN_SMS_NETWORK_TIMEOUT Handle = 0x80548225 + E_MBN_SMS_UNKNOWN_SMSC_ADDRESS Handle = 0x80548226 + E_MBN_SMS_FORMAT_NOT_SUPPORTED Handle = 0x80548227 + E_MBN_SMS_OPERATION_NOT_ALLOWED Handle = 0x80548228 + E_MBN_SMS_MEMORY_FULL Handle = 0x80548229 + PEER_E_IPV6_NOT_INSTALLED Handle = 0x80630001 + PEER_E_NOT_INITIALIZED Handle = 0x80630002 + PEER_E_CANNOT_START_SERVICE Handle = 0x80630003 + PEER_E_NOT_LICENSED Handle = 0x80630004 + PEER_E_INVALID_GRAPH Handle = 0x80630010 + PEER_E_DBNAME_CHANGED Handle = 0x80630011 + PEER_E_DUPLICATE_GRAPH Handle = 0x80630012 + PEER_E_GRAPH_NOT_READY Handle = 0x80630013 + PEER_E_GRAPH_SHUTTING_DOWN Handle = 0x80630014 + PEER_E_GRAPH_IN_USE Handle = 0x80630015 + PEER_E_INVALID_DATABASE Handle = 0x80630016 + PEER_E_TOO_MANY_ATTRIBUTES Handle = 0x80630017 + PEER_E_CONNECTION_NOT_FOUND Handle = 0x80630103 + PEER_E_CONNECT_SELF Handle = 0x80630106 + PEER_E_ALREADY_LISTENING Handle = 0x80630107 + PEER_E_NODE_NOT_FOUND Handle = 0x80630108 + PEER_E_CONNECTION_FAILED Handle = 0x80630109 + PEER_E_CONNECTION_NOT_AUTHENTICATED Handle = 0x8063010A + PEER_E_CONNECTION_REFUSED Handle = 0x8063010B + PEER_E_CLASSIFIER_TOO_LONG Handle = 0x80630201 + PEER_E_TOO_MANY_IDENTITIES Handle = 0x80630202 + PEER_E_NO_KEY_ACCESS Handle = 0x80630203 + PEER_E_GROUPS_EXIST Handle = 0x80630204 + PEER_E_RECORD_NOT_FOUND Handle = 0x80630301 + PEER_E_DATABASE_ACCESSDENIED Handle = 0x80630302 + PEER_E_DBINITIALIZATION_FAILED Handle = 0x80630303 + PEER_E_MAX_RECORD_SIZE_EXCEEDED Handle = 0x80630304 + PEER_E_DATABASE_ALREADY_PRESENT Handle = 0x80630305 + PEER_E_DATABASE_NOT_PRESENT Handle = 0x80630306 + PEER_E_IDENTITY_NOT_FOUND Handle = 0x80630401 + PEER_E_EVENT_HANDLE_NOT_FOUND Handle = 0x80630501 + PEER_E_INVALID_SEARCH Handle = 0x80630601 + PEER_E_INVALID_ATTRIBUTES Handle = 0x80630602 + PEER_E_INVITATION_NOT_TRUSTED Handle = 0x80630701 + PEER_E_CHAIN_TOO_LONG Handle = 0x80630703 + PEER_E_INVALID_TIME_PERIOD Handle = 0x80630705 + PEER_E_CIRCULAR_CHAIN_DETECTED Handle = 0x80630706 + PEER_E_CERT_STORE_CORRUPTED Handle = 0x80630801 + PEER_E_NO_CLOUD Handle = 0x80631001 + PEER_E_CLOUD_NAME_AMBIGUOUS Handle = 0x80631005 + PEER_E_INVALID_RECORD Handle = 0x80632010 + PEER_E_NOT_AUTHORIZED Handle = 0x80632020 + PEER_E_PASSWORD_DOES_NOT_MEET_POLICY Handle = 0x80632021 + PEER_E_DEFERRED_VALIDATION Handle = 0x80632030 + PEER_E_INVALID_GROUP_PROPERTIES Handle = 0x80632040 + PEER_E_INVALID_PEER_NAME Handle = 0x80632050 + PEER_E_INVALID_CLASSIFIER Handle = 0x80632060 + PEER_E_INVALID_FRIENDLY_NAME Handle = 0x80632070 + PEER_E_INVALID_ROLE_PROPERTY Handle = 0x80632071 + PEER_E_INVALID_CLASSIFIER_PROPERTY Handle = 0x80632072 + PEER_E_INVALID_RECORD_EXPIRATION Handle = 0x80632080 + PEER_E_INVALID_CREDENTIAL_INFO Handle = 0x80632081 + PEER_E_INVALID_CREDENTIAL Handle = 0x80632082 + PEER_E_INVALID_RECORD_SIZE Handle = 0x80632083 + PEER_E_UNSUPPORTED_VERSION Handle = 0x80632090 + PEER_E_GROUP_NOT_READY Handle = 0x80632091 + PEER_E_GROUP_IN_USE Handle = 0x80632092 + PEER_E_INVALID_GROUP Handle = 0x80632093 + PEER_E_NO_MEMBERS_FOUND Handle = 0x80632094 + PEER_E_NO_MEMBER_CONNECTIONS Handle = 0x80632095 + PEER_E_UNABLE_TO_LISTEN Handle = 0x80632096 + PEER_E_IDENTITY_DELETED Handle = 0x806320A0 + PEER_E_SERVICE_NOT_AVAILABLE Handle = 0x806320A1 + PEER_E_CONTACT_NOT_FOUND Handle = 0x80636001 + PEER_S_GRAPH_DATA_CREATED Handle = 0x00630001 + PEER_S_NO_EVENT_DATA Handle = 0x00630002 + PEER_S_ALREADY_CONNECTED Handle = 0x00632000 + PEER_S_SUBSCRIPTION_EXISTS Handle = 0x00636000 + PEER_S_NO_CONNECTIVITY Handle = 0x00630005 + PEER_S_ALREADY_A_MEMBER Handle = 0x00630006 + PEER_E_CANNOT_CONVERT_PEER_NAME Handle = 0x80634001 + PEER_E_INVALID_PEER_HOST_NAME Handle = 0x80634002 + PEER_E_NO_MORE Handle = 0x80634003 + PEER_E_PNRP_DUPLICATE_PEER_NAME Handle = 0x80634005 + PEER_E_INVITE_CANCELLED Handle = 0x80637000 + PEER_E_INVITE_RESPONSE_NOT_AVAILABLE Handle = 0x80637001 + PEER_E_NOT_SIGNED_IN Handle = 0x80637003 + PEER_E_PRIVACY_DECLINED Handle = 0x80637004 + PEER_E_TIMEOUT Handle = 0x80637005 + PEER_E_INVALID_ADDRESS Handle = 0x80637007 + PEER_E_FW_EXCEPTION_DISABLED Handle = 0x80637008 + PEER_E_FW_BLOCKED_BY_POLICY Handle = 0x80637009 + PEER_E_FW_BLOCKED_BY_SHIELDS_UP Handle = 0x8063700A + PEER_E_FW_DECLINED Handle = 0x8063700B + UI_E_CREATE_FAILED Handle = 0x802A0001 + UI_E_SHUTDOWN_CALLED Handle = 0x802A0002 + UI_E_ILLEGAL_REENTRANCY Handle = 0x802A0003 + UI_E_OBJECT_SEALED Handle = 0x802A0004 + UI_E_VALUE_NOT_SET Handle = 0x802A0005 + UI_E_VALUE_NOT_DETERMINED Handle = 0x802A0006 + UI_E_INVALID_OUTPUT Handle = 0x802A0007 + UI_E_BOOLEAN_EXPECTED Handle = 0x802A0008 + UI_E_DIFFERENT_OWNER Handle = 0x802A0009 + UI_E_AMBIGUOUS_MATCH Handle = 0x802A000A + UI_E_FP_OVERFLOW Handle = 0x802A000B + UI_E_WRONG_THREAD Handle = 0x802A000C + UI_E_STORYBOARD_ACTIVE Handle = 0x802A0101 + UI_E_STORYBOARD_NOT_PLAYING Handle = 0x802A0102 + UI_E_START_KEYFRAME_AFTER_END Handle = 0x802A0103 + UI_E_END_KEYFRAME_NOT_DETERMINED Handle = 0x802A0104 + UI_E_LOOPS_OVERLAP Handle = 0x802A0105 + UI_E_TRANSITION_ALREADY_USED Handle = 0x802A0106 + UI_E_TRANSITION_NOT_IN_STORYBOARD Handle = 0x802A0107 + UI_E_TRANSITION_ECLIPSED Handle = 0x802A0108 + UI_E_TIME_BEFORE_LAST_UPDATE Handle = 0x802A0109 + UI_E_TIMER_CLIENT_ALREADY_CONNECTED Handle = 0x802A010A + UI_E_INVALID_DIMENSION Handle = 0x802A010B + UI_E_PRIMITIVE_OUT_OF_BOUNDS Handle = 0x802A010C + UI_E_WINDOW_CLOSED Handle = 0x802A0201 + E_BLUETOOTH_ATT_INVALID_HANDLE Handle = 0x80650001 + E_BLUETOOTH_ATT_READ_NOT_PERMITTED Handle = 0x80650002 + E_BLUETOOTH_ATT_WRITE_NOT_PERMITTED Handle = 0x80650003 + E_BLUETOOTH_ATT_INVALID_PDU Handle = 0x80650004 + E_BLUETOOTH_ATT_INSUFFICIENT_AUTHENTICATION Handle = 0x80650005 + E_BLUETOOTH_ATT_REQUEST_NOT_SUPPORTED Handle = 0x80650006 + E_BLUETOOTH_ATT_INVALID_OFFSET Handle = 0x80650007 + E_BLUETOOTH_ATT_INSUFFICIENT_AUTHORIZATION Handle = 0x80650008 + E_BLUETOOTH_ATT_PREPARE_QUEUE_FULL Handle = 0x80650009 + E_BLUETOOTH_ATT_ATTRIBUTE_NOT_FOUND Handle = 0x8065000A + E_BLUETOOTH_ATT_ATTRIBUTE_NOT_LONG Handle = 0x8065000B + E_BLUETOOTH_ATT_INSUFFICIENT_ENCRYPTION_KEY_SIZE Handle = 0x8065000C + E_BLUETOOTH_ATT_INVALID_ATTRIBUTE_VALUE_LENGTH Handle = 0x8065000D + E_BLUETOOTH_ATT_UNLIKELY Handle = 0x8065000E + E_BLUETOOTH_ATT_INSUFFICIENT_ENCRYPTION Handle = 0x8065000F + E_BLUETOOTH_ATT_UNSUPPORTED_GROUP_TYPE Handle = 0x80650010 + E_BLUETOOTH_ATT_INSUFFICIENT_RESOURCES Handle = 0x80650011 + E_BLUETOOTH_ATT_UNKNOWN_ERROR Handle = 0x80651000 + E_AUDIO_ENGINE_NODE_NOT_FOUND Handle = 0x80660001 + E_HDAUDIO_EMPTY_CONNECTION_LIST Handle = 0x80660002 + E_HDAUDIO_CONNECTION_LIST_NOT_SUPPORTED Handle = 0x80660003 + E_HDAUDIO_NO_LOGICAL_DEVICES_CREATED Handle = 0x80660004 + E_HDAUDIO_NULL_LINKED_LIST_ENTRY Handle = 0x80660005 + STATEREPOSITORY_E_CONCURRENCY_LOCKING_FAILURE Handle = 0x80670001 + STATEREPOSITORY_E_STATEMENT_INPROGRESS Handle = 0x80670002 + STATEREPOSITORY_E_CONFIGURATION_INVALID Handle = 0x80670003 + STATEREPOSITORY_E_UNKNOWN_SCHEMA_VERSION Handle = 0x80670004 + STATEREPOSITORY_ERROR_DICTIONARY_CORRUPTED Handle = 0x80670005 + STATEREPOSITORY_E_BLOCKED Handle = 0x80670006 + STATEREPOSITORY_E_BUSY_RETRY Handle = 0x80670007 + STATEREPOSITORY_E_BUSY_RECOVERY_RETRY Handle = 0x80670008 + STATEREPOSITORY_E_LOCKED_RETRY Handle = 0x80670009 + STATEREPOSITORY_E_LOCKED_SHAREDCACHE_RETRY Handle = 0x8067000A + STATEREPOSITORY_E_TRANSACTION_REQUIRED Handle = 0x8067000B + STATEREPOSITORY_E_BUSY_TIMEOUT_EXCEEDED Handle = 0x8067000C + STATEREPOSITORY_E_BUSY_RECOVERY_TIMEOUT_EXCEEDED Handle = 0x8067000D + STATEREPOSITORY_E_LOCKED_TIMEOUT_EXCEEDED Handle = 0x8067000E + STATEREPOSITORY_E_LOCKED_SHAREDCACHE_TIMEOUT_EXCEEDED Handle = 0x8067000F + STATEREPOSITORY_E_SERVICE_STOP_IN_PROGRESS Handle = 0x80670010 + STATEREPOSTORY_E_NESTED_TRANSACTION_NOT_SUPPORTED Handle = 0x80670011 + STATEREPOSITORY_ERROR_CACHE_CORRUPTED Handle = 0x80670012 + STATEREPOSITORY_TRANSACTION_CALLER_ID_CHANGED Handle = 0x00670013 + STATEREPOSITORY_TRANSACTION_IN_PROGRESS Handle = 0x00670014 + ERROR_SPACES_POOL_WAS_DELETED Handle = 0x00E70001 + ERROR_SPACES_FAULT_DOMAIN_TYPE_INVALID Handle = 0x80E70001 + ERROR_SPACES_INTERNAL_ERROR Handle = 0x80E70002 + ERROR_SPACES_RESILIENCY_TYPE_INVALID Handle = 0x80E70003 + ERROR_SPACES_DRIVE_SECTOR_SIZE_INVALID Handle = 0x80E70004 + ERROR_SPACES_DRIVE_REDUNDANCY_INVALID Handle = 0x80E70006 + ERROR_SPACES_NUMBER_OF_DATA_COPIES_INVALID Handle = 0x80E70007 + ERROR_SPACES_PARITY_LAYOUT_INVALID Handle = 0x80E70008 + ERROR_SPACES_INTERLEAVE_LENGTH_INVALID Handle = 0x80E70009 + ERROR_SPACES_NUMBER_OF_COLUMNS_INVALID Handle = 0x80E7000A + ERROR_SPACES_NOT_ENOUGH_DRIVES Handle = 0x80E7000B + ERROR_SPACES_EXTENDED_ERROR Handle = 0x80E7000C + ERROR_SPACES_PROVISIONING_TYPE_INVALID Handle = 0x80E7000D + ERROR_SPACES_ALLOCATION_SIZE_INVALID Handle = 0x80E7000E + ERROR_SPACES_ENCLOSURE_AWARE_INVALID Handle = 0x80E7000F + ERROR_SPACES_WRITE_CACHE_SIZE_INVALID Handle = 0x80E70010 + ERROR_SPACES_NUMBER_OF_GROUPS_INVALID Handle = 0x80E70011 + ERROR_SPACES_DRIVE_OPERATIONAL_STATE_INVALID Handle = 0x80E70012 + ERROR_SPACES_ENTRY_INCOMPLETE Handle = 0x80E70013 + ERROR_SPACES_ENTRY_INVALID Handle = 0x80E70014 + ERROR_VOLSNAP_BOOTFILE_NOT_VALID Handle = 0x80820001 + ERROR_VOLSNAP_ACTIVATION_TIMEOUT Handle = 0x80820002 + ERROR_TIERING_NOT_SUPPORTED_ON_VOLUME Handle = 0x80830001 + ERROR_TIERING_VOLUME_DISMOUNT_IN_PROGRESS Handle = 0x80830002 + ERROR_TIERING_STORAGE_TIER_NOT_FOUND Handle = 0x80830003 + ERROR_TIERING_INVALID_FILE_ID Handle = 0x80830004 + ERROR_TIERING_WRONG_CLUSTER_NODE Handle = 0x80830005 + ERROR_TIERING_ALREADY_PROCESSING Handle = 0x80830006 + ERROR_TIERING_CANNOT_PIN_OBJECT Handle = 0x80830007 + ERROR_TIERING_FILE_IS_NOT_PINNED Handle = 0x80830008 + ERROR_NOT_A_TIERED_VOLUME Handle = 0x80830009 + ERROR_ATTRIBUTE_NOT_PRESENT Handle = 0x8083000A + ERROR_SECCORE_INVALID_COMMAND Handle = 0xC0E80000 + ERROR_NO_APPLICABLE_APP_LICENSES_FOUND Handle = 0xC0EA0001 + ERROR_CLIP_LICENSE_NOT_FOUND Handle = 0xC0EA0002 + ERROR_CLIP_DEVICE_LICENSE_MISSING Handle = 0xC0EA0003 + ERROR_CLIP_LICENSE_INVALID_SIGNATURE Handle = 0xC0EA0004 + ERROR_CLIP_KEYHOLDER_LICENSE_MISSING_OR_INVALID Handle = 0xC0EA0005 + ERROR_CLIP_LICENSE_EXPIRED Handle = 0xC0EA0006 + ERROR_CLIP_LICENSE_SIGNED_BY_UNKNOWN_SOURCE Handle = 0xC0EA0007 + ERROR_CLIP_LICENSE_NOT_SIGNED Handle = 0xC0EA0008 + ERROR_CLIP_LICENSE_HARDWARE_ID_OUT_OF_TOLERANCE Handle = 0xC0EA0009 + ERROR_CLIP_LICENSE_DEVICE_ID_MISMATCH Handle = 0xC0EA000A + DXGI_STATUS_OCCLUDED Handle = 0x087A0001 + DXGI_STATUS_CLIPPED Handle = 0x087A0002 + DXGI_STATUS_NO_REDIRECTION Handle = 0x087A0004 + DXGI_STATUS_NO_DESKTOP_ACCESS Handle = 0x087A0005 + DXGI_STATUS_GRAPHICS_VIDPN_SOURCE_IN_USE Handle = 0x087A0006 + DXGI_STATUS_MODE_CHANGED Handle = 0x087A0007 + DXGI_STATUS_MODE_CHANGE_IN_PROGRESS Handle = 0x087A0008 + DXGI_ERROR_INVALID_CALL Handle = 0x887A0001 + DXGI_ERROR_NOT_FOUND Handle = 0x887A0002 + DXGI_ERROR_MORE_DATA Handle = 0x887A0003 + DXGI_ERROR_UNSUPPORTED Handle = 0x887A0004 + DXGI_ERROR_DEVICE_REMOVED Handle = 0x887A0005 + DXGI_ERROR_DEVICE_HUNG Handle = 0x887A0006 + DXGI_ERROR_DEVICE_RESET Handle = 0x887A0007 + DXGI_ERROR_WAS_STILL_DRAWING Handle = 0x887A000A + DXGI_ERROR_FRAME_STATISTICS_DISJOINT Handle = 0x887A000B + DXGI_ERROR_GRAPHICS_VIDPN_SOURCE_IN_USE Handle = 0x887A000C + DXGI_ERROR_DRIVER_INTERNAL_ERROR Handle = 0x887A0020 + DXGI_ERROR_NONEXCLUSIVE Handle = 0x887A0021 + DXGI_ERROR_NOT_CURRENTLY_AVAILABLE Handle = 0x887A0022 + DXGI_ERROR_REMOTE_CLIENT_DISCONNECTED Handle = 0x887A0023 + DXGI_ERROR_REMOTE_OUTOFMEMORY Handle = 0x887A0024 + DXGI_ERROR_ACCESS_LOST Handle = 0x887A0026 + DXGI_ERROR_WAIT_TIMEOUT Handle = 0x887A0027 + DXGI_ERROR_SESSION_DISCONNECTED Handle = 0x887A0028 + DXGI_ERROR_RESTRICT_TO_OUTPUT_STALE Handle = 0x887A0029 + DXGI_ERROR_CANNOT_PROTECT_CONTENT Handle = 0x887A002A + DXGI_ERROR_ACCESS_DENIED Handle = 0x887A002B + DXGI_ERROR_NAME_ALREADY_EXISTS Handle = 0x887A002C + DXGI_ERROR_SDK_COMPONENT_MISSING Handle = 0x887A002D + DXGI_ERROR_NOT_CURRENT Handle = 0x887A002E + DXGI_ERROR_HW_PROTECTION_OUTOFMEMORY Handle = 0x887A0030 + DXGI_ERROR_DYNAMIC_CODE_POLICY_VIOLATION Handle = 0x887A0031 + DXGI_ERROR_NON_COMPOSITED_UI Handle = 0x887A0032 + DXGI_STATUS_UNOCCLUDED Handle = 0x087A0009 + DXGI_STATUS_DDA_WAS_STILL_DRAWING Handle = 0x087A000A + DXGI_ERROR_MODE_CHANGE_IN_PROGRESS Handle = 0x887A0025 + DXGI_STATUS_PRESENT_REQUIRED Handle = 0x087A002F + DXGI_ERROR_CACHE_CORRUPT Handle = 0x887A0033 + DXGI_ERROR_CACHE_FULL Handle = 0x887A0034 + DXGI_ERROR_CACHE_HASH_COLLISION Handle = 0x887A0035 + DXGI_ERROR_ALREADY_EXISTS Handle = 0x887A0036 + DXGI_DDI_ERR_WASSTILLDRAWING Handle = 0x887B0001 + DXGI_DDI_ERR_UNSUPPORTED Handle = 0x887B0002 + DXGI_DDI_ERR_NONEXCLUSIVE Handle = 0x887B0003 + D3D10_ERROR_TOO_MANY_UNIQUE_STATE_OBJECTS Handle = 0x88790001 + D3D10_ERROR_FILE_NOT_FOUND Handle = 0x88790002 + D3D11_ERROR_TOO_MANY_UNIQUE_STATE_OBJECTS Handle = 0x887C0001 + D3D11_ERROR_FILE_NOT_FOUND Handle = 0x887C0002 + D3D11_ERROR_TOO_MANY_UNIQUE_VIEW_OBJECTS Handle = 0x887C0003 + D3D11_ERROR_DEFERRED_CONTEXT_MAP_WITHOUT_INITIAL_DISCARD Handle = 0x887C0004 + D3D12_ERROR_ADAPTER_NOT_FOUND Handle = 0x887E0001 + D3D12_ERROR_DRIVER_VERSION_MISMATCH Handle = 0x887E0002 + D2DERR_WRONG_STATE Handle = 0x88990001 + D2DERR_NOT_INITIALIZED Handle = 0x88990002 + D2DERR_UNSUPPORTED_OPERATION Handle = 0x88990003 + D2DERR_SCANNER_FAILED Handle = 0x88990004 + D2DERR_SCREEN_ACCESS_DENIED Handle = 0x88990005 + D2DERR_DISPLAY_STATE_INVALID Handle = 0x88990006 + D2DERR_ZERO_VECTOR Handle = 0x88990007 + D2DERR_INTERNAL_ERROR Handle = 0x88990008 + D2DERR_DISPLAY_FORMAT_NOT_SUPPORTED Handle = 0x88990009 + D2DERR_INVALID_CALL Handle = 0x8899000A + D2DERR_NO_HARDWARE_DEVICE Handle = 0x8899000B + D2DERR_RECREATE_TARGET Handle = 0x8899000C + D2DERR_TOO_MANY_SHADER_ELEMENTS Handle = 0x8899000D + D2DERR_SHADER_COMPILE_FAILED Handle = 0x8899000E + D2DERR_MAX_TEXTURE_SIZE_EXCEEDED Handle = 0x8899000F + D2DERR_UNSUPPORTED_VERSION Handle = 0x88990010 + D2DERR_BAD_NUMBER Handle = 0x88990011 + D2DERR_WRONG_FACTORY Handle = 0x88990012 + D2DERR_LAYER_ALREADY_IN_USE Handle = 0x88990013 + D2DERR_POP_CALL_DID_NOT_MATCH_PUSH Handle = 0x88990014 + D2DERR_WRONG_RESOURCE_DOMAIN Handle = 0x88990015 + D2DERR_PUSH_POP_UNBALANCED Handle = 0x88990016 + D2DERR_RENDER_TARGET_HAS_LAYER_OR_CLIPRECT Handle = 0x88990017 + D2DERR_INCOMPATIBLE_BRUSH_TYPES Handle = 0x88990018 + D2DERR_WIN32_ERROR Handle = 0x88990019 + D2DERR_TARGET_NOT_GDI_COMPATIBLE Handle = 0x8899001A + D2DERR_TEXT_EFFECT_IS_WRONG_TYPE Handle = 0x8899001B + D2DERR_TEXT_RENDERER_NOT_RELEASED Handle = 0x8899001C + D2DERR_EXCEEDS_MAX_BITMAP_SIZE Handle = 0x8899001D + D2DERR_INVALID_GRAPH_CONFIGURATION Handle = 0x8899001E + D2DERR_INVALID_INTERNAL_GRAPH_CONFIGURATION Handle = 0x8899001F + D2DERR_CYCLIC_GRAPH Handle = 0x88990020 + D2DERR_BITMAP_CANNOT_DRAW Handle = 0x88990021 + D2DERR_OUTSTANDING_BITMAP_REFERENCES Handle = 0x88990022 + D2DERR_ORIGINAL_TARGET_NOT_BOUND Handle = 0x88990023 + D2DERR_INVALID_TARGET Handle = 0x88990024 + D2DERR_BITMAP_BOUND_AS_TARGET Handle = 0x88990025 + D2DERR_INSUFFICIENT_DEVICE_CAPABILITIES Handle = 0x88990026 + D2DERR_INTERMEDIATE_TOO_LARGE Handle = 0x88990027 + D2DERR_EFFECT_IS_NOT_REGISTERED Handle = 0x88990028 + D2DERR_INVALID_PROPERTY Handle = 0x88990029 + D2DERR_NO_SUBPROPERTIES Handle = 0x8899002A + D2DERR_PRINT_JOB_CLOSED Handle = 0x8899002B + D2DERR_PRINT_FORMAT_NOT_SUPPORTED Handle = 0x8899002C + D2DERR_TOO_MANY_TRANSFORM_INPUTS Handle = 0x8899002D + D2DERR_INVALID_GLYPH_IMAGE Handle = 0x8899002E + DWRITE_E_FILEFORMAT Handle = 0x88985000 + DWRITE_E_UNEXPECTED Handle = 0x88985001 + DWRITE_E_NOFONT Handle = 0x88985002 + DWRITE_E_FILENOTFOUND Handle = 0x88985003 + DWRITE_E_FILEACCESS Handle = 0x88985004 + DWRITE_E_FONTCOLLECTIONOBSOLETE Handle = 0x88985005 + DWRITE_E_ALREADYREGISTERED Handle = 0x88985006 + DWRITE_E_CACHEFORMAT Handle = 0x88985007 + DWRITE_E_CACHEVERSION Handle = 0x88985008 + DWRITE_E_UNSUPPORTEDOPERATION Handle = 0x88985009 + DWRITE_E_TEXTRENDERERINCOMPATIBLE Handle = 0x8898500A + DWRITE_E_FLOWDIRECTIONCONFLICTS Handle = 0x8898500B + DWRITE_E_NOCOLOR Handle = 0x8898500C + DWRITE_E_REMOTEFONT Handle = 0x8898500D + DWRITE_E_DOWNLOADCANCELLED Handle = 0x8898500E + DWRITE_E_DOWNLOADFAILED Handle = 0x8898500F + DWRITE_E_TOOMANYDOWNLOADS Handle = 0x88985010 + WINCODEC_ERR_WRONGSTATE Handle = 0x88982F04 + WINCODEC_ERR_VALUEOUTOFRANGE Handle = 0x88982F05 + WINCODEC_ERR_UNKNOWNIMAGEFORMAT Handle = 0x88982F07 + WINCODEC_ERR_UNSUPPORTEDVERSION Handle = 0x88982F0B + WINCODEC_ERR_NOTINITIALIZED Handle = 0x88982F0C + WINCODEC_ERR_ALREADYLOCKED Handle = 0x88982F0D + WINCODEC_ERR_PROPERTYNOTFOUND Handle = 0x88982F40 + WINCODEC_ERR_PROPERTYNOTSUPPORTED Handle = 0x88982F41 + WINCODEC_ERR_PROPERTYSIZE Handle = 0x88982F42 + WINCODEC_ERR_CODECPRESENT Handle = 0x88982F43 + WINCODEC_ERR_CODECNOTHUMBNAIL Handle = 0x88982F44 + WINCODEC_ERR_PALETTEUNAVAILABLE Handle = 0x88982F45 + WINCODEC_ERR_CODECTOOMANYSCANLINES Handle = 0x88982F46 + WINCODEC_ERR_INTERNALERROR Handle = 0x88982F48 + WINCODEC_ERR_SOURCERECTDOESNOTMATCHDIMENSIONS Handle = 0x88982F49 + WINCODEC_ERR_COMPONENTNOTFOUND Handle = 0x88982F50 + WINCODEC_ERR_IMAGESIZEOUTOFRANGE Handle = 0x88982F51 + WINCODEC_ERR_TOOMUCHMETADATA Handle = 0x88982F52 + WINCODEC_ERR_BADIMAGE Handle = 0x88982F60 + WINCODEC_ERR_BADHEADER Handle = 0x88982F61 + WINCODEC_ERR_FRAMEMISSING Handle = 0x88982F62 + WINCODEC_ERR_BADMETADATAHEADER Handle = 0x88982F63 + WINCODEC_ERR_BADSTREAMDATA Handle = 0x88982F70 + WINCODEC_ERR_STREAMWRITE Handle = 0x88982F71 + WINCODEC_ERR_STREAMREAD Handle = 0x88982F72 + WINCODEC_ERR_STREAMNOTAVAILABLE Handle = 0x88982F73 + WINCODEC_ERR_UNSUPPORTEDPIXELFORMAT Handle = 0x88982F80 + WINCODEC_ERR_UNSUPPORTEDOPERATION Handle = 0x88982F81 + WINCODEC_ERR_INVALIDREGISTRATION Handle = 0x88982F8A + WINCODEC_ERR_COMPONENTINITIALIZEFAILURE Handle = 0x88982F8B + WINCODEC_ERR_INSUFFICIENTBUFFER Handle = 0x88982F8C + WINCODEC_ERR_DUPLICATEMETADATAPRESENT Handle = 0x88982F8D + WINCODEC_ERR_PROPERTYUNEXPECTEDTYPE Handle = 0x88982F8E + WINCODEC_ERR_UNEXPECTEDSIZE Handle = 0x88982F8F + WINCODEC_ERR_INVALIDQUERYREQUEST Handle = 0x88982F90 + WINCODEC_ERR_UNEXPECTEDMETADATATYPE Handle = 0x88982F91 + WINCODEC_ERR_REQUESTONLYVALIDATMETADATAROOT Handle = 0x88982F92 + WINCODEC_ERR_INVALIDQUERYCHARACTER Handle = 0x88982F93 + WINCODEC_ERR_WIN32ERROR Handle = 0x88982F94 + WINCODEC_ERR_INVALIDPROGRESSIVELEVEL Handle = 0x88982F95 + WINCODEC_ERR_INVALIDJPEGSCANINDEX Handle = 0x88982F96 + MILERR_OBJECTBUSY Handle = 0x88980001 + MILERR_INSUFFICIENTBUFFER Handle = 0x88980002 + MILERR_WIN32ERROR Handle = 0x88980003 + MILERR_SCANNER_FAILED Handle = 0x88980004 + MILERR_SCREENACCESSDENIED Handle = 0x88980005 + MILERR_DISPLAYSTATEINVALID Handle = 0x88980006 + MILERR_NONINVERTIBLEMATRIX Handle = 0x88980007 + MILERR_ZEROVECTOR Handle = 0x88980008 + MILERR_TERMINATED Handle = 0x88980009 + MILERR_BADNUMBER Handle = 0x8898000A + MILERR_INTERNALERROR Handle = 0x88980080 + MILERR_DISPLAYFORMATNOTSUPPORTED Handle = 0x88980084 + MILERR_INVALIDCALL Handle = 0x88980085 + MILERR_ALREADYLOCKED Handle = 0x88980086 + MILERR_NOTLOCKED Handle = 0x88980087 + MILERR_DEVICECANNOTRENDERTEXT Handle = 0x88980088 + MILERR_GLYPHBITMAPMISSED Handle = 0x88980089 + MILERR_MALFORMEDGLYPHCACHE Handle = 0x8898008A + MILERR_GENERIC_IGNORE Handle = 0x8898008B + MILERR_MALFORMED_GUIDELINE_DATA Handle = 0x8898008C + MILERR_NO_HARDWARE_DEVICE Handle = 0x8898008D + MILERR_NEED_RECREATE_AND_PRESENT Handle = 0x8898008E + MILERR_ALREADY_INITIALIZED Handle = 0x8898008F + MILERR_MISMATCHED_SIZE Handle = 0x88980090 + MILERR_NO_REDIRECTION_SURFACE_AVAILABLE Handle = 0x88980091 + MILERR_REMOTING_NOT_SUPPORTED Handle = 0x88980092 + MILERR_QUEUED_PRESENT_NOT_SUPPORTED Handle = 0x88980093 + MILERR_NOT_QUEUING_PRESENTS Handle = 0x88980094 + MILERR_NO_REDIRECTION_SURFACE_RETRY_LATER Handle = 0x88980095 + MILERR_TOOMANYSHADERELEMNTS Handle = 0x88980096 + MILERR_MROW_READLOCK_FAILED Handle = 0x88980097 + MILERR_MROW_UPDATE_FAILED Handle = 0x88980098 + MILERR_SHADER_COMPILE_FAILED Handle = 0x88980099 + MILERR_MAX_TEXTURE_SIZE_EXCEEDED Handle = 0x8898009A + MILERR_QPC_TIME_WENT_BACKWARD Handle = 0x8898009B + MILERR_DXGI_ENUMERATION_OUT_OF_SYNC Handle = 0x8898009D + MILERR_ADAPTER_NOT_FOUND Handle = 0x8898009E + MILERR_COLORSPACE_NOT_SUPPORTED Handle = 0x8898009F + MILERR_PREFILTER_NOT_SUPPORTED Handle = 0x889800A0 + MILERR_DISPLAYID_ACCESS_DENIED Handle = 0x889800A1 + UCEERR_INVALIDPACKETHEADER Handle = 0x88980400 + UCEERR_UNKNOWNPACKET Handle = 0x88980401 + UCEERR_ILLEGALPACKET Handle = 0x88980402 + UCEERR_MALFORMEDPACKET Handle = 0x88980403 + UCEERR_ILLEGALHANDLE Handle = 0x88980404 + UCEERR_HANDLELOOKUPFAILED Handle = 0x88980405 + UCEERR_RENDERTHREADFAILURE Handle = 0x88980406 + UCEERR_CTXSTACKFRSTTARGETNULL Handle = 0x88980407 + UCEERR_CONNECTIONIDLOOKUPFAILED Handle = 0x88980408 + UCEERR_BLOCKSFULL Handle = 0x88980409 + UCEERR_MEMORYFAILURE Handle = 0x8898040A + UCEERR_PACKETRECORDOUTOFRANGE Handle = 0x8898040B + UCEERR_ILLEGALRECORDTYPE Handle = 0x8898040C + UCEERR_OUTOFHANDLES Handle = 0x8898040D + UCEERR_UNCHANGABLE_UPDATE_ATTEMPTED Handle = 0x8898040E + UCEERR_NO_MULTIPLE_WORKER_THREADS Handle = 0x8898040F + UCEERR_REMOTINGNOTSUPPORTED Handle = 0x88980410 + UCEERR_MISSINGENDCOMMAND Handle = 0x88980411 + UCEERR_MISSINGBEGINCOMMAND Handle = 0x88980412 + UCEERR_CHANNELSYNCTIMEDOUT Handle = 0x88980413 + UCEERR_CHANNELSYNCABANDONED Handle = 0x88980414 + UCEERR_UNSUPPORTEDTRANSPORTVERSION Handle = 0x88980415 + UCEERR_TRANSPORTUNAVAILABLE Handle = 0x88980416 + UCEERR_FEEDBACK_UNSUPPORTED Handle = 0x88980417 + UCEERR_COMMANDTRANSPORTDENIED Handle = 0x88980418 + UCEERR_GRAPHICSSTREAMUNAVAILABLE Handle = 0x88980419 + UCEERR_GRAPHICSSTREAMALREADYOPEN Handle = 0x88980420 + UCEERR_TRANSPORTDISCONNECTED Handle = 0x88980421 + UCEERR_TRANSPORTOVERLOADED Handle = 0x88980422 + UCEERR_PARTITION_ZOMBIED Handle = 0x88980423 + MILAVERR_NOCLOCK Handle = 0x88980500 + MILAVERR_NOMEDIATYPE Handle = 0x88980501 + MILAVERR_NOVIDEOMIXER Handle = 0x88980502 + MILAVERR_NOVIDEOPRESENTER Handle = 0x88980503 + MILAVERR_NOREADYFRAMES Handle = 0x88980504 + MILAVERR_MODULENOTLOADED Handle = 0x88980505 + MILAVERR_WMPFACTORYNOTREGISTERED Handle = 0x88980506 + MILAVERR_INVALIDWMPVERSION Handle = 0x88980507 + MILAVERR_INSUFFICIENTVIDEORESOURCES Handle = 0x88980508 + MILAVERR_VIDEOACCELERATIONNOTAVAILABLE Handle = 0x88980509 + MILAVERR_REQUESTEDTEXTURETOOBIG Handle = 0x8898050A + MILAVERR_SEEKFAILED Handle = 0x8898050B + MILAVERR_UNEXPECTEDWMPFAILURE Handle = 0x8898050C + MILAVERR_MEDIAPLAYERCLOSED Handle = 0x8898050D + MILAVERR_UNKNOWNHARDWAREERROR Handle = 0x8898050E + MILEFFECTSERR_UNKNOWNPROPERTY Handle = 0x8898060E + MILEFFECTSERR_EFFECTNOTPARTOFGROUP Handle = 0x8898060F + MILEFFECTSERR_NOINPUTSOURCEATTACHED Handle = 0x88980610 + MILEFFECTSERR_CONNECTORNOTCONNECTED Handle = 0x88980611 + MILEFFECTSERR_CONNECTORNOTASSOCIATEDWITHEFFECT Handle = 0x88980612 + MILEFFECTSERR_RESERVED Handle = 0x88980613 + MILEFFECTSERR_CYCLEDETECTED Handle = 0x88980614 + MILEFFECTSERR_EFFECTINMORETHANONEGRAPH Handle = 0x88980615 + MILEFFECTSERR_EFFECTALREADYINAGRAPH Handle = 0x88980616 + MILEFFECTSERR_EFFECTHASNOCHILDREN Handle = 0x88980617 + MILEFFECTSERR_ALREADYATTACHEDTOLISTENER Handle = 0x88980618 + MILEFFECTSERR_NOTAFFINETRANSFORM Handle = 0x88980619 + MILEFFECTSERR_EMPTYBOUNDS Handle = 0x8898061A + MILEFFECTSERR_OUTPUTSIZETOOLARGE Handle = 0x8898061B + DWMERR_STATE_TRANSITION_FAILED Handle = 0x88980700 + DWMERR_THEME_FAILED Handle = 0x88980701 + DWMERR_CATASTROPHIC_FAILURE Handle = 0x88980702 + DCOMPOSITION_ERROR_WINDOW_ALREADY_COMPOSED Handle = 0x88980800 + DCOMPOSITION_ERROR_SURFACE_BEING_RENDERED Handle = 0x88980801 + DCOMPOSITION_ERROR_SURFACE_NOT_BEING_RENDERED Handle = 0x88980802 + ONL_E_INVALID_AUTHENTICATION_TARGET Handle = 0x80860001 + ONL_E_ACCESS_DENIED_BY_TOU Handle = 0x80860002 + ONL_E_INVALID_APPLICATION Handle = 0x80860003 + ONL_E_PASSWORD_UPDATE_REQUIRED Handle = 0x80860004 + ONL_E_ACCOUNT_UPDATE_REQUIRED Handle = 0x80860005 + ONL_E_FORCESIGNIN Handle = 0x80860006 + ONL_E_ACCOUNT_LOCKED Handle = 0x80860007 + ONL_E_PARENTAL_CONSENT_REQUIRED Handle = 0x80860008 + ONL_E_EMAIL_VERIFICATION_REQUIRED Handle = 0x80860009 + ONL_E_ACCOUNT_SUSPENDED_COMPROIMISE Handle = 0x8086000A + ONL_E_ACCOUNT_SUSPENDED_ABUSE Handle = 0x8086000B + ONL_E_ACTION_REQUIRED Handle = 0x8086000C + ONL_CONNECTION_COUNT_LIMIT Handle = 0x8086000D + ONL_E_CONNECTED_ACCOUNT_CAN_NOT_SIGNOUT Handle = 0x8086000E + ONL_E_USER_AUTHENTICATION_REQUIRED Handle = 0x8086000F + ONL_E_REQUEST_THROTTLED Handle = 0x80860010 + FA_E_MAX_PERSISTED_ITEMS_REACHED Handle = 0x80270220 + FA_E_HOMEGROUP_NOT_AVAILABLE Handle = 0x80270222 + E_MONITOR_RESOLUTION_TOO_LOW Handle = 0x80270250 + E_ELEVATED_ACTIVATION_NOT_SUPPORTED Handle = 0x80270251 + E_UAC_DISABLED Handle = 0x80270252 + E_FULL_ADMIN_NOT_SUPPORTED Handle = 0x80270253 + E_APPLICATION_NOT_REGISTERED Handle = 0x80270254 + E_MULTIPLE_EXTENSIONS_FOR_APPLICATION Handle = 0x80270255 + E_MULTIPLE_PACKAGES_FOR_FAMILY Handle = 0x80270256 + E_APPLICATION_MANAGER_NOT_RUNNING Handle = 0x80270257 + S_STORE_LAUNCHED_FOR_REMEDIATION Handle = 0x00270258 + S_APPLICATION_ACTIVATION_ERROR_HANDLED_BY_DIALOG Handle = 0x00270259 + E_APPLICATION_ACTIVATION_TIMED_OUT Handle = 0x8027025A + E_APPLICATION_ACTIVATION_EXEC_FAILURE Handle = 0x8027025B + E_APPLICATION_TEMPORARY_LICENSE_ERROR Handle = 0x8027025C + E_APPLICATION_TRIAL_LICENSE_EXPIRED Handle = 0x8027025D + E_SKYDRIVE_ROOT_TARGET_FILE_SYSTEM_NOT_SUPPORTED Handle = 0x80270260 + E_SKYDRIVE_ROOT_TARGET_OVERLAP Handle = 0x80270261 + E_SKYDRIVE_ROOT_TARGET_CANNOT_INDEX Handle = 0x80270262 + E_SKYDRIVE_FILE_NOT_UPLOADED Handle = 0x80270263 + E_SKYDRIVE_UPDATE_AVAILABILITY_FAIL Handle = 0x80270264 + E_SKYDRIVE_ROOT_TARGET_VOLUME_ROOT_NOT_SUPPORTED Handle = 0x80270265 + E_SYNCENGINE_FILE_SIZE_OVER_LIMIT Handle = 0x8802B001 + E_SYNCENGINE_FILE_SIZE_EXCEEDS_REMAINING_QUOTA Handle = 0x8802B002 + E_SYNCENGINE_UNSUPPORTED_FILE_NAME Handle = 0x8802B003 + E_SYNCENGINE_FOLDER_ITEM_COUNT_LIMIT_EXCEEDED Handle = 0x8802B004 + E_SYNCENGINE_FILE_SYNC_PARTNER_ERROR Handle = 0x8802B005 + E_SYNCENGINE_SYNC_PAUSED_BY_SERVICE Handle = 0x8802B006 + E_SYNCENGINE_FILE_IDENTIFIER_UNKNOWN Handle = 0x8802C002 + E_SYNCENGINE_SERVICE_AUTHENTICATION_FAILED Handle = 0x8802C003 + E_SYNCENGINE_UNKNOWN_SERVICE_ERROR Handle = 0x8802C004 + E_SYNCENGINE_SERVICE_RETURNED_UNEXPECTED_SIZE Handle = 0x8802C005 + E_SYNCENGINE_REQUEST_BLOCKED_BY_SERVICE Handle = 0x8802C006 + E_SYNCENGINE_REQUEST_BLOCKED_DUE_TO_CLIENT_ERROR Handle = 0x8802C007 + E_SYNCENGINE_FOLDER_INACCESSIBLE Handle = 0x8802D001 + E_SYNCENGINE_UNSUPPORTED_FOLDER_NAME Handle = 0x8802D002 + E_SYNCENGINE_UNSUPPORTED_MARKET Handle = 0x8802D003 + E_SYNCENGINE_PATH_LENGTH_LIMIT_EXCEEDED Handle = 0x8802D004 + E_SYNCENGINE_REMOTE_PATH_LENGTH_LIMIT_EXCEEDED Handle = 0x8802D005 + E_SYNCENGINE_CLIENT_UPDATE_NEEDED Handle = 0x8802D006 + E_SYNCENGINE_PROXY_AUTHENTICATION_REQUIRED Handle = 0x8802D007 + E_SYNCENGINE_STORAGE_SERVICE_PROVISIONING_FAILED Handle = 0x8802D008 + E_SYNCENGINE_UNSUPPORTED_REPARSE_POINT Handle = 0x8802D009 + E_SYNCENGINE_STORAGE_SERVICE_BLOCKED Handle = 0x8802D00A + E_SYNCENGINE_FOLDER_IN_REDIRECTION Handle = 0x8802D00B + EAS_E_POLICY_NOT_MANAGED_BY_OS Handle = 0x80550001 + EAS_E_POLICY_COMPLIANT_WITH_ACTIONS Handle = 0x80550002 + EAS_E_REQUESTED_POLICY_NOT_ENFORCEABLE Handle = 0x80550003 + EAS_E_CURRENT_USER_HAS_BLANK_PASSWORD Handle = 0x80550004 + EAS_E_REQUESTED_POLICY_PASSWORD_EXPIRATION_INCOMPATIBLE Handle = 0x80550005 + EAS_E_USER_CANNOT_CHANGE_PASSWORD Handle = 0x80550006 + EAS_E_ADMINS_HAVE_BLANK_PASSWORD Handle = 0x80550007 + EAS_E_ADMINS_CANNOT_CHANGE_PASSWORD Handle = 0x80550008 + EAS_E_LOCAL_CONTROLLED_USERS_CANNOT_CHANGE_PASSWORD Handle = 0x80550009 + EAS_E_PASSWORD_POLICY_NOT_ENFORCEABLE_FOR_CONNECTED_ADMINS Handle = 0x8055000A + EAS_E_CONNECTED_ADMINS_NEED_TO_CHANGE_PASSWORD Handle = 0x8055000B + EAS_E_PASSWORD_POLICY_NOT_ENFORCEABLE_FOR_CURRENT_CONNECTED_USER Handle = 0x8055000C + EAS_E_CURRENT_CONNECTED_USER_NEED_TO_CHANGE_PASSWORD Handle = 0x8055000D + WEB_E_UNSUPPORTED_FORMAT Handle = 0x83750001 + WEB_E_INVALID_XML Handle = 0x83750002 + WEB_E_MISSING_REQUIRED_ELEMENT Handle = 0x83750003 + WEB_E_MISSING_REQUIRED_ATTRIBUTE Handle = 0x83750004 + WEB_E_UNEXPECTED_CONTENT Handle = 0x83750005 + WEB_E_RESOURCE_TOO_LARGE Handle = 0x83750006 + WEB_E_INVALID_JSON_STRING Handle = 0x83750007 + WEB_E_INVALID_JSON_NUMBER Handle = 0x83750008 + WEB_E_JSON_VALUE_NOT_FOUND Handle = 0x83750009 + HTTP_E_STATUS_UNEXPECTED Handle = 0x80190001 + HTTP_E_STATUS_UNEXPECTED_REDIRECTION Handle = 0x80190003 + HTTP_E_STATUS_UNEXPECTED_CLIENT_ERROR Handle = 0x80190004 + HTTP_E_STATUS_UNEXPECTED_SERVER_ERROR Handle = 0x80190005 + HTTP_E_STATUS_AMBIGUOUS Handle = 0x8019012C + HTTP_E_STATUS_MOVED Handle = 0x8019012D + HTTP_E_STATUS_REDIRECT Handle = 0x8019012E + HTTP_E_STATUS_REDIRECT_METHOD Handle = 0x8019012F + HTTP_E_STATUS_NOT_MODIFIED Handle = 0x80190130 + HTTP_E_STATUS_USE_PROXY Handle = 0x80190131 + HTTP_E_STATUS_REDIRECT_KEEP_VERB Handle = 0x80190133 + HTTP_E_STATUS_BAD_REQUEST Handle = 0x80190190 + HTTP_E_STATUS_DENIED Handle = 0x80190191 + HTTP_E_STATUS_PAYMENT_REQ Handle = 0x80190192 + HTTP_E_STATUS_FORBIDDEN Handle = 0x80190193 + HTTP_E_STATUS_NOT_FOUND Handle = 0x80190194 + HTTP_E_STATUS_BAD_METHOD Handle = 0x80190195 + HTTP_E_STATUS_NONE_ACCEPTABLE Handle = 0x80190196 + HTTP_E_STATUS_PROXY_AUTH_REQ Handle = 0x80190197 + HTTP_E_STATUS_REQUEST_TIMEOUT Handle = 0x80190198 + HTTP_E_STATUS_CONFLICT Handle = 0x80190199 + HTTP_E_STATUS_GONE Handle = 0x8019019A + HTTP_E_STATUS_LENGTH_REQUIRED Handle = 0x8019019B + HTTP_E_STATUS_PRECOND_FAILED Handle = 0x8019019C + HTTP_E_STATUS_REQUEST_TOO_LARGE Handle = 0x8019019D + HTTP_E_STATUS_URI_TOO_LONG Handle = 0x8019019E + HTTP_E_STATUS_UNSUPPORTED_MEDIA Handle = 0x8019019F + HTTP_E_STATUS_RANGE_NOT_SATISFIABLE Handle = 0x801901A0 + HTTP_E_STATUS_EXPECTATION_FAILED Handle = 0x801901A1 + HTTP_E_STATUS_SERVER_ERROR Handle = 0x801901F4 + HTTP_E_STATUS_NOT_SUPPORTED Handle = 0x801901F5 + HTTP_E_STATUS_BAD_GATEWAY Handle = 0x801901F6 + HTTP_E_STATUS_SERVICE_UNAVAIL Handle = 0x801901F7 + HTTP_E_STATUS_GATEWAY_TIMEOUT Handle = 0x801901F8 + HTTP_E_STATUS_VERSION_NOT_SUP Handle = 0x801901F9 + E_INVALID_PROTOCOL_OPERATION Handle = 0x83760001 + E_INVALID_PROTOCOL_FORMAT Handle = 0x83760002 + E_PROTOCOL_EXTENSIONS_NOT_SUPPORTED Handle = 0x83760003 + E_SUBPROTOCOL_NOT_SUPPORTED Handle = 0x83760004 + E_PROTOCOL_VERSION_NOT_SUPPORTED Handle = 0x83760005 + INPUT_E_OUT_OF_ORDER Handle = 0x80400000 + INPUT_E_REENTRANCY Handle = 0x80400001 + INPUT_E_MULTIMODAL Handle = 0x80400002 + INPUT_E_PACKET Handle = 0x80400003 + INPUT_E_FRAME Handle = 0x80400004 + INPUT_E_HISTORY Handle = 0x80400005 + INPUT_E_DEVICE_INFO Handle = 0x80400006 + INPUT_E_TRANSFORM Handle = 0x80400007 + INPUT_E_DEVICE_PROPERTY Handle = 0x80400008 + INET_E_INVALID_URL Handle = 0x800C0002 + INET_E_NO_SESSION Handle = 0x800C0003 + INET_E_CANNOT_CONNECT Handle = 0x800C0004 + INET_E_RESOURCE_NOT_FOUND Handle = 0x800C0005 + INET_E_OBJECT_NOT_FOUND Handle = 0x800C0006 + INET_E_DATA_NOT_AVAILABLE Handle = 0x800C0007 + INET_E_DOWNLOAD_FAILURE Handle = 0x800C0008 + INET_E_AUTHENTICATION_REQUIRED Handle = 0x800C0009 + INET_E_NO_VALID_MEDIA Handle = 0x800C000A + INET_E_CONNECTION_TIMEOUT Handle = 0x800C000B + INET_E_INVALID_REQUEST Handle = 0x800C000C + INET_E_UNKNOWN_PROTOCOL Handle = 0x800C000D + INET_E_SECURITY_PROBLEM Handle = 0x800C000E + INET_E_CANNOT_LOAD_DATA Handle = 0x800C000F + INET_E_CANNOT_INSTANTIATE_OBJECT Handle = 0x800C0010 + INET_E_INVALID_CERTIFICATE Handle = 0x800C0019 + INET_E_REDIRECT_FAILED Handle = 0x800C0014 + INET_E_REDIRECT_TO_DIR Handle = 0x800C0015 + ERROR_DBG_CREATE_PROCESS_FAILURE_LOCKDOWN Handle = 0x80B00001 + ERROR_DBG_ATTACH_PROCESS_FAILURE_LOCKDOWN Handle = 0x80B00002 + ERROR_DBG_CONNECT_SERVER_FAILURE_LOCKDOWN Handle = 0x80B00003 + ERROR_DBG_START_SERVER_FAILURE_LOCKDOWN Handle = 0x80B00004 + ERROR_IO_PREEMPTED Handle = 0x89010001 + JSCRIPT_E_CANTEXECUTE Handle = 0x89020001 + WEP_E_NOT_PROVISIONED_ON_ALL_VOLUMES Handle = 0x88010001 + WEP_E_FIXED_DATA_NOT_SUPPORTED Handle = 0x88010002 + WEP_E_HARDWARE_NOT_COMPLIANT Handle = 0x88010003 + WEP_E_LOCK_NOT_CONFIGURED Handle = 0x88010004 + WEP_E_PROTECTION_SUSPENDED Handle = 0x88010005 + WEP_E_NO_LICENSE Handle = 0x88010006 + WEP_E_OS_NOT_PROTECTED Handle = 0x88010007 + WEP_E_UNEXPECTED_FAIL Handle = 0x88010008 + WEP_E_BUFFER_TOO_LARGE Handle = 0x88010009 + ERROR_SVHDX_ERROR_STORED Handle = 0xC05C0000 + ERROR_SVHDX_ERROR_NOT_AVAILABLE Handle = 0xC05CFF00 + ERROR_SVHDX_UNIT_ATTENTION_AVAILABLE Handle = 0xC05CFF01 + ERROR_SVHDX_UNIT_ATTENTION_CAPACITY_DATA_CHANGED Handle = 0xC05CFF02 + ERROR_SVHDX_UNIT_ATTENTION_RESERVATIONS_PREEMPTED Handle = 0xC05CFF03 + ERROR_SVHDX_UNIT_ATTENTION_RESERVATIONS_RELEASED Handle = 0xC05CFF04 + ERROR_SVHDX_UNIT_ATTENTION_REGISTRATIONS_PREEMPTED Handle = 0xC05CFF05 + ERROR_SVHDX_UNIT_ATTENTION_OPERATING_DEFINITION_CHANGED Handle = 0xC05CFF06 + ERROR_SVHDX_RESERVATION_CONFLICT Handle = 0xC05CFF07 + ERROR_SVHDX_WRONG_FILE_TYPE Handle = 0xC05CFF08 + ERROR_SVHDX_VERSION_MISMATCH Handle = 0xC05CFF09 + ERROR_VHD_SHARED Handle = 0xC05CFF0A + ERROR_SVHDX_NO_INITIATOR Handle = 0xC05CFF0B + ERROR_VHDSET_BACKING_STORAGE_NOT_FOUND Handle = 0xC05CFF0C + ERROR_SMB_NO_PREAUTH_INTEGRITY_HASH_OVERLAP Handle = 0xC05D0000 + ERROR_SMB_BAD_CLUSTER_DIALECT Handle = 0xC05D0001 + WININET_E_OUT_OF_HANDLES Handle = 0x80072EE1 + WININET_E_TIMEOUT Handle = 0x80072EE2 + WININET_E_EXTENDED_ERROR Handle = 0x80072EE3 + WININET_E_INTERNAL_ERROR Handle = 0x80072EE4 + WININET_E_INVALID_URL Handle = 0x80072EE5 + WININET_E_UNRECOGNIZED_SCHEME Handle = 0x80072EE6 + WININET_E_NAME_NOT_RESOLVED Handle = 0x80072EE7 + WININET_E_PROTOCOL_NOT_FOUND Handle = 0x80072EE8 + WININET_E_INVALID_OPTION Handle = 0x80072EE9 + WININET_E_BAD_OPTION_LENGTH Handle = 0x80072EEA + WININET_E_OPTION_NOT_SETTABLE Handle = 0x80072EEB + WININET_E_SHUTDOWN Handle = 0x80072EEC + WININET_E_INCORRECT_USER_NAME Handle = 0x80072EED + WININET_E_INCORRECT_PASSWORD Handle = 0x80072EEE + WININET_E_LOGIN_FAILURE Handle = 0x80072EEF + WININET_E_INVALID_OPERATION Handle = 0x80072EF0 + WININET_E_OPERATION_CANCELLED Handle = 0x80072EF1 + WININET_E_INCORRECT_HANDLE_TYPE Handle = 0x80072EF2 + WININET_E_INCORRECT_HANDLE_STATE Handle = 0x80072EF3 + WININET_E_NOT_PROXY_REQUEST Handle = 0x80072EF4 + WININET_E_REGISTRY_VALUE_NOT_FOUND Handle = 0x80072EF5 + WININET_E_BAD_REGISTRY_PARAMETER Handle = 0x80072EF6 + WININET_E_NO_DIRECT_ACCESS Handle = 0x80072EF7 + WININET_E_NO_CONTEXT Handle = 0x80072EF8 + WININET_E_NO_CALLBACK Handle = 0x80072EF9 + WININET_E_REQUEST_PENDING Handle = 0x80072EFA + WININET_E_INCORRECT_FORMAT Handle = 0x80072EFB + WININET_E_ITEM_NOT_FOUND Handle = 0x80072EFC + WININET_E_CANNOT_CONNECT Handle = 0x80072EFD + WININET_E_CONNECTION_ABORTED Handle = 0x80072EFE + WININET_E_CONNECTION_RESET Handle = 0x80072EFF + WININET_E_FORCE_RETRY Handle = 0x80072F00 + WININET_E_INVALID_PROXY_REQUEST Handle = 0x80072F01 + WININET_E_NEED_UI Handle = 0x80072F02 + WININET_E_HANDLE_EXISTS Handle = 0x80072F04 + WININET_E_SEC_CERT_DATE_INVALID Handle = 0x80072F05 + WININET_E_SEC_CERT_CN_INVALID Handle = 0x80072F06 + WININET_E_HTTP_TO_HTTPS_ON_REDIR Handle = 0x80072F07 + WININET_E_HTTPS_TO_HTTP_ON_REDIR Handle = 0x80072F08 + WININET_E_MIXED_SECURITY Handle = 0x80072F09 + WININET_E_CHG_POST_IS_NON_SECURE Handle = 0x80072F0A + WININET_E_POST_IS_NON_SECURE Handle = 0x80072F0B + WININET_E_CLIENT_AUTH_CERT_NEEDED Handle = 0x80072F0C + WININET_E_INVALID_CA Handle = 0x80072F0D + WININET_E_CLIENT_AUTH_NOT_SETUP Handle = 0x80072F0E + WININET_E_ASYNC_THREAD_FAILED Handle = 0x80072F0F + WININET_E_REDIRECT_SCHEME_CHANGE Handle = 0x80072F10 + WININET_E_DIALOG_PENDING Handle = 0x80072F11 + WININET_E_RETRY_DIALOG Handle = 0x80072F12 + WININET_E_NO_NEW_CONTAINERS Handle = 0x80072F13 + WININET_E_HTTPS_HTTP_SUBMIT_REDIR Handle = 0x80072F14 + WININET_E_SEC_CERT_ERRORS Handle = 0x80072F17 + WININET_E_SEC_CERT_REV_FAILED Handle = 0x80072F19 + WININET_E_HEADER_NOT_FOUND Handle = 0x80072F76 + WININET_E_DOWNLEVEL_SERVER Handle = 0x80072F77 + WININET_E_INVALID_SERVER_RESPONSE Handle = 0x80072F78 + WININET_E_INVALID_HEADER Handle = 0x80072F79 + WININET_E_INVALID_QUERY_REQUEST Handle = 0x80072F7A + WININET_E_HEADER_ALREADY_EXISTS Handle = 0x80072F7B + WININET_E_REDIRECT_FAILED Handle = 0x80072F7C + WININET_E_SECURITY_CHANNEL_ERROR Handle = 0x80072F7D + WININET_E_UNABLE_TO_CACHE_FILE Handle = 0x80072F7E + WININET_E_TCPIP_NOT_INSTALLED Handle = 0x80072F7F + WININET_E_DISCONNECTED Handle = 0x80072F83 + WININET_E_SERVER_UNREACHABLE Handle = 0x80072F84 + WININET_E_PROXY_SERVER_UNREACHABLE Handle = 0x80072F85 + WININET_E_BAD_AUTO_PROXY_SCRIPT Handle = 0x80072F86 + WININET_E_UNABLE_TO_DOWNLOAD_SCRIPT Handle = 0x80072F87 + WININET_E_SEC_INVALID_CERT Handle = 0x80072F89 + WININET_E_SEC_CERT_REVOKED Handle = 0x80072F8A + WININET_E_FAILED_DUETOSECURITYCHECK Handle = 0x80072F8B + WININET_E_NOT_INITIALIZED Handle = 0x80072F8C + WININET_E_LOGIN_FAILURE_DISPLAY_ENTITY_BODY Handle = 0x80072F8E + WININET_E_DECODING_FAILED Handle = 0x80072F8F + WININET_E_NOT_REDIRECTED Handle = 0x80072F80 + WININET_E_COOKIE_NEEDS_CONFIRMATION Handle = 0x80072F81 + WININET_E_COOKIE_DECLINED Handle = 0x80072F82 + WININET_E_REDIRECT_NEEDS_CONFIRMATION Handle = 0x80072F88 + SQLITE_E_ERROR Handle = 0x87AF0001 + SQLITE_E_INTERNAL Handle = 0x87AF0002 + SQLITE_E_PERM Handle = 0x87AF0003 + SQLITE_E_ABORT Handle = 0x87AF0004 + SQLITE_E_BUSY Handle = 0x87AF0005 + SQLITE_E_LOCKED Handle = 0x87AF0006 + SQLITE_E_NOMEM Handle = 0x87AF0007 + SQLITE_E_READONLY Handle = 0x87AF0008 + SQLITE_E_INTERRUPT Handle = 0x87AF0009 + SQLITE_E_IOERR Handle = 0x87AF000A + SQLITE_E_CORRUPT Handle = 0x87AF000B + SQLITE_E_NOTFOUND Handle = 0x87AF000C + SQLITE_E_FULL Handle = 0x87AF000D + SQLITE_E_CANTOPEN Handle = 0x87AF000E + SQLITE_E_PROTOCOL Handle = 0x87AF000F + SQLITE_E_EMPTY Handle = 0x87AF0010 + SQLITE_E_SCHEMA Handle = 0x87AF0011 + SQLITE_E_TOOBIG Handle = 0x87AF0012 + SQLITE_E_CONSTRAINT Handle = 0x87AF0013 + SQLITE_E_MISMATCH Handle = 0x87AF0014 + SQLITE_E_MISUSE Handle = 0x87AF0015 + SQLITE_E_NOLFS Handle = 0x87AF0016 + SQLITE_E_AUTH Handle = 0x87AF0017 + SQLITE_E_FORMAT Handle = 0x87AF0018 + SQLITE_E_RANGE Handle = 0x87AF0019 + SQLITE_E_NOTADB Handle = 0x87AF001A + SQLITE_E_NOTICE Handle = 0x87AF001B + SQLITE_E_WARNING Handle = 0x87AF001C + SQLITE_E_ROW Handle = 0x87AF0064 + SQLITE_E_DONE Handle = 0x87AF0065 + SQLITE_E_IOERR_READ Handle = 0x87AF010A + SQLITE_E_IOERR_SHORT_READ Handle = 0x87AF020A + SQLITE_E_IOERR_WRITE Handle = 0x87AF030A + SQLITE_E_IOERR_FSYNC Handle = 0x87AF040A + SQLITE_E_IOERR_DIR_FSYNC Handle = 0x87AF050A + SQLITE_E_IOERR_TRUNCATE Handle = 0x87AF060A + SQLITE_E_IOERR_FSTAT Handle = 0x87AF070A + SQLITE_E_IOERR_UNLOCK Handle = 0x87AF080A + SQLITE_E_IOERR_RDLOCK Handle = 0x87AF090A + SQLITE_E_IOERR_DELETE Handle = 0x87AF0A0A + SQLITE_E_IOERR_BLOCKED Handle = 0x87AF0B0A + SQLITE_E_IOERR_NOMEM Handle = 0x87AF0C0A + SQLITE_E_IOERR_ACCESS Handle = 0x87AF0D0A + SQLITE_E_IOERR_CHECKRESERVEDLOCK Handle = 0x87AF0E0A + SQLITE_E_IOERR_LOCK Handle = 0x87AF0F0A + SQLITE_E_IOERR_CLOSE Handle = 0x87AF100A + SQLITE_E_IOERR_DIR_CLOSE Handle = 0x87AF110A + SQLITE_E_IOERR_SHMOPEN Handle = 0x87AF120A + SQLITE_E_IOERR_SHMSIZE Handle = 0x87AF130A + SQLITE_E_IOERR_SHMLOCK Handle = 0x87AF140A + SQLITE_E_IOERR_SHMMAP Handle = 0x87AF150A + SQLITE_E_IOERR_SEEK Handle = 0x87AF160A + SQLITE_E_IOERR_DELETE_NOENT Handle = 0x87AF170A + SQLITE_E_IOERR_MMAP Handle = 0x87AF180A + SQLITE_E_IOERR_GETTEMPPATH Handle = 0x87AF190A + SQLITE_E_IOERR_CONVPATH Handle = 0x87AF1A0A + SQLITE_E_IOERR_VNODE Handle = 0x87AF1A02 + SQLITE_E_IOERR_AUTH Handle = 0x87AF1A03 + SQLITE_E_LOCKED_SHAREDCACHE Handle = 0x87AF0106 + SQLITE_E_BUSY_RECOVERY Handle = 0x87AF0105 + SQLITE_E_BUSY_SNAPSHOT Handle = 0x87AF0205 + SQLITE_E_CANTOPEN_NOTEMPDIR Handle = 0x87AF010E + SQLITE_E_CANTOPEN_ISDIR Handle = 0x87AF020E + SQLITE_E_CANTOPEN_FULLPATH Handle = 0x87AF030E + SQLITE_E_CANTOPEN_CONVPATH Handle = 0x87AF040E + SQLITE_E_CORRUPT_VTAB Handle = 0x87AF010B + SQLITE_E_READONLY_RECOVERY Handle = 0x87AF0108 + SQLITE_E_READONLY_CANTLOCK Handle = 0x87AF0208 + SQLITE_E_READONLY_ROLLBACK Handle = 0x87AF0308 + SQLITE_E_READONLY_DBMOVED Handle = 0x87AF0408 + SQLITE_E_ABORT_ROLLBACK Handle = 0x87AF0204 + SQLITE_E_CONSTRAINT_CHECK Handle = 0x87AF0113 + SQLITE_E_CONSTRAINT_COMMITHOOK Handle = 0x87AF0213 + SQLITE_E_CONSTRAINT_FOREIGNKEY Handle = 0x87AF0313 + SQLITE_E_CONSTRAINT_FUNCTION Handle = 0x87AF0413 + SQLITE_E_CONSTRAINT_NOTNULL Handle = 0x87AF0513 + SQLITE_E_CONSTRAINT_PRIMARYKEY Handle = 0x87AF0613 + SQLITE_E_CONSTRAINT_TRIGGER Handle = 0x87AF0713 + SQLITE_E_CONSTRAINT_UNIQUE Handle = 0x87AF0813 + SQLITE_E_CONSTRAINT_VTAB Handle = 0x87AF0913 + SQLITE_E_CONSTRAINT_ROWID Handle = 0x87AF0A13 + SQLITE_E_NOTICE_RECOVER_WAL Handle = 0x87AF011B + SQLITE_E_NOTICE_RECOVER_ROLLBACK Handle = 0x87AF021B + SQLITE_E_WARNING_AUTOINDEX Handle = 0x87AF011C + UTC_E_TOGGLE_TRACE_STARTED Handle = 0x87C51001 + UTC_E_ALTERNATIVE_TRACE_CANNOT_PREEMPT Handle = 0x87C51002 + UTC_E_AOT_NOT_RUNNING Handle = 0x87C51003 + UTC_E_SCRIPT_TYPE_INVALID Handle = 0x87C51004 + UTC_E_SCENARIODEF_NOT_FOUND Handle = 0x87C51005 + UTC_E_TRACEPROFILE_NOT_FOUND Handle = 0x87C51006 + UTC_E_FORWARDER_ALREADY_ENABLED Handle = 0x87C51007 + UTC_E_FORWARDER_ALREADY_DISABLED Handle = 0x87C51008 + UTC_E_EVENTLOG_ENTRY_MALFORMED Handle = 0x87C51009 + UTC_E_DIAGRULES_SCHEMAVERSION_MISMATCH Handle = 0x87C5100A + UTC_E_SCRIPT_TERMINATED Handle = 0x87C5100B + UTC_E_INVALID_CUSTOM_FILTER Handle = 0x87C5100C + UTC_E_TRACE_NOT_RUNNING Handle = 0x87C5100D + UTC_E_REESCALATED_TOO_QUICKLY Handle = 0x87C5100E + UTC_E_ESCALATION_ALREADY_RUNNING Handle = 0x87C5100F + UTC_E_PERFTRACK_ALREADY_TRACING Handle = 0x87C51010 + UTC_E_REACHED_MAX_ESCALATIONS Handle = 0x87C51011 + UTC_E_FORWARDER_PRODUCER_MISMATCH Handle = 0x87C51012 + UTC_E_INTENTIONAL_SCRIPT_FAILURE Handle = 0x87C51013 + UTC_E_SQM_INIT_FAILED Handle = 0x87C51014 + UTC_E_NO_WER_LOGGER_SUPPORTED Handle = 0x87C51015 + UTC_E_TRACERS_DONT_EXIST Handle = 0x87C51016 + UTC_E_WINRT_INIT_FAILED Handle = 0x87C51017 + UTC_E_SCENARIODEF_SCHEMAVERSION_MISMATCH Handle = 0x87C51018 + UTC_E_INVALID_FILTER Handle = 0x87C51019 + UTC_E_EXE_TERMINATED Handle = 0x87C5101A + UTC_E_ESCALATION_NOT_AUTHORIZED Handle = 0x87C5101B + UTC_E_SETUP_NOT_AUTHORIZED Handle = 0x87C5101C + UTC_E_CHILD_PROCESS_FAILED Handle = 0x87C5101D + UTC_E_COMMAND_LINE_NOT_AUTHORIZED Handle = 0x87C5101E + UTC_E_CANNOT_LOAD_SCENARIO_EDITOR_XML Handle = 0x87C5101F + UTC_E_ESCALATION_TIMED_OUT Handle = 0x87C51020 + UTC_E_SETUP_TIMED_OUT Handle = 0x87C51021 + UTC_E_TRIGGER_MISMATCH Handle = 0x87C51022 + UTC_E_TRIGGER_NOT_FOUND Handle = 0x87C51023 + UTC_E_SIF_NOT_SUPPORTED Handle = 0x87C51024 + UTC_E_DELAY_TERMINATED Handle = 0x87C51025 + UTC_E_DEVICE_TICKET_ERROR Handle = 0x87C51026 + UTC_E_TRACE_BUFFER_LIMIT_EXCEEDED Handle = 0x87C51027 + UTC_E_API_RESULT_UNAVAILABLE Handle = 0x87C51028 + UTC_E_RPC_TIMEOUT Handle = 0x87C51029 + UTC_E_RPC_WAIT_FAILED Handle = 0x87C5102A + UTC_E_API_BUSY Handle = 0x87C5102B + UTC_E_TRACE_MIN_DURATION_REQUIREMENT_NOT_MET Handle = 0x87C5102C + UTC_E_EXCLUSIVITY_NOT_AVAILABLE Handle = 0x87C5102D + UTC_E_GETFILE_FILE_PATH_NOT_APPROVED Handle = 0x87C5102E + UTC_E_ESCALATION_DIRECTORY_ALREADY_EXISTS Handle = 0x87C5102F + UTC_E_TIME_TRIGGER_ON_START_INVALID Handle = 0x87C51030 + UTC_E_TIME_TRIGGER_ONLY_VALID_ON_SINGLE_TRANSITION Handle = 0x87C51031 + UTC_E_TIME_TRIGGER_INVALID_TIME_RANGE Handle = 0x87C51032 + UTC_E_MULTIPLE_TIME_TRIGGER_ON_SINGLE_STATE Handle = 0x87C51033 + UTC_E_BINARY_MISSING Handle = 0x87C51034 + UTC_E_NETWORK_CAPTURE_NOT_ALLOWED Handle = 0x87C51035 + UTC_E_FAILED_TO_RESOLVE_CONTAINER_ID Handle = 0x87C51036 + UTC_E_UNABLE_TO_RESOLVE_SESSION Handle = 0x87C51037 + UTC_E_THROTTLED Handle = 0x87C51038 + UTC_E_UNAPPROVED_SCRIPT Handle = 0x87C51039 + UTC_E_SCRIPT_MISSING Handle = 0x87C5103A + UTC_E_SCENARIO_THROTTLED Handle = 0x87C5103B + UTC_E_API_NOT_SUPPORTED Handle = 0x87C5103C + UTC_E_GETFILE_EXTERNAL_PATH_NOT_APPROVED Handle = 0x87C5103D + UTC_E_TRY_GET_SCENARIO_TIMEOUT_EXCEEDED Handle = 0x87C5103E + UTC_E_CERT_REV_FAILED Handle = 0x87C5103F + UTC_E_FAILED_TO_START_NDISCAP Handle = 0x87C51040 + UTC_E_KERNELDUMP_LIMIT_REACHED Handle = 0x87C51041 + UTC_E_MISSING_AGGREGATE_EVENT_TAG Handle = 0x87C51042 + UTC_E_INVALID_AGGREGATION_STRUCT Handle = 0x87C51043 + UTC_E_ACTION_NOT_SUPPORTED_IN_DESTINATION Handle = 0x87C51044 + UTC_E_FILTER_MISSING_ATTRIBUTE Handle = 0x87C51045 + UTC_E_FILTER_INVALID_TYPE Handle = 0x87C51046 + UTC_E_FILTER_VARIABLE_NOT_FOUND Handle = 0x87C51047 + UTC_E_FILTER_FUNCTION_RESTRICTED Handle = 0x87C51048 + UTC_E_FILTER_VERSION_MISMATCH Handle = 0x87C51049 + UTC_E_FILTER_INVALID_FUNCTION Handle = 0x87C51050 + UTC_E_FILTER_INVALID_FUNCTION_PARAMS Handle = 0x87C51051 + UTC_E_FILTER_INVALID_COMMAND Handle = 0x87C51052 + UTC_E_FILTER_ILLEGAL_EVAL Handle = 0x87C51053 + UTC_E_TTTRACER_RETURNED_ERROR Handle = 0x87C51054 + UTC_E_AGENT_DIAGNOSTICS_TOO_LARGE Handle = 0x87C51055 + UTC_E_FAILED_TO_RECEIVE_AGENT_DIAGNOSTICS Handle = 0x87C51056 + UTC_E_SCENARIO_HAS_NO_ACTIONS Handle = 0x87C51057 + UTC_E_TTTRACER_STORAGE_FULL Handle = 0x87C51058 + UTC_E_INSUFFICIENT_SPACE_TO_START_TRACE Handle = 0x87C51059 + UTC_E_ESCALATION_CANCELLED_AT_SHUTDOWN Handle = 0x87C5105A + UTC_E_GETFILEINFOACTION_FILE_NOT_APPROVED Handle = 0x87C5105B + UTC_E_SETREGKEYACTION_TYPE_NOT_APPROVED Handle = 0x87C5105C + WINML_ERR_INVALID_DEVICE Handle = 0x88900001 + WINML_ERR_INVALID_BINDING Handle = 0x88900002 + WINML_ERR_VALUE_NOTFOUND Handle = 0x88900003 + WINML_ERR_SIZE_MISMATCH Handle = 0x88900004 + STATUS_WAIT_0 NTStatus = 0x00000000 + STATUS_SUCCESS NTStatus = 0x00000000 + STATUS_WAIT_1 NTStatus = 0x00000001 + STATUS_WAIT_2 NTStatus = 0x00000002 + STATUS_WAIT_3 NTStatus = 0x00000003 + STATUS_WAIT_63 NTStatus = 0x0000003F + STATUS_ABANDONED NTStatus = 0x00000080 + STATUS_ABANDONED_WAIT_0 NTStatus = 0x00000080 + STATUS_ABANDONED_WAIT_63 NTStatus = 0x000000BF + STATUS_USER_APC NTStatus = 0x000000C0 + STATUS_ALREADY_COMPLETE NTStatus = 0x000000FF + STATUS_KERNEL_APC NTStatus = 0x00000100 + STATUS_ALERTED NTStatus = 0x00000101 + STATUS_TIMEOUT NTStatus = 0x00000102 + STATUS_PENDING NTStatus = 0x00000103 + STATUS_REPARSE NTStatus = 0x00000104 + STATUS_MORE_ENTRIES NTStatus = 0x00000105 + STATUS_NOT_ALL_ASSIGNED NTStatus = 0x00000106 + STATUS_SOME_NOT_MAPPED NTStatus = 0x00000107 + STATUS_OPLOCK_BREAK_IN_PROGRESS NTStatus = 0x00000108 + STATUS_VOLUME_MOUNTED NTStatus = 0x00000109 + STATUS_RXACT_COMMITTED NTStatus = 0x0000010A + STATUS_NOTIFY_CLEANUP NTStatus = 0x0000010B + STATUS_NOTIFY_ENUM_DIR NTStatus = 0x0000010C + STATUS_NO_QUOTAS_FOR_ACCOUNT NTStatus = 0x0000010D + STATUS_PRIMARY_TRANSPORT_CONNECT_FAILED NTStatus = 0x0000010E + STATUS_PAGE_FAULT_TRANSITION NTStatus = 0x00000110 + STATUS_PAGE_FAULT_DEMAND_ZERO NTStatus = 0x00000111 + STATUS_PAGE_FAULT_COPY_ON_WRITE NTStatus = 0x00000112 + STATUS_PAGE_FAULT_GUARD_PAGE NTStatus = 0x00000113 + STATUS_PAGE_FAULT_PAGING_FILE NTStatus = 0x00000114 + STATUS_CACHE_PAGE_LOCKED NTStatus = 0x00000115 + STATUS_CRASH_DUMP NTStatus = 0x00000116 + STATUS_BUFFER_ALL_ZEROS NTStatus = 0x00000117 + STATUS_REPARSE_OBJECT NTStatus = 0x00000118 + STATUS_RESOURCE_REQUIREMENTS_CHANGED NTStatus = 0x00000119 + STATUS_TRANSLATION_COMPLETE NTStatus = 0x00000120 + STATUS_DS_MEMBERSHIP_EVALUATED_LOCALLY NTStatus = 0x00000121 + STATUS_NOTHING_TO_TERMINATE NTStatus = 0x00000122 + STATUS_PROCESS_NOT_IN_JOB NTStatus = 0x00000123 + STATUS_PROCESS_IN_JOB NTStatus = 0x00000124 + STATUS_VOLSNAP_HIBERNATE_READY NTStatus = 0x00000125 + STATUS_FSFILTER_OP_COMPLETED_SUCCESSFULLY NTStatus = 0x00000126 + STATUS_INTERRUPT_VECTOR_ALREADY_CONNECTED NTStatus = 0x00000127 + STATUS_INTERRUPT_STILL_CONNECTED NTStatus = 0x00000128 + STATUS_PROCESS_CLONED NTStatus = 0x00000129 + STATUS_FILE_LOCKED_WITH_ONLY_READERS NTStatus = 0x0000012A + STATUS_FILE_LOCKED_WITH_WRITERS NTStatus = 0x0000012B + STATUS_VALID_IMAGE_HASH NTStatus = 0x0000012C + STATUS_VALID_CATALOG_HASH NTStatus = 0x0000012D + STATUS_VALID_STRONG_CODE_HASH NTStatus = 0x0000012E + STATUS_GHOSTED NTStatus = 0x0000012F + STATUS_DATA_OVERWRITTEN NTStatus = 0x00000130 + STATUS_RESOURCEMANAGER_READ_ONLY NTStatus = 0x00000202 + STATUS_RING_PREVIOUSLY_EMPTY NTStatus = 0x00000210 + STATUS_RING_PREVIOUSLY_FULL NTStatus = 0x00000211 + STATUS_RING_PREVIOUSLY_ABOVE_QUOTA NTStatus = 0x00000212 + STATUS_RING_NEWLY_EMPTY NTStatus = 0x00000213 + STATUS_RING_SIGNAL_OPPOSITE_ENDPOINT NTStatus = 0x00000214 + STATUS_OPLOCK_SWITCHED_TO_NEW_HANDLE NTStatus = 0x00000215 + STATUS_OPLOCK_HANDLE_CLOSED NTStatus = 0x00000216 + STATUS_WAIT_FOR_OPLOCK NTStatus = 0x00000367 + STATUS_REPARSE_GLOBAL NTStatus = 0x00000368 + STATUS_FLT_IO_COMPLETE NTStatus = 0x001C0001 + STATUS_OBJECT_NAME_EXISTS NTStatus = 0x40000000 + STATUS_THREAD_WAS_SUSPENDED NTStatus = 0x40000001 + STATUS_WORKING_SET_LIMIT_RANGE NTStatus = 0x40000002 + STATUS_IMAGE_NOT_AT_BASE NTStatus = 0x40000003 + STATUS_RXACT_STATE_CREATED NTStatus = 0x40000004 + STATUS_SEGMENT_NOTIFICATION NTStatus = 0x40000005 + STATUS_LOCAL_USER_SESSION_KEY NTStatus = 0x40000006 + STATUS_BAD_CURRENT_DIRECTORY NTStatus = 0x40000007 + STATUS_SERIAL_MORE_WRITES NTStatus = 0x40000008 + STATUS_REGISTRY_RECOVERED NTStatus = 0x40000009 + STATUS_FT_READ_RECOVERY_FROM_BACKUP NTStatus = 0x4000000A + STATUS_FT_WRITE_RECOVERY NTStatus = 0x4000000B + STATUS_SERIAL_COUNTER_TIMEOUT NTStatus = 0x4000000C + STATUS_NULL_LM_PASSWORD NTStatus = 0x4000000D + STATUS_IMAGE_MACHINE_TYPE_MISMATCH NTStatus = 0x4000000E + STATUS_RECEIVE_PARTIAL NTStatus = 0x4000000F + STATUS_RECEIVE_EXPEDITED NTStatus = 0x40000010 + STATUS_RECEIVE_PARTIAL_EXPEDITED NTStatus = 0x40000011 + STATUS_EVENT_DONE NTStatus = 0x40000012 + STATUS_EVENT_PENDING NTStatus = 0x40000013 + STATUS_CHECKING_FILE_SYSTEM NTStatus = 0x40000014 + STATUS_FATAL_APP_EXIT NTStatus = 0x40000015 + STATUS_PREDEFINED_HANDLE NTStatus = 0x40000016 + STATUS_WAS_UNLOCKED NTStatus = 0x40000017 + STATUS_SERVICE_NOTIFICATION NTStatus = 0x40000018 + STATUS_WAS_LOCKED NTStatus = 0x40000019 + STATUS_LOG_HARD_ERROR NTStatus = 0x4000001A + STATUS_ALREADY_WIN32 NTStatus = 0x4000001B + STATUS_WX86_UNSIMULATE NTStatus = 0x4000001C + STATUS_WX86_CONTINUE NTStatus = 0x4000001D + STATUS_WX86_SINGLE_STEP NTStatus = 0x4000001E + STATUS_WX86_BREAKPOINT NTStatus = 0x4000001F + STATUS_WX86_EXCEPTION_CONTINUE NTStatus = 0x40000020 + STATUS_WX86_EXCEPTION_LASTCHANCE NTStatus = 0x40000021 + STATUS_WX86_EXCEPTION_CHAIN NTStatus = 0x40000022 + STATUS_IMAGE_MACHINE_TYPE_MISMATCH_EXE NTStatus = 0x40000023 + STATUS_NO_YIELD_PERFORMED NTStatus = 0x40000024 + STATUS_TIMER_RESUME_IGNORED NTStatus = 0x40000025 + STATUS_ARBITRATION_UNHANDLED NTStatus = 0x40000026 + STATUS_CARDBUS_NOT_SUPPORTED NTStatus = 0x40000027 + STATUS_WX86_CREATEWX86TIB NTStatus = 0x40000028 + STATUS_MP_PROCESSOR_MISMATCH NTStatus = 0x40000029 + STATUS_HIBERNATED NTStatus = 0x4000002A + STATUS_RESUME_HIBERNATION NTStatus = 0x4000002B + STATUS_FIRMWARE_UPDATED NTStatus = 0x4000002C + STATUS_DRIVERS_LEAKING_LOCKED_PAGES NTStatus = 0x4000002D + STATUS_MESSAGE_RETRIEVED NTStatus = 0x4000002E + STATUS_SYSTEM_POWERSTATE_TRANSITION NTStatus = 0x4000002F + STATUS_ALPC_CHECK_COMPLETION_LIST NTStatus = 0x40000030 + STATUS_SYSTEM_POWERSTATE_COMPLEX_TRANSITION NTStatus = 0x40000031 + STATUS_ACCESS_AUDIT_BY_POLICY NTStatus = 0x40000032 + STATUS_ABANDON_HIBERFILE NTStatus = 0x40000033 + STATUS_BIZRULES_NOT_ENABLED NTStatus = 0x40000034 + STATUS_FT_READ_FROM_COPY NTStatus = 0x40000035 + STATUS_IMAGE_AT_DIFFERENT_BASE NTStatus = 0x40000036 + STATUS_PATCH_DEFERRED NTStatus = 0x40000037 + STATUS_HEURISTIC_DAMAGE_POSSIBLE NTStatus = 0x40190001 + STATUS_GUARD_PAGE_VIOLATION NTStatus = 0x80000001 + STATUS_DATATYPE_MISALIGNMENT NTStatus = 0x80000002 + STATUS_BREAKPOINT NTStatus = 0x80000003 + STATUS_SINGLE_STEP NTStatus = 0x80000004 + STATUS_BUFFER_OVERFLOW NTStatus = 0x80000005 + STATUS_NO_MORE_FILES NTStatus = 0x80000006 + STATUS_WAKE_SYSTEM_DEBUGGER NTStatus = 0x80000007 + STATUS_HANDLES_CLOSED NTStatus = 0x8000000A + STATUS_NO_INHERITANCE NTStatus = 0x8000000B + STATUS_GUID_SUBSTITUTION_MADE NTStatus = 0x8000000C + STATUS_PARTIAL_COPY NTStatus = 0x8000000D + STATUS_DEVICE_PAPER_EMPTY NTStatus = 0x8000000E + STATUS_DEVICE_POWERED_OFF NTStatus = 0x8000000F + STATUS_DEVICE_OFF_LINE NTStatus = 0x80000010 + STATUS_DEVICE_BUSY NTStatus = 0x80000011 + STATUS_NO_MORE_EAS NTStatus = 0x80000012 + STATUS_INVALID_EA_NAME NTStatus = 0x80000013 + STATUS_EA_LIST_INCONSISTENT NTStatus = 0x80000014 + STATUS_INVALID_EA_FLAG NTStatus = 0x80000015 + STATUS_VERIFY_REQUIRED NTStatus = 0x80000016 + STATUS_EXTRANEOUS_INFORMATION NTStatus = 0x80000017 + STATUS_RXACT_COMMIT_NECESSARY NTStatus = 0x80000018 + STATUS_NO_MORE_ENTRIES NTStatus = 0x8000001A + STATUS_FILEMARK_DETECTED NTStatus = 0x8000001B + STATUS_MEDIA_CHANGED NTStatus = 0x8000001C + STATUS_BUS_RESET NTStatus = 0x8000001D + STATUS_END_OF_MEDIA NTStatus = 0x8000001E + STATUS_BEGINNING_OF_MEDIA NTStatus = 0x8000001F + STATUS_MEDIA_CHECK NTStatus = 0x80000020 + STATUS_SETMARK_DETECTED NTStatus = 0x80000021 + STATUS_NO_DATA_DETECTED NTStatus = 0x80000022 + STATUS_REDIRECTOR_HAS_OPEN_HANDLES NTStatus = 0x80000023 + STATUS_SERVER_HAS_OPEN_HANDLES NTStatus = 0x80000024 + STATUS_ALREADY_DISCONNECTED NTStatus = 0x80000025 + STATUS_LONGJUMP NTStatus = 0x80000026 + STATUS_CLEANER_CARTRIDGE_INSTALLED NTStatus = 0x80000027 + STATUS_PLUGPLAY_QUERY_VETOED NTStatus = 0x80000028 + STATUS_UNWIND_CONSOLIDATE NTStatus = 0x80000029 + STATUS_REGISTRY_HIVE_RECOVERED NTStatus = 0x8000002A + STATUS_DLL_MIGHT_BE_INSECURE NTStatus = 0x8000002B + STATUS_DLL_MIGHT_BE_INCOMPATIBLE NTStatus = 0x8000002C + STATUS_STOPPED_ON_SYMLINK NTStatus = 0x8000002D + STATUS_CANNOT_GRANT_REQUESTED_OPLOCK NTStatus = 0x8000002E + STATUS_NO_ACE_CONDITION NTStatus = 0x8000002F + STATUS_DEVICE_SUPPORT_IN_PROGRESS NTStatus = 0x80000030 + STATUS_DEVICE_POWER_CYCLE_REQUIRED NTStatus = 0x80000031 + STATUS_NO_WORK_DONE NTStatus = 0x80000032 + STATUS_CLUSTER_NODE_ALREADY_UP NTStatus = 0x80130001 + STATUS_CLUSTER_NODE_ALREADY_DOWN NTStatus = 0x80130002 + STATUS_CLUSTER_NETWORK_ALREADY_ONLINE NTStatus = 0x80130003 + STATUS_CLUSTER_NETWORK_ALREADY_OFFLINE NTStatus = 0x80130004 + STATUS_CLUSTER_NODE_ALREADY_MEMBER NTStatus = 0x80130005 + STATUS_FLT_BUFFER_TOO_SMALL NTStatus = 0x801C0001 + STATUS_FVE_PARTIAL_METADATA NTStatus = 0x80210001 + STATUS_FVE_TRANSIENT_STATE NTStatus = 0x80210002 + STATUS_CLOUD_FILE_PROPERTY_BLOB_CHECKSUM_MISMATCH NTStatus = 0x8000CF00 + STATUS_UNSUCCESSFUL NTStatus = 0xC0000001 + STATUS_NOT_IMPLEMENTED NTStatus = 0xC0000002 + STATUS_INVALID_INFO_CLASS NTStatus = 0xC0000003 + STATUS_INFO_LENGTH_MISMATCH NTStatus = 0xC0000004 + STATUS_ACCESS_VIOLATION NTStatus = 0xC0000005 + STATUS_IN_PAGE_ERROR NTStatus = 0xC0000006 + STATUS_PAGEFILE_QUOTA NTStatus = 0xC0000007 + STATUS_INVALID_HANDLE NTStatus = 0xC0000008 + STATUS_BAD_INITIAL_STACK NTStatus = 0xC0000009 + STATUS_BAD_INITIAL_PC NTStatus = 0xC000000A + STATUS_INVALID_CID NTStatus = 0xC000000B + STATUS_TIMER_NOT_CANCELED NTStatus = 0xC000000C + STATUS_INVALID_PARAMETER NTStatus = 0xC000000D + STATUS_NO_SUCH_DEVICE NTStatus = 0xC000000E + STATUS_NO_SUCH_FILE NTStatus = 0xC000000F + STATUS_INVALID_DEVICE_REQUEST NTStatus = 0xC0000010 + STATUS_END_OF_FILE NTStatus = 0xC0000011 + STATUS_WRONG_VOLUME NTStatus = 0xC0000012 + STATUS_NO_MEDIA_IN_DEVICE NTStatus = 0xC0000013 + STATUS_UNRECOGNIZED_MEDIA NTStatus = 0xC0000014 + STATUS_NONEXISTENT_SECTOR NTStatus = 0xC0000015 + STATUS_MORE_PROCESSING_REQUIRED NTStatus = 0xC0000016 + STATUS_NO_MEMORY NTStatus = 0xC0000017 + STATUS_CONFLICTING_ADDRESSES NTStatus = 0xC0000018 + STATUS_NOT_MAPPED_VIEW NTStatus = 0xC0000019 + STATUS_UNABLE_TO_FREE_VM NTStatus = 0xC000001A + STATUS_UNABLE_TO_DELETE_SECTION NTStatus = 0xC000001B + STATUS_INVALID_SYSTEM_SERVICE NTStatus = 0xC000001C + STATUS_ILLEGAL_INSTRUCTION NTStatus = 0xC000001D + STATUS_INVALID_LOCK_SEQUENCE NTStatus = 0xC000001E + STATUS_INVALID_VIEW_SIZE NTStatus = 0xC000001F + STATUS_INVALID_FILE_FOR_SECTION NTStatus = 0xC0000020 + STATUS_ALREADY_COMMITTED NTStatus = 0xC0000021 + STATUS_ACCESS_DENIED NTStatus = 0xC0000022 + STATUS_BUFFER_TOO_SMALL NTStatus = 0xC0000023 + STATUS_OBJECT_TYPE_MISMATCH NTStatus = 0xC0000024 + STATUS_NONCONTINUABLE_EXCEPTION NTStatus = 0xC0000025 + STATUS_INVALID_DISPOSITION NTStatus = 0xC0000026 + STATUS_UNWIND NTStatus = 0xC0000027 + STATUS_BAD_STACK NTStatus = 0xC0000028 + STATUS_INVALID_UNWIND_TARGET NTStatus = 0xC0000029 + STATUS_NOT_LOCKED NTStatus = 0xC000002A + STATUS_PARITY_ERROR NTStatus = 0xC000002B + STATUS_UNABLE_TO_DECOMMIT_VM NTStatus = 0xC000002C + STATUS_NOT_COMMITTED NTStatus = 0xC000002D + STATUS_INVALID_PORT_ATTRIBUTES NTStatus = 0xC000002E + STATUS_PORT_MESSAGE_TOO_LONG NTStatus = 0xC000002F + STATUS_INVALID_PARAMETER_MIX NTStatus = 0xC0000030 + STATUS_INVALID_QUOTA_LOWER NTStatus = 0xC0000031 + STATUS_DISK_CORRUPT_ERROR NTStatus = 0xC0000032 + STATUS_OBJECT_NAME_INVALID NTStatus = 0xC0000033 + STATUS_OBJECT_NAME_NOT_FOUND NTStatus = 0xC0000034 + STATUS_OBJECT_NAME_COLLISION NTStatus = 0xC0000035 + STATUS_PORT_DO_NOT_DISTURB NTStatus = 0xC0000036 + STATUS_PORT_DISCONNECTED NTStatus = 0xC0000037 + STATUS_DEVICE_ALREADY_ATTACHED NTStatus = 0xC0000038 + STATUS_OBJECT_PATH_INVALID NTStatus = 0xC0000039 + STATUS_OBJECT_PATH_NOT_FOUND NTStatus = 0xC000003A + STATUS_OBJECT_PATH_SYNTAX_BAD NTStatus = 0xC000003B + STATUS_DATA_OVERRUN NTStatus = 0xC000003C + STATUS_DATA_LATE_ERROR NTStatus = 0xC000003D + STATUS_DATA_ERROR NTStatus = 0xC000003E + STATUS_CRC_ERROR NTStatus = 0xC000003F + STATUS_SECTION_TOO_BIG NTStatus = 0xC0000040 + STATUS_PORT_CONNECTION_REFUSED NTStatus = 0xC0000041 + STATUS_INVALID_PORT_HANDLE NTStatus = 0xC0000042 + STATUS_SHARING_VIOLATION NTStatus = 0xC0000043 + STATUS_QUOTA_EXCEEDED NTStatus = 0xC0000044 + STATUS_INVALID_PAGE_PROTECTION NTStatus = 0xC0000045 + STATUS_MUTANT_NOT_OWNED NTStatus = 0xC0000046 + STATUS_SEMAPHORE_LIMIT_EXCEEDED NTStatus = 0xC0000047 + STATUS_PORT_ALREADY_SET NTStatus = 0xC0000048 + STATUS_SECTION_NOT_IMAGE NTStatus = 0xC0000049 + STATUS_SUSPEND_COUNT_EXCEEDED NTStatus = 0xC000004A + STATUS_THREAD_IS_TERMINATING NTStatus = 0xC000004B + STATUS_BAD_WORKING_SET_LIMIT NTStatus = 0xC000004C + STATUS_INCOMPATIBLE_FILE_MAP NTStatus = 0xC000004D + STATUS_SECTION_PROTECTION NTStatus = 0xC000004E + STATUS_EAS_NOT_SUPPORTED NTStatus = 0xC000004F + STATUS_EA_TOO_LARGE NTStatus = 0xC0000050 + STATUS_NONEXISTENT_EA_ENTRY NTStatus = 0xC0000051 + STATUS_NO_EAS_ON_FILE NTStatus = 0xC0000052 + STATUS_EA_CORRUPT_ERROR NTStatus = 0xC0000053 + STATUS_FILE_LOCK_CONFLICT NTStatus = 0xC0000054 + STATUS_LOCK_NOT_GRANTED NTStatus = 0xC0000055 + STATUS_DELETE_PENDING NTStatus = 0xC0000056 + STATUS_CTL_FILE_NOT_SUPPORTED NTStatus = 0xC0000057 + STATUS_UNKNOWN_REVISION NTStatus = 0xC0000058 + STATUS_REVISION_MISMATCH NTStatus = 0xC0000059 + STATUS_INVALID_OWNER NTStatus = 0xC000005A + STATUS_INVALID_PRIMARY_GROUP NTStatus = 0xC000005B + STATUS_NO_IMPERSONATION_TOKEN NTStatus = 0xC000005C + STATUS_CANT_DISABLE_MANDATORY NTStatus = 0xC000005D + STATUS_NO_LOGON_SERVERS NTStatus = 0xC000005E + STATUS_NO_SUCH_LOGON_SESSION NTStatus = 0xC000005F + STATUS_NO_SUCH_PRIVILEGE NTStatus = 0xC0000060 + STATUS_PRIVILEGE_NOT_HELD NTStatus = 0xC0000061 + STATUS_INVALID_ACCOUNT_NAME NTStatus = 0xC0000062 + STATUS_USER_EXISTS NTStatus = 0xC0000063 + STATUS_NO_SUCH_USER NTStatus = 0xC0000064 + STATUS_GROUP_EXISTS NTStatus = 0xC0000065 + STATUS_NO_SUCH_GROUP NTStatus = 0xC0000066 + STATUS_MEMBER_IN_GROUP NTStatus = 0xC0000067 + STATUS_MEMBER_NOT_IN_GROUP NTStatus = 0xC0000068 + STATUS_LAST_ADMIN NTStatus = 0xC0000069 + STATUS_WRONG_PASSWORD NTStatus = 0xC000006A + STATUS_ILL_FORMED_PASSWORD NTStatus = 0xC000006B + STATUS_PASSWORD_RESTRICTION NTStatus = 0xC000006C + STATUS_LOGON_FAILURE NTStatus = 0xC000006D + STATUS_ACCOUNT_RESTRICTION NTStatus = 0xC000006E + STATUS_INVALID_LOGON_HOURS NTStatus = 0xC000006F + STATUS_INVALID_WORKSTATION NTStatus = 0xC0000070 + STATUS_PASSWORD_EXPIRED NTStatus = 0xC0000071 + STATUS_ACCOUNT_DISABLED NTStatus = 0xC0000072 + STATUS_NONE_MAPPED NTStatus = 0xC0000073 + STATUS_TOO_MANY_LUIDS_REQUESTED NTStatus = 0xC0000074 + STATUS_LUIDS_EXHAUSTED NTStatus = 0xC0000075 + STATUS_INVALID_SUB_AUTHORITY NTStatus = 0xC0000076 + STATUS_INVALID_ACL NTStatus = 0xC0000077 + STATUS_INVALID_SID NTStatus = 0xC0000078 + STATUS_INVALID_SECURITY_DESCR NTStatus = 0xC0000079 + STATUS_PROCEDURE_NOT_FOUND NTStatus = 0xC000007A + STATUS_INVALID_IMAGE_FORMAT NTStatus = 0xC000007B + STATUS_NO_TOKEN NTStatus = 0xC000007C + STATUS_BAD_INHERITANCE_ACL NTStatus = 0xC000007D + STATUS_RANGE_NOT_LOCKED NTStatus = 0xC000007E + STATUS_DISK_FULL NTStatus = 0xC000007F + STATUS_SERVER_DISABLED NTStatus = 0xC0000080 + STATUS_SERVER_NOT_DISABLED NTStatus = 0xC0000081 + STATUS_TOO_MANY_GUIDS_REQUESTED NTStatus = 0xC0000082 + STATUS_GUIDS_EXHAUSTED NTStatus = 0xC0000083 + STATUS_INVALID_ID_AUTHORITY NTStatus = 0xC0000084 + STATUS_AGENTS_EXHAUSTED NTStatus = 0xC0000085 + STATUS_INVALID_VOLUME_LABEL NTStatus = 0xC0000086 + STATUS_SECTION_NOT_EXTENDED NTStatus = 0xC0000087 + STATUS_NOT_MAPPED_DATA NTStatus = 0xC0000088 + STATUS_RESOURCE_DATA_NOT_FOUND NTStatus = 0xC0000089 + STATUS_RESOURCE_TYPE_NOT_FOUND NTStatus = 0xC000008A + STATUS_RESOURCE_NAME_NOT_FOUND NTStatus = 0xC000008B + STATUS_ARRAY_BOUNDS_EXCEEDED NTStatus = 0xC000008C + STATUS_FLOAT_DENORMAL_OPERAND NTStatus = 0xC000008D + STATUS_FLOAT_DIVIDE_BY_ZERO NTStatus = 0xC000008E + STATUS_FLOAT_INEXACT_RESULT NTStatus = 0xC000008F + STATUS_FLOAT_INVALID_OPERATION NTStatus = 0xC0000090 + STATUS_FLOAT_OVERFLOW NTStatus = 0xC0000091 + STATUS_FLOAT_STACK_CHECK NTStatus = 0xC0000092 + STATUS_FLOAT_UNDERFLOW NTStatus = 0xC0000093 + STATUS_INTEGER_DIVIDE_BY_ZERO NTStatus = 0xC0000094 + STATUS_INTEGER_OVERFLOW NTStatus = 0xC0000095 + STATUS_PRIVILEGED_INSTRUCTION NTStatus = 0xC0000096 + STATUS_TOO_MANY_PAGING_FILES NTStatus = 0xC0000097 + STATUS_FILE_INVALID NTStatus = 0xC0000098 + STATUS_ALLOTTED_SPACE_EXCEEDED NTStatus = 0xC0000099 + STATUS_INSUFFICIENT_RESOURCES NTStatus = 0xC000009A + STATUS_DFS_EXIT_PATH_FOUND NTStatus = 0xC000009B + STATUS_DEVICE_DATA_ERROR NTStatus = 0xC000009C + STATUS_DEVICE_NOT_CONNECTED NTStatus = 0xC000009D + STATUS_DEVICE_POWER_FAILURE NTStatus = 0xC000009E + STATUS_FREE_VM_NOT_AT_BASE NTStatus = 0xC000009F + STATUS_MEMORY_NOT_ALLOCATED NTStatus = 0xC00000A0 + STATUS_WORKING_SET_QUOTA NTStatus = 0xC00000A1 + STATUS_MEDIA_WRITE_PROTECTED NTStatus = 0xC00000A2 + STATUS_DEVICE_NOT_READY NTStatus = 0xC00000A3 + STATUS_INVALID_GROUP_ATTRIBUTES NTStatus = 0xC00000A4 + STATUS_BAD_IMPERSONATION_LEVEL NTStatus = 0xC00000A5 + STATUS_CANT_OPEN_ANONYMOUS NTStatus = 0xC00000A6 + STATUS_BAD_VALIDATION_CLASS NTStatus = 0xC00000A7 + STATUS_BAD_TOKEN_TYPE NTStatus = 0xC00000A8 + STATUS_BAD_MASTER_BOOT_RECORD NTStatus = 0xC00000A9 + STATUS_INSTRUCTION_MISALIGNMENT NTStatus = 0xC00000AA + STATUS_INSTANCE_NOT_AVAILABLE NTStatus = 0xC00000AB + STATUS_PIPE_NOT_AVAILABLE NTStatus = 0xC00000AC + STATUS_INVALID_PIPE_STATE NTStatus = 0xC00000AD + STATUS_PIPE_BUSY NTStatus = 0xC00000AE + STATUS_ILLEGAL_FUNCTION NTStatus = 0xC00000AF + STATUS_PIPE_DISCONNECTED NTStatus = 0xC00000B0 + STATUS_PIPE_CLOSING NTStatus = 0xC00000B1 + STATUS_PIPE_CONNECTED NTStatus = 0xC00000B2 + STATUS_PIPE_LISTENING NTStatus = 0xC00000B3 + STATUS_INVALID_READ_MODE NTStatus = 0xC00000B4 + STATUS_IO_TIMEOUT NTStatus = 0xC00000B5 + STATUS_FILE_FORCED_CLOSED NTStatus = 0xC00000B6 + STATUS_PROFILING_NOT_STARTED NTStatus = 0xC00000B7 + STATUS_PROFILING_NOT_STOPPED NTStatus = 0xC00000B8 + STATUS_COULD_NOT_INTERPRET NTStatus = 0xC00000B9 + STATUS_FILE_IS_A_DIRECTORY NTStatus = 0xC00000BA + STATUS_NOT_SUPPORTED NTStatus = 0xC00000BB + STATUS_REMOTE_NOT_LISTENING NTStatus = 0xC00000BC + STATUS_DUPLICATE_NAME NTStatus = 0xC00000BD + STATUS_BAD_NETWORK_PATH NTStatus = 0xC00000BE + STATUS_NETWORK_BUSY NTStatus = 0xC00000BF + STATUS_DEVICE_DOES_NOT_EXIST NTStatus = 0xC00000C0 + STATUS_TOO_MANY_COMMANDS NTStatus = 0xC00000C1 + STATUS_ADAPTER_HARDWARE_ERROR NTStatus = 0xC00000C2 + STATUS_INVALID_NETWORK_RESPONSE NTStatus = 0xC00000C3 + STATUS_UNEXPECTED_NETWORK_ERROR NTStatus = 0xC00000C4 + STATUS_BAD_REMOTE_ADAPTER NTStatus = 0xC00000C5 + STATUS_PRINT_QUEUE_FULL NTStatus = 0xC00000C6 + STATUS_NO_SPOOL_SPACE NTStatus = 0xC00000C7 + STATUS_PRINT_CANCELLED NTStatus = 0xC00000C8 + STATUS_NETWORK_NAME_DELETED NTStatus = 0xC00000C9 + STATUS_NETWORK_ACCESS_DENIED NTStatus = 0xC00000CA + STATUS_BAD_DEVICE_TYPE NTStatus = 0xC00000CB + STATUS_BAD_NETWORK_NAME NTStatus = 0xC00000CC + STATUS_TOO_MANY_NAMES NTStatus = 0xC00000CD + STATUS_TOO_MANY_SESSIONS NTStatus = 0xC00000CE + STATUS_SHARING_PAUSED NTStatus = 0xC00000CF + STATUS_REQUEST_NOT_ACCEPTED NTStatus = 0xC00000D0 + STATUS_REDIRECTOR_PAUSED NTStatus = 0xC00000D1 + STATUS_NET_WRITE_FAULT NTStatus = 0xC00000D2 + STATUS_PROFILING_AT_LIMIT NTStatus = 0xC00000D3 + STATUS_NOT_SAME_DEVICE NTStatus = 0xC00000D4 + STATUS_FILE_RENAMED NTStatus = 0xC00000D5 + STATUS_VIRTUAL_CIRCUIT_CLOSED NTStatus = 0xC00000D6 + STATUS_NO_SECURITY_ON_OBJECT NTStatus = 0xC00000D7 + STATUS_CANT_WAIT NTStatus = 0xC00000D8 + STATUS_PIPE_EMPTY NTStatus = 0xC00000D9 + STATUS_CANT_ACCESS_DOMAIN_INFO NTStatus = 0xC00000DA + STATUS_CANT_TERMINATE_SELF NTStatus = 0xC00000DB + STATUS_INVALID_SERVER_STATE NTStatus = 0xC00000DC + STATUS_INVALID_DOMAIN_STATE NTStatus = 0xC00000DD + STATUS_INVALID_DOMAIN_ROLE NTStatus = 0xC00000DE + STATUS_NO_SUCH_DOMAIN NTStatus = 0xC00000DF + STATUS_DOMAIN_EXISTS NTStatus = 0xC00000E0 + STATUS_DOMAIN_LIMIT_EXCEEDED NTStatus = 0xC00000E1 + STATUS_OPLOCK_NOT_GRANTED NTStatus = 0xC00000E2 + STATUS_INVALID_OPLOCK_PROTOCOL NTStatus = 0xC00000E3 + STATUS_INTERNAL_DB_CORRUPTION NTStatus = 0xC00000E4 + STATUS_INTERNAL_ERROR NTStatus = 0xC00000E5 + STATUS_GENERIC_NOT_MAPPED NTStatus = 0xC00000E6 + STATUS_BAD_DESCRIPTOR_FORMAT NTStatus = 0xC00000E7 + STATUS_INVALID_USER_BUFFER NTStatus = 0xC00000E8 + STATUS_UNEXPECTED_IO_ERROR NTStatus = 0xC00000E9 + STATUS_UNEXPECTED_MM_CREATE_ERR NTStatus = 0xC00000EA + STATUS_UNEXPECTED_MM_MAP_ERROR NTStatus = 0xC00000EB + STATUS_UNEXPECTED_MM_EXTEND_ERR NTStatus = 0xC00000EC + STATUS_NOT_LOGON_PROCESS NTStatus = 0xC00000ED + STATUS_LOGON_SESSION_EXISTS NTStatus = 0xC00000EE + STATUS_INVALID_PARAMETER_1 NTStatus = 0xC00000EF + STATUS_INVALID_PARAMETER_2 NTStatus = 0xC00000F0 + STATUS_INVALID_PARAMETER_3 NTStatus = 0xC00000F1 + STATUS_INVALID_PARAMETER_4 NTStatus = 0xC00000F2 + STATUS_INVALID_PARAMETER_5 NTStatus = 0xC00000F3 + STATUS_INVALID_PARAMETER_6 NTStatus = 0xC00000F4 + STATUS_INVALID_PARAMETER_7 NTStatus = 0xC00000F5 + STATUS_INVALID_PARAMETER_8 NTStatus = 0xC00000F6 + STATUS_INVALID_PARAMETER_9 NTStatus = 0xC00000F7 + STATUS_INVALID_PARAMETER_10 NTStatus = 0xC00000F8 + STATUS_INVALID_PARAMETER_11 NTStatus = 0xC00000F9 + STATUS_INVALID_PARAMETER_12 NTStatus = 0xC00000FA + STATUS_REDIRECTOR_NOT_STARTED NTStatus = 0xC00000FB + STATUS_REDIRECTOR_STARTED NTStatus = 0xC00000FC + STATUS_STACK_OVERFLOW NTStatus = 0xC00000FD + STATUS_NO_SUCH_PACKAGE NTStatus = 0xC00000FE + STATUS_BAD_FUNCTION_TABLE NTStatus = 0xC00000FF + STATUS_VARIABLE_NOT_FOUND NTStatus = 0xC0000100 + STATUS_DIRECTORY_NOT_EMPTY NTStatus = 0xC0000101 + STATUS_FILE_CORRUPT_ERROR NTStatus = 0xC0000102 + STATUS_NOT_A_DIRECTORY NTStatus = 0xC0000103 + STATUS_BAD_LOGON_SESSION_STATE NTStatus = 0xC0000104 + STATUS_LOGON_SESSION_COLLISION NTStatus = 0xC0000105 + STATUS_NAME_TOO_LONG NTStatus = 0xC0000106 + STATUS_FILES_OPEN NTStatus = 0xC0000107 + STATUS_CONNECTION_IN_USE NTStatus = 0xC0000108 + STATUS_MESSAGE_NOT_FOUND NTStatus = 0xC0000109 + STATUS_PROCESS_IS_TERMINATING NTStatus = 0xC000010A + STATUS_INVALID_LOGON_TYPE NTStatus = 0xC000010B + STATUS_NO_GUID_TRANSLATION NTStatus = 0xC000010C + STATUS_CANNOT_IMPERSONATE NTStatus = 0xC000010D + STATUS_IMAGE_ALREADY_LOADED NTStatus = 0xC000010E + STATUS_ABIOS_NOT_PRESENT NTStatus = 0xC000010F + STATUS_ABIOS_LID_NOT_EXIST NTStatus = 0xC0000110 + STATUS_ABIOS_LID_ALREADY_OWNED NTStatus = 0xC0000111 + STATUS_ABIOS_NOT_LID_OWNER NTStatus = 0xC0000112 + STATUS_ABIOS_INVALID_COMMAND NTStatus = 0xC0000113 + STATUS_ABIOS_INVALID_LID NTStatus = 0xC0000114 + STATUS_ABIOS_SELECTOR_NOT_AVAILABLE NTStatus = 0xC0000115 + STATUS_ABIOS_INVALID_SELECTOR NTStatus = 0xC0000116 + STATUS_NO_LDT NTStatus = 0xC0000117 + STATUS_INVALID_LDT_SIZE NTStatus = 0xC0000118 + STATUS_INVALID_LDT_OFFSET NTStatus = 0xC0000119 + STATUS_INVALID_LDT_DESCRIPTOR NTStatus = 0xC000011A + STATUS_INVALID_IMAGE_NE_FORMAT NTStatus = 0xC000011B + STATUS_RXACT_INVALID_STATE NTStatus = 0xC000011C + STATUS_RXACT_COMMIT_FAILURE NTStatus = 0xC000011D + STATUS_MAPPED_FILE_SIZE_ZERO NTStatus = 0xC000011E + STATUS_TOO_MANY_OPENED_FILES NTStatus = 0xC000011F + STATUS_CANCELLED NTStatus = 0xC0000120 + STATUS_CANNOT_DELETE NTStatus = 0xC0000121 + STATUS_INVALID_COMPUTER_NAME NTStatus = 0xC0000122 + STATUS_FILE_DELETED NTStatus = 0xC0000123 + STATUS_SPECIAL_ACCOUNT NTStatus = 0xC0000124 + STATUS_SPECIAL_GROUP NTStatus = 0xC0000125 + STATUS_SPECIAL_USER NTStatus = 0xC0000126 + STATUS_MEMBERS_PRIMARY_GROUP NTStatus = 0xC0000127 + STATUS_FILE_CLOSED NTStatus = 0xC0000128 + STATUS_TOO_MANY_THREADS NTStatus = 0xC0000129 + STATUS_THREAD_NOT_IN_PROCESS NTStatus = 0xC000012A + STATUS_TOKEN_ALREADY_IN_USE NTStatus = 0xC000012B + STATUS_PAGEFILE_QUOTA_EXCEEDED NTStatus = 0xC000012C + STATUS_COMMITMENT_LIMIT NTStatus = 0xC000012D + STATUS_INVALID_IMAGE_LE_FORMAT NTStatus = 0xC000012E + STATUS_INVALID_IMAGE_NOT_MZ NTStatus = 0xC000012F + STATUS_INVALID_IMAGE_PROTECT NTStatus = 0xC0000130 + STATUS_INVALID_IMAGE_WIN_16 NTStatus = 0xC0000131 + STATUS_LOGON_SERVER_CONFLICT NTStatus = 0xC0000132 + STATUS_TIME_DIFFERENCE_AT_DC NTStatus = 0xC0000133 + STATUS_SYNCHRONIZATION_REQUIRED NTStatus = 0xC0000134 + STATUS_DLL_NOT_FOUND NTStatus = 0xC0000135 + STATUS_OPEN_FAILED NTStatus = 0xC0000136 + STATUS_IO_PRIVILEGE_FAILED NTStatus = 0xC0000137 + STATUS_ORDINAL_NOT_FOUND NTStatus = 0xC0000138 + STATUS_ENTRYPOINT_NOT_FOUND NTStatus = 0xC0000139 + STATUS_CONTROL_C_EXIT NTStatus = 0xC000013A + STATUS_LOCAL_DISCONNECT NTStatus = 0xC000013B + STATUS_REMOTE_DISCONNECT NTStatus = 0xC000013C + STATUS_REMOTE_RESOURCES NTStatus = 0xC000013D + STATUS_LINK_FAILED NTStatus = 0xC000013E + STATUS_LINK_TIMEOUT NTStatus = 0xC000013F + STATUS_INVALID_CONNECTION NTStatus = 0xC0000140 + STATUS_INVALID_ADDRESS NTStatus = 0xC0000141 + STATUS_DLL_INIT_FAILED NTStatus = 0xC0000142 + STATUS_MISSING_SYSTEMFILE NTStatus = 0xC0000143 + STATUS_UNHANDLED_EXCEPTION NTStatus = 0xC0000144 + STATUS_APP_INIT_FAILURE NTStatus = 0xC0000145 + STATUS_PAGEFILE_CREATE_FAILED NTStatus = 0xC0000146 + STATUS_NO_PAGEFILE NTStatus = 0xC0000147 + STATUS_INVALID_LEVEL NTStatus = 0xC0000148 + STATUS_WRONG_PASSWORD_CORE NTStatus = 0xC0000149 + STATUS_ILLEGAL_FLOAT_CONTEXT NTStatus = 0xC000014A + STATUS_PIPE_BROKEN NTStatus = 0xC000014B + STATUS_REGISTRY_CORRUPT NTStatus = 0xC000014C + STATUS_REGISTRY_IO_FAILED NTStatus = 0xC000014D + STATUS_NO_EVENT_PAIR NTStatus = 0xC000014E + STATUS_UNRECOGNIZED_VOLUME NTStatus = 0xC000014F + STATUS_SERIAL_NO_DEVICE_INITED NTStatus = 0xC0000150 + STATUS_NO_SUCH_ALIAS NTStatus = 0xC0000151 + STATUS_MEMBER_NOT_IN_ALIAS NTStatus = 0xC0000152 + STATUS_MEMBER_IN_ALIAS NTStatus = 0xC0000153 + STATUS_ALIAS_EXISTS NTStatus = 0xC0000154 + STATUS_LOGON_NOT_GRANTED NTStatus = 0xC0000155 + STATUS_TOO_MANY_SECRETS NTStatus = 0xC0000156 + STATUS_SECRET_TOO_LONG NTStatus = 0xC0000157 + STATUS_INTERNAL_DB_ERROR NTStatus = 0xC0000158 + STATUS_FULLSCREEN_MODE NTStatus = 0xC0000159 + STATUS_TOO_MANY_CONTEXT_IDS NTStatus = 0xC000015A + STATUS_LOGON_TYPE_NOT_GRANTED NTStatus = 0xC000015B + STATUS_NOT_REGISTRY_FILE NTStatus = 0xC000015C + STATUS_NT_CROSS_ENCRYPTION_REQUIRED NTStatus = 0xC000015D + STATUS_DOMAIN_CTRLR_CONFIG_ERROR NTStatus = 0xC000015E + STATUS_FT_MISSING_MEMBER NTStatus = 0xC000015F + STATUS_ILL_FORMED_SERVICE_ENTRY NTStatus = 0xC0000160 + STATUS_ILLEGAL_CHARACTER NTStatus = 0xC0000161 + STATUS_UNMAPPABLE_CHARACTER NTStatus = 0xC0000162 + STATUS_UNDEFINED_CHARACTER NTStatus = 0xC0000163 + STATUS_FLOPPY_VOLUME NTStatus = 0xC0000164 + STATUS_FLOPPY_ID_MARK_NOT_FOUND NTStatus = 0xC0000165 + STATUS_FLOPPY_WRONG_CYLINDER NTStatus = 0xC0000166 + STATUS_FLOPPY_UNKNOWN_ERROR NTStatus = 0xC0000167 + STATUS_FLOPPY_BAD_REGISTERS NTStatus = 0xC0000168 + STATUS_DISK_RECALIBRATE_FAILED NTStatus = 0xC0000169 + STATUS_DISK_OPERATION_FAILED NTStatus = 0xC000016A + STATUS_DISK_RESET_FAILED NTStatus = 0xC000016B + STATUS_SHARED_IRQ_BUSY NTStatus = 0xC000016C + STATUS_FT_ORPHANING NTStatus = 0xC000016D + STATUS_BIOS_FAILED_TO_CONNECT_INTERRUPT NTStatus = 0xC000016E + STATUS_PARTITION_FAILURE NTStatus = 0xC0000172 + STATUS_INVALID_BLOCK_LENGTH NTStatus = 0xC0000173 + STATUS_DEVICE_NOT_PARTITIONED NTStatus = 0xC0000174 + STATUS_UNABLE_TO_LOCK_MEDIA NTStatus = 0xC0000175 + STATUS_UNABLE_TO_UNLOAD_MEDIA NTStatus = 0xC0000176 + STATUS_EOM_OVERFLOW NTStatus = 0xC0000177 + STATUS_NO_MEDIA NTStatus = 0xC0000178 + STATUS_NO_SUCH_MEMBER NTStatus = 0xC000017A + STATUS_INVALID_MEMBER NTStatus = 0xC000017B + STATUS_KEY_DELETED NTStatus = 0xC000017C + STATUS_NO_LOG_SPACE NTStatus = 0xC000017D + STATUS_TOO_MANY_SIDS NTStatus = 0xC000017E + STATUS_LM_CROSS_ENCRYPTION_REQUIRED NTStatus = 0xC000017F + STATUS_KEY_HAS_CHILDREN NTStatus = 0xC0000180 + STATUS_CHILD_MUST_BE_VOLATILE NTStatus = 0xC0000181 + STATUS_DEVICE_CONFIGURATION_ERROR NTStatus = 0xC0000182 + STATUS_DRIVER_INTERNAL_ERROR NTStatus = 0xC0000183 + STATUS_INVALID_DEVICE_STATE NTStatus = 0xC0000184 + STATUS_IO_DEVICE_ERROR NTStatus = 0xC0000185 + STATUS_DEVICE_PROTOCOL_ERROR NTStatus = 0xC0000186 + STATUS_BACKUP_CONTROLLER NTStatus = 0xC0000187 + STATUS_LOG_FILE_FULL NTStatus = 0xC0000188 + STATUS_TOO_LATE NTStatus = 0xC0000189 + STATUS_NO_TRUST_LSA_SECRET NTStatus = 0xC000018A + STATUS_NO_TRUST_SAM_ACCOUNT NTStatus = 0xC000018B + STATUS_TRUSTED_DOMAIN_FAILURE NTStatus = 0xC000018C + STATUS_TRUSTED_RELATIONSHIP_FAILURE NTStatus = 0xC000018D + STATUS_EVENTLOG_FILE_CORRUPT NTStatus = 0xC000018E + STATUS_EVENTLOG_CANT_START NTStatus = 0xC000018F + STATUS_TRUST_FAILURE NTStatus = 0xC0000190 + STATUS_MUTANT_LIMIT_EXCEEDED NTStatus = 0xC0000191 + STATUS_NETLOGON_NOT_STARTED NTStatus = 0xC0000192 + STATUS_ACCOUNT_EXPIRED NTStatus = 0xC0000193 + STATUS_POSSIBLE_DEADLOCK NTStatus = 0xC0000194 + STATUS_NETWORK_CREDENTIAL_CONFLICT NTStatus = 0xC0000195 + STATUS_REMOTE_SESSION_LIMIT NTStatus = 0xC0000196 + STATUS_EVENTLOG_FILE_CHANGED NTStatus = 0xC0000197 + STATUS_NOLOGON_INTERDOMAIN_TRUST_ACCOUNT NTStatus = 0xC0000198 + STATUS_NOLOGON_WORKSTATION_TRUST_ACCOUNT NTStatus = 0xC0000199 + STATUS_NOLOGON_SERVER_TRUST_ACCOUNT NTStatus = 0xC000019A + STATUS_DOMAIN_TRUST_INCONSISTENT NTStatus = 0xC000019B + STATUS_FS_DRIVER_REQUIRED NTStatus = 0xC000019C + STATUS_IMAGE_ALREADY_LOADED_AS_DLL NTStatus = 0xC000019D + STATUS_INCOMPATIBLE_WITH_GLOBAL_SHORT_NAME_REGISTRY_SETTING NTStatus = 0xC000019E + STATUS_SHORT_NAMES_NOT_ENABLED_ON_VOLUME NTStatus = 0xC000019F + STATUS_SECURITY_STREAM_IS_INCONSISTENT NTStatus = 0xC00001A0 + STATUS_INVALID_LOCK_RANGE NTStatus = 0xC00001A1 + STATUS_INVALID_ACE_CONDITION NTStatus = 0xC00001A2 + STATUS_IMAGE_SUBSYSTEM_NOT_PRESENT NTStatus = 0xC00001A3 + STATUS_NOTIFICATION_GUID_ALREADY_DEFINED NTStatus = 0xC00001A4 + STATUS_INVALID_EXCEPTION_HANDLER NTStatus = 0xC00001A5 + STATUS_DUPLICATE_PRIVILEGES NTStatus = 0xC00001A6 + STATUS_NOT_ALLOWED_ON_SYSTEM_FILE NTStatus = 0xC00001A7 + STATUS_REPAIR_NEEDED NTStatus = 0xC00001A8 + STATUS_QUOTA_NOT_ENABLED NTStatus = 0xC00001A9 + STATUS_NO_APPLICATION_PACKAGE NTStatus = 0xC00001AA + STATUS_FILE_METADATA_OPTIMIZATION_IN_PROGRESS NTStatus = 0xC00001AB + STATUS_NOT_SAME_OBJECT NTStatus = 0xC00001AC + STATUS_FATAL_MEMORY_EXHAUSTION NTStatus = 0xC00001AD + STATUS_ERROR_PROCESS_NOT_IN_JOB NTStatus = 0xC00001AE + STATUS_CPU_SET_INVALID NTStatus = 0xC00001AF + STATUS_IO_DEVICE_INVALID_DATA NTStatus = 0xC00001B0 + STATUS_IO_UNALIGNED_WRITE NTStatus = 0xC00001B1 + STATUS_NETWORK_OPEN_RESTRICTION NTStatus = 0xC0000201 + STATUS_NO_USER_SESSION_KEY NTStatus = 0xC0000202 + STATUS_USER_SESSION_DELETED NTStatus = 0xC0000203 + STATUS_RESOURCE_LANG_NOT_FOUND NTStatus = 0xC0000204 + STATUS_INSUFF_SERVER_RESOURCES NTStatus = 0xC0000205 + STATUS_INVALID_BUFFER_SIZE NTStatus = 0xC0000206 + STATUS_INVALID_ADDRESS_COMPONENT NTStatus = 0xC0000207 + STATUS_INVALID_ADDRESS_WILDCARD NTStatus = 0xC0000208 + STATUS_TOO_MANY_ADDRESSES NTStatus = 0xC0000209 + STATUS_ADDRESS_ALREADY_EXISTS NTStatus = 0xC000020A + STATUS_ADDRESS_CLOSED NTStatus = 0xC000020B + STATUS_CONNECTION_DISCONNECTED NTStatus = 0xC000020C + STATUS_CONNECTION_RESET NTStatus = 0xC000020D + STATUS_TOO_MANY_NODES NTStatus = 0xC000020E + STATUS_TRANSACTION_ABORTED NTStatus = 0xC000020F + STATUS_TRANSACTION_TIMED_OUT NTStatus = 0xC0000210 + STATUS_TRANSACTION_NO_RELEASE NTStatus = 0xC0000211 + STATUS_TRANSACTION_NO_MATCH NTStatus = 0xC0000212 + STATUS_TRANSACTION_RESPONDED NTStatus = 0xC0000213 + STATUS_TRANSACTION_INVALID_ID NTStatus = 0xC0000214 + STATUS_TRANSACTION_INVALID_TYPE NTStatus = 0xC0000215 + STATUS_NOT_SERVER_SESSION NTStatus = 0xC0000216 + STATUS_NOT_CLIENT_SESSION NTStatus = 0xC0000217 + STATUS_CANNOT_LOAD_REGISTRY_FILE NTStatus = 0xC0000218 + STATUS_DEBUG_ATTACH_FAILED NTStatus = 0xC0000219 + STATUS_SYSTEM_PROCESS_TERMINATED NTStatus = 0xC000021A + STATUS_DATA_NOT_ACCEPTED NTStatus = 0xC000021B + STATUS_NO_BROWSER_SERVERS_FOUND NTStatus = 0xC000021C + STATUS_VDM_HARD_ERROR NTStatus = 0xC000021D + STATUS_DRIVER_CANCEL_TIMEOUT NTStatus = 0xC000021E + STATUS_REPLY_MESSAGE_MISMATCH NTStatus = 0xC000021F + STATUS_MAPPED_ALIGNMENT NTStatus = 0xC0000220 + STATUS_IMAGE_CHECKSUM_MISMATCH NTStatus = 0xC0000221 + STATUS_LOST_WRITEBEHIND_DATA NTStatus = 0xC0000222 + STATUS_CLIENT_SERVER_PARAMETERS_INVALID NTStatus = 0xC0000223 + STATUS_PASSWORD_MUST_CHANGE NTStatus = 0xC0000224 + STATUS_NOT_FOUND NTStatus = 0xC0000225 + STATUS_NOT_TINY_STREAM NTStatus = 0xC0000226 + STATUS_RECOVERY_FAILURE NTStatus = 0xC0000227 + STATUS_STACK_OVERFLOW_READ NTStatus = 0xC0000228 + STATUS_FAIL_CHECK NTStatus = 0xC0000229 + STATUS_DUPLICATE_OBJECTID NTStatus = 0xC000022A + STATUS_OBJECTID_EXISTS NTStatus = 0xC000022B + STATUS_CONVERT_TO_LARGE NTStatus = 0xC000022C + STATUS_RETRY NTStatus = 0xC000022D + STATUS_FOUND_OUT_OF_SCOPE NTStatus = 0xC000022E + STATUS_ALLOCATE_BUCKET NTStatus = 0xC000022F + STATUS_PROPSET_NOT_FOUND NTStatus = 0xC0000230 + STATUS_MARSHALL_OVERFLOW NTStatus = 0xC0000231 + STATUS_INVALID_VARIANT NTStatus = 0xC0000232 + STATUS_DOMAIN_CONTROLLER_NOT_FOUND NTStatus = 0xC0000233 + STATUS_ACCOUNT_LOCKED_OUT NTStatus = 0xC0000234 + STATUS_HANDLE_NOT_CLOSABLE NTStatus = 0xC0000235 + STATUS_CONNECTION_REFUSED NTStatus = 0xC0000236 + STATUS_GRACEFUL_DISCONNECT NTStatus = 0xC0000237 + STATUS_ADDRESS_ALREADY_ASSOCIATED NTStatus = 0xC0000238 + STATUS_ADDRESS_NOT_ASSOCIATED NTStatus = 0xC0000239 + STATUS_CONNECTION_INVALID NTStatus = 0xC000023A + STATUS_CONNECTION_ACTIVE NTStatus = 0xC000023B + STATUS_NETWORK_UNREACHABLE NTStatus = 0xC000023C + STATUS_HOST_UNREACHABLE NTStatus = 0xC000023D + STATUS_PROTOCOL_UNREACHABLE NTStatus = 0xC000023E + STATUS_PORT_UNREACHABLE NTStatus = 0xC000023F + STATUS_REQUEST_ABORTED NTStatus = 0xC0000240 + STATUS_CONNECTION_ABORTED NTStatus = 0xC0000241 + STATUS_BAD_COMPRESSION_BUFFER NTStatus = 0xC0000242 + STATUS_USER_MAPPED_FILE NTStatus = 0xC0000243 + STATUS_AUDIT_FAILED NTStatus = 0xC0000244 + STATUS_TIMER_RESOLUTION_NOT_SET NTStatus = 0xC0000245 + STATUS_CONNECTION_COUNT_LIMIT NTStatus = 0xC0000246 + STATUS_LOGIN_TIME_RESTRICTION NTStatus = 0xC0000247 + STATUS_LOGIN_WKSTA_RESTRICTION NTStatus = 0xC0000248 + STATUS_IMAGE_MP_UP_MISMATCH NTStatus = 0xC0000249 + STATUS_INSUFFICIENT_LOGON_INFO NTStatus = 0xC0000250 + STATUS_BAD_DLL_ENTRYPOINT NTStatus = 0xC0000251 + STATUS_BAD_SERVICE_ENTRYPOINT NTStatus = 0xC0000252 + STATUS_LPC_REPLY_LOST NTStatus = 0xC0000253 + STATUS_IP_ADDRESS_CONFLICT1 NTStatus = 0xC0000254 + STATUS_IP_ADDRESS_CONFLICT2 NTStatus = 0xC0000255 + STATUS_REGISTRY_QUOTA_LIMIT NTStatus = 0xC0000256 + STATUS_PATH_NOT_COVERED NTStatus = 0xC0000257 + STATUS_NO_CALLBACK_ACTIVE NTStatus = 0xC0000258 + STATUS_LICENSE_QUOTA_EXCEEDED NTStatus = 0xC0000259 + STATUS_PWD_TOO_SHORT NTStatus = 0xC000025A + STATUS_PWD_TOO_RECENT NTStatus = 0xC000025B + STATUS_PWD_HISTORY_CONFLICT NTStatus = 0xC000025C + STATUS_PLUGPLAY_NO_DEVICE NTStatus = 0xC000025E + STATUS_UNSUPPORTED_COMPRESSION NTStatus = 0xC000025F + STATUS_INVALID_HW_PROFILE NTStatus = 0xC0000260 + STATUS_INVALID_PLUGPLAY_DEVICE_PATH NTStatus = 0xC0000261 + STATUS_DRIVER_ORDINAL_NOT_FOUND NTStatus = 0xC0000262 + STATUS_DRIVER_ENTRYPOINT_NOT_FOUND NTStatus = 0xC0000263 + STATUS_RESOURCE_NOT_OWNED NTStatus = 0xC0000264 + STATUS_TOO_MANY_LINKS NTStatus = 0xC0000265 + STATUS_QUOTA_LIST_INCONSISTENT NTStatus = 0xC0000266 + STATUS_FILE_IS_OFFLINE NTStatus = 0xC0000267 + STATUS_EVALUATION_EXPIRATION NTStatus = 0xC0000268 + STATUS_ILLEGAL_DLL_RELOCATION NTStatus = 0xC0000269 + STATUS_LICENSE_VIOLATION NTStatus = 0xC000026A + STATUS_DLL_INIT_FAILED_LOGOFF NTStatus = 0xC000026B + STATUS_DRIVER_UNABLE_TO_LOAD NTStatus = 0xC000026C + STATUS_DFS_UNAVAILABLE NTStatus = 0xC000026D + STATUS_VOLUME_DISMOUNTED NTStatus = 0xC000026E + STATUS_WX86_INTERNAL_ERROR NTStatus = 0xC000026F + STATUS_WX86_FLOAT_STACK_CHECK NTStatus = 0xC0000270 + STATUS_VALIDATE_CONTINUE NTStatus = 0xC0000271 + STATUS_NO_MATCH NTStatus = 0xC0000272 + STATUS_NO_MORE_MATCHES NTStatus = 0xC0000273 + STATUS_NOT_A_REPARSE_POINT NTStatus = 0xC0000275 + STATUS_IO_REPARSE_TAG_INVALID NTStatus = 0xC0000276 + STATUS_IO_REPARSE_TAG_MISMATCH NTStatus = 0xC0000277 + STATUS_IO_REPARSE_DATA_INVALID NTStatus = 0xC0000278 + STATUS_IO_REPARSE_TAG_NOT_HANDLED NTStatus = 0xC0000279 + STATUS_PWD_TOO_LONG NTStatus = 0xC000027A + STATUS_STOWED_EXCEPTION NTStatus = 0xC000027B + STATUS_CONTEXT_STOWED_EXCEPTION NTStatus = 0xC000027C + STATUS_REPARSE_POINT_NOT_RESOLVED NTStatus = 0xC0000280 + STATUS_DIRECTORY_IS_A_REPARSE_POINT NTStatus = 0xC0000281 + STATUS_RANGE_LIST_CONFLICT NTStatus = 0xC0000282 + STATUS_SOURCE_ELEMENT_EMPTY NTStatus = 0xC0000283 + STATUS_DESTINATION_ELEMENT_FULL NTStatus = 0xC0000284 + STATUS_ILLEGAL_ELEMENT_ADDRESS NTStatus = 0xC0000285 + STATUS_MAGAZINE_NOT_PRESENT NTStatus = 0xC0000286 + STATUS_REINITIALIZATION_NEEDED NTStatus = 0xC0000287 + STATUS_DEVICE_REQUIRES_CLEANING NTStatus = 0x80000288 + STATUS_DEVICE_DOOR_OPEN NTStatus = 0x80000289 + STATUS_ENCRYPTION_FAILED NTStatus = 0xC000028A + STATUS_DECRYPTION_FAILED NTStatus = 0xC000028B + STATUS_RANGE_NOT_FOUND NTStatus = 0xC000028C + STATUS_NO_RECOVERY_POLICY NTStatus = 0xC000028D + STATUS_NO_EFS NTStatus = 0xC000028E + STATUS_WRONG_EFS NTStatus = 0xC000028F + STATUS_NO_USER_KEYS NTStatus = 0xC0000290 + STATUS_FILE_NOT_ENCRYPTED NTStatus = 0xC0000291 + STATUS_NOT_EXPORT_FORMAT NTStatus = 0xC0000292 + STATUS_FILE_ENCRYPTED NTStatus = 0xC0000293 + STATUS_WAKE_SYSTEM NTStatus = 0x40000294 + STATUS_WMI_GUID_NOT_FOUND NTStatus = 0xC0000295 + STATUS_WMI_INSTANCE_NOT_FOUND NTStatus = 0xC0000296 + STATUS_WMI_ITEMID_NOT_FOUND NTStatus = 0xC0000297 + STATUS_WMI_TRY_AGAIN NTStatus = 0xC0000298 + STATUS_SHARED_POLICY NTStatus = 0xC0000299 + STATUS_POLICY_OBJECT_NOT_FOUND NTStatus = 0xC000029A + STATUS_POLICY_ONLY_IN_DS NTStatus = 0xC000029B + STATUS_VOLUME_NOT_UPGRADED NTStatus = 0xC000029C + STATUS_REMOTE_STORAGE_NOT_ACTIVE NTStatus = 0xC000029D + STATUS_REMOTE_STORAGE_MEDIA_ERROR NTStatus = 0xC000029E + STATUS_NO_TRACKING_SERVICE NTStatus = 0xC000029F + STATUS_SERVER_SID_MISMATCH NTStatus = 0xC00002A0 + STATUS_DS_NO_ATTRIBUTE_OR_VALUE NTStatus = 0xC00002A1 + STATUS_DS_INVALID_ATTRIBUTE_SYNTAX NTStatus = 0xC00002A2 + STATUS_DS_ATTRIBUTE_TYPE_UNDEFINED NTStatus = 0xC00002A3 + STATUS_DS_ATTRIBUTE_OR_VALUE_EXISTS NTStatus = 0xC00002A4 + STATUS_DS_BUSY NTStatus = 0xC00002A5 + STATUS_DS_UNAVAILABLE NTStatus = 0xC00002A6 + STATUS_DS_NO_RIDS_ALLOCATED NTStatus = 0xC00002A7 + STATUS_DS_NO_MORE_RIDS NTStatus = 0xC00002A8 + STATUS_DS_INCORRECT_ROLE_OWNER NTStatus = 0xC00002A9 + STATUS_DS_RIDMGR_INIT_ERROR NTStatus = 0xC00002AA + STATUS_DS_OBJ_CLASS_VIOLATION NTStatus = 0xC00002AB + STATUS_DS_CANT_ON_NON_LEAF NTStatus = 0xC00002AC + STATUS_DS_CANT_ON_RDN NTStatus = 0xC00002AD + STATUS_DS_CANT_MOD_OBJ_CLASS NTStatus = 0xC00002AE + STATUS_DS_CROSS_DOM_MOVE_FAILED NTStatus = 0xC00002AF + STATUS_DS_GC_NOT_AVAILABLE NTStatus = 0xC00002B0 + STATUS_DIRECTORY_SERVICE_REQUIRED NTStatus = 0xC00002B1 + STATUS_REPARSE_ATTRIBUTE_CONFLICT NTStatus = 0xC00002B2 + STATUS_CANT_ENABLE_DENY_ONLY NTStatus = 0xC00002B3 + STATUS_FLOAT_MULTIPLE_FAULTS NTStatus = 0xC00002B4 + STATUS_FLOAT_MULTIPLE_TRAPS NTStatus = 0xC00002B5 + STATUS_DEVICE_REMOVED NTStatus = 0xC00002B6 + STATUS_JOURNAL_DELETE_IN_PROGRESS NTStatus = 0xC00002B7 + STATUS_JOURNAL_NOT_ACTIVE NTStatus = 0xC00002B8 + STATUS_NOINTERFACE NTStatus = 0xC00002B9 + STATUS_DS_RIDMGR_DISABLED NTStatus = 0xC00002BA + STATUS_DS_ADMIN_LIMIT_EXCEEDED NTStatus = 0xC00002C1 + STATUS_DRIVER_FAILED_SLEEP NTStatus = 0xC00002C2 + STATUS_MUTUAL_AUTHENTICATION_FAILED NTStatus = 0xC00002C3 + STATUS_CORRUPT_SYSTEM_FILE NTStatus = 0xC00002C4 + STATUS_DATATYPE_MISALIGNMENT_ERROR NTStatus = 0xC00002C5 + STATUS_WMI_READ_ONLY NTStatus = 0xC00002C6 + STATUS_WMI_SET_FAILURE NTStatus = 0xC00002C7 + STATUS_COMMITMENT_MINIMUM NTStatus = 0xC00002C8 + STATUS_REG_NAT_CONSUMPTION NTStatus = 0xC00002C9 + STATUS_TRANSPORT_FULL NTStatus = 0xC00002CA + STATUS_DS_SAM_INIT_FAILURE NTStatus = 0xC00002CB + STATUS_ONLY_IF_CONNECTED NTStatus = 0xC00002CC + STATUS_DS_SENSITIVE_GROUP_VIOLATION NTStatus = 0xC00002CD + STATUS_PNP_RESTART_ENUMERATION NTStatus = 0xC00002CE + STATUS_JOURNAL_ENTRY_DELETED NTStatus = 0xC00002CF + STATUS_DS_CANT_MOD_PRIMARYGROUPID NTStatus = 0xC00002D0 + STATUS_SYSTEM_IMAGE_BAD_SIGNATURE NTStatus = 0xC00002D1 + STATUS_PNP_REBOOT_REQUIRED NTStatus = 0xC00002D2 + STATUS_POWER_STATE_INVALID NTStatus = 0xC00002D3 + STATUS_DS_INVALID_GROUP_TYPE NTStatus = 0xC00002D4 + STATUS_DS_NO_NEST_GLOBALGROUP_IN_MIXEDDOMAIN NTStatus = 0xC00002D5 + STATUS_DS_NO_NEST_LOCALGROUP_IN_MIXEDDOMAIN NTStatus = 0xC00002D6 + STATUS_DS_GLOBAL_CANT_HAVE_LOCAL_MEMBER NTStatus = 0xC00002D7 + STATUS_DS_GLOBAL_CANT_HAVE_UNIVERSAL_MEMBER NTStatus = 0xC00002D8 + STATUS_DS_UNIVERSAL_CANT_HAVE_LOCAL_MEMBER NTStatus = 0xC00002D9 + STATUS_DS_GLOBAL_CANT_HAVE_CROSSDOMAIN_MEMBER NTStatus = 0xC00002DA + STATUS_DS_LOCAL_CANT_HAVE_CROSSDOMAIN_LOCAL_MEMBER NTStatus = 0xC00002DB + STATUS_DS_HAVE_PRIMARY_MEMBERS NTStatus = 0xC00002DC + STATUS_WMI_NOT_SUPPORTED NTStatus = 0xC00002DD + STATUS_INSUFFICIENT_POWER NTStatus = 0xC00002DE + STATUS_SAM_NEED_BOOTKEY_PASSWORD NTStatus = 0xC00002DF + STATUS_SAM_NEED_BOOTKEY_FLOPPY NTStatus = 0xC00002E0 + STATUS_DS_CANT_START NTStatus = 0xC00002E1 + STATUS_DS_INIT_FAILURE NTStatus = 0xC00002E2 + STATUS_SAM_INIT_FAILURE NTStatus = 0xC00002E3 + STATUS_DS_GC_REQUIRED NTStatus = 0xC00002E4 + STATUS_DS_LOCAL_MEMBER_OF_LOCAL_ONLY NTStatus = 0xC00002E5 + STATUS_DS_NO_FPO_IN_UNIVERSAL_GROUPS NTStatus = 0xC00002E6 + STATUS_DS_MACHINE_ACCOUNT_QUOTA_EXCEEDED NTStatus = 0xC00002E7 + STATUS_MULTIPLE_FAULT_VIOLATION NTStatus = 0xC00002E8 + STATUS_CURRENT_DOMAIN_NOT_ALLOWED NTStatus = 0xC00002E9 + STATUS_CANNOT_MAKE NTStatus = 0xC00002EA + STATUS_SYSTEM_SHUTDOWN NTStatus = 0xC00002EB + STATUS_DS_INIT_FAILURE_CONSOLE NTStatus = 0xC00002EC + STATUS_DS_SAM_INIT_FAILURE_CONSOLE NTStatus = 0xC00002ED + STATUS_UNFINISHED_CONTEXT_DELETED NTStatus = 0xC00002EE + STATUS_NO_TGT_REPLY NTStatus = 0xC00002EF + STATUS_OBJECTID_NOT_FOUND NTStatus = 0xC00002F0 + STATUS_NO_IP_ADDRESSES NTStatus = 0xC00002F1 + STATUS_WRONG_CREDENTIAL_HANDLE NTStatus = 0xC00002F2 + STATUS_CRYPTO_SYSTEM_INVALID NTStatus = 0xC00002F3 + STATUS_MAX_REFERRALS_EXCEEDED NTStatus = 0xC00002F4 + STATUS_MUST_BE_KDC NTStatus = 0xC00002F5 + STATUS_STRONG_CRYPTO_NOT_SUPPORTED NTStatus = 0xC00002F6 + STATUS_TOO_MANY_PRINCIPALS NTStatus = 0xC00002F7 + STATUS_NO_PA_DATA NTStatus = 0xC00002F8 + STATUS_PKINIT_NAME_MISMATCH NTStatus = 0xC00002F9 + STATUS_SMARTCARD_LOGON_REQUIRED NTStatus = 0xC00002FA + STATUS_KDC_INVALID_REQUEST NTStatus = 0xC00002FB + STATUS_KDC_UNABLE_TO_REFER NTStatus = 0xC00002FC + STATUS_KDC_UNKNOWN_ETYPE NTStatus = 0xC00002FD + STATUS_SHUTDOWN_IN_PROGRESS NTStatus = 0xC00002FE + STATUS_SERVER_SHUTDOWN_IN_PROGRESS NTStatus = 0xC00002FF + STATUS_NOT_SUPPORTED_ON_SBS NTStatus = 0xC0000300 + STATUS_WMI_GUID_DISCONNECTED NTStatus = 0xC0000301 + STATUS_WMI_ALREADY_DISABLED NTStatus = 0xC0000302 + STATUS_WMI_ALREADY_ENABLED NTStatus = 0xC0000303 + STATUS_MFT_TOO_FRAGMENTED NTStatus = 0xC0000304 + STATUS_COPY_PROTECTION_FAILURE NTStatus = 0xC0000305 + STATUS_CSS_AUTHENTICATION_FAILURE NTStatus = 0xC0000306 + STATUS_CSS_KEY_NOT_PRESENT NTStatus = 0xC0000307 + STATUS_CSS_KEY_NOT_ESTABLISHED NTStatus = 0xC0000308 + STATUS_CSS_SCRAMBLED_SECTOR NTStatus = 0xC0000309 + STATUS_CSS_REGION_MISMATCH NTStatus = 0xC000030A + STATUS_CSS_RESETS_EXHAUSTED NTStatus = 0xC000030B + STATUS_PASSWORD_CHANGE_REQUIRED NTStatus = 0xC000030C + STATUS_LOST_MODE_LOGON_RESTRICTION NTStatus = 0xC000030D + STATUS_PKINIT_FAILURE NTStatus = 0xC0000320 + STATUS_SMARTCARD_SUBSYSTEM_FAILURE NTStatus = 0xC0000321 + STATUS_NO_KERB_KEY NTStatus = 0xC0000322 + STATUS_HOST_DOWN NTStatus = 0xC0000350 + STATUS_UNSUPPORTED_PREAUTH NTStatus = 0xC0000351 + STATUS_EFS_ALG_BLOB_TOO_BIG NTStatus = 0xC0000352 + STATUS_PORT_NOT_SET NTStatus = 0xC0000353 + STATUS_DEBUGGER_INACTIVE NTStatus = 0xC0000354 + STATUS_DS_VERSION_CHECK_FAILURE NTStatus = 0xC0000355 + STATUS_AUDITING_DISABLED NTStatus = 0xC0000356 + STATUS_PRENT4_MACHINE_ACCOUNT NTStatus = 0xC0000357 + STATUS_DS_AG_CANT_HAVE_UNIVERSAL_MEMBER NTStatus = 0xC0000358 + STATUS_INVALID_IMAGE_WIN_32 NTStatus = 0xC0000359 + STATUS_INVALID_IMAGE_WIN_64 NTStatus = 0xC000035A + STATUS_BAD_BINDINGS NTStatus = 0xC000035B + STATUS_NETWORK_SESSION_EXPIRED NTStatus = 0xC000035C + STATUS_APPHELP_BLOCK NTStatus = 0xC000035D + STATUS_ALL_SIDS_FILTERED NTStatus = 0xC000035E + STATUS_NOT_SAFE_MODE_DRIVER NTStatus = 0xC000035F + STATUS_ACCESS_DISABLED_BY_POLICY_DEFAULT NTStatus = 0xC0000361 + STATUS_ACCESS_DISABLED_BY_POLICY_PATH NTStatus = 0xC0000362 + STATUS_ACCESS_DISABLED_BY_POLICY_PUBLISHER NTStatus = 0xC0000363 + STATUS_ACCESS_DISABLED_BY_POLICY_OTHER NTStatus = 0xC0000364 + STATUS_FAILED_DRIVER_ENTRY NTStatus = 0xC0000365 + STATUS_DEVICE_ENUMERATION_ERROR NTStatus = 0xC0000366 + STATUS_MOUNT_POINT_NOT_RESOLVED NTStatus = 0xC0000368 + STATUS_INVALID_DEVICE_OBJECT_PARAMETER NTStatus = 0xC0000369 + STATUS_MCA_OCCURED NTStatus = 0xC000036A + STATUS_DRIVER_BLOCKED_CRITICAL NTStatus = 0xC000036B + STATUS_DRIVER_BLOCKED NTStatus = 0xC000036C + STATUS_DRIVER_DATABASE_ERROR NTStatus = 0xC000036D + STATUS_SYSTEM_HIVE_TOO_LARGE NTStatus = 0xC000036E + STATUS_INVALID_IMPORT_OF_NON_DLL NTStatus = 0xC000036F + STATUS_DS_SHUTTING_DOWN NTStatus = 0x40000370 + STATUS_NO_SECRETS NTStatus = 0xC0000371 + STATUS_ACCESS_DISABLED_NO_SAFER_UI_BY_POLICY NTStatus = 0xC0000372 + STATUS_FAILED_STACK_SWITCH NTStatus = 0xC0000373 + STATUS_HEAP_CORRUPTION NTStatus = 0xC0000374 + STATUS_SMARTCARD_WRONG_PIN NTStatus = 0xC0000380 + STATUS_SMARTCARD_CARD_BLOCKED NTStatus = 0xC0000381 + STATUS_SMARTCARD_CARD_NOT_AUTHENTICATED NTStatus = 0xC0000382 + STATUS_SMARTCARD_NO_CARD NTStatus = 0xC0000383 + STATUS_SMARTCARD_NO_KEY_CONTAINER NTStatus = 0xC0000384 + STATUS_SMARTCARD_NO_CERTIFICATE NTStatus = 0xC0000385 + STATUS_SMARTCARD_NO_KEYSET NTStatus = 0xC0000386 + STATUS_SMARTCARD_IO_ERROR NTStatus = 0xC0000387 + STATUS_DOWNGRADE_DETECTED NTStatus = 0xC0000388 + STATUS_SMARTCARD_CERT_REVOKED NTStatus = 0xC0000389 + STATUS_ISSUING_CA_UNTRUSTED NTStatus = 0xC000038A + STATUS_REVOCATION_OFFLINE_C NTStatus = 0xC000038B + STATUS_PKINIT_CLIENT_FAILURE NTStatus = 0xC000038C + STATUS_SMARTCARD_CERT_EXPIRED NTStatus = 0xC000038D + STATUS_DRIVER_FAILED_PRIOR_UNLOAD NTStatus = 0xC000038E + STATUS_SMARTCARD_SILENT_CONTEXT NTStatus = 0xC000038F + STATUS_PER_USER_TRUST_QUOTA_EXCEEDED NTStatus = 0xC0000401 + STATUS_ALL_USER_TRUST_QUOTA_EXCEEDED NTStatus = 0xC0000402 + STATUS_USER_DELETE_TRUST_QUOTA_EXCEEDED NTStatus = 0xC0000403 + STATUS_DS_NAME_NOT_UNIQUE NTStatus = 0xC0000404 + STATUS_DS_DUPLICATE_ID_FOUND NTStatus = 0xC0000405 + STATUS_DS_GROUP_CONVERSION_ERROR NTStatus = 0xC0000406 + STATUS_VOLSNAP_PREPARE_HIBERNATE NTStatus = 0xC0000407 + STATUS_USER2USER_REQUIRED NTStatus = 0xC0000408 + STATUS_STACK_BUFFER_OVERRUN NTStatus = 0xC0000409 + STATUS_NO_S4U_PROT_SUPPORT NTStatus = 0xC000040A + STATUS_CROSSREALM_DELEGATION_FAILURE NTStatus = 0xC000040B + STATUS_REVOCATION_OFFLINE_KDC NTStatus = 0xC000040C + STATUS_ISSUING_CA_UNTRUSTED_KDC NTStatus = 0xC000040D + STATUS_KDC_CERT_EXPIRED NTStatus = 0xC000040E + STATUS_KDC_CERT_REVOKED NTStatus = 0xC000040F + STATUS_PARAMETER_QUOTA_EXCEEDED NTStatus = 0xC0000410 + STATUS_HIBERNATION_FAILURE NTStatus = 0xC0000411 + STATUS_DELAY_LOAD_FAILED NTStatus = 0xC0000412 + STATUS_AUTHENTICATION_FIREWALL_FAILED NTStatus = 0xC0000413 + STATUS_VDM_DISALLOWED NTStatus = 0xC0000414 + STATUS_HUNG_DISPLAY_DRIVER_THREAD NTStatus = 0xC0000415 + STATUS_INSUFFICIENT_RESOURCE_FOR_SPECIFIED_SHARED_SECTION_SIZE NTStatus = 0xC0000416 + STATUS_INVALID_CRUNTIME_PARAMETER NTStatus = 0xC0000417 + STATUS_NTLM_BLOCKED NTStatus = 0xC0000418 + STATUS_DS_SRC_SID_EXISTS_IN_FOREST NTStatus = 0xC0000419 + STATUS_DS_DOMAIN_NAME_EXISTS_IN_FOREST NTStatus = 0xC000041A + STATUS_DS_FLAT_NAME_EXISTS_IN_FOREST NTStatus = 0xC000041B + STATUS_INVALID_USER_PRINCIPAL_NAME NTStatus = 0xC000041C + STATUS_FATAL_USER_CALLBACK_EXCEPTION NTStatus = 0xC000041D + STATUS_ASSERTION_FAILURE NTStatus = 0xC0000420 + STATUS_VERIFIER_STOP NTStatus = 0xC0000421 + STATUS_CALLBACK_POP_STACK NTStatus = 0xC0000423 + STATUS_INCOMPATIBLE_DRIVER_BLOCKED NTStatus = 0xC0000424 + STATUS_HIVE_UNLOADED NTStatus = 0xC0000425 + STATUS_COMPRESSION_DISABLED NTStatus = 0xC0000426 + STATUS_FILE_SYSTEM_LIMITATION NTStatus = 0xC0000427 + STATUS_INVALID_IMAGE_HASH NTStatus = 0xC0000428 + STATUS_NOT_CAPABLE NTStatus = 0xC0000429 + STATUS_REQUEST_OUT_OF_SEQUENCE NTStatus = 0xC000042A + STATUS_IMPLEMENTATION_LIMIT NTStatus = 0xC000042B + STATUS_ELEVATION_REQUIRED NTStatus = 0xC000042C + STATUS_NO_SECURITY_CONTEXT NTStatus = 0xC000042D + STATUS_PKU2U_CERT_FAILURE NTStatus = 0xC000042F + STATUS_BEYOND_VDL NTStatus = 0xC0000432 + STATUS_ENCOUNTERED_WRITE_IN_PROGRESS NTStatus = 0xC0000433 + STATUS_PTE_CHANGED NTStatus = 0xC0000434 + STATUS_PURGE_FAILED NTStatus = 0xC0000435 + STATUS_CRED_REQUIRES_CONFIRMATION NTStatus = 0xC0000440 + STATUS_CS_ENCRYPTION_INVALID_SERVER_RESPONSE NTStatus = 0xC0000441 + STATUS_CS_ENCRYPTION_UNSUPPORTED_SERVER NTStatus = 0xC0000442 + STATUS_CS_ENCRYPTION_EXISTING_ENCRYPTED_FILE NTStatus = 0xC0000443 + STATUS_CS_ENCRYPTION_NEW_ENCRYPTED_FILE NTStatus = 0xC0000444 + STATUS_CS_ENCRYPTION_FILE_NOT_CSE NTStatus = 0xC0000445 + STATUS_INVALID_LABEL NTStatus = 0xC0000446 + STATUS_DRIVER_PROCESS_TERMINATED NTStatus = 0xC0000450 + STATUS_AMBIGUOUS_SYSTEM_DEVICE NTStatus = 0xC0000451 + STATUS_SYSTEM_DEVICE_NOT_FOUND NTStatus = 0xC0000452 + STATUS_RESTART_BOOT_APPLICATION NTStatus = 0xC0000453 + STATUS_INSUFFICIENT_NVRAM_RESOURCES NTStatus = 0xC0000454 + STATUS_INVALID_SESSION NTStatus = 0xC0000455 + STATUS_THREAD_ALREADY_IN_SESSION NTStatus = 0xC0000456 + STATUS_THREAD_NOT_IN_SESSION NTStatus = 0xC0000457 + STATUS_INVALID_WEIGHT NTStatus = 0xC0000458 + STATUS_REQUEST_PAUSED NTStatus = 0xC0000459 + STATUS_NO_RANGES_PROCESSED NTStatus = 0xC0000460 + STATUS_DISK_RESOURCES_EXHAUSTED NTStatus = 0xC0000461 + STATUS_NEEDS_REMEDIATION NTStatus = 0xC0000462 + STATUS_DEVICE_FEATURE_NOT_SUPPORTED NTStatus = 0xC0000463 + STATUS_DEVICE_UNREACHABLE NTStatus = 0xC0000464 + STATUS_INVALID_TOKEN NTStatus = 0xC0000465 + STATUS_SERVER_UNAVAILABLE NTStatus = 0xC0000466 + STATUS_FILE_NOT_AVAILABLE NTStatus = 0xC0000467 + STATUS_DEVICE_INSUFFICIENT_RESOURCES NTStatus = 0xC0000468 + STATUS_PACKAGE_UPDATING NTStatus = 0xC0000469 + STATUS_NOT_READ_FROM_COPY NTStatus = 0xC000046A + STATUS_FT_WRITE_FAILURE NTStatus = 0xC000046B + STATUS_FT_DI_SCAN_REQUIRED NTStatus = 0xC000046C + STATUS_OBJECT_NOT_EXTERNALLY_BACKED NTStatus = 0xC000046D + STATUS_EXTERNAL_BACKING_PROVIDER_UNKNOWN NTStatus = 0xC000046E + STATUS_COMPRESSION_NOT_BENEFICIAL NTStatus = 0xC000046F + STATUS_DATA_CHECKSUM_ERROR NTStatus = 0xC0000470 + STATUS_INTERMIXED_KERNEL_EA_OPERATION NTStatus = 0xC0000471 + STATUS_TRIM_READ_ZERO_NOT_SUPPORTED NTStatus = 0xC0000472 + STATUS_TOO_MANY_SEGMENT_DESCRIPTORS NTStatus = 0xC0000473 + STATUS_INVALID_OFFSET_ALIGNMENT NTStatus = 0xC0000474 + STATUS_INVALID_FIELD_IN_PARAMETER_LIST NTStatus = 0xC0000475 + STATUS_OPERATION_IN_PROGRESS NTStatus = 0xC0000476 + STATUS_INVALID_INITIATOR_TARGET_PATH NTStatus = 0xC0000477 + STATUS_SCRUB_DATA_DISABLED NTStatus = 0xC0000478 + STATUS_NOT_REDUNDANT_STORAGE NTStatus = 0xC0000479 + STATUS_RESIDENT_FILE_NOT_SUPPORTED NTStatus = 0xC000047A + STATUS_COMPRESSED_FILE_NOT_SUPPORTED NTStatus = 0xC000047B + STATUS_DIRECTORY_NOT_SUPPORTED NTStatus = 0xC000047C + STATUS_IO_OPERATION_TIMEOUT NTStatus = 0xC000047D + STATUS_SYSTEM_NEEDS_REMEDIATION NTStatus = 0xC000047E + STATUS_APPX_INTEGRITY_FAILURE_CLR_NGEN NTStatus = 0xC000047F + STATUS_SHARE_UNAVAILABLE NTStatus = 0xC0000480 + STATUS_APISET_NOT_HOSTED NTStatus = 0xC0000481 + STATUS_APISET_NOT_PRESENT NTStatus = 0xC0000482 + STATUS_DEVICE_HARDWARE_ERROR NTStatus = 0xC0000483 + STATUS_FIRMWARE_SLOT_INVALID NTStatus = 0xC0000484 + STATUS_FIRMWARE_IMAGE_INVALID NTStatus = 0xC0000485 + STATUS_STORAGE_TOPOLOGY_ID_MISMATCH NTStatus = 0xC0000486 + STATUS_WIM_NOT_BOOTABLE NTStatus = 0xC0000487 + STATUS_BLOCKED_BY_PARENTAL_CONTROLS NTStatus = 0xC0000488 + STATUS_NEEDS_REGISTRATION NTStatus = 0xC0000489 + STATUS_QUOTA_ACTIVITY NTStatus = 0xC000048A + STATUS_CALLBACK_INVOKE_INLINE NTStatus = 0xC000048B + STATUS_BLOCK_TOO_MANY_REFERENCES NTStatus = 0xC000048C + STATUS_MARKED_TO_DISALLOW_WRITES NTStatus = 0xC000048D + STATUS_NETWORK_ACCESS_DENIED_EDP NTStatus = 0xC000048E + STATUS_ENCLAVE_FAILURE NTStatus = 0xC000048F + STATUS_PNP_NO_COMPAT_DRIVERS NTStatus = 0xC0000490 + STATUS_PNP_DRIVER_PACKAGE_NOT_FOUND NTStatus = 0xC0000491 + STATUS_PNP_DRIVER_CONFIGURATION_NOT_FOUND NTStatus = 0xC0000492 + STATUS_PNP_DRIVER_CONFIGURATION_INCOMPLETE NTStatus = 0xC0000493 + STATUS_PNP_FUNCTION_DRIVER_REQUIRED NTStatus = 0xC0000494 + STATUS_PNP_DEVICE_CONFIGURATION_PENDING NTStatus = 0xC0000495 + STATUS_DEVICE_HINT_NAME_BUFFER_TOO_SMALL NTStatus = 0xC0000496 + STATUS_PACKAGE_NOT_AVAILABLE NTStatus = 0xC0000497 + STATUS_DEVICE_IN_MAINTENANCE NTStatus = 0xC0000499 + STATUS_NOT_SUPPORTED_ON_DAX NTStatus = 0xC000049A + STATUS_FREE_SPACE_TOO_FRAGMENTED NTStatus = 0xC000049B + STATUS_DAX_MAPPING_EXISTS NTStatus = 0xC000049C + STATUS_CHILD_PROCESS_BLOCKED NTStatus = 0xC000049D + STATUS_STORAGE_LOST_DATA_PERSISTENCE NTStatus = 0xC000049E + STATUS_VRF_CFG_ENABLED NTStatus = 0xC000049F + STATUS_PARTITION_TERMINATING NTStatus = 0xC00004A0 + STATUS_EXTERNAL_SYSKEY_NOT_SUPPORTED NTStatus = 0xC00004A1 + STATUS_ENCLAVE_VIOLATION NTStatus = 0xC00004A2 + STATUS_FILE_PROTECTED_UNDER_DPL NTStatus = 0xC00004A3 + STATUS_VOLUME_NOT_CLUSTER_ALIGNED NTStatus = 0xC00004A4 + STATUS_NO_PHYSICALLY_ALIGNED_FREE_SPACE_FOUND NTStatus = 0xC00004A5 + STATUS_APPX_FILE_NOT_ENCRYPTED NTStatus = 0xC00004A6 + STATUS_RWRAW_ENCRYPTED_FILE_NOT_ENCRYPTED NTStatus = 0xC00004A7 + STATUS_RWRAW_ENCRYPTED_INVALID_EDATAINFO_FILEOFFSET NTStatus = 0xC00004A8 + STATUS_RWRAW_ENCRYPTED_INVALID_EDATAINFO_FILERANGE NTStatus = 0xC00004A9 + STATUS_RWRAW_ENCRYPTED_INVALID_EDATAINFO_PARAMETER NTStatus = 0xC00004AA + STATUS_FT_READ_FAILURE NTStatus = 0xC00004AB + STATUS_PATCH_CONFLICT NTStatus = 0xC00004AC + STATUS_STORAGE_RESERVE_ID_INVALID NTStatus = 0xC00004AD + STATUS_STORAGE_RESERVE_DOES_NOT_EXIST NTStatus = 0xC00004AE + STATUS_STORAGE_RESERVE_ALREADY_EXISTS NTStatus = 0xC00004AF + STATUS_STORAGE_RESERVE_NOT_EMPTY NTStatus = 0xC00004B0 + STATUS_NOT_A_DAX_VOLUME NTStatus = 0xC00004B1 + STATUS_NOT_DAX_MAPPABLE NTStatus = 0xC00004B2 + STATUS_CASE_DIFFERING_NAMES_IN_DIR NTStatus = 0xC00004B3 + STATUS_FILE_NOT_SUPPORTED NTStatus = 0xC00004B4 + STATUS_NOT_SUPPORTED_WITH_BTT NTStatus = 0xC00004B5 + STATUS_ENCRYPTION_DISABLED NTStatus = 0xC00004B6 + STATUS_ENCRYPTING_METADATA_DISALLOWED NTStatus = 0xC00004B7 + STATUS_CANT_CLEAR_ENCRYPTION_FLAG NTStatus = 0xC00004B8 + STATUS_INVALID_TASK_NAME NTStatus = 0xC0000500 + STATUS_INVALID_TASK_INDEX NTStatus = 0xC0000501 + STATUS_THREAD_ALREADY_IN_TASK NTStatus = 0xC0000502 + STATUS_CALLBACK_BYPASS NTStatus = 0xC0000503 + STATUS_UNDEFINED_SCOPE NTStatus = 0xC0000504 + STATUS_INVALID_CAP NTStatus = 0xC0000505 + STATUS_NOT_GUI_PROCESS NTStatus = 0xC0000506 + STATUS_DEVICE_HUNG NTStatus = 0xC0000507 + STATUS_CONTAINER_ASSIGNED NTStatus = 0xC0000508 + STATUS_JOB_NO_CONTAINER NTStatus = 0xC0000509 + STATUS_DEVICE_UNRESPONSIVE NTStatus = 0xC000050A + STATUS_REPARSE_POINT_ENCOUNTERED NTStatus = 0xC000050B + STATUS_ATTRIBUTE_NOT_PRESENT NTStatus = 0xC000050C + STATUS_NOT_A_TIERED_VOLUME NTStatus = 0xC000050D + STATUS_ALREADY_HAS_STREAM_ID NTStatus = 0xC000050E + STATUS_JOB_NOT_EMPTY NTStatus = 0xC000050F + STATUS_ALREADY_INITIALIZED NTStatus = 0xC0000510 + STATUS_ENCLAVE_NOT_TERMINATED NTStatus = 0xC0000511 + STATUS_ENCLAVE_IS_TERMINATING NTStatus = 0xC0000512 + STATUS_SMB1_NOT_AVAILABLE NTStatus = 0xC0000513 + STATUS_SMR_GARBAGE_COLLECTION_REQUIRED NTStatus = 0xC0000514 + STATUS_INTERRUPTED NTStatus = 0xC0000515 + STATUS_THREAD_NOT_RUNNING NTStatus = 0xC0000516 + STATUS_FAIL_FAST_EXCEPTION NTStatus = 0xC0000602 + STATUS_IMAGE_CERT_REVOKED NTStatus = 0xC0000603 + STATUS_DYNAMIC_CODE_BLOCKED NTStatus = 0xC0000604 + STATUS_IMAGE_CERT_EXPIRED NTStatus = 0xC0000605 + STATUS_STRICT_CFG_VIOLATION NTStatus = 0xC0000606 + STATUS_SET_CONTEXT_DENIED NTStatus = 0xC000060A + STATUS_CROSS_PARTITION_VIOLATION NTStatus = 0xC000060B + STATUS_PORT_CLOSED NTStatus = 0xC0000700 + STATUS_MESSAGE_LOST NTStatus = 0xC0000701 + STATUS_INVALID_MESSAGE NTStatus = 0xC0000702 + STATUS_REQUEST_CANCELED NTStatus = 0xC0000703 + STATUS_RECURSIVE_DISPATCH NTStatus = 0xC0000704 + STATUS_LPC_RECEIVE_BUFFER_EXPECTED NTStatus = 0xC0000705 + STATUS_LPC_INVALID_CONNECTION_USAGE NTStatus = 0xC0000706 + STATUS_LPC_REQUESTS_NOT_ALLOWED NTStatus = 0xC0000707 + STATUS_RESOURCE_IN_USE NTStatus = 0xC0000708 + STATUS_HARDWARE_MEMORY_ERROR NTStatus = 0xC0000709 + STATUS_THREADPOOL_HANDLE_EXCEPTION NTStatus = 0xC000070A + STATUS_THREADPOOL_SET_EVENT_ON_COMPLETION_FAILED NTStatus = 0xC000070B + STATUS_THREADPOOL_RELEASE_SEMAPHORE_ON_COMPLETION_FAILED NTStatus = 0xC000070C + STATUS_THREADPOOL_RELEASE_MUTEX_ON_COMPLETION_FAILED NTStatus = 0xC000070D + STATUS_THREADPOOL_FREE_LIBRARY_ON_COMPLETION_FAILED NTStatus = 0xC000070E + STATUS_THREADPOOL_RELEASED_DURING_OPERATION NTStatus = 0xC000070F + STATUS_CALLBACK_RETURNED_WHILE_IMPERSONATING NTStatus = 0xC0000710 + STATUS_APC_RETURNED_WHILE_IMPERSONATING NTStatus = 0xC0000711 + STATUS_PROCESS_IS_PROTECTED NTStatus = 0xC0000712 + STATUS_MCA_EXCEPTION NTStatus = 0xC0000713 + STATUS_CERTIFICATE_MAPPING_NOT_UNIQUE NTStatus = 0xC0000714 + STATUS_SYMLINK_CLASS_DISABLED NTStatus = 0xC0000715 + STATUS_INVALID_IDN_NORMALIZATION NTStatus = 0xC0000716 + STATUS_NO_UNICODE_TRANSLATION NTStatus = 0xC0000717 + STATUS_ALREADY_REGISTERED NTStatus = 0xC0000718 + STATUS_CONTEXT_MISMATCH NTStatus = 0xC0000719 + STATUS_PORT_ALREADY_HAS_COMPLETION_LIST NTStatus = 0xC000071A + STATUS_CALLBACK_RETURNED_THREAD_PRIORITY NTStatus = 0xC000071B + STATUS_INVALID_THREAD NTStatus = 0xC000071C + STATUS_CALLBACK_RETURNED_TRANSACTION NTStatus = 0xC000071D + STATUS_CALLBACK_RETURNED_LDR_LOCK NTStatus = 0xC000071E + STATUS_CALLBACK_RETURNED_LANG NTStatus = 0xC000071F + STATUS_CALLBACK_RETURNED_PRI_BACK NTStatus = 0xC0000720 + STATUS_CALLBACK_RETURNED_THREAD_AFFINITY NTStatus = 0xC0000721 + STATUS_LPC_HANDLE_COUNT_EXCEEDED NTStatus = 0xC0000722 + STATUS_EXECUTABLE_MEMORY_WRITE NTStatus = 0xC0000723 + STATUS_KERNEL_EXECUTABLE_MEMORY_WRITE NTStatus = 0xC0000724 + STATUS_ATTACHED_EXECUTABLE_MEMORY_WRITE NTStatus = 0xC0000725 + STATUS_TRIGGERED_EXECUTABLE_MEMORY_WRITE NTStatus = 0xC0000726 + STATUS_DISK_REPAIR_DISABLED NTStatus = 0xC0000800 + STATUS_DS_DOMAIN_RENAME_IN_PROGRESS NTStatus = 0xC0000801 + STATUS_DISK_QUOTA_EXCEEDED NTStatus = 0xC0000802 + STATUS_DATA_LOST_REPAIR NTStatus = 0x80000803 + STATUS_CONTENT_BLOCKED NTStatus = 0xC0000804 + STATUS_BAD_CLUSTERS NTStatus = 0xC0000805 + STATUS_VOLUME_DIRTY NTStatus = 0xC0000806 + STATUS_DISK_REPAIR_REDIRECTED NTStatus = 0x40000807 + STATUS_DISK_REPAIR_UNSUCCESSFUL NTStatus = 0xC0000808 + STATUS_CORRUPT_LOG_OVERFULL NTStatus = 0xC0000809 + STATUS_CORRUPT_LOG_CORRUPTED NTStatus = 0xC000080A + STATUS_CORRUPT_LOG_UNAVAILABLE NTStatus = 0xC000080B + STATUS_CORRUPT_LOG_DELETED_FULL NTStatus = 0xC000080C + STATUS_CORRUPT_LOG_CLEARED NTStatus = 0xC000080D + STATUS_ORPHAN_NAME_EXHAUSTED NTStatus = 0xC000080E + STATUS_PROACTIVE_SCAN_IN_PROGRESS NTStatus = 0xC000080F + STATUS_ENCRYPTED_IO_NOT_POSSIBLE NTStatus = 0xC0000810 + STATUS_CORRUPT_LOG_UPLEVEL_RECORDS NTStatus = 0xC0000811 + STATUS_FILE_CHECKED_OUT NTStatus = 0xC0000901 + STATUS_CHECKOUT_REQUIRED NTStatus = 0xC0000902 + STATUS_BAD_FILE_TYPE NTStatus = 0xC0000903 + STATUS_FILE_TOO_LARGE NTStatus = 0xC0000904 + STATUS_FORMS_AUTH_REQUIRED NTStatus = 0xC0000905 + STATUS_VIRUS_INFECTED NTStatus = 0xC0000906 + STATUS_VIRUS_DELETED NTStatus = 0xC0000907 + STATUS_BAD_MCFG_TABLE NTStatus = 0xC0000908 + STATUS_CANNOT_BREAK_OPLOCK NTStatus = 0xC0000909 + STATUS_BAD_KEY NTStatus = 0xC000090A + STATUS_BAD_DATA NTStatus = 0xC000090B + STATUS_NO_KEY NTStatus = 0xC000090C + STATUS_FILE_HANDLE_REVOKED NTStatus = 0xC0000910 + STATUS_WOW_ASSERTION NTStatus = 0xC0009898 + STATUS_INVALID_SIGNATURE NTStatus = 0xC000A000 + STATUS_HMAC_NOT_SUPPORTED NTStatus = 0xC000A001 + STATUS_AUTH_TAG_MISMATCH NTStatus = 0xC000A002 + STATUS_INVALID_STATE_TRANSITION NTStatus = 0xC000A003 + STATUS_INVALID_KERNEL_INFO_VERSION NTStatus = 0xC000A004 + STATUS_INVALID_PEP_INFO_VERSION NTStatus = 0xC000A005 + STATUS_HANDLE_REVOKED NTStatus = 0xC000A006 + STATUS_EOF_ON_GHOSTED_RANGE NTStatus = 0xC000A007 + STATUS_IPSEC_QUEUE_OVERFLOW NTStatus = 0xC000A010 + STATUS_ND_QUEUE_OVERFLOW NTStatus = 0xC000A011 + STATUS_HOPLIMIT_EXCEEDED NTStatus = 0xC000A012 + STATUS_PROTOCOL_NOT_SUPPORTED NTStatus = 0xC000A013 + STATUS_FASTPATH_REJECTED NTStatus = 0xC000A014 + STATUS_LOST_WRITEBEHIND_DATA_NETWORK_DISCONNECTED NTStatus = 0xC000A080 + STATUS_LOST_WRITEBEHIND_DATA_NETWORK_SERVER_ERROR NTStatus = 0xC000A081 + STATUS_LOST_WRITEBEHIND_DATA_LOCAL_DISK_ERROR NTStatus = 0xC000A082 + STATUS_XML_PARSE_ERROR NTStatus = 0xC000A083 + STATUS_XMLDSIG_ERROR NTStatus = 0xC000A084 + STATUS_WRONG_COMPARTMENT NTStatus = 0xC000A085 + STATUS_AUTHIP_FAILURE NTStatus = 0xC000A086 + STATUS_DS_OID_MAPPED_GROUP_CANT_HAVE_MEMBERS NTStatus = 0xC000A087 + STATUS_DS_OID_NOT_FOUND NTStatus = 0xC000A088 + STATUS_INCORRECT_ACCOUNT_TYPE NTStatus = 0xC000A089 + STATUS_HASH_NOT_SUPPORTED NTStatus = 0xC000A100 + STATUS_HASH_NOT_PRESENT NTStatus = 0xC000A101 + STATUS_SECONDARY_IC_PROVIDER_NOT_REGISTERED NTStatus = 0xC000A121 + STATUS_GPIO_CLIENT_INFORMATION_INVALID NTStatus = 0xC000A122 + STATUS_GPIO_VERSION_NOT_SUPPORTED NTStatus = 0xC000A123 + STATUS_GPIO_INVALID_REGISTRATION_PACKET NTStatus = 0xC000A124 + STATUS_GPIO_OPERATION_DENIED NTStatus = 0xC000A125 + STATUS_GPIO_INCOMPATIBLE_CONNECT_MODE NTStatus = 0xC000A126 + STATUS_GPIO_INTERRUPT_ALREADY_UNMASKED NTStatus = 0x8000A127 + STATUS_CANNOT_SWITCH_RUNLEVEL NTStatus = 0xC000A141 + STATUS_INVALID_RUNLEVEL_SETTING NTStatus = 0xC000A142 + STATUS_RUNLEVEL_SWITCH_TIMEOUT NTStatus = 0xC000A143 + STATUS_SERVICES_FAILED_AUTOSTART NTStatus = 0x4000A144 + STATUS_RUNLEVEL_SWITCH_AGENT_TIMEOUT NTStatus = 0xC000A145 + STATUS_RUNLEVEL_SWITCH_IN_PROGRESS NTStatus = 0xC000A146 + STATUS_NOT_APPCONTAINER NTStatus = 0xC000A200 + STATUS_NOT_SUPPORTED_IN_APPCONTAINER NTStatus = 0xC000A201 + STATUS_INVALID_PACKAGE_SID_LENGTH NTStatus = 0xC000A202 + STATUS_LPAC_ACCESS_DENIED NTStatus = 0xC000A203 + STATUS_ADMINLESS_ACCESS_DENIED NTStatus = 0xC000A204 + STATUS_APP_DATA_NOT_FOUND NTStatus = 0xC000A281 + STATUS_APP_DATA_EXPIRED NTStatus = 0xC000A282 + STATUS_APP_DATA_CORRUPT NTStatus = 0xC000A283 + STATUS_APP_DATA_LIMIT_EXCEEDED NTStatus = 0xC000A284 + STATUS_APP_DATA_REBOOT_REQUIRED NTStatus = 0xC000A285 + STATUS_OFFLOAD_READ_FLT_NOT_SUPPORTED NTStatus = 0xC000A2A1 + STATUS_OFFLOAD_WRITE_FLT_NOT_SUPPORTED NTStatus = 0xC000A2A2 + STATUS_OFFLOAD_READ_FILE_NOT_SUPPORTED NTStatus = 0xC000A2A3 + STATUS_OFFLOAD_WRITE_FILE_NOT_SUPPORTED NTStatus = 0xC000A2A4 + STATUS_WOF_WIM_HEADER_CORRUPT NTStatus = 0xC000A2A5 + STATUS_WOF_WIM_RESOURCE_TABLE_CORRUPT NTStatus = 0xC000A2A6 + STATUS_WOF_FILE_RESOURCE_TABLE_CORRUPT NTStatus = 0xC000A2A7 + STATUS_FILE_SYSTEM_VIRTUALIZATION_UNAVAILABLE NTStatus = 0xC000CE01 + STATUS_FILE_SYSTEM_VIRTUALIZATION_METADATA_CORRUPT NTStatus = 0xC000CE02 + STATUS_FILE_SYSTEM_VIRTUALIZATION_BUSY NTStatus = 0xC000CE03 + STATUS_FILE_SYSTEM_VIRTUALIZATION_PROVIDER_UNKNOWN NTStatus = 0xC000CE04 + STATUS_FILE_SYSTEM_VIRTUALIZATION_INVALID_OPERATION NTStatus = 0xC000CE05 + STATUS_CLOUD_FILE_SYNC_ROOT_METADATA_CORRUPT NTStatus = 0xC000CF00 + STATUS_CLOUD_FILE_PROVIDER_NOT_RUNNING NTStatus = 0xC000CF01 + STATUS_CLOUD_FILE_METADATA_CORRUPT NTStatus = 0xC000CF02 + STATUS_CLOUD_FILE_METADATA_TOO_LARGE NTStatus = 0xC000CF03 + STATUS_CLOUD_FILE_PROPERTY_BLOB_TOO_LARGE NTStatus = 0x8000CF04 + STATUS_CLOUD_FILE_TOO_MANY_PROPERTY_BLOBS NTStatus = 0x8000CF05 + STATUS_CLOUD_FILE_PROPERTY_VERSION_NOT_SUPPORTED NTStatus = 0xC000CF06 + STATUS_NOT_A_CLOUD_FILE NTStatus = 0xC000CF07 + STATUS_CLOUD_FILE_NOT_IN_SYNC NTStatus = 0xC000CF08 + STATUS_CLOUD_FILE_ALREADY_CONNECTED NTStatus = 0xC000CF09 + STATUS_CLOUD_FILE_NOT_SUPPORTED NTStatus = 0xC000CF0A + STATUS_CLOUD_FILE_INVALID_REQUEST NTStatus = 0xC000CF0B + STATUS_CLOUD_FILE_READ_ONLY_VOLUME NTStatus = 0xC000CF0C + STATUS_CLOUD_FILE_CONNECTED_PROVIDER_ONLY NTStatus = 0xC000CF0D + STATUS_CLOUD_FILE_VALIDATION_FAILED NTStatus = 0xC000CF0E + STATUS_CLOUD_FILE_AUTHENTICATION_FAILED NTStatus = 0xC000CF0F + STATUS_CLOUD_FILE_INSUFFICIENT_RESOURCES NTStatus = 0xC000CF10 + STATUS_CLOUD_FILE_NETWORK_UNAVAILABLE NTStatus = 0xC000CF11 + STATUS_CLOUD_FILE_UNSUCCESSFUL NTStatus = 0xC000CF12 + STATUS_CLOUD_FILE_NOT_UNDER_SYNC_ROOT NTStatus = 0xC000CF13 + STATUS_CLOUD_FILE_IN_USE NTStatus = 0xC000CF14 + STATUS_CLOUD_FILE_PINNED NTStatus = 0xC000CF15 + STATUS_CLOUD_FILE_REQUEST_ABORTED NTStatus = 0xC000CF16 + STATUS_CLOUD_FILE_PROPERTY_CORRUPT NTStatus = 0xC000CF17 + STATUS_CLOUD_FILE_ACCESS_DENIED NTStatus = 0xC000CF18 + STATUS_CLOUD_FILE_INCOMPATIBLE_HARDLINKS NTStatus = 0xC000CF19 + STATUS_CLOUD_FILE_PROPERTY_LOCK_CONFLICT NTStatus = 0xC000CF1A + STATUS_CLOUD_FILE_REQUEST_CANCELED NTStatus = 0xC000CF1B + STATUS_CLOUD_FILE_PROVIDER_TERMINATED NTStatus = 0xC000CF1D + STATUS_NOT_A_CLOUD_SYNC_ROOT NTStatus = 0xC000CF1E + STATUS_CLOUD_FILE_REQUEST_TIMEOUT NTStatus = 0xC000CF1F + STATUS_ACPI_INVALID_OPCODE NTStatus = 0xC0140001 + STATUS_ACPI_STACK_OVERFLOW NTStatus = 0xC0140002 + STATUS_ACPI_ASSERT_FAILED NTStatus = 0xC0140003 + STATUS_ACPI_INVALID_INDEX NTStatus = 0xC0140004 + STATUS_ACPI_INVALID_ARGUMENT NTStatus = 0xC0140005 + STATUS_ACPI_FATAL NTStatus = 0xC0140006 + STATUS_ACPI_INVALID_SUPERNAME NTStatus = 0xC0140007 + STATUS_ACPI_INVALID_ARGTYPE NTStatus = 0xC0140008 + STATUS_ACPI_INVALID_OBJTYPE NTStatus = 0xC0140009 + STATUS_ACPI_INVALID_TARGETTYPE NTStatus = 0xC014000A + STATUS_ACPI_INCORRECT_ARGUMENT_COUNT NTStatus = 0xC014000B + STATUS_ACPI_ADDRESS_NOT_MAPPED NTStatus = 0xC014000C + STATUS_ACPI_INVALID_EVENTTYPE NTStatus = 0xC014000D + STATUS_ACPI_HANDLER_COLLISION NTStatus = 0xC014000E + STATUS_ACPI_INVALID_DATA NTStatus = 0xC014000F + STATUS_ACPI_INVALID_REGION NTStatus = 0xC0140010 + STATUS_ACPI_INVALID_ACCESS_SIZE NTStatus = 0xC0140011 + STATUS_ACPI_ACQUIRE_GLOBAL_LOCK NTStatus = 0xC0140012 + STATUS_ACPI_ALREADY_INITIALIZED NTStatus = 0xC0140013 + STATUS_ACPI_NOT_INITIALIZED NTStatus = 0xC0140014 + STATUS_ACPI_INVALID_MUTEX_LEVEL NTStatus = 0xC0140015 + STATUS_ACPI_MUTEX_NOT_OWNED NTStatus = 0xC0140016 + STATUS_ACPI_MUTEX_NOT_OWNER NTStatus = 0xC0140017 + STATUS_ACPI_RS_ACCESS NTStatus = 0xC0140018 + STATUS_ACPI_INVALID_TABLE NTStatus = 0xC0140019 + STATUS_ACPI_REG_HANDLER_FAILED NTStatus = 0xC0140020 + STATUS_ACPI_POWER_REQUEST_FAILED NTStatus = 0xC0140021 + STATUS_CTX_WINSTATION_NAME_INVALID NTStatus = 0xC00A0001 + STATUS_CTX_INVALID_PD NTStatus = 0xC00A0002 + STATUS_CTX_PD_NOT_FOUND NTStatus = 0xC00A0003 + STATUS_CTX_CDM_CONNECT NTStatus = 0x400A0004 + STATUS_CTX_CDM_DISCONNECT NTStatus = 0x400A0005 + STATUS_CTX_CLOSE_PENDING NTStatus = 0xC00A0006 + STATUS_CTX_NO_OUTBUF NTStatus = 0xC00A0007 + STATUS_CTX_MODEM_INF_NOT_FOUND NTStatus = 0xC00A0008 + STATUS_CTX_INVALID_MODEMNAME NTStatus = 0xC00A0009 + STATUS_CTX_RESPONSE_ERROR NTStatus = 0xC00A000A + STATUS_CTX_MODEM_RESPONSE_TIMEOUT NTStatus = 0xC00A000B + STATUS_CTX_MODEM_RESPONSE_NO_CARRIER NTStatus = 0xC00A000C + STATUS_CTX_MODEM_RESPONSE_NO_DIALTONE NTStatus = 0xC00A000D + STATUS_CTX_MODEM_RESPONSE_BUSY NTStatus = 0xC00A000E + STATUS_CTX_MODEM_RESPONSE_VOICE NTStatus = 0xC00A000F + STATUS_CTX_TD_ERROR NTStatus = 0xC00A0010 + STATUS_CTX_LICENSE_CLIENT_INVALID NTStatus = 0xC00A0012 + STATUS_CTX_LICENSE_NOT_AVAILABLE NTStatus = 0xC00A0013 + STATUS_CTX_LICENSE_EXPIRED NTStatus = 0xC00A0014 + STATUS_CTX_WINSTATION_NOT_FOUND NTStatus = 0xC00A0015 + STATUS_CTX_WINSTATION_NAME_COLLISION NTStatus = 0xC00A0016 + STATUS_CTX_WINSTATION_BUSY NTStatus = 0xC00A0017 + STATUS_CTX_BAD_VIDEO_MODE NTStatus = 0xC00A0018 + STATUS_CTX_GRAPHICS_INVALID NTStatus = 0xC00A0022 + STATUS_CTX_NOT_CONSOLE NTStatus = 0xC00A0024 + STATUS_CTX_CLIENT_QUERY_TIMEOUT NTStatus = 0xC00A0026 + STATUS_CTX_CONSOLE_DISCONNECT NTStatus = 0xC00A0027 + STATUS_CTX_CONSOLE_CONNECT NTStatus = 0xC00A0028 + STATUS_CTX_SHADOW_DENIED NTStatus = 0xC00A002A + STATUS_CTX_WINSTATION_ACCESS_DENIED NTStatus = 0xC00A002B + STATUS_CTX_INVALID_WD NTStatus = 0xC00A002E + STATUS_CTX_WD_NOT_FOUND NTStatus = 0xC00A002F + STATUS_CTX_SHADOW_INVALID NTStatus = 0xC00A0030 + STATUS_CTX_SHADOW_DISABLED NTStatus = 0xC00A0031 + STATUS_RDP_PROTOCOL_ERROR NTStatus = 0xC00A0032 + STATUS_CTX_CLIENT_LICENSE_NOT_SET NTStatus = 0xC00A0033 + STATUS_CTX_CLIENT_LICENSE_IN_USE NTStatus = 0xC00A0034 + STATUS_CTX_SHADOW_ENDED_BY_MODE_CHANGE NTStatus = 0xC00A0035 + STATUS_CTX_SHADOW_NOT_RUNNING NTStatus = 0xC00A0036 + STATUS_CTX_LOGON_DISABLED NTStatus = 0xC00A0037 + STATUS_CTX_SECURITY_LAYER_ERROR NTStatus = 0xC00A0038 + STATUS_TS_INCOMPATIBLE_SESSIONS NTStatus = 0xC00A0039 + STATUS_TS_VIDEO_SUBSYSTEM_ERROR NTStatus = 0xC00A003A + STATUS_PNP_BAD_MPS_TABLE NTStatus = 0xC0040035 + STATUS_PNP_TRANSLATION_FAILED NTStatus = 0xC0040036 + STATUS_PNP_IRQ_TRANSLATION_FAILED NTStatus = 0xC0040037 + STATUS_PNP_INVALID_ID NTStatus = 0xC0040038 + STATUS_IO_REISSUE_AS_CACHED NTStatus = 0xC0040039 + STATUS_MUI_FILE_NOT_FOUND NTStatus = 0xC00B0001 + STATUS_MUI_INVALID_FILE NTStatus = 0xC00B0002 + STATUS_MUI_INVALID_RC_CONFIG NTStatus = 0xC00B0003 + STATUS_MUI_INVALID_LOCALE_NAME NTStatus = 0xC00B0004 + STATUS_MUI_INVALID_ULTIMATEFALLBACK_NAME NTStatus = 0xC00B0005 + STATUS_MUI_FILE_NOT_LOADED NTStatus = 0xC00B0006 + STATUS_RESOURCE_ENUM_USER_STOP NTStatus = 0xC00B0007 + STATUS_FLT_NO_HANDLER_DEFINED NTStatus = 0xC01C0001 + STATUS_FLT_CONTEXT_ALREADY_DEFINED NTStatus = 0xC01C0002 + STATUS_FLT_INVALID_ASYNCHRONOUS_REQUEST NTStatus = 0xC01C0003 + STATUS_FLT_DISALLOW_FAST_IO NTStatus = 0xC01C0004 + STATUS_FLT_INVALID_NAME_REQUEST NTStatus = 0xC01C0005 + STATUS_FLT_NOT_SAFE_TO_POST_OPERATION NTStatus = 0xC01C0006 + STATUS_FLT_NOT_INITIALIZED NTStatus = 0xC01C0007 + STATUS_FLT_FILTER_NOT_READY NTStatus = 0xC01C0008 + STATUS_FLT_POST_OPERATION_CLEANUP NTStatus = 0xC01C0009 + STATUS_FLT_INTERNAL_ERROR NTStatus = 0xC01C000A + STATUS_FLT_DELETING_OBJECT NTStatus = 0xC01C000B + STATUS_FLT_MUST_BE_NONPAGED_POOL NTStatus = 0xC01C000C + STATUS_FLT_DUPLICATE_ENTRY NTStatus = 0xC01C000D + STATUS_FLT_CBDQ_DISABLED NTStatus = 0xC01C000E + STATUS_FLT_DO_NOT_ATTACH NTStatus = 0xC01C000F + STATUS_FLT_DO_NOT_DETACH NTStatus = 0xC01C0010 + STATUS_FLT_INSTANCE_ALTITUDE_COLLISION NTStatus = 0xC01C0011 + STATUS_FLT_INSTANCE_NAME_COLLISION NTStatus = 0xC01C0012 + STATUS_FLT_FILTER_NOT_FOUND NTStatus = 0xC01C0013 + STATUS_FLT_VOLUME_NOT_FOUND NTStatus = 0xC01C0014 + STATUS_FLT_INSTANCE_NOT_FOUND NTStatus = 0xC01C0015 + STATUS_FLT_CONTEXT_ALLOCATION_NOT_FOUND NTStatus = 0xC01C0016 + STATUS_FLT_INVALID_CONTEXT_REGISTRATION NTStatus = 0xC01C0017 + STATUS_FLT_NAME_CACHE_MISS NTStatus = 0xC01C0018 + STATUS_FLT_NO_DEVICE_OBJECT NTStatus = 0xC01C0019 + STATUS_FLT_VOLUME_ALREADY_MOUNTED NTStatus = 0xC01C001A + STATUS_FLT_ALREADY_ENLISTED NTStatus = 0xC01C001B + STATUS_FLT_CONTEXT_ALREADY_LINKED NTStatus = 0xC01C001C + STATUS_FLT_NO_WAITER_FOR_REPLY NTStatus = 0xC01C0020 + STATUS_FLT_REGISTRATION_BUSY NTStatus = 0xC01C0023 + STATUS_SXS_SECTION_NOT_FOUND NTStatus = 0xC0150001 + STATUS_SXS_CANT_GEN_ACTCTX NTStatus = 0xC0150002 + STATUS_SXS_INVALID_ACTCTXDATA_FORMAT NTStatus = 0xC0150003 + STATUS_SXS_ASSEMBLY_NOT_FOUND NTStatus = 0xC0150004 + STATUS_SXS_MANIFEST_FORMAT_ERROR NTStatus = 0xC0150005 + STATUS_SXS_MANIFEST_PARSE_ERROR NTStatus = 0xC0150006 + STATUS_SXS_ACTIVATION_CONTEXT_DISABLED NTStatus = 0xC0150007 + STATUS_SXS_KEY_NOT_FOUND NTStatus = 0xC0150008 + STATUS_SXS_VERSION_CONFLICT NTStatus = 0xC0150009 + STATUS_SXS_WRONG_SECTION_TYPE NTStatus = 0xC015000A + STATUS_SXS_THREAD_QUERIES_DISABLED NTStatus = 0xC015000B + STATUS_SXS_ASSEMBLY_MISSING NTStatus = 0xC015000C + STATUS_SXS_RELEASE_ACTIVATION_CONTEXT NTStatus = 0x4015000D + STATUS_SXS_PROCESS_DEFAULT_ALREADY_SET NTStatus = 0xC015000E + STATUS_SXS_EARLY_DEACTIVATION NTStatus = 0xC015000F + STATUS_SXS_INVALID_DEACTIVATION NTStatus = 0xC0150010 + STATUS_SXS_MULTIPLE_DEACTIVATION NTStatus = 0xC0150011 + STATUS_SXS_SYSTEM_DEFAULT_ACTIVATION_CONTEXT_EMPTY NTStatus = 0xC0150012 + STATUS_SXS_PROCESS_TERMINATION_REQUESTED NTStatus = 0xC0150013 + STATUS_SXS_CORRUPT_ACTIVATION_STACK NTStatus = 0xC0150014 + STATUS_SXS_CORRUPTION NTStatus = 0xC0150015 + STATUS_SXS_INVALID_IDENTITY_ATTRIBUTE_VALUE NTStatus = 0xC0150016 + STATUS_SXS_INVALID_IDENTITY_ATTRIBUTE_NAME NTStatus = 0xC0150017 + STATUS_SXS_IDENTITY_DUPLICATE_ATTRIBUTE NTStatus = 0xC0150018 + STATUS_SXS_IDENTITY_PARSE_ERROR NTStatus = 0xC0150019 + STATUS_SXS_COMPONENT_STORE_CORRUPT NTStatus = 0xC015001A + STATUS_SXS_FILE_HASH_MISMATCH NTStatus = 0xC015001B + STATUS_SXS_MANIFEST_IDENTITY_SAME_BUT_CONTENTS_DIFFERENT NTStatus = 0xC015001C + STATUS_SXS_IDENTITIES_DIFFERENT NTStatus = 0xC015001D + STATUS_SXS_ASSEMBLY_IS_NOT_A_DEPLOYMENT NTStatus = 0xC015001E + STATUS_SXS_FILE_NOT_PART_OF_ASSEMBLY NTStatus = 0xC015001F + STATUS_ADVANCED_INSTALLER_FAILED NTStatus = 0xC0150020 + STATUS_XML_ENCODING_MISMATCH NTStatus = 0xC0150021 + STATUS_SXS_MANIFEST_TOO_BIG NTStatus = 0xC0150022 + STATUS_SXS_SETTING_NOT_REGISTERED NTStatus = 0xC0150023 + STATUS_SXS_TRANSACTION_CLOSURE_INCOMPLETE NTStatus = 0xC0150024 + STATUS_SMI_PRIMITIVE_INSTALLER_FAILED NTStatus = 0xC0150025 + STATUS_GENERIC_COMMAND_FAILED NTStatus = 0xC0150026 + STATUS_SXS_FILE_HASH_MISSING NTStatus = 0xC0150027 + STATUS_CLUSTER_INVALID_NODE NTStatus = 0xC0130001 + STATUS_CLUSTER_NODE_EXISTS NTStatus = 0xC0130002 + STATUS_CLUSTER_JOIN_IN_PROGRESS NTStatus = 0xC0130003 + STATUS_CLUSTER_NODE_NOT_FOUND NTStatus = 0xC0130004 + STATUS_CLUSTER_LOCAL_NODE_NOT_FOUND NTStatus = 0xC0130005 + STATUS_CLUSTER_NETWORK_EXISTS NTStatus = 0xC0130006 + STATUS_CLUSTER_NETWORK_NOT_FOUND NTStatus = 0xC0130007 + STATUS_CLUSTER_NETINTERFACE_EXISTS NTStatus = 0xC0130008 + STATUS_CLUSTER_NETINTERFACE_NOT_FOUND NTStatus = 0xC0130009 + STATUS_CLUSTER_INVALID_REQUEST NTStatus = 0xC013000A + STATUS_CLUSTER_INVALID_NETWORK_PROVIDER NTStatus = 0xC013000B + STATUS_CLUSTER_NODE_DOWN NTStatus = 0xC013000C + STATUS_CLUSTER_NODE_UNREACHABLE NTStatus = 0xC013000D + STATUS_CLUSTER_NODE_NOT_MEMBER NTStatus = 0xC013000E + STATUS_CLUSTER_JOIN_NOT_IN_PROGRESS NTStatus = 0xC013000F + STATUS_CLUSTER_INVALID_NETWORK NTStatus = 0xC0130010 + STATUS_CLUSTER_NO_NET_ADAPTERS NTStatus = 0xC0130011 + STATUS_CLUSTER_NODE_UP NTStatus = 0xC0130012 + STATUS_CLUSTER_NODE_PAUSED NTStatus = 0xC0130013 + STATUS_CLUSTER_NODE_NOT_PAUSED NTStatus = 0xC0130014 + STATUS_CLUSTER_NO_SECURITY_CONTEXT NTStatus = 0xC0130015 + STATUS_CLUSTER_NETWORK_NOT_INTERNAL NTStatus = 0xC0130016 + STATUS_CLUSTER_POISONED NTStatus = 0xC0130017 + STATUS_CLUSTER_NON_CSV_PATH NTStatus = 0xC0130018 + STATUS_CLUSTER_CSV_VOLUME_NOT_LOCAL NTStatus = 0xC0130019 + STATUS_CLUSTER_CSV_READ_OPLOCK_BREAK_IN_PROGRESS NTStatus = 0xC0130020 + STATUS_CLUSTER_CSV_AUTO_PAUSE_ERROR NTStatus = 0xC0130021 + STATUS_CLUSTER_CSV_REDIRECTED NTStatus = 0xC0130022 + STATUS_CLUSTER_CSV_NOT_REDIRECTED NTStatus = 0xC0130023 + STATUS_CLUSTER_CSV_VOLUME_DRAINING NTStatus = 0xC0130024 + STATUS_CLUSTER_CSV_SNAPSHOT_CREATION_IN_PROGRESS NTStatus = 0xC0130025 + STATUS_CLUSTER_CSV_VOLUME_DRAINING_SUCCEEDED_DOWNLEVEL NTStatus = 0xC0130026 + STATUS_CLUSTER_CSV_NO_SNAPSHOTS NTStatus = 0xC0130027 + STATUS_CSV_IO_PAUSE_TIMEOUT NTStatus = 0xC0130028 + STATUS_CLUSTER_CSV_INVALID_HANDLE NTStatus = 0xC0130029 + STATUS_CLUSTER_CSV_SUPPORTED_ONLY_ON_COORDINATOR NTStatus = 0xC0130030 + STATUS_CLUSTER_CAM_TICKET_REPLAY_DETECTED NTStatus = 0xC0130031 + STATUS_TRANSACTIONAL_CONFLICT NTStatus = 0xC0190001 + STATUS_INVALID_TRANSACTION NTStatus = 0xC0190002 + STATUS_TRANSACTION_NOT_ACTIVE NTStatus = 0xC0190003 + STATUS_TM_INITIALIZATION_FAILED NTStatus = 0xC0190004 + STATUS_RM_NOT_ACTIVE NTStatus = 0xC0190005 + STATUS_RM_METADATA_CORRUPT NTStatus = 0xC0190006 + STATUS_TRANSACTION_NOT_JOINED NTStatus = 0xC0190007 + STATUS_DIRECTORY_NOT_RM NTStatus = 0xC0190008 + STATUS_COULD_NOT_RESIZE_LOG NTStatus = 0x80190009 + STATUS_TRANSACTIONS_UNSUPPORTED_REMOTE NTStatus = 0xC019000A + STATUS_LOG_RESIZE_INVALID_SIZE NTStatus = 0xC019000B + STATUS_REMOTE_FILE_VERSION_MISMATCH NTStatus = 0xC019000C + STATUS_CRM_PROTOCOL_ALREADY_EXISTS NTStatus = 0xC019000F + STATUS_TRANSACTION_PROPAGATION_FAILED NTStatus = 0xC0190010 + STATUS_CRM_PROTOCOL_NOT_FOUND NTStatus = 0xC0190011 + STATUS_TRANSACTION_SUPERIOR_EXISTS NTStatus = 0xC0190012 + STATUS_TRANSACTION_REQUEST_NOT_VALID NTStatus = 0xC0190013 + STATUS_TRANSACTION_NOT_REQUESTED NTStatus = 0xC0190014 + STATUS_TRANSACTION_ALREADY_ABORTED NTStatus = 0xC0190015 + STATUS_TRANSACTION_ALREADY_COMMITTED NTStatus = 0xC0190016 + STATUS_TRANSACTION_INVALID_MARSHALL_BUFFER NTStatus = 0xC0190017 + STATUS_CURRENT_TRANSACTION_NOT_VALID NTStatus = 0xC0190018 + STATUS_LOG_GROWTH_FAILED NTStatus = 0xC0190019 + STATUS_OBJECT_NO_LONGER_EXISTS NTStatus = 0xC0190021 + STATUS_STREAM_MINIVERSION_NOT_FOUND NTStatus = 0xC0190022 + STATUS_STREAM_MINIVERSION_NOT_VALID NTStatus = 0xC0190023 + STATUS_MINIVERSION_INACCESSIBLE_FROM_SPECIFIED_TRANSACTION NTStatus = 0xC0190024 + STATUS_CANT_OPEN_MINIVERSION_WITH_MODIFY_INTENT NTStatus = 0xC0190025 + STATUS_CANT_CREATE_MORE_STREAM_MINIVERSIONS NTStatus = 0xC0190026 + STATUS_HANDLE_NO_LONGER_VALID NTStatus = 0xC0190028 + STATUS_NO_TXF_METADATA NTStatus = 0x80190029 + STATUS_LOG_CORRUPTION_DETECTED NTStatus = 0xC0190030 + STATUS_CANT_RECOVER_WITH_HANDLE_OPEN NTStatus = 0x80190031 + STATUS_RM_DISCONNECTED NTStatus = 0xC0190032 + STATUS_ENLISTMENT_NOT_SUPERIOR NTStatus = 0xC0190033 + STATUS_RECOVERY_NOT_NEEDED NTStatus = 0x40190034 + STATUS_RM_ALREADY_STARTED NTStatus = 0x40190035 + STATUS_FILE_IDENTITY_NOT_PERSISTENT NTStatus = 0xC0190036 + STATUS_CANT_BREAK_TRANSACTIONAL_DEPENDENCY NTStatus = 0xC0190037 + STATUS_CANT_CROSS_RM_BOUNDARY NTStatus = 0xC0190038 + STATUS_TXF_DIR_NOT_EMPTY NTStatus = 0xC0190039 + STATUS_INDOUBT_TRANSACTIONS_EXIST NTStatus = 0xC019003A + STATUS_TM_VOLATILE NTStatus = 0xC019003B + STATUS_ROLLBACK_TIMER_EXPIRED NTStatus = 0xC019003C + STATUS_TXF_ATTRIBUTE_CORRUPT NTStatus = 0xC019003D + STATUS_EFS_NOT_ALLOWED_IN_TRANSACTION NTStatus = 0xC019003E + STATUS_TRANSACTIONAL_OPEN_NOT_ALLOWED NTStatus = 0xC019003F + STATUS_TRANSACTED_MAPPING_UNSUPPORTED_REMOTE NTStatus = 0xC0190040 + STATUS_TXF_METADATA_ALREADY_PRESENT NTStatus = 0x80190041 + STATUS_TRANSACTION_SCOPE_CALLBACKS_NOT_SET NTStatus = 0x80190042 + STATUS_TRANSACTION_REQUIRED_PROMOTION NTStatus = 0xC0190043 + STATUS_CANNOT_EXECUTE_FILE_IN_TRANSACTION NTStatus = 0xC0190044 + STATUS_TRANSACTIONS_NOT_FROZEN NTStatus = 0xC0190045 + STATUS_TRANSACTION_FREEZE_IN_PROGRESS NTStatus = 0xC0190046 + STATUS_NOT_SNAPSHOT_VOLUME NTStatus = 0xC0190047 + STATUS_NO_SAVEPOINT_WITH_OPEN_FILES NTStatus = 0xC0190048 + STATUS_SPARSE_NOT_ALLOWED_IN_TRANSACTION NTStatus = 0xC0190049 + STATUS_TM_IDENTITY_MISMATCH NTStatus = 0xC019004A + STATUS_FLOATED_SECTION NTStatus = 0xC019004B + STATUS_CANNOT_ACCEPT_TRANSACTED_WORK NTStatus = 0xC019004C + STATUS_CANNOT_ABORT_TRANSACTIONS NTStatus = 0xC019004D + STATUS_TRANSACTION_NOT_FOUND NTStatus = 0xC019004E + STATUS_RESOURCEMANAGER_NOT_FOUND NTStatus = 0xC019004F + STATUS_ENLISTMENT_NOT_FOUND NTStatus = 0xC0190050 + STATUS_TRANSACTIONMANAGER_NOT_FOUND NTStatus = 0xC0190051 + STATUS_TRANSACTIONMANAGER_NOT_ONLINE NTStatus = 0xC0190052 + STATUS_TRANSACTIONMANAGER_RECOVERY_NAME_COLLISION NTStatus = 0xC0190053 + STATUS_TRANSACTION_NOT_ROOT NTStatus = 0xC0190054 + STATUS_TRANSACTION_OBJECT_EXPIRED NTStatus = 0xC0190055 + STATUS_COMPRESSION_NOT_ALLOWED_IN_TRANSACTION NTStatus = 0xC0190056 + STATUS_TRANSACTION_RESPONSE_NOT_ENLISTED NTStatus = 0xC0190057 + STATUS_TRANSACTION_RECORD_TOO_LONG NTStatus = 0xC0190058 + STATUS_NO_LINK_TRACKING_IN_TRANSACTION NTStatus = 0xC0190059 + STATUS_OPERATION_NOT_SUPPORTED_IN_TRANSACTION NTStatus = 0xC019005A + STATUS_TRANSACTION_INTEGRITY_VIOLATED NTStatus = 0xC019005B + STATUS_TRANSACTIONMANAGER_IDENTITY_MISMATCH NTStatus = 0xC019005C + STATUS_RM_CANNOT_BE_FROZEN_FOR_SNAPSHOT NTStatus = 0xC019005D + STATUS_TRANSACTION_MUST_WRITETHROUGH NTStatus = 0xC019005E + STATUS_TRANSACTION_NO_SUPERIOR NTStatus = 0xC019005F + STATUS_EXPIRED_HANDLE NTStatus = 0xC0190060 + STATUS_TRANSACTION_NOT_ENLISTED NTStatus = 0xC0190061 + STATUS_LOG_SECTOR_INVALID NTStatus = 0xC01A0001 + STATUS_LOG_SECTOR_PARITY_INVALID NTStatus = 0xC01A0002 + STATUS_LOG_SECTOR_REMAPPED NTStatus = 0xC01A0003 + STATUS_LOG_BLOCK_INCOMPLETE NTStatus = 0xC01A0004 + STATUS_LOG_INVALID_RANGE NTStatus = 0xC01A0005 + STATUS_LOG_BLOCKS_EXHAUSTED NTStatus = 0xC01A0006 + STATUS_LOG_READ_CONTEXT_INVALID NTStatus = 0xC01A0007 + STATUS_LOG_RESTART_INVALID NTStatus = 0xC01A0008 + STATUS_LOG_BLOCK_VERSION NTStatus = 0xC01A0009 + STATUS_LOG_BLOCK_INVALID NTStatus = 0xC01A000A + STATUS_LOG_READ_MODE_INVALID NTStatus = 0xC01A000B + STATUS_LOG_NO_RESTART NTStatus = 0x401A000C + STATUS_LOG_METADATA_CORRUPT NTStatus = 0xC01A000D + STATUS_LOG_METADATA_INVALID NTStatus = 0xC01A000E + STATUS_LOG_METADATA_INCONSISTENT NTStatus = 0xC01A000F + STATUS_LOG_RESERVATION_INVALID NTStatus = 0xC01A0010 + STATUS_LOG_CANT_DELETE NTStatus = 0xC01A0011 + STATUS_LOG_CONTAINER_LIMIT_EXCEEDED NTStatus = 0xC01A0012 + STATUS_LOG_START_OF_LOG NTStatus = 0xC01A0013 + STATUS_LOG_POLICY_ALREADY_INSTALLED NTStatus = 0xC01A0014 + STATUS_LOG_POLICY_NOT_INSTALLED NTStatus = 0xC01A0015 + STATUS_LOG_POLICY_INVALID NTStatus = 0xC01A0016 + STATUS_LOG_POLICY_CONFLICT NTStatus = 0xC01A0017 + STATUS_LOG_PINNED_ARCHIVE_TAIL NTStatus = 0xC01A0018 + STATUS_LOG_RECORD_NONEXISTENT NTStatus = 0xC01A0019 + STATUS_LOG_RECORDS_RESERVED_INVALID NTStatus = 0xC01A001A + STATUS_LOG_SPACE_RESERVED_INVALID NTStatus = 0xC01A001B + STATUS_LOG_TAIL_INVALID NTStatus = 0xC01A001C + STATUS_LOG_FULL NTStatus = 0xC01A001D + STATUS_LOG_MULTIPLEXED NTStatus = 0xC01A001E + STATUS_LOG_DEDICATED NTStatus = 0xC01A001F + STATUS_LOG_ARCHIVE_NOT_IN_PROGRESS NTStatus = 0xC01A0020 + STATUS_LOG_ARCHIVE_IN_PROGRESS NTStatus = 0xC01A0021 + STATUS_LOG_EPHEMERAL NTStatus = 0xC01A0022 + STATUS_LOG_NOT_ENOUGH_CONTAINERS NTStatus = 0xC01A0023 + STATUS_LOG_CLIENT_ALREADY_REGISTERED NTStatus = 0xC01A0024 + STATUS_LOG_CLIENT_NOT_REGISTERED NTStatus = 0xC01A0025 + STATUS_LOG_FULL_HANDLER_IN_PROGRESS NTStatus = 0xC01A0026 + STATUS_LOG_CONTAINER_READ_FAILED NTStatus = 0xC01A0027 + STATUS_LOG_CONTAINER_WRITE_FAILED NTStatus = 0xC01A0028 + STATUS_LOG_CONTAINER_OPEN_FAILED NTStatus = 0xC01A0029 + STATUS_LOG_CONTAINER_STATE_INVALID NTStatus = 0xC01A002A + STATUS_LOG_STATE_INVALID NTStatus = 0xC01A002B + STATUS_LOG_PINNED NTStatus = 0xC01A002C + STATUS_LOG_METADATA_FLUSH_FAILED NTStatus = 0xC01A002D + STATUS_LOG_INCONSISTENT_SECURITY NTStatus = 0xC01A002E + STATUS_LOG_APPENDED_FLUSH_FAILED NTStatus = 0xC01A002F + STATUS_LOG_PINNED_RESERVATION NTStatus = 0xC01A0030 + STATUS_VIDEO_HUNG_DISPLAY_DRIVER_THREAD NTStatus = 0xC01B00EA + STATUS_VIDEO_HUNG_DISPLAY_DRIVER_THREAD_RECOVERED NTStatus = 0x801B00EB + STATUS_VIDEO_DRIVER_DEBUG_REPORT_REQUEST NTStatus = 0x401B00EC + STATUS_MONITOR_NO_DESCRIPTOR NTStatus = 0xC01D0001 + STATUS_MONITOR_UNKNOWN_DESCRIPTOR_FORMAT NTStatus = 0xC01D0002 + STATUS_MONITOR_INVALID_DESCRIPTOR_CHECKSUM NTStatus = 0xC01D0003 + STATUS_MONITOR_INVALID_STANDARD_TIMING_BLOCK NTStatus = 0xC01D0004 + STATUS_MONITOR_WMI_DATABLOCK_REGISTRATION_FAILED NTStatus = 0xC01D0005 + STATUS_MONITOR_INVALID_SERIAL_NUMBER_MONDSC_BLOCK NTStatus = 0xC01D0006 + STATUS_MONITOR_INVALID_USER_FRIENDLY_MONDSC_BLOCK NTStatus = 0xC01D0007 + STATUS_MONITOR_NO_MORE_DESCRIPTOR_DATA NTStatus = 0xC01D0008 + STATUS_MONITOR_INVALID_DETAILED_TIMING_BLOCK NTStatus = 0xC01D0009 + STATUS_MONITOR_INVALID_MANUFACTURE_DATE NTStatus = 0xC01D000A + STATUS_GRAPHICS_NOT_EXCLUSIVE_MODE_OWNER NTStatus = 0xC01E0000 + STATUS_GRAPHICS_INSUFFICIENT_DMA_BUFFER NTStatus = 0xC01E0001 + STATUS_GRAPHICS_INVALID_DISPLAY_ADAPTER NTStatus = 0xC01E0002 + STATUS_GRAPHICS_ADAPTER_WAS_RESET NTStatus = 0xC01E0003 + STATUS_GRAPHICS_INVALID_DRIVER_MODEL NTStatus = 0xC01E0004 + STATUS_GRAPHICS_PRESENT_MODE_CHANGED NTStatus = 0xC01E0005 + STATUS_GRAPHICS_PRESENT_OCCLUDED NTStatus = 0xC01E0006 + STATUS_GRAPHICS_PRESENT_DENIED NTStatus = 0xC01E0007 + STATUS_GRAPHICS_CANNOTCOLORCONVERT NTStatus = 0xC01E0008 + STATUS_GRAPHICS_DRIVER_MISMATCH NTStatus = 0xC01E0009 + STATUS_GRAPHICS_PARTIAL_DATA_POPULATED NTStatus = 0x401E000A + STATUS_GRAPHICS_PRESENT_REDIRECTION_DISABLED NTStatus = 0xC01E000B + STATUS_GRAPHICS_PRESENT_UNOCCLUDED NTStatus = 0xC01E000C + STATUS_GRAPHICS_WINDOWDC_NOT_AVAILABLE NTStatus = 0xC01E000D + STATUS_GRAPHICS_WINDOWLESS_PRESENT_DISABLED NTStatus = 0xC01E000E + STATUS_GRAPHICS_PRESENT_INVALID_WINDOW NTStatus = 0xC01E000F + STATUS_GRAPHICS_PRESENT_BUFFER_NOT_BOUND NTStatus = 0xC01E0010 + STATUS_GRAPHICS_VAIL_STATE_CHANGED NTStatus = 0xC01E0011 + STATUS_GRAPHICS_INDIRECT_DISPLAY_ABANDON_SWAPCHAIN NTStatus = 0xC01E0012 + STATUS_GRAPHICS_INDIRECT_DISPLAY_DEVICE_STOPPED NTStatus = 0xC01E0013 + STATUS_GRAPHICS_NO_VIDEO_MEMORY NTStatus = 0xC01E0100 + STATUS_GRAPHICS_CANT_LOCK_MEMORY NTStatus = 0xC01E0101 + STATUS_GRAPHICS_ALLOCATION_BUSY NTStatus = 0xC01E0102 + STATUS_GRAPHICS_TOO_MANY_REFERENCES NTStatus = 0xC01E0103 + STATUS_GRAPHICS_TRY_AGAIN_LATER NTStatus = 0xC01E0104 + STATUS_GRAPHICS_TRY_AGAIN_NOW NTStatus = 0xC01E0105 + STATUS_GRAPHICS_ALLOCATION_INVALID NTStatus = 0xC01E0106 + STATUS_GRAPHICS_UNSWIZZLING_APERTURE_UNAVAILABLE NTStatus = 0xC01E0107 + STATUS_GRAPHICS_UNSWIZZLING_APERTURE_UNSUPPORTED NTStatus = 0xC01E0108 + STATUS_GRAPHICS_CANT_EVICT_PINNED_ALLOCATION NTStatus = 0xC01E0109 + STATUS_GRAPHICS_INVALID_ALLOCATION_USAGE NTStatus = 0xC01E0110 + STATUS_GRAPHICS_CANT_RENDER_LOCKED_ALLOCATION NTStatus = 0xC01E0111 + STATUS_GRAPHICS_ALLOCATION_CLOSED NTStatus = 0xC01E0112 + STATUS_GRAPHICS_INVALID_ALLOCATION_INSTANCE NTStatus = 0xC01E0113 + STATUS_GRAPHICS_INVALID_ALLOCATION_HANDLE NTStatus = 0xC01E0114 + STATUS_GRAPHICS_WRONG_ALLOCATION_DEVICE NTStatus = 0xC01E0115 + STATUS_GRAPHICS_ALLOCATION_CONTENT_LOST NTStatus = 0xC01E0116 + STATUS_GRAPHICS_GPU_EXCEPTION_ON_DEVICE NTStatus = 0xC01E0200 + STATUS_GRAPHICS_SKIP_ALLOCATION_PREPARATION NTStatus = 0x401E0201 + STATUS_GRAPHICS_INVALID_VIDPN_TOPOLOGY NTStatus = 0xC01E0300 + STATUS_GRAPHICS_VIDPN_TOPOLOGY_NOT_SUPPORTED NTStatus = 0xC01E0301 + STATUS_GRAPHICS_VIDPN_TOPOLOGY_CURRENTLY_NOT_SUPPORTED NTStatus = 0xC01E0302 + STATUS_GRAPHICS_INVALID_VIDPN NTStatus = 0xC01E0303 + STATUS_GRAPHICS_INVALID_VIDEO_PRESENT_SOURCE NTStatus = 0xC01E0304 + STATUS_GRAPHICS_INVALID_VIDEO_PRESENT_TARGET NTStatus = 0xC01E0305 + STATUS_GRAPHICS_VIDPN_MODALITY_NOT_SUPPORTED NTStatus = 0xC01E0306 + STATUS_GRAPHICS_MODE_NOT_PINNED NTStatus = 0x401E0307 + STATUS_GRAPHICS_INVALID_VIDPN_SOURCEMODESET NTStatus = 0xC01E0308 + STATUS_GRAPHICS_INVALID_VIDPN_TARGETMODESET NTStatus = 0xC01E0309 + STATUS_GRAPHICS_INVALID_FREQUENCY NTStatus = 0xC01E030A + STATUS_GRAPHICS_INVALID_ACTIVE_REGION NTStatus = 0xC01E030B + STATUS_GRAPHICS_INVALID_TOTAL_REGION NTStatus = 0xC01E030C + STATUS_GRAPHICS_INVALID_VIDEO_PRESENT_SOURCE_MODE NTStatus = 0xC01E0310 + STATUS_GRAPHICS_INVALID_VIDEO_PRESENT_TARGET_MODE NTStatus = 0xC01E0311 + STATUS_GRAPHICS_PINNED_MODE_MUST_REMAIN_IN_SET NTStatus = 0xC01E0312 + STATUS_GRAPHICS_PATH_ALREADY_IN_TOPOLOGY NTStatus = 0xC01E0313 + STATUS_GRAPHICS_MODE_ALREADY_IN_MODESET NTStatus = 0xC01E0314 + STATUS_GRAPHICS_INVALID_VIDEOPRESENTSOURCESET NTStatus = 0xC01E0315 + STATUS_GRAPHICS_INVALID_VIDEOPRESENTTARGETSET NTStatus = 0xC01E0316 + STATUS_GRAPHICS_SOURCE_ALREADY_IN_SET NTStatus = 0xC01E0317 + STATUS_GRAPHICS_TARGET_ALREADY_IN_SET NTStatus = 0xC01E0318 + STATUS_GRAPHICS_INVALID_VIDPN_PRESENT_PATH NTStatus = 0xC01E0319 + STATUS_GRAPHICS_NO_RECOMMENDED_VIDPN_TOPOLOGY NTStatus = 0xC01E031A + STATUS_GRAPHICS_INVALID_MONITOR_FREQUENCYRANGESET NTStatus = 0xC01E031B + STATUS_GRAPHICS_INVALID_MONITOR_FREQUENCYRANGE NTStatus = 0xC01E031C + STATUS_GRAPHICS_FREQUENCYRANGE_NOT_IN_SET NTStatus = 0xC01E031D + STATUS_GRAPHICS_NO_PREFERRED_MODE NTStatus = 0x401E031E + STATUS_GRAPHICS_FREQUENCYRANGE_ALREADY_IN_SET NTStatus = 0xC01E031F + STATUS_GRAPHICS_STALE_MODESET NTStatus = 0xC01E0320 + STATUS_GRAPHICS_INVALID_MONITOR_SOURCEMODESET NTStatus = 0xC01E0321 + STATUS_GRAPHICS_INVALID_MONITOR_SOURCE_MODE NTStatus = 0xC01E0322 + STATUS_GRAPHICS_NO_RECOMMENDED_FUNCTIONAL_VIDPN NTStatus = 0xC01E0323 + STATUS_GRAPHICS_MODE_ID_MUST_BE_UNIQUE NTStatus = 0xC01E0324 + STATUS_GRAPHICS_EMPTY_ADAPTER_MONITOR_MODE_SUPPORT_INTERSECTION NTStatus = 0xC01E0325 + STATUS_GRAPHICS_VIDEO_PRESENT_TARGETS_LESS_THAN_SOURCES NTStatus = 0xC01E0326 + STATUS_GRAPHICS_PATH_NOT_IN_TOPOLOGY NTStatus = 0xC01E0327 + STATUS_GRAPHICS_ADAPTER_MUST_HAVE_AT_LEAST_ONE_SOURCE NTStatus = 0xC01E0328 + STATUS_GRAPHICS_ADAPTER_MUST_HAVE_AT_LEAST_ONE_TARGET NTStatus = 0xC01E0329 + STATUS_GRAPHICS_INVALID_MONITORDESCRIPTORSET NTStatus = 0xC01E032A + STATUS_GRAPHICS_INVALID_MONITORDESCRIPTOR NTStatus = 0xC01E032B + STATUS_GRAPHICS_MONITORDESCRIPTOR_NOT_IN_SET NTStatus = 0xC01E032C + STATUS_GRAPHICS_MONITORDESCRIPTOR_ALREADY_IN_SET NTStatus = 0xC01E032D + STATUS_GRAPHICS_MONITORDESCRIPTOR_ID_MUST_BE_UNIQUE NTStatus = 0xC01E032E + STATUS_GRAPHICS_INVALID_VIDPN_TARGET_SUBSET_TYPE NTStatus = 0xC01E032F + STATUS_GRAPHICS_RESOURCES_NOT_RELATED NTStatus = 0xC01E0330 + STATUS_GRAPHICS_SOURCE_ID_MUST_BE_UNIQUE NTStatus = 0xC01E0331 + STATUS_GRAPHICS_TARGET_ID_MUST_BE_UNIQUE NTStatus = 0xC01E0332 + STATUS_GRAPHICS_NO_AVAILABLE_VIDPN_TARGET NTStatus = 0xC01E0333 + STATUS_GRAPHICS_MONITOR_COULD_NOT_BE_ASSOCIATED_WITH_ADAPTER NTStatus = 0xC01E0334 + STATUS_GRAPHICS_NO_VIDPNMGR NTStatus = 0xC01E0335 + STATUS_GRAPHICS_NO_ACTIVE_VIDPN NTStatus = 0xC01E0336 + STATUS_GRAPHICS_STALE_VIDPN_TOPOLOGY NTStatus = 0xC01E0337 + STATUS_GRAPHICS_MONITOR_NOT_CONNECTED NTStatus = 0xC01E0338 + STATUS_GRAPHICS_SOURCE_NOT_IN_TOPOLOGY NTStatus = 0xC01E0339 + STATUS_GRAPHICS_INVALID_PRIMARYSURFACE_SIZE NTStatus = 0xC01E033A + STATUS_GRAPHICS_INVALID_VISIBLEREGION_SIZE NTStatus = 0xC01E033B + STATUS_GRAPHICS_INVALID_STRIDE NTStatus = 0xC01E033C + STATUS_GRAPHICS_INVALID_PIXELFORMAT NTStatus = 0xC01E033D + STATUS_GRAPHICS_INVALID_COLORBASIS NTStatus = 0xC01E033E + STATUS_GRAPHICS_INVALID_PIXELVALUEACCESSMODE NTStatus = 0xC01E033F + STATUS_GRAPHICS_TARGET_NOT_IN_TOPOLOGY NTStatus = 0xC01E0340 + STATUS_GRAPHICS_NO_DISPLAY_MODE_MANAGEMENT_SUPPORT NTStatus = 0xC01E0341 + STATUS_GRAPHICS_VIDPN_SOURCE_IN_USE NTStatus = 0xC01E0342 + STATUS_GRAPHICS_CANT_ACCESS_ACTIVE_VIDPN NTStatus = 0xC01E0343 + STATUS_GRAPHICS_INVALID_PATH_IMPORTANCE_ORDINAL NTStatus = 0xC01E0344 + STATUS_GRAPHICS_INVALID_PATH_CONTENT_GEOMETRY_TRANSFORMATION NTStatus = 0xC01E0345 + STATUS_GRAPHICS_PATH_CONTENT_GEOMETRY_TRANSFORMATION_NOT_SUPPORTED NTStatus = 0xC01E0346 + STATUS_GRAPHICS_INVALID_GAMMA_RAMP NTStatus = 0xC01E0347 + STATUS_GRAPHICS_GAMMA_RAMP_NOT_SUPPORTED NTStatus = 0xC01E0348 + STATUS_GRAPHICS_MULTISAMPLING_NOT_SUPPORTED NTStatus = 0xC01E0349 + STATUS_GRAPHICS_MODE_NOT_IN_MODESET NTStatus = 0xC01E034A + STATUS_GRAPHICS_DATASET_IS_EMPTY NTStatus = 0x401E034B + STATUS_GRAPHICS_NO_MORE_ELEMENTS_IN_DATASET NTStatus = 0x401E034C + STATUS_GRAPHICS_INVALID_VIDPN_TOPOLOGY_RECOMMENDATION_REASON NTStatus = 0xC01E034D + STATUS_GRAPHICS_INVALID_PATH_CONTENT_TYPE NTStatus = 0xC01E034E + STATUS_GRAPHICS_INVALID_COPYPROTECTION_TYPE NTStatus = 0xC01E034F + STATUS_GRAPHICS_UNASSIGNED_MODESET_ALREADY_EXISTS NTStatus = 0xC01E0350 + STATUS_GRAPHICS_PATH_CONTENT_GEOMETRY_TRANSFORMATION_NOT_PINNED NTStatus = 0x401E0351 + STATUS_GRAPHICS_INVALID_SCANLINE_ORDERING NTStatus = 0xC01E0352 + STATUS_GRAPHICS_TOPOLOGY_CHANGES_NOT_ALLOWED NTStatus = 0xC01E0353 + STATUS_GRAPHICS_NO_AVAILABLE_IMPORTANCE_ORDINALS NTStatus = 0xC01E0354 + STATUS_GRAPHICS_INCOMPATIBLE_PRIVATE_FORMAT NTStatus = 0xC01E0355 + STATUS_GRAPHICS_INVALID_MODE_PRUNING_ALGORITHM NTStatus = 0xC01E0356 + STATUS_GRAPHICS_INVALID_MONITOR_CAPABILITY_ORIGIN NTStatus = 0xC01E0357 + STATUS_GRAPHICS_INVALID_MONITOR_FREQUENCYRANGE_CONSTRAINT NTStatus = 0xC01E0358 + STATUS_GRAPHICS_MAX_NUM_PATHS_REACHED NTStatus = 0xC01E0359 + STATUS_GRAPHICS_CANCEL_VIDPN_TOPOLOGY_AUGMENTATION NTStatus = 0xC01E035A + STATUS_GRAPHICS_INVALID_CLIENT_TYPE NTStatus = 0xC01E035B + STATUS_GRAPHICS_CLIENTVIDPN_NOT_SET NTStatus = 0xC01E035C + STATUS_GRAPHICS_SPECIFIED_CHILD_ALREADY_CONNECTED NTStatus = 0xC01E0400 + STATUS_GRAPHICS_CHILD_DESCRIPTOR_NOT_SUPPORTED NTStatus = 0xC01E0401 + STATUS_GRAPHICS_UNKNOWN_CHILD_STATUS NTStatus = 0x401E042F + STATUS_GRAPHICS_NOT_A_LINKED_ADAPTER NTStatus = 0xC01E0430 + STATUS_GRAPHICS_LEADLINK_NOT_ENUMERATED NTStatus = 0xC01E0431 + STATUS_GRAPHICS_CHAINLINKS_NOT_ENUMERATED NTStatus = 0xC01E0432 + STATUS_GRAPHICS_ADAPTER_CHAIN_NOT_READY NTStatus = 0xC01E0433 + STATUS_GRAPHICS_CHAINLINKS_NOT_STARTED NTStatus = 0xC01E0434 + STATUS_GRAPHICS_CHAINLINKS_NOT_POWERED_ON NTStatus = 0xC01E0435 + STATUS_GRAPHICS_INCONSISTENT_DEVICE_LINK_STATE NTStatus = 0xC01E0436 + STATUS_GRAPHICS_LEADLINK_START_DEFERRED NTStatus = 0x401E0437 + STATUS_GRAPHICS_NOT_POST_DEVICE_DRIVER NTStatus = 0xC01E0438 + STATUS_GRAPHICS_POLLING_TOO_FREQUENTLY NTStatus = 0x401E0439 + STATUS_GRAPHICS_START_DEFERRED NTStatus = 0x401E043A + STATUS_GRAPHICS_ADAPTER_ACCESS_NOT_EXCLUDED NTStatus = 0xC01E043B + STATUS_GRAPHICS_DEPENDABLE_CHILD_STATUS NTStatus = 0x401E043C + STATUS_GRAPHICS_OPM_NOT_SUPPORTED NTStatus = 0xC01E0500 + STATUS_GRAPHICS_COPP_NOT_SUPPORTED NTStatus = 0xC01E0501 + STATUS_GRAPHICS_UAB_NOT_SUPPORTED NTStatus = 0xC01E0502 + STATUS_GRAPHICS_OPM_INVALID_ENCRYPTED_PARAMETERS NTStatus = 0xC01E0503 + STATUS_GRAPHICS_OPM_NO_PROTECTED_OUTPUTS_EXIST NTStatus = 0xC01E0505 + STATUS_GRAPHICS_OPM_INTERNAL_ERROR NTStatus = 0xC01E050B + STATUS_GRAPHICS_OPM_INVALID_HANDLE NTStatus = 0xC01E050C + STATUS_GRAPHICS_PVP_INVALID_CERTIFICATE_LENGTH NTStatus = 0xC01E050E + STATUS_GRAPHICS_OPM_SPANNING_MODE_ENABLED NTStatus = 0xC01E050F + STATUS_GRAPHICS_OPM_THEATER_MODE_ENABLED NTStatus = 0xC01E0510 + STATUS_GRAPHICS_PVP_HFS_FAILED NTStatus = 0xC01E0511 + STATUS_GRAPHICS_OPM_INVALID_SRM NTStatus = 0xC01E0512 + STATUS_GRAPHICS_OPM_OUTPUT_DOES_NOT_SUPPORT_HDCP NTStatus = 0xC01E0513 + STATUS_GRAPHICS_OPM_OUTPUT_DOES_NOT_SUPPORT_ACP NTStatus = 0xC01E0514 + STATUS_GRAPHICS_OPM_OUTPUT_DOES_NOT_SUPPORT_CGMSA NTStatus = 0xC01E0515 + STATUS_GRAPHICS_OPM_HDCP_SRM_NEVER_SET NTStatus = 0xC01E0516 + STATUS_GRAPHICS_OPM_RESOLUTION_TOO_HIGH NTStatus = 0xC01E0517 + STATUS_GRAPHICS_OPM_ALL_HDCP_HARDWARE_ALREADY_IN_USE NTStatus = 0xC01E0518 + STATUS_GRAPHICS_OPM_PROTECTED_OUTPUT_NO_LONGER_EXISTS NTStatus = 0xC01E051A + STATUS_GRAPHICS_OPM_PROTECTED_OUTPUT_DOES_NOT_HAVE_COPP_SEMANTICS NTStatus = 0xC01E051C + STATUS_GRAPHICS_OPM_INVALID_INFORMATION_REQUEST NTStatus = 0xC01E051D + STATUS_GRAPHICS_OPM_DRIVER_INTERNAL_ERROR NTStatus = 0xC01E051E + STATUS_GRAPHICS_OPM_PROTECTED_OUTPUT_DOES_NOT_HAVE_OPM_SEMANTICS NTStatus = 0xC01E051F + STATUS_GRAPHICS_OPM_SIGNALING_NOT_SUPPORTED NTStatus = 0xC01E0520 + STATUS_GRAPHICS_OPM_INVALID_CONFIGURATION_REQUEST NTStatus = 0xC01E0521 + STATUS_GRAPHICS_I2C_NOT_SUPPORTED NTStatus = 0xC01E0580 + STATUS_GRAPHICS_I2C_DEVICE_DOES_NOT_EXIST NTStatus = 0xC01E0581 + STATUS_GRAPHICS_I2C_ERROR_TRANSMITTING_DATA NTStatus = 0xC01E0582 + STATUS_GRAPHICS_I2C_ERROR_RECEIVING_DATA NTStatus = 0xC01E0583 + STATUS_GRAPHICS_DDCCI_VCP_NOT_SUPPORTED NTStatus = 0xC01E0584 + STATUS_GRAPHICS_DDCCI_INVALID_DATA NTStatus = 0xC01E0585 + STATUS_GRAPHICS_DDCCI_MONITOR_RETURNED_INVALID_TIMING_STATUS_BYTE NTStatus = 0xC01E0586 + STATUS_GRAPHICS_DDCCI_INVALID_CAPABILITIES_STRING NTStatus = 0xC01E0587 + STATUS_GRAPHICS_MCA_INTERNAL_ERROR NTStatus = 0xC01E0588 + STATUS_GRAPHICS_DDCCI_INVALID_MESSAGE_COMMAND NTStatus = 0xC01E0589 + STATUS_GRAPHICS_DDCCI_INVALID_MESSAGE_LENGTH NTStatus = 0xC01E058A + STATUS_GRAPHICS_DDCCI_INVALID_MESSAGE_CHECKSUM NTStatus = 0xC01E058B + STATUS_GRAPHICS_INVALID_PHYSICAL_MONITOR_HANDLE NTStatus = 0xC01E058C + STATUS_GRAPHICS_MONITOR_NO_LONGER_EXISTS NTStatus = 0xC01E058D + STATUS_GRAPHICS_ONLY_CONSOLE_SESSION_SUPPORTED NTStatus = 0xC01E05E0 + STATUS_GRAPHICS_NO_DISPLAY_DEVICE_CORRESPONDS_TO_NAME NTStatus = 0xC01E05E1 + STATUS_GRAPHICS_DISPLAY_DEVICE_NOT_ATTACHED_TO_DESKTOP NTStatus = 0xC01E05E2 + STATUS_GRAPHICS_MIRRORING_DEVICES_NOT_SUPPORTED NTStatus = 0xC01E05E3 + STATUS_GRAPHICS_INVALID_POINTER NTStatus = 0xC01E05E4 + STATUS_GRAPHICS_NO_MONITORS_CORRESPOND_TO_DISPLAY_DEVICE NTStatus = 0xC01E05E5 + STATUS_GRAPHICS_PARAMETER_ARRAY_TOO_SMALL NTStatus = 0xC01E05E6 + STATUS_GRAPHICS_INTERNAL_ERROR NTStatus = 0xC01E05E7 + STATUS_GRAPHICS_SESSION_TYPE_CHANGE_IN_PROGRESS NTStatus = 0xC01E05E8 + STATUS_FVE_LOCKED_VOLUME NTStatus = 0xC0210000 + STATUS_FVE_NOT_ENCRYPTED NTStatus = 0xC0210001 + STATUS_FVE_BAD_INFORMATION NTStatus = 0xC0210002 + STATUS_FVE_TOO_SMALL NTStatus = 0xC0210003 + STATUS_FVE_FAILED_WRONG_FS NTStatus = 0xC0210004 + STATUS_FVE_BAD_PARTITION_SIZE NTStatus = 0xC0210005 + STATUS_FVE_FS_NOT_EXTENDED NTStatus = 0xC0210006 + STATUS_FVE_FS_MOUNTED NTStatus = 0xC0210007 + STATUS_FVE_NO_LICENSE NTStatus = 0xC0210008 + STATUS_FVE_ACTION_NOT_ALLOWED NTStatus = 0xC0210009 + STATUS_FVE_BAD_DATA NTStatus = 0xC021000A + STATUS_FVE_VOLUME_NOT_BOUND NTStatus = 0xC021000B + STATUS_FVE_NOT_DATA_VOLUME NTStatus = 0xC021000C + STATUS_FVE_CONV_READ_ERROR NTStatus = 0xC021000D + STATUS_FVE_CONV_WRITE_ERROR NTStatus = 0xC021000E + STATUS_FVE_OVERLAPPED_UPDATE NTStatus = 0xC021000F + STATUS_FVE_FAILED_SECTOR_SIZE NTStatus = 0xC0210010 + STATUS_FVE_FAILED_AUTHENTICATION NTStatus = 0xC0210011 + STATUS_FVE_NOT_OS_VOLUME NTStatus = 0xC0210012 + STATUS_FVE_KEYFILE_NOT_FOUND NTStatus = 0xC0210013 + STATUS_FVE_KEYFILE_INVALID NTStatus = 0xC0210014 + STATUS_FVE_KEYFILE_NO_VMK NTStatus = 0xC0210015 + STATUS_FVE_TPM_DISABLED NTStatus = 0xC0210016 + STATUS_FVE_TPM_SRK_AUTH_NOT_ZERO NTStatus = 0xC0210017 + STATUS_FVE_TPM_INVALID_PCR NTStatus = 0xC0210018 + STATUS_FVE_TPM_NO_VMK NTStatus = 0xC0210019 + STATUS_FVE_PIN_INVALID NTStatus = 0xC021001A + STATUS_FVE_AUTH_INVALID_APPLICATION NTStatus = 0xC021001B + STATUS_FVE_AUTH_INVALID_CONFIG NTStatus = 0xC021001C + STATUS_FVE_DEBUGGER_ENABLED NTStatus = 0xC021001D + STATUS_FVE_DRY_RUN_FAILED NTStatus = 0xC021001E + STATUS_FVE_BAD_METADATA_POINTER NTStatus = 0xC021001F + STATUS_FVE_OLD_METADATA_COPY NTStatus = 0xC0210020 + STATUS_FVE_REBOOT_REQUIRED NTStatus = 0xC0210021 + STATUS_FVE_RAW_ACCESS NTStatus = 0xC0210022 + STATUS_FVE_RAW_BLOCKED NTStatus = 0xC0210023 + STATUS_FVE_NO_AUTOUNLOCK_MASTER_KEY NTStatus = 0xC0210024 + STATUS_FVE_MOR_FAILED NTStatus = 0xC0210025 + STATUS_FVE_NO_FEATURE_LICENSE NTStatus = 0xC0210026 + STATUS_FVE_POLICY_USER_DISABLE_RDV_NOT_ALLOWED NTStatus = 0xC0210027 + STATUS_FVE_CONV_RECOVERY_FAILED NTStatus = 0xC0210028 + STATUS_FVE_VIRTUALIZED_SPACE_TOO_BIG NTStatus = 0xC0210029 + STATUS_FVE_INVALID_DATUM_TYPE NTStatus = 0xC021002A + STATUS_FVE_VOLUME_TOO_SMALL NTStatus = 0xC0210030 + STATUS_FVE_ENH_PIN_INVALID NTStatus = 0xC0210031 + STATUS_FVE_FULL_ENCRYPTION_NOT_ALLOWED_ON_TP_STORAGE NTStatus = 0xC0210032 + STATUS_FVE_WIPE_NOT_ALLOWED_ON_TP_STORAGE NTStatus = 0xC0210033 + STATUS_FVE_NOT_ALLOWED_ON_CSV_STACK NTStatus = 0xC0210034 + STATUS_FVE_NOT_ALLOWED_ON_CLUSTER NTStatus = 0xC0210035 + STATUS_FVE_NOT_ALLOWED_TO_UPGRADE_WHILE_CONVERTING NTStatus = 0xC0210036 + STATUS_FVE_WIPE_CANCEL_NOT_APPLICABLE NTStatus = 0xC0210037 + STATUS_FVE_EDRIVE_DRY_RUN_FAILED NTStatus = 0xC0210038 + STATUS_FVE_SECUREBOOT_DISABLED NTStatus = 0xC0210039 + STATUS_FVE_SECUREBOOT_CONFIG_CHANGE NTStatus = 0xC021003A + STATUS_FVE_DEVICE_LOCKEDOUT NTStatus = 0xC021003B + STATUS_FVE_VOLUME_EXTEND_PREVENTS_EOW_DECRYPT NTStatus = 0xC021003C + STATUS_FVE_NOT_DE_VOLUME NTStatus = 0xC021003D + STATUS_FVE_PROTECTION_DISABLED NTStatus = 0xC021003E + STATUS_FVE_PROTECTION_CANNOT_BE_DISABLED NTStatus = 0xC021003F + STATUS_FVE_OSV_KSR_NOT_ALLOWED NTStatus = 0xC0210040 + STATUS_FWP_CALLOUT_NOT_FOUND NTStatus = 0xC0220001 + STATUS_FWP_CONDITION_NOT_FOUND NTStatus = 0xC0220002 + STATUS_FWP_FILTER_NOT_FOUND NTStatus = 0xC0220003 + STATUS_FWP_LAYER_NOT_FOUND NTStatus = 0xC0220004 + STATUS_FWP_PROVIDER_NOT_FOUND NTStatus = 0xC0220005 + STATUS_FWP_PROVIDER_CONTEXT_NOT_FOUND NTStatus = 0xC0220006 + STATUS_FWP_SUBLAYER_NOT_FOUND NTStatus = 0xC0220007 + STATUS_FWP_NOT_FOUND NTStatus = 0xC0220008 + STATUS_FWP_ALREADY_EXISTS NTStatus = 0xC0220009 + STATUS_FWP_IN_USE NTStatus = 0xC022000A + STATUS_FWP_DYNAMIC_SESSION_IN_PROGRESS NTStatus = 0xC022000B + STATUS_FWP_WRONG_SESSION NTStatus = 0xC022000C + STATUS_FWP_NO_TXN_IN_PROGRESS NTStatus = 0xC022000D + STATUS_FWP_TXN_IN_PROGRESS NTStatus = 0xC022000E + STATUS_FWP_TXN_ABORTED NTStatus = 0xC022000F + STATUS_FWP_SESSION_ABORTED NTStatus = 0xC0220010 + STATUS_FWP_INCOMPATIBLE_TXN NTStatus = 0xC0220011 + STATUS_FWP_TIMEOUT NTStatus = 0xC0220012 + STATUS_FWP_NET_EVENTS_DISABLED NTStatus = 0xC0220013 + STATUS_FWP_INCOMPATIBLE_LAYER NTStatus = 0xC0220014 + STATUS_FWP_KM_CLIENTS_ONLY NTStatus = 0xC0220015 + STATUS_FWP_LIFETIME_MISMATCH NTStatus = 0xC0220016 + STATUS_FWP_BUILTIN_OBJECT NTStatus = 0xC0220017 + STATUS_FWP_TOO_MANY_CALLOUTS NTStatus = 0xC0220018 + STATUS_FWP_NOTIFICATION_DROPPED NTStatus = 0xC0220019 + STATUS_FWP_TRAFFIC_MISMATCH NTStatus = 0xC022001A + STATUS_FWP_INCOMPATIBLE_SA_STATE NTStatus = 0xC022001B + STATUS_FWP_NULL_POINTER NTStatus = 0xC022001C + STATUS_FWP_INVALID_ENUMERATOR NTStatus = 0xC022001D + STATUS_FWP_INVALID_FLAGS NTStatus = 0xC022001E + STATUS_FWP_INVALID_NET_MASK NTStatus = 0xC022001F + STATUS_FWP_INVALID_RANGE NTStatus = 0xC0220020 + STATUS_FWP_INVALID_INTERVAL NTStatus = 0xC0220021 + STATUS_FWP_ZERO_LENGTH_ARRAY NTStatus = 0xC0220022 + STATUS_FWP_NULL_DISPLAY_NAME NTStatus = 0xC0220023 + STATUS_FWP_INVALID_ACTION_TYPE NTStatus = 0xC0220024 + STATUS_FWP_INVALID_WEIGHT NTStatus = 0xC0220025 + STATUS_FWP_MATCH_TYPE_MISMATCH NTStatus = 0xC0220026 + STATUS_FWP_TYPE_MISMATCH NTStatus = 0xC0220027 + STATUS_FWP_OUT_OF_BOUNDS NTStatus = 0xC0220028 + STATUS_FWP_RESERVED NTStatus = 0xC0220029 + STATUS_FWP_DUPLICATE_CONDITION NTStatus = 0xC022002A + STATUS_FWP_DUPLICATE_KEYMOD NTStatus = 0xC022002B + STATUS_FWP_ACTION_INCOMPATIBLE_WITH_LAYER NTStatus = 0xC022002C + STATUS_FWP_ACTION_INCOMPATIBLE_WITH_SUBLAYER NTStatus = 0xC022002D + STATUS_FWP_CONTEXT_INCOMPATIBLE_WITH_LAYER NTStatus = 0xC022002E + STATUS_FWP_CONTEXT_INCOMPATIBLE_WITH_CALLOUT NTStatus = 0xC022002F + STATUS_FWP_INCOMPATIBLE_AUTH_METHOD NTStatus = 0xC0220030 + STATUS_FWP_INCOMPATIBLE_DH_GROUP NTStatus = 0xC0220031 + STATUS_FWP_EM_NOT_SUPPORTED NTStatus = 0xC0220032 + STATUS_FWP_NEVER_MATCH NTStatus = 0xC0220033 + STATUS_FWP_PROVIDER_CONTEXT_MISMATCH NTStatus = 0xC0220034 + STATUS_FWP_INVALID_PARAMETER NTStatus = 0xC0220035 + STATUS_FWP_TOO_MANY_SUBLAYERS NTStatus = 0xC0220036 + STATUS_FWP_CALLOUT_NOTIFICATION_FAILED NTStatus = 0xC0220037 + STATUS_FWP_INVALID_AUTH_TRANSFORM NTStatus = 0xC0220038 + STATUS_FWP_INVALID_CIPHER_TRANSFORM NTStatus = 0xC0220039 + STATUS_FWP_INCOMPATIBLE_CIPHER_TRANSFORM NTStatus = 0xC022003A + STATUS_FWP_INVALID_TRANSFORM_COMBINATION NTStatus = 0xC022003B + STATUS_FWP_DUPLICATE_AUTH_METHOD NTStatus = 0xC022003C + STATUS_FWP_INVALID_TUNNEL_ENDPOINT NTStatus = 0xC022003D + STATUS_FWP_L2_DRIVER_NOT_READY NTStatus = 0xC022003E + STATUS_FWP_KEY_DICTATOR_ALREADY_REGISTERED NTStatus = 0xC022003F + STATUS_FWP_KEY_DICTATION_INVALID_KEYING_MATERIAL NTStatus = 0xC0220040 + STATUS_FWP_CONNECTIONS_DISABLED NTStatus = 0xC0220041 + STATUS_FWP_INVALID_DNS_NAME NTStatus = 0xC0220042 + STATUS_FWP_STILL_ON NTStatus = 0xC0220043 + STATUS_FWP_IKEEXT_NOT_RUNNING NTStatus = 0xC0220044 + STATUS_FWP_TCPIP_NOT_READY NTStatus = 0xC0220100 + STATUS_FWP_INJECT_HANDLE_CLOSING NTStatus = 0xC0220101 + STATUS_FWP_INJECT_HANDLE_STALE NTStatus = 0xC0220102 + STATUS_FWP_CANNOT_PEND NTStatus = 0xC0220103 + STATUS_FWP_DROP_NOICMP NTStatus = 0xC0220104 + STATUS_NDIS_CLOSING NTStatus = 0xC0230002 + STATUS_NDIS_BAD_VERSION NTStatus = 0xC0230004 + STATUS_NDIS_BAD_CHARACTERISTICS NTStatus = 0xC0230005 + STATUS_NDIS_ADAPTER_NOT_FOUND NTStatus = 0xC0230006 + STATUS_NDIS_OPEN_FAILED NTStatus = 0xC0230007 + STATUS_NDIS_DEVICE_FAILED NTStatus = 0xC0230008 + STATUS_NDIS_MULTICAST_FULL NTStatus = 0xC0230009 + STATUS_NDIS_MULTICAST_EXISTS NTStatus = 0xC023000A + STATUS_NDIS_MULTICAST_NOT_FOUND NTStatus = 0xC023000B + STATUS_NDIS_REQUEST_ABORTED NTStatus = 0xC023000C + STATUS_NDIS_RESET_IN_PROGRESS NTStatus = 0xC023000D + STATUS_NDIS_NOT_SUPPORTED NTStatus = 0xC02300BB + STATUS_NDIS_INVALID_PACKET NTStatus = 0xC023000F + STATUS_NDIS_ADAPTER_NOT_READY NTStatus = 0xC0230011 + STATUS_NDIS_INVALID_LENGTH NTStatus = 0xC0230014 + STATUS_NDIS_INVALID_DATA NTStatus = 0xC0230015 + STATUS_NDIS_BUFFER_TOO_SHORT NTStatus = 0xC0230016 + STATUS_NDIS_INVALID_OID NTStatus = 0xC0230017 + STATUS_NDIS_ADAPTER_REMOVED NTStatus = 0xC0230018 + STATUS_NDIS_UNSUPPORTED_MEDIA NTStatus = 0xC0230019 + STATUS_NDIS_GROUP_ADDRESS_IN_USE NTStatus = 0xC023001A + STATUS_NDIS_FILE_NOT_FOUND NTStatus = 0xC023001B + STATUS_NDIS_ERROR_READING_FILE NTStatus = 0xC023001C + STATUS_NDIS_ALREADY_MAPPED NTStatus = 0xC023001D + STATUS_NDIS_RESOURCE_CONFLICT NTStatus = 0xC023001E + STATUS_NDIS_MEDIA_DISCONNECTED NTStatus = 0xC023001F + STATUS_NDIS_INVALID_ADDRESS NTStatus = 0xC0230022 + STATUS_NDIS_INVALID_DEVICE_REQUEST NTStatus = 0xC0230010 + STATUS_NDIS_PAUSED NTStatus = 0xC023002A + STATUS_NDIS_INTERFACE_NOT_FOUND NTStatus = 0xC023002B + STATUS_NDIS_UNSUPPORTED_REVISION NTStatus = 0xC023002C + STATUS_NDIS_INVALID_PORT NTStatus = 0xC023002D + STATUS_NDIS_INVALID_PORT_STATE NTStatus = 0xC023002E + STATUS_NDIS_LOW_POWER_STATE NTStatus = 0xC023002F + STATUS_NDIS_REINIT_REQUIRED NTStatus = 0xC0230030 + STATUS_NDIS_NO_QUEUES NTStatus = 0xC0230031 + STATUS_NDIS_DOT11_AUTO_CONFIG_ENABLED NTStatus = 0xC0232000 + STATUS_NDIS_DOT11_MEDIA_IN_USE NTStatus = 0xC0232001 + STATUS_NDIS_DOT11_POWER_STATE_INVALID NTStatus = 0xC0232002 + STATUS_NDIS_PM_WOL_PATTERN_LIST_FULL NTStatus = 0xC0232003 + STATUS_NDIS_PM_PROTOCOL_OFFLOAD_LIST_FULL NTStatus = 0xC0232004 + STATUS_NDIS_DOT11_AP_CHANNEL_CURRENTLY_NOT_AVAILABLE NTStatus = 0xC0232005 + STATUS_NDIS_DOT11_AP_BAND_CURRENTLY_NOT_AVAILABLE NTStatus = 0xC0232006 + STATUS_NDIS_DOT11_AP_CHANNEL_NOT_ALLOWED NTStatus = 0xC0232007 + STATUS_NDIS_DOT11_AP_BAND_NOT_ALLOWED NTStatus = 0xC0232008 + STATUS_NDIS_INDICATION_REQUIRED NTStatus = 0x40230001 + STATUS_NDIS_OFFLOAD_POLICY NTStatus = 0xC023100F + STATUS_NDIS_OFFLOAD_CONNECTION_REJECTED NTStatus = 0xC0231012 + STATUS_NDIS_OFFLOAD_PATH_REJECTED NTStatus = 0xC0231013 + STATUS_TPM_ERROR_MASK NTStatus = 0xC0290000 + STATUS_TPM_AUTHFAIL NTStatus = 0xC0290001 + STATUS_TPM_BADINDEX NTStatus = 0xC0290002 + STATUS_TPM_BAD_PARAMETER NTStatus = 0xC0290003 + STATUS_TPM_AUDITFAILURE NTStatus = 0xC0290004 + STATUS_TPM_CLEAR_DISABLED NTStatus = 0xC0290005 + STATUS_TPM_DEACTIVATED NTStatus = 0xC0290006 + STATUS_TPM_DISABLED NTStatus = 0xC0290007 + STATUS_TPM_DISABLED_CMD NTStatus = 0xC0290008 + STATUS_TPM_FAIL NTStatus = 0xC0290009 + STATUS_TPM_BAD_ORDINAL NTStatus = 0xC029000A + STATUS_TPM_INSTALL_DISABLED NTStatus = 0xC029000B + STATUS_TPM_INVALID_KEYHANDLE NTStatus = 0xC029000C + STATUS_TPM_KEYNOTFOUND NTStatus = 0xC029000D + STATUS_TPM_INAPPROPRIATE_ENC NTStatus = 0xC029000E + STATUS_TPM_MIGRATEFAIL NTStatus = 0xC029000F + STATUS_TPM_INVALID_PCR_INFO NTStatus = 0xC0290010 + STATUS_TPM_NOSPACE NTStatus = 0xC0290011 + STATUS_TPM_NOSRK NTStatus = 0xC0290012 + STATUS_TPM_NOTSEALED_BLOB NTStatus = 0xC0290013 + STATUS_TPM_OWNER_SET NTStatus = 0xC0290014 + STATUS_TPM_RESOURCES NTStatus = 0xC0290015 + STATUS_TPM_SHORTRANDOM NTStatus = 0xC0290016 + STATUS_TPM_SIZE NTStatus = 0xC0290017 + STATUS_TPM_WRONGPCRVAL NTStatus = 0xC0290018 + STATUS_TPM_BAD_PARAM_SIZE NTStatus = 0xC0290019 + STATUS_TPM_SHA_THREAD NTStatus = 0xC029001A + STATUS_TPM_SHA_ERROR NTStatus = 0xC029001B + STATUS_TPM_FAILEDSELFTEST NTStatus = 0xC029001C + STATUS_TPM_AUTH2FAIL NTStatus = 0xC029001D + STATUS_TPM_BADTAG NTStatus = 0xC029001E + STATUS_TPM_IOERROR NTStatus = 0xC029001F + STATUS_TPM_ENCRYPT_ERROR NTStatus = 0xC0290020 + STATUS_TPM_DECRYPT_ERROR NTStatus = 0xC0290021 + STATUS_TPM_INVALID_AUTHHANDLE NTStatus = 0xC0290022 + STATUS_TPM_NO_ENDORSEMENT NTStatus = 0xC0290023 + STATUS_TPM_INVALID_KEYUSAGE NTStatus = 0xC0290024 + STATUS_TPM_WRONG_ENTITYTYPE NTStatus = 0xC0290025 + STATUS_TPM_INVALID_POSTINIT NTStatus = 0xC0290026 + STATUS_TPM_INAPPROPRIATE_SIG NTStatus = 0xC0290027 + STATUS_TPM_BAD_KEY_PROPERTY NTStatus = 0xC0290028 + STATUS_TPM_BAD_MIGRATION NTStatus = 0xC0290029 + STATUS_TPM_BAD_SCHEME NTStatus = 0xC029002A + STATUS_TPM_BAD_DATASIZE NTStatus = 0xC029002B + STATUS_TPM_BAD_MODE NTStatus = 0xC029002C + STATUS_TPM_BAD_PRESENCE NTStatus = 0xC029002D + STATUS_TPM_BAD_VERSION NTStatus = 0xC029002E + STATUS_TPM_NO_WRAP_TRANSPORT NTStatus = 0xC029002F + STATUS_TPM_AUDITFAIL_UNSUCCESSFUL NTStatus = 0xC0290030 + STATUS_TPM_AUDITFAIL_SUCCESSFUL NTStatus = 0xC0290031 + STATUS_TPM_NOTRESETABLE NTStatus = 0xC0290032 + STATUS_TPM_NOTLOCAL NTStatus = 0xC0290033 + STATUS_TPM_BAD_TYPE NTStatus = 0xC0290034 + STATUS_TPM_INVALID_RESOURCE NTStatus = 0xC0290035 + STATUS_TPM_NOTFIPS NTStatus = 0xC0290036 + STATUS_TPM_INVALID_FAMILY NTStatus = 0xC0290037 + STATUS_TPM_NO_NV_PERMISSION NTStatus = 0xC0290038 + STATUS_TPM_REQUIRES_SIGN NTStatus = 0xC0290039 + STATUS_TPM_KEY_NOTSUPPORTED NTStatus = 0xC029003A + STATUS_TPM_AUTH_CONFLICT NTStatus = 0xC029003B + STATUS_TPM_AREA_LOCKED NTStatus = 0xC029003C + STATUS_TPM_BAD_LOCALITY NTStatus = 0xC029003D + STATUS_TPM_READ_ONLY NTStatus = 0xC029003E + STATUS_TPM_PER_NOWRITE NTStatus = 0xC029003F + STATUS_TPM_FAMILYCOUNT NTStatus = 0xC0290040 + STATUS_TPM_WRITE_LOCKED NTStatus = 0xC0290041 + STATUS_TPM_BAD_ATTRIBUTES NTStatus = 0xC0290042 + STATUS_TPM_INVALID_STRUCTURE NTStatus = 0xC0290043 + STATUS_TPM_KEY_OWNER_CONTROL NTStatus = 0xC0290044 + STATUS_TPM_BAD_COUNTER NTStatus = 0xC0290045 + STATUS_TPM_NOT_FULLWRITE NTStatus = 0xC0290046 + STATUS_TPM_CONTEXT_GAP NTStatus = 0xC0290047 + STATUS_TPM_MAXNVWRITES NTStatus = 0xC0290048 + STATUS_TPM_NOOPERATOR NTStatus = 0xC0290049 + STATUS_TPM_RESOURCEMISSING NTStatus = 0xC029004A + STATUS_TPM_DELEGATE_LOCK NTStatus = 0xC029004B + STATUS_TPM_DELEGATE_FAMILY NTStatus = 0xC029004C + STATUS_TPM_DELEGATE_ADMIN NTStatus = 0xC029004D + STATUS_TPM_TRANSPORT_NOTEXCLUSIVE NTStatus = 0xC029004E + STATUS_TPM_OWNER_CONTROL NTStatus = 0xC029004F + STATUS_TPM_DAA_RESOURCES NTStatus = 0xC0290050 + STATUS_TPM_DAA_INPUT_DATA0 NTStatus = 0xC0290051 + STATUS_TPM_DAA_INPUT_DATA1 NTStatus = 0xC0290052 + STATUS_TPM_DAA_ISSUER_SETTINGS NTStatus = 0xC0290053 + STATUS_TPM_DAA_TPM_SETTINGS NTStatus = 0xC0290054 + STATUS_TPM_DAA_STAGE NTStatus = 0xC0290055 + STATUS_TPM_DAA_ISSUER_VALIDITY NTStatus = 0xC0290056 + STATUS_TPM_DAA_WRONG_W NTStatus = 0xC0290057 + STATUS_TPM_BAD_HANDLE NTStatus = 0xC0290058 + STATUS_TPM_BAD_DELEGATE NTStatus = 0xC0290059 + STATUS_TPM_BADCONTEXT NTStatus = 0xC029005A + STATUS_TPM_TOOMANYCONTEXTS NTStatus = 0xC029005B + STATUS_TPM_MA_TICKET_SIGNATURE NTStatus = 0xC029005C + STATUS_TPM_MA_DESTINATION NTStatus = 0xC029005D + STATUS_TPM_MA_SOURCE NTStatus = 0xC029005E + STATUS_TPM_MA_AUTHORITY NTStatus = 0xC029005F + STATUS_TPM_PERMANENTEK NTStatus = 0xC0290061 + STATUS_TPM_BAD_SIGNATURE NTStatus = 0xC0290062 + STATUS_TPM_NOCONTEXTSPACE NTStatus = 0xC0290063 + STATUS_TPM_20_E_ASYMMETRIC NTStatus = 0xC0290081 + STATUS_TPM_20_E_ATTRIBUTES NTStatus = 0xC0290082 + STATUS_TPM_20_E_HASH NTStatus = 0xC0290083 + STATUS_TPM_20_E_VALUE NTStatus = 0xC0290084 + STATUS_TPM_20_E_HIERARCHY NTStatus = 0xC0290085 + STATUS_TPM_20_E_KEY_SIZE NTStatus = 0xC0290087 + STATUS_TPM_20_E_MGF NTStatus = 0xC0290088 + STATUS_TPM_20_E_MODE NTStatus = 0xC0290089 + STATUS_TPM_20_E_TYPE NTStatus = 0xC029008A + STATUS_TPM_20_E_HANDLE NTStatus = 0xC029008B + STATUS_TPM_20_E_KDF NTStatus = 0xC029008C + STATUS_TPM_20_E_RANGE NTStatus = 0xC029008D + STATUS_TPM_20_E_AUTH_FAIL NTStatus = 0xC029008E + STATUS_TPM_20_E_NONCE NTStatus = 0xC029008F + STATUS_TPM_20_E_PP NTStatus = 0xC0290090 + STATUS_TPM_20_E_SCHEME NTStatus = 0xC0290092 + STATUS_TPM_20_E_SIZE NTStatus = 0xC0290095 + STATUS_TPM_20_E_SYMMETRIC NTStatus = 0xC0290096 + STATUS_TPM_20_E_TAG NTStatus = 0xC0290097 + STATUS_TPM_20_E_SELECTOR NTStatus = 0xC0290098 + STATUS_TPM_20_E_INSUFFICIENT NTStatus = 0xC029009A + STATUS_TPM_20_E_SIGNATURE NTStatus = 0xC029009B + STATUS_TPM_20_E_KEY NTStatus = 0xC029009C + STATUS_TPM_20_E_POLICY_FAIL NTStatus = 0xC029009D + STATUS_TPM_20_E_INTEGRITY NTStatus = 0xC029009F + STATUS_TPM_20_E_TICKET NTStatus = 0xC02900A0 + STATUS_TPM_20_E_RESERVED_BITS NTStatus = 0xC02900A1 + STATUS_TPM_20_E_BAD_AUTH NTStatus = 0xC02900A2 + STATUS_TPM_20_E_EXPIRED NTStatus = 0xC02900A3 + STATUS_TPM_20_E_POLICY_CC NTStatus = 0xC02900A4 + STATUS_TPM_20_E_BINDING NTStatus = 0xC02900A5 + STATUS_TPM_20_E_CURVE NTStatus = 0xC02900A6 + STATUS_TPM_20_E_ECC_POINT NTStatus = 0xC02900A7 + STATUS_TPM_20_E_INITIALIZE NTStatus = 0xC0290100 + STATUS_TPM_20_E_FAILURE NTStatus = 0xC0290101 + STATUS_TPM_20_E_SEQUENCE NTStatus = 0xC0290103 + STATUS_TPM_20_E_PRIVATE NTStatus = 0xC029010B + STATUS_TPM_20_E_HMAC NTStatus = 0xC0290119 + STATUS_TPM_20_E_DISABLED NTStatus = 0xC0290120 + STATUS_TPM_20_E_EXCLUSIVE NTStatus = 0xC0290121 + STATUS_TPM_20_E_ECC_CURVE NTStatus = 0xC0290123 + STATUS_TPM_20_E_AUTH_TYPE NTStatus = 0xC0290124 + STATUS_TPM_20_E_AUTH_MISSING NTStatus = 0xC0290125 + STATUS_TPM_20_E_POLICY NTStatus = 0xC0290126 + STATUS_TPM_20_E_PCR NTStatus = 0xC0290127 + STATUS_TPM_20_E_PCR_CHANGED NTStatus = 0xC0290128 + STATUS_TPM_20_E_UPGRADE NTStatus = 0xC029012D + STATUS_TPM_20_E_TOO_MANY_CONTEXTS NTStatus = 0xC029012E + STATUS_TPM_20_E_AUTH_UNAVAILABLE NTStatus = 0xC029012F + STATUS_TPM_20_E_REBOOT NTStatus = 0xC0290130 + STATUS_TPM_20_E_UNBALANCED NTStatus = 0xC0290131 + STATUS_TPM_20_E_COMMAND_SIZE NTStatus = 0xC0290142 + STATUS_TPM_20_E_COMMAND_CODE NTStatus = 0xC0290143 + STATUS_TPM_20_E_AUTHSIZE NTStatus = 0xC0290144 + STATUS_TPM_20_E_AUTH_CONTEXT NTStatus = 0xC0290145 + STATUS_TPM_20_E_NV_RANGE NTStatus = 0xC0290146 + STATUS_TPM_20_E_NV_SIZE NTStatus = 0xC0290147 + STATUS_TPM_20_E_NV_LOCKED NTStatus = 0xC0290148 + STATUS_TPM_20_E_NV_AUTHORIZATION NTStatus = 0xC0290149 + STATUS_TPM_20_E_NV_UNINITIALIZED NTStatus = 0xC029014A + STATUS_TPM_20_E_NV_SPACE NTStatus = 0xC029014B + STATUS_TPM_20_E_NV_DEFINED NTStatus = 0xC029014C + STATUS_TPM_20_E_BAD_CONTEXT NTStatus = 0xC0290150 + STATUS_TPM_20_E_CPHASH NTStatus = 0xC0290151 + STATUS_TPM_20_E_PARENT NTStatus = 0xC0290152 + STATUS_TPM_20_E_NEEDS_TEST NTStatus = 0xC0290153 + STATUS_TPM_20_E_NO_RESULT NTStatus = 0xC0290154 + STATUS_TPM_20_E_SENSITIVE NTStatus = 0xC0290155 + STATUS_TPM_COMMAND_BLOCKED NTStatus = 0xC0290400 + STATUS_TPM_INVALID_HANDLE NTStatus = 0xC0290401 + STATUS_TPM_DUPLICATE_VHANDLE NTStatus = 0xC0290402 + STATUS_TPM_EMBEDDED_COMMAND_BLOCKED NTStatus = 0xC0290403 + STATUS_TPM_EMBEDDED_COMMAND_UNSUPPORTED NTStatus = 0xC0290404 + STATUS_TPM_RETRY NTStatus = 0xC0290800 + STATUS_TPM_NEEDS_SELFTEST NTStatus = 0xC0290801 + STATUS_TPM_DOING_SELFTEST NTStatus = 0xC0290802 + STATUS_TPM_DEFEND_LOCK_RUNNING NTStatus = 0xC0290803 + STATUS_TPM_COMMAND_CANCELED NTStatus = 0xC0291001 + STATUS_TPM_TOO_MANY_CONTEXTS NTStatus = 0xC0291002 + STATUS_TPM_NOT_FOUND NTStatus = 0xC0291003 + STATUS_TPM_ACCESS_DENIED NTStatus = 0xC0291004 + STATUS_TPM_INSUFFICIENT_BUFFER NTStatus = 0xC0291005 + STATUS_TPM_PPI_FUNCTION_UNSUPPORTED NTStatus = 0xC0291006 + STATUS_PCP_ERROR_MASK NTStatus = 0xC0292000 + STATUS_PCP_DEVICE_NOT_READY NTStatus = 0xC0292001 + STATUS_PCP_INVALID_HANDLE NTStatus = 0xC0292002 + STATUS_PCP_INVALID_PARAMETER NTStatus = 0xC0292003 + STATUS_PCP_FLAG_NOT_SUPPORTED NTStatus = 0xC0292004 + STATUS_PCP_NOT_SUPPORTED NTStatus = 0xC0292005 + STATUS_PCP_BUFFER_TOO_SMALL NTStatus = 0xC0292006 + STATUS_PCP_INTERNAL_ERROR NTStatus = 0xC0292007 + STATUS_PCP_AUTHENTICATION_FAILED NTStatus = 0xC0292008 + STATUS_PCP_AUTHENTICATION_IGNORED NTStatus = 0xC0292009 + STATUS_PCP_POLICY_NOT_FOUND NTStatus = 0xC029200A + STATUS_PCP_PROFILE_NOT_FOUND NTStatus = 0xC029200B + STATUS_PCP_VALIDATION_FAILED NTStatus = 0xC029200C + STATUS_PCP_DEVICE_NOT_FOUND NTStatus = 0xC029200D + STATUS_PCP_WRONG_PARENT NTStatus = 0xC029200E + STATUS_PCP_KEY_NOT_LOADED NTStatus = 0xC029200F + STATUS_PCP_NO_KEY_CERTIFICATION NTStatus = 0xC0292010 + STATUS_PCP_KEY_NOT_FINALIZED NTStatus = 0xC0292011 + STATUS_PCP_ATTESTATION_CHALLENGE_NOT_SET NTStatus = 0xC0292012 + STATUS_PCP_NOT_PCR_BOUND NTStatus = 0xC0292013 + STATUS_PCP_KEY_ALREADY_FINALIZED NTStatus = 0xC0292014 + STATUS_PCP_KEY_USAGE_POLICY_NOT_SUPPORTED NTStatus = 0xC0292015 + STATUS_PCP_KEY_USAGE_POLICY_INVALID NTStatus = 0xC0292016 + STATUS_PCP_SOFT_KEY_ERROR NTStatus = 0xC0292017 + STATUS_PCP_KEY_NOT_AUTHENTICATED NTStatus = 0xC0292018 + STATUS_PCP_KEY_NOT_AIK NTStatus = 0xC0292019 + STATUS_PCP_KEY_NOT_SIGNING_KEY NTStatus = 0xC029201A + STATUS_PCP_LOCKED_OUT NTStatus = 0xC029201B + STATUS_PCP_CLAIM_TYPE_NOT_SUPPORTED NTStatus = 0xC029201C + STATUS_PCP_TPM_VERSION_NOT_SUPPORTED NTStatus = 0xC029201D + STATUS_PCP_BUFFER_LENGTH_MISMATCH NTStatus = 0xC029201E + STATUS_PCP_IFX_RSA_KEY_CREATION_BLOCKED NTStatus = 0xC029201F + STATUS_PCP_TICKET_MISSING NTStatus = 0xC0292020 + STATUS_PCP_RAW_POLICY_NOT_SUPPORTED NTStatus = 0xC0292021 + STATUS_PCP_KEY_HANDLE_INVALIDATED NTStatus = 0xC0292022 + STATUS_PCP_UNSUPPORTED_PSS_SALT NTStatus = 0x40292023 + STATUS_RTPM_CONTEXT_CONTINUE NTStatus = 0x00293000 + STATUS_RTPM_CONTEXT_COMPLETE NTStatus = 0x00293001 + STATUS_RTPM_NO_RESULT NTStatus = 0xC0293002 + STATUS_RTPM_PCR_READ_INCOMPLETE NTStatus = 0xC0293003 + STATUS_RTPM_INVALID_CONTEXT NTStatus = 0xC0293004 + STATUS_RTPM_UNSUPPORTED_CMD NTStatus = 0xC0293005 + STATUS_TPM_ZERO_EXHAUST_ENABLED NTStatus = 0xC0294000 + STATUS_HV_INVALID_HYPERCALL_CODE NTStatus = 0xC0350002 + STATUS_HV_INVALID_HYPERCALL_INPUT NTStatus = 0xC0350003 + STATUS_HV_INVALID_ALIGNMENT NTStatus = 0xC0350004 + STATUS_HV_INVALID_PARAMETER NTStatus = 0xC0350005 + STATUS_HV_ACCESS_DENIED NTStatus = 0xC0350006 + STATUS_HV_INVALID_PARTITION_STATE NTStatus = 0xC0350007 + STATUS_HV_OPERATION_DENIED NTStatus = 0xC0350008 + STATUS_HV_UNKNOWN_PROPERTY NTStatus = 0xC0350009 + STATUS_HV_PROPERTY_VALUE_OUT_OF_RANGE NTStatus = 0xC035000A + STATUS_HV_INSUFFICIENT_MEMORY NTStatus = 0xC035000B + STATUS_HV_PARTITION_TOO_DEEP NTStatus = 0xC035000C + STATUS_HV_INVALID_PARTITION_ID NTStatus = 0xC035000D + STATUS_HV_INVALID_VP_INDEX NTStatus = 0xC035000E + STATUS_HV_INVALID_PORT_ID NTStatus = 0xC0350011 + STATUS_HV_INVALID_CONNECTION_ID NTStatus = 0xC0350012 + STATUS_HV_INSUFFICIENT_BUFFERS NTStatus = 0xC0350013 + STATUS_HV_NOT_ACKNOWLEDGED NTStatus = 0xC0350014 + STATUS_HV_INVALID_VP_STATE NTStatus = 0xC0350015 + STATUS_HV_ACKNOWLEDGED NTStatus = 0xC0350016 + STATUS_HV_INVALID_SAVE_RESTORE_STATE NTStatus = 0xC0350017 + STATUS_HV_INVALID_SYNIC_STATE NTStatus = 0xC0350018 + STATUS_HV_OBJECT_IN_USE NTStatus = 0xC0350019 + STATUS_HV_INVALID_PROXIMITY_DOMAIN_INFO NTStatus = 0xC035001A + STATUS_HV_NO_DATA NTStatus = 0xC035001B + STATUS_HV_INACTIVE NTStatus = 0xC035001C + STATUS_HV_NO_RESOURCES NTStatus = 0xC035001D + STATUS_HV_FEATURE_UNAVAILABLE NTStatus = 0xC035001E + STATUS_HV_INSUFFICIENT_BUFFER NTStatus = 0xC0350033 + STATUS_HV_INSUFFICIENT_DEVICE_DOMAINS NTStatus = 0xC0350038 + STATUS_HV_CPUID_FEATURE_VALIDATION_ERROR NTStatus = 0xC035003C + STATUS_HV_CPUID_XSAVE_FEATURE_VALIDATION_ERROR NTStatus = 0xC035003D + STATUS_HV_PROCESSOR_STARTUP_TIMEOUT NTStatus = 0xC035003E + STATUS_HV_SMX_ENABLED NTStatus = 0xC035003F + STATUS_HV_INVALID_LP_INDEX NTStatus = 0xC0350041 + STATUS_HV_INVALID_REGISTER_VALUE NTStatus = 0xC0350050 + STATUS_HV_INVALID_VTL_STATE NTStatus = 0xC0350051 + STATUS_HV_NX_NOT_DETECTED NTStatus = 0xC0350055 + STATUS_HV_INVALID_DEVICE_ID NTStatus = 0xC0350057 + STATUS_HV_INVALID_DEVICE_STATE NTStatus = 0xC0350058 + STATUS_HV_PENDING_PAGE_REQUESTS NTStatus = 0x00350059 + STATUS_HV_PAGE_REQUEST_INVALID NTStatus = 0xC0350060 + STATUS_HV_INVALID_CPU_GROUP_ID NTStatus = 0xC035006F + STATUS_HV_INVALID_CPU_GROUP_STATE NTStatus = 0xC0350070 + STATUS_HV_OPERATION_FAILED NTStatus = 0xC0350071 + STATUS_HV_NOT_ALLOWED_WITH_NESTED_VIRT_ACTIVE NTStatus = 0xC0350072 + STATUS_HV_INSUFFICIENT_ROOT_MEMORY NTStatus = 0xC0350073 + STATUS_HV_NOT_PRESENT NTStatus = 0xC0351000 + STATUS_VID_DUPLICATE_HANDLER NTStatus = 0xC0370001 + STATUS_VID_TOO_MANY_HANDLERS NTStatus = 0xC0370002 + STATUS_VID_QUEUE_FULL NTStatus = 0xC0370003 + STATUS_VID_HANDLER_NOT_PRESENT NTStatus = 0xC0370004 + STATUS_VID_INVALID_OBJECT_NAME NTStatus = 0xC0370005 + STATUS_VID_PARTITION_NAME_TOO_LONG NTStatus = 0xC0370006 + STATUS_VID_MESSAGE_QUEUE_NAME_TOO_LONG NTStatus = 0xC0370007 + STATUS_VID_PARTITION_ALREADY_EXISTS NTStatus = 0xC0370008 + STATUS_VID_PARTITION_DOES_NOT_EXIST NTStatus = 0xC0370009 + STATUS_VID_PARTITION_NAME_NOT_FOUND NTStatus = 0xC037000A + STATUS_VID_MESSAGE_QUEUE_ALREADY_EXISTS NTStatus = 0xC037000B + STATUS_VID_EXCEEDED_MBP_ENTRY_MAP_LIMIT NTStatus = 0xC037000C + STATUS_VID_MB_STILL_REFERENCED NTStatus = 0xC037000D + STATUS_VID_CHILD_GPA_PAGE_SET_CORRUPTED NTStatus = 0xC037000E + STATUS_VID_INVALID_NUMA_SETTINGS NTStatus = 0xC037000F + STATUS_VID_INVALID_NUMA_NODE_INDEX NTStatus = 0xC0370010 + STATUS_VID_NOTIFICATION_QUEUE_ALREADY_ASSOCIATED NTStatus = 0xC0370011 + STATUS_VID_INVALID_MEMORY_BLOCK_HANDLE NTStatus = 0xC0370012 + STATUS_VID_PAGE_RANGE_OVERFLOW NTStatus = 0xC0370013 + STATUS_VID_INVALID_MESSAGE_QUEUE_HANDLE NTStatus = 0xC0370014 + STATUS_VID_INVALID_GPA_RANGE_HANDLE NTStatus = 0xC0370015 + STATUS_VID_NO_MEMORY_BLOCK_NOTIFICATION_QUEUE NTStatus = 0xC0370016 + STATUS_VID_MEMORY_BLOCK_LOCK_COUNT_EXCEEDED NTStatus = 0xC0370017 + STATUS_VID_INVALID_PPM_HANDLE NTStatus = 0xC0370018 + STATUS_VID_MBPS_ARE_LOCKED NTStatus = 0xC0370019 + STATUS_VID_MESSAGE_QUEUE_CLOSED NTStatus = 0xC037001A + STATUS_VID_VIRTUAL_PROCESSOR_LIMIT_EXCEEDED NTStatus = 0xC037001B + STATUS_VID_STOP_PENDING NTStatus = 0xC037001C + STATUS_VID_INVALID_PROCESSOR_STATE NTStatus = 0xC037001D + STATUS_VID_EXCEEDED_KM_CONTEXT_COUNT_LIMIT NTStatus = 0xC037001E + STATUS_VID_KM_INTERFACE_ALREADY_INITIALIZED NTStatus = 0xC037001F + STATUS_VID_MB_PROPERTY_ALREADY_SET_RESET NTStatus = 0xC0370020 + STATUS_VID_MMIO_RANGE_DESTROYED NTStatus = 0xC0370021 + STATUS_VID_INVALID_CHILD_GPA_PAGE_SET NTStatus = 0xC0370022 + STATUS_VID_RESERVE_PAGE_SET_IS_BEING_USED NTStatus = 0xC0370023 + STATUS_VID_RESERVE_PAGE_SET_TOO_SMALL NTStatus = 0xC0370024 + STATUS_VID_MBP_ALREADY_LOCKED_USING_RESERVED_PAGE NTStatus = 0xC0370025 + STATUS_VID_MBP_COUNT_EXCEEDED_LIMIT NTStatus = 0xC0370026 + STATUS_VID_SAVED_STATE_CORRUPT NTStatus = 0xC0370027 + STATUS_VID_SAVED_STATE_UNRECOGNIZED_ITEM NTStatus = 0xC0370028 + STATUS_VID_SAVED_STATE_INCOMPATIBLE NTStatus = 0xC0370029 + STATUS_VID_VTL_ACCESS_DENIED NTStatus = 0xC037002A + STATUS_VID_REMOTE_NODE_PARENT_GPA_PAGES_USED NTStatus = 0x80370001 + STATUS_IPSEC_BAD_SPI NTStatus = 0xC0360001 + STATUS_IPSEC_SA_LIFETIME_EXPIRED NTStatus = 0xC0360002 + STATUS_IPSEC_WRONG_SA NTStatus = 0xC0360003 + STATUS_IPSEC_REPLAY_CHECK_FAILED NTStatus = 0xC0360004 + STATUS_IPSEC_INVALID_PACKET NTStatus = 0xC0360005 + STATUS_IPSEC_INTEGRITY_CHECK_FAILED NTStatus = 0xC0360006 + STATUS_IPSEC_CLEAR_TEXT_DROP NTStatus = 0xC0360007 + STATUS_IPSEC_AUTH_FIREWALL_DROP NTStatus = 0xC0360008 + STATUS_IPSEC_THROTTLE_DROP NTStatus = 0xC0360009 + STATUS_IPSEC_DOSP_BLOCK NTStatus = 0xC0368000 + STATUS_IPSEC_DOSP_RECEIVED_MULTICAST NTStatus = 0xC0368001 + STATUS_IPSEC_DOSP_INVALID_PACKET NTStatus = 0xC0368002 + STATUS_IPSEC_DOSP_STATE_LOOKUP_FAILED NTStatus = 0xC0368003 + STATUS_IPSEC_DOSP_MAX_ENTRIES NTStatus = 0xC0368004 + STATUS_IPSEC_DOSP_KEYMOD_NOT_ALLOWED NTStatus = 0xC0368005 + STATUS_IPSEC_DOSP_MAX_PER_IP_RATELIMIT_QUEUES NTStatus = 0xC0368006 + STATUS_VOLMGR_INCOMPLETE_REGENERATION NTStatus = 0x80380001 + STATUS_VOLMGR_INCOMPLETE_DISK_MIGRATION NTStatus = 0x80380002 + STATUS_VOLMGR_DATABASE_FULL NTStatus = 0xC0380001 + STATUS_VOLMGR_DISK_CONFIGURATION_CORRUPTED NTStatus = 0xC0380002 + STATUS_VOLMGR_DISK_CONFIGURATION_NOT_IN_SYNC NTStatus = 0xC0380003 + STATUS_VOLMGR_PACK_CONFIG_UPDATE_FAILED NTStatus = 0xC0380004 + STATUS_VOLMGR_DISK_CONTAINS_NON_SIMPLE_VOLUME NTStatus = 0xC0380005 + STATUS_VOLMGR_DISK_DUPLICATE NTStatus = 0xC0380006 + STATUS_VOLMGR_DISK_DYNAMIC NTStatus = 0xC0380007 + STATUS_VOLMGR_DISK_ID_INVALID NTStatus = 0xC0380008 + STATUS_VOLMGR_DISK_INVALID NTStatus = 0xC0380009 + STATUS_VOLMGR_DISK_LAST_VOTER NTStatus = 0xC038000A + STATUS_VOLMGR_DISK_LAYOUT_INVALID NTStatus = 0xC038000B + STATUS_VOLMGR_DISK_LAYOUT_NON_BASIC_BETWEEN_BASIC_PARTITIONS NTStatus = 0xC038000C + STATUS_VOLMGR_DISK_LAYOUT_NOT_CYLINDER_ALIGNED NTStatus = 0xC038000D + STATUS_VOLMGR_DISK_LAYOUT_PARTITIONS_TOO_SMALL NTStatus = 0xC038000E + STATUS_VOLMGR_DISK_LAYOUT_PRIMARY_BETWEEN_LOGICAL_PARTITIONS NTStatus = 0xC038000F + STATUS_VOLMGR_DISK_LAYOUT_TOO_MANY_PARTITIONS NTStatus = 0xC0380010 + STATUS_VOLMGR_DISK_MISSING NTStatus = 0xC0380011 + STATUS_VOLMGR_DISK_NOT_EMPTY NTStatus = 0xC0380012 + STATUS_VOLMGR_DISK_NOT_ENOUGH_SPACE NTStatus = 0xC0380013 + STATUS_VOLMGR_DISK_REVECTORING_FAILED NTStatus = 0xC0380014 + STATUS_VOLMGR_DISK_SECTOR_SIZE_INVALID NTStatus = 0xC0380015 + STATUS_VOLMGR_DISK_SET_NOT_CONTAINED NTStatus = 0xC0380016 + STATUS_VOLMGR_DISK_USED_BY_MULTIPLE_MEMBERS NTStatus = 0xC0380017 + STATUS_VOLMGR_DISK_USED_BY_MULTIPLE_PLEXES NTStatus = 0xC0380018 + STATUS_VOLMGR_DYNAMIC_DISK_NOT_SUPPORTED NTStatus = 0xC0380019 + STATUS_VOLMGR_EXTENT_ALREADY_USED NTStatus = 0xC038001A + STATUS_VOLMGR_EXTENT_NOT_CONTIGUOUS NTStatus = 0xC038001B + STATUS_VOLMGR_EXTENT_NOT_IN_PUBLIC_REGION NTStatus = 0xC038001C + STATUS_VOLMGR_EXTENT_NOT_SECTOR_ALIGNED NTStatus = 0xC038001D + STATUS_VOLMGR_EXTENT_OVERLAPS_EBR_PARTITION NTStatus = 0xC038001E + STATUS_VOLMGR_EXTENT_VOLUME_LENGTHS_DO_NOT_MATCH NTStatus = 0xC038001F + STATUS_VOLMGR_FAULT_TOLERANT_NOT_SUPPORTED NTStatus = 0xC0380020 + STATUS_VOLMGR_INTERLEAVE_LENGTH_INVALID NTStatus = 0xC0380021 + STATUS_VOLMGR_MAXIMUM_REGISTERED_USERS NTStatus = 0xC0380022 + STATUS_VOLMGR_MEMBER_IN_SYNC NTStatus = 0xC0380023 + STATUS_VOLMGR_MEMBER_INDEX_DUPLICATE NTStatus = 0xC0380024 + STATUS_VOLMGR_MEMBER_INDEX_INVALID NTStatus = 0xC0380025 + STATUS_VOLMGR_MEMBER_MISSING NTStatus = 0xC0380026 + STATUS_VOLMGR_MEMBER_NOT_DETACHED NTStatus = 0xC0380027 + STATUS_VOLMGR_MEMBER_REGENERATING NTStatus = 0xC0380028 + STATUS_VOLMGR_ALL_DISKS_FAILED NTStatus = 0xC0380029 + STATUS_VOLMGR_NO_REGISTERED_USERS NTStatus = 0xC038002A + STATUS_VOLMGR_NO_SUCH_USER NTStatus = 0xC038002B + STATUS_VOLMGR_NOTIFICATION_RESET NTStatus = 0xC038002C + STATUS_VOLMGR_NUMBER_OF_MEMBERS_INVALID NTStatus = 0xC038002D + STATUS_VOLMGR_NUMBER_OF_PLEXES_INVALID NTStatus = 0xC038002E + STATUS_VOLMGR_PACK_DUPLICATE NTStatus = 0xC038002F + STATUS_VOLMGR_PACK_ID_INVALID NTStatus = 0xC0380030 + STATUS_VOLMGR_PACK_INVALID NTStatus = 0xC0380031 + STATUS_VOLMGR_PACK_NAME_INVALID NTStatus = 0xC0380032 + STATUS_VOLMGR_PACK_OFFLINE NTStatus = 0xC0380033 + STATUS_VOLMGR_PACK_HAS_QUORUM NTStatus = 0xC0380034 + STATUS_VOLMGR_PACK_WITHOUT_QUORUM NTStatus = 0xC0380035 + STATUS_VOLMGR_PARTITION_STYLE_INVALID NTStatus = 0xC0380036 + STATUS_VOLMGR_PARTITION_UPDATE_FAILED NTStatus = 0xC0380037 + STATUS_VOLMGR_PLEX_IN_SYNC NTStatus = 0xC0380038 + STATUS_VOLMGR_PLEX_INDEX_DUPLICATE NTStatus = 0xC0380039 + STATUS_VOLMGR_PLEX_INDEX_INVALID NTStatus = 0xC038003A + STATUS_VOLMGR_PLEX_LAST_ACTIVE NTStatus = 0xC038003B + STATUS_VOLMGR_PLEX_MISSING NTStatus = 0xC038003C + STATUS_VOLMGR_PLEX_REGENERATING NTStatus = 0xC038003D + STATUS_VOLMGR_PLEX_TYPE_INVALID NTStatus = 0xC038003E + STATUS_VOLMGR_PLEX_NOT_RAID5 NTStatus = 0xC038003F + STATUS_VOLMGR_PLEX_NOT_SIMPLE NTStatus = 0xC0380040 + STATUS_VOLMGR_STRUCTURE_SIZE_INVALID NTStatus = 0xC0380041 + STATUS_VOLMGR_TOO_MANY_NOTIFICATION_REQUESTS NTStatus = 0xC0380042 + STATUS_VOLMGR_TRANSACTION_IN_PROGRESS NTStatus = 0xC0380043 + STATUS_VOLMGR_UNEXPECTED_DISK_LAYOUT_CHANGE NTStatus = 0xC0380044 + STATUS_VOLMGR_VOLUME_CONTAINS_MISSING_DISK NTStatus = 0xC0380045 + STATUS_VOLMGR_VOLUME_ID_INVALID NTStatus = 0xC0380046 + STATUS_VOLMGR_VOLUME_LENGTH_INVALID NTStatus = 0xC0380047 + STATUS_VOLMGR_VOLUME_LENGTH_NOT_SECTOR_SIZE_MULTIPLE NTStatus = 0xC0380048 + STATUS_VOLMGR_VOLUME_NOT_MIRRORED NTStatus = 0xC0380049 + STATUS_VOLMGR_VOLUME_NOT_RETAINED NTStatus = 0xC038004A + STATUS_VOLMGR_VOLUME_OFFLINE NTStatus = 0xC038004B + STATUS_VOLMGR_VOLUME_RETAINED NTStatus = 0xC038004C + STATUS_VOLMGR_NUMBER_OF_EXTENTS_INVALID NTStatus = 0xC038004D + STATUS_VOLMGR_DIFFERENT_SECTOR_SIZE NTStatus = 0xC038004E + STATUS_VOLMGR_BAD_BOOT_DISK NTStatus = 0xC038004F + STATUS_VOLMGR_PACK_CONFIG_OFFLINE NTStatus = 0xC0380050 + STATUS_VOLMGR_PACK_CONFIG_ONLINE NTStatus = 0xC0380051 + STATUS_VOLMGR_NOT_PRIMARY_PACK NTStatus = 0xC0380052 + STATUS_VOLMGR_PACK_LOG_UPDATE_FAILED NTStatus = 0xC0380053 + STATUS_VOLMGR_NUMBER_OF_DISKS_IN_PLEX_INVALID NTStatus = 0xC0380054 + STATUS_VOLMGR_NUMBER_OF_DISKS_IN_MEMBER_INVALID NTStatus = 0xC0380055 + STATUS_VOLMGR_VOLUME_MIRRORED NTStatus = 0xC0380056 + STATUS_VOLMGR_PLEX_NOT_SIMPLE_SPANNED NTStatus = 0xC0380057 + STATUS_VOLMGR_NO_VALID_LOG_COPIES NTStatus = 0xC0380058 + STATUS_VOLMGR_PRIMARY_PACK_PRESENT NTStatus = 0xC0380059 + STATUS_VOLMGR_NUMBER_OF_DISKS_INVALID NTStatus = 0xC038005A + STATUS_VOLMGR_MIRROR_NOT_SUPPORTED NTStatus = 0xC038005B + STATUS_VOLMGR_RAID5_NOT_SUPPORTED NTStatus = 0xC038005C + STATUS_BCD_NOT_ALL_ENTRIES_IMPORTED NTStatus = 0x80390001 + STATUS_BCD_TOO_MANY_ELEMENTS NTStatus = 0xC0390002 + STATUS_BCD_NOT_ALL_ENTRIES_SYNCHRONIZED NTStatus = 0x80390003 + STATUS_VHD_DRIVE_FOOTER_MISSING NTStatus = 0xC03A0001 + STATUS_VHD_DRIVE_FOOTER_CHECKSUM_MISMATCH NTStatus = 0xC03A0002 + STATUS_VHD_DRIVE_FOOTER_CORRUPT NTStatus = 0xC03A0003 + STATUS_VHD_FORMAT_UNKNOWN NTStatus = 0xC03A0004 + STATUS_VHD_FORMAT_UNSUPPORTED_VERSION NTStatus = 0xC03A0005 + STATUS_VHD_SPARSE_HEADER_CHECKSUM_MISMATCH NTStatus = 0xC03A0006 + STATUS_VHD_SPARSE_HEADER_UNSUPPORTED_VERSION NTStatus = 0xC03A0007 + STATUS_VHD_SPARSE_HEADER_CORRUPT NTStatus = 0xC03A0008 + STATUS_VHD_BLOCK_ALLOCATION_FAILURE NTStatus = 0xC03A0009 + STATUS_VHD_BLOCK_ALLOCATION_TABLE_CORRUPT NTStatus = 0xC03A000A + STATUS_VHD_INVALID_BLOCK_SIZE NTStatus = 0xC03A000B + STATUS_VHD_BITMAP_MISMATCH NTStatus = 0xC03A000C + STATUS_VHD_PARENT_VHD_NOT_FOUND NTStatus = 0xC03A000D + STATUS_VHD_CHILD_PARENT_ID_MISMATCH NTStatus = 0xC03A000E + STATUS_VHD_CHILD_PARENT_TIMESTAMP_MISMATCH NTStatus = 0xC03A000F + STATUS_VHD_METADATA_READ_FAILURE NTStatus = 0xC03A0010 + STATUS_VHD_METADATA_WRITE_FAILURE NTStatus = 0xC03A0011 + STATUS_VHD_INVALID_SIZE NTStatus = 0xC03A0012 + STATUS_VHD_INVALID_FILE_SIZE NTStatus = 0xC03A0013 + STATUS_VIRTDISK_PROVIDER_NOT_FOUND NTStatus = 0xC03A0014 + STATUS_VIRTDISK_NOT_VIRTUAL_DISK NTStatus = 0xC03A0015 + STATUS_VHD_PARENT_VHD_ACCESS_DENIED NTStatus = 0xC03A0016 + STATUS_VHD_CHILD_PARENT_SIZE_MISMATCH NTStatus = 0xC03A0017 + STATUS_VHD_DIFFERENCING_CHAIN_CYCLE_DETECTED NTStatus = 0xC03A0018 + STATUS_VHD_DIFFERENCING_CHAIN_ERROR_IN_PARENT NTStatus = 0xC03A0019 + STATUS_VIRTUAL_DISK_LIMITATION NTStatus = 0xC03A001A + STATUS_VHD_INVALID_TYPE NTStatus = 0xC03A001B + STATUS_VHD_INVALID_STATE NTStatus = 0xC03A001C + STATUS_VIRTDISK_UNSUPPORTED_DISK_SECTOR_SIZE NTStatus = 0xC03A001D + STATUS_VIRTDISK_DISK_ALREADY_OWNED NTStatus = 0xC03A001E + STATUS_VIRTDISK_DISK_ONLINE_AND_WRITABLE NTStatus = 0xC03A001F + STATUS_CTLOG_TRACKING_NOT_INITIALIZED NTStatus = 0xC03A0020 + STATUS_CTLOG_LOGFILE_SIZE_EXCEEDED_MAXSIZE NTStatus = 0xC03A0021 + STATUS_CTLOG_VHD_CHANGED_OFFLINE NTStatus = 0xC03A0022 + STATUS_CTLOG_INVALID_TRACKING_STATE NTStatus = 0xC03A0023 + STATUS_CTLOG_INCONSISTENT_TRACKING_FILE NTStatus = 0xC03A0024 + STATUS_VHD_METADATA_FULL NTStatus = 0xC03A0028 + STATUS_VHD_INVALID_CHANGE_TRACKING_ID NTStatus = 0xC03A0029 + STATUS_VHD_CHANGE_TRACKING_DISABLED NTStatus = 0xC03A002A + STATUS_VHD_MISSING_CHANGE_TRACKING_INFORMATION NTStatus = 0xC03A0030 + STATUS_VHD_RESIZE_WOULD_TRUNCATE_DATA NTStatus = 0xC03A0031 + STATUS_VHD_COULD_NOT_COMPUTE_MINIMUM_VIRTUAL_SIZE NTStatus = 0xC03A0032 + STATUS_VHD_ALREADY_AT_OR_BELOW_MINIMUM_VIRTUAL_SIZE NTStatus = 0xC03A0033 + STATUS_QUERY_STORAGE_ERROR NTStatus = 0x803A0001 + STATUS_GDI_HANDLE_LEAK NTStatus = 0x803F0001 + STATUS_RKF_KEY_NOT_FOUND NTStatus = 0xC0400001 + STATUS_RKF_DUPLICATE_KEY NTStatus = 0xC0400002 + STATUS_RKF_BLOB_FULL NTStatus = 0xC0400003 + STATUS_RKF_STORE_FULL NTStatus = 0xC0400004 + STATUS_RKF_FILE_BLOCKED NTStatus = 0xC0400005 + STATUS_RKF_ACTIVE_KEY NTStatus = 0xC0400006 + STATUS_RDBSS_RESTART_OPERATION NTStatus = 0xC0410001 + STATUS_RDBSS_CONTINUE_OPERATION NTStatus = 0xC0410002 + STATUS_RDBSS_POST_OPERATION NTStatus = 0xC0410003 + STATUS_RDBSS_RETRY_LOOKUP NTStatus = 0xC0410004 + STATUS_BTH_ATT_INVALID_HANDLE NTStatus = 0xC0420001 + STATUS_BTH_ATT_READ_NOT_PERMITTED NTStatus = 0xC0420002 + STATUS_BTH_ATT_WRITE_NOT_PERMITTED NTStatus = 0xC0420003 + STATUS_BTH_ATT_INVALID_PDU NTStatus = 0xC0420004 + STATUS_BTH_ATT_INSUFFICIENT_AUTHENTICATION NTStatus = 0xC0420005 + STATUS_BTH_ATT_REQUEST_NOT_SUPPORTED NTStatus = 0xC0420006 + STATUS_BTH_ATT_INVALID_OFFSET NTStatus = 0xC0420007 + STATUS_BTH_ATT_INSUFFICIENT_AUTHORIZATION NTStatus = 0xC0420008 + STATUS_BTH_ATT_PREPARE_QUEUE_FULL NTStatus = 0xC0420009 + STATUS_BTH_ATT_ATTRIBUTE_NOT_FOUND NTStatus = 0xC042000A + STATUS_BTH_ATT_ATTRIBUTE_NOT_LONG NTStatus = 0xC042000B + STATUS_BTH_ATT_INSUFFICIENT_ENCRYPTION_KEY_SIZE NTStatus = 0xC042000C + STATUS_BTH_ATT_INVALID_ATTRIBUTE_VALUE_LENGTH NTStatus = 0xC042000D + STATUS_BTH_ATT_UNLIKELY NTStatus = 0xC042000E + STATUS_BTH_ATT_INSUFFICIENT_ENCRYPTION NTStatus = 0xC042000F + STATUS_BTH_ATT_UNSUPPORTED_GROUP_TYPE NTStatus = 0xC0420010 + STATUS_BTH_ATT_INSUFFICIENT_RESOURCES NTStatus = 0xC0420011 + STATUS_BTH_ATT_UNKNOWN_ERROR NTStatus = 0xC0421000 + STATUS_SECUREBOOT_ROLLBACK_DETECTED NTStatus = 0xC0430001 + STATUS_SECUREBOOT_POLICY_VIOLATION NTStatus = 0xC0430002 + STATUS_SECUREBOOT_INVALID_POLICY NTStatus = 0xC0430003 + STATUS_SECUREBOOT_POLICY_PUBLISHER_NOT_FOUND NTStatus = 0xC0430004 + STATUS_SECUREBOOT_POLICY_NOT_SIGNED NTStatus = 0xC0430005 + STATUS_SECUREBOOT_NOT_ENABLED NTStatus = 0x80430006 + STATUS_SECUREBOOT_FILE_REPLACED NTStatus = 0xC0430007 + STATUS_SECUREBOOT_POLICY_NOT_AUTHORIZED NTStatus = 0xC0430008 + STATUS_SECUREBOOT_POLICY_UNKNOWN NTStatus = 0xC0430009 + STATUS_SECUREBOOT_POLICY_MISSING_ANTIROLLBACKVERSION NTStatus = 0xC043000A + STATUS_SECUREBOOT_PLATFORM_ID_MISMATCH NTStatus = 0xC043000B + STATUS_SECUREBOOT_POLICY_ROLLBACK_DETECTED NTStatus = 0xC043000C + STATUS_SECUREBOOT_POLICY_UPGRADE_MISMATCH NTStatus = 0xC043000D + STATUS_SECUREBOOT_REQUIRED_POLICY_FILE_MISSING NTStatus = 0xC043000E + STATUS_SECUREBOOT_NOT_BASE_POLICY NTStatus = 0xC043000F + STATUS_SECUREBOOT_NOT_SUPPLEMENTAL_POLICY NTStatus = 0xC0430010 + STATUS_PLATFORM_MANIFEST_NOT_AUTHORIZED NTStatus = 0xC0EB0001 + STATUS_PLATFORM_MANIFEST_INVALID NTStatus = 0xC0EB0002 + STATUS_PLATFORM_MANIFEST_FILE_NOT_AUTHORIZED NTStatus = 0xC0EB0003 + STATUS_PLATFORM_MANIFEST_CATALOG_NOT_AUTHORIZED NTStatus = 0xC0EB0004 + STATUS_PLATFORM_MANIFEST_BINARY_ID_NOT_FOUND NTStatus = 0xC0EB0005 + STATUS_PLATFORM_MANIFEST_NOT_ACTIVE NTStatus = 0xC0EB0006 + STATUS_PLATFORM_MANIFEST_NOT_SIGNED NTStatus = 0xC0EB0007 + STATUS_SYSTEM_INTEGRITY_ROLLBACK_DETECTED NTStatus = 0xC0E90001 + STATUS_SYSTEM_INTEGRITY_POLICY_VIOLATION NTStatus = 0xC0E90002 + STATUS_SYSTEM_INTEGRITY_INVALID_POLICY NTStatus = 0xC0E90003 + STATUS_SYSTEM_INTEGRITY_POLICY_NOT_SIGNED NTStatus = 0xC0E90004 + STATUS_SYSTEM_INTEGRITY_TOO_MANY_POLICIES NTStatus = 0xC0E90005 + STATUS_SYSTEM_INTEGRITY_SUPPLEMENTAL_POLICY_NOT_AUTHORIZED NTStatus = 0xC0E90006 + STATUS_NO_APPLICABLE_APP_LICENSES_FOUND NTStatus = 0xC0EA0001 + STATUS_CLIP_LICENSE_NOT_FOUND NTStatus = 0xC0EA0002 + STATUS_CLIP_DEVICE_LICENSE_MISSING NTStatus = 0xC0EA0003 + STATUS_CLIP_LICENSE_INVALID_SIGNATURE NTStatus = 0xC0EA0004 + STATUS_CLIP_KEYHOLDER_LICENSE_MISSING_OR_INVALID NTStatus = 0xC0EA0005 + STATUS_CLIP_LICENSE_EXPIRED NTStatus = 0xC0EA0006 + STATUS_CLIP_LICENSE_SIGNED_BY_UNKNOWN_SOURCE NTStatus = 0xC0EA0007 + STATUS_CLIP_LICENSE_NOT_SIGNED NTStatus = 0xC0EA0008 + STATUS_CLIP_LICENSE_HARDWARE_ID_OUT_OF_TOLERANCE NTStatus = 0xC0EA0009 + STATUS_CLIP_LICENSE_DEVICE_ID_MISMATCH NTStatus = 0xC0EA000A + STATUS_AUDIO_ENGINE_NODE_NOT_FOUND NTStatus = 0xC0440001 + STATUS_HDAUDIO_EMPTY_CONNECTION_LIST NTStatus = 0xC0440002 + STATUS_HDAUDIO_CONNECTION_LIST_NOT_SUPPORTED NTStatus = 0xC0440003 + STATUS_HDAUDIO_NO_LOGICAL_DEVICES_CREATED NTStatus = 0xC0440004 + STATUS_HDAUDIO_NULL_LINKED_LIST_ENTRY NTStatus = 0xC0440005 + STATUS_SPACES_REPAIRED NTStatus = 0x00E70000 + STATUS_SPACES_PAUSE NTStatus = 0x00E70001 + STATUS_SPACES_COMPLETE NTStatus = 0x00E70002 + STATUS_SPACES_REDIRECT NTStatus = 0x00E70003 + STATUS_SPACES_FAULT_DOMAIN_TYPE_INVALID NTStatus = 0xC0E70001 + STATUS_SPACES_RESILIENCY_TYPE_INVALID NTStatus = 0xC0E70003 + STATUS_SPACES_DRIVE_SECTOR_SIZE_INVALID NTStatus = 0xC0E70004 + STATUS_SPACES_DRIVE_REDUNDANCY_INVALID NTStatus = 0xC0E70006 + STATUS_SPACES_NUMBER_OF_DATA_COPIES_INVALID NTStatus = 0xC0E70007 + STATUS_SPACES_INTERLEAVE_LENGTH_INVALID NTStatus = 0xC0E70009 + STATUS_SPACES_NUMBER_OF_COLUMNS_INVALID NTStatus = 0xC0E7000A + STATUS_SPACES_NOT_ENOUGH_DRIVES NTStatus = 0xC0E7000B + STATUS_SPACES_EXTENDED_ERROR NTStatus = 0xC0E7000C + STATUS_SPACES_PROVISIONING_TYPE_INVALID NTStatus = 0xC0E7000D + STATUS_SPACES_ALLOCATION_SIZE_INVALID NTStatus = 0xC0E7000E + STATUS_SPACES_ENCLOSURE_AWARE_INVALID NTStatus = 0xC0E7000F + STATUS_SPACES_WRITE_CACHE_SIZE_INVALID NTStatus = 0xC0E70010 + STATUS_SPACES_NUMBER_OF_GROUPS_INVALID NTStatus = 0xC0E70011 + STATUS_SPACES_DRIVE_OPERATIONAL_STATE_INVALID NTStatus = 0xC0E70012 + STATUS_SPACES_UPDATE_COLUMN_STATE NTStatus = 0xC0E70013 + STATUS_SPACES_MAP_REQUIRED NTStatus = 0xC0E70014 + STATUS_SPACES_UNSUPPORTED_VERSION NTStatus = 0xC0E70015 + STATUS_SPACES_CORRUPT_METADATA NTStatus = 0xC0E70016 + STATUS_SPACES_DRT_FULL NTStatus = 0xC0E70017 + STATUS_SPACES_INCONSISTENCY NTStatus = 0xC0E70018 + STATUS_SPACES_LOG_NOT_READY NTStatus = 0xC0E70019 + STATUS_SPACES_NO_REDUNDANCY NTStatus = 0xC0E7001A + STATUS_SPACES_DRIVE_NOT_READY NTStatus = 0xC0E7001B + STATUS_SPACES_DRIVE_SPLIT NTStatus = 0xC0E7001C + STATUS_SPACES_DRIVE_LOST_DATA NTStatus = 0xC0E7001D + STATUS_SPACES_ENTRY_INCOMPLETE NTStatus = 0xC0E7001E + STATUS_SPACES_ENTRY_INVALID NTStatus = 0xC0E7001F + STATUS_SPACES_MARK_DIRTY NTStatus = 0xC0E70020 + STATUS_VOLSNAP_BOOTFILE_NOT_VALID NTStatus = 0xC0500003 + STATUS_VOLSNAP_ACTIVATION_TIMEOUT NTStatus = 0xC0500004 + STATUS_IO_PREEMPTED NTStatus = 0xC0510001 + STATUS_SVHDX_ERROR_STORED NTStatus = 0xC05C0000 + STATUS_SVHDX_ERROR_NOT_AVAILABLE NTStatus = 0xC05CFF00 + STATUS_SVHDX_UNIT_ATTENTION_AVAILABLE NTStatus = 0xC05CFF01 + STATUS_SVHDX_UNIT_ATTENTION_CAPACITY_DATA_CHANGED NTStatus = 0xC05CFF02 + STATUS_SVHDX_UNIT_ATTENTION_RESERVATIONS_PREEMPTED NTStatus = 0xC05CFF03 + STATUS_SVHDX_UNIT_ATTENTION_RESERVATIONS_RELEASED NTStatus = 0xC05CFF04 + STATUS_SVHDX_UNIT_ATTENTION_REGISTRATIONS_PREEMPTED NTStatus = 0xC05CFF05 + STATUS_SVHDX_UNIT_ATTENTION_OPERATING_DEFINITION_CHANGED NTStatus = 0xC05CFF06 + STATUS_SVHDX_RESERVATION_CONFLICT NTStatus = 0xC05CFF07 + STATUS_SVHDX_WRONG_FILE_TYPE NTStatus = 0xC05CFF08 + STATUS_SVHDX_VERSION_MISMATCH NTStatus = 0xC05CFF09 + STATUS_VHD_SHARED NTStatus = 0xC05CFF0A + STATUS_SVHDX_NO_INITIATOR NTStatus = 0xC05CFF0B + STATUS_VHDSET_BACKING_STORAGE_NOT_FOUND NTStatus = 0xC05CFF0C + STATUS_SMB_NO_PREAUTH_INTEGRITY_HASH_OVERLAP NTStatus = 0xC05D0000 + STATUS_SMB_BAD_CLUSTER_DIALECT NTStatus = 0xC05D0001 + STATUS_SMB_GUEST_LOGON_BLOCKED NTStatus = 0xC05D0002 + STATUS_SECCORE_INVALID_COMMAND NTStatus = 0xC0E80000 + STATUS_VSM_NOT_INITIALIZED NTStatus = 0xC0450000 + STATUS_VSM_DMA_PROTECTION_NOT_IN_USE NTStatus = 0xC0450001 + STATUS_APPEXEC_CONDITION_NOT_SATISFIED NTStatus = 0xC0EC0000 + STATUS_APPEXEC_HANDLE_INVALIDATED NTStatus = 0xC0EC0001 + STATUS_APPEXEC_INVALID_HOST_GENERATION NTStatus = 0xC0EC0002 + STATUS_APPEXEC_UNEXPECTED_PROCESS_REGISTRATION NTStatus = 0xC0EC0003 + STATUS_APPEXEC_INVALID_HOST_STATE NTStatus = 0xC0EC0004 + STATUS_APPEXEC_NO_DONOR NTStatus = 0xC0EC0005 + STATUS_APPEXEC_HOST_ID_MISMATCH NTStatus = 0xC0EC0006 + STATUS_APPEXEC_UNKNOWN_USER NTStatus = 0xC0EC0007 +) diff --git a/vendor/golang.org/x/sys/windows/zknownfolderids_windows.go b/vendor/golang.org/x/sys/windows/zknownfolderids_windows.go new file mode 100644 index 00000000..6048ac67 --- /dev/null +++ b/vendor/golang.org/x/sys/windows/zknownfolderids_windows.go @@ -0,0 +1,149 @@ +// Code generated by 'mkknownfolderids.bash'; DO NOT EDIT. + +package windows + +type KNOWNFOLDERID GUID + +var ( + FOLDERID_NetworkFolder = &KNOWNFOLDERID{0xd20beec4, 0x5ca8, 0x4905, [8]byte{0xae, 0x3b, 0xbf, 0x25, 0x1e, 0xa0, 0x9b, 0x53}} + FOLDERID_ComputerFolder = &KNOWNFOLDERID{0x0ac0837c, 0xbbf8, 0x452a, [8]byte{0x85, 0x0d, 0x79, 0xd0, 0x8e, 0x66, 0x7c, 0xa7}} + FOLDERID_InternetFolder = &KNOWNFOLDERID{0x4d9f7874, 0x4e0c, 0x4904, [8]byte{0x96, 0x7b, 0x40, 0xb0, 0xd2, 0x0c, 0x3e, 0x4b}} + FOLDERID_ControlPanelFolder = &KNOWNFOLDERID{0x82a74aeb, 0xaeb4, 0x465c, [8]byte{0xa0, 0x14, 0xd0, 0x97, 0xee, 0x34, 0x6d, 0x63}} + FOLDERID_PrintersFolder = &KNOWNFOLDERID{0x76fc4e2d, 0xd6ad, 0x4519, [8]byte{0xa6, 0x63, 0x37, 0xbd, 0x56, 0x06, 0x81, 0x85}} + FOLDERID_SyncManagerFolder = &KNOWNFOLDERID{0x43668bf8, 0xc14e, 0x49b2, [8]byte{0x97, 0xc9, 0x74, 0x77, 0x84, 0xd7, 0x84, 0xb7}} + FOLDERID_SyncSetupFolder = &KNOWNFOLDERID{0x0f214138, 0xb1d3, 0x4a90, [8]byte{0xbb, 0xa9, 0x27, 0xcb, 0xc0, 0xc5, 0x38, 0x9a}} + FOLDERID_ConflictFolder = &KNOWNFOLDERID{0x4bfefb45, 0x347d, 0x4006, [8]byte{0xa5, 0xbe, 0xac, 0x0c, 0xb0, 0x56, 0x71, 0x92}} + FOLDERID_SyncResultsFolder = &KNOWNFOLDERID{0x289a9a43, 0xbe44, 0x4057, [8]byte{0xa4, 0x1b, 0x58, 0x7a, 0x76, 0xd7, 0xe7, 0xf9}} + FOLDERID_RecycleBinFolder = &KNOWNFOLDERID{0xb7534046, 0x3ecb, 0x4c18, [8]byte{0xbe, 0x4e, 0x64, 0xcd, 0x4c, 0xb7, 0xd6, 0xac}} + FOLDERID_ConnectionsFolder = &KNOWNFOLDERID{0x6f0cd92b, 0x2e97, 0x45d1, [8]byte{0x88, 0xff, 0xb0, 0xd1, 0x86, 0xb8, 0xde, 0xdd}} + FOLDERID_Fonts = &KNOWNFOLDERID{0xfd228cb7, 0xae11, 0x4ae3, [8]byte{0x86, 0x4c, 0x16, 0xf3, 0x91, 0x0a, 0xb8, 0xfe}} + FOLDERID_Desktop = &KNOWNFOLDERID{0xb4bfcc3a, 0xdb2c, 0x424c, [8]byte{0xb0, 0x29, 0x7f, 0xe9, 0x9a, 0x87, 0xc6, 0x41}} + FOLDERID_Startup = &KNOWNFOLDERID{0xb97d20bb, 0xf46a, 0x4c97, [8]byte{0xba, 0x10, 0x5e, 0x36, 0x08, 0x43, 0x08, 0x54}} + FOLDERID_Programs = &KNOWNFOLDERID{0xa77f5d77, 0x2e2b, 0x44c3, [8]byte{0xa6, 0xa2, 0xab, 0xa6, 0x01, 0x05, 0x4a, 0x51}} + FOLDERID_StartMenu = &KNOWNFOLDERID{0x625b53c3, 0xab48, 0x4ec1, [8]byte{0xba, 0x1f, 0xa1, 0xef, 0x41, 0x46, 0xfc, 0x19}} + FOLDERID_Recent = &KNOWNFOLDERID{0xae50c081, 0xebd2, 0x438a, [8]byte{0x86, 0x55, 0x8a, 0x09, 0x2e, 0x34, 0x98, 0x7a}} + FOLDERID_SendTo = &KNOWNFOLDERID{0x8983036c, 0x27c0, 0x404b, [8]byte{0x8f, 0x08, 0x10, 0x2d, 0x10, 0xdc, 0xfd, 0x74}} + FOLDERID_Documents = &KNOWNFOLDERID{0xfdd39ad0, 0x238f, 0x46af, [8]byte{0xad, 0xb4, 0x6c, 0x85, 0x48, 0x03, 0x69, 0xc7}} + FOLDERID_Favorites = &KNOWNFOLDERID{0x1777f761, 0x68ad, 0x4d8a, [8]byte{0x87, 0xbd, 0x30, 0xb7, 0x59, 0xfa, 0x33, 0xdd}} + FOLDERID_NetHood = &KNOWNFOLDERID{0xc5abbf53, 0xe17f, 0x4121, [8]byte{0x89, 0x00, 0x86, 0x62, 0x6f, 0xc2, 0xc9, 0x73}} + FOLDERID_PrintHood = &KNOWNFOLDERID{0x9274bd8d, 0xcfd1, 0x41c3, [8]byte{0xb3, 0x5e, 0xb1, 0x3f, 0x55, 0xa7, 0x58, 0xf4}} + FOLDERID_Templates = &KNOWNFOLDERID{0xa63293e8, 0x664e, 0x48db, [8]byte{0xa0, 0x79, 0xdf, 0x75, 0x9e, 0x05, 0x09, 0xf7}} + FOLDERID_CommonStartup = &KNOWNFOLDERID{0x82a5ea35, 0xd9cd, 0x47c5, [8]byte{0x96, 0x29, 0xe1, 0x5d, 0x2f, 0x71, 0x4e, 0x6e}} + FOLDERID_CommonPrograms = &KNOWNFOLDERID{0x0139d44e, 0x6afe, 0x49f2, [8]byte{0x86, 0x90, 0x3d, 0xaf, 0xca, 0xe6, 0xff, 0xb8}} + FOLDERID_CommonStartMenu = &KNOWNFOLDERID{0xa4115719, 0xd62e, 0x491d, [8]byte{0xaa, 0x7c, 0xe7, 0x4b, 0x8b, 0xe3, 0xb0, 0x67}} + FOLDERID_PublicDesktop = &KNOWNFOLDERID{0xc4aa340d, 0xf20f, 0x4863, [8]byte{0xaf, 0xef, 0xf8, 0x7e, 0xf2, 0xe6, 0xba, 0x25}} + FOLDERID_ProgramData = &KNOWNFOLDERID{0x62ab5d82, 0xfdc1, 0x4dc3, [8]byte{0xa9, 0xdd, 0x07, 0x0d, 0x1d, 0x49, 0x5d, 0x97}} + FOLDERID_CommonTemplates = &KNOWNFOLDERID{0xb94237e7, 0x57ac, 0x4347, [8]byte{0x91, 0x51, 0xb0, 0x8c, 0x6c, 0x32, 0xd1, 0xf7}} + FOLDERID_PublicDocuments = &KNOWNFOLDERID{0xed4824af, 0xdce4, 0x45a8, [8]byte{0x81, 0xe2, 0xfc, 0x79, 0x65, 0x08, 0x36, 0x34}} + FOLDERID_RoamingAppData = &KNOWNFOLDERID{0x3eb685db, 0x65f9, 0x4cf6, [8]byte{0xa0, 0x3a, 0xe3, 0xef, 0x65, 0x72, 0x9f, 0x3d}} + FOLDERID_LocalAppData = &KNOWNFOLDERID{0xf1b32785, 0x6fba, 0x4fcf, [8]byte{0x9d, 0x55, 0x7b, 0x8e, 0x7f, 0x15, 0x70, 0x91}} + FOLDERID_LocalAppDataLow = &KNOWNFOLDERID{0xa520a1a4, 0x1780, 0x4ff6, [8]byte{0xbd, 0x18, 0x16, 0x73, 0x43, 0xc5, 0xaf, 0x16}} + FOLDERID_InternetCache = &KNOWNFOLDERID{0x352481e8, 0x33be, 0x4251, [8]byte{0xba, 0x85, 0x60, 0x07, 0xca, 0xed, 0xcf, 0x9d}} + FOLDERID_Cookies = &KNOWNFOLDERID{0x2b0f765d, 0xc0e9, 0x4171, [8]byte{0x90, 0x8e, 0x08, 0xa6, 0x11, 0xb8, 0x4f, 0xf6}} + FOLDERID_History = &KNOWNFOLDERID{0xd9dc8a3b, 0xb784, 0x432e, [8]byte{0xa7, 0x81, 0x5a, 0x11, 0x30, 0xa7, 0x59, 0x63}} + FOLDERID_System = &KNOWNFOLDERID{0x1ac14e77, 0x02e7, 0x4e5d, [8]byte{0xb7, 0x44, 0x2e, 0xb1, 0xae, 0x51, 0x98, 0xb7}} + FOLDERID_SystemX86 = &KNOWNFOLDERID{0xd65231b0, 0xb2f1, 0x4857, [8]byte{0xa4, 0xce, 0xa8, 0xe7, 0xc6, 0xea, 0x7d, 0x27}} + FOLDERID_Windows = &KNOWNFOLDERID{0xf38bf404, 0x1d43, 0x42f2, [8]byte{0x93, 0x05, 0x67, 0xde, 0x0b, 0x28, 0xfc, 0x23}} + FOLDERID_Profile = &KNOWNFOLDERID{0x5e6c858f, 0x0e22, 0x4760, [8]byte{0x9a, 0xfe, 0xea, 0x33, 0x17, 0xb6, 0x71, 0x73}} + FOLDERID_Pictures = &KNOWNFOLDERID{0x33e28130, 0x4e1e, 0x4676, [8]byte{0x83, 0x5a, 0x98, 0x39, 0x5c, 0x3b, 0xc3, 0xbb}} + FOLDERID_ProgramFilesX86 = &KNOWNFOLDERID{0x7c5a40ef, 0xa0fb, 0x4bfc, [8]byte{0x87, 0x4a, 0xc0, 0xf2, 0xe0, 0xb9, 0xfa, 0x8e}} + FOLDERID_ProgramFilesCommonX86 = &KNOWNFOLDERID{0xde974d24, 0xd9c6, 0x4d3e, [8]byte{0xbf, 0x91, 0xf4, 0x45, 0x51, 0x20, 0xb9, 0x17}} + FOLDERID_ProgramFilesX64 = &KNOWNFOLDERID{0x6d809377, 0x6af0, 0x444b, [8]byte{0x89, 0x57, 0xa3, 0x77, 0x3f, 0x02, 0x20, 0x0e}} + FOLDERID_ProgramFilesCommonX64 = &KNOWNFOLDERID{0x6365d5a7, 0x0f0d, 0x45e5, [8]byte{0x87, 0xf6, 0x0d, 0xa5, 0x6b, 0x6a, 0x4f, 0x7d}} + FOLDERID_ProgramFiles = &KNOWNFOLDERID{0x905e63b6, 0xc1bf, 0x494e, [8]byte{0xb2, 0x9c, 0x65, 0xb7, 0x32, 0xd3, 0xd2, 0x1a}} + FOLDERID_ProgramFilesCommon = &KNOWNFOLDERID{0xf7f1ed05, 0x9f6d, 0x47a2, [8]byte{0xaa, 0xae, 0x29, 0xd3, 0x17, 0xc6, 0xf0, 0x66}} + FOLDERID_UserProgramFiles = &KNOWNFOLDERID{0x5cd7aee2, 0x2219, 0x4a67, [8]byte{0xb8, 0x5d, 0x6c, 0x9c, 0xe1, 0x56, 0x60, 0xcb}} + FOLDERID_UserProgramFilesCommon = &KNOWNFOLDERID{0xbcbd3057, 0xca5c, 0x4622, [8]byte{0xb4, 0x2d, 0xbc, 0x56, 0xdb, 0x0a, 0xe5, 0x16}} + FOLDERID_AdminTools = &KNOWNFOLDERID{0x724ef170, 0xa42d, 0x4fef, [8]byte{0x9f, 0x26, 0xb6, 0x0e, 0x84, 0x6f, 0xba, 0x4f}} + FOLDERID_CommonAdminTools = &KNOWNFOLDERID{0xd0384e7d, 0xbac3, 0x4797, [8]byte{0x8f, 0x14, 0xcb, 0xa2, 0x29, 0xb3, 0x92, 0xb5}} + FOLDERID_Music = &KNOWNFOLDERID{0x4bd8d571, 0x6d19, 0x48d3, [8]byte{0xbe, 0x97, 0x42, 0x22, 0x20, 0x08, 0x0e, 0x43}} + FOLDERID_Videos = &KNOWNFOLDERID{0x18989b1d, 0x99b5, 0x455b, [8]byte{0x84, 0x1c, 0xab, 0x7c, 0x74, 0xe4, 0xdd, 0xfc}} + FOLDERID_Ringtones = &KNOWNFOLDERID{0xc870044b, 0xf49e, 0x4126, [8]byte{0xa9, 0xc3, 0xb5, 0x2a, 0x1f, 0xf4, 0x11, 0xe8}} + FOLDERID_PublicPictures = &KNOWNFOLDERID{0xb6ebfb86, 0x6907, 0x413c, [8]byte{0x9a, 0xf7, 0x4f, 0xc2, 0xab, 0xf0, 0x7c, 0xc5}} + FOLDERID_PublicMusic = &KNOWNFOLDERID{0x3214fab5, 0x9757, 0x4298, [8]byte{0xbb, 0x61, 0x92, 0xa9, 0xde, 0xaa, 0x44, 0xff}} + FOLDERID_PublicVideos = &KNOWNFOLDERID{0x2400183a, 0x6185, 0x49fb, [8]byte{0xa2, 0xd8, 0x4a, 0x39, 0x2a, 0x60, 0x2b, 0xa3}} + FOLDERID_PublicRingtones = &KNOWNFOLDERID{0xe555ab60, 0x153b, 0x4d17, [8]byte{0x9f, 0x04, 0xa5, 0xfe, 0x99, 0xfc, 0x15, 0xec}} + FOLDERID_ResourceDir = &KNOWNFOLDERID{0x8ad10c31, 0x2adb, 0x4296, [8]byte{0xa8, 0xf7, 0xe4, 0x70, 0x12, 0x32, 0xc9, 0x72}} + FOLDERID_LocalizedResourcesDir = &KNOWNFOLDERID{0x2a00375e, 0x224c, 0x49de, [8]byte{0xb8, 0xd1, 0x44, 0x0d, 0xf7, 0xef, 0x3d, 0xdc}} + FOLDERID_CommonOEMLinks = &KNOWNFOLDERID{0xc1bae2d0, 0x10df, 0x4334, [8]byte{0xbe, 0xdd, 0x7a, 0xa2, 0x0b, 0x22, 0x7a, 0x9d}} + FOLDERID_CDBurning = &KNOWNFOLDERID{0x9e52ab10, 0xf80d, 0x49df, [8]byte{0xac, 0xb8, 0x43, 0x30, 0xf5, 0x68, 0x78, 0x55}} + FOLDERID_UserProfiles = &KNOWNFOLDERID{0x0762d272, 0xc50a, 0x4bb0, [8]byte{0xa3, 0x82, 0x69, 0x7d, 0xcd, 0x72, 0x9b, 0x80}} + FOLDERID_Playlists = &KNOWNFOLDERID{0xde92c1c7, 0x837f, 0x4f69, [8]byte{0xa3, 0xbb, 0x86, 0xe6, 0x31, 0x20, 0x4a, 0x23}} + FOLDERID_SamplePlaylists = &KNOWNFOLDERID{0x15ca69b3, 0x30ee, 0x49c1, [8]byte{0xac, 0xe1, 0x6b, 0x5e, 0xc3, 0x72, 0xaf, 0xb5}} + FOLDERID_SampleMusic = &KNOWNFOLDERID{0xb250c668, 0xf57d, 0x4ee1, [8]byte{0xa6, 0x3c, 0x29, 0x0e, 0xe7, 0xd1, 0xaa, 0x1f}} + FOLDERID_SamplePictures = &KNOWNFOLDERID{0xc4900540, 0x2379, 0x4c75, [8]byte{0x84, 0x4b, 0x64, 0xe6, 0xfa, 0xf8, 0x71, 0x6b}} + FOLDERID_SampleVideos = &KNOWNFOLDERID{0x859ead94, 0x2e85, 0x48ad, [8]byte{0xa7, 0x1a, 0x09, 0x69, 0xcb, 0x56, 0xa6, 0xcd}} + FOLDERID_PhotoAlbums = &KNOWNFOLDERID{0x69d2cf90, 0xfc33, 0x4fb7, [8]byte{0x9a, 0x0c, 0xeb, 0xb0, 0xf0, 0xfc, 0xb4, 0x3c}} + FOLDERID_Public = &KNOWNFOLDERID{0xdfdf76a2, 0xc82a, 0x4d63, [8]byte{0x90, 0x6a, 0x56, 0x44, 0xac, 0x45, 0x73, 0x85}} + FOLDERID_ChangeRemovePrograms = &KNOWNFOLDERID{0xdf7266ac, 0x9274, 0x4867, [8]byte{0x8d, 0x55, 0x3b, 0xd6, 0x61, 0xde, 0x87, 0x2d}} + FOLDERID_AppUpdates = &KNOWNFOLDERID{0xa305ce99, 0xf527, 0x492b, [8]byte{0x8b, 0x1a, 0x7e, 0x76, 0xfa, 0x98, 0xd6, 0xe4}} + FOLDERID_AddNewPrograms = &KNOWNFOLDERID{0xde61d971, 0x5ebc, 0x4f02, [8]byte{0xa3, 0xa9, 0x6c, 0x82, 0x89, 0x5e, 0x5c, 0x04}} + FOLDERID_Downloads = &KNOWNFOLDERID{0x374de290, 0x123f, 0x4565, [8]byte{0x91, 0x64, 0x39, 0xc4, 0x92, 0x5e, 0x46, 0x7b}} + FOLDERID_PublicDownloads = &KNOWNFOLDERID{0x3d644c9b, 0x1fb8, 0x4f30, [8]byte{0x9b, 0x45, 0xf6, 0x70, 0x23, 0x5f, 0x79, 0xc0}} + FOLDERID_SavedSearches = &KNOWNFOLDERID{0x7d1d3a04, 0xdebb, 0x4115, [8]byte{0x95, 0xcf, 0x2f, 0x29, 0xda, 0x29, 0x20, 0xda}} + FOLDERID_QuickLaunch = &KNOWNFOLDERID{0x52a4f021, 0x7b75, 0x48a9, [8]byte{0x9f, 0x6b, 0x4b, 0x87, 0xa2, 0x10, 0xbc, 0x8f}} + FOLDERID_Contacts = &KNOWNFOLDERID{0x56784854, 0xc6cb, 0x462b, [8]byte{0x81, 0x69, 0x88, 0xe3, 0x50, 0xac, 0xb8, 0x82}} + FOLDERID_SidebarParts = &KNOWNFOLDERID{0xa75d362e, 0x50fc, 0x4fb7, [8]byte{0xac, 0x2c, 0xa8, 0xbe, 0xaa, 0x31, 0x44, 0x93}} + FOLDERID_SidebarDefaultParts = &KNOWNFOLDERID{0x7b396e54, 0x9ec5, 0x4300, [8]byte{0xbe, 0x0a, 0x24, 0x82, 0xeb, 0xae, 0x1a, 0x26}} + FOLDERID_PublicGameTasks = &KNOWNFOLDERID{0xdebf2536, 0xe1a8, 0x4c59, [8]byte{0xb6, 0xa2, 0x41, 0x45, 0x86, 0x47, 0x6a, 0xea}} + FOLDERID_GameTasks = &KNOWNFOLDERID{0x054fae61, 0x4dd8, 0x4787, [8]byte{0x80, 0xb6, 0x09, 0x02, 0x20, 0xc4, 0xb7, 0x00}} + FOLDERID_SavedGames = &KNOWNFOLDERID{0x4c5c32ff, 0xbb9d, 0x43b0, [8]byte{0xb5, 0xb4, 0x2d, 0x72, 0xe5, 0x4e, 0xaa, 0xa4}} + FOLDERID_Games = &KNOWNFOLDERID{0xcac52c1a, 0xb53d, 0x4edc, [8]byte{0x92, 0xd7, 0x6b, 0x2e, 0x8a, 0xc1, 0x94, 0x34}} + FOLDERID_SEARCH_MAPI = &KNOWNFOLDERID{0x98ec0e18, 0x2098, 0x4d44, [8]byte{0x86, 0x44, 0x66, 0x97, 0x93, 0x15, 0xa2, 0x81}} + FOLDERID_SEARCH_CSC = &KNOWNFOLDERID{0xee32e446, 0x31ca, 0x4aba, [8]byte{0x81, 0x4f, 0xa5, 0xeb, 0xd2, 0xfd, 0x6d, 0x5e}} + FOLDERID_Links = &KNOWNFOLDERID{0xbfb9d5e0, 0xc6a9, 0x404c, [8]byte{0xb2, 0xb2, 0xae, 0x6d, 0xb6, 0xaf, 0x49, 0x68}} + FOLDERID_UsersFiles = &KNOWNFOLDERID{0xf3ce0f7c, 0x4901, 0x4acc, [8]byte{0x86, 0x48, 0xd5, 0xd4, 0x4b, 0x04, 0xef, 0x8f}} + FOLDERID_UsersLibraries = &KNOWNFOLDERID{0xa302545d, 0xdeff, 0x464b, [8]byte{0xab, 0xe8, 0x61, 0xc8, 0x64, 0x8d, 0x93, 0x9b}} + FOLDERID_SearchHome = &KNOWNFOLDERID{0x190337d1, 0xb8ca, 0x4121, [8]byte{0xa6, 0x39, 0x6d, 0x47, 0x2d, 0x16, 0x97, 0x2a}} + FOLDERID_OriginalImages = &KNOWNFOLDERID{0x2c36c0aa, 0x5812, 0x4b87, [8]byte{0xbf, 0xd0, 0x4c, 0xd0, 0xdf, 0xb1, 0x9b, 0x39}} + FOLDERID_DocumentsLibrary = &KNOWNFOLDERID{0x7b0db17d, 0x9cd2, 0x4a93, [8]byte{0x97, 0x33, 0x46, 0xcc, 0x89, 0x02, 0x2e, 0x7c}} + FOLDERID_MusicLibrary = &KNOWNFOLDERID{0x2112ab0a, 0xc86a, 0x4ffe, [8]byte{0xa3, 0x68, 0x0d, 0xe9, 0x6e, 0x47, 0x01, 0x2e}} + FOLDERID_PicturesLibrary = &KNOWNFOLDERID{0xa990ae9f, 0xa03b, 0x4e80, [8]byte{0x94, 0xbc, 0x99, 0x12, 0xd7, 0x50, 0x41, 0x04}} + FOLDERID_VideosLibrary = &KNOWNFOLDERID{0x491e922f, 0x5643, 0x4af4, [8]byte{0xa7, 0xeb, 0x4e, 0x7a, 0x13, 0x8d, 0x81, 0x74}} + FOLDERID_RecordedTVLibrary = &KNOWNFOLDERID{0x1a6fdba2, 0xf42d, 0x4358, [8]byte{0xa7, 0x98, 0xb7, 0x4d, 0x74, 0x59, 0x26, 0xc5}} + FOLDERID_HomeGroup = &KNOWNFOLDERID{0x52528a6b, 0xb9e3, 0x4add, [8]byte{0xb6, 0x0d, 0x58, 0x8c, 0x2d, 0xba, 0x84, 0x2d}} + FOLDERID_HomeGroupCurrentUser = &KNOWNFOLDERID{0x9b74b6a3, 0x0dfd, 0x4f11, [8]byte{0x9e, 0x78, 0x5f, 0x78, 0x00, 0xf2, 0xe7, 0x72}} + FOLDERID_DeviceMetadataStore = &KNOWNFOLDERID{0x5ce4a5e9, 0xe4eb, 0x479d, [8]byte{0xb8, 0x9f, 0x13, 0x0c, 0x02, 0x88, 0x61, 0x55}} + FOLDERID_Libraries = &KNOWNFOLDERID{0x1b3ea5dc, 0xb587, 0x4786, [8]byte{0xb4, 0xef, 0xbd, 0x1d, 0xc3, 0x32, 0xae, 0xae}} + FOLDERID_PublicLibraries = &KNOWNFOLDERID{0x48daf80b, 0xe6cf, 0x4f4e, [8]byte{0xb8, 0x00, 0x0e, 0x69, 0xd8, 0x4e, 0xe3, 0x84}} + FOLDERID_UserPinned = &KNOWNFOLDERID{0x9e3995ab, 0x1f9c, 0x4f13, [8]byte{0xb8, 0x27, 0x48, 0xb2, 0x4b, 0x6c, 0x71, 0x74}} + FOLDERID_ImplicitAppShortcuts = &KNOWNFOLDERID{0xbcb5256f, 0x79f6, 0x4cee, [8]byte{0xb7, 0x25, 0xdc, 0x34, 0xe4, 0x02, 0xfd, 0x46}} + FOLDERID_AccountPictures = &KNOWNFOLDERID{0x008ca0b1, 0x55b4, 0x4c56, [8]byte{0xb8, 0xa8, 0x4d, 0xe4, 0xb2, 0x99, 0xd3, 0xbe}} + FOLDERID_PublicUserTiles = &KNOWNFOLDERID{0x0482af6c, 0x08f1, 0x4c34, [8]byte{0x8c, 0x90, 0xe1, 0x7e, 0xc9, 0x8b, 0x1e, 0x17}} + FOLDERID_AppsFolder = &KNOWNFOLDERID{0x1e87508d, 0x89c2, 0x42f0, [8]byte{0x8a, 0x7e, 0x64, 0x5a, 0x0f, 0x50, 0xca, 0x58}} + FOLDERID_StartMenuAllPrograms = &KNOWNFOLDERID{0xf26305ef, 0x6948, 0x40b9, [8]byte{0xb2, 0x55, 0x81, 0x45, 0x3d, 0x09, 0xc7, 0x85}} + FOLDERID_CommonStartMenuPlaces = &KNOWNFOLDERID{0xa440879f, 0x87a0, 0x4f7d, [8]byte{0xb7, 0x00, 0x02, 0x07, 0xb9, 0x66, 0x19, 0x4a}} + FOLDERID_ApplicationShortcuts = &KNOWNFOLDERID{0xa3918781, 0xe5f2, 0x4890, [8]byte{0xb3, 0xd9, 0xa7, 0xe5, 0x43, 0x32, 0x32, 0x8c}} + FOLDERID_RoamingTiles = &KNOWNFOLDERID{0x00bcfc5a, 0xed94, 0x4e48, [8]byte{0x96, 0xa1, 0x3f, 0x62, 0x17, 0xf2, 0x19, 0x90}} + FOLDERID_RoamedTileImages = &KNOWNFOLDERID{0xaaa8d5a5, 0xf1d6, 0x4259, [8]byte{0xba, 0xa8, 0x78, 0xe7, 0xef, 0x60, 0x83, 0x5e}} + FOLDERID_Screenshots = &KNOWNFOLDERID{0xb7bede81, 0xdf94, 0x4682, [8]byte{0xa7, 0xd8, 0x57, 0xa5, 0x26, 0x20, 0xb8, 0x6f}} + FOLDERID_CameraRoll = &KNOWNFOLDERID{0xab5fb87b, 0x7ce2, 0x4f83, [8]byte{0x91, 0x5d, 0x55, 0x08, 0x46, 0xc9, 0x53, 0x7b}} + FOLDERID_SkyDrive = &KNOWNFOLDERID{0xa52bba46, 0xe9e1, 0x435f, [8]byte{0xb3, 0xd9, 0x28, 0xda, 0xa6, 0x48, 0xc0, 0xf6}} + FOLDERID_OneDrive = &KNOWNFOLDERID{0xa52bba46, 0xe9e1, 0x435f, [8]byte{0xb3, 0xd9, 0x28, 0xda, 0xa6, 0x48, 0xc0, 0xf6}} + FOLDERID_SkyDriveDocuments = &KNOWNFOLDERID{0x24d89e24, 0x2f19, 0x4534, [8]byte{0x9d, 0xde, 0x6a, 0x66, 0x71, 0xfb, 0xb8, 0xfe}} + FOLDERID_SkyDrivePictures = &KNOWNFOLDERID{0x339719b5, 0x8c47, 0x4894, [8]byte{0x94, 0xc2, 0xd8, 0xf7, 0x7a, 0xdd, 0x44, 0xa6}} + FOLDERID_SkyDriveMusic = &KNOWNFOLDERID{0xc3f2459e, 0x80d6, 0x45dc, [8]byte{0xbf, 0xef, 0x1f, 0x76, 0x9f, 0x2b, 0xe7, 0x30}} + FOLDERID_SkyDriveCameraRoll = &KNOWNFOLDERID{0x767e6811, 0x49cb, 0x4273, [8]byte{0x87, 0xc2, 0x20, 0xf3, 0x55, 0xe1, 0x08, 0x5b}} + FOLDERID_SearchHistory = &KNOWNFOLDERID{0x0d4c3db6, 0x03a3, 0x462f, [8]byte{0xa0, 0xe6, 0x08, 0x92, 0x4c, 0x41, 0xb5, 0xd4}} + FOLDERID_SearchTemplates = &KNOWNFOLDERID{0x7e636bfe, 0xdfa9, 0x4d5e, [8]byte{0xb4, 0x56, 0xd7, 0xb3, 0x98, 0x51, 0xd8, 0xa9}} + FOLDERID_CameraRollLibrary = &KNOWNFOLDERID{0x2b20df75, 0x1eda, 0x4039, [8]byte{0x80, 0x97, 0x38, 0x79, 0x82, 0x27, 0xd5, 0xb7}} + FOLDERID_SavedPictures = &KNOWNFOLDERID{0x3b193882, 0xd3ad, 0x4eab, [8]byte{0x96, 0x5a, 0x69, 0x82, 0x9d, 0x1f, 0xb5, 0x9f}} + FOLDERID_SavedPicturesLibrary = &KNOWNFOLDERID{0xe25b5812, 0xbe88, 0x4bd9, [8]byte{0x94, 0xb0, 0x29, 0x23, 0x34, 0x77, 0xb6, 0xc3}} + FOLDERID_RetailDemo = &KNOWNFOLDERID{0x12d4c69e, 0x24ad, 0x4923, [8]byte{0xbe, 0x19, 0x31, 0x32, 0x1c, 0x43, 0xa7, 0x67}} + FOLDERID_Device = &KNOWNFOLDERID{0x1c2ac1dc, 0x4358, 0x4b6c, [8]byte{0x97, 0x33, 0xaf, 0x21, 0x15, 0x65, 0x76, 0xf0}} + FOLDERID_DevelopmentFiles = &KNOWNFOLDERID{0xdbe8e08e, 0x3053, 0x4bbc, [8]byte{0xb1, 0x83, 0x2a, 0x7b, 0x2b, 0x19, 0x1e, 0x59}} + FOLDERID_Objects3D = &KNOWNFOLDERID{0x31c0dd25, 0x9439, 0x4f12, [8]byte{0xbf, 0x41, 0x7f, 0xf4, 0xed, 0xa3, 0x87, 0x22}} + FOLDERID_AppCaptures = &KNOWNFOLDERID{0xedc0fe71, 0x98d8, 0x4f4a, [8]byte{0xb9, 0x20, 0xc8, 0xdc, 0x13, 0x3c, 0xb1, 0x65}} + FOLDERID_LocalDocuments = &KNOWNFOLDERID{0xf42ee2d3, 0x909f, 0x4907, [8]byte{0x88, 0x71, 0x4c, 0x22, 0xfc, 0x0b, 0xf7, 0x56}} + FOLDERID_LocalPictures = &KNOWNFOLDERID{0x0ddd015d, 0xb06c, 0x45d5, [8]byte{0x8c, 0x4c, 0xf5, 0x97, 0x13, 0x85, 0x46, 0x39}} + FOLDERID_LocalVideos = &KNOWNFOLDERID{0x35286a68, 0x3c57, 0x41a1, [8]byte{0xbb, 0xb1, 0x0e, 0xae, 0x73, 0xd7, 0x6c, 0x95}} + FOLDERID_LocalMusic = &KNOWNFOLDERID{0xa0c69a99, 0x21c8, 0x4671, [8]byte{0x87, 0x03, 0x79, 0x34, 0x16, 0x2f, 0xcf, 0x1d}} + FOLDERID_LocalDownloads = &KNOWNFOLDERID{0x7d83ee9b, 0x2244, 0x4e70, [8]byte{0xb1, 0xf5, 0x53, 0x93, 0x04, 0x2a, 0xf1, 0xe4}} + FOLDERID_RecordedCalls = &KNOWNFOLDERID{0x2f8b40c2, 0x83ed, 0x48ee, [8]byte{0xb3, 0x83, 0xa1, 0xf1, 0x57, 0xec, 0x6f, 0x9a}} + FOLDERID_AllAppMods = &KNOWNFOLDERID{0x7ad67899, 0x66af, 0x43ba, [8]byte{0x91, 0x56, 0x6a, 0xad, 0x42, 0xe6, 0xc5, 0x96}} + FOLDERID_CurrentAppMods = &KNOWNFOLDERID{0x3db40b20, 0x2a30, 0x4dbe, [8]byte{0x91, 0x7e, 0x77, 0x1d, 0xd2, 0x1d, 0xd0, 0x99}} + FOLDERID_AppDataDesktop = &KNOWNFOLDERID{0xb2c5e279, 0x7add, 0x439f, [8]byte{0xb2, 0x8c, 0xc4, 0x1f, 0xe1, 0xbb, 0xf6, 0x72}} + FOLDERID_AppDataDocuments = &KNOWNFOLDERID{0x7be16610, 0x1f7f, 0x44ac, [8]byte{0xbf, 0xf0, 0x83, 0xe1, 0x5f, 0x2f, 0xfc, 0xa1}} + FOLDERID_AppDataFavorites = &KNOWNFOLDERID{0x7cfbefbc, 0xde1f, 0x45aa, [8]byte{0xb8, 0x43, 0xa5, 0x42, 0xac, 0x53, 0x6c, 0xc9}} + FOLDERID_AppDataProgramData = &KNOWNFOLDERID{0x559d40a3, 0xa036, 0x40fa, [8]byte{0xaf, 0x61, 0x84, 0xcb, 0x43, 0x0a, 0x4d, 0x34}} +) diff --git a/vendor/golang.org/x/sys/windows/zsyscall_windows.go b/vendor/golang.org/x/sys/windows/zsyscall_windows.go new file mode 100644 index 00000000..fe7a4ea1 --- /dev/null +++ b/vendor/golang.org/x/sys/windows/zsyscall_windows.go @@ -0,0 +1,4757 @@ +// Code generated by 'go generate'; DO NOT EDIT. + +package windows + +import ( + "syscall" + "unsafe" +) + +var _ unsafe.Pointer + +// Do the interface allocations only once for common +// Errno values. +const ( + errnoERROR_IO_PENDING = 997 +) + +var ( + errERROR_IO_PENDING error = syscall.Errno(errnoERROR_IO_PENDING) + errERROR_EINVAL error = syscall.EINVAL +) + +// errnoErr returns common boxed Errno values, to prevent +// allocations at runtime. +func errnoErr(e syscall.Errno) error { + switch e { + case 0: + return errERROR_EINVAL + case errnoERROR_IO_PENDING: + return errERROR_IO_PENDING + } + // TODO: add more here, after collecting data on the common + // error values see on Windows. (perhaps when running + // all.bat?) + return e +} + +var ( + modCfgMgr32 = NewLazySystemDLL("CfgMgr32.dll") + modadvapi32 = NewLazySystemDLL("advapi32.dll") + modcrypt32 = NewLazySystemDLL("crypt32.dll") + moddnsapi = NewLazySystemDLL("dnsapi.dll") + moddwmapi = NewLazySystemDLL("dwmapi.dll") + modiphlpapi = NewLazySystemDLL("iphlpapi.dll") + modkernel32 = NewLazySystemDLL("kernel32.dll") + modmswsock = NewLazySystemDLL("mswsock.dll") + modnetapi32 = NewLazySystemDLL("netapi32.dll") + modntdll = NewLazySystemDLL("ntdll.dll") + modole32 = NewLazySystemDLL("ole32.dll") + modpsapi = NewLazySystemDLL("psapi.dll") + modsechost = NewLazySystemDLL("sechost.dll") + modsecur32 = NewLazySystemDLL("secur32.dll") + modsetupapi = NewLazySystemDLL("setupapi.dll") + modshell32 = NewLazySystemDLL("shell32.dll") + moduser32 = NewLazySystemDLL("user32.dll") + moduserenv = NewLazySystemDLL("userenv.dll") + modversion = NewLazySystemDLL("version.dll") + modwinmm = NewLazySystemDLL("winmm.dll") + modwintrust = NewLazySystemDLL("wintrust.dll") + modws2_32 = NewLazySystemDLL("ws2_32.dll") + modwtsapi32 = NewLazySystemDLL("wtsapi32.dll") + + procCM_Get_DevNode_Status = modCfgMgr32.NewProc("CM_Get_DevNode_Status") + procCM_Get_Device_Interface_ListW = modCfgMgr32.NewProc("CM_Get_Device_Interface_ListW") + procCM_Get_Device_Interface_List_SizeW = modCfgMgr32.NewProc("CM_Get_Device_Interface_List_SizeW") + procCM_MapCrToWin32Err = modCfgMgr32.NewProc("CM_MapCrToWin32Err") + procAdjustTokenGroups = modadvapi32.NewProc("AdjustTokenGroups") + procAdjustTokenPrivileges = modadvapi32.NewProc("AdjustTokenPrivileges") + procAllocateAndInitializeSid = modadvapi32.NewProc("AllocateAndInitializeSid") + procBuildSecurityDescriptorW = modadvapi32.NewProc("BuildSecurityDescriptorW") + procChangeServiceConfig2W = modadvapi32.NewProc("ChangeServiceConfig2W") + procChangeServiceConfigW = modadvapi32.NewProc("ChangeServiceConfigW") + procCheckTokenMembership = modadvapi32.NewProc("CheckTokenMembership") + procCloseServiceHandle = modadvapi32.NewProc("CloseServiceHandle") + procControlService = modadvapi32.NewProc("ControlService") + procConvertSecurityDescriptorToStringSecurityDescriptorW = modadvapi32.NewProc("ConvertSecurityDescriptorToStringSecurityDescriptorW") + procConvertSidToStringSidW = modadvapi32.NewProc("ConvertSidToStringSidW") + procConvertStringSecurityDescriptorToSecurityDescriptorW = modadvapi32.NewProc("ConvertStringSecurityDescriptorToSecurityDescriptorW") + procConvertStringSidToSidW = modadvapi32.NewProc("ConvertStringSidToSidW") + procCopySid = modadvapi32.NewProc("CopySid") + procCreateProcessAsUserW = modadvapi32.NewProc("CreateProcessAsUserW") + procCreateServiceW = modadvapi32.NewProc("CreateServiceW") + procCreateWellKnownSid = modadvapi32.NewProc("CreateWellKnownSid") + procCryptAcquireContextW = modadvapi32.NewProc("CryptAcquireContextW") + procCryptGenRandom = modadvapi32.NewProc("CryptGenRandom") + procCryptReleaseContext = modadvapi32.NewProc("CryptReleaseContext") + procDeleteService = modadvapi32.NewProc("DeleteService") + procDeregisterEventSource = modadvapi32.NewProc("DeregisterEventSource") + procDuplicateTokenEx = modadvapi32.NewProc("DuplicateTokenEx") + procEnumDependentServicesW = modadvapi32.NewProc("EnumDependentServicesW") + procEnumServicesStatusExW = modadvapi32.NewProc("EnumServicesStatusExW") + procEqualSid = modadvapi32.NewProc("EqualSid") + procFreeSid = modadvapi32.NewProc("FreeSid") + procGetAce = modadvapi32.NewProc("GetAce") + procGetLengthSid = modadvapi32.NewProc("GetLengthSid") + procGetNamedSecurityInfoW = modadvapi32.NewProc("GetNamedSecurityInfoW") + procGetSecurityDescriptorControl = modadvapi32.NewProc("GetSecurityDescriptorControl") + procGetSecurityDescriptorDacl = modadvapi32.NewProc("GetSecurityDescriptorDacl") + procGetSecurityDescriptorGroup = modadvapi32.NewProc("GetSecurityDescriptorGroup") + procGetSecurityDescriptorLength = modadvapi32.NewProc("GetSecurityDescriptorLength") + procGetSecurityDescriptorOwner = modadvapi32.NewProc("GetSecurityDescriptorOwner") + procGetSecurityDescriptorRMControl = modadvapi32.NewProc("GetSecurityDescriptorRMControl") + procGetSecurityDescriptorSacl = modadvapi32.NewProc("GetSecurityDescriptorSacl") + procGetSecurityInfo = modadvapi32.NewProc("GetSecurityInfo") + procGetSidIdentifierAuthority = modadvapi32.NewProc("GetSidIdentifierAuthority") + procGetSidSubAuthority = modadvapi32.NewProc("GetSidSubAuthority") + procGetSidSubAuthorityCount = modadvapi32.NewProc("GetSidSubAuthorityCount") + procGetTokenInformation = modadvapi32.NewProc("GetTokenInformation") + procImpersonateSelf = modadvapi32.NewProc("ImpersonateSelf") + procInitializeSecurityDescriptor = modadvapi32.NewProc("InitializeSecurityDescriptor") + procInitiateSystemShutdownExW = modadvapi32.NewProc("InitiateSystemShutdownExW") + procIsTokenRestricted = modadvapi32.NewProc("IsTokenRestricted") + procIsValidSecurityDescriptor = modadvapi32.NewProc("IsValidSecurityDescriptor") + procIsValidSid = modadvapi32.NewProc("IsValidSid") + procIsWellKnownSid = modadvapi32.NewProc("IsWellKnownSid") + procLookupAccountNameW = modadvapi32.NewProc("LookupAccountNameW") + procLookupAccountSidW = modadvapi32.NewProc("LookupAccountSidW") + procLookupPrivilegeValueW = modadvapi32.NewProc("LookupPrivilegeValueW") + procMakeAbsoluteSD = modadvapi32.NewProc("MakeAbsoluteSD") + procMakeSelfRelativeSD = modadvapi32.NewProc("MakeSelfRelativeSD") + procNotifyServiceStatusChangeW = modadvapi32.NewProc("NotifyServiceStatusChangeW") + procOpenProcessToken = modadvapi32.NewProc("OpenProcessToken") + procOpenSCManagerW = modadvapi32.NewProc("OpenSCManagerW") + procOpenServiceW = modadvapi32.NewProc("OpenServiceW") + procOpenThreadToken = modadvapi32.NewProc("OpenThreadToken") + procQueryServiceConfig2W = modadvapi32.NewProc("QueryServiceConfig2W") + procQueryServiceConfigW = modadvapi32.NewProc("QueryServiceConfigW") + procQueryServiceDynamicInformation = modadvapi32.NewProc("QueryServiceDynamicInformation") + procQueryServiceLockStatusW = modadvapi32.NewProc("QueryServiceLockStatusW") + procQueryServiceStatus = modadvapi32.NewProc("QueryServiceStatus") + procQueryServiceStatusEx = modadvapi32.NewProc("QueryServiceStatusEx") + procRegCloseKey = modadvapi32.NewProc("RegCloseKey") + procRegEnumKeyExW = modadvapi32.NewProc("RegEnumKeyExW") + procRegNotifyChangeKeyValue = modadvapi32.NewProc("RegNotifyChangeKeyValue") + procRegOpenKeyExW = modadvapi32.NewProc("RegOpenKeyExW") + procRegQueryInfoKeyW = modadvapi32.NewProc("RegQueryInfoKeyW") + procRegQueryValueExW = modadvapi32.NewProc("RegQueryValueExW") + procRegisterEventSourceW = modadvapi32.NewProc("RegisterEventSourceW") + procRegisterServiceCtrlHandlerExW = modadvapi32.NewProc("RegisterServiceCtrlHandlerExW") + procReportEventW = modadvapi32.NewProc("ReportEventW") + procRevertToSelf = modadvapi32.NewProc("RevertToSelf") + procSetEntriesInAclW = modadvapi32.NewProc("SetEntriesInAclW") + procSetKernelObjectSecurity = modadvapi32.NewProc("SetKernelObjectSecurity") + procSetNamedSecurityInfoW = modadvapi32.NewProc("SetNamedSecurityInfoW") + procSetSecurityDescriptorControl = modadvapi32.NewProc("SetSecurityDescriptorControl") + procSetSecurityDescriptorDacl = modadvapi32.NewProc("SetSecurityDescriptorDacl") + procSetSecurityDescriptorGroup = modadvapi32.NewProc("SetSecurityDescriptorGroup") + procSetSecurityDescriptorOwner = modadvapi32.NewProc("SetSecurityDescriptorOwner") + procSetSecurityDescriptorRMControl = modadvapi32.NewProc("SetSecurityDescriptorRMControl") + procSetSecurityDescriptorSacl = modadvapi32.NewProc("SetSecurityDescriptorSacl") + procSetSecurityInfo = modadvapi32.NewProc("SetSecurityInfo") + procSetServiceStatus = modadvapi32.NewProc("SetServiceStatus") + procSetThreadToken = modadvapi32.NewProc("SetThreadToken") + procSetTokenInformation = modadvapi32.NewProc("SetTokenInformation") + procStartServiceCtrlDispatcherW = modadvapi32.NewProc("StartServiceCtrlDispatcherW") + procStartServiceW = modadvapi32.NewProc("StartServiceW") + procCertAddCertificateContextToStore = modcrypt32.NewProc("CertAddCertificateContextToStore") + procCertCloseStore = modcrypt32.NewProc("CertCloseStore") + procCertCreateCertificateContext = modcrypt32.NewProc("CertCreateCertificateContext") + procCertDeleteCertificateFromStore = modcrypt32.NewProc("CertDeleteCertificateFromStore") + procCertDuplicateCertificateContext = modcrypt32.NewProc("CertDuplicateCertificateContext") + procCertEnumCertificatesInStore = modcrypt32.NewProc("CertEnumCertificatesInStore") + procCertFindCertificateInStore = modcrypt32.NewProc("CertFindCertificateInStore") + procCertFindChainInStore = modcrypt32.NewProc("CertFindChainInStore") + procCertFindExtension = modcrypt32.NewProc("CertFindExtension") + procCertFreeCertificateChain = modcrypt32.NewProc("CertFreeCertificateChain") + procCertFreeCertificateContext = modcrypt32.NewProc("CertFreeCertificateContext") + procCertGetCertificateChain = modcrypt32.NewProc("CertGetCertificateChain") + procCertGetNameStringW = modcrypt32.NewProc("CertGetNameStringW") + procCertOpenStore = modcrypt32.NewProc("CertOpenStore") + procCertOpenSystemStoreW = modcrypt32.NewProc("CertOpenSystemStoreW") + procCertVerifyCertificateChainPolicy = modcrypt32.NewProc("CertVerifyCertificateChainPolicy") + procCryptAcquireCertificatePrivateKey = modcrypt32.NewProc("CryptAcquireCertificatePrivateKey") + procCryptDecodeObject = modcrypt32.NewProc("CryptDecodeObject") + procCryptProtectData = modcrypt32.NewProc("CryptProtectData") + procCryptQueryObject = modcrypt32.NewProc("CryptQueryObject") + procCryptUnprotectData = modcrypt32.NewProc("CryptUnprotectData") + procPFXImportCertStore = modcrypt32.NewProc("PFXImportCertStore") + procDnsNameCompare_W = moddnsapi.NewProc("DnsNameCompare_W") + procDnsQuery_W = moddnsapi.NewProc("DnsQuery_W") + procDnsRecordListFree = moddnsapi.NewProc("DnsRecordListFree") + procDwmGetWindowAttribute = moddwmapi.NewProc("DwmGetWindowAttribute") + procDwmSetWindowAttribute = moddwmapi.NewProc("DwmSetWindowAttribute") + procCancelMibChangeNotify2 = modiphlpapi.NewProc("CancelMibChangeNotify2") + procFreeMibTable = modiphlpapi.NewProc("FreeMibTable") + procGetAdaptersAddresses = modiphlpapi.NewProc("GetAdaptersAddresses") + procGetAdaptersInfo = modiphlpapi.NewProc("GetAdaptersInfo") + procGetBestInterfaceEx = modiphlpapi.NewProc("GetBestInterfaceEx") + procGetIfEntry = modiphlpapi.NewProc("GetIfEntry") + procGetIfEntry2Ex = modiphlpapi.NewProc("GetIfEntry2Ex") + procGetIpForwardEntry2 = modiphlpapi.NewProc("GetIpForwardEntry2") + procGetIpForwardTable2 = modiphlpapi.NewProc("GetIpForwardTable2") + procGetUnicastIpAddressEntry = modiphlpapi.NewProc("GetUnicastIpAddressEntry") + procNotifyIpInterfaceChange = modiphlpapi.NewProc("NotifyIpInterfaceChange") + procNotifyRouteChange2 = modiphlpapi.NewProc("NotifyRouteChange2") + procNotifyUnicastIpAddressChange = modiphlpapi.NewProc("NotifyUnicastIpAddressChange") + procAddDllDirectory = modkernel32.NewProc("AddDllDirectory") + procAssignProcessToJobObject = modkernel32.NewProc("AssignProcessToJobObject") + procCancelIo = modkernel32.NewProc("CancelIo") + procCancelIoEx = modkernel32.NewProc("CancelIoEx") + procClearCommBreak = modkernel32.NewProc("ClearCommBreak") + procClearCommError = modkernel32.NewProc("ClearCommError") + procCloseHandle = modkernel32.NewProc("CloseHandle") + procClosePseudoConsole = modkernel32.NewProc("ClosePseudoConsole") + procConnectNamedPipe = modkernel32.NewProc("ConnectNamedPipe") + procCreateDirectoryW = modkernel32.NewProc("CreateDirectoryW") + procCreateEventExW = modkernel32.NewProc("CreateEventExW") + procCreateEventW = modkernel32.NewProc("CreateEventW") + procCreateFileMappingW = modkernel32.NewProc("CreateFileMappingW") + procCreateFileW = modkernel32.NewProc("CreateFileW") + procCreateHardLinkW = modkernel32.NewProc("CreateHardLinkW") + procCreateIoCompletionPort = modkernel32.NewProc("CreateIoCompletionPort") + procCreateJobObjectW = modkernel32.NewProc("CreateJobObjectW") + procCreateMutexExW = modkernel32.NewProc("CreateMutexExW") + procCreateMutexW = modkernel32.NewProc("CreateMutexW") + procCreateNamedPipeW = modkernel32.NewProc("CreateNamedPipeW") + procCreatePipe = modkernel32.NewProc("CreatePipe") + procCreateProcessW = modkernel32.NewProc("CreateProcessW") + procCreatePseudoConsole = modkernel32.NewProc("CreatePseudoConsole") + procCreateSymbolicLinkW = modkernel32.NewProc("CreateSymbolicLinkW") + procCreateToolhelp32Snapshot = modkernel32.NewProc("CreateToolhelp32Snapshot") + procDefineDosDeviceW = modkernel32.NewProc("DefineDosDeviceW") + procDeleteFileW = modkernel32.NewProc("DeleteFileW") + procDeleteProcThreadAttributeList = modkernel32.NewProc("DeleteProcThreadAttributeList") + procDeleteVolumeMountPointW = modkernel32.NewProc("DeleteVolumeMountPointW") + procDeviceIoControl = modkernel32.NewProc("DeviceIoControl") + procDisconnectNamedPipe = modkernel32.NewProc("DisconnectNamedPipe") + procDuplicateHandle = modkernel32.NewProc("DuplicateHandle") + procEscapeCommFunction = modkernel32.NewProc("EscapeCommFunction") + procExitProcess = modkernel32.NewProc("ExitProcess") + procExpandEnvironmentStringsW = modkernel32.NewProc("ExpandEnvironmentStringsW") + procFindClose = modkernel32.NewProc("FindClose") + procFindCloseChangeNotification = modkernel32.NewProc("FindCloseChangeNotification") + procFindFirstChangeNotificationW = modkernel32.NewProc("FindFirstChangeNotificationW") + procFindFirstFileW = modkernel32.NewProc("FindFirstFileW") + procFindFirstVolumeMountPointW = modkernel32.NewProc("FindFirstVolumeMountPointW") + procFindFirstVolumeW = modkernel32.NewProc("FindFirstVolumeW") + procFindNextChangeNotification = modkernel32.NewProc("FindNextChangeNotification") + procFindNextFileW = modkernel32.NewProc("FindNextFileW") + procFindNextVolumeMountPointW = modkernel32.NewProc("FindNextVolumeMountPointW") + procFindNextVolumeW = modkernel32.NewProc("FindNextVolumeW") + procFindResourceW = modkernel32.NewProc("FindResourceW") + procFindVolumeClose = modkernel32.NewProc("FindVolumeClose") + procFindVolumeMountPointClose = modkernel32.NewProc("FindVolumeMountPointClose") + procFlushConsoleInputBuffer = modkernel32.NewProc("FlushConsoleInputBuffer") + procFlushFileBuffers = modkernel32.NewProc("FlushFileBuffers") + procFlushViewOfFile = modkernel32.NewProc("FlushViewOfFile") + procFormatMessageW = modkernel32.NewProc("FormatMessageW") + procFreeEnvironmentStringsW = modkernel32.NewProc("FreeEnvironmentStringsW") + procFreeLibrary = modkernel32.NewProc("FreeLibrary") + procGenerateConsoleCtrlEvent = modkernel32.NewProc("GenerateConsoleCtrlEvent") + procGetACP = modkernel32.NewProc("GetACP") + procGetActiveProcessorCount = modkernel32.NewProc("GetActiveProcessorCount") + procGetCommModemStatus = modkernel32.NewProc("GetCommModemStatus") + procGetCommState = modkernel32.NewProc("GetCommState") + procGetCommTimeouts = modkernel32.NewProc("GetCommTimeouts") + procGetCommandLineW = modkernel32.NewProc("GetCommandLineW") + procGetComputerNameExW = modkernel32.NewProc("GetComputerNameExW") + procGetComputerNameW = modkernel32.NewProc("GetComputerNameW") + procGetConsoleCP = modkernel32.NewProc("GetConsoleCP") + procGetConsoleMode = modkernel32.NewProc("GetConsoleMode") + procGetConsoleOutputCP = modkernel32.NewProc("GetConsoleOutputCP") + procGetConsoleScreenBufferInfo = modkernel32.NewProc("GetConsoleScreenBufferInfo") + procGetCurrentDirectoryW = modkernel32.NewProc("GetCurrentDirectoryW") + procGetCurrentProcessId = modkernel32.NewProc("GetCurrentProcessId") + procGetCurrentThreadId = modkernel32.NewProc("GetCurrentThreadId") + procGetDiskFreeSpaceExW = modkernel32.NewProc("GetDiskFreeSpaceExW") + procGetDriveTypeW = modkernel32.NewProc("GetDriveTypeW") + procGetEnvironmentStringsW = modkernel32.NewProc("GetEnvironmentStringsW") + procGetEnvironmentVariableW = modkernel32.NewProc("GetEnvironmentVariableW") + procGetExitCodeProcess = modkernel32.NewProc("GetExitCodeProcess") + procGetFileAttributesExW = modkernel32.NewProc("GetFileAttributesExW") + procGetFileAttributesW = modkernel32.NewProc("GetFileAttributesW") + procGetFileInformationByHandle = modkernel32.NewProc("GetFileInformationByHandle") + procGetFileInformationByHandleEx = modkernel32.NewProc("GetFileInformationByHandleEx") + procGetFileTime = modkernel32.NewProc("GetFileTime") + procGetFileType = modkernel32.NewProc("GetFileType") + procGetFinalPathNameByHandleW = modkernel32.NewProc("GetFinalPathNameByHandleW") + procGetFullPathNameW = modkernel32.NewProc("GetFullPathNameW") + procGetLargePageMinimum = modkernel32.NewProc("GetLargePageMinimum") + procGetLastError = modkernel32.NewProc("GetLastError") + procGetLogicalDriveStringsW = modkernel32.NewProc("GetLogicalDriveStringsW") + procGetLogicalDrives = modkernel32.NewProc("GetLogicalDrives") + procGetLongPathNameW = modkernel32.NewProc("GetLongPathNameW") + procGetMaximumProcessorCount = modkernel32.NewProc("GetMaximumProcessorCount") + procGetModuleFileNameW = modkernel32.NewProc("GetModuleFileNameW") + procGetModuleHandleExW = modkernel32.NewProc("GetModuleHandleExW") + procGetNamedPipeClientProcessId = modkernel32.NewProc("GetNamedPipeClientProcessId") + procGetNamedPipeHandleStateW = modkernel32.NewProc("GetNamedPipeHandleStateW") + procGetNamedPipeInfo = modkernel32.NewProc("GetNamedPipeInfo") + procGetNamedPipeServerProcessId = modkernel32.NewProc("GetNamedPipeServerProcessId") + procGetNumberOfConsoleInputEvents = modkernel32.NewProc("GetNumberOfConsoleInputEvents") + procGetOverlappedResult = modkernel32.NewProc("GetOverlappedResult") + procGetPriorityClass = modkernel32.NewProc("GetPriorityClass") + procGetProcAddress = modkernel32.NewProc("GetProcAddress") + procGetProcessId = modkernel32.NewProc("GetProcessId") + procGetProcessPreferredUILanguages = modkernel32.NewProc("GetProcessPreferredUILanguages") + procGetProcessShutdownParameters = modkernel32.NewProc("GetProcessShutdownParameters") + procGetProcessTimes = modkernel32.NewProc("GetProcessTimes") + procGetProcessWorkingSetSizeEx = modkernel32.NewProc("GetProcessWorkingSetSizeEx") + procGetQueuedCompletionStatus = modkernel32.NewProc("GetQueuedCompletionStatus") + procGetShortPathNameW = modkernel32.NewProc("GetShortPathNameW") + procGetStartupInfoW = modkernel32.NewProc("GetStartupInfoW") + procGetStdHandle = modkernel32.NewProc("GetStdHandle") + procGetSystemDirectoryW = modkernel32.NewProc("GetSystemDirectoryW") + procGetSystemPreferredUILanguages = modkernel32.NewProc("GetSystemPreferredUILanguages") + procGetSystemTimeAsFileTime = modkernel32.NewProc("GetSystemTimeAsFileTime") + procGetSystemTimePreciseAsFileTime = modkernel32.NewProc("GetSystemTimePreciseAsFileTime") + procGetSystemWindowsDirectoryW = modkernel32.NewProc("GetSystemWindowsDirectoryW") + procGetTempPathW = modkernel32.NewProc("GetTempPathW") + procGetThreadPreferredUILanguages = modkernel32.NewProc("GetThreadPreferredUILanguages") + procGetTickCount64 = modkernel32.NewProc("GetTickCount64") + procGetTimeZoneInformation = modkernel32.NewProc("GetTimeZoneInformation") + procGetUserPreferredUILanguages = modkernel32.NewProc("GetUserPreferredUILanguages") + procGetVersion = modkernel32.NewProc("GetVersion") + procGetVolumeInformationByHandleW = modkernel32.NewProc("GetVolumeInformationByHandleW") + procGetVolumeInformationW = modkernel32.NewProc("GetVolumeInformationW") + procGetVolumeNameForVolumeMountPointW = modkernel32.NewProc("GetVolumeNameForVolumeMountPointW") + procGetVolumePathNameW = modkernel32.NewProc("GetVolumePathNameW") + procGetVolumePathNamesForVolumeNameW = modkernel32.NewProc("GetVolumePathNamesForVolumeNameW") + procGetWindowsDirectoryW = modkernel32.NewProc("GetWindowsDirectoryW") + procInitializeProcThreadAttributeList = modkernel32.NewProc("InitializeProcThreadAttributeList") + procIsProcessorFeaturePresent = modkernel32.NewProc("IsProcessorFeaturePresent") + procIsWow64Process = modkernel32.NewProc("IsWow64Process") + procIsWow64Process2 = modkernel32.NewProc("IsWow64Process2") + procLoadLibraryExW = modkernel32.NewProc("LoadLibraryExW") + procLoadLibraryW = modkernel32.NewProc("LoadLibraryW") + procLoadResource = modkernel32.NewProc("LoadResource") + procLocalAlloc = modkernel32.NewProc("LocalAlloc") + procLocalFree = modkernel32.NewProc("LocalFree") + procLockFileEx = modkernel32.NewProc("LockFileEx") + procLockResource = modkernel32.NewProc("LockResource") + procMapViewOfFile = modkernel32.NewProc("MapViewOfFile") + procModule32FirstW = modkernel32.NewProc("Module32FirstW") + procModule32NextW = modkernel32.NewProc("Module32NextW") + procMoveFileExW = modkernel32.NewProc("MoveFileExW") + procMoveFileW = modkernel32.NewProc("MoveFileW") + procMultiByteToWideChar = modkernel32.NewProc("MultiByteToWideChar") + procOpenEventW = modkernel32.NewProc("OpenEventW") + procOpenMutexW = modkernel32.NewProc("OpenMutexW") + procOpenProcess = modkernel32.NewProc("OpenProcess") + procOpenThread = modkernel32.NewProc("OpenThread") + procPostQueuedCompletionStatus = modkernel32.NewProc("PostQueuedCompletionStatus") + procProcess32FirstW = modkernel32.NewProc("Process32FirstW") + procProcess32NextW = modkernel32.NewProc("Process32NextW") + procProcessIdToSessionId = modkernel32.NewProc("ProcessIdToSessionId") + procPulseEvent = modkernel32.NewProc("PulseEvent") + procPurgeComm = modkernel32.NewProc("PurgeComm") + procQueryDosDeviceW = modkernel32.NewProc("QueryDosDeviceW") + procQueryFullProcessImageNameW = modkernel32.NewProc("QueryFullProcessImageNameW") + procQueryInformationJobObject = modkernel32.NewProc("QueryInformationJobObject") + procReadConsoleW = modkernel32.NewProc("ReadConsoleW") + procReadDirectoryChangesW = modkernel32.NewProc("ReadDirectoryChangesW") + procReadFile = modkernel32.NewProc("ReadFile") + procReadProcessMemory = modkernel32.NewProc("ReadProcessMemory") + procReleaseMutex = modkernel32.NewProc("ReleaseMutex") + procRemoveDirectoryW = modkernel32.NewProc("RemoveDirectoryW") + procRemoveDllDirectory = modkernel32.NewProc("RemoveDllDirectory") + procResetEvent = modkernel32.NewProc("ResetEvent") + procResizePseudoConsole = modkernel32.NewProc("ResizePseudoConsole") + procResumeThread = modkernel32.NewProc("ResumeThread") + procSetCommBreak = modkernel32.NewProc("SetCommBreak") + procSetCommMask = modkernel32.NewProc("SetCommMask") + procSetCommState = modkernel32.NewProc("SetCommState") + procSetCommTimeouts = modkernel32.NewProc("SetCommTimeouts") + procSetConsoleCP = modkernel32.NewProc("SetConsoleCP") + procSetConsoleCursorPosition = modkernel32.NewProc("SetConsoleCursorPosition") + procSetConsoleMode = modkernel32.NewProc("SetConsoleMode") + procSetConsoleOutputCP = modkernel32.NewProc("SetConsoleOutputCP") + procSetCurrentDirectoryW = modkernel32.NewProc("SetCurrentDirectoryW") + procSetDefaultDllDirectories = modkernel32.NewProc("SetDefaultDllDirectories") + procSetDllDirectoryW = modkernel32.NewProc("SetDllDirectoryW") + procSetEndOfFile = modkernel32.NewProc("SetEndOfFile") + procSetEnvironmentVariableW = modkernel32.NewProc("SetEnvironmentVariableW") + procSetErrorMode = modkernel32.NewProc("SetErrorMode") + procSetEvent = modkernel32.NewProc("SetEvent") + procSetFileAttributesW = modkernel32.NewProc("SetFileAttributesW") + procSetFileCompletionNotificationModes = modkernel32.NewProc("SetFileCompletionNotificationModes") + procSetFileInformationByHandle = modkernel32.NewProc("SetFileInformationByHandle") + procSetFilePointer = modkernel32.NewProc("SetFilePointer") + procSetFileTime = modkernel32.NewProc("SetFileTime") + procSetFileValidData = modkernel32.NewProc("SetFileValidData") + procSetHandleInformation = modkernel32.NewProc("SetHandleInformation") + procSetInformationJobObject = modkernel32.NewProc("SetInformationJobObject") + procSetNamedPipeHandleState = modkernel32.NewProc("SetNamedPipeHandleState") + procSetPriorityClass = modkernel32.NewProc("SetPriorityClass") + procSetProcessPriorityBoost = modkernel32.NewProc("SetProcessPriorityBoost") + procSetProcessShutdownParameters = modkernel32.NewProc("SetProcessShutdownParameters") + procSetProcessWorkingSetSizeEx = modkernel32.NewProc("SetProcessWorkingSetSizeEx") + procSetStdHandle = modkernel32.NewProc("SetStdHandle") + procSetVolumeLabelW = modkernel32.NewProc("SetVolumeLabelW") + procSetVolumeMountPointW = modkernel32.NewProc("SetVolumeMountPointW") + procSetupComm = modkernel32.NewProc("SetupComm") + procSizeofResource = modkernel32.NewProc("SizeofResource") + procSleepEx = modkernel32.NewProc("SleepEx") + procTerminateJobObject = modkernel32.NewProc("TerminateJobObject") + procTerminateProcess = modkernel32.NewProc("TerminateProcess") + procThread32First = modkernel32.NewProc("Thread32First") + procThread32Next = modkernel32.NewProc("Thread32Next") + procUnlockFileEx = modkernel32.NewProc("UnlockFileEx") + procUnmapViewOfFile = modkernel32.NewProc("UnmapViewOfFile") + procUpdateProcThreadAttribute = modkernel32.NewProc("UpdateProcThreadAttribute") + procVirtualAlloc = modkernel32.NewProc("VirtualAlloc") + procVirtualFree = modkernel32.NewProc("VirtualFree") + procVirtualLock = modkernel32.NewProc("VirtualLock") + procVirtualProtect = modkernel32.NewProc("VirtualProtect") + procVirtualProtectEx = modkernel32.NewProc("VirtualProtectEx") + procVirtualQuery = modkernel32.NewProc("VirtualQuery") + procVirtualQueryEx = modkernel32.NewProc("VirtualQueryEx") + procVirtualUnlock = modkernel32.NewProc("VirtualUnlock") + procWTSGetActiveConsoleSessionId = modkernel32.NewProc("WTSGetActiveConsoleSessionId") + procWaitCommEvent = modkernel32.NewProc("WaitCommEvent") + procWaitForMultipleObjects = modkernel32.NewProc("WaitForMultipleObjects") + procWaitForSingleObject = modkernel32.NewProc("WaitForSingleObject") + procWriteConsoleW = modkernel32.NewProc("WriteConsoleW") + procWriteFile = modkernel32.NewProc("WriteFile") + procWriteProcessMemory = modkernel32.NewProc("WriteProcessMemory") + procAcceptEx = modmswsock.NewProc("AcceptEx") + procGetAcceptExSockaddrs = modmswsock.NewProc("GetAcceptExSockaddrs") + procTransmitFile = modmswsock.NewProc("TransmitFile") + procNetApiBufferFree = modnetapi32.NewProc("NetApiBufferFree") + procNetGetJoinInformation = modnetapi32.NewProc("NetGetJoinInformation") + procNetUserEnum = modnetapi32.NewProc("NetUserEnum") + procNetUserGetInfo = modnetapi32.NewProc("NetUserGetInfo") + procNtCreateFile = modntdll.NewProc("NtCreateFile") + procNtCreateNamedPipeFile = modntdll.NewProc("NtCreateNamedPipeFile") + procNtQueryInformationProcess = modntdll.NewProc("NtQueryInformationProcess") + procNtQuerySystemInformation = modntdll.NewProc("NtQuerySystemInformation") + procNtSetInformationFile = modntdll.NewProc("NtSetInformationFile") + procNtSetInformationProcess = modntdll.NewProc("NtSetInformationProcess") + procNtSetSystemInformation = modntdll.NewProc("NtSetSystemInformation") + procRtlAddFunctionTable = modntdll.NewProc("RtlAddFunctionTable") + procRtlDefaultNpAcl = modntdll.NewProc("RtlDefaultNpAcl") + procRtlDeleteFunctionTable = modntdll.NewProc("RtlDeleteFunctionTable") + procRtlDosPathNameToNtPathName_U_WithStatus = modntdll.NewProc("RtlDosPathNameToNtPathName_U_WithStatus") + procRtlDosPathNameToRelativeNtPathName_U_WithStatus = modntdll.NewProc("RtlDosPathNameToRelativeNtPathName_U_WithStatus") + procRtlGetCurrentPeb = modntdll.NewProc("RtlGetCurrentPeb") + procRtlGetNtVersionNumbers = modntdll.NewProc("RtlGetNtVersionNumbers") + procRtlGetVersion = modntdll.NewProc("RtlGetVersion") + procRtlInitString = modntdll.NewProc("RtlInitString") + procRtlInitUnicodeString = modntdll.NewProc("RtlInitUnicodeString") + procRtlNtStatusToDosErrorNoTeb = modntdll.NewProc("RtlNtStatusToDosErrorNoTeb") + procCLSIDFromString = modole32.NewProc("CLSIDFromString") + procCoCreateGuid = modole32.NewProc("CoCreateGuid") + procCoGetObject = modole32.NewProc("CoGetObject") + procCoInitializeEx = modole32.NewProc("CoInitializeEx") + procCoTaskMemFree = modole32.NewProc("CoTaskMemFree") + procCoUninitialize = modole32.NewProc("CoUninitialize") + procStringFromGUID2 = modole32.NewProc("StringFromGUID2") + procEnumProcessModules = modpsapi.NewProc("EnumProcessModules") + procEnumProcessModulesEx = modpsapi.NewProc("EnumProcessModulesEx") + procEnumProcesses = modpsapi.NewProc("EnumProcesses") + procGetModuleBaseNameW = modpsapi.NewProc("GetModuleBaseNameW") + procGetModuleFileNameExW = modpsapi.NewProc("GetModuleFileNameExW") + procGetModuleInformation = modpsapi.NewProc("GetModuleInformation") + procQueryWorkingSetEx = modpsapi.NewProc("QueryWorkingSetEx") + procSubscribeServiceChangeNotifications = modsechost.NewProc("SubscribeServiceChangeNotifications") + procUnsubscribeServiceChangeNotifications = modsechost.NewProc("UnsubscribeServiceChangeNotifications") + procGetUserNameExW = modsecur32.NewProc("GetUserNameExW") + procTranslateNameW = modsecur32.NewProc("TranslateNameW") + procSetupDiBuildDriverInfoList = modsetupapi.NewProc("SetupDiBuildDriverInfoList") + procSetupDiCallClassInstaller = modsetupapi.NewProc("SetupDiCallClassInstaller") + procSetupDiCancelDriverInfoSearch = modsetupapi.NewProc("SetupDiCancelDriverInfoSearch") + procSetupDiClassGuidsFromNameExW = modsetupapi.NewProc("SetupDiClassGuidsFromNameExW") + procSetupDiClassNameFromGuidExW = modsetupapi.NewProc("SetupDiClassNameFromGuidExW") + procSetupDiCreateDeviceInfoListExW = modsetupapi.NewProc("SetupDiCreateDeviceInfoListExW") + procSetupDiCreateDeviceInfoW = modsetupapi.NewProc("SetupDiCreateDeviceInfoW") + procSetupDiDestroyDeviceInfoList = modsetupapi.NewProc("SetupDiDestroyDeviceInfoList") + procSetupDiDestroyDriverInfoList = modsetupapi.NewProc("SetupDiDestroyDriverInfoList") + procSetupDiEnumDeviceInfo = modsetupapi.NewProc("SetupDiEnumDeviceInfo") + procSetupDiEnumDriverInfoW = modsetupapi.NewProc("SetupDiEnumDriverInfoW") + procSetupDiGetClassDevsExW = modsetupapi.NewProc("SetupDiGetClassDevsExW") + procSetupDiGetClassInstallParamsW = modsetupapi.NewProc("SetupDiGetClassInstallParamsW") + procSetupDiGetDeviceInfoListDetailW = modsetupapi.NewProc("SetupDiGetDeviceInfoListDetailW") + procSetupDiGetDeviceInstallParamsW = modsetupapi.NewProc("SetupDiGetDeviceInstallParamsW") + procSetupDiGetDeviceInstanceIdW = modsetupapi.NewProc("SetupDiGetDeviceInstanceIdW") + procSetupDiGetDevicePropertyW = modsetupapi.NewProc("SetupDiGetDevicePropertyW") + procSetupDiGetDeviceRegistryPropertyW = modsetupapi.NewProc("SetupDiGetDeviceRegistryPropertyW") + procSetupDiGetDriverInfoDetailW = modsetupapi.NewProc("SetupDiGetDriverInfoDetailW") + procSetupDiGetSelectedDevice = modsetupapi.NewProc("SetupDiGetSelectedDevice") + procSetupDiGetSelectedDriverW = modsetupapi.NewProc("SetupDiGetSelectedDriverW") + procSetupDiOpenDevRegKey = modsetupapi.NewProc("SetupDiOpenDevRegKey") + procSetupDiSetClassInstallParamsW = modsetupapi.NewProc("SetupDiSetClassInstallParamsW") + procSetupDiSetDeviceInstallParamsW = modsetupapi.NewProc("SetupDiSetDeviceInstallParamsW") + procSetupDiSetDeviceRegistryPropertyW = modsetupapi.NewProc("SetupDiSetDeviceRegistryPropertyW") + procSetupDiSetSelectedDevice = modsetupapi.NewProc("SetupDiSetSelectedDevice") + procSetupDiSetSelectedDriverW = modsetupapi.NewProc("SetupDiSetSelectedDriverW") + procSetupUninstallOEMInfW = modsetupapi.NewProc("SetupUninstallOEMInfW") + procCommandLineToArgvW = modshell32.NewProc("CommandLineToArgvW") + procSHGetKnownFolderPath = modshell32.NewProc("SHGetKnownFolderPath") + procShellExecuteW = modshell32.NewProc("ShellExecuteW") + procEnumChildWindows = moduser32.NewProc("EnumChildWindows") + procEnumWindows = moduser32.NewProc("EnumWindows") + procExitWindowsEx = moduser32.NewProc("ExitWindowsEx") + procGetClassNameW = moduser32.NewProc("GetClassNameW") + procGetDesktopWindow = moduser32.NewProc("GetDesktopWindow") + procGetForegroundWindow = moduser32.NewProc("GetForegroundWindow") + procGetGUIThreadInfo = moduser32.NewProc("GetGUIThreadInfo") + procGetKeyboardLayout = moduser32.NewProc("GetKeyboardLayout") + procGetShellWindow = moduser32.NewProc("GetShellWindow") + procGetWindowThreadProcessId = moduser32.NewProc("GetWindowThreadProcessId") + procIsWindow = moduser32.NewProc("IsWindow") + procIsWindowUnicode = moduser32.NewProc("IsWindowUnicode") + procIsWindowVisible = moduser32.NewProc("IsWindowVisible") + procLoadKeyboardLayoutW = moduser32.NewProc("LoadKeyboardLayoutW") + procMessageBoxW = moduser32.NewProc("MessageBoxW") + procToUnicodeEx = moduser32.NewProc("ToUnicodeEx") + procUnloadKeyboardLayout = moduser32.NewProc("UnloadKeyboardLayout") + procCreateEnvironmentBlock = moduserenv.NewProc("CreateEnvironmentBlock") + procDestroyEnvironmentBlock = moduserenv.NewProc("DestroyEnvironmentBlock") + procGetUserProfileDirectoryW = moduserenv.NewProc("GetUserProfileDirectoryW") + procGetFileVersionInfoSizeW = modversion.NewProc("GetFileVersionInfoSizeW") + procGetFileVersionInfoW = modversion.NewProc("GetFileVersionInfoW") + procVerQueryValueW = modversion.NewProc("VerQueryValueW") + proctimeBeginPeriod = modwinmm.NewProc("timeBeginPeriod") + proctimeEndPeriod = modwinmm.NewProc("timeEndPeriod") + procWinVerifyTrustEx = modwintrust.NewProc("WinVerifyTrustEx") + procFreeAddrInfoW = modws2_32.NewProc("FreeAddrInfoW") + procGetAddrInfoW = modws2_32.NewProc("GetAddrInfoW") + procWSACleanup = modws2_32.NewProc("WSACleanup") + procWSADuplicateSocketW = modws2_32.NewProc("WSADuplicateSocketW") + procWSAEnumProtocolsW = modws2_32.NewProc("WSAEnumProtocolsW") + procWSAGetOverlappedResult = modws2_32.NewProc("WSAGetOverlappedResult") + procWSAIoctl = modws2_32.NewProc("WSAIoctl") + procWSALookupServiceBeginW = modws2_32.NewProc("WSALookupServiceBeginW") + procWSALookupServiceEnd = modws2_32.NewProc("WSALookupServiceEnd") + procWSALookupServiceNextW = modws2_32.NewProc("WSALookupServiceNextW") + procWSARecv = modws2_32.NewProc("WSARecv") + procWSARecvFrom = modws2_32.NewProc("WSARecvFrom") + procWSASend = modws2_32.NewProc("WSASend") + procWSASendTo = modws2_32.NewProc("WSASendTo") + procWSASocketW = modws2_32.NewProc("WSASocketW") + procWSAStartup = modws2_32.NewProc("WSAStartup") + procbind = modws2_32.NewProc("bind") + procclosesocket = modws2_32.NewProc("closesocket") + procconnect = modws2_32.NewProc("connect") + procgethostbyname = modws2_32.NewProc("gethostbyname") + procgetpeername = modws2_32.NewProc("getpeername") + procgetprotobyname = modws2_32.NewProc("getprotobyname") + procgetservbyname = modws2_32.NewProc("getservbyname") + procgetsockname = modws2_32.NewProc("getsockname") + procgetsockopt = modws2_32.NewProc("getsockopt") + proclisten = modws2_32.NewProc("listen") + procntohs = modws2_32.NewProc("ntohs") + procrecvfrom = modws2_32.NewProc("recvfrom") + procsendto = modws2_32.NewProc("sendto") + procsetsockopt = modws2_32.NewProc("setsockopt") + procshutdown = modws2_32.NewProc("shutdown") + procsocket = modws2_32.NewProc("socket") + procWTSEnumerateSessionsW = modwtsapi32.NewProc("WTSEnumerateSessionsW") + procWTSFreeMemory = modwtsapi32.NewProc("WTSFreeMemory") + procWTSQueryUserToken = modwtsapi32.NewProc("WTSQueryUserToken") +) + +func cm_Get_DevNode_Status(status *uint32, problemNumber *uint32, devInst DEVINST, flags uint32) (ret CONFIGRET) { + r0, _, _ := syscall.SyscallN(procCM_Get_DevNode_Status.Addr(), uintptr(unsafe.Pointer(status)), uintptr(unsafe.Pointer(problemNumber)), uintptr(devInst), uintptr(flags)) + ret = CONFIGRET(r0) + return +} + +func cm_Get_Device_Interface_List(interfaceClass *GUID, deviceID *uint16, buffer *uint16, bufferLen uint32, flags uint32) (ret CONFIGRET) { + r0, _, _ := syscall.SyscallN(procCM_Get_Device_Interface_ListW.Addr(), uintptr(unsafe.Pointer(interfaceClass)), uintptr(unsafe.Pointer(deviceID)), uintptr(unsafe.Pointer(buffer)), uintptr(bufferLen), uintptr(flags)) + ret = CONFIGRET(r0) + return +} + +func cm_Get_Device_Interface_List_Size(len *uint32, interfaceClass *GUID, deviceID *uint16, flags uint32) (ret CONFIGRET) { + r0, _, _ := syscall.SyscallN(procCM_Get_Device_Interface_List_SizeW.Addr(), uintptr(unsafe.Pointer(len)), uintptr(unsafe.Pointer(interfaceClass)), uintptr(unsafe.Pointer(deviceID)), uintptr(flags)) + ret = CONFIGRET(r0) + return +} + +func cm_MapCrToWin32Err(configRet CONFIGRET, defaultWin32Error Errno) (ret Errno) { + r0, _, _ := syscall.SyscallN(procCM_MapCrToWin32Err.Addr(), uintptr(configRet), uintptr(defaultWin32Error)) + ret = Errno(r0) + return +} + +func AdjustTokenGroups(token Token, resetToDefault bool, newstate *Tokengroups, buflen uint32, prevstate *Tokengroups, returnlen *uint32) (err error) { + var _p0 uint32 + if resetToDefault { + _p0 = 1 + } + r1, _, e1 := syscall.SyscallN(procAdjustTokenGroups.Addr(), uintptr(token), uintptr(_p0), uintptr(unsafe.Pointer(newstate)), uintptr(buflen), uintptr(unsafe.Pointer(prevstate)), uintptr(unsafe.Pointer(returnlen))) + if r1 == 0 { + err = errnoErr(e1) + } + return +} + +func AdjustTokenPrivileges(token Token, disableAllPrivileges bool, newstate *Tokenprivileges, buflen uint32, prevstate *Tokenprivileges, returnlen *uint32) (err error) { + var _p0 uint32 + if disableAllPrivileges { + _p0 = 1 + } + r1, _, e1 := syscall.SyscallN(procAdjustTokenPrivileges.Addr(), uintptr(token), uintptr(_p0), uintptr(unsafe.Pointer(newstate)), uintptr(buflen), uintptr(unsafe.Pointer(prevstate)), uintptr(unsafe.Pointer(returnlen))) + if r1 == 0 { + err = errnoErr(e1) + } + return +} + +func AllocateAndInitializeSid(identAuth *SidIdentifierAuthority, subAuth byte, subAuth0 uint32, subAuth1 uint32, subAuth2 uint32, subAuth3 uint32, subAuth4 uint32, subAuth5 uint32, subAuth6 uint32, subAuth7 uint32, sid **SID) (err error) { + r1, _, e1 := syscall.SyscallN(procAllocateAndInitializeSid.Addr(), uintptr(unsafe.Pointer(identAuth)), uintptr(subAuth), uintptr(subAuth0), uintptr(subAuth1), uintptr(subAuth2), uintptr(subAuth3), uintptr(subAuth4), uintptr(subAuth5), uintptr(subAuth6), uintptr(subAuth7), uintptr(unsafe.Pointer(sid))) + if r1 == 0 { + err = errnoErr(e1) + } + return +} + +func buildSecurityDescriptor(owner *TRUSTEE, group *TRUSTEE, countAccessEntries uint32, accessEntries *EXPLICIT_ACCESS, countAuditEntries uint32, auditEntries *EXPLICIT_ACCESS, oldSecurityDescriptor *SECURITY_DESCRIPTOR, sizeNewSecurityDescriptor *uint32, newSecurityDescriptor **SECURITY_DESCRIPTOR) (ret error) { + r0, _, _ := syscall.SyscallN(procBuildSecurityDescriptorW.Addr(), uintptr(unsafe.Pointer(owner)), uintptr(unsafe.Pointer(group)), uintptr(countAccessEntries), uintptr(unsafe.Pointer(accessEntries)), uintptr(countAuditEntries), uintptr(unsafe.Pointer(auditEntries)), uintptr(unsafe.Pointer(oldSecurityDescriptor)), uintptr(unsafe.Pointer(sizeNewSecurityDescriptor)), uintptr(unsafe.Pointer(newSecurityDescriptor))) + if r0 != 0 { + ret = syscall.Errno(r0) + } + return +} + +func ChangeServiceConfig2(service Handle, infoLevel uint32, info *byte) (err error) { + r1, _, e1 := syscall.SyscallN(procChangeServiceConfig2W.Addr(), uintptr(service), uintptr(infoLevel), uintptr(unsafe.Pointer(info))) + if r1 == 0 { + err = errnoErr(e1) + } + return +} + +func ChangeServiceConfig(service Handle, serviceType uint32, startType uint32, errorControl uint32, binaryPathName *uint16, loadOrderGroup *uint16, tagId *uint32, dependencies *uint16, serviceStartName *uint16, password *uint16, displayName *uint16) (err error) { + r1, _, e1 := syscall.SyscallN(procChangeServiceConfigW.Addr(), uintptr(service), uintptr(serviceType), uintptr(startType), uintptr(errorControl), uintptr(unsafe.Pointer(binaryPathName)), uintptr(unsafe.Pointer(loadOrderGroup)), uintptr(unsafe.Pointer(tagId)), uintptr(unsafe.Pointer(dependencies)), uintptr(unsafe.Pointer(serviceStartName)), uintptr(unsafe.Pointer(password)), uintptr(unsafe.Pointer(displayName))) + if r1 == 0 { + err = errnoErr(e1) + } + return +} + +func checkTokenMembership(tokenHandle Token, sidToCheck *SID, isMember *int32) (err error) { + r1, _, e1 := syscall.SyscallN(procCheckTokenMembership.Addr(), uintptr(tokenHandle), uintptr(unsafe.Pointer(sidToCheck)), uintptr(unsafe.Pointer(isMember))) + if r1 == 0 { + err = errnoErr(e1) + } + return +} + +func CloseServiceHandle(handle Handle) (err error) { + r1, _, e1 := syscall.SyscallN(procCloseServiceHandle.Addr(), uintptr(handle)) + if r1 == 0 { + err = errnoErr(e1) + } + return +} + +func ControlService(service Handle, control uint32, status *SERVICE_STATUS) (err error) { + r1, _, e1 := syscall.SyscallN(procControlService.Addr(), uintptr(service), uintptr(control), uintptr(unsafe.Pointer(status))) + if r1 == 0 { + err = errnoErr(e1) + } + return +} + +func convertSecurityDescriptorToStringSecurityDescriptor(sd *SECURITY_DESCRIPTOR, revision uint32, securityInformation SECURITY_INFORMATION, str **uint16, strLen *uint32) (err error) { + r1, _, e1 := syscall.SyscallN(procConvertSecurityDescriptorToStringSecurityDescriptorW.Addr(), uintptr(unsafe.Pointer(sd)), uintptr(revision), uintptr(securityInformation), uintptr(unsafe.Pointer(str)), uintptr(unsafe.Pointer(strLen))) + if r1 == 0 { + err = errnoErr(e1) + } + return +} + +func ConvertSidToStringSid(sid *SID, stringSid **uint16) (err error) { + r1, _, e1 := syscall.SyscallN(procConvertSidToStringSidW.Addr(), uintptr(unsafe.Pointer(sid)), uintptr(unsafe.Pointer(stringSid))) + if r1 == 0 { + err = errnoErr(e1) + } + return +} + +func convertStringSecurityDescriptorToSecurityDescriptor(str string, revision uint32, sd **SECURITY_DESCRIPTOR, size *uint32) (err error) { + var _p0 *uint16 + _p0, err = syscall.UTF16PtrFromString(str) + if err != nil { + return + } + return _convertStringSecurityDescriptorToSecurityDescriptor(_p0, revision, sd, size) +} + +func _convertStringSecurityDescriptorToSecurityDescriptor(str *uint16, revision uint32, sd **SECURITY_DESCRIPTOR, size *uint32) (err error) { + r1, _, e1 := syscall.SyscallN(procConvertStringSecurityDescriptorToSecurityDescriptorW.Addr(), uintptr(unsafe.Pointer(str)), uintptr(revision), uintptr(unsafe.Pointer(sd)), uintptr(unsafe.Pointer(size))) + if r1 == 0 { + err = errnoErr(e1) + } + return +} + +func ConvertStringSidToSid(stringSid *uint16, sid **SID) (err error) { + r1, _, e1 := syscall.SyscallN(procConvertStringSidToSidW.Addr(), uintptr(unsafe.Pointer(stringSid)), uintptr(unsafe.Pointer(sid))) + if r1 == 0 { + err = errnoErr(e1) + } + return +} + +func CopySid(destSidLen uint32, destSid *SID, srcSid *SID) (err error) { + r1, _, e1 := syscall.SyscallN(procCopySid.Addr(), uintptr(destSidLen), uintptr(unsafe.Pointer(destSid)), uintptr(unsafe.Pointer(srcSid))) + if r1 == 0 { + err = errnoErr(e1) + } + return +} + +func CreateProcessAsUser(token Token, appName *uint16, commandLine *uint16, procSecurity *SecurityAttributes, threadSecurity *SecurityAttributes, inheritHandles bool, creationFlags uint32, env *uint16, currentDir *uint16, startupInfo *StartupInfo, outProcInfo *ProcessInformation) (err error) { + var _p0 uint32 + if inheritHandles { + _p0 = 1 + } + r1, _, e1 := syscall.SyscallN(procCreateProcessAsUserW.Addr(), uintptr(token), uintptr(unsafe.Pointer(appName)), uintptr(unsafe.Pointer(commandLine)), uintptr(unsafe.Pointer(procSecurity)), uintptr(unsafe.Pointer(threadSecurity)), uintptr(_p0), uintptr(creationFlags), uintptr(unsafe.Pointer(env)), uintptr(unsafe.Pointer(currentDir)), uintptr(unsafe.Pointer(startupInfo)), uintptr(unsafe.Pointer(outProcInfo))) + if r1 == 0 { + err = errnoErr(e1) + } + return +} + +func CreateService(mgr Handle, serviceName *uint16, displayName *uint16, access uint32, srvType uint32, startType uint32, errCtl uint32, pathName *uint16, loadOrderGroup *uint16, tagId *uint32, dependencies *uint16, serviceStartName *uint16, password *uint16) (handle Handle, err error) { + r0, _, e1 := syscall.SyscallN(procCreateServiceW.Addr(), uintptr(mgr), uintptr(unsafe.Pointer(serviceName)), uintptr(unsafe.Pointer(displayName)), uintptr(access), uintptr(srvType), uintptr(startType), uintptr(errCtl), uintptr(unsafe.Pointer(pathName)), uintptr(unsafe.Pointer(loadOrderGroup)), uintptr(unsafe.Pointer(tagId)), uintptr(unsafe.Pointer(dependencies)), uintptr(unsafe.Pointer(serviceStartName)), uintptr(unsafe.Pointer(password))) + handle = Handle(r0) + if handle == 0 { + err = errnoErr(e1) + } + return +} + +func createWellKnownSid(sidType WELL_KNOWN_SID_TYPE, domainSid *SID, sid *SID, sizeSid *uint32) (err error) { + r1, _, e1 := syscall.SyscallN(procCreateWellKnownSid.Addr(), uintptr(sidType), uintptr(unsafe.Pointer(domainSid)), uintptr(unsafe.Pointer(sid)), uintptr(unsafe.Pointer(sizeSid))) + if r1 == 0 { + err = errnoErr(e1) + } + return +} + +func CryptAcquireContext(provhandle *Handle, container *uint16, provider *uint16, provtype uint32, flags uint32) (err error) { + r1, _, e1 := syscall.SyscallN(procCryptAcquireContextW.Addr(), uintptr(unsafe.Pointer(provhandle)), uintptr(unsafe.Pointer(container)), uintptr(unsafe.Pointer(provider)), uintptr(provtype), uintptr(flags)) + if r1 == 0 { + err = errnoErr(e1) + } + return +} + +func CryptGenRandom(provhandle Handle, buflen uint32, buf *byte) (err error) { + r1, _, e1 := syscall.SyscallN(procCryptGenRandom.Addr(), uintptr(provhandle), uintptr(buflen), uintptr(unsafe.Pointer(buf))) + if r1 == 0 { + err = errnoErr(e1) + } + return +} + +func CryptReleaseContext(provhandle Handle, flags uint32) (err error) { + r1, _, e1 := syscall.SyscallN(procCryptReleaseContext.Addr(), uintptr(provhandle), uintptr(flags)) + if r1 == 0 { + err = errnoErr(e1) + } + return +} + +func DeleteService(service Handle) (err error) { + r1, _, e1 := syscall.SyscallN(procDeleteService.Addr(), uintptr(service)) + if r1 == 0 { + err = errnoErr(e1) + } + return +} + +func DeregisterEventSource(handle Handle) (err error) { + r1, _, e1 := syscall.SyscallN(procDeregisterEventSource.Addr(), uintptr(handle)) + if r1 == 0 { + err = errnoErr(e1) + } + return +} + +func DuplicateTokenEx(existingToken Token, desiredAccess uint32, tokenAttributes *SecurityAttributes, impersonationLevel uint32, tokenType uint32, newToken *Token) (err error) { + r1, _, e1 := syscall.SyscallN(procDuplicateTokenEx.Addr(), uintptr(existingToken), uintptr(desiredAccess), uintptr(unsafe.Pointer(tokenAttributes)), uintptr(impersonationLevel), uintptr(tokenType), uintptr(unsafe.Pointer(newToken))) + if r1 == 0 { + err = errnoErr(e1) + } + return +} + +func EnumDependentServices(service Handle, activityState uint32, services *ENUM_SERVICE_STATUS, buffSize uint32, bytesNeeded *uint32, servicesReturned *uint32) (err error) { + r1, _, e1 := syscall.SyscallN(procEnumDependentServicesW.Addr(), uintptr(service), uintptr(activityState), uintptr(unsafe.Pointer(services)), uintptr(buffSize), uintptr(unsafe.Pointer(bytesNeeded)), uintptr(unsafe.Pointer(servicesReturned))) + if r1 == 0 { + err = errnoErr(e1) + } + return +} + +func EnumServicesStatusEx(mgr Handle, infoLevel uint32, serviceType uint32, serviceState uint32, services *byte, bufSize uint32, bytesNeeded *uint32, servicesReturned *uint32, resumeHandle *uint32, groupName *uint16) (err error) { + r1, _, e1 := syscall.SyscallN(procEnumServicesStatusExW.Addr(), uintptr(mgr), uintptr(infoLevel), uintptr(serviceType), uintptr(serviceState), uintptr(unsafe.Pointer(services)), uintptr(bufSize), uintptr(unsafe.Pointer(bytesNeeded)), uintptr(unsafe.Pointer(servicesReturned)), uintptr(unsafe.Pointer(resumeHandle)), uintptr(unsafe.Pointer(groupName))) + if r1 == 0 { + err = errnoErr(e1) + } + return +} + +func EqualSid(sid1 *SID, sid2 *SID) (isEqual bool) { + r0, _, _ := syscall.SyscallN(procEqualSid.Addr(), uintptr(unsafe.Pointer(sid1)), uintptr(unsafe.Pointer(sid2))) + isEqual = r0 != 0 + return +} + +func FreeSid(sid *SID) (err error) { + r1, _, e1 := syscall.SyscallN(procFreeSid.Addr(), uintptr(unsafe.Pointer(sid))) + if r1 != 0 { + err = errnoErr(e1) + } + return +} + +func GetAce(acl *ACL, aceIndex uint32, pAce **ACCESS_ALLOWED_ACE) (err error) { + r1, _, e1 := syscall.SyscallN(procGetAce.Addr(), uintptr(unsafe.Pointer(acl)), uintptr(aceIndex), uintptr(unsafe.Pointer(pAce))) + if r1 == 0 { + err = errnoErr(e1) + } + return +} + +func GetLengthSid(sid *SID) (len uint32) { + r0, _, _ := syscall.SyscallN(procGetLengthSid.Addr(), uintptr(unsafe.Pointer(sid))) + len = uint32(r0) + return +} + +func getNamedSecurityInfo(objectName string, objectType SE_OBJECT_TYPE, securityInformation SECURITY_INFORMATION, owner **SID, group **SID, dacl **ACL, sacl **ACL, sd **SECURITY_DESCRIPTOR) (ret error) { + var _p0 *uint16 + _p0, ret = syscall.UTF16PtrFromString(objectName) + if ret != nil { + return + } + return _getNamedSecurityInfo(_p0, objectType, securityInformation, owner, group, dacl, sacl, sd) +} + +func _getNamedSecurityInfo(objectName *uint16, objectType SE_OBJECT_TYPE, securityInformation SECURITY_INFORMATION, owner **SID, group **SID, dacl **ACL, sacl **ACL, sd **SECURITY_DESCRIPTOR) (ret error) { + r0, _, _ := syscall.SyscallN(procGetNamedSecurityInfoW.Addr(), uintptr(unsafe.Pointer(objectName)), uintptr(objectType), uintptr(securityInformation), uintptr(unsafe.Pointer(owner)), uintptr(unsafe.Pointer(group)), uintptr(unsafe.Pointer(dacl)), uintptr(unsafe.Pointer(sacl)), uintptr(unsafe.Pointer(sd))) + if r0 != 0 { + ret = syscall.Errno(r0) + } + return +} + +func getSecurityDescriptorControl(sd *SECURITY_DESCRIPTOR, control *SECURITY_DESCRIPTOR_CONTROL, revision *uint32) (err error) { + r1, _, e1 := syscall.SyscallN(procGetSecurityDescriptorControl.Addr(), uintptr(unsafe.Pointer(sd)), uintptr(unsafe.Pointer(control)), uintptr(unsafe.Pointer(revision))) + if r1 == 0 { + err = errnoErr(e1) + } + return +} + +func getSecurityDescriptorDacl(sd *SECURITY_DESCRIPTOR, daclPresent *bool, dacl **ACL, daclDefaulted *bool) (err error) { + var _p0 uint32 + if *daclPresent { + _p0 = 1 + } + var _p1 uint32 + if *daclDefaulted { + _p1 = 1 + } + r1, _, e1 := syscall.SyscallN(procGetSecurityDescriptorDacl.Addr(), uintptr(unsafe.Pointer(sd)), uintptr(unsafe.Pointer(&_p0)), uintptr(unsafe.Pointer(dacl)), uintptr(unsafe.Pointer(&_p1))) + *daclPresent = _p0 != 0 + *daclDefaulted = _p1 != 0 + if r1 == 0 { + err = errnoErr(e1) + } + return +} + +func getSecurityDescriptorGroup(sd *SECURITY_DESCRIPTOR, group **SID, groupDefaulted *bool) (err error) { + var _p0 uint32 + if *groupDefaulted { + _p0 = 1 + } + r1, _, e1 := syscall.SyscallN(procGetSecurityDescriptorGroup.Addr(), uintptr(unsafe.Pointer(sd)), uintptr(unsafe.Pointer(group)), uintptr(unsafe.Pointer(&_p0))) + *groupDefaulted = _p0 != 0 + if r1 == 0 { + err = errnoErr(e1) + } + return +} + +func getSecurityDescriptorLength(sd *SECURITY_DESCRIPTOR) (len uint32) { + r0, _, _ := syscall.SyscallN(procGetSecurityDescriptorLength.Addr(), uintptr(unsafe.Pointer(sd))) + len = uint32(r0) + return +} + +func getSecurityDescriptorOwner(sd *SECURITY_DESCRIPTOR, owner **SID, ownerDefaulted *bool) (err error) { + var _p0 uint32 + if *ownerDefaulted { + _p0 = 1 + } + r1, _, e1 := syscall.SyscallN(procGetSecurityDescriptorOwner.Addr(), uintptr(unsafe.Pointer(sd)), uintptr(unsafe.Pointer(owner)), uintptr(unsafe.Pointer(&_p0))) + *ownerDefaulted = _p0 != 0 + if r1 == 0 { + err = errnoErr(e1) + } + return +} + +func getSecurityDescriptorRMControl(sd *SECURITY_DESCRIPTOR, rmControl *uint8) (ret error) { + r0, _, _ := syscall.SyscallN(procGetSecurityDescriptorRMControl.Addr(), uintptr(unsafe.Pointer(sd)), uintptr(unsafe.Pointer(rmControl))) + if r0 != 0 { + ret = syscall.Errno(r0) + } + return +} + +func getSecurityDescriptorSacl(sd *SECURITY_DESCRIPTOR, saclPresent *bool, sacl **ACL, saclDefaulted *bool) (err error) { + var _p0 uint32 + if *saclPresent { + _p0 = 1 + } + var _p1 uint32 + if *saclDefaulted { + _p1 = 1 + } + r1, _, e1 := syscall.SyscallN(procGetSecurityDescriptorSacl.Addr(), uintptr(unsafe.Pointer(sd)), uintptr(unsafe.Pointer(&_p0)), uintptr(unsafe.Pointer(sacl)), uintptr(unsafe.Pointer(&_p1))) + *saclPresent = _p0 != 0 + *saclDefaulted = _p1 != 0 + if r1 == 0 { + err = errnoErr(e1) + } + return +} + +func getSecurityInfo(handle Handle, objectType SE_OBJECT_TYPE, securityInformation SECURITY_INFORMATION, owner **SID, group **SID, dacl **ACL, sacl **ACL, sd **SECURITY_DESCRIPTOR) (ret error) { + r0, _, _ := syscall.SyscallN(procGetSecurityInfo.Addr(), uintptr(handle), uintptr(objectType), uintptr(securityInformation), uintptr(unsafe.Pointer(owner)), uintptr(unsafe.Pointer(group)), uintptr(unsafe.Pointer(dacl)), uintptr(unsafe.Pointer(sacl)), uintptr(unsafe.Pointer(sd))) + if r0 != 0 { + ret = syscall.Errno(r0) + } + return +} + +func getSidIdentifierAuthority(sid *SID) (authority *SidIdentifierAuthority) { + r0, _, _ := syscall.SyscallN(procGetSidIdentifierAuthority.Addr(), uintptr(unsafe.Pointer(sid))) + authority = (*SidIdentifierAuthority)(unsafe.Pointer(r0)) + return +} + +func getSidSubAuthority(sid *SID, index uint32) (subAuthority *uint32) { + r0, _, _ := syscall.SyscallN(procGetSidSubAuthority.Addr(), uintptr(unsafe.Pointer(sid)), uintptr(index)) + subAuthority = (*uint32)(unsafe.Pointer(r0)) + return +} + +func getSidSubAuthorityCount(sid *SID) (count *uint8) { + r0, _, _ := syscall.SyscallN(procGetSidSubAuthorityCount.Addr(), uintptr(unsafe.Pointer(sid))) + count = (*uint8)(unsafe.Pointer(r0)) + return +} + +func GetTokenInformation(token Token, infoClass uint32, info *byte, infoLen uint32, returnedLen *uint32) (err error) { + r1, _, e1 := syscall.SyscallN(procGetTokenInformation.Addr(), uintptr(token), uintptr(infoClass), uintptr(unsafe.Pointer(info)), uintptr(infoLen), uintptr(unsafe.Pointer(returnedLen))) + if r1 == 0 { + err = errnoErr(e1) + } + return +} + +func ImpersonateSelf(impersonationlevel uint32) (err error) { + r1, _, e1 := syscall.SyscallN(procImpersonateSelf.Addr(), uintptr(impersonationlevel)) + if r1 == 0 { + err = errnoErr(e1) + } + return +} + +func initializeSecurityDescriptor(absoluteSD *SECURITY_DESCRIPTOR, revision uint32) (err error) { + r1, _, e1 := syscall.SyscallN(procInitializeSecurityDescriptor.Addr(), uintptr(unsafe.Pointer(absoluteSD)), uintptr(revision)) + if r1 == 0 { + err = errnoErr(e1) + } + return +} + +func InitiateSystemShutdownEx(machineName *uint16, message *uint16, timeout uint32, forceAppsClosed bool, rebootAfterShutdown bool, reason uint32) (err error) { + var _p0 uint32 + if forceAppsClosed { + _p0 = 1 + } + var _p1 uint32 + if rebootAfterShutdown { + _p1 = 1 + } + r1, _, e1 := syscall.SyscallN(procInitiateSystemShutdownExW.Addr(), uintptr(unsafe.Pointer(machineName)), uintptr(unsafe.Pointer(message)), uintptr(timeout), uintptr(_p0), uintptr(_p1), uintptr(reason)) + if r1 == 0 { + err = errnoErr(e1) + } + return +} + +func isTokenRestricted(tokenHandle Token) (ret bool, err error) { + r0, _, e1 := syscall.SyscallN(procIsTokenRestricted.Addr(), uintptr(tokenHandle)) + ret = r0 != 0 + if !ret { + err = errnoErr(e1) + } + return +} + +func isValidSecurityDescriptor(sd *SECURITY_DESCRIPTOR) (isValid bool) { + r0, _, _ := syscall.SyscallN(procIsValidSecurityDescriptor.Addr(), uintptr(unsafe.Pointer(sd))) + isValid = r0 != 0 + return +} + +func isValidSid(sid *SID) (isValid bool) { + r0, _, _ := syscall.SyscallN(procIsValidSid.Addr(), uintptr(unsafe.Pointer(sid))) + isValid = r0 != 0 + return +} + +func isWellKnownSid(sid *SID, sidType WELL_KNOWN_SID_TYPE) (isWellKnown bool) { + r0, _, _ := syscall.SyscallN(procIsWellKnownSid.Addr(), uintptr(unsafe.Pointer(sid)), uintptr(sidType)) + isWellKnown = r0 != 0 + return +} + +func LookupAccountName(systemName *uint16, accountName *uint16, sid *SID, sidLen *uint32, refdDomainName *uint16, refdDomainNameLen *uint32, use *uint32) (err error) { + r1, _, e1 := syscall.SyscallN(procLookupAccountNameW.Addr(), uintptr(unsafe.Pointer(systemName)), uintptr(unsafe.Pointer(accountName)), uintptr(unsafe.Pointer(sid)), uintptr(unsafe.Pointer(sidLen)), uintptr(unsafe.Pointer(refdDomainName)), uintptr(unsafe.Pointer(refdDomainNameLen)), uintptr(unsafe.Pointer(use))) + if r1 == 0 { + err = errnoErr(e1) + } + return +} + +func LookupAccountSid(systemName *uint16, sid *SID, name *uint16, nameLen *uint32, refdDomainName *uint16, refdDomainNameLen *uint32, use *uint32) (err error) { + r1, _, e1 := syscall.SyscallN(procLookupAccountSidW.Addr(), uintptr(unsafe.Pointer(systemName)), uintptr(unsafe.Pointer(sid)), uintptr(unsafe.Pointer(name)), uintptr(unsafe.Pointer(nameLen)), uintptr(unsafe.Pointer(refdDomainName)), uintptr(unsafe.Pointer(refdDomainNameLen)), uintptr(unsafe.Pointer(use))) + if r1 == 0 { + err = errnoErr(e1) + } + return +} + +func LookupPrivilegeValue(systemname *uint16, name *uint16, luid *LUID) (err error) { + r1, _, e1 := syscall.SyscallN(procLookupPrivilegeValueW.Addr(), uintptr(unsafe.Pointer(systemname)), uintptr(unsafe.Pointer(name)), uintptr(unsafe.Pointer(luid))) + if r1 == 0 { + err = errnoErr(e1) + } + return +} + +func makeAbsoluteSD(selfRelativeSD *SECURITY_DESCRIPTOR, absoluteSD *SECURITY_DESCRIPTOR, absoluteSDSize *uint32, dacl *ACL, daclSize *uint32, sacl *ACL, saclSize *uint32, owner *SID, ownerSize *uint32, group *SID, groupSize *uint32) (err error) { + r1, _, e1 := syscall.SyscallN(procMakeAbsoluteSD.Addr(), uintptr(unsafe.Pointer(selfRelativeSD)), uintptr(unsafe.Pointer(absoluteSD)), uintptr(unsafe.Pointer(absoluteSDSize)), uintptr(unsafe.Pointer(dacl)), uintptr(unsafe.Pointer(daclSize)), uintptr(unsafe.Pointer(sacl)), uintptr(unsafe.Pointer(saclSize)), uintptr(unsafe.Pointer(owner)), uintptr(unsafe.Pointer(ownerSize)), uintptr(unsafe.Pointer(group)), uintptr(unsafe.Pointer(groupSize))) + if r1 == 0 { + err = errnoErr(e1) + } + return +} + +func makeSelfRelativeSD(absoluteSD *SECURITY_DESCRIPTOR, selfRelativeSD *SECURITY_DESCRIPTOR, selfRelativeSDSize *uint32) (err error) { + r1, _, e1 := syscall.SyscallN(procMakeSelfRelativeSD.Addr(), uintptr(unsafe.Pointer(absoluteSD)), uintptr(unsafe.Pointer(selfRelativeSD)), uintptr(unsafe.Pointer(selfRelativeSDSize))) + if r1 == 0 { + err = errnoErr(e1) + } + return +} + +func NotifyServiceStatusChange(service Handle, notifyMask uint32, notifier *SERVICE_NOTIFY) (ret error) { + r0, _, _ := syscall.SyscallN(procNotifyServiceStatusChangeW.Addr(), uintptr(service), uintptr(notifyMask), uintptr(unsafe.Pointer(notifier))) + if r0 != 0 { + ret = syscall.Errno(r0) + } + return +} + +func OpenProcessToken(process Handle, access uint32, token *Token) (err error) { + r1, _, e1 := syscall.SyscallN(procOpenProcessToken.Addr(), uintptr(process), uintptr(access), uintptr(unsafe.Pointer(token))) + if r1 == 0 { + err = errnoErr(e1) + } + return +} + +func OpenSCManager(machineName *uint16, databaseName *uint16, access uint32) (handle Handle, err error) { + r0, _, e1 := syscall.SyscallN(procOpenSCManagerW.Addr(), uintptr(unsafe.Pointer(machineName)), uintptr(unsafe.Pointer(databaseName)), uintptr(access)) + handle = Handle(r0) + if handle == 0 { + err = errnoErr(e1) + } + return +} + +func OpenService(mgr Handle, serviceName *uint16, access uint32) (handle Handle, err error) { + r0, _, e1 := syscall.SyscallN(procOpenServiceW.Addr(), uintptr(mgr), uintptr(unsafe.Pointer(serviceName)), uintptr(access)) + handle = Handle(r0) + if handle == 0 { + err = errnoErr(e1) + } + return +} + +func OpenThreadToken(thread Handle, access uint32, openAsSelf bool, token *Token) (err error) { + var _p0 uint32 + if openAsSelf { + _p0 = 1 + } + r1, _, e1 := syscall.SyscallN(procOpenThreadToken.Addr(), uintptr(thread), uintptr(access), uintptr(_p0), uintptr(unsafe.Pointer(token))) + if r1 == 0 { + err = errnoErr(e1) + } + return +} + +func QueryServiceConfig2(service Handle, infoLevel uint32, buff *byte, buffSize uint32, bytesNeeded *uint32) (err error) { + r1, _, e1 := syscall.SyscallN(procQueryServiceConfig2W.Addr(), uintptr(service), uintptr(infoLevel), uintptr(unsafe.Pointer(buff)), uintptr(buffSize), uintptr(unsafe.Pointer(bytesNeeded))) + if r1 == 0 { + err = errnoErr(e1) + } + return +} + +func QueryServiceConfig(service Handle, serviceConfig *QUERY_SERVICE_CONFIG, bufSize uint32, bytesNeeded *uint32) (err error) { + r1, _, e1 := syscall.SyscallN(procQueryServiceConfigW.Addr(), uintptr(service), uintptr(unsafe.Pointer(serviceConfig)), uintptr(bufSize), uintptr(unsafe.Pointer(bytesNeeded))) + if r1 == 0 { + err = errnoErr(e1) + } + return +} + +func QueryServiceDynamicInformation(service Handle, infoLevel uint32, dynamicInfo unsafe.Pointer) (err error) { + err = procQueryServiceDynamicInformation.Find() + if err != nil { + return + } + r1, _, e1 := syscall.SyscallN(procQueryServiceDynamicInformation.Addr(), uintptr(service), uintptr(infoLevel), uintptr(dynamicInfo)) + if r1 == 0 { + err = errnoErr(e1) + } + return +} + +func QueryServiceLockStatus(mgr Handle, lockStatus *QUERY_SERVICE_LOCK_STATUS, bufSize uint32, bytesNeeded *uint32) (err error) { + r1, _, e1 := syscall.SyscallN(procQueryServiceLockStatusW.Addr(), uintptr(mgr), uintptr(unsafe.Pointer(lockStatus)), uintptr(bufSize), uintptr(unsafe.Pointer(bytesNeeded))) + if r1 == 0 { + err = errnoErr(e1) + } + return +} + +func QueryServiceStatus(service Handle, status *SERVICE_STATUS) (err error) { + r1, _, e1 := syscall.SyscallN(procQueryServiceStatus.Addr(), uintptr(service), uintptr(unsafe.Pointer(status))) + if r1 == 0 { + err = errnoErr(e1) + } + return +} + +func QueryServiceStatusEx(service Handle, infoLevel uint32, buff *byte, buffSize uint32, bytesNeeded *uint32) (err error) { + r1, _, e1 := syscall.SyscallN(procQueryServiceStatusEx.Addr(), uintptr(service), uintptr(infoLevel), uintptr(unsafe.Pointer(buff)), uintptr(buffSize), uintptr(unsafe.Pointer(bytesNeeded))) + if r1 == 0 { + err = errnoErr(e1) + } + return +} + +func RegCloseKey(key Handle) (regerrno error) { + r0, _, _ := syscall.SyscallN(procRegCloseKey.Addr(), uintptr(key)) + if r0 != 0 { + regerrno = syscall.Errno(r0) + } + return +} + +func RegEnumKeyEx(key Handle, index uint32, name *uint16, nameLen *uint32, reserved *uint32, class *uint16, classLen *uint32, lastWriteTime *Filetime) (regerrno error) { + r0, _, _ := syscall.SyscallN(procRegEnumKeyExW.Addr(), uintptr(key), uintptr(index), uintptr(unsafe.Pointer(name)), uintptr(unsafe.Pointer(nameLen)), uintptr(unsafe.Pointer(reserved)), uintptr(unsafe.Pointer(class)), uintptr(unsafe.Pointer(classLen)), uintptr(unsafe.Pointer(lastWriteTime))) + if r0 != 0 { + regerrno = syscall.Errno(r0) + } + return +} + +func RegNotifyChangeKeyValue(key Handle, watchSubtree bool, notifyFilter uint32, event Handle, asynchronous bool) (regerrno error) { + var _p0 uint32 + if watchSubtree { + _p0 = 1 + } + var _p1 uint32 + if asynchronous { + _p1 = 1 + } + r0, _, _ := syscall.SyscallN(procRegNotifyChangeKeyValue.Addr(), uintptr(key), uintptr(_p0), uintptr(notifyFilter), uintptr(event), uintptr(_p1)) + if r0 != 0 { + regerrno = syscall.Errno(r0) + } + return +} + +func RegOpenKeyEx(key Handle, subkey *uint16, options uint32, desiredAccess uint32, result *Handle) (regerrno error) { + r0, _, _ := syscall.SyscallN(procRegOpenKeyExW.Addr(), uintptr(key), uintptr(unsafe.Pointer(subkey)), uintptr(options), uintptr(desiredAccess), uintptr(unsafe.Pointer(result))) + if r0 != 0 { + regerrno = syscall.Errno(r0) + } + return +} + +func RegQueryInfoKey(key Handle, class *uint16, classLen *uint32, reserved *uint32, subkeysLen *uint32, maxSubkeyLen *uint32, maxClassLen *uint32, valuesLen *uint32, maxValueNameLen *uint32, maxValueLen *uint32, saLen *uint32, lastWriteTime *Filetime) (regerrno error) { + r0, _, _ := syscall.SyscallN(procRegQueryInfoKeyW.Addr(), uintptr(key), uintptr(unsafe.Pointer(class)), uintptr(unsafe.Pointer(classLen)), uintptr(unsafe.Pointer(reserved)), uintptr(unsafe.Pointer(subkeysLen)), uintptr(unsafe.Pointer(maxSubkeyLen)), uintptr(unsafe.Pointer(maxClassLen)), uintptr(unsafe.Pointer(valuesLen)), uintptr(unsafe.Pointer(maxValueNameLen)), uintptr(unsafe.Pointer(maxValueLen)), uintptr(unsafe.Pointer(saLen)), uintptr(unsafe.Pointer(lastWriteTime))) + if r0 != 0 { + regerrno = syscall.Errno(r0) + } + return +} + +func RegQueryValueEx(key Handle, name *uint16, reserved *uint32, valtype *uint32, buf *byte, buflen *uint32) (regerrno error) { + r0, _, _ := syscall.SyscallN(procRegQueryValueExW.Addr(), uintptr(key), uintptr(unsafe.Pointer(name)), uintptr(unsafe.Pointer(reserved)), uintptr(unsafe.Pointer(valtype)), uintptr(unsafe.Pointer(buf)), uintptr(unsafe.Pointer(buflen))) + if r0 != 0 { + regerrno = syscall.Errno(r0) + } + return +} + +func RegisterEventSource(uncServerName *uint16, sourceName *uint16) (handle Handle, err error) { + r0, _, e1 := syscall.SyscallN(procRegisterEventSourceW.Addr(), uintptr(unsafe.Pointer(uncServerName)), uintptr(unsafe.Pointer(sourceName))) + handle = Handle(r0) + if handle == 0 { + err = errnoErr(e1) + } + return +} + +func RegisterServiceCtrlHandlerEx(serviceName *uint16, handlerProc uintptr, context uintptr) (handle Handle, err error) { + r0, _, e1 := syscall.SyscallN(procRegisterServiceCtrlHandlerExW.Addr(), uintptr(unsafe.Pointer(serviceName)), uintptr(handlerProc), uintptr(context)) + handle = Handle(r0) + if handle == 0 { + err = errnoErr(e1) + } + return +} + +func ReportEvent(log Handle, etype uint16, category uint16, eventId uint32, usrSId uintptr, numStrings uint16, dataSize uint32, strings **uint16, rawData *byte) (err error) { + r1, _, e1 := syscall.SyscallN(procReportEventW.Addr(), uintptr(log), uintptr(etype), uintptr(category), uintptr(eventId), uintptr(usrSId), uintptr(numStrings), uintptr(dataSize), uintptr(unsafe.Pointer(strings)), uintptr(unsafe.Pointer(rawData))) + if r1 == 0 { + err = errnoErr(e1) + } + return +} + +func RevertToSelf() (err error) { + r1, _, e1 := syscall.SyscallN(procRevertToSelf.Addr()) + if r1 == 0 { + err = errnoErr(e1) + } + return +} + +func setEntriesInAcl(countExplicitEntries uint32, explicitEntries *EXPLICIT_ACCESS, oldACL *ACL, newACL **ACL) (ret error) { + r0, _, _ := syscall.SyscallN(procSetEntriesInAclW.Addr(), uintptr(countExplicitEntries), uintptr(unsafe.Pointer(explicitEntries)), uintptr(unsafe.Pointer(oldACL)), uintptr(unsafe.Pointer(newACL))) + if r0 != 0 { + ret = syscall.Errno(r0) + } + return +} + +func SetKernelObjectSecurity(handle Handle, securityInformation SECURITY_INFORMATION, securityDescriptor *SECURITY_DESCRIPTOR) (err error) { + r1, _, e1 := syscall.SyscallN(procSetKernelObjectSecurity.Addr(), uintptr(handle), uintptr(securityInformation), uintptr(unsafe.Pointer(securityDescriptor))) + if r1 == 0 { + err = errnoErr(e1) + } + return +} + +func SetNamedSecurityInfo(objectName string, objectType SE_OBJECT_TYPE, securityInformation SECURITY_INFORMATION, owner *SID, group *SID, dacl *ACL, sacl *ACL) (ret error) { + var _p0 *uint16 + _p0, ret = syscall.UTF16PtrFromString(objectName) + if ret != nil { + return + } + return _SetNamedSecurityInfo(_p0, objectType, securityInformation, owner, group, dacl, sacl) +} + +func _SetNamedSecurityInfo(objectName *uint16, objectType SE_OBJECT_TYPE, securityInformation SECURITY_INFORMATION, owner *SID, group *SID, dacl *ACL, sacl *ACL) (ret error) { + r0, _, _ := syscall.SyscallN(procSetNamedSecurityInfoW.Addr(), uintptr(unsafe.Pointer(objectName)), uintptr(objectType), uintptr(securityInformation), uintptr(unsafe.Pointer(owner)), uintptr(unsafe.Pointer(group)), uintptr(unsafe.Pointer(dacl)), uintptr(unsafe.Pointer(sacl))) + if r0 != 0 { + ret = syscall.Errno(r0) + } + return +} + +func setSecurityDescriptorControl(sd *SECURITY_DESCRIPTOR, controlBitsOfInterest SECURITY_DESCRIPTOR_CONTROL, controlBitsToSet SECURITY_DESCRIPTOR_CONTROL) (err error) { + r1, _, e1 := syscall.SyscallN(procSetSecurityDescriptorControl.Addr(), uintptr(unsafe.Pointer(sd)), uintptr(controlBitsOfInterest), uintptr(controlBitsToSet)) + if r1 == 0 { + err = errnoErr(e1) + } + return +} + +func setSecurityDescriptorDacl(sd *SECURITY_DESCRIPTOR, daclPresent bool, dacl *ACL, daclDefaulted bool) (err error) { + var _p0 uint32 + if daclPresent { + _p0 = 1 + } + var _p1 uint32 + if daclDefaulted { + _p1 = 1 + } + r1, _, e1 := syscall.SyscallN(procSetSecurityDescriptorDacl.Addr(), uintptr(unsafe.Pointer(sd)), uintptr(_p0), uintptr(unsafe.Pointer(dacl)), uintptr(_p1)) + if r1 == 0 { + err = errnoErr(e1) + } + return +} + +func setSecurityDescriptorGroup(sd *SECURITY_DESCRIPTOR, group *SID, groupDefaulted bool) (err error) { + var _p0 uint32 + if groupDefaulted { + _p0 = 1 + } + r1, _, e1 := syscall.SyscallN(procSetSecurityDescriptorGroup.Addr(), uintptr(unsafe.Pointer(sd)), uintptr(unsafe.Pointer(group)), uintptr(_p0)) + if r1 == 0 { + err = errnoErr(e1) + } + return +} + +func setSecurityDescriptorOwner(sd *SECURITY_DESCRIPTOR, owner *SID, ownerDefaulted bool) (err error) { + var _p0 uint32 + if ownerDefaulted { + _p0 = 1 + } + r1, _, e1 := syscall.SyscallN(procSetSecurityDescriptorOwner.Addr(), uintptr(unsafe.Pointer(sd)), uintptr(unsafe.Pointer(owner)), uintptr(_p0)) + if r1 == 0 { + err = errnoErr(e1) + } + return +} + +func setSecurityDescriptorRMControl(sd *SECURITY_DESCRIPTOR, rmControl *uint8) { + syscall.SyscallN(procSetSecurityDescriptorRMControl.Addr(), uintptr(unsafe.Pointer(sd)), uintptr(unsafe.Pointer(rmControl))) + return +} + +func setSecurityDescriptorSacl(sd *SECURITY_DESCRIPTOR, saclPresent bool, sacl *ACL, saclDefaulted bool) (err error) { + var _p0 uint32 + if saclPresent { + _p0 = 1 + } + var _p1 uint32 + if saclDefaulted { + _p1 = 1 + } + r1, _, e1 := syscall.SyscallN(procSetSecurityDescriptorSacl.Addr(), uintptr(unsafe.Pointer(sd)), uintptr(_p0), uintptr(unsafe.Pointer(sacl)), uintptr(_p1)) + if r1 == 0 { + err = errnoErr(e1) + } + return +} + +func SetSecurityInfo(handle Handle, objectType SE_OBJECT_TYPE, securityInformation SECURITY_INFORMATION, owner *SID, group *SID, dacl *ACL, sacl *ACL) (ret error) { + r0, _, _ := syscall.SyscallN(procSetSecurityInfo.Addr(), uintptr(handle), uintptr(objectType), uintptr(securityInformation), uintptr(unsafe.Pointer(owner)), uintptr(unsafe.Pointer(group)), uintptr(unsafe.Pointer(dacl)), uintptr(unsafe.Pointer(sacl))) + if r0 != 0 { + ret = syscall.Errno(r0) + } + return +} + +func SetServiceStatus(service Handle, serviceStatus *SERVICE_STATUS) (err error) { + r1, _, e1 := syscall.SyscallN(procSetServiceStatus.Addr(), uintptr(service), uintptr(unsafe.Pointer(serviceStatus))) + if r1 == 0 { + err = errnoErr(e1) + } + return +} + +func SetThreadToken(thread *Handle, token Token) (err error) { + r1, _, e1 := syscall.SyscallN(procSetThreadToken.Addr(), uintptr(unsafe.Pointer(thread)), uintptr(token)) + if r1 == 0 { + err = errnoErr(e1) + } + return +} + +func SetTokenInformation(token Token, infoClass uint32, info *byte, infoLen uint32) (err error) { + r1, _, e1 := syscall.SyscallN(procSetTokenInformation.Addr(), uintptr(token), uintptr(infoClass), uintptr(unsafe.Pointer(info)), uintptr(infoLen)) + if r1 == 0 { + err = errnoErr(e1) + } + return +} + +func StartServiceCtrlDispatcher(serviceTable *SERVICE_TABLE_ENTRY) (err error) { + r1, _, e1 := syscall.SyscallN(procStartServiceCtrlDispatcherW.Addr(), uintptr(unsafe.Pointer(serviceTable))) + if r1 == 0 { + err = errnoErr(e1) + } + return +} + +func StartService(service Handle, numArgs uint32, argVectors **uint16) (err error) { + r1, _, e1 := syscall.SyscallN(procStartServiceW.Addr(), uintptr(service), uintptr(numArgs), uintptr(unsafe.Pointer(argVectors))) + if r1 == 0 { + err = errnoErr(e1) + } + return +} + +func CertAddCertificateContextToStore(store Handle, certContext *CertContext, addDisposition uint32, storeContext **CertContext) (err error) { + r1, _, e1 := syscall.SyscallN(procCertAddCertificateContextToStore.Addr(), uintptr(store), uintptr(unsafe.Pointer(certContext)), uintptr(addDisposition), uintptr(unsafe.Pointer(storeContext))) + if r1 == 0 { + err = errnoErr(e1) + } + return +} + +func CertCloseStore(store Handle, flags uint32) (err error) { + r1, _, e1 := syscall.SyscallN(procCertCloseStore.Addr(), uintptr(store), uintptr(flags)) + if r1 == 0 { + err = errnoErr(e1) + } + return +} + +func CertCreateCertificateContext(certEncodingType uint32, certEncoded *byte, encodedLen uint32) (context *CertContext, err error) { + r0, _, e1 := syscall.SyscallN(procCertCreateCertificateContext.Addr(), uintptr(certEncodingType), uintptr(unsafe.Pointer(certEncoded)), uintptr(encodedLen)) + context = (*CertContext)(unsafe.Pointer(r0)) + if context == nil { + err = errnoErr(e1) + } + return +} + +func CertDeleteCertificateFromStore(certContext *CertContext) (err error) { + r1, _, e1 := syscall.SyscallN(procCertDeleteCertificateFromStore.Addr(), uintptr(unsafe.Pointer(certContext))) + if r1 == 0 { + err = errnoErr(e1) + } + return +} + +func CertDuplicateCertificateContext(certContext *CertContext) (dupContext *CertContext) { + r0, _, _ := syscall.SyscallN(procCertDuplicateCertificateContext.Addr(), uintptr(unsafe.Pointer(certContext))) + dupContext = (*CertContext)(unsafe.Pointer(r0)) + return +} + +func CertEnumCertificatesInStore(store Handle, prevContext *CertContext) (context *CertContext, err error) { + r0, _, e1 := syscall.SyscallN(procCertEnumCertificatesInStore.Addr(), uintptr(store), uintptr(unsafe.Pointer(prevContext))) + context = (*CertContext)(unsafe.Pointer(r0)) + if context == nil { + err = errnoErr(e1) + } + return +} + +func CertFindCertificateInStore(store Handle, certEncodingType uint32, findFlags uint32, findType uint32, findPara unsafe.Pointer, prevCertContext *CertContext) (cert *CertContext, err error) { + r0, _, e1 := syscall.SyscallN(procCertFindCertificateInStore.Addr(), uintptr(store), uintptr(certEncodingType), uintptr(findFlags), uintptr(findType), uintptr(findPara), uintptr(unsafe.Pointer(prevCertContext))) + cert = (*CertContext)(unsafe.Pointer(r0)) + if cert == nil { + err = errnoErr(e1) + } + return +} + +func CertFindChainInStore(store Handle, certEncodingType uint32, findFlags uint32, findType uint32, findPara unsafe.Pointer, prevChainContext *CertChainContext) (certchain *CertChainContext, err error) { + r0, _, e1 := syscall.SyscallN(procCertFindChainInStore.Addr(), uintptr(store), uintptr(certEncodingType), uintptr(findFlags), uintptr(findType), uintptr(findPara), uintptr(unsafe.Pointer(prevChainContext))) + certchain = (*CertChainContext)(unsafe.Pointer(r0)) + if certchain == nil { + err = errnoErr(e1) + } + return +} + +func CertFindExtension(objId *byte, countExtensions uint32, extensions *CertExtension) (ret *CertExtension) { + r0, _, _ := syscall.SyscallN(procCertFindExtension.Addr(), uintptr(unsafe.Pointer(objId)), uintptr(countExtensions), uintptr(unsafe.Pointer(extensions))) + ret = (*CertExtension)(unsafe.Pointer(r0)) + return +} + +func CertFreeCertificateChain(ctx *CertChainContext) { + syscall.SyscallN(procCertFreeCertificateChain.Addr(), uintptr(unsafe.Pointer(ctx))) + return +} + +func CertFreeCertificateContext(ctx *CertContext) (err error) { + r1, _, e1 := syscall.SyscallN(procCertFreeCertificateContext.Addr(), uintptr(unsafe.Pointer(ctx))) + if r1 == 0 { + err = errnoErr(e1) + } + return +} + +func CertGetCertificateChain(engine Handle, leaf *CertContext, time *Filetime, additionalStore Handle, para *CertChainPara, flags uint32, reserved uintptr, chainCtx **CertChainContext) (err error) { + r1, _, e1 := syscall.SyscallN(procCertGetCertificateChain.Addr(), uintptr(engine), uintptr(unsafe.Pointer(leaf)), uintptr(unsafe.Pointer(time)), uintptr(additionalStore), uintptr(unsafe.Pointer(para)), uintptr(flags), uintptr(reserved), uintptr(unsafe.Pointer(chainCtx))) + if r1 == 0 { + err = errnoErr(e1) + } + return +} + +func CertGetNameString(certContext *CertContext, nameType uint32, flags uint32, typePara unsafe.Pointer, name *uint16, size uint32) (chars uint32) { + r0, _, _ := syscall.SyscallN(procCertGetNameStringW.Addr(), uintptr(unsafe.Pointer(certContext)), uintptr(nameType), uintptr(flags), uintptr(typePara), uintptr(unsafe.Pointer(name)), uintptr(size)) + chars = uint32(r0) + return +} + +func CertOpenStore(storeProvider uintptr, msgAndCertEncodingType uint32, cryptProv uintptr, flags uint32, para uintptr) (handle Handle, err error) { + r0, _, e1 := syscall.SyscallN(procCertOpenStore.Addr(), uintptr(storeProvider), uintptr(msgAndCertEncodingType), uintptr(cryptProv), uintptr(flags), uintptr(para)) + handle = Handle(r0) + if handle == 0 { + err = errnoErr(e1) + } + return +} + +func CertOpenSystemStore(hprov Handle, name *uint16) (store Handle, err error) { + r0, _, e1 := syscall.SyscallN(procCertOpenSystemStoreW.Addr(), uintptr(hprov), uintptr(unsafe.Pointer(name))) + store = Handle(r0) + if store == 0 { + err = errnoErr(e1) + } + return +} + +func CertVerifyCertificateChainPolicy(policyOID uintptr, chain *CertChainContext, para *CertChainPolicyPara, status *CertChainPolicyStatus) (err error) { + r1, _, e1 := syscall.SyscallN(procCertVerifyCertificateChainPolicy.Addr(), uintptr(policyOID), uintptr(unsafe.Pointer(chain)), uintptr(unsafe.Pointer(para)), uintptr(unsafe.Pointer(status))) + if r1 == 0 { + err = errnoErr(e1) + } + return +} + +func CryptAcquireCertificatePrivateKey(cert *CertContext, flags uint32, parameters unsafe.Pointer, cryptProvOrNCryptKey *Handle, keySpec *uint32, callerFreeProvOrNCryptKey *bool) (err error) { + var _p0 uint32 + if *callerFreeProvOrNCryptKey { + _p0 = 1 + } + r1, _, e1 := syscall.SyscallN(procCryptAcquireCertificatePrivateKey.Addr(), uintptr(unsafe.Pointer(cert)), uintptr(flags), uintptr(parameters), uintptr(unsafe.Pointer(cryptProvOrNCryptKey)), uintptr(unsafe.Pointer(keySpec)), uintptr(unsafe.Pointer(&_p0))) + *callerFreeProvOrNCryptKey = _p0 != 0 + if r1 == 0 { + err = errnoErr(e1) + } + return +} + +func CryptDecodeObject(encodingType uint32, structType *byte, encodedBytes *byte, lenEncodedBytes uint32, flags uint32, decoded unsafe.Pointer, decodedLen *uint32) (err error) { + r1, _, e1 := syscall.SyscallN(procCryptDecodeObject.Addr(), uintptr(encodingType), uintptr(unsafe.Pointer(structType)), uintptr(unsafe.Pointer(encodedBytes)), uintptr(lenEncodedBytes), uintptr(flags), uintptr(decoded), uintptr(unsafe.Pointer(decodedLen))) + if r1 == 0 { + err = errnoErr(e1) + } + return +} + +func CryptProtectData(dataIn *DataBlob, name *uint16, optionalEntropy *DataBlob, reserved uintptr, promptStruct *CryptProtectPromptStruct, flags uint32, dataOut *DataBlob) (err error) { + r1, _, e1 := syscall.SyscallN(procCryptProtectData.Addr(), uintptr(unsafe.Pointer(dataIn)), uintptr(unsafe.Pointer(name)), uintptr(unsafe.Pointer(optionalEntropy)), uintptr(reserved), uintptr(unsafe.Pointer(promptStruct)), uintptr(flags), uintptr(unsafe.Pointer(dataOut))) + if r1 == 0 { + err = errnoErr(e1) + } + return +} + +func CryptQueryObject(objectType uint32, object unsafe.Pointer, expectedContentTypeFlags uint32, expectedFormatTypeFlags uint32, flags uint32, msgAndCertEncodingType *uint32, contentType *uint32, formatType *uint32, certStore *Handle, msg *Handle, context *unsafe.Pointer) (err error) { + r1, _, e1 := syscall.SyscallN(procCryptQueryObject.Addr(), uintptr(objectType), uintptr(object), uintptr(expectedContentTypeFlags), uintptr(expectedFormatTypeFlags), uintptr(flags), uintptr(unsafe.Pointer(msgAndCertEncodingType)), uintptr(unsafe.Pointer(contentType)), uintptr(unsafe.Pointer(formatType)), uintptr(unsafe.Pointer(certStore)), uintptr(unsafe.Pointer(msg)), uintptr(unsafe.Pointer(context))) + if r1 == 0 { + err = errnoErr(e1) + } + return +} + +func CryptUnprotectData(dataIn *DataBlob, name **uint16, optionalEntropy *DataBlob, reserved uintptr, promptStruct *CryptProtectPromptStruct, flags uint32, dataOut *DataBlob) (err error) { + r1, _, e1 := syscall.SyscallN(procCryptUnprotectData.Addr(), uintptr(unsafe.Pointer(dataIn)), uintptr(unsafe.Pointer(name)), uintptr(unsafe.Pointer(optionalEntropy)), uintptr(reserved), uintptr(unsafe.Pointer(promptStruct)), uintptr(flags), uintptr(unsafe.Pointer(dataOut))) + if r1 == 0 { + err = errnoErr(e1) + } + return +} + +func PFXImportCertStore(pfx *CryptDataBlob, password *uint16, flags uint32) (store Handle, err error) { + r0, _, e1 := syscall.SyscallN(procPFXImportCertStore.Addr(), uintptr(unsafe.Pointer(pfx)), uintptr(unsafe.Pointer(password)), uintptr(flags)) + store = Handle(r0) + if store == 0 { + err = errnoErr(e1) + } + return +} + +func DnsNameCompare(name1 *uint16, name2 *uint16) (same bool) { + r0, _, _ := syscall.SyscallN(procDnsNameCompare_W.Addr(), uintptr(unsafe.Pointer(name1)), uintptr(unsafe.Pointer(name2))) + same = r0 != 0 + return +} + +func DnsQuery(name string, qtype uint16, options uint32, extra *byte, qrs **DNSRecord, pr *byte) (status error) { + var _p0 *uint16 + _p0, status = syscall.UTF16PtrFromString(name) + if status != nil { + return + } + return _DnsQuery(_p0, qtype, options, extra, qrs, pr) +} + +func _DnsQuery(name *uint16, qtype uint16, options uint32, extra *byte, qrs **DNSRecord, pr *byte) (status error) { + r0, _, _ := syscall.SyscallN(procDnsQuery_W.Addr(), uintptr(unsafe.Pointer(name)), uintptr(qtype), uintptr(options), uintptr(unsafe.Pointer(extra)), uintptr(unsafe.Pointer(qrs)), uintptr(unsafe.Pointer(pr))) + if r0 != 0 { + status = syscall.Errno(r0) + } + return +} + +func DnsRecordListFree(rl *DNSRecord, freetype uint32) { + syscall.SyscallN(procDnsRecordListFree.Addr(), uintptr(unsafe.Pointer(rl)), uintptr(freetype)) + return +} + +func DwmGetWindowAttribute(hwnd HWND, attribute uint32, value unsafe.Pointer, size uint32) (ret error) { + r0, _, _ := syscall.SyscallN(procDwmGetWindowAttribute.Addr(), uintptr(hwnd), uintptr(attribute), uintptr(value), uintptr(size)) + if r0 != 0 { + ret = syscall.Errno(r0) + } + return +} + +func DwmSetWindowAttribute(hwnd HWND, attribute uint32, value unsafe.Pointer, size uint32) (ret error) { + r0, _, _ := syscall.SyscallN(procDwmSetWindowAttribute.Addr(), uintptr(hwnd), uintptr(attribute), uintptr(value), uintptr(size)) + if r0 != 0 { + ret = syscall.Errno(r0) + } + return +} + +func CancelMibChangeNotify2(notificationHandle Handle) (errcode error) { + r0, _, _ := syscall.SyscallN(procCancelMibChangeNotify2.Addr(), uintptr(notificationHandle)) + if r0 != 0 { + errcode = syscall.Errno(r0) + } + return +} + +func FreeMibTable(memory unsafe.Pointer) { + syscall.SyscallN(procFreeMibTable.Addr(), uintptr(memory)) + return +} + +func GetAdaptersAddresses(family uint32, flags uint32, reserved uintptr, adapterAddresses *IpAdapterAddresses, sizePointer *uint32) (errcode error) { + r0, _, _ := syscall.SyscallN(procGetAdaptersAddresses.Addr(), uintptr(family), uintptr(flags), uintptr(reserved), uintptr(unsafe.Pointer(adapterAddresses)), uintptr(unsafe.Pointer(sizePointer))) + if r0 != 0 { + errcode = syscall.Errno(r0) + } + return +} + +func GetAdaptersInfo(ai *IpAdapterInfo, ol *uint32) (errcode error) { + r0, _, _ := syscall.SyscallN(procGetAdaptersInfo.Addr(), uintptr(unsafe.Pointer(ai)), uintptr(unsafe.Pointer(ol))) + if r0 != 0 { + errcode = syscall.Errno(r0) + } + return +} + +func getBestInterfaceEx(sockaddr unsafe.Pointer, pdwBestIfIndex *uint32) (errcode error) { + r0, _, _ := syscall.SyscallN(procGetBestInterfaceEx.Addr(), uintptr(sockaddr), uintptr(unsafe.Pointer(pdwBestIfIndex))) + if r0 != 0 { + errcode = syscall.Errno(r0) + } + return +} + +func GetIfEntry(pIfRow *MibIfRow) (errcode error) { + r0, _, _ := syscall.SyscallN(procGetIfEntry.Addr(), uintptr(unsafe.Pointer(pIfRow))) + if r0 != 0 { + errcode = syscall.Errno(r0) + } + return +} + +func GetIfEntry2Ex(level uint32, row *MibIfRow2) (errcode error) { + r0, _, _ := syscall.SyscallN(procGetIfEntry2Ex.Addr(), uintptr(level), uintptr(unsafe.Pointer(row))) + if r0 != 0 { + errcode = syscall.Errno(r0) + } + return +} + +func GetIpForwardEntry2(row *MibIpForwardRow2) (errcode error) { + r0, _, _ := syscall.SyscallN(procGetIpForwardEntry2.Addr(), uintptr(unsafe.Pointer(row))) + if r0 != 0 { + errcode = syscall.Errno(r0) + } + return +} + +func GetIpForwardTable2(family uint16, table **MibIpForwardTable2) (errcode error) { + r0, _, _ := syscall.SyscallN(procGetIpForwardTable2.Addr(), uintptr(family), uintptr(unsafe.Pointer(table))) + if r0 != 0 { + errcode = syscall.Errno(r0) + } + return +} + +func GetUnicastIpAddressEntry(row *MibUnicastIpAddressRow) (errcode error) { + r0, _, _ := syscall.SyscallN(procGetUnicastIpAddressEntry.Addr(), uintptr(unsafe.Pointer(row))) + if r0 != 0 { + errcode = syscall.Errno(r0) + } + return +} + +func NotifyIpInterfaceChange(family uint16, callback uintptr, callerContext unsafe.Pointer, initialNotification bool, notificationHandle *Handle) (errcode error) { + var _p0 uint32 + if initialNotification { + _p0 = 1 + } + r0, _, _ := syscall.SyscallN(procNotifyIpInterfaceChange.Addr(), uintptr(family), uintptr(callback), uintptr(callerContext), uintptr(_p0), uintptr(unsafe.Pointer(notificationHandle))) + if r0 != 0 { + errcode = syscall.Errno(r0) + } + return +} + +func NotifyRouteChange2(family uint16, callback uintptr, callerContext unsafe.Pointer, initialNotification bool, notificationHandle *Handle) (errcode error) { + var _p0 uint32 + if initialNotification { + _p0 = 1 + } + r0, _, _ := syscall.SyscallN(procNotifyRouteChange2.Addr(), uintptr(family), uintptr(callback), uintptr(callerContext), uintptr(_p0), uintptr(unsafe.Pointer(notificationHandle))) + if r0 != 0 { + errcode = syscall.Errno(r0) + } + return +} + +func NotifyUnicastIpAddressChange(family uint16, callback uintptr, callerContext unsafe.Pointer, initialNotification bool, notificationHandle *Handle) (errcode error) { + var _p0 uint32 + if initialNotification { + _p0 = 1 + } + r0, _, _ := syscall.SyscallN(procNotifyUnicastIpAddressChange.Addr(), uintptr(family), uintptr(callback), uintptr(callerContext), uintptr(_p0), uintptr(unsafe.Pointer(notificationHandle))) + if r0 != 0 { + errcode = syscall.Errno(r0) + } + return +} + +func AddDllDirectory(path *uint16) (cookie uintptr, err error) { + r0, _, e1 := syscall.SyscallN(procAddDllDirectory.Addr(), uintptr(unsafe.Pointer(path))) + cookie = uintptr(r0) + if cookie == 0 { + err = errnoErr(e1) + } + return +} + +func AssignProcessToJobObject(job Handle, process Handle) (err error) { + r1, _, e1 := syscall.SyscallN(procAssignProcessToJobObject.Addr(), uintptr(job), uintptr(process)) + if r1 == 0 { + err = errnoErr(e1) + } + return +} + +func CancelIo(s Handle) (err error) { + r1, _, e1 := syscall.SyscallN(procCancelIo.Addr(), uintptr(s)) + if r1 == 0 { + err = errnoErr(e1) + } + return +} + +func CancelIoEx(s Handle, o *Overlapped) (err error) { + r1, _, e1 := syscall.SyscallN(procCancelIoEx.Addr(), uintptr(s), uintptr(unsafe.Pointer(o))) + if r1 == 0 { + err = errnoErr(e1) + } + return +} + +func ClearCommBreak(handle Handle) (err error) { + r1, _, e1 := syscall.SyscallN(procClearCommBreak.Addr(), uintptr(handle)) + if r1 == 0 { + err = errnoErr(e1) + } + return +} + +func ClearCommError(handle Handle, lpErrors *uint32, lpStat *ComStat) (err error) { + r1, _, e1 := syscall.SyscallN(procClearCommError.Addr(), uintptr(handle), uintptr(unsafe.Pointer(lpErrors)), uintptr(unsafe.Pointer(lpStat))) + if r1 == 0 { + err = errnoErr(e1) + } + return +} + +func CloseHandle(handle Handle) (err error) { + r1, _, e1 := syscall.SyscallN(procCloseHandle.Addr(), uintptr(handle)) + if r1 == 0 { + err = errnoErr(e1) + } + return +} + +func ClosePseudoConsole(console Handle) { + syscall.SyscallN(procClosePseudoConsole.Addr(), uintptr(console)) + return +} + +func ConnectNamedPipe(pipe Handle, overlapped *Overlapped) (err error) { + r1, _, e1 := syscall.SyscallN(procConnectNamedPipe.Addr(), uintptr(pipe), uintptr(unsafe.Pointer(overlapped))) + if r1 == 0 { + err = errnoErr(e1) + } + return +} + +func CreateDirectory(path *uint16, sa *SecurityAttributes) (err error) { + r1, _, e1 := syscall.SyscallN(procCreateDirectoryW.Addr(), uintptr(unsafe.Pointer(path)), uintptr(unsafe.Pointer(sa))) + if r1 == 0 { + err = errnoErr(e1) + } + return +} + +func CreateEventEx(eventAttrs *SecurityAttributes, name *uint16, flags uint32, desiredAccess uint32) (handle Handle, err error) { + r0, _, e1 := syscall.SyscallN(procCreateEventExW.Addr(), uintptr(unsafe.Pointer(eventAttrs)), uintptr(unsafe.Pointer(name)), uintptr(flags), uintptr(desiredAccess)) + handle = Handle(r0) + if handle == 0 || e1 == ERROR_ALREADY_EXISTS { + err = errnoErr(e1) + } + return +} + +func CreateEvent(eventAttrs *SecurityAttributes, manualReset uint32, initialState uint32, name *uint16) (handle Handle, err error) { + r0, _, e1 := syscall.SyscallN(procCreateEventW.Addr(), uintptr(unsafe.Pointer(eventAttrs)), uintptr(manualReset), uintptr(initialState), uintptr(unsafe.Pointer(name))) + handle = Handle(r0) + if handle == 0 || e1 == ERROR_ALREADY_EXISTS { + err = errnoErr(e1) + } + return +} + +func CreateFileMapping(fhandle Handle, sa *SecurityAttributes, prot uint32, maxSizeHigh uint32, maxSizeLow uint32, name *uint16) (handle Handle, err error) { + r0, _, e1 := syscall.SyscallN(procCreateFileMappingW.Addr(), uintptr(fhandle), uintptr(unsafe.Pointer(sa)), uintptr(prot), uintptr(maxSizeHigh), uintptr(maxSizeLow), uintptr(unsafe.Pointer(name))) + handle = Handle(r0) + if handle == 0 || e1 == ERROR_ALREADY_EXISTS { + err = errnoErr(e1) + } + return +} + +func CreateFile(name *uint16, access uint32, mode uint32, sa *SecurityAttributes, createmode uint32, attrs uint32, templatefile Handle) (handle Handle, err error) { + r0, _, e1 := syscall.SyscallN(procCreateFileW.Addr(), uintptr(unsafe.Pointer(name)), uintptr(access), uintptr(mode), uintptr(unsafe.Pointer(sa)), uintptr(createmode), uintptr(attrs), uintptr(templatefile)) + handle = Handle(r0) + if handle == InvalidHandle { + err = errnoErr(e1) + } + return +} + +func CreateHardLink(filename *uint16, existingfilename *uint16, reserved uintptr) (err error) { + r1, _, e1 := syscall.SyscallN(procCreateHardLinkW.Addr(), uintptr(unsafe.Pointer(filename)), uintptr(unsafe.Pointer(existingfilename)), uintptr(reserved)) + if r1&0xff == 0 { + err = errnoErr(e1) + } + return +} + +func CreateIoCompletionPort(filehandle Handle, cphandle Handle, key uintptr, threadcnt uint32) (handle Handle, err error) { + r0, _, e1 := syscall.SyscallN(procCreateIoCompletionPort.Addr(), uintptr(filehandle), uintptr(cphandle), uintptr(key), uintptr(threadcnt)) + handle = Handle(r0) + if handle == 0 { + err = errnoErr(e1) + } + return +} + +func CreateJobObject(jobAttr *SecurityAttributes, name *uint16) (handle Handle, err error) { + r0, _, e1 := syscall.SyscallN(procCreateJobObjectW.Addr(), uintptr(unsafe.Pointer(jobAttr)), uintptr(unsafe.Pointer(name))) + handle = Handle(r0) + if handle == 0 { + err = errnoErr(e1) + } + return +} + +func CreateMutexEx(mutexAttrs *SecurityAttributes, name *uint16, flags uint32, desiredAccess uint32) (handle Handle, err error) { + r0, _, e1 := syscall.SyscallN(procCreateMutexExW.Addr(), uintptr(unsafe.Pointer(mutexAttrs)), uintptr(unsafe.Pointer(name)), uintptr(flags), uintptr(desiredAccess)) + handle = Handle(r0) + if handle == 0 || e1 == ERROR_ALREADY_EXISTS { + err = errnoErr(e1) + } + return +} + +func CreateMutex(mutexAttrs *SecurityAttributes, initialOwner bool, name *uint16) (handle Handle, err error) { + var _p0 uint32 + if initialOwner { + _p0 = 1 + } + r0, _, e1 := syscall.SyscallN(procCreateMutexW.Addr(), uintptr(unsafe.Pointer(mutexAttrs)), uintptr(_p0), uintptr(unsafe.Pointer(name))) + handle = Handle(r0) + if handle == 0 || e1 == ERROR_ALREADY_EXISTS { + err = errnoErr(e1) + } + return +} + +func CreateNamedPipe(name *uint16, flags uint32, pipeMode uint32, maxInstances uint32, outSize uint32, inSize uint32, defaultTimeout uint32, sa *SecurityAttributes) (handle Handle, err error) { + r0, _, e1 := syscall.SyscallN(procCreateNamedPipeW.Addr(), uintptr(unsafe.Pointer(name)), uintptr(flags), uintptr(pipeMode), uintptr(maxInstances), uintptr(outSize), uintptr(inSize), uintptr(defaultTimeout), uintptr(unsafe.Pointer(sa))) + handle = Handle(r0) + if handle == InvalidHandle { + err = errnoErr(e1) + } + return +} + +func CreatePipe(readhandle *Handle, writehandle *Handle, sa *SecurityAttributes, size uint32) (err error) { + r1, _, e1 := syscall.SyscallN(procCreatePipe.Addr(), uintptr(unsafe.Pointer(readhandle)), uintptr(unsafe.Pointer(writehandle)), uintptr(unsafe.Pointer(sa)), uintptr(size)) + if r1 == 0 { + err = errnoErr(e1) + } + return +} + +func CreateProcess(appName *uint16, commandLine *uint16, procSecurity *SecurityAttributes, threadSecurity *SecurityAttributes, inheritHandles bool, creationFlags uint32, env *uint16, currentDir *uint16, startupInfo *StartupInfo, outProcInfo *ProcessInformation) (err error) { + var _p0 uint32 + if inheritHandles { + _p0 = 1 + } + r1, _, e1 := syscall.SyscallN(procCreateProcessW.Addr(), uintptr(unsafe.Pointer(appName)), uintptr(unsafe.Pointer(commandLine)), uintptr(unsafe.Pointer(procSecurity)), uintptr(unsafe.Pointer(threadSecurity)), uintptr(_p0), uintptr(creationFlags), uintptr(unsafe.Pointer(env)), uintptr(unsafe.Pointer(currentDir)), uintptr(unsafe.Pointer(startupInfo)), uintptr(unsafe.Pointer(outProcInfo))) + if r1 == 0 { + err = errnoErr(e1) + } + return +} + +func createPseudoConsole(size uint32, in Handle, out Handle, flags uint32, pconsole *Handle) (hr error) { + r0, _, _ := syscall.SyscallN(procCreatePseudoConsole.Addr(), uintptr(size), uintptr(in), uintptr(out), uintptr(flags), uintptr(unsafe.Pointer(pconsole))) + if r0 != 0 { + hr = syscall.Errno(r0) + } + return +} + +func CreateSymbolicLink(symlinkfilename *uint16, targetfilename *uint16, flags uint32) (err error) { + r1, _, e1 := syscall.SyscallN(procCreateSymbolicLinkW.Addr(), uintptr(unsafe.Pointer(symlinkfilename)), uintptr(unsafe.Pointer(targetfilename)), uintptr(flags)) + if r1&0xff == 0 { + err = errnoErr(e1) + } + return +} + +func CreateToolhelp32Snapshot(flags uint32, processId uint32) (handle Handle, err error) { + r0, _, e1 := syscall.SyscallN(procCreateToolhelp32Snapshot.Addr(), uintptr(flags), uintptr(processId)) + handle = Handle(r0) + if handle == InvalidHandle { + err = errnoErr(e1) + } + return +} + +func DefineDosDevice(flags uint32, deviceName *uint16, targetPath *uint16) (err error) { + r1, _, e1 := syscall.SyscallN(procDefineDosDeviceW.Addr(), uintptr(flags), uintptr(unsafe.Pointer(deviceName)), uintptr(unsafe.Pointer(targetPath))) + if r1 == 0 { + err = errnoErr(e1) + } + return +} + +func DeleteFile(path *uint16) (err error) { + r1, _, e1 := syscall.SyscallN(procDeleteFileW.Addr(), uintptr(unsafe.Pointer(path))) + if r1 == 0 { + err = errnoErr(e1) + } + return +} + +func deleteProcThreadAttributeList(attrlist *ProcThreadAttributeList) { + syscall.SyscallN(procDeleteProcThreadAttributeList.Addr(), uintptr(unsafe.Pointer(attrlist))) + return +} + +func DeleteVolumeMountPoint(volumeMountPoint *uint16) (err error) { + r1, _, e1 := syscall.SyscallN(procDeleteVolumeMountPointW.Addr(), uintptr(unsafe.Pointer(volumeMountPoint))) + if r1 == 0 { + err = errnoErr(e1) + } + return +} + +func DeviceIoControl(handle Handle, ioControlCode uint32, inBuffer *byte, inBufferSize uint32, outBuffer *byte, outBufferSize uint32, bytesReturned *uint32, overlapped *Overlapped) (err error) { + r1, _, e1 := syscall.SyscallN(procDeviceIoControl.Addr(), uintptr(handle), uintptr(ioControlCode), uintptr(unsafe.Pointer(inBuffer)), uintptr(inBufferSize), uintptr(unsafe.Pointer(outBuffer)), uintptr(outBufferSize), uintptr(unsafe.Pointer(bytesReturned)), uintptr(unsafe.Pointer(overlapped))) + if r1 == 0 { + err = errnoErr(e1) + } + return +} + +func DisconnectNamedPipe(pipe Handle) (err error) { + r1, _, e1 := syscall.SyscallN(procDisconnectNamedPipe.Addr(), uintptr(pipe)) + if r1 == 0 { + err = errnoErr(e1) + } + return +} + +func DuplicateHandle(hSourceProcessHandle Handle, hSourceHandle Handle, hTargetProcessHandle Handle, lpTargetHandle *Handle, dwDesiredAccess uint32, bInheritHandle bool, dwOptions uint32) (err error) { + var _p0 uint32 + if bInheritHandle { + _p0 = 1 + } + r1, _, e1 := syscall.SyscallN(procDuplicateHandle.Addr(), uintptr(hSourceProcessHandle), uintptr(hSourceHandle), uintptr(hTargetProcessHandle), uintptr(unsafe.Pointer(lpTargetHandle)), uintptr(dwDesiredAccess), uintptr(_p0), uintptr(dwOptions)) + if r1 == 0 { + err = errnoErr(e1) + } + return +} + +func EscapeCommFunction(handle Handle, dwFunc uint32) (err error) { + r1, _, e1 := syscall.SyscallN(procEscapeCommFunction.Addr(), uintptr(handle), uintptr(dwFunc)) + if r1 == 0 { + err = errnoErr(e1) + } + return +} + +func ExitProcess(exitcode uint32) { + syscall.SyscallN(procExitProcess.Addr(), uintptr(exitcode)) + return +} + +func ExpandEnvironmentStrings(src *uint16, dst *uint16, size uint32) (n uint32, err error) { + r0, _, e1 := syscall.SyscallN(procExpandEnvironmentStringsW.Addr(), uintptr(unsafe.Pointer(src)), uintptr(unsafe.Pointer(dst)), uintptr(size)) + n = uint32(r0) + if n == 0 { + err = errnoErr(e1) + } + return +} + +func FindClose(handle Handle) (err error) { + r1, _, e1 := syscall.SyscallN(procFindClose.Addr(), uintptr(handle)) + if r1 == 0 { + err = errnoErr(e1) + } + return +} + +func FindCloseChangeNotification(handle Handle) (err error) { + r1, _, e1 := syscall.SyscallN(procFindCloseChangeNotification.Addr(), uintptr(handle)) + if r1 == 0 { + err = errnoErr(e1) + } + return +} + +func FindFirstChangeNotification(path string, watchSubtree bool, notifyFilter uint32) (handle Handle, err error) { + var _p0 *uint16 + _p0, err = syscall.UTF16PtrFromString(path) + if err != nil { + return + } + return _FindFirstChangeNotification(_p0, watchSubtree, notifyFilter) +} + +func _FindFirstChangeNotification(path *uint16, watchSubtree bool, notifyFilter uint32) (handle Handle, err error) { + var _p1 uint32 + if watchSubtree { + _p1 = 1 + } + r0, _, e1 := syscall.SyscallN(procFindFirstChangeNotificationW.Addr(), uintptr(unsafe.Pointer(path)), uintptr(_p1), uintptr(notifyFilter)) + handle = Handle(r0) + if handle == InvalidHandle { + err = errnoErr(e1) + } + return +} + +func findFirstFile1(name *uint16, data *win32finddata1) (handle Handle, err error) { + r0, _, e1 := syscall.SyscallN(procFindFirstFileW.Addr(), uintptr(unsafe.Pointer(name)), uintptr(unsafe.Pointer(data))) + handle = Handle(r0) + if handle == InvalidHandle { + err = errnoErr(e1) + } + return +} + +func FindFirstVolumeMountPoint(rootPathName *uint16, volumeMountPoint *uint16, bufferLength uint32) (handle Handle, err error) { + r0, _, e1 := syscall.SyscallN(procFindFirstVolumeMountPointW.Addr(), uintptr(unsafe.Pointer(rootPathName)), uintptr(unsafe.Pointer(volumeMountPoint)), uintptr(bufferLength)) + handle = Handle(r0) + if handle == InvalidHandle { + err = errnoErr(e1) + } + return +} + +func FindFirstVolume(volumeName *uint16, bufferLength uint32) (handle Handle, err error) { + r0, _, e1 := syscall.SyscallN(procFindFirstVolumeW.Addr(), uintptr(unsafe.Pointer(volumeName)), uintptr(bufferLength)) + handle = Handle(r0) + if handle == InvalidHandle { + err = errnoErr(e1) + } + return +} + +func FindNextChangeNotification(handle Handle) (err error) { + r1, _, e1 := syscall.SyscallN(procFindNextChangeNotification.Addr(), uintptr(handle)) + if r1 == 0 { + err = errnoErr(e1) + } + return +} + +func findNextFile1(handle Handle, data *win32finddata1) (err error) { + r1, _, e1 := syscall.SyscallN(procFindNextFileW.Addr(), uintptr(handle), uintptr(unsafe.Pointer(data))) + if r1 == 0 { + err = errnoErr(e1) + } + return +} + +func FindNextVolumeMountPoint(findVolumeMountPoint Handle, volumeMountPoint *uint16, bufferLength uint32) (err error) { + r1, _, e1 := syscall.SyscallN(procFindNextVolumeMountPointW.Addr(), uintptr(findVolumeMountPoint), uintptr(unsafe.Pointer(volumeMountPoint)), uintptr(bufferLength)) + if r1 == 0 { + err = errnoErr(e1) + } + return +} + +func FindNextVolume(findVolume Handle, volumeName *uint16, bufferLength uint32) (err error) { + r1, _, e1 := syscall.SyscallN(procFindNextVolumeW.Addr(), uintptr(findVolume), uintptr(unsafe.Pointer(volumeName)), uintptr(bufferLength)) + if r1 == 0 { + err = errnoErr(e1) + } + return +} + +func findResource(module Handle, name uintptr, resType uintptr) (resInfo Handle, err error) { + r0, _, e1 := syscall.SyscallN(procFindResourceW.Addr(), uintptr(module), uintptr(name), uintptr(resType)) + resInfo = Handle(r0) + if resInfo == 0 { + err = errnoErr(e1) + } + return +} + +func FindVolumeClose(findVolume Handle) (err error) { + r1, _, e1 := syscall.SyscallN(procFindVolumeClose.Addr(), uintptr(findVolume)) + if r1 == 0 { + err = errnoErr(e1) + } + return +} + +func FindVolumeMountPointClose(findVolumeMountPoint Handle) (err error) { + r1, _, e1 := syscall.SyscallN(procFindVolumeMountPointClose.Addr(), uintptr(findVolumeMountPoint)) + if r1 == 0 { + err = errnoErr(e1) + } + return +} + +func FlushConsoleInputBuffer(console Handle) (err error) { + r1, _, e1 := syscall.SyscallN(procFlushConsoleInputBuffer.Addr(), uintptr(console)) + if r1 == 0 { + err = errnoErr(e1) + } + return +} + +func FlushFileBuffers(handle Handle) (err error) { + r1, _, e1 := syscall.SyscallN(procFlushFileBuffers.Addr(), uintptr(handle)) + if r1 == 0 { + err = errnoErr(e1) + } + return +} + +func FlushViewOfFile(addr uintptr, length uintptr) (err error) { + r1, _, e1 := syscall.SyscallN(procFlushViewOfFile.Addr(), uintptr(addr), uintptr(length)) + if r1 == 0 { + err = errnoErr(e1) + } + return +} + +func FormatMessage(flags uint32, msgsrc uintptr, msgid uint32, langid uint32, buf []uint16, args *byte) (n uint32, err error) { + var _p0 *uint16 + if len(buf) > 0 { + _p0 = &buf[0] + } + r0, _, e1 := syscall.SyscallN(procFormatMessageW.Addr(), uintptr(flags), uintptr(msgsrc), uintptr(msgid), uintptr(langid), uintptr(unsafe.Pointer(_p0)), uintptr(len(buf)), uintptr(unsafe.Pointer(args))) + n = uint32(r0) + if n == 0 { + err = errnoErr(e1) + } + return +} + +func FreeEnvironmentStrings(envs *uint16) (err error) { + r1, _, e1 := syscall.SyscallN(procFreeEnvironmentStringsW.Addr(), uintptr(unsafe.Pointer(envs))) + if r1 == 0 { + err = errnoErr(e1) + } + return +} + +func FreeLibrary(handle Handle) (err error) { + r1, _, e1 := syscall.SyscallN(procFreeLibrary.Addr(), uintptr(handle)) + if r1 == 0 { + err = errnoErr(e1) + } + return +} + +func GenerateConsoleCtrlEvent(ctrlEvent uint32, processGroupID uint32) (err error) { + r1, _, e1 := syscall.SyscallN(procGenerateConsoleCtrlEvent.Addr(), uintptr(ctrlEvent), uintptr(processGroupID)) + if r1 == 0 { + err = errnoErr(e1) + } + return +} + +func GetACP() (acp uint32) { + r0, _, _ := syscall.SyscallN(procGetACP.Addr()) + acp = uint32(r0) + return +} + +func GetActiveProcessorCount(groupNumber uint16) (ret uint32) { + r0, _, _ := syscall.SyscallN(procGetActiveProcessorCount.Addr(), uintptr(groupNumber)) + ret = uint32(r0) + return +} + +func GetCommModemStatus(handle Handle, lpModemStat *uint32) (err error) { + r1, _, e1 := syscall.SyscallN(procGetCommModemStatus.Addr(), uintptr(handle), uintptr(unsafe.Pointer(lpModemStat))) + if r1 == 0 { + err = errnoErr(e1) + } + return +} + +func GetCommState(handle Handle, lpDCB *DCB) (err error) { + r1, _, e1 := syscall.SyscallN(procGetCommState.Addr(), uintptr(handle), uintptr(unsafe.Pointer(lpDCB))) + if r1 == 0 { + err = errnoErr(e1) + } + return +} + +func GetCommTimeouts(handle Handle, timeouts *CommTimeouts) (err error) { + r1, _, e1 := syscall.SyscallN(procGetCommTimeouts.Addr(), uintptr(handle), uintptr(unsafe.Pointer(timeouts))) + if r1 == 0 { + err = errnoErr(e1) + } + return +} + +func GetCommandLine() (cmd *uint16) { + r0, _, _ := syscall.SyscallN(procGetCommandLineW.Addr()) + cmd = (*uint16)(unsafe.Pointer(r0)) + return +} + +func GetComputerNameEx(nametype uint32, buf *uint16, n *uint32) (err error) { + r1, _, e1 := syscall.SyscallN(procGetComputerNameExW.Addr(), uintptr(nametype), uintptr(unsafe.Pointer(buf)), uintptr(unsafe.Pointer(n))) + if r1 == 0 { + err = errnoErr(e1) + } + return +} + +func GetComputerName(buf *uint16, n *uint32) (err error) { + r1, _, e1 := syscall.SyscallN(procGetComputerNameW.Addr(), uintptr(unsafe.Pointer(buf)), uintptr(unsafe.Pointer(n))) + if r1 == 0 { + err = errnoErr(e1) + } + return +} + +func GetConsoleCP() (cp uint32, err error) { + r0, _, e1 := syscall.SyscallN(procGetConsoleCP.Addr()) + cp = uint32(r0) + if cp == 0 { + err = errnoErr(e1) + } + return +} + +func GetConsoleMode(console Handle, mode *uint32) (err error) { + r1, _, e1 := syscall.SyscallN(procGetConsoleMode.Addr(), uintptr(console), uintptr(unsafe.Pointer(mode))) + if r1 == 0 { + err = errnoErr(e1) + } + return +} + +func GetConsoleOutputCP() (cp uint32, err error) { + r0, _, e1 := syscall.SyscallN(procGetConsoleOutputCP.Addr()) + cp = uint32(r0) + if cp == 0 { + err = errnoErr(e1) + } + return +} + +func GetConsoleScreenBufferInfo(console Handle, info *ConsoleScreenBufferInfo) (err error) { + r1, _, e1 := syscall.SyscallN(procGetConsoleScreenBufferInfo.Addr(), uintptr(console), uintptr(unsafe.Pointer(info))) + if r1 == 0 { + err = errnoErr(e1) + } + return +} + +func GetCurrentDirectory(buflen uint32, buf *uint16) (n uint32, err error) { + r0, _, e1 := syscall.SyscallN(procGetCurrentDirectoryW.Addr(), uintptr(buflen), uintptr(unsafe.Pointer(buf))) + n = uint32(r0) + if n == 0 { + err = errnoErr(e1) + } + return +} + +func GetCurrentProcessId() (pid uint32) { + r0, _, _ := syscall.SyscallN(procGetCurrentProcessId.Addr()) + pid = uint32(r0) + return +} + +func GetCurrentThreadId() (id uint32) { + r0, _, _ := syscall.SyscallN(procGetCurrentThreadId.Addr()) + id = uint32(r0) + return +} + +func GetDiskFreeSpaceEx(directoryName *uint16, freeBytesAvailableToCaller *uint64, totalNumberOfBytes *uint64, totalNumberOfFreeBytes *uint64) (err error) { + r1, _, e1 := syscall.SyscallN(procGetDiskFreeSpaceExW.Addr(), uintptr(unsafe.Pointer(directoryName)), uintptr(unsafe.Pointer(freeBytesAvailableToCaller)), uintptr(unsafe.Pointer(totalNumberOfBytes)), uintptr(unsafe.Pointer(totalNumberOfFreeBytes))) + if r1 == 0 { + err = errnoErr(e1) + } + return +} + +func GetDriveType(rootPathName *uint16) (driveType uint32) { + r0, _, _ := syscall.SyscallN(procGetDriveTypeW.Addr(), uintptr(unsafe.Pointer(rootPathName))) + driveType = uint32(r0) + return +} + +func GetEnvironmentStrings() (envs *uint16, err error) { + r0, _, e1 := syscall.SyscallN(procGetEnvironmentStringsW.Addr()) + envs = (*uint16)(unsafe.Pointer(r0)) + if envs == nil { + err = errnoErr(e1) + } + return +} + +func GetEnvironmentVariable(name *uint16, buffer *uint16, size uint32) (n uint32, err error) { + r0, _, e1 := syscall.SyscallN(procGetEnvironmentVariableW.Addr(), uintptr(unsafe.Pointer(name)), uintptr(unsafe.Pointer(buffer)), uintptr(size)) + n = uint32(r0) + if n == 0 { + err = errnoErr(e1) + } + return +} + +func GetExitCodeProcess(handle Handle, exitcode *uint32) (err error) { + r1, _, e1 := syscall.SyscallN(procGetExitCodeProcess.Addr(), uintptr(handle), uintptr(unsafe.Pointer(exitcode))) + if r1 == 0 { + err = errnoErr(e1) + } + return +} + +func GetFileAttributesEx(name *uint16, level uint32, info *byte) (err error) { + r1, _, e1 := syscall.SyscallN(procGetFileAttributesExW.Addr(), uintptr(unsafe.Pointer(name)), uintptr(level), uintptr(unsafe.Pointer(info))) + if r1 == 0 { + err = errnoErr(e1) + } + return +} + +func GetFileAttributes(name *uint16) (attrs uint32, err error) { + r0, _, e1 := syscall.SyscallN(procGetFileAttributesW.Addr(), uintptr(unsafe.Pointer(name))) + attrs = uint32(r0) + if attrs == INVALID_FILE_ATTRIBUTES { + err = errnoErr(e1) + } + return +} + +func GetFileInformationByHandle(handle Handle, data *ByHandleFileInformation) (err error) { + r1, _, e1 := syscall.SyscallN(procGetFileInformationByHandle.Addr(), uintptr(handle), uintptr(unsafe.Pointer(data))) + if r1 == 0 { + err = errnoErr(e1) + } + return +} + +func GetFileInformationByHandleEx(handle Handle, class uint32, outBuffer *byte, outBufferLen uint32) (err error) { + r1, _, e1 := syscall.SyscallN(procGetFileInformationByHandleEx.Addr(), uintptr(handle), uintptr(class), uintptr(unsafe.Pointer(outBuffer)), uintptr(outBufferLen)) + if r1 == 0 { + err = errnoErr(e1) + } + return +} + +func GetFileTime(handle Handle, ctime *Filetime, atime *Filetime, wtime *Filetime) (err error) { + r1, _, e1 := syscall.SyscallN(procGetFileTime.Addr(), uintptr(handle), uintptr(unsafe.Pointer(ctime)), uintptr(unsafe.Pointer(atime)), uintptr(unsafe.Pointer(wtime))) + if r1 == 0 { + err = errnoErr(e1) + } + return +} + +func GetFileType(filehandle Handle) (n uint32, err error) { + r0, _, e1 := syscall.SyscallN(procGetFileType.Addr(), uintptr(filehandle)) + n = uint32(r0) + if n == 0 { + err = errnoErr(e1) + } + return +} + +func GetFinalPathNameByHandle(file Handle, filePath *uint16, filePathSize uint32, flags uint32) (n uint32, err error) { + r0, _, e1 := syscall.SyscallN(procGetFinalPathNameByHandleW.Addr(), uintptr(file), uintptr(unsafe.Pointer(filePath)), uintptr(filePathSize), uintptr(flags)) + n = uint32(r0) + if n == 0 { + err = errnoErr(e1) + } + return +} + +func GetFullPathName(path *uint16, buflen uint32, buf *uint16, fname **uint16) (n uint32, err error) { + r0, _, e1 := syscall.SyscallN(procGetFullPathNameW.Addr(), uintptr(unsafe.Pointer(path)), uintptr(buflen), uintptr(unsafe.Pointer(buf)), uintptr(unsafe.Pointer(fname))) + n = uint32(r0) + if n == 0 { + err = errnoErr(e1) + } + return +} + +func GetLargePageMinimum() (size uintptr) { + r0, _, _ := syscall.SyscallN(procGetLargePageMinimum.Addr()) + size = uintptr(r0) + return +} + +func GetLastError() (lasterr error) { + r0, _, _ := syscall.SyscallN(procGetLastError.Addr()) + if r0 != 0 { + lasterr = syscall.Errno(r0) + } + return +} + +func GetLogicalDriveStrings(bufferLength uint32, buffer *uint16) (n uint32, err error) { + r0, _, e1 := syscall.SyscallN(procGetLogicalDriveStringsW.Addr(), uintptr(bufferLength), uintptr(unsafe.Pointer(buffer))) + n = uint32(r0) + if n == 0 { + err = errnoErr(e1) + } + return +} + +func GetLogicalDrives() (drivesBitMask uint32, err error) { + r0, _, e1 := syscall.SyscallN(procGetLogicalDrives.Addr()) + drivesBitMask = uint32(r0) + if drivesBitMask == 0 { + err = errnoErr(e1) + } + return +} + +func GetLongPathName(path *uint16, buf *uint16, buflen uint32) (n uint32, err error) { + r0, _, e1 := syscall.SyscallN(procGetLongPathNameW.Addr(), uintptr(unsafe.Pointer(path)), uintptr(unsafe.Pointer(buf)), uintptr(buflen)) + n = uint32(r0) + if n == 0 { + err = errnoErr(e1) + } + return +} + +func GetMaximumProcessorCount(groupNumber uint16) (ret uint32) { + r0, _, _ := syscall.SyscallN(procGetMaximumProcessorCount.Addr(), uintptr(groupNumber)) + ret = uint32(r0) + return +} + +func GetModuleFileName(module Handle, filename *uint16, size uint32) (n uint32, err error) { + r0, _, e1 := syscall.SyscallN(procGetModuleFileNameW.Addr(), uintptr(module), uintptr(unsafe.Pointer(filename)), uintptr(size)) + n = uint32(r0) + if n == 0 { + err = errnoErr(e1) + } + return +} + +func GetModuleHandleEx(flags uint32, moduleName *uint16, module *Handle) (err error) { + r1, _, e1 := syscall.SyscallN(procGetModuleHandleExW.Addr(), uintptr(flags), uintptr(unsafe.Pointer(moduleName)), uintptr(unsafe.Pointer(module))) + if r1 == 0 { + err = errnoErr(e1) + } + return +} + +func GetNamedPipeClientProcessId(pipe Handle, clientProcessID *uint32) (err error) { + r1, _, e1 := syscall.SyscallN(procGetNamedPipeClientProcessId.Addr(), uintptr(pipe), uintptr(unsafe.Pointer(clientProcessID))) + if r1 == 0 { + err = errnoErr(e1) + } + return +} + +func GetNamedPipeHandleState(pipe Handle, state *uint32, curInstances *uint32, maxCollectionCount *uint32, collectDataTimeout *uint32, userName *uint16, maxUserNameSize uint32) (err error) { + r1, _, e1 := syscall.SyscallN(procGetNamedPipeHandleStateW.Addr(), uintptr(pipe), uintptr(unsafe.Pointer(state)), uintptr(unsafe.Pointer(curInstances)), uintptr(unsafe.Pointer(maxCollectionCount)), uintptr(unsafe.Pointer(collectDataTimeout)), uintptr(unsafe.Pointer(userName)), uintptr(maxUserNameSize)) + if r1 == 0 { + err = errnoErr(e1) + } + return +} + +func GetNamedPipeInfo(pipe Handle, flags *uint32, outSize *uint32, inSize *uint32, maxInstances *uint32) (err error) { + r1, _, e1 := syscall.SyscallN(procGetNamedPipeInfo.Addr(), uintptr(pipe), uintptr(unsafe.Pointer(flags)), uintptr(unsafe.Pointer(outSize)), uintptr(unsafe.Pointer(inSize)), uintptr(unsafe.Pointer(maxInstances))) + if r1 == 0 { + err = errnoErr(e1) + } + return +} + +func GetNamedPipeServerProcessId(pipe Handle, serverProcessID *uint32) (err error) { + r1, _, e1 := syscall.SyscallN(procGetNamedPipeServerProcessId.Addr(), uintptr(pipe), uintptr(unsafe.Pointer(serverProcessID))) + if r1 == 0 { + err = errnoErr(e1) + } + return +} + +func GetNumberOfConsoleInputEvents(console Handle, numevents *uint32) (err error) { + r1, _, e1 := syscall.SyscallN(procGetNumberOfConsoleInputEvents.Addr(), uintptr(console), uintptr(unsafe.Pointer(numevents))) + if r1 == 0 { + err = errnoErr(e1) + } + return +} + +func GetOverlappedResult(handle Handle, overlapped *Overlapped, done *uint32, wait bool) (err error) { + var _p0 uint32 + if wait { + _p0 = 1 + } + r1, _, e1 := syscall.SyscallN(procGetOverlappedResult.Addr(), uintptr(handle), uintptr(unsafe.Pointer(overlapped)), uintptr(unsafe.Pointer(done)), uintptr(_p0)) + if r1 == 0 { + err = errnoErr(e1) + } + return +} + +func GetPriorityClass(process Handle) (ret uint32, err error) { + r0, _, e1 := syscall.SyscallN(procGetPriorityClass.Addr(), uintptr(process)) + ret = uint32(r0) + if ret == 0 { + err = errnoErr(e1) + } + return +} + +func GetProcAddress(module Handle, procname string) (proc uintptr, err error) { + var _p0 *byte + _p0, err = syscall.BytePtrFromString(procname) + if err != nil { + return + } + return _GetProcAddress(module, _p0) +} + +func _GetProcAddress(module Handle, procname *byte) (proc uintptr, err error) { + r0, _, e1 := syscall.SyscallN(procGetProcAddress.Addr(), uintptr(module), uintptr(unsafe.Pointer(procname))) + proc = uintptr(r0) + if proc == 0 { + err = errnoErr(e1) + } + return +} + +func GetProcessId(process Handle) (id uint32, err error) { + r0, _, e1 := syscall.SyscallN(procGetProcessId.Addr(), uintptr(process)) + id = uint32(r0) + if id == 0 { + err = errnoErr(e1) + } + return +} + +func getProcessPreferredUILanguages(flags uint32, numLanguages *uint32, buf *uint16, bufSize *uint32) (err error) { + r1, _, e1 := syscall.SyscallN(procGetProcessPreferredUILanguages.Addr(), uintptr(flags), uintptr(unsafe.Pointer(numLanguages)), uintptr(unsafe.Pointer(buf)), uintptr(unsafe.Pointer(bufSize))) + if r1 == 0 { + err = errnoErr(e1) + } + return +} + +func GetProcessShutdownParameters(level *uint32, flags *uint32) (err error) { + r1, _, e1 := syscall.SyscallN(procGetProcessShutdownParameters.Addr(), uintptr(unsafe.Pointer(level)), uintptr(unsafe.Pointer(flags))) + if r1 == 0 { + err = errnoErr(e1) + } + return +} + +func GetProcessTimes(handle Handle, creationTime *Filetime, exitTime *Filetime, kernelTime *Filetime, userTime *Filetime) (err error) { + r1, _, e1 := syscall.SyscallN(procGetProcessTimes.Addr(), uintptr(handle), uintptr(unsafe.Pointer(creationTime)), uintptr(unsafe.Pointer(exitTime)), uintptr(unsafe.Pointer(kernelTime)), uintptr(unsafe.Pointer(userTime))) + if r1 == 0 { + err = errnoErr(e1) + } + return +} + +func GetProcessWorkingSetSizeEx(hProcess Handle, lpMinimumWorkingSetSize *uintptr, lpMaximumWorkingSetSize *uintptr, flags *uint32) { + syscall.SyscallN(procGetProcessWorkingSetSizeEx.Addr(), uintptr(hProcess), uintptr(unsafe.Pointer(lpMinimumWorkingSetSize)), uintptr(unsafe.Pointer(lpMaximumWorkingSetSize)), uintptr(unsafe.Pointer(flags))) + return +} + +func GetQueuedCompletionStatus(cphandle Handle, qty *uint32, key *uintptr, overlapped **Overlapped, timeout uint32) (err error) { + r1, _, e1 := syscall.SyscallN(procGetQueuedCompletionStatus.Addr(), uintptr(cphandle), uintptr(unsafe.Pointer(qty)), uintptr(unsafe.Pointer(key)), uintptr(unsafe.Pointer(overlapped)), uintptr(timeout)) + if r1 == 0 { + err = errnoErr(e1) + } + return +} + +func GetShortPathName(longpath *uint16, shortpath *uint16, buflen uint32) (n uint32, err error) { + r0, _, e1 := syscall.SyscallN(procGetShortPathNameW.Addr(), uintptr(unsafe.Pointer(longpath)), uintptr(unsafe.Pointer(shortpath)), uintptr(buflen)) + n = uint32(r0) + if n == 0 { + err = errnoErr(e1) + } + return +} + +func getStartupInfo(startupInfo *StartupInfo) { + syscall.SyscallN(procGetStartupInfoW.Addr(), uintptr(unsafe.Pointer(startupInfo))) + return +} + +func GetStdHandle(stdhandle uint32) (handle Handle, err error) { + r0, _, e1 := syscall.SyscallN(procGetStdHandle.Addr(), uintptr(stdhandle)) + handle = Handle(r0) + if handle == InvalidHandle { + err = errnoErr(e1) + } + return +} + +func getSystemDirectory(dir *uint16, dirLen uint32) (len uint32, err error) { + r0, _, e1 := syscall.SyscallN(procGetSystemDirectoryW.Addr(), uintptr(unsafe.Pointer(dir)), uintptr(dirLen)) + len = uint32(r0) + if len == 0 { + err = errnoErr(e1) + } + return +} + +func getSystemPreferredUILanguages(flags uint32, numLanguages *uint32, buf *uint16, bufSize *uint32) (err error) { + r1, _, e1 := syscall.SyscallN(procGetSystemPreferredUILanguages.Addr(), uintptr(flags), uintptr(unsafe.Pointer(numLanguages)), uintptr(unsafe.Pointer(buf)), uintptr(unsafe.Pointer(bufSize))) + if r1 == 0 { + err = errnoErr(e1) + } + return +} + +func GetSystemTimeAsFileTime(time *Filetime) { + syscall.SyscallN(procGetSystemTimeAsFileTime.Addr(), uintptr(unsafe.Pointer(time))) + return +} + +func GetSystemTimePreciseAsFileTime(time *Filetime) { + syscall.SyscallN(procGetSystemTimePreciseAsFileTime.Addr(), uintptr(unsafe.Pointer(time))) + return +} + +func getSystemWindowsDirectory(dir *uint16, dirLen uint32) (len uint32, err error) { + r0, _, e1 := syscall.SyscallN(procGetSystemWindowsDirectoryW.Addr(), uintptr(unsafe.Pointer(dir)), uintptr(dirLen)) + len = uint32(r0) + if len == 0 { + err = errnoErr(e1) + } + return +} + +func GetTempPath(buflen uint32, buf *uint16) (n uint32, err error) { + r0, _, e1 := syscall.SyscallN(procGetTempPathW.Addr(), uintptr(buflen), uintptr(unsafe.Pointer(buf))) + n = uint32(r0) + if n == 0 { + err = errnoErr(e1) + } + return +} + +func getThreadPreferredUILanguages(flags uint32, numLanguages *uint32, buf *uint16, bufSize *uint32) (err error) { + r1, _, e1 := syscall.SyscallN(procGetThreadPreferredUILanguages.Addr(), uintptr(flags), uintptr(unsafe.Pointer(numLanguages)), uintptr(unsafe.Pointer(buf)), uintptr(unsafe.Pointer(bufSize))) + if r1 == 0 { + err = errnoErr(e1) + } + return +} + +func getTickCount64() (ms uint64) { + r0, _, _ := syscall.SyscallN(procGetTickCount64.Addr()) + ms = uint64(r0) + return +} + +func GetTimeZoneInformation(tzi *Timezoneinformation) (rc uint32, err error) { + r0, _, e1 := syscall.SyscallN(procGetTimeZoneInformation.Addr(), uintptr(unsafe.Pointer(tzi))) + rc = uint32(r0) + if rc == 0xffffffff { + err = errnoErr(e1) + } + return +} + +func getUserPreferredUILanguages(flags uint32, numLanguages *uint32, buf *uint16, bufSize *uint32) (err error) { + r1, _, e1 := syscall.SyscallN(procGetUserPreferredUILanguages.Addr(), uintptr(flags), uintptr(unsafe.Pointer(numLanguages)), uintptr(unsafe.Pointer(buf)), uintptr(unsafe.Pointer(bufSize))) + if r1 == 0 { + err = errnoErr(e1) + } + return +} + +func GetVersion() (ver uint32, err error) { + r0, _, e1 := syscall.SyscallN(procGetVersion.Addr()) + ver = uint32(r0) + if ver == 0 { + err = errnoErr(e1) + } + return +} + +func GetVolumeInformationByHandle(file Handle, volumeNameBuffer *uint16, volumeNameSize uint32, volumeNameSerialNumber *uint32, maximumComponentLength *uint32, fileSystemFlags *uint32, fileSystemNameBuffer *uint16, fileSystemNameSize uint32) (err error) { + r1, _, e1 := syscall.SyscallN(procGetVolumeInformationByHandleW.Addr(), uintptr(file), uintptr(unsafe.Pointer(volumeNameBuffer)), uintptr(volumeNameSize), uintptr(unsafe.Pointer(volumeNameSerialNumber)), uintptr(unsafe.Pointer(maximumComponentLength)), uintptr(unsafe.Pointer(fileSystemFlags)), uintptr(unsafe.Pointer(fileSystemNameBuffer)), uintptr(fileSystemNameSize)) + if r1 == 0 { + err = errnoErr(e1) + } + return +} + +func GetVolumeInformation(rootPathName *uint16, volumeNameBuffer *uint16, volumeNameSize uint32, volumeNameSerialNumber *uint32, maximumComponentLength *uint32, fileSystemFlags *uint32, fileSystemNameBuffer *uint16, fileSystemNameSize uint32) (err error) { + r1, _, e1 := syscall.SyscallN(procGetVolumeInformationW.Addr(), uintptr(unsafe.Pointer(rootPathName)), uintptr(unsafe.Pointer(volumeNameBuffer)), uintptr(volumeNameSize), uintptr(unsafe.Pointer(volumeNameSerialNumber)), uintptr(unsafe.Pointer(maximumComponentLength)), uintptr(unsafe.Pointer(fileSystemFlags)), uintptr(unsafe.Pointer(fileSystemNameBuffer)), uintptr(fileSystemNameSize)) + if r1 == 0 { + err = errnoErr(e1) + } + return +} + +func GetVolumeNameForVolumeMountPoint(volumeMountPoint *uint16, volumeName *uint16, bufferlength uint32) (err error) { + r1, _, e1 := syscall.SyscallN(procGetVolumeNameForVolumeMountPointW.Addr(), uintptr(unsafe.Pointer(volumeMountPoint)), uintptr(unsafe.Pointer(volumeName)), uintptr(bufferlength)) + if r1 == 0 { + err = errnoErr(e1) + } + return +} + +func GetVolumePathName(fileName *uint16, volumePathName *uint16, bufferLength uint32) (err error) { + r1, _, e1 := syscall.SyscallN(procGetVolumePathNameW.Addr(), uintptr(unsafe.Pointer(fileName)), uintptr(unsafe.Pointer(volumePathName)), uintptr(bufferLength)) + if r1 == 0 { + err = errnoErr(e1) + } + return +} + +func GetVolumePathNamesForVolumeName(volumeName *uint16, volumePathNames *uint16, bufferLength uint32, returnLength *uint32) (err error) { + r1, _, e1 := syscall.SyscallN(procGetVolumePathNamesForVolumeNameW.Addr(), uintptr(unsafe.Pointer(volumeName)), uintptr(unsafe.Pointer(volumePathNames)), uintptr(bufferLength), uintptr(unsafe.Pointer(returnLength))) + if r1 == 0 { + err = errnoErr(e1) + } + return +} + +func getWindowsDirectory(dir *uint16, dirLen uint32) (len uint32, err error) { + r0, _, e1 := syscall.SyscallN(procGetWindowsDirectoryW.Addr(), uintptr(unsafe.Pointer(dir)), uintptr(dirLen)) + len = uint32(r0) + if len == 0 { + err = errnoErr(e1) + } + return +} + +func initializeProcThreadAttributeList(attrlist *ProcThreadAttributeList, attrcount uint32, flags uint32, size *uintptr) (err error) { + r1, _, e1 := syscall.SyscallN(procInitializeProcThreadAttributeList.Addr(), uintptr(unsafe.Pointer(attrlist)), uintptr(attrcount), uintptr(flags), uintptr(unsafe.Pointer(size))) + if r1 == 0 { + err = errnoErr(e1) + } + return +} + +func IsProcessorFeaturePresent(ProcessorFeature uint32) (ret bool) { + r0, _, _ := syscall.SyscallN(procIsProcessorFeaturePresent.Addr(), uintptr(ProcessorFeature)) + ret = r0 != 0 + return +} + +func IsWow64Process(handle Handle, isWow64 *bool) (err error) { + var _p0 uint32 + if *isWow64 { + _p0 = 1 + } + r1, _, e1 := syscall.SyscallN(procIsWow64Process.Addr(), uintptr(handle), uintptr(unsafe.Pointer(&_p0))) + *isWow64 = _p0 != 0 + if r1 == 0 { + err = errnoErr(e1) + } + return +} + +func IsWow64Process2(handle Handle, processMachine *uint16, nativeMachine *uint16) (err error) { + err = procIsWow64Process2.Find() + if err != nil { + return + } + r1, _, e1 := syscall.SyscallN(procIsWow64Process2.Addr(), uintptr(handle), uintptr(unsafe.Pointer(processMachine)), uintptr(unsafe.Pointer(nativeMachine))) + if r1 == 0 { + err = errnoErr(e1) + } + return +} + +func LoadLibraryEx(libname string, zero Handle, flags uintptr) (handle Handle, err error) { + var _p0 *uint16 + _p0, err = syscall.UTF16PtrFromString(libname) + if err != nil { + return + } + return _LoadLibraryEx(_p0, zero, flags) +} + +func _LoadLibraryEx(libname *uint16, zero Handle, flags uintptr) (handle Handle, err error) { + r0, _, e1 := syscall.SyscallN(procLoadLibraryExW.Addr(), uintptr(unsafe.Pointer(libname)), uintptr(zero), uintptr(flags)) + handle = Handle(r0) + if handle == 0 { + err = errnoErr(e1) + } + return +} + +func LoadLibrary(libname string) (handle Handle, err error) { + var _p0 *uint16 + _p0, err = syscall.UTF16PtrFromString(libname) + if err != nil { + return + } + return _LoadLibrary(_p0) +} + +func _LoadLibrary(libname *uint16) (handle Handle, err error) { + r0, _, e1 := syscall.SyscallN(procLoadLibraryW.Addr(), uintptr(unsafe.Pointer(libname))) + handle = Handle(r0) + if handle == 0 { + err = errnoErr(e1) + } + return +} + +func LoadResource(module Handle, resInfo Handle) (resData Handle, err error) { + r0, _, e1 := syscall.SyscallN(procLoadResource.Addr(), uintptr(module), uintptr(resInfo)) + resData = Handle(r0) + if resData == 0 { + err = errnoErr(e1) + } + return +} + +func LocalAlloc(flags uint32, length uint32) (ptr uintptr, err error) { + r0, _, e1 := syscall.SyscallN(procLocalAlloc.Addr(), uintptr(flags), uintptr(length)) + ptr = uintptr(r0) + if ptr == 0 { + err = errnoErr(e1) + } + return +} + +func LocalFree(hmem Handle) (handle Handle, err error) { + r0, _, e1 := syscall.SyscallN(procLocalFree.Addr(), uintptr(hmem)) + handle = Handle(r0) + if handle != 0 { + err = errnoErr(e1) + } + return +} + +func LockFileEx(file Handle, flags uint32, reserved uint32, bytesLow uint32, bytesHigh uint32, overlapped *Overlapped) (err error) { + r1, _, e1 := syscall.SyscallN(procLockFileEx.Addr(), uintptr(file), uintptr(flags), uintptr(reserved), uintptr(bytesLow), uintptr(bytesHigh), uintptr(unsafe.Pointer(overlapped))) + if r1 == 0 { + err = errnoErr(e1) + } + return +} + +func LockResource(resData Handle) (addr uintptr, err error) { + r0, _, e1 := syscall.SyscallN(procLockResource.Addr(), uintptr(resData)) + addr = uintptr(r0) + if addr == 0 { + err = errnoErr(e1) + } + return +} + +func MapViewOfFile(handle Handle, access uint32, offsetHigh uint32, offsetLow uint32, length uintptr) (addr uintptr, err error) { + r0, _, e1 := syscall.SyscallN(procMapViewOfFile.Addr(), uintptr(handle), uintptr(access), uintptr(offsetHigh), uintptr(offsetLow), uintptr(length)) + addr = uintptr(r0) + if addr == 0 { + err = errnoErr(e1) + } + return +} + +func Module32First(snapshot Handle, moduleEntry *ModuleEntry32) (err error) { + r1, _, e1 := syscall.SyscallN(procModule32FirstW.Addr(), uintptr(snapshot), uintptr(unsafe.Pointer(moduleEntry))) + if r1 == 0 { + err = errnoErr(e1) + } + return +} + +func Module32Next(snapshot Handle, moduleEntry *ModuleEntry32) (err error) { + r1, _, e1 := syscall.SyscallN(procModule32NextW.Addr(), uintptr(snapshot), uintptr(unsafe.Pointer(moduleEntry))) + if r1 == 0 { + err = errnoErr(e1) + } + return +} + +func MoveFileEx(from *uint16, to *uint16, flags uint32) (err error) { + r1, _, e1 := syscall.SyscallN(procMoveFileExW.Addr(), uintptr(unsafe.Pointer(from)), uintptr(unsafe.Pointer(to)), uintptr(flags)) + if r1 == 0 { + err = errnoErr(e1) + } + return +} + +func MoveFile(from *uint16, to *uint16) (err error) { + r1, _, e1 := syscall.SyscallN(procMoveFileW.Addr(), uintptr(unsafe.Pointer(from)), uintptr(unsafe.Pointer(to))) + if r1 == 0 { + err = errnoErr(e1) + } + return +} + +func MultiByteToWideChar(codePage uint32, dwFlags uint32, str *byte, nstr int32, wchar *uint16, nwchar int32) (nwrite int32, err error) { + r0, _, e1 := syscall.SyscallN(procMultiByteToWideChar.Addr(), uintptr(codePage), uintptr(dwFlags), uintptr(unsafe.Pointer(str)), uintptr(nstr), uintptr(unsafe.Pointer(wchar)), uintptr(nwchar)) + nwrite = int32(r0) + if nwrite == 0 { + err = errnoErr(e1) + } + return +} + +func OpenEvent(desiredAccess uint32, inheritHandle bool, name *uint16) (handle Handle, err error) { + var _p0 uint32 + if inheritHandle { + _p0 = 1 + } + r0, _, e1 := syscall.SyscallN(procOpenEventW.Addr(), uintptr(desiredAccess), uintptr(_p0), uintptr(unsafe.Pointer(name))) + handle = Handle(r0) + if handle == 0 { + err = errnoErr(e1) + } + return +} + +func OpenMutex(desiredAccess uint32, inheritHandle bool, name *uint16) (handle Handle, err error) { + var _p0 uint32 + if inheritHandle { + _p0 = 1 + } + r0, _, e1 := syscall.SyscallN(procOpenMutexW.Addr(), uintptr(desiredAccess), uintptr(_p0), uintptr(unsafe.Pointer(name))) + handle = Handle(r0) + if handle == 0 { + err = errnoErr(e1) + } + return +} + +func OpenProcess(desiredAccess uint32, inheritHandle bool, processId uint32) (handle Handle, err error) { + var _p0 uint32 + if inheritHandle { + _p0 = 1 + } + r0, _, e1 := syscall.SyscallN(procOpenProcess.Addr(), uintptr(desiredAccess), uintptr(_p0), uintptr(processId)) + handle = Handle(r0) + if handle == 0 { + err = errnoErr(e1) + } + return +} + +func OpenThread(desiredAccess uint32, inheritHandle bool, threadId uint32) (handle Handle, err error) { + var _p0 uint32 + if inheritHandle { + _p0 = 1 + } + r0, _, e1 := syscall.SyscallN(procOpenThread.Addr(), uintptr(desiredAccess), uintptr(_p0), uintptr(threadId)) + handle = Handle(r0) + if handle == 0 { + err = errnoErr(e1) + } + return +} + +func PostQueuedCompletionStatus(cphandle Handle, qty uint32, key uintptr, overlapped *Overlapped) (err error) { + r1, _, e1 := syscall.SyscallN(procPostQueuedCompletionStatus.Addr(), uintptr(cphandle), uintptr(qty), uintptr(key), uintptr(unsafe.Pointer(overlapped))) + if r1 == 0 { + err = errnoErr(e1) + } + return +} + +func Process32First(snapshot Handle, procEntry *ProcessEntry32) (err error) { + r1, _, e1 := syscall.SyscallN(procProcess32FirstW.Addr(), uintptr(snapshot), uintptr(unsafe.Pointer(procEntry))) + if r1 == 0 { + err = errnoErr(e1) + } + return +} + +func Process32Next(snapshot Handle, procEntry *ProcessEntry32) (err error) { + r1, _, e1 := syscall.SyscallN(procProcess32NextW.Addr(), uintptr(snapshot), uintptr(unsafe.Pointer(procEntry))) + if r1 == 0 { + err = errnoErr(e1) + } + return +} + +func ProcessIdToSessionId(pid uint32, sessionid *uint32) (err error) { + r1, _, e1 := syscall.SyscallN(procProcessIdToSessionId.Addr(), uintptr(pid), uintptr(unsafe.Pointer(sessionid))) + if r1 == 0 { + err = errnoErr(e1) + } + return +} + +func PulseEvent(event Handle) (err error) { + r1, _, e1 := syscall.SyscallN(procPulseEvent.Addr(), uintptr(event)) + if r1 == 0 { + err = errnoErr(e1) + } + return +} + +func PurgeComm(handle Handle, dwFlags uint32) (err error) { + r1, _, e1 := syscall.SyscallN(procPurgeComm.Addr(), uintptr(handle), uintptr(dwFlags)) + if r1 == 0 { + err = errnoErr(e1) + } + return +} + +func QueryDosDevice(deviceName *uint16, targetPath *uint16, max uint32) (n uint32, err error) { + r0, _, e1 := syscall.SyscallN(procQueryDosDeviceW.Addr(), uintptr(unsafe.Pointer(deviceName)), uintptr(unsafe.Pointer(targetPath)), uintptr(max)) + n = uint32(r0) + if n == 0 { + err = errnoErr(e1) + } + return +} + +func QueryFullProcessImageName(proc Handle, flags uint32, exeName *uint16, size *uint32) (err error) { + r1, _, e1 := syscall.SyscallN(procQueryFullProcessImageNameW.Addr(), uintptr(proc), uintptr(flags), uintptr(unsafe.Pointer(exeName)), uintptr(unsafe.Pointer(size))) + if r1 == 0 { + err = errnoErr(e1) + } + return +} + +func QueryInformationJobObject(job Handle, JobObjectInformationClass int32, JobObjectInformation uintptr, JobObjectInformationLength uint32, retlen *uint32) (err error) { + r1, _, e1 := syscall.SyscallN(procQueryInformationJobObject.Addr(), uintptr(job), uintptr(JobObjectInformationClass), uintptr(JobObjectInformation), uintptr(JobObjectInformationLength), uintptr(unsafe.Pointer(retlen))) + if r1 == 0 { + err = errnoErr(e1) + } + return +} + +func ReadConsole(console Handle, buf *uint16, toread uint32, read *uint32, inputControl *byte) (err error) { + r1, _, e1 := syscall.SyscallN(procReadConsoleW.Addr(), uintptr(console), uintptr(unsafe.Pointer(buf)), uintptr(toread), uintptr(unsafe.Pointer(read)), uintptr(unsafe.Pointer(inputControl))) + if r1 == 0 { + err = errnoErr(e1) + } + return +} + +func ReadDirectoryChanges(handle Handle, buf *byte, buflen uint32, watchSubTree bool, mask uint32, retlen *uint32, overlapped *Overlapped, completionRoutine uintptr) (err error) { + var _p0 uint32 + if watchSubTree { + _p0 = 1 + } + r1, _, e1 := syscall.SyscallN(procReadDirectoryChangesW.Addr(), uintptr(handle), uintptr(unsafe.Pointer(buf)), uintptr(buflen), uintptr(_p0), uintptr(mask), uintptr(unsafe.Pointer(retlen)), uintptr(unsafe.Pointer(overlapped)), uintptr(completionRoutine)) + if r1 == 0 { + err = errnoErr(e1) + } + return +} + +func readFile(handle Handle, buf []byte, done *uint32, overlapped *Overlapped) (err error) { + var _p0 *byte + if len(buf) > 0 { + _p0 = &buf[0] + } + r1, _, e1 := syscall.SyscallN(procReadFile.Addr(), uintptr(handle), uintptr(unsafe.Pointer(_p0)), uintptr(len(buf)), uintptr(unsafe.Pointer(done)), uintptr(unsafe.Pointer(overlapped))) + if r1 == 0 { + err = errnoErr(e1) + } + return +} + +func ReadProcessMemory(process Handle, baseAddress uintptr, buffer *byte, size uintptr, numberOfBytesRead *uintptr) (err error) { + r1, _, e1 := syscall.SyscallN(procReadProcessMemory.Addr(), uintptr(process), uintptr(baseAddress), uintptr(unsafe.Pointer(buffer)), uintptr(size), uintptr(unsafe.Pointer(numberOfBytesRead))) + if r1 == 0 { + err = errnoErr(e1) + } + return +} + +func ReleaseMutex(mutex Handle) (err error) { + r1, _, e1 := syscall.SyscallN(procReleaseMutex.Addr(), uintptr(mutex)) + if r1 == 0 { + err = errnoErr(e1) + } + return +} + +func RemoveDirectory(path *uint16) (err error) { + r1, _, e1 := syscall.SyscallN(procRemoveDirectoryW.Addr(), uintptr(unsafe.Pointer(path))) + if r1 == 0 { + err = errnoErr(e1) + } + return +} + +func RemoveDllDirectory(cookie uintptr) (err error) { + r1, _, e1 := syscall.SyscallN(procRemoveDllDirectory.Addr(), uintptr(cookie)) + if r1 == 0 { + err = errnoErr(e1) + } + return +} + +func ResetEvent(event Handle) (err error) { + r1, _, e1 := syscall.SyscallN(procResetEvent.Addr(), uintptr(event)) + if r1 == 0 { + err = errnoErr(e1) + } + return +} + +func resizePseudoConsole(pconsole Handle, size uint32) (hr error) { + r0, _, _ := syscall.SyscallN(procResizePseudoConsole.Addr(), uintptr(pconsole), uintptr(size)) + if r0 != 0 { + hr = syscall.Errno(r0) + } + return +} + +func ResumeThread(thread Handle) (ret uint32, err error) { + r0, _, e1 := syscall.SyscallN(procResumeThread.Addr(), uintptr(thread)) + ret = uint32(r0) + if ret == 0xffffffff { + err = errnoErr(e1) + } + return +} + +func SetCommBreak(handle Handle) (err error) { + r1, _, e1 := syscall.SyscallN(procSetCommBreak.Addr(), uintptr(handle)) + if r1 == 0 { + err = errnoErr(e1) + } + return +} + +func SetCommMask(handle Handle, dwEvtMask uint32) (err error) { + r1, _, e1 := syscall.SyscallN(procSetCommMask.Addr(), uintptr(handle), uintptr(dwEvtMask)) + if r1 == 0 { + err = errnoErr(e1) + } + return +} + +func SetCommState(handle Handle, lpDCB *DCB) (err error) { + r1, _, e1 := syscall.SyscallN(procSetCommState.Addr(), uintptr(handle), uintptr(unsafe.Pointer(lpDCB))) + if r1 == 0 { + err = errnoErr(e1) + } + return +} + +func SetCommTimeouts(handle Handle, timeouts *CommTimeouts) (err error) { + r1, _, e1 := syscall.SyscallN(procSetCommTimeouts.Addr(), uintptr(handle), uintptr(unsafe.Pointer(timeouts))) + if r1 == 0 { + err = errnoErr(e1) + } + return +} + +func SetConsoleCP(cp uint32) (err error) { + r1, _, e1 := syscall.SyscallN(procSetConsoleCP.Addr(), uintptr(cp)) + if r1 == 0 { + err = errnoErr(e1) + } + return +} + +func setConsoleCursorPosition(console Handle, position uint32) (err error) { + r1, _, e1 := syscall.SyscallN(procSetConsoleCursorPosition.Addr(), uintptr(console), uintptr(position)) + if r1 == 0 { + err = errnoErr(e1) + } + return +} + +func SetConsoleMode(console Handle, mode uint32) (err error) { + r1, _, e1 := syscall.SyscallN(procSetConsoleMode.Addr(), uintptr(console), uintptr(mode)) + if r1 == 0 { + err = errnoErr(e1) + } + return +} + +func SetConsoleOutputCP(cp uint32) (err error) { + r1, _, e1 := syscall.SyscallN(procSetConsoleOutputCP.Addr(), uintptr(cp)) + if r1 == 0 { + err = errnoErr(e1) + } + return +} + +func SetCurrentDirectory(path *uint16) (err error) { + r1, _, e1 := syscall.SyscallN(procSetCurrentDirectoryW.Addr(), uintptr(unsafe.Pointer(path))) + if r1 == 0 { + err = errnoErr(e1) + } + return +} + +func SetDefaultDllDirectories(directoryFlags uint32) (err error) { + r1, _, e1 := syscall.SyscallN(procSetDefaultDllDirectories.Addr(), uintptr(directoryFlags)) + if r1 == 0 { + err = errnoErr(e1) + } + return +} + +func SetDllDirectory(path string) (err error) { + var _p0 *uint16 + _p0, err = syscall.UTF16PtrFromString(path) + if err != nil { + return + } + return _SetDllDirectory(_p0) +} + +func _SetDllDirectory(path *uint16) (err error) { + r1, _, e1 := syscall.SyscallN(procSetDllDirectoryW.Addr(), uintptr(unsafe.Pointer(path))) + if r1 == 0 { + err = errnoErr(e1) + } + return +} + +func SetEndOfFile(handle Handle) (err error) { + r1, _, e1 := syscall.SyscallN(procSetEndOfFile.Addr(), uintptr(handle)) + if r1 == 0 { + err = errnoErr(e1) + } + return +} + +func SetEnvironmentVariable(name *uint16, value *uint16) (err error) { + r1, _, e1 := syscall.SyscallN(procSetEnvironmentVariableW.Addr(), uintptr(unsafe.Pointer(name)), uintptr(unsafe.Pointer(value))) + if r1 == 0 { + err = errnoErr(e1) + } + return +} + +func SetErrorMode(mode uint32) (ret uint32) { + r0, _, _ := syscall.SyscallN(procSetErrorMode.Addr(), uintptr(mode)) + ret = uint32(r0) + return +} + +func SetEvent(event Handle) (err error) { + r1, _, e1 := syscall.SyscallN(procSetEvent.Addr(), uintptr(event)) + if r1 == 0 { + err = errnoErr(e1) + } + return +} + +func SetFileAttributes(name *uint16, attrs uint32) (err error) { + r1, _, e1 := syscall.SyscallN(procSetFileAttributesW.Addr(), uintptr(unsafe.Pointer(name)), uintptr(attrs)) + if r1 == 0 { + err = errnoErr(e1) + } + return +} + +func SetFileCompletionNotificationModes(handle Handle, flags uint8) (err error) { + r1, _, e1 := syscall.SyscallN(procSetFileCompletionNotificationModes.Addr(), uintptr(handle), uintptr(flags)) + if r1 == 0 { + err = errnoErr(e1) + } + return +} + +func SetFileInformationByHandle(handle Handle, class uint32, inBuffer *byte, inBufferLen uint32) (err error) { + r1, _, e1 := syscall.SyscallN(procSetFileInformationByHandle.Addr(), uintptr(handle), uintptr(class), uintptr(unsafe.Pointer(inBuffer)), uintptr(inBufferLen)) + if r1 == 0 { + err = errnoErr(e1) + } + return +} + +func SetFilePointer(handle Handle, lowoffset int32, highoffsetptr *int32, whence uint32) (newlowoffset uint32, err error) { + r0, _, e1 := syscall.SyscallN(procSetFilePointer.Addr(), uintptr(handle), uintptr(lowoffset), uintptr(unsafe.Pointer(highoffsetptr)), uintptr(whence)) + newlowoffset = uint32(r0) + if newlowoffset == 0xffffffff { + err = errnoErr(e1) + } + return +} + +func SetFileTime(handle Handle, ctime *Filetime, atime *Filetime, wtime *Filetime) (err error) { + r1, _, e1 := syscall.SyscallN(procSetFileTime.Addr(), uintptr(handle), uintptr(unsafe.Pointer(ctime)), uintptr(unsafe.Pointer(atime)), uintptr(unsafe.Pointer(wtime))) + if r1 == 0 { + err = errnoErr(e1) + } + return +} + +func SetFileValidData(handle Handle, validDataLength int64) (err error) { + r1, _, e1 := syscall.SyscallN(procSetFileValidData.Addr(), uintptr(handle), uintptr(validDataLength)) + if r1 == 0 { + err = errnoErr(e1) + } + return +} + +func SetHandleInformation(handle Handle, mask uint32, flags uint32) (err error) { + r1, _, e1 := syscall.SyscallN(procSetHandleInformation.Addr(), uintptr(handle), uintptr(mask), uintptr(flags)) + if r1 == 0 { + err = errnoErr(e1) + } + return +} + +func SetInformationJobObject(job Handle, JobObjectInformationClass uint32, JobObjectInformation uintptr, JobObjectInformationLength uint32) (ret int, err error) { + r0, _, e1 := syscall.SyscallN(procSetInformationJobObject.Addr(), uintptr(job), uintptr(JobObjectInformationClass), uintptr(JobObjectInformation), uintptr(JobObjectInformationLength)) + ret = int(r0) + if ret == 0 { + err = errnoErr(e1) + } + return +} + +func SetNamedPipeHandleState(pipe Handle, state *uint32, maxCollectionCount *uint32, collectDataTimeout *uint32) (err error) { + r1, _, e1 := syscall.SyscallN(procSetNamedPipeHandleState.Addr(), uintptr(pipe), uintptr(unsafe.Pointer(state)), uintptr(unsafe.Pointer(maxCollectionCount)), uintptr(unsafe.Pointer(collectDataTimeout))) + if r1 == 0 { + err = errnoErr(e1) + } + return +} + +func SetPriorityClass(process Handle, priorityClass uint32) (err error) { + r1, _, e1 := syscall.SyscallN(procSetPriorityClass.Addr(), uintptr(process), uintptr(priorityClass)) + if r1 == 0 { + err = errnoErr(e1) + } + return +} + +func SetProcessPriorityBoost(process Handle, disable bool) (err error) { + var _p0 uint32 + if disable { + _p0 = 1 + } + r1, _, e1 := syscall.SyscallN(procSetProcessPriorityBoost.Addr(), uintptr(process), uintptr(_p0)) + if r1 == 0 { + err = errnoErr(e1) + } + return +} + +func SetProcessShutdownParameters(level uint32, flags uint32) (err error) { + r1, _, e1 := syscall.SyscallN(procSetProcessShutdownParameters.Addr(), uintptr(level), uintptr(flags)) + if r1 == 0 { + err = errnoErr(e1) + } + return +} + +func SetProcessWorkingSetSizeEx(hProcess Handle, dwMinimumWorkingSetSize uintptr, dwMaximumWorkingSetSize uintptr, flags uint32) (err error) { + r1, _, e1 := syscall.SyscallN(procSetProcessWorkingSetSizeEx.Addr(), uintptr(hProcess), uintptr(dwMinimumWorkingSetSize), uintptr(dwMaximumWorkingSetSize), uintptr(flags)) + if r1 == 0 { + err = errnoErr(e1) + } + return +} + +func SetStdHandle(stdhandle uint32, handle Handle) (err error) { + r1, _, e1 := syscall.SyscallN(procSetStdHandle.Addr(), uintptr(stdhandle), uintptr(handle)) + if r1 == 0 { + err = errnoErr(e1) + } + return +} + +func SetVolumeLabel(rootPathName *uint16, volumeName *uint16) (err error) { + r1, _, e1 := syscall.SyscallN(procSetVolumeLabelW.Addr(), uintptr(unsafe.Pointer(rootPathName)), uintptr(unsafe.Pointer(volumeName))) + if r1 == 0 { + err = errnoErr(e1) + } + return +} + +func SetVolumeMountPoint(volumeMountPoint *uint16, volumeName *uint16) (err error) { + r1, _, e1 := syscall.SyscallN(procSetVolumeMountPointW.Addr(), uintptr(unsafe.Pointer(volumeMountPoint)), uintptr(unsafe.Pointer(volumeName))) + if r1 == 0 { + err = errnoErr(e1) + } + return +} + +func SetupComm(handle Handle, dwInQueue uint32, dwOutQueue uint32) (err error) { + r1, _, e1 := syscall.SyscallN(procSetupComm.Addr(), uintptr(handle), uintptr(dwInQueue), uintptr(dwOutQueue)) + if r1 == 0 { + err = errnoErr(e1) + } + return +} + +func SizeofResource(module Handle, resInfo Handle) (size uint32, err error) { + r0, _, e1 := syscall.SyscallN(procSizeofResource.Addr(), uintptr(module), uintptr(resInfo)) + size = uint32(r0) + if size == 0 { + err = errnoErr(e1) + } + return +} + +func SleepEx(milliseconds uint32, alertable bool) (ret uint32) { + var _p0 uint32 + if alertable { + _p0 = 1 + } + r0, _, _ := syscall.SyscallN(procSleepEx.Addr(), uintptr(milliseconds), uintptr(_p0)) + ret = uint32(r0) + return +} + +func TerminateJobObject(job Handle, exitCode uint32) (err error) { + r1, _, e1 := syscall.SyscallN(procTerminateJobObject.Addr(), uintptr(job), uintptr(exitCode)) + if r1 == 0 { + err = errnoErr(e1) + } + return +} + +func TerminateProcess(handle Handle, exitcode uint32) (err error) { + r1, _, e1 := syscall.SyscallN(procTerminateProcess.Addr(), uintptr(handle), uintptr(exitcode)) + if r1 == 0 { + err = errnoErr(e1) + } + return +} + +func Thread32First(snapshot Handle, threadEntry *ThreadEntry32) (err error) { + r1, _, e1 := syscall.SyscallN(procThread32First.Addr(), uintptr(snapshot), uintptr(unsafe.Pointer(threadEntry))) + if r1 == 0 { + err = errnoErr(e1) + } + return +} + +func Thread32Next(snapshot Handle, threadEntry *ThreadEntry32) (err error) { + r1, _, e1 := syscall.SyscallN(procThread32Next.Addr(), uintptr(snapshot), uintptr(unsafe.Pointer(threadEntry))) + if r1 == 0 { + err = errnoErr(e1) + } + return +} + +func UnlockFileEx(file Handle, reserved uint32, bytesLow uint32, bytesHigh uint32, overlapped *Overlapped) (err error) { + r1, _, e1 := syscall.SyscallN(procUnlockFileEx.Addr(), uintptr(file), uintptr(reserved), uintptr(bytesLow), uintptr(bytesHigh), uintptr(unsafe.Pointer(overlapped))) + if r1 == 0 { + err = errnoErr(e1) + } + return +} + +func UnmapViewOfFile(addr uintptr) (err error) { + r1, _, e1 := syscall.SyscallN(procUnmapViewOfFile.Addr(), uintptr(addr)) + if r1 == 0 { + err = errnoErr(e1) + } + return +} + +func updateProcThreadAttribute(attrlist *ProcThreadAttributeList, flags uint32, attr uintptr, value unsafe.Pointer, size uintptr, prevvalue unsafe.Pointer, returnedsize *uintptr) (err error) { + r1, _, e1 := syscall.SyscallN(procUpdateProcThreadAttribute.Addr(), uintptr(unsafe.Pointer(attrlist)), uintptr(flags), uintptr(attr), uintptr(value), uintptr(size), uintptr(prevvalue), uintptr(unsafe.Pointer(returnedsize))) + if r1 == 0 { + err = errnoErr(e1) + } + return +} + +func VirtualAlloc(address uintptr, size uintptr, alloctype uint32, protect uint32) (value uintptr, err error) { + r0, _, e1 := syscall.SyscallN(procVirtualAlloc.Addr(), uintptr(address), uintptr(size), uintptr(alloctype), uintptr(protect)) + value = uintptr(r0) + if value == 0 { + err = errnoErr(e1) + } + return +} + +func VirtualFree(address uintptr, size uintptr, freetype uint32) (err error) { + r1, _, e1 := syscall.SyscallN(procVirtualFree.Addr(), uintptr(address), uintptr(size), uintptr(freetype)) + if r1 == 0 { + err = errnoErr(e1) + } + return +} + +func VirtualLock(addr uintptr, length uintptr) (err error) { + r1, _, e1 := syscall.SyscallN(procVirtualLock.Addr(), uintptr(addr), uintptr(length)) + if r1 == 0 { + err = errnoErr(e1) + } + return +} + +func VirtualProtect(address uintptr, size uintptr, newprotect uint32, oldprotect *uint32) (err error) { + r1, _, e1 := syscall.SyscallN(procVirtualProtect.Addr(), uintptr(address), uintptr(size), uintptr(newprotect), uintptr(unsafe.Pointer(oldprotect))) + if r1 == 0 { + err = errnoErr(e1) + } + return +} + +func VirtualProtectEx(process Handle, address uintptr, size uintptr, newProtect uint32, oldProtect *uint32) (err error) { + r1, _, e1 := syscall.SyscallN(procVirtualProtectEx.Addr(), uintptr(process), uintptr(address), uintptr(size), uintptr(newProtect), uintptr(unsafe.Pointer(oldProtect))) + if r1 == 0 { + err = errnoErr(e1) + } + return +} + +func VirtualQuery(address uintptr, buffer *MemoryBasicInformation, length uintptr) (err error) { + r1, _, e1 := syscall.SyscallN(procVirtualQuery.Addr(), uintptr(address), uintptr(unsafe.Pointer(buffer)), uintptr(length)) + if r1 == 0 { + err = errnoErr(e1) + } + return +} + +func VirtualQueryEx(process Handle, address uintptr, buffer *MemoryBasicInformation, length uintptr) (err error) { + r1, _, e1 := syscall.SyscallN(procVirtualQueryEx.Addr(), uintptr(process), uintptr(address), uintptr(unsafe.Pointer(buffer)), uintptr(length)) + if r1 == 0 { + err = errnoErr(e1) + } + return +} + +func VirtualUnlock(addr uintptr, length uintptr) (err error) { + r1, _, e1 := syscall.SyscallN(procVirtualUnlock.Addr(), uintptr(addr), uintptr(length)) + if r1 == 0 { + err = errnoErr(e1) + } + return +} + +func WTSGetActiveConsoleSessionId() (sessionID uint32) { + r0, _, _ := syscall.SyscallN(procWTSGetActiveConsoleSessionId.Addr()) + sessionID = uint32(r0) + return +} + +func WaitCommEvent(handle Handle, lpEvtMask *uint32, lpOverlapped *Overlapped) (err error) { + r1, _, e1 := syscall.SyscallN(procWaitCommEvent.Addr(), uintptr(handle), uintptr(unsafe.Pointer(lpEvtMask)), uintptr(unsafe.Pointer(lpOverlapped))) + if r1 == 0 { + err = errnoErr(e1) + } + return +} + +func waitForMultipleObjects(count uint32, handles uintptr, waitAll bool, waitMilliseconds uint32) (event uint32, err error) { + var _p0 uint32 + if waitAll { + _p0 = 1 + } + r0, _, e1 := syscall.SyscallN(procWaitForMultipleObjects.Addr(), uintptr(count), uintptr(handles), uintptr(_p0), uintptr(waitMilliseconds)) + event = uint32(r0) + if event == 0xffffffff { + err = errnoErr(e1) + } + return +} + +func WaitForSingleObject(handle Handle, waitMilliseconds uint32) (event uint32, err error) { + r0, _, e1 := syscall.SyscallN(procWaitForSingleObject.Addr(), uintptr(handle), uintptr(waitMilliseconds)) + event = uint32(r0) + if event == 0xffffffff { + err = errnoErr(e1) + } + return +} + +func WriteConsole(console Handle, buf *uint16, towrite uint32, written *uint32, reserved *byte) (err error) { + r1, _, e1 := syscall.SyscallN(procWriteConsoleW.Addr(), uintptr(console), uintptr(unsafe.Pointer(buf)), uintptr(towrite), uintptr(unsafe.Pointer(written)), uintptr(unsafe.Pointer(reserved))) + if r1 == 0 { + err = errnoErr(e1) + } + return +} + +func writeFile(handle Handle, buf []byte, done *uint32, overlapped *Overlapped) (err error) { + var _p0 *byte + if len(buf) > 0 { + _p0 = &buf[0] + } + r1, _, e1 := syscall.SyscallN(procWriteFile.Addr(), uintptr(handle), uintptr(unsafe.Pointer(_p0)), uintptr(len(buf)), uintptr(unsafe.Pointer(done)), uintptr(unsafe.Pointer(overlapped))) + if r1 == 0 { + err = errnoErr(e1) + } + return +} + +func WriteProcessMemory(process Handle, baseAddress uintptr, buffer *byte, size uintptr, numberOfBytesWritten *uintptr) (err error) { + r1, _, e1 := syscall.SyscallN(procWriteProcessMemory.Addr(), uintptr(process), uintptr(baseAddress), uintptr(unsafe.Pointer(buffer)), uintptr(size), uintptr(unsafe.Pointer(numberOfBytesWritten))) + if r1 == 0 { + err = errnoErr(e1) + } + return +} + +func AcceptEx(ls Handle, as Handle, buf *byte, rxdatalen uint32, laddrlen uint32, raddrlen uint32, recvd *uint32, overlapped *Overlapped) (err error) { + r1, _, e1 := syscall.SyscallN(procAcceptEx.Addr(), uintptr(ls), uintptr(as), uintptr(unsafe.Pointer(buf)), uintptr(rxdatalen), uintptr(laddrlen), uintptr(raddrlen), uintptr(unsafe.Pointer(recvd)), uintptr(unsafe.Pointer(overlapped))) + if r1 == 0 { + err = errnoErr(e1) + } + return +} + +func GetAcceptExSockaddrs(buf *byte, rxdatalen uint32, laddrlen uint32, raddrlen uint32, lrsa **RawSockaddrAny, lrsalen *int32, rrsa **RawSockaddrAny, rrsalen *int32) { + syscall.SyscallN(procGetAcceptExSockaddrs.Addr(), uintptr(unsafe.Pointer(buf)), uintptr(rxdatalen), uintptr(laddrlen), uintptr(raddrlen), uintptr(unsafe.Pointer(lrsa)), uintptr(unsafe.Pointer(lrsalen)), uintptr(unsafe.Pointer(rrsa)), uintptr(unsafe.Pointer(rrsalen))) + return +} + +func TransmitFile(s Handle, handle Handle, bytesToWrite uint32, bytsPerSend uint32, overlapped *Overlapped, transmitFileBuf *TransmitFileBuffers, flags uint32) (err error) { + r1, _, e1 := syscall.SyscallN(procTransmitFile.Addr(), uintptr(s), uintptr(handle), uintptr(bytesToWrite), uintptr(bytsPerSend), uintptr(unsafe.Pointer(overlapped)), uintptr(unsafe.Pointer(transmitFileBuf)), uintptr(flags)) + if r1 == 0 { + err = errnoErr(e1) + } + return +} + +func NetApiBufferFree(buf *byte) (neterr error) { + r0, _, _ := syscall.SyscallN(procNetApiBufferFree.Addr(), uintptr(unsafe.Pointer(buf))) + if r0 != 0 { + neterr = syscall.Errno(r0) + } + return +} + +func NetGetJoinInformation(server *uint16, name **uint16, bufType *uint32) (neterr error) { + r0, _, _ := syscall.SyscallN(procNetGetJoinInformation.Addr(), uintptr(unsafe.Pointer(server)), uintptr(unsafe.Pointer(name)), uintptr(unsafe.Pointer(bufType))) + if r0 != 0 { + neterr = syscall.Errno(r0) + } + return +} + +func NetUserEnum(serverName *uint16, level uint32, filter uint32, buf **byte, prefMaxLen uint32, entriesRead *uint32, totalEntries *uint32, resumeHandle *uint32) (neterr error) { + r0, _, _ := syscall.SyscallN(procNetUserEnum.Addr(), uintptr(unsafe.Pointer(serverName)), uintptr(level), uintptr(filter), uintptr(unsafe.Pointer(buf)), uintptr(prefMaxLen), uintptr(unsafe.Pointer(entriesRead)), uintptr(unsafe.Pointer(totalEntries)), uintptr(unsafe.Pointer(resumeHandle))) + if r0 != 0 { + neterr = syscall.Errno(r0) + } + return +} + +func NetUserGetInfo(serverName *uint16, userName *uint16, level uint32, buf **byte) (neterr error) { + r0, _, _ := syscall.SyscallN(procNetUserGetInfo.Addr(), uintptr(unsafe.Pointer(serverName)), uintptr(unsafe.Pointer(userName)), uintptr(level), uintptr(unsafe.Pointer(buf))) + if r0 != 0 { + neterr = syscall.Errno(r0) + } + return +} + +func NtCreateFile(handle *Handle, access uint32, oa *OBJECT_ATTRIBUTES, iosb *IO_STATUS_BLOCK, allocationSize *int64, attributes uint32, share uint32, disposition uint32, options uint32, eabuffer uintptr, ealength uint32) (ntstatus error) { + r0, _, _ := syscall.SyscallN(procNtCreateFile.Addr(), uintptr(unsafe.Pointer(handle)), uintptr(access), uintptr(unsafe.Pointer(oa)), uintptr(unsafe.Pointer(iosb)), uintptr(unsafe.Pointer(allocationSize)), uintptr(attributes), uintptr(share), uintptr(disposition), uintptr(options), uintptr(eabuffer), uintptr(ealength)) + if r0 != 0 { + ntstatus = NTStatus(r0) + } + return +} + +func NtCreateNamedPipeFile(pipe *Handle, access uint32, oa *OBJECT_ATTRIBUTES, iosb *IO_STATUS_BLOCK, share uint32, disposition uint32, options uint32, typ uint32, readMode uint32, completionMode uint32, maxInstances uint32, inboundQuota uint32, outputQuota uint32, timeout *int64) (ntstatus error) { + r0, _, _ := syscall.SyscallN(procNtCreateNamedPipeFile.Addr(), uintptr(unsafe.Pointer(pipe)), uintptr(access), uintptr(unsafe.Pointer(oa)), uintptr(unsafe.Pointer(iosb)), uintptr(share), uintptr(disposition), uintptr(options), uintptr(typ), uintptr(readMode), uintptr(completionMode), uintptr(maxInstances), uintptr(inboundQuota), uintptr(outputQuota), uintptr(unsafe.Pointer(timeout))) + if r0 != 0 { + ntstatus = NTStatus(r0) + } + return +} + +func NtQueryInformationProcess(proc Handle, procInfoClass int32, procInfo unsafe.Pointer, procInfoLen uint32, retLen *uint32) (ntstatus error) { + r0, _, _ := syscall.SyscallN(procNtQueryInformationProcess.Addr(), uintptr(proc), uintptr(procInfoClass), uintptr(procInfo), uintptr(procInfoLen), uintptr(unsafe.Pointer(retLen))) + if r0 != 0 { + ntstatus = NTStatus(r0) + } + return +} + +func NtQuerySystemInformation(sysInfoClass int32, sysInfo unsafe.Pointer, sysInfoLen uint32, retLen *uint32) (ntstatus error) { + r0, _, _ := syscall.SyscallN(procNtQuerySystemInformation.Addr(), uintptr(sysInfoClass), uintptr(sysInfo), uintptr(sysInfoLen), uintptr(unsafe.Pointer(retLen))) + if r0 != 0 { + ntstatus = NTStatus(r0) + } + return +} + +func NtSetInformationFile(handle Handle, iosb *IO_STATUS_BLOCK, inBuffer *byte, inBufferLen uint32, class uint32) (ntstatus error) { + r0, _, _ := syscall.SyscallN(procNtSetInformationFile.Addr(), uintptr(handle), uintptr(unsafe.Pointer(iosb)), uintptr(unsafe.Pointer(inBuffer)), uintptr(inBufferLen), uintptr(class)) + if r0 != 0 { + ntstatus = NTStatus(r0) + } + return +} + +func NtSetInformationProcess(proc Handle, procInfoClass int32, procInfo unsafe.Pointer, procInfoLen uint32) (ntstatus error) { + r0, _, _ := syscall.SyscallN(procNtSetInformationProcess.Addr(), uintptr(proc), uintptr(procInfoClass), uintptr(procInfo), uintptr(procInfoLen)) + if r0 != 0 { + ntstatus = NTStatus(r0) + } + return +} + +func NtSetSystemInformation(sysInfoClass int32, sysInfo unsafe.Pointer, sysInfoLen uint32) (ntstatus error) { + r0, _, _ := syscall.SyscallN(procNtSetSystemInformation.Addr(), uintptr(sysInfoClass), uintptr(sysInfo), uintptr(sysInfoLen)) + if r0 != 0 { + ntstatus = NTStatus(r0) + } + return +} + +func RtlAddFunctionTable(functionTable *RUNTIME_FUNCTION, entryCount uint32, baseAddress uintptr) (ret bool) { + r0, _, _ := syscall.SyscallN(procRtlAddFunctionTable.Addr(), uintptr(unsafe.Pointer(functionTable)), uintptr(entryCount), uintptr(baseAddress)) + ret = r0 != 0 + return +} + +func RtlDefaultNpAcl(acl **ACL) (ntstatus error) { + r0, _, _ := syscall.SyscallN(procRtlDefaultNpAcl.Addr(), uintptr(unsafe.Pointer(acl))) + if r0 != 0 { + ntstatus = NTStatus(r0) + } + return +} + +func RtlDeleteFunctionTable(functionTable *RUNTIME_FUNCTION) (ret bool) { + r0, _, _ := syscall.SyscallN(procRtlDeleteFunctionTable.Addr(), uintptr(unsafe.Pointer(functionTable))) + ret = r0 != 0 + return +} + +func RtlDosPathNameToNtPathName(dosName *uint16, ntName *NTUnicodeString, ntFileNamePart *uint16, relativeName *RTL_RELATIVE_NAME) (ntstatus error) { + r0, _, _ := syscall.SyscallN(procRtlDosPathNameToNtPathName_U_WithStatus.Addr(), uintptr(unsafe.Pointer(dosName)), uintptr(unsafe.Pointer(ntName)), uintptr(unsafe.Pointer(ntFileNamePart)), uintptr(unsafe.Pointer(relativeName))) + if r0 != 0 { + ntstatus = NTStatus(r0) + } + return +} + +func RtlDosPathNameToRelativeNtPathName(dosName *uint16, ntName *NTUnicodeString, ntFileNamePart *uint16, relativeName *RTL_RELATIVE_NAME) (ntstatus error) { + r0, _, _ := syscall.SyscallN(procRtlDosPathNameToRelativeNtPathName_U_WithStatus.Addr(), uintptr(unsafe.Pointer(dosName)), uintptr(unsafe.Pointer(ntName)), uintptr(unsafe.Pointer(ntFileNamePart)), uintptr(unsafe.Pointer(relativeName))) + if r0 != 0 { + ntstatus = NTStatus(r0) + } + return +} + +func RtlGetCurrentPeb() (peb *PEB) { + r0, _, _ := syscall.SyscallN(procRtlGetCurrentPeb.Addr()) + peb = (*PEB)(unsafe.Pointer(r0)) + return +} + +func rtlGetNtVersionNumbers(majorVersion *uint32, minorVersion *uint32, buildNumber *uint32) { + syscall.SyscallN(procRtlGetNtVersionNumbers.Addr(), uintptr(unsafe.Pointer(majorVersion)), uintptr(unsafe.Pointer(minorVersion)), uintptr(unsafe.Pointer(buildNumber))) + return +} + +func rtlGetVersion(info *OsVersionInfoEx) (ntstatus error) { + r0, _, _ := syscall.SyscallN(procRtlGetVersion.Addr(), uintptr(unsafe.Pointer(info))) + if r0 != 0 { + ntstatus = NTStatus(r0) + } + return +} + +func RtlInitString(destinationString *NTString, sourceString *byte) { + syscall.SyscallN(procRtlInitString.Addr(), uintptr(unsafe.Pointer(destinationString)), uintptr(unsafe.Pointer(sourceString))) + return +} + +func RtlInitUnicodeString(destinationString *NTUnicodeString, sourceString *uint16) { + syscall.SyscallN(procRtlInitUnicodeString.Addr(), uintptr(unsafe.Pointer(destinationString)), uintptr(unsafe.Pointer(sourceString))) + return +} + +func rtlNtStatusToDosErrorNoTeb(ntstatus NTStatus) (ret syscall.Errno) { + r0, _, _ := syscall.SyscallN(procRtlNtStatusToDosErrorNoTeb.Addr(), uintptr(ntstatus)) + ret = syscall.Errno(r0) + return +} + +func clsidFromString(lpsz *uint16, pclsid *GUID) (ret error) { + r0, _, _ := syscall.SyscallN(procCLSIDFromString.Addr(), uintptr(unsafe.Pointer(lpsz)), uintptr(unsafe.Pointer(pclsid))) + if r0 != 0 { + ret = syscall.Errno(r0) + } + return +} + +func coCreateGuid(pguid *GUID) (ret error) { + r0, _, _ := syscall.SyscallN(procCoCreateGuid.Addr(), uintptr(unsafe.Pointer(pguid))) + if r0 != 0 { + ret = syscall.Errno(r0) + } + return +} + +func CoGetObject(name *uint16, bindOpts *BIND_OPTS3, guid *GUID, functionTable **uintptr) (ret error) { + r0, _, _ := syscall.SyscallN(procCoGetObject.Addr(), uintptr(unsafe.Pointer(name)), uintptr(unsafe.Pointer(bindOpts)), uintptr(unsafe.Pointer(guid)), uintptr(unsafe.Pointer(functionTable))) + if r0 != 0 { + ret = syscall.Errno(r0) + } + return +} + +func CoInitializeEx(reserved uintptr, coInit uint32) (ret error) { + r0, _, _ := syscall.SyscallN(procCoInitializeEx.Addr(), uintptr(reserved), uintptr(coInit)) + if r0 != 0 { + ret = syscall.Errno(r0) + } + return +} + +func CoTaskMemFree(address unsafe.Pointer) { + syscall.SyscallN(procCoTaskMemFree.Addr(), uintptr(address)) + return +} + +func CoUninitialize() { + syscall.SyscallN(procCoUninitialize.Addr()) + return +} + +func stringFromGUID2(rguid *GUID, lpsz *uint16, cchMax int32) (chars int32) { + r0, _, _ := syscall.SyscallN(procStringFromGUID2.Addr(), uintptr(unsafe.Pointer(rguid)), uintptr(unsafe.Pointer(lpsz)), uintptr(cchMax)) + chars = int32(r0) + return +} + +func EnumProcessModules(process Handle, module *Handle, cb uint32, cbNeeded *uint32) (err error) { + r1, _, e1 := syscall.SyscallN(procEnumProcessModules.Addr(), uintptr(process), uintptr(unsafe.Pointer(module)), uintptr(cb), uintptr(unsafe.Pointer(cbNeeded))) + if r1 == 0 { + err = errnoErr(e1) + } + return +} + +func EnumProcessModulesEx(process Handle, module *Handle, cb uint32, cbNeeded *uint32, filterFlag uint32) (err error) { + r1, _, e1 := syscall.SyscallN(procEnumProcessModulesEx.Addr(), uintptr(process), uintptr(unsafe.Pointer(module)), uintptr(cb), uintptr(unsafe.Pointer(cbNeeded)), uintptr(filterFlag)) + if r1 == 0 { + err = errnoErr(e1) + } + return +} + +func enumProcesses(processIds *uint32, nSize uint32, bytesReturned *uint32) (err error) { + r1, _, e1 := syscall.SyscallN(procEnumProcesses.Addr(), uintptr(unsafe.Pointer(processIds)), uintptr(nSize), uintptr(unsafe.Pointer(bytesReturned))) + if r1 == 0 { + err = errnoErr(e1) + } + return +} + +func GetModuleBaseName(process Handle, module Handle, baseName *uint16, size uint32) (err error) { + r1, _, e1 := syscall.SyscallN(procGetModuleBaseNameW.Addr(), uintptr(process), uintptr(module), uintptr(unsafe.Pointer(baseName)), uintptr(size)) + if r1 == 0 { + err = errnoErr(e1) + } + return +} + +func GetModuleFileNameEx(process Handle, module Handle, filename *uint16, size uint32) (err error) { + r1, _, e1 := syscall.SyscallN(procGetModuleFileNameExW.Addr(), uintptr(process), uintptr(module), uintptr(unsafe.Pointer(filename)), uintptr(size)) + if r1 == 0 { + err = errnoErr(e1) + } + return +} + +func GetModuleInformation(process Handle, module Handle, modinfo *ModuleInfo, cb uint32) (err error) { + r1, _, e1 := syscall.SyscallN(procGetModuleInformation.Addr(), uintptr(process), uintptr(module), uintptr(unsafe.Pointer(modinfo)), uintptr(cb)) + if r1 == 0 { + err = errnoErr(e1) + } + return +} + +func QueryWorkingSetEx(process Handle, pv uintptr, cb uint32) (err error) { + r1, _, e1 := syscall.SyscallN(procQueryWorkingSetEx.Addr(), uintptr(process), uintptr(pv), uintptr(cb)) + if r1 == 0 { + err = errnoErr(e1) + } + return +} + +func SubscribeServiceChangeNotifications(service Handle, eventType uint32, callback uintptr, callbackCtx uintptr, subscription *uintptr) (ret error) { + ret = procSubscribeServiceChangeNotifications.Find() + if ret != nil { + return + } + r0, _, _ := syscall.SyscallN(procSubscribeServiceChangeNotifications.Addr(), uintptr(service), uintptr(eventType), uintptr(callback), uintptr(callbackCtx), uintptr(unsafe.Pointer(subscription))) + if r0 != 0 { + ret = syscall.Errno(r0) + } + return +} + +func UnsubscribeServiceChangeNotifications(subscription uintptr) (err error) { + err = procUnsubscribeServiceChangeNotifications.Find() + if err != nil { + return + } + syscall.SyscallN(procUnsubscribeServiceChangeNotifications.Addr(), uintptr(subscription)) + return +} + +func GetUserNameEx(nameFormat uint32, nameBuffre *uint16, nSize *uint32) (err error) { + r1, _, e1 := syscall.SyscallN(procGetUserNameExW.Addr(), uintptr(nameFormat), uintptr(unsafe.Pointer(nameBuffre)), uintptr(unsafe.Pointer(nSize))) + if r1&0xff == 0 { + err = errnoErr(e1) + } + return +} + +func TranslateName(accName *uint16, accNameFormat uint32, desiredNameFormat uint32, translatedName *uint16, nSize *uint32) (err error) { + r1, _, e1 := syscall.SyscallN(procTranslateNameW.Addr(), uintptr(unsafe.Pointer(accName)), uintptr(accNameFormat), uintptr(desiredNameFormat), uintptr(unsafe.Pointer(translatedName)), uintptr(unsafe.Pointer(nSize))) + if r1&0xff == 0 { + err = errnoErr(e1) + } + return +} + +func SetupDiBuildDriverInfoList(deviceInfoSet DevInfo, deviceInfoData *DevInfoData, driverType SPDIT) (err error) { + r1, _, e1 := syscall.SyscallN(procSetupDiBuildDriverInfoList.Addr(), uintptr(deviceInfoSet), uintptr(unsafe.Pointer(deviceInfoData)), uintptr(driverType)) + if r1 == 0 { + err = errnoErr(e1) + } + return +} + +func SetupDiCallClassInstaller(installFunction DI_FUNCTION, deviceInfoSet DevInfo, deviceInfoData *DevInfoData) (err error) { + r1, _, e1 := syscall.SyscallN(procSetupDiCallClassInstaller.Addr(), uintptr(installFunction), uintptr(deviceInfoSet), uintptr(unsafe.Pointer(deviceInfoData))) + if r1 == 0 { + err = errnoErr(e1) + } + return +} + +func SetupDiCancelDriverInfoSearch(deviceInfoSet DevInfo) (err error) { + r1, _, e1 := syscall.SyscallN(procSetupDiCancelDriverInfoSearch.Addr(), uintptr(deviceInfoSet)) + if r1 == 0 { + err = errnoErr(e1) + } + return +} + +func setupDiClassGuidsFromNameEx(className *uint16, classGuidList *GUID, classGuidListSize uint32, requiredSize *uint32, machineName *uint16, reserved uintptr) (err error) { + r1, _, e1 := syscall.SyscallN(procSetupDiClassGuidsFromNameExW.Addr(), uintptr(unsafe.Pointer(className)), uintptr(unsafe.Pointer(classGuidList)), uintptr(classGuidListSize), uintptr(unsafe.Pointer(requiredSize)), uintptr(unsafe.Pointer(machineName)), uintptr(reserved)) + if r1 == 0 { + err = errnoErr(e1) + } + return +} + +func setupDiClassNameFromGuidEx(classGUID *GUID, className *uint16, classNameSize uint32, requiredSize *uint32, machineName *uint16, reserved uintptr) (err error) { + r1, _, e1 := syscall.SyscallN(procSetupDiClassNameFromGuidExW.Addr(), uintptr(unsafe.Pointer(classGUID)), uintptr(unsafe.Pointer(className)), uintptr(classNameSize), uintptr(unsafe.Pointer(requiredSize)), uintptr(unsafe.Pointer(machineName)), uintptr(reserved)) + if r1 == 0 { + err = errnoErr(e1) + } + return +} + +func setupDiCreateDeviceInfoListEx(classGUID *GUID, hwndParent uintptr, machineName *uint16, reserved uintptr) (handle DevInfo, err error) { + r0, _, e1 := syscall.SyscallN(procSetupDiCreateDeviceInfoListExW.Addr(), uintptr(unsafe.Pointer(classGUID)), uintptr(hwndParent), uintptr(unsafe.Pointer(machineName)), uintptr(reserved)) + handle = DevInfo(r0) + if handle == DevInfo(InvalidHandle) { + err = errnoErr(e1) + } + return +} + +func setupDiCreateDeviceInfo(deviceInfoSet DevInfo, DeviceName *uint16, classGUID *GUID, DeviceDescription *uint16, hwndParent uintptr, CreationFlags DICD, deviceInfoData *DevInfoData) (err error) { + r1, _, e1 := syscall.SyscallN(procSetupDiCreateDeviceInfoW.Addr(), uintptr(deviceInfoSet), uintptr(unsafe.Pointer(DeviceName)), uintptr(unsafe.Pointer(classGUID)), uintptr(unsafe.Pointer(DeviceDescription)), uintptr(hwndParent), uintptr(CreationFlags), uintptr(unsafe.Pointer(deviceInfoData))) + if r1 == 0 { + err = errnoErr(e1) + } + return +} + +func SetupDiDestroyDeviceInfoList(deviceInfoSet DevInfo) (err error) { + r1, _, e1 := syscall.SyscallN(procSetupDiDestroyDeviceInfoList.Addr(), uintptr(deviceInfoSet)) + if r1 == 0 { + err = errnoErr(e1) + } + return +} + +func SetupDiDestroyDriverInfoList(deviceInfoSet DevInfo, deviceInfoData *DevInfoData, driverType SPDIT) (err error) { + r1, _, e1 := syscall.SyscallN(procSetupDiDestroyDriverInfoList.Addr(), uintptr(deviceInfoSet), uintptr(unsafe.Pointer(deviceInfoData)), uintptr(driverType)) + if r1 == 0 { + err = errnoErr(e1) + } + return +} + +func setupDiEnumDeviceInfo(deviceInfoSet DevInfo, memberIndex uint32, deviceInfoData *DevInfoData) (err error) { + r1, _, e1 := syscall.SyscallN(procSetupDiEnumDeviceInfo.Addr(), uintptr(deviceInfoSet), uintptr(memberIndex), uintptr(unsafe.Pointer(deviceInfoData))) + if r1 == 0 { + err = errnoErr(e1) + } + return +} + +func setupDiEnumDriverInfo(deviceInfoSet DevInfo, deviceInfoData *DevInfoData, driverType SPDIT, memberIndex uint32, driverInfoData *DrvInfoData) (err error) { + r1, _, e1 := syscall.SyscallN(procSetupDiEnumDriverInfoW.Addr(), uintptr(deviceInfoSet), uintptr(unsafe.Pointer(deviceInfoData)), uintptr(driverType), uintptr(memberIndex), uintptr(unsafe.Pointer(driverInfoData))) + if r1 == 0 { + err = errnoErr(e1) + } + return +} + +func setupDiGetClassDevsEx(classGUID *GUID, Enumerator *uint16, hwndParent uintptr, Flags DIGCF, deviceInfoSet DevInfo, machineName *uint16, reserved uintptr) (handle DevInfo, err error) { + r0, _, e1 := syscall.SyscallN(procSetupDiGetClassDevsExW.Addr(), uintptr(unsafe.Pointer(classGUID)), uintptr(unsafe.Pointer(Enumerator)), uintptr(hwndParent), uintptr(Flags), uintptr(deviceInfoSet), uintptr(unsafe.Pointer(machineName)), uintptr(reserved)) + handle = DevInfo(r0) + if handle == DevInfo(InvalidHandle) { + err = errnoErr(e1) + } + return +} + +func SetupDiGetClassInstallParams(deviceInfoSet DevInfo, deviceInfoData *DevInfoData, classInstallParams *ClassInstallHeader, classInstallParamsSize uint32, requiredSize *uint32) (err error) { + r1, _, e1 := syscall.SyscallN(procSetupDiGetClassInstallParamsW.Addr(), uintptr(deviceInfoSet), uintptr(unsafe.Pointer(deviceInfoData)), uintptr(unsafe.Pointer(classInstallParams)), uintptr(classInstallParamsSize), uintptr(unsafe.Pointer(requiredSize))) + if r1 == 0 { + err = errnoErr(e1) + } + return +} + +func setupDiGetDeviceInfoListDetail(deviceInfoSet DevInfo, deviceInfoSetDetailData *DevInfoListDetailData) (err error) { + r1, _, e1 := syscall.SyscallN(procSetupDiGetDeviceInfoListDetailW.Addr(), uintptr(deviceInfoSet), uintptr(unsafe.Pointer(deviceInfoSetDetailData))) + if r1 == 0 { + err = errnoErr(e1) + } + return +} + +func setupDiGetDeviceInstallParams(deviceInfoSet DevInfo, deviceInfoData *DevInfoData, deviceInstallParams *DevInstallParams) (err error) { + r1, _, e1 := syscall.SyscallN(procSetupDiGetDeviceInstallParamsW.Addr(), uintptr(deviceInfoSet), uintptr(unsafe.Pointer(deviceInfoData)), uintptr(unsafe.Pointer(deviceInstallParams))) + if r1 == 0 { + err = errnoErr(e1) + } + return +} + +func setupDiGetDeviceInstanceId(deviceInfoSet DevInfo, deviceInfoData *DevInfoData, instanceId *uint16, instanceIdSize uint32, instanceIdRequiredSize *uint32) (err error) { + r1, _, e1 := syscall.SyscallN(procSetupDiGetDeviceInstanceIdW.Addr(), uintptr(deviceInfoSet), uintptr(unsafe.Pointer(deviceInfoData)), uintptr(unsafe.Pointer(instanceId)), uintptr(instanceIdSize), uintptr(unsafe.Pointer(instanceIdRequiredSize))) + if r1 == 0 { + err = errnoErr(e1) + } + return +} + +func setupDiGetDeviceProperty(deviceInfoSet DevInfo, deviceInfoData *DevInfoData, propertyKey *DEVPROPKEY, propertyType *DEVPROPTYPE, propertyBuffer *byte, propertyBufferSize uint32, requiredSize *uint32, flags uint32) (err error) { + r1, _, e1 := syscall.SyscallN(procSetupDiGetDevicePropertyW.Addr(), uintptr(deviceInfoSet), uintptr(unsafe.Pointer(deviceInfoData)), uintptr(unsafe.Pointer(propertyKey)), uintptr(unsafe.Pointer(propertyType)), uintptr(unsafe.Pointer(propertyBuffer)), uintptr(propertyBufferSize), uintptr(unsafe.Pointer(requiredSize)), uintptr(flags)) + if r1 == 0 { + err = errnoErr(e1) + } + return +} + +func setupDiGetDeviceRegistryProperty(deviceInfoSet DevInfo, deviceInfoData *DevInfoData, property SPDRP, propertyRegDataType *uint32, propertyBuffer *byte, propertyBufferSize uint32, requiredSize *uint32) (err error) { + r1, _, e1 := syscall.SyscallN(procSetupDiGetDeviceRegistryPropertyW.Addr(), uintptr(deviceInfoSet), uintptr(unsafe.Pointer(deviceInfoData)), uintptr(property), uintptr(unsafe.Pointer(propertyRegDataType)), uintptr(unsafe.Pointer(propertyBuffer)), uintptr(propertyBufferSize), uintptr(unsafe.Pointer(requiredSize))) + if r1 == 0 { + err = errnoErr(e1) + } + return +} + +func setupDiGetDriverInfoDetail(deviceInfoSet DevInfo, deviceInfoData *DevInfoData, driverInfoData *DrvInfoData, driverInfoDetailData *DrvInfoDetailData, driverInfoDetailDataSize uint32, requiredSize *uint32) (err error) { + r1, _, e1 := syscall.SyscallN(procSetupDiGetDriverInfoDetailW.Addr(), uintptr(deviceInfoSet), uintptr(unsafe.Pointer(deviceInfoData)), uintptr(unsafe.Pointer(driverInfoData)), uintptr(unsafe.Pointer(driverInfoDetailData)), uintptr(driverInfoDetailDataSize), uintptr(unsafe.Pointer(requiredSize))) + if r1 == 0 { + err = errnoErr(e1) + } + return +} + +func setupDiGetSelectedDevice(deviceInfoSet DevInfo, deviceInfoData *DevInfoData) (err error) { + r1, _, e1 := syscall.SyscallN(procSetupDiGetSelectedDevice.Addr(), uintptr(deviceInfoSet), uintptr(unsafe.Pointer(deviceInfoData))) + if r1 == 0 { + err = errnoErr(e1) + } + return +} + +func setupDiGetSelectedDriver(deviceInfoSet DevInfo, deviceInfoData *DevInfoData, driverInfoData *DrvInfoData) (err error) { + r1, _, e1 := syscall.SyscallN(procSetupDiGetSelectedDriverW.Addr(), uintptr(deviceInfoSet), uintptr(unsafe.Pointer(deviceInfoData)), uintptr(unsafe.Pointer(driverInfoData))) + if r1 == 0 { + err = errnoErr(e1) + } + return +} + +func SetupDiOpenDevRegKey(deviceInfoSet DevInfo, deviceInfoData *DevInfoData, Scope DICS_FLAG, HwProfile uint32, KeyType DIREG, samDesired uint32) (key Handle, err error) { + r0, _, e1 := syscall.SyscallN(procSetupDiOpenDevRegKey.Addr(), uintptr(deviceInfoSet), uintptr(unsafe.Pointer(deviceInfoData)), uintptr(Scope), uintptr(HwProfile), uintptr(KeyType), uintptr(samDesired)) + key = Handle(r0) + if key == InvalidHandle { + err = errnoErr(e1) + } + return +} + +func SetupDiSetClassInstallParams(deviceInfoSet DevInfo, deviceInfoData *DevInfoData, classInstallParams *ClassInstallHeader, classInstallParamsSize uint32) (err error) { + r1, _, e1 := syscall.SyscallN(procSetupDiSetClassInstallParamsW.Addr(), uintptr(deviceInfoSet), uintptr(unsafe.Pointer(deviceInfoData)), uintptr(unsafe.Pointer(classInstallParams)), uintptr(classInstallParamsSize)) + if r1 == 0 { + err = errnoErr(e1) + } + return +} + +func SetupDiSetDeviceInstallParams(deviceInfoSet DevInfo, deviceInfoData *DevInfoData, deviceInstallParams *DevInstallParams) (err error) { + r1, _, e1 := syscall.SyscallN(procSetupDiSetDeviceInstallParamsW.Addr(), uintptr(deviceInfoSet), uintptr(unsafe.Pointer(deviceInfoData)), uintptr(unsafe.Pointer(deviceInstallParams))) + if r1 == 0 { + err = errnoErr(e1) + } + return +} + +func setupDiSetDeviceRegistryProperty(deviceInfoSet DevInfo, deviceInfoData *DevInfoData, property SPDRP, propertyBuffer *byte, propertyBufferSize uint32) (err error) { + r1, _, e1 := syscall.SyscallN(procSetupDiSetDeviceRegistryPropertyW.Addr(), uintptr(deviceInfoSet), uintptr(unsafe.Pointer(deviceInfoData)), uintptr(property), uintptr(unsafe.Pointer(propertyBuffer)), uintptr(propertyBufferSize)) + if r1 == 0 { + err = errnoErr(e1) + } + return +} + +func SetupDiSetSelectedDevice(deviceInfoSet DevInfo, deviceInfoData *DevInfoData) (err error) { + r1, _, e1 := syscall.SyscallN(procSetupDiSetSelectedDevice.Addr(), uintptr(deviceInfoSet), uintptr(unsafe.Pointer(deviceInfoData))) + if r1 == 0 { + err = errnoErr(e1) + } + return +} + +func SetupDiSetSelectedDriver(deviceInfoSet DevInfo, deviceInfoData *DevInfoData, driverInfoData *DrvInfoData) (err error) { + r1, _, e1 := syscall.SyscallN(procSetupDiSetSelectedDriverW.Addr(), uintptr(deviceInfoSet), uintptr(unsafe.Pointer(deviceInfoData)), uintptr(unsafe.Pointer(driverInfoData))) + if r1 == 0 { + err = errnoErr(e1) + } + return +} + +func setupUninstallOEMInf(infFileName *uint16, flags SUOI, reserved uintptr) (err error) { + r1, _, e1 := syscall.SyscallN(procSetupUninstallOEMInfW.Addr(), uintptr(unsafe.Pointer(infFileName)), uintptr(flags), uintptr(reserved)) + if r1 == 0 { + err = errnoErr(e1) + } + return +} + +func commandLineToArgv(cmd *uint16, argc *int32) (argv **uint16, err error) { + r0, _, e1 := syscall.SyscallN(procCommandLineToArgvW.Addr(), uintptr(unsafe.Pointer(cmd)), uintptr(unsafe.Pointer(argc))) + argv = (**uint16)(unsafe.Pointer(r0)) + if argv == nil { + err = errnoErr(e1) + } + return +} + +func shGetKnownFolderPath(id *KNOWNFOLDERID, flags uint32, token Token, path **uint16) (ret error) { + r0, _, _ := syscall.SyscallN(procSHGetKnownFolderPath.Addr(), uintptr(unsafe.Pointer(id)), uintptr(flags), uintptr(token), uintptr(unsafe.Pointer(path))) + if r0 != 0 { + ret = syscall.Errno(r0) + } + return +} + +func ShellExecute(hwnd Handle, verb *uint16, file *uint16, args *uint16, cwd *uint16, showCmd int32) (err error) { + r1, _, e1 := syscall.SyscallN(procShellExecuteW.Addr(), uintptr(hwnd), uintptr(unsafe.Pointer(verb)), uintptr(unsafe.Pointer(file)), uintptr(unsafe.Pointer(args)), uintptr(unsafe.Pointer(cwd)), uintptr(showCmd)) + if r1 <= 32 { + err = errnoErr(e1) + } + return +} + +func EnumChildWindows(hwnd HWND, enumFunc uintptr, param unsafe.Pointer) { + syscall.SyscallN(procEnumChildWindows.Addr(), uintptr(hwnd), uintptr(enumFunc), uintptr(param)) + return +} + +func EnumWindows(enumFunc uintptr, param unsafe.Pointer) (err error) { + r1, _, e1 := syscall.SyscallN(procEnumWindows.Addr(), uintptr(enumFunc), uintptr(param)) + if r1 == 0 { + err = errnoErr(e1) + } + return +} + +func ExitWindowsEx(flags uint32, reason uint32) (err error) { + r1, _, e1 := syscall.SyscallN(procExitWindowsEx.Addr(), uintptr(flags), uintptr(reason)) + if r1 == 0 { + err = errnoErr(e1) + } + return +} + +func GetClassName(hwnd HWND, className *uint16, maxCount int32) (copied int32, err error) { + r0, _, e1 := syscall.SyscallN(procGetClassNameW.Addr(), uintptr(hwnd), uintptr(unsafe.Pointer(className)), uintptr(maxCount)) + copied = int32(r0) + if copied == 0 { + err = errnoErr(e1) + } + return +} + +func GetDesktopWindow() (hwnd HWND) { + r0, _, _ := syscall.SyscallN(procGetDesktopWindow.Addr()) + hwnd = HWND(r0) + return +} + +func GetForegroundWindow() (hwnd HWND) { + r0, _, _ := syscall.SyscallN(procGetForegroundWindow.Addr()) + hwnd = HWND(r0) + return +} + +func GetGUIThreadInfo(thread uint32, info *GUIThreadInfo) (err error) { + r1, _, e1 := syscall.SyscallN(procGetGUIThreadInfo.Addr(), uintptr(thread), uintptr(unsafe.Pointer(info))) + if r1 == 0 { + err = errnoErr(e1) + } + return +} + +func GetKeyboardLayout(tid uint32) (hkl Handle) { + r0, _, _ := syscall.SyscallN(procGetKeyboardLayout.Addr(), uintptr(tid)) + hkl = Handle(r0) + return +} + +func GetShellWindow() (shellWindow HWND) { + r0, _, _ := syscall.SyscallN(procGetShellWindow.Addr()) + shellWindow = HWND(r0) + return +} + +func GetWindowThreadProcessId(hwnd HWND, pid *uint32) (tid uint32, err error) { + r0, _, e1 := syscall.SyscallN(procGetWindowThreadProcessId.Addr(), uintptr(hwnd), uintptr(unsafe.Pointer(pid))) + tid = uint32(r0) + if tid == 0 { + err = errnoErr(e1) + } + return +} + +func IsWindow(hwnd HWND) (isWindow bool) { + r0, _, _ := syscall.SyscallN(procIsWindow.Addr(), uintptr(hwnd)) + isWindow = r0 != 0 + return +} + +func IsWindowUnicode(hwnd HWND) (isUnicode bool) { + r0, _, _ := syscall.SyscallN(procIsWindowUnicode.Addr(), uintptr(hwnd)) + isUnicode = r0 != 0 + return +} + +func IsWindowVisible(hwnd HWND) (isVisible bool) { + r0, _, _ := syscall.SyscallN(procIsWindowVisible.Addr(), uintptr(hwnd)) + isVisible = r0 != 0 + return +} + +func LoadKeyboardLayout(name *uint16, flags uint32) (hkl Handle, err error) { + r0, _, e1 := syscall.SyscallN(procLoadKeyboardLayoutW.Addr(), uintptr(unsafe.Pointer(name)), uintptr(flags)) + hkl = Handle(r0) + if hkl == 0 { + err = errnoErr(e1) + } + return +} + +func MessageBox(hwnd HWND, text *uint16, caption *uint16, boxtype uint32) (ret int32, err error) { + r0, _, e1 := syscall.SyscallN(procMessageBoxW.Addr(), uintptr(hwnd), uintptr(unsafe.Pointer(text)), uintptr(unsafe.Pointer(caption)), uintptr(boxtype)) + ret = int32(r0) + if ret == 0 { + err = errnoErr(e1) + } + return +} + +func ToUnicodeEx(vkey uint32, scancode uint32, keystate *byte, pwszBuff *uint16, cchBuff int32, flags uint32, hkl Handle) (ret int32) { + r0, _, _ := syscall.SyscallN(procToUnicodeEx.Addr(), uintptr(vkey), uintptr(scancode), uintptr(unsafe.Pointer(keystate)), uintptr(unsafe.Pointer(pwszBuff)), uintptr(cchBuff), uintptr(flags), uintptr(hkl)) + ret = int32(r0) + return +} + +func UnloadKeyboardLayout(hkl Handle) (err error) { + r1, _, e1 := syscall.SyscallN(procUnloadKeyboardLayout.Addr(), uintptr(hkl)) + if r1 == 0 { + err = errnoErr(e1) + } + return +} + +func CreateEnvironmentBlock(block **uint16, token Token, inheritExisting bool) (err error) { + var _p0 uint32 + if inheritExisting { + _p0 = 1 + } + r1, _, e1 := syscall.SyscallN(procCreateEnvironmentBlock.Addr(), uintptr(unsafe.Pointer(block)), uintptr(token), uintptr(_p0)) + if r1 == 0 { + err = errnoErr(e1) + } + return +} + +func DestroyEnvironmentBlock(block *uint16) (err error) { + r1, _, e1 := syscall.SyscallN(procDestroyEnvironmentBlock.Addr(), uintptr(unsafe.Pointer(block))) + if r1 == 0 { + err = errnoErr(e1) + } + return +} + +func GetUserProfileDirectory(t Token, dir *uint16, dirLen *uint32) (err error) { + r1, _, e1 := syscall.SyscallN(procGetUserProfileDirectoryW.Addr(), uintptr(t), uintptr(unsafe.Pointer(dir)), uintptr(unsafe.Pointer(dirLen))) + if r1 == 0 { + err = errnoErr(e1) + } + return +} + +func GetFileVersionInfoSize(filename string, zeroHandle *Handle) (bufSize uint32, err error) { + var _p0 *uint16 + _p0, err = syscall.UTF16PtrFromString(filename) + if err != nil { + return + } + return _GetFileVersionInfoSize(_p0, zeroHandle) +} + +func _GetFileVersionInfoSize(filename *uint16, zeroHandle *Handle) (bufSize uint32, err error) { + r0, _, e1 := syscall.SyscallN(procGetFileVersionInfoSizeW.Addr(), uintptr(unsafe.Pointer(filename)), uintptr(unsafe.Pointer(zeroHandle))) + bufSize = uint32(r0) + if bufSize == 0 { + err = errnoErr(e1) + } + return +} + +func GetFileVersionInfo(filename string, handle uint32, bufSize uint32, buffer unsafe.Pointer) (err error) { + var _p0 *uint16 + _p0, err = syscall.UTF16PtrFromString(filename) + if err != nil { + return + } + return _GetFileVersionInfo(_p0, handle, bufSize, buffer) +} + +func _GetFileVersionInfo(filename *uint16, handle uint32, bufSize uint32, buffer unsafe.Pointer) (err error) { + r1, _, e1 := syscall.SyscallN(procGetFileVersionInfoW.Addr(), uintptr(unsafe.Pointer(filename)), uintptr(handle), uintptr(bufSize), uintptr(buffer)) + if r1 == 0 { + err = errnoErr(e1) + } + return +} + +func VerQueryValue(block unsafe.Pointer, subBlock string, pointerToBufferPointer unsafe.Pointer, bufSize *uint32) (err error) { + var _p0 *uint16 + _p0, err = syscall.UTF16PtrFromString(subBlock) + if err != nil { + return + } + return _VerQueryValue(block, _p0, pointerToBufferPointer, bufSize) +} + +func _VerQueryValue(block unsafe.Pointer, subBlock *uint16, pointerToBufferPointer unsafe.Pointer, bufSize *uint32) (err error) { + r1, _, e1 := syscall.SyscallN(procVerQueryValueW.Addr(), uintptr(block), uintptr(unsafe.Pointer(subBlock)), uintptr(pointerToBufferPointer), uintptr(unsafe.Pointer(bufSize))) + if r1 == 0 { + err = errnoErr(e1) + } + return +} + +func TimeBeginPeriod(period uint32) (err error) { + r1, _, e1 := syscall.SyscallN(proctimeBeginPeriod.Addr(), uintptr(period)) + if r1 != 0 { + err = errnoErr(e1) + } + return +} + +func TimeEndPeriod(period uint32) (err error) { + r1, _, e1 := syscall.SyscallN(proctimeEndPeriod.Addr(), uintptr(period)) + if r1 != 0 { + err = errnoErr(e1) + } + return +} + +func WinVerifyTrustEx(hwnd HWND, actionId *GUID, data *WinTrustData) (ret error) { + r0, _, _ := syscall.SyscallN(procWinVerifyTrustEx.Addr(), uintptr(hwnd), uintptr(unsafe.Pointer(actionId)), uintptr(unsafe.Pointer(data))) + if r0 != 0 { + ret = syscall.Errno(r0) + } + return +} + +func FreeAddrInfoW(addrinfo *AddrinfoW) { + syscall.SyscallN(procFreeAddrInfoW.Addr(), uintptr(unsafe.Pointer(addrinfo))) + return +} + +func GetAddrInfoW(nodename *uint16, servicename *uint16, hints *AddrinfoW, result **AddrinfoW) (sockerr error) { + r0, _, _ := syscall.SyscallN(procGetAddrInfoW.Addr(), uintptr(unsafe.Pointer(nodename)), uintptr(unsafe.Pointer(servicename)), uintptr(unsafe.Pointer(hints)), uintptr(unsafe.Pointer(result))) + if r0 != 0 { + sockerr = syscall.Errno(r0) + } + return +} + +func WSACleanup() (err error) { + r1, _, e1 := syscall.SyscallN(procWSACleanup.Addr()) + if r1 == socket_error { + err = errnoErr(e1) + } + return +} + +func WSADuplicateSocket(s Handle, processID uint32, info *WSAProtocolInfo) (err error) { + r1, _, e1 := syscall.SyscallN(procWSADuplicateSocketW.Addr(), uintptr(s), uintptr(processID), uintptr(unsafe.Pointer(info))) + if r1 != 0 { + err = errnoErr(e1) + } + return +} + +func WSAEnumProtocols(protocols *int32, protocolBuffer *WSAProtocolInfo, bufferLength *uint32) (n int32, err error) { + r0, _, e1 := syscall.SyscallN(procWSAEnumProtocolsW.Addr(), uintptr(unsafe.Pointer(protocols)), uintptr(unsafe.Pointer(protocolBuffer)), uintptr(unsafe.Pointer(bufferLength))) + n = int32(r0) + if n == -1 { + err = errnoErr(e1) + } + return +} + +func WSAGetOverlappedResult(h Handle, o *Overlapped, bytes *uint32, wait bool, flags *uint32) (err error) { + var _p0 uint32 + if wait { + _p0 = 1 + } + r1, _, e1 := syscall.SyscallN(procWSAGetOverlappedResult.Addr(), uintptr(h), uintptr(unsafe.Pointer(o)), uintptr(unsafe.Pointer(bytes)), uintptr(_p0), uintptr(unsafe.Pointer(flags))) + if r1 == 0 { + err = errnoErr(e1) + } + return +} + +func WSAIoctl(s Handle, iocc uint32, inbuf *byte, cbif uint32, outbuf *byte, cbob uint32, cbbr *uint32, overlapped *Overlapped, completionRoutine uintptr) (err error) { + r1, _, e1 := syscall.SyscallN(procWSAIoctl.Addr(), uintptr(s), uintptr(iocc), uintptr(unsafe.Pointer(inbuf)), uintptr(cbif), uintptr(unsafe.Pointer(outbuf)), uintptr(cbob), uintptr(unsafe.Pointer(cbbr)), uintptr(unsafe.Pointer(overlapped)), uintptr(completionRoutine)) + if r1 == socket_error { + err = errnoErr(e1) + } + return +} + +func WSALookupServiceBegin(querySet *WSAQUERYSET, flags uint32, handle *Handle) (err error) { + r1, _, e1 := syscall.SyscallN(procWSALookupServiceBeginW.Addr(), uintptr(unsafe.Pointer(querySet)), uintptr(flags), uintptr(unsafe.Pointer(handle))) + if r1 == socket_error { + err = errnoErr(e1) + } + return +} + +func WSALookupServiceEnd(handle Handle) (err error) { + r1, _, e1 := syscall.SyscallN(procWSALookupServiceEnd.Addr(), uintptr(handle)) + if r1 == socket_error { + err = errnoErr(e1) + } + return +} + +func WSALookupServiceNext(handle Handle, flags uint32, size *int32, querySet *WSAQUERYSET) (err error) { + r1, _, e1 := syscall.SyscallN(procWSALookupServiceNextW.Addr(), uintptr(handle), uintptr(flags), uintptr(unsafe.Pointer(size)), uintptr(unsafe.Pointer(querySet))) + if r1 == socket_error { + err = errnoErr(e1) + } + return +} + +func WSARecv(s Handle, bufs *WSABuf, bufcnt uint32, recvd *uint32, flags *uint32, overlapped *Overlapped, croutine *byte) (err error) { + r1, _, e1 := syscall.SyscallN(procWSARecv.Addr(), uintptr(s), uintptr(unsafe.Pointer(bufs)), uintptr(bufcnt), uintptr(unsafe.Pointer(recvd)), uintptr(unsafe.Pointer(flags)), uintptr(unsafe.Pointer(overlapped)), uintptr(unsafe.Pointer(croutine))) + if r1 == socket_error { + err = errnoErr(e1) + } + return +} + +func WSARecvFrom(s Handle, bufs *WSABuf, bufcnt uint32, recvd *uint32, flags *uint32, from *RawSockaddrAny, fromlen *int32, overlapped *Overlapped, croutine *byte) (err error) { + r1, _, e1 := syscall.SyscallN(procWSARecvFrom.Addr(), uintptr(s), uintptr(unsafe.Pointer(bufs)), uintptr(bufcnt), uintptr(unsafe.Pointer(recvd)), uintptr(unsafe.Pointer(flags)), uintptr(unsafe.Pointer(from)), uintptr(unsafe.Pointer(fromlen)), uintptr(unsafe.Pointer(overlapped)), uintptr(unsafe.Pointer(croutine))) + if r1 == socket_error { + err = errnoErr(e1) + } + return +} + +func WSASend(s Handle, bufs *WSABuf, bufcnt uint32, sent *uint32, flags uint32, overlapped *Overlapped, croutine *byte) (err error) { + r1, _, e1 := syscall.SyscallN(procWSASend.Addr(), uintptr(s), uintptr(unsafe.Pointer(bufs)), uintptr(bufcnt), uintptr(unsafe.Pointer(sent)), uintptr(flags), uintptr(unsafe.Pointer(overlapped)), uintptr(unsafe.Pointer(croutine))) + if r1 == socket_error { + err = errnoErr(e1) + } + return +} + +func WSASendTo(s Handle, bufs *WSABuf, bufcnt uint32, sent *uint32, flags uint32, to *RawSockaddrAny, tolen int32, overlapped *Overlapped, croutine *byte) (err error) { + r1, _, e1 := syscall.SyscallN(procWSASendTo.Addr(), uintptr(s), uintptr(unsafe.Pointer(bufs)), uintptr(bufcnt), uintptr(unsafe.Pointer(sent)), uintptr(flags), uintptr(unsafe.Pointer(to)), uintptr(tolen), uintptr(unsafe.Pointer(overlapped)), uintptr(unsafe.Pointer(croutine))) + if r1 == socket_error { + err = errnoErr(e1) + } + return +} + +func WSASocket(af int32, typ int32, protocol int32, protoInfo *WSAProtocolInfo, group uint32, flags uint32) (handle Handle, err error) { + r0, _, e1 := syscall.SyscallN(procWSASocketW.Addr(), uintptr(af), uintptr(typ), uintptr(protocol), uintptr(unsafe.Pointer(protoInfo)), uintptr(group), uintptr(flags)) + handle = Handle(r0) + if handle == InvalidHandle { + err = errnoErr(e1) + } + return +} + +func WSAStartup(verreq uint32, data *WSAData) (sockerr error) { + r0, _, _ := syscall.SyscallN(procWSAStartup.Addr(), uintptr(verreq), uintptr(unsafe.Pointer(data))) + if r0 != 0 { + sockerr = syscall.Errno(r0) + } + return +} + +func bind(s Handle, name unsafe.Pointer, namelen int32) (err error) { + r1, _, e1 := syscall.SyscallN(procbind.Addr(), uintptr(s), uintptr(name), uintptr(namelen)) + if r1 == socket_error { + err = errnoErr(e1) + } + return +} + +func Closesocket(s Handle) (err error) { + r1, _, e1 := syscall.SyscallN(procclosesocket.Addr(), uintptr(s)) + if r1 == socket_error { + err = errnoErr(e1) + } + return +} + +func connect(s Handle, name unsafe.Pointer, namelen int32) (err error) { + r1, _, e1 := syscall.SyscallN(procconnect.Addr(), uintptr(s), uintptr(name), uintptr(namelen)) + if r1 == socket_error { + err = errnoErr(e1) + } + return +} + +func GetHostByName(name string) (h *Hostent, err error) { + var _p0 *byte + _p0, err = syscall.BytePtrFromString(name) + if err != nil { + return + } + return _GetHostByName(_p0) +} + +func _GetHostByName(name *byte) (h *Hostent, err error) { + r0, _, e1 := syscall.SyscallN(procgethostbyname.Addr(), uintptr(unsafe.Pointer(name))) + h = (*Hostent)(unsafe.Pointer(r0)) + if h == nil { + err = errnoErr(e1) + } + return +} + +func getpeername(s Handle, rsa *RawSockaddrAny, addrlen *int32) (err error) { + r1, _, e1 := syscall.SyscallN(procgetpeername.Addr(), uintptr(s), uintptr(unsafe.Pointer(rsa)), uintptr(unsafe.Pointer(addrlen))) + if r1 == socket_error { + err = errnoErr(e1) + } + return +} + +func GetProtoByName(name string) (p *Protoent, err error) { + var _p0 *byte + _p0, err = syscall.BytePtrFromString(name) + if err != nil { + return + } + return _GetProtoByName(_p0) +} + +func _GetProtoByName(name *byte) (p *Protoent, err error) { + r0, _, e1 := syscall.SyscallN(procgetprotobyname.Addr(), uintptr(unsafe.Pointer(name))) + p = (*Protoent)(unsafe.Pointer(r0)) + if p == nil { + err = errnoErr(e1) + } + return +} + +func GetServByName(name string, proto string) (s *Servent, err error) { + var _p0 *byte + _p0, err = syscall.BytePtrFromString(name) + if err != nil { + return + } + var _p1 *byte + _p1, err = syscall.BytePtrFromString(proto) + if err != nil { + return + } + return _GetServByName(_p0, _p1) +} + +func _GetServByName(name *byte, proto *byte) (s *Servent, err error) { + r0, _, e1 := syscall.SyscallN(procgetservbyname.Addr(), uintptr(unsafe.Pointer(name)), uintptr(unsafe.Pointer(proto))) + s = (*Servent)(unsafe.Pointer(r0)) + if s == nil { + err = errnoErr(e1) + } + return +} + +func getsockname(s Handle, rsa *RawSockaddrAny, addrlen *int32) (err error) { + r1, _, e1 := syscall.SyscallN(procgetsockname.Addr(), uintptr(s), uintptr(unsafe.Pointer(rsa)), uintptr(unsafe.Pointer(addrlen))) + if r1 == socket_error { + err = errnoErr(e1) + } + return +} + +func Getsockopt(s Handle, level int32, optname int32, optval *byte, optlen *int32) (err error) { + r1, _, e1 := syscall.SyscallN(procgetsockopt.Addr(), uintptr(s), uintptr(level), uintptr(optname), uintptr(unsafe.Pointer(optval)), uintptr(unsafe.Pointer(optlen))) + if r1 == socket_error { + err = errnoErr(e1) + } + return +} + +func listen(s Handle, backlog int32) (err error) { + r1, _, e1 := syscall.SyscallN(proclisten.Addr(), uintptr(s), uintptr(backlog)) + if r1 == socket_error { + err = errnoErr(e1) + } + return +} + +func Ntohs(netshort uint16) (u uint16) { + r0, _, _ := syscall.SyscallN(procntohs.Addr(), uintptr(netshort)) + u = uint16(r0) + return +} + +func recvfrom(s Handle, buf []byte, flags int32, from *RawSockaddrAny, fromlen *int32) (n int32, err error) { + var _p0 *byte + if len(buf) > 0 { + _p0 = &buf[0] + } + r0, _, e1 := syscall.SyscallN(procrecvfrom.Addr(), uintptr(s), uintptr(unsafe.Pointer(_p0)), uintptr(len(buf)), uintptr(flags), uintptr(unsafe.Pointer(from)), uintptr(unsafe.Pointer(fromlen))) + n = int32(r0) + if n == -1 { + err = errnoErr(e1) + } + return +} + +func sendto(s Handle, buf []byte, flags int32, to unsafe.Pointer, tolen int32) (err error) { + var _p0 *byte + if len(buf) > 0 { + _p0 = &buf[0] + } + r1, _, e1 := syscall.SyscallN(procsendto.Addr(), uintptr(s), uintptr(unsafe.Pointer(_p0)), uintptr(len(buf)), uintptr(flags), uintptr(to), uintptr(tolen)) + if r1 == socket_error { + err = errnoErr(e1) + } + return +} + +func Setsockopt(s Handle, level int32, optname int32, optval *byte, optlen int32) (err error) { + r1, _, e1 := syscall.SyscallN(procsetsockopt.Addr(), uintptr(s), uintptr(level), uintptr(optname), uintptr(unsafe.Pointer(optval)), uintptr(optlen)) + if r1 == socket_error { + err = errnoErr(e1) + } + return +} + +func shutdown(s Handle, how int32) (err error) { + r1, _, e1 := syscall.SyscallN(procshutdown.Addr(), uintptr(s), uintptr(how)) + if r1 == socket_error { + err = errnoErr(e1) + } + return +} + +func socket(af int32, typ int32, protocol int32) (handle Handle, err error) { + r0, _, e1 := syscall.SyscallN(procsocket.Addr(), uintptr(af), uintptr(typ), uintptr(protocol)) + handle = Handle(r0) + if handle == InvalidHandle { + err = errnoErr(e1) + } + return +} + +func WTSEnumerateSessions(handle Handle, reserved uint32, version uint32, sessions **WTS_SESSION_INFO, count *uint32) (err error) { + r1, _, e1 := syscall.SyscallN(procWTSEnumerateSessionsW.Addr(), uintptr(handle), uintptr(reserved), uintptr(version), uintptr(unsafe.Pointer(sessions)), uintptr(unsafe.Pointer(count))) + if r1 == 0 { + err = errnoErr(e1) + } + return +} + +func WTSFreeMemory(ptr uintptr) { + syscall.SyscallN(procWTSFreeMemory.Addr(), uintptr(ptr)) + return +} + +func WTSQueryUserToken(session uint32, token *Token) (err error) { + r1, _, e1 := syscall.SyscallN(procWTSQueryUserToken.Addr(), uintptr(session), uintptr(unsafe.Pointer(token))) + if r1 == 0 { + err = errnoErr(e1) + } + return +} diff --git a/vendor/modules.txt b/vendor/modules.txt index 2860eb29..492f9e01 100644 --- a/vendor/modules.txt +++ b/vendor/modules.txt @@ -2,9 +2,55 @@ ## explicit; go 1.24.0 filippo.io/edwards25519 filippo.io/edwards25519/field +# github.com/Masterminds/squirrel v1.5.4 +## explicit; go 1.14 +github.com/Masterminds/squirrel +# github.com/Masterminds/structable v0.0.0-20170407152004-a1a302ef78ec +## explicit +github.com/Masterminds/structable +# github.com/Microsoft/go-winio v0.6.2 +## explicit; go 1.21 +github.com/Microsoft/go-winio +github.com/Microsoft/go-winio/internal/fs +github.com/Microsoft/go-winio/internal/socket +github.com/Microsoft/go-winio/internal/stringbuffer +github.com/Microsoft/go-winio/pkg/guid +# github.com/cenkalti/backoff/v5 v5.0.3 +## explicit; go 1.23 +github.com/cenkalti/backoff/v5 +# github.com/cespare/xxhash/v2 v2.3.0 +## explicit; go 1.11 +github.com/cespare/xxhash/v2 +# github.com/containerd/errdefs v1.0.0 +## explicit; go 1.20 +github.com/containerd/errdefs +# github.com/containerd/errdefs/pkg v0.3.0 +## explicit; go 1.22 +github.com/containerd/errdefs/pkg/errhttp +github.com/containerd/errdefs/pkg/internal/cause # github.com/davecgh/go-spew v1.1.1 ## explicit github.com/davecgh/go-spew/spew +# github.com/distribution/reference v0.6.0 +## explicit; go 1.20 +github.com/distribution/reference +# github.com/docker/go-connections v0.6.0 +## explicit; go 1.18 +github.com/docker/go-connections/sockets +github.com/docker/go-connections/tlsconfig +# github.com/docker/go-units v0.5.0 +## explicit +github.com/docker/go-units +# github.com/felixge/httpsnoop v1.0.4 +## explicit; go 1.13 +github.com/felixge/httpsnoop +# github.com/go-logr/logr v1.4.3 +## explicit; go 1.18 +github.com/go-logr/logr +github.com/go-logr/logr/funcr +# github.com/go-logr/stdr v1.2.2 +## explicit; go 1.16 +github.com/go-logr/stdr # github.com/go-sql-driver/mysql v1.9.3 ## explicit; go 1.21.0 github.com/go-sql-driver/mysql @@ -15,18 +61,68 @@ github.com/iancoleman/strcase ## explicit; go 1.10 github.com/jmoiron/sqlx github.com/jmoiron/sqlx/reflectx -# github.com/lib/pq v1.11.2 +# github.com/lann/builder v0.0.0-20180802200727-47ae307949d0 +## explicit +github.com/lann/builder +# github.com/lann/ps v0.0.0-20150810152359-62de8c46ede0 +## explicit +github.com/lann/ps +# github.com/lib/pq v1.12.3 ## explicit; go 1.21 github.com/lib/pq github.com/lib/pq/internal/pgpass +github.com/lib/pq/internal/pgservice github.com/lib/pq/internal/pqsql +github.com/lib/pq/internal/pqtime github.com/lib/pq/internal/pqutil github.com/lib/pq/internal/proto github.com/lib/pq/oid +github.com/lib/pq/pqerror github.com/lib/pq/scram -# github.com/mattn/go-sqlite3 v1.14.34 -## explicit; go 1.19 +# github.com/mattn/go-sqlite3 v1.14.42 +## explicit; go 1.21 github.com/mattn/go-sqlite3 +# github.com/moby/docker-image-spec v1.3.1 +## explicit; go 1.18 +github.com/moby/docker-image-spec/specs-go/v1 +# github.com/moby/moby/api v1.54.1 +## explicit; go 1.24 +github.com/moby/moby/api/pkg/stdcopy +github.com/moby/moby/api/types +github.com/moby/moby/api/types/blkiodev +github.com/moby/moby/api/types/build +github.com/moby/moby/api/types/checkpoint +github.com/moby/moby/api/types/common +github.com/moby/moby/api/types/container +github.com/moby/moby/api/types/events +github.com/moby/moby/api/types/image +github.com/moby/moby/api/types/jsonstream +github.com/moby/moby/api/types/mount +github.com/moby/moby/api/types/network +github.com/moby/moby/api/types/plugin +github.com/moby/moby/api/types/registry +github.com/moby/moby/api/types/storage +github.com/moby/moby/api/types/swarm +github.com/moby/moby/api/types/system +github.com/moby/moby/api/types/volume +# github.com/moby/moby/client v0.4.0 +## explicit; go 1.24 +github.com/moby/moby/client +github.com/moby/moby/client/internal +github.com/moby/moby/client/internal/mod +github.com/moby/moby/client/internal/timestamp +github.com/moby/moby/client/pkg/versions +# github.com/opencontainers/go-digest v1.0.0 +## explicit; go 1.13 +github.com/opencontainers/go-digest +# github.com/opencontainers/image-spec v1.1.1 +## explicit; go 1.18 +github.com/opencontainers/image-spec/specs-go +github.com/opencontainers/image-spec/specs-go/v1 +# github.com/ory/dockertest/v4 v4.0.0-beta.4 +## explicit; go 1.25.5 +github.com/ory/dockertest/v4 +github.com/ory/dockertest/v4/internal/client # github.com/pmezard/go-difflib v1.0.0 ## explicit github.com/pmezard/go-difflib/difflib @@ -38,8 +134,46 @@ github.com/stretchr/objx github.com/stretchr/testify/assert github.com/stretchr/testify/assert/yaml github.com/stretchr/testify/mock -# golang.org/x/text v0.34.0 +# go.opentelemetry.io/auto/sdk v1.2.1 ## explicit; go 1.24.0 +go.opentelemetry.io/auto/sdk +go.opentelemetry.io/auto/sdk/internal/telemetry +# go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.68.0 +## explicit; go 1.25.0 +go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp +go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp/internal/request +go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp/internal/semconv +# go.opentelemetry.io/otel v1.43.0 +## explicit; go 1.25.0 +go.opentelemetry.io/otel +go.opentelemetry.io/otel/attribute +go.opentelemetry.io/otel/attribute/internal +go.opentelemetry.io/otel/attribute/internal/xxhash +go.opentelemetry.io/otel/baggage +go.opentelemetry.io/otel/codes +go.opentelemetry.io/otel/internal/baggage +go.opentelemetry.io/otel/internal/errorhandler +go.opentelemetry.io/otel/internal/global +go.opentelemetry.io/otel/propagation +go.opentelemetry.io/otel/semconv/v1.37.0 +go.opentelemetry.io/otel/semconv/v1.40.0 +go.opentelemetry.io/otel/semconv/v1.40.0/httpconv +# go.opentelemetry.io/otel/metric v1.43.0 +## explicit; go 1.25.0 +go.opentelemetry.io/otel/metric +go.opentelemetry.io/otel/metric/embedded +go.opentelemetry.io/otel/metric/noop +# go.opentelemetry.io/otel/trace v1.43.0 +## explicit; go 1.25.0 +go.opentelemetry.io/otel/trace +go.opentelemetry.io/otel/trace/embedded +go.opentelemetry.io/otel/trace/internal/telemetry +go.opentelemetry.io/otel/trace/noop +# golang.org/x/sys v0.43.0 +## explicit; go 1.25.0 +golang.org/x/sys/windows +# golang.org/x/text v0.36.0 +## explicit; go 1.25.0 golang.org/x/text/cases golang.org/x/text/internal golang.org/x/text/internal/language